spexcode 0.2.8 → 0.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 (101) hide show
  1. package/README.md +56 -44
  2. package/package.json +3 -3
  3. package/spec-cli/bin/spex.mjs +2 -2
  4. package/spec-cli/hooks/dispatch.sh +1 -1
  5. package/spec-cli/hooks/harness.sh +26 -6
  6. package/spec-cli/src/anchors.ts +300 -0
  7. package/spec-cli/src/attach.ts +2 -2
  8. package/spec-cli/src/cli.ts +691 -536
  9. package/spec-cli/src/client.ts +31 -30
  10. package/spec-cli/src/contract-filter.ts +1 -1
  11. package/spec-cli/src/doctor.ts +40 -13
  12. package/spec-cli/src/gateway.ts +11 -7
  13. package/spec-cli/src/git.ts +23 -15
  14. package/spec-cli/src/{board.ts → graph.ts} +44 -14
  15. package/spec-cli/src/{boardCache.ts → graphCache.ts} +41 -21
  16. package/spec-cli/src/{boardDelta.ts → graphDelta.ts} +1 -1
  17. package/spec-cli/src/graphStream.ts +288 -0
  18. package/spec-cli/src/guide.ts +142 -98
  19. package/spec-cli/src/harness-select.ts +2 -2
  20. package/spec-cli/src/harness.ts +30 -14
  21. package/spec-cli/src/help.ts +300 -385
  22. package/spec-cli/src/hooks.ts +1 -1
  23. package/spec-cli/src/index.ts +144 -103
  24. package/spec-cli/src/init.ts +14 -13
  25. package/spec-cli/src/issues.ts +89 -33
  26. package/spec-cli/src/layout.ts +5 -5
  27. package/spec-cli/src/lint.ts +128 -30
  28. package/spec-cli/src/localIssues.ts +61 -60
  29. package/spec-cli/src/materialize.ts +1 -1
  30. package/spec-cli/src/mentions.ts +15 -15
  31. package/spec-cli/src/migrate-table.ts +398 -0
  32. package/spec-cli/src/migrate.ts +386 -0
  33. package/spec-cli/src/ranker.ts +30 -4
  34. package/spec-cli/src/reaper.ts +117 -0
  35. package/spec-cli/src/search.bench.mjs +12 -12
  36. package/spec-cli/src/search.ts +1 -1
  37. package/spec-cli/src/sessions.ts +244 -138
  38. package/spec-cli/src/specs.ts +40 -25
  39. package/spec-cli/src/supervise.ts +2 -2
  40. package/spec-cli/src/tree.ts +5 -5
  41. package/spec-cli/src/uninstall.ts +4 -4
  42. package/spec-cli/templates/hooks/post-checkout +1 -1
  43. package/spec-cli/templates/hooks/post-merge +3 -3
  44. package/spec-cli/templates/hooks/pre-commit +9 -9
  45. package/spec-cli/templates/hooks/prepare-commit-msg +1 -1
  46. package/spec-cli/templates/spec/project/{.config → .plugins}/core/idle/idle.sh +2 -2
  47. package/spec-cli/templates/spec/project/{.config → .plugins}/core/mark-active/mark-active.sh +7 -0
  48. package/spec-cli/templates/spec/project/{.config → .plugins}/core/mark-active/spec.md +2 -0
  49. package/spec-cli/templates/spec/project/{.config → .plugins}/core/session-fail/fail.sh +1 -1
  50. package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-first/spec-first.sh +1 -1
  51. package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-of-file/spec-of-file.sh +2 -2
  52. package/spec-cli/templates/spec/project/.plugins/core/spec.md +21 -0
  53. package/spec-cli/templates/spec/project/{.config → .plugins}/core/stop-gate/stop-gate.sh +21 -21
  54. package/spec-cli/templates/spec/project/{.config → .plugins}/distill/spec.md +2 -2
  55. package/spec-cli/templates/spec/project/{.config → .plugins}/extract/spec.md +5 -5
  56. package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/forge-link/spec.md +1 -1
  57. package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/reproduce-before-fix/spec.md +3 -3
  58. package/spec-cli/templates/spec/project/.plugins/prompts/spec.md +20 -0
  59. package/spec-cli/templates/spec/project/{.config → .plugins}/regroup/spec.md +2 -2
  60. package/spec-cli/templates/spec/project/.plugins/spec.md +18 -0
  61. package/spec-cli/templates/spec/project/.plugins/supervisor/spec.md +8 -0
  62. package/spec-cli/templates/spec/project/{.config → .plugins}/tidy/spec.md +1 -1
  63. package/spec-cli/templates/spec/project/spec.md +1 -1
  64. package/spec-dashboard/dist/assets/{Dashboard-P0B9ukSG.js → Dashboard-CTcH2eW9.js} +9 -9
  65. package/spec-dashboard/dist/assets/EvalsPage-CJNKwHLN.js +2 -0
  66. package/spec-dashboard/dist/assets/{FoldToggle-BuQ0lokE.js → FoldToggle-CVFbBpyW.js} +1 -1
  67. package/spec-dashboard/dist/assets/{IssuesPage-H-D8aHEl.js → IssuesPage-kULjonqj.js} +1 -1
  68. package/spec-dashboard/dist/assets/{MobileApp-oZXIeCPb.js → MobileApp-B0ZJju8K.js} +1 -1
  69. package/spec-dashboard/dist/assets/{SessionInterface-Blr_MEdU.js → SessionInterface-BRKJqU2U.js} +3 -3
  70. package/spec-dashboard/dist/assets/{SessionWindow-LcCzBMU7.js → SessionWindow-CDhEL7wO.js} +7 -7
  71. package/spec-dashboard/dist/assets/{Settings-_yOye-In.js → Settings-BL6FV_8S.js} +1 -1
  72. package/spec-dashboard/dist/assets/{index-uGs9v_9o.css → index-DmQsNYKK.css} +1 -1
  73. package/spec-dashboard/dist/assets/{index-BhIslAau.js → index-DulGPk6A.js} +8 -8
  74. package/spec-dashboard/dist/index.html +2 -2
  75. package/{spec-yatsu → spec-eval}/src/cache.ts +8 -5
  76. package/{spec-yatsu → spec-eval}/src/cli.ts +212 -96
  77. package/{spec-yatsu → spec-eval}/src/evaltab.ts +35 -27
  78. package/{spec-yatsu → spec-eval}/src/filing.ts +7 -5
  79. package/{spec-yatsu → spec-eval}/src/freshness.ts +44 -22
  80. package/spec-eval/src/humanok.ts +43 -0
  81. package/{spec-yatsu → spec-eval}/src/scenariofresh.ts +22 -17
  82. package/{spec-yatsu/src/yatsu.ts → spec-eval/src/scenarios.ts} +41 -26
  83. package/{spec-yatsu/src/proof.ts → spec-eval/src/sessioneval.ts} +59 -59
  84. package/{spec-yatsu → spec-eval}/src/sidecar.ts +42 -10
  85. package/{spec-yatsu → spec-eval}/src/timeline.ts +1 -1
  86. package/spec-forge/src/__fixtures__/github-forge.json +9 -9
  87. package/spec-forge/src/cli.ts +14 -13
  88. package/spec-forge/src/{needs-yatsu-eval.ts → needs-eval.ts} +6 -6
  89. package/spec-cli/src/boardStream.ts +0 -179
  90. package/spec-cli/templates/presets/careful/.config/clarify-before-code/spec.md +0 -11
  91. package/spec-cli/templates/spec/project/.config/core/spec.md +0 -17
  92. package/spec-cli/templates/spec/project/.config/spec.md +0 -15
  93. package/spec-cli/templates/spec/project/.config/supervisor/spec.md +0 -8
  94. package/spec-dashboard/dist/assets/EvalsPage-BrvAGyc4.js +0 -2
  95. /package/spec-cli/templates/spec/project/{.config → .plugins}/core/idle/spec.md +0 -0
  96. /package/spec-cli/templates/spec/project/{.config → .plugins}/core/session-fail/spec.md +0 -0
  97. /package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-first/spec.md +0 -0
  98. /package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-of-file/spec.md +0 -0
  99. /package/spec-cli/templates/spec/project/{.config → .plugins}/core/stop-gate/spec.md +0 -0
  100. /package/spec-cli/templates/spec/project/{.config → .plugins}/distill/digest.mjs +0 -0
  101. /package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/memory-hygiene/spec.md +0 -0
