peaks-cli 1.0.19 → 1.0.21

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/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Peaks
2
2
 
3
- Peaks 是一个面向 Claude Code 的全局 CLI 工具和短技能族,用来把项目治理、工作流规划、受控执行、QA 验证、变更追踪组织成可复用的工程流程。
4
-
5
- 如果你是使用者,把 Peaks 当成一个安装后直接运行的命令行工具即可:先配置工作区,再选择工作流,再按需要调用 skills 和受控 worker。
3
+ Peaks 是一个面向 Claude Code CLI 工具和技能族,把项目治理、工作流规划、受控执行、QA 验证、变更追踪组织成可复用的工程流程。
6
4
 
7
5
  ## 安装
8
6
 
@@ -10,408 +8,77 @@ Peaks 是一个面向 Claude Code 的全局 CLI 工具和短技能族,用来
10
8
  npm install -g peaks-cli
11
9
  ```
12
10
 
13
- 安装后可直接使用:
14
-
15
- ```bash
16
- peaks --help
17
- ```
18
-
19
- 如果你已经从源码或本地包安装,也可以直接运行 `peaks`。
11
+ 安装后,Peaks 会把内置 skills 注册到 Claude Code,你可以在对话里直接调用。
20
12
 
21
- 要确认安装成功,可以执行:
13
+ 验证安装:
22
14
 
23
15
  ```bash
24
- peaks -v
25
- peaks --version
26
16
  peaks --help
