dev-playbooks-cn 1.0.7 → 1.0.10

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.
Files changed (32) hide show
  1. package/bin/devbooks.js +14 -72
  2. package/package.json +1 -1
  3. package/templates/dev-playbooks/README.md +69 -109
  4. package/templates/dev-playbooks/docs/DevBooks/351/205/215/347/275/256/346/214/207/345/215/227.md +204 -0
  5. package/templates/dev-playbooks/docs/workflow-diagram.svg +203 -0
  6. package/templates/claude-commands/devbooks/apply.md +0 -38
  7. package/templates/claude-commands/devbooks/archive.md +0 -33
  8. package/templates/claude-commands/devbooks/backport.md +0 -19
  9. package/templates/claude-commands/devbooks/bootstrap.md +0 -19
  10. package/templates/claude-commands/devbooks/c4.md +0 -19
  11. package/templates/claude-commands/devbooks/challenger.md +0 -19
  12. package/templates/claude-commands/devbooks/code.md +0 -19
  13. package/templates/claude-commands/devbooks/debate.md +0 -19
  14. package/templates/claude-commands/devbooks/delivery.md +0 -19
  15. package/templates/claude-commands/devbooks/design.md +0 -19
  16. package/templates/claude-commands/devbooks/entropy.md +0 -19
  17. package/templates/claude-commands/devbooks/federation.md +0 -19
  18. package/templates/claude-commands/devbooks/gardener.md +0 -19
  19. package/templates/claude-commands/devbooks/impact.md +0 -19
  20. package/templates/claude-commands/devbooks/index.md +0 -19
  21. package/templates/claude-commands/devbooks/judge.md +0 -19
  22. package/templates/claude-commands/devbooks/plan.md +0 -19
  23. package/templates/claude-commands/devbooks/proposal.md +0 -19
  24. package/templates/claude-commands/devbooks/quick.md +0 -42
  25. package/templates/claude-commands/devbooks/review.md +0 -19
  26. package/templates/claude-commands/devbooks/router.md +0 -19
  27. package/templates/claude-commands/devbooks/spec.md +0 -19
  28. package/templates/claude-commands/devbooks/test-review.md +0 -19
  29. package/templates/claude-commands/devbooks/test.md +0 -19
  30. package/templates/dev-playbooks/docs/DevBooks/345/256/211/350/243/205/346/217/220/347/244/272/350/257/215.md +0 -42
  31. package/templates/dev-playbooks/docs/DevBooks/351/233/206/346/210/220/346/250/241/346/235/277/357/274/210/345/215/217/350/256/256/346/227/240/345/205/263/357/274/211.md +0 -120
  32. package/templates/dev-playbooks/docs/Slash /345/221/275/344/273/244/344/275/277/347/224/250/346/214/207/345/215/227.md" +0 -485
package/bin/devbooks.js CHANGED
@@ -202,26 +202,6 @@ function copyDirSync(src, dest) {
202
202
  return count;
203
203
  }
204
204
 
