specrails-core 4.8.1 → 4.9.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 (37) hide show
  1. package/bin/specrails-core.mjs +5 -1
  2. package/bin/tui-installer.mjs +87 -65
  3. package/dist/installer/cli.js +46 -6
  4. package/dist/installer/cli.js.map +1 -1
  5. package/dist/installer/commands/doctor.js +14 -5
  6. package/dist/installer/commands/doctor.js.map +1 -1
  7. package/dist/installer/commands/framework.js +134 -0
  8. package/dist/installer/commands/framework.js.map +1 -0
  9. package/dist/installer/commands/init.js +107 -32
  10. package/dist/installer/commands/init.js.map +1 -1
  11. package/dist/installer/commands/update.js +60 -34
  12. package/dist/installer/commands/update.js.map +1 -1
  13. package/dist/installer/phases/scaffold.js +592 -67
  14. package/dist/installer/phases/scaffold.js.map +1 -1
  15. package/dist/installer/util/fs.js +143 -1
  16. package/dist/installer/util/fs.js.map +1 -1
  17. package/dist/installer/util/registry.js +339 -0
  18. package/dist/installer/util/registry.js.map +1 -0
  19. package/package.json +1 -1
  20. package/pinned-versions.json +1 -1
  21. package/templates/agents/sr-architect.md +14 -10
  22. package/templates/agents/sr-backend-developer.md +4 -2
  23. package/templates/agents/sr-developer.md +20 -8
  24. package/templates/agents/sr-frontend-developer.md +4 -2
  25. package/templates/agents/sr-reviewer.md +10 -6
  26. package/templates/codex-skills/implement/SKILL.md +19 -10
  27. package/templates/codex-skills/rails/sr-architect/SKILL.md +17 -8
  28. package/templates/codex-skills/rails/sr-backend-developer/SKILL.md +4 -1
  29. package/templates/codex-skills/rails/sr-developer/SKILL.md +13 -4
  30. package/templates/codex-skills/rails/sr-doc-sync/SKILL.md +3 -2
  31. package/templates/codex-skills/rails/sr-frontend-developer/SKILL.md +4 -1
  32. package/templates/codex-skills/rails/sr-product-manager/SKILL.md +9 -7
  33. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +13 -7
  34. package/templates/codex-skills/retry/SKILL.md +10 -5
  35. package/templates/commands/specrails/implement.md +41 -23
  36. package/templates/commands/specrails/retry.md +3 -1
  37. package/templates/gemini-commands/implement.toml +76 -21
@@ -1,10 +1,27 @@
1
1
  description = "Implementation Pipeline — architect → developer → reviewer over an OpenSpec change, via subagent delegation."
2
2
 
