specrails-core 3.5.2 → 3.5.3
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/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/setup.md +76 -76
- package/update.sh +44 -17
package/commands/setup.md
CHANGED
|
@@ -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,22 +39,22 @@ 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.
|
|
@@ -82,28 +82,28 @@ Store all results for use in Phases U4 and U5.
|
|
|
82
82
|
|
|
83
83
|
### Phase U3: Identify What Needs Regeneration
|
|
84
84
|
|
|
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 `.
|
|
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 `.specrails/setup-templates/agents/`:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
sha256sum .
|
|
88
|
+
sha256sum .specrails/setup-templates/agents/sr-<name>.md
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Build three lists for agents:
|
|
92
92
|
|
|
93
93
|
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 `.
|
|
94
|
+
2. **New agents**: template file exists in `.specrails/setup-templates/agents/` but the agent name is NOT in the manifest → mark for evaluation
|
|
95
95
|
3. **Unchanged agents**: agent name exists in manifest AND checksum matches → skip
|
|
96
96
|
|
|
97
|
-
**Command templates:** If `.
|
|
97
|
+
**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
98
|
|
|
99
99
|
```bash
|
|
100
|
-
sha256sum .
|
|
100
|
+
sha256sum .specrails/setup-templates/commands/specrails/<name>.md
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
Build three lists for commands:
|
|
104
104
|
|
|
105
105
|
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 `.
|
|
106
|
+
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
107
|
3. **Unchanged commands**: command name exists in manifest AND checksum matches → skip
|
|
108
108
|
|
|
109
109
|
Display the combined analysis to the user:
|
|
@@ -144,7 +144,7 @@ Then jump to Phase U7.
|
|
|
144
144
|
|
|
145
145
|
For each agent in the "changed" list:
|
|
146
146
|
|
|
147
|
-
1. Read the NEW template from
|
|
147
|
+
1. Read the NEW template from `.specrails/setup-templates/agents/sr-<name>.md`
|
|
148
148
|
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
149
|
- `{{PROJECT_NAME}}` → project name (from README.md or directory name)
|
|
150
150
|
- `{{ARCHITECTURE_DIAGRAM}}` → detected architecture layers
|
|
@@ -176,8 +176,8 @@ grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken
|
|
|
176
176
|
For each command in the "changed commands" list from Phase U3:
|
|
177
177
|
|
|
178
178
|
1. Read the NEW template:
|
|
179
|
-
- If `cli_provider == "claude"`: from
|
|
180
|
-
- If `cli_provider == "codex"`: from
|
|
179
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
180
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
181
181
|
2. Read stored backlog configuration from `.specrails/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
|
|
182
182
|
- `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
|
|
183
183
|
- `BACKLOG_WRITE` → `write_access` field
|
|
@@ -214,7 +214,7 @@ If any placeholders remain unresolved, warn the user:
|
|
|
214
214
|
|
|
215
215
|
For each agent in the "new" list:
|
|
216
216
|
|
|
217
|
-
1. Read the template from `.
|
|
217
|
+
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
218
|
2. Match against the codebase detected in Phase U2:
|
|
219
219
|
- If the template targets a layer/stack that IS present (e.g., `sr-frontend-developer` and React was detected), prompt:
|
|
220
220
|
> "New agent available: `sr-<name>` — your project uses [detected tech]. Add it? [Y/n]"
|
|
@@ -230,8 +230,8 @@ For each agent in the "new" list:
|
|
|
230
230
|
For each command in the "new commands" list from Phase U3:
|
|
231
231
|
|
|
232
232
|
1. Read the template:
|
|
233
|
-
- If `cli_provider == "claude"`: from
|
|
234
|
-
- If `cli_provider == "codex"`: from
|
|
233
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
234
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
235
235
|
2. Prompt the user:
|
|
236
236
|
- If `cli_provider == "claude"`: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
|
|
237
237
|
- If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
|
|
@@ -298,12 +298,12 @@ All agents and commands are now up to date.
|
|
|
298
298
|
[list command names, or "(none)"]
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
Update `.specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
301
|
+
Update `.specrails/specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
302
302
|
- For each regenerated agent: update its checksum entry to the new template's checksum (keyed as `templates/agents/sr-<name>.md`)
|
|
303
303
|
- For each added agent: add a new entry with its checksum
|
|
304
304
|
- For each updated command: update its checksum entry to the new template's checksum (keyed as `templates/commands/specrails/<name>.md`)
|
|
305
305
|
- For each added command: add a new entry with its checksum
|
|
306
|
-
- Update the `version` field to the version read from `.specrails-version`
|
|
306
|
+
- Update the `version` field to the version read from `.specrails/specrails-version`
|
|
307
307
|
|
|
308
308
|
---
|
|
309
309
|
|
|
@@ -382,7 +382,7 @@ Generate files using the Lite Mode defaults.
|
|
|
382
382
|
|
|
383
383
|
**1. CLAUDE.md**
|
|
384
384
|
|
|
385
|
-
Read
|
|
385
|
+
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
386
|
|
|
387
387
|
Replace placeholders:
|
|
388
388
|
- `{{PROJECT_NAME}}` → derive from directory name or README.md first heading
|
|
@@ -396,7 +396,7 @@ Skip if user says no.
|
|
|
396
396
|
|
|
397
397
|
**2. Agent files**
|
|
398
398
|
|
|
399
|
-
For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from
|
|
399
|
+
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
400
|
- `cli_provider == "claude"`: write to `.claude/agents/<name>.md` (Markdown with frontmatter)
|
|
401
401
|
- `cli_provider == "codex"`: write to `.codex/agents/<name>.toml` (TOML format)
|
|
402
402
|
|
|
@@ -436,7 +436,7 @@ Core commands (always install if missing):
|
|
|
436
436
|
|
|
437
437
|
**If `cli_provider == "claude"`:**
|
|
438
438
|
|
|
439
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the template from
|
|
439
|
+
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
440
|
|
|
441
441
|
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
442
|
- If it exists: skip it — show `✓ Already installed: /specrails:<name>`
|
|
@@ -444,7 +444,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
444
444
|
|
|
445
445
|
**If `cli_provider == "codex"`:**
|
|
446
446
|
|
|
447
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the corresponding skill template from
|
|
447
|
+
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
448
|
|
|
449
449
|
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
450
|
- If it exists: skip it — show `✓ Already installed: $sr-<name>`
|
|
@@ -452,7 +452,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
452
452
|
|
|
453
453
|
**4. Cleanup**
|
|
454
454
|
|
|
455
|
-
Remove
|
|
455
|
+
Remove `.specrails/setup-templates/` (same as full wizard cleanup in Phase 5).
|
|
456
456
|
|
|
457
457
|
Remove `commands/setup.md` from `.claude/commands/` if it was copied there by the installer.
|
|
458
458
|
|
|
@@ -560,7 +560,7 @@ Display the detected architecture to the user:
|
|
|
560
560
|
|
|
561
561
|
### OSS Project Detection
|
|
562
562
|
|
|
563
|
-
Read `.
|
|
563
|
+
Read `.specrails/setup-templates/.oss-detection.json` if it exists.
|
|
564
564
|
|
|
565
565
|
| Signal | Status |
|
|
566
566
|
|--------|--------|
|
|
@@ -629,7 +629,7 @@ Search queries to use (adapt to the domain):
|
|
|
629
629
|
|
|
630
630
|
### 2.3 Generate VPC personas
|
|
631
631
|
|
|
632
|
-
For each user type, generate a full Value Proposition Canvas persona file following the template at `.
|
|
632
|
+
For each user type, generate a full Value Proposition Canvas persona file following the template at `.specrails/setup-templates/personas/persona.md`.
|
|
633
633
|
|
|
634
634
|
Each persona must include:
|
|
635
635
|
- **Profile**: Demographics, behaviors, tools used, spending patterns
|
|
@@ -986,9 +986,9 @@ Wait for final confirmation.
|
|
|
986
986
|
|
|
987
987
|
## Phase 4: Generate Files
|
|
988
988
|
|
|
989
|
-
Read each template from `.
|
|
989
|
+
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
990
|
|
|
991
|
-
**Provider detection (required before any file generation):** Read
|
|
991
|
+
**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
992
|
|
|
993
993
|
### 4.1 Generate agents
|
|
994
994
|
|
|
@@ -997,26 +997,26 @@ For each selected agent, read the template and generate the adapted version.
|
|
|
997
997
|
**Template → Output mapping:**
|
|
998
998
|
|
|
999
999
|
**If `cli_provider == "claude"` (default):**
|
|
1000
|
-
-
|
|
1001
|
-
-
|
|
1002
|
-
-
|
|
1003
|
-
-
|
|
1004
|
-
-
|
|
1005
|
-
-
|
|
1006
|
-
-
|
|
1007
|
-
-
|
|
1008
|
-
-
|
|
1000
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.claude/agents/sr-architect.md`
|
|
1001
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.claude/agents/sr-developer.md`
|
|
1002
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.claude/agents/sr-reviewer.md`
|
|
1003
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.claude/agents/sr-test-writer.md`
|
|
1004
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.claude/agents/sr-security-reviewer.md`
|
|
1005
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.claude/agents/sr-product-manager.md`
|
|
1006
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.claude/agents/sr-product-analyst.md`
|
|
1007
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.claude/agents/sr-backend-developer.md` (if backend layer)
|
|
1008
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.claude/agents/sr-frontend-developer.md` (if frontend layer)
|
|
1009
1009
|
|
|
1010
1010
|
**If `cli_provider == "codex"`:**
|
|
1011
|
-
-
|
|
1012
|
-
-
|
|
1013
|
-
-
|
|
1014
|
-
-
|
|
1015
|
-
-
|
|
1016
|
-
-
|
|
1017
|
-
-
|
|
1018
|
-
-
|
|
1019
|
-
-
|
|
1011
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.codex/agents/sr-architect.toml`
|
|
1012
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.codex/agents/sr-developer.toml`
|
|
1013
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.codex/agents/sr-reviewer.toml`
|
|
1014
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.codex/agents/sr-test-writer.toml`
|
|
1015
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.codex/agents/sr-security-reviewer.toml`
|
|
1016
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.codex/agents/sr-product-manager.toml`
|
|
1017
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.codex/agents/sr-product-analyst.toml`
|
|
1018
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.codex/agents/sr-backend-developer.toml` (if backend layer)
|
|
1019
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.codex/agents/sr-frontend-developer.toml` (if frontend layer)
|
|
1020
1020
|
|
|
1021
1021
|
When generating each agent:
|
|
1022
1022
|
1. Read the template
|
|
@@ -1058,7 +1058,7 @@ When generating each agent:
|
|
|
1058
1058
|
### 4.2 Generate personas
|
|
1059
1059
|
|
|
1060
1060
|
If IS_OSS=true:
|
|
1061
|
-
1. Copy
|
|
1061
|
+
1. Copy `.specrails/setup-templates/personas/the-maintainer.md` to `$SPECRAILS_DIR/agents/personas/the-maintainer.md`
|
|
1062
1062
|
2. Log: "Maintainer persona included"
|
|
1063
1063
|
3. Set MAINTAINER_INCLUDED=true for use in template substitution
|
|
1064
1064
|
4. Set `{{MAINTAINER_PERSONA_LINE}}` = `- \`$SPECRAILS_DIR/agents/personas/the-maintainer.md\` — "Kai" the Maintainer (open-source maintainer)`
|
|
@@ -1078,26 +1078,26 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
|
|
|
1078
1078
|
For each selected command, read the template and adapt.
|
|
1079
1079
|
|
|
1080
1080
|
**If `cli_provider == "claude"` (default):**
|
|
1081
|
-
-
|
|
1082
|
-
-
|
|
1083
|
-
-
|
|
1084
|
-
-
|
|
1085
|
-
-
|
|
1086
|
-
-
|
|
1087
|
-
-
|
|
1088
|
-
-
|
|
1081
|
+
- `.specrails/setup-templates/commands/specrails/implement.md` → `.claude/commands/specrails/implement.md`
|
|
1082
|
+
- `.specrails/setup-templates/commands/specrails/batch-implement.md` → `.claude/commands/specrails/batch-implement.md`
|
|
1083
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.claude/commands/specrails/propose-spec.md`
|
|
1084
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.claude/commands/specrails/get-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1085
|
+
- `.specrails/setup-templates/commands/specrails/auto-propose-backlog-specs.md` → `.claude/commands/specrails/auto-propose-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1086
|
+
- `.specrails/setup-templates/commands/specrails/compat-check.md` → `.claude/commands/specrails/compat-check.md`
|
|
1087
|
+
- `.specrails/setup-templates/commands/specrails/refactor-recommender.md` → `.claude/commands/specrails/refactor-recommender.md`
|
|
1088
|
+
- `.specrails/setup-templates/commands/specrails/why.md` → `.claude/commands/specrails/why.md`
|
|
1089
1089
|
|
|
1090
1090
|
**If `cli_provider == "codex"`:**
|
|
1091
|
-
-
|
|
1092
|
-
-
|
|
1093
|
-
-
|
|
1094
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
-
|
|
1098
|
-
-
|
|
1099
|
-
|
|
1100
|
-
**Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in
|
|
1091
|
+
- `.specrails/setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
|
|
1092
|
+
- `.specrails/setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
|
|
1093
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
|
|
1094
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.agents/skills/sr-get-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1095
|
+
- `.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)
|
|
1096
|
+
- `.specrails/setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
|
|
1097
|
+
- `.specrails/setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
|
|
1098
|
+
- `.specrails/setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
|
|
1099
|
+
|
|
1100
|
+
**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
1101
|
```yaml
|
|
1102
1102
|
---
|
|
1103
1103
|
name: sr-<name>
|
|
@@ -1199,7 +1199,7 @@ The command templates use `{{BACKLOG_FETCH_CMD}}`, `{{BACKLOG_CREATE_CMD}}`, `{{
|
|
|
1199
1199
|
### 4.4 Generate rules
|
|
1200
1200
|
|
|
1201
1201
|
For each detected layer, read the layer rule template and generate a layer-specific rules file:
|
|
1202
|
-
-
|
|
1202
|
+
- `.specrails/setup-templates/rules/layer.md` → `$SPECRAILS_DIR/rules/{layer-name}.md`
|
|
1203
1203
|
|
|
1204
1204
|
Each rule file must:
|
|
1205
1205
|
- Have the correct `paths:` frontmatter matching the layer's directory
|
|
@@ -1214,7 +1214,7 @@ Each rule file must:
|
|
|
1214
1214
|
|
|
1215
1215
|
### 4.6 Generate settings
|
|
1216
1216
|
|
|
1217
|
-
Read `.
|
|
1217
|
+
Read `.specrails/setup-templates/.provider-detection.json` (written by `install.sh`) to determine `cli_provider` (`"claude"` or `"codex"`).
|
|
1218
1218
|
|
|
1219
1219
|
**If `cli_provider == "claude"` (default):**
|
|
1220
1220
|
|
|
@@ -1227,9 +1227,9 @@ Create or merge `.claude/settings.json` with permissions for:
|
|
|
1227
1227
|
|
|
1228
1228
|
**If `cli_provider == "codex"`:**
|
|
1229
1229
|
|
|
1230
|
-
1. Read
|
|
1230
|
+
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
1231
|
|
|
1232
|
-
2. Read
|
|
1232
|
+
2. Read `.specrails/setup-templates/settings/codex-rules.star`. Replace `{{CODEX_SHELL_RULES}}` with Starlark `prefix_rule(...)` lines for each detected tool allowance:
|
|
1233
1233
|
|
|
1234
1234
|
| Detected tool/command | Starlark rule |
|
|
1235
1235
|
|----------------------|---------------|
|
|
@@ -1268,7 +1268,7 @@ The setup process installed temporary files that are only needed during installa
|
|
|
1268
1268
|
|
|
1269
1269
|
```bash
|
|
1270
1270
|
# 1. Remove setup templates (used as structural references during generation)
|
|
1271
|
-
rm -rf .
|
|
1271
|
+
rm -rf .specrails/setup-templates/
|
|
1272
1272
|
|
|
1273
1273
|
# 2. Remove the /specrails:setup command itself — it's a one-time installer, not a permanent command
|
|
1274
1274
|
rm -f .claude/commands/setup.md
|
|
@@ -1281,7 +1281,7 @@ rm -f .claude/commands/setup.md
|
|
|
1281
1281
|
**What gets removed:**
|
|
1282
1282
|
| Artifact | Why |
|
|
1283
1283
|
|----------|-----|
|
|
1284
|
-
| `.
|
|
1284
|
+
| `.specrails/setup-templates/` | Temporary — templates already rendered into final files |
|
|
1285
1285
|
| `.claude/commands/setup.md` | One-time installer — running it again would overwrite customized agents |
|
|
1286
1286
|
|
|
1287
1287
|
**What to do with `specrails/`:**
|
|
@@ -1327,7 +1327,7 @@ ls .codex/rules/*.md
|
|
|
1327
1327
|
ls .codex/agent-memory/
|
|
1328
1328
|
|
|
1329
1329
|
# These should NOT exist (scaffolding):
|
|
1330
|
-
#
|
|
1330
|
+
# .specrails/setup-templates/ — GONE
|
|
1331
1331
|
# If cli_provider == "claude": $SPECRAILS_DIR/commands/setup.md — GONE
|
|
1332
1332
|
# If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
|
|
1333
1333
|
```
|
|
@@ -1402,7 +1402,7 @@ Note: Only commands/skills selected during setup are shown. Backlog commands are
|
|
|
1402
1402
|
### Scaffolding Removed
|
|
1403
1403
|
| Artifact | Status |
|
|
1404
1404
|
|----------|--------|
|
|
1405
|
-
|
|
|
1405
|
+
| .specrails/setup-templates/ | Deleted |
|
|
1406
1406
|
[If cli_provider == "claude":] | .claude/commands/setup.md | Deleted |
|
|
1407
1407
|
[If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
|
|
1408
1408
|
| specrails/ | [User's choice] |
|
package/docs/installation.md
CHANGED
|
@@ -82,9 +82,9 @@ git clone https://github.com/fjpulidop/specrails-core.git
|
|
|
82
82
|
2. **Detects existing setup** — warns if SpecRails artifacts already exist
|
|
83
83
|
3. **Installs artifacts:**
|
|
84
84
|
- `.claude/commands/specrails/setup.md` — the `/specrails:setup` wizard
|
|
85
|
-
- `.
|
|
85
|
+
- `.specrails/setup-templates/` — agent and command templates (temporary, removed after `/specrails:setup`)
|
|
86
86
|
- `.claude/security-exemptions.yaml` — security scanner config
|
|
87
|
-
4. **Tracks version** — writes `.specrails-version` and `.specrails-manifest.json`
|
|
87
|
+
4. **Tracks version** — writes `.specrails/specrails-version` and `.specrails/specrails-manifest.json`
|
|
88
88
|
|
|
89
89
|
The scaffold installer only copies files. It does not modify your existing code, create commits, or push to any remote.
|
|
90
90
|
|
|
@@ -210,7 +210,7 @@ The wizard fills all templates with your project-specific context:
|
|
|
210
210
|
The wizard removes itself:
|
|
211
211
|
|
|
212
212
|
- Deletes `.claude/commands/specrails/setup.md`
|
|
213
|
-
- Deletes `.
|
|
213
|
+
- Deletes `.specrails/setup-templates/`
|
|
214
214
|
- Leaves only the final generated files
|
|
215
215
|
|
|
216
216
|
After this phase, `/specrails:setup` is no longer available until re-run — your workflow is ready.
|
|
@@ -253,7 +253,7 @@ ls .claude/agents/
|
|
|
253
253
|
grep -r '{{[A-Z_]*}}' .claude/agents/ .claude/commands/ .claude/rules/
|
|
254
254
|
|
|
255
255
|
# Scaffold method: check version
|
|
256
|
-
cat .specrails-version
|
|
256
|
+
cat .specrails/specrails-version
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
---
|
package/docs/updating.md
CHANGED
|
@@ -6,7 +6,7 @@ SpecRails includes an update system that pulls new templates while preserving yo
|
|
|
6
6
|
|
|
7
7
|
The update system uses a **manifest-based approach**:
|
|
8
8
|
|
|
9
|
-
1. During installation, SpecRails generates `.specrails-manifest.json` — a checksum of every installed file
|
|
9
|
+
1. During installation, SpecRails generates `.specrails/specrails-manifest.json` — a checksum of every installed file
|
|
10
10
|
2. On update, it compares the manifest against current files to detect what you've customized
|
|
11
11
|
3. Customized files are preserved; unchanged files are updated to the latest version
|
|
12
12
|
|
|
@@ -25,7 +25,7 @@ bash /path/to/specrails/update.sh
|
|
|
25
25
|
### What happens
|
|
26
26
|
|
|
27
27
|
1. **Backup** — creates `.claude.specrails.backup/` with your current files
|
|
28
|
-
2. **Version check** — compares installed version (`.specrails-version`) with latest
|
|
28
|
+
2. **Version check** — compares installed version (`.specrails/specrails-version`) with latest
|
|
29
29
|
3. **Update files** — replaces unchanged files, preserves customized ones
|
|
30
30
|
4. **Merge settings** — additively merges `settings.json` (your permissions are kept)
|
|
31
31
|
5. **Update version** — writes new version and manifest
|
|
@@ -66,7 +66,7 @@ bash update.sh --only all
|
|
|
66
66
|
|
|
67
67
|
If you installed SpecRails before the versioning system (pre-v0.1.0):
|
|
68
68
|
|
|
69
|
-
- The updater detects missing `.specrails-version` and treats it as a legacy install
|
|
69
|
+
- The updater detects missing `.specrails/specrails-version` and treats it as a legacy install
|
|
70
70
|
- It migrates your installation to the versioned system
|
|
71
71
|
- A manifest is generated from your current files
|
|
72
72
|
- Future updates use the standard manifest comparison
|
|
@@ -78,7 +78,7 @@ If something goes wrong, restore from the automatic backup:
|
|
|
78
78
|
```bash
|
|
79
79
|
# Backups are at .claude.specrails.backup/
|
|
80
80
|
cp -r .claude.specrails.backup/.claude .claude
|
|
81
|
-
cp .claude.specrails.backup/.specrails-version .specrails-version
|
|
81
|
+
cp .claude.specrails.backup/.specrails/specrails-version .specrails/specrails-version
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
---
|
package/docs/user-docs/faq.md
CHANGED
|
@@ -88,7 +88,7 @@ your-project/
|
|
|
88
88
|
└── config.toml # Permissions
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
The installer also writes `.specrails-version` and `.specrails-manifest.json` to track the installed version.
|
|
91
|
+
The installer also writes `.specrails/specrails-version` and `.specrails/specrails-manifest.json` to track the installed version.
|
|
92
92
|
|
|
93
93
|
## Configure with /specrails:setup
|
|
94
94
|
|
|
@@ -131,7 +131,7 @@ ls .claude/agents/
|
|
|
131
131
|
grep -r '{{[A-Z_]*}}' .claude/agents/ .claude/commands/ .claude/rules/
|
|
132
132
|
|
|
133
133
|
# Scaffold method: check the installed version
|
|
134
|
-
cat .specrails-version
|
|
134
|
+
cat .specrails/specrails-version
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
## Troubleshooting
|
package/install.sh
CHANGED
|
@@ -143,7 +143,7 @@ generate_manifest() {
|
|
|
143
143
|
installed_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
144
144
|
|
|
145
145
|
# Write version file
|
|
146
|
-
printf '%s\n' "$version" > "$REPO_ROOT/.specrails-version"
|
|
146
|
+
printf '%s\n' "$version" > "$REPO_ROOT/.specrails/specrails-version"
|
|
147
147
|
|
|
148
148
|
# Build artifact checksums for all files under templates/
|
|
149
149
|
local artifacts_json=""
|
|
@@ -177,7 +177,7 @@ generate_manifest() {
|
|
|
177
177
|
artifacts_json="${artifacts_json},
|
|
178
178
|
\"commands/specrails/doctor.md\": \"${doctor_checksum}\""
|
|
179
179
|
|
|
180
|
-
cat > "$REPO_ROOT/.specrails-manifest.json" << EOF
|
|
180
|
+
cat > "$REPO_ROOT/.specrails/specrails-manifest.json" << EOF
|
|
181
181
|
{
|
|
182
182
|
"version": "${version}",
|
|
183
183
|
"installed_at": "${installed_at}",
|
|
@@ -493,14 +493,14 @@ if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
|
493
493
|
else
|
|
494
494
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/commands/specrails"
|
|
495
495
|
fi
|
|
496
|
-
mkdir -p "$REPO_ROOT
|
|
497
|
-
mkdir -p "$REPO_ROOT
|
|
498
|
-
mkdir -p "$REPO_ROOT
|
|
499
|
-
mkdir -p "$REPO_ROOT
|
|
500
|
-
mkdir -p "$REPO_ROOT
|
|
501
|
-
mkdir -p "$REPO_ROOT
|
|
502
|
-
mkdir -p "$REPO_ROOT
|
|
503
|
-
mkdir -p "$REPO_ROOT
|
|
496
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/agents"
|
|
497
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/commands"
|
|
498
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/skills"
|
|
499
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/rules"
|
|
500
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/personas"
|
|
501
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/claude-md"
|
|
502
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/settings"
|
|
503
|
+
mkdir -p "$REPO_ROOT/.specrails/setup-templates/prompts"
|
|
504
504
|
mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/agent-memory/explanations"
|
|
505
505
|
|
|
506
506
|
# Copy the /specrails:setup and /specrails:doctor commands (or skills for Codex)
|
|
@@ -553,11 +553,11 @@ ok "Installed specrails doctor (bin/doctor.sh)"
|
|
|
553
553
|
# Copy templates (includes commands, skills, agents, rules, personas, settings)
|
|
554
554
|
# Use tar to exclude node_modules and package-lock.json for performance
|
|
555
555
|
tar -C "$SCRIPT_DIR/templates" --exclude='node_modules' --exclude='package-lock.json' -cf - . \
|
|
556
|
-
| tar -C "$REPO_ROOT
|
|
556
|
+
| tar -C "$REPO_ROOT/.specrails/setup-templates/" -xf -
|
|
557
557
|
ok "Installed setup templates (commands + skills)"
|
|
558
558
|
|
|
559
559
|
# Write OSS detection results for /specrails:setup
|
|
560
|
-
cat > "$REPO_ROOT
|
|
560
|
+
cat > "$REPO_ROOT/.specrails/setup-templates/.oss-detection.json" << EOF
|
|
561
561
|
{
|
|
562
562
|
"is_oss": $IS_OSS,
|
|
563
563
|
"signals": {
|
|
@@ -570,7 +570,7 @@ EOF
|
|
|
570
570
|
ok "OSS detection results written"
|
|
571
571
|
|
|
572
572
|
# Write provider detection results for /setup
|
|
573
|
-
cat > "$REPO_ROOT
|
|
573
|
+
cat > "$REPO_ROOT/.specrails/setup-templates/.provider-detection.json" << EOF
|
|
574
574
|
{
|
|
575
575
|
"cli_provider": "$CLI_PROVIDER",
|
|
576
576
|
"specrails_dir": "$SPECRAILS_DIR",
|
|
@@ -578,7 +578,7 @@ cat > "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/.provider-detection.json" << EO
|
|
|
578
578
|
"agent_teams": $AGENT_TEAMS
|
|
579
579
|
}
|
|
580
580
|
EOF
|
|
581
|
-
ok "Provider detection results written ($CLI_PROVIDER →
|
|
581
|
+
ok "Provider detection results written ($CLI_PROVIDER → .specrails/setup-templates/)"
|
|
582
582
|
|
|
583
583
|
# Copy security exemptions config (skip if already exists — preserve user exemptions)
|
|
584
584
|
if [ ! -f "${REPO_ROOT}/$SPECRAILS_DIR/security-exemptions.yaml" ]; then
|
|
@@ -588,7 +588,7 @@ fi
|
|
|
588
588
|
|
|
589
589
|
# Copy prompts
|
|
590
590
|
if [ -d "$SCRIPT_DIR/prompts" ] && [ "$(ls -A "$SCRIPT_DIR/prompts" 2>/dev/null)" ]; then
|
|
591
|
-
cp -r "$SCRIPT_DIR/prompts/"* "$REPO_ROOT
|
|
591
|
+
cp -r "$SCRIPT_DIR/prompts/"* "$REPO_ROOT/.specrails/setup-templates/prompts/"
|
|
592
592
|
ok "Installed prompts"
|
|
593
593
|
fi
|
|
594
594
|
|
|
@@ -609,8 +609,8 @@ fi
|
|
|
609
609
|
step "Phase 3b: Writing version and manifest"
|
|
610
610
|
|
|
611
611
|
generate_manifest
|
|
612
|
-
ok "Written .specrails-version ($(cat "$REPO_ROOT/.specrails-version"))"
|
|
613
|
-
ok "Written .specrails-manifest.json"
|
|
612
|
+
ok "Written .specrails/specrails-version ($(cat "$REPO_ROOT/.specrails/specrails-version"))"
|
|
613
|
+
ok "Written .specrails/specrails-manifest.json"
|
|
614
614
|
|
|
615
615
|
# ─────────────────────────────────────────────
|
|
616
616
|
# Phase 4: Summary & next steps
|
|
@@ -634,9 +634,9 @@ if [[ "$CLI_PROVIDER" == "codex" ]]; then
|
|
|
634
634
|
else
|
|
635
635
|
echo " $SPECRAILS_DIR/commands/specrails/setup.md ← The /specrails:setup command"
|
|
636
636
|
fi
|
|
637
|
-
echo "
|
|
638
|
-
echo " .specrails-version
|
|
639
|
-
echo " .specrails-manifest.json
|
|
637
|
+
echo " .specrails/setup-templates/ ← Templates: commands + skills (temporary, removed after setup)"
|
|
638
|
+
echo " .specrails/specrails-version ← Installed specrails version"
|
|
639
|
+
echo " .specrails/specrails-manifest.json ← Artifact checksums for update detection"
|
|
640
640
|
echo ""
|
|
641
641
|
|
|
642
642
|
echo -e "${BOLD}Prerequisites:${NC}"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specrails-core",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "AI agent workflow system for Claude Code — installs 12 specialized agents, orchestration commands, and persona-driven product discovery into any repository",
|
|
5
5
|
"bin": {
|
|
6
6
|
"specrails-core": "bin/specrails-core.js"
|
|
@@ -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,22 +39,22 @@ 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.
|
|
@@ -82,28 +82,28 @@ Store all results for use in Phases U4 and U5.
|
|
|
82
82
|
|
|
83
83
|
### Phase U3: Identify What Needs Regeneration
|
|
84
84
|
|
|
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 `.
|
|
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 `.specrails/setup-templates/agents/`:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
sha256sum .
|
|
88
|
+
sha256sum .specrails/setup-templates/agents/sr-<name>.md
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Build three lists for agents:
|
|
92
92
|
|
|
93
93
|
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 `.
|
|
94
|
+
2. **New agents**: template file exists in `.specrails/setup-templates/agents/` but the agent name is NOT in the manifest → mark for evaluation
|
|
95
95
|
3. **Unchanged agents**: agent name exists in manifest AND checksum matches → skip
|
|
96
96
|
|
|
97
|
-
**Command templates:** If `.
|
|
97
|
+
**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
98
|
|
|
99
99
|
```bash
|
|
100
|
-
sha256sum .
|
|
100
|
+
sha256sum .specrails/setup-templates/commands/specrails/<name>.md
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
Build three lists for commands:
|
|
104
104
|
|
|
105
105
|
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 `.
|
|
106
|
+
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
107
|
3. **Unchanged commands**: command name exists in manifest AND checksum matches → skip
|
|
108
108
|
|
|
109
109
|
Display the combined analysis to the user:
|
|
@@ -144,7 +144,7 @@ Then jump to Phase U7.
|
|
|
144
144
|
|
|
145
145
|
For each agent in the "changed" list:
|
|
146
146
|
|
|
147
|
-
1. Read the NEW template from
|
|
147
|
+
1. Read the NEW template from `.specrails/setup-templates/agents/sr-<name>.md`
|
|
148
148
|
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
149
|
- `{{PROJECT_NAME}}` → project name (from README.md or directory name)
|
|
150
150
|
- `{{ARCHITECTURE_DIAGRAM}}` → detected architecture layers
|
|
@@ -176,8 +176,8 @@ grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken
|
|
|
176
176
|
For each command in the "changed commands" list from Phase U3:
|
|
177
177
|
|
|
178
178
|
1. Read the NEW template:
|
|
179
|
-
- If `cli_provider == "claude"`: from
|
|
180
|
-
- If `cli_provider == "codex"`: from
|
|
179
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
180
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
181
181
|
2. Read stored backlog configuration from `.specrails/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
|
|
182
182
|
- `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
|
|
183
183
|
- `BACKLOG_WRITE` → `write_access` field
|
|
@@ -214,7 +214,7 @@ If any placeholders remain unresolved, warn the user:
|
|
|
214
214
|
|
|
215
215
|
For each agent in the "new" list:
|
|
216
216
|
|
|
217
|
-
1. Read the template from `.
|
|
217
|
+
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
218
|
2. Match against the codebase detected in Phase U2:
|
|
219
219
|
- If the template targets a layer/stack that IS present (e.g., `sr-frontend-developer` and React was detected), prompt:
|
|
220
220
|
> "New agent available: `sr-<name>` — your project uses [detected tech]. Add it? [Y/n]"
|
|
@@ -230,8 +230,8 @@ For each agent in the "new" list:
|
|
|
230
230
|
For each command in the "new commands" list from Phase U3:
|
|
231
231
|
|
|
232
232
|
1. Read the template:
|
|
233
|
-
- If `cli_provider == "claude"`: from
|
|
234
|
-
- If `cli_provider == "codex"`: from
|
|
233
|
+
- If `cli_provider == "claude"`: from `.specrails/setup-templates/commands/specrails/<name>.md`
|
|
234
|
+
- If `cli_provider == "codex"`: from `.specrails/setup-templates/skills/sr-<name>/SKILL.md`
|
|
235
235
|
2. Prompt the user:
|
|
236
236
|
- If `cli_provider == "claude"`: `"New command available: /specrails:<name> — [one-line description]. Install it? [Y/n]"`
|
|
237
237
|
- If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
|
|
@@ -298,12 +298,12 @@ All agents and commands are now up to date.
|
|
|
298
298
|
[list command names, or "(none)"]
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
Update `.specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
301
|
+
Update `.specrails/specrails-manifest.json` to reflect the new checksums for all regenerated/updated and added agents and commands:
|
|
302
302
|
- For each regenerated agent: update its checksum entry to the new template's checksum (keyed as `templates/agents/sr-<name>.md`)
|
|
303
303
|
- For each added agent: add a new entry with its checksum
|
|
304
304
|
- For each updated command: update its checksum entry to the new template's checksum (keyed as `templates/commands/specrails/<name>.md`)
|
|
305
305
|
- For each added command: add a new entry with its checksum
|
|
306
|
-
- Update the `version` field to the version read from `.specrails-version`
|
|
306
|
+
- Update the `version` field to the version read from `.specrails/specrails-version`
|
|
307
307
|
|
|
308
308
|
---
|
|
309
309
|
|
|
@@ -382,7 +382,7 @@ Generate files using the Lite Mode defaults.
|
|
|
382
382
|
|
|
383
383
|
**1. CLAUDE.md**
|
|
384
384
|
|
|
385
|
-
Read
|
|
385
|
+
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
386
|
|
|
387
387
|
Replace placeholders:
|
|
388
388
|
- `{{PROJECT_NAME}}` → derive from directory name or README.md first heading
|
|
@@ -396,7 +396,7 @@ Skip if user says no.
|
|
|
396
396
|
|
|
397
397
|
**2. Agent files**
|
|
398
398
|
|
|
399
|
-
For each default agent (sr-architect, sr-developer, sr-reviewer, sr-product-manager), read the template from
|
|
399
|
+
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
400
|
- `cli_provider == "claude"`: write to `.claude/agents/<name>.md` (Markdown with frontmatter)
|
|
401
401
|
- `cli_provider == "codex"`: write to `.codex/agents/<name>.toml` (TOML format)
|
|
402
402
|
|
|
@@ -436,7 +436,7 @@ Core commands (always install if missing):
|
|
|
436
436
|
|
|
437
437
|
**If `cli_provider == "claude"`:**
|
|
438
438
|
|
|
439
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the template from
|
|
439
|
+
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
440
|
|
|
441
441
|
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
442
|
- If it exists: skip it — show `✓ Already installed: /specrails:<name>`
|
|
@@ -444,7 +444,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
444
444
|
|
|
445
445
|
**If `cli_provider == "codex"`:**
|
|
446
446
|
|
|
447
|
-
If `QS_IS_RERUN=false` (fresh install): for each core command, read the corresponding skill template from
|
|
447
|
+
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
448
|
|
|
449
449
|
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
450
|
- If it exists: skip it — show `✓ Already installed: $sr-<name>`
|
|
@@ -452,7 +452,7 @@ If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check
|
|
|
452
452
|
|
|
453
453
|
**4. Cleanup**
|
|
454
454
|
|
|
455
|
-
Remove
|
|
455
|
+
Remove `.specrails/setup-templates/` (same as full wizard cleanup in Phase 5).
|
|
456
456
|
|
|
457
457
|
Remove `commands/setup.md` from `.claude/commands/` if it was copied there by the installer.
|
|
458
458
|
|
|
@@ -560,7 +560,7 @@ Display the detected architecture to the user:
|
|
|
560
560
|
|
|
561
561
|
### OSS Project Detection
|
|
562
562
|
|
|
563
|
-
Read `.
|
|
563
|
+
Read `.specrails/setup-templates/.oss-detection.json` if it exists.
|
|
564
564
|
|
|
565
565
|
| Signal | Status |
|
|
566
566
|
|--------|--------|
|
|
@@ -629,7 +629,7 @@ Search queries to use (adapt to the domain):
|
|
|
629
629
|
|
|
630
630
|
### 2.3 Generate VPC personas
|
|
631
631
|
|
|
632
|
-
For each user type, generate a full Value Proposition Canvas persona file following the template at `.
|
|
632
|
+
For each user type, generate a full Value Proposition Canvas persona file following the template at `.specrails/setup-templates/personas/persona.md`.
|
|
633
633
|
|
|
634
634
|
Each persona must include:
|
|
635
635
|
- **Profile**: Demographics, behaviors, tools used, spending patterns
|
|
@@ -986,9 +986,9 @@ Wait for final confirmation.
|
|
|
986
986
|
|
|
987
987
|
## Phase 4: Generate Files
|
|
988
988
|
|
|
989
|
-
Read each template from `.
|
|
989
|
+
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
990
|
|
|
991
|
-
**Provider detection (required before any file generation):** Read
|
|
991
|
+
**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
992
|
|
|
993
993
|
### 4.1 Generate agents
|
|
994
994
|
|
|
@@ -997,26 +997,26 @@ For each selected agent, read the template and generate the adapted version.
|
|
|
997
997
|
**Template → Output mapping:**
|
|
998
998
|
|
|
999
999
|
**If `cli_provider == "claude"` (default):**
|
|
1000
|
-
-
|
|
1001
|
-
-
|
|
1002
|
-
-
|
|
1003
|
-
-
|
|
1004
|
-
-
|
|
1005
|
-
-
|
|
1006
|
-
-
|
|
1007
|
-
-
|
|
1008
|
-
-
|
|
1000
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.claude/agents/sr-architect.md`
|
|
1001
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.claude/agents/sr-developer.md`
|
|
1002
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.claude/agents/sr-reviewer.md`
|
|
1003
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.claude/agents/sr-test-writer.md`
|
|
1004
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.claude/agents/sr-security-reviewer.md`
|
|
1005
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.claude/agents/sr-product-manager.md`
|
|
1006
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.claude/agents/sr-product-analyst.md`
|
|
1007
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.claude/agents/sr-backend-developer.md` (if backend layer)
|
|
1008
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.claude/agents/sr-frontend-developer.md` (if frontend layer)
|
|
1009
1009
|
|
|
1010
1010
|
**If `cli_provider == "codex"`:**
|
|
1011
|
-
-
|
|
1012
|
-
-
|
|
1013
|
-
-
|
|
1014
|
-
-
|
|
1015
|
-
-
|
|
1016
|
-
-
|
|
1017
|
-
-
|
|
1018
|
-
-
|
|
1019
|
-
-
|
|
1011
|
+
- `.specrails/setup-templates/agents/sr-architect.md` → `.codex/agents/sr-architect.toml`
|
|
1012
|
+
- `.specrails/setup-templates/agents/sr-developer.md` → `.codex/agents/sr-developer.toml`
|
|
1013
|
+
- `.specrails/setup-templates/agents/sr-reviewer.md` → `.codex/agents/sr-reviewer.toml`
|
|
1014
|
+
- `.specrails/setup-templates/agents/sr-test-writer.md` → `.codex/agents/sr-test-writer.toml`
|
|
1015
|
+
- `.specrails/setup-templates/agents/sr-security-reviewer.md` → `.codex/agents/sr-security-reviewer.toml`
|
|
1016
|
+
- `.specrails/setup-templates/agents/sr-product-manager.md` → `.codex/agents/sr-product-manager.toml`
|
|
1017
|
+
- `.specrails/setup-templates/agents/sr-product-analyst.md` → `.codex/agents/sr-product-analyst.toml`
|
|
1018
|
+
- `.specrails/setup-templates/agents/sr-backend-developer.md` → `.codex/agents/sr-backend-developer.toml` (if backend layer)
|
|
1019
|
+
- `.specrails/setup-templates/agents/sr-frontend-developer.md` → `.codex/agents/sr-frontend-developer.toml` (if frontend layer)
|
|
1020
1020
|
|
|
1021
1021
|
When generating each agent:
|
|
1022
1022
|
1. Read the template
|
|
@@ -1058,7 +1058,7 @@ When generating each agent:
|
|
|
1058
1058
|
### 4.2 Generate personas
|
|
1059
1059
|
|
|
1060
1060
|
If IS_OSS=true:
|
|
1061
|
-
1. Copy
|
|
1061
|
+
1. Copy `.specrails/setup-templates/personas/the-maintainer.md` to `$SPECRAILS_DIR/agents/personas/the-maintainer.md`
|
|
1062
1062
|
2. Log: "Maintainer persona included"
|
|
1063
1063
|
3. Set MAINTAINER_INCLUDED=true for use in template substitution
|
|
1064
1064
|
4. Set `{{MAINTAINER_PERSONA_LINE}}` = `- \`$SPECRAILS_DIR/agents/personas/the-maintainer.md\` — "Kai" the Maintainer (open-source maintainer)`
|
|
@@ -1078,26 +1078,26 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
|
|
|
1078
1078
|
For each selected command, read the template and adapt.
|
|
1079
1079
|
|
|
1080
1080
|
**If `cli_provider == "claude"` (default):**
|
|
1081
|
-
-
|
|
1082
|
-
-
|
|
1083
|
-
-
|
|
1084
|
-
-
|
|
1085
|
-
-
|
|
1086
|
-
-
|
|
1087
|
-
-
|
|
1088
|
-
-
|
|
1081
|
+
- `.specrails/setup-templates/commands/specrails/implement.md` → `.claude/commands/specrails/implement.md`
|
|
1082
|
+
- `.specrails/setup-templates/commands/specrails/batch-implement.md` → `.claude/commands/specrails/batch-implement.md`
|
|
1083
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.claude/commands/specrails/propose-spec.md`
|
|
1084
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.claude/commands/specrails/get-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1085
|
+
- `.specrails/setup-templates/commands/specrails/auto-propose-backlog-specs.md` → `.claude/commands/specrails/auto-propose-backlog-specs.md` (if `BACKLOG_PROVIDER != none`)
|
|
1086
|
+
- `.specrails/setup-templates/commands/specrails/compat-check.md` → `.claude/commands/specrails/compat-check.md`
|
|
1087
|
+
- `.specrails/setup-templates/commands/specrails/refactor-recommender.md` → `.claude/commands/specrails/refactor-recommender.md`
|
|
1088
|
+
- `.specrails/setup-templates/commands/specrails/why.md` → `.claude/commands/specrails/why.md`
|
|
1089
1089
|
|
|
1090
1090
|
**If `cli_provider == "codex"`:**
|
|
1091
|
-
-
|
|
1092
|
-
-
|
|
1093
|
-
-
|
|
1094
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
-
|
|
1098
|
-
-
|
|
1099
|
-
|
|
1100
|
-
**Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in
|
|
1091
|
+
- `.specrails/setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
|
|
1092
|
+
- `.specrails/setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
|
|
1093
|
+
- `.specrails/setup-templates/commands/specrails/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
|
|
1094
|
+
- `.specrails/setup-templates/commands/specrails/get-backlog-specs.md` → `.agents/skills/sr-get-backlog-specs/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
|
|
1095
|
+
- `.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)
|
|
1096
|
+
- `.specrails/setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
|
|
1097
|
+
- `.specrails/setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
|
|
1098
|
+
- `.specrails/setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
|
|
1099
|
+
|
|
1100
|
+
**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
1101
|
```yaml
|
|
1102
1102
|
---
|
|
1103
1103
|
name: sr-<name>
|
|
@@ -1199,7 +1199,7 @@ The command templates use `{{BACKLOG_FETCH_CMD}}`, `{{BACKLOG_CREATE_CMD}}`, `{{
|
|
|
1199
1199
|
### 4.4 Generate rules
|
|
1200
1200
|
|
|
1201
1201
|
For each detected layer, read the layer rule template and generate a layer-specific rules file:
|
|
1202
|
-
-
|
|
1202
|
+
- `.specrails/setup-templates/rules/layer.md` → `$SPECRAILS_DIR/rules/{layer-name}.md`
|
|
1203
1203
|
|
|
1204
1204
|
Each rule file must:
|
|
1205
1205
|
- Have the correct `paths:` frontmatter matching the layer's directory
|
|
@@ -1214,7 +1214,7 @@ Each rule file must:
|
|
|
1214
1214
|
|
|
1215
1215
|
### 4.6 Generate settings
|
|
1216
1216
|
|
|
1217
|
-
Read `.
|
|
1217
|
+
Read `.specrails/setup-templates/.provider-detection.json` (written by `install.sh`) to determine `cli_provider` (`"claude"` or `"codex"`).
|
|
1218
1218
|
|
|
1219
1219
|
**If `cli_provider == "claude"` (default):**
|
|
1220
1220
|
|
|
@@ -1227,9 +1227,9 @@ Create or merge `.claude/settings.json` with permissions for:
|
|
|
1227
1227
|
|
|
1228
1228
|
**If `cli_provider == "codex"`:**
|
|
1229
1229
|
|
|
1230
|
-
1. Read
|
|
1230
|
+
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
1231
|
|
|
1232
|
-
2. Read
|
|
1232
|
+
2. Read `.specrails/setup-templates/settings/codex-rules.star`. Replace `{{CODEX_SHELL_RULES}}` with Starlark `prefix_rule(...)` lines for each detected tool allowance:
|
|
1233
1233
|
|
|
1234
1234
|
| Detected tool/command | Starlark rule |
|
|
1235
1235
|
|----------------------|---------------|
|
|
@@ -1268,7 +1268,7 @@ The setup process installed temporary files that are only needed during installa
|
|
|
1268
1268
|
|
|
1269
1269
|
```bash
|
|
1270
1270
|
# 1. Remove setup templates (used as structural references during generation)
|
|
1271
|
-
rm -rf .
|
|
1271
|
+
rm -rf .specrails/setup-templates/
|
|
1272
1272
|
|
|
1273
1273
|
# 2. Remove the /specrails:setup command itself — it's a one-time installer, not a permanent command
|
|
1274
1274
|
rm -f .claude/commands/setup.md
|
|
@@ -1281,7 +1281,7 @@ rm -f .claude/commands/setup.md
|
|
|
1281
1281
|
**What gets removed:**
|
|
1282
1282
|
| Artifact | Why |
|
|
1283
1283
|
|----------|-----|
|
|
1284
|
-
| `.
|
|
1284
|
+
| `.specrails/setup-templates/` | Temporary — templates already rendered into final files |
|
|
1285
1285
|
| `.claude/commands/setup.md` | One-time installer — running it again would overwrite customized agents |
|
|
1286
1286
|
|
|
1287
1287
|
**What to do with `specrails/`:**
|
|
@@ -1327,7 +1327,7 @@ ls .codex/rules/*.md
|
|
|
1327
1327
|
ls .codex/agent-memory/
|
|
1328
1328
|
|
|
1329
1329
|
# These should NOT exist (scaffolding):
|
|
1330
|
-
#
|
|
1330
|
+
# .specrails/setup-templates/ — GONE
|
|
1331
1331
|
# If cli_provider == "claude": $SPECRAILS_DIR/commands/setup.md — GONE
|
|
1332
1332
|
# If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
|
|
1333
1333
|
```
|
|
@@ -1402,7 +1402,7 @@ Note: Only commands/skills selected during setup are shown. Backlog commands are
|
|
|
1402
1402
|
### Scaffolding Removed
|
|
1403
1403
|
| Artifact | Status |
|
|
1404
1404
|
|----------|--------|
|
|
1405
|
-
|
|
|
1405
|
+
| .specrails/setup-templates/ | Deleted |
|
|
1406
1406
|
[If cli_provider == "claude":] | .claude/commands/setup.md | Deleted |
|
|
1407
1407
|
[If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
|
|
1408
1408
|
| 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 ""
|