27
- peaks -h
28
- ```
29
-
30
- `-v` / `--version` 会显示版本号,`--help` / `-h` 会列出可用的 Peaks 命令。
31
-
32
- 全局安装时,Peaks 会把包内置的 skills 以 symlink 形式注册到全局 Claude skills 目录。安装完成后,你可以在 Claude Code 里直接用这些 skill 名称加自然语言描述来发起工作。
33
-
34
- ## 项目全貌
35
-
36
- Peaks 由五层组成:
37
-
38
- - CLI 入口:`bin/peaks.js` 和 `src/cli/**`,提供所有 `peaks ...` 命令。
39
- - 服务层:`src/services/**`,实现配置、artifact、memory、standards、workflow、RD、Tech、SC、capability、MiniMax worker 等能力。
40
- - Skills:`skills/peaks-*`,提供 PRD、UI、RD、QA、Solo、SC、TXT 七个 Claude Code 工作流角色。
41
- - Schemas:`schemas/*.json`,定义 artifact、recommendation、context capsule、approval、capability、change impact 等稳定数据契约。
42
- - 验证:`tests/unit/**` 和 `tests/e2e/**` 覆盖 CLI 分支、服务边界、路径安全、安装脚本、watch 脚本和 E2E 工作流。
43
-
44
- 核心设计是“skills 定义流程,CLI 执行副作用”。Skills 不直接改配置、不安装 MCP、不写远端仓库;这些动作必须通过 CLI 的 dry-run、JSON 输出、显式 apply/confirm 和可验证结果完成。
45
-
46
- ## 快速开始
47
-
48
- ### 1. 先确认环境
49
-
50
- ```bash
51
- peaks doctor --json
52
- peaks skill doctor --json
53
- ```
54
-
55
- 这两条命令会帮助你确认 Peaks、skills、配置和 artifact 相关状态是否可用。
56
-
57
- ### 2. 查看可用 skills
58
-
59
- ```bash
60
17
  peaks skill list --json
61
18
  ```
62
19
 
63
- Peaks skills 主要有这些:
64
-
65
- - `peaks-solo`:端到端编排入口
66
- - `peaks-prd`:产品目标、非目标、验收标准
67
- - `peaks-ui`:UI/UX、交互和视觉约束
68
- - `peaks-rd`:研发分析、重构规划、执行契约
69
- - `peaks-qa`:测试、覆盖率、回归和验收
70
- - `peaks-sc`:变更追踪、commit boundary、artifact 留存
71
- - `peaks-txt`:上下文胶囊、决策记录、知识压缩
72
-
73
- ## 用 config.json 配置工作区
74
-
75
- Peaks 读取两个位置的配置:
20
+ ## 使用 Skills
76
21
 
77
- - 全局:`~/.peaks/config.json`
78
- - 项目:`<project>/.peaks/config.json`
79
-
80
- 项目配置优先;没有项目配置时,Peaks 回退到全局配置。工作区、当前工作区和运行时偏好都直接写进 `config.json`,后续命令会自动读取,不需要每次重复传 workspace 参数。
81
-
82
- 项目级配置示例:
83
-
84
- ```json
85
- {
86
- "currentWorkspace": "ice-cola",
87
- "workspaces": [
88
- {
89
- "workspaceId": "ice-cola",
90
- "name": "Ice Cola",
91
- "rootPath": "C:/Users/smallMark/Desktop/peaksclaw/ice-cola",
92
- "installedCapabilityIds": [],
93
- "artifactRepo": {
94
- "provider": "github",
95
- "owner": "YOUR_ARTIFACT_REPO_OWNER",
96
- "name": "YOUR_ARTIFACT_REPO_NAME"
97
- }
98
- }
99
- ]
100
- }
101
- ```
102
-
103
- 如果你还需要用户级别的 provider 配置,把它放在全局 `~/.peaks/config.json`:
104
-
105
- ```json
106
- {
107
- "providers": {
108
- "minimax": {
109
- "baseUrl": "https://api.minimaxi.com/anthropic",
110
- "apiKey": "YOUR_MINIMAX_API_KEY"
111
- }
112
- }
113
- }
114
- ```
115
-
116
- 说明:
117
-
118
- - `workspace.rootPath` 指向真实目标项目。
119
- - `currentWorkspace` 决定当前启用哪一个 workspace。
120
- - artifact repo 是中间产物仓库,不是目标代码仓库。
121
- - 项目 `.peaks/config.json` 只放非敏感的工作区元数据;敏感凭据放全局配置。
122
- - 中间产物不要写进目标仓库。
123
-
124
- ## CLI 命令地图
125
-
126
- 所有重要命令都支持 `--json`。会产生副作用的命令通常提供 `--dry-run` 预览和 `--apply` 或 `--confirm` 显式执行。
127
-
128
- ### 健康检查、skills、profiles
129
-
130
- ```bash
131
- peaks doctor --json
132
- peaks skill list --json
133
- peaks skill doctor --json
134
- peaks profile list --json
135
- ```
136
-
137
- 用途:检查 Peaks 运行环境、列出内置 skills、验证 skills 注册状态,并查看可用运行 profile。
138
-
139
- ### 查看和验证配置
140
-
141
- 如果你想确认 Peaks 读取到了什么,可以继续用 `doctor` 和 `config` 相关命令做检查,但配置本身直接写 `config.json` 就够了。
142
-
143
- ```bash
144
- peaks config get --json
145
- peaks config get --key currentWorkspace --json
146
- peaks config set --key language --value '"zh"' --layer user --json
147
- peaks config workspace list --json
148
- peaks config workspace add --id <id> --name <name> --path <project> --json
149
- peaks config workspace switch --id <id> --json
150
- peaks config workspace remove --id <id> --json
151
- ```
152
-
153
- ### MiniMax provider 与外部 worker
154
-
155
- ```bash
156
- export MINIMAX_API_KEY=<key>
157
- peaks config provider minimax set --base-url <https-url> --json
158
- peaks config provider minimax status --json
159
- peaks config provider minimax get --json
160
- peaks config provider minimax test --model MiniMax-M2.7 --json
161
-
162
- peaks worker minimax \
163
- --change-id <id> \
164
- --goal "<目标>" \
165
- --coding-task "<编码任务>" \
166
- --unit-test-task "<测试任务>" \
167
- --confirm \
168
- --json
169
- ```
170
-
171
- MiniMax provider 配置只把敏感凭据写到用户层配置。Worker 是受控外部执行入口:输入必须可外发,输出默认视为不可信,需要再经过顶级模型 review。
172
-
173
- ### Artifact workspace 与项目记忆
174
-
175
- ```bash
176
- peaks artifacts status --json
177
- peaks artifacts init --provider github --name <repo> --path .peaks-artifacts --dry-run --json
178
- peaks artifacts workspace --json
179
- peaks artifacts sync --dry-run --json
180
- peaks artifacts setup --step detect --json
181
-
182
- peaks memory extract --project <project> --artifact <artifact-path> --dry-run --json
183
- peaks memory extract --project <project> --artifact <artifact-path> --apply --json
184
- peaks memory sync --project <project> --workspace <artifact-workspace> --dry-run --json
185
- peaks memory sync --project <project> --workspace <artifact-workspace> --apply --json
186
- ```
187
-
188
- Artifact repo 用来保存 PRD、RD、QA、TXT、SC 等中间产物,不是目标代码仓库。Memory 命令只提取稳定、可复用的项目记忆,并带路径逃逸和密钥检测。
189
-
190
- ### 用短命令产出计划
191
-
192
- Peaks 推荐使用顶层短命令:一个动作对应一个命令,不需要记多层命令堆叠。
193
-
194
- - `route` / `workflow route`:判断这次改动该走 solo 还是 team,输出路线图。
195
- - `autonomous` / `workflow autonomous`:生成全自动治理链路预览。
196
- - `tech-plan` / `tech plan`:把技术目标拆成 scan、document、review、reducer 等可审阅波次。
197
- - `tech-status` / `tech status`:查看技术 artifact / approval 状态。
198
- - `swarm-plan` / `swarm plan`:把 RD 范围拆成并行 worker 图、冲突组和质量门。
199
- - `refactor`:输出 refactor gates、artifact 要求和覆盖率门槛,不直接改代码。
200
- - `recommend`:根据 workflow 推荐外部 skills、MCP 或 Peaks 内置 fallback。
201
- - `minimax-worker` / `worker minimax`:把明确小任务交给 MiniMax worker,并返回给顶级模型审查的交接结果。
202
-
203
- 先写清楚目标,再让 Peaks 产出结构化结果,最后审查结果是否足够小、足够清楚、足够可验证。
204
-
205
- ```bash
206
- peaks route --mode solo --change-id <id> --goal "<目标>" --dry-run --json
207
- peaks autonomous --mode solo --change-id <id> --goal "<目标>" --dry-run --json
208
- peaks tech-plan --change-id <id> --goal "<目标>" --swarm --dry-run --json
209
- peaks swarm-plan --change-id <id> --goal "<目标>" --dry-run --json
210
- peaks refactor --solo --dry-run --json
211
- peaks recommend --workflow code-refactor --language zh --json
212
- peaks minimax-worker --change-id <id> --goal "<目标>" --coding-task "<编码任务>" --unit-test-task "<测试任务>" --confirm --json
213
- ```
214
-
215
-
216
- ### 项目规范 preflight
217
-
218
- Peaks 可以为目标项目生成项目本地规范,并让 `peaks-rd`、`peaks-qa`、`peaks-solo` 在进入代码仓工作流前先检查这些规范。
219
-
220
- ```bash
221
- peaks standards init --project <project> --dry-run --json
222
- peaks standards init --project <project> --apply --json
223
- peaks standards update --project <project> --dry-run --json
224
- peaks standards update --project <project> --apply --json
225
- ```
226
-
227
- 说明:
228
-
229
- - `standards init` 用于首次创建 `CLAUDE.md` 和 `.claude/rules/**`。
230
- - `standards update` 用于已有 `CLAUDE.md` 的项目:追加 Peaks 管理的规范索引,并只补齐缺失的 rules 文件。
231
- - 如果已有 managed block 与当前模板不一致,命令会要求人工 review,并返回非零退出码。
232
- - 对 `CLAUDE.md` 和 rules 的文件写入会检查项目边界,避免 symlink/path traversal 逃逸。
233
-
234
- ### 推荐能力与能力可用性
235
-
236
- ```bash
237
- peaks capability status --json
238
- peaks capability map --source all --json
239
- peaks capabilities --source mcp-server --json
240
-
241
- peaks recommend --workflow code-refactor --language zh --json
242
- peaks recommend --workflow product-refactor --language zh --json
243
- peaks recommend --workflow frontend-design --language zh --json
244
- ```
245
-
246
- 用途:帮助你决定是否应该调用外部 skills、MCP、hooks、agent browser、OpenSpec 等能力。Peaks 的立场是优先复用优秀外部能力;如果能力不可用,再回退到内置流程。
247
-
248
- ### Source control 与变更追踪
249
-
250
- ```bash
251
- peaks sc status --json
252
- peaks sc help
253
-
254
- peaks sc impact \
255
- --change-id ice-cola-marketplace \
256
- --module admin-marketplace \
257
- --module server-marketplace \
258
- --file packages/admin/src/services/marketplaceApi.ts \
259
- --file packages/server/src/marketplace/marketplace.service.ts \
260
- --json
261
-
262
- peaks sc retention \
263
- --slice-id marketplace-api-contract \
264
- --prd artifacts/prd.md \
265
- --rd artifacts/rd.md \
266
- --qa artifacts/qa.md \
267
- --coverage artifacts/coverage.md \
268
- --review artifacts/review.md \
269
- --code packages/admin/src/services/marketplaceApi.ts \
270
- --json
271
-
272
- peaks sc boundary \
273
- --slice-id marketplace-api-contract \
274
- --artifact artifacts/prd.md \
275
- --artifact artifacts/qa.md \
276
- --code packages/admin/src/services/marketplaceApi.ts \
277
- --json
278
-
279
- peaks sc validate --slice-id marketplace-api-contract --json
280
- ```
281
-
282
- SC 命令负责把一次变更的影响范围、artifact 留存、代码边界和回滚点变成可审查记录。
283
-
284
- ### 代理与网络辅助
285
-
286
- ```bash
287
- peaks proxy test --proxy http://127.0.0.1:7890 --target https://www.google.com --dry-run --json
288
- ```
289
-
290
- `proxy test` 只规划连通性测试,不直接执行网络探测。
291
-
292
- ## 使用 skills 的方式
293
-
294
- 如果你在 Claude Code 里工作,可以把 Peaks skills 当成角色化工作流:
295
-
296
- - 先用 `peaks skill list --json` 看有哪些技能可用
297
- - 最简单的用法就是在 Claude Code 里输入:`skill + 自然语言描述`
298
- - 例如:
22
+ Claude Code 对话里,直接用 `skill名称 + 自然语言描述` 发起工作流:
299
23
 
300
24
  ```text
301
- peaks-solo 使用全自动模式治理 C:/Users/smallMark/Desktop/peaksclaw/ice-cola
25
+ peaks-solo 使用全自动模式治理 /path/to/your-project
302
26
  peaks-prd 为会员邀请功能整理产品目标、非目标和验收标准
303
27
  peaks-rd 分析这次重构的最小实现切片和风险
304
28
  peaks-qa 为这次改动设计测试和回归验证清单
29
+ peaks-ui 设计登录页面的交互和视觉方案
30
+ peaks-sc 记录这次变更的影响范围、artifact 留存和 commit 边界
31
+ peaks-txt 为当前模块生成上下文胶囊,保留关键决策
305
32
  ```
306
33
 
307
34
  按任务选择对应技能:
308
- - `peaks-solo`:决定整体工作流模式
309
- - `peaks-prd`:整理产品目标、非目标、验收标准
310
- - `peaks-ui`:补充 UI/UX、交互和视觉约束
311
- - `peaks-rd`:做工程分析、重构规划、执行契约
312
- - `peaks-qa`:定义测试、覆盖率和回归
313
- - `peaks-sc`:记录变更追踪、commit 边界、artifact 留存
314
- - `peaks-txt`:压缩上下文、保留关键决策
315
-
316
- 真实用户通常只需要知道怎么调用,不需要关心内部怎么实现。
317
-
318
- 一个实用顺序是:
319
35
 
320
- 1. 先熟悉项目
321
- 2. 再产出 PRD / RD / QA / TXT
322
- 3. 再生成 route / tech-plan / swarm-plan 计划
323
- 4. 最后才进入受控执行
36
+ | 技能 | 用途 | 典型场景 |
37
+ |------|------|----------|
38
+ | `peaks-solo` | 端到端编排入口 | 全流程开发、从需求到上线 |
39
+ | `peaks-prd` | 产品目标、非目标、验收标准 | 需求整理、重构目标定义 |
40
+ | `peaks-ui` | UI/UX、交互和视觉约束 | 页面设计、交互方案、原型 |
41
+ | `peaks-rd` | 研发分析、重构规划、执行契约 | 工程分析、最小实现切片、风险评估 |
42
+ | `peaks-qa` | 测试、覆盖率、回归验证 | 测试设计、回归矩阵、验收检查 |
43
+ | `peaks-sc` | 变更追踪、commit 边界、artifact 留存 | 影响范围记录、回滚证据 |
44
+ | `peaks-txt` | 上下文胶囊、决策记录、知识压缩 | 模块理解、关键决策留存 |
324
45
 
325
- ## 推荐工作流
46
+ ### 常用工作流
326
47
 
327
- ### 既有项目重构
48
+ **从零到一的新功能:**
328
49
 
329
- 1. `peaks doctor --json`
330
- 2. `peaks config workspace list --json`
331
- 3. `peaks artifacts workspace --json`
332
- 4. `peaks-txt` 生成上下文胶囊
333
- 5. `peaks-prd` 明确目标、非目标和验收标准
334
- 6. 用 `peaks-rd` 熟悉项目结构、测试、脚本、关键模块和风险
335
- 7. 用 `peaks-qa` 定义回归矩阵和覆盖率门禁
336
- 8. UI 相关任务再引入 `peaks-ui`
337
- 9. `peaks route --mode solo --solo-mode full-auto ... --dry-run --json`
338
- 10. `peaks tech-plan ... --swarm --dry-run --json`
339
- 11. `peaks swarm-plan ... --dry-run --json`
340
- 12. 必要时使用 `peaks minimax-worker ... --confirm --json`
341
- 13. 最后做 code review / security review / TypeScript review
342
- 14. 用 `peaks-sc` 记录 impact、retention、boundary
50
+ 1. `peaks-prd` 输出功能目标、用户价值、验收标准和非目标
51
+ 2. `peaks-rd` 找到最小实现切片和受影响模块
52
+ 3. `peaks-ui` 补充交互和视觉方案(UI 相关任务)
53
+ 4. `peaks-qa` 定义新增测试和回归测试
54
+ 5. `peaks-solo` 端到端编排执行
343
55
 
344
- ### 新增功能
56
+ **既有项目重构:**
345
57
 
346
- 1. 先熟悉项目:README、package scripts、路由、服务层、测试、数据模型、当前 git 状态
347
- 2. `peaks-prd` 输出功能目标、用户价值、验收标准和非目标
348
- 3. `peaks-rd` 找到最小实现切片和受影响模块
349
- 4. `peaks-qa` 定义新增测试和回归测试
350
- 5. 再进入 `route` 或 `autonomous` 计划
351
- 6. 受控执行前,确认 artifact workspace 在目标 repo 外部
352
- 7. 实现、单测、build、review、安全检查全部完成后再进入下一步
58
+ 1. `peaks-txt` 生成上下文胶囊,理解当前模块
59
+ 2. `peaks-prd` 明确重构目标、非目标和验收标准
60
+ 3. `peaks-rd` 分析项目结构、测试、脚本、关键模块和风险
61
+ 4. `peaks-qa` 定义回归矩阵和覆盖率门禁
62
+ 5. `peaks-solo` 端到端编排执行
63
+ 6. `peaks-sc` 记录 impact、retention、boundary
353
64
 
354
- ### bug
65
+ **修 bug:**
355
66
 
356
67
  1. 先复现或定位 bug
357
- 2. 熟悉相关模块、调用链、测试和已有约定
358
- 3. `peaks-rd` 生成 root cause、修复策略和回归风险
359
- 4. `peaks-qa` 定义失败用例和验收条件
360
- 5. 先补失败测试,再做最小修复
361
- 6. 跑聚焦测试和相关 build
362
- 7. 再做 code / security / TypeScript review
363
- 8. 用 `peaks-sc` 记录影响范围和边界
68
+ 2. `peaks-rd` 生成 root cause、修复策略和回归风险
69
+ 3. `peaks-qa` 定义失败用例和验收条件
70
+ 4. 先补失败测试,再做最小修复
71
+ 5. `peaks-sc` 记录影响范围和边界
364
72
 
365
- ## 开发、测试和发布包内容
73
+ ### 环境检查
366
74
 
367
- 本仓库是 TypeScript + Commander + Vitest 项目。
75
+ 使用 skill 之前,建议先确认环境:
368
76
 
369
77
  ```bash
370
- pnpm install
371
- pnpm run dev -- --help
372
- pnpm run dev:watch
373
- pnpm run typecheck
374
- pnpm test
375
- pnpm run test:coverage
376
- pnpm run build
377
- ```
378
-
379
- 说明:
380
-
381
- - `scripts/install-skills.mjs` 会把 `skills/peaks-*` 以 symlink 注册到 Claude skills 目录。
382
- - `scripts/watch.mjs` 监听 `src/`、`schemas/`、`skills/`,构建后重新安装 skills。
383
- - npm 包包含 `bin/peaks.js`、编译后的 `dist/src/**`、`scripts/**`、`skills/**` 和 `schemas/*.json`。
384
- - 单元测试覆盖服务逻辑、CLI 分支、路径安全、配置脱敏、MiniMax provider、artifact workspace、standards、memory、SC 和 workflow planning。
385
- - E2E 脚本覆盖 artifact、config、SC 的核心命令链路。
386
-
387
- ## JSON 输出
388
-
389
- 大多数 CLI 命令都支持 `--json`。建议自动化场景总是使用它,因为输出是稳定的 envelope:
390
-
391
- ```json
392
- {
393
- "ok": true,
394
- "command": "workflow.route",
395
- "data": {},
396
- "warnings": [],
397
- "nextActions": []
398
- }
78
+ peaks doctor --json
79
+ peaks skill doctor --json
399
80
  ```
400
81
 
401
- ## 安全边界
402
-
403
- - 不要把 secrets 写进 project config 或 artifacts。
404
- - provider URL 必须使用可信 allowlist 和 HTTPS。
405
- - 既有项目不要跳过熟悉阶段。
406
- - 重构需要测试、覆盖率和验收面。
407
- - 中间 artifacts 应存放在目标仓库外部。
408
- - 修改远端、创建仓库、推送代码、改共享配置都需要显式确认。
409
- - MiniMax worker 等外部 provider 调用必须确认输入可外发。
410
-
411
82
  ## 许可
412
83
 
413
- 本仓库使用 MIT 许可完全开源,详见 [LICENSE](LICENSE)。
414
-
415
- ## 设计立场
416
-
417
- Peaks 与 cc-switch 等工具共存,不修改 cc-switch 状态。Peaks 只通过 Peaks 管理的状态、dry-run 计划、备份和可回滚 sync 来管理 Claude global skills、MCP、hooks、agents 和 profiles。
84
+ MIT License,详见 [LICENSE](LICENSE)。
package/bin/peaks.js CHANGED
File without changes
@@ -8,6 +8,8 @@ export type ArtifactPrerequisite = {
8
8
  relativePath: string;
9
9
  /** Human-readable description of what this artifact represents. */