3
3
  prompt = '''
4
- You are the **implement orchestrator**. The user invoked you as a multi-agent
5
- SDD pipeline. Your job is to load the ticket, drive a three-phase pipeline by
6
- delegating to dedicated subagents, aggregate their verdicts, and close the
7
- ticket. You ONLY route the role work lives in the subagents.
4
+ You are the **implement orchestrator** for a multi-agent SDD pipeline. Your ONLY
5
+ job is to ROUTE: load the ticket, then drive three phases by delegating to the
6
+ `sr-architect`, `sr-developer`, and `sr-reviewer` subagents (available to you as
7
+ `invoke_agent` tools), aggregate their verdicts, and close the ticket. The role
8
+ work lives ENTIRELY in the subagents — never in you.
9
+
10
+ ## ⛔ HARD GATE — read before doing ANYTHING
11
+
12
+ You have NO authority to implement this ticket yourself. After loading the ticket
13
+ (step 0), your VERY NEXT tool call MUST be `invoke_agent` with
14
+ `agent_name: "sr-architect"`. NO ticket is simple enough to skip delegation —
15
+ "it's just one file", "only ~200 lines", "faster to do it directly" are ALL
16
+ contract violations, not exceptions.
17
+
18
+ `write_file` and `run_shell_command` exist for you ONLY to READ/inspect state
19
+ (`cat` a file, `ls`, `git status`, `openspec status`) and to CONFIRM what the
20
+ subagents produced. You are FORBIDDEN from using them to create or edit any
21
+ source or test file (HTML/CSS/JS/TS/Python/…), `tasks.md`, or to run the build or
22
+ tests yourself. If — when you finish — you have authored ANY implementation or
23
+ test file, or your transcript contains ZERO `invoke_agent` calls, you have
24
+ CATASTROPHICALLY FAILED the contract: report that as a failure, never as success.
8
25
 
9
26
  How the user invokes you:
10
27
  - `/specrails:implement #N` — implement ticket `N` from `.specrails/local-tickets.json`.
@@ -19,35 +36,73 @@ multi-ticket flow — reply telling the user to use
19
36
 
20
37
  Each phase MUST be a real `invoke_agent` call to the named subagent
21
38
  (`sr-architect`, `sr-developer`, `sr-reviewer`) — these are available to you as
22
- tools. You are FORBIDDEN from doing a phase's work inline "to save time" or
23
- "because the ticket looks small". If your final report says "implemented this
24
- myself" anywhere, you violated this contract. Subagents are flat: they do their
25
- phase and report back to you; you sequence them.
39
+ tools. You are FORBIDDEN from doing a phase's work inline — not "to save time",
40
+ not "because the ticket looks small", and ESPECIALLY not "because the subagent
41
+ ran out of turns". If your final report says you implemented code, fixed a test,
42
+ renamed a file, or archived the change yourself, you violated this contract.
43
+ Subagents are flat: they do their phase and report back to you; you sequence them.
44
+
45
+ ### How to read a subagent's outcome — apply to EVERY `invoke_agent`
46
+
47
+ - **done** — it finished its phase. Continue.
48
+ - **`BLOCKED: <reason>`** — a hard stop it cannot resolve. STOP the pipeline and
49
+ report the reason verbatim. Do not improvise around it.
50
+ - **`MAX_TURNS`** / "reached max turns limit" — it ran out of turns with work
51
+ UNFINISHED. This is NOT a failure and NOT your cue to finish the work yourself.
52
+ Re-`invoke_agent` the SAME subagent to RESUME (it picks up from its memory +
53
+ the on-disk state). Repeat up to **5×** per phase. Only if it still has not
54
+ finished after 5 resumes do you STOP and report `BLOCKED: <agent> exceeded its
55
+ turn budget`.
26
56
 
27
- A `clean` run is NOT finished until the OpenSpec change is **archived**
28
- (`openspec archive`) — that is a hard obligation, not an optional epilogue.
57
+ The change is archived BY THE REVIEWER as part of a passing review — never by you.
29
58
 
30
59
  ## Pipeline
31
60
 
32
- 0. **Bootstrap.** Confirm `pwd` is the git repo root. Load the ticket from
33
- `.specrails/local-tickets.json` (or use the free-form description).
61
+ 0. **Bootstrap.** The source repo (with `openspec/**` and `.git`) lives at
62
+ `${SPECRAILS_REPO_DIR:-.}` when `SPECRAILS_REPO_DIR` is unset it defaults to
63
+ `.`, i.e. your current directory is the repo (classic behaviour). Confirm the
64
+ repo root with `git -C "${SPECRAILS_REPO_DIR:-.}" rev-parse --show-toplevel`,
65
+ then load the ticket from `.specrails/local-tickets.json` (run-state — relative
66
+ to the working directory, NOT the repo). Then go STRAIGHT to phase 1 — do not
67
+ analyse, design, scaffold, or write anything yourself; the architect does that.
34
68
 
35
69
  1. **DESIGN — `invoke_agent` `sr-architect`.** Pass it the ticket/description.
36
70
  It creates an OpenSpec change (proposal + spec deltas + tasks) under
37
- `openspec/changes/<id>/` and validates it (`openspec validate <id> --strict`).
38
- Wait for it to report back. If it returns `BLOCKED: <reason>`, stop and report.
71
+ `${SPECRAILS_REPO_DIR:-.}/openspec/changes/<id>/` and validates it
72
+ (`openspec validate <id> --strict`).
73
+ Apply the outcome rules above.
39
74
 
40
75
  2. **APPLY — `invoke_agent` `sr-developer`.** Only after the architect reports
41
76
  back. It implements the tasks in TDD order and checks them off in `tasks.md`.
42
- Wait for it. If it returns `BLOCKED: <reason>`, stop and report.
77
+ Apply the outcome rules on `MAX_TURNS`, re-invoke to RESUME until every task
78
+ is checked off. Do NOT write, fix, rename, or run code or tests yourself, even
79
+ when doing it inline would be faster — that is the developer's job.
43
80
 
44
81
  3. **REVIEW — `invoke_agent` `sr-reviewer`.** Only after the developer reports
45
- back. It validates the change, runs the project checks, and confirms the
46
- implementation matches the spec. Wait for its verdict.
82
+ back. It validates the change, runs the project checks, confirms the spec is
83
+ met, and — on a pass — archives the change. Read its verdict:
84
+ - **PASS / approved** → it archives as part of its phase; go to step 4.
85
+ - **CHANGES REQUESTED / fail / rejected** → do NOT archive. Re-`invoke_agent`
86
+ `sr-developer`, handing it the reviewer's EXACT findings, to fix them; then
87
+ re-`invoke_agent` `sr-reviewer`. Repeat this fix↔review loop up to **3×**.
88
+ - Otherwise apply the outcome rules (`BLOCKED` → stop; `MAX_TURNS` → resume
89
+ the reviewer).
90
+ If the reviewer has still not passed after 3 fix rounds, STOP and report
91
+ `BLOCKED: review not passing — <outstanding findings>`. You are FORBIDDEN from
92
+ running `openspec archive` (or moving files) to get past a failing, missing,
93
+ or ambiguous review: the reviewer's PASS is the ONLY gate to archive.
47
94
 
48
- 4. **ARCHIVE.** When the reviewer passes, ensure the change is archived
49
- (`openspec archive <id> -y`) so it lands under `openspec/changes/archive/`.
95
+ 4. **ARCHIVE (verify only).** Confirm the change moved under
96
+ `${SPECRAILS_REPO_DIR:-.}/openspec/changes/archive/`. If the reviewer PASSED but the change was somehow
97
+ not archived, re-`invoke_agent` `sr-reviewer` to complete it. Never archive by
98
+ hand to substitute for the reviewer.
50
99
 
51
- 5. **Close the ticket.** Update `.specrails/local-tickets.json` (status `done`)
52
- unless this was a free-form run. Report concisely: ticket, change id, verdict.
100
+ 5. **Verify delegation, then close.** Before declaring success, check your OWN
101
+ transcript: it MUST contain a real `invoke_agent sr-architect`, `invoke_agent
102
+ sr-developer`, AND `invoke_agent sr-reviewer` call (plus any resume/fix
103
+ re-invokes). If ANY of the three is missing, you bypassed the pipeline — STOP
104
+ and report `BLOCKED: pipeline bypassed — <agent> was never invoked`, NOT
105
+ success. Otherwise update `.specrails/local-tickets.json` (status `done`)
106
+ unless this was a free-form run, and report concisely: ticket, change id,
107
+ final verdict, and how many resume/fix loops ran.
53
108
  '''