peaks-cli 1.2.3 → 1.2.5

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 (32) hide show
  1. package/dist/src/cli/commands/openspec-commands.js +31 -0
  2. package/dist/src/cli/commands/project-commands.js +51 -1
  3. package/dist/src/cli/commands/sop-commands.js +2 -2
  4. package/dist/src/cli/commands/workspace-commands.js +38 -4
  5. package/dist/src/services/memory/project-memory-service.d.ts +50 -0
  6. package/dist/src/services/memory/project-memory-service.js +412 -35
  7. package/dist/src/services/openspec/openspec-init-service.d.ts +23 -0
  8. package/dist/src/services/openspec/openspec-init-service.js +122 -0
  9. package/dist/src/services/session/index.d.ts +1 -1
  10. package/dist/src/services/session/index.js +1 -1
  11. package/dist/src/services/session/session-manager.d.ts +11 -0
  12. package/dist/src/services/session/session-manager.js +19 -0
  13. package/dist/src/services/skills/skill-presence-service.js +11 -0
  14. package/dist/src/services/sop/sop-check-service.d.ts +16 -0
  15. package/dist/src/services/sop/sop-check-service.js +35 -2
  16. package/dist/src/services/sop/sop-service.d.ts +8 -0
  17. package/dist/src/services/sop/sop-service.js +13 -2
  18. package/dist/src/services/sop/sop-types.d.ts +7 -0
  19. package/dist/src/services/workspace/workspace-service.d.ts +15 -0
  20. package/dist/src/services/workspace/workspace-service.js +60 -1
  21. package/dist/src/shared/version.d.ts +1 -1
  22. package/dist/src/shared/version.js +1 -1
  23. package/package.json +1 -1
  24. package/skills/peaks-prd/SKILL.md +36 -0
  25. package/skills/peaks-qa/SKILL.md +92 -2
  26. package/skills/peaks-rd/SKILL.md +70 -2
  27. package/skills/peaks-solo/SKILL.md +253 -40
  28. package/skills/peaks-solo/references/swarm-dispatch-contract.md +186 -0
  29. package/skills/peaks-sop/SKILL.md +17 -0
  30. package/skills/peaks-sop/references/sop-authoring.md +1 -1
  31. package/skills/peaks-txt/SKILL.md +16 -0
  32. package/skills/peaks-ui/SKILL.md +61 -2
@@ -8,7 +8,7 @@ interview → generate → debug loop, and security notes. The skill drives the
8
8
 
9
9
  SOP **definitions** live in one of two layers:
10
10
  - **Global** `~/.peaks/sops/<sop-id>/sop.json` (+ `SKILL.md`) — personal, reusable across every project. `init` / `lint` / `register` default here.
11
- - **Project** `<project>/.peaks/sops/<sop-id>/sop.json` — committed into the repo and team-shared. Pass `--project <repo>` to `init` / `lint` / `register` to use this layer. The project layer **wins** over global for the same id; execution reads (`check`/`advance`/enforce) and `sop registry --project` see the merged view.
11
+ - **Project** `<project>/.peaks/sops/<sop-id>/sop.json` — committed into the repo and team-shared. Pass `--project <repo>` to `init` / `lint` / `register` to use this layer. The project layer **wins** over global for the same id; execution reads (`check` / `advance` / `gate enforce` / `registry`) default `--project` to the current directory, so they see the merged view without an explicit flag.
12
12
 
13
13
  A SOP's **run-state** is always per-project: `<project>/.peaks/sop-state/<sop-id>/state.json` (git-ignored — runtime, not shared). `check` / `advance` take `--project` (default: current directory) — that says which project the gate paths resolve against, whose progress advances, and which definition layer wins.
14
14
 
@@ -207,12 +207,28 @@ peaks capabilities --json
207
207
 
208
208
  # 6. Memory extraction — --apply is REQUIRED to write .peaks/memory
