specops 0.2.5 → 0.3.2
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/.opencode/agent/specops-codebase-mapper.md +764 -0
- package/.opencode/agent/specops-debugger.md +1246 -0
- package/.opencode/agent/specops-executor.md +475 -0
- package/.opencode/agent/specops-integration-checker.md +443 -0
- package/.opencode/agent/specops-phase-researcher.md +547 -0
- package/.opencode/agent/specops-plan-checker.md +690 -0
- package/.opencode/agent/specops-planner.md +581 -0
- package/.opencode/agent/specops-project-researcher.md +354 -0
- package/.opencode/agent/specops-research-synthesizer.md +242 -0
- package/.opencode/agent/specops-roadmapper.md +642 -0
- package/.opencode/agent/specops-work-verifier.md +573 -0
- package/.opencode/references/checkpoints.md +776 -0
- package/.opencode/references/continuation-format.md +249 -0
- package/.opencode/references/decimal-phase-calculation.md +65 -0
- package/.opencode/references/git-integration.md +248 -0
- package/.opencode/references/git-planning-commit.md +38 -0
- package/.opencode/references/model-profile-resolution.md +34 -0
- package/.opencode/references/model-profiles.md +92 -0
- package/.opencode/references/phase-argument-parsing.md +61 -0
- package/.opencode/references/planning-config.md +196 -0
- package/.opencode/references/questioning.md +145 -0
- package/.opencode/references/tdd.md +263 -0
- package/.opencode/references/ui-brand.md +160 -0
- package/.opencode/references/verification-patterns.md +612 -0
- package/.opencode/templates/DEBUG.md +164 -0
- package/.opencode/templates/UAT.md +180 -0
- package/.opencode/templates/VALIDATION.md +76 -0
- package/.opencode/templates/codebase/architecture.md +255 -0
- package/.opencode/templates/codebase/concerns.md +310 -0
- package/.opencode/templates/codebase/conventions.md +307 -0
- package/.opencode/templates/codebase/integrations.md +280 -0
- package/.opencode/templates/codebase/stack.md +186 -0
- package/.opencode/templates/codebase/structure.md +285 -0
- package/.opencode/templates/codebase/testing.md +480 -0
- package/.opencode/templates/context.md +221 -0
- package/.opencode/templates/continue-here.md +78 -0
- package/.opencode/templates/debug-subagent-prompt.md +91 -0
- package/.opencode/templates/discovery.md +147 -0
- package/.opencode/templates/milestone-archive.md +123 -0
- package/.opencode/templates/milestone.md +115 -0
- package/.opencode/templates/phase-prompt.md +333 -0
- package/.opencode/templates/planner-subagent-prompt.md +117 -0
- package/.opencode/templates/project.md +184 -0
- package/.opencode/templates/requirements.md +130 -0
- package/.opencode/templates/research-project/ARCHITECTURE.md +204 -0
- package/.opencode/templates/research-project/FEATURES.md +147 -0
- package/.opencode/templates/research-project/PITFALLS.md +200 -0
- package/.opencode/templates/research-project/STACK.md +120 -0
- package/.opencode/templates/research-project/SUMMARY.md +170 -0
- package/.opencode/templates/research.md +278 -0
- package/.opencode/templates/retrospective.md +54 -0
- package/.opencode/templates/roadmap.md +202 -0
- package/.opencode/templates/state.md +176 -0
- package/.opencode/templates/summary-complex.md +59 -0
- package/.opencode/templates/summary-minimal.md +41 -0
- package/.opencode/templates/summary-standard.md +48 -0
- package/.opencode/templates/summary.md +248 -0
- package/.opencode/templates/user-setup.md +311 -0
- package/.opencode/templates/verification-report.md +322 -0
- package/.opencode/workflows/add-phase.md +111 -0
- package/.opencode/workflows/add-tests.md +350 -0
- package/.opencode/workflows/add-todo.md +157 -0
- package/.opencode/workflows/audit-milestone.md +297 -0
- package/.opencode/workflows/check-todos.md +176 -0
- package/.opencode/workflows/cleanup.md +152 -0
- package/.opencode/workflows/complete-milestone.md +763 -0
- package/.opencode/workflows/diagnose-issues.md +219 -0
- package/.opencode/workflows/discovery-phase.md +288 -0
- package/.opencode/workflows/discuss-phase.md +542 -0
- package/.opencode/workflows/execute-phase.md +449 -0
- package/.opencode/workflows/execute-plan.md +447 -0
- package/.opencode/workflows/health.md +156 -0
- package/.opencode/workflows/help.md +489 -0
- package/.opencode/workflows/insert-phase.md +129 -0
- package/.opencode/workflows/list-phase-assumptions.md +178 -0
- package/.opencode/workflows/map-codebase.md +315 -0
- package/.opencode/workflows/new-milestone.md +382 -0
- package/.opencode/workflows/new-project.md +1116 -0
- package/.opencode/workflows/pause-work.md +122 -0
- package/.opencode/workflows/plan-milestone-gaps.md +274 -0
- package/.opencode/workflows/plan-phase.md +569 -0
- package/.opencode/workflows/progress.md +381 -0
- package/.opencode/workflows/quick.md +453 -0
- package/.opencode/workflows/remove-phase.md +154 -0
- package/.opencode/workflows/research-phase.md +73 -0
- package/.opencode/workflows/resume-project.md +304 -0
- package/.opencode/workflows/set-profile.md +80 -0
- package/.opencode/workflows/settings.md +213 -0
- package/.opencode/workflows/transition.md +544 -0
- package/.opencode/workflows/update.md +219 -0
- package/.opencode/workflows/verify-phase.md +242 -0
- package/.opencode/workflows/verify-work.md +569 -0
- package/commands/specops/add-phase.md +43 -0
- package/commands/specops/add-tests.md +41 -0
- package/commands/specops/add-todo.md +47 -0
- package/commands/specops/audit-milestone.md +36 -0
- package/commands/specops/check-todos.md +45 -0
- package/commands/specops/cleanup.md +18 -0
- package/commands/specops/complete-milestone.md +136 -0
- package/commands/specops/debug.md +167 -0
- package/commands/specops/discuss-phase.md +83 -0
- package/commands/specops/execute-phase.md +41 -0
- package/commands/specops/health.md +22 -0
- package/commands/specops/help.md +22 -0
- package/commands/specops/insert-phase.md +32 -0
- package/commands/specops/join-discord.md +18 -0
- package/commands/specops/list-phase-assumptions.md +46 -0
- package/commands/specops/map-codebase.md +71 -0
- package/commands/specops/new-milestone.md +44 -0
- package/commands/specops/new-project.md +42 -0
- package/commands/specops/pause-work.md +38 -0
- package/commands/specops/plan-milestone-gaps.md +34 -0
- package/commands/specops/plan-phase.md +45 -0
- package/commands/specops/progress.md +24 -0
- package/commands/specops/quick.md +41 -0
- package/commands/specops/reapply-patches.md +111 -0
- package/commands/specops/remove-phase.md +31 -0
- package/commands/specops/research-phase.md +189 -0
- package/commands/specops/resume-work.md +40 -0
- package/commands/specops/set-profile.md +34 -0
- package/commands/specops/settings.md +36 -0
- package/commands/specops/update.md +37 -0
- package/commands/specops/verify-work.md +38 -0
- package/dist/__integration__/fixtures/generator.d.ts +4 -0
- package/dist/__integration__/fixtures/generator.js +1 -0
- package/dist/__integration__/mocks/server.d.ts +7 -0
- package/dist/__integration__/mocks/server.js +1 -0
- package/dist/__integration__/setup.d.ts +6 -0
- package/dist/__integration__/setup.js +1 -0
- package/dist/acceptance/lazyDetector.js +1 -1
- package/dist/acceptance/reporter.js +1 -1
- package/dist/acceptance/runner.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/promptTemplate.js +1 -1
- package/dist/context/techContextLoader.js +1 -1
- package/dist/engine.d.ts +1 -0
- package/dist/engine.js +1 -1
- package/dist/evolution/distiller.js +1 -1
- package/dist/evolution/index.js +1 -1
- package/dist/evolution/memoryGraph.js +1 -1
- package/dist/evolution/selector.js +1 -1
- package/dist/evolution/signals.js +1 -1
- package/dist/evolution/solidify.js +1 -1
- package/dist/evolution/store.js +1 -1
- package/dist/evolution/types.js +1 -1
- package/dist/init.d.ts +4 -3
- package/dist/init.js +1 -1
- package/dist/machines/agentMachine.js +1 -1
- package/dist/machines/supervisorMachine.js +1 -1
- package/dist/persistence/schema.js +1 -1
- package/dist/persistence/stateFile.js +1 -1
- package/dist/plugin-engine.js +1 -1
- package/dist/plugin.js +1 -1
- package/dist/requirement-analysis/analyzers/repository-parser.d.ts +121 -0
- package/dist/requirement-analysis/analyzers/repository-parser.js +1 -0
- package/dist/requirement-analysis/generators/prd-generator.d.ts +90 -0
- package/dist/requirement-analysis/generators/prd-generator.js +1 -0
- package/dist/requirement-analysis/integrations/v1-integration.d.ts +73 -0
- package/dist/requirement-analysis/integrations/v1-integration.js +1 -0
- package/dist/requirement-analysis/tools/analyze-requirements.js +1 -0
- package/dist/requirement-analysis/types/analysis-result.d.ts +326 -0
- package/dist/requirement-analysis/types/analysis-result.js +1 -0
- package/dist/requirement-analysis/types/feature-mapping.d.ts +294 -0
- package/dist/requirement-analysis/types/feature-mapping.js +1 -0
- package/dist/requirement-analysis/types/index.d.ts +171 -0
- package/dist/requirement-analysis/types/index.js +1 -0
- package/dist/requirement-analysis/types/tech-stack.d.ts +213 -0
- package/dist/requirement-analysis/types/tech-stack.js +1 -0
- package/dist/requirement-analysis/utils/error-handler.d.ts +112 -0
- package/dist/requirement-analysis/utils/error-handler.js +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +1 -1
- package/dist/utils/id.js +1 -1
- package/package.json +4 -2
- package/skills/competitor-search/SKILL.md +169 -0
- package/skills/demand-analysis/SKILL.md +307 -0
- package/skills/feature-search/SKILL.md +182 -0
- package/skills/requirement-analysis/README.md +464 -0
- package/skills/requirement-analysis/SKILL.md +224 -0
- package/skills/requirement-analysis/templates/feature-mapping-template.json +210 -0
- package/skills/requirement-analysis/templates/prd-template.md +104 -0
- package/skills/tech-selection/SKILL.md +198 -0
- package/dist/__e2e__/01-state-engine.e2e.test.d.ts +0 -10
- package/dist/__e2e__/01-state-engine.e2e.test.js +0 -1
- package/dist/acceptance/lazyDetector.test.d.ts +0 -1
- package/dist/acceptance/lazyDetector.test.js +0 -1
- package/dist/acceptance/reporter.test.d.ts +0 -1
- package/dist/acceptance/reporter.test.js +0 -1
- package/dist/acceptance/runner.test.d.ts +0 -1
- package/dist/acceptance/runner.test.js +0 -1
- package/dist/context/promptTemplate.test.d.ts +0 -1
- package/dist/context/promptTemplate.test.js +0 -1
- package/dist/context/techContextLoader.test.d.ts +0 -1
- package/dist/context/techContextLoader.test.js +0 -1
- package/dist/machines/agentMachine.test.d.ts +0 -1
- package/dist/machines/agentMachine.test.js +0 -1
- package/dist/machines/supervisorMachine.test.d.ts +0 -1
- package/dist/machines/supervisorMachine.test.js +0 -1
- package/dist/persistence/stateFile.test.d.ts +0 -1
- package/dist/persistence/stateFile.test.js +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# 模型配置
|
|
2
|
+
|
|
3
|
+
模型配置控制每个 SpecOps 代理使用哪个 Claude 模型。这允许在质量和 token 消耗之间取得平衡。
|
|
4
|
+
|
|
5
|
+
## 配置定义
|
|
6
|
+
|
|
7
|
+
| 代理 | `quality` | `balanced` | `budget` |
|
|
8
|
+
|------|-----------|------------|----------|
|
|
9
|
+
| specops-planner | opus | opus | sonnet |
|
|
10
|
+
| specops-roadmapper | opus | sonnet | sonnet |
|
|
11
|
+
| specops-executor | opus | sonnet | sonnet |
|
|
12
|
+
| specops-phase-researcher | opus | sonnet | haiku |
|
|
13
|
+
| specops-project-researcher | opus | sonnet | haiku |
|
|
14
|
+
| specops-research-synthesizer | sonnet | sonnet | haiku |
|
|
15
|
+
| specops-debugger | opus | sonnet | sonnet |
|
|
16
|
+
| specops-codebase-mapper | sonnet | haiku | haiku |
|
|
17
|
+
| specops-verifier | sonnet | sonnet | haiku |
|
|
18
|
+
| specops-plan-checker | sonnet | sonnet | haiku |
|
|
19
|
+
| specops-integration-checker | sonnet | sonnet | haiku |
|
|
20
|
+
|
|
21
|
+
## 配置理念
|
|
22
|
+
|
|
23
|
+
**quality** - 最大推理能力
|
|
24
|
+
- 所有决策代理使用 Opus
|
|
25
|
+
- 只读验证使用 Sonnet
|
|
26
|
+
- 适用场景:配额充足、关键架构工作
|
|
27
|
+
|
|
28
|
+
**balanced**(默认) - 智能分配
|
|
29
|
+
- 仅规划使用 Opus(架构决策发生的地方)
|
|
30
|
+
- 执行和研究使用 Sonnet(遵循明确指令)
|
|
31
|
+
- 验证使用 Sonnet(需要推理,不只是模式匹配)
|
|
32
|
+
- 适用场景:日常开发、质量和成本的良好平衡
|
|
33
|
+
|
|
34
|
+
**budget** - 最小 Opus 使用
|
|
35
|
+
- 写代码的都用 Sonnet
|
|
36
|
+
- 研究和验证用 Haiku
|
|
37
|
+
- 适用场景:节省配额、大量工作、不太关键的阶段
|
|
38
|
+
|
|
39
|
+
## 解析逻辑
|
|
40
|
+
|
|
41
|
+
编排器在生成前解析模型:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1. 读取 .planning/config.json
|
|
45
|
+
2. 检查 model_overrides 中是否有代理特定的覆盖
|
|
46
|
+
3. 如果没有覆盖,在配置表中查找代理
|
|
47
|
+
4. 将 model 参数传递给 Task 调用
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 单代理覆盖
|
|
51
|
+
|
|
52
|
+
覆盖特定代理而不改变整个配置:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"model_profile": "balanced",
|
|
57
|
+
"model_overrides": {
|
|
58
|
+
"specops-executor": "opus",
|
|
59
|
+
"specops-planner": "haiku"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
覆盖优先于配置。有效值:`opus`、`sonnet`、`haiku`。
|
|
65
|
+
|
|
66
|
+
## 切换配置
|
|
67
|
+
|
|
68
|
+
运行时:`/specops:set-profile <profile>`
|
|
69
|
+
|
|
70
|
+
项目默认:在 `.planning/config.json` 中设置:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"model_profile": "balanced"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 设计原理
|
|
78
|
+
|
|
79
|
+
**为什么 specops-planner 用 Opus?**
|
|
80
|
+
规划涉及架构决策、目标分解和任务设计。这是模型质量影响最大的地方。
|
|
81
|
+
|
|
82
|
+
**为什么 specops-executor 用 Sonnet?**
|
|
83
|
+
执行器遵循明确的 PLAN.md 指令。计划已经包含了推理;执行是实现。
|
|
84
|
+
|
|
85
|
+
**为什么 balanced 中验证器用 Sonnet(不是 Haiku)?**
|
|
86
|
+
验证需要目标反推推理,检查代码是否*交付*了阶段承诺的内容,而非只是模式匹配。Sonnet 处理得好;Haiku 可能遗漏细微差距。
|
|
87
|
+
|
|
88
|
+
**为什么 specops-codebase-mapper 用 Haiku?**
|
|
89
|
+
只读的探索和模式提取。不需要推理,只需从文件内容生成结构化输出。
|
|
90
|
+
|
|
91
|
+
**为什么用 `inherit` 而不是直接传 `opus`?**
|
|
92
|
+
Claude Code 的 `"opus"` 别名映射到特定模型版本。组织可能阻止旧的 opus 版本而允许新版本。SpecOps 对 opus 级别的代理返回 `"inherit"`,使它们使用用户会话中配置的任何 opus 版本。这避免了版本冲突和静默回退到 Sonnet。
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 阶段参数解析
|
|
2
|
+
|
|
3
|
+
解析和规范化操作阶段的命令的阶段参数。
|
|
4
|
+
|
|
5
|
+
## 提取
|
|
6
|
+
|
|
7
|
+
从 `$ARGUMENTS` 中:
|
|
8
|
+
- 提取阶段编号(第一个数字参数)
|
|
9
|
+
- 提取标志(以 `--` 为前缀)
|
|
10
|
+
- 剩余文本为描述(用于 insert/add 命令)
|
|
11
|
+
|
|
12
|
+
## 使用 specops-tools
|
|
13
|
+
|
|
14
|
+
`find-phase` 命令一步完成规范化和验证:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
PHASE_INFO=$(node .opencode/bin/specops-tools.cjs find-phase "${PHASE}")
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
返回 JSON 包含:
|
|
21
|
+
- `found`:true/false
|
|
22
|
+
- `directory`:阶段目录的完整路径
|
|
23
|
+
- `phase_number`:规范化的编号(如 "06"、"06.1")
|
|
24
|
+
- `phase_name`:名称部分(如 "foundation")
|
|
25
|
+
- `plans`:PLAN.md 文件数组
|
|
26
|
+
- `summaries`:SUMMARY.md 文件数组
|
|
27
|
+
|
|
28
|
+
## 手动规范化(遗留方式)
|
|
29
|
+
|
|
30
|
+
整数阶段零填充到 2 位。保留小数后缀。
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 规范化阶段编号
|
|
34
|
+
if [[ "$PHASE" =~ ^[0-9]+$ ]]; then
|
|
35
|
+
# 整数:8 -> 08
|
|
36
|
+
PHASE=$(printf "%02d" "$PHASE")
|
|
37
|
+
elif [[ "$PHASE" =~ ^([0-9]+)\.([0-9]+)$ ]]; then
|
|
38
|
+
# 小数:2.1 -> 02.1
|
|
39
|
+
PHASE=$(printf "%02d.%s" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}")
|
|
40
|
+
fi
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 验证
|
|
44
|
+
|
|
45
|
+
使用 `roadmap get-phase` 验证阶段是否存在:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
PHASE_CHECK=$(node .opencode/bin/specops-tools.cjs roadmap get-phase "${PHASE}")
|
|
49
|
+
if [ "$(echo "$PHASE_CHECK" | jq -r '.found')" = "false" ]; then
|
|
50
|
+
echo "ERROR: Phase ${PHASE} not found in roadmap"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 目录查找
|
|
56
|
+
|
|
57
|
+
使用 `find-phase` 进行目录查找:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
PHASE_DIR=$(node .opencode/bin/specops-tools.cjs find-phase "${PHASE}" --raw)
|
|
61
|
+
```
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<planning_config>
|
|
2
|
+
|
|
3
|
+
`.planning/` 目录行为的配置选项。
|
|
4
|
+
|
|
5
|
+
<config_schema>
|
|
6
|
+
```json
|
|
7
|
+
"planning": {
|
|
8
|
+
"commit_docs": true,
|
|
9
|
+
"search_gitignored": false
|
|
10
|
+
},
|
|
11
|
+
"git": {
|
|
12
|
+
"branching_strategy": "none",
|
|
13
|
+
"phase_branch_template": "specops/phase-{phase}-{slug}",
|
|
14
|
+
"milestone_branch_template": "specops/{milestone}-{slug}"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| 选项 | 默认值 | 说明 |
|
|
19
|
+
|------|--------|------|
|
|
20
|
+
| `commit_docs` | `true` | 是否将规划产物提交到 git |
|
|
21
|
+
| `search_gitignored` | `false` | 在广泛 rg 搜索中添加 `--no-ignore` |
|
|
22
|
+
| `git.branching_strategy` | `"none"` | Git 分支策略:`"none"`、`"phase"` 或 `"milestone"` |
|
|
23
|
+
| `git.phase_branch_template` | `"specops/phase-{phase}-{slug}"` | 阶段策略的分支模板 |
|
|
24
|
+
| `git.milestone_branch_template` | `"specops/{milestone}-{slug}"` | 里程碑策略的分支模板 |
|
|
25
|
+
</config_schema>
|
|
26
|
+
|
|
27
|
+
<commit_docs_behavior>
|
|
28
|
+
|
|
29
|
+
**当 `commit_docs: true`(默认)时:**
|
|
30
|
+
- 规划文件正常提交
|
|
31
|
+
- SUMMARY.md、STATE.md、ROADMAP.md 纳入 git 追踪
|
|
32
|
+
- 完整保留规划决策历史
|
|
33
|
+
|
|
34
|
+
**当 `commit_docs: false` 时:**
|
|
35
|
+
- 跳过所有 `.planning/` 文件的 `git add`/`git commit`
|
|
36
|
+
- 用户需将 `.planning/` 添加到 `.gitignore`
|
|
37
|
+
- 适用场景:开源贡献、客户项目、保持规划私密
|
|
38
|
+
|
|
39
|
+
**使用 specops-tools.cjs(推荐):**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 带自动 commit_docs + gitignore 检查的提交:
|
|
43
|
+
node .opencode/bin/specops-tools.cjs commit "docs: update state" --files .planning/STATE.md
|
|
44
|
+
|
|
45
|
+
# 通过 state load 加载配置(返回 JSON):
|
|
46
|
+
INIT=$(node .opencode/bin/specops-tools.cjs state load)
|
|
47
|
+
# commit_docs 包含在 JSON 输出中
|
|
48
|
+
|
|
49
|
+
# 或使用 init 命令,其中包含 commit_docs:
|
|
50
|
+
INIT=$(node .opencode/bin/specops-tools.cjs init execute-phase "1")
|
|
51
|
+
# commit_docs 包含在所有 init 命令输出中
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**自动检测:** 如果 `.planning/` 被 gitignore,无论 config.json 如何设置,`commit_docs` 自动为 `false`。这可以防止用户在 `.gitignore` 中有 `.planning/` 时出现 git 错误。
|
|
55
|
+
|
|
56
|
+
**通过 CLI 提交(自动处理检查):**
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
node .opencode/bin/specops-tools.cjs commit "docs: update state" --files .planning/STATE.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
CLI 会在内部检查 `commit_docs` 配置和 gitignore 状态,无需手动条件判断。
|
|
63
|
+
|
|
64
|
+
</commit_docs_behavior>
|
|
65
|
+
|
|
66
|
+
<search_behavior>
|
|
67
|
+
|
|
68
|
+
**当 `search_gitignored: false`(默认)时:**
|
|
69
|
+
- 标准 rg 行为(遵守 .gitignore)
|
|
70
|
+
- 直接路径搜索有效:`rg "pattern" .planning/` 可找到文件
|
|
71
|
+
- 广泛搜索跳过被 gitignore 的内容:`rg "pattern"` 跳过 `.planning/`
|
|
72
|
+
|
|
73
|
+
**当 `search_gitignored: true` 时:**
|
|
74
|
+
- 在需要包含 `.planning/` 的广泛 rg 搜索中添加 `--no-ignore`
|
|
75
|
+
- 仅在搜索整个仓库且期望匹配 `.planning/` 内容时需要
|
|
76
|
+
|
|
77
|
+
**注意:** 大多数 SpecOps 操作使用直接文件读取或显式路径,无论 gitignore 状态如何都能正常工作。
|
|
78
|
+
|
|
79
|
+
</search_behavior>
|
|
80
|
+
|
|
81
|
+
<setup_uncommitted_mode>
|
|
82
|
+
|
|
83
|
+
要使用非提交模式:
|
|
84
|
+
|
|
85
|
+
1. **设置配置:**
|
|
86
|
+
```json
|
|
87
|
+
"planning": {
|
|
88
|
+
"commit_docs": false,
|
|
89
|
+
"search_gitignored": true
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. **添加到 .gitignore:**
|
|
94
|
+
```
|
|
95
|
+
.planning/
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
3. **已追踪的文件:** 如果 `.planning/` 之前已被追踪:
|
|
99
|
+
```bash
|
|
100
|
+
git rm -r --cached .planning/
|
|
101
|
+
git commit -m "chore: stop tracking planning docs"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. **分支合并:** 使用 `branching_strategy: phase` 或 `milestone` 时,`complete-milestone` 工作流在 `commit_docs: false` 的情况下会自动在合并提交前从暂存区移除 `.planning/` 文件。
|
|
105
|
+
|
|
106
|
+
</setup_uncommitted_mode>
|
|
107
|
+
|
|
108
|
+
<branching_strategy_behavior>
|
|
109
|
+
|
|
110
|
+
**分支策略:**
|
|
111
|
+
|
|
112
|
+
| 策略 | 创建分支时机 | 分支范围 | 合并点 |
|
|
113
|
+
|------|-------------|---------|--------|
|
|
114
|
+
| `none` | 从不 | 不适用 | 不适用 |
|
|
115
|
+
| `phase` | 在 `execute-phase` 开始时 | 单个阶段 | 用户在阶段完成后合并 |
|
|
116
|
+
| `milestone` | 在里程碑的第一个 `execute-phase` 时 | 整个里程碑 | 在 `complete-milestone` 时 |
|
|
117
|
+
|
|
118
|
+
**当 `git.branching_strategy: "none"`(默认)时:**
|
|
119
|
+
- 所有工作提交到当前分支
|
|
120
|
+
- 标准 SpecOps 行为
|
|
121
|
+
|
|
122
|
+
**当 `git.branching_strategy: "phase"` 时:**
|
|
123
|
+
- `execute-phase` 在执行前创建/切换到分支
|
|
124
|
+
- 分支名来自 `phase_branch_template`(如 `specops/phase-03-authentication`)
|
|
125
|
+
- 所有计划提交到该分支
|
|
126
|
+
- 用户在阶段完成后手动合并分支
|
|
127
|
+
- `complete-milestone` 提供合并所有阶段分支的选项
|
|
128
|
+
|
|
129
|
+
**当 `git.branching_strategy: "milestone"` 时:**
|
|
130
|
+
- 里程碑的第一个 `execute-phase` 创建里程碑分支
|
|
131
|
+
- 分支名来自 `milestone_branch_template`(如 `specops/v1.0-mvp`)
|
|
132
|
+
- 里程碑中所有阶段提交到同一分支
|
|
133
|
+
- `complete-milestone` 提供将里程碑分支合并到 main 的选项
|
|
134
|
+
|
|
135
|
+
**模板变量:**
|
|
136
|
+
|
|
137
|
+
| 变量 | 可用于 | 说明 |
|
|
138
|
+
|------|--------|------|
|
|
139
|
+
| `{phase}` | phase_branch_template | 零填充的阶段编号(如 "03") |
|
|
140
|
+
| `{slug}` | 两者都可 | 小写、连字符分隔的名称 |
|
|
141
|
+
| `{milestone}` | milestone_branch_template | 里程碑版本(如 "v1.0") |
|
|
142
|
+
|
|
143
|
+
**检查配置:**
|
|
144
|
+
|
|
145
|
+
使用 `init execute-phase`,它以 JSON 返回所有配置:
|
|
146
|
+
```bash
|
|
147
|
+
INIT=$(node .opencode/bin/specops-tools.cjs init execute-phase "1")
|
|
148
|
+
# JSON 输出包含:branching_strategy、phase_branch_template、milestone_branch_template
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
或使用 `state load` 获取配置值:
|
|
152
|
+
```bash
|
|
153
|
+
INIT=$(node .opencode/bin/specops-tools.cjs state load)
|
|
154
|
+
# 从 JSON 中解析 branching_strategy、phase_branch_template、milestone_branch_template
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**分支创建:**
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# 阶段策略
|
|
161
|
+
if [ "$BRANCHING_STRATEGY" = "phase" ]; then
|
|
162
|
+
PHASE_SLUG=$(echo "$PHASE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
|
|
163
|
+
BRANCH_NAME=$(echo "$PHASE_BRANCH_TEMPLATE" | sed "s/{phase}/$PADDED_PHASE/g" | sed "s/{slug}/$PHASE_SLUG/g")
|
|
164
|
+
git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
# 里程碑策略
|
|
168
|
+
if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
|
|
169
|
+
MILESTONE_SLUG=$(echo "$MILESTONE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
|
|
170
|
+
BRANCH_NAME=$(echo "$MILESTONE_BRANCH_TEMPLATE" | sed "s/{milestone}/$MILESTONE_VERSION/g" | sed "s/{slug}/$MILESTONE_SLUG/g")
|
|
171
|
+
git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
|
|
172
|
+
fi
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**complete-milestone 时的合并选项:**
|
|
176
|
+
|
|
177
|
+
| 选项 | Git 命令 | 结果 |
|
|
178
|
+
|------|----------|------|
|
|
179
|
+
| 压缩合并(推荐) | `git merge --squash` | 每个分支一个干净的提交 |
|
|
180
|
+
| 保留历史合并 | `git merge --no-ff` | 保留所有单独的提交 |
|
|
181
|
+
| 删除不合并 | `git branch -D` | 丢弃分支工作 |
|
|
182
|
+
| 保留分支 | (无) | 稍后手动处理 |
|
|
183
|
+
|
|
184
|
+
推荐压缩合并,保持主分支历史干净,同时在分支中保留完整的开发历史(直到删除)。
|
|
185
|
+
|
|
186
|
+
**使用场景:**
|
|
187
|
+
|
|
188
|
+
| 策略 | 最适合 |
|
|
189
|
+
|------|--------|
|
|
190
|
+
| `none` | 独立开发、简单项目 |
|
|
191
|
+
| `phase` | 按阶段代码审查、细粒度回滚、团队协作 |
|
|
192
|
+
| `milestone` | 发布分支、预发布环境、按版本 PR |
|
|
193
|
+
|
|
194
|
+
</branching_strategy_behavior>
|
|
195
|
+
|
|
196
|
+
</planning_config>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<questioning_guide>
|
|
2
|
+
|
|
3
|
+
项目初始化是梦想提取,而非需求收集。你在帮助用户发现和表达他们想要构建的东西。这不是合同谈判,而是协作思考。
|
|
4
|
+
|
|
5
|
+
<philosophy>
|
|
6
|
+
|
|
7
|
+
**你是思考伙伴,不是面试官。**
|
|
8
|
+
|
|
9
|
+
用户通常有一个模糊的想法。你的工作是帮助他们把它变清晰。提出让他们想到「哦,我没考虑过这个」或「是的,这正是我的意思」的问题。
|
|
10
|
+
|
|
11
|
+
不要审问。要协作。不要照本宣科。要跟着线索走。
|
|
12
|
+
|
|
13
|
+
</philosophy>
|
|
14
|
+
|
|
15
|
+
<the_goal>
|
|
16
|
+
|
|
17
|
+
提问结束时,你需要足够的清晰度来编写一个下游阶段可以据此行动的 PROJECT.md:
|
|
18
|
+
|
|
19
|
+
- **研究** 需要:研究什么领域、用户已经知道什么、存在什么未知
|
|
20
|
+
- **需求** 需要:足够清晰的愿景来确定 v1 特性范围
|
|
21
|
+
- **路线图** 需要:足够清晰的愿景来分解为阶段、「完成」是什么样子
|
|
22
|
+
- **plan-phase** 需要:具体的需求来分解为任务、实现选择的上下文
|
|
23
|
+
- **execute-phase** 需要:验证的成功标准、需求背后的「为什么」
|
|
24
|
+
|
|
25
|
+
模糊的 PROJECT.md 迫使每个下游阶段去猜测。成本会累积。
|
|
26
|
+
|
|
27
|
+
</the_goal>
|
|
28
|
+
|
|
29
|
+
<how_to_question>
|
|
30
|
+
|
|
31
|
+
**从开放式开始。** 让他们倾倒脑中的模型。不要用结构打断。
|
|
32
|
+
|
|
33
|
+
**跟随能量。** 他们强调了什么,就深入什么。什么让他们兴奋?什么问题触发了这个想法?
|
|
34
|
+
|
|
35
|
+
**挑战模糊。** 永远不要接受模糊的回答。「好」是什么意思?「用户」是谁?「简单」是怎样的?
|
|
36
|
+
|
|
37
|
+
**让抽象变具体。** 「带我走一遍使用过程。」「那实际上是什么样子?」
|
|
38
|
+
|
|
39
|
+
**澄清歧义。** 「你说 Z 的时候,是指 A 还是 B?」「你提到了 X,多说说。」
|
|
40
|
+
|
|
41
|
+
**知道何时停止。** 当你理解了他们想要什么、为什么想要、为谁做、以及完成是什么样子时,提议继续。
|
|
42
|
+
|
|
43
|
+
</how_to_question>
|
|
44
|
+
|
|
45
|
+
<question_types>
|
|
46
|
+
|
|
47
|
+
把这些当作灵感,不是清单。选择与当前线索相关的。
|
|
48
|
+
|
|
49
|
+
**动机 - 为什么存在:**
|
|
50
|
+
- 「是什么促使了这个?」
|
|
51
|
+
- 「你今天在做什么,这个要替代它?」
|
|
52
|
+
- 「如果这个存在了,你会做什么?」
|
|
53
|
+
|
|
54
|
+
**具体性 - 实际是什么:**
|
|
55
|
+
- 「带我走一遍使用过程」
|
|
56
|
+
- 「你说 X,那实际上是什么样子?」
|
|
57
|
+
- 「给我一个例子」
|
|
58
|
+
|
|
59
|
+
**澄清 - 他们的意思:**
|
|
60
|
+
- 「你说 Z 的时候,是指 A 还是 B?」
|
|
61
|
+
- 「你提到了 X,多说说」
|
|
62
|
+
|
|
63
|
+
**成功 - 如何知道它在工作:**
|
|
64
|
+
- 「你怎么知道这个在工作?」
|
|
65
|
+
- 「完成是什么样子?」
|
|
66
|
+
|
|
67
|
+
</question_types>
|
|
68
|
+
|
|
69
|
+
<using_askuserquestion>
|
|
70
|
+
|
|
71
|
+
使用 AskUserQuestion 通过呈现具体选项来帮助用户思考。
|
|
72
|
+
|
|
73
|
+
**好的选项:**
|
|
74
|
+
- 对他们可能意思的解读
|
|
75
|
+
- 用于确认或否认的具体例子
|
|
76
|
+
- 揭示优先级的具体选择
|
|
77
|
+
|
|
78
|
+
**坏的选项:**
|
|
79
|
+
- 通用类别(「技术」、「业务」、「其他」)
|
|
80
|
+
- 预设答案的引导性选项
|
|
81
|
+
- 太多选项(2-4 个最理想)
|
|
82
|
+
- 标题超过 12 个字符(硬限制,验证会拒绝)
|
|
83
|
+
|
|
84
|
+
**示例 - 模糊回答:**
|
|
85
|
+
用户说「它应该很快」
|
|
86
|
+
|
|
87
|
+
- header: "Fast"
|
|
88
|
+
- question: "Fast how?"
|
|
89
|
+
- options: ["Sub-second response", "Handles large datasets", "Quick to build", "Let me explain"]
|
|
90
|
+
|
|
91
|
+
**示例 - 跟随线索:**
|
|
92
|
+
用户提到「对当前工具感到沮丧」
|
|
93
|
+
|
|
94
|
+
- header: "Frustration"
|
|
95
|
+
- question: "What specifically frustrates you?"
|
|
96
|
+
- options: ["Too many clicks", "Missing features", "Unreliable", "Let me explain"]
|
|
97
|
+
|
|
98
|
+
**用户提示 - 修改选项:**
|
|
99
|
+
想要某个选项的略微修改版本的用户可以选择「Other」并通过编号引用选项:`#1 but for finger joints only` 或 `#2 with pagination disabled`。这避免了重新输入完整的选项文本。
|
|
100
|
+
|
|
101
|
+
</using_askuserquestion>
|
|
102
|
+
|
|
103
|
+
<context_checklist>
|
|
104
|
+
|
|
105
|
+
把这当作**后台清单**,不是对话结构。在进行中心理检查这些。如果有空白,自然地穿插问题。
|
|
106
|
+
|
|
107
|
+
- [ ] 他们在构建什么(具体到能向陌生人解释)
|
|
108
|
+
- [ ] 为什么需要存在(驱动它的问题或愿望)
|
|
109
|
+
- [ ] 为谁做的(即使只是他们自己)
|
|
110
|
+
- [ ] 「完成」是什么样子(可观察的结果)
|
|
111
|
+
|
|
112
|
+
四件事。如果他们主动提供更多,记录下来。
|
|
113
|
+
|
|
114
|
+
</context_checklist>
|
|
115
|
+
|
|
116
|
+
<decision_gate>
|
|
117
|
+
|
|
118
|
+
当你能写出清晰的 PROJECT.md 时,提议继续:
|
|
119
|
+
|
|
120
|
+
- header: "Ready?"
|
|
121
|
+
- question: "I think I understand what you're after. Ready to create PROJECT.md?"
|
|
122
|
+
- options:
|
|
123
|
+
- "Create PROJECT.md" - Let's move forward
|
|
124
|
+
- "Keep exploring" - I want to share more / ask me more
|
|
125
|
+
|
|
126
|
+
如果选择「Keep exploring」,询问他们想添加什么,或识别空白并自然地探索。
|
|
127
|
+
|
|
128
|
+
循环直到选择「Create PROJECT.md」。
|
|
129
|
+
|
|
130
|
+
</decision_gate>
|
|
131
|
+
|
|
132
|
+
<anti_patterns>
|
|
133
|
+
|
|
134
|
+
- **清单式提问** - 不管他们说了什么都遍历所有领域
|
|
135
|
+
- **罐头问题** - 不管上下文都问「你的核心价值是什么?」「什么不在范围内?」
|
|
136
|
+
- **企业腔** - 「你的成功标准是什么?」「你的利益相关者是谁?」
|
|
137
|
+
- **审问** - 连珠炮式提问而不基于回答展开
|
|
138
|
+
- **急于求成** - 最小化提问以尽快进入「工作」
|
|
139
|
+
- **浅层接受** - 接受模糊回答而不深入探究
|
|
140
|
+
- **过早约束** - 在理解想法之前就问技术栈
|
|
141
|
+
- **用户技能** - 永远不要问用户的技术经验。Claude 来构建。
|
|
142
|
+
|
|
143
|
+
</anti_patterns>
|
|
144
|
+
|
|
145
|
+
</questioning_guide>
|