peaks-cli 1.3.9 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/src/cli/commands/core-artifact-commands.js +27 -0
  2. package/dist/src/cli/commands/skill-scope-commands.d.ts +49 -0
  3. package/dist/src/cli/commands/skill-scope-commands.js +305 -0
  4. package/dist/src/cli/commands/workflow-commands.js +1 -1
  5. package/dist/src/cli/commands/workflow-plan-commands.d.ts +39 -0
  6. package/dist/src/cli/commands/workflow-plan-commands.js +163 -0
  7. package/dist/src/cli/program.js +6 -0
  8. package/dist/src/services/doctor/doctor-service.d.ts +40 -0
  9. package/dist/src/services/doctor/doctor-service.js +160 -0
  10. package/dist/src/services/hooks/presence-marker-detector.d.ts +16 -0
  11. package/dist/src/services/hooks/presence-marker-detector.js +105 -0
  12. package/dist/src/services/skill-scope/adapters/_stub-helper.d.ts +39 -0
  13. package/dist/src/services/skill-scope/adapters/_stub-helper.js +98 -0
  14. package/dist/src/services/skill-scope/adapters/claude-code.d.ts +59 -0
  15. package/dist/src/services/skill-scope/adapters/claude-code.js +304 -0
  16. package/dist/src/services/skill-scope/adapters/codex.d.ts +2 -0
  17. package/dist/src/services/skill-scope/adapters/codex.js +12 -0
  18. package/dist/src/services/skill-scope/adapters/cursor.d.ts +2 -0
  19. package/dist/src/services/skill-scope/adapters/cursor.js +13 -0
  20. package/dist/src/services/skill-scope/adapters/qoder.d.ts +2 -0
  21. package/dist/src/services/skill-scope/adapters/qoder.js +13 -0
  22. package/dist/src/services/skill-scope/adapters/tongyi.d.ts +2 -0
  23. package/dist/src/services/skill-scope/adapters/tongyi.js +13 -0
  24. package/dist/src/services/skill-scope/adapters/trae.d.ts +2 -0
  25. package/dist/src/services/skill-scope/adapters/trae.js +12 -0
  26. package/dist/src/services/skill-scope/detect.d.ts +75 -0
  27. package/dist/src/services/skill-scope/detect.js +480 -0
  28. package/dist/src/services/skill-scope/registry.d.ts +41 -0
  29. package/dist/src/services/skill-scope/registry.js +83 -0
  30. package/dist/src/services/skill-scope/source-of-truth.d.ts +44 -0
  31. package/dist/src/services/skill-scope/source-of-truth.js +118 -0
  32. package/dist/src/services/skill-scope/types.d.ts +176 -0
  33. package/dist/src/services/skill-scope/types.js +74 -0
  34. package/dist/src/services/standards/migrate-service.d.ts +63 -0
  35. package/dist/src/services/standards/migrate-service.js +193 -0
  36. package/dist/src/services/standards/project-standards-service.js +1 -23
  37. package/dist/src/services/workflow/artifact-paths.d.ts +59 -0
  38. package/dist/src/services/workflow/artifact-paths.js +127 -0
  39. package/dist/src/services/workflow/pipeline-verify-service.d.ts +6 -0
  40. package/dist/src/services/workflow/pipeline-verify-service.js +49 -4
  41. package/dist/src/services/workflow/plan-reader.d.ts +29 -0
  42. package/dist/src/services/workflow/plan-reader.js +158 -0
  43. package/dist/src/services/workflow/plan-refresher.d.ts +32 -0
  44. package/dist/src/services/workflow/plan-refresher.js +353 -0
  45. package/dist/src/services/workflow/plan-trigger-detector.d.ts +55 -0
  46. package/dist/src/services/workflow/plan-trigger-detector.js +142 -0
  47. package/dist/src/shared/version.d.ts +1 -1
  48. package/dist/src/shared/version.js +1 -1
  49. package/package.json +3 -2
  50. package/schemas/doctor-report.schema.json +2 -2
  51. package/skills/peaks-qa/SKILL.md +25 -0
  52. package/skills/peaks-qa/references/qa-perf-test-plan.md +67 -0
  53. package/skills/peaks-qa/references/qa-security-test-plan.md +73 -0
  54. package/skills/peaks-qa/references/qa-transition-gates.md +13 -9
  55. package/skills/peaks-rd/SKILL.md +2 -2
  56. package/skills/peaks-rd/references/mandatory-perf-baseline.md +2 -0
