TaskMaster Autonomous Workflow
【免费下载链接】claude-task-masterAn AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.项目地址: https://gitcode.com/GitHub_Trending/cl/claude-task-master
When working on tasks withtm autopilot:
Start workflow:
tm autopilot start <taskId>Loop until complete:
# Get next action NEXT=$(tm autopilot next --json) ACTION=$(echo $NEXT | jq -r '.action') SUBTASK=$(echo $NEXT | jq -r '.subtask.id') case $ACTION in red) # 1. Generate tests based on instructions # 2. Write test files # 3. Run tests yourself (you know the test command) npm test # or pytest, go test, cargo test, etc. # 4. Report results to TaskMaster tm autopilot complete red $SUBTASK --results="failed:3,passed:0" ;; green) # 1. Implement code to pass tests # 2. Write implementation files # 3. Run tests yourself npm test # 4. Report results to TaskMaster (include coverage if available) tm autopilot complete green $SUBTASK --results="passed:3,failed:0" --coverage="92" ;; commit) # TaskMaster handles git operations tm autopilot commit $SUBTASK ;; complete) echo "Workflow complete!" ;; esacState is preserved- you can stop/resume anytime with
tm autopilot resume
Important:You are responsible for:
- Running test commands (TaskMaster doesn't know your test framework)
- Parsing test output (passed/failed counts)
- Reporting accurate results
Via MCP:Useautopilot_*tools for the same workflow with better integration.
### 13.1 示例 AI 智能体提示词 ```markdown You are working autonomously on Task Master tasks using the autopilot workflow. Instructions: 1. Call `tm autopilot next --json` to get your next action 2. Read the action type and context 3. Execute the action: - **RED**: * Generate tests that fail initially * Run tests: `npm test` (or appropriate test command) * Report: `tm autopilot complete red <id> --results="failed:n,passed:n"` - **GREEN**: * Implement code to pass the tests * Run tests: `npm test` * Report: `tm autopilot complete green <id> --results="passed:n,failed:n" --coverage="nn"` - **COMMIT**: * Call: `tm autopilot commit <id>` (TaskMaster handles git) 4. Repeat until action is "complete" Always: - Follow TDD principles (RED → GREEN → COMMIT) - YOU run the tests (TaskMaster doesn't know test frameworks) - Report accurate test results (passed/failed counts) - Write minimal code to pass tests - Check `tm autopilot status` if unsure of current state You are responsible for: - Knowing which test command to run (npm test, pytest, go test, etc.) - Parsing test output to get pass/fail counts - Understanding the project's testing framework - Running tests after generating/implementing code TaskMaster is responsible for: - Validating your reported results make sense (RED should fail, GREEN should pass) - Creating properly formatted git commits - Managing workflow state and transitions ``` ## 十四、配置与 .gitignore ### 14.1 `.taskmaster/config.json`(版本化) ```json { "autopilot": { "enabled": true, "requireCleanWorkingTree": true, "commitTemplate": "{type}({scope}): {msg} (task {taskId})", "defaultCommitType": "feat", "maxGreenAttempts": 3, "testTimeout": 300000, "storage": { "location": "global", "basePath": "~/.taskmaster" } }, "test": { "runner": "auto", "coverageThresholds": { "lines": 80, "branches": 80, "functions": 80, "statements": 80 }, "targetedRunPattern": "**/*.test.js" }, "git": { "branchPattern": "{tag}/task-{id}-{slug}", "defaultRemote": "origin" } } ``` 参数要点:`requireCleanWorkingTree` 控制启动前是否强制要求工作区干净;`commitTemplate` 定义提交信息模板(与 [template-engine.ts](https://link.gitcode.com/i/022f58902ecd725d30984b0b90ba7ed0) 配合);`maxGreenAttempts` 是 GREEN 相位最大重试次数;`coverageThresholds` 的四维阈值(行 / 分支 / 函数 / 语句,默认 80%)与 TestResultValidator 的 `validateCoverage` 逻辑一一对应;`storage.basePath` 指定全局存储根目录。配置管理相关实现可参考 [config-manager.ts](https://link.gitcode.com/i/8e6b962b3ae187ff65ac8e11b6aadb0d) 与 [config-loader.service.ts](https://link.gitcode.com/i/f5295a65096cd09d753c7ef144dfc58a)。 ### 14.2 更新 `.gitignore`(保持项目干净) ```gitignore # TaskMaster runtime artifacts (stored globally, not needed in repo) .taskmaster/state/ .taskmaster/reports/ # Keep these versioned !.taskmaster/tasks/ !.taskmaster/config.json !.taskmaster/docs/ !.taskmaster/templates/【免费下载链接】claude-task-masterAn AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.项目地址: https://gitcode.com/GitHub_Trending/cl/claude-task-master
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考