205
- function copyCodexPromptsSync(srcDir, destDir) {
206
- if (!fs.existsSync(srcDir)) return 0;
207
- fs.mkdirSync(destDir, { recursive: true });
208
-
209
- let count = 0;
210
- const entries = fs.readdirSync(srcDir, { withFileTypes: true });
211
- for (const entry of entries) {
212
- if (!entry.isFile()) continue;
213
- if (!entry.name.endsWith('.md')) continue;
214
-
215
- const srcPath = path.join(srcDir, entry.name);
216
- const destName = entry.name.startsWith('devbooks-') ? entry.name : `devbooks-${entry.name}`;
217
- const destPath = path.join(destDir, destName);
218
- fs.copyFileSync(srcPath, destPath);
219
- count++;
220
- }
221
-
222
- return count;
223
- }
224
-
225
205
  function getSkillsSupportLabel(level) {
226
206
  switch (level) {
227
207
  case SKILLS_SUPPORT.FULL:
@@ -327,40 +307,6 @@ async function promptToolSelection(projectDir) {
327
307
  return selectedTools;
328
308
  }
329
309
 
330
- // ============================================================================
331
- // 安装 Slash 命令
332
- // ============================================================================
333
-
334
- function installSlashCommands(toolIds, projectDir) {
335
- const slashSrcDir = path.join(__dirname, '..', 'templates', 'claude-commands', 'devbooks');
336
-
337
- if (!fs.existsSync(slashSrcDir)) {
338
- return { results: [], total: 0 };
339
- }
340
-
341
- const results = [];
342
-
343
- for (const toolId of toolIds) {
344
- const tool = AI_TOOLS.find(t => t.id === toolId);
345
- if (!tool) continue;
346
-
347
- let destDir;
348
- if (tool.slashDir) {
349
- destDir = path.join(projectDir, tool.slashDir);
350
- } else if (tool.globalSlashDir) {
351
- destDir = expandPath(tool.globalSlashDir);
352
- } else {
353
- continue;
354
- }
355
-
356
- const count = toolId === 'codex'
357
- ? copyCodexPromptsSync(slashSrcDir, destDir)
358
- : copyDirSync(slashSrcDir, destDir);
359
- results.push({ tool: tool.name, count, path: destDir });
360
- }
361
-
362
- return { results, total: results.length };
363
- }
364
310
 
365
311
  // ============================================================================
366
312
  // 安装 Skills(Claude Code, Codex CLI, Qoder)
@@ -624,6 +570,7 @@ function createProjectStructure(projectDir) {
624
570
  'dev-playbooks/specs/architecture',
625
571
  'dev-playbooks/changes',
626
572
  'dev-playbooks/scripts',
573
+ 'dev-playbooks/docs',
627
574
  '.devbooks'
628
575
  ];
629
576
 
@@ -641,6 +588,18 @@ function createProjectStructure(projectDir) {
641
588
  { src: '.devbooks/config.yaml', dest: '.devbooks/config.yaml' }
642
589
  ];
643
590
 
591
+ // 动态添加 docs 目录下的所有文件
592
+ const docsDir = path.join(templateDir, 'dev-playbooks', 'docs');
593
+ if (fs.existsSync(docsDir)) {
594
+ const docFiles = fs.readdirSync(docsDir).filter(f => f.endsWith('.md'));
595
+ for (const docFile of docFiles) {
596
+ templateFiles.push({
597
+ src: `dev-playbooks/docs/${docFile}`,
598
+ dest: `dev-playbooks/docs/${docFile}`
599
+ });
600
+ }
601
+ }
602
+
644
603
  let copiedCount = 0;
645
604
  for (const { src, dest } of templateFiles) {
646
605
  const srcPath = path.join(templateDir, src);
@@ -750,15 +709,6 @@ async function initCommand(projectDir, options) {
750
709
  return;
751
710
  }
752
711
 
753
- // 安装 Slash 命令
754
- const slashSpinner = ora('安装 Slash 命令...').start();
755
- const slashResults = installSlashCommands(selectedTools, projectDir);
756
- slashSpinner.succeed(`安装了 ${slashResults.results.length} 个工具的 Slash 命令`);
757
-
758
- for (const result of slashResults.results) {
759
- console.log(chalk.gray(` └ ${result.tool}: ${result.count} 个命令`));
760
- }
761
-
762
712
  // 安装 Skills(仅完整支持的工具)
763
713
  const fullSupportTools = selectedTools.filter(id => {
764
714
  const tool = AI_TOOLS.find(t => t.id === id);
@@ -824,10 +774,8 @@ async function initCommand(projectDir, options) {
824
774
  // 下一步提示
825
775
  console.log(chalk.bold('下一步:'));
826
776
  console.log(` 1. 编辑 ${chalk.cyan('dev-playbooks/project.md')} 添加项目信息`);
827
- console.log(` 2. 使用 ${chalk.cyan('/devbooks:proposal')} 创建第一个变更提案`);
777
+ console.log(` 2. 使用 ${chalk.cyan('devbooks-proposal-author')} Skill 创建第一个变更提案`);
828
778
  console.log();
829
- console.log(chalk.yellow('重要提示:'));
830
- console.log(' Slash 命令在 IDE 启动时加载,请重启你的 AI 工具以使命令生效。');
831
779
  }
832
780
 
833
781
  // ============================================================================
@@ -861,12 +809,6 @@ async function updateCommand(projectDir) {
861
809
  });
862
810
  console.log(chalk.blue('ℹ') + ` 检测到已配置的工具: ${toolNames.join(', ')}`);
863
811
 
864
- // 更新 Slash 命令
865
- const slashResults = installSlashCommands(configuredTools, projectDir);
866
- for (const result of slashResults.results) {
867
- console.log(chalk.green('✓') + ` ${result.tool}: 更新了 ${result.count} 个 slash 命令`);
868
- }
869
-
870
812
  // 更新 Skills
871
813
  const skillsResults = installSkills(configuredTools, true);
872
814
  for (const result of skillsResults) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-playbooks-cn",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "AI-driven spec-based development workflow",
5
5
  "keywords": [
6
6
  "devbooks",
@@ -7,6 +7,8 @@
7
7
  [![npm](https://img.shields.io/npm/v/dev-playbooks-cn)](https://www.npmjs.com/package/dev-playbooks-cn)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../LICENSE)
9
9
 
10
+ ![DevBooks 工作流](docs/workflow-diagram.svg)
11
+
10
12
  ---
11
13
 
12
14
  ## 为什么选择 DevBooks?
@@ -46,29 +48,6 @@ AI 编码助手很强大,但往往**不可预测**:
46
48
 
47
49
  ## 工作原理
48
50
 
49
- ```
50
- DevBooks 工作流
51
-
52
- PROPOSAL 阶段 APPLY 阶段 ARCHIVE 阶段
53
- (禁止编码) (角色隔离强制) (质量闸门)
54
-
55
- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
56
- │ /devbooks: │ │ 对话 A │ │ /devbooks: │
57
- │ proposal │ │ ┌───────────┐ │ │ gardener │
58
- │ impact │────────────│ │Test Owner │ │────────────│ delivery │
59
- │ design │ │ │(先跑 Red) │ │ │ │
60
- │ spec │ │ └───────────┘ │ │ 质量闸门: │
61
- │ plan │ │ │ │ ✓ Green 证据 │
62
- └─────────────────┘ │ 对话 B │ │ ✓ 任务完成 │
63
- │ │ ┌───────────┐ │ │ ✓ 角色边界 │
64
- ▼ │ │ Coder │ │ │ ✓ 无失败 │
65
- ┌─────────────────┐ │ │(禁改测试!)│ │ └─────────────────┘
66
- │ 三角对辩 │ │ └───────────┘ │
67
- │ Author/Challenger│ └─────────────────┘
68
- │ /Judge │
69
- └─────────────────┘
70
- ```
71
-
72
51
  **核心约束**:Test Owner 与 Coder **必须在独立对话**中工作。这是硬性约束,不是建议。Coder 不能修改 `tests/**`,完成由测试/构建验证,而非 AI 自评。
73
52
 
74
53
  ---
@@ -77,19 +56,18 @@ AI 编码助手很强大,但往往**不可预测**:
77
56
 
78
57
  ### 支持的 AI 工具
79
58
 
80
- | 工具 | Slash 命令 | 自然语言 | 配置文件 |
81
- |------|-----------|----------|----------|
82
- | **Claude Code** | `/devbooks:*` | 支持 | `CLAUDE.md` |
83
- | **Codex CLI** | `/devbooks:*` | 支持 | `AGENTS.md` |
84
- | **Cursor** | - | 支持 | `.cursorrules` |
85
- | **Windsurf** | - | 支持 | `.windsurfrules` |
86
- | **Continue.dev** | - | 支持 | `.continuerules` |
87
- | **GitHub Copilot** | - | 支持 | `.github/copilot-instructions.md` |
88
- | **Gemini Code Assist** | - | 支持 | - |
89
- | **Aider** | - | 支持 | `.aider.conf.yml` |
90
- | **Cline** | - | 支持 | `.clinerules` |
59
+ | 工具 | 支持级别 | 配置文件 |
60
+ |------|----------|----------|
61
+ | **Claude Code** | 完整 Skills | `CLAUDE.md` |
62
+ | **Codex CLI** | 完整 Skills | `AGENTS.md` |
63
+ | **Qoder** | 完整 Skills | `AGENTS.md` |
64
+ | **Cursor** | Rules 系统 | `.cursor/rules/` |
65
+ | **Windsurf** | Rules 系统 | `.windsurf/rules/` |
66
+ | **Gemini CLI** | Rules 系统 | `GEMINI.md` |
67
+ | **Continue** | Rules 系统 | `.continue/rules/` |
68
+ | **GitHub Copilot** | 自定义指令 | `.github/copilot-instructions.md` |
91
69
 
92
- > **提示**:对于不支持 Slash 命令的工具,使用自然语言指令,例如:"运行 DevBooks proposal skill..."
70
+ > **提示**:使用自然语言调用 Skills,例如:"运行 devbooks-proposal-author skill..."
93
71
 
94
72
  ### 安装与初始化
95
73
 
@@ -119,7 +97,7 @@ npx dev-playbooks-cn@latest init
119
97
 
120
98
  初始化后:
121
99
  - Claude Code:`~/.claude/skills/devbooks-*`
122
- - Codex CLI:`$CODEX_HOME/skills/devbooks-*`(默认 `~/.codex/skills/devbooks-*`)
100
+ - Codex CLI:`~/.codex/skills/devbooks-*`
123
101
 
124
102
  ### 快速集成
125
103
 
@@ -130,7 +108,7 @@ DevBooks 使用两个目录根:
130
108
  | `<truth-root>` | 当前规格(只读真理) | `dev-playbooks/specs/` |
131
109
  | `<change-root>` | 变更包(工作区) | `dev-playbooks/changes/` |
132
110
 
133
- 详见 `docs/DevBooks集成模板(协议无关).md` 或使用 `docs/DevBooks安装提示词.md` 让 AI 自动配置。
111
+ 详见 `docs/DevBooks配置指南.md`。
134
112
 
135
113
  ---
136
114
 
@@ -138,20 +116,20 @@ DevBooks 使用两个目录根:
138
116
 
139
117
  ### 使用 Router(推荐)
140
118
 
119
+ 告诉 AI 你的需求,让 Router 分析并输出执行计划:
120
+
141
121
  ```
142
- /devbooks:router <你的需求>
122
+ 请运行 devbooks-router skill,分析需求:<你的需求>
143
123
  ```
144
124
 
145
- Router 分析需求并输出执行计划,告诉你下一步用哪个命令。
146
-
147
- ### 直达命令
125
+ ### Skills 直达
148
126
 
149
127
  熟悉流程后,直接调用 Skill:
150
128
 
151
129
  **1. Proposal 阶段(禁止编码)**
152
130
 
153
131
  ```
154
- /devbooks:proposal 添加 OAuth2 用户认证
132
+ 请运行 devbooks-proposal-author skill,创建提案:添加 OAuth2 用户认证
155
133
  ```
156
134
 
157
135
  产物:`proposal.md`(必需)、`design.md`、`tasks.md`
@@ -162,10 +140,10 @@ Router 分析需求并输出执行计划,告诉你下一步用哪个命令。
162
140
 
163
141
  ```
164
142
  # 对话 A - Test Owner
165
- /devbooks:test add-oauth2
143
+ 请运行 devbooks-test-owner skill,变更 ID:add-oauth2
166
144
 
167
145
  # 对话 B - Coder
168
- /devbooks:code add-oauth2
146
+ 请运行 devbooks-coder skill,变更 ID:add-oauth2
169
147
  ```
170
148
 
171
149
  - Test Owner:写 `verification.md` + 测试,先跑 **Red**
@@ -174,64 +152,64 @@ Router 分析需求并输出执行计划,告诉你下一步用哪个命令。
174
152
  **3. Review 阶段**
175
153
 
176
154
  ```
177
- /devbooks:review add-oauth2
155
+ 请运行 devbooks-code-review skill,变更 ID:add-oauth2
178
156
  ```
179
157
 
180
158
  **4. Archive 阶段**
181
159
 
182
160
  ```
183
- /devbooks:gardener add-oauth2
161
+ 请运行 devbooks-spec-gardener skill,变更 ID:add-oauth2
184
162
  ```
185
163
 
186
164
  ---
187
165
 
188
- ## 命令参考
166
+ ## Skills 参考
189
167
 
190
168
  ### Proposal 阶段
191
169
 
192
- | 命令 | Skill | 说明 |
193
- |------|-------|------|
194
- | `/devbooks:router` | devbooks-router | 智能路由到合适的 Skill |
195
- | `/devbooks:proposal` | devbooks-proposal-author | 创建变更提案 |
196
- | `/devbooks:impact` | devbooks-impact-analysis | 跨模块影响分析 |
197
- | `/devbooks:challenger` | devbooks-proposal-challenger | 质疑和挑战提案 |
198
- | `/devbooks:judge` | devbooks-proposal-judge | 裁决提案 |
199
- | `/devbooks:debate` | devbooks-proposal-debate-workflow | 三角对辩(Author/Challenger/Judge) |
200
- | `/devbooks:design` | devbooks-design-doc | 创建设计文档 |
201
- | `/devbooks:spec` | devbooks-spec-contract | 定义规格与契约 |
202
- | `/devbooks:c4` | devbooks-c4-map | 生成 C4 架构地图 |
203
- | `/devbooks:plan` | devbooks-implementation-plan | 创建实现计划 |
170
+ | Skill | 说明 |
171
+ |-------|------|
172
+ | `devbooks-router` | 智能路由到合适的 Skill |
173
+ | `devbooks-proposal-author` | 创建变更提案 |
174
+ | `devbooks-impact-analysis` | 跨模块影响分析 |
175
+ | `devbooks-proposal-challenger` | 质疑和挑战提案 |
176
+ | `devbooks-proposal-judge` | 裁决提案 |
177
+ | `devbooks-proposal-debate-workflow` | 三角对辩(Author/Challenger/Judge) |
178
+ | `devbooks-design-doc` | 创建设计文档 |
179
+ | `devbooks-spec-contract` | 定义规格与契约 |
180
+ | `devbooks-c4-map` | 生成 C4 架构地图 |
181
+ | `devbooks-implementation-plan` | 创建实现计划 |
204
182
 
205
183
  ### Apply 阶段
206
184
 
207
- | 命令 | Skill | 说明 |
208
- |------|-------|------|
209
- | `/devbooks:test` | devbooks-test-owner | Test Owner 角色(必须独立对话) |
210
- | `/devbooks:code` | devbooks-coder | Coder 角色(必须独立对话) |
211
- | `/devbooks:backport` | devbooks-design-backport | 回写发现到设计文档 |
185
+ | Skill | 说明 |
186
+ |-------|------|
187
+ | `devbooks-test-owner` | Test Owner 角色(必须独立对话) |
188
+ | `devbooks-coder` | Coder 角色(必须独立对话) |
189
+ | `devbooks-design-backport` | 回写发现到设计文档 |
212
190
 
213
191
  ### Review 阶段
214
192
 
215
- | 命令 | Skill | 说明 |
216
- |------|-------|------|
217
- | `/devbooks:review` | devbooks-code-review | 代码评审(可读性/一致性) |
218
- | `/devbooks:test-review` | devbooks-test-reviewer | 测试质量与覆盖率评审 |
193
+ | Skill | 说明 |
194
+ |-------|------|
195
+ | `devbooks-code-review` | 代码评审(可读性/一致性) |
196
+ | `devbooks-test-reviewer` | 测试质量与覆盖率评审 |
219
197
 
220
198
  ### Archive 阶段
221
199
 
222
- | 命令 | Skill | 说明 |
223
- |------|-------|------|
224
- | `/devbooks:gardener` | devbooks-spec-gardener | 规格维护与去重 |
225
- | `/devbooks:delivery` | devbooks-delivery-workflow | 完整交付闭环 |
200
+ | Skill | 说明 |
201
+ |-------|------|
202
+ | `devbooks-spec-gardener` | 规格维护与去重 |
203
+ | `devbooks-delivery-workflow` | 完整交付闭环 |
226
204
 
227
205
  ### 独立技能
228
206
 
229
- | 命令 | Skill | 说明 |
230
- |------|-------|------|
231
- | `/devbooks:entropy` | devbooks-entropy-monitor | 系统熵度量 |
232
- | `/devbooks:federation` | devbooks-federation | 跨仓库联邦分析 |
233
- | `/devbooks:bootstrap` | devbooks-brownfield-bootstrap | 存量项目初始化 |
234
- | `/devbooks:index` | devbooks-index-bootstrap | 生成 SCIP 索引 |
207
+ | Skill | 说明 |
208
+ |-------|------|
209
+ | `devbooks-entropy-monitor` | 系统熵度量 |
210
+ | `devbooks-federation` | 跨仓库联邦分析 |
211
+ | `devbooks-brownfield-bootstrap` | 存量项目初始化 |
212
+ | `devbooks-index-bootstrap` | 生成 SCIP 索引 |
235
213
 
236
214
  ---
237
215
 
@@ -353,7 +331,7 @@ DevBooks 跟踪四维系统熵:
353
331
  | 测试熵 | 测试覆盖率和质量衰减 |
354
332
  | 依赖熵 | 外部依赖健康度 |
355
333
 
356
- `/devbooks:entropy` 生成报告,识别重构机会。
334
+ `devbooks-entropy-monitor` 生成报告,识别重构机会。
357
335
 
358
336
  脚本(位于 `~/.claude/skills/devbooks-entropy-monitor/scripts/`):`entropy-measure.sh`、`entropy-report.sh`
359
337
 
@@ -362,13 +340,8 @@ DevBooks 跟踪四维系统熵:
362
340
  <details>
363
341
  <summary><strong>存量项目初始化</strong></summary>
364
342
 
365
- 当 `<truth-root>` 为空时:
343
+ 当 `<truth-root>` 为空时,使用 `devbooks-brownfield-bootstrap` 生成:
366
344
 
367
- ```
368
- /devbooks:bootstrap
369
- ```
370
-
371
- 生成:
372
345
  - 项目画像和术语表
373
346
  - 从现有代码生成基线规格
374
347
  - 最小验证锚点
@@ -380,13 +353,7 @@ DevBooks 跟踪四维系统熵:
380
353
  <details>
381
354
  <summary><strong>跨仓库联邦</strong></summary>
382
355
 
383
- 多仓库分析:
384
-
385
- ```
386
- /devbooks:federation
387
- ```
388
-
389
- 分析跨仓库边界的契约和依赖,支持协调变更。
356
+ 多仓库分析用 `devbooks-federation`,分析跨仓库边界的契约和依赖,支持协调变更。
390
357
 
391
358
  </details>
392
359
 
@@ -405,27 +372,23 @@ DevBooks Skills 支持 MCP(Model Context Protocol)优雅降级:在没有 M
405
372
 
406
373
  | MCP 状态 | 行为 |
407
374
  |----------|------|
408
- | CKB 可用 | 增强模式:符号级影响分析/引用查找/调用图/热点(`mcp__ckb__analyzeImpact`、`mcp__ckb__findReferences`、`mcp__ckb__getCallGraph`、`mcp__ckb__getHotspots`) |
375
+ | CKB 可用 | 增强模式:符号级影响分析/引用查找/调用图/热点 |
409
376
  | CKB 不可用 | 基础模式:Grep + Glob 文本搜索(功能完整,精度降低) |
410
377
 
411
378
  ### 自动检测
412
379
 
413
- - 需要 MCP 的 Skills 会先调用 `mcp__ckb__getStatus` 探测可用性(2s 超时)
380
+ - 需要 MCP 的 Skills 会先探测可用性(2s 超时)
414
381
  - 超时/失败 → 静默降级到基础模式,不阻塞执行
415
382
  - 无需手动选择"基础/增强"模式
416
383
 
417
- 如需启用增强能力:按 `docs/推荐MCP.md` 配置 CKB,并运行 `/devbooks:index` 生成 `index.scip`。
384
+ 如需启用增强能力:按 `docs/推荐MCP.md` 配置 CKB,并运行 `devbooks-index-bootstrap` 生成 `index.scip`。
418
385
 
419
386
  </details>
420
387
 
421
388
  <details>
422
389
  <summary><strong>提案对辩工作流</strong></summary>
423
390
 
424
- 严格提案审查用三角对辩:
425
-
426
- ```
427
- /devbooks:debate
428
- ```
391
+ 严格提案审查用三角对辩 `devbooks-proposal-debate-workflow`:
429
392
 
430
393
  三个角色:
431
394
  1. **Author**:创建并捍卫提案
@@ -462,7 +425,6 @@ dev-playbooks-cn migrate --from openspec --keep-old
462
425
  - `openspec/changes/` → `dev-playbooks/changes/`
463
426
  - `openspec/project.md` → `dev-playbooks/project.md`
464
427
  - 所有路径引用自动更新
465
- - AI 工具命令目录自动清理(`.claude/commands/openspec/` 等)
466
428
 
467
429
  ### 从 GitHub spec-kit 迁移
468
430
 
@@ -507,7 +469,7 @@ dev-playbooks-cn migrate --from speckit --keep-old
507
469
  1. 运行 `dev-playbooks-cn init` 设置 DevBooks Skills
508
470
  2. 检查 `dev-playbooks/` 中的迁移文件
509
471
  3. 更新 `verification.md` 文件的 AC 映射
510
- 4. 如需基线规格,运行 `/devbooks:bootstrap`
472
+ 4. 如需基线规格,运行 `devbooks-brownfield-bootstrap`
511
473
 
512
474
  ---
513
475
 
@@ -524,20 +486,18 @@ dev-playbooks/
524
486
  ├── changes/ # 变更包(工作区)
525
487
  ├── scripts/ # 辅助脚本
526
488
  └── docs/ # 文档
527
- ├── Slash 命令使用指南.md
528
- ├── 推荐MCP.md
529
- ├── DevBooks集成模板(协议无关).md
530
- └── DevBooks安装提示词.md
489
+ ├── workflow-diagram.svg # 工作流程图
490
+ ├── 推荐MCP.md # MCP 配置建议
491
+ └── DevBooks配置指南.md # 配置指南
531
492
  ```
532
493
 
533
494
  ---
534
495
 
535
496
  ## 文档
536
497
 
537
- - [Slash 命令使用指南](docs/Slash%20命令使用指南.md)
498
+ - [工作流程图](docs/workflow-diagram.svg)
538
499
  - [MCP 配置建议](docs/推荐MCP.md)
539
- - [集成模板(协议无关)](docs/DevBooks集成模板(协议无关).md)
540
- - [安装提示词](docs/DevBooks安装提示词.md)
500
+ - [配置指南](docs/DevBooks配置指南.md)
541
501
 
542
502
  ---
543
503
 
@@ -0,0 +1,204 @@
1
+ # DevBooks 配置指南
2
+
3
+ > 本指南帮助你在项目中集成 DevBooks 工作流。
4
+
5
+ ---
6
+
7
+ ## 快速开始(让 AI 自动配置)
8
+
9
+ 将以下提示词发送给 AI,它会自动完成配置:
10
+
11
+ ```text
12
+ 你是"DevBooks 上下文协议适配器安装员(DevBooks Context Protocol Adapter Installer)"。你的目标是在目标项目中,把 DevBooks 的协议无关约定(<truth-root>/<change-root> + 角色隔离 + DoD + Skills 索引)集成到该项目的上下文协议里。
13
+
14
+ 前置条件(先检查,缺失则停止并说明原因):
15
+ - 系统依赖已安装(必需:jq、ripgrep;推荐:scc、radon)
16
+ 检查命令:command -v jq rg scc radon
17
+ 若缺失,运行:<devbooks-root>/scripts/install-dependencies.sh
18
+ - 你能定位该项目的"标牌文件(signpost file)"(由上下文协议决定,常见:CLAUDE.md / AGENTS.md / PROJECT.md / <protocol>/project.md)。
19
+
20
+ 硬约束(必须遵守):
21
+ 1) 本次安装只允许改"上下文/文档标牌",不得修改业务代码、tests、也不得引入新依赖。
22
+ 2) 若目标项目已有"上下文协议托管区块(managed block)",自定义内容必须放在托管区块之外,避免被后续自动更新覆盖。
23
+ 3) 安装必须明确写出两个目录根:
24
+ - <truth-root>:当前真理目录根
25
+ - <change-root>:变更包目录根
26
+
27
+ 任务(按顺序执行):
28
+ 0) 检查系统依赖:
29
+ - 运行:command -v jq rg scc radon
30
+ - 若缺失必需依赖(jq、rg),提示用户先运行:./scripts/install-dependencies.sh
31
+ - 若缺失推荐依赖(scc、radon),说明这是可选项,用于启用"复杂度加权热点"等能力
32
+ 1) 识别上下文协议类型(至少两条分支):
33
+ - 若检测到 DevBooks(存在 dev-playbooks/project.md):使用 DevBooks 默认值(<truth-root>=dev-playbooks/specs,<change-root>=dev-playbooks/changes)
34
+ - 否则:使用手动配置部分进行集成
35
+ 2) 为该项目确定目录根:
36
+ - 若项目已有 specs/changes 等目录约定:直接沿用作为 <truth-root>/<change-root>
37
+ - 若项目没有定义:推荐在仓库根目录使用 `specs/` 与 `changes/`
38
+ 3) 将模板内容合入标牌文件(以追加方式合并):
39
+ - 写入:<truth-root>/<change-root>、变更包结构约定、角色隔离、DoD、devbooks-* Skills 索引
40
+ 4) 验证(必须输出检查结果):
41
+ - 产物落点是否一致(proposal/design/tasks/verification/specs/evidence)
42
+ - 是否包含 Test Owner/Coder 隔离与"Coder 禁止修改 tests"
43
+ - 是否包含 DoD(MECE)
44
+ - 是否包含 devbooks-* Skills 索引
45
+
46
+ 完成后输出:
47
+ - 系统依赖检查结果(哪些已安装、哪些缺失)
48
+ - 你修改了哪些文件(列表)
49
+ - 该项目最终的 <truth-root>/<change-root> 值
50
+ - 下一步最短路径示例(用自然语言点 2-3 个关键 skills)
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 手动配置
56
+
57
+ 如果你想手动配置,将以下内容添加到项目的标牌文件(`CLAUDE.md`、`AGENTS.md` 或 `PROJECT.md`)中:
58
+
59
+ ### 目录根配置
60
+
61
+ ```yaml
62
+ # DevBooks 目录约定
63
+ truth_root: dev-playbooks/specs/ # 当前真理目录根
64
+ change_root: dev-playbooks/changes/ # 变更包目录根
65
+ ```
66
+
67
+ ### 单次变更包结构
68
+
69
+ 每次变更的产物按以下结构组织:
70
+
71
+ | 产物 | 路径 | 说明 |
72
+ |------|------|------|
73
+ | 提案 | `<change-root>/<change-id>/proposal.md` | Why/What/Impact |
74
+ | 设计 | `<change-root>/<change-id>/design.md` | What/Constraints + AC-xxx |
75
+ | 计划 | `<change-root>/<change-id>/tasks.md` | 可跟踪的编码任务 |
76
+ | 验证 | `<change-root>/<change-id>/verification.md` | 追溯矩阵 + MANUAL-* 清单 |
77
+ | 规格增量 | `<change-root>/<change-id>/specs/**` | 本次变更的规格 delta |
78
+ | 证据 | `<change-root>/<change-id>/evidence/**` | Red/Green 证据(按需) |
79
+
80
+ ### 当前真理目录结构
81
+
82
+ ```
83
+ <truth-root>/
84
+ ├── _meta/
85
+ │ ├── project-profile.md # 项目画像/约束/闸门
86
+ │ └── glossary.md # 统一语言术语表
87
+ ├── architecture/
88
+ │ └── c4.md # C4 架构地图
89
+ └── engineering/
90
+ └── pitfalls.md # 高 ROI 坑库(可选)
91
+ ```
92
+
93
+ ### 角色隔离(强制)
94
+
95
+ ```markdown
96
+ ## DevBooks 角色隔离规则
97
+
98
+ - Test Owner 与 Coder 必须在**独立对话/独立实例**中工作
99
+ - 允许并行,但不允许共享上下文造成"自证式测试"
100
+ - Coder **禁止修改** `tests/**`
101
+ - 如需调整测试,必须交回 Test Owner 决策与修改
102
+ ```
103
+
104
+ ### DoD(完成定义,MECE)
105
+
106
+ 每次变更必须声明覆盖哪些闸门,未覆盖项必须写明原因:
107
+
108
+ | 闸门 | 类型 | 示例 |
109
+ |------|------|------|
110
+ | 行为 | unit/integration/e2e | pytest, jest |
111
+ | 契约 | OpenAPI/Proto/Schema | contract tests |
112
+ | 结构 | 分层/依赖方向/无环 | fitness tests |
113
+ | 静态/安全 | lint/typecheck/build | SAST/secret scan |
114
+ | 证据 | 截图/录像/报告 | UI、性能(按需) |
115
+
116
+ ---
117
+
118
+ ## Skills 索引
119
+
120
+ ### 按角色
121
+
122
+ | 角色 | Skill | 产物落点 |
123
+ |------|-------|----------|
124
+ | Router | `devbooks-router` | 路由与下一步建议 |
125
+ | Proposal Author | `devbooks-proposal-author` | `proposal.md` |
126
+ | Proposal Challenger | `devbooks-proposal-challenger` | 质疑报告 |
127
+ | Proposal Judge | `devbooks-proposal-judge` | 裁决回写 |
128
+ | Impact Analyst | `devbooks-impact-analysis` | Impact 章节 |
129
+ | Design Owner | `devbooks-design-doc` | `design.md` |
130
+ | Spec & Contract | `devbooks-spec-contract` | `specs/**` |
131
+ | Planner | `devbooks-implementation-plan` | `tasks.md` |
132
+ | Test Owner | `devbooks-test-owner` | `verification.md` + `tests/` |
133
+ | Coder | `devbooks-coder` | 按 tasks 实现(禁止改 tests) |
134
+ | Reviewer | `devbooks-code-review` | 评审意见 |
135
+ | Spec Gardener | `devbooks-spec-gardener` | 归档修剪 |
136
+ | C4 Map | `devbooks-c4-map` | `architecture/c4.md` |
137
+ | Design Backport | `devbooks-design-backport` | 回写设计缺口 |
138
+
139
+ ### 按工作流
140
+
141
+ | 工作流 | Skill | 说明 |
142
+ |--------|-------|------|
143
+ | Proposal Debate | `devbooks-proposal-debate-workflow` | 三角辩论 |
144
+ | Delivery | `devbooks-delivery-workflow` | 变更闭环 |
145
+ | Brownfield Bootstrap | `devbooks-brownfield-bootstrap` | 存量项目初始化 |
146
+
147
+ ### 度量与索引
148
+
149
+ | 功能 | Skill | 说明 |
150
+ |------|-------|------|
151
+ | Entropy Monitor | `devbooks-entropy-monitor` | 系统熵度量 |
152
+ | Index Bootstrap | `devbooks-index-bootstrap` | 生成 SCIP 索引 |
153
+ | Federation | `devbooks-federation` | 跨仓库分析 |
154
+
155
+ ---
156
+
157
+ ## 高级选项
158
+
159
+ ### 自定义目录映射
160
+
161
+ 在 `.devbooks/config.yaml` 中配置:
162
+
163
+ ```yaml
164
+ # 目录映射
165
+ mapping:
166
+ truth_root: specs/ # 自定义真理目录
167
+ change_root: changes/ # 自定义变更目录
168
+ agents_doc: AGENTS.md # 规则文档路径
169
+
170
+ # AI 工具配置
171
+ ai_tools:
172
+ - claude
173
+ - cursor
174
+ ```
175
+
176
+ ### CI/CD 集成
177
+
178
+ 将 `templates/ci/` 中的模板复制到 `.github/workflows/`:
179
+
180
+ - `devbooks-guardrail.yml`:PR 上检查复杂度/热点/分层违规
181
+ - `devbooks-cod-update.yml`:push 后更新 COD 模型
182
+
183
+ ### 跨仓库联邦
184
+
185
+ 多仓库项目可配置 `.devbooks/federation.yaml`:
186
+
187
+ ```bash
188
+ cp skills/devbooks-federation/templates/federation.yaml .devbooks/federation.yaml
189
+ ```
190
+
191
+ 详见 `skills/devbooks-federation/SKILL.md`
192
+
193
+ ---
194
+
195
+ ## 自动 Skill 路由
196
+
197
+ AI 可以根据用户意图自动选择 Skills:
198
+
199
+ | 用户意图 | 自动路由 |
200
+ |----------|----------|
201
+ | "修 bug"、"定位问题" | `devbooks-impact-analysis` → `devbooks-coder` |
202
+ | "重构"、"优化代码" | `devbooks-code-review` → `devbooks-coder` |
203
+ | "新功能"、"实现 XX" | `devbooks-router` → 输出闭环路线 |
204
+ | "写测试"、"补测试" | `devbooks-test-owner` |