@@ -0,0 +1,67 @@
1
+ # Performance test plan (project-level, slice 025)
2
+
3
+ > Body of `## Performance test plan`. Slice 025 introduces a
4
+ > project-level performance baseline that is **stable across slices
5
+ > within a session** and is refreshed only when a slice's diff matches
6
+ > the trigger table. The per-slice
7
+ > `qa/performance-findings-<rid>.md` references this baseline by path +
8
+ > hash.
9
+
10
+ ## Location
11
+
12
+ `.peaks/_runtime/<sessionId>/qa/perf-baseline.md`. The CLI is
13
+ `peaks workflow plan read perf --project <repo> --json` /
14
+ `peaks workflow plan refresh perf --project <repo> --apply` /
15
+ `peaks workflow plan detect-trigger --project <repo> --rid <rid> --json`.
16
+
17
+ ## Generation workflow
18
+
19
+ 1. `peaks workflow plan read perf --project <repo> --json` — return the
20
+ existing baseline envelope. When missing, proceed to step 2.
21
+ 2. `peaks workflow plan detect-trigger --rid <rid> --project <repo> --json`
22
+ — return `{ triggered, reason }`. The perf baseline is refreshed on
23
+ the same triggers as the security plan: new dep, new route/hook
24
+ registration, or `--refresh`.
25
+ 3. If `triggered: true`, run
26
+ `peaks workflow plan refresh perf --project <repo> --apply --json`.
27
+ 4. The slice's `qa/performance-findings-<rid>.md` opens with the
28
+ `## Plan reference` block referencing the baseline hash + path.
29
+ 5. The slice result records the diff vs the baseline threshold
30
+ (lighthouse / k6 / autocannon output) — see peaks-rd's
31
+ `mandatory-perf-baseline.md` for the RD-side measurement workflow.
32
+
33
+ ## Content schema (deterministic — body is normalized before hashing)
34
+
35
+ - `## CLI Command Inventory` — auto-enumerated from
36
+ `src/cli/commands/*-commands.ts`. Sorted alphabetically.
37
+ - `## Routes / Hooks` — fixed narrative. CLI is a CLI tool, no HTTP.
38
+ - `## Baseline Measurements` — placeholder table; the RD fills the
39
+ actual numbers (CLI does not call measurement tools).
40
+ - `## Thresholds` — placeholder; RD fills per-route thresholds.
41
+
42
+ ## Refresh trigger table (shared with security plan)
43
+
44
+ | Signal | Reason string | Re-generates the baseline? |
45
+ |---|---|---|
46
+ | New dep in `dependencies` / `optionalDependencies` | `new-dependency` | yes |
47
+ | New file under `src/services/{auth,security,secrets,payments,filesystem}/` | `auth-surface-added` | yes |
48
+ | New `*auth*.ts` file anywhere in `src/` | `auth-surface-added` | yes |
49
+ | New route / command registration (`router.ts`, `commands/*-commands.ts`) | `hot-path-added` | yes |
50
+ | `--refresh` on the slice workflow | `manual-override` | yes |
51
+ | devDependencies change only | (none) | no — locked Q1 default |
52
+ | Pure text edits to `rd/*` or `qa/test-cases/*` | (none) | no |
53
+
54
+ ## Back-compat (1 minor release)
55
+
56
+ The pre-slice-025 non-suffixed `qa/performance-findings.md` is still
57
+ accepted by `peaks workflow verify-pipeline` Gate C during the
58
+ 1-minor-release window. The path resolver
59
+ (`src/services/workflow/artifact-paths.ts`) handles the fallback and
60
+ emits a `legacy-redirect` warning.
61
+
62
+ ## CLI surface recap
63
+
64
+ | Command | Returns | JSON shape |
65
+ |---|---|---|
66
+ | `peaks workflow plan read perf --project <repo>` | `exists`, `path`, `hash`, `refreshedAt`, `source` | `{ ok, command, data: { ... } }` |
67
+ | `peaks workflow plan refresh perf --project <repo> [--apply]` | `writtenFiles`, `wouldWrite`, `hash`, `refreshedAt`, `dryRun` | `{ ok, command, data: { ... } }` |
@@ -0,0 +1,73 @@
1
+ # Security test plan (project-level, slice 025)
2
+
3
+ > Body of `## Security test plan`. Slice 025 introduces a project-level
4
+ > security test plan that is **stable across slices within a session**
5
+ > and is refreshed only when a slice's diff matches the trigger table.
6
+ > The per-slice `qa/security-findings-<rid>.md` references this plan by
7
+ > path + hash; the plan itself is NOT regenerated per slice.
8
+
9
+ ## Location
10
+
11
+ `.peaks/_runtime/<sessionId>/qa/security-test-plan.md`. The CLI is
12
+ `peaks workflow plan read security --project <repo> --json` /
13
+ `peaks workflow plan refresh security --project <repo> --apply` /
14
+ `peaks workflow plan detect-trigger --project <repo> --rid <rid> --json`.
15
+
16
+ ## Generation workflow
17
+
18
+ 1. `peaks workflow plan read security --project <repo> --json` — return
19
+ the existing plan envelope (exists, path, hash, refreshedAt). When
20
+ the plan does not exist, the slice workflow proceeds to step 2.
21
+ 2. `peaks workflow plan detect-trigger --rid <rid> --project <repo> --json`
22
+ — return `{ triggered, reason }` based on the trigger table below.
23
+ 3. If `triggered: true`, run
24
+ `peaks workflow plan refresh security --project <repo> --apply --json`
25
+ — atomic write; the response carries the new hash + refreshedAt.
26
+ 4. The slice's `qa/security-findings-<rid>.md` opens with the
27
+ `## Plan reference` block: `plan-hash: <hash>`, `plan-path: <path>`,
28
+ `unchanged-since: <prev-rid> | new`.
29
+ 5. Re-read with `peaks workflow plan read security` to confirm the
30
+ post-write envelope matches the value embedded in the slice result.
31
+
32
+ ## Content schema (deterministic — body is normalized before hashing)
33
+
34
+ - `## Threat Model` — fixed narrative. Auth boundary, secret storage,
35
+ external API surface, file system writes.
36
+ - `## Sensitive Service Files` — auto-enumerated from
37
+ `src/services/{auth,security,secrets,payments,filesystem}/`. Empty
38
+ buckets render as `- (none)`. Files sorted alphabetically.
39
+ - `## Auth Surface (*auth*.ts files repo-wide)` — auto-enumerated.
40
+ - `## Runtime Dependencies` — split into `dependencies` and
41
+ `optionalDependencies` (per locked decision 1, `devDependencies` are
42
+ **excluded** from the trigger scan and from the plan body).
43
+ - `## Test Matrix` — fixed narrative. Points the slice workflow at
44
+ peaks-qa's per-slice diff scan.
45
+
46
+ ## Refresh trigger table (locked decision 1)
47
+
48
+ | Signal | Reason string | Re-generates the plan? |
49
+ |---|---|---|
50
+ | New dep in `dependencies` / `optionalDependencies` | `new-dependency` | yes |
51
+ | New file under `src/services/{auth,security,secrets,payments,filesystem}/` | `auth-surface-added` | yes |
52
+ | New `*auth*.ts` file anywhere in `src/` | `auth-surface-added` | yes |
53
+ | New route / command registration (`router.ts`, `commands/*-commands.ts`) | `hot-path-added` | yes |
54
+ | `--refresh` on the slice workflow | `manual-override` | yes |
55
+ | devDependencies change only | (none) | no — locked Q1 default |
56
+ | Pure text edits to `rd/*` or `qa/test-cases/*` | (none) | no |
57
+
58
+ ## Back-compat (1 minor release)
59
+
60
+ The pre-slice-025 non-suffixed `qa/security-findings.md` is still
61
+ accepted by `peaks workflow verify-pipeline` Gate C during the
62
+ 1-minor-release window. The path resolver
63
+ (`src/services/workflow/artifact-paths.ts`) handles the fallback and
64
+ emits a `legacy-redirect` warning in the gate's violation list. The
65
+ form is rejected after the next minor bump.
66
+
67
+ ## CLI surface recap
68
+
69
+ | Command | Returns | JSON shape |
70
+ |---|---|---|
71
+ | `peaks workflow plan read security --project <repo>` | `exists`, `path`, `hash`, `refreshedAt`, `source` | `{ ok, command, data: { ... } }` |
72
+ | `peaks workflow plan refresh security --project <repo> [--apply]` | `writtenFiles`, `wouldWrite`, `hash`, `refreshedAt`, `dryRun` | `{ ok, command, data: { ... } }` |
73
+ | `peaks workflow plan detect-trigger --project <repo> --rid <rid> [--refresh]` | `triggered`, `reason` | `{ ok, command, data: { ... } }` |
@@ -6,12 +6,12 @@
6
6
 
