@bicorne/task-flow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/SKILL.md +250 -0
- package/assets/.harnessrc +10 -0
- package/assets/PHASE-task.json.example +50 -0
- package/assets/design.md +69 -0
- package/assets/hooks.json +15 -0
- package/assets/product-requirement.md +82 -0
- package/assets/schema.json +127 -0
- package/assets/tasks.md +26 -0
- package/dist/commands/analyze.d.ts +32 -0
- package/dist/commands/analyze.js +338 -0
- package/dist/commands/archive.d.ts +11 -0
- package/dist/commands/archive.js +53 -0
- package/dist/commands/design.d.ts +38 -0
- package/dist/commands/design.js +492 -0
- package/dist/commands/extract.d.ts +31 -0
- package/dist/commands/extract.js +477 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.js +165 -0
- package/dist/commands/merge/index.d.ts +17 -0
- package/dist/commands/merge/index.js +322 -0
- package/dist/commands/merge/merger.d.ts +18 -0
- package/dist/commands/merge/merger.js +151 -0
- package/dist/commands/merge/types.d.ts +67 -0
- package/dist/commands/merge/types.js +6 -0
- package/dist/commands/merge/validators.d.ts +14 -0
- package/dist/commands/merge/validators.js +147 -0
- package/dist/commands/merge.d.ts +7 -0
- package/dist/commands/merge.js +15 -0
- package/dist/commands/start.d.ts +32 -0
- package/dist/commands/start.js +265 -0
- package/dist/commands/status.d.ts +15 -0
- package/dist/commands/status.js +143 -0
- package/dist/commands/sync.d.ts +11 -0
- package/dist/commands/sync.js +58 -0
- package/dist/commands/tasks-gen/doc-parser.d.ts +7 -0
- package/dist/commands/tasks-gen/doc-parser.js +259 -0
- package/dist/commands/tasks-gen/generators.d.ts +33 -0
- package/dist/commands/tasks-gen/generators.js +141 -0
- package/dist/commands/tasks-gen/index.d.ts +30 -0
- package/dist/commands/tasks-gen/index.js +345 -0
- package/dist/commands/tasks-gen/parsers.d.ts +29 -0
- package/dist/commands/tasks-gen/parsers.js +272 -0
- package/dist/commands/tasks-gen/templates.d.ts +8 -0
- package/dist/commands/tasks-gen/templates.js +37 -0
- package/dist/commands/tasks-gen/types.d.ts +71 -0
- package/dist/commands/tasks-gen/types.js +17 -0
- package/dist/commands/tasks-gen/validators.d.ts +14 -0
- package/dist/commands/tasks-gen/validators.js +54 -0
- package/dist/commands/tasks.d.ts +9 -0
- package/dist/commands/tasks.js +22 -0
- package/dist/commands/worktree.d.ts +28 -0
- package/dist/commands/worktree.js +275 -0
- package/dist/hooks/check-prd-exists.d.ts +20 -0
- package/dist/hooks/check-prd-exists.js +61 -0
- package/dist/hooks/check-worktree-conflict.d.ts +34 -0
- package/dist/hooks/check-worktree-conflict.js +107 -0
- package/dist/hooks/hook-runner/executor.d.ts +18 -0
- package/dist/hooks/hook-runner/executor.js +143 -0
- package/dist/hooks/hook-runner/index.d.ts +64 -0
- package/dist/hooks/hook-runner/index.js +220 -0
- package/dist/hooks/hook-runner/loader.d.ts +23 -0
- package/dist/hooks/hook-runner/loader.js +126 -0
- package/dist/hooks/hook-runner/types.d.ts +59 -0
- package/dist/hooks/hook-runner/types.js +6 -0
- package/dist/hooks/hook-runner.d.ts +9 -0
- package/dist/hooks/hook-runner.js +30 -0
- package/dist/hooks/phase-complete-detector.d.ts +35 -0
- package/dist/hooks/phase-complete-detector.js +203 -0
- package/dist/hooks/phase-gate-validator.d.ts +76 -0
- package/dist/hooks/phase-gate-validator.js +407 -0
- package/dist/hooks/save-checkpoint.d.ts +43 -0
- package/dist/hooks/save-checkpoint.js +144 -0
- package/dist/hooks/start-mcp-servers.d.ts +50 -0
- package/dist/hooks/start-mcp-servers.js +75 -0
- package/dist/hooks/stop-mcp-servers.d.ts +40 -0
- package/dist/hooks/stop-mcp-servers.js +58 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +238 -0
- package/dist/lib/archive.d.ts +31 -0
- package/dist/lib/archive.js +226 -0
- package/dist/lib/config.d.ts +93 -0
- package/dist/lib/config.js +251 -0
- package/dist/lib/constants.d.ts +222 -0
- package/dist/lib/constants.js +247 -0
- package/dist/lib/interactive.d.ts +31 -0
- package/dist/lib/interactive.js +166 -0
- package/dist/lib/mcp-client.d.ts +156 -0
- package/dist/lib/mcp-client.js +370 -0
- package/dist/lib/state.d.ts +119 -0
- package/dist/lib/state.js +293 -0
- package/dist/slash/executor.d.ts +22 -0
- package/dist/slash/executor.js +259 -0
- package/dist/slash/index.d.ts +11 -0
- package/dist/slash/index.js +45 -0
- package/dist/slash/parser.d.ts +24 -0
- package/dist/slash/parser.js +101 -0
- package/dist/slash/registry.d.ts +22 -0
- package/dist/slash/registry.js +155 -0
- package/dist/spec/openspec-to-task/builders.d.ts +107 -0
- package/dist/spec/openspec-to-task/builders.js +138 -0
- package/dist/spec/openspec-to-task/index.d.ts +20 -0
- package/dist/spec/openspec-to-task/index.js +182 -0
- package/dist/spec/openspec-to-task/parsers.d.ts +65 -0
- package/dist/spec/openspec-to-task/parsers.js +232 -0
- package/dist/spec/openspec-to-task/types.d.ts +49 -0
- package/dist/spec/openspec-to-task/types.js +6 -0
- package/dist/spec/sync-openspec-to-task.d.ts +7 -0
- package/dist/spec/sync-openspec-to-task.js +21 -0
- package/dist/spec/sync-task-to-openspec.d.ts +27 -0
- package/dist/spec/sync-task-to-openspec.js +288 -0
- package/dist/types/ai-context.d.ts +108 -0
- package/dist/types/ai-context.js +9 -0
- package/package.json +66 -0
- package/references/AI-CONVERSATION-TUTORIAL.md +270 -0
- package/references/CLI-TUTORIAL.md +447 -0
- package/references/GIT-WORKTREE-SOP.md +109 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sam Xu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @bicorne/task-flow
|
|
2
|
+
|
|
3
|
+
A git worktree-based parallel task execution system for zero-conflict multi-task development.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install from npm (recommended)
|
|
9
|
+
npm install -g @bicorne/task-flow
|
|
10
|
+
|
|
11
|
+
# Or use via npx
|
|
12
|
+
npx @bicorne/task-flow init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Requirements:**
|
|
16
|
+
|
|
17
|
+
| Dependency | Version | Description |
|
|
18
|
+
|------------|---------|-------------|
|
|
19
|
+
| **Node.js** | >= 22.11.0 | Required for CLI execution |
|
|
20
|
+
| **Git** | >= 2.17 | Required for worktree functionality |
|
|
21
|
+
| **Bash** | >= 4.0 | Required for bootstrap scripts |
|
|
22
|
+
|
|
23
|
+
**Git Configuration (for worktree tests):**
|
|
24
|
+
```bash
|
|
25
|
+
git config --global user.name "Your Name"
|
|
26
|
+
git config --global user.email "your@email.com"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### Step 1: Initialize Task Flow
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
task-flow init
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This creates:
|
|
38
|
+
- `.harness/` - Root directory for harness state
|
|
39
|
+
- `.harness/state.json` - Current state file
|
|
40
|
+
- `.harnessrc.example` - Configuration template
|
|
41
|
+
|
|
42
|
+
### Step 2: Create PRD Document
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
task-flow extract --change my-feature
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This creates:
|
|
49
|
+
- `spec/changes/my-feature/product-requirement.md` - PRD document
|
|
50
|
+
|
|
51
|
+
### Step 3: Edit PRD Document Manually
|
|
52
|
+
|
|
53
|
+
Edit `spec/changes/my-feature/product-requirement.md` to describe your change:
|
|
54
|
+
- Project background and goals
|
|
55
|
+
- Users and scenarios
|
|
56
|
+
- Global design and architecture
|
|
57
|
+
- Detailed functional requirements
|
|
58
|
+
- Non-functional requirements
|
|
59
|
+
- Launch and operations plan
|
|
60
|
+
|
|
61
|
+
### Step 4: Generate Design
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
task-flow design --change my-feature
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This generates:
|
|
68
|
+
- `spec/changes/my-feature/design.md` - Technical specification
|
|
69
|
+
|
|
70
|
+
### Step 5: Generate Tasks
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
task-flow tasks --change my-feature
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This generates:
|
|
77
|
+
- `spec/changes/my-feature/tasks.md` - Task list
|
|
78
|
+
- `spec/changes/my-feature/tasks/PHASE-*.json` - Individual task files
|
|
79
|
+
- `spec/changes/my-feature/manifest.json` - Execution config
|
|
80
|
+
|
|
81
|
+
### Step 6: Create Worktree
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
task-flow worktree --change my-feature
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This creates:
|
|
88
|
+
- `.worktrees/harness-feat-my-feature/` - Isolated worktree
|
|
89
|
+
- `.harness/` symlink in worktree
|
|
90
|
+
|
|
91
|
+
## Commands
|
|
92
|
+
|
|
93
|
+
| Command | Description |
|
|
94
|
+
|---------|-------------|
|
|
95
|
+
| `init` | Initialize task flow in current project |
|
|
96
|
+
| `extract` | Extract project requirements and generate PRD document |
|
|
97
|
+
| `design` | Generate design.md from product-requirement.md |
|
|
98
|
+
| `tasks` | Generate tasks.md and PHASE-*.json files |
|
|
99
|
+
| `worktree` | Create isolated git worktree |
|
|
100
|
+
| `status` | Show current task and phase status |
|
|
101
|
+
| `archive` | Archive current task state |
|
|
102
|
+
| `merge` | Merge completed worktree back to main |
|
|
103
|
+
| `sync` | Sync task execution status to spec |
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
### Environment Variables
|
|
108
|
+
|
|
109
|
+
| Variable | Default | Description |
|
|
110
|
+
|----------|---------|-------------|
|
|
111
|
+
| `HARNESS_ROOT` | `.harness` | Root directory for harness state |
|
|
112
|
+
| `HARNESS_WORKTREES_DIR` | `.worktrees` | Directory for worktree checkouts |
|
|
113
|
+
| `HARNESS_CONFIG_FILE` | `.harnessrc` | Path to config file |
|
|
114
|
+
| `HARNESS_SPEC_ROOT` | `spec` | Root directory for spec files |
|
|
115
|
+
|
|
116
|
+
### Config File (`.harnessrc`)
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"harnessRoot": ".harness",
|
|
121
|
+
"worktreesDir": ".worktrees",
|
|
122
|
+
"tasksDir": "tasks",
|
|
123
|
+
"snapshotsDir": "snapshots",
|
|
124
|
+
"archiveDir": "archive",
|
|
125
|
+
"reportsDir": "reports",
|
|
126
|
+
"plansDir": "plans",
|
|
127
|
+
"specRoot": "spec"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Directory Structure
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
spec/
|
|
135
|
+
├── changes/
|
|
136
|
+
│ └── <change-name>/
|
|
137
|
+
│ ├── product-requirement.md # 产品需求文档(AI 生成)
|
|
138
|
+
│ ├── design.md # 技术规格(可选,AI 生成)
|
|
139
|
+
│ ├── tasks.md # 任务清单(AI 生成)
|
|
140
|
+
│ ├── tasks/ # 多阶段任务 JSON
|
|
141
|
+
│ │ ├── PHASE-1-1-1.json
|
|
142
|
+
│ │ ├── PHASE-1-1-2.json
|
|
143
|
+
│ │ └── ...
|
|
144
|
+
│ └── manifest.json # 执行配置
|
|
145
|
+
├── skills.json # 技能工具注册(可选)
|
|
146
|
+
└── mcp.json # MCP 工具注册(可选)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Tool Registration
|
|
150
|
+
|
|
151
|
+
### skills.json
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"version": "1.0",
|
|
156
|
+
"skills": [
|
|
157
|
+
{
|
|
158
|
+
"name": "project-scaffold",
|
|
159
|
+
"description": "项目工程脚手架 skill",
|
|
160
|
+
"path": ".trae/skills/scaffold",
|
|
161
|
+
"enabled": true
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### mcp.json
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"version": "1.0",
|
|
172
|
+
"mcpServers": [
|
|
173
|
+
{
|
|
174
|
+
"name": "component-library",
|
|
175
|
+
"description": "组件库知识库 MCP",
|
|
176
|
+
"command": "node",
|
|
177
|
+
"args": ["mcp-server.js"],
|
|
178
|
+
"enabled": true
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Workflow
|
|
185
|
+
|
|
186
|
+
### New Slash Command Workflow (v2)
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
extract → design → tasks → worktree → implement → review → merge
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Architecture
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
harness-task-flow/
|
|
196
|
+
├── src/
|
|
197
|
+
│ ├── index.ts # CLI entry point
|
|
198
|
+
│ ├── commands/ # Command implementations
|
|
199
|
+
│ │ ├── init.ts
|
|
200
|
+
│ │ ├── extract.ts # Extract requirements → PRD
|
|
201
|
+
│ │ ├── design.ts # Analyze PRD → tech spec (optional)
|
|
202
|
+
│ │ ├── tasks.ts # Generate PHASE-*.json task files
|
|
203
|
+
│ │ ├── worktree.ts # Create isolated worktree
|
|
204
|
+
│ │ ├── status.ts
|
|
205
|
+
│ │ ├── archive.ts
|
|
206
|
+
│ │ ├── merge.ts
|
|
207
|
+
│ │ └── sync.ts
|
|
208
|
+
│ ├── lib/ # Core utilities
|
|
209
|
+
│ │ ├── config.ts
|
|
210
|
+
│ │ ├── state.ts
|
|
211
|
+
│ │ ├── archive.ts
|
|
212
|
+
│ │ └── tool-registry.ts
|
|
213
|
+
│ ├── hooks/ # Event hooks
|
|
214
|
+
│ │ ├── hook-runner.ts
|
|
215
|
+
│ │ ├── check-prd-exists.ts
|
|
216
|
+
│ │ ├── phase-gate-validator.ts
|
|
217
|
+
│ │ ├── phase-complete-detector.ts
|
|
218
|
+
│ │ ├── save-checkpoint.ts
|
|
219
|
+
│ │ └── check-worktree-conflict.ts
|
|
220
|
+
│ └── spec/ # Spec integration
|
|
221
|
+
│ ├── sync-openspec-to-task.ts
|
|
222
|
+
│ └── sync-task-to-openspec.ts
|
|
223
|
+
├── assets/ # File templates
|
|
224
|
+
│ ├── schema.json # Task JSON schema
|
|
225
|
+
│ ├── product-requirement.md # PRD template
|
|
226
|
+
│ ├── design.md # Tech spec template
|
|
227
|
+
│ └── tasks.md # Tasks template
|
|
228
|
+
├── SKILL.md
|
|
229
|
+
└── package.json
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Install dependencies
|
|
236
|
+
pnpm install
|
|
237
|
+
|
|
238
|
+
# Run tests
|
|
239
|
+
pnpm test
|
|
240
|
+
|
|
241
|
+
# Lint
|
|
242
|
+
pnpm lint
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT License - See LICENSE file for details.
|
|
248
|
+
|
|
249
|
+
## Links
|
|
250
|
+
|
|
251
|
+
- [Agent Skills Specification](https://agentskills.io/specification)
|
|
252
|
+
- [Task Flow](https://github.com/didengren/harness-task-flow)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: harness-task-flow
|
|
3
|
+
description: |
|
|
4
|
+
需求分析与任务拆分工具。帮助 AI 梳理用户需求生成 PRD 文档、编写技术规格、
|
|
5
|
+
拆分多阶段任务文件,并通过 Git worktree 实现零冲突并行开发。适用于新功能开发、
|
|
6
|
+
Bug 修复、代码重构等场景。
|
|
7
|
+
license: MIT
|
|
8
|
+
compatibility: Node.js >= 24.14.0, Git >= 2.17
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Task Flow — AI Skill
|
|
12
|
+
|
|
13
|
+
基于 Git worktree 的并行任务执行系统,让 AI 能够零冲突地多任务开发。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 核心概念
|
|
18
|
+
|
|
19
|
+
### AI 调用模型
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
AI 分析项目 → 生成 context.json → 调用 CLI 生成文档 → AI 审查并填充 → 执行任务
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **AI 是"大脑"**:理解项目、做决策、填充内容
|
|
26
|
+
- **CLI 是"手"**:文件操作、格式转换、状态管理
|
|
27
|
+
|
|
28
|
+
### Context 协议
|
|
29
|
+
|
|
30
|
+
AI 在调用命令前生成 context JSON,传递项目理解:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
interface AiContext {
|
|
34
|
+
version: '1.0';
|
|
35
|
+
project: {
|
|
36
|
+
name: string;
|
|
37
|
+
type?: 'library' | 'application' | 'service' | 'cli' | 'monorepo';
|
|
38
|
+
techStack?: { language?: string; framework?: string; runtime?: string; };
|
|
39
|
+
};
|
|
40
|
+
analysis?: {
|
|
41
|
+
architectureSummary?: string;
|
|
42
|
+
coreModules?: Array<{ name: string; path: string; description: string }>;
|
|
43
|
+
risks?: string[];
|
|
44
|
+
};
|
|
45
|
+
task?: {
|
|
46
|
+
type?: 'feat' | 'fix' | 'refactor' | 'test' | 'docs' | 'chore';
|
|
47
|
+
priority?: 'high' | 'medium' | 'low';
|
|
48
|
+
affectedFiles?: string[];
|
|
49
|
+
constraints?: string[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 工作流
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
analyze → extract → design → tasks → worktree → implement → review → merge
|
|
60
|
+
│ │ │ │ │
|
|
61
|
+
│ │ │ │ └── 创建隔离 git worktree
|
|
62
|
+
│ │ │ └── 生成 PHASE-*.json 任务文件
|
|
63
|
+
│ │ └── 分析 PRD 生成技术规格(可选)
|
|
64
|
+
│ └── 提取需求生成 PRD 文档
|
|
65
|
+
└── 自动扫描项目结构,生成 context.json 骨架
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 命令速查
|
|
71
|
+
|
|
72
|
+
### Slash Commands(推荐)
|
|
73
|
+
|
|
74
|
+
类似 OpenSpec 的 `/opsx:propose` 模式,用户在 AI 对话中直接输入 `/tf:<command>`,AI 识别后自动执行对应操作:
|
|
75
|
+
|
|
76
|
+
| Slash Command | 说明 | AI 执行的操作 |
|
|
77
|
+
|---------------|------|---------------|
|
|
78
|
+
| `/tf:propose <name>` | 一键创建变更提案 | extract → design → tasks |
|
|
79
|
+
| `/tf:apply <name>` | 应用并创建工作区 | worktree |
|
|
80
|
+
| `/tf:archive --task-id <id>` | 归档已完成任务 | archive → sync |
|
|
81
|
+
| `/tf:init` | 初始化项目 | init |
|
|
82
|
+
| `/tf:status` | 显示当前状态 | status |
|
|
83
|
+
| `/tf:extract <name>` | 生成 PRD 文档 | extract |
|
|
84
|
+
| `/tf:design <name>` | 生成技术设计 | design |
|
|
85
|
+
| `/tf:tasks <name>` | 生成任务文件 | tasks |
|
|
86
|
+
| `/tf:worktree <name>` | 创建隔离工作区 | worktree |
|
|
87
|
+
| `/tf:merge <id>` | 合并代码 | merge |
|
|
88
|
+
| `/tf:sync --task-id <id>` | 同步状态到 spec | sync |
|
|
89
|
+
|
|
90
|
+
> **使用方式**:直接在 AI 对话中输入 `/tf:init` 即可,无需加 `task-flow` 前缀。
|
|
91
|
+
> AI 读取本 Skill 文档后,会自动识别并执行对应的 CLI 命令。
|
|
92
|
+
|
|
93
|
+
### 传统 CLI 命令
|
|
94
|
+
|
|
95
|
+
| 命令 | 说明 | 关键参数 |
|
|
96
|
+
|------|------|----------|
|
|
97
|
+
| `init` | 初始化项目 | `--force` |
|
|
98
|
+
| `analyze` | 扫描项目生成 context | `--output <path>` |
|
|
99
|
+
| `extract` | 生成 PRD 文档 | `--change <name> --context-file <path>` |
|
|
100
|
+
| `design` | 生成技术设计 | `--change <name> --context-file <path> --skip-prompt` |
|
|
101
|
+
| `tasks` | 生成任务文件 | `--change <name> --yes` |
|
|
102
|
+
| `worktree` | 创建隔离工作区 | `--change <name> --yes` |
|
|
103
|
+
| `status` | 显示当前状态 | - |
|
|
104
|
+
| `merge` | 合并代码 | `<task-id> --dry-run` |
|
|
105
|
+
| `archive` | 归档任务 | `--task-id <id> --event <event>` |
|
|
106
|
+
|
|
107
|
+
详细用法见 [CLI 使用教程](references/CLI-TUTORIAL.md)。
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## AI 调用示例
|
|
112
|
+
|
|
113
|
+
### 使用 Slash Commands(推荐)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# 1. 初始化
|
|
117
|
+
/tf:init
|
|
118
|
+
|
|
119
|
+
# 2. 一键创建变更提案(extract + design + tasks)
|
|
120
|
+
/tf:propose add-oauth
|
|
121
|
+
|
|
122
|
+
# 3. AI 审查并编辑生成的 PRD 和设计文档
|
|
123
|
+
|
|
124
|
+
# 4. 应用并创建工作区
|
|
125
|
+
/tf:apply add-oauth
|
|
126
|
+
|
|
127
|
+
# 5. 在工作区中编码实现
|
|
128
|
+
cd .worktrees/harness-feat-add-oauth
|
|
129
|
+
|
|
130
|
+
# 6. 验证并合并
|
|
131
|
+
pnpm build && pnpm test && pnpm lint
|
|
132
|
+
cd ../..
|
|
133
|
+
/tf:merge add-oauth
|
|
134
|
+
|
|
135
|
+
# 7. 归档
|
|
136
|
+
/tf:archive --task-id add-oauth
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 使用传统 CLI 命令
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# 1. 初始化
|
|
143
|
+
task-flow init
|
|
144
|
+
|
|
145
|
+
# 2. 扫描项目
|
|
146
|
+
task-flow analyze --output /tmp/context.json
|
|
147
|
+
|
|
148
|
+
# 3. AI 补充 context.json(analysis、task 字段)
|
|
149
|
+
|
|
150
|
+
# 4. 生成文档
|
|
151
|
+
task-flow extract --change add-oauth --context-file /tmp/context.json
|
|
152
|
+
task-flow design --change add-oauth --context-file /tmp/context.json
|
|
153
|
+
|
|
154
|
+
# 5. AI 编辑生成的 PRD 和设计文档
|
|
155
|
+
|
|
156
|
+
# 6. 生成任务并创建工作区
|
|
157
|
+
task-flow tasks --change add-oauth --yes
|
|
158
|
+
task-flow worktree --change add-oauth --yes
|
|
159
|
+
|
|
160
|
+
# 7. 在工作区中编码实现
|
|
161
|
+
cd .worktrees/harness-feat-add-oauth
|
|
162
|
+
|
|
163
|
+
# 8. 验证并合并
|
|
164
|
+
pnpm build && pnpm test && pnpm lint
|
|
165
|
+
cd ../..
|
|
166
|
+
task-flow merge add-oauth
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
完整对话示例见 [AI 对话教程](references/AI-CONVERSATION-TUTORIAL.md)。
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Hooks 配置
|
|
174
|
+
|
|
175
|
+
在 `.harness/hooks.json` 中配置生命周期钩子:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"version": "1.0",
|
|
180
|
+
"hooks": {
|
|
181
|
+
"pre-design": [
|
|
182
|
+
{ "name": "check-prd-exists", "script": "src/hooks/check-prd-exists.js", "enabled": true }
|
|
183
|
+
],
|
|
184
|
+
"pre-worktree": [
|
|
185
|
+
{ "name": "check-worktree-conflict", "script": "src/hooks/check-worktree-conflict.js", "enabled": true }
|
|
186
|
+
],
|
|
187
|
+
"post-task-complete": [
|
|
188
|
+
{ "name": "phase-gate-validator", "script": "src/hooks/phase-gate-validator.js", "enabled": true }
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 最佳实践
|
|
197
|
+
|
|
198
|
+
### 推荐模式
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
task-flow analyze --output context.json
|
|
202
|
+
# AI 补充 context.json
|
|
203
|
+
task-flow extract --change <name> --context-file context.json
|
|
204
|
+
task-flow design --change <name> --context-file context.json
|
|
205
|
+
# AI 编辑生成的文档
|
|
206
|
+
task-flow tasks --change <name> --yes
|
|
207
|
+
task-flow worktree --change <name> --yes
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 避免
|
|
211
|
+
|
|
212
|
+
| 反模式 | 正确做法 |
|
|
213
|
+
|--------|----------|
|
|
214
|
+
| 用 `--input` 传超长文本 | 用 `--context-file` 传结构化 JSON |
|
|
215
|
+
| 跳过 PRD 审查直接 tasks | AI 先审查并编辑 PRD |
|
|
216
|
+
| 单 worktree 多 Agent | 每任务独立 worktree |
|
|
217
|
+
| 跳过验证阶段 | 始终通过 build/test/lint |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 参考文档
|
|
222
|
+
|
|
223
|
+
- [AI 对话教程](references/AI-CONVERSATION-TUTORIAL.md) - 人类与 AI 对话完成开发任务
|
|
224
|
+
- [CLI 使用教程](references/CLI-TUTORIAL.md) - 人类直接使用 CLI
|
|
225
|
+
- [Git Worktree SOP](references/GIT-WORKTREE-SOP.md) - Git worktree 操作流程
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 目录结构
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
project/
|
|
233
|
+
├── .harness/
|
|
234
|
+
│ ├── state.json # 当前状态
|
|
235
|
+
│ ├── hooks.json # Hooks 配置
|
|
236
|
+
│ └── archive/ # 归档任务
|
|
237
|
+
├── .worktrees/ # worktree 目录
|
|
238
|
+
├── spec/changes/<change-name>/
|
|
239
|
+
│ ├── product-requirement.md # PRD
|
|
240
|
+
│ ├── design.md # 技术设计
|
|
241
|
+
│ ├── tasks/ # PHASE-*.json
|
|
242
|
+
│ └── manifest.json # 执行配置
|
|
243
|
+
└── .harnessrc # 配置文件
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 许可证
|
|
249
|
+
|
|
250
|
+
MIT License
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "PHASE-1-1-1",
|
|
3
|
+
"type": "feat",
|
|
4
|
+
"title": "Example task title",
|
|
5
|
+
"priority": "medium",
|
|
6
|
+
"phase": 1,
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"docs_to_read": [
|
|
9
|
+
"spec/changes/change-name/proposal.md",
|
|
10
|
+
"spec/changes/change-name/design.md"
|
|
11
|
+
],
|
|
12
|
+
"spec": {
|
|
13
|
+
"description": "Detailed description of what this task should accomplish",
|
|
14
|
+
"files": [
|
|
15
|
+
"src/path/to/file1.ts",
|
|
16
|
+
"src/path/to/file2.ts"
|
|
17
|
+
],
|
|
18
|
+
"context": []
|
|
19
|
+
},
|
|
20
|
+
"acceptance_criteria": [
|
|
21
|
+
"Feature works as expected",
|
|
22
|
+
"Tests pass",
|
|
23
|
+
"Code follows project conventions"
|
|
24
|
+
],
|
|
25
|
+
"implementation": {
|
|
26
|
+
"steps": [
|
|
27
|
+
{
|
|
28
|
+
"step": "Step 1 description",
|
|
29
|
+
"details": "Optional details for this step"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"step": "Step 2 description",
|
|
33
|
+
"details": "Optional details for this step"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"notes": "Any additional notes for implementation"
|
|
37
|
+
},
|
|
38
|
+
"validation": {
|
|
39
|
+
"commands": [
|
|
40
|
+
"pnpm build",
|
|
41
|
+
"pnpm test",
|
|
42
|
+
"pnpm lint"
|
|
43
|
+
],
|
|
44
|
+
"manual_checks": [
|
|
45
|
+
"Verify UI renders correctly",
|
|
46
|
+
"Check error handling"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"status": "pending"
|
|
50
|
+
}
|
package/assets/design.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# 技术规格文档
|
|
2
|
+
|
|
3
|
+
## 文档基础信息
|
|
4
|
+
|
|
5
|
+
- **需求名称**: [待填写]
|
|
6
|
+
- **文档状态**: 草稿
|
|
7
|
+
- **技术负责人**: [待填写]
|
|
8
|
+
- **修订历史**:
|
|
9
|
+
- [日期] - v1.0 - 初始版本
|
|
10
|
+
|
|
11
|
+
## 技术选型
|
|
12
|
+
|
|
13
|
+
### 核心技术栈
|
|
14
|
+
<!-- 列出本次需求涉及的核心技术及选型理由 -->
|
|
15
|
+
|
|
16
|
+
### 新增依赖
|
|
17
|
+
<!-- 列出需要引入的新依赖库及其用途 -->
|
|
18
|
+
|
|
19
|
+
### 技术决策
|
|
20
|
+
<!-- 记录关键技术决策及其权衡 -->
|
|
21
|
+
|
|
22
|
+
## 架构设计
|
|
23
|
+
|
|
24
|
+
### 系统架构图
|
|
25
|
+
<!-- 提供系统架构图,展示各组件关系 -->
|
|
26
|
+
|
|
27
|
+
### 模块划分
|
|
28
|
+
<!-- 描述模块划分及职责边界 -->
|
|
29
|
+
|
|
30
|
+
### 数据流向
|
|
31
|
+
<!-- 描述核心数据流转路径 -->
|
|
32
|
+
|
|
33
|
+
## 接口设计
|
|
34
|
+
|
|
35
|
+
### API 接口
|
|
36
|
+
<!-- 列出需要新增或修改的 API 接口 -->
|
|
37
|
+
|
|
38
|
+
### 数据格式
|
|
39
|
+
<!-- 定义请求和响应的数据格式 -->
|
|
40
|
+
|
|
41
|
+
### 错误处理
|
|
42
|
+
<!-- 定义错误码和错误处理策略 -->
|
|
43
|
+
|
|
44
|
+
## 数据模型
|
|
45
|
+
|
|
46
|
+
### 数据库设计
|
|
47
|
+
<!-- 描述数据库表结构设计 -->
|
|
48
|
+
|
|
49
|
+
### 数据关系
|
|
50
|
+
<!-- 描述实体间的关系 -->
|
|
51
|
+
|
|
52
|
+
### 数据迁移
|
|
53
|
+
<!-- 描述数据迁移策略 -->
|
|
54
|
+
|
|
55
|
+
## 技术风险与缓解
|
|
56
|
+
|
|
57
|
+
### 已识别风险
|
|
58
|
+
<!-- 列出技术实现中的潜在风险 -->
|
|
59
|
+
|
|
60
|
+
### 缓解措施
|
|
61
|
+
<!-- 针对每个风险的缓解方案 -->
|
|
62
|
+
|
|
63
|
+
## 性能与扩展
|
|
64
|
+
|
|
65
|
+
### 性能要求
|
|
66
|
+
<!-- 描述性能指标和优化策略 -->
|
|
67
|
+
|
|
68
|
+
### 扩展性设计
|
|
69
|
+
<!-- 描述如何支持未来的扩展需求 -->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"pre-design": [],
|
|
5
|
+
"post-design": [],
|
|
6
|
+
"pre-planning": [],
|
|
7
|
+
"post-planning": [],
|
|
8
|
+
"pre-implementation": [],
|
|
9
|
+
"post-implementation": [],
|
|
10
|
+
"pre-review": [],
|
|
11
|
+
"post-review": [],
|
|
12
|
+
"pre-merge": [],
|
|
13
|
+
"post-merge": []
|
|
14
|
+
}
|
|
15
|
+
}
|