specrails-core 2.1.1 → 3.0.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/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![npm downloads](https://img.shields.io/npm/dw/specrails-core.svg)](https://www.npmjs.com/package/specrails-core)
7
7
  [![Claude Code](https://img.shields.io/badge/Built%20for-Claude%20Code-blueviolet)](https://docs.anthropic.com/en/docs/claude-code)
8
+ [![Codex](https://img.shields.io/badge/Built%20for-OpenAI%20Codex-412991)](https://github.com/openai/codex)
8
9
 
9
10
  **Your AI development team. From idea to production code.**
10
11
 
@@ -14,7 +15,7 @@ One command gives your repo a full team of specialized AI agents: architect, dev
14
15
  npx specrails-core@latest init --root-dir .
15
16
  ```
16
17
 
17
- > **Requirements:** [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (required), Node 18+, git
18
+ > **Requirements:** [Claude Code](https://docs.anthropic.com/en/docs/claude-code) or [Codex CLI](https://github.com/openai/codex) (choose one), Node 18+, git
18
19
 
19
20
  <!--
20
21
  BOARD: Add demo GIF here — this is the #1 conversion driver on Product Hunt and npm.
@@ -51,10 +52,12 @@ Every artifact (agents, rules, personas) is generated **specifically for your pr
51
52
  npx specrails-core@latest init --root-dir .
52
53
  ```
53
54
 
54
- **2. Run setup inside Claude Code**
55
+ **2. Run setup inside your AI CLI**
55
56
 
56
57
  ```bash
57
- claude # open Claude Code in your project
58
+ claude # Claude Code
59
+ # or
60
+ codex # OpenAI Codex (beta)
58
61
  > /setup # run the 5-phase wizard (~5 min)
59
62
  ```
60
63
 
package/commands/setup.md CHANGED
@@ -176,8 +176,10 @@ grep -r '{{[A-Z_]*}}' .codex/agents/sr-*.toml 2>/dev/null || echo "OK: no broken
176
176
 
177
177
  For each command in the "changed commands" list from Phase U3:
178
178
 
179
- 1. Read the NEW template from `.claude/setup-templates/commands/sr/<name>.md`
180
- 2. Read stored backlog configuration from `.claude/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
179
+ 1. Read the NEW template:
180
+ - If `cli_provider == "claude"`: from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md`
181
+ - If `cli_provider == "codex"`: from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md`
182
+ 2. Read stored backlog configuration from `$SPECRAILS_DIR/backlog-config.json` (if it exists) to resolve provider-specific placeholders:
181
183
  - `BACKLOG_PROVIDER` → `provider` field (`github`, `jira`, or `none`)
182
184
  - `BACKLOG_WRITE` → `write_access` field
183
185
  - `JIRA_BASE_URL` → `jira_base_url` field
@@ -192,12 +194,19 @@ For each command in the "changed commands" list from Phase U3:
192
194
  - `{{BACKLOG_VIEW_CMD}}` → provider-specific view command from backlog config
193
195
  - `{{BACKLOG_PREFLIGHT}}` → provider-specific preflight check from backlog config
194
196
  - Any other `{{PLACEHOLDER}}` values → use Phase U2 analysis data
195
- 4. Write the updated command to `.claude/commands/sr/<name>.md`
196
- 5. Show: `✓ Updated /sr:<name>`
197
-
198
- After updating all changed commands, verify no unresolved placeholders remain in the updated files:
197
+ 4. Write the updated file:
198
+ - If `cli_provider == "claude"`: to `.claude/commands/sr/<name>.md`
199
+ - If `cli_provider == "codex"`: to `.agents/skills/sr-<name>/SKILL.md`
200
+ 5. Show:
201
+ - If `cli_provider == "claude"`: `✓ Updated /sr:<name>`
202
+ - If `cli_provider == "codex"`: `✓ Updated $sr-<name>`
203
+
204
+ After updating all changed commands/skills, verify no unresolved placeholders remain:
199
205
  ```bash
206
+ # If cli_provider == "claude":
200
207
  grep -l '{{[A-Z_]*}}' .claude/commands/sr/*.md 2>/dev/null || echo "OK: no broken placeholders"
208
+ # If cli_provider == "codex":
209
+ grep -rl '{{[A-Z_]*}}' .agents/skills/sr-*/SKILL.md 2>/dev/null || echo "OK: no broken placeholders"
201
210
  ```
202
211
  If any placeholders remain unresolved, warn the user:
203
212
  > "⚠ Some placeholders in `<filename>` could not be resolved automatically. Please review the file and fill them in manually."
@@ -221,24 +230,32 @@ For each agent in the "new" list:
221
230
 
222
231
  For each command in the "new commands" list from Phase U3:
223
232
 
224
- 1. Read the template from `.claude/setup-templates/commands/sr/<name>.md` to understand what it does (read the title and description)
233
+ 1. Read the template:
234
+ - If `cli_provider == "claude"`: from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md`
235
+ - If `cli_provider == "codex"`: from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md`
225
236
  2. Prompt the user:
226
- > "New command available: `/sr:<name>` — [one-line description from template]. Install it? [Y/n]"
237
+ - If `cli_provider == "claude"`: `"New command available: /sr:<name> — [one-line description]. Install it? [Y/n]"`
238
+ - If `cli_provider == "codex"`: `"New skill available: $sr-<name> — [one-line description]. Install it? [Y/n]"`
227
239
  3. If the user accepts (or presses Enter):
228
240
  - Apply placeholder substitution using the same rules as Phase U4b (backlog config + codebase analysis)
229
- - Write the command to `.claude/commands/sr/<name>.md`
230
- - Show: `✓ Added /sr:<name>`
241
+ - If `cli_provider == "claude"`: write to `.claude/commands/sr/<name>.md` — show `✓ Added /sr:<name>`
242
+ - If `cli_provider == "codex"`: write to `.agents/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name>`
231
243
  4. If the user declines:
232
- - Show: `→ Skipped /sr:<name>`
244
+ - If `cli_provider == "claude"`: show `→ Skipped /sr:<name>`
245
+ - If `cli_provider == "codex"`: show `→ Skipped $sr-<name>`
233
246
 
234
247
  ### Phase U6: Update Workflow Commands
235
248
 
236
249
  If any new agents were added in Phase U5:
237
250
 
238
- 1. Read `.claude/commands/sr/implement.md`
251
+ 1. Read the implement command/skill:
252
+ - If `cli_provider == "claude"`: `.claude/commands/sr/implement.md`
253
+ - If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
239
254
  2. Check if the file references agent names in its orchestration steps (look for `sr-architect`, `sr-developer`, `sr-reviewer` etc.)
240
255
  3. If newly added agents belong in the implementation pipeline (i.e., they are layer-specific developers such as `sr-frontend-developer` or `sr-backend-developer`), add them to the appropriate step in the implement command — specifically where parallel developer agents are launched
241
- 4. Write the updated `.claude/commands/sr/implement.md` if any changes were made
256
+ 4. Write the updated file if any changes were made:
257
+ - If `cli_provider == "claude"`: `.claude/commands/sr/implement.md`
258
+ - If `cli_provider == "codex"`: `.agents/skills/sr-implement/SKILL.md`
242
259
  5. Show which commands were updated, or "No command updates needed" if nothing changed
243
260
 
244
261
  This is a lightweight check — only update commands where the sr- agent clearly belongs. Do not restructure the entire command.
@@ -341,20 +358,31 @@ Store as `QS_IS_EXISTING_CODEBASE=true/false`.
341
358
 
342
359
  Before generating files, check if this is a re-run:
343
360
 
344
- 1. Check if `.claude/commands/sr/` directory exists with any `.md` files:
345
- ```bash
346
- ls .claude/commands/sr/*.md 2>/dev/null
347
- ```
348
- 2. If `.md` files are found → this is a **re-run**. Store `QS_IS_RERUN=true`.
361
+ 1. Check if commands/skills already exist:
362
+ - If `cli_provider == "claude"`: check if `.claude/commands/sr/` directory exists with any `.md` files:
363
+ ```bash
364
+ ls .claude/commands/sr/*.md 2>/dev/null
365
+ ```
366
+ - If `cli_provider == "codex"`: check if `.agents/skills/sr-*/SKILL.md` files exist:
367
+ ```bash
368
+ ls .agents/skills/sr-*/SKILL.md 2>/dev/null
369
+ ```
370
+ 2. If files are found → this is a **re-run**. Store `QS_IS_RERUN=true`.
349
371
  3. If the directory does not exist or is empty → this is a **fresh install**. Store `QS_IS_RERUN=false`.
350
372
 
351
- In re-run mode, QS3 executes in **gap-fill mode** for command files:
352
- - For each command in the list, check if it already exists at `.claude/commands/sr/<name>.md`
353
- - If it exists: skip it and show `✓ Already installed: /sr:<name>`
354
- - If it does NOT exist: install it and show `✓ Added /sr:<name> (was missing)`
373
+ In re-run mode, QS3 executes in **gap-fill mode** for command/skill files:
374
+ - For each command in the list, check if it already exists:
375
+ - If `cli_provider == "claude"`: at `.claude/commands/sr/<name>.md`
376
+ - If `cli_provider == "codex"`: at `.agents/skills/sr-<name>/SKILL.md`
377
+ - If it exists: skip it and show:
378
+ - Claude: `✓ Already installed: /sr:<name>`
379
+ - Codex: `✓ Already installed: $sr-<name>`
380
+ - If it does NOT exist: install it and show:
381
+ - Claude: `✓ Added /sr:<name> (was missing)`
382
+ - Codex: `✓ Added $sr-<name> (was missing)`
355
383
  - Do NOT prompt the user for confirmation on missing files — install them automatically
356
384
 
357
- For CLAUDE.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
385
+ For CLAUDE.md/AGENTS.md and agent files, the existing per-file prompts already handle re-runs (user is asked before overwriting). No change needed there.
358
386
 
359
387
  ### QS3: Generate files
360
388
 
@@ -404,11 +432,21 @@ Core commands (always install if missing):
404
432
 
405
433
  Do NOT copy `product-backlog.md` or `update-product-driven-backlog.md` (no backlog provider configured).
406
434
 
407
- If `QS_IS_RERUN=false` (fresh install): copy all core commands from `setup-templates/commands/sr/` to `.claude/commands/sr/`.
435
+ **If `cli_provider == "claude"`:**
436
+
437
+ If `QS_IS_RERUN=false` (fresh install): copy all core commands from `$SPECRAILS_DIR/setup-templates/commands/sr/` to `.claude/commands/sr/`.
408
438
 
409
439
  If `QS_IS_RERUN=true` (gap-fill mode): for each command in the list above, check if `.claude/commands/sr/<name>.md` already exists:
410
440
  - If it exists: skip it — show `✓ Already installed: /sr:<name>`
411
- - If it does NOT exist: copy from `setup-templates/commands/sr/<name>.md` — show `✓ Added /sr:<name> (was missing)`
441
+ - If it does NOT exist: copy from `$SPECRAILS_DIR/setup-templates/commands/sr/<name>.md` — show `✓ Added /sr:<name> (was missing)`
442
+
443
+ **If `cli_provider == "codex"`:**
444
+
445
+ If `QS_IS_RERUN=false` (fresh install): for each core command, copy the corresponding skill from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md` to `.agents/skills/sr-<name>/SKILL.md` (create the directory first).
446
+
447
+ 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:
448
+ - If it exists: skip it — show `✓ Already installed: $sr-<name>`
449
+ - If it does NOT exist: copy from `$SPECRAILS_DIR/setup-templates/skills/sr-<name>/SKILL.md` — show `✓ Added $sr-<name> (was missing)`
412
450
 
413
451
  **4. Cleanup**
414
452
 
@@ -954,9 +992,11 @@ Write each persona to `$SPECRAILS_DIR/agents/personas/`:
954
992
  - Use the VPC personas generated in Phase 2
955
993
  - File naming: kebab-case of persona nickname (e.g., `the-developer.md`, `the-admin.md`)
956
994
 
957
- ### 4.3 Generate commands
995
+ ### 4.3 Generate commands / skills
958
996
 
959
- For each selected command, read the template and adapt:
997
+ For each selected command, read the template and adapt.
998
+
999
+ **If `cli_provider == "claude"` (default):**
960
1000
  - `setup-templates/commands/sr/implement.md` → `.claude/commands/sr/implement.md`
961
1001
  - `setup-templates/commands/sr/batch-implement.md` → `.claude/commands/sr/batch-implement.md`
962
1002
  - `setup-templates/commands/sr/propose-spec.md` → `.claude/commands/sr/propose-spec.md`
@@ -967,6 +1007,32 @@ For each selected command, read the template and adapt:
967
1007
  - `setup-templates/commands/sr/refactor-recommender.md` → `.claude/commands/sr/refactor-recommender.md`
968
1008
  - `setup-templates/commands/sr/why.md` → `.claude/commands/sr/why.md`
969
1009
 
1010
+ **If `cli_provider == "codex"`:**
1011
+ - `setup-templates/skills/sr-implement/SKILL.md` → `.agents/skills/sr-implement/SKILL.md`
1012
+ - `setup-templates/skills/sr-batch-implement/SKILL.md` → `.agents/skills/sr-batch-implement/SKILL.md`
1013
+ - `setup-templates/commands/sr/propose-spec.md` → `.agents/skills/sr-propose-spec/SKILL.md` (wrap with YAML frontmatter if no skill template exists)
1014
+ - `setup-templates/commands/sr/product-backlog.md` → `.agents/skills/sr-product-backlog/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
1015
+ - `setup-templates/commands/sr/update-product-driven-backlog.md` → `.agents/skills/sr-update-product-driven-backlog/SKILL.md` (if `BACKLOG_PROVIDER != none`; wrap with frontmatter)
1016
+ - `setup-templates/skills/sr-health-check/SKILL.md` → `.agents/skills/sr-health-check/SKILL.md`
1017
+ - `setup-templates/skills/sr-compat-check/SKILL.md` → `.agents/skills/sr-compat-check/SKILL.md`
1018
+ - `setup-templates/skills/sr-refactor-recommender/SKILL.md` → `.agents/skills/sr-refactor-recommender/SKILL.md`
1019
+ - `setup-templates/skills/sr-why/SKILL.md` → `.agents/skills/sr-why/SKILL.md`
1020
+
1021
+ **Codex skill frontmatter wrapping:** When a dedicated skill template does not exist in `setup-templates/skills/` for a command, generate the `SKILL.md` by prepending YAML frontmatter to the command content:
1022
+ ```yaml
1023
+ ---
1024
+ name: sr-<name>
1025
+ description: "<one-line description from the command's first heading>"
1026
+ license: MIT
1027
+ compatibility: "Requires git."
1028
+ metadata:
1029
+ author: specrails
1030
+ version: "1.0"
1031
+ ---
1032
+ ```
1033
+
1034
+ For both providers, create the output directory before writing (`mkdir -p` for `.claude/commands/sr/` or `.agents/skills/sr-<name>/`).
1035
+
970
1036
  Adapt:
971
1037
  - CI commands to match detected stack
972
1038
  - **Persona references** to match generated personas (see substitution rules below)
@@ -980,7 +1046,7 @@ When adapting `update-product-driven-backlog.md` and `product-backlog.md`, subst
980
1046
 
981
1047
  | Placeholder | Substitution rule |
982
1048
  |-------------|------------------|
983
- | `{{PERSONA_FILE_READ_LIST}}` | One bullet per persona file: `- Read \`.claude/agents/personas/{name}.md\`` |
1049
+ | `{{PERSONA_FILE_READ_LIST}}` | One bullet per persona file: `- Read \`$SPECRAILS_DIR/agents/personas/{name}.md\`` |
984
1050
  | `{{PERSONA_SCORE_HEADERS}}` | Column headers for each persona nickname: e.g., `Alex \| Sara \| Kai` |
985
1051
  | `{{PERSONA_SCORE_SEPARATORS}}` | One `------` separator per persona column |
986
1052
  | `{{PERSONA_FIT_FORMAT}}` | Inline score display: e.g., `Alex: X/5, Sara: X/5, Kai: X/5` |
@@ -1017,7 +1083,7 @@ When adapting `update-product-driven-backlog.md` and `product-backlog.md`, subst
1017
1083
  - Issue view: `jira issue view {key}` or REST API
1018
1084
  - VPC scores stored in the issue description body (same markdown format, parsed from description)
1019
1085
  - Pre-flight check: `jira me` or test API connectivity
1020
- - Store JIRA config in `.claude/backlog-config.json`:
1086
+ - Store JIRA config in `$SPECRAILS_DIR/backlog-config.json`:
1021
1087
  ```json
1022
1088
  {
1023
1089
  "provider": "jira",
@@ -1033,16 +1099,18 @@ The command templates use `{{BACKLOG_FETCH_CMD}}`, `{{BACKLOG_CREATE_CMD}}`, `{{
1033
1099
  ### 4.4 Generate rules
1034
1100
 
1035
1101
  For each detected layer, read the layer rule template and generate a layer-specific rules file:
1036
- - `setup-templates/rules/layer.md` → `.claude/rules/{layer-name}.md`
1102
+ - `setup-templates/rules/layer.md` → `$SPECRAILS_DIR/rules/{layer-name}.md`
1037
1103
 
1038
1104
  Each rule file must:
1039
1105
  - Have the correct `paths:` frontmatter matching the layer's directory
1040
1106
  - Contain conventions specific to that layer (from Phase 1 analysis)
1041
1107
  - Reference actual file paths and patterns from the codebase
1042
1108
 
1043
- ### 4.5 Generate root CLAUDE.md
1109
+ ### 4.5 Generate root instructions file
1044
1110
 
1045
- If no CLAUDE.md exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1111
+ **If `cli_provider == "claude"`:** If no `CLAUDE.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1112
+
1113
+ **If `cli_provider == "codex"`:** If no `AGENTS.md` exists, generate one from the template. If one already exists, **merge** — add the agent workflow sections without removing existing content.
1046
1114
 
1047
1115
  ### 4.6 Generate settings
1048
1116
 
@@ -1154,13 +1222,14 @@ ls .claude/agent-memory/
1154
1222
  # If cli_provider == "codex":
1155
1223
  ls .codex/agents/sr-*.toml
1156
1224
  ls .codex/agents/personas/*.md
1157
- ls .codex/skills/sr-*/SKILL.md
1225
+ ls .agents/skills/sr-*/SKILL.md
1158
1226
  ls .codex/rules/*.md
1159
1227
  ls .codex/agent-memory/
1160
1228
 
1161
1229
  # These should NOT exist (scaffolding):
1162
1230
  # $SPECRAILS_DIR/setup-templates/ — GONE
1163
- # $SPECRAILS_DIR/commands/setup.md — GONE
1231
+ # If cli_provider == "claude": $SPECRAILS_DIR/commands/setup.md — GONE
1232
+ # If cli_provider == "codex": .agents/skills/setup/ — GONE (installer scaffold, not a generated sr-skill)
1164
1233
  ```
1165
1234
 
1166
1235
  If any scaffolding artifact remains, remove it.
@@ -1198,7 +1267,8 @@ Display the complete installation summary:
1198
1267
  [For each user-generated persona:]
1199
1268
  | "[Name]" — The [Role] | $SPECRAILS_DIR/agents/personas/[name].md | Generated |
1200
1269
 
1201
- ### Commands Installed
1270
+ ### Commands / Skills Installed
1271
+ [If cli_provider == "claude":]
1202
1272
  | Command | File |
1203
1273
  |---------|------|
1204
1274
  | /sr:implement | .claude/commands/sr/implement.md |
@@ -1210,33 +1280,58 @@ Display the complete installation summary:
1210
1280
  | /sr:compat-check | .claude/commands/sr/compat-check.md |
1211
1281
  | /sr:refactor-recommender | .claude/commands/sr/refactor-recommender.md |
1212
1282
  | /sr:why | .claude/commands/sr/why.md |
1213
-
1214
- Note: Only commands selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
1283
+ [If cli_provider == "codex":]
1284
+ | Skill | File |
1285
+ |-------|------|
1286
+ | $sr-implement | .agents/skills/sr-implement/SKILL.md |
1287
+ | $sr-batch-implement | .agents/skills/sr-batch-implement/SKILL.md |
1288
+ | $sr-propose-spec | .agents/skills/sr-propose-spec/SKILL.md |
1289
+ | $sr-product-backlog | .agents/skills/sr-product-backlog/SKILL.md |
1290
+ | $sr-update-product-driven-backlog | .agents/skills/sr-update-product-driven-backlog/SKILL.md |
1291
+ | $sr-health-check | .agents/skills/sr-health-check/SKILL.md |
1292
+ | $sr-compat-check | .agents/skills/sr-compat-check/SKILL.md |
1293
+ | $sr-refactor-recommender | .agents/skills/sr-refactor-recommender/SKILL.md |
1294
+ | $sr-why | .agents/skills/sr-why/SKILL.md |
1295
+
1296
+ Note: Only commands/skills selected during setup are shown. Backlog commands are excluded if no backlog provider was configured.
1215
1297
 
1216
1298
  ### Rules Created
1217
1299
  | Layer | File |
1218
1300
  |-------|------|
1219
- | Backend | .claude/rules/backend.md |
1220
- | Frontend | .claude/rules/frontend.md |
1301
+ | Backend | $SPECRAILS_DIR/rules/backend.md |
1302
+ | Frontend | $SPECRAILS_DIR/rules/frontend.md |
1221
1303
 
1222
1304
  ### Scaffolding Removed
1223
1305
  | Artifact | Status |
1224
1306
  |----------|--------|
1225
- | .claude/setup-templates/ | Deleted |
1226
- | .claude/commands/setup.md | Deleted |
1307
+ | $SPECRAILS_DIR/setup-templates/ | Deleted |
1308
+ [If cli_provider == "claude":] | .claude/commands/setup.md | Deleted |
1309
+ [If cli_provider == "codex":] | .agents/skills/setup/ | Deleted |
1227
1310
  | specrails/ | [User's choice] |
1228
1311
 
1229
1312
  ### Next Steps
1313
+ [If cli_provider == "claude":]
1230
1314
  1. Review the generated files in .claude/
1231
1315
  2. Run `/sr:product-backlog` to see your backlog (if GitHub Issues exist)
1232
1316
  3. Run `/sr:update-product-driven-backlog` to generate feature ideas
1233
1317
  4. Run `/sr:implement #issue-number` to implement a feature
1234
1318
  5. Commit the .claude/ directory to version control
1319
+ [If cli_provider == "codex":]
1320
+ 1. Review the generated files in .codex/ and .agents/skills/
1321
+ 2. Run `$sr-product-backlog` to see your backlog (if GitHub Issues exist)
1322
+ 3. Run `$sr-update-product-driven-backlog` to generate feature ideas
1323
+ 4. Run `$sr-implement #issue-number` to implement a feature
1324
+ 5. Commit the .codex/ and .agents/ directories to version control
1235
1325
 
1236
1326
  ### Quick Start
1327
+ [If cli_provider == "claude":]
1237
1328
  - `/sr:implement "describe a feature"` — implement something right now
1238
1329
  - `/sr:product-backlog` — see prioritized feature ideas
1239
1330
  - `/sr:update-product-driven-backlog` — discover new features using VPC
1331
+ [If cli_provider == "codex":]
1332
+ - `$sr-implement "describe a feature"` — implement something right now
1333
+ - `$sr-product-backlog` — see prioritized feature ideas
1334
+ - `$sr-update-product-driven-backlog` — discover new features using VPC
1240
1335
  ```
1241
1336
 
1242
1337
  ## First Task Prompt (Advanced Mode)
@@ -1248,7 +1343,10 @@ After displaying the setup complete summary above, detect the project type and o
1248
1343
  ✅ Setup complete.
1249
1344
 
1250
1345
  Try your first spec:
1346
+ [If cli_provider == "claude":]
1251
1347
  > /sr:product-backlog
1348
+ [If cli_provider == "codex":]
1349
+ > $sr-product-backlog
1252
1350
  ```
1253
1351
 
1254
1352
  **Existing codebase** (one or more of the above files found in root):
@@ -1256,7 +1354,10 @@ Try your first spec:
1256
1354
  ✅ Setup complete.
1257
1355
 
1258
1356
  Try your first spec:
1357
+ [If cli_provider == "claude":]
1259
1358
  > /sr:health-check
1359
+ [If cli_provider == "codex":]
1360
+ > $sr-health-check
1260
1361
  ```
1261
1362
 
1262
1363
  Then stop.
@@ -37,15 +37,15 @@ Epic: [SPEA-505](/SPEA/issues/SPEA-505) — Codex Compatibility Approach B
37
37
  | Feature | Claude Code | Codex |
38
38
  |---------|:-:|:-:|
39
39
  | Legacy slash commands `.claude/commands/sr/` | ✅ | ❌ |
40
- | SKILL.md format `.claude/skills/sr-*/` | 🔄 | 🔄 |
41
- | `sr:implement` skill | ✅ | 🔄 |
42
- | `sr:product-backlog` skill | ✅ | 🔄 |
43
- | `sr:health-check` skill | ✅ | 🔄 |
44
- | `sr:compat-check` skill | ✅ | 🔄 |
45
- | `sr:why` skill | ✅ | 🔄 |
46
- | `sr:refactor-recommender` skill | ✅ | 🔄 |
47
- | `sr:batch-implement` skill | ✅ | 🔄 |
48
- | `sr:update-product-driven-backlog` skill | ✅ | 🔄 |
40
+ | SKILL.md format `.claude/skills/sr-*/` | | |
41
+ | `sr:implement` skill | ✅ | |
42
+ | `sr:product-backlog` skill | ✅ | |
43
+ | `sr:health-check` skill | ✅ | |
44
+ | `sr:compat-check` skill | ✅ | |
45
+ | `sr:why` skill | ✅ | |
46
+ | `sr:refactor-recommender` skill | ✅ | |
47
+ | `sr:batch-implement` skill | ✅ | |
48
+ | `sr:update-product-driven-backlog` skill | ✅ | |
49
49
  | Backward compat: slash commands still invoke correctly | ✅ | — |
50
50
 
51
51
  ### Permissions Configuration (SPEA-508)
@@ -76,12 +76,12 @@ Epic: [SPEA-505](/SPEA/issues/SPEA-505) — Codex Compatibility Approach B
76
76
 
77
77
  | Feature | Claude Code | Codex |
78
78
  |---------|:-:|:-:|
79
- | Hub detects claude binary | 🔄 | — |
80
- | Hub detects codex binary | — | 🔄 |
81
- | `integration-contract.json` v2 schema valid | 🔄 | 🔄 |
82
- | Hub invokes CLI with correct args | 🔄 | 🔄 |
83
- | Hub dashboard shows CLI badge | 🔄 | 🔄 |
84
- | Hub handles "no CLI detected" state | 🔄 | 🔄 |
79
+ | Hub detects claude binary | | — |
80
+ | Hub detects codex binary | — | |
81
+ | `integration-contract.json` v2 schema valid | | |
82
+ | Hub invokes CLI with correct args | | |
83
+ | Hub dashboard shows CLI badge | | |
84
+ | Hub handles "no CLI detected" state | | |
85
85
 
86
86
  ---
87
87
 
@@ -410,6 +410,7 @@ The `npx specrails-core@latest init` command accepts:
410
410
  |------|--------|
411
411
  | `--root-dir <path>` | Install into this directory (default: current directory) |
412
412
  | `--yes` / `-y` | Skip confirmation prompts |
413
+ | `--provider <claude\|codex>` | Force a specific AI CLI (default: auto-detect) |
413
414
 
414
415
  ---
415
416
 
@@ -177,7 +177,7 @@ codex --version
177
177
  If Codex is installed via a custom path, pass the provider explicitly:
178
178
 
179
179
  ```bash
180
- CLI_PROVIDER=codex npx specrails-core@latest init --root-dir .
180
+ npx specrails-core@latest init --root-dir . --provider codex
181
181
  ```
182
182
 
183
183
  ### Existing `.codex/` directory detected
@@ -13,7 +13,7 @@ SpecRails supports both **Claude Code** and **OpenAI Codex**. The installer dete
13
13
  | **Codex CLI** | Latest | Beta — `npm i -g @openai/codex` |
14
14
  | **Git** | Any | Your project must be a git repository |
15
15
 
16
- You need at least one of Claude Code or Codex CLI. If both are installed, the installer uses Claude Code by default. Override with `CLI_PROVIDER=codex`.
16
+ You need at least one of Claude Code or Codex CLI. If both are installed, the installer uses Claude Code by default. Override with `--provider codex` (or the env var `CLI_PROVIDER=codex`).
17
17
 
18
18
  Optional but recommended:
19
19
 
@@ -38,9 +38,16 @@ The installer copies agent templates, skills, and configuration files into `.cla
38
38
  |------|--------|
39
39
  | `--root-dir <path>` | Target directory (default: current directory) |
40
40
  | `--yes` / `-y` | Skip confirmation prompts |
41
+ | `--provider <claude\|codex>` | Force a specific AI CLI (default: auto-detect) |
41
42
 
42
43
  You can also force a specific provider:
43
44
 
45
+ ```bash
46
+ npx specrails-core@latest init --root-dir . --provider codex
47
+ ```
48
+
49
+ Alternatively, use the `CLI_PROVIDER` env var (legacy):
50
+
44
51
  ```bash
45
52
  CLI_PROVIDER=codex npx specrails-core@latest init --root-dir .
46
53
  ```
@@ -169,7 +176,7 @@ npm i -g @openai/codex
169
176
  Or force the provider if Codex is installed at a non-standard path:
170
177
 
171
178
  ```bash
172
- CLI_PROVIDER=codex npx specrails-core@latest init --root-dir .
179
+ npx specrails-core@latest init --root-dir . --provider codex
173
180
  ```
174
181
 
175
182
  ---
@@ -2,6 +2,8 @@
2
2
 
3
3
  Get SpecRails running in your project in under 10 minutes.
4
4
 
5
+ > **Using OpenAI Codex?** See the [Codex getting started guide](getting-started-codex.md) — setup is slightly different.
6
+
5
7
  ## Before you begin
6
8
 
7
9
  You need:
package/install.sh CHANGED
@@ -290,15 +290,24 @@ if [[ "$CLI_PROVIDER" == "claude" ]]; then
290
290
  fi
291
291
  else
292
292
  # Codex
293
+ CODEX_AUTHED=false
293
294
  if [[ -n "${OPENAI_API_KEY:-}" ]]; then
294
- ok "OpenAI API key: configured"
295
+ CODEX_AUTHED=true
296
+ elif codex login status 2>/dev/null | grep -qi "logged in"; then
297
+ CODEX_AUTHED=true
298
+ elif [[ -f "${HOME}/.codex/auth.json" ]] && grep -q '"access_token"' "${HOME}/.codex/auth.json" 2>/dev/null; then
299
+ CODEX_AUTHED=true
300
+ fi
301
+
302
+ if [[ "$CODEX_AUTHED" == "true" ]]; then
303
+ ok "Codex: authenticated"
295
304
  elif [[ "$SKIP_PREREQS" == "1" ]]; then
296
- warn "No OpenAI API key configured (skipped — SPECRAILS_SKIP_PREREQS=1)"
305
+ warn "Codex authentication not found (skipped — SPECRAILS_SKIP_PREREQS=1)"
297
306
  else
298
- fail "No OpenAI API key configured."
307
+ fail "No Codex authentication found."
299
308
  echo ""
300
- echo " Set it: export OPENAI_API_KEY=<your-key>"
301
- echo " Get one: https://platform.openai.com/api-keys"
309
+ echo " Option 1 (API key): export OPENAI_API_KEY=<your-key>"
310
+ echo " Option 2 (OAuth): codex login"
302
311
  exit 1
303
312
  fi
304
313
  fi
@@ -447,7 +456,13 @@ step "Phase 3: Installing specrails artifacts"
447
456
 
448
457
  # Create directory structure
449
458
  mkdir -p "$REPO_ROOT/specrails"
450
- mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/commands"
459
+ if [[ "$CLI_PROVIDER" == "codex" ]]; then
460
+ # Codex: install as Agent Skills (Codex doesn't support .codex/commands/)
461
+ mkdir -p "$REPO_ROOT/.agents/skills/setup"
462
+ mkdir -p "$REPO_ROOT/.agents/skills/doctor"
463
+ else
464
+ mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/commands"
465
+ fi
451
466
  mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/agents"
452
467
  mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/commands"
453
468
  mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/skills"
@@ -458,13 +473,46 @@ mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/settings"
458
473
  mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/setup-templates/prompts"
459
474
  mkdir -p "$REPO_ROOT/$SPECRAILS_DIR/agent-memory/explanations"
460
475
 
461
- # Copy the /setup command
462
- cp "$SCRIPT_DIR/commands/setup.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/setup.md"
463
- ok "Installed /setup command"
476
+ # Copy the /setup and /doctor commands (or skills for Codex)
477
+ if [[ "$CLI_PROVIDER" == "codex" ]]; then
478
+ # Codex uses Agent Skills in .agents/skills/<name>/SKILL.md
479
+ {
480
+ echo '---'
481
+ echo 'name: setup'
482
+ echo 'description: "Interactive wizard to configure the full specrails agent workflow system for this repository."'
483
+ echo 'license: MIT'
484
+ echo 'compatibility: "Requires npm, git."'
485
+ echo 'metadata:'
486
+ echo ' author: specrails'
487
+ echo ' version: "1.0"'
488
+ echo '---'
489
+ echo ''
490
+ cat "$SCRIPT_DIR/commands/setup.md"
491
+ } > "$REPO_ROOT/.agents/skills/setup/SKILL.md"
492
+ ok "Installed \$setup skill"
493
+
494
+ {
495
+ echo '---'
496
+ echo 'name: doctor'
497
+ echo 'description: "Health check for the specrails agent workflow system — validates agents, commands, rules, and configuration."'
498
+ echo 'license: MIT'
499
+ echo 'compatibility: "Requires npm, git."'
500
+ echo 'metadata:'
501
+ echo ' author: specrails'
502
+ echo ' version: "1.0"'
503
+ echo '---'
504
+ echo ''
505
+ cat "$SCRIPT_DIR/commands/doctor.md"
506
+ } > "$REPO_ROOT/.agents/skills/doctor/SKILL.md"
507
+ ok "Installed \$doctor skill"
508
+ else
509
+ # Claude Code uses commands in .claude/commands/
510
+ cp "$SCRIPT_DIR/commands/setup.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/setup.md"
511
+ ok "Installed /setup command"
464
512
 
465
- # Copy the /doctor command
466
- cp "$SCRIPT_DIR/commands/doctor.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/doctor.md"
467
- ok "Installed /doctor command"
513
+ cp "$SCRIPT_DIR/commands/doctor.md" "$REPO_ROOT/$SPECRAILS_DIR/commands/doctor.md"
514
+ ok "Installed /doctor command"
515
+ fi
468
516
 
469
517
  # Install bin/doctor.sh for standalone use
470
518
  mkdir -p "$REPO_ROOT/.specrails/bin"
@@ -543,7 +591,12 @@ echo ""
543
591
  echo " Provider: $CLI_PROVIDER → output to $SPECRAILS_DIR/"
544
592
  echo ""
545
593
  echo " Files installed:"
546
- echo " $SPECRAILS_DIR/commands/setup.md ← The /setup command"
594
+ if [[ "$CLI_PROVIDER" == "codex" ]]; then
595
+ echo " .agents/skills/setup/SKILL.md ← The \$setup skill"
596
+ echo " .agents/skills/doctor/SKILL.md ← The \$doctor skill"
597
+ else
598
+ echo " $SPECRAILS_DIR/commands/setup.md ← The /setup command"
599
+ fi
547
600
  echo " $SPECRAILS_DIR/setup-templates/ ← Templates: commands + skills (temporary, removed after setup)"
548
601
  echo " .specrails-version ← Installed specrails version"
549
602
  echo " .specrails-manifest.json ← Artifact checksums for update detection"
@@ -565,7 +618,11 @@ echo -e " ${BOLD}cd $REPO_ROOT && $CLI_PROVIDER${NC}"
565
618
  echo ""
566
619
  echo " 2. Run the setup wizard:"
567
620
  echo ""
568
- echo -e " ${BOLD}/setup${NC}"
621
+ if [[ "$CLI_PROVIDER" == "codex" ]]; then
622
+ echo -e " ${BOLD}\$setup${NC}"
623
+ else
624
+ echo -e " ${BOLD}/setup${NC}"
625
+ fi
569
626
  echo ""
570
627
  if [[ "$CLI_PROVIDER" == "codex" ]]; then
571
628
  echo " Codex will analyze your codebase, ask about your users,"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specrails-core",
3
- "version": "2.1.1",
3
+ "version": "3.0.0",
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"