@@ -7,7 +7,7 @@ desc: Reverse-engineer a faithful spec tree out of existing code — responsibil
7
7
  kind: mutating
8
8
  ---
9
9
  Reverse-engineer a spec tree for the target source area(s) below — code that has no specs yet. Aim for a
10
- tree where every governed file is claimed and `spex lint` is clean, with bodies at contract altitude and in
10
+ tree where every governed file is claimed and `spex spec lint` is clean, with bodies at contract altitude and in
11
11
  the codebase's own primary language (a predominantly-Chinese repo → Chinese specs).
12
12
 
13
13
  {{targets}}
@@ -42,11 +42,11 @@ Then grow nodes under that spine:
42
42
  dignifying it with a confident spec.
43
43
 
44
44
  **Give every frontend node a loss signal.** A node that governs UI or visual code (`.tsx`/`.jsx`/`.vue`/
45
- `.svelte`/`.css`, or the dashboard) is a blind spot until it carries a `yatsu.md` — so write one as you
45
+ `.svelte`/`.css`, or the dashboard) is a blind spot until it carries a `eval.md` — so write one as you
46
46
  extract it: a **real user-path** scenario — a goal and the steps to reach it through the running app (never a
47
47
  bare render-check), covering a failure/empty/edge state — with a **description** of those steps and the