10
10
  description: string;
11
+ /** Optional content markers — when set, the file must contain ALL of these (case-insensitive substring). */
12
+ mustContain?: ReadonlyArray<string>;
11
13
  };
12
14
  export type PrerequisiteCheckResult = {
13
15
  ok: boolean;
@@ -1,4 +1,5 @@
1
1
  import { join } from 'node:path';
2
+ import { readFile } from 'node:fs/promises';
2
3
  import { pathExists } from '../../shared/fs.js';
3
4
  export const VALID_REQUEST_TYPES = [
4
5
  'feature',
@@ -21,7 +22,16 @@ const TEST_CASES = { relativePath: 'qa/test-cases/<rid>.md', description: 'Gener
21
22
  const TEST_REPORT = { relativePath: 'qa/test-reports/<rid>.md', description: 'Test execution report with actual pass/fail/coverage results' };
22
23
  const SECURITY_FINDINGS = { relativePath: 'qa/security-findings.md', description: 'Security test findings (record "no findings" inside if truly clean)' };
23
24
  const PERFORMANCE_FINDINGS = { relativePath: 'qa/performance-findings.md', description: 'Performance test findings (record baseline/after numbers or explicit "not applicable" rationale)' };
25
+ // PRD content prereq: ensures the PRD artifact has actual scope/acceptance content
26
+ // before handoff to RD/UI/QA. The SKILL says "Handoff to RD/UI/QA is blocked while
27
+ // the artifact is missing or in `draft` state" — this gives that claim a CLI gate.
28
+ const PRD_CONTENT = {
29
+ relativePath: 'prd/requests/<rid>.md',
30
+ description: 'PRD artifact must contain Goal and Acceptance criteria sections before handoff',
31
+ mustContain: ['## Goals', '## Acceptance']
32
+ };
24
33
  const FEATURE_TABLE = {
34
+ 'prd:handed-off': [PRD_CONTENT],
25
35
  'rd:implemented': [TECH_DOC],
26
36
  'rd:qa-handoff': [TECH_DOC, CODE_REVIEW, SECURITY_REVIEW],
27
37
  'qa:running': [TEST_CASES],
@@ -30,6 +40,7 @@ const FEATURE_TABLE = {
30
40
  // Bugfix: lighter planning artifact (bug-analysis instead of tech-doc), still requires code review + security review + regression test.
31
41
  // Performance findings not mandatory for non-perf bugs (use --allow-incomplete --reason if a perf bug requires it).
32
42
  const BUGFIX_TABLE = {
43
+ 'prd:handed-off': [PRD_CONTENT],
33
44
  'rd:implemented': [BUG_ANALYSIS],
34
45
  'rd:qa-handoff': [BUG_ANALYSIS, CODE_REVIEW, SECURITY_REVIEW],
35
46
  'qa:running': [TEST_CASES],
@@ -41,6 +52,7 @@ const REFACTOR_TABLE = FEATURE_TABLE;
41
52
  const NO_GATES = {};
42
53
  // Config: security review is the only mandatory check (config changes can break auth, CORS, CSP, secrets handling).
43
54
  const CONFIG_TABLE = {
55
+ 'prd:handed-off': [PRD_CONTENT],
44
56
  'rd:qa-handoff': [SECURITY_REVIEW],
45
57
  'qa:verdict-issued': [SECURITY_FINDINGS]
46
58
  };
@@ -71,6 +83,18 @@ export async function checkPrerequisites(options) {
71
83
  const absolute = join(sessionRoot, relative);
72
84
  if (!(await pathExists(absolute))) {
73
85
  missing.push({ path: relative, description: prerequisite.description });
86
+ continue;
87
+ }
88
+ if (prerequisite.mustContain && prerequisite.mustContain.length > 0) {
89
+ const body = await readFile(absolute, 'utf8');
90
+ const lowered = body.toLowerCase();
91
+ const missingMarkers = prerequisite.mustContain.filter((marker) => !lowered.includes(marker.toLowerCase()));
92
+ if (missingMarkers.length > 0) {
93
+ missing.push({
94
+ path: relative,
95
+ description: `${prerequisite.description} — missing section(s): ${missingMarkers.join(', ')}`
96
+ });
97
+ }
74
98
  }
75
99
  }
76
100
  return { ok: missing.length === 0, missing };
@@ -1 +1 @@
1
- export declare const CLI_VERSION = "1.0.19";
1
+ export declare const CLI_VERSION = "1.0.21";
@@ -1 +1 @@
1
- export const CLI_VERSION = "1.0.19";
1
+ export const CLI_VERSION = "1.0.21";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-cli",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Peaks CLI and short skill family for Claude Code automation.",
5
5
  "author": "SquabbyZ",
6
6
  "license": "MIT",
@@ -34,9 +34,9 @@ Every QA invocation — feature, bug, refactor, clarification — must write **t
34
34
 
35
35
  | # | File | Path | Reader | Content |
36
36
  |---|------|------|--------|---------|
37
- | 1 | Test cases | `.peaks/<id>/qa/test-cases/<rid>.md` | RD (before impl), QA | Generated test scenarios with status |
38
- | 2 | Test report | `.peaks/<id>/qa/test-reports/<rid>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
39
- | 3 | Request artifact | `.peaks/<id>/qa/requests/<rid>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
37
+ | 1 | Test cases | `.peaks/<session-id>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
38
+ | 2 | Test report | `.peaks/<session-id>/qa/test-reports/<request-id>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
39
+ | 3 | Request artifact | `.peaks/<session-id>/qa/requests/<request-id>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
40
40
 
41
41
  Concrete template and rules: `references/artifact-per-request.md`.
42
42
 
@@ -442,11 +442,29 @@ Before RD work stops, finishes, blocks, or hands off to another role, emit a sho
442
442
 
443
443
  **Matt Pocock skills** (`diagnose`, `triage`, `tdd`, `improve-codebase-architecture`, `prototype`): Engineering references only. Inspect before applying; Peaks RD gates remain authoritative.
444
444
 
445
+ ## Matt Pocock skills integration
446
+
447
+ Engineering methods from `mattpocock/skills` can inform RD work but never replace Peaks gates. Inspect upstream skill content before applying any method.
448
+
449
+ - `diagnose` — root-cause investigation before fixing
450
+ - `triage` — prioritize bug surface area
451
+ - `tdd` — drive implementation from failing tests
452
+ - `improve-codebase-architecture` — opportunistic refactor framing
453
+ - `prototype` — throwaway exploration before committing to a slice
454
+
455
+ These are references only; Peaks RD gates remain authoritative for handoff, acceptance, and slice closure.
456
+
445
457
  **Understand Anything**: Consume via `peaks understand status/show --json`. Fall back to `peaks codegraph context` or local project scan when absent.
446
458
 
447
459
  **Codegraph**: Optional local analysis via `peaks codegraph context/affected`. Output as untrusted supporting evidence; never commit `.codegraph/` artifacts.
448
460
 
449
- **Other external resources** (Context7, SearchCode, everything-claude-code, GitNexus, etc.): Use `peaks capabilities --source access-repo/mcp-server --json` before recommending. Reference-only, no execute/install/persist. Peaks RD gates remain authoritative.
461
+ ## Codegraph project analysis
462
+
463
+ RD may use `peaks codegraph affected --project <path> <changed-files...> --json` as local project-analysis evidence to inform red-line scope boundaries before writing tech-doc or starting implementation. Treat the output as untrusted supporting evidence — verify against the actual code before relying on it.
464
+
465
+ Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts. Peaks RD gates remain authoritative for handoff and acceptance.
466
+
467
+ **Other external resources** (Context7, SearchCode, everything-claude-code, GitNexus, etc.): Use `peaks capabilities --source access-repo/mcp-server --json` for capability discovery before recommending. References only — do not execute upstream installers, do not install upstream resources, do not persist sensitive examples. Peaks RD gates remain authoritative.
450
468
 
451
469
  **OpenSpec and MCP CLI**: Route through Peaks CLI (`peaks openspec show/to-rd/render`, `peaks mcp list/plan/apply/call`). Do not hand-edit `openspec/changes/**` or `~/.claude/settings.json`. Recipes: `references/openspec-mcp-cli.md`.
452
470
 
@@ -71,7 +71,7 @@ Use the Peaks CLI for runtime side effects.
71
71
 
72
72
  Map gstack stages to Peaks role artifacts; preserve Peaks confirmation gates. Do not delegate orchestration to gstack commands.
73
73
 
74
- For frontend workflows, RD and QA must use Playwright MCP for real browser E2E (`peaks mcp plan/apply --capability playwright-mcp.browser-validation --yes`). Chrome DevTools MCP is a secondary CDP surface only. Sanitize browser artifacts before retention (no login URLs, cookies, tokens, PII). See `references/browser-workflow.md`.
74
+ For frontend workflows, RD and QA must use Playwright MCP (`mcp__playwright__` tool namespace) for real browser E2E (`peaks mcp plan/apply --capability playwright-mcp.browser-validation --yes`). Chrome DevTools MCP is a secondary CDP surface only. Sanitize browser artifacts before retention (no login URLs, cookies, tokens, PII). See `references/browser-workflow.md`.
75
75
 
76
76
  ## Local intermediate artifact workspace (MANDATORY)
77
77
 
@@ -731,7 +731,13 @@ Use Peaks TXT for the compact handoff capsule: mode, validated decisions, artifa
731
731
 
732
732
  **Codegraph**: Optional project-analysis before RD handoff. Use `peaks codegraph affected --project <path> <changed-files...> --json` for regression-surface hints. Output as untrusted supporting evidence only; never commit `.codegraph/` artifacts.
733
733
 
734
- **External skills**: All external skill references (`mattpocock/skills`, `awesome-design-md`, `taste-skill`, `shadcn/ui`, `Chrome DevTools MCP`, `Figma Context MCP`, `Context7`, etc.) follow the three-stage pattern: capability discovery before naming, reference-only (no execute/install/persist), Peaks CLI for all side effects. External skills inform, they do not approve.
734
+ ## Codegraph orchestration context
735
+
736
+ Solo treats `peaks codegraph affected --project <path> <changed-files...> --json` as an optional project-analysis enhancement that informs the role handoff between PRD, RD, and QA. The output is untrusted supporting evidence — Solo must not treat codegraph output as approval for scope, design, or QA verdict.
737
+
738
+ Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts into git. Peaks gates remain authoritative; codegraph context is a hint, never a substitute for role-skill output.
739
+
740
+ **External skills**: All external skill references (`mattpocock/skills`, `awesome-design-md`, `taste-skill`, `shadcn/ui`, `Chrome DevTools MCP`, `Figma Context MCP`, `Context7`, etc.) follow the three-stage pattern: capability discovery via `peaks capabilities` before naming, references only (no execute/install/persist), Peaks CLI for all side effects. Do not execute upstream installers, do not install upstream resources, do not persist sensitive examples — Peaks gates remain authoritative. External skills inform, they do not approve.
735
741
 
736
742
  **OpenSpec lifecycle**: `render → validate → show → to-rd → validate → archive`. Solo's default runbook handles the exit gate (validate → archive after QA pass). Entry-gate validation (to-rd before slicing) is available when `openspec/` exists pre-workflow; Solo delegates it to `peaks-rd` during implementation.
737
743
 
@@ -34,8 +34,8 @@ Every UI invocation that touches user-visible behavior — including bug fixes t
34
34
 
35
35
  | # | File | Purpose |
36
36
  |---|------|---------|
37
- | 1 | `.peaks/<id>/ui/design-draft.md` | Design direction, dials, component specs, anti-template checklist |
38
- | 2 | `.peaks/<id>/ui/requests/<rid>.md` | Links to #1, records visual direction decisions, regression seeds |
37
+ | 1 | `.peaks/<session-id>/ui/design-draft.md` | Design direction, dials, component specs, anti-template checklist |
38
+ | 2 | `.peaks/<session-id>/ui/requests/<request-id>.md` | Links to #1, records visual direction decisions, regression seeds |
39
39
 
40
40
  RD consumes the design-draft to implement; QA consumes it for visual regression checks.
41
41