specrails 0.2.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 (74) hide show
  1. package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
  2. package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
  3. package/.claude/skills/openspec-bulk-archive-change/SKILL.md +246 -0
  4. package/.claude/skills/openspec-continue-change/SKILL.md +118 -0
  5. package/.claude/skills/openspec-explore/SKILL.md +290 -0
  6. package/.claude/skills/openspec-ff-change/SKILL.md +101 -0
  7. package/.claude/skills/openspec-new-change/SKILL.md +74 -0
  8. package/.claude/skills/openspec-onboard/SKILL.md +529 -0
  9. package/.claude/skills/openspec-sync-specs/SKILL.md +138 -0
  10. package/.claude/skills/openspec-verify-change/SKILL.md +168 -0
  11. package/README.md +226 -0
  12. package/VERSION +1 -0
  13. package/bin/specrails.js +41 -0
  14. package/commands/setup.md +851 -0
  15. package/install.sh +488 -0
  16. package/package.json +34 -0
  17. package/prompts/analyze-codebase.md +87 -0
  18. package/prompts/generate-personas.md +61 -0
  19. package/prompts/infer-conventions.md +72 -0
  20. package/templates/agents/sr-architect.md +194 -0
  21. package/templates/agents/sr-backend-developer.md +54 -0
  22. package/templates/agents/sr-backend-reviewer.md +139 -0
  23. package/templates/agents/sr-developer.md +146 -0
  24. package/templates/agents/sr-doc-sync.md +167 -0
  25. package/templates/agents/sr-frontend-developer.md +48 -0
  26. package/templates/agents/sr-frontend-reviewer.md +132 -0
  27. package/templates/agents/sr-product-analyst.md +36 -0
  28. package/templates/agents/sr-product-manager.md +148 -0
  29. package/templates/agents/sr-reviewer.md +265 -0
  30. package/templates/agents/sr-security-reviewer.md +178 -0
  31. package/templates/agents/sr-test-writer.md +163 -0
  32. package/templates/claude-md/root.md +50 -0
  33. package/templates/commands/sr/batch-implement.md +282 -0
  34. package/templates/commands/sr/compat-check.md +271 -0
  35. package/templates/commands/sr/health-check.md +396 -0
  36. package/templates/commands/sr/implement.md +972 -0
  37. package/templates/commands/sr/product-backlog.md +195 -0
  38. package/templates/commands/sr/refactor-recommender.md +169 -0
  39. package/templates/commands/sr/update-product-driven-backlog.md +272 -0
  40. package/templates/commands/sr/why.md +96 -0
  41. package/templates/personas/persona.md +43 -0
  42. package/templates/personas/the-maintainer.md +78 -0
  43. package/templates/rules/layer.md +8 -0
  44. package/templates/security/security-exemptions.yaml +20 -0
  45. package/templates/settings/confidence-config.json +17 -0
  46. package/templates/settings/settings.json +15 -0
  47. package/templates/web-manager/README.md +107 -0
  48. package/templates/web-manager/client/index.html +12 -0
  49. package/templates/web-manager/client/package-lock.json +1727 -0
  50. package/templates/web-manager/client/package.json +20 -0
  51. package/templates/web-manager/client/src/App.tsx +83 -0
  52. package/templates/web-manager/client/src/components/AgentActivity.tsx +19 -0
  53. package/templates/web-manager/client/src/components/CommandInput.tsx +81 -0
  54. package/templates/web-manager/client/src/components/LogStream.tsx +57 -0
  55. package/templates/web-manager/client/src/components/PipelineSidebar.tsx +65 -0
  56. package/templates/web-manager/client/src/components/SearchBox.tsx +34 -0
  57. package/templates/web-manager/client/src/hooks/usePipeline.ts +62 -0
  58. package/templates/web-manager/client/src/hooks/useWebSocket.ts +59 -0
  59. package/templates/web-manager/client/src/main.tsx +9 -0
  60. package/templates/web-manager/client/tsconfig.json +21 -0
  61. package/templates/web-manager/client/tsconfig.node.json +11 -0
  62. package/templates/web-manager/client/vite.config.ts +13 -0
  63. package/templates/web-manager/package-lock.json +3327 -0
  64. package/templates/web-manager/package.json +30 -0
  65. package/templates/web-manager/server/hooks.test.ts +196 -0
  66. package/templates/web-manager/server/hooks.ts +71 -0
  67. package/templates/web-manager/server/index.test.ts +186 -0
  68. package/templates/web-manager/server/index.ts +99 -0
  69. package/templates/web-manager/server/spawner.test.ts +319 -0
  70. package/templates/web-manager/server/spawner.ts +89 -0
  71. package/templates/web-manager/server/types.ts +46 -0
  72. package/templates/web-manager/tsconfig.json +14 -0
  73. package/templates/web-manager/vitest.config.ts +8 -0
  74. package/update.sh +877 -0
