specrails-core 4.6.4 → 4.6.6
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.
- package/commands/enrich.md +109 -214
- package/dist/installer/phases/scaffold.js +152 -153
- package/dist/installer/phases/scaffold.js.map +1 -1
- package/docs/deployment.md +1 -1
- package/package.json +1 -2
- package/schemas/profile.v1.json +1 -9
- package/templates/agents/sr-architect.md +13 -9
- package/templates/agents/sr-developer.md +2 -2
- package/templates/agents/sr-reviewer.md +8 -2
- package/templates/codex-skills/enrich/SKILL.md +3 -3
- package/templates/codex-skills/implement/SKILL.md +75 -8
- package/templates/codex-skills/rails/sr-architect/SKILL.md +33 -7
- package/templates/codex-skills/rails/sr-developer/SKILL.md +6 -3
- package/templates/codex-skills/rails/sr-reviewer/SKILL.md +57 -5
- package/templates/commands/specrails/enrich.md +36 -213
- package/templates/commands/specrails/implement.md +22 -10
- package/templates/commands/specrails/reconfig.md +1 -10
- package/templates/commands/specrails/retry.md +2 -1
- package/templates/skills/rails/sr-architect/SKILL.md +0 -234
- package/templates/skills/rails/sr-developer/SKILL.md +0 -210
- package/templates/skills/rails/sr-merge-resolver/SKILL.md +0 -197
- package/templates/skills/rails/sr-reviewer/SKILL.md +0 -320
- package/templates/skills/sr-auto-propose-backlog-specs/SKILL.md +0 -275
- package/templates/skills/sr-batch-implement/SKILL.md +0 -292
- package/templates/skills/sr-compat-check/SKILL.md +0 -275
- package/templates/skills/sr-get-backlog-specs/SKILL.md +0 -199
- package/templates/skills/sr-implement/SKILL.md +0 -1205
- package/templates/skills/sr-refactor-recommender/SKILL.md +0 -216
- package/templates/skills/sr-why/SKILL.md +0 -106
package/commands/enrich.md
CHANGED
|
@@ -45,7 +45,7 @@ Then stop.
|
|
|
45
45
|
|
|
46
46
|
Parse the YAML and extract:
|
|
47
47
|
- `config.version` — must be `1`; if not, warn and proceed
|
|
48
|
-
- `config.provider` — `claude`
|
|
48
|
+
- `config.provider` — `claude` (this is the Claude enrichment flow); default `claude`
|
|
49
49
|
- `config.tier` — `full` or `quick`; default `full`
|
|
50
50
|
- `config.agents.selected` — list of agent names to install
|
|
51
51
|
- `config.agents.excluded` — list of agent names to skip (for reference only)
|
|
@@ -69,9 +69,7 @@ To resolve the model for any given agent:
|
|
|
69
69
|
|
|
70
70
|
### FC2: Provider Setup
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Set `SPECRAILS_DIR` and `CLI_PROVIDER` from resolved provider.
|
|
72
|
+
This is the Claude enrichment flow. Set `SPECRAILS_DIR = ".claude"`.
|
|
75
73
|
|
|
76
74
|
### FC3: If tier is `quick` — run Quick Mode with config context
|
|
77
75
|
|
|
@@ -144,7 +142,7 @@ Read the following files to understand the current installation state:
|
|
|
144
142
|
|
|
145
143
|
2. Read `.specrails/specrails-version` — contains the current version string (e.g., `0.2.0`). If it does not exist, treat version as `0.1.0 (legacy)`.
|
|
146
144
|
|
|
147
|
-
3.
|
|
145
|
+
3. This is the **Claude** enrichment flow: it operates on `.claude/` (`specrails_dir = ".claude"`). Codex projects use their own codex-native `$enrich` skill, not this command.
|
|
148
146
|
|
|
149
147
|
4. List all template files in `.specrails/setup-templates/agents/` — these are the NEW agent templates from the update:
|
|
150
148
|
```bash
|
|
@@ -161,6 +159,8 @@ Read the following files to understand the current installation state:
|
|
|
161
159
|
|
|
162
160
|
6. Read `.specrails/backlog-config.json` if it exists — contains stored provider configuration needed for command placeholder substitution.
|
|
163
161
|
|
|
162
|
+
7. Read `.specrails/agents.yaml` if it exists — contains agent model configuration. Validate all `model:` values (only `opus`, `sonnet`, `haiku` are valid). Store as `AGENTS_CONFIG` for use in Phase U4. If the file does not exist, set `AGENTS_CONFIG = null`.
|
|
163
|
+
|
|
164
164
|
### Phase U2: Quick Codebase Re-Analysis
|
|
165
165
|
|
|
166
166
|
Perform the same analysis as Phase 1 of the full setup wizard, but silently — do not prompt the user and do not show the findings table. Just execute and store results internally.
|
|
@@ -258,26 +258,25 @@ For each agent in the "changed" list:
|
|
|
258
258
|
- `{{KEY_FILE_PATHS}}` → important file paths detected in Phase U2
|
|
259
259
|
- `{{WARNINGS}}` → read from existing `CLAUDE.md` if present
|
|
260
260
|
- `{{MEMORY_PATH}}` → `$SPECRAILS_DIR/agent-memory/sr-<agent-name>/`
|
|
261
|
-
3.
|
|
262
|
-
- `
|
|
263
|
-
-
|
|
264
|
-
|
|
261
|
+
3. Resolve the agent's model using `AGENTS_CONFIG` (loaded in Phase U1, step 7):
|
|
262
|
+
- Check `AGENTS_CONFIG.agents.<agent-name>.model` (per-agent override)
|
|
263
|
+
- If not present, check `AGENTS_CONFIG.defaults.model` (global default)
|
|
264
|
+
- If `AGENTS_CONFIG` is null, use the model from the template frontmatter
|
|
265
|
+
- Replace the `model:` field in the YAML frontmatter with the resolved value before writing
|
|
266
|
+
4. Write the adapted agent (same rules as Phase 4.1):
|
|
267
|
+
- Write to `.claude/agents/sr-<name>.md` (Markdown with YAML frontmatter)
|
|
268
|
+
5. Show: `✓ Regenerated sr-<name>`
|
|
265
269
|
|
|
266
270
|
After regenerating all changed agents, verify no unresolved placeholders remain:
|
|
267
271
|
```bash
|
|
268
|
-
# Claude Code
|
|
269
272
|
grep -r '{{[A-Z_]*}}' .claude/agents/sr-*.md 2>/dev/null || echo "OK: no broken placeholders"
|
|
270
|
-
# Codex
|
|
271
|
-
grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken placeholders"
|
|
272
273
|
```
|
|
273
274
|
|
|
274
275
|
### Phase U4b: Update Changed Commands
|
|
275
276
|
|
|
276
277
|
For each command in the "changed commands" list from Phase U3:
|
|
277
278
|
|
|
278
|
-
1. Read the NEW template
|
|
279
|
-
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
280
|
-
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
279
|
+
1. Read the NEW template from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
281
280
|
2. Read stored backlog configuration from `.specrails/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
|
|
282
281
|
- `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
|
|
283
282
|
- `BACKLOG_WRITE` → `write_access` field
|
|
@@ -293,19 +292,12 @@ For each command in the "changed commands" list from Phase U3:
|
|
|
293
292
|
- `{{BACKLOG_VIEW_CMD}}` → provider-specific view command from backlog config
|
|
294
293
|
- `{{BACKLOG_PREFLIGHT}}` → provider-specific preflight check from backlog config
|
|
295
294
|
- Any other `{{PLACEHOLDER}}` values → use Phase U2 analysis data
|
|
296
|
-
4. Write the updated file
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- If `cli_provider == "claude"`: `✓ Updated /specrails:<name>`
|
|
301
|
-
- If `cli_provider == "codex"`: `✓ Updated $sr-<name>`
|
|
302
|
-
|
|
303
|
-
After updating all changed commands/skills, verify no unresolved placeholders remain:
|
|
295
|
+
4. Write the updated file to `.claude/commands/specrails/<name>.md`
|
|
296
|
+
5. Show: `✓ Updated /specrails:<name>`
|
|
297
|
+
|
|
298
|
+
After updating all changed commands, verify no unresolved placeholders remain:
|
|
304
299
|
```bash
|
|
305
|
-
# If cli_provider == "claude":
|
|
306
300
|
grep -l '{{[A-Z_]*}}' .claude/commands/specrails/*.md 2>/dev/null || echo "OK: no broken placeholders"
|
|
307
|
-
# If cli_provider == "codex":
|
|
308
|
-
grep -rl '{{[A-Z_]*}}' .agents/skills/sr-*/SKILL.md 2>/dev/null || echo "OK: no broken placeholders"
|
|
309
301
|
```
|
|
310
302
|
If any placeholders remain unresolved, warn the user:
|
|
311
303
|
> "⚠ Some placeholders in `<filename>` could not be resolved automatically. Please review the file and fill them in manually."
|
|
@@ -329,32 +321,22 @@ For each agent in the "new" list:
|
|
|
329
321
|
|
|
330
322
|
For each command in the "new commands" list from Phase U3:
|
|
331
323
|
|
|
332
|
-
1. Read the template
|
|
333
|
-
|
|
334
|
-
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
335
|
-
2. Prompt the user:
|
|
336
|
-
- If `cli_provider == "claude"`: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
|
|
337
|
-
- If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
|
|
324
|
+
1. Read the template from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
325
|
+
2. Prompt the user: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
|
|
338
326
|
3. If the user accepts (or presses Enter):
|
|
339
327
|
- Apply placeholder substitution using the same rules as Phase U4b (backlog config + codebase analysis)
|
|
340
|
-
-
|
|
341
|
-
- If `cli_provider == "codex"`: write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name>`
|
|
328
|
+
- Write to `.claude/commands/specrails/<name>.md` — show `✓ Added /specrails:<name>`
|
|
342
329
|
4. If the user declines:
|
|
343
|
-
-
|
|
344
|
-
- If `cli_provider == "codex"`: show `→ Skipped $sr-<name>`
|
|
330
|
+
- Show `→ Skipped /specrails:<name>`
|
|
345
331
|
|
|
346
332
|
### Phase U6: Update Workflow Commands
|
|
347
333
|
|
|
348
334
|
If any new agents were added in Phase U5:
|
|
349
335
|
|
|
350
|
-
1. Read the implement command/
|
|
351
|
-
- If `cli_provider == "claude"`: `.claude/commands/specrails/implement.md`
|
|
352
|
-
- If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
|
|
336
|
+
1. Read the implement command at `.claude/commands/specrails/implement.md`
|
|
353
337
|
2. Check if the file references agent names in its orchestration steps (look for `sr-architect`, `sr-developer`, `sr-reviewer` etc.)
|
|
354
338
|
3. If newly added agents belong in the implementation pipeline (i.e., they are layer-specific developers such as `sr-frontend-developer` or `sr-backend-developer`), add them to the appropriate step in the implement command — specifically where parallel developer agents are launched
|
|
355
|
-
4. Write the updated file if any changes were made
|
|
356
|
-
- If `cli_provider == "claude"`: `.claude/commands/specrails/implement.md`
|
|
357
|
-
- If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
|
|
339
|
+
4. Write the updated file to `.claude/commands/specrails/implement.md` if any changes were made
|
|
358
340
|
5. Show which commands were updated, or "No command updates needed" if nothing changed
|
|
359
341
|
|
|
360
342
|
This is a lightweight check — only update commands where the sr- agent clearly belongs. Do not restructure the entire command.
|
|
@@ -456,28 +438,17 @@ Store as `QS_IS_EXISTING_CODEBASE=true/false`.
|
|
|
456
438
|
|
|
457
439
|
Before generating files, check if this is a re-run:
|
|
458
440
|
|
|
459
|
-
1. Check if commands
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
```
|
|
464
|
-
- If `cli_provider == "codex"`: check if `.agents/skills/sr-*/SKILL.md` files exist:
|
|
465
|
-
```bash
|
|
466
|
-
ls .agents/skills/sr-*/SKILL.md 2>/dev/null
|
|
467
|
-
```
|
|
441
|
+
1. Check if commands already exist — check if `.claude/commands/specrails/` directory exists with any `.md` files:
|
|
442
|
+
```bash
|
|
443
|
+
ls .claude/commands/specrails/*.md 2>/dev/null
|
|
444
|
+
```
|
|
468
445
|
2. If files are found → this is a **re-run**. Store `QS_IS_RERUN=true`.
|
|
469
446
|
3. If the directory does not exist or is empty → this is a **fresh install**. Store `QS_IS_RERUN=false`.
|
|
470
447
|
|
|
471
|
-
In re-run mode, QS3 executes in **gap-fill mode** for command
|
|
472
|
-
- For each command in the list, check if it already exists
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
- If it exists: skip it and show:
|
|
476
|
-
- Claude: `✓ Already installed: /specrails:<name>`
|
|
477
|
-
- Codex: `✓ Already installed: $sr-<name>`
|
|
478
|
-
- If it does NOT exist: install it and show:
|
|
479
|
-
- Claude: `✓ Added /specrails:<name> (was missing)`
|
|
480
|
-
- Codex: `✓ Added $sr-<name> (was missing)`
|
|
448
|
+
In re-run mode, QS3 executes in **gap-fill mode** for command files:
|
|
449
|
+
- For each command in the list, check if it already exists at `.claude/commands/specrails/<name>.md`
|
|
450
|
+
- If it exists: skip it and show `✓ Already installed: /specrails:<name>`
|
|
451
|
+
- If it does NOT exist: install it and show `✓ Added /specrails:<name> (was missing)`
|
|
481
452
|
- Do NOT prompt the user for confirmation on missing files — install them automatically
|
|
482
453
|
|
|
483
454
|
For CLAUDE.md/AGENTS.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
|
|
@@ -500,9 +471,10 @@ Skip if user says no.
|
|
|
500
471
|
|
|
501
472
|
**2. Agent files**
|
|
502
473
|
|
|
503
|
-
For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from `.specrails/setup-templates/agents/<name>.md` and generate the adapted agent file using the
|
|
504
|
-
-
|
|
505
|
-
|
|
474
|
+
For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from `.specrails/setup-templates/agents/<name>.md` and generate the adapted agent file using the rules from Phase 4.1:
|
|
475
|
+
- Write to `.claude/agents/<name>.md` (Markdown with frontmatter)
|
|
476
|
+
|
|
477
|
+
If `.specrails/agents.yaml` exists, read it and apply model resolution (per-agent override → defaults → template value) before writing each agent file.
|
|
506
478
|
|
|
507
479
|
Fill placeholders with best-effort values from the limited context available:
|
|
508
480
|
- `{{PROJECT_NAME}}` → directory name or README first heading
|
|
@@ -536,22 +508,12 @@ Core commands (always install if missing):
|
|
|
536
508
|
}
|
|
537
509
|
```
|
|
538
510
|
|
|
539
|
-
**If `cli_provider == "claude"`:**
|
|
540
|
-
|
|
541
511
|
If `QS_IS_RERUN=false` (fresh install): for each core command, read the template from `.specrails/setup-templates/commands/specrails/<name>.md`, substitute the backlog placeholders with local values (using the same table as Phase 4.3 "Local Tickets"), stub all persona placeholders with `(Quick Mode — run /specrails:enrich to configure personas)`, then write to `.claude/commands/specrails/<name>.md`.
|
|
542
512
|
|
|
543
513
|
If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.claude/commands/specrails/<name>.md` already exists:
|
|
544
514
|
- If it exists: skip it — show `✓ Already installed: /specrails:<name>`
|
|
545
515
|
- If it does NOT exist: read template, substitute placeholders as above, write to `.claude/commands/specrails/<name>.md` — show `✓ Added /specrails:<name> (was missing)`
|
|
546
516
|
|
|
547
|
-
**If `cli_provider == "codex"`:**
|
|
548
|
-
|
|
549
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the corresponding skill template from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`, substitute the backlog placeholders with local values and stub persona placeholders with `(Quick Mode — run /specrails:enrich to configure personas)`, then write to `.agents/skills/sr-<name>/SKILL.md` (create the directory first).
|
|
550
|
-
|
|
551
|
-
If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.agents/skills/sr-<name>/SKILL.md` already exists:
|
|
552
|
-
- If it exists: skip it — show `✓ Already installed: $sr-<name>`
|
|
553
|
-
- If it does NOT exist: read template, substitute placeholders as above, write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name> (was missing)`
|
|
554
|
-
|
|
555
517
|
**4. Cleanup**
|
|
556
518
|
|
|
557
519
|
Remove `.specrails/setup-templates/` (same as full wizard cleanup in Phase 5).
|
|
@@ -763,6 +725,62 @@ Display each generated persona to the user:
|
|
|
763
725
|
|
|
764
726
|
Wait for confirmation. If the user wants edits, apply them.
|
|
765
727
|
|
|
728
|
+
### 2.5 Initialize agent config
|
|
729
|
+
|
|
730
|
+
Check for `.specrails/agents.yaml`:
|
|
731
|
+
|
|
732
|
+
1. If the file **exists**:
|
|
733
|
+
- Read it
|
|
734
|
+
- Validate all `model:` values — only `opus`, `sonnet`, and `haiku` are valid
|
|
735
|
+
- If any value is invalid, warn the user and fall back to the template default for that agent
|
|
736
|
+
- Store as `AGENTS_CONFIG` for use in Phase 4
|
|
737
|
+
|
|
738
|
+
2. If the file **does not exist**:
|
|
739
|
+
- Generate it with the default model assignments matching the template hard-coded values:
|
|
740
|
+
|
|
741
|
+
```yaml
|
|
742
|
+
# specrails agent configuration
|
|
743
|
+
# Modify model assignments and other agent settings
|
|
744
|
+
# Valid models: opus, sonnet, haiku
|
|
745
|
+
|
|
746
|
+
defaults:
|
|
747
|
+
model: sonnet
|
|
748
|
+
|
|
749
|
+
agents:
|
|
750
|
+
sr-architect:
|
|
751
|
+
model: sonnet
|
|
752
|
+
sr-developer:
|
|
753
|
+
model: sonnet
|
|
754
|
+
sr-reviewer:
|
|
755
|
+
model: sonnet
|
|
756
|
+
sr-product-manager:
|
|
757
|
+
model: opus
|
|
758
|
+
sr-product-analyst:
|
|
759
|
+
model: haiku
|
|
760
|
+
sr-test-writer:
|
|
761
|
+
model: sonnet
|
|
762
|
+
sr-security-reviewer:
|
|
763
|
+
model: sonnet
|
|
764
|
+
sr-backend-developer:
|
|
765
|
+
model: sonnet
|
|
766
|
+
sr-frontend-developer:
|
|
767
|
+
model: sonnet
|
|
768
|
+
sr-backend-reviewer:
|
|
769
|
+
model: sonnet
|
|
770
|
+
sr-frontend-reviewer:
|
|
771
|
+
model: sonnet
|
|
772
|
+
sr-doc-sync:
|
|
773
|
+
model: sonnet
|
|
774
|
+
sr-merge-resolver:
|
|
775
|
+
model: sonnet
|
|
776
|
+
sr-performance-reviewer:
|
|
777
|
+
model: sonnet
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
- Write this file to `.specrails/agents.yaml`
|
|
781
|
+
- Store as `AGENTS_CONFIG` for use in Phase 4
|
|
782
|
+
- Log: "Generated `.specrails/agents.yaml` with default model assignments"
|
|
783
|
+
|
|
766
784
|
---
|
|
767
785
|
|
|
768
786
|
## Phase 3: Configuration
|
|
@@ -964,7 +982,7 @@ How should we interact with JIRA?
|
|
|
964
982
|
|
|
965
983
|
Set `BACKLOG_WRITE=true/false`.
|
|
966
984
|
|
|
967
|
-
<!-- This command is
|
|
985
|
+
<!-- This command is mirrored from commands/enrich.md for staged installs. -->
|
|
968
986
|
|
|
969
987
|
#### Project Label
|
|
970
988
|
|
|
@@ -1090,7 +1108,7 @@ Wait for final confirmation.
|
|
|
1090
1108
|
|
|
1091
1109
|
Read each template from `.specrails/setup-templates/` and generate the final files adapted to this project. Use the codebase analysis from Phase 1, personas from Phase 2, and configuration from Phase 3.
|
|
1092
1110
|
|
|
1093
|
-
**
|
|
1111
|
+
**Output base directory:** All output paths in Phase 4 use `.claude` as the base directory (`specrails_dir = ".claude"`).
|
|
1094
1112
|
|
|
1095
1113
|
### 4.1 Generate agents
|
|
1096
1114
|
|
|
@@ -1098,7 +1116,6 @@ For each selected agent, read the template and generate the adapted version.
|
|
|
1098
1116
|
|
|
1099
1117
|
**Template → Output mapping:**
|
|
1100
1118
|
|
|
1101
|
-
**If `cli_provider == "claude"` (default):**
|
|
1102
1119
|
- `.specrails/setup-templates/agents/sr-architect.md` → `.claude/agents/sr-architect.md`
|
|
1103
1120
|
- `.specrails/setup-templates/agents/sr-developer.md` → `.claude/agents/sr-developer.md`
|
|
1104
1121
|
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.claude/agents/sr-reviewer.md`
|
|
@@ -1109,17 +1126,6 @@ For each selected agent, read the template and generate the adapted version.
|
|
|
1109
1126
|
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.claude/agents/sr-backend-developer.md` (if backend layer)
|
|
1110
1127
|
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.claude/agents/sr-frontend-developer.md` (if frontend layer)
|
|
1111
1128
|
|
|
1112
|
-
**If `cli_provider == "codex"`:**
|
|
1113
|
-
- `.specrails/setup-templates/agents/sr-architect.md` → `.codex/agents/sr-architect.toml`
|
|
1114
|
-
- `.specrails/setup-templates/agents/sr-developer.md` → `.codex/agents/sr-developer.toml`
|
|
1115
|
-
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.codex/agents/sr-reviewer.toml`
|
|
1116
|
-
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.codex/agents/sr-test-writer.toml`
|
|
1117
|
-
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.codex/agents/sr-security-reviewer.toml`
|
|
1118
|
-
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.codex/agents/sr-product-manager.toml`
|
|
1119
|
-
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.codex/agents/sr-product-analyst.toml`
|
|
1120
|
-
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.codex/agents/sr-backend-developer.toml` (if backend layer)
|
|
1121
|
-
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.codex/agents/sr-frontend-developer.toml` (if frontend layer)
|
|
1122
|
-
|
|
1123
1129
|
When generating each agent:
|
|
1124
1130
|
1. Read the template
|
|
1125
1131
|
2. Replace all `{{PLACEHOLDER}}` values with project-specific content:
|
|
@@ -1139,23 +1145,12 @@ When generating each agent:
|
|
|
1139
1145
|
- `{{TECH_EXPERTISE}}` → detected languages, frameworks, and test frameworks from Phase 1
|
|
1140
1146
|
- `{{LAYER_CLAUDE_MD_PATHS}}` → comma-separated paths to per-layer rules files (e.g., `$SPECRAILS_DIR/rules/backend.md`, `$SPECRAILS_DIR/rules/frontend.md`)
|
|
1141
1147
|
- `{{SECURITY_EXEMPTIONS_PATH}}` → `$SPECRAILS_DIR/security-exemptions.yaml`
|
|
1142
|
-
3.
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
- Extract the body content (everything after the closing `---` of the frontmatter)
|
|
1149
|
-
- Map the `model` field: `sonnet` → `codex-mini-latest`, `opus` → `o3`, `haiku` → `codex-mini-latest`
|
|
1150
|
-
- Write a `.toml` file with this structure:
|
|
1151
|
-
```toml
|
|
1152
|
-
name = "<name from frontmatter>"
|
|
1153
|
-
description = "<description from frontmatter, escaped for TOML>"
|
|
1154
|
-
model = "codex-mini-latest"
|
|
1155
|
-
prompt = """
|
|
1156
|
-
<body content after placeholder substitution>
|
|
1157
|
-
"""
|
|
1158
|
-
```
|
|
1148
|
+
3. Resolve the agent's model using `AGENTS_CONFIG` (loaded in Phase 2.5):
|
|
1149
|
+
- Check `AGENTS_CONFIG.agents.<agent-name>.model` (per-agent override)
|
|
1150
|
+
- If not present, check `AGENTS_CONFIG.defaults.model` (global default)
|
|
1151
|
+
- If `AGENTS_CONFIG` was not loaded (e.g., re-run without config), use the model from the template frontmatter (current behavior)
|
|
1152
|
+
- Replace the `model:` field in the YAML frontmatter with the resolved value before writing
|
|
1153
|
+
4. Write the final file as Markdown with YAML frontmatter — the template file as-is (frontmatter preserved).
|
|
1159
1154
|
|
|
1160
1155
|
### 4.2 Generate personas
|
|
1161
1156
|
|
|
@@ -1175,11 +1170,10 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
|
|
|
1175
1170
|
- Use the VPC personas generated in Phase 2
|
|
1176
1171
|
- File naming: kebab-case of persona nickname (e.g., `the-developer.md`, `the-admin.md`)
|
|
1177
1172
|
|
|
1178
|
-
### 4.3 Generate commands
|
|
1173
|
+
### 4.3 Generate commands
|
|
1179
1174
|
|
|
1180
1175
|
For each selected command, read the template and adapt.
|
|
1181
1176
|
|
|
1182
|
-
**If `cli_provider == "claude"` (default):**
|
|
1183
1177
|
- `.specrails/setup-templates/commands/specrails/implement.md` → `.claude/commands/specrails/implement.md`
|
|
1184
1178
|
- `.specrails/setup-templates/commands/specrails/batch-implement.md` → `.claude/commands/specrails/batch-implement.md`
|
|
1185
1179
|
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.claude/commands/specrails/propose-spec.md`
|
|
@@ -1188,31 +1182,9 @@ For each selected command, read the template and adapt.
|
|
|
1188
1182
|
- `.specrails/setup-templates/commands/specrails/compat-check.md` → `.claude/commands/specrails/compat-check.md`
|
|
1189
1183
|
- `.specrails/setup-templates/commands/specrails/refactor-recommender.md` → `.claude/commands/specrails/refactor-recommender.md`
|
|
1190
1184
|
- `.specrails/setup-templates/commands/specrails/why.md` → `.claude/commands/specrails/why.md`
|
|
1185
|
+
- `.specrails/setup-templates/commands/specrails/reconfig.md` → `.claude/commands/specrails/reconfig.md`
|
|
1191
1186
|
|
|
1192
|
-
|
|
1193
|
-
- `.specrails/setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
|
|
1194
|
-
- `.specrails/setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
|
|
1195
|
-
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
|
|
1196
|
-
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.agents/skills/sr-get-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1197
|
-
- `.specrails/setup-templates/commands/specrails/auto-propose-backlog-specs.md` → `.agents/skills/sr-auto-propose-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1198
|
-
- `.specrails/setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
|
|
1199
|
-
- `.specrails/setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
|
|
1200
|
-
- `.specrails/setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
|
|
1201
|
-
|
|
1202
|
-
**Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in `.specrails/setup-templates/skills/` for a command, generate the `SKILL.md` by prepending YAML frontmatter to the command content:
|
|
1203
|
-
```yaml
|
|
1204
|
-
---
|
|
1205
|
-
name: sr-<name>
|
|
1206
|
-
description: "<one-line description from the command's first heading>"
|
|
1207
|
-
license: MIT
|
|
1208
|
-
compatibility: "Requires git."
|
|
1209
|
-
metadata:
|
|
1210
|
-
author: specrails
|
|
1211
|
-
version: "1.0"
|
|
1212
|
-
---
|
|
1213
|
-
```
|
|
1214
|
-
|
|
1215
|
-
For both providers, create the output directory before writing (`mkdir -p` for `.claude/commands/specrails/` or `.agents/skills/sr-<name>/`).
|
|
1187
|
+
Create the output directory before writing (`mkdir -p .claude/commands/specrails/`).
|
|
1216
1188
|
|
|
1217
1189
|
Adapt:
|
|
1218
1190
|
- CI commands to match detected stack
|
|
@@ -1310,16 +1282,10 @@ Each rule file must:
|
|
|
1310
1282
|
|
|
1311
1283
|
### 4.5 Generate root instructions file
|
|
1312
1284
|
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
**If `cli_provider == "codex"`:** If no `AGENTS.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
|
|
1285
|
+
If no `CLAUDE.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
|
|
1316
1286
|
|
|
1317
1287
|
### 4.6 Generate settings
|
|
1318
1288
|
|
|
1319
|
-
Resolve `cli_provider` from the existing install layout (`.codex/` => `codex`, otherwise `claude`).
|
|
1320
|
-
|
|
1321
|
-
**If `cli_provider == "claude"` (default):**
|
|
1322
|
-
|
|
1323
1289
|
Create or merge `.claude/settings.json` with permissions for:
|
|
1324
1290
|
- All detected CI commands
|
|
1325
1291
|
- Git operations
|
|
@@ -1327,29 +1293,6 @@ Create or merge `.claude/settings.json` with permissions for:
|
|
|
1327
1293
|
- GitHub CLI (if available)
|
|
1328
1294
|
- Language-specific tools (python, npm, cargo, go, etc.)
|
|
1329
1295
|
|
|
1330
|
-
**If `cli_provider == "codex"`:**
|
|
1331
|
-
|
|
1332
|
-
1. Read `.specrails/setup-templates/settings/codex-config.toml`. Write it to `.codex/config.toml` as-is (no substitutions needed — the TOML is static).
|
|
1333
|
-
|
|
1334
|
-
2. Read `.specrails/setup-templates/settings/codex-rules.star`. Replace `{{CODEX_SHELL_RULES}}` with Starlark `prefix_rule(...)` lines for each detected tool allowance:
|
|
1335
|
-
|
|
1336
|
-
| Detected tool/command | Starlark rule |
|
|
1337
|
-
|----------------------|---------------|
|
|
1338
|
-
| OpenSpec CLI (`openspec`) | `prefix_rule(pattern=["openspec"], decision="allow")` |
|
|
1339
|
-
| Python (`python`, `pip`) | `prefix_rule(pattern=["python"], decision="allow")`<br>`prefix_rule(pattern=["pip"], decision="allow")` |
|
|
1340
|
-
| npm (`npm`) | `prefix_rule(pattern=["npm"], decision="allow")` |
|
|
1341
|
-
| Cargo (`cargo`) | `prefix_rule(pattern=["cargo"], decision="allow")` |
|
|
1342
|
-
| Go (`go`) | `prefix_rule(pattern=["go"], decision="allow")` |
|
|
1343
|
-
| Any detected CI command | `prefix_rule(pattern=["<cmd>"], decision="allow")` |
|
|
1344
|
-
|
|
1345
|
-
Write the rendered file to `.codex/rules/default.rules`.
|
|
1346
|
-
|
|
1347
|
-
```bash
|
|
1348
|
-
mkdir -p .codex/rules
|
|
1349
|
-
```
|
|
1350
|
-
|
|
1351
|
-
If `cli_provider` cannot be determined (file missing), fall back to `"claude"` behavior.
|
|
1352
|
-
|
|
1353
1296
|
### 4.7 Initialize agent memory
|
|
1354
1297
|
|
|
1355
1298
|
Create memory directories for each installed agent using the provider-aware base directory:
|
|
@@ -1413,25 +1356,16 @@ Apply the user's choice.
|
|
|
1413
1356
|
After cleanup, verify that only the intended files remain:
|
|
1414
1357
|
|
|
1415
1358
|
```bash
|
|
1416
|
-
# These should exist (the actual system)
|
|
1417
|
-
# If cli_provider == "claude":
|
|
1359
|
+
# These should exist (the actual system):
|
|
1418
1360
|
ls .claude/agents/sr-*.md
|
|
1419
1361
|
ls .claude/agents/personas/*.md
|
|
1420
1362
|
ls .claude/commands/specrails/*.md
|
|
1421
1363
|
ls .claude/rules/*.md
|
|
1422
1364
|
ls .claude/agent-memory/
|
|
1423
1365
|
|
|
1424
|
-
# If cli_provider == "codex":
|
|
1425
|
-
ls .codex/agents/sr-*.toml
|
|
1426
|
-
ls .codex/agents/personas/*.md
|
|
1427
|
-
ls .agents/skills/sr-*/SKILL.md
|
|
1428
|
-
ls .codex/rules/*.md
|
|
1429
|
-
ls .codex/agent-memory/
|
|
1430
|
-
|
|
1431
1366
|
# These should NOT exist (scaffolding):
|
|
1432
1367
|
# .specrails/setup-templates/ — GONE
|
|
1433
|
-
#
|
|
1434
|
-
# If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
|
|
1368
|
+
# .claude/commands/enrich.md — GONE
|
|
1435
1369
|
```
|
|
1436
1370
|
|
|
1437
1371
|
If any scaffolding artifact remains, remove it.
|
|
@@ -1446,20 +1380,12 @@ Display the complete installation summary:
|
|
|
1446
1380
|
### Agents Installed
|
|
1447
1381
|
| Agent | File | Model |
|
|
1448
1382
|
|-------|------|-------|
|
|
1449
|
-
[If cli_provider == "claude":]
|
|
1450
1383
|
| sr-architect | .claude/agents/sr-architect.md | Sonnet |
|
|
1451
1384
|
| sr-developer | .claude/agents/sr-developer.md | Sonnet |
|
|
1452
1385
|
| sr-reviewer | .claude/agents/sr-reviewer.md | Sonnet |
|
|
1453
1386
|
| sr-test-writer | .claude/agents/sr-test-writer.md | Sonnet |
|
|
1454
1387
|
| sr-security-reviewer | .claude/agents/sr-security-reviewer.md | Sonnet |
|
|
1455
1388
|
| sr-product-manager | .claude/agents/sr-product-manager.md | Opus |
|
|
1456
|
-
[If cli_provider == "codex":]
|
|
1457
|
-
| sr-architect | .codex/agents/sr-architect.toml | codex-mini-latest |
|
|
1458
|
-
| sr-developer | .codex/agents/sr-developer.toml | codex-mini-latest |
|
|
1459
|
-
| sr-reviewer | .codex/agents/sr-reviewer.toml | codex-mini-latest |
|
|
1460
|
-
| sr-test-writer | .codex/agents/sr-test-writer.toml | codex-mini-latest |
|
|
1461
|
-
| sr-security-reviewer | .codex/agents/sr-security-reviewer.toml | codex-mini-latest |
|
|
1462
|
-
| sr-product-manager | .codex/agents/sr-product-manager.toml | o3 |
|
|
1463
1389
|
|
|
1464
1390
|
### Personas Created
|
|
1465
1391
|
| Persona | File | Source |
|
|
@@ -1469,8 +1395,7 @@ Display the complete installation summary:
|
|
|
1469
1395
|
[For each user-generated persona:]
|
|
1470
1396
|
| "[Name]" — The [Role] | $SPECRAILS_DIR/agents/personas/[name].md | Generated |
|
|
1471
1397
|
|
|
1472
|
-
### Commands
|
|
1473
|
-
[If cli_provider == "claude":]
|
|
1398
|
+
### Commands Installed
|
|
1474
1399
|
| Command | File |
|
|
1475
1400
|
|---------|------|
|
|
1476
1401
|
| /specrails:implement | .claude/commands/specrails/implement.md |
|
|
@@ -1481,19 +1406,8 @@ Display the complete installation summary:
|
|
|
1481
1406
|
| /specrails:compat-check | .claude/commands/specrails/compat-check.md |
|
|
1482
1407
|
| /specrails:refactor-recommender | .claude/commands/specrails/refactor-recommender.md |
|
|
1483
1408
|
| /specrails:why | .claude/commands/specrails/why.md |
|
|
1484
|
-
[If cli_provider == "codex":]
|
|
1485
|
-
| Skill | File |
|
|
1486
|
-
|-------|------|
|
|
1487
|
-
| $sr-implement | .agents/skills/sr-implement/SKILL.md |
|
|
1488
|
-
| $sr-batch-implement | .agents/skills/sr-batch-implement/SKILL.md |
|
|
1489
|
-
| $sr-propose-spec | .agents/skills/sr-propose-spec/SKILL.md |
|
|
1490
|
-
| $sr-get-backlog-specs | .agents/skills/sr-get-backlog-specs/SKILL.md |
|
|
1491
|
-
| $sr-auto-propose-backlog-specs | .agents/skills/sr-auto-propose-backlog-specs/SKILL.md |
|
|
1492
|
-
| $sr-compat-check | .agents/skills/sr-compat-check/SKILL.md |
|
|
1493
|
-
| $sr-refactor-recommender | .agents/skills/sr-refactor-recommender/SKILL.md |
|
|
1494
|
-
| $sr-why | .agents/skills/sr-why/SKILL.md |
|
|
1495
1409
|
|
|
1496
|
-
Note: Only commands
|
|
1410
|
+
Note: Only commands selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
|
|
1497
1411
|
|
|
1498
1412
|
### Rules Created
|
|
1499
1413
|
| Layer | File |
|
|
@@ -1505,33 +1419,20 @@ Note: Only commands/skills selected during setup are shown. Backlog commands are
|
|
|
1505
1419
|
| Artifact | Status |
|
|
1506
1420
|
|----------|--------|
|
|
1507
1421
|
| .specrails/setup-templates/ | Deleted |
|
|
1508
|
-
|
|
1509
|
-
[If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
|
|
1422
|
+
| .claude/commands/enrich.md | Deleted |
|
|
1510
1423
|
| specrails/ | [User's choice] |
|
|
1511
1424
|
|
|
1512
1425
|
### Next Steps
|
|
1513
|
-
[If cli_provider == "claude":]
|
|
1514
1426
|
1. Review the generated files in .claude/
|
|
1515
1427
|
2. Run `/specrails:get-backlog-specs` to see your backlog (if GitHub Issues exist)
|
|
1516
1428
|
3. Run `/specrails:auto-propose-backlog-specs` to generate feature ideas
|
|
1517
1429
|
4. Run `/specrails:implement #issue-number` to implement a feature
|
|
1518
1430
|
5. Commit the .claude/ directory to version control
|
|
1519
|
-
[If cli_provider == "codex":]
|
|
1520
|
-
1. Review the generated files in .codex/ and .agents/skills/
|
|
1521
|
-
2. Run `$sr-get-backlog-specs` to see your backlog (if GitHub Issues exist)
|
|
1522
|
-
3. Run `$sr-auto-propose-backlog-specs` to generate feature ideas
|
|
1523
|
-
4. Run `$sr-implement #issue-number` to implement a feature
|
|
1524
|
-
5. Commit the .codex/ and .agents/ directories to version control
|
|
1525
1431
|
|
|
1526
1432
|
### Quick Start
|
|
1527
|
-
[If cli_provider == "claude":]
|
|
1528
1433
|
- `/specrails:implement "describe a feature"` — implement something right now
|
|
1529
1434
|
- `/specrails:get-backlog-specs` — see prioritized feature ideas
|
|
1530
1435
|
- `/specrails:auto-propose-backlog-specs` — discover new features using VPC
|
|
1531
|
-
[If cli_provider == "codex":]
|
|
1532
|
-
- `$sr-implement "describe a feature"` — implement something right now
|
|
1533
|
-
- `$sr-get-backlog-specs` — see prioritized feature ideas
|
|
1534
|
-
- `$sr-auto-propose-backlog-specs` — discover new features using VPC
|
|
1535
1436
|
```
|
|
1536
1437
|
|
|
1537
1438
|
## First Task Prompt (Full Wizard)
|
|
@@ -1543,10 +1444,7 @@ After displaying the setup complete summary above, detect the project type and o
|
|
|
1543
1444
|
✅ Setup complete.
|
|
1544
1445
|
|
|
1545
1446
|
Try your first spec:
|
|
1546
|
-
[If cli_provider == "claude":]
|
|
1547
1447
|
> /specrails:get-backlog-specs
|
|
1548
|
-
[If cli_provider == "codex":]
|
|
1549
|
-
> $sr-get-backlog-specs
|
|
1550
1448
|
```
|
|
1551
1449
|
|
|
1552
1450
|
**Existing codebase** (one or more of the above files found in root):
|
|
@@ -1554,10 +1452,7 @@ Try your first spec:
|
|
|
1554
1452
|
✅ Setup complete.
|
|
1555
1453
|
|
|
1556
1454
|
Try your first spec:
|
|
1557
|
-
[If cli_provider == "claude":]
|
|
1558
1455
|
> /specrails:refactor-recommender
|
|
1559
|
-
[If cli_provider == "codex":]
|
|
1560
|
-
> $sr-refactor-recommender
|
|
1561
1456
|
```
|
|
1562
1457
|
|
|
1563
1458
|
Then stop.
|