peaks-cli 1.3.7 → 1.3.9
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/core-artifact-commands.js +119 -14
- package/dist/src/cli/commands/project-commands.js +58 -1
- package/dist/src/cli/commands/request-commands.js +124 -4
- package/dist/src/cli/commands/retrospective-commands.d.ts +3 -0
- package/dist/src/cli/commands/retrospective-commands.js +113 -0
- package/dist/src/cli/program.js +2 -0
- package/dist/src/services/artifacts/request-artifact-service.d.ts +16 -0
- package/dist/src/services/artifacts/request-artifact-service.js +18 -2
- package/dist/src/services/memory/project-memory-service.d.ts +19 -0
- package/dist/src/services/memory/project-memory-service.js +33 -0
- package/dist/src/services/retrospective/migrate-from-md.d.ts +37 -0
- package/dist/src/services/retrospective/migrate-from-md.js +528 -0
- package/dist/src/services/retrospective/retrospective-index.d.ts +37 -0
- package/dist/src/services/retrospective/retrospective-index.js +110 -0
- package/dist/src/services/retrospective/retrospective-show.d.ts +40 -0
- package/dist/src/services/retrospective/retrospective-show.js +109 -0
- package/dist/src/services/session/caller-binding-service.d.ts +70 -0
- package/dist/src/services/session/caller-binding-service.js +148 -0
- package/dist/src/services/session/caller-id-types.d.ts +77 -0
- package/dist/src/services/session/caller-id-types.js +46 -0
- package/dist/src/services/session/index.d.ts +4 -0
- package/dist/src/services/session/index.js +5 -0
- package/dist/src/services/session/platform-fallbacks.d.ts +31 -0
- package/dist/src/services/session/platform-fallbacks.js +35 -0
- package/dist/src/services/session/resolve-caller-id.d.ts +57 -0
- package/dist/src/services/session/resolve-caller-id.js +88 -0
- package/dist/src/services/skills/skill-presence-service.d.ts +11 -0
- package/dist/src/services/skills/skill-presence-service.js +59 -0
- package/dist/src/shared/format-md-compact.d.ts +32 -0
- package/dist/src/shared/format-md-compact.js +297 -0
- package/dist/src/shared/stale-policy.d.ts +67 -0
- package/dist/src/shared/stale-policy.js +85 -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 +86 -515
- package/skills/peaks-qa/references/artifact-per-request.md +7 -79
- package/skills/peaks-qa/references/browser-validation-contracts.md +51 -0
- package/skills/peaks-qa/references/codegraph-regression-focus.md +5 -0
- package/skills/peaks-qa/references/external-capability-guidance.md +9 -0
- package/skills/peaks-qa/references/qa-compact-handoff.md +3 -0
- package/skills/peaks-qa/references/qa-context-governance.md +24 -0
- package/skills/peaks-qa/references/qa-fanout-contract.md +8 -0
- package/skills/peaks-qa/references/qa-gstack-integration.md +7 -0
- package/skills/peaks-qa/references/qa-local-artifacts.md +3 -0
- package/skills/peaks-qa/references/qa-matt-pocock-integration.md +9 -0
- package/skills/peaks-qa/references/qa-refactor-role.md +3 -0
- package/skills/peaks-qa/references/qa-runbook.md +74 -0
- package/skills/peaks-qa/references/qa-skill-presence.md +22 -0
- package/skills/peaks-qa/references/qa-standards-preflight.md +8 -0
- package/skills/peaks-qa/references/qa-sub-agent-dispatch.md +38 -0
- package/skills/peaks-qa/references/qa-transition-gates.md +79 -0
- package/skills/peaks-qa/references/requirement-boundary-recheck.md +9 -0
- package/skills/peaks-qa/references/test-case-generation.md +27 -0
- package/skills/peaks-qa/references/test-report-output.md +14 -0
- package/skills/peaks-rd/SKILL.md +85 -732
- package/skills/peaks-rd/references/artifact-and-standards-output.md +9 -0
- package/skills/peaks-rd/references/artifact-per-request.md +20 -0
- package/skills/peaks-rd/references/browser-self-test-contracts.md +29 -0
- package/skills/peaks-rd/references/codegraph-project-analysis.md +5 -0
- package/skills/peaks-rd/references/compact-handoff.md +3 -0
- package/skills/peaks-rd/references/external-references.md +11 -0
- package/skills/peaks-rd/references/frontend-project-generation.md +11 -0
- package/skills/peaks-rd/references/library-version-awareness.md +30 -0
- package/skills/peaks-rd/references/mandatory-perf-baseline.md +40 -0
- package/skills/peaks-rd/references/mandatory-tech-doc.md +18 -0
- package/skills/peaks-rd/references/matt-pocock-integration.md +11 -0
- package/skills/peaks-rd/references/mock-data-placement.md +40 -0
- package/skills/peaks-rd/references/parallel-review-fanout.md +81 -0
- package/skills/peaks-rd/references/rd-context-governance.md +36 -0
- package/skills/peaks-rd/references/rd-gstack-integration.md +16 -0
- package/skills/peaks-rd/references/rd-runbook.md +125 -0
- package/skills/peaks-rd/references/rd-standards-preflight.md +8 -0
- package/skills/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
- package/skills/peaks-rd/references/rd-transition-gates.md +148 -0
- package/skills/peaks-rd/references/skill-presence-and-title.md +22 -0
- package/skills/peaks-solo/SKILL.md +87 -786
- package/skills/peaks-solo/references/anchoring-and-session-info.md +25 -0
- package/skills/peaks-solo/references/boundaries.md +21 -0
- package/skills/peaks-solo/references/codegraph-orchestration.md +5 -0
- package/skills/peaks-solo/references/completion-handoff.md +16 -0
- package/skills/peaks-solo/references/context-governance.md +51 -0
- package/skills/peaks-solo/references/external-references.md +17 -0
- package/skills/peaks-solo/references/frontend-only-mode.md +87 -0
- package/skills/peaks-solo/references/gstack-integration.md +7 -0
- package/skills/peaks-solo/references/local-artifact-workspace.md +79 -0
- package/skills/peaks-solo/references/micro-cycle.md +68 -0
- package/skills/peaks-solo/references/mode-selection.md +21 -0
- package/skills/peaks-solo/references/openspec-workflow.md +43 -0
- package/skills/peaks-solo/references/project-memory-loading.md +17 -0
- package/skills/peaks-solo/references/project-scan-checklist.md +136 -0
- package/skills/peaks-solo/references/quality-gate-cheatsheet.md +13 -0
- package/skills/peaks-solo/references/resume-detection.md +63 -0
- package/skills/peaks-solo/references/runbook.md +1 -1
- package/skills/peaks-solo/references/skill-presence-and-title.md +31 -0
- package/skills/peaks-solo/references/standards-preflight.md +23 -0
- package/skills/peaks-solo/references/sub-agent-dispatch.md +46 -0
- package/skills/peaks-solo/references/swarm-dispatch-contract.md +56 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Artifact and standards output (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Artifact and standards output`. When project identification or scanning produces reports, matrices, maps, plans, or validation files, write them under the configured Peaks-Cli artifact workspace. By default, use local non-git storage at `.peaks/_runtime/<sessionId>/rd/` in the target project or the Peaks-Cli CLI-provided local workspace. If the artifact workspace is unknown, create or request `.peaks/_runtime/<sessionId>/` before writing generated outputs. Use one session directory consistently so generated outputs stay grouped.
|
|
4
|
+
|
|
5
|
+
Do not default to a git-backed artifact repository, external artifact sync, or automatic commits for intermediate artifacts. Git inclusion or sync requires explicit user confirmation or an active profile that clearly authorizes it. Browser evidence must be sanitized before retention: do not store login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material.
|
|
6
|
+
|
|
7
|
+
When project-local `CLAUDE.md` or project-local `.claude/rules/**` is created or updated, route the mutation through `peaks standards init` or `peaks standards update`; do not hand-write standards mutations. Derive the content from the current scan results and existing project standards. Keep only the rules that match the project's languages, frameworks, tooling, and repository layout. Do not emit generic templates, copy-pasted boilerplate, or rules unrelated to the current scan evidence. Do not update user-global `~/.claude/rules/**` from this workflow.
|
|
8
|
+
|
|
9
|
+
If the scan results are insufficient to justify a rule, leave it out or surface a review-only suggestion instead of writing it into project standards.
|
|
@@ -88,3 +88,23 @@ For each slice in this request:
|
|
|
88
88
|
- Sanitize MCP/network/browser evidence before writing.
|
|
89
89
|
- Do not commit unless the user or active profile authorizes durable retention.
|
|
90
90
|
- Handoff to QA is blocked while state is `draft` or `spec-locked` without implementation evidence.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Two RD artifact files — do not confuse them
|
|
95
|
+
|
|
96
|
+
> Body of `## Two RD artifact files`. RD has two distinct artifact files, and the most common regression is to write the per-slice content into the per-session file. They serve different readers and live in different places:
|
|
97
|
+
|
|
98
|
+
| File | Scope | Reader | Required content |
|
|
99
|
+
|---|---|---|---|
|
|
100
|
+
| `.peaks/_runtime/<sessionId>/rd/tech-doc.md` | per-session — the whole RD plan for the session, all slices | Solo, future LLM, the human scrolling the session | Architecture, slice graph, mock strategy, cross-cutting decisions. **Not** the place for per-slice implementation evidence. |
|
|
101
|
+
| `.peaks/_runtime/<sessionId>/rd/requests/<rid>.md` | per-slice — one request, one planning artifact | QA, SC, the lint gate | Red-line scope, in-scope / out-of-scope, unit-test requirements, **Implementation evidence** (file list, `pnpm test` output, git diff excerpts), MCP usage, handoff, status. **This is the file the lint gate checks for placeholders.** |
|
|
102
|
+
| `.peaks/_runtime/<sessionId>/rd/code-review.md` | per-session — the engineering review | QA, the human reviewer | Code review findings + fixes. |
|
|
103
|
+
| `.peaks/_runtime/<sessionId>/rd/security-review.md` | per-session — the security review | QA | Security review findings + fixes. |
|
|
104
|
+
|
|
105
|
+
**Failure mode the lint gate catches**: the LLM writes the actual implementation content into `rd/tech-doc.md` and leaves `rd/requests/<rid>.md` as the default template (with placeholder sections like "Implementation evidence: 留待 RD 实施阶段补充" and "MCP usage: N/A"). The lint gate then fails the slice with 6+ lint errors on the `<rid>.md` template even though the actual content lives in `tech-doc.md`.
|
|
106
|
+
|
|
107
|
+
**Rule**:
|
|
108
|
+
- **Per-slice content** (red-line scope, in-scope / out-of-scope, the implementation evidence list, the unit-test assertions, the handoff) → **belongs in `rd/requests/<rid>.md`**.
|
|
109
|
+
- **Per-session content** (the architecture overview, the slice roadmap, the cross-cutting concerns, the mock strategy for the whole session) → **belongs in `rd/tech-doc.md`**.
|
|
110
|
+
- When in doubt: copy the per-slice content into the `<rid>.md` artifact's "Implementation evidence" section after writing it to `tech-doc.md`. The two files can carry overlapping context; the gate only enforces that `<rid>.md` is not empty placeholders.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Browser self-test contracts
|
|
2
|
+
|
|
3
|
+
> Body of `## Hard contracts for browser self-test` + `### Contract 1` + `### Contract 2`.
|
|
4
|
+
|
|
5
|
+
For frontend or UI-affecting slices, RD's self-test uses the Playwright MCP headed browser to verify the implementation behaves correctly before handing off to QA. The two contracts below are identical in spirit to `peaks-qa`'s contracts — RD and QA share the same headed-browser path and the same evidence conventions; only the role differs.
|
|
6
|
+
|
|
7
|
+
## Contract 1 — Self-test screenshots must land under .peaks/_runtime/<sessionId>/qa/screenshots/
|
|
8
|
+
|
|
9
|
+
Even though RD runs the self-test, **the screenshot evidence is QA's** by convention (the test report under `.peaks/_runtime/<sessionId>/qa/test-reports/` cites these paths). Therefore RD's Playwright screenshot tool calls (the LLM invokes `browser_take_screenshot` directly when the the Playwright MCP tools are present in the LLM's tool list) MUST pass `filename` (in the args object) whose absolute path is inside `.peaks/_runtime/<sessionId>/qa/screenshots/`, exactly the same contract QA enforces. Do not let Playwright fall back to the project root. If the the Playwright MCP tools are absent from the tool list, STOP and tell the user: `claude mcp add playwright -- npx @playwright/mcp@latest` (Claude Code) or consult the IDE's MCP install docs.
|
|
10
|
+
|
|
11
|
+
## Contract 2 — Login / CAPTCHA / SSO / MFA wall is a hard block, not a skip
|
|
12
|
+
|
|
13
|
+
When the headed browser hits an auth wall, RD does **not** skip the browser gate. The skill must surface the wall with `AskUserQuestion` and pick one of three paths:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
AskUserQuestion({
|
|
17
|
+
question: "Headed browser hit a login wall at <URL>. How should RD self-test proceed?",
|
|
18
|
+
options: [
|
|
19
|
+
{ label: "I am logged in / I'll log in now",
|
|
20
|
+
description: "Pause RD. The visible browser is already open; the user completes login in-place, then types 'logged in' or equivalent. RD resumes browser_navigate + browser_snapshot from the post-login page." },
|
|
21
|
+
{ label: "Skip browser self-test, hand off to QA",
|
|
22
|
+
description: "Mark the slice's browser self-test as deferred. Do NOT mark the slice as RD-done; transition to qa-handoff with browser-gate=blocked reason=login-required, and let QA's gate machinery surface the wall to the user again." },
|
|
23
|
+
{ label: "Cancel the workflow",
|
|
24
|
+
description: "Stop RD. Emit a blocked TXT handoff so peaks-solo can surface the auth wall to the user. Do not modify code paths that the browser gate would have covered." }
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The full hard-block contract is defined in `peaks-qa` (see "Hard contracts for browser validation" there); RD inherits the same rules. Without an explicit decision from the user, RD does not advance past the wall.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
## Codegraph project analysis (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Codegraph project analysis`. RD may use `peaks codegraph affected --project <path> <changed-files...> --json` as local project-analysis evidence to inform red-line scope boundaries before writing tech-doc or starting implementation. Treat the output as untrusted supporting evidence — verify against the actual code before relying on it.
|
|
4
|
+
|
|
5
|
+
Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts. Peaks-Cli RD gates remain authoritative for handoff and acceptance.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Compact handoff (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Compact handoff`. Before RD work stops, finishes, blocks, or hands off to another role, emit a short resumable capsule: mode, scope, coverage status, validated decisions, current slice, artifact paths, blockers, and next action. Link to scan reports, matrices, plans, and task graphs instead of restating them.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# External references (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## External references`. **Matt Pocock skills** (`diagnose`, `triage`, `tdd`, `improve-codebase-architecture`, `prototype`): Engineering references only. Inspect before applying; Peaks-Cli RD gates remain authoritative.
|
|
4
|
+
|
|
5
|
+
**Understand Anything**: Consume via `peaks understand status/show --json`. Fall back to `peaks codegraph context` or local project scan when absent.
|
|
6
|
+
|
|
7
|
+
**Codegraph**: Optional local analysis via `peaks codegraph context/affected`. Output as untrusted supporting evidence; never commit `.codegraph/` artifacts.
|
|
8
|
+
|
|
9
|
+
**Other external resources** (Context7, SearchCode, everything-claude-code, GitNexus, etc.): Use `peaks capabilities --source access-repo/mcp-server --json` for capability discovery before recommending. References only — do not execute upstream installers, do not install upstream resources, do not persist sensitive examples. Peaks-Cli RD gates remain authoritative.
|
|
10
|
+
|
|
11
|
+
**OpenSpec CLI**: Route through Peaks-Cli CLI (`peaks openspec show/to-rd/render`). Do not hand-edit `openspec/changes/**`. Recipes: `references/openspec-cli.md`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Frontend project generation (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Frontend project generation`. When RD work creates a frontend application and the user has not specified a technology stack, and the current scan plus existing project standards still do not establish a frontend stack, default to React + Vite + shadcn/ui with:
|
|
4
|
+
|
|
5
|
+
- `peaks shadcn init --preset [CODE] --template vite`
|
|
6
|
+
|
|
7
|
+
`[CODE]` is the preset code supplied by the shadcn registry or user workflow; if it is unknown, stop and resolve the intended preset before scaffolding.
|
|
8
|
+
|
|
9
|
+
If the user specifies a frontend stack or scaffold command, use the specified technology. If the scaffold emits JavaScript, convert generated application files to TypeScript before continuing; if conversion is not practical, ask for a TypeScript-compatible scaffold.
|
|
10
|
+
|
|
11
|
+
Application projects generated through this skill must not contain JavaScript source or config files. Generate TypeScript only (`.ts`, `.tsx`, and TypeScript config equivalents), including when adapting examples from libraries or templates.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Library version awareness
|
|
2
|
+
|
|
3
|
+
> Body of `## Library version awareness (3rd-party breaking-change gate)`. After `peaks scan libraries` lands the dependency list under `## Library versions` in `rd/project-scan.md`, RD MUST cross-check the slice's diff against `schemas/library-breaking-changes.data.json` before writing any 3rd-party API call. Concretely:
|
|
4
|
+
|
|
5
|
+
1. **Read the project's `## Library versions` section** in `.peaks/_runtime/<sessionId>/rd/project-scan.md`. Identify the `name` + `major` of every dependency the slice imports from.
|
|
6
|
+
2. **Open `schemas/library-breaking-changes.data.json`** (LLM reads via the `Read` tool). For each library where the installed `major` matches a `toMajor` in the table, load the corresponding `breakingChanges[]` list.
|
|
7
|
+
3. **For each `import` statement in the slice's diff** (e.g. `import { Drawer } from 'antd'`), check whether the imported symbol or its prop signature matches any `breakingChanges[].api` entry for the library's installed major.
|
|
8
|
+
4. **On a hit**:
|
|
9
|
+
- **Warn the LLM in the slice's handoff**: in `.peaks/_runtime/<sessionId>/rd/requests/<rid>.md` under `## Implementation evidence`, append a one-line note per hit: `- [lib-version] <library> <installed version> imports <api>; breaking-change rule says use <replacement> instead.`
|
|
10
|
+
- **Persist a `lesson` memory** at the END of `.peaks/_runtime/<sessionId>/rd/project-scan.md` (or the tech-doc, or the handoff — any of these is read by future RD runs):
|
|
11
|
+
```
|
|
12
|
+
<!-- peaks-memory:start -->
|
|
13
|
+
title: <library> <installed major> requires <api> → <replacement>
|
|
14
|
+
kind: lesson
|
|
15
|
+
---
|
|
16
|
+
Observed in slice <rid>: project is on <library>@<major> and the diff imported <api> which is on the breaking-changes list. Use <replacement> instead. Source: schemas/library-breaking-changes.data.json.
|
|
17
|
+
<!-- peaks-memory:end -->
|
|
18
|
+
```
|
|
19
|
+
- The next RD run will see this lesson in `peaks project memories` and skip the same drift.
|
|
20
|
+
|
|
21
|
+
**Why this exists**: the LLM's training data lags the latest major versions. The user hit `[antd: Drawer] width is deprecated. Please use size instead` in an antv6 project because the LLM wrote v5-style code. The breaking-changes table is the canonical place for "library X at major Y has these known migrations" so the LLM doesn't have to guess.
|
|
22
|
+
|
|
23
|
+
**Out of scope**: the breaking-changes table is hand-curated; auto-syncing from upstream changelogs (Context7, etc.) is a follow-up slice. Per-slice the LLM only reads the table — it does NOT maintain it.
|
|
24
|
+
|
|
25
|
+
**Data freshness check (read schemas/library-breaking-changes.meta.json first)**:
|
|
26
|
+
- Before reading `schemas/library-breaking-changes.data.json`, also read `schemas/library-breaking-changes.meta.json`.
|
|
27
|
+
- Compute `ageInDays = (today - meta.lastUpdated)`. The LLM is responsible for this date math.
|
|
28
|
+
- If `ageInDays > meta.freshnessPolicyDays` (default 180 days), surface a **freshness warning** in the handoff: `- [data-staleness] library-breaking-changes.data.json is ${ageInDays} days old (last touched ${meta.lastUpdated}); the breaking-changes below may miss library X's recent major. Re-verify against the library's official changelog before relying on these substitutions.`
|
|
29
|
+
- The warning is **informational**, not blocking. A stale table is better than no table. The LLM still applies the entries it has, just with the caveat.
|
|
30
|
+
- When a row in the table matches an `import` in the diff AND the table is fresh, proceed without the warning.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Mandatory perf-baseline output (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Mandatory perf-baseline output` + numbered perf-baseline steps. **BLOCKING — Do not hand off to QA without a perf-baseline file when the slice has a user-visible performance surface.** The QA stage's Gate A4 (performance check) needs a stable reference to diff against; without an RD-side baseline, the first time Gate A4 runs it has nothing to compare against and any regression it finds is a blind-side surprise. The user-facing pain of leaving perf to QA only has historically been a 3-cycle repair loop. The RD-side baseline closes that loop.
|
|
4
|
+
|
|
5
|
+
**When this applies:**
|
|
6
|
+
- feature / refactor slices that touch a route, hook, API, or any user-perceivable surface
|
|
7
|
+
- bugfix slices where the bug is performance-shaped (slow render, hot loop, N+1)
|
|
8
|
+
- any slice where the PRD mentions a number (LCP / FCP / TBT / p95 / rps / etc.)
|
|
9
|
+
|
|
10
|
+
**When this does NOT apply:**
|
|
11
|
+
- docs / chore slices
|
|
12
|
+
- pure bugfixes whose fix is "remove the bug" (no perf surface)
|
|
13
|
+
- any slice where the slice is documentation-only or otherwise has no perf surface — in that case write `N/A — no perf surface` in the file's "Notes" section and surface that fact in the RD handoff
|
|
14
|
+
|
|
15
|
+
**How to produce the file:**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 1. dry-run preview (default)
|
|
19
|
+
peaks perf baseline --project <repo>
|
|
20
|
+
# → ok: true, data.plannedWrites shows the file path, no files written
|
|
21
|
+
|
|
22
|
+
# 2. apply — scaffolds the file at .peaks/_runtime/<sessionId>/rd/perf-baseline.md
|
|
23
|
+
peaks perf baseline --project <repo> --apply --reason "capturing baseline for Gate A4 diff"
|
|
24
|
+
# → ok: true, data.writtenFiles includes the path
|
|
25
|
+
|
|
26
|
+
# 3. fill in the file's Results table
|
|
27
|
+
# (lighthouse / k6 / autocannon / project-local bench — the
|
|
28
|
+
# CLI does not call any of these; that is the RD's job)
|
|
29
|
+
# open .peaks/_runtime/<sessionId>/rd/perf-baseline.md and complete the
|
|
30
|
+
# "Path / route | Workload | Tool | Metric | Baseline | Threshold"
|
|
31
|
+
# table
|
|
32
|
+
|
|
33
|
+
# 4. hand off to QA. The QA stage reads the file's Results
|
|
34
|
+
# table as the input to Gate A4 — see peaks-qa SKILL.md
|
|
35
|
+
# Gate A4.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Idempotency:** re-running `peaks perf baseline --apply` on a session where the file already exists is a no-op (the CLI does not overwrite hand-edited content). This is the normal RD retry pattern (re-measurement, threshold adjustment, etc.). If the RD really does want to overwrite, delete the file first and re-run.
|
|
39
|
+
|
|
40
|
+
**The role of the CLI vs. the actual measurement:** the CLI is the *scaffolding*. It writes the file, exposes the path, and keeps the file's structure stable so QA can rely on it. The CLI does NOT call lighthouse / k6 / autocannon — those are project-shape dependent and the right tool is a project-local concern, not a peaks-cli concern. The CLI is justified (4-grounds check): it gates the QA-side decision on a stable artefact, it requires --apply for a destructive write, and it is invokable from a hook on session init. It is *not* a machine-enforced gate that prose cannot enforce — the measurement is the RD's responsibility.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Mandatory tech-doc output (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Mandatory tech-doc output`. **BLOCKING — Do not hand off to QA without this file.** Every RD invocation that touches code MUST produce a tech-doc artifact at `.peaks/_runtime/<sessionId>/rd/tech-doc.md`. If this file is missing at QA handoff, the handoff is invalid. The request artifact links to it; QA and SC read it for verification context.
|
|
4
|
+
|
|
5
|
+
**Minimum tech-doc sections:**
|
|
6
|
+
|
|
7
|
+
1. **Architecture decisions** — what changed, why, tradeoffs considered, alternatives rejected
|
|
8
|
+
2. **Component changes** — files added/modified/deleted with role (new component, refactor, bug fix)
|
|
9
|
+
- **CRITICAL: Every file path in this section must be verified against the actual project.** Run `ls` on every directory path before writing it. A wrong path is worse than no tech-doc — it sends QA and future developers to non-existent files.
|
|
10
|
+
3. **Data flow** — how data moves through the changed surface (props, API calls, state updates, events)
|
|
11
|
+
4. **CSS/Style changes** — what CSS files or style blocks changed, which component-library tokens were used, any CSS framework interactions
|
|
12
|
+
5. **API contract changes** — new/modified request paths, request/response shapes, error states
|
|
13
|
+
6. **Dependencies** — new packages added, versions, why each was needed, license check
|
|
14
|
+
|
|
15
|
+
**CSS framework change rules:**
|
|
16
|
+
- When a component library (antd, MUI, etc.) is already in use, prefer its built-in styling APIs (antd's `token`/`className`/`styles` props, MUI's `sx`/`styled`/`theme`) over adding TailwindCSS classes
|
|
17
|
+
- Never add `tailwindcss` to a project that already uses a component library with its own CSS-in-JS solution unless the project-scan explicitly approves it
|
|
18
|
+
- If TailwindCSS is already present, use it consistently with the project's existing utility patterns; do not mix TailwindCSS utility classes with component-library `style` prop overrides on the same element
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Matt Pocock skills integration (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Matt Pocock skills integration`. Engineering methods from `mattpocock/skills` can inform RD work but never replace Peaks-Cli gates. Inspect upstream skill content before applying any method.
|
|
4
|
+
|
|
5
|
+
- `diagnose` — root-cause investigation before fixing
|
|
6
|
+
- `triage` — prioritize bug surface area
|
|
7
|
+
- `tdd` — drive implementation from failing tests
|
|
8
|
+
- `improve-codebase-architecture` — opportunistic refactor framing
|
|
9
|
+
- `prototype` — throwaway exploration before committing to a slice
|
|
10
|
+
|
|
11
|
+
These are references only; Peaks-Cli RD gates remain authoritative for handoff, acceptance, and slice closure.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Mock data placement rules
|
|
2
|
+
|
|
3
|
+
> Body of `## Mock data placement rules` + `### Framework-to-mock-directory mapping` + `### Hard rules` + `### Verification gate`. **BLOCKING — framework-aware.**
|
|
4
|
+
|
|
5
|
+
When the project-scan in `.peaks/<changeId>/rd/project-scan.md` identifies a frontend framework, mock data MUST follow the framework's built-in mock mechanism. **Never write mock data inline in component files.**
|
|
6
|
+
|
|
7
|
+
## Framework-to-mock-directory mapping
|
|
8
|
+
|
|
9
|
+
| Project-scan finding | Mock location | Notes |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Umi (`@umijs/max`, `.umirc.ts`) | `mock/*.ts` | Umi's built-in mock directory. Zero config, auto-reload. |
|
|
12
|
+
| Next.js (`next.config.*`) | `__mocks__/` or MSW handlers | Match the project's existing pattern |
|
|
13
|
+
| Vite (`vite.config.*`) | `src/mock/` | Service-layer mock files with typed fixtures |
|
|
14
|
+
| CRA / Webpack | `src/__mocks__/` | Match the project's existing pattern |
|
|
15
|
+
|
|
16
|
+
## Hard rules
|
|
17
|
+
|
|
18
|
+
1. **Umi project → `mock/*.ts`**: If the project-scan says the build tool is Umi, mock data MUST go in the `mock/` directory at project root. This is Umi's built-in feature — it intercepts requests matching the defined path and method. Do NOT write `Promise.resolve(mockData)` in component files or service files for Umi projects.
|
|
19
|
+
|
|
20
|
+
2. **Never inline mock data in component files**: Mock data, fixture objects, and stub responses belong in dedicated mock files. Components should receive data through their normal channels (props, API calls via services). Writing `const mockData = [...]` inside a `.tsx` file is prohibited.
|
|
21
|
+
|
|
22
|
+
3. **Mock files must export TypeScript interfaces**: Every mock response type must be exported so RD implementation and QA test-cases can import the same contract. See peaks-solo's "Frontend-only development mode" for the full mock-to-real migration pattern.
|
|
23
|
+
|
|
24
|
+
4. **Every mock file must be marked**: Add `// MOCK: Replace with real API call when swagger.json is available` at the top of every mock file.
|
|
25
|
+
|
|
26
|
+
5. **Mock data must be realistic**: No `"test"`, `"foo"`, `"123"` values. Use plausible content that resembles production data.
|
|
27
|
+
|
|
28
|
+
## Verification gate (after mock creation)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# If project-scan detected Umi, verify mock/ directory was used
|
|
32
|
+
ls mock/*.ts 2>&1
|
|
33
|
+
# Expected: one or more .ts files in mock/
|
|
34
|
+
# "No such file" → BLOCKED. Umi projects must use mock/ directory.
|
|
35
|
+
|
|
36
|
+
# Verify no inline mock data in component files
|
|
37
|
+
grep -r "const mock\|mockData\|mock_data\|MOCK_DATA" src/ --include="*.tsx" --include="*.ts" -l 2>&1
|
|
38
|
+
# Expected: no matches (or only in dedicated mock files / test files)
|
|
39
|
+
# Any match in a component → BLOCKED. Move to mock/ (Umi) or src/mock/ (Vite).
|
|
40
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Parallel review fan-out (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Parallel review fan-out`. **When RD reaches the end of implementation, the four review activities (code review, security review, perf baseline, AND QA test-cases draft) run in parallel via `peaks sub-agent dispatch <role>` (then executing the returned toolCall), not sequentially.** This is the same fan-out pattern peaks-solo uses for the post-PRD swarm. RD itself, when it is the main loop, behaves as a sub-agent orchestrator: it issues 4 `peaks sub-agent dispatch` calls in a single message and waits for all to return before aggregating findings and transitioning to `qa-handoff`.
|
|
4
|
+
|
|
5
|
+
**Why 4 sub-agents (added in slice 004):** the original 3-way fan-out (code-review + security-review + perf-baseline) cut the RD→QA wall-clock by running 3 LLM writes in parallel, but `qa/test-cases/<rid>.md` was still written sequentially by QA's main loop AFTER the RD handoff landed. Drafting QA test-cases in the same fan-out means the QA main loop's first action is "execute the pre-drafted test plan + write test-report" instead of "draft a test plan from scratch + execute + write report". Wall-clock drop: ~30-40% on the RD→QA-verdict segment for `feature` / `refactor` / `bugfix` slices.
|
|
6
|
+
|
|
7
|
+
**When to fan out:**
|
|
8
|
+
- Feature / refactor slices: all four sub-agents always run.
|
|
9
|
+
- Bugfix slices: code-review + security-review + qa-test-cases always run; perf-baseline runs only when the bug is performance-shaped (matches the "When this applies" criteria in the perf-baseline section above).
|
|
10
|
+
- Config / docs / chore slices: no fan-out (no review surface). Document N/A in the request artifact.
|
|
11
|
+
|
|
12
|
+
**The dispatch template:**
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
peaks sub-agent dispatch <role> \
|
|
16
|
+
--prompt "<role contract below>, plus runtime args: project=<repo>, session-id=<session-id>, request-id=<rid>.
|
|
17
|
+
Write your evidence file at .peaks/_runtime/<sessionId>/<evidence-path> and return ONLY the path.
|
|
18
|
+
Do not call Skill(...). Do not set presence. Do not prompt the user. Do not commit, push,
|
|
19
|
+
install hooks, or mutate settings.json. Do not edit any source file — review only.
|
|
20
|
+
While running, call peaks sub-agent heartbeat --record <dispatchRecordPath>
|
|
21
|
+
--status running --progress <pct> --note \"<text>\" at least every 30 seconds;
|
|
22
|
+
on completion call --status done --progress 100 --note 'completed'." \
|
|
23
|
+
--request-id <rid> --session-id <session-id> --project <repo> --json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Note: sub-agents 1-3 write to `rd/<evidence-path>`, sub-agent 4 writes to `qa/test-cases/<rid>.md` (QA's dir). The role name in the description differentiates them.
|
|
27
|
+
|
|
28
|
+
**Sub-agent 1 — code-reviewer (always runs for feature / refactor / bugfix):**
|
|
29
|
+
- Read the git diff for this slice (`git diff main...HEAD` or equivalent).
|
|
30
|
+
- Read `.peaks/_runtime/<sessionId>/rd/tech-doc.md` for slice intent.
|
|
31
|
+
- Inspect for: correctness, type safety, error handling, mutation patterns, file-size, naming, dead code, regressions, contract drift.
|
|
32
|
+
- Output: `.peaks/_runtime/<sessionId>/rd/code-review.md` with sections: Summary, Findings, Required Fixes, Recommended, Verdict.
|
|
33
|
+
- Required for Gate B3.
|
|
34
|
+
|
|
35
|
+
**Sub-agent 2 — security-reviewer (always runs for feature / refactor / bugfix):**
|
|
36
|
+
- Read the git diff and the file list.
|
|
37
|
+
- Read `.peaks/_runtime/<sessionId>/rd/tech-doc.md` for the slice's threat model.
|
|
38
|
+
- Inspect for: hardcoded secrets, unsanitized input, path traversal, SQL injection, XSS, missing auth, dependency changes, external API surface, command injection via Bash guards.
|
|
39
|
+
- Output: `.peaks/_runtime/<sessionId>/rd/security-review.md` with the same shape.
|
|
40
|
+
- Required for Gate B4.
|
|
41
|
+
|
|
42
|
+
**Sub-agent 3 — perf-baseline-reviewer (feature / refactor / bugfix-when-perf only):**
|
|
43
|
+
- Read the git diff and the slice's PRD/tech-doc for any mentioned numbers.
|
|
44
|
+
- Run `peaks perf baseline --project <repo> --apply --reason "parallel fan-out for rid=<rid>"` to scaffold `.peaks/_runtime/<sessionId>/rd/perf-baseline.md` (idempotent).
|
|
45
|
+
- Decide: perf surface exists → leave the scaffold in place for the main RD loop to fill in. No perf surface → write `N/A — no perf surface` and return.
|
|
46
|
+
- Output: `.peaks/_runtime/<sessionId>/rd/perf-baseline.md` (scaffolded, or N/A stub).
|
|
47
|
+
- Required for Gate B9.
|
|
48
|
+
|
|
49
|
+
**Sub-agent 4 — qa-test-cases-writer (always runs for feature / refactor / bugfix):**
|
|
50
|
+
- Read the git diff and the PRD acceptance criteria.
|
|
51
|
+
- Draft the test plan: enumerate every acceptance criterion as a separate test case; for each, write a `ts` snippet, assert the expected outcome, link to the PRD criterion by ID.
|
|
52
|
+
- Include the standard sections: ## Test cases, ## Test case summary, ## Mandatory validation gates, ## Regression matrix, ## Verdict.
|
|
53
|
+
- Output: `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md`.
|
|
54
|
+
- Required for Gate C (RD-side qa-handoff transition). When this file is present at RD's qa-handoff transition, QA's main loop can skip its own "draft test plan" step and proceed directly to "execute pre-drafted test plan + write test-report + verdict".
|
|
55
|
+
|
|
56
|
+
**Hard prohibitions on all 4 sub-agents:**
|
|
57
|
+
- Do NOT call `Skill(skill="...")` — would re-enter RD or another skill and break the fan-out.
|
|
58
|
+
- Do NOT call `peaks skill presence:set` — only the main RD loop owns presence.
|
|
59
|
+
- Do NOT open interactive user prompts. If something is unclear, return `blocked` and let the main loop handle the user.
|
|
60
|
+
- Do NOT commit, push, install hooks, or mutate settings.json.
|
|
61
|
+
- Do NOT edit any source file under src/, tests/, skills/, bin/, scripts/, docs/, schemas/. Review only.
|
|
62
|
+
|
|
63
|
+
**Aggregation (after all 4 sub-agents return):**
|
|
64
|
+
|
|
65
|
+
1. Restore presence: `peaks skill presence:set peaks-rd --project <repo> --gate review-fan-out-converged`
|
|
66
|
+
2. Run the 4 `ls` checks (Gate B3 code-review, Gate B4 security-review, Gate B9 perf-baseline, Gate C2 qa-test-cases).
|
|
67
|
+
3. Read each evidence file. Aggregate CRITICAL/HIGH across code-review + security-review.
|
|
68
|
+
4. If any CRITICAL or HIGH finding exists: fix in the main RD loop, then re-launch ONLY the affected sub-agent(s) to verify the fix. Loop until clean, or mark as blocked if the issue cannot be resolved.
|
|
69
|
+
5. For perf-baseline: if scaffolded, run the project's perf measurement tool, fill in the Results table. If N/A, no measurement needed.
|
|
70
|
+
6. For qa-test-cases: the file is now pre-drafted by sub-agent 4. The main RD loop does NOT re-draft it; it only verifies (a) the file exists, (b) every PRD acceptance criterion is enumerated, (c) every `ts` test snippet is syntactically valid. If incomplete, fix it inline in the main RD loop (small edits only) OR re-launch the sub-agent (large re-drafts).
|
|
71
|
+
7. Re-run all 4 `ls` checks to confirm the evidence files are present and not empty.
|
|
72
|
+
8. Only then transition `peaks request transition <rid> --role rd --state qa-handoff --project <repo> --json`.
|
|
73
|
+
|
|
74
|
+
**Degradation when a sub-agent fails or returns blocked:**
|
|
75
|
+
- code-review sub-agent fails: fall back to inline RD code review. TXT handoff note: `code-review-subagent-degraded-to-inline`.
|
|
76
|
+
- security-review sub-agent fails: same fallback. TXT note: `security-review-subagent-degraded-to-inline`.
|
|
77
|
+
- perf-baseline sub-agent fails: same fallback. TXT note: `perf-baseline-subagent-degraded-to-inline`.
|
|
78
|
+
- qa-test-cases sub-agent fails: fall back to inline QA test-case drafting at the start of QA's main loop. TXT note: `qa-test-cases-subagent-degraded-to-inline-qa-draft`.
|
|
79
|
+
- 2 or more fail: do not hand off as clean; transition to `qa-handoff` with `--allow-incomplete --reason "<degradation>"` OR block.
|
|
80
|
+
|
|
81
|
+
**Why this works (3-loop repair closure):** the original 3-loop repair pain was caused by perf being QA-only. This fan-out moves perf measurement to the RD side AND runs it in parallel with the other reviews, so the RD handoff is complete on the first attempt instead of after several cycles. Slice 004 extends the same pattern to QA test-cases so the QA→verdict loop is also faster on the first attempt.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Sub-agent context governance (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Sub-agent context governance` + `### G7` + `### G8.6` + `### G9`. RD sub-agent prompt template MUST include the G7 path convention + G8.6 share protocol.
|
|
4
|
+
|
|
5
|
+
## G7 — RD sub-agent protocol
|
|
6
|
+
|
|
7
|
+
1. Write artifact to `.peaks/_sub_agents/<sessionId>/artifacts/<rid>-rd-001.md` (path convention mandatory).
|
|
8
|
+
2. Call `peaks sub-agent dispatch --write-artifact <path>` (or via the dispatch CLI flag) to register ArtifactMeta.
|
|
9
|
+
3. The dispatch record stores only `path + size + sha256 + status + contentInlined:false + summary` — main LLM sees ~200 chars/sub-agent.
|
|
10
|
+
|
|
11
|
+
## G8.6 — RD sub-agent prompt template (mandatory)
|
|
12
|
+
|
|
13
|
+
Sub-agent prompts dispatched by peaks-rd must include:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
You are sub-agent role rd, batch <batchId>.
|
|
17
|
+
|
|
18
|
+
PROTOCOL (mandatory):
|
|
19
|
+
1. On start: peek at shared channel: `peaks sub-agent shared-read --batch <batchId> --json`
|
|
20
|
+
to see what other sub-agents in this batch have shared so far.
|
|
21
|
+
2. While running: if you find a blocker or partial work, write share entry
|
|
22
|
+
`peaks sub-agent share --key "rd.found-blocker" --value {"reason": "..."}`.
|
|
23
|
+
3. On completion: write share entry
|
|
24
|
+
`peaks sub-agent share --key "rd.completed" --value <artifact-meta>` BEFORE the
|
|
25
|
+
final `peaks sub-agent heartbeat --status done` heartbeat (RL-23 strong constraint).
|
|
26
|
+
4. The shared channel is your only visibility into sibling sub-agents.
|
|
27
|
+
Do NOT attempt to read other sub-agents' dispatch records directly.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## G9 — RD prompt size self-check
|
|
31
|
+
|
|
32
|
+
Before dispatching a sub-agent, RD self-checks prompt size:
|
|
33
|
+
- < 50%: pass through.
|
|
34
|
+
- 50-75%: soft warn (consider `--use-headroom`).
|
|
35
|
+
- 75-80%: soft warn + `warnings: ["CONTEXT_NEAR_LIMIT"]` (mandatory suggest `--use-headroom`).
|
|
36
|
+
- 80%+: reject (CLI 兜底 returns `code: "PROMPT_TOO_LARGE"`). Use `--force` at CLI only when overriding; hook layer will still reject (RL-30).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# GStack integration and code dry-runs (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## GStack integration and code dry-runs`. Use gstack as a concrete engineering workflow reference for `Think → Plan → Build → Review → Test → Ship → Reflect`:
|
|
4
|
+
|
|
5
|
+
- map plan engineering review to Peaks-Cli RD risk matrices, task graphs, and slice contracts;
|
|
6
|
+
- map build/review discipline to strict spec-first implementation and code-review gates;
|
|
7
|
+
- map investigate/careful/guard concepts to root-cause analysis, risky-action confirmation, and scoped edit boundaries;
|
|
8
|
+
- adapt gstack concepts into Peaks-Cli artifacts rather than invoking gstack commands as runtime dependencies.
|
|
9
|
+
|
|
10
|
+
When Peaks-Cli RD produces or changes code, dry-run repeatedly instead of only during preflight:
|
|
11
|
+
|
|
12
|
+
1. run standards dry-runs before planning or implementation;
|
|
13
|
+
2. run the relevant Peaks-Cli dry-run again after each meaningful implementation slice or standards-affecting decision;
|
|
14
|
+
3. after implementation, run required unit tests, code review, and security review before any completion claim;
|
|
15
|
+
4. only after those checks pass, run the relevant Peaks-Cli dry-run before handoff, review, or retention-boundary work;
|
|
16
|
+
5. record commands, results, coverage evidence, reviewer/security findings, dry-run result, and remaining action in the RD handoff capsule.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Default runbook (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Default runbook` + numbered runbook steps #0–#8. The default sequence the RD skill should execute for a code-touching request. Skip steps that do not apply to the request type; do not skip the artifact, coverage gate, or red-line scope steps.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 0. confirm RD's own runbook integrity before any code edit
|
|
7
|
+
peaks skill runbook peaks-rd --json
|
|
8
|
+
peaks skill presence:set peaks-rd --project <repo> # show persistent skill presence every turn
|
|
9
|
+
|
|
10
|
+
# 1. capture the RD request artifact and read upstream PRD / UI scope
|
|
11
|
+
peaks request init --role rd --id <request-id> --project <repo> --apply --json
|
|
12
|
+
peaks request show <request-id> --role prd --project <repo> --json
|
|
13
|
+
peaks request show <request-id> --role ui --project <repo> --json # if UI involved
|
|
14
|
+
|
|
15
|
+
# 2. standards preflight before planning any code edit
|
|
16
|
+
peaks standards init --project <repo> --dry-run --json
|
|
17
|
+
peaks standards update --project <repo> --dry-run --json
|
|
18
|
+
|
|
19
|
+
# 3. pull OpenSpec context when openspec/ exists in the repo
|
|
20
|
+
peaks openspec list --project <repo> --json
|
|
21
|
+
peaks openspec show <change-id> --project <repo> --json
|
|
22
|
+
peaks openspec validate <change-id> --project <repo> --json # entry gate
|
|
23
|
+
peaks openspec to-rd <change-id> --project <repo> --json # acceptance + commit boundaries
|
|
24
|
+
|
|
25
|
+
# 4. project-analysis evidence — MANDATORY before implementation
|
|
26
|
+
peaks understand status --project <repo> --json
|
|
27
|
+
peaks understand show --project <repo> --json # when UA artifact exists
|
|
28
|
+
peaks codegraph context --project <repo> "<task>"
|
|
29
|
+
peaks codegraph affected --project <repo> <changed-files...> --json
|
|
30
|
+
|
|
31
|
+
# 4.1 read project-scan from Solo's pre-RD scan — BLOCKING if missing
|
|
32
|
+
# **STOP if .peaks/_runtime/<sessionId>/rd/project-scan.md does not exist.**
|
|
33
|
+
# **Do not write any code, do not plan any implementation, do not pass go.**
|
|
34
|
+
# **Create the project-scan first, then proceed.**
|
|
35
|
+
# NOTE: project-scan.md is a session-scoped singleton. Check if it already exists
|
|
36
|
+
# before regenerating (e.g. via `ls .peaks/<changeId>/rd/project-scan.md`). If it exists
|
|
37
|
+
# and is complete (has `## Archetype` and `## Project mode` sections), reuse it.
|
|
38
|
+
# Required sections in project-scan:
|
|
39
|
+
# - build tool and framework
|
|
40
|
+
# - component library (antd, MUI, shadcn, etc.) and version
|
|
41
|
+
# - CSS solution (Less, Sass, TailwindCSS, CSS-in-JS) and conflicts
|
|
42
|
+
# - state management, routing, data fetching libraries
|
|
43
|
+
#
|
|
44
|
+
# After writing project-scan, embed durable memory markers for stable project facts.
|
|
45
|
+
# Append one <!-- peaks-memory:start --> block per fact at the end of project-scan.md:
|
|
46
|
+
#
|
|
47
|
+
# <!-- peaks-memory:start -->
|
|
48
|
+
# title: <component library>
|
|
49
|
+
# kind: module
|
|
50
|
+
# ---
|
|
51
|
+
# <Library> <version> — detected from package.json and source imports.
|
|
52
|
+
# <!-- peaks-memory:end -->
|
|
53
|
+
#
|
|
54
|
+
# Embed markers for: component library, CSS solution, build tool, state management,
|
|
55
|
+
# routing, data fetching, and any legacy constraints. These facts are session-invariant
|
|
56
|
+
# and valuable for future sessions. Do NOT embed secrets, credentials, or transient state.
|
|
57
|
+
|
|
58
|
+
# 4.2 component library detection — verify against package.json, not assumptions
|
|
59
|
+
# WRONG: "looks like a React project, let me use shadcn/ui"
|
|
60
|
+
# RIGHT: check package.json for antd/@mui/@shadcn/etc., match imports in source files
|
|
61
|
+
|
|
62
|
+
# 4.3 CSS framework conflict check (CRITICAL)
|
|
63
|
+
# Detect conflicts BEFORE adding any CSS dependency:
|
|
64
|
+
# - TailwindCSS + antd → HIGH conflict (preflight reset vs antd base styles)
|
|
65
|
+
# - TailwindCSS + MUI → HIGH conflict (utility classes vs sx/system props)
|
|
66
|
+
# - Adding a second CSS-in-JS lib to a project that already has one → BLOCK
|
|
67
|
+
# - Adding Less/Sass to a CSS-in-JS project → wasteful, not conflicting
|
|
68
|
+
# If a conflict is detected, DO NOT add the conflicting dependency.
|
|
69
|
+
# Record the conflict in the RD artifact and propose a compatible alternative.
|
|
70
|
+
|
|
71
|
+
# 4.4 source-code component import verification
|
|
72
|
+
# grep source files for actual component imports to confirm library usage:
|
|
73
|
+
# grep -r "from 'antd'" src/ --include="*.tsx" --include="*.ts"
|
|
74
|
+
# grep -r "from '@mui/material'" src/ --include="*.tsx"
|
|
75
|
+
# grep -r "from '@/components/ui'" src/ --include="*.tsx"
|
|
76
|
+
|
|
77
|
+
# 4.5 mock data strategy — MANDATORY for frontend-only projects
|
|
78
|
+
# Check project-scan for the detected build tool:
|
|
79
|
+
# Umi → use mock/*.ts (Umi's built-in mock directory)
|
|
80
|
+
# Vite → use src/mock/ (service-layer mock files)
|
|
81
|
+
# Next.js → match existing project pattern
|
|
82
|
+
# NEVER write mock data inline in component files.
|
|
83
|
+
# See "Mock data placement rules" section for the full framework mapping.
|
|
84
|
+
|
|
85
|
+
# 5. optional library docs lookup through the LLM's own tool list (Context7 MCP)
|
|
86
|
+
# If the Context7 MCP is present in the tool list, invoke the
|
|
87
|
+
# tool directly (resolve-library-id / query-docs / etc.). If absent, skip
|
|
88
|
+
# library docs and rely on existing project knowledge — do NOT hand-edit
|
|
89
|
+
# `~/.claude/settings.json` to install MCPs.
|
|
90
|
+
|
|
91
|
+
# 6. record red-line scope, slice contract, coverage status into the RD artifact, then implement
|
|
92
|
+
|
|
93
|
+
# 6.5 BEFORE tech-doc: verify EVERY path in the tech-doc against actual project structure (Peaks-Cli Gate A2)
|
|
94
|
+
# ls every directory path in the tech-doc — zero "No such file" allowed
|
|
95
|
+
# This is the most common RD failure mode. Do not skip it.
|
|
96
|
+
|
|
97
|
+
# 6.6 BEFORE implementation: verify CLAUDE.md + .claude/rules/ exist (Peaks-Cli Gate A3)
|
|
98
|
+
# Missing standards files → run `peaks standards init --project .` first
|
|
99
|
+
# Without project rules, security review and code review triggers won't fire.
|
|
100
|
+
|
|
101
|
+
# 7. AFTER implementation, BEFORE QA handoff — RUN THESE GATES:
|
|
102
|
+
# Peaks-Cli Gate B2: unit tests exist and pass for the changed surface → npx vitest run --changed (or project equivalent; the changed-only mode is the peaks slice check default as of run 017; use --run-tests for the full suite, or invoke /peaks-solo-test to run the full suite standalone)
|
|
103
|
+
# Peaks-Cli Gate B3: code review evidence → .peaks/<changeId>/rd/code-review.md
|
|
104
|
+
# Peaks-Cli Gate B4: security review evidence → .peaks/<changeId>/rd/security-review.md
|
|
105
|
+
# Peaks-Cli Gate B5 (NEW): RD artifact body has no unfilled placeholders.
|
|
106
|
+
peaks request lint <rid> --role rd --project <repo> --session-id <session-id> --json
|
|
107
|
+
# Peaks-Cli Gate B6 (NEW): declared --type still matches the actual diff after implementation.
|
|
108
|
+
peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
109
|
+
# Peaks-Cli Gate B7 (NEW, repair cycles only): we have not exceeded the 3-cycle cap.
|
|
110
|
+
peaks request repair-status <rid> --project <repo> --session-id <session-id> --json
|
|
111
|
+
# Peaks-Cli Gate B8 (NEW): every changed file matches the RD red-line scope (no out-of-bounds writes).
|
|
112
|
+
peaks scan diff-vs-scope --rid <rid> --project <repo> --session-id <session-id> --json
|
|
113
|
+
# All six non-zero → BLOCKED. Fix and re-check before attempting the qa-handoff transition.
|
|
114
|
+
|
|
115
|
+
# 7. self-validate before QA handoff
|
|
116
|
+
peaks openspec validate <change-id> --project <repo> --json # exit gate (re-run)
|
|
117
|
+
|
|
118
|
+
# 8. hand off to QA via the cross-linked request id
|
|
119
|
+
peaks request init --role qa --id <request-id> --project <repo> --apply --json
|
|
120
|
+
peaks request show <request-id> --role rd --project <repo> --json
|
|
121
|
+
peaks project memories:extract --session-id <session-id> --project <repo> --json # extract durable memories
|
|
122
|
+
peaks skill presence:clear --project <repo> # handoff complete, remove presence indicator
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
For refactor work, the coverage ≥ 95% gate in `Refactor hard gates` still applies and must be recorded in the artifact before slicing begins.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Project standards preflight (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Project standards preflight`. Before RD planning or implementation work in a code repository, call the Peaks-Cli CLI:
|
|
4
|
+
|
|
5
|
+
- `peaks standards init --project <path> --dry-run`
|
|
6
|
+
- `peaks standards update --project <path> --dry-run`
|
|
7
|
+
|
|
8
|
+
If `CLAUDE.md` is missing, treat creation as the preferred path. If `CLAUDE.md` already exists, use `standards update` to decide whether to append a managed index block or surface review-only suggestions. Apply only when write authorization exists; otherwise keep the CLI output as a preflight next action. Do not hand-write standards file mutations inside the skill.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Sub-agent dispatch (RD)
|
|
2
|
+
|
|
3
|
+
> Body of `## Sub-agent dispatch`. When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` (then the LLM executes the returned toolCall) from `peaks-solo`, the following sections of THIS skill are **suspended** for the sub-agent run:
|
|
4
|
+
|
|
5
|
+
- **Session id** — use the parent's sid (read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI). Do NOT spawn your own session. The new `peaks session info --active` reads the canonical binding for you.
|
|
6
|
+
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-rd`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Solo loop owns that file. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-rd.json` and only that.
|
|
7
|
+
- **Workspace initialization** — Solo has already run `peaks workspace init` before fan-out. Do not re-run it.
|
|
8
|
+
- **Mode selection** — Solo has already chosen the mode. Read it from the prompt arguments (or from `.peaks/.active-skill.json` if you can, but do not write it).
|
|
9
|
+
- **Statusline install** — already done by Solo at session startup; do not re-run.
|
|
10
|
+
|
|
11
|
+
What the sub-agent **MUST** still do, from this skill's contract:
|
|
12
|
+
|
|
13
|
+
0. **Do NOT call `peaks request init`** — Solo has already initialised the request artefact slot in the main loop before fan-out (the runbook has the exact `peaks request init --role rd --id <rid> --project <repo> --apply --type <type> --json` call). The sub-agent reads the slot via `peaks request show <rid> --role rd --project <repo> --json` if it needs to. Note: `peaks request init` is **dry-run by default**. Pass `--apply` to actually create the artifact.
|
|
14
|
+
2. `peaks request show <rid> --role prd --project <repo> --json` (and `--role ui` if UI is in the swarm plan).
|
|
15
|
+
3. Standards preflight (dry-run only; Solo owns the apply step).
|
|
16
|
+
4. Project-scan read; create `rd/project-scan.md` only if Solo flagged it missing in the dispatch prompt.
|
|
17
|
+
5. Write the planning artefact: `rd/tech-doc.md` (feature/refactor) or `rd/bug-analysis.md` (bugfix). If `--type` is `config|docs|chore`, **no planning artefact is required** — return immediately with `{"role":"rd-planning","status":"skipped","reason":"type=<type>"}`.
|
|
18
|
+
6. Return only a compact JSON envelope — Solo will run the convergence gate (`ls` checks):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"role": "rd-planning",
|
|
23
|
+
"rid": "<rid>",
|
|
24
|
+
"status": "ok" | "blocked" | "skipped",
|
|
25
|
+
"artefacts": [".peaks/_runtime/<sessionId>/rd/tech-doc.md"],
|
|
26
|
+
"warnings": [],
|
|
27
|
+
"blockedReason": null
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Hard prohibitions** (sub-agent context, in addition to general red lines):
|
|
32
|
+
|
|
33
|
+
- Do NOT call `Skill(skill="...")` from inside the sub-agent — that defeats the fan-out.
|
|
34
|
+
- Do NOT call `peaks skill presence:set` — Solo owns the active-skill file.
|
|
35
|
+
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
36
|
+
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}` and let Solo handle the user message.
|
|
37
|
+
- Do NOT modify code (the Swarm phase is planning only; code edits happen in the RD implementation phase, which is a separate sub-agent or inline run after Gate B).
|
|
38
|
+
|
|
39
|
+
After returning, Solo re-checks Gate B (`ls .peaks/_runtime/<sessionId>/rd/tech-doc.md` etc.) and proceeds to RD implementation, which is a different sub-agent or inline run.
|