peaks-cli 1.0.17 → 1.0.19
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/dist/src/cli/commands/request-commands.js +109 -3
- package/dist/src/cli/commands/scan-commands.d.ts +3 -0
- package/dist/src/cli/commands/scan-commands.js +194 -0
- package/dist/src/cli/commands/workspace-commands.d.ts +3 -0
- package/dist/src/cli/commands/workspace-commands.js +32 -0
- package/dist/src/cli/program.js +4 -0
- package/dist/src/services/artifacts/artifact-lint-service.d.ts +23 -0
- package/dist/src/services/artifacts/artifact-lint-service.js +80 -0
- package/dist/src/services/artifacts/artifact-prerequisites.d.ts +28 -0
- package/dist/src/services/artifacts/artifact-prerequisites.js +77 -0
- package/dist/src/services/artifacts/repair-cycle-service.d.ts +23 -0
- package/dist/src/services/artifacts/repair-cycle-service.js +52 -0
- package/dist/src/services/artifacts/request-artifact-service.d.ts +14 -0
- package/dist/src/services/artifacts/request-artifact-service.js +73 -21
- package/dist/src/services/scan/acceptance-coverage-service.d.ts +42 -0
- package/dist/src/services/scan/acceptance-coverage-service.js +135 -0
- package/dist/src/services/scan/archetype-service.d.ts +5 -0
- package/dist/src/services/scan/archetype-service.js +253 -0
- package/dist/src/services/scan/diff-scope-service.d.ts +40 -0
- package/dist/src/services/scan/diff-scope-service.js +198 -0
- package/dist/src/services/scan/existing-system-service.d.ts +7 -0
- package/dist/src/services/scan/existing-system-service.js +300 -0
- package/dist/src/services/scan/scan-types.d.ts +59 -0
- package/dist/src/services/scan/scan-types.js +1 -0
- package/dist/src/services/scan/type-sanity-service.d.ts +23 -0
- package/dist/src/services/scan/type-sanity-service.js +108 -0
- package/dist/src/services/standards/project-context.d.ts +24 -0
- package/dist/src/services/standards/project-context.js +318 -0
- package/dist/src/services/standards/project-standards-service.js +145 -40
- package/dist/src/services/workspace/workspace-service.d.ts +16 -0
- package/dist/src/services/workspace/workspace-service.js +66 -0
- package/dist/src/shared/version.d.ts +1 -1
- package/dist/src/shared/version.js +1 -1
- package/package.json +1 -1
- package/skills/peaks-qa/SKILL.md +56 -0
- package/skills/peaks-rd/SKILL.md +65 -2
- package/skills/peaks-solo/SKILL.md +307 -61
- package/skills/peaks-solo/references/existing-system-extraction.md +78 -0
- package/skills/peaks-ui/SKILL.md +9 -1
|
@@ -20,15 +20,17 @@ When the user invokes Peaks Solo without explicitly naming an execution profile,
|
|
|
20
20
|
3. **Swarm** — Peaks maximizes safe parallel role/worker execution for larger RD or QA workloads while keeping reducer validation and artifact boundaries explicit.
|
|
21
21
|
4. **Strict** — Peaks uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
|
|
22
22
|
|
|
23
|
-
Map the user's selection to the `--mode` flag value:
|
|
23
|
+
Map the user's selection to the `--mode` flag value (used by `peaks skill presence:set`; `presence:set --mode` accepts any string, so the name matches the user-facing label rather than overloading "solo" which is also the skill name):
|
|
24
24
|
|
|
25
25
|
| User selects | `--mode` value |
|
|
26
26
|
|---|---|
|
|
27
|
-
| Full auto | `
|
|
27
|
+
| Full auto | `full-auto` |
|
|
28
28
|
| Assisted | `assisted` |
|
|
29
29
|
| Swarm | `swarm` |
|
|
30
30
|
| Strict | `strict` |
|
|
31
31
|
|
|
32
|
+
> Note: `peaks workflow route --mode solo|team` is a **different** CLI dimension (solo developer vs team flow) and is unrelated to the profile choice here. Do not conflate them.
|
|
33
|
+
|
|
32
34
|
If the user already names a profile in their invocation (e.g. `/peaks-solo --full-auto`, "用全自动模式"), skip this question and use the named profile directly.
|
|
33
35
|
|
|
34
36
|
### Step 2: Set skill presence
|
|
@@ -92,21 +94,28 @@ peaks workspace init --project <repo> --session-id <YYYY-MM-DD-<slug>> --json
|
|
|
92
94
|
The workspace initialization creates this structure under `.peaks/<session-id>/`:
|
|
93
95
|
|
|
94
96
|
```
|
|
95
|
-
prd/source/
|
|
96
|
-
prd/requests/
|
|
97
|
-
ui/requests/
|
|
98
|
-
rd/requests/
|
|
99
|
-
qa/test-cases/
|
|
97
|
+
prd/source/ # PRD source documents (Feishu exports, pasted content)
|
|
98
|
+
prd/requests/ # PRD request artifacts (goals, non-goals, acceptance, frontend delta)
|
|
99
|
+
ui/requests/ # UI request artifacts (visual direction, taste reports)
|
|
100
|
+
rd/requests/ # RD request artifacts (slice specs, coverage, CR findings)
|
|
101
|
+
qa/test-cases/ # QA test cases
|
|
100
102
|
qa/test-reports/ # QA test reports (regression matrices, browser evidence)
|
|
101
|
-
qa/requests/
|
|
102
|
-
sc/
|
|
103
|
-
txt/
|
|
103
|
+
qa/requests/ # QA request artifacts
|
|
104
|
+
sc/ # SC artifacts (change-control, impact, retention, boundary)
|
|
105
|
+
txt/ # TXT artifacts (handoff capsules, lessons, memory extraction)
|
|
106
|
+
system/ # Existing-system extraction output (visual tokens, conventions)
|
|
104
107
|
```
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `
|
|
109
|
-
-
|
|
109
|
+
Files written into these directories during the workflow (not pre-created — they appear as their step runs):
|
|
110
|
+
|
|
111
|
+
- `rd/project-scan.md` (Solo step 0.6)
|
|
112
|
+
- `rd/tech-doc.md` (feature/refactor planning; required by `rd → implemented` gate)
|
|
113
|
+
- `rd/bug-analysis.md` (bugfix planning; required by `rd → implemented` gate for `--type bugfix`)
|
|
114
|
+
- `rd/code-review.md`, `rd/security-review.md` (required by `rd → qa-handoff` gate for feature/bugfix/refactor; security-review only for config)
|
|
115
|
+
- `rd/mock-plan.md` (frontend-only mode)
|
|
116
|
+
- `ui/design-draft.md` (UI step)
|
|
117
|
+
- `system/existing-system.md` (Solo step 0.7; legacy projects only)
|
|
118
|
+
- `qa/test-cases/<rid>.md`, `qa/test-reports/<rid>.md`, `qa/security-findings.md`, `qa/performance-findings.md` (gated per `--type`)
|
|
110
119
|
|
|
111
120
|
### Root pollution prohibition (CRITICAL)
|
|
112
121
|
|
|
@@ -131,6 +140,27 @@ Do not default to git-backed storage or automatic commits for intermediate artif
|
|
|
131
140
|
|
|
132
141
|
Before handing off to `peaks-rd`, scan the project and record findings to `.peaks/<session-id>/rd/project-scan.md`. RD and UI roles read this before starting work.
|
|
133
142
|
|
|
143
|
+
### 0. Project archetype detection (MANDATORY — run FIRST, deterministic CLI)
|
|
144
|
+
|
|
145
|
+
Run the CLI; do NOT infer the archetype from prompts. Record the JSON output as `## Archetype` and `## Project mode` in `project-scan.md`. Later gates (frontend-only mode, visual system extraction, standards generation) read these fields.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
peaks scan archetype --project <repo> --json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The command emits a stable JSON envelope with these fields you copy verbatim into `project-scan.md`:
|
|
152
|
+
|
|
153
|
+
- `archetype`: `greenfield | legacy-frontend | legacy-fullstack | frontend-monorepo | unknown`
|
|
154
|
+
- `confidence`: `high | medium | low`
|
|
155
|
+
- `frontendOnly`: `true | false`
|
|
156
|
+
- `frontendOnlyReason`: short string explaining the decision
|
|
157
|
+
- `signals[]`: each signal's name, matched flag, and detail (paste under `## Archetype → Signals matched`)
|
|
158
|
+
- `detected`: raw filesystem facts (package.json presence, backend frameworks, swagger paths, monorepo configs, src file count, lockfile age)
|
|
159
|
+
|
|
160
|
+
If `archetype` is `unknown`, STOP and surface to the user as an open question in the TXT handoff — do NOT guess. If `confidence` is `low`, note the uncertainty in `project-scan.md` and confirm the choice with the user before proceeding.
|
|
161
|
+
|
|
162
|
+
The CLI is the sole source of truth for archetype and frontend-only-mode decisions. Manual heuristics in older versions of this skill are superseded by the CLI output.
|
|
163
|
+
|
|
134
164
|
### 1. Build tool: inspect config files for the framework
|
|
135
165
|
|
|
136
166
|
| Config file | Framework |
|
|
@@ -138,23 +168,35 @@ Before handing off to `peaks-rd`, scan the project and record findings to `.peak
|
|
|
138
168
|
| `.umirc.ts`, `config/config.ts` | Umi (Ant Design Pro) |
|
|
139
169
|
| `next.config.*` | Next.js |
|
|
140
170
|
| `vite.config.*` | Vite |
|
|
171
|
+
| `rsbuild.config.*` | Rsbuild |
|
|
172
|
+
| `rspack.config.*` | Rspack |
|
|
173
|
+
| `farm.config.*` | Farm |
|
|
174
|
+
| `craco.config.*` | CRA + craco |
|
|
141
175
|
| `webpack.config.*` | Webpack |
|
|
176
|
+
| `gulpfile.*` | Gulp (legacy) |
|
|
142
177
|
| `angular.json` | Angular |
|
|
178
|
+
| Custom `build/` or `scripts/build.*` only | Bespoke pipeline — record as `custom` and capture entry script path |
|
|
179
|
+
|
|
180
|
+
If multiple build configs coexist (e.g. `webpack.config.js` + `vite.config.ts`), record ALL of them and mark `build.mixed: true`. Mixed builds are a constraint, not an error — do not silently pick one.
|
|
143
181
|
|
|
144
182
|
### 2. Component library: check `package.json` dependencies
|
|
145
183
|
|
|
146
184
|
| Package | Library |
|
|
147
185
|
|---|---|
|
|
148
|
-
| `antd` | Ant Design |
|
|
186
|
+
| `antd` (capture major version: v3/v4/v5) | Ant Design |
|
|
187
|
+
| `@ant-design/pro-components`, `@ant-design/pro-*` | Ant Design Pro suite |
|
|
149
188
|
| `@mui/material` | Material UI |
|
|
150
189
|
| `tailwindcss` + `radix-ui` | shadcn/ui |
|
|
151
190
|
| `element-plus` / `element-ui` | Element UI/Plus |
|
|
152
191
|
| `@arco-design/web-react` | Arco Design |
|
|
153
192
|
| `tdesign-react` / `tdesign-vue-next` | TDesign |
|
|
193
|
+
| `@douyinfe/semi-ui` | Semi Design |
|
|
154
194
|
| `@nextui-org/react` | NextUI |
|
|
155
195
|
| `@chakra-ui/react` | Chakra UI |
|
|
196
|
+
| `vant` | Vant (mobile) |
|
|
197
|
+
| Workspace package (`workspace:*`) or private-registry scope matching internal design system | In-house design system — record package name and entry path |
|
|
156
198
|
|
|
157
|
-
**CRITICAL**: Never add a second component library to a project that already has one. Do not introduce shadcn/ui to an antd project or vice versa.
|
|
199
|
+
**CRITICAL**: Never add a second component library to a project that already has one. Do not introduce shadcn/ui to an antd project or vice versa. For antd, ALSO record the major version — v3 / v4 / v5 have incompatible APIs and tokens; mixing component code across majors is a blocker.
|
|
158
200
|
|
|
159
201
|
### 3. CSS framework: check for conflicts
|
|
160
202
|
|
|
@@ -171,20 +213,45 @@ State: `zustand`, `jotai`, `redux`/`@reduxjs/toolkit`, `valtio`, `mobx`, `hox`
|
|
|
171
213
|
Routing: `react-router-dom`, `@umijs/max`, Next.js file-based, `vue-router`
|
|
172
214
|
Data fetching: `@tanstack/react-query`, `swr`, `ahooks` (`useRequest`), `umi-request`
|
|
173
215
|
|
|
174
|
-
### 5.
|
|
216
|
+
### 5. Legacy signals (legacy-frontend / legacy-fullstack only)
|
|
217
|
+
|
|
218
|
+
Grep `src/` for outdated patterns and list them as constraints in `project-scan.md` under `## Legacy constraints`. RD must preserve these patterns for new code in the same file/module unless PRD explicitly authorizes modernization.
|
|
219
|
+
|
|
220
|
+
| Signal | Detection |
|
|
221
|
+
|---|---|
|
|
222
|
+
| Class components | `extends React.Component` / `extends Component` in `.tsx`/`.jsx` |
|
|
223
|
+
| `moment` instead of dayjs/date-fns | `package.json` dep |
|
|
224
|
+
| Enzyme test suite | `package.json` dep `enzyme*` |
|
|
225
|
+
| redux-saga / redux-thunk | `package.json` dep |
|
|
226
|
+
| HOC-heavy patterns | `withRouter`, `connect()`, `compose(` frequency in `src/` |
|
|
227
|
+
| Legacy lifecycle | `componentWillMount`/`componentWillReceiveProps` occurrences |
|
|
228
|
+
| jQuery / Backbone / Vue 2 | `package.json` dep |
|
|
229
|
+
| Inline styles dominant | `style={{` occurrences ≥ 50 |
|
|
230
|
+
|
|
231
|
+
### 6. Project-scan artifact template
|
|
175
232
|
|
|
176
233
|
```markdown
|
|
177
234
|
# Project Scan: <project-name>
|
|
178
235
|
**Date:** YYYY-MM-DD
|
|
179
236
|
**Session:** <session-id>
|
|
180
237
|
|
|
238
|
+
## Archetype
|
|
239
|
+
- Type: <greenfield | legacy-frontend | legacy-fullstack | frontend-monorepo | unknown>
|
|
240
|
+
- Signals matched: <bullet list of signals that drove the decision>
|
|
241
|
+
|
|
242
|
+
## Project mode
|
|
243
|
+
- Frontend-only: <true | false>
|
|
244
|
+
- Reason: <archetype-derived | user-stated | backend-detected>
|
|
245
|
+
|
|
181
246
|
## Build tool
|
|
182
247
|
- Framework: <name> <version>
|
|
183
248
|
- Config file: <path>
|
|
249
|
+
- Mixed builds: <true | false; list all configs if true>
|
|
184
250
|
|
|
185
251
|
## Component library
|
|
186
|
-
- Library: <name> <version>
|
|
252
|
+
- Library: <name> <version (major matters for antd)>
|
|
187
253
|
- Design-system packages: <list>
|
|
254
|
+
- In-house design system: <package name | none>
|
|
188
255
|
|
|
189
256
|
## CSS solution
|
|
190
257
|
- Primary: <Less/Sass/CSS-in-JS/TailwindCSS/CSS Modules>
|
|
@@ -194,11 +261,25 @@ Data fetching: `@tanstack/react-query`, `swr`, `ahooks` (`useRequest`), `umi-req
|
|
|
194
261
|
- State: <name>
|
|
195
262
|
- Routing: <name>
|
|
196
263
|
- Data fetching: <name>
|
|
264
|
+
|
|
265
|
+
## Legacy constraints
|
|
266
|
+
- <bullet list of legacy signals from section 5; empty for greenfield>
|
|
197
267
|
```
|
|
198
268
|
|
|
199
269
|
## Frontend-only development mode
|
|
200
270
|
|
|
201
|
-
When the project
|
|
271
|
+
When the project has no live backend (no swagger.json, no API server), Solo must activate frontend-only mode.
|
|
272
|
+
|
|
273
|
+
### Mode determination (deterministic — CLI is the source of truth)
|
|
274
|
+
|
|
275
|
+
The CLI decision is authoritative. Read `frontendOnly` and `frontendOnlyReason` directly from the `peaks scan archetype --json` output and copy both into `project-scan.md` under `## Project mode`. Do NOT re-derive the decision from user phrasing.
|
|
276
|
+
|
|
277
|
+
User-stated intent is **only** consulted when it conflicts with the CLI result. The two conflict cases:
|
|
278
|
+
|
|
279
|
+
- **CLI says `frontendOnly=false` but the user says "前端项目 / 没有后端 / 先 mock 数据"**: STOP and `AskUserQuestion` to confirm whether to override the scan (the repo probably contains a backend folder the user wants to ignore). Record the override decision and reason in `project-scan.md`.
|
|
280
|
+
- **CLI says `frontendOnly=true` but the user says "需要做后端 / 加 API"**: STOP and `AskUserQuestion` to confirm whether the request actually targets the missing backend (the user may be confused about repo scope, or there is a separate backend repo Solo should switch to).
|
|
281
|
+
|
|
282
|
+
When there is no conflict, do not ask — the CLI value wins and the workflow proceeds.
|
|
202
283
|
|
|
203
284
|
### Mock data strategy selection
|
|
204
285
|
|
|
@@ -211,6 +292,9 @@ Solo records the chosen mock strategy in `.peaks/<session-id>/rd/tech-doc.md` un
|
|
|
211
292
|
| `ahooks` `useRequest` + service functions | Service-layer mock: replace HTTP call with `Promise.resolve(mockData)` | Matches existing service-function pattern |
|
|
212
293
|
| MSW (Mock Service Worker) already configured | Add new handlers to existing MSW setup | Consistent with project convention |
|
|
213
294
|
| No existing pattern (greenfield) | Service-layer mock with a `mock/` directory and typed fixture files | Clean separation, easy to delete later |
|
|
295
|
+
| Existing `src/services/*` but no fetcher abstraction | Inline mock inside the service file; preserve the function signature | Keeps existing call-sites unchanged |
|
|
296
|
+
| Mixed data-fetching styles (e.g. react-query + raw fetch in legacy files) | Match the style of the most recently added code in the same module | Avoid introducing a third style |
|
|
297
|
+
| Cannot decide from scan alone | STOP and `AskUserQuestion` | Asking once beats picking differently on every run |
|
|
214
298
|
|
|
215
299
|
**Mock data rules:**
|
|
216
300
|
|
|
@@ -218,6 +302,7 @@ Solo records the chosen mock strategy in `.peaks/<session-id>/rd/tech-doc.md` un
|
|
|
218
302
|
2. Mock data should be realistic (not `"test"`, `"foo"`, `123`) — use plausible Chinese/English content that resembles production data.
|
|
219
303
|
3. Each mock must export its TypeScript interface so RD implementation and QA test-cases can import the same types.
|
|
220
304
|
4. Mark every mock file with a header comment: `// MOCK: Replace with real API call when swagger.json is available`.
|
|
305
|
+
5. Before producing any mock file, register the plan in `.peaks/<session-id>/rd/mock-plan.md` with: chosen strategy (from the table above), planned file paths, and a one-line rationale per file. This file is the source of truth for mock locations across runs — RD must read it before writing code, QA must read it before writing test cases.
|
|
221
306
|
|
|
222
307
|
### API contract placeholder pattern
|
|
223
308
|
|
|
@@ -253,20 +338,38 @@ When the PRD source is a Feishu/Lark document that requires authentication:
|
|
|
253
338
|
|
|
254
339
|
Never silently fall back to unauthenticated `fetch` or `WebFetch` for authenticated documents.
|
|
255
340
|
|
|
341
|
+
## Request type classification (MANDATORY before `peaks request init`)
|
|
342
|
+
|
|
343
|
+
Before initializing any role artifact, classify the request into exactly one of six types. The choice drives RD/QA gate strictness (see "Mandatory RD QA repair loop"). Pick the **primary intent** — if a request could fit two types, the higher-strictness one wins.
|
|
344
|
+
|
|
345
|
+
| `--type` | Pick this when the PRD says... | Pick something else when... |
|
|
346
|
+
|---|---|---|
|
|
347
|
+
| `feature` | Add new capability, new page/component/route/API path, new user-facing behavior. Includes "extend X to support Y" when Y is a new code path. | The PRD is fixing an existing broken behavior → `bugfix`. The PRD is reshaping existing code without changing user-visible behavior → `refactor`. |
|
|
348
|
+
| `bugfix` | Fix a specific broken behavior; PRD includes reproduction steps or a defect description; success = "the broken thing now works as it was supposed to". | The "fix" actually adds new capability (validation that didn't exist, a missing field) → `feature`. The "fix" is purely cosmetic and has zero risk → still `bugfix`; do NOT downgrade to `chore`. |
|
|
349
|
+
| `refactor` | Restructure code without changing user-visible behavior. Examples: rename modules, extract shared utilities, migrate a library version with no API surface change, split a monolithic file. PRD mentions coverage targets or "no behavior change". | The refactor incidentally adds or changes user-visible behavior → split into `refactor` + `feature` or pick `feature`. The change is one-line formatting → `chore`. |
|
|
350
|
+
| `config` | Modify config / infrastructure files only: `tsconfig.json`, `eslint`, CI YAML, `package.json` scripts, env defaults, CORS/CSP rules, build config, Docker, deployment manifests. No application source-code changes. | The config change is paired with code changes that consume the new config → `feature` or `refactor` (whichever the code change is). |
|
|
351
|
+
| `docs` | Modify only `*.md` / docs site / inline JSDoc / README. No `.ts` / `.tsx` / `.js` / `.css` / config-file changes. | Any source code change is included → use the type matching the code change. Adding a code example to docs that requires the example to compile → still `docs` if the example is illustrative only. |
|
|
352
|
+
| `chore` | Pure mechanical hygiene: formatter run, lint fix, dependency version bump with no API surface change, dead-code removal of unused files identified by tooling. | The bump changes API behavior or requires consumer migration → `refactor` (or `feature` if it adds capability). Any logic edit → `bugfix` or `refactor`. |
|
|
353
|
+
|
|
354
|
+
**Self-check before locking the type**: read the PRD scope and answer "what is the smallest gate set that still protects users from regression?" — that is the right type. Picking `docs` or `chore` to skip gates when source code is actually changing is a workflow violation and the SC phase will reject it.
|
|
355
|
+
|
|
356
|
+
For ambiguous cases (e.g. "improve login flow"), ask the user to clarify before initializing. The cost of one `AskUserQuestion` round is much lower than running the wrong gate matrix for the whole workflow.
|
|
357
|
+
|
|
256
358
|
When Peaks Solo coordinates development in a code repository, keep this order explicit:
|
|
257
359
|
|
|
258
360
|
0. **Snapshot** — `peaks doctor` + `peaks project dashboard` to capture baseline state before anything else;
|
|
259
361
|
0.5. **Workspace initialization** — `.peaks/<session-id>/` created, directory structure verified;
|
|
260
|
-
0.6. **Project scan** — component library, CSS framework, build tool, state management, routing, data fetching detected and recorded to `.peaks/<session-id>/rd/project-scan.md`;
|
|
362
|
+
0.6. **Project scan** — archetype, component library, CSS framework, build tool, state management, routing, data fetching, legacy signals detected and recorded to `.peaks/<session-id>/rd/project-scan.md`;
|
|
363
|
+
0.7. **Existing-system extraction** (MANDATORY when archetype ∈ {legacy-frontend, legacy-fullstack, frontend-monorepo}; SKIP for greenfield) — extract visual tokens and code conventions from the live codebase to `.peaks/<session-id>/system/existing-system.md`. The path lives under `system/` (not `ui/`) because the file also records non-UI conventions (service-layer signatures, hooks, naming) that backend-only or legacy-fullstack work consumes. See `references/existing-system-extraction.md`. UI design-draft and RD implementation MUST treat the extracted tokens and conventions as hard constraints;
|
|
261
364
|
1. **Standards preflight** — `peaks standards init/update --dry-run`, must reference concrete project-scan findings (never emit generic templates);
|
|
262
365
|
2. **PRD phase** — capture request as canonical artifact, extract scope and acceptance criteria:
|
|
263
366
|
- Full-auto/Swarm: auto-transition to `confirmed-by-user` once the artifact is complete;
|
|
264
367
|
- Assisted/Strict: pause with `AskUserQuestion` for explicit user confirmation before proceeding;
|
|
265
368
|
3. **Swarm parallel phase** — after PRD confirmed, launch UI, RD(planning), QA(test-cases) simultaneously:
|
|
266
|
-
3a. UI design draft and visual direction (MANDATORY when request is frontend/user-visible);
|
|
267
|
-
3b. RD tech-doc
|
|
268
|
-
3c. QA test-case generation (
|
|
269
|
-
4. **RD implementation** — consumes UI design-draft + RD
|
|
369
|
+
3a. UI design draft and visual direction (MANDATORY when request is frontend/user-visible; skipped for `--type docs|chore|config` or pure-backend requests);
|
|
370
|
+
3b. RD planning artifact — `rd/tech-doc.md` for feature/refactor, `rd/bug-analysis.md` for bugfix, skipped for docs/chore/config;
|
|
371
|
+
3c. QA test-case generation (skipped for docs/chore — no acceptance surface to validate);
|
|
372
|
+
4. **RD implementation** — consumes the type-appropriate inputs: project-scan + standards + (if UI involved) UI design-draft + RD planning artifact + QA test-cases. Includes unit tests for new/changed behavior (TDD) unless `--type` is docs/chore;
|
|
270
373
|
5. **Code review + security review** — CRITICAL/HIGH issues fixed before progression; marked-blocked issues only allow a blocked handoff;
|
|
271
374
|
6. **QA validation** (auto-proceed from RD in full-auto) — execute test cases + API checks + Playwright MCP headed browser E2E for frontend + security/perf checks + test report;
|
|
272
375
|
7. **RD↔QA repair loop** — if QA verdict is `return-to-rd`, loop back to step 4 (RD implementation) and re-run through QA; max 3 repair cycles, then emit blocked TXT regardless;
|
|
@@ -284,32 +387,76 @@ You cannot declare a phase complete from memory. Each gate below is a `ls` comma
|
|
|
284
387
|
ls .peaks/<id>/rd/project-scan.md
|
|
285
388
|
# Expected output: .peaks/<id>/rd/project-scan.md
|
|
286
389
|
# "No such file" → STOP, run project scan first
|
|
390
|
+
# File present but missing `## Archetype` or `## Project mode` sections → INCOMPLETE, rerun scan
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Gate A.5 — Existing-system extraction (legacy projects only):**
|
|
394
|
+
```bash
|
|
395
|
+
# If project-scan.md `## Archetype` is greenfield → skip this gate
|
|
396
|
+
# Otherwise:
|
|
397
|
+
ls .peaks/<id>/system/existing-system.md
|
|
398
|
+
# "No such file" → STOP, run existing-system extraction
|
|
399
|
+
# (see references/existing-system-extraction.md)
|
|
287
400
|
```
|
|
288
401
|
|
|
289
402
|
**Gate B — After swarm convergence (UI + RD planning + QA test-cases):**
|
|
403
|
+
|
|
404
|
+
Gate B has two sub-checks: a HARD gate (blocks progression) and an INFORMATIONAL check (records degradation but does not block).
|
|
405
|
+
|
|
290
406
|
```bash
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
#
|
|
407
|
+
# B.hard — REQUIRED before continuing to RD implementation.
|
|
408
|
+
# Missing any of these → STOP, return to the role that owns the file.
|
|
409
|
+
|
|
410
|
+
# Always required (every type):
|
|
411
|
+
ls .peaks/<id>/prd/requests/<rid>.md
|
|
412
|
+
|
|
413
|
+
# Type-specific RD planning artifact:
|
|
414
|
+
# feature / refactor → ls .peaks/<id>/rd/tech-doc.md
|
|
415
|
+
# bugfix → ls .peaks/<id>/rd/bug-analysis.md
|
|
416
|
+
# config / docs / chore → (no RD planning artifact required)
|
|
417
|
+
|
|
418
|
+
# QA test-cases (skipped for docs/chore):
|
|
419
|
+
ls .peaks/<id>/qa/test-cases/<rid>.md
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# B.info — NON-BLOCKING. Record degradation in TXT, then proceed.
|
|
424
|
+
ls .peaks/<id>/ui/design-draft.md 2>&1
|
|
425
|
+
# "No such file" + request affects user-visible UI → swarm degradation rule 1 fires:
|
|
426
|
+
# note "ui-design-missing" in TXT, RD continues with PRD visual descriptions.
|
|
427
|
+
# "No such file" + pure backend / docs / chore / config → state skip reason in TXT, proceed.
|
|
298
428
|
```
|
|
299
429
|
|
|
300
430
|
**Gate C — After RD implementation (before QA handoff):**
|
|
431
|
+
|
|
432
|
+
The CLI gate (`peaks request transition --state qa-handoff`) is the authoritative check; running this `ls` first lets you produce missing files before the CLI rejects the transition.
|
|
433
|
+
|
|
301
434
|
```bash
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
435
|
+
# Always required
|
|
436
|
+
ls .peaks/<id>/rd/requests/<rid>.md
|
|
437
|
+
|
|
438
|
+
# Type-specific RD evidence (must match the type recorded in the artifact body)
|
|
439
|
+
# feature / refactor → ls rd/tech-doc.md rd/code-review.md rd/security-review.md
|
|
440
|
+
# bugfix → ls rd/bug-analysis.md rd/code-review.md rd/security-review.md
|
|
441
|
+
# config → ls rd/security-review.md
|
|
442
|
+
# docs / chore → (no extra evidence required)
|
|
443
|
+
# Missing any required file → DO NOT attempt the qa-handoff transition; CLI will reject with PREREQUISITES_MISSING.
|
|
305
444
|
```
|
|
306
445
|
|
|
307
446
|
**Gate D — After QA validation:**
|
|
447
|
+
|
|
448
|
+
The CLI gate at `qa:verdict-issued` is the authoritative check; this `ls` lets you produce missing evidence before the CLI rejects the transition.
|
|
449
|
+
|
|
308
450
|
```bash
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
#
|
|
451
|
+
# Always required
|
|
452
|
+
ls .peaks/<id>/qa/requests/<rid>.md
|
|
453
|
+
|
|
454
|
+
# Type-specific QA evidence
|
|
455
|
+
# feature / refactor → ls qa/test-cases/<rid>.md qa/test-reports/<rid>.md qa/security-findings.md qa/performance-findings.md
|
|
456
|
+
# bugfix → ls qa/test-cases/<rid>.md qa/test-reports/<rid>.md qa/security-findings.md
|
|
457
|
+
# config → ls qa/security-findings.md
|
|
458
|
+
# docs / chore → (no QA evidence files required)
|
|
459
|
+
# Missing required file → QA incomplete; do not transition to verdict-issued.
|
|
313
460
|
```
|
|
314
461
|
|
|
315
462
|
**Gate E — Before declaring workflow complete:**
|
|
@@ -317,6 +464,7 @@ ls .peaks/<id>/qa/test-cases/<rid>.md \
|
|
|
317
464
|
find .peaks/<id>/ -type f | sort
|
|
318
465
|
# Verify: files from gates A-D all appear in this list.
|
|
319
466
|
# Any mandatory file missing → NOT complete. Do not emit TXT.
|
|
467
|
+
# Gate G (CLAUDE.md + .claude/rules/**) must ALSO pass before TXT is emitted.
|
|
320
468
|
```
|
|
321
469
|
|
|
322
470
|
**Gate F — Root pollution check (BLOCKING before completion):**
|
|
@@ -336,6 +484,25 @@ find . -maxdepth 1 -name "*.png" -o -name "*.jpg" -o -name "qa-*.js" -o -name "m
|
|
|
336
484
|
# Legitimate project files (e.g. favicon.png) are fine — only move Peaks artifacts.
|
|
337
485
|
```
|
|
338
486
|
|
|
487
|
+
**Gate G — Project standards present (BLOCKING before workflow completion):**
|
|
488
|
+
```bash
|
|
489
|
+
# After `peaks standards init/update --apply`, verify the files actually landed
|
|
490
|
+
# at the project root. The CLAUDE.md and rules files are required so that
|
|
491
|
+
# subsequent peaks-rd / peaks-qa / peaks-solo runs perform the project-local
|
|
492
|
+
# preflight described in CLAUDE.md (read coding-style.md, code-review.md, security.md).
|
|
493
|
+
ls <repo>/CLAUDE.md
|
|
494
|
+
# "No such file" → BLOCKED. Run `peaks standards init --project <repo> --apply --json`
|
|
495
|
+
# (first time) or `peaks standards update --project <repo> --apply --json` (existing).
|
|
496
|
+
ls <repo>/.claude/rules/common/coding-style.md \
|
|
497
|
+
<repo>/.claude/rules/common/code-review.md \
|
|
498
|
+
<repo>/.claude/rules/common/security.md
|
|
499
|
+
# Any "No such file" → BLOCKED. The standards apply step did not complete; re-run
|
|
500
|
+
# standards init/update with --apply and re-verify.
|
|
501
|
+
# Skipping Gate G (e.g. because the user did not explicitly authorize writes) is
|
|
502
|
+
# only acceptable in `assisted`/`strict` modes where the user actively declined; in
|
|
503
|
+
# `full-auto`/`swarm` the absence of these files is a workflow violation.
|
|
504
|
+
```
|
|
505
|
+
|
|
339
506
|
|
|
340
507
|
## Swarm parallel phase
|
|
341
508
|
|
|
@@ -353,19 +520,41 @@ After PRD reaches `confirmed-by-user`, Solo launches peaks-ui, peaks-rd(planning
|
|
|
353
520
|
|
|
354
521
|
## Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
355
522
|
|
|
523
|
+
> **CLI gate enforcement**: `peaks request transition` now refuses to move RD/QA to gated states when required artifacts are missing. The required files depend on `--type` chosen at `peaks request init` (default `feature`):
|
|
524
|
+
>
|
|
525
|
+
> - `feature` / `refactor`: full gates (tech-doc, code-review, security-review, test-cases, test-report, security-findings, performance-findings)
|
|
526
|
+
> - `bugfix`: lighter planning (`bug-analysis.md` instead of `tech-doc.md`); still requires code-review + security-review + regression test-cases + security-findings; performance-findings optional unless the bug is performance-related
|
|
527
|
+
> - `config`: only security-review (RD) and security-findings (QA)
|
|
528
|
+
> - `docs` / `chore`: no gates
|
|
529
|
+
>
|
|
530
|
+
> When PRD lands, classify the request type before running `peaks request init` for every role — pass `--type <type>` so the artifact records it and downstream transitions enforce the right gates. Misclassifying a feature as `docs` to skip gates is a workflow violation. If a transition fails with `code: PREREQUISITES_MISSING`, the response lists every missing path — produce them, then re-transition. For one-off exceptions, the escape hatch `--allow-incomplete --reason "<text>"` records the bypass in the artifact transition note.
|
|
531
|
+
|
|
356
532
|
After `peaks-rd` finishes any implementation, repair, or code-output slice, Peaks Solo MUST automatically route the result to `peaks-qa` without waiting for user confirmation. This is not optional in full-auto mode. Solo must not declare the workflow complete, emit a TXT handoff, or stop at RD completion.
|
|
357
533
|
|
|
358
|
-
**
|
|
534
|
+
**How Solo invokes another role skill (mechanism, not metaphor):**
|
|
535
|
+
|
|
536
|
+
Solo is itself a skill running in the current session. To "invoke peaks-rd" or "peaks-qa", Solo MUST use the `Skill` tool with the role's name (e.g. `Skill(skill="peaks-rd")` or `Skill(skill="peaks-qa")`), passing the `<request-id>` and `<session-id>` as arguments so the role reads the same artifacts Solo wrote. Do NOT re-implement the role's logic inline in Solo. Do NOT use the `Agent` tool with a sub-agent — role skills are skills, not agents. After the role skill returns, Solo reads the artifacts the role wrote (via the request artifact path or `peaks request show <rid> --role <role>`) to decide the next step.
|
|
537
|
+
|
|
538
|
+
**Full-auto auto-proceed rule**: In the `full-auto` profile, when RD transitions to `qa-handoff`, Solo immediately invokes `peaks-qa` via the Skill tool with the same `<request-id>`. Do not pause, do not ask the user, do not summarize RD results as if they were final. The only valid reason to skip QA is when `--type` is `docs` or `chore` (no acceptance surface).
|
|
359
539
|
|
|
360
540
|
A QA report with any failing, blocked, missing, or unverified acceptance item is not a pass.
|
|
361
541
|
|
|
362
|
-
|
|
542
|
+
**How Solo routes QA findings back to RD (mechanism, not metaphor):**
|
|
363
543
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
544
|
+
When `peaks-qa` returns `verdict=return-to-rd`, Solo does NOT manually rewrite RD artifacts. Instead it follows this exact sequence:
|
|
545
|
+
|
|
546
|
+
1. Read the QA verdict and findings via `peaks request show <rid> --role qa --project <repo> --json`. The findings live in the QA artifact body (failing acceptance items, evidence paths, severity).
|
|
547
|
+
2. Transition the RD artifact back from `qa-handoff` to a working state and record the QA verdict in the transition note:
|
|
548
|
+
```bash
|
|
549
|
+
peaks request transition <rid> --role rd --state spec-locked \
|
|
550
|
+
--reason "QA return-to-rd cycle <N>: <one-line summary of failing items; full findings in qa/test-reports/<rid>.md>" \
|
|
551
|
+
--project <repo> --json
|
|
552
|
+
```
|
|
553
|
+
`spec-locked` is the canonical "needs more RD work" state. The reason is mandatory in repair cycles so the artifact history shows the loop.
|
|
554
|
+
3. Invoke `peaks-rd` via the Skill tool. Pass the request id and the path to the QA findings; peaks-rd reads `qa/test-reports/<rid>.md` and the QA `requests/<rid>.md` for the verdict.
|
|
555
|
+
4. peaks-rd fixes the reported issues only (red-line scope: do not modify unrelated surfaces), regenerates code-review and security-review evidence if changes touched reviewed surfaces, then transitions `rd → implemented → qa-handoff` again.
|
|
556
|
+
5. Solo invokes `peaks-qa` again with the same `<request-id>` (the same Skill call as before). QA re-runs gates against the new diff.
|
|
557
|
+
6. Repeat steps 1-5 until QA returns `verdict=pass`, or the cap below fires.
|
|
369
558
|
|
|
370
559
|
**Repair cycle cap**: After 3 repair cycles without a passing QA verdict, emit a blocked TXT handoff regardless of remaining issues. Do not loop indefinitely. If a specific issue cannot be resolved within 3 cycles, mark it as a known blocker in the TXT handoff and proceed to the SC phase.
|
|
371
560
|
|
|
@@ -375,46 +564,89 @@ In full-auto mode, treat the RD↔QA repair loop as a built-in controller object
|
|
|
375
564
|
|
|
376
565
|
> **Maintenance**: The numbered workflow list above (steps 0-11) is the canonical phase sequence. This runbook is the executable CLI transcription. When updating this skill, keep both in lockstep — a change to one must be reflected in the other.
|
|
377
566
|
|
|
378
|
-
The end-to-end CLI sequence for the
|
|
567
|
+
The end-to-end CLI sequence for the `full-auto` profile. `assisted` and `strict` profiles pause at `[CONFIRM]` markers below. `full-auto` and `swarm` auto-proceed through all gates. See Transition Gates for artifact verification at each stage.
|
|
379
568
|
|
|
380
569
|
```bash
|
|
381
|
-
# 0. Snapshot + 0.5 Workspace + 0.6 Project scan
|
|
570
|
+
# 0. Snapshot + 0.5 Workspace + 0.6 Project scan + 0.7 Existing-system extraction
|
|
382
571
|
peaks doctor --json
|
|
383
572
|
peaks project dashboard --project <repo> --json
|
|
384
573
|
peaks skill runbook peaks-solo --json
|
|
385
574
|
peaks workspace init --project <repo> --session-id <YYYY-MM-DD-<slug>> --json
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
#
|
|
389
|
-
peaks
|
|
575
|
+
peaks scan archetype --project <repo> --json
|
|
576
|
+
# → copy archetype, frontendOnly, signals into .peaks/<session-id>/rd/project-scan.md (Gate A)
|
|
577
|
+
# → if archetype != greenfield AND archetype != unknown:
|
|
578
|
+
peaks scan existing-system --project <repo> --json
|
|
579
|
+
# → copy tokens, sources, conventions, inconsistencies into .peaks/<session-id>/system/existing-system.md (Gate A.5)
|
|
580
|
+
|
|
581
|
+
# 1. Standards preflight + apply
|
|
582
|
+
# Run dry-run first to inspect deltas, then APPLY. In full-auto and swarm modes,
|
|
583
|
+
# --apply is the default — Standards files (CLAUDE.md, .claude/rules/**) live INSIDE
|
|
584
|
+
# the target project and are required for downstream skill preflight, so producing
|
|
585
|
+
# them is part of completing the workflow. Assisted/Strict modes pause for [CONFIRM]
|
|
586
|
+
# between dry-run and apply.
|
|
587
|
+
peaks standards init --project <repo> --dry-run --json
|
|
390
588
|
# or: peaks standards update --project <repo> --dry-run --json
|
|
589
|
+
peaks standards init --project <repo> --apply --json
|
|
590
|
+
# or: peaks standards update --project <repo> --apply --json
|
|
591
|
+
# After apply, verify the files actually exist on disk (see Gate G).
|
|
391
592
|
|
|
392
593
|
# 2. PRD (Assisted/Strict: [CONFIRM] before confirmed-by-user)
|
|
393
|
-
|
|
594
|
+
# Classify the request type from the PRD: feature | bugfix | refactor | docs | config | chore
|
|
595
|
+
# This drives RD/QA gate strictness — see "Mandatory RD QA repair loop" for the matrix.
|
|
596
|
+
peaks request init --role prd --id <rid> --project <repo> --apply --type <type> --json
|
|
597
|
+
# Cross-verify the chosen --type against the current git diff (only meaningful if RD has started writing code;
|
|
598
|
+
# safe to run early too, just expect "no changes" rationale until code lands).
|
|
599
|
+
peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
600
|
+
# → consistent=false → re-classify before continuing. consistent=true → proceed.
|
|
601
|
+
# Lint the PRD artifact before transitioning out of draft.
|
|
602
|
+
peaks request lint <rid> --role prd --project <repo> --json
|
|
603
|
+
# → ok=false → fill in <placeholders>, then re-run.
|
|
394
604
|
peaks request transition <rid> --role prd --state confirmed-by-user --project <repo> --json
|
|
395
605
|
peaks request transition <rid> --role prd --state handed-off --project <repo> --json
|
|
396
606
|
|
|
397
607
|
# 3. Swarm parallel — launch UI + RD(planning) + QA(test-cases) simultaneously
|
|
398
|
-
|
|
608
|
+
# Pass the same --type chosen for PRD so RD/QA gate matrix lines up.
|
|
609
|
+
peaks request init --role ui --id <rid> --project <repo> --apply --type <type> --json
|
|
399
610
|
peaks request transition <rid> --role ui --state direction-locked --project <repo> --json
|
|
400
611
|
peaks request transition <rid> --role ui --state handed-off --project <repo> --json
|
|
401
|
-
peaks request init --role rd --id <rid> --project <repo> --apply --json
|
|
612
|
+
peaks request init --role rd --id <rid> --project <repo> --apply --type <type> --json
|
|
402
613
|
peaks request transition <rid> --role rd --state spec-locked --project <repo> --json
|
|
403
|
-
peaks request init --role qa --id <rid> --project <repo> --apply --json
|
|
614
|
+
peaks request init --role qa --id <rid> --project <repo> --apply --type <type> --json
|
|
404
615
|
# → Gate B convergence check. Assisted/Strict: [CONFIRM]
|
|
405
616
|
|
|
406
|
-
# 4. RD
|
|
617
|
+
# 4. RD planning artifact (the file required by the prerequisite gate)
|
|
618
|
+
# feature / refactor → write .peaks/<id>/rd/tech-doc.md
|
|
619
|
+
# bugfix → write .peaks/<id>/rd/bug-analysis.md
|
|
620
|
+
# config → no planning artifact required at this state
|
|
621
|
+
# docs / chore → no planning artifact required
|
|
407
622
|
peaks request transition <rid> --role rd --state implemented --project <repo> --json
|
|
408
|
-
peaks request transition <rid> --role rd --state qa-handoff --project <repo> --json
|
|
409
623
|
|
|
410
|
-
# 5. Code review + security review
|
|
624
|
+
# 5. Code review + security review BEFORE qa-handoff transition.
|
|
625
|
+
# Produce the evidence files the CLI gate enforces:
|
|
626
|
+
# - .peaks/<id>/rd/code-review.md (CRITICAL/HIGH findings + fixes; required for feature/bugfix/refactor)
|
|
627
|
+
# - .peaks/<id>/rd/security-review.md (required for feature/bugfix/refactor/config)
|
|
628
|
+
# Then transition. If --type is docs/chore the gate is empty and the transition is unguarded.
|
|
629
|
+
peaks request transition <rid> --role rd --state qa-handoff --project <repo> --json
|
|
411
630
|
|
|
412
631
|
# 6. QA validation (AUTO-PROCEED from RD in full-auto)
|
|
632
|
+
# Before each QA transition, produce the evidence files the CLI gate enforces:
|
|
633
|
+
# Before qa:running → .peaks/<id>/qa/test-cases/<rid>.md
|
|
413
634
|
peaks request transition <rid> --role qa --state running --project <repo> --json
|
|
635
|
+
# Before qa:verdict-issued → .peaks/<id>/qa/test-reports/<rid>.md
|
|
636
|
+
# + .peaks/<id>/qa/security-findings.md
|
|
637
|
+
# + .peaks/<id>/qa/performance-findings.md (feature/refactor only)
|
|
414
638
|
peaks request transition <rid> --role qa --state verdict-issued --project <repo> --json
|
|
415
639
|
# → Gate D check. Assisted/Strict: [CONFIRM]
|
|
416
640
|
|
|
417
|
-
# 7. RD↔QA repair loop — if verdict is return-to-rd, re-run 4 through 6 until QA passes or blocked TXT
|
|
641
|
+
# 7. RD↔QA repair loop — if verdict is return-to-rd, re-run 4 through 6 until QA passes or blocked TXT.
|
|
642
|
+
# Before invoking peaks-rd again, check the cycle count so you don't blow past the cap silently:
|
|
643
|
+
peaks request repair-status <rid> --project <repo> --json
|
|
644
|
+
# → atCap=true → STOP and emit a blocked TXT handoff. Do NOT enter another cycle.
|
|
645
|
+
# → remaining > 0 → safe to continue. The next transition's --reason must include "QA return-to-rd cycle N: ..."
|
|
646
|
+
# so this command keeps counting accurately.
|
|
647
|
+
# After RD finishes the repair, re-check that the diff is still consistent with the declared --type:
|
|
648
|
+
peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
649
|
+
# → consistent=false → RD scope-creeped during repair; review before re-handoff.
|
|
418
650
|
|
|
419
651
|
# 8. SC phase
|
|
420
652
|
peaks sc impact --change-id <cid> --module <module> --file <path> --json
|
|
@@ -444,10 +676,12 @@ Before orchestrating an end-to-end code repository workflow, gather the project
|
|
|
444
676
|
- `peaks standards init --project <path> --dry-run`
|
|
445
677
|
- `peaks standards update --project <path> --dry-run`
|
|
446
678
|
|
|
447
|
-
Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior.
|
|
679
|
+
Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior. In `full-auto` and `swarm` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
|
|
448
680
|
|
|
449
681
|
**CRITICAL — Standards must reflect the project scan.** When generating or updating `CLAUDE.md`, the content must reference concrete findings from `.peaks/<id>/rd/project-scan.md`: the detected component library (e.g. "This project uses antd 5.x"), CSS solution (e.g. "Uses Less via Umi"), build tool, state management, and routing. Never emit a generic template that says "read .claude/rules/..." without naming the actual project stack. If the project-scan has not been run yet, run it before standards init/update.
|
|
450
682
|
|
|
683
|
+
**Legacy projects additionally** — when archetype ∈ {legacy-frontend, legacy-fullstack, frontend-monorepo}, the `CLAUDE.md` Conventions section MUST extract concrete naming, directory, service-layer, and hooks conventions from `.peaks/<id>/system/existing-system.md` and record them as hard constraints for new code. It must also list the `## Legacy constraints` from `project-scan.md` (class components, moment, enzyme, etc.) and instruct that new code in the same module preserves those patterns unless PRD explicitly authorizes modernization. A `CLAUDE.md` for a legacy project that contains only generic rule pointers without naming the actual conventions is a blocking violation — regenerate it.
|
|
684
|
+
|
|
451
685
|
Do not hand-write standards file mutations inside the skill.
|
|
452
686
|
|
|
453
687
|
For project-analysis requests such as "分析项目", the handoff must include an explicit **Standards increment** section. Report the current `CLAUDE.md` and `.claude/rules/**` status from the dry-run output as incremental deltas, not just a generic preflight note:
|
|
@@ -475,6 +709,18 @@ It must enforce the shared refactor red lines:
|
|
|
475
709
|
6. require 100% acceptance for each slice;
|
|
476
710
|
7. require code changes and sanitized intermediate artifacts to be traceable in local `.peaks/<session-id>/` storage before the next slice; commit or sync sanitized artifacts only when explicitly authorized.
|
|
477
711
|
|
|
712
|
+
## Quality-gate commands (CLI cheat sheet)
|
|
713
|
+
|
|
714
|
+
These commands harden the workflow against silent skips. Use them in the runbook at the points indicated; they all support `--json` and `--session-id`.
|
|
715
|
+
|
|
716
|
+
| Command | Purpose | When to run | Non-zero exit when |
|
|
717
|
+
|---|---|---|---|
|
|
718
|
+
| `peaks request lint <rid> --role <role> --project <path>` | Scan artifact body for unfilled `<placeholder>`, bare `- ...` bullets, TBD/TODO markers | Before every transition out of `draft` / before role handoff | Any `error`-severity finding (unfilled placeholder, bare-dot bullet) |
|
|
719
|
+
| `peaks request repair-status <rid> --project <path>` | Count RD↔QA repair cycles from `--reason` transition notes ("QA cycle N: ...") | Before every RD repair iteration in step 7 | Cycle count reached the 3-cycle cap |
|
|
720
|
+
| `peaks scan request-type-sanity --project <path> --type <type>` | Cross-verify declared `--type` against the actual `git diff` file mix (catches "feature mis-declared as docs" workflow violations) | After PRD type lock-in AND after each RD repair iteration | Declared type disagrees with the file mix |
|
|
721
|
+
|
|
722
|
+
Together with `peaks request transition` (which already CLI-enforces per-type artifact prerequisites), these four commands form the runtime quality net. SKILL.md prose is descriptive; the CLI is what physically blocks bad workflows.
|
|
723
|
+
|
|
478
724
|
## Completion handoff
|
|
479
725
|
|
|
480
726
|
After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write). Merge scan-backed changes incrementally; preserve hand-maintained content unless user confirms deletion.
|
|
@@ -491,4 +737,4 @@ Use Peaks TXT for the compact handoff capsule: mode, validated decisions, artifa
|
|
|
491
737
|
|
|
492
738
|
**MCP lifecycle**: `list → plan → apply --yes → call → rollback`. `apply` backs up settings and refuses non-peaks entries unless `--claim` is passed.
|
|
493
739
|
|
|
494
|
-
Detailed rules: `references/external-skill-invocation.md`, `references/openspec-mcp-workflow.md`, `references/workflow.md`.
|
|
740
|
+
Detailed rules: `references/external-skill-invocation.md`, `references/openspec-mcp-workflow.md`, `references/workflow.md`, `references/existing-system-extraction.md`.
|