peaks-cli 1.0.16 → 1.0.18
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/bin/peaks.js +0 -0
- 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/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 +42 -0
- package/skills/peaks-rd/SKILL.md +65 -2
- package/skills/peaks-solo/SKILL.md +389 -263
- package/skills/peaks-solo/references/existing-system-extraction.md +78 -0
- package/skills/peaks-solo/results.tsv +0 -1
|
@@ -9,12 +9,36 @@ Peaks Solo is the orchestration facade for the Peaks short skill family.
|
|
|
9
9
|
|
|
10
10
|
Use this skill to identify the user scenario, recommend an execution mode, coordinate role skills, and produce the final handoff report. Do not collapse role responsibilities into this skill.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Startup sequence (MANDATORY — execute in order)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Step 1: Mode selection (MUST run before presence:set)
|
|
15
|
+
|
|
16
|
+
When the user invokes Peaks Solo without explicitly naming an execution profile, use `AskUserQuestion` BEFORE any other action. Present the recommended full-auto path as the first/default option with a practical description for each:
|
|
17
|
+
|
|
18
|
+
1. **Full auto (Recommended)** — Peaks handles planning, role coordination, validation, and compact handoff end-to-end while preserving required confirmation gates for risky or shared-state actions.
|
|
19
|
+
2. **Assisted** — Peaks proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
|
|
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
|
+
4. **Strict** — Peaks uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
|
|
22
|
+
|
|
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
|
+
|
|
25
|
+
| User selects | `--mode` value |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Full auto | `full-auto` |
|
|
28
|
+
| Assisted | `assisted` |
|
|
29
|
+
| Swarm | `swarm` |
|
|
30
|
+
| Strict | `strict` |
|
|
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
|
+
|
|
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.
|
|
35
|
+
|
|
36
|
+
### Step 2: Set skill presence
|
|
37
|
+
|
|
38
|
+
Only after the mode is known (user selected or explicitly named), run:
|
|
15
39
|
|
|
16
40
|
```bash
|
|
17
|
-
peaks skill presence:set peaks-solo --mode <mode> --gate startup
|
|
41
|
+
peaks skill presence:set peaks-solo --mode <mode-value> --gate startup
|
|
18
42
|
```
|
|
19
43
|
|
|
20
44
|
Then display the compact status header: `Peaks Skill: peaks-solo | Gate: startup | Next: <one short action>`. Display this header on EVERY turn while the skill is active.
|
|
@@ -45,9 +69,9 @@ Use the Peaks CLI for runtime side effects.
|
|
|
45
69
|
|
|
46
70
|
## GStack integration
|
|
47
71
|
|
|
48
|
-
Map gstack
|
|
72
|
+
Map gstack stages to Peaks role artifacts; preserve Peaks confirmation gates. Do not delegate orchestration to gstack commands.
|
|
49
73
|
|
|
50
|
-
For frontend workflows,
|
|
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`.
|
|
51
75
|
|
|
52
76
|
## Local intermediate artifact workspace (MANDATORY)
|
|
53
77
|
|
|
@@ -70,14 +94,29 @@ peaks workspace init --project <repo> --session-id <YYYY-MM-DD-<slug>> --json
|
|
|
70
94
|
The workspace initialization creates this structure under `.peaks/<session-id>/`:
|
|
71
95
|
|
|
72
96
|
```
|
|
73
|
-
prd/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
102
|
+
qa/test-reports/ # QA test reports (regression matrices, browser evidence)
|
|
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)
|
|
79
107
|
```
|
|
80
108
|
|
|
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`)
|
|
119
|
+
|
|
81
120
|
### Root pollution prohibition (CRITICAL)
|
|
82
121
|
|
|
83
122
|
**NEVER write Peaks intermediate artifacts to the project root directory.** Specifically prohibited at root level:
|
|
@@ -99,85 +138,120 @@ Do not default to git-backed storage or automatic commits for intermediate artif
|
|
|
99
138
|
|
|
100
139
|
## Pre-RD project scan checklist (MANDATORY)
|
|
101
140
|
|
|
102
|
-
Before handing off to `peaks-rd
|
|
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.
|
|
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.
|
|
103
161
|
|
|
104
|
-
|
|
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.
|
|
105
163
|
|
|
106
|
-
|
|
164
|
+
### 1. Build tool: inspect config files for the framework
|
|
107
165
|
|
|
108
166
|
| Config file | Framework |
|
|
109
167
|
|---|---|
|
|
110
168
|
| `.umirc.ts`, `config/config.ts` | Umi (Ant Design Pro) |
|
|
111
169
|
| `next.config.*` | Next.js |
|
|
112
170
|
| `vite.config.*` | Vite |
|
|
113
|
-
| `
|
|
171
|
+
| `rsbuild.config.*` | Rsbuild |
|
|
172
|
+
| `rspack.config.*` | Rspack |
|
|
173
|
+
| `farm.config.*` | Farm |
|
|
174
|
+
| `craco.config.*` | CRA + craco |
|
|
175
|
+
| `webpack.config.*` | Webpack |
|
|
176
|
+
| `gulpfile.*` | Gulp (legacy) |
|
|
114
177
|
| `angular.json` | Angular |
|
|
178
|
+
| Custom `build/` or `scripts/build.*` only | Bespoke pipeline — record as `custom` and capture entry script path |
|
|
115
179
|
|
|
116
|
-
|
|
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.
|
|
117
181
|
|
|
118
|
-
### 2. Component library
|
|
119
|
-
|
|
120
|
-
Identify the UI component library in use by checking `package.json` dependencies:
|
|
182
|
+
### 2. Component library: check `package.json` dependencies
|
|
121
183
|
|
|
122
184
|
| Package | Library |
|
|
123
185
|
|---|---|
|
|
124
|
-
| `antd` | Ant Design |
|
|
125
|
-
| `@
|
|
126
|
-
| `@
|
|
127
|
-
| `
|
|
186
|
+
| `antd` (capture major version: v3/v4/v5) | Ant Design |
|
|
187
|
+
| `@ant-design/pro-components`, `@ant-design/pro-*` | Ant Design Pro suite |
|
|
188
|
+
| `@mui/material` | Material UI |
|
|
189
|
+
| `tailwindcss` + `radix-ui` | shadcn/ui |
|
|
190
|
+
| `element-plus` / `element-ui` | Element UI/Plus |
|
|
128
191
|
| `@arco-design/web-react` | Arco Design |
|
|
192
|
+
| `tdesign-react` / `tdesign-vue-next` | TDesign |
|
|
193
|
+
| `@douyinfe/semi-ui` | Semi Design |
|
|
129
194
|
| `@nextui-org/react` | NextUI |
|
|
130
195
|
| `@chakra-ui/react` | Chakra UI |
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
**CRITICAL**: Never assume the component library. If the project uses `antd` and `@ant-design/pro-components`, do not introduce shadcn/ui components or vice versa. Adding a second component library to a project that already has one will cause style conflicts and bloated bundles.
|
|
134
|
-
|
|
135
|
-
Record the detected library, version, and any design-system packages (e.g. `@ant-design/pro-components`, `@ant-design/icons`).
|
|
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 |
|
|
136
198
|
|
|
137
|
-
|
|
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.
|
|
138
200
|
|
|
139
|
-
|
|
201
|
+
### 3. CSS framework: check for conflicts
|
|
140
202
|
|
|
141
|
-
- **
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
203
|
+
- **antd + TailwindCSS**: High conflict risk (preflight reset overrides base styles). Resolution:
|
|
204
|
+
- Both already in `package.json` → coexist; use Tailwind for layout, antd for components.
|
|
205
|
+
- Tailwind breaks antd styles → add `corePlugins: { preflight: false }` or `important: '#root'`.
|
|
206
|
+
- Only antd, user wants Tailwind → **Block**; propose antd `ConfigProvider` tokens or CSS Modules.
|
|
207
|
+
- **Less/Sass**: Standard for Umi+antd projects; compatible with CSS Modules.
|
|
208
|
+
- **CSS-in-JS (@emotion, styled-components)**: Check if component library already uses one internally; don't add competing solutions.
|
|
145
209
|
|
|
146
|
-
|
|
210
|
+
### 4. State management, routing, data fetching: detect from `package.json`
|
|
147
211
|
|
|
148
|
-
|
|
212
|
+
State: `zustand`, `jotai`, `redux`/`@reduxjs/toolkit`, `valtio`, `mobx`, `hox`
|
|
213
|
+
Routing: `react-router-dom`, `@umijs/max`, Next.js file-based, `vue-router`
|
|
214
|
+
Data fetching: `@tanstack/react-query`, `swr`, `ahooks` (`useRequest`), `umi-request`
|
|
149
215
|
|
|
150
|
-
|
|
151
|
-
|---|---|---|
|
|
152
|
-
| TailwindCSS + antd already in `package.json` (project lives with both) | Do not remove either. Record as "coexisting — project already handles specificity." RD uses Tailwind for layout/spacing utilities and antd for component styling. Add `@layer` directives if Tailwind preflight breaks antd. | Non-blocking |
|
|
153
|
-
| TailwindCSS present but antd styles visibly broken | Add `corePlugins: { preflight: false }` to `tailwind.config.js` or scope Tailwind with `important: '#root'`. Record the fix in project-scan. | Fix before RD |
|
|
154
|
-
| Project has only antd, user wants TailwindCSS | **Block.** Propose alternatives: CSS Modules + antd's `ConfigProvider` token system, or antd's built-in utility patterns. Only proceed with TailwindCSS if user explicitly confirms after seeing the conflict warning. | Blocking |
|
|
155
|
-
|
|
156
|
-
If none of the above apply and the conflict cannot be resolved automatically, flag as a blocking pre-RD issue with the specific conflict description and proposed resolution options for user decision.
|
|
216
|
+
### 5. Legacy signals (legacy-frontend / legacy-fullstack only)
|
|
157
217
|
|
|
158
|
-
|
|
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.
|
|
159
219
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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 |
|
|
166
230
|
|
|
167
|
-
|
|
231
|
+
### 6. Project-scan artifact template
|
|
168
232
|
|
|
169
233
|
```markdown
|
|
170
234
|
# Project Scan: <project-name>
|
|
171
235
|
**Date:** YYYY-MM-DD
|
|
172
236
|
**Session:** <session-id>
|
|
173
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
|
+
|
|
174
246
|
## Build tool
|
|
175
247
|
- Framework: <name> <version>
|
|
176
248
|
- Config file: <path>
|
|
249
|
+
- Mixed builds: <true | false; list all configs if true>
|
|
177
250
|
|
|
178
251
|
## Component library
|
|
179
|
-
- Library: <name> <version>
|
|
252
|
+
- Library: <name> <version (major matters for antd)>
|
|
180
253
|
- Design-system packages: <list>
|
|
254
|
+
- In-house design system: <package name | none>
|
|
181
255
|
|
|
182
256
|
## CSS solution
|
|
183
257
|
- Primary: <Less/Sass/CSS-in-JS/TailwindCSS/CSS Modules>
|
|
@@ -187,13 +261,25 @@ Write the scan result to `.peaks/<session-id>/rd/project-scan.md` with these sec
|
|
|
187
261
|
- State: <name>
|
|
188
262
|
- Routing: <name>
|
|
189
263
|
- Data fetching: <name>
|
|
190
|
-
```
|
|
191
264
|
|
|
192
|
-
|
|
265
|
+
## Legacy constraints
|
|
266
|
+
- <bullet list of legacy signals from section 5; empty for greenfield>
|
|
267
|
+
```
|
|
193
268
|
|
|
194
269
|
## Frontend-only development mode
|
|
195
270
|
|
|
196
|
-
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.
|
|
197
283
|
|
|
198
284
|
### Mock data strategy selection
|
|
199
285
|
|
|
@@ -206,6 +292,9 @@ Solo records the chosen mock strategy in `.peaks/<session-id>/rd/tech-doc.md` un
|
|
|
206
292
|
| `ahooks` `useRequest` + service functions | Service-layer mock: replace HTTP call with `Promise.resolve(mockData)` | Matches existing service-function pattern |
|
|
207
293
|
| MSW (Mock Service Worker) already configured | Add new handlers to existing MSW setup | Consistent with project convention |
|
|
208
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 |
|
|
209
298
|
|
|
210
299
|
**Mock data rules:**
|
|
211
300
|
|
|
@@ -213,34 +302,19 @@ Solo records the chosen mock strategy in `.peaks/<session-id>/rd/tech-doc.md` un
|
|
|
213
302
|
2. Mock data should be realistic (not `"test"`, `"foo"`, `123`) — use plausible Chinese/English content that resembles production data.
|
|
214
303
|
3. Each mock must export its TypeScript interface so RD implementation and QA test-cases can import the same types.
|
|
215
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.
|
|
216
306
|
|
|
217
307
|
### API contract placeholder pattern
|
|
218
308
|
|
|
219
|
-
When no swagger.json exists, RD defines API contracts as TypeScript interfaces
|
|
309
|
+
When no swagger.json exists, RD defines API contracts as TypeScript interfaces with a mock-then-real service layer:
|
|
220
310
|
|
|
221
311
|
```
|
|
222
|
-
src/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<feature>-api.types.ts ← API request/response interfaces
|
|
226
|
-
<feature>-service.ts ← Service functions (mock now, real later)
|
|
227
|
-
mock/
|
|
228
|
-
<feature>-mock.ts ← Mock data satisfying the interfaces
|
|
312
|
+
src/services/types/<feature>-api.types.ts ← API request/response interfaces
|
|
313
|
+
src/services/<feature>-service.ts ← Service functions (mock → real)
|
|
314
|
+
mock/<feature>-mock.ts ← Mock data satisfying interfaces
|
|
229
315
|
```
|
|
230
316
|
|
|
231
|
-
Each service function
|
|
232
|
-
|
|
233
|
-
```typescript
|
|
234
|
-
// src/services/knowledge-service.ts
|
|
235
|
-
import type { KnowledgeListResponse, KnowledgeCreateRequest } from './types/knowledge-api.types';
|
|
236
|
-
// MOCK: Replace mock import with real HTTP call when swagger.json is available
|
|
237
|
-
import { mockKnowledgeList } from '@/mock/knowledge-mock';
|
|
238
|
-
|
|
239
|
-
export async function fetchKnowledgeList(params: KnowledgeListParams): Promise<KnowledgeListResponse> {
|
|
240
|
-
// TODO: Replace with real API call — POST /api/v1/knowledge/list
|
|
241
|
-
return mockKnowledgeList;
|
|
242
|
-
}
|
|
243
|
-
```
|
|
317
|
+
Each service function returns a typed mock response marked with `// MOCK: Replace with real API call when swagger.json is available`.
|
|
244
318
|
|
|
245
319
|
### Mock-to-real migration path
|
|
246
320
|
|
|
@@ -264,24 +338,45 @@ When the PRD source is a Feishu/Lark document that requires authentication:
|
|
|
264
338
|
|
|
265
339
|
Never silently fall back to unauthenticated `fetch` or `WebFetch` for authenticated documents.
|
|
266
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
|
+
|
|
267
358
|
When Peaks Solo coordinates development in a code repository, keep this order explicit:
|
|
268
359
|
|
|
269
|
-
0.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
360
|
+
0. **Snapshot** — `peaks doctor` + `peaks project dashboard` to capture baseline state before anything else;
|
|
361
|
+
0.5. **Workspace initialization** — `.peaks/<session-id>/` created, directory structure verified;
|
|
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;
|
|
364
|
+
1. **Standards preflight** — `peaks standards init/update --dry-run`, must reference concrete project-scan findings (never emit generic templates);
|
|
365
|
+
2. **PRD phase** — capture request as canonical artifact, extract scope and acceptance criteria:
|
|
366
|
+
- Full-auto/Swarm: auto-transition to `confirmed-by-user` once the artifact is complete;
|
|
367
|
+
- Assisted/Strict: pause with `AskUserQuestion` for explicit user confirmation before proceeding;
|
|
368
|
+
3. **Swarm parallel phase** — after PRD confirmed, launch UI, RD(planning), QA(test-cases) simultaneously:
|
|
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;
|
|
373
|
+
5. **Code review + security review** — CRITICAL/HIGH issues fixed before progression; marked-blocked issues only allow a blocked handoff;
|
|
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;
|
|
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;
|
|
376
|
+
8. **SC phase** — change-control evidence: impact, retention, validate, boundary;
|
|
377
|
+
9. **OpenSpec archive** — exit gate: validate → archive only after QA verdict=pass (when `openspec/` exists);
|
|
378
|
+
10. **TXT handoff capsule** — mode, validated decisions, artifact paths, standards deltas, open questions, next action;
|
|
379
|
+
11. **Final snapshot** — `peaks project dashboard` + `peaks skill doctor` to confirm the workflow closed cleanly.
|
|
285
380
|
|
|
286
381
|
### Transition verification gates (MANDATORY — run the command, see the output)
|
|
287
382
|
|
|
@@ -292,32 +387,76 @@ You cannot declare a phase complete from memory. Each gate below is a `ls` comma
|
|
|
292
387
|
ls .peaks/<id>/rd/project-scan.md
|
|
293
388
|
# Expected output: .peaks/<id>/rd/project-scan.md
|
|
294
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)
|
|
295
400
|
```
|
|
296
401
|
|
|
297
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
|
+
|
|
298
406
|
```bash
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
#
|
|
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.
|
|
306
428
|
```
|
|
307
429
|
|
|
308
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
|
+
|
|
309
434
|
```bash
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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.
|
|
313
444
|
```
|
|
314
445
|
|
|
315
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
|
+
|
|
316
450
|
```bash
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
#
|
|
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.
|
|
321
460
|
```
|
|
322
461
|
|
|
323
462
|
**Gate E — Before declaring workflow complete:**
|
|
@@ -345,189 +484,162 @@ find . -maxdepth 1 -name "*.png" -o -name "*.jpg" -o -name "qa-*.js" -o -name "m
|
|
|
345
484
|
```
|
|
346
485
|
|
|
347
486
|
|
|
348
|
-
## Swarm parallel phase
|
|
487
|
+
## Swarm parallel phase
|
|
349
488
|
|
|
350
|
-
PRD
|
|
489
|
+
After PRD reaches `confirmed-by-user`, Solo launches peaks-ui, peaks-rd(planning), and peaks-qa(test-cases) simultaneously using parallel Agent calls. All three derive independently from the same PRD and write to separate artifact paths. Solo waits for all three, checks convergence (Gate B), then enters RD implementation.
|
|
351
490
|
|
|
352
|
-
###
|
|
491
|
+
### Degradation when swarm roles fail
|
|
353
492
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
└── peaks-qa → test-cases/*.md 独立:只需要 PRD 的验收标准来写测试用例
|
|
360
|
-
│
|
|
361
|
-
↓ 三个都完成后汇合
|
|
362
|
-
peaks-rd (implementation)
|
|
363
|
-
读取 design-draft.md + tech-doc.md + test-cases/*.md
|
|
364
|
-
开始编码实现
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### 为什么可以并行
|
|
368
|
-
|
|
369
|
-
- **UI 不依赖 RD 技术文档**:设计稿描述"长什么样",技术文档描述"怎么建",两者从同一个 PRD 出发独立产出
|
|
370
|
-
- **RD 技术文档不依赖 UI 设计稿**:架构决策(组件树、数据流、API 契约)可以从 PRD 的功能描述直接推导,不需要等到视觉设计完成。RD 实现阶段才需要读设计稿
|
|
371
|
-
- **QA 测试用例不依赖实现代码**:TDD 原则——测试用例应该在代码之前写好。QA 根据 PRD 验收标准写用例,不依赖 RD 的输出
|
|
372
|
-
|
|
373
|
-
### 并行执行规则
|
|
374
|
-
|
|
375
|
-
1. PRD 状态到达 `confirmed-by-user` 后,Solo 同时启动 peaks-ui、peaks-rd(planning)、peaks-qa(test-cases)
|
|
376
|
-
2. 如果在 full-auto 模式下,使用并行 Agent 调用来执行(一次发送多个 Agent tool call)
|
|
377
|
-
3. 三个角色各自写入独立产物,互不冲突
|
|
378
|
-
4. Solo 等待三个角色全部完成后,再进入 RD 实现阶段
|
|
379
|
-
5. RD 实现阶段读取所有三个产物,综合实施
|
|
380
|
-
|
|
381
|
-
### 产物汇合检查
|
|
493
|
+
1. **UI missing**: RD continues with PRD visual descriptions; note "ui-design-missing" in TXT.
|
|
494
|
+
2. **RD planning missing**: RD continues; note "tech-doc-missing" in TXT.
|
|
495
|
+
3. **QA test-cases missing**: RD continues; QA must backfill test cases before issuing verdict.
|
|
496
|
+
4. **Two or more missing**: Fall back to sequential mode (PRD → RD → QA); note "swarm-degraded-to-sequential".
|
|
497
|
+
5. **All three missing**: Pause workflow; report to user; request confirmation to continue.
|
|
382
498
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
```
|
|
386
|
-
.peaks/<session-id>/ui/design-draft.md ← peaks-ui 产出
|
|
387
|
-
.peaks/<session-id>/rd/tech-doc.md ← peaks-rd 规划产出
|
|
388
|
-
.peaks/<session-id>/qa/test-cases/<id>.md ← peaks-qa 测试用例产出
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
缺任何一个都不能进入实现阶段。
|
|
499
|
+
**UI phase mandatory for frontend**: When the request affects user-visible behavior (pages, components, forms, modals, tables, styling, interaction, or layout), Peaks Solo MUST invoke `peaks-ui` in the swarm parallel phase alongside RD planning and QA test-case generation. UI produces design drafts that RD implementation later consumes. Skipping UI for frontend work is a blocking violation. The only valid reason to skip UI is when the request is purely backend (API, database, CLI, config, or build tooling).
|
|
392
500
|
|
|
393
|
-
|
|
501
|
+
## Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
394
502
|
|
|
395
|
-
|
|
503
|
+
> **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`):
|
|
504
|
+
>
|
|
505
|
+
> - `feature` / `refactor`: full gates (tech-doc, code-review, security-review, test-cases, test-report, security-findings, performance-findings)
|
|
506
|
+
> - `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
|
|
507
|
+
> - `config`: only security-review (RD) and security-findings (QA)
|
|
508
|
+
> - `docs` / `chore`: no gates
|
|
509
|
+
>
|
|
510
|
+
> 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.
|
|
396
511
|
|
|
397
|
-
|
|
398
|
-
2. **RD(planning) 失败(tech-doc 缺失)**: 不阻塞 RD 实现阶段,RD 可以在实现过程中内联补充技术决策。tech-doc 缺失必须在 TXT 手记中标注
|
|
399
|
-
3. **QA(test-cases) 失败(test-cases 缺失)**: 不阻塞 RD 实现,但 QA 必须在 RD 完成实现后补充测试用例才能进入验证阶段。阻塞 QA verdict 直到测试用例补齐
|
|
400
|
-
4. **两个或以上角色失败**: 回退到串行降级模式——按 PRD→RD(含内联设计+规划)→QA(含测试用例+验证) 的顺序逐步执行,跳过 UI 阶段。TXT 手记标注 "swarm-degraded-to-sequential"
|
|
401
|
-
5. **全部三个角色失败**: 暂停工作流,向用户报告失败原因(大概率是 PRD 信息不足或 CLI 环境问题),请求用户确认是否继续
|
|
512
|
+
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.
|
|
402
513
|
|
|
403
|
-
Solo
|
|
514
|
+
**How Solo invokes another role skill (mechanism, not metaphor):**
|
|
404
515
|
|
|
405
|
-
|
|
516
|
+
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.
|
|
406
517
|
|
|
407
|
-
|
|
518
|
+
**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).
|
|
408
519
|
|
|
409
|
-
|
|
520
|
+
A QA report with any failing, blocked, missing, or unverified acceptance item is not a pass.
|
|
410
521
|
|
|
411
|
-
**
|
|
522
|
+
**How Solo routes QA findings back to RD (mechanism, not metaphor):**
|
|
412
523
|
|
|
413
|
-
|
|
524
|
+
When `peaks-qa` returns `verdict=return-to-rd`, Solo does NOT manually rewrite RD artifacts. Instead it follows this exact sequence:
|
|
414
525
|
|
|
415
|
-
|
|
526
|
+
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).
|
|
527
|
+
2. Transition the RD artifact back from `qa-handoff` to a working state and record the QA verdict in the transition note:
|
|
528
|
+
```bash
|
|
529
|
+
peaks request transition <rid> --role rd --state spec-locked \
|
|
530
|
+
--reason "QA return-to-rd cycle <N>: <one-line summary of failing items; full findings in qa/test-reports/<rid>.md>" \
|
|
531
|
+
--project <repo> --json
|
|
532
|
+
```
|
|
533
|
+
`spec-locked` is the canonical "needs more RD work" state. The reason is mandatory in repair cycles so the artifact history shows the loop.
|
|
534
|
+
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.
|
|
535
|
+
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.
|
|
536
|
+
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.
|
|
537
|
+
6. Repeat steps 1-5 until QA returns `verdict=pass`, or the cap below fires.
|
|
416
538
|
|
|
417
|
-
|
|
418
|
-
2. require RD to repair only the reported issues or explicitly mark a blocker;
|
|
419
|
-
3. run the relevant RD checks again;
|
|
420
|
-
4. run `peaks-qa` again on the repaired output;
|
|
421
|
-
5. repeat until QA reports all acceptance items passed, or emit a blocked TXT handoff.
|
|
539
|
+
**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.
|
|
422
540
|
|
|
423
|
-
|
|
541
|
+
In full-auto mode, treat the RD↔QA repair loop as a built-in controller objective: loop through RD→QA until all acceptance items pass (max 3 cycles). Do not exit the loop on a non-passing QA verdict unless the TXT handoff marks the workflow as blocked.
|
|
424
542
|
|
|
425
543
|
## Default runbook
|
|
426
544
|
|
|
427
|
-
|
|
545
|
+
> **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.
|
|
546
|
+
|
|
547
|
+
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.
|
|
428
548
|
|
|
429
549
|
```bash
|
|
430
|
-
# 0.
|
|
550
|
+
# 0. Snapshot + 0.5 Workspace + 0.6 Project scan + 0.7 Existing-system extraction
|
|
431
551
|
peaks doctor --json
|
|
432
|
-
peaks project dashboard --project <repo> --json
|
|
433
|
-
peaks skill runbook peaks-solo --json
|
|
434
|
-
peaks skill presence:set peaks-solo --mode solo # show persistent skill presence every turn
|
|
435
|
-
|
|
436
|
-
# 0.5 workspace initialization — MANDATORY before any artifact write
|
|
552
|
+
peaks project dashboard --project <repo> --json
|
|
553
|
+
peaks skill runbook peaks-solo --json
|
|
437
554
|
peaks workspace init --project <repo> --session-id <YYYY-MM-DD-<slug>> --json
|
|
438
|
-
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
#
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
#
|
|
453
|
-
#
|
|
454
|
-
|
|
455
|
-
#
|
|
456
|
-
|
|
457
|
-
peaks request
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
peaks request
|
|
469
|
-
|
|
470
|
-
#
|
|
471
|
-
|
|
472
|
-
#
|
|
473
|
-
#
|
|
474
|
-
#
|
|
475
|
-
#
|
|
476
|
-
#
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
#
|
|
480
|
-
#
|
|
481
|
-
#
|
|
482
|
-
peaks
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
#
|
|
487
|
-
#
|
|
488
|
-
#
|
|
489
|
-
peaks request transition <
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
#
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
#
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
peaks
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
#
|
|
555
|
+
peaks scan archetype --project <repo> --json
|
|
556
|
+
# → copy archetype, frontendOnly, signals into .peaks/<session-id>/rd/project-scan.md (Gate A)
|
|
557
|
+
# → if archetype != greenfield AND archetype != unknown:
|
|
558
|
+
peaks scan existing-system --project <repo> --json
|
|
559
|
+
# → copy tokens, sources, conventions, inconsistencies into .peaks/<session-id>/system/existing-system.md (Gate A.5)
|
|
560
|
+
|
|
561
|
+
# 1. Standards preflight
|
|
562
|
+
peaks standards init --project <repo> --dry-run --json
|
|
563
|
+
# or: peaks standards update --project <repo> --dry-run --json
|
|
564
|
+
|
|
565
|
+
# 2. PRD (Assisted/Strict: [CONFIRM] before confirmed-by-user)
|
|
566
|
+
# Classify the request type from the PRD: feature | bugfix | refactor | docs | config | chore
|
|
567
|
+
# This drives RD/QA gate strictness — see "Mandatory RD QA repair loop" for the matrix.
|
|
568
|
+
peaks request init --role prd --id <rid> --project <repo> --apply --type <type> --json
|
|
569
|
+
# Cross-verify the chosen --type against the current git diff (only meaningful if RD has started writing code;
|
|
570
|
+
# safe to run early too, just expect "no changes" rationale until code lands).
|
|
571
|
+
peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
572
|
+
# → consistent=false → re-classify before continuing. consistent=true → proceed.
|
|
573
|
+
# Lint the PRD artifact before transitioning out of draft.
|
|
574
|
+
peaks request lint <rid> --role prd --project <repo> --json
|
|
575
|
+
# → ok=false → fill in <placeholders>, then re-run.
|
|
576
|
+
peaks request transition <rid> --role prd --state confirmed-by-user --project <repo> --json
|
|
577
|
+
peaks request transition <rid> --role prd --state handed-off --project <repo> --json
|
|
578
|
+
|
|
579
|
+
# 3. Swarm parallel — launch UI + RD(planning) + QA(test-cases) simultaneously
|
|
580
|
+
# Pass the same --type chosen for PRD so RD/QA gate matrix lines up.
|
|
581
|
+
peaks request init --role ui --id <rid> --project <repo> --apply --type <type> --json
|
|
582
|
+
peaks request transition <rid> --role ui --state direction-locked --project <repo> --json
|
|
583
|
+
peaks request transition <rid> --role ui --state handed-off --project <repo> --json
|
|
584
|
+
peaks request init --role rd --id <rid> --project <repo> --apply --type <type> --json
|
|
585
|
+
peaks request transition <rid> --role rd --state spec-locked --project <repo> --json
|
|
586
|
+
peaks request init --role qa --id <rid> --project <repo> --apply --type <type> --json
|
|
587
|
+
# → Gate B convergence check. Assisted/Strict: [CONFIRM]
|
|
588
|
+
|
|
589
|
+
# 4. RD planning artifact (the file required by the prerequisite gate)
|
|
590
|
+
# feature / refactor → write .peaks/<id>/rd/tech-doc.md
|
|
591
|
+
# bugfix → write .peaks/<id>/rd/bug-analysis.md
|
|
592
|
+
# config → no planning artifact required at this state
|
|
593
|
+
# docs / chore → no planning artifact required
|
|
594
|
+
peaks request transition <rid> --role rd --state implemented --project <repo> --json
|
|
595
|
+
|
|
596
|
+
# 5. Code review + security review BEFORE qa-handoff transition.
|
|
597
|
+
# Produce the evidence files the CLI gate enforces:
|
|
598
|
+
# - .peaks/<id>/rd/code-review.md (CRITICAL/HIGH findings + fixes; required for feature/bugfix/refactor)
|
|
599
|
+
# - .peaks/<id>/rd/security-review.md (required for feature/bugfix/refactor/config)
|
|
600
|
+
# Then transition. If --type is docs/chore the gate is empty and the transition is unguarded.
|
|
601
|
+
peaks request transition <rid> --role rd --state qa-handoff --project <repo> --json
|
|
602
|
+
|
|
603
|
+
# 6. QA validation (AUTO-PROCEED from RD in full-auto)
|
|
604
|
+
# Before each QA transition, produce the evidence files the CLI gate enforces:
|
|
605
|
+
# Before qa:running → .peaks/<id>/qa/test-cases/<rid>.md
|
|
606
|
+
peaks request transition <rid> --role qa --state running --project <repo> --json
|
|
607
|
+
# Before qa:verdict-issued → .peaks/<id>/qa/test-reports/<rid>.md
|
|
608
|
+
# + .peaks/<id>/qa/security-findings.md
|
|
609
|
+
# + .peaks/<id>/qa/performance-findings.md (feature/refactor only)
|
|
610
|
+
peaks request transition <rid> --role qa --state verdict-issued --project <repo> --json
|
|
611
|
+
# → Gate D check. Assisted/Strict: [CONFIRM]
|
|
612
|
+
|
|
613
|
+
# 7. RD↔QA repair loop — if verdict is return-to-rd, re-run 4 through 6 until QA passes or blocked TXT.
|
|
614
|
+
# Before invoking peaks-rd again, check the cycle count so you don't blow past the cap silently:
|
|
615
|
+
peaks request repair-status <rid> --project <repo> --json
|
|
616
|
+
# → atCap=true → STOP and emit a blocked TXT handoff. Do NOT enter another cycle.
|
|
617
|
+
# → remaining > 0 → safe to continue. The next transition's --reason must include "QA return-to-rd cycle N: ..."
|
|
618
|
+
# so this command keeps counting accurately.
|
|
619
|
+
# After RD finishes the repair, re-check that the diff is still consistent with the declared --type:
|
|
620
|
+
peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
621
|
+
# → consistent=false → RD scope-creeped during repair; review before re-handoff.
|
|
622
|
+
|
|
623
|
+
# 8. SC phase
|
|
624
|
+
peaks sc impact --change-id <cid> --module <module> --file <path> --json
|
|
625
|
+
peaks sc retention --slice-id <rid> --prd <prd> --rd <rd> --qa <qa> --json
|
|
626
|
+
peaks sc validate --slice-id <rid> --json
|
|
627
|
+
peaks sc boundary --slice-id <rid> --artifact <artifact> --code <file> --json
|
|
628
|
+
|
|
629
|
+
# 9. OpenSpec archive (exit gate; only after QA pass, when openspec/ exists)
|
|
630
|
+
peaks openspec validate <cid> --project <repo> --json
|
|
631
|
+
peaks openspec archive <cid> --project <repo> --apply --json
|
|
632
|
+
|
|
633
|
+
# 10. TXT handoff
|
|
507
634
|
peaks memory extract --project <repo> --artifact <qa-artifact> --dry-run --json
|
|
508
635
|
|
|
509
|
-
#
|
|
636
|
+
# 11. Final snapshot
|
|
510
637
|
peaks project dashboard --project <repo> --json
|
|
511
|
-
peaks skill doctor --json
|
|
512
|
-
peaks skill presence:clear
|
|
638
|
+
peaks skill doctor --json
|
|
639
|
+
peaks skill presence:clear
|
|
513
640
|
```
|
|
514
641
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
For Assisted, Swarm, or Strict profiles, Solo pauses at the transition boundaries to confirm the next phase rather than running the chain straight through. The CLI sequence is the same; only the confirmation gate cadence differs.
|
|
518
|
-
|
|
519
|
-
## Mode selection
|
|
520
|
-
|
|
521
|
-
When the user invokes Peaks Solo without explicitly selecting an execution profile, use `AskUserQuestion` before orchestration starts. Present the recommended full-auto path as the first/default option, and give every option a practical description so users can choose quickly.
|
|
522
|
-
|
|
523
|
-
Offer these profiles unless the active command narrows the valid set:
|
|
524
|
-
|
|
525
|
-
1. **Full auto (Recommended, Solo profile)** — Peaks handles planning, role coordination, validation, and compact handoff end-to-end while preserving required confirmation gates for risky or shared-state actions.
|
|
526
|
-
2. **Assisted** — Peaks proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
|
|
527
|
-
3. **Swarm** — Peaks maximizes safe parallel role/worker execution for larger RD or QA workloads while keeping reducer validation and artifact boundaries explicit.
|
|
528
|
-
4. **Strict** — Peaks uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
|
|
529
|
-
|
|
530
|
-
If the user already names a profile, do not ask again unless the request crosses a risk boundary or the named profile conflicts with required Peaks gates.
|
|
642
|
+
Repair loop details: see `## Mandatory RD QA repair loop` above for the full 5-step procedure and the 3-cycle cap. Append transition notes via `--reason` rather than rewriting artifacts during repair cycles.
|
|
531
643
|
|
|
532
644
|
## Project standards preflight
|
|
533
645
|
|
|
@@ -540,6 +652,8 @@ Use `standards init` for first-time creation and `standards update` for existing
|
|
|
540
652
|
|
|
541
653
|
**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.
|
|
542
654
|
|
|
655
|
+
**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.
|
|
656
|
+
|
|
543
657
|
Do not hand-write standards file mutations inside the skill.
|
|
544
658
|
|
|
545
659
|
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:
|
|
@@ -567,6 +681,18 @@ It must enforce the shared refactor red lines:
|
|
|
567
681
|
6. require 100% acceptance for each slice;
|
|
568
682
|
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.
|
|
569
683
|
|
|
684
|
+
## Quality-gate commands (CLI cheat sheet)
|
|
685
|
+
|
|
686
|
+
These commands harden the workflow against silent skips. Use them in the runbook at the points indicated; they all support `--json` and `--session-id`.
|
|
687
|
+
|
|
688
|
+
| Command | Purpose | When to run | Non-zero exit when |
|
|
689
|
+
|---|---|---|---|
|
|
690
|
+
| `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) |
|
|
691
|
+
| `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 |
|
|
692
|
+
| `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 |
|
|
693
|
+
|
|
694
|
+
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.
|
|
695
|
+
|
|
570
696
|
## Completion handoff
|
|
571
697
|
|
|
572
698
|
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.
|
|
@@ -579,8 +705,8 @@ Use Peaks TXT for the compact handoff capsule: mode, validated decisions, artifa
|
|
|
579
705
|
|
|
580
706
|
**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.
|
|
581
707
|
|
|
582
|
-
**OpenSpec lifecycle**: `render → validate → show → to-rd → validate → archive`.
|
|
708
|
+
**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.
|
|
583
709
|
|
|
584
710
|
**MCP lifecycle**: `list → plan → apply --yes → call → rollback`. `apply` backs up settings and refuses non-peaks entries unless `--claim` is passed.
|
|
585
711
|
|
|
586
|
-
Detailed rules: `references/external-skill-invocation.md`, `references/openspec-mcp-workflow.md`, `references/workflow.md`.
|
|
712
|
+
Detailed rules: `references/external-skill-invocation.md`, `references/openspec-mcp-workflow.md`, `references/workflow.md`, `references/existing-system-extraction.md`.
|