7
7
  | Type | qa:running requires | qa:verdict-issued also requires |
8
8
  |---|---|---|
9
- | feature / refactor | `qa/test-cases/<rid>.md` | `qa/test-reports/<rid>.md` + `qa/security-findings.md` + `qa/performance-findings.md` |
10
- | bugfix | `qa/test-cases/<rid>.md` (MUST include the regression test) | `qa/test-reports/<rid>.md` + `qa/security-findings.md` (perf optional unless the bug is performance-related) |
11
- | config | (none) | `qa/security-findings.md` only |
9
+ | feature / refactor | `qa/test-cases/<rid>.md` | `qa/test-reports/<rid>.md` + `qa/security-findings-<rid>.md` + `qa/performance-findings-<rid>.md` |
10
+ | bugfix | `qa/test-cases/<rid>.md` (MUST include the regression test) | `qa/test-reports/<rid>.md` + `qa/security-findings-<rid>.md` (perf optional unless the bug is performance-related) |
11
+ | config | (none) | `qa/security-findings-<rid>.md` only |
12
12
  | docs / chore | (none) | (none) |
13
13
 
14
- For feature / refactor, `security-findings.md` and `performance-findings.md` MUST exist — record `"no findings"` inside if truly clean rather than skipping the file.
14
+ For feature / refactor, the `<rid>`-suffixed security-findings and performance-findings MUST exist — record `"no findings"` inside if truly clean rather than skipping the file. The pre-slice-025 non-suffixed `security-findings.md` / `performance-findings.md` paths are accepted as a 1-minor-release back-compat fallback; the resolver in `src/services/workflow/artifact-paths.ts` picks the suffixed form when both exist, and Gate C logs a `legacy-redirect` warning so users know to migrate. The form is rejected after the next minor bump.
15
15
 
