storage-taskwarrior

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Agent Purpose: Manage Taskwarrior tasks using the current project's git repository remote URL as a project ID.
Project ID Generation: Automatically slugified from git remote URL
  • Example:
    git@github.com:zenobi-us/dotfiles.git
    zenobi-us-dotfiles
  • Stored in Taskwarrior
    project
    attribute for easy filtering
Agent用途: 以当前项目Git仓库的远程URL作为项目ID,管理Taskwarrior任务。
项目ID生成: 自动将Git远程URL转换为短格式标识符
  • 示例:
    git@github.com:zenobi-us/dotfiles.git
    zenobi-us-dotfiles
  • 存储在Taskwarrior的
    project
    属性中,便于筛选

Core Capabilities

核心功能

1. Automatic Project ID Resolution

1. 自动解析项目ID

The agent automatically:
  1. Detects the git repository remote URL:
    git config --get remote.origin.url
  2. Extracts owner and repo:
    github.com:{owner}/{repo}.git
    {owner}-{repo}
  3. Uses this as the
    project
    filter for all task commands
  4. Allows manual override via environment variable:
    TASK_PROJECT_ID
该Agent会自动执行以下操作:
  1. 检测Git仓库的远程URL:
    git config --get remote.origin.url
  2. 提取所有者和仓库名:
    github.com:{owner}/{repo}.git
    {owner}-{repo}
  3. 将此作为所有任务命令的
    project
    筛选条件
  4. 允许通过环境变量
    TASK_PROJECT_ID
    手动覆盖

2. Task Listing & Search

2. 任务列表与搜索

List all tasks for this project:
bash
task project:$PROJECT_ID list
Search tasks by tags:
bash
task project:$PROJECT_ID +tag list
Filter by status:
bash
task project:$PROJECT_ID status:pending list
task project:$PROJECT_ID status:completed list
Filter by priority:
bash
task project:$PROJECT_ID priority:H list
task project:$PROJECT_ID priority:L list
Complex filtering:
bash
task project:$PROJECT_ID +bug priority:H status:pending list
列出当前项目的所有任务:
bash
task project:$PROJECT_ID list
按标签搜索任务:
bash
task project:$PROJECT_ID +tag list
按状态筛选:
bash
task project:$PROJECT_ID status:pending list
task project:$PROJECT_ID status:completed list
按优先级筛选:
bash
task project:$PROJECT_ID priority:H list
task project:$PROJECT_ID priority:L list
复杂筛选:
bash
task project:$PROJECT_ID +bug priority:H status:pending list

3. Task CRUD Operations

3. 任务CRUD操作

Add a new task:
bash
task project:$PROJECT_ID add "Task description" +tag priority:H
Create task with full attributes:
bash
task project:$PROJECT_ID add "Implementation task" project:$PROJECT_ID +feature +backend priority:M
Update existing task:
bash
task project:$PROJECT_ID 5 modify priority:H +urgent
task project:$PROJECT_ID 5 modify "New description" -old-tag +new-tag
Delete task:
bash
task project:$PROJECT_ID 5 delete
Mark task as done:
bash
task project:$PROJECT_ID 5 done
添加新任务:
bash
task project:$PROJECT_ID add "Task description" +tag priority:H
创建包含完整属性的任务:
bash
task project:$PROJECT_ID add "Implementation task" project:$PROJECT_ID +feature +backend priority:M
更新现有任务:
bash
task project:$PROJECT_ID 5 modify priority:H +urgent
task project:$PROJECT_ID 5 modify "New description" -old-tag +new-tag
删除任务:
bash
task project:$PROJECT_ID 5 delete
标记任务为已完成:
bash
task project:$PROJECT_ID 5 done

4. Task Analysis & Reporting

4. 任务分析与报告

View task statistics:
bash
task project:$PROJECT_ID stats
Show task summary by status:
bash
task project:$PROJECT_ID summary
List active tasks:
bash
task project:$PROJECT_ID active list
查看任务统计信息:
bash
task project:$PROJECT_ID stats
按状态显示任务摘要:
bash
task project:$PROJECT_ID summary
列出活跃任务:
bash
task project:$PROJECT_ID active list

5. Export & Import

5. 导出与导入

Export tasks to JSON:
bash
task project:$PROJECT_ID export > backup.json
Import tasks from JSON:
bash
task import backup.json
将任务导出为JSON:
bash
task project:$PROJECT_ID export > backup.json
从JSON导入任务:
bash
task import backup.json

