specrails-core 4.12.1 → 5.1.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 (97) hide show
  1. package/README.md +103 -339
  2. package/bin/specrails-core.mjs +20 -98
  3. package/bin/tui-installer.mjs +22 -105
  4. package/commands/doctor.md +1 -1
  5. package/dist/installer/cli.js +16 -2
  6. package/dist/installer/cli.js.map +1 -1
  7. package/dist/installer/commands/doctor.js +3 -5
  8. package/dist/installer/commands/doctor.js.map +1 -1
  9. package/dist/installer/commands/framework.js +64 -49
  10. package/dist/installer/commands/framework.js.map +1 -1
  11. package/dist/installer/commands/init.js +122 -82
  12. package/dist/installer/commands/init.js.map +1 -1
  13. package/dist/installer/commands/update.js +90 -83
  14. package/dist/installer/commands/update.js.map +1 -1
  15. package/dist/installer/commands/v5-migration.js +133 -0
  16. package/dist/installer/commands/v5-migration.js.map +1 -0
  17. package/dist/installer/phases/framework-lifecycle.js +2 -0
  18. package/dist/installer/phases/framework-lifecycle.js.map +1 -1
  19. package/dist/installer/phases/install-config.js +3 -6
  20. package/dist/installer/phases/install-config.js.map +1 -1
  21. package/dist/installer/phases/manifest.js +2 -6
  22. package/dist/installer/phases/manifest.js.map +1 -1
  23. package/dist/installer/phases/prereqs.js +0 -1
  24. package/dist/installer/phases/prereqs.js.map +1 -1
  25. package/dist/installer/phases/scaffold.js +228 -405
  26. package/dist/installer/phases/scaffold.js.map +1 -1
  27. package/dist/installer/runtime/pipeline-state.js +801 -0
  28. package/dist/installer/runtime/pipeline-state.js.map +1 -0
  29. package/dist/installer/util/install-transaction.js +246 -0
  30. package/dist/installer/util/install-transaction.js.map +1 -0
  31. package/dist/installer/util/registry.js +20 -0
  32. package/dist/installer/util/registry.js.map +1 -1
  33. package/docs/ci-cd.md +57 -0
  34. package/docs/user-docs/codex-vs-claude-code.md +23 -151
  35. package/docs/user-docs/core-updates.md +70 -0
  36. package/docs/user-docs/provider-pipelines.md +53 -0
  37. package/integration-contract.json +179 -66
  38. package/package.json +5 -2
  39. package/schemas/profile.v1.json +1 -1
  40. package/templates/agents/sr-architect.md +30 -0
  41. package/templates/agents/sr-developer.md +30 -19
  42. package/templates/agents/sr-reviewer.md +70 -64
  43. package/templates/codex-skills/batch-implement/SKILL.md +58 -267
  44. package/templates/codex-skills/implement/SKILL.md +136 -420
  45. package/templates/codex-skills/rails/sr-architect/SKILL.md +45 -20
  46. package/templates/codex-skills/rails/sr-developer/SKILL.md +42 -10
  47. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +60 -15
  48. package/templates/codex-skills/retry/SKILL.md +37 -117
  49. package/templates/commands/specrails/batch-implement.md +16 -288
  50. package/templates/commands/specrails/doctor.md +1 -1
  51. package/templates/commands/specrails/implement.md +94 -1260
  52. package/templates/commands/specrails/memory-inspect.md +6 -4
  53. package/templates/commands/specrails/propose-spec.md +1 -1
  54. package/templates/commands/specrails/refactor-recommender.md +8 -51
  55. package/templates/commands/specrails/retry.md +22 -350
  56. package/templates/commands/specrails/telemetry.md +1 -1
  57. package/templates/gemini-commands/batch-implement.toml +28 -40
  58. package/templates/gemini-commands/implement.toml +55 -105
  59. package/templates/gemini-commands/retry.toml +21 -0
  60. package/templates/kimi/specrails/run-skill.mjs +51 -2
  61. package/templates/profiles/default.json +5 -18
  62. package/templates/runtime/provider-pipeline.md +55 -0
  63. package/commands/enrich.md +0 -1456
  64. package/templates/agents/sr-backend-developer.md +0 -91
  65. package/templates/agents/sr-backend-reviewer.md +0 -152
  66. package/templates/agents/sr-doc-sync.md +0 -247
  67. package/templates/agents/sr-frontend-developer.md +0 -85
  68. package/templates/agents/sr-frontend-reviewer.md +0 -145
  69. package/templates/agents/sr-merge-resolver.md +0 -195
  70. package/templates/agents/sr-performance-reviewer.md +0 -186
  71. package/templates/agents/sr-product-analyst.md +0 -36
  72. package/templates/agents/sr-product-manager.md +0 -148
  73. package/templates/agents/sr-security-reviewer.md +0 -191
  74. package/templates/agents/sr-test-writer.md +0 -176
  75. package/templates/codex-skills/enrich/SKILL.md +0 -191
  76. package/templates/codex-skills/merge-resolve/SKILL.md +0 -88
  77. package/templates/codex-skills/rails/sr-backend-developer/SKILL.md +0 -93
  78. package/templates/codex-skills/rails/sr-backend-reviewer/SKILL.md +0 -120
  79. package/templates/codex-skills/rails/sr-doc-sync/SKILL.md +0 -124
  80. package/templates/codex-skills/rails/sr-frontend-developer/SKILL.md +0 -106
  81. package/templates/codex-skills/rails/sr-frontend-reviewer/SKILL.md +0 -111
  82. package/templates/codex-skills/rails/sr-merge-resolver/SKILL.md +0 -156
  83. package/templates/codex-skills/rails/sr-performance-reviewer/SKILL.md +0 -109
  84. package/templates/codex-skills/rails/sr-product-analyst/SKILL.md +0 -85
  85. package/templates/codex-skills/rails/sr-product-manager/SKILL.md +0 -131
  86. package/templates/codex-skills/rails/sr-security-reviewer/SKILL.md +0 -121
  87. package/templates/codex-skills/rails/sr-test-writer/SKILL.md +0 -115
  88. package/templates/commands/specrails/auto-propose-backlog-specs.md +0 -312
  89. package/templates/commands/specrails/enrich.md +0 -1456
  90. package/templates/commands/specrails/get-backlog-specs.md +0 -226
  91. package/templates/commands/specrails/merge-resolve.md +0 -172
  92. package/templates/commands/specrails/reconfig.md +0 -80
  93. package/templates/commands/specrails/vpc-drift.md +0 -405
  94. package/templates/commands/test.md +0 -58
  95. package/templates/personas/persona.md +0 -43
  96. package/templates/personas/the-maintainer.md +0 -98
  97. package/templates/settings/perf-thresholds.yml +0 -25
