specrails-core 4.12.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +103 -339
  2. package/bin/specrails-core.mjs +20 -98
  3. package/bin/tui-installer.mjs +22 -105
  4. package/commands/doctor.md +1 -1
  5. package/dist/installer/cli.js +16 -2
  6. package/dist/installer/cli.js.map +1 -1
  7. package/dist/installer/commands/doctor.js +3 -5
  8. package/dist/installer/commands/doctor.js.map +1 -1
  9. package/dist/installer/commands/framework.js +64 -49
  10. package/dist/installer/commands/framework.js.map +1 -1
  11. package/dist/installer/commands/init.js +122 -82
  12. package/dist/installer/commands/init.js.map +1 -1
  13. package/dist/installer/commands/update.js +90 -83
  14. package/dist/installer/commands/update.js.map +1 -1
  15. package/dist/installer/commands/v5-migration.js +133 -0
  16. package/dist/installer/commands/v5-migration.js.map +1 -0
  17. package/dist/installer/phases/framework-lifecycle.js +2 -0
  18. package/dist/installer/phases/framework-lifecycle.js.map +1 -1
  19. package/dist/installer/phases/install-config.js +3 -6
  20. package/dist/installer/phases/install-config.js.map +1 -1
  21. package/dist/installer/phases/manifest.js +2 -6
  22. package/dist/installer/phases/manifest.js.map +1 -1
  23. package/dist/installer/phases/prereqs.js +0 -1
  24. package/dist/installer/phases/prereqs.js.map +1 -1
  25. package/dist/installer/phases/scaffold.js +228 -405
  26. package/dist/installer/phases/scaffold.js.map +1 -1
  27. package/dist/installer/runtime/pipeline-state.js +801 -0
  28. package/dist/installer/runtime/pipeline-state.js.map +1 -0
  29. package/dist/installer/util/install-transaction.js +246 -0
  30. package/dist/installer/util/install-transaction.js.map +1 -0
  31. package/dist/installer/util/registry.js +20 -0
  32. package/dist/installer/util/registry.js.map +1 -1
  33. package/docs/ci-cd.md +57 -0
  34. package/docs/user-docs/codex-vs-claude-code.md +23 -151
  35. package/docs/user-docs/core-updates.md +70 -0
  36. package/docs/user-docs/provider-pipelines.md +53 -0
  37. package/integration-contract.json +179 -66
  38. package/package.json +5 -2
  39. package/schemas/profile.v1.json +1 -1
  40. package/templates/agents/sr-architect.md +30 -0
  41. package/templates/agents/sr-developer.md +30 -19
  42. package/templates/agents/sr-reviewer.md +70 -64
  43. package/templates/codex-skills/batch-implement/SKILL.md +58 -267
  44. package/templates/codex-skills/implement/SKILL.md +136 -420
  45. package/templates/codex-skills/rails/sr-architect/SKILL.md +45 -20
  46. package/templates/codex-skills/rails/sr-developer/SKILL.md +42 -10
  47. package/templates/codex-skills/rails/sr-reviewer/SKILL.md +60 -15
  48. package/templates/codex-skills/retry/SKILL.md +37 -117
  49. package/templates/commands/specrails/batch-implement.md +16 -288
  50. package/templates/commands/specrails/doctor.md +1 -1
  51. package/templates/commands/specrails/implement.md +94 -1260
  52. package/templates/commands/specrails/memory-inspect.md +6 -4
  53. package/templates/commands/specrails/propose-spec.md +1 -1
  54. package/templates/commands/specrails/refactor-recommender.md +8 -51
  55. package/templates/commands/specrails/retry.md +22 -350
  56. package/templates/commands/specrails/telemetry.md +1 -1
  57. package/templates/gemini-commands/batch-implement.toml +28 -40
  58. package/templates/gemini-commands/implement.toml +55 -105
  59. package/templates/gemini-commands/retry.toml +21 -0
  60. package/templates/kimi/specrails/run-skill.mjs +51 -2
  61. package/templates/profiles/default.json +5 -18
  62. package/templates/runtime/provider-pipeline.md +55 -0
  63. package/commands/enrich.md +0 -1456
  64. package/templates/agents/sr-backend-developer.md +0 -91
  65. package/templates/agents/sr-backend-reviewer.md +0 -152
  66. package/templates/agents/sr-doc-sync.md +0 -247
  67. package/templates/agents/sr-frontend-developer.md +0 -85
  68. package/templates/agents/sr-frontend-reviewer.md +0 -145
  69. package/templates/agents/sr-merge-resolver.md +0 -195
  70. package/templates/agents/sr-performance-reviewer.md +0 -186
  71. package/templates/agents/sr-product-analyst.md +0 -36
  72. package/templates/agents/sr-product-manager.md +0 -148
  73. package/templates/agents/sr-security-reviewer.md +0 -191
  74. package/templates/agents/sr-test-writer.md +0 -176
  75. package/templates/codex-skills/enrich/SKILL.md +0 -191
  76. package/templates/codex-skills/merge-resolve/SKILL.md +0 -88
  77. package/templates/codex-skills/rails/sr-backend-developer/SKILL.md +0 -93
  78. package/templates/codex-skills/rails/sr-backend-reviewer/SKILL.md +0 -120
  79. package/templates/codex-skills/rails/sr-doc-sync/SKILL.md +0 -124
  80. package/templates/codex-skills/rails/sr-frontend-developer/SKILL.md +0 -106
  81. package/templates/codex-skills/rails/sr-frontend-reviewer/SKILL.md +0 -111
  82. package/templates/codex-skills/rails/sr-merge-resolver/SKILL.md +0 -156
  83. package/templates/codex-skills/rails/sr-performance-reviewer/SKILL.md +0 -109
  84. package/templates/codex-skills/rails/sr-product-analyst/SKILL.md +0 -85
  85. package/templates/codex-skills/rails/sr-product-manager/SKILL.md +0 -131
  86. package/templates/codex-skills/rails/sr-security-reviewer/SKILL.md +0 -121
  87. package/templates/codex-skills/rails/sr-test-writer/SKILL.md +0 -115
  88. package/templates/commands/specrails/auto-propose-backlog-specs.md +0 -312
  89. package/templates/commands/specrails/enrich.md +0 -1456
  90. package/templates/commands/specrails/get-backlog-specs.md +0 -226
  91. package/templates/commands/specrails/merge-resolve.md +0 -172
  92. package/templates/commands/specrails/reconfig.md +0 -80
  93. package/templates/commands/specrails/vpc-drift.md +0 -405
  94. package/templates/commands/test.md +0 -58
  95. package/templates/personas/persona.md +0 -43
  96. package/templates/personas/the-maintainer.md +0 -98
  97. package/templates/settings/perf-thresholds.yml +0 -25