Implementation Guidelines

实施指南

When implementing commands that use this agent:
  1. Always extract project ID first:
    • Run:
      git config --get remote.origin.url | sed -E 's/.*[:/]([^/]+)\/([^/.]+)(\.git)?$/\1-\2/'
    • Store in
      $PROJECT_ID
      variable
    • Allow override:
      ${TASK_PROJECT_ID:-$PROJECT_ID}
  2. All task operations must include project filter:
    • Use:
      task project:$PROJECT_ID [filter] [command]
    • Never run
      task [command]
      without project filter in automated scripts
  3. Handle edge cases:
    • No tasks found: Return empty list gracefully
    • Invalid project ID: Validate format (alphanumeric + dash only)
    • Missing .task directory: Initialize with
      task config report.next.labels ''
  4. Provide human-readable output:
    • Parse JSON export for programmatic use
    • Format list output with clear columns and highlighting
    • Show task counts in summaries
在实现使用该Agent的命令时:
  1. 始终先提取项目ID:
    • 执行:
      git config --get remote.origin.url | sed -E 's/.*[:/]([^/]+)\/([^/.]+)(\.git)?$/\1-\2/'
    • 存储在
      $PROJECT_ID
      变量中
    • 允许覆盖:
      ${TASK_PROJECT_ID:-$PROJECT_ID}
  2. 所有任务操作必须包含项目筛选条件:
    • 使用:
      task project:$PROJECT_ID [filter] [command]
    • 在自动化脚本中,切勿在不带项目筛选条件的情况下运行
      task [command]
  3. 处理边缘情况:
    • 未找到任务:优雅地返回空列表
    • 无效项目ID:验证格式(仅允许字母数字和连字符)
    • 缺少.task目录:使用
      task config report.next.labels ''
      初始化
  4. 提供易读的输出:
    • 解析JSON导出内容以用于程序化调用
    • 格式化列表输出,使用清晰的列和高亮显示
    • 在摘要中显示任务数量

Command Examples

命令示例

Search with Multiple Filters

多条件搜索

bash
undefined
bash
undefined

Find urgent bugs with high priority

查找高优先级的紧急Bug

task project:zenobi-us-dotfiles +bug priority:H list
task project:zenobi-us-dotfiles +bug priority:H list

Find pending tasks with high priority

查找高优先级的待处理任务

task project:zenobi-us-dotfiles status:pending priority:H +important list
undefined
task project:zenobi-us-dotfiles status:pending priority:H +important list
undefined

Batch Operations

批量操作

bash
undefined
bash
undefined

Mark all overdue tasks as waiting

将所有逾期任务标记为等待状态

task project:zenobi-us-dotfiles overdue modify +waiting
task project:zenobi-us-dotfiles overdue modify +waiting

Add same tag to multiple tasks

为多个任务添加相同标签

task project:zenobi-us-dotfiles 1,2,3 modify +reviewed
undefined
task project:zenobi-us-dotfiles 1,2,3 modify +reviewed
undefined

Complex Filtering

复杂筛选

bash
undefined
bash
undefined

Find tasks matching pattern

查找描述中包含Bug的任务

task project:zenobi-us-dotfiles 'description~Bug' list
task project:zenobi-us-dotfiles 'description~Bug' list

Combine filters with AND/OR

使用AND/OR组合筛选条件

task project:zenobi-us-dotfiles '(priority:H or status:pending)' list
undefined
task project:zenobi-us-dotfiles '(priority:H or status:pending)' list
undefined

Integration Points

集成点

This agent works with:
  • Taskwarrior: Primary task management backend
  • Git: Automatic project ID from repository metadata
  • OpenCode Commands:
    /project:do:task
    workflow integration
  • Bash/Scripts: Export/import for CI/CD automation
该Agent可与以下工具集成:
  • Taskwarrior:主要任务管理后端
  • Git:从仓库元数据自动获取项目ID
  • OpenCode Commands:与
    /project:do:task
    工作流集成
  • Bash/Scripts:通过导出/导入实现CI/CD自动化

Reference

参考资料

  • Taskwarrior Documentation: https://taskwarrior.org
  • Project filtering:
    task help | grep project
  • Full filter syntax:
    man taskfilter
    or
    task help usage
  • Taskwarrior文档:https://taskwarrior.org
  • 项目筛选:
    task help | grep project
  • 完整筛选语法:
    man taskfilter
    task help usage