specrails-core 3.5.2 → 3.6.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.
- package/commands/setup.md +76 -76
- package/docs/customization.md +36 -6
- package/docs/installation.md +4 -4
- package/docs/updating.md +4 -4
- package/docs/user-docs/faq.md +1 -1
- package/docs/user-docs/getting-started-codex.md +1 -1
- package/docs/user-docs/installation.md +2 -2
- package/install.sh +20 -20
- package/package.json +1 -1
- package/templates/commands/specrails/reconfig.md +89 -0
- package/templates/commands/specrails/setup.md +151 -79
- package/update.sh +44 -17
|
@@ -26,7 +26,7 @@ When `--update` is passed, execute this streamlined flow instead of the full wiz
|
|
|
26
26
|
|
|
27
27
|
Read the following files to understand the current installation state:
|
|
28
28
|
|
|
29
|
-
1. Read `.specrails-manifest.json` — contains agent template checksums from the last install/update. Structure:
|
|
29
|
+
1. Read `.specrails/specrails-manifest.json` — contains agent template checksums from the last install/update. Structure:
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
32
|
"version": "0.2.0",
|
|
@@ -39,28 +39,30 @@ Read the following files to understand the current installation state:
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
If this file does not exist, inform the user:
|
|
42
|
-
> "No `.specrails-manifest.json` found. This looks like a pre-versioning installation. Run `update.sh` first to initialize the manifest, then re-run `/specrails:setup --update`."
|
|
42
|
+
> "No `.specrails/specrails-manifest.json` found. This looks like a pre-versioning installation. Run `update.sh` first to initialize the manifest, then re-run `/specrails:setup --update`."
|
|
43
43
|
Then stop.
|
|
44
44
|
|
|
45
|
-
2. Read `.specrails-version` — contains the current version string (e.g., `0.2.0`). If it does not exist, treat version as `0.1.0 (legacy)`.
|
|
45
|
+
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)`.
|
|
46
46
|
|
|
47
|
-
3. Determine `$SPECRAILS_DIR` by reading
|
|
47
|
+
3. Determine `$SPECRAILS_DIR` by reading `.specrails/setup-templates/.provider-detection.json`. Extract `cli_provider` and `specrails_dir`. If not found, default to `cli_provider = "claude"`, `specrails_dir = ".claude"`.
|
|
48
48
|
|
|
49
|
-
4. List all template files in
|
|
49
|
+
4. List all template files in `.specrails/setup-templates/agents/` — these are the NEW agent templates from the update:
|
|
50
50
|
```bash
|
|
51
|
-
ls
|
|
51
|
+
ls .specrails/setup-templates/agents/
|
|
52
52
|
```
|
|
53
53
|
Template files are named with `sr-` prefix (e.g., `sr-architect.md`, `sr-developer.md`).
|
|
54
54
|
|
|
55
|
-
5. List all template files in
|
|
55
|
+
5. List all template files in `.specrails/setup-templates/commands/specrails/` — these are the NEW command templates from the update:
|
|
56
56
|
```bash
|
|
57
|
-
ls
|
|
57
|
+
ls .specrails/setup-templates/commands/specrails/
|
|
58
58
|
```
|
|
59
59
|
Command template files include `implement.md`, `batch-implement.md`, `compat-check.md`, `refactor-recommender.md`, `why.md`, `get-backlog-specs.md`, `auto-propose-backlog-specs.md`.
|
|
60
60
|
If this directory does not exist, skip command template checking for this update.
|
|
61
61
|
|
|
62
62
|
6. Read `.specrails/backlog-config.json` if it exists — contains stored provider configuration needed for command placeholder substitution.
|
|
63
63
|
|
|
64
|
+
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`.
|
|
65
|
+
|
|
64
66
|
### Phase U2: Quick Codebase Re-Analysis
|
|
65
67
|
|
|
66
68
|
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.
|
|
@@ -82,28 +84,28 @@ Store all results for use in Phases U4 and U5.
|
|
|
82
84
|
|
|
83
85
|
### Phase U3: Identify What Needs Regeneration
|
|
84
86
|
|
|
85
|
-
**Agent templates:** For each agent template, find its entry in the manifest's `artifacts` map (keyed as `templates/agents/sr-<name>.md`). Compute the SHA-256 checksum of the corresponding file in `.
|
|
87
|
+
**Agent templates:** For each agent template, find its entry in the manifest's `artifacts` map (keyed as `templates/agents/sr-<name>.md`). Compute the SHA-256 checksum of the corresponding file in `.specrails/setup-templates/agents/`:
|
|
86
88
|
|
|
87
89
|
```bash
|
|
88
|
-
sha256sum .
|
|
90
|
+
sha256sum .specrails/setup-templates/agents/sr-<name>.md
|
|
89
91
|
```
|
|
90
92
|
|
|
91
93
|
Build three lists for agents:
|
|
92
94
|
|
|
93
95
|
1. **Changed agents**: agent name exists in manifest AND the current template checksum differs from the manifest checksum → mark for regeneration
|
|
94
|
-
2. **New agents**: template file exists in `.
|
|
96
|
+
2. **New agents**: template file exists in `.specrails/setup-templates/agents/` but the agent name is NOT in the manifest → mark for evaluation
|
|
95
97
|
3. **Unchanged agents**: agent name exists in manifest AND checksum matches → skip
|
|
96
98
|
|
|
97
|
-
**Command templates:** If `.
|
|
99
|
+
**Command templates:** If `.specrails/setup-templates/commands/specrails/` exists, for each command template file, find its entry in the manifest's `artifacts` map (keyed as `templates/commands/specrails/<name>.md`). Compute the SHA-256 checksum of the corresponding file in `.specrails/setup-templates/commands/specrails/`:
|
|
98
100
|
|
|
99
101
|
```bash
|
|
100
|
-
sha256sum .
|
|
102
|
+
sha256sum .specrails/setup-templates/commands/specrails/<name>.md
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
Build three lists for commands:
|
|
104
106
|
|
|
105
107
|
1. **Changed commands**: command name exists in manifest AND the current template checksum differs from the manifest checksum → mark for update
|
|
106
|
-
2. **New commands**: template file exists in `.
|
|
108
|
+
2. **New commands**: template file exists in `.specrails/setup-templates/commands/specrails/` but the command name is NOT in the manifest → mark for evaluation
|
|
107
109
|
3. **Unchanged commands**: command name exists in manifest AND checksum matches → skip
|
|
108
110
|
|
|
109
111
|
Display the combined analysis to the user:
|
|
@@ -144,7 +146,7 @@ Then jump to Phase U7.
|
|
|
144
146
|
|
|
145
147
|
For each agent in the "changed" list:
|
|
146
148
|
|
|
147
|
-
1. Read the NEW template from
|
|
149
|
+
1. Read the NEW template from `.specrails/setup-templates/agents/sr-<name>.md`
|
|
148
150
|
2. Use the codebase analysis from Phase U2 to fill in all `{{PLACEHOLDER}}` values, using the same substitution rules as Phase 4.1 of the full setup:
|
|
149
151
|
- `{{PROJECT_NAME}}` → project name (from README.md or directory name)
|
|
150
152
|
- `{{ARCHITECTURE_DIAGRAM}}` → detected architecture layers
|
|
@@ -158,10 +160,15 @@ For each agent in the "changed" list:
|
|
|
158
160
|
- `{{KEY_FILE_PATHS}}` → important file paths detected in Phase U2
|
|
159
161
|
- `{{WARNINGS}}` → read from existing `CLAUDE.md` if present
|
|
160
162
|
- `{{MEMORY_PATH}}` → `$SPECRAILS_DIR/agent-memory/sr-<agent-name>/`
|
|
161
|
-
3.
|
|
163
|
+
3. Resolve the agent's model using `AGENTS_CONFIG` (loaded in Phase U1, step 7):
|
|
164
|
+
- Check `AGENTS_CONFIG.agents.<agent-name>.model` (per-agent override)
|
|
165
|
+
- If not present, check `AGENTS_CONFIG.defaults.model` (global default)
|
|
166
|
+
- If `AGENTS_CONFIG` is null, use the model from the template frontmatter
|
|
167
|
+
- Replace the `model:` field in the YAML frontmatter with the resolved value before writing
|
|
168
|
+
4. Write the adapted agent using the format for the active provider (same dual-format rules as Phase 4.1):
|
|
162
169
|
- `cli_provider == "claude"`: write to `$SPECRAILS_DIR/agents/sr-<name>.md` (Markdown with YAML frontmatter)
|
|
163
170
|
- `cli_provider == "codex"`: write to `$SPECRAILS_DIR/agents/sr-<name>.toml` (TOML format with `name`, `description`, `model`, `prompt` fields)
|
|
164
|
-
|
|
171
|
+
5. Show: `✓ Regenerated sr-<name>`
|
|
165
172
|
|
|
166
173
|
After regenerating all changed agents, verify no unresolved placeholders remain:
|
|
167
174
|
```bash
|
|
@@ -176,8 +183,8 @@ grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken
|
|
|
176
183
|
For each command in the "changed commands" list from Phase U3:
|
|
177
184
|
|
|
178
185
|
1. Read the NEW template:
|
|
179
|
-
- If `cli_provider == "claude"`: from
|
|
180
|
-
- If `cli_provider == "codex"`: from
|
|
186
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
187
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
181
188
|
2. Read stored backlog configuration from `.specrails/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
|
|
182
189
|
- `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
|
|
183
190
|
- `BACKLOG_WRITE` → `write_access` field
|
|
@@ -214,7 +221,7 @@ If any placeholders remain unresolved, warn the user:
|
|
|
214
221
|
|
|
215
222
|
For each agent in the "new" list:
|
|
216
223
|
|
|
217
|
-
1. Read the template from `.
|
|
224
|
+
1. Read the template from `.specrails/setup-templates/agents/sr-<name>.md` to understand what stack or layer it targets (read its description and any layer-specific comments)
|
|
218
225
|
2. Match against the codebase detected in Phase U2:
|
|
219
226
|
- If the template targets a layer/stack that IS present (e.g., `sr-frontend-developer` and React was detected), prompt:
|
|
220
227
|
> "New agent available: `sr-<name>` — your project uses [detected tech]. Add it? [Y/n]"
|
|
@@ -230,8 +237,8 @@ For each agent in the "new" list:
|
|
|
230
237
|
For each command in the "new commands" list from Phase U3:
|
|
231
238
|
|
|
232
239
|
1. Read the template:
|
|
233
|
-
- If `cli_provider == "claude"`: from
|
|
234
|
-
- If `cli_provider == "codex"`: from
|
|
240
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
241
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
235
242
|
2. Prompt the user:
|
|
236
243
|
- If `cli_provider == "claude"`: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
|
|
237
244
|
- If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
|
|
@@ -298,12 +305,12 @@ All agents and commands are now up to date.
|
|
|
298
305
|
[list command names, or "(none)"]
|
|
299
306
|
```
|
|
300
307
|
|
|
301
|
-
Update `.specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
308
|
+
Update `.specrails/specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
302
309
|
- For each regenerated agent: update its checksum entry to the new template's checksum (keyed as `templates/agents/sr-<name>.md`)
|
|
303
310
|
- For each added agent: add a new entry with its checksum
|
|
304
311
|
- For each updated command: update its checksum entry to the new template's checksum (keyed as `templates/commands/specrails/<name>.md`)
|
|
305
312
|
- For each added command: add a new entry with its checksum
|
|
306
|
-
- Update the `version` field to the version read from `.specrails-version`
|
|
313
|
+
- Update the `version` field to the version read from `.specrails/specrails-version`
|
|
307
314
|
|
|
308
315
|
---
|
|
309
316
|
|
|
@@ -382,7 +389,7 @@ Generate files using the Lite Mode defaults.
|
|
|
382
389
|
|
|
383
390
|
**1. CLAUDE.md**
|
|
384
391
|
|
|
385
|
-
Read
|
|
392
|
+
Read `.specrails/setup-templates/claude-md/CLAUDE-quickstart.md` (or fall back to `.specrails/setup-templates/claude-md/default.md` if quickstart template is not found).
|
|
386
393
|
|
|
387
394
|
Replace placeholders:
|
|
388
395
|
- `{{PROJECT_NAME}}` → derive from directory name or README.md first heading
|
|
@@ -396,10 +403,12 @@ Skip if user says no.
|
|
|
396
403
|
|
|
397
404
|
**2. Agent files**
|
|
398
405
|
|
|
399
|
-
For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from
|
|
406
|
+
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 dual-format rules from Phase 4.1:
|
|
400
407
|
- `cli_provider == "claude"`: write to `.claude/agents/<name>.md` (Markdown with frontmatter)
|
|
401
408
|
- `cli_provider == "codex"`: write to `.codex/agents/<name>.toml` (TOML format)
|
|
402
409
|
|
|
410
|
+
If `.specrails/agents.yaml` exists, read it and apply model resolution (per-agent override → defaults → template value) before writing each agent file.
|
|
411
|
+
|
|
403
412
|
Fill placeholders with best-effort values from the limited context available:
|
|
404
413
|
- `{{PROJECT_NAME}}` → directory name or README first heading
|
|
405
414
|
- `{{PROJECT_DESCRIPTION}}` → `QS_PROJECT_DESCRIPTION`
|
|
@@ -436,7 +445,7 @@ Core commands (always install if missing):
|
|
|
436
445
|
|
|
437
446
|
**If `cli_provider == "claude"`:**
|
|
438
447
|
|
|
439
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the template from
|
|
448
|
+
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 `(Lite Mode — run /specrails:setup to configure personas)`, then write to `.claude/commands/specrails/<name>.md`.
|
|
440
449
|
|
|
441
450
|
If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.claude/commands/specrails/<name>.md` already exists:
|
|
442
451
|
- If it exists: skip it — show `✓ Already installed: /specrails:<name>`
|
|
@@ -444,7 +453,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
444
453
|
|
|
445
454
|
**If `cli_provider == "codex"`:**
|
|
446
455
|
|
|
447
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the corresponding skill template from
|
|
456
|
+
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 `(Lite Mode — run /specrails:setup to configure personas)`, then write to `.agents/skills/sr-<name>/SKILL.md` (create the directory first).
|
|
448
457
|
|
|
449
458
|
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:
|
|
450
459
|
- If it exists: skip it — show `✓ Already installed: $sr-<name>`
|
|
@@ -452,7 +461,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
452
461
|
|
|
453
462
|
**4. Cleanup**
|
|
454
463
|
|
|
455
|
-
Remove
|
|
464
|
+
Remove `.specrails/setup-templates/` (same as full wizard cleanup in Phase 5).
|
|
456
465
|
|
|
457
466
|
Remove `commands/setup.md` from `.claude/commands/` if it was copied there by the installer.
|
|
458
467
|
|
|
@@ -560,7 +569,7 @@ Display the detected architecture to the user:
|
|
|
560
569
|
|
|
561
570
|
### OSS Project Detection
|
|
562
571
|
|
|
563
|
-
Read `.
|
|
572
|
+
Read `.specrails/setup-templates/.oss-detection.json` if it exists.
|
|
564
573
|
|
|
565
574
|
| Signal | Status |
|
|
566
575
|
|--------|--------|
|
|
@@ -629,7 +638,7 @@ Search queries to use (adapt to the domain):
|
|
|
629
638
|
|
|
630
639
|
### 2.3 Generate VPC personas
|
|
631
640
|
|
|
632
|
-
For each user type, generate a full Value Proposition Canvas persona file following the template at `.
|
|
641
|
+
For each user type, generate a full Value Proposition Canvas persona file following the template at `.specrails/setup-templates/personas/persona.md`.
|
|
633
642
|
|
|
634
643
|
Each persona must include:
|
|
635
644
|
- **Profile**: Demographics, behaviors, tools used, spending patterns
|
|
@@ -661,6 +670,62 @@ Display each generated persona to the user:
|
|
|
661
670
|
|
|
662
671
|
Wait for confirmation. If the user wants edits, apply them.
|
|
663
672
|
|
|
673
|
+
### 2.5 Initialize agent config
|
|
674
|
+
|
|
675
|
+
Check for `.specrails/agents.yaml`:
|
|
676
|
+
|
|
677
|
+
1. If the file **exists**:
|
|
678
|
+
- Read it
|
|
679
|
+
- Validate all `model:` values — only `opus`, `sonnet`, and `haiku` are valid
|
|
680
|
+
- If any value is invalid, warn the user and fall back to the template default for that agent
|
|
681
|
+
- Store as `AGENTS_CONFIG` for use in Phase 4
|
|
682
|
+
|
|
683
|
+
2. If the file **does not exist**:
|
|
684
|
+
- Generate it with the default model assignments matching the template hard-coded values:
|
|
685
|
+
|
|
686
|
+
```yaml
|
|
687
|
+
# specrails agent configuration
|
|
688
|
+
# Modify model assignments and other agent settings
|
|
689
|
+
# Valid models: opus, sonnet, haiku
|
|
690
|
+
|
|
691
|
+
defaults:
|
|
692
|
+
model: sonnet
|
|
693
|
+
|
|
694
|
+
agents:
|
|
695
|
+
sr-architect:
|
|
696
|
+
model: sonnet
|
|
697
|
+
sr-developer:
|
|
698
|
+
model: sonnet
|
|
699
|
+
sr-reviewer:
|
|
700
|
+
model: sonnet
|
|
701
|
+
sr-product-manager:
|
|
702
|
+
model: opus
|
|
703
|
+
sr-product-analyst:
|
|
704
|
+
model: haiku
|
|
705
|
+
sr-test-writer:
|
|
706
|
+
model: sonnet
|
|
707
|
+
sr-security-reviewer:
|
|
708
|
+
model: sonnet
|
|
709
|
+
sr-backend-developer:
|
|
710
|
+
model: sonnet
|
|
711
|
+
sr-frontend-developer:
|
|
712
|
+
model: sonnet
|
|
713
|
+
sr-backend-reviewer:
|
|
714
|
+
model: sonnet
|
|
715
|
+
sr-frontend-reviewer:
|
|
716
|
+
model: sonnet
|
|
717
|
+
sr-doc-sync:
|
|
718
|
+
model: sonnet
|
|
719
|
+
sr-merge-resolver:
|
|
720
|
+
model: sonnet
|
|
721
|
+
sr-performance-reviewer:
|
|
722
|
+
model: sonnet
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
- Write this file to `.specrails/agents.yaml`
|
|
726
|
+
- Store as `AGENTS_CONFIG` for use in Phase 4
|
|
727
|
+
- Log: "Generated `.specrails/agents.yaml` with default model assignments"
|
|
728
|
+
|
|
664
729
|
---
|
|
665
730
|
|
|
666
731
|
## Phase 3: Configuration
|
|
@@ -986,9 +1051,9 @@ Wait for final confirmation.
|
|
|
986
1051
|
|
|
987
1052
|
## Phase 4: Generate Files
|
|
988
1053
|
|
|
989
|
-
Read each template from `.
|
|
1054
|
+
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.
|
|
990
1055
|
|
|
991
|
-
**Provider detection (required before any file generation):** Read
|
|
1056
|
+
**Provider detection (required before any file generation):** Read `.specrails/setup-templates/.provider-detection.json` to determine `cli_provider` (`"claude"` or `"codex"`) and `specrails_dir` (`.claude` or `.codex`). All output paths in Phase 4 use `$SPECRAILS_DIR` as the base directory. If the file is missing, fall back to `cli_provider = "claude"` and `specrails_dir = ".claude"`.
|
|
992
1057
|
|
|
993
1058
|
### 4.1 Generate agents
|
|
994
1059
|
|
|
@@ -997,26 +1062,26 @@ For each selected agent, read the template and generate the adapted version.
|
|
|
997
1062
|
**Template → Output mapping:**
|
|
998
1063
|
|
|
999
1064
|
**If `cli_provider == "claude"` (default):**
|
|
1000
|
-
-
|
|
1001
|
-
-
|
|
1002
|
-
-
|
|
1003
|
-
-
|
|
1004
|
-
-
|
|
1005
|
-
-
|
|
1006
|
-
-
|
|
1007
|
-
-
|
|
1008
|
-
-
|
|
1065
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.claude/agents/sr-architect.md`
|
|
1066
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.claude/agents/sr-developer.md`
|
|
1067
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.claude/agents/sr-reviewer.md`
|
|
1068
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.claude/agents/sr-test-writer.md`
|
|
1069
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.claude/agents/sr-security-reviewer.md`
|
|
1070
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.claude/agents/sr-product-manager.md`
|
|
1071
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.claude/agents/sr-product-analyst.md`
|
|
1072
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.claude/agents/sr-backend-developer.md` (if backend layer)
|
|
1073
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.claude/agents/sr-frontend-developer.md` (if frontend layer)
|
|
1009
1074
|
|
|
1010
1075
|
**If `cli_provider == "codex"`:**
|
|
1011
|
-
-
|
|
1012
|
-
-
|
|
1013
|
-
-
|
|
1014
|
-
-
|
|
1015
|
-
-
|
|
1016
|
-
-
|
|
1017
|
-
-
|
|
1018
|
-
-
|
|
1019
|
-
-
|
|
1076
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.codex/agents/sr-architect.toml`
|
|
1077
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.codex/agents/sr-developer.toml`
|
|
1078
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.codex/agents/sr-reviewer.toml`
|
|
1079
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.codex/agents/sr-test-writer.toml`
|
|
1080
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.codex/agents/sr-security-reviewer.toml`
|
|
1081
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.codex/agents/sr-product-manager.toml`
|
|
1082
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.codex/agents/sr-product-analyst.toml`
|
|
1083
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.codex/agents/sr-backend-developer.toml` (if backend layer)
|
|
1084
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.codex/agents/sr-frontend-developer.toml` (if frontend layer)
|
|
1020
1085
|
|
|
1021
1086
|
When generating each agent:
|
|
1022
1087
|
1. Read the template
|
|
@@ -1037,7 +1102,12 @@ When generating each agent:
|
|
|
1037
1102
|
- `{{TECH_EXPERTISE}}` → detected languages, frameworks, and test frameworks from Phase 1
|
|
1038
1103
|
- `{{LAYER_CLAUDE_MD_PATHS}}` → comma-separated paths to per-layer rules files (e.g., `$SPECRAILS_DIR/rules/backend.md`, `$SPECRAILS_DIR/rules/frontend.md`)
|
|
1039
1104
|
- `{{SECURITY_EXEMPTIONS_PATH}}` → `$SPECRAILS_DIR/security-exemptions.yaml`
|
|
1040
|
-
3.
|
|
1105
|
+
3. Resolve the agent's model using `AGENTS_CONFIG` (loaded in Phase 2.5):
|
|
1106
|
+
- Check `AGENTS_CONFIG.agents.<agent-name>.model` (per-agent override)
|
|
1107
|
+
- If not present, check `AGENTS_CONFIG.defaults.model` (global default)
|
|
1108
|
+
- If `AGENTS_CONFIG` was not loaded (e.g., re-run without config), use the model from the template frontmatter (current behavior)
|
|
1109
|
+
- Replace the `model:` field in the YAML frontmatter with the resolved value before writing
|
|
1110
|
+
4. Write the final file in the format for the active provider:
|
|
1041
1111
|
|
|
1042
1112
|
**If `cli_provider == "claude"`:** Write as Markdown with YAML frontmatter — the template file as-is (frontmatter preserved).
|
|
1043
1113
|
|
|
@@ -1058,7 +1128,7 @@ When generating each agent:
|
|
|
1058
1128
|
### 4.2 Generate personas
|
|
1059
1129
|
|
|
1060
1130
|
If IS_OSS=true:
|
|
1061
|
-
1. Copy
|
|
1131
|
+
1. Copy `.specrails/setup-templates/personas/the-maintainer.md` to `$SPECRAILS_DIR/agents/personas/the-maintainer.md`
|
|
1062
1132
|
2. Log: "Maintainer persona included"
|
|
1063
1133
|
3. Set MAINTAINER_INCLUDED=true for use in template substitution
|
|
1064
1134
|
4. Set `{{MAINTAINER_PERSONA_LINE}}` = `- \`$SPECRAILS_DIR/agents/personas/the-maintainer.md\` — "Kai" the Maintainer (open-source maintainer)`
|
|
@@ -1078,26 +1148,28 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
|
|
|
1078
1148
|
For each selected command, read the template and adapt.
|
|
1079
1149
|
|
|
1080
1150
|
**If `cli_provider == "claude"` (default):**
|
|
1081
|
-
-
|
|
1082
|
-
-
|
|
1083
|
-
-
|
|
1084
|
-
-
|
|
1085
|
-
-
|
|
1086
|
-
-
|
|
1087
|
-
-
|
|
1088
|
-
-
|
|
1151
|
+
- `.specrails/setup-templates/commands/specrails/implement.md` → `.claude/commands/specrails/implement.md`
|
|
1152
|
+
- `.specrails/setup-templates/commands/specrails/batch-implement.md` → `.claude/commands/specrails/batch-implement.md`
|
|
1153
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.claude/commands/specrails/propose-spec.md`
|
|
1154
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.claude/commands/specrails/get-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1155
|
+
- `.specrails/setup-templates/commands/specrails/auto-propose-backlog-specs.md` → `.claude/commands/specrails/auto-propose-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1156
|
+
- `.specrails/setup-templates/commands/specrails/compat-check.md` → `.claude/commands/specrails/compat-check.md`
|
|
1157
|
+
- `.specrails/setup-templates/commands/specrails/refactor-recommender.md` → `.claude/commands/specrails/refactor-recommender.md`
|
|
1158
|
+
- `.specrails/setup-templates/commands/specrails/why.md` → `.claude/commands/specrails/why.md`
|
|
1159
|
+
- `.specrails/setup-templates/commands/specrails/reconfig.md` → `.claude/commands/specrails/reconfig.md`
|
|
1089
1160
|
|
|
1090
1161
|
**If `cli_provider == "codex"`:**
|
|
1091
|
-
-
|
|
1092
|
-
-
|
|
1093
|
-
-
|
|
1094
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
-
|
|
1098
|
-
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1162
|
+
- `.specrails/setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
|
|
1163
|
+
- `.specrails/setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
|
|
1164
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
|
|
1165
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.agents/skills/sr-get-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1166
|
+
- `.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)
|
|
1167
|
+
- `.specrails/setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
|
|
1168
|
+
- `.specrails/setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
|
|
1169
|
+
- `.specrails/setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
|
|
1170
|
+
- `.specrails/setup-templates/commands/specrails/reconfig.md` → `.agents/skills/sr-reconfig/SKILL.md` (wrap with YAML frontmatter)
|
|
1171
|
+
|
|
1172
|
+
**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:
|
|
1101
1173
|
```yaml
|
|
1102
1174
|
---
|
|
1103
1175
|
name: sr-<name>
|
|
@@ -1199,7 +1271,7 @@ The command templates use `{{BACKLOG_FETCH_CMD}}`, `{{BACKLOG_CREATE_CMD}}`, `{{
|
|
|
1199
1271
|
### 4.4 Generate rules
|
|
1200
1272
|
|
|
1201
1273
|
For each detected layer, read the layer rule template and generate a layer-specific rules file:
|
|
1202
|
-
-
|
|
1274
|
+
- `.specrails/setup-templates/rules/layer.md` → `$SPECRAILS_DIR/rules/{layer-name}.md`
|
|
1203
1275
|
|
|
1204
1276
|
Each rule file must:
|
|
1205
1277
|
- Have the correct `paths:` frontmatter matching the layer's directory
|
|
@@ -1214,7 +1286,7 @@ Each rule file must:
|
|
|
1214
1286
|
|
|
1215
1287
|
### 4.6 Generate settings
|
|
1216
1288
|
|
|
1217
|
-
Read `.
|
|
1289
|
+
Read `.specrails/setup-templates/.provider-detection.json` (written by `install.sh`) to determine `cli_provider` (`"claude"` or `"codex"`).
|
|
1218
1290
|
|
|
1219
1291
|
**If `cli_provider == "claude"` (default):**
|
|
1220
1292
|
|
|
@@ -1227,9 +1299,9 @@ Create or merge `.claude/settings.json` with permissions for:
|
|
|
1227
1299
|
|
|
1228
1300
|
**If `cli_provider == "codex"`:**
|
|
1229
1301
|
|
|
1230
|
-
1. Read
|
|
1302
|
+
1. Read `.specrails/setup-templates/settings/codex-config.toml`. Write it to `.codex/config.toml` as-is (no substitutions needed — the TOML is static).
|
|
1231
1303
|
|
|
1232
|
-
2. Read
|
|
1304
|
+
2. Read `.specrails/setup-templates/settings/codex-rules.star`. Replace `{{CODEX_SHELL_RULES}}` with Starlark `prefix_rule(...)` lines for each detected tool allowance:
|
|
1233
1305
|
|
|
1234
1306
|
| Detected tool/command | Starlark rule |
|
|
1235
1307
|
|----------------------|---------------|
|
|
@@ -1268,7 +1340,7 @@ The setup process installed temporary files that are only needed during installa
|
|
|
1268
1340
|
|
|
1269
1341
|
```bash
|
|
1270
1342
|
# 1. Remove setup templates (used as structural references during generation)
|
|
1271
|
-
rm -rf .
|
|
1343
|
+
rm -rf .specrails/setup-templates/
|
|
1272
1344
|
|
|
1273
1345
|
# 2. Remove the /specrails:setup command itself — it's a one-time installer, not a permanent command
|
|
1274
1346
|
rm -f .claude/commands/setup.md
|
|
@@ -1281,7 +1353,7 @@ rm -f .claude/commands/setup.md
|
|
|
1281
1353
|
**What gets removed:**
|
|
1282
1354
|
| Artifact | Why |
|
|
1283
1355
|
|----------|-----|
|
|
1284
|
-
| `.
|
|
1356
|
+
| `.specrails/setup-templates/` | Temporary — templates already rendered into final files |
|
|
1285
1357
|
| `.claude/commands/setup.md` | One-time installer — running it again would overwrite customized agents |
|
|
1286
1358
|
|
|
1287
1359
|
**What to do with `specrails/`:**
|
|
@@ -1327,7 +1399,7 @@ ls .codex/rules/*.md
|
|
|
1327
1399
|
ls .codex/agent-memory/
|
|
1328
1400
|
|
|
1329
1401
|
# These should NOT exist (scaffolding):
|
|
1330
|
-
#
|
|
1402
|
+
# .specrails/setup-templates/ — GONE
|
|
1331
1403
|
# If cli_provider == "claude": $SPECRAILS_DIR/commands/setup.md — GONE
|
|
1332
1404
|
# If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
|
|
1333
1405
|
```
|
|
@@ -1402,7 +1474,7 @@ Note: Only commands/skills selected during setup are shown. Backlog commands are
|
|
|
1402
1474
|
### Scaffolding Removed
|
|
1403
1475
|
| Artifact | Status |
|
|
1404
1476
|
|----------|--------|
|
|
1405
|
-
|
|
|
1477
|
+
| .specrails/setup-templates/ | Deleted |
|
|
1406
1478
|
[If cli_provider == "claude":] | .claude/commands/setup.md | Deleted |
|
|
1407
1479
|
[If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
|
|
1408
1480
|
| specrails/ | [User's choice] |
|
package/update.sh
CHANGED
|
@@ -149,7 +149,7 @@ generate_manifest() {
|
|
|
149
149
|
updated_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
150
150
|
|
|
151
151
|
# Write version file
|
|
152
|
-
printf '%s\n' "$version" > "$REPO_ROOT/.specrails-version"
|
|
152
|
+
printf '%s\n' "$version" > "$REPO_ROOT/.specrails/specrails-version"
|
|
153
153
|
|
|
154
154
|
# Build artifact checksums for all files under templates/
|
|
155
155
|
local artifacts_json=""
|
|
@@ -201,7 +201,7 @@ generate_manifest() {
|
|
|
201
201
|
done < <(find "$SCRIPT_DIR/.claude/skills" -type f -print0 | sort -z)
|
|
202
202
|
fi
|
|
203
203
|
|
|
204
|
-
cat > "$REPO_ROOT/.specrails-manifest.json" << EOF
|
|
204
|
+
cat > "$REPO_ROOT/.specrails/specrails-manifest.json" << EOF
|
|
205
205
|
{
|
|
206
206
|
"version": "${version}",
|
|
207
207
|
"installed_at": "${updated_at}",
|
|
@@ -223,9 +223,33 @@ if [[ -z "$REPO_ROOT" ]]; then
|
|
|
223
223
|
exit 1
|
|
224
224
|
fi
|
|
225
225
|
|
|
226
|
-
VERSION_FILE="$REPO_ROOT/.specrails-version"
|
|
226
|
+
VERSION_FILE="$REPO_ROOT/.specrails/specrails-version"
|
|
227
227
|
AGENTS_DIR="$REPO_ROOT/.claude/agents"
|
|
228
228
|
|
|
229
|
+
# Migrate old root-level metadata files to .specrails/ (path change introduced in v3.6.0)
|
|
230
|
+
if [[ ! -f "$VERSION_FILE" ]] && [[ -f "$REPO_ROOT/.specrails-version" ]]; then
|
|
231
|
+
mkdir -p "$REPO_ROOT/.specrails"
|
|
232
|
+
mv "$REPO_ROOT/.specrails-version" "$REPO_ROOT/.specrails/specrails-version"
|
|
233
|
+
ok "Migrated .specrails-version → .specrails/specrails-version"
|
|
234
|
+
fi
|
|
235
|
+
if [[ -f "$REPO_ROOT/.specrails-manifest.json" ]]; then
|
|
236
|
+
mkdir -p "$REPO_ROOT/.specrails"
|
|
237
|
+
mv "$REPO_ROOT/.specrails-manifest.json" "$REPO_ROOT/.specrails/specrails-manifest.json"
|
|
238
|
+
ok "Migrated .specrails-manifest.json → .specrails/specrails-manifest.json"
|
|
239
|
+
fi
|
|
240
|
+
# Migrate old provider-specific setup-templates to .specrails/setup-templates/
|
|
241
|
+
_MIGRATED_SETUP_TEMPLATES=false
|
|
242
|
+
for _old_templates in "$REPO_ROOT/.claude/setup-templates" "$REPO_ROOT/.codex/setup-templates"; do
|
|
243
|
+
if [[ -d "$_old_templates" ]]; then
|
|
244
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates"
|
|
245
|
+
cp -r "$_old_templates/." "$REPO_ROOT/.specrails/setup-templates/"
|
|
246
|
+
rm -rf "$_old_templates"
|
|
247
|
+
ok "Migrated ${_old_templates#"$REPO_ROOT/"} → .specrails/setup-templates/"
|
|
248
|
+
_MIGRATED_SETUP_TEMPLATES=true
|
|
249
|
+
fi
|
|
250
|
+
done
|
|
251
|
+
unset _old_templates
|
|
252
|
+
|
|
229
253
|
# Detect installation state
|
|
230
254
|
INSTALLED_VERSION=""
|
|
231
255
|
IS_LEGACY=false
|
|
@@ -253,7 +277,7 @@ fi
|
|
|
253
277
|
# Content-aware up-to-date check (skip for legacy migrations and agent-only runs)
|
|
254
278
|
if [[ "$INSTALLED_VERSION" == "$AVAILABLE_VERSION" ]] && [[ "$IS_LEGACY" == false ]] && [[ "$UPDATE_COMPONENT" != "agents" ]] && [[ "$FORCE_UPDATE" == false ]]; then
|
|
255
279
|
# Same version — check if any template content has actually changed
|
|
256
|
-
local_manifest="$REPO_ROOT/.specrails-manifest.json"
|
|
280
|
+
local_manifest="$REPO_ROOT/.specrails/specrails-manifest.json"
|
|
257
281
|
HAS_CHANGES=false
|
|
258
282
|
|
|
259
283
|
if [[ -f "$local_manifest" ]]; then
|
|
@@ -310,13 +334,13 @@ fi
|
|
|
310
334
|
|
|
311
335
|
if [[ "$IS_LEGACY" == true ]]; then
|
|
312
336
|
step "Phase 2: Legacy migration"
|
|
313
|
-
warn "No .specrails-version found — assuming v0.1.0 (pre-versioning install)"
|
|
337
|
+
warn "No .specrails/specrails-version found — assuming v0.1.0 (pre-versioning install)"
|
|
314
338
|
info "Generating baseline manifest from current specrails templates..."
|
|
315
339
|
generate_manifest
|
|
316
340
|
# Overwrite with legacy version so the update flow sees "0.1.0 → current"
|
|
317
341
|
printf '0.1.0\n' > "$VERSION_FILE"
|
|
318
|
-
ok "Written .specrails-version as 0.1.0"
|
|
319
|
-
ok "Written .specrails-manifest.json"
|
|
342
|
+
ok "Written .specrails/specrails-version as 0.1.0"
|
|
343
|
+
ok "Written .specrails/specrails-manifest.json"
|
|
320
344
|
fi
|
|
321
345
|
|
|
322
346
|
# ─────────────────────────────────────────────
|
|
@@ -348,6 +372,9 @@ ok "Backed up .claude/ to .claude.specrails.backup/ (excluding node_modules)"
|
|
|
348
372
|
# ─────────────────────────────────────────────
|
|
349
373
|
|
|
350
374
|
NEEDS_SETUP_UPDATE=false
|
|
375
|
+
if [[ "$_MIGRATED_SETUP_TEMPLATES" == true ]]; then
|
|
376
|
+
NEEDS_SETUP_UPDATE=true
|
|
377
|
+
fi
|
|
351
378
|
FORCE_AGENTS=false
|
|
352
379
|
|
|
353
380
|
do_migrate_sr_prefix() {
|
|
@@ -461,7 +488,7 @@ do_migrate_sr_prefix() {
|
|
|
461
488
|
do_core() {
|
|
462
489
|
step "Updating core artifacts (commands, skills, setup-templates)"
|
|
463
490
|
|
|
464
|
-
local manifest_file="$REPO_ROOT/.specrails-manifest.json"
|
|
491
|
+
local manifest_file="$REPO_ROOT/.specrails/specrails-manifest.json"
|
|
465
492
|
local updated_count=0
|
|
466
493
|
local added_count=0
|
|
467
494
|
|
|
@@ -509,7 +536,7 @@ except Exception:
|
|
|
509
536
|
relpath="templates/${filepath#"$SCRIPT_DIR/templates/"}"
|
|
510
537
|
|
|
511
538
|
if _file_changed "$filepath" "$relpath"; then
|
|
512
|
-
local dest="$REPO_ROOT/.
|
|
539
|
+
local dest="$REPO_ROOT/.specrails/setup-templates/${filepath#"$SCRIPT_DIR/templates/"}"
|
|
513
540
|
mkdir -p "$(dirname "$dest")"
|
|
514
541
|
cp "$filepath" "$dest"
|
|
515
542
|
|
|
@@ -540,7 +567,7 @@ except Exception:
|
|
|
540
567
|
relpath="prompts/${filepath#"$SCRIPT_DIR/prompts/"}"
|
|
541
568
|
|
|
542
569
|
if _file_changed "$filepath" "$relpath"; then
|
|
543
|
-
local dest="$REPO_ROOT/.
|
|
570
|
+
local dest="$REPO_ROOT/.specrails/setup-templates/prompts/${filepath#"$SCRIPT_DIR/prompts/"}"
|
|
544
571
|
mkdir -p "$(dirname "$dest")"
|
|
545
572
|
cp "$filepath" "$dest"
|
|
546
573
|
|
|
@@ -605,10 +632,10 @@ except Exception:
|
|
|
605
632
|
do_agents() {
|
|
606
633
|
step "Checking adapted artifacts (agents, rules)"
|
|
607
634
|
|
|
608
|
-
local manifest_file="$REPO_ROOT/.specrails-manifest.json"
|
|
635
|
+
local manifest_file="$REPO_ROOT/.specrails/specrails-manifest.json"
|
|
609
636
|
|
|
610
637
|
if [[ ! -f "$manifest_file" ]]; then
|
|
611
|
-
warn "No .specrails-manifest.json found — cannot detect template changes."
|
|
638
|
+
warn "No .specrails/specrails-manifest.json found — cannot detect template changes."
|
|
612
639
|
warn "Run update.sh without --only to regenerate the manifest."
|
|
613
640
|
return
|
|
614
641
|
fi
|
|
@@ -748,8 +775,8 @@ with open(user_path, 'w') as f:
|
|
|
748
775
|
do_stamp() {
|
|
749
776
|
step "Writing version stamp and manifest"
|
|
750
777
|
generate_manifest
|
|
751
|
-
ok "Updated .specrails-version to v${AVAILABLE_VERSION}"
|
|
752
|
-
ok "Updated .specrails-manifest.json"
|
|
778
|
+
ok "Updated .specrails/specrails-version to v${AVAILABLE_VERSION}"
|
|
779
|
+
ok "Updated .specrails/specrails-manifest.json"
|
|
753
780
|
}
|
|
754
781
|
|
|
755
782
|
# ─────────────────────────────────────────────
|
|
@@ -795,9 +822,9 @@ rm -rf "$BACKUP_DIR"
|
|
|
795
822
|
ok "Backup removed"
|
|
796
823
|
|
|
797
824
|
# Clean up setup-templates if no /specrails:setup re-run is needed
|
|
798
|
-
if [[ "$NEEDS_SETUP_UPDATE" != true ]] && [[ -d "$REPO_ROOT/.
|
|
799
|
-
rm -rf "$REPO_ROOT/.
|
|
800
|
-
ok "Cleaned up setup-templates (no /specrails:setup re-run needed)"
|
|
825
|
+
if [[ "$NEEDS_SETUP_UPDATE" != true ]] && [[ -d "$REPO_ROOT/.specrails/setup-templates" ]]; then
|
|
826
|
+
rm -rf "$REPO_ROOT/.specrails/setup-templates"
|
|
827
|
+
ok "Cleaned up .specrails/setup-templates (no /specrails:setup re-run needed)"
|
|
801
828
|
fi
|
|
802
829
|
|
|
803
830
|
echo ""
|