16
16
  **Peaks-Cli Gate A — After test-case generation:**
17
17
  ```bash
@@ -29,13 +29,15 @@ npx vitest run --changed --reporter=verbose 2>&1 | tail -30
29
29
 
30
30
  **Peaks-Cli Gate A3 — Security test executed (NOT just a checklist item):**
31
31
  ```bash
32
- ls .peaks/<changeId>/qa/security-findings.md 2>&1
33
- # Expected: .peaks/<changeId>/qa/security-findings.md
32
+ ls .peaks/<changeId>/qa/security-findings-<rid>.md 2>&1
33
+ # Expected: .peaks/<changeId>/qa/security-findings-<rid>.md
34
+ # Back-compat (1 minor release): .peaks/<changeId>/qa/security-findings.md is also accepted.
34
35
  ```
35
36
 
36
37
  **Peaks-Cli Gate A4 — Performance test executed:**
37
38
  ```bash
38
- ls .peaks/<changeId>/qa/performance-findings.md 2>&1
39
+ ls .peaks/<changeId>/qa/performance-findings-<rid>.md 2>&1
40
+ # Back-compat (1 minor release): .peaks/<changeId>/qa/performance-findings.md is also accepted.
39
41
  ```
40
42
 
41
43
  **Peaks-Cli Gate B — After test-report write (MUST contain execution results):**
@@ -49,10 +51,12 @@ grep -c "pass\|fail\|blocked" .peaks/<changeId>/qa/test-reports/<rid>.md
49
51
  ```bash
