specrails-core 1.7.0 → 1.7.1

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.
@@ -0,0 +1,410 @@
1
+ # Workflows & Commands
2
+
3
+ SpecRails commands are Claude Code slash commands that orchestrate the agent pipeline. Here's every command, what it does, and when to use it.
4
+
5
+ ## The main workflow: `/sr:implement`
6
+
7
+ This is the command you'll use most. It takes a feature request and drives it through the entire pipeline — from architecture to shipped PR.
8
+
9
+ ### Usage
10
+
11
+ ```
12
+ /sr:implement #85 # From a GitHub Issue
13
+ /sr:implement #85, #71, #63 # Multiple issues (parallel)
14
+ /sr:implement "add dark mode toggle" # Text description
15
+ /sr:implement UI, Analytics # By area (explores + selects)
16
+ ```
17
+
18
+ ### Flags
19
+
20
+ | Flag | Effect |
21
+ |------|--------|
22
+ | `--dry-run` / `--preview` | Run the full pipeline without git operations or PRs |
23
+ | `--apply <name>` | Apply a previously cached dry-run |
24
+
25
+ ### Pipeline phases
26
+
27
+ When you run `/sr:implement #85`, here's what happens:
28
+
29
+ ```
30
+ Phase -1 Environment check
31
+ ↓ prerequisites verified
32
+ Phase 0 Parse input, detect mode + snapshot issue state
33
+ ↓ feature(s) identified
34
+ Phase 3a.0 Conflict check — verify issue unchanged since Phase 0
35
+ ↓ no external modifications detected
36
+ Phase 3a Architect → design + tasks + compat check
37
+ ↓ implementation plan ready
38
+ Phase 3b Developer → write code
39
+ ↓ implementation complete
40
+ Phase 3c Test Writer → generate tests
41
+ ↓ tests passing
42
+ Phase 3d Doc Sync → update docs
43
+ ↓ docs in sync
44
+ Phase 4 Security Reviewer → scan
45
+ ↓ no critical findings
46
+ Phase 4b Layer reviewers (Frontend + Backend, parallel)
47
+ + Generalist Reviewer → run CI + fix issues
48
+ ↓ CI green
49
+ Phase 4b-conf Confidence gate → score 0–100% across 5 aspects
50
+ ↓ score meets threshold (or override)
51
+ Phase 4c.0 Conflict check — verify issue unchanged before ship
52
+ ↓ no external modifications detected
53
+ Phase 5 Create PR
54
+ ```
55
+
56
+ ### Single vs. multi-feature
57
+
58
+ | Mode | Behavior |
59
+ |------|----------|
60
+ | **Single feature** | Sequential pipeline, one branch |
61
+ | **Multiple features** | Parallel pipelines in **git worktrees**, auto-merged |
62
+
63
+ For multiple features, each gets its own isolated worktree. Agents run concurrently, and results are merged automatically at the end.
64
+
65
+ ### Example output
66
+
67
+ ```
68
+ /sr:implement #85
69
+ ```
70
+
71
+ ```
72
+ ┌─ Phase 3a: Architecture ──────────────────────┐
73
+ │ Architect analyzed issue #85 │
74
+ │ Design: REST endpoint + middleware + migration │
75
+ │ Tasks: 4 ordered steps │
76
+ └─────────────────────────────────────────────────┘
77
+
78
+ ┌─ Phase 3b: Implementation ────────────────────┐
79
+ │ Developer completed 4/4 tasks │
80
+ │ Files: 6 created, 2 modified │
81
+ └─────────────────────────────────────────────────┘
82
+
83
+ ┌─ Phase 3c: Tests ─────────────────────────────┐
84
+ │ Test Writer generated 12 tests │
85
+ │ Coverage: 87% of new code │
86
+ └─────────────────────────────────────────────────┘
87
+
88
+ ┌─ Phase 4b: Review ────────────────────────────┐
89
+ │ Frontend Reviewer: bundle +2kb, WCAG ok │
90
+ │ Backend Reviewer: no N+1, indexes ok │
91
+ │ ✓ lint ✓ typecheck ✓ tests │
92
+ │ Fixed: 1 import, 1 lint warning │
93
+ └─────────────────────────────────────────────────┘
94
+
95
+ ┌─ Phase 4b-conf: Confidence ───────────────────┐
96
+ │ Correctness: 92% Tests: 87% Security: 95% │
97
+ │ Performance: 88% Maintainability: 90% │
98
+ │ Overall: 90% — threshold met │
99
+ └─────────────────────────────────────────────────┘
100
+
101
+ PR #42 created: feat: add health check endpoint
102
+ ```
103
+
104
+ ---
105
+
106
+ ## `/sr:batch-implement`
107
+
108
+ Orchestrates **multiple independent features** in parallel using git worktrees. Use this when you have several unrelated features to ship at once.
109
+
110
+ ```
111
+ /sr:batch-implement #85, #71, #63
112
+ ```
113
+
114
+ Each feature gets its own worktree, its own agent pipeline, and its own PR. Features run concurrently for maximum speed.
115
+
116
+ ---
117
+
118
+ ## `/sr:product-backlog`
119
+
120
+ View your prioritized product backlog, ranked by VPC fit and effort.
121
+
122
+ ```
123
+ /sr:product-backlog # Full backlog
124
+ /sr:product-backlog UI, API # Filter by area
125
+ ```
126
+
127
+ ### What it shows
128
+
129
+ The Product Analyst reads your GitHub Issues (labeled `product-driven-backlog`) and produces:
130
+
131
+ - **Backlog table** per area — sorted by Total Persona Score
132
+ - **Top 3 recommendations** — ranked by VPC score / effort ratio, filtered to Wave 1 of the safe implementation order
133
+ - **Metadata** — area, persona fit scores, effort estimate, description
134
+ - **Safe Implementation Order** — dependency DAG built from `Prerequisites:` fields in issue bodies; cycles are detected and reported; topological sort determines the order
135
+
136
+ ### Example output
137
+
138
+ ```
139
+ ┌─ API ──────────────────────────────────────────┐
140
+ │ # Issue Score Effort Description │
141
+ │ 1 #85 12/15 Medium Health check endpoint │
142
+ │ 2 #71 10/15 Low Rate limiting │
143
+ │ 3 #63 8/15 High GraphQL migration │
144
+ └─────────────────────────────────────────────────┘
145
+
146
+ Safe Implementation Order (Wave 1):
147
+ 1. #71 — Rate limiting (no prerequisites)
148
+ 2. #85 — Health check (requires #71)
149
+ 3. #63 — GraphQL migration (requires #85)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## `/sr:update-product-driven-backlog`
155
+
156
+ Generate new feature ideas through product discovery. The Product Manager (Opus) researches your competitive landscape and generates ideas evaluated against your personas.
157
+
158
+ ```
159
+ /sr:update-product-driven-backlog # All areas
160
+ /sr:update-product-driven-backlog UI, API # Focus areas
161
+ ```
162
+
163
+ ### What it does
164
+
165
+ 1. Reads all persona files (VPC profiles)
166
+ 2. Researches competitors via web search
167
+ 3. Generates 2–4 feature ideas per area
168
+ 4. Scores each against every persona (0–5)
169
+ 5. Creates GitHub Issues (if write access) or displays for manual creation
170
+
171
+ ---
172
+
173
+ ## `/sr:health-check`
174
+
175
+ Run a comprehensive codebase quality analysis.
176
+
177
+ ```
178
+ /sr:health-check
179
+ ```
180
+
181
+ Analyzes code quality, test coverage, technical debt, and dependency health. Compares with previous runs to detect regressions.
182
+
183
+ ---
184
+
185
+ ## `/sr:refactor-recommender`
186
+
187
+ Scan for refactoring opportunities ranked by impact/effort ratio.
188
+
189
+ ```
190
+ /sr:refactor-recommender
191
+ ```
192
+
193
+ Identifies duplicates, long functions, large files, dead code, outdated patterns, and complex logic. Optionally creates GitHub Issues for tracking.
194
+
195
+ ---
196
+
197
+ ## `/sr:compat-check`
198
+
199
+ Analyze the backwards compatibility impact of a proposed change before implementation.
200
+
201
+ ```
202
+ /sr:compat-check #85 # Check a specific issue
203
+ /sr:compat-check #85 --save # Check and save as the new API baseline
204
+ ```
205
+
206
+ The Architect's Phase 6 auto-check runs this analysis as part of every `/sr:implement` pipeline. You can also run it standalone to evaluate a change before committing to it.
207
+
208
+ ### What it detects
209
+
210
+ | Category | Examples |
211
+ |----------|---------|
212
+ | **Removed endpoints** | Deleted routes, removed methods |
213
+ | **Changed signatures** | Parameter renames, type changes, reordered args |
214
+ | **Changed response shapes** | Added required fields, removed fields, type widening |
215
+ | **Behavioral changes** | Changed defaults, altered error codes, modified side effects |
216
+
217
+ When breaking changes are found, `compat-check` generates a **migration guide** describing what callers need to update.
218
+
219
+ ---
220
+
221
+ ## `/sr:why`
222
+
223
+ Search agent explanation records in plain language.
224
+
225
+ ```
226
+ /sr:why "why did we switch to event sourcing"
227
+ /sr:why "why is pagination implemented this way"
228
+ /sr:why "explain the auth middleware design"
229
+ ```
230
+
231
+ The Architect, Developer, and Reviewer record decision rationale in `.claude/agent-memory/explanations/` as they work. `/sr:why` searches these records semantically and surfaces the relevant context.
232
+
233
+ This is useful for onboarding, code review, and revisiting past decisions without digging through git history.
234
+
235
+ ---
236
+
237
+ ## OpenSpec commands
238
+
239
+ These commands manage the structured design-to-code workflow powered by [OpenSpec](https://openspec.dev).
240
+
241
+ ### `/opsx:ff` — Fast Forward
242
+
243
+ Create a change and generate **all artifacts at once** (proposal → design → tasks → context bundle). Use this when you know what you want to build and don't need to step through each artifact.
244
+
245
+ ```
246
+ /opsx:ff
247
+ ```
248
+
249
+ ### `/opsx:new` — New Change
250
+
251
+ Start a new change with the step-by-step artifact workflow. Creates a proposal first, then you advance through each artifact.
252
+
253
+ ```
254
+ /opsx:new
255
+ ```
256
+
257
+ ### `/opsx:continue` — Continue Change
258
+
259
+ Resume work on an in-progress change. Creates the next artifact in the sequence.
260
+
261
+ ```
262
+ /opsx:continue
263
+ ```
264
+
265
+ ### `/opsx:apply` — Apply Change
266
+
267
+ Implement the tasks from a designed change. Hands off to the Developer agent.
268
+
269
+ ```
270
+ /opsx:apply
271
+ ```
272
+
273
+ ### `/opsx:verify` — Verify Change
274
+
275
+ Validate that implementation matches the change artifacts before archiving.
276
+
277
+ ```
278
+ /opsx:verify
279
+ ```
280
+
281
+ ### `/opsx:archive` — Archive Change
282
+
283
+ Finalize and archive a completed change. Moves it from active to archived.
284
+
285
+ ```
286
+ /opsx:archive
287
+ ```
288
+
289
+ ### `/opsx:explore` — Explore
290
+
291
+ Open-ended thinking mode. Use for brainstorming, investigating problems, or clarifying requirements before creating a change.
292
+
293
+ ```
294
+ /opsx:explore
295
+ ```
296
+
297
+ ### Typical OpenSpec flow
298
+
299
+ ```
300
+ /opsx:ff → Architect creates all artifacts
301
+ /opsx:apply → Developer implements
302
+ /opsx:verify → Validate implementation
303
+ /opsx:archive → Finalize and archive
304
+ ```
305
+
306
+ Or step by step:
307
+
308
+ ```
309
+ /opsx:new → Create proposal
310
+ /opsx:continue → Create design
311
+ /opsx:continue → Create tasks
312
+ /opsx:continue → Create context bundle
313
+ /opsx:apply → Implement
314
+ /opsx:archive → Archive
315
+ ```
316
+
317
+ ---
318
+
319
+ ## `/sr:retry`
320
+
321
+ Resume a failed `/sr:implement` run from the last successful phase — without restarting from scratch.
322
+
323
+ ```
324
+ /sr:retry <feature-name> # Resume from the failed phase
325
+ /sr:retry --list # List all available pipeline states
326
+ /sr:retry <feature-name> --from architect # Force resume from a specific phase
327
+ /sr:retry <feature-name> --dry-run # Resume in preview mode
328
+ ```
329
+
330
+ When a pipeline fails mid-run (e.g., the reviewer hits a flaky CI issue), SpecRails saves pipeline state to `.claude/pipeline-state/<feature-name>.json`. `/sr:retry` reads that state, identifies which phases completed, and re-executes only the remaining phases.
331
+
332
+ Valid `--from` phase values: `architect`, `developer`, `test-writer`, `doc-sync`, `reviewer`, `ship`, `ci`.
333
+
334
+ ---
335
+
336
+ ## `/sr:vpc-drift`
337
+
338
+ Detect when your VPC personas have drifted from what your product actually delivers.
339
+
340
+ ```
341
+ /sr:vpc-drift # Analyze all personas
342
+ /sr:vpc-drift --persona "Alex,Sara" # Filter to specific personas
343
+ /sr:vpc-drift --verbose # Show full attribute lists
344
+ /sr:vpc-drift --format json # Emit report as JSON
345
+ ```
346
+
347
+ Compares persona Jobs/Pains/Gains against the product backlog, implemented features, and agent memory to surface alignment gaps. Produces a per-persona alignment score and concrete recommendations for updating your VPC.
348
+
349
+ Run this when your backlog feels disconnected from your users, or after a major product pivot.
350
+
351
+ ---
352
+
353
+ ## `/sr:memory-inspect`
354
+
355
+ Inspect agent memory directories to understand what your agents remember and clean up stale data.
356
+
357
+ ```
358
+ /sr:memory-inspect # Inspect all agent memory
359
+ /sr:memory-inspect sr-developer # Inspect a specific agent
360
+ /sr:memory-inspect --stale 14 # Flag files older than 14 days
361
+ /sr:memory-inspect --prune # Delete stale files (after confirmation)
362
+ ```
363
+
364
+ Agents write persistent memory to `.claude/agent-memory/sr-*/`. Over time this can accumulate stale or orphaned files. `/sr:memory-inspect` shows per-agent stats (file count, size, last modified), recent entries, and actionable cleanup recommendations.
365
+
366
+ ---
367
+
368
+ ## `/sr:propose-spec`
369
+
370
+ Explore a feature idea and produce a structured proposal ready for the OpenSpec pipeline.
371
+
372
+ ```
373
+ /sr:propose-spec "add rate limiting to the API"
374
+ ```
375
+
376
+ The command explores your codebase to understand existing patterns, then produces a structured proposal with: problem statement, proposed solution, out-of-scope items, acceptance criteria, technical considerations, and a complexity estimate.
377
+
378
+ Use this before creating a GitHub Issue when you want a well-formed spec rather than a rough idea.
379
+
380
+ ---
381
+
382
+ ## Preview mode
383
+
384
+ Any workflow can be run in preview mode to see what would happen without making changes:
385
+
386
+ ```
387
+ /sr:implement --dry-run #85
388
+ ```
389
+
390
+ Preview mode runs the full pipeline but skips:
391
+ - Git operations (no commits, no branches)
392
+ - PR creation
393
+ - Backlog updates
394
+
395
+ The results are cached. Apply them later with:
396
+
397
+ ```
398
+ /sr:implement --apply health-check-endpoint
399
+ ```
400
+
401
+ ---
402
+
403
+ ## What's next?
404
+
405
+ - [Customization](customization.md) — adapt agents, rules, and personas to your project
406
+ - [Updating](updating.md) — keep SpecRails up to date
407
+
408
+ ---
409
+
410
+ [← Agents](agents.md) · [Customization →](customization.md)
package/install.sh CHANGED
@@ -35,6 +35,8 @@ NC='\033[0m'
35
35
 
36
36
  CUSTOM_ROOT_DIR=""
37
37
  AUTO_YES=false
38
+ # Set SPECRAILS_SKIP_PREREQS=1 to bypass hard-exit prerequisite checks (for CI/testing).
39
+ SKIP_PREREQS="${SPECRAILS_SKIP_PREREQS:-0}"
38
40
 
39
41
  while [[ $# -gt 0 ]]; do
40
42
  case "$1" in
@@ -189,6 +191,8 @@ fi
189
191
  if command -v claude &> /dev/null; then
190
192
  CLAUDE_VERSION=$(claude --version 2>/dev/null || echo "unknown")
191
193
  ok "Claude Code CLI: $CLAUDE_VERSION"
194
+ elif [[ "$SKIP_PREREQS" == "1" ]]; then
195
+ warn "Claude Code CLI not found (skipped — SPECRAILS_SKIP_PREREQS=1)"
192
196
  else
193
197
  fail "Claude Code CLI not found."
194
198
  echo ""
@@ -199,6 +203,8 @@ fi
199
203
  # 1.3 API key
200
204
  if claude config list 2>/dev/null | grep -q "api_key" || [[ -n "${ANTHROPIC_API_KEY:-}" ]]; then
201
205
  ok "Claude API key: configured"
206
+ elif [[ "$SKIP_PREREQS" == "1" ]]; then
207
+ warn "No Claude API key configured (skipped — SPECRAILS_SKIP_PREREQS=1)"
202
208
  else
203
209
  fail "No Claude API key configured."
204
210
  echo ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specrails-core",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
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"
@@ -13,6 +13,7 @@
13
13
  "prompts/",
14
14
  ".claude/skills/",
15
15
  "commands/",
16
+ "docs/",
16
17
  "VERSION",
17
18
  "integration-contract.json"
18
19
  ],