48
- **expected** zero-loss result. Frontend scenarios are measured by looking (YATU) — a screenshot filed with
49
- `spex yatsu eval <node> --image <png> --pass`. Backend nodes don't need one yet; run `spex yatsu scan` to
48
+ **expected** zero-loss result. Frontend scenarios are measured by looking through the running product, as a real user would — a screenshot filed with
49
+ `spex eval add <node> --image <png> --pass`. Backend nodes don't need one yet; run `spex eval lint` to
50
50
  list the frontend nodes still uncovered.
51
51
 
52
52
  **Extract incrementally — don't plan the whole tree before writing.** For a large area (hundreds of files),
@@ -57,4 +57,4 @@ one subtree uncommitted, so progress survives context limits.
57
57
 
58
58
  Confirm `spexcode.json`'s `governedRoots` points at the real source dirs first — lint reads silently empty
59
59
  otherwise. Commit one node per commit (`spec: <id> — extract from <area>`) with a `Session:` trailer, and
60
- run `spex lint` after each: it must reach 0 errors, 0 coverage warnings, 0 altitude warnings.
60
+ run `spex spec lint` after each: it must reach 0 errors, 0 coverage warnings, 0 altitude warnings.
@@ -6,4 +6,4 @@ hue: 280
6
6
  desc: A config plugin — agents link an issue they open to the spec node it serves via a `Spec: <id>` body line.
7
7
  code:
8
8
  ---
9
- When you open a GitHub issue, link it to the spec node(s) it serves by adding a line to the issue **body**: `Spec: <node-id>` (comma-separate several). The id is the node's **leaf** name — the folder under `.spec/…/<id>/spec.md`, e.g. `sessions`, never the slash-path. An unrecognized id silently links nothing, so use a real node id (`spex board` lists them). A pull request needs no marker: opening it from your `node/<id>` branch links it for free.
9
+ When you open a GitHub issue, link it to the spec node(s) it serves by adding a line to the issue **body**: `Spec: <node-id>` (comma-separate several). The id is the node's **leaf** name — the folder under `.spec/…/<id>/spec.md`, e.g. `sessions`, never the slash-path. An unrecognized id silently links nothing, so use a real node id (`spex graph --json` lists them). A pull request needs no marker: opening it from your `node/<id>` branch links it for free.
@@ -10,9 +10,9 @@ code:
10
10
 
11
11
  If your task is to FIX A BUG, reproduce it *first*, as a measurement — before you touch the fix. A claim that something is broken is worth nothing until the loss signal shows it broken; a claim that you fixed it is worth nothing until the same signal shows it passing. So a bug fix is bracketed by two readings of ONE scenario:
12
12
 