package/README.md CHANGED
@@ -1,402 +1,166 @@
1
1
  # specrails-core
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/specrails-core.svg)](https://www.npmjs.com/package/specrails-core)
4
- [![GitHub Stars](https://img.shields.io/github/stars/fjpulidop/specrails-core?style=social)](https://github.com/fjpulidop/specrails-core)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![npm downloads](https://img.shields.io/npm/dw/specrails-core.svg)](https://www.npmjs.com/package/specrails-core)
7
- [![AI providers](https://img.shields.io/badge/providers-Claude%20%7C%20Codex%20%7C%20Gemini%20%7C%20Kimi-6f42c1)](#provider-support)
3
+ [![CI](https://github.com/fjpulidop/specrails-core/actions/workflows/ci.yml/badge.svg)](https://github.com/fjpulidop/specrails-core/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/specrails-core.svg)](https://www.npmjs.com/package/specrails-core)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
6
 
9
- **Your agentic development team. From idea to production code.**
7
+ Specrails Core installs specification-driven development workflows into a project. It gives your AI CLI three baseline roles—architect, developer and reviewer—plus provider-native commands, OpenSpec integration and project conventions. You choose the provider; Core supplies the workflow and its local artifacts.
10
8
 
11
- One command turns your repo into a spec-driven pipeline with a team of specialized AI agents architect, developers, reviewers, product manager all adapted to your codebase.
9
+ Use Core directly from Claude Code, Codex CLI, Gemini CLI or Kimi Code. For mission conversations, a shared project board, execution loops and delivery controls, use [Specrails Desktop](https://github.com/fjpulidop/specrails-desktop).
12
10
 
13
- ```bash
14
- npx specrails-core@latest init # install into the current repo
15
- /specrails:enrich # Claude/Gemini (Kimi: /skill:specrails-enrich)
16
- ```
17
-
18
- > **Requirements:** one supported AI CLI, git, and Node 20.19.0+. Cross-platform:
19
- > macOS, Linux, and Windows. Use `--provider claude|codex|gemini|kimi` to
20
- > override auto-detection.
21
-
22
- ---
23
-
24
- ## How it works
25
-
26
- ```
27
- Idea → Architecture → Implementation → Review → PR
28
- (sr-architect) (sr-developer) (sr-reviewer)
29
- ```
30
-
31
- Run `/specrails:implement "add dark mode"` — the pipeline designs, builds, reviews, and ships a pull request. No hand-holding.
32
-
33
- Every artifact (agents, rules, personas) is generated **specifically for your project** by analysing your actual codebase, tech stack, and CI setup. Not generic templates.
34
-
35
- ---
11
+ This README describes the current source tree. `npx specrails-core@latest` installs the published package, not unmerged changes. Check the [release notes](https://github.com/fjpulidop/specrails-core/releases), or [build this checkout](#develop-from-source) when testing unreleased work.
36
12
 
37
13
  ## Quick start
38
14
 
39
- ```bash
40
- # 1. Install into the current repo
41
- npx specrails-core@latest init
42
- ```
43
-
44
- The TUI asks you to pick a tier:
15
+ You need **Node.js 20.19.0+**, Git and at least one installed, authenticated AI CLI. A provider may impose a higher Node or operating-system requirement than Core itself. Install providers through their own supported installation flow.
45
16
 
46
- - **Quick** (default) provider-native agents/skills and commands are installed
47
- under `.claude/`, `.codex/`, `.gemini/`, or `.kimi-code/`. No AI interaction.
48
- - **Full** — same as Quick plus `/specrails:enrich` (5-phase deep analysis: stack detection, VPC personas, competitive research). ~5 min.
17
+ From the project you want to configure:
49
18
 
50
- ```bash
51
- # 2. Optional run enrich later if you picked Quick
52
- /specrails:enrich
53
-
54
- # 3. Start building
55
- > /specrails:implement "add user authentication"
56
- > /specrails:implement #1, #2 # from local tickets (default)
57
- > /specrails:implement #42 # from GitHub Issues (if configured)
19
+ ```sh
20
+ npx specrails-core@latest init --provider claude
58
21
  ```
59
22
 
60
- That's it. The pipeline takes over.
61
-
62
- ---
63
-
64
- ## Provider support
65
-
66
- | Provider | Runtime command | Project surface | Workflow syntax |
67
- |----------|-----------------|-----------------|-----------------|
68
- | Claude Code | `claude` | `.claude/` | `/specrails:<command>` |
69
- | Codex CLI | `codex` | `.codex/` | provider-native skills |
70
- | Gemini CLI | `gemini` | `.gemini/` | `/specrails:<command>` |
71
- | Kimi Code | managed Node skill runner → external `kimi -p` | `.kimi-code/` | `/skill:specrails-<command>` in the TUI |
72
-
73
- Kimi is an external CLI dependency, just like the other providers. SpecRails
74
- does not bundle a Kimi binary, start `kimi web`, or own a Kimi server. Install
75
- Kimi Code separately, run `kimi login` once, then select it explicitly or let
76
- the installer detect it. Parallel Kimi roles are submitted as one bounded
77
- foreground wave; Core creates/reuses their git worktrees, attributes each
78
- child stream, and waits for aggregate completion—without a server. See the
79
- [Kimi setup guide](./docs/user-docs/getting-started-kimi.md).
80
-
81
- ## What gets installed
23
+ Choose `claude`, `codex`, `gemini` or `kimi`. The default installer collects agent and model configuration interactively. For a non-interactive installation using defaults:
82
24
 
83
- Everything lands in your repo — nothing auto-updates, nothing phones home. You own it, you commit it.
84
-
85
- | Category | Location | Purpose |
86
- |----------|----------|---------|
87
- | **Provider workflows** | `.claude/`, `.codex/`, `.gemini/`, or `.kimi-code/` | Provider-native SpecRails commands and role definitions |
88
- | **Kimi workflow skills** | `.kimi-code/skills/specrails-*/SKILL.md` | `/skill:specrails-*` directory-form skills |
89
- | **Kimi role skills** | `.kimi-code/skills/sr-*/SKILL.md` | Specialized role prompts used by Kimi workflows; Kimi discovers only direct skill children |
90
- | **Kimi headless runner** | `.kimi-code/specrails/run-skill.mjs` | Materializes Kimi's native skill-activation prompt before launching the external CLI |
91
- | **OpenSpec skills** | Provider-native skills directory | Structured proposal/design/tasks/apply workflows |
92
- | **Config** | `.specrails/config.yaml` | Stack, CI commands, git workflow |
93
- | **Personas** | `.specrails/personas/*.md` | VPC user profiles, generated from your users |
94
- | **Rules** | `.specrails/rules/*.md` | Per-layer coding conventions |
95
- | **Memory** | `.specrails/agent-memory/` | Persistent knowledge — agents learn across sessions |
96
- | **Pipeline state** | `.specrails/pipeline/` | In-flight feature state for parallel builds |
97
-
98
- To update, re-run the installer:
99
-
100
- ```bash
101
- npx specrails-core@latest init
25
+ ```sh
26
+ npx specrails-core@latest init --yes --provider claude
102
27
  ```
103
28
 
104
- It refreshes the agents/commands while leaving your `.specrails/` data untouched.
105
-
106
- ---
107
-
108
- ## Why specrails
109
-
110
- | | specrails | Plain Claude Code | Cursor / Copilot |
111
- |---|---|---|---|
112
- | Structured pipeline | ✅ Architect → Dev → Review → PR | ❌ Manual | ❌ Manual |
113
- | Adapts to your codebase | ✅ Reads your real stack/CI | ⚠️ Prompts only | ❌ |
114
- | Product-driven backlog | ✅ VPC persona scoring | ❌ | ❌ |
115
- | Parallel feature builds | ✅ Git worktrees | ❌ | ❌ |
116
- | Institutional memory | ✅ Agents learn across sessions | ❌ | ❌ |
117
- | Open source | ✅ MIT | N/A | ❌ |
118
-
119
- specrails is not a chat interface. It's a **development pipeline** that coordinates multiple specialised agents through your existing tools (GitHub Issues, JIRA, git, CI).
120
-
121
- ---
122
-
123
- ## The agents
29
+ Core 5 installs the baseline roles and workflows directly; it does not invoke a model for an enrichment phase. Installing dependencies or OpenSpec may require network access. Review the generated project configuration before running an implementation.
124
30
 
125
- | Agent | Model | Role |
126
- |-------|-------|------|
127
- | **sr-architect** | Sonnet | Designs features: proposal, technical design, task breakdown |
128
- | **sr-developer** | Sonnet | Full-stack implementation |
129
- | **sr-backend-developer** | Sonnet | Backend-specialised implementation |
130
- | **sr-frontend-developer** | Sonnet | Frontend-specialised implementation |
131
- | **sr-reviewer** | Sonnet | Quality gate: runs CI, fixes issues, records learnings |
132
- | **sr-backend-reviewer** | Sonnet | Backend code review: API design, DB patterns, performance |
133
- | **sr-frontend-reviewer** | Sonnet | Frontend code review: UX, accessibility, component design |
134
- | **sr-test-writer** | Sonnet | Generates unit, integration, and e2e tests |
135
- | **sr-security-reviewer** | Sonnet | Secrets detection, OWASP checks, dependency vulnerabilities |
136
- | **sr-doc-sync** | Sonnet | Updates changelogs, READMEs, API docs |
137
- | **sr-merge-resolver** | Sonnet | AI-powered merge conflict resolution for multi-feature pipelines |
138
- | **sr-performance-reviewer** | Sonnet | Performance regression detection after implementation |
139
- | **sr-product-manager** | Opus | Product discovery: competitive analysis, VPC evaluation |
140
- | **sr-product-analyst** | Haiku | Read-only backlog analysis and prioritisation |
31
+ Open the selected AI CLI in that project and use its native workflow syntax:
141
32
 
142
- ---
33
+ | Provider | Executable | Implement | Batch | Retry |
34
+ | --- | --- | --- | --- | --- |
35
+ | Claude Code | `claude` | `/specrails:implement` | `/specrails:batch-implement` | `/specrails:retry` |
36
+ | Codex CLI | `codex` | `$implement` | `$batch-implement` | `$retry` |
37
+ | Gemini CLI | `gemini` | `/specrails:implement` | `/specrails:batch-implement` | `/specrails:retry` |
38
+ | Kimi Code | `kimi` | `/skill:specrails-implement` | `/skill:specrails-batch-implement` | `/skill:specrails-retry` |
143
39
 
144
- ## Commands
40
+ For example, enter this **inside Claude Code or Gemini CLI**, not in your shell:
145
41
 
146
- ### `/specrails:implement` — Build features
147
-
148
- ```bash
149
- /specrails:implement "add dark mode" # from a description
150
- /specrails:implement #85, #71 # from tickets
151
- /specrails:implement UI, Analytics # explore areas, pick the best ideas
42
+ ```text
43
+ /specrails:implement "add keyboard navigation to the settings page"
44
+ /specrails:implement #1, #2
152
45
  ```
153
46
 
154
- Architect designs developer builds reviewer validates PR created. Multiple features run in parallel with git worktrees.
155
-
156
- #### Letting a host own version control (`SPECRAILS_GIT_AUTO`)
157
-
158
- By default the pipeline ships automatically (`GIT_AUTO=true`): it creates a branch, commits, pushes, and opens a pull request. When specrails-core runs **inside a host that owns version control itself** — such as [specrails-desktop](https://github.com/fjpulidop/specrails-desktop), which runs each pipeline in an isolated git worktree and opens the pull request for you — that host sets the `SPECRAILS_GIT_AUTO` environment variable to `false`.
159
-
160
- When `SPECRAILS_GIT_AUTO=false` (or `0`), the Ship phase is forced onto the **manual** path regardless of configuration: the pipeline stops at "code written and verified" and makes **no branch, commit, push, or PR** — the host does that. This prevents a second, uncoordinated pull request. Leave the variable unset for the normal standalone behaviour (automatic shipping, subject to your `GIT_AUTO` configuration). It composes with `--dry-run`, which independently skips all git/GitHub/backlog operations.
47
+ Kimi integration targets Kimi Code 0.27.0+. Its headless path uses the installed `.kimi-code/specrails/run-skill.mjs` helper to activate the workflow before calling the external CLI; passing a slash command directly to `kimi -p` is not equivalent. See [Kimi setup](docs/user-docs/getting-started-kimi.md) and [provider pipeline contracts](docs/user-docs/provider-pipelines.md).
161
48
 
162
- #### Dry-run / preview mode
49
+ ## How implementation works
163
50
 
164
- Not ready to commit? Run the full pipeline without touching git or GitHub:
165
-
166
- ```bash
167
- /specrails:implement "add dark mode" --dry-run
168
- /specrails:implement #85 --preview # --preview is an alias for --dry-run
51
+ ```text
52
+ Specification → Architecture → Implementation → Review → Delivery
53
+ sr-architect sr-developer sr-reviewer
169
54
  ```
170
55
 
171
- All agents run normally. Generated files land in `.claude/.dry-run/<feature-name>/` instead of your working tree. No branches, commits, PRs, or issue updates are created.
56
+ The architect produces the OpenSpec proposal, design and tasks. The developer implements the agreed work. The reviewer checks the result against the spec and project verification commands. Delivery follows the configured Git workflow and the execution owner's policy.
172
57
 
173
- When you're happy with the preview, apply the cached output:
58
+ The current source installs a local pipeline helper for persisted phase state, explicit role handoffs and verification receipts. Retry resumes the first incomplete or invalid phase; it does not treat an earlier success as valid after its inputs change. A batch retains its tickets' requirements and repository identities in an aggregate change. See the [pipeline contract](docs/user-docs/provider-pipelines.md) for the execution context and validation limits.
174
59
 
175
- ```bash
176
- /specrails:implement --apply add-dark-mode # copies files to real paths, then ships
177
- ```
60
+ Standalone automatic delivery can create branches, commits, pushes and pull requests when enabled. Set the project's Git workflow deliberately; model execution and repository writes are real operations, not a preview by default. GitHub pull requests additionally require an authenticated `gh` CLI.
178
61
 
179
- To discard without applying:
62
+ When a host such as Desktop owns worktrees and delivery, it sets `SPECRAILS_GIT_AUTO=false` and supplies the execution context. Core then leaves branch creation, commits, pushes and PRs to that host. Multi-repository contexts must explicitly identify the selected repositories and the OpenSpec/backlog owner; an additional readable folder is not automatically an implementation target.
180
63
 
181
- ```bash
182
- rm -rf .claude/.dry-run/add-dark-mode/
183
- ```
64
+ ## Installed files and ownership
184
65
 
185
- ### `/specrails:get-backlog-specs` View prioritised backlog
66
+ Standalone installation normally copies committable artifacts into the repository and uses a shared framework store under `~/.specrails/`. Relocated installations, including Desktop-managed workspaces, can keep framework links and project artifacts outside the checkout. The resolved workspace determines where these files live.
186
67
 
187
- ```bash
188
- /specrails:get-backlog-specs # show all areas
189
- /specrails:get-backlog-specs UI, Decks # filter by area
190
- ```
68
+ | Surface | Purpose |
69
+ | --- | --- |
70
+ | `.claude/`, `.codex/`, `.gemini/`, `.kimi-code/` | Selected provider's agents, commands or skills |
71
+ | `openspec/` | Specifications and change artifacts |
72
+ | `.specrails/config.yaml` and `install-config.yaml` | Project workflow and installation configuration |
73
+ | `.specrails/rules/` and `agent-memory/` | Coding conventions and retained agent notes |
74
+ | `.specrails/runtime/` and `pipeline/` | Installed execution helper and run state in the current source |
75
+ | `.specrails/local-tickets.json` | Local backlog, when that backlog provider is selected |
76
+ | `.specrails/profiles/` | User-owned profiles and model/routing choices |
191
77
 
192
- Reads your tickets (local or GitHub Issues), scores by VPC persona match, recommends top 3 for the next sprint.
78
+ Local tickets do not require GitHub or Jira. External backlog integrations require their own credentials and configuration. See [local tickets](docs/local-tickets.md) and [backlog migration](docs/migration-guide.md).
193
79
 
194
- ### `/specrails:auto-propose-backlog-specs` Discover features
80
+ Managed files can be regenerated by updates. Keep extensions in documented user-owned locations rather than relying on edits to generated agents surviving an update.
195
81
 
196
- ```bash
197
- /specrails:auto-propose-backlog-specs # explore all areas
198
- /specrails:auto-propose-backlog-specs Analytics # focus on one area
199
- ```
82
+ ## Extend the agents
200
83
 
201
- AI product discovery using your personas. Evaluates ideas, creates tickets (local or GitHub Issues) for the best ones.
84
+ Profiles can select models and route tasks to additional specialists where the provider workflow supports them. Keep the three baseline roles, then add your custom agents and routing. The profile schema is [schemas/profile.v1.json](schemas/profile.v1.json).
202
85
 
203
- ---
86
+ ```sh
87
+ npx specrails-core@latest profile validate .specrails/profiles/default.json
88
+ ```
204
89
 
205
- ## Agent profiles
90
+ The installer reserves these extension paths:
206
91
 
207
- > Available in `specrails-core >= 4.1.0`. Optional — without a profile, the pipeline behaves exactly as before.
92
+ - `.specrails/profiles/**`
93
+ - `.claude/agents/custom-*.md`
94
+ - `.kimi-code/skills/custom-*/**`
208
95
 
209
- Profiles are declarative JSON files that tell `/specrails:implement` which agents to use, which models to run them with, and how to route tasks to specialists. One project can define many profiles (e.g. `default`, `data-heavy`, `security-heavy`) and run different features with different profiles — useful for concurrent rails in `/specrails:batch-implement`.
96
+ Use the `custom-` prefix for protected custom roles. The legacy nested Kimi custom-role layout is preserved during migration as well. Other provider-managed surfaces are not a blanket guarantee that arbitrary local changes survive regeneration. See [customization](docs/customization.md) for the broader configuration model.
210
97
 
211
- ### File layout
98
+ ## Update an existing project
212
99
 
213
- ```
214
- <project>/.specrails/
215
- profiles/
216
- default.json # checked into git, team-shared
217
- data-heavy.json # checked into git, team-shared
218
- .user-preferred.json # gitignored, your personal default
219
- ```
100
+ Updating the executable and refreshing a project's artifacts are separate operations. From the project directory:
220
101
 
221
- ### Resolution order
222
-
223
- When running the pipeline, the active profile is resolved in this order:
224
-
225
- 1. `$SPECRAILS_PROFILE_PATH` environment variable (absolute path to a JSON snapshot)
226
- 2. Provider default: `<cwd>/.specrails/profiles/project-default.json` for
227
- Claude, or `<cwd>/.specrails/profiles/kimi-default.json` for Kimi
228
- 3. No profile — legacy behavior (identical to pre-4.1.0)
229
-
230
- Tools such as [specrails-desktop](https://github.com/fjpulidop/specrails-desktop) set `$SPECRAILS_PROFILE_PATH` to a job-scoped snapshot so concurrent rails can run independent profiles.
231
-
232
- ### Schema
233
-
234
- The v1 profile schema is published at [`schemas/profile.v1.json`](./schemas/profile.v1.json). Example:
235
-
236
- ```json
237
- {
238
- "schemaVersion": 1,
239
- "name": "data-heavy",
240
- "description": "Data engineering rail with stricter review",
241
- "orchestrator": { "model": "opus" },
242
- "agents": [
243
- { "id": "sr-architect", "model": "opus", "required": true },
244
- { "id": "sr-data-engineer", "model": "sonnet" },
245
- { "id": "sr-developer", "model": "sonnet", "required": true },
246
- { "id": "sr-reviewer", "model": "opus", "required": true }
247
- ],
248
- "routing": [
249
- { "tags": ["etl", "schema", "data"], "agent": "sr-data-engineer" },
250
- { "default": true, "agent": "sr-developer" }
251
- ]
252
- }
102
+ ```sh
103
+ npx specrails-core@latest --version
104
+ npx specrails-core@latest update --dry-run
105
+ npx specrails-core@latest update
106
+ npx specrails-core@latest doctor
253
107
  ```
254
108
 
255
- Baseline agents (`sr-architect`, `sr-developer`, `sr-reviewer`) MUST appear in `agents[]`. The `routing` array is ordered first rule whose `tags` intersects the task's tags wins; the terminal `default: true` rule catches everything else.
256
-
257
- ### Reserved paths
109
+ Use an exact published package version instead of `latest` when reproducibility matters. The selected CLI supplies the framework bytes; the current source rejects an older CLI overwriting a newer installed framework. It retains recovery information for failed updates and does not report a complete upgrade after a partial component refresh.
258
110
 
259
- The following paths are **reserved** `specrails-core update` will never create, modify, or delete anything inside them:
111
+ Existing provider selections are preserved by the current update implementation. Installing support for an additional provider does not require discarding the other provider's managed artifacts. See [installation and update consistency](docs/user-docs/core-updates.md) for version checks, copied versus linked workspaces, concurrent updates and rollback behavior.
260
112
 
261
- - `.specrails/profiles/**` profile JSON files (yours and desktop-authored).
262
- - `.claude/agents/custom-*.md` — your custom agents. Use the `custom-` prefix to opt in to this protection.
263
- - `.kimi-code/skills/custom-*/**` — your custom Kimi role skills. Pre-release
264
- `.kimi-code/skills/rails/custom-*` roles are also reserved while Core safely
265
- migrates them into this discoverable direct-child layout.
113
+ ### Migrating from Core 4
266
114
 
267
- This contract is what lets you safely hand-author (or let specrails-desktop author) profiles and custom agents without fear of the next `update` overwriting your work. Other paths managed by specrails-core (`.specrails/install-config.yaml`, `.specrails/specrails-version`, etc.) remain under update's control. Audited by `src/installer/__tests__/reserved-paths.test.ts` on every CI run.
115
+ Core 5 removes the `enrich` command, the quick/full installation tiers and the previously bundled non-core specialist agents. `init` performs deterministic placement instead of launching the old enrichment wizard.
268
116
 
269
- ---
117
+ Before upgrading, review customizations and profiles that refer to removed agents. Move any specialist you want to retain into a protected `custom-*` role and update its profile reference. The migration removes installer-owned legacy artifacts; protected profiles and custom agents remain user-owned.
270
118
 
271
- ## Local ticket management
119
+ Desktop must support the selected Core lifecycle. Current Desktop source supports Core 5, but older installed Desktop releases can differ. Updating this repository or the global CLI alone does not upgrade a running Desktop application or every project's copied artifacts.
272
120
 
273
- specrails-core ships with a built-in ticket system — no GitHub account or external tools required.
121
+ ## Develop from source
274
122
 
275
- Tickets live in `.specrails/local-tickets.json` alongside your code. They're plain JSON and git-friendly.
123
+ Core uses one npm dependency tree. Node **20.19.0+** is the package minimum; CI exercises the declared platform/runtime matrix.
276
124
 
277
- **Local tickets are the default.** The `/specrails:enrich` wizard skips GitHub/JIRA credential setup unless you opt in.
278
-
279
- ```bash
280
- /specrails:implement #1, #4 # implement by ticket ID
281
- /specrails:get-backlog-specs # view prioritised backlog
282
- /specrails:auto-propose-backlog-specs # discover and create tickets with AI
283
- /specrails:propose-spec # create a ticket from a spec proposal
125
+ ```sh
126
+ git clone https://github.com/fjpulidop/specrails-core.git
127
+ cd specrails-core
128
+ npm ci
129
+ npm test
284
130
  ```
285
131
 
286
- See [docs/local-tickets.md](./docs/local-tickets.md) for the full schema reference, concurrency model, and command integration details.
287
-
288
- Migrating from GitHub Issues or JIRA? See [docs/migration-guide.md](./docs/migration-guide.md).
289
-
290
- ---
291
-
292
- ## VPC persona scoring
132
+ `npm test` builds `dist/`, checks types and runs the tests. To use the current checkout against a separate project:
293
133
 
294
- Features are scored against your user personas using the Value Proposition Canvas framework:
295
-
296
- ```
297
- +-----------------------------+ +-----------------------------+
298
- | VALUE PROPOSITION | | CUSTOMER SEGMENT |
299
- | Products & Services <---+--->| Customer Jobs |
300
- | Pain Relievers <---+--->| Pains |
301
- | Gain Creators <---+--->| Gains |
302
- +-----------------------------+ +-----------------------------+
134
+ ```sh
135
+ npm run build
136
+ node bin/specrails-core.mjs --version
137
+ node bin/specrails-core.mjs init --root-dir /absolute/path/to/project --provider codex
303
138
  ```
304
139
 
305
- Each persona scores features 0–5. Features are ranked by score / effort ratio. No gut-feel product decisions.
306
-
307
- ---
308
-
309
- ## Prerequisites
310
-
311
- | Tool | Required | Purpose |
312
- |------|----------|---------|
313
- | **One supported AI CLI** | Yes | Claude Code, Codex CLI, Gemini CLI, or Kimi Code |
314
- | **Kimi Code 0.27.0+** | For Kimi projects | Install from the [official Kimi Code guide](https://www.kimi.com/code/docs/en/kimi-code-cli/guides/getting-started), then run `kimi login` |
315
- | **git** | Yes | Repository detection |
316
- | **Node 20.19.0+** | Yes | Needed for `npx specrails-core@latest init` (the floor required by the pinned OpenSpec 1.4.1 CLI). Cross-platform: macOS, Linux, Windows (10/11, x64 + ARM64 via emulation). |
317
- | **GitHub CLI** (`gh`) | Optional | Backlog sync to GitHub Issues, PR creation. Not needed with local tickets. |
318
- | **JIRA CLI** (`jira`) | Optional | Backlog sync to JIRA. Not needed with local tickets. |
319
-
320
- The installer checks for prerequisites and offers to install missing ones.
321
-
322
- ---
323
-
324
- ## Supported stacks
325
-
326
- Stack-agnostic. The `/specrails:enrich` wizard detects and adapts to whatever you're running:
327
-
328
- - **Backend:** Python/FastAPI, Node/Express, Go/Gin, Rust/Actix, Java/Spring, Ruby/Rails, .NET
329
- - **Frontend:** React, Vue, Angular, Svelte, Next.js, Nuxt
330
- - **Database:** PostgreSQL, MySQL, SQLite, MongoDB, Redis
331
- - **CI/CD:** GitHub Actions, GitLab CI, Jenkins, Makefile
332
- - **Testing:** pytest, vitest, jest, go test, cargo test, rspec
333
-
334
- ---
335
-
336
- ## Design principles
337
-
338
- 1. **Local by default** — Everything lives in your repo. No cloud services, no telemetry, no phone home.
339
- 2. **Self-cleaning** — Installer scaffolding is removed after setup. Only final, project-specific files remain.
340
- 3. **Context-first** — Every generated file uses your real paths, patterns, and CI commands.
341
- 4. **Persona-driven** — Product decisions grounded in researched user personas, not assumptions.
342
- 5. **Institutional memory** — Agents learn across sessions. Reviewer learnings feed back to future developers.
343
- 6. **Parallel-safe** — Multiple features implemented simultaneously via git worktrees with automatic merge.
344
-
345
- ---
346
-
347
- ## FAQ
348
-
349
- **Can I customise the agents after installation?**
350
- Yes. Everything in the selected provider tree and `.specrails/` is yours to
351
- edit. For Kimi, customize `.kimi-code/skills/`, `.kimi-code/rules/`, and the
352
- managed block in `.kimi-code/AGENTS.md`; `custom-*` role skills are preserved.
353
-
354
- **Can I re-run the wizard?**
355
- Run `/specrails:enrich` again at any time to regenerate or update project data files. Re-running `npx specrails-core@latest init` refreshes the agents/commands without touching `.specrails/`.
356
-
357
- **Does this work without GitHub CLI?**
358
- Yes. Local tickets are the default and need no external tools. `/specrails:implement "description"` also works without `gh` — it just skips automated PR creation.
359
-
360
- **Can I use local tickets and GitHub Issues together?**
361
- Not simultaneously for the same project — backlog commands use one active provider at a time. You can migrate from GitHub Issues to local tickets using the [migration guide](./docs/migration-guide.md).
362
-
363
- **How much does it cost to run?**
364
- Cost depends on the selected provider, model, and workload. SpecRails does not
365
- add a model surcharge. Kimi's stream output does not currently report a native
366
- USD cost, so consumers must display it as unavailable rather than inventing an
367
- estimate.
368
-
369
- **Does it work with private repos?**
370
- Yes. Orchestration runs through the selected local CLI. The provider still
371
- connects to its model API and any MCP/integration endpoints you configure.
372
-
373
- **How do I use specrails with Kimi?**
374
- Install and authenticate Kimi Code, then run
375
- `npx specrails-core@latest init --provider kimi`. Invoke the generated workflows
376
- as `/skill:specrails-implement`, `/skill:specrails-enrich`, and so on in Kimi's
377
- interactive TUI. Headless callers use the managed
378
- `.kimi-code/specrails/run-skill.mjs` helper: Kimi 0.27 sends a slash command
379
- passed directly to `kimi -p` as literal text, so the helper first renders the
380
- same skill prompt as Kimi's native activation path and then starts external
381
- `kimi -p --output-format stream-json`. No server installation is required.
382
-
383
- ---
384
-
385
- ## Related
386
-
387
- - **[specrails-desktop](https://github.com/fjpulidop/specrails-desktop)** — desktop dashboard that visualises specrails pipelines (macOS, open source).
388
- - **[specrails.dev](https://specrails.dev)** — landing page and documentation.
389
-
390
- ---
140
+ That final command installs into the target project. Use a disposable fixture when testing installation behavior. No global npm install is needed to execute this checkout.
391
141
 
392
- ## Support
142
+ | Command | Purpose |
143
+ | --- | --- |
144
+ | `npm run build` | Compile the installer and runtime |
145
+ | `npm run typecheck` | Check production and test types |
146
+ | `npm test` | Build, typecheck and run tests |
147
+ | `npm run test:coverage` | Build and run the coverage suite |
148
+ | `npm run test:scripts` | Run release and package guard regressions |
149
+ | `npm run check:package` | Build, install and verify a temporary npm consumer |
150
+ | `npm run ci` | Run local type, release, coverage and package checks |
151
+ | `npm pack` | Build and create a package tarball without publishing |
393
152
 
394
- If specrails-core is useful to you, you can donate on [Ko-fi](https://ko-fi.com/D1D81Y002C) to support ongoing development.
153
+ See [CI and releases](docs/ci-cd.md) for platform gates and publication requirements. Tests with simulated provider processes do not establish live compatibility with every CLI version, and an installer test does not prove a model will successfully implement every requested feature.
395
154
 
396
- [![Donate on Ko-fi](https://img.shields.io/badge/Donate-Ko--fi-FF5E5B?logo=kofi&logoColor=white&style=flat-square)](https://ko-fi.com/D1D81Y002C)
155
+ ## Data, security and documentation
397
156
 
398
- ---
157
+ Core's configuration, specs and run state are local files. Provider CLIs still send supplied context to their configured model services; package installation, GitHub/Jira and MCP integrations may also use the network. Model usage is billed according to your provider. Review the repository's commands and agent permissions before execution.
399
158
 
400
- ## License
159
+ - [CLI reference](docs/user-docs/cli-reference.md)
160
+ - [Provider pipeline contracts](docs/user-docs/provider-pipelines.md)
161
+ - [Core update consistency](docs/user-docs/core-updates.md)
162
+ - [Local tickets](docs/local-tickets.md)
163
+ - [Documentation index](docs/README.md)
164
+ - [Contributing](CONTRIBUTING.md), [security reporting](SECURITY.md) and [changelog](CHANGELOG.md)
401
165
 
402
- MIT [fjpulidop](https://github.com/fjpulidop)
166
+ Specrails Core is available under the [MIT license](LICENSE). Development can be supported through [Ko-fi](https://ko-fi.com/D1D81Y002C).