209
209
  # (without --apply the command only previews; the directory will NOT be created)
210
+ # You MUST scan the handoff capsule for embedded memory blocks FIRST. If none
211
+ # are present, the step is a no-op (the command succeeds with extractedCount=0
212
+ # and writes nothing). If blocks are present, --apply writes them and the
213
+ # index is regenerated.
214
+ grep -c "peaks-memory:start" .peaks/<id>/txt/handoff.md || true # skill-side scan; do NOT add a new CLI
210
215
  peaks memory extract --project <repo> --artifact .peaks/<id>/txt/handoff.md --apply --json
211
216
  peaks skill presence:clear --project <repo> # handoff capsule complete, remove presence indicator
212
217
  ```
213
218
 
214
219
  `peaks memory extract --apply` writes to `.peaks/memory` (without `--apply` it only previews). The handoff capsule `.peaks/<id>/txt/handoff.md` is the primary artifact for extraction — embed `<!-- peaks-memory:start -->` blocks in it for stable project facts before running extract.
215
220
 
221
+ ### Memory block embedding rule (BLOCKING — read before writing the handoff)
222
+
223
+ Every handoff capsule you emit **MUST** include the scan for stable facts. The minimum acceptable is:
224
+
225
+ - Run `grep -c 'peaks-memory:start' .peaks/<id>/txt/handoff.md` after writing the capsule body.
226
+ - If the count is 0 AND this session surfaced a stable project fact (an architectural decision, a stack constraint, a naming convention, a refactor approved by the user, an API pattern, a hard rule from RD/QA review), you MUST go back and embed at least one `<!-- peaks-memory:start -->` block before declaring TXT complete. Skipping the block is a workflow violation.
227
+ - If the count is 0 AND no stable fact was surfaced (pure analysis, no code touched, all transient), it is acceptable to skip embedding — but you MUST still run `peaks memory extract --apply` so the artefact state stays consistent (the command will be a no-op write, that's fine).
228
+ - If the count is ≥ 1, the `--apply` extract will write one markdown per block to `.peaks/memory/` and regenerate `index.json`. The user sees the durable persistence; that is the entire point of this step.
229
+
230
+ This rule is the skill-side half of the **Skill is primary, CLI is auxiliary** contract: the LLM is responsible for embedding blocks (skill prompt, no CLI can decide what is stable), and the CLI is responsible for atomic persistence (`peaks memory extract --apply`, single shot, structured JSON envelope).
231
+
216
232
  ### Transition verification gates (MANDATORY — run the command, see the output)
217
233
 
218
234
  You cannot declare TXT complete from memory. Each gate below is a `ls` command you **MUST run** and whose output you **MUST see** before proceeding.
@@ -7,9 +7,68 @@ description: UI and experience skill for Peaks. Use when a workflow touches UI/U
7
7
 
8
8
  Peaks-Cli UI handles experience, interaction, visual direction, and UI-specific refactor artifacts.
9
9
 
10
- ## Skill presence (MANDATORY first action)
10
+ ## Hard contracts for browser inspection (BLOCKING read before any browser_take_screenshot / login flow)
11
11
 
12
- Before any analysis or tool call, immediately run:
12
+ UI's headed-browser work (visual inspection, regression seed capture, Figma / live-page cross-check) follows the same two contracts as `peaks-qa` and `peaks-rd`. The contracts are defined in full in `peaks-qa` ("Hard contracts for browser validation"); UI inherits them.
13
+
14
+ ### Contract 1 — Inspection screenshots must land under .peaks/<sid>/qa/screenshots/
15
+
16
+ Every `mcp__playwright__browser_take_screenshot` call **MUST** pass `filename` inside `.peaks/<session-id>/qa/screenshots/`, named after the inspection target (e.g. `home-after-cta.png`, `empty-state-v2.png`). Do not let Playwright fall back to the project root. After every batch, run:
17
+
18
+ ```bash
19
+ ls .peaks/<sid>/qa/screenshots/*.png 2>&1
20
+ find . -maxdepth 1 -name '*.png' 2>&1
21
+ ```
22
+
23
+ `find` must be empty; any project-root `.png` is a leak and must be moved into the screenshots directory before completing this skill.
24
+
25
+ ### Contract 2 — Login / CAPTCHA / SSO / MFA wall is a hard block, not a skip
26
+
27
+ UI's headed-browser inspection hits the same auth walls. The flow is identical to QA: `AskUserQuestion` with three options (logged in / skip / cancel); no silent downgrade to static screenshots, no inferring login from DOM state. The full hard-block contract is defined in `peaks-qa`; UI inherits it.
28
+
29
+ ## Sub-agent dispatch (when launched by peaks-solo swarm)
30
+
31
+ When this skill is launched as a sub-agent via `Task(subagent_type="general-purpose", ...)` from `peaks-solo`, the following sections of THIS skill are **suspended** for the sub-agent run:
32
+
33
+ - **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-ui`. 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/<session-id>/system/sub-agent-ui.json` and only that.
34
+ - **Workspace initialization** — Solo has already run `peaks workspace init` before fan-out. Do not re-run it.
35
+ - **Mode selection** — Solo has already chosen the mode.
36
+ - **Statusline install** — already done by Solo at session startup.
37
+
38
+ What the sub-agent **MUST** still do:
39
+
40
+ 0. **Do NOT call `peaks request init`** — Solo has already initialised the request artefact slot in the main loop before fan-out. The sub-agent reads it via `peaks request show <rid> --role ui --project <repo> --json` if it needs to.
41
+ 2. `peaks request show <rid> --role prd --project <repo> --json` to read the PRD scope.
42
+ 3. Read project-scan (`rd/project-scan.md`) for component library, CSS framework, design-system context.
43
+ 4. Run the prototype fidelity check (Figma / PRD visuals / headed browser).
44
+ 5. Write the two artefacts: `.peaks/<session-id>/ui/design-draft.md` and `.peaks/<session-id>/ui/requests/<rid>.md`.
45
+ 6. Return only a compact JSON envelope:
46
+
47
+ ```json
48
+ {
49
+ "role": "ui",
50
+ "rid": "<rid>",
51
+ "status": "ok" | "blocked" | "skipped",
52
+ "artefacts": [".peaks/<sid>/ui/design-draft.md", ".peaks/<sid>/ui/requests/<rid>.md"],
53
+ "warnings": [],
54
+ "blockedReason": null
55
+ }
56
+ ```
57
+
58
+ **Hard prohibitions** (sub-agent context):
59
+
60
+ - Do NOT call `Skill(skill="...")`.
61
+ - Do NOT call `peaks skill presence:set` — Solo owns the active-skill file.
62
+ - Do NOT modify application code. UI is design-direction only; the actual frontend code is written in the RD implementation phase.
63
+ - Do NOT install MCP servers. If `peaks mcp list` shows playwright-mcp missing and the headed browser is required, return `{"status":"blocked","blockedReason":"playwright-mcp-unavailable"}` and let Solo escalate to the user.
64
+ - Do NOT commit, push, install hooks, or apply settings.json mutations.
65
+ - Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}`.
66
+
67
+ If the request does not affect user-visible behavior (no frontend keyword hit, `frontendOnly=false`), the swarm plan should not include UI at all — Solo will not launch this sub-agent. But if it does launch you and you determine the work is non-visual, return `{"status":"skipped","reason":"non-frontend-request"}` so Solo can record the misfire.
68
+
69
+ ## Skill presence (MANDATORY first action — main-loop context only)
70
+
71
+ When this skill is running in the main Claude session (not as a sub-agent), before any analysis or tool call, immediately run:
13
72
 
14
73
  ```bash
15
74
  peaks skill presence:set peaks-ui --project <repo> --mode <mode> --gate startup