13
- - **A — reproduce (fail).** Find the yatsu scenario whose expected the bug violates (if none fits, ADD one to the node's `yatsu.md` — a description + the expected correct behaviour), run it, and file the failing reading with evidence that SHOWS the bug: `spex yatsu eval <node> --scenario <s> --fail --note "<what's wrong>"` plus an `--image`/`--video` of the actual broken behaviour. This is not ceremony — reproducing is how you learn what actually breaks, and a fix aimed at an unreproduced bug aims at a guess.
14
- - **B — fix, then re-measure (pass).** Make the code honor the spec, run the SAME scenario again, and file the passing reading with evidence of the corrected behaviour: `spex yatsu eval <node> --scenario <s> --pass`.
13
+ - **A — reproduce (fail).** Find the eval scenario whose expected the bug violates (if none fits, ADD one to the node's `eval.md` — a description + the expected correct behaviour), run it, and file the failing reading with evidence that SHOWS the bug: `spex eval add <node> --scenario <s> --fail --note "<what's wrong>"` plus an `--image`/`--video` of the actual broken behaviour. This is not ceremony — reproducing is how you learn what actually breaks, and a fix aimed at an unreproduced bug aims at a guess.
14
+ - **B — fix, then re-measure (pass).** Make the code honor the spec, run the SAME scenario again, and file the passing reading with evidence of the corrected behaviour: `spex eval add <node> --scenario <s> --pass`.
15
15
 
16
- The two readings on the same scenario are the **A/B** — the error→correct transition, the fix's proof-of-work. yatsu keeps per-scenario reading history, so the pair is durable and navigable end to end.
16
+ The two readings on the same scenario are the **A/B** — the error→correct transition, the fix's proof-of-work. eval keeps per-scenario reading history, so the pair is durable and navigable end to end.
17
17
 
18
18
  Don't skip A because the fix looks obvious — an obvious fix with no reproduced failure leaves the loss signal blind to exactly the regression you just closed. This does not apply to building new intent (there is no prior failure to reproduce) — it is the discipline for **repair**: keep the loss signal honest across a bug's whole lifecycle, not just at the end.
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: prompts
3
+ status: active
4
+ hue: 110
5
+ desc: Grouping shelf for the auxiliary `surface: system` prompt contracts — single-body always-on prose. `core` is not a resident — the core contract subsystem is a direct `.plugins` child. A shelf, not a surface — routing stays field-driven.
6
+ ---
7
+ # prompts
8
+
9
+ The **auxiliary** `surface: system` prompt contracts live here: leaf plugins whose whole substance is one
10
+ prose body an agent must always carry — materialized (in name order, together with every other system
11
+ body) into the `<!-- spexcode -->` contract block — rather than a verb it invokes. Grouping them keeps
12
+ `.plugins/` legible at a glance: peripheral prompt contracts on this shelf; the invocable surfaces
13
+ (command/skill/agent) and `core` as flat children beside it.
14
+
15
+ The shelf boundary is **leafness, not surface**: a single-body prose contract shelves here, while a
16
+ contract that anchors its own subtree outranks the shelf — `core`, the contract subsystem whose children
17
+ are the `surface: hook` gates, is a *peer* of this shelf, never a resident.
18
+
19
+ This node is a **shelf, not a surface**: it declares no `surface` field and gathers nothing itself.
20
+ Discovery is recursive and field-driven, so residents plug in exactly as they would at the root.
@@ -18,8 +18,8 @@ Read before you move: the over-broad node's spec, every child's spec, and the `[
18
18
 
19
19
  Honor these:
20
20
 
21
- - **Reparent, never rewrite.** Move a node by `git mv`-ing its folder; its id (= folder basename), its `[[links]]`, its `code:` governance, and its `yatsu.md` all ride along untouched. If a child needs its body edited to belong in a group, it doesn't belong.
21
+ - **Reparent, never rewrite.** Move a node by `git mv`-ing its folder; its id (= folder basename), its `[[links]]`, its `code:` governance, and its `eval.md` all ride along untouched. If a child needs its body edited to belong in a group, it doesn't belong.
22
22
  - **Fewest, deepest-justified parents.** Don't trade one flat layer for six two-child wrappers — that relocates the sprawl instead of resolving it. Between two passing groupings, take the one that adds fewer nodes.
23
23
  - Parent ids name the concept (kebab-case); give the parent a `hue` near its children's family.
24
24
 
25
- Work the order: (1) read everything; (2) write each candidate seam with the one-sentence intent that justifies it — kill the unjustifiable, and mark each survivor as reparent-under-existing or new-parent; (3) make the moves, one reviewable commit per group (`spec: <parent> — regroup <children>`, with a `Session:` trailer); (4) run `spex lint` and confirm breadth is resolved with no new errors. Uncommitted `git mv`s churn the drift count transiently — committing settles it; don't chase it.
25
+ Work the order: (1) read everything; (2) write each candidate seam with the one-sentence intent that justifies it — kill the unjustifiable, and mark each survivor as reparent-under-existing or new-parent; (3) make the moves, one reviewable commit per group (`spec: <parent> — regroup <children>`, with a `Session:` trailer); (4) run `spex spec lint` and confirm breadth is resolved with no new errors. Uncommitted `git mv`s churn the drift count transiently — committing settles it; don't chase it.
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: .plugins
3
+ status: active
4
+ hue: 110
5
+ desc: The instance home — this repo's DIY dev-flow plugins live here as skill-shaped plugin nodes.
6
+ ---
7
+ `.plugins/` is the **instance** of the plugin system: the concrete dev-flow plugins this repo ships for
8
+ working in it. Each plugin is a skill-shaped node — its folder *is* the unit (a `spec.md` plus any
9
+ co-located scripts) — carrying a `surface: command|system|…` field that names where it plugs in.
10
+ Discovery is recursive and field-driven, so plugins may sit under a grouping shelf: the auxiliary
11
+ `surface: system` prompt contracts live under `prompts/`, while `core` — the contract subsystem whose
12
+ children are the `surface: hook` gates — and invocable presets (command/skill/agent) are flat
13
+ children here.
14
+
15
+ The launcher's system gather and the new-session dropdown read from here. Only **active** plugins
16
+ gather: a `pending` node is declared intent, not yet an active plugin. The seed ships `core`
17
+ (`surface: system` — the spec-discipline contract folded into every agent) plus command presets like
18
+ `tidy`; add your own by creating a sibling node with a `surface` field.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: supervisor
3
+ surface: command
4
+ status: active
5
+ hue: 280
6
+ desc: Launch a supervisor agent that manages other agents from the main checkout to drive a goal to completion.
7
+ ---
8
+ You are a SpexCode supervisor — a **manager**, not a feature worker. Your work base is the main checkout (the repository root), NOT your own worktree: do all git via `git -C <root>`, everything else via the `spex` CLI, and never write feature code. **FIRST, read the project's agent notes (`<root>/CLAUDE.md` / `AGENTS.md`, including the materialized `<!-- spexcode -->` contract block)** for project-specific rules; the loop below (dispatch → monitor → review → merge → close, parallelizing independent tasks) is your playbook. Then drive the goal: decompose it into worker-sized tasks and dispatch one worker per independent task (`spex session new "<task>"` — give each ONLY its task; a task about one specific node mentions it as `[[<id>]]`, which only sets the branch name and board attribution; the session's real node links come from what it edits), monitor with `spex session watch`, review proposals with `spex session review <id>`, merge good ones with `git -C <root> merge --no-ff <branch>`, then close. Never let a worker self-merge; keep `spex spec lint` at 0 errors. To WAIT on a worker, POLL one-shot (`spex session review <id>` or `spex session ls` — both return immediately); never block on `spex session watch`, which STREAMS forever and will freeze your turn. One footgun that bites a fresh supervisor: before `spex session close <id>`, confirm the merge landed (`git -C <root> log -1` shows HEAD at the new merge commit) — closing an unmerged branch discards the work. Report progress as you go and when the goal is complete. Your goal follows:
@@ -22,4 +22,4 @@ For each target, in its own commit:
22
22
  - **Cut redundancy and narration** — say each thing once, at the altitude a maintainer needs.
23
23
  - **Stay a living document** — rewrite in place; never add `## vN` history (git carries versions).
24
24
 
25
- Commit per node (`spec: <id> — tidy to contract altitude`) with a `Session:` trailer. Run `spex lint` after each — it must stay at 0 errors.
25
+ Commit per node (`spec: <id> — tidy to contract altitude`) with a `Session:` trailer. Run `spex spec lint` after each — it must stay at 0 errors.
@@ -12,7 +12,7 @@ made it. This node is the founding spec everything else hangs from — **rewrite
12
12
  your own project**, then grow child package/feature nodes beneath it (each its own directory with a
13
13
  `spec.md`).
14
14
 
15
- `.config/` holds the dev-flow plugins this instance ships — skill-shaped flat child nodes, each tagged
15
+ `.plugins/` holds the dev-flow plugins this instance ships — skill-shaped child nodes, each tagged
16
16
  with a `surface` field: a `surface: system` node folds into every launched agent's system prompt as
17
17
  always-on contract (the seed ships `core`), and a `surface: command` node is a prompt preset the
18
18
  new-session dropdown composes over target nodes (the seed ships `tidy`). Add, edit, or