Taskwarrior Documentation
repository·develop·Indexed 26 days ago
https://github.com/gothenburgbitfactory/taskwarriorA feature-rich, portable command-line task management utility. This documentation covers general usage, installation across Linux, macOS, and Windows, and detailed development guides including build workflows with CMake, C++ and Rust coding styles, and the integration with the TaskChampion storage backend.
What's inside Taskwarrior
- Taskwarrior is a command line task list management utility featuring a wide range of capabilities. It is designed as a portable open source project and supports an extensive ecosystem of tools, hooks, and extensions.
Locate Taskwarrior documentation
developTaskwarrior documentation is distributed in several formats and locations depending on your needs:
- Manual Pages: The source for manual pages is located in the
man/directory. - Configuration Files (rcfiles): Configuration templates and rcfiles are located in the
rc/directory. These are typically installed to/usr/share/doc/task/rcor an equivalent system path. - Reference Documentation: General reference documentation is located in the
ref/directory. These are typically installed to/usr/share/doc/taskor an equivalent system path.
- Manual Pages: The source for manual pages is located in the
Access Taskwarrior documentation
developFor general user documentation, guides, and manuals, visit the official Taskwarrior website at https://taskwarrior.org. The documentation in thedoc/devel/directory is intended specifically for development purposes.Follow the Taskwarrior C++ coding style
developThe C++ coding style for Taskwarrior is based on the Google C++ Style Guide, with minor modifications to the line length requirements.Understand the Taskwarrior and TaskChampion relationship
developSince the 3.0 release, Taskwarrior utilizes TaskChampion for task data management. If you are developing features related to data storage or task management, you should consult the TaskChampion documentation:
- Repository: https://github.com/GothenburgBitFactory/taskchampion/
- TaskChampion Book: https://gothenburgbitfactory.github.io/taskchampion/
- TaskChampion API Documentation: https://docs.rs/taskchampion
Understand the TaskChampion storage backend
developTaskChampion is a Rust library that provides the storage backend for Taskwarrior (as of version 3.0.0). It manages "replicas" containing user tasks and defines an abstract data model for them. TaskChampion provides a Rust API for manipulating replicas and includes a sync server implementation for synchronizing replicas across different locations. Other applications can use TaskChampion as a task management interface independently of Taskwarrior.Understand the Taskserver Sync Algorithm
developThe Taskserver uses a sync algorithm to merge task changes from multiple sources (e.g., local machines and the server) into a single, conflict-free state. The algorithm functions similarly to an SCM (Source Control Management) rebase.
Key concepts:
- Deltas: A change is represented as a delta ($d$), which is the transform applied to a base task ($T_0$) to reach a new state ($T_1$). Formula: $d_1 = T_1 - T_0$.
- Two-Branch Case: When changes occur simultaneously on a client and the server, the algorithm treats them as two parallel sequences starting from the same base task.
- Ordering: Because deltas are not commutative (the order of application matters), the Taskserver uses the task's last modified time metadata to determine the correct sequence of application.
- Serial Processing: Multiple client sync requests are processed serially, meaning the algorithm only ever needs to resolve a two-branch case at any given moment.
Understand Taskwarrior recurrence terminology
developThe recurrence system uses specific terminology to manage recurring tasks:
- Template: The hidden task that defines the recurrence rules (formerly called
parent). - Synthesis: The process of generating new recurring task instances when necessary.
- Instances: The individual tasks generated from a template.
- Index: The zero-based, monotonically increasing number of an instance.
- Drift: Accumulated errors in time that can cause due dates to shift for recurring tasks.
- rtype: The recurrence type (flavor) of the task.
- Template: The hidden task that defines the recurrence rules (formerly called
Run the Taskwarrior test suite
developThe test suite is managed via
ctest. Before running tests, you must build both thetask_executableand thetest_runnertarget.Test Execution Commands:
- Run all tests:
ctest --test-dir build - Parallel execution: Use
-j <number-of-jobs>to run tests in parallel. - Filter by regex: Use
-R <regex>to run only tests matching a specific pattern (e.g.,-R cppfor C++ tests). - Handle failures: It is recommended to use
--output-on-failurefor verbose error reporting and--rerun-failedto retry only failed tests. - Debug sporadic failures: Use
--repeat-until-fail <count>to run a specific test multiple times to catch intermittent issues.
- Run all tests:
Set up automatic code formatting with pre-commit
developTaskwarrior uses
pre-committo automatically applyclang-format(for C++) andblack(for Python) to ensure code consistency. To set up these hooks locally, installpre-commitvia pip and then install the git hooks.pip install pre-commit pre-commit installBuild Taskwarrior from source
developPerform an out-of-source build using CMake. The primary executable is located at
build/src/taskafter a successful build.Basic Build Workflow:
- Clone the repository and initialize submodules.
- Configure the build directory with a specific build type (e.g.,
RelWithDebInfo,Release, orDebug). - Build the project.
Build Options:
- Specific Target: To build only the
taskexecutable, use the--target task_executableflag. - Parallel Build: Use
-j <number-of-jobs>to speed up the build process. - Clang Compiler: To force the use of
clangandclang++, configure a separate build directory (e.g.,build-clang) using theCMAKE_C_COMPILERandCMAKE_CXX_COMPILERflags.
Format Rust code with rustfmt
developRust code in this project should follow general Rust style guidelines and be formatted usingrustfmt.