@@ -0,0 +1,96 @@
1
+ # /sr:why — In-Context Help
2
+
3
+ Searches explanation records written by sr-architect, sr-developer, and sr-reviewer agents
4
+ during the OpenSpec implementation pipeline.
5
+
6
+ Records are stored in `.claude/agent-memory/explanations/` as Markdown files with
7
+ YAML frontmatter (agent, feature, tags, date).
8
+
9
+ **Usage:**
10
+ - `/sr:why` — list the 20 most recent explanation records
11
+ - `/sr:why <query>` — search records by keyword or tag
12
+
13
+ ---
14
+
15
+ ## Step 1: Find explanation records
16
+
17
+ Glob all files matching `.claude/agent-memory/explanations/*.md`.
18
+
19
+ If the directory does not exist or contains no files:
20
+ Print:
21
+ ```
22
+ No explanation records found yet.
23
+
24
+ Explanation records are written by the sr-architect, sr-developer, and sr-reviewer agents
25
+ when they make significant decisions during feature implementation.
26
+
27
+ Run `/sr:implement` on a feature to generate your first explanation records.
28
+ ```
29
+ Then stop.
30
+
31
+ ## Step 2: Handle no-argument mode (listing)
32
+
33
+ If `$ARGUMENTS` is empty:
34
+
35
+ Read each explanation record file. Extract from frontmatter: `date`, `agent`, `feature`, `tags`.
36
+ Extract the first sentence of the `## Decision` section as the decision summary.
37
+
38
+ Sort records by `date` descending. Print the 20 most recent as a Markdown table:
39
+
40
+ ```
41
+ ## Recent Explanation Records
42
+
43
+ | Date | Agent | Feature | Tags | Decision |
44
+ |------|-------|---------|------|----------|
45
+ | 2026-03-14 | sr-architect | in-context-help | [templates, commands] | Chose flat directory over per-agent subdirectories. |
46
+ | ... | ... | ... | ... | ... |
47
+ ```
48
+
49
+ Then stop.
50
+
51
+ ## Step 3: Handle query mode (search)
52
+
53
+ If `$ARGUMENTS` is non-empty, treat the full string as the search query.
54
+
55
+ For each explanation record file:
56
+ 1. Read the full file content
57
+ 2. Score the record against the query:
58
+ - Filename contains a query word: +3 points per matching word
59
+ - Frontmatter `tags` array contains an exact query word: +3 points per matching tag
60
+ - Frontmatter `feature` contains a query word: +2 points
61
+ - Body text contains a query word: +1 point per occurrence (case-insensitive)
62
+ 3. Sum the score
63
+
64
+ Sort records by score descending. Take the top 5 records with score > 0.
65
+
66
+ If no records score > 0:
67
+ Print:
68
+ ```
69
+ No explanation records match "<query>".
70
+ ```
71
+ Then list all unique tags from existing records:
72
+ ```
73
+ ## Available Tags
74
+
75
+ [sorted list of all unique tags from all explanation records]
76
+
77
+ Try `/sr:why <tag>` with one of the tags above, or `/sr:why` to browse all records.
78
+ ```
79
+
80
+ If records match, print each matching record in full, separated by `---`:
81
+
82
+ ```
83
+ ## Results for "<query>" (N matches)
84
+
85
+ ---
86
+
87
+ **[date] [agent] — [feature]**
88
+ Tags: [tag1, tag2]
89
+
90
+ [full record body]
91
+
92
+ ---
93
+
94
+ **[date] [agent] — [feature]**
95
+ ...
96
+ ```
@@ -0,0 +1,43 @@
1
+ # Persona: {{PERSONA_NAME}}
2
+
3
+ > {{PERSONA_TAGLINE}}
4
+
5
+ ## Profile
6
+
7
+ | Field | Value |
8
+ |-------|-------|
9
+ | **Name** | "{{PERSONA_NICKNAME}}" — The {{PERSONA_ROLE}} |
10
+ | **Age** | {{PERSONA_AGE_RANGE}} |
11
+ {{PERSONA_PROFILE_FIELDS}}
12
+
13
+ ## Behaviors
14
+
15
+ {{PERSONA_BEHAVIORS}}
16
+
17
+ ## Value Proposition Canvas
18
+
19
+ ### Customer Jobs
20
+
21
+ | Type | Job |
22
+ |------|-----|
23
+ {{PERSONA_JOBS}}
24
+
25
+ ### Pains
26
+
27
+ | Severity | Pain |
28
+ |----------|------|
29
+ {{PERSONA_PAINS}}
30
+
31
+ ### Gains
32
+
33
+ | Impact | Gain |
34
+ |--------|------|
35
+ {{PERSONA_GAINS}}
36
+
37
+ ## Key Insight
38
+
39
+ > {{PERSONA_KEY_INSIGHT}}
40
+
41
+ ## Sources
42
+
43
+ {{PERSONA_SOURCES}}
@@ -0,0 +1,78 @@
1
+ # Persona: The Maintainer
2
+
3
+ > "I maintain this project in my spare time. Every hour I save on routine work is an hour I can spend on what actually matters."
4
+
5
+ ## Profile
6
+
7
+ | Field | Value |
8
+ |-------|-------|
9
+ | **Name** | "Kai" — The Maintainer |
10
+ | **Age** | 25-45 |
11
+ | **Role** | Open-source maintainer, often solo or with 1-3 co-maintainers |
12
+ | **Projects** | 1-5 active repos, ranging from 100 to 50k+ stars |
13
+ | **Experience** | Deep expertise in their project's domain; variable breadth across stacks |
14
+ | **Tools today** | GitHub (Issues, PRs, Actions), Dependabot, CodeQL, Claude Code or Copilot |
15
+ | **Spending** | $0-20/month (OSS maintainers are cost-sensitive; many rely on free tiers/sponsorships) |
16
+ | **Tech comfort** | Very high — but time-poor; optimizes for efficiency above all |
17
+
18
+ ## Behaviors
19
+
20
+ - Reviews 5-50 PRs per week, most from contributors they've never met
21
+ - Spends disproportionate time on triage — labeling issues, requesting info, closing duplicates
22
+ - Deeply skeptical of AI-generated PRs and "drive-by" contributions
23
+ - Values consistency and backwards compatibility over new features
24
+ - Writes detailed contributing guides but contributors rarely read them
25
+ - Burns out from the imbalance: contribution volume grows but maintainer capacity doesn't
26
+ - Will adopt automation that reduces their review burden without sacrificing quality
27
+
28
+ ## Value Proposition Canvas
29
+
30
+ ### Customer Jobs
31
+
32
+ | Type | Job |
33
+ |------|-----|
34
+ | Functional | Review and merge contributions efficiently without sacrificing quality |
35
+ | Functional | Maintain coding standards across a growing contributor base |
36
+ | Functional | Triage issues and PRs — separate signal from noise |
37
+ | Functional | Keep CI/CD green and catch regressions early |
38
+ | Social | Build a healthy community where contributors feel welcomed and guided |
39
+ | Emotional | Avoid burnout from the growing volume of contributions and issues |
40
+ | Emotional | Feel that their project is sustainable, not just surviving |
41
+
42
+ ### Pains
43
+
44
+ | Severity | Pain |
45
+ |----------|------|
46
+ | Critical | "Eternal September" — AI lowers contribution friction, flooding maintainers with low-quality PRs |
47
+ | Critical | Review burden scales with contributors but maintainer time doesn't |
48
+ | High | AI-generated contributions that look plausible but miss project conventions or architectural intent |
49
+ | High | No way to enforce project-specific coding standards automatically beyond basic linting |
50
+ | Medium | Automated scanning tools (security, code quality) generate noise — hard to distinguish real issues |
51
+ | Medium | Onboarding contributors to the project's specific patterns and conventions is time-consuming |
52
+ | Medium | Feature requests pile up with no framework to evaluate which ones matter most to users |
53
+ | Low | Sponsorship/funding doesn't scale with project popularity or maintenance burden |
54
+
55
+ ### Gains
56
+
57
+ | Impact | Gain |
58
+ |--------|------|
59
+ | High | Automated review that enforces project-specific conventions, not just generic lint rules |
60
+ | High | AI reviewer that knows the codebase deeply — catches architectural violations, not just style issues |
61
+ | High | Reduced time spent on routine reviews, freeing time for design decisions and community |
62
+ | Medium | Structured feature prioritization based on actual user needs (not loudest voices) |
63
+ | Medium | Implementation pipeline that lets maintainers describe features and get convention-compliant PRs |
64
+ | Medium | Institutional memory — the AI system remembers past decisions and enforces them consistently |
65
+ | Low | Easy setup that works with existing GitHub-based workflows (Issues, Actions, PRs) |
66
+ | Low | Free or very low cost for open-source projects |
67
+
68
+ ## Key Insight
69
+
70
+ > Open-source maintainers are the most **time-constrained** users in the software ecosystem. They don't need more AI to *write* code — they need AI that *understands their project deeply enough* to review contributions, enforce conventions, and handle routine tasks so they can focus on architecture and community. The key unlock is project-specific intelligence, not generic coding ability.
71
+
72
+ ## Sources
73
+
74
+ - [GitHub Blog — Welcome to the Eternal September of Open Source](https://github.blog/open-source/maintainers/welcome-to-the-eternal-september-of-open-source-heres-what-we-plan-to-do-for-maintainers/)
75
+ - [st0012.dev — AI and Open Source: A Maintainer's Take (End of 2025)](https://st0012.dev/2025/12/30/ai-and-open-source-a-maintainers-take-end-of-2025/)
76
+ - [The New Stack — Open Source: Inside 2025's 4 Biggest Trends](https://thenewstack.io/open-source-inside-2025s-4-biggest-trends/)
77
+ - [Anthropic — 2026 Agentic Coding Trends Report](https://resources.anthropic.com/hubfs/2026%20Agentic%20Coding%20Trends%20Report.pdf)
78
+ - [Augment Code — 6 Best Devin Alternatives for AI Agent Orchestration](https://www.augmentcode.com/tools/best-devin-alternatives)
@@ -0,0 +1,8 @@
1
+ ---
2
+ paths:
3
+ - "{{LAYER_PATH}}/**"
4
+ ---
5
+
6
+ # {{LAYER_NAME}} Conventions
7
+
8
+ {{LAYER_CONVENTIONS}}
@@ -0,0 +1,20 @@
1
+ # Security scan exemptions
2
+ #
3
+ # Add entries here to suppress known false positives from the security-reviewer agent.
4
+ # All exemptions are tracked in git — every addition is auditable.
5
+ #
6
+ # Fields:
7
+ # secrets.pattern - Description of the pattern being exempted (for documentation)
8
+ # secrets.reason - Required: why this is a known false positive
9
+ # secrets.added_by - Required: who added this exemption
10
+ # secrets.added_on - Required: ISO 8601 date (YYYY-MM-DD)
11
+ #
12
+ # vulnerabilities.rule - The vulnerability rule name being exempted
13
+ # vulnerabilities.file - Optional: scope exemption to a specific file path
14
+ # vulnerabilities.reason - Required: justification
15
+ # vulnerabilities.added_by - Required
16
+ # vulnerabilities.added_on - Required
17
+
18
+ exemptions:
19
+ secrets: []
20
+ vulnerabilities: []
@@ -0,0 +1,17 @@
1
+ {
2
+ "_docs": "specrails confidence gate configuration. Installed to .claude/confidence-config.json by /setup.",
3
+ "schema_version": "1",
4
+ "enabled": true,
5
+ "thresholds": {
6
+ "overall": 70,
7
+ "aspects": {
8
+ "type_correctness": 60,
9
+ "pattern_adherence": 60,
10
+ "test_coverage": 60,
11
+ "security": 75,
12
+ "architectural_alignment": 60
13
+ }
14
+ },
15
+ "on_breach": "block",
16
+ "override_allowed": true
17
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read",
5
+ "Write",
6
+ "Edit",
7
+ "Glob",
8
+ "Grep",
9
+ "Agent",
10
+ "Skill",
11
+ "ToolSearch",
12
+ "{{PERMISSION_ENTRIES}}"
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,107 @@
1
+ # specrails Web Manager
2
+
3
+ ## Overview
4
+
5
+ The specrails web manager is a locally-run dashboard that monitors and controls the specrails pipeline. It visualizes the four pipeline phases (Architect, Developer, Reviewer, Ship) with live state indicators, streams logs in real-time from spawned `claude` CLI processes, and lets you launch pipeline commands directly from the browser.
6
+
7
+ ## Prerequisites
8
+
9
+ - Node.js 18 or later
10
+ - `claude` CLI on your PATH (the `claude` binary from the Claude Code CLI)
11
+
12
+ ## Setup
13
+
14
+ ```bash
15
+ cd web
16
+ npm install
17
+ ```
18
+
19
+ This installs both the server dependencies (Express, WebSocket) and the client dependencies (React, Vite).
20
+
21
+ ## Start
22
+
23
+ ```bash
24
+ npm run dev
25
+ ```
26
+
27
+ This starts two processes concurrently:
28
+ - **Backend server** on `http://127.0.0.1:4200`
29
+ - **Frontend client** on `http://localhost:4201`
30
+
31
+ Open `http://localhost:4201` in your browser to view the dashboard.
32
+
33
+ ## CLI Options
34
+
35
+ The server accepts these CLI flags (used with `npm run dev:server` or `tsx server/index.ts`):
36
+
37
+ | Flag | Default | Description |
38
+ |------|---------|-------------|
39
+ | `--project <name>` | `specrails` | Project name displayed in the dashboard header |
40
+ | `--port <n>` | `4200` | Port the backend server listens on |
41
+
42
+ Example:
43
+
44
+ ```bash
45
+ tsx server/index.ts --project my-app --port 4000
46
+ ```
47
+
48
+ ## Hook Integration
49
+
50
+ The web manager accepts Claude Code hook events at `POST /hooks/events`. Configure hooks in the target project's `.claude/settings.json` to POST phase transitions as the pipeline runs.
51
+
52
+ Example `.claude/settings.json` entry for the target repo:
53
+
54
+ ```json
55
+ {
56
+ "hooks": {
57
+ "PreToolUse": [],
58
+ "PostToolUse": []
59
+ }
60
+ }
61
+ ```
62
+
63
+ To manually fire a hook event (useful for testing):
64
+
65
+ ```bash
66
+ # Mark the architect phase as running
67
+ curl -X POST http://localhost:4200/hooks/events \
68
+ -H 'Content-Type: application/json' \
69
+ -d '{"event":"agent_start","agent":"architect"}'
70
+
71
+ # Mark the architect phase as done
72
+ curl -X POST http://localhost:4200/hooks/events \
73
+ -H 'Content-Type: application/json' \
74
+ -d '{"event":"agent_stop","agent":"architect"}'
75
+
76
+ # Mark the developer phase as errored
77
+ curl -X POST http://localhost:4200/hooks/events \
78
+ -H 'Content-Type: application/json' \
79
+ -d '{"event":"agent_error","agent":"developer"}'
80
+ ```
81
+
82
+ Supported `agent` values: `architect`, `developer`, `reviewer`, `ship`
83
+
84
+ Supported `event` values: `agent_start`, `agent_stop`, `agent_error`
85
+
86
+ Unknown agents or events are ignored (the server returns 200 and logs a warning).
87
+
88
+ ## Command Examples
89
+
90
+ Type these in the Actions input at the bottom of the sidebar and press Enter or click Run:
91
+
92
+ ```
93
+ /implement #42
94
+ /opsx:ff
95
+ /review
96
+ ```
97
+
98
+ The dashboard spawns `claude --dangerously-skip-permissions <command>` and streams all output to the log panel.
99
+
100
+ ## MVP Limitations
101
+
102
+ The following are explicitly out of scope for this MVP:
103
+
104
+ - **No log persistence** — logs are in-memory only; restarting the server clears all history
105
+ - **No authentication** — the server binds to `127.0.0.1` (loopback only); do not expose it to a network
106
+ - **No multi-project UI** — one project per server instance; run multiple servers on different ports for multiple projects
107
+ - **One active process at a time** — submitting a command while one is running returns a 409 error; wait for the current process to finish
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>specrails manager</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>