@@ -1,272 +1,63 @@
1
1
  ---
2
2
  name: batch-implement
3
- description: "Run the implement pipeline over multiple backlog tickets in one session. Per ticket: spawn architect → spawn developer → spawn reviewer (the same three-phase pipeline $implement runs), then move to the next. Sequential by default; parallel only when the user explicitly opts in AND the tickets are independent. Reports an aggregated verdict at the end. Use when the user invokes `$batch-implement #N #M #K` or `$batch-implement --status todo`."
3
+ description: "Implement the frozen batch in one OpenSpec change and journal, with aggregate verification, review and archive gates."
4
4
  license: MIT
5
- compatibility: "Codex-native. Fully headless / non-interactive. Drives architect/developer/reviewer spawns at the ROOT agent level — does NOT spawn a nested $implement sub-agent per ticket (codex's nested-spawn reliability degrades at depth 2, causing sub-agents to skip phases silently). Sub-agents are full-history forks (no agent_type / model / reasoning_effort)."
5
+ compatibility: "Codex-native root-level role delegation. One aggregate change per run; hosted worktrees stay under host ownership."
6
6
  ---
7
7
 
8
- You are the **batch-implement orchestrator**. The user invoked
9
- you to apply the implement pipeline to multiple tickets in one
10
- session.
11
-
12
- **This skill is fully headless / non-interactive.** Every
13
- sub-agent invocation must include `--yes` semantics. There is
14
- no "interactive mode". If you find yourself thinking "the
15
- batch skill is interactive by design, let me run inline
16
- instead", you're misreading.
17
-
18
- ## Why this skill drives the pipeline directly
19
-
20
- An earlier design spawned a `$implement` sub-agent per ticket
21
- that itself spawned architect/developer/reviewer sub-sub-agents.
22
- That worked technically but was **unreliable in practice**:
23
- codex's nested-spawn at depth 2 frequently dropped the reviewer
24
- phase (and sometimes the architect), leaving tickets reported as
25
- "done" with no confidence artefact and stale backlog state.
26
-
27
- This skill therefore runs the **same three-phase pipeline
28
- `$implement` runs**, but it drives the spawns from the root
29
- agent (you) instead of nesting. Per ticket you spawn architect,
30
- developer, and reviewer at depth 1 — three real sub-agents per
31
- ticket, no more nesting. The contract that `$implement` enforces
32
- (every phase MUST be a real spawn) applies here too.
33
-
34
- ## How the user invokes you
35
-
36
- - `$batch-implement #1 #2 #3 --yes` — sequential.
37
- - `$batch-implement --status todo` — every todo ticket, ascending
38
- id order.
39
- - `$batch-implement --status todo --priority high` — combined
40
- filter.
41
- - `$batch-implement #1 #2 --parallel` — opt-in parallel, with a
42
- disjoint-file safety check (see Step 2.b).
43
-
44
- Default execution mode is sequential.
45
-
46
- ## Desktop rail execution context
47
-
48
- When the working directory is a specrails-desktop isolated rail worktree (path contains `/worktrees/`, typically on a `feat/...` branch), you are the ASSIGNED executor of that rail: implement every ticket sequentially in THIS worktree on THIS branch — the desktop assembles it into a batch PR afterwards, nothing needs to land on the integration branch first. The desktop's own bookkeeping (ticket-ownership rows in its `jobs.sqlite`, state under `~/.specrails/`) describes this very launch — never read those internals, and never stop to ask which process should run the batch.
49
-
50
- ## Steps
51
-
52
- ### 0. Bootstrap
53
-
54
- 1. Confirm `pwd` matches `git rev-parse --show-toplevel`.
55
- 2. Parse argv: collect `#N` tokens + filter flags (`--status`,
56
- `--priority`, `--parallel`).
57
- 3. Build the target list:
58
- - Explicit ids → use them in given order.
59
- - Otherwise filter `.specrails/local-tickets.json` by
60
- `--status`/`--priority` and sort numeric id ascending.
61
- 4. If empty target list, reply
62
- `"NO-OP: no tickets match the filter"` and end.
63
- 5. **List installed rails** once:
64
- `ls .codex/skills/rails/`. Cache the set; you'll reuse it
65
- for routing each ticket's developer + reviewer phase.
66
- 6. State (≤4 lines) which tickets you're processing, in what
67
- mode, and the available rails.
68
-
69
- ### 1. Sequential pipeline (default)
70
-
71
- For each ticket id in order, run the three-phase pipeline at
72
- ROOT level (do NOT spawn `$implement` as a sub-agent — drive
73
- the pipeline yourself):
74
-
75
- #### 1.a Architect phase (per ticket)
76
-
77
- - `spawn_agent` (full-history, no agent_type / model /
78
- reasoning_effort).
79
- - `send_message`:
80
-
81
- > `$sr-architect`
82
- >
83
- > Ticket id: `<TICKET_ID>`
84
- > Ticket title: `<TICKET_TITLE>`
85
- >
86
- > Read `jq '.tickets["<TICKET_ID>"]' .specrails/local-tickets.json`
87
- > for the full ticket. Follow the `$sr-architect` skill
88
- > instructions exactly.
89
- >
90
- > In `design.md`'s `## Context` section, include a
91
- > `Scope: <labels>` line drawn from: `frontend`, `backend`,
92
- > `both`, `security-sensitive`, `performance-sensitive`.
93
-
94
- - `wait_agent`. Parse reply for the plan path. `close_agent`.
95
- - Open the plan + design.md, parse the `Scope:` line.
96
- - If the architect returned `BLOCKED: …`, mark this ticket
97
- as failed for the batch report and **continue to the next
98
- ticket** — do not stop the batch.
99
-
100
- #### 1.b Developer phase (per ticket)
101
-
102
- Routing matrix (mirrors `$implement`):
103
-
104
- | scope contains | rails available | spawn |
105
- |---|---|---|
106
- | `frontend` only | `sr-frontend-developer` | $sr-frontend-developer |
107
- | `backend` only | `sr-backend-developer` | $sr-backend-developer |
108
- | `frontend` only | (no fe specialist) | $sr-developer |
109
- | `backend` only | (no be specialist) | $sr-developer |
110
- | `both` + both specialists + tagged tasks.md | — | TWO devs parallel |
111
- | else | — | $sr-developer |
112
-
113
- - `spawn_agent`. `send_message`:
114
-
115
- > `$<developer-skill>`
116
- >
117
- > Ticket id: `<TICKET_ID>`
118
- > Plan: `<PLAN_PATH>`
119
- > Scope: `<comma-separated labels>`
120
- >
121
- > Follow the `$<developer-skill>` skill instructions exactly.
122
-
123
- - `wait_agent`. Capture file list. `close_agent`.
124
- - If `BLOCKED: …` → mark ticket as failed in the batch report
125
- and move to next ticket.
126
-
127
- #### 1.c Reviewer phase (per ticket) — parallel where possible
128
-
129
- Always spawn `$sr-reviewer`. Additionally if installed AND
130
- scope matches:
131
-
132
- | scope flag | additional rail |
133
- |---|---|
134
- | `frontend` | `$sr-frontend-reviewer` |
135
- | `backend` | `$sr-backend-reviewer` |
136
- | `security-sensitive` | `$sr-security-reviewer` |
137
- | `performance-sensitive` | `$sr-performance-reviewer` |
138
-
139
- Spawn ALL reviewers in parallel, then `wait_agent` on each.
140
- `close_agent` each.
141
-
142
- Aggregate verdicts (same matrix as `$implement`):
143
-
144
- - `clean` — every reviewer ≥70, no fix/blocked verdicts.
145
- - `fix needed` — any "fix needed", OR score <70 with no
146
- blocked, OR blocked with score 30-69 (recoverable case).
147
- - `blocked` — blocked with score <30, OR all reviewers blocked.
148
-
149
- #### 1.d Optional fix loop (single pass per ticket)
150
-
151
- If the verdict is `fix needed`, run ONE follow-up developer
152
- pass with the reviewer's issues list, then re-run the
153
- reviewer set. If still `fix needed` or `blocked`, do NOT
154
- loop again — record the failure in the batch report and
155
- continue.
156
-
157
- #### 1.e Close the ticket (per ticket)
158
-
159
- If the final verdict is `clean`:
160
- - Update `.specrails/local-tickets.json` — set
161
- `tickets["<ID>"].status = "done"`, bump `revision`, set
162
- `updated_at` to `date -Iseconds`. Preserve every other
163
- field.
164
-
165
- If the verdict is `fix needed` or `blocked`:
166
- - Leave status as `todo`. Still bump `revision` and set
167
- `updated_at` so the file reflects the run. Record the
168
- blocker in the batch report's Follow-up section.
169
-
170
- **Important**: only YOU (the root orchestrator) ever writes
171
- to `.specrails/local-tickets.json`. None of the sub-agents
172
- (architect, developer, reviewer) should touch it — the rail
173
- skills already enforce that on their side.
174
-
175
- ### 2. Parallel pipeline (opt-in via `--parallel`)
176
-
177
- When the user passed `--parallel`:
178
-
179
- a. **Pre-spawn architect-only pass**. For each ticket, spawn
180
- `$sr-architect` in parallel via `spawn_agents_on_csv`
181
- (cap at 10 concurrent). Wait for each to produce its
182
- `tasks.md` + plan path.
183
- b. **Disjoint-file check**. Collect every file path mentioned
184
- across all `tasks.md` files. If ANY file appears in more
185
- than one ticket's list, abort parallel mode for the
186
- overlapping tickets — process them sequentially after the
187
- non-overlapping batch. State in your reply which tickets
188
- were re-routed and why.
189
- c. For the non-overlapping tickets, run their developer +
190
- reviewer phases (and optional fix-loop) in parallel
191
- per-ticket. Each ticket is still a sequence
192
- internally — only the outer per-ticket processing is
193
- concurrent.
194
-
195
- The safety net exists because two developer pipelines editing
196
- the same file would race. If unsure, fall back to sequential.
197
-
198
- ### 3. Aggregate the batch
199
-
200
- For each ticket, collect:
201
-
202
- - `ticket_id`
203
- - `verdict`: `done` | `todo` | `blocked` | `arch_blocked`
204
- - `score`: overall (or `n/a` if no reviewer ran)
205
- - `plan_path`, `confidence_path` (omit if `n/a`)
206
- - `files_changed`: list (or `n/a`)
207
- - `tests_summary`, `build_summary`
208
- - Any Follow-up bullets
209
-
210
- ### 4. Report
211
-
212
- Print ONE consolidated summary (≤30 lines for typical
213
- batches):
214
-
215
- ```
216
- batch-implement — <N> tickets attempted
217
-
218
- Outcomes:
219
- done: #<id> #<id> ...
220
- todo: #<id> (reason: …) ...
221
- blocked: #<id> (reason: …) ...
222
-
223
- Per-ticket details:
224
- #<id> → <verdict> (score <N>/100)
225
- plan: <path>
226
- confidence: <path>
227
- files: <count> (<one path>, +N more)
228
- tests: <pass/fail summary>
229
-
230
- Aggregate stats:
231
- Files touched: <total unique count>
232
- Tests run: <total>, pass <count>, fail <count>
233
- Build: <count where ran, count ok, count failed>
234
-
235
- Follow-up across batch:
236
- - <bullet> (#<id>)
237
- - ...
238
- ```
239
-
240
- If every ticket ended in `done`, also print:
241
-
242
- ```
243
- ✓ Batch complete: <N>/<N> tickets done.
244
- ```
245
-
246
- If some ended in `todo` or `blocked`, finish with the
247
- re-launch hint:
248
-
249
- ```
250
- Re-run with: $batch-implement #<id> [#<id> ...] --yes
251
- ```
252
-
253
- ## What you must NOT do
254
-
255
- - **Do NOT spawn `$implement` as a sub-agent** to handle a
256
- ticket. Drive the architect/developer/reviewer pipeline
257
- yourself, at depth 1 (root → role-skill). Nested spawning
258
- at depth 2 drops phases silently and produces "done"
259
- tickets with no confidence artefact.
260
- - **Do NOT pass `agent_type`, `model`, or `reasoning_effort`**
261
- to `spawn_agent` on full-history forks.
262
- - **Do NOT proceed in parallel mode** without the
263
- disjoint-file check.
264
- - **Do NOT exceed 10 parallel sub-agents** in one fan-out.
265
- - **Do NOT do speculative work** (sed/find/grep/etc.) while
266
- a sub-agent is running. Wait silently for `wait_agent`.
267
- - **Do NOT touch `.claude/agent-memory/`** — codex projects
268
- use `.specrails/agent-memory/`.
269
- - **Do NOT skip a phase**. Every ticket gets architect →
270
- developer → reviewer (+ fix loop if needed). A ticket
271
- reported as "done" without a confidence artefact is a
272
- contract violation.
8
+ You coordinate one batch run. Explicit #IDs retain their order; filters resolve
9
+ against the shared backlog. Freeze the full ticket descriptions, acceptance criteria
10
+ and repository IDs once. With host context use its complete specs unchanged.
11
+
12
+ Initialize ONE stable aggregate change slug and journal for the batch. Do not
13
+ initialize another change with the same runId or create child per-ticket journals.
14
+ Resolve source via context.repositories, OpenSpec via context.artifactRoot, and
15
+ backlog via context.backlogPath/backlogRoot; cwd can be an external workspace.
16
+
17
+ Read the single implement role instructions, but execute the following aggregate
18
+ pipeline DIRECTLY from this root. Do NOT spawn `$implement` as a sub-agent.
19
+ Each role receives the explicit bounded handoff including ALL frozen specs and
20
+ repository paths, aggregate change slug and already completed task groups.
21
+
22
+ 1. Architect: one `$sr-architect` creates and validates one change covering every
23
+ ticket, grouping tasks by ticket and repository and recording dependency order.
24
+ Record architect running/done via the helper. Require high/medium design
25
+ confidence. Missing or low confidence blocks development; never infer a pass.
26
+ 2. Developer: one `$sr-developer` applies the task groups sequentially, preserving
27
+ preceding groups and all repositories. Persist per-group progress in tasks.md
28
+ before yielding. Scoped checks run per group; the full verification gate runs
29
+ once for the aggregate candidate through the helper. Only then record developer
30
+ done. Incomplete groups block downstream review and remain retriable.
31
+ 3. Reviewer: one `$sr-reviewer` semantically checks every ticket/criterion and
32
+ cross-ticket interaction. Include the full receipt and changed-file inventory.
33
+ Ordinary review does NOT archive. If recoverable findings need changes, invoke
34
+ developer once with the exact findings and re-review. Missing/ambiguous verdicts
35
+ and stale receipts never become done; record blocked/failed with a next action.
36
+ 4. Archive: after semantic reviewer done and canonical confidence thresholds from
37
+ implement pass (including security), run `archive-check`. Only success permits
38
+ `$sr-reviewer` with ARCHIVE_ONLY=true and ARCHIVE_AUTHORIZED=true. Validate the
39
+ archive exists and active change is absent; record archive done. Failure leaves
40
+ EVERY batch ticket open.
41
+ 5. Delivery/CI: follow implement ownership exactly. Host-owned Git records ship/ci
42
+ skipped and returns evidence; Core-owned authorized delivery records each selected
43
+ repository outcome and required CI. Partial delivery keeps the batch incomplete.
44
+ 6. Backlog: only Core-owned backlog may close participating tickets at
45
+ context.backlogPath after required delivery and live-vs-frozen requirements match.
46
+ Preserve unrelated data and revisions. Host-owned backlog stays untouched.
47
+
48
+ Before any role, inspect status.resumePhase; reuse every still-valid phase without
49
+ respawning. Use available worker capabilities and capability-aware cleanup from
50
+ implement; never invent close_agent or native model override support.
51
+
52
+ On a provider turn limit, continue the same role from explicit saved progress;
53
+ never launch a nested coordinator or repeat valid earlier stages. Retry resumes
54
+ this same aggregate change/journal. Two continuations without progress block.
55
+
56
+ `--parallel` is a preference, not permission to create unmanaged worktrees or
57
+ assume ten available agent slots. The aggregate pipeline is sequential by default;
58
+ keep hosted worktrees in the supplied repositories. Do not claim parallel work
59
+ when it did not run. Do not override models on a full-history fork.
60
+
61
+ Report one table with every ticket and actual implemented/reviewed outcome, the
62
+ aggregate verification receipt, archive result and outstanding groups. No ticket
63
+ is done until the whole aggregate close succeeds.