50
52
  ls .peaks/<changeId>/qa/test-cases/<rid>.md \
51
53
  .peaks/<changeId>/qa/test-reports/<rid>.md \
52
- .peaks/<changeId>/qa/security-findings.md \
53
- .peaks/<changeId>/qa/performance-findings.md \
54
+ .peaks/<changeId>/qa/security-findings-<rid>.md \
55
+ .peaks/<changeId>/qa/performance-findings-<rid>.md \
54
56
  .peaks/<changeId>/qa/requests/<rid>.md
55
57
  # All five must exist. Missing any → QA incomplete, verdict blocked.
58
+ # Back-compat (1 minor release): security-findings.md / performance-findings.md
59
+ # (no <rid> suffix) are also accepted during the 1-minor-release window.
56
60
  ```
57
61
 
58
62
  **Peaks-Cli Gate E — Acceptance coverage:**
@@ -98,9 +98,9 @@ Before every code or mock change, RD must write and then enforce a red-line scop
98
98
 
99
99
  ## Mandatory perf-baseline output (RD-side perf gate)
100
100
 
101
- **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.
101
+ **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. **Slice 025**: the perf baseline is stable across slices within a session and is refreshed on trigger; use `peaks workflow plan refresh perf --apply` for refreshes.
102
102
 
103
- → see `references/mandatory-perf-baseline.md` for the full "when this applies" + `peaks perf baseline --apply` workflow.
103
+ → see `references/mandatory-perf-baseline.md` for the full "when this applies" + `peaks perf baseline --apply` workflow + slice-025 refresh contract.
104
104
 
105
105
  ## Implementation completion gates
106
106
 
@@ -2,6 +2,8 @@
2
2
 
3
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
4
 
5
+ > **Slice 025 — stable across slices within a session; refreshed on trigger.** The perf baseline is a **project-level** artifact (`.peaks/_runtime/<sessionId>/qa/perf-baseline.md`) and is **stable across slices within a session**. It is regenerated only when the slice diff matches the refresh trigger table (see `peaks-qa/references/qa-perf-test-plan.md`). Slices that do not trigger a refresh reference the existing baseline by hash from the per-slice `qa/performance-findings-<rid>.md` (not by regenerating the baseline). The CLI is `peaks workflow plan read|refresh|detect-trigger perf --project <repo>`; the RD-side `peaks perf baseline --apply` workflow below still scaffolds the initial file but the canonical refresh path post-slice-025 is the new `peaks workflow plan refresh` primitive.
6
+
5
7
  **When this applies:**
6
8
  - feature / refactor slices that touch a route, hook, API, or any user-perceivable surface
7
9
  - bugfix slices where the bug is performance-shaped (slow render, hot loop, N+1)