specrails-core 1.7.0 → 1.7.2
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/bin/specrails-core.js +24 -7
- package/docs/README.md +37 -0
- package/docs/agents.md +273 -0
- package/docs/api-reference.md +266 -0
- package/docs/changelog.md +151 -0
- package/docs/concepts.md +183 -0
- package/docs/customization.md +320 -0
- package/docs/deployment.md +217 -0
- package/docs/getting-started.md +107 -0
- package/docs/installation.md +243 -0
- package/docs/playbook-oss-maintainer.md +112 -0
- package/docs/playbook-parallel-dev.md +124 -0
- package/docs/playbook-product-discovery.md +115 -0
- package/docs/updating.md +96 -0
- package/docs/workflows.md +410 -0
- package/install.sh +6 -0
- package/package.json +2 -1
- package/update.sh +11 -11
package/bin/specrails-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { spawnSync } = require("child_process");
|
|
4
4
|
const { resolve } = require("path");
|
|
5
5
|
|
|
6
6
|
const ROOT = resolve(__dirname, "..");
|
|
@@ -33,11 +33,28 @@ if (!script) {
|
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// Allowlisted flags per subcommand (defense-in-depth — spawnSync already
|
|
37
|
+
// prevents shell injection, but an explicit allowlist rejects unknown flags
|
|
38
|
+
// before the shell script is ever invoked).
|
|
39
|
+
const ALLOWED_FLAGS = {
|
|
40
|
+
init: ["--root-dir", "--yes", "-y"],
|
|
41
|
+
update: ["--only"],
|
|
42
|
+
doctor: [],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const subargs = args.slice(1);
|
|
46
|
+
const allowed = ALLOWED_FLAGS[subcommand] ?? [];
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
for (const arg of subargs) {
|
|
49
|
+
if (arg.startsWith("-") && !allowed.includes(arg)) {
|
|
50
|
+
console.error(`Unknown flag: ${arg}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
43
53
|
}
|
|
54
|
+
|
|
55
|
+
const result = spawnSync("bash", [resolve(ROOT, script), ...subargs], {
|
|
56
|
+
stdio: "inherit",
|
|
57
|
+
cwd: process.cwd(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
process.exit(result.status ?? (result.error ? 1 : 0));
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SpecRails Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the SpecRails docs. This guide will take you from zero to a fully autonomous product-driven development workflow.
|
|
4
|
+
|
|
5
|
+
## Start here
|
|
6
|
+
|
|
7
|
+
| Guide | What you'll learn |
|
|
8
|
+
|-------|-------------------|
|
|
9
|
+
| [Getting Started](getting-started.md) | Install SpecRails and run your first workflow in 5 minutes |
|
|
10
|
+
| [Core Concepts](concepts.md) | Understand the pipeline, agents, and product-driven approach |
|
|
11
|
+
|
|
12
|
+
## Deep dives
|
|
13
|
+
|
|
14
|
+
| Guide | What it covers |
|
|
15
|
+
|-------|----------------|
|
|
16
|
+
| [Installation & Setup](installation.md) | Detailed setup, prerequisites, the `/setup` wizard |
|
|
17
|
+
| [Agents](agents.md) | Every agent explained — role, when it runs, why it exists |
|
|
18
|
+
| [Workflows & Commands](workflows.md) | How to use `/sr:implement`, `/sr:product-backlog`, and more |
|
|
19
|
+
| [Customization](customization.md) | Adapt agents, rules, personas, and conventions to your project |
|
|
20
|
+
| [Updating](updating.md) | Keep SpecRails up to date without losing your customizations |
|
|
21
|
+
|
|
22
|
+
## Reading order
|
|
23
|
+
|
|
24
|
+
These docs are designed to be read front-to-back:
|
|
25
|
+
|
|
26
|
+
1. **Getting Started** — get running fast
|
|
27
|
+
2. **Core Concepts** — understand _why_ before _how_
|
|
28
|
+
3. **Agents** — meet the team
|
|
29
|
+
4. **Workflows & Commands** — put them to work
|
|
30
|
+
5. **Customization** — make it yours
|
|
31
|
+
6. **Updating** — keep it fresh
|
|
32
|
+
|
|
33
|
+
Each page links to the next, so you can follow along naturally.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
[Get started →](getting-started.md)
|
package/docs/agents.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Agents
|
|
2
|
+
|
|
3
|
+
SpecRails ships with **12 specialized agents**. Each has a clear role, a dedicated AI model, and knows exactly when to stay in its lane.
|
|
4
|
+
|
|
5
|
+
## Why specialized agents?
|
|
6
|
+
|
|
7
|
+
A single "do everything" prompt gets mediocre results. By splitting responsibilities, each agent:
|
|
8
|
+
|
|
9
|
+
- Has a **focused system prompt** optimized for its task
|
|
10
|
+
- Uses the **right model** for the job (Opus for creative work, Sonnet for implementation, Haiku for analysis)
|
|
11
|
+
- Maintains **its own memory** across sessions
|
|
12
|
+
- Loads only the **relevant conventions** for its scope
|
|
13
|
+
|
|
14
|
+
The result: better quality at every stage, with clear accountability.
|
|
15
|
+
|
|
16
|
+
## Agent roster
|
|
17
|
+
|
|
18
|
+
### Product Manager
|
|
19
|
+
|
|
20
|
+
| | |
|
|
21
|
+
|-|-|
|
|
22
|
+
| **Color** | Blue |
|
|
23
|
+
| **Model** | Opus (creative reasoning) |
|
|
24
|
+
| **Trigger** | `/opsx:explore`, `/sr:update-product-driven-backlog` |
|
|
25
|
+
| **Role** | Feature ideation and product strategy |
|
|
26
|
+
|
|
27
|
+
The Product Manager is the **starting point** of the pipeline. It researches your competitive landscape (via web search), evaluates ideas against your user personas using the VPC framework, and produces prioritized feature recommendations.
|
|
28
|
+
|
|
29
|
+
**Why Opus?** Product thinking requires creative reasoning and nuanced judgment — weighing user needs, market trends, and technical feasibility simultaneously. Opus excels at this kind of open-ended analysis.
|
|
30
|
+
|
|
31
|
+
**What it produces:**
|
|
32
|
+
- Feature ideas organized by area
|
|
33
|
+
- VPC scores per persona (0–5)
|
|
34
|
+
- Effort estimates
|
|
35
|
+
- Competitive inspiration sources
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### Product Analyst
|
|
40
|
+
|
|
41
|
+
| | |
|
|
42
|
+
|-|-|
|
|
43
|
+
| **Color** | Cyan |
|
|
44
|
+
| **Model** | Haiku (fast, read-only) |
|
|
45
|
+
| **Trigger** | `/sr:product-backlog` |
|
|
46
|
+
| **Role** | Backlog analysis and reporting |
|
|
47
|
+
|
|
48
|
+
The Product Analyst is a **read-only** agent. It reads your backlog, specs, and archived changes to produce structured reports. It never writes code or makes decisions — it just gives you the data.
|
|
49
|
+
|
|
50
|
+
**Why Haiku?** Analysis tasks need speed, not deep reasoning. Haiku is fast and cheap, perfect for reading and summarizing large amounts of data.
|
|
51
|
+
|
|
52
|
+
**What it produces:**
|
|
53
|
+
- Prioritized backlog tables grouped by area
|
|
54
|
+
- Top 3 recommendations ranked by VPC score / effort ratio
|
|
55
|
+
- Spec gap analysis (what's specified vs. what's implemented)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Architect
|
|
60
|
+
|
|
61
|
+
| | |
|
|
62
|
+
|-|-|
|
|
63
|
+
| **Color** | Green |
|
|
64
|
+
| **Model** | Sonnet |
|
|
65
|
+
| **Trigger** | `/opsx:ff`, `/opsx:continue`, `/sr:implement` (Phase 3a) |
|
|
66
|
+
| **Role** | System design and task breakdown |
|
|
67
|
+
|
|
68
|
+
The Architect translates **what to build** into **how to build it**. It reads the relevant specs, analyzes the codebase, and produces a detailed implementation design with ordered tasks.
|
|
69
|
+
|
|
70
|
+
**Why it matters:** Without architecture, developers write code that works locally but breaks the system. The Architect considers cross-cutting concerns, API contracts, data flows, and migration needs before a single line of code is written.
|
|
71
|
+
|
|
72
|
+
**What it produces:**
|
|
73
|
+
- Change summary and impact analysis
|
|
74
|
+
- Implementation design (technical approach per layer)
|
|
75
|
+
- Ordered task breakdown with dependencies
|
|
76
|
+
- Risks and considerations
|
|
77
|
+
- Backwards compatibility impact report (Phase 6 auto-check against API surface)
|
|
78
|
+
|
|
79
|
+
The Architect also records decision rationale in `.claude/agent-memory/explanations/` — queryable later with `/sr:why`.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### Developer
|
|
84
|
+
|
|
85
|
+
| | |
|
|
86
|
+
|-|-|
|
|
87
|
+
| **Color** | Purple |
|
|
88
|
+
| **Model** | Sonnet |
|
|
89
|
+
| **Trigger** | `/opsx:apply`, `/sr:implement` (Phase 3b) |
|
|
90
|
+
| **Role** | Full-stack implementation |
|
|
91
|
+
|
|
92
|
+
The Developer is the **workhorse**. It reads the Architect's design, loads the relevant layer conventions, and writes production-quality code across all layers. It follows a strict process: understand, plan, implement, verify.
|
|
93
|
+
|
|
94
|
+
Before starting implementation, the Developer reads any **failure records** from `.claude/agent-memory/failures/` that match the current task — using past mistakes as guardrails. After implementation, it records decision rationale in `.claude/agent-memory/explanations/`.
|
|
95
|
+
|
|
96
|
+
**What it produces:**
|
|
97
|
+
- Production code across all affected layers
|
|
98
|
+
- Follows existing patterns and conventions
|
|
99
|
+
- Runs CI-equivalent checks before declaring "done"
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Backend Developer & Frontend Developer
|
|
104
|
+
|
|
105
|
+
| | |
|
|
106
|
+
|-|-|
|
|
107
|
+
| **Colors** | Purple (backend), Blue (frontend) |
|
|
108
|
+
| **Model** | Sonnet |
|
|
109
|
+
| **Trigger** | `/sr:implement` with parallel pipeline |
|
|
110
|
+
| **Role** | Layer-specific implementation |
|
|
111
|
+
|
|
112
|
+
For large full-stack features, SpecRails can split work between **Backend Developer** and **Frontend Developer** running in **parallel git worktrees**. Each has a lighter prompt focused on their stack and runs only the relevant CI checks.
|
|
113
|
+
|
|
114
|
+
**Why split?** A backend API and a React component have nothing in common. Splitting them lets each developer focus on their domain, and the work happens concurrently instead of sequentially.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### Test Writer
|
|
119
|
+
|
|
120
|
+
| | |
|
|
121
|
+
|-|-|
|
|
122
|
+
| **Color** | Cyan |
|
|
123
|
+
| **Model** | Sonnet |
|
|
124
|
+
| **Trigger** | `/sr:implement` (Phase 3c) |
|
|
125
|
+
| **Role** | Automated test generation |
|
|
126
|
+
|
|
127
|
+
After the Developer finishes, the Test Writer generates comprehensive tests for the new code. It auto-detects your test framework, reads 3 existing tests to learn your patterns, and targets >80% coverage of new code.
|
|
128
|
+
|
|
129
|
+
**Why a separate agent?** Developers writing their own tests tend to test what they built, not what could break. A separate Test Writer approaches the code fresh, testing edge cases and failure modes the developer might miss.
|
|
130
|
+
|
|
131
|
+
**What it produces:**
|
|
132
|
+
- Test files following your project's conventions
|
|
133
|
+
- Coverage targeting >80% of new code
|
|
134
|
+
- Never modifies implementation files
|
|
135
|
+
|
|
136
|
+
**Supported frameworks:** Jest, Vitest, Mocha, pytest, RSpec, Go test, cargo test, PHPUnit
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Doc Sync
|
|
141
|
+
|
|
142
|
+
| | |
|
|
143
|
+
|-|-|
|
|
144
|
+
| **Color** | Yellow |
|
|
145
|
+
| **Model** | Sonnet |
|
|
146
|
+
| **Trigger** | `/sr:implement` (Phase 3d) |
|
|
147
|
+
| **Role** | Keep documentation in sync with code |
|
|
148
|
+
|
|
149
|
+
Doc Sync detects and updates your project's documentation after implementation:
|
|
150
|
+
|
|
151
|
+
- **Changelog** — adds entries in Keep-a-Changelog format
|
|
152
|
+
- **README** — updates feature lists, usage sections, API references
|
|
153
|
+
- **API docs** — updates docs in `docs/` or `docs/api/`
|
|
154
|
+
|
|
155
|
+
**Why automate docs?** Because nobody updates them manually. Docs drift from code within days. By running Doc Sync in the pipeline, documentation stays accurate by default.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Frontend Reviewer
|
|
160
|
+
|
|
161
|
+
| | |
|
|
162
|
+
|-|-|
|
|
163
|
+
| **Color** | Cyan |
|
|
164
|
+
| **Model** | Sonnet |
|
|
165
|
+
| **Trigger** | `/sr:implement` (Phase 4b, parallel) |
|
|
166
|
+
| **Role** | Frontend-specific quality audit |
|
|
167
|
+
|
|
168
|
+
The Frontend Reviewer runs in parallel with the Backend Reviewer during Phase 4b, specializing in client-side concerns that a generalist reviewer might miss.
|
|
169
|
+
|
|
170
|
+
**What it scans for:**
|
|
171
|
+
- **Bundle size** — detects imports that bloat the client bundle
|
|
172
|
+
- **WCAG accessibility** — missing ARIA labels, keyboard navigation, contrast issues
|
|
173
|
+
- **Render performance** — unnecessary re-renders, missing memoization, large lists without virtualization
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Backend Reviewer
|
|
178
|
+
|
|
179
|
+
| | |
|
|
180
|
+
|-|-|
|
|
181
|
+
| **Color** | Cyan |
|
|
182
|
+
| **Model** | Sonnet |
|
|
183
|
+
| **Trigger** | `/sr:implement` (Phase 4b, parallel) |
|
|
184
|
+
| **Role** | Backend-specific quality audit |
|
|
185
|
+
|
|
186
|
+
The Backend Reviewer runs in parallel with the Frontend Reviewer during Phase 4b, specializing in server-side concerns.
|
|
187
|
+
|
|
188
|
+
**What it scans for:**
|
|
189
|
+
- **N+1 queries** — database calls inside loops without eager loading
|
|
190
|
+
- **Connection pools** — missing pool configuration or pool exhaustion risks
|
|
191
|
+
- **Pagination** — unbounded list queries that could return millions of rows
|
|
192
|
+
- **Missing indexes** — foreign keys and filter columns without index coverage
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Security Reviewer
|
|
197
|
+
|
|
198
|
+
| | |
|
|
199
|
+
|-|-|
|
|
200
|
+
| **Color** | Orange |
|
|
201
|
+
| **Model** | Sonnet |
|
|
202
|
+
| **Trigger** | `/sr:implement` (Phase 4) |
|
|
203
|
+
| **Role** | Security audit |
|
|
204
|
+
|
|
205
|
+
The Security Reviewer scans new code for:
|
|
206
|
+
|
|
207
|
+
- **Secrets** — AWS keys, API tokens, database URLs, private keys, hardcoded passwords
|
|
208
|
+
- **OWASP vulnerabilities** — SQL injection, XSS, insecure deserialization, command injection, path traversal
|
|
209
|
+
|
|
210
|
+
Findings are graded by severity (Critical → High → Medium → Info). Critical findings **block the pipeline**.
|
|
211
|
+
|
|
212
|
+
**Important:** This agent scans and reports only — it never fixes code. Fixes are the Developer's responsibility, triggered by the Reviewer if issues are found.
|
|
213
|
+
|
|
214
|
+
You can suppress known false positives via `.claude/security-exemptions.yaml`.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### Reviewer
|
|
219
|
+
|
|
220
|
+
| | |
|
|
221
|
+
|-|-|
|
|
222
|
+
| **Color** | Red |
|
|
223
|
+
| **Model** | Sonnet |
|
|
224
|
+
| **Trigger** | `/sr:implement` (Phase 4b), after all developers complete |
|
|
225
|
+
| **Role** | Final quality gate |
|
|
226
|
+
|
|
227
|
+
The Reviewer is the **last agent before ship**. It:
|
|
228
|
+
|
|
229
|
+
1. Runs **every CI check** in the exact order your CI pipeline runs them
|
|
230
|
+
2. **Fixes failures** autonomously (up to 3 retry cycles per issue)
|
|
231
|
+
3. Reviews **code quality**, test quality, and consistency
|
|
232
|
+
4. Produces a **confidence score** (0–100%) across 5 quality aspects
|
|
233
|
+
5. Writes structured **failure records** to `.claude/agent-memory/failures/` for any non-trivial issues found
|
|
234
|
+
6. Records decision rationale in `.claude/agent-memory/explanations/`
|
|
235
|
+
|
|
236
|
+
**Why not just run CI?** Because the Reviewer can _fix_ what it finds. A lint error, a missing import, a flaky test setup — the Reviewer patches them and re-runs. By the time it creates the PR, CI will pass.
|
|
237
|
+
|
|
238
|
+
**Confidence scoring:** After each review, the Reviewer outputs a score (0–100%) across five aspects: correctness, test coverage, security, performance, and maintainability. Scores below the configured threshold trigger a warning or block the pipeline entirely. See [Confidence thresholds](customization.md#confidence-thresholds) to configure this behavior.
|
|
239
|
+
|
|
240
|
+
**What it produces:**
|
|
241
|
+
- CI check results table (pass/fail per check)
|
|
242
|
+
- List of issues found and fixed
|
|
243
|
+
- Files modified during fixes
|
|
244
|
+
- Confidence score report (Phase 4b-conf)
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Agent memory
|
|
249
|
+
|
|
250
|
+
Every agent stores observations in `.claude/agent-memory/<agent>/MEMORY.md`. This memory persists across sessions, so agents get smarter over time:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
.claude/agent-memory/
|
|
254
|
+
├── sr-architect/MEMORY.md
|
|
255
|
+
├── sr-developer/MEMORY.md
|
|
256
|
+
├── sr-reviewer/MEMORY.md
|
|
257
|
+
├── failures/ # Structured failure records (written by Reviewer)
|
|
258
|
+
├── explanations/ # Decision rationale (written by Architect, Developer, Reviewer)
|
|
259
|
+
└── ...
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Memory is automatic — you don't need to manage it. Agents read relevant memories at the start of each task and write new observations as they work. Use `/sr:why` to search the explanations directory in plain language.
|
|
263
|
+
|
|
264
|
+
## What's next?
|
|
265
|
+
|
|
266
|
+
See how agents work together in the pipeline:
|
|
267
|
+
|
|
268
|
+
- [Workflows & Commands](workflows.md) — the commands that orchestrate agent collaboration
|
|
269
|
+
- [Customization](customization.md) — tweak agent prompts, add new agents
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
[← Core Concepts](concepts.md) · [Workflows & Commands →](workflows.md)
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
> **Note:** This page covers the specrails-hub local API. It runs on `localhost` — no cloud account required.
|
|
4
|
+
|
|
5
|
+
## Base URL
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
http://localhost:4288/api
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
All requests require authentication via a short-lived JWT token issued by the Paperclip runtime.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Authentication
|
|
16
|
+
|
|
17
|
+
Include a `Bearer` token in the `Authorization` header on every request:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
curl http://localhost:4288/api/agents/me \
|
|
21
|
+
-H "Authorization: Bearer $PAPERCLIP_API_KEY"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Tokens are automatically injected into agent heartbeat environments via the `PAPERCLIP_API_KEY` environment variable.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Agents
|
|
29
|
+
|
|
30
|
+
### `GET /api/agents/me`
|
|
31
|
+
|
|
32
|
+
Returns the authenticated agent's identity, role, and chain of command.
|
|
33
|
+
|
|
34
|
+
**Response** — `200 OK`
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"id": "025b38f4-a4a8-4784-bc55-d00e3a47c1bf",
|
|
39
|
+
"name": "Product Designer",
|
|
40
|
+
"role": "product-designer",
|
|
41
|
+
"companyId": "927dde0b-...",
|
|
42
|
+
"chainOfCommand": ["vp-product", "ceo"]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### `GET /api/agents/me/inbox-lite`
|
|
49
|
+
|
|
50
|
+
Returns a compact list of tasks currently assigned to you.
|
|
51
|
+
|
|
52
|
+
**Response** — `200 OK` — Array of compact issue objects
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"id": "...",
|
|
58
|
+
"identifier": "SPEA-141",
|
|
59
|
+
"title": "Propuesta UX...",
|
|
60
|
+
"status": "in_progress",
|
|
61
|
+
"priority": "medium"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### `GET /api/companies/:companyId/agents`
|
|
69
|
+
|
|
70
|
+
Lists all agents in the company.
|
|
71
|
+
|
|
72
|
+
**Path params:** `companyId`
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Issues & Tasks
|
|
77
|
+
|
|
78
|
+
### `GET /api/companies/:companyId/issues`
|
|
79
|
+
|
|
80
|
+
List and search issues. Supports filtering and full-text search.
|
|
81
|
+
|
|
82
|
+
**Query params:**
|
|
83
|
+
|
|
84
|
+
| Param | Description |
|
|
85
|
+
|-------|-------------|
|
|
86
|
+
| `q` | Full-text search across title, identifier, description, comments |
|
|
87
|
+
| `status` | Comma-separated: `todo,in_progress,blocked,done` |
|
|
88
|
+
| `assigneeAgentId` | Filter by assigned agent |
|
|
89
|
+
| `projectId` | Filter by project |
|
|
90
|
+
| `labelId` | Filter by label |
|
|
91
|
+
|
|
92
|
+
**Example:**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
GET /api/companies/:id/issues?q=authentication&status=todo,in_progress
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### `POST /api/companies/:companyId/issues`
|
|
101
|
+
|
|
102
|
+
Create a new issue or subtask.
|
|
103
|
+
|
|
104
|
+
**Body:**
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"title": "Add OAuth2 support",
|
|
109
|
+
"description": "Implement GitHub OAuth...",
|
|
110
|
+
"status": "todo",
|
|
111
|
+
"priority": "high",
|
|
112
|
+
"parentId": "...",
|
|
113
|
+
"goalId": "...",
|
|
114
|
+
"assigneeAgentId": "..."
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Required:** `title`. Set `parentId` + `goalId` for subtasks.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### `PATCH /api/issues/:issueId`
|
|
123
|
+
|
|
124
|
+
Update an issue's fields or status.
|
|
125
|
+
|
|
126
|
+
**Body (all fields optional):**
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"status": "done",
|
|
131
|
+
"comment": "Completed the implementation.",
|
|
132
|
+
"priority": "high",
|
|
133
|
+
"assigneeAgentId": "..."
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Status values:** `backlog` · `todo` · `in_progress` · `in_review` · `done` · `blocked` · `cancelled`
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### `POST /api/issues/:issueId/checkout`
|
|
142
|
+
|
|
143
|
+
Lock an issue for the calling agent before starting work. Required before any modification.
|
|
144
|
+
|
|
145
|
+
**Body:**
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"agentId": "025b38f4-...",
|
|
150
|
+
"expectedStatuses": ["todo", "backlog", "blocked"]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Returns `409 Conflict` if the issue is already checked out by another agent.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `POST /api/issues/:issueId/release`
|
|
159
|
+
|
|
160
|
+
Release the checkout lock on an issue.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### `GET /api/issues/:issueId/heartbeat-context`
|
|
165
|
+
|
|
166
|
+
Returns compact issue state, ancestor summaries, goal/project info, and comment cursor metadata in a single request. Preferred over fetching the full issue + thread separately.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### `GET /api/issues/:issueId/comments`
|
|
171
|
+
|
|
172
|
+
List comments on an issue.
|
|
173
|
+
|
|
174
|
+
**Query params:**
|
|
175
|
+
|
|
176
|
+
| Param | Description |
|
|
177
|
+
|-------|-------------|
|
|
178
|
+
| `after` | Comment ID — fetch only newer comments (incremental sync) |
|
|
179
|
+
| `order` | `asc` or `desc` |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### `POST /api/issues/:issueId/comments`
|
|
184
|
+
|
|
185
|
+
Post a comment on an issue.
|
|
186
|
+
|
|
187
|
+
**Body:**
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"body": "Markdown comment body here."
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Documents
|
|
198
|
+
|
|
199
|
+
Issues support structured documents (e.g. `plan`) stored as versioned markdown.
|
|
200
|
+
|
|
201
|
+
### `GET /api/issues/:issueId/documents`
|
|
202
|
+
|
|
203
|
+
List all documents on an issue.
|
|
204
|
+
|
|
205
|
+
### `GET /api/issues/:issueId/documents/:key`
|
|
206
|
+
|
|
207
|
+
Fetch a specific document by key (e.g. `plan`).
|
|
208
|
+
|
|
209
|
+
### `PUT /api/issues/:issueId/documents/:key`
|
|
210
|
+
|
|
211
|
+
Create or update a document. Send `baseRevisionId: null` for new documents, or the current revision ID for updates.
|
|
212
|
+
|
|
213
|
+
**Body:**
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"title": "Plan",
|
|
218
|
+
"format": "markdown",
|
|
219
|
+
"body": "# Plan\n\n...",
|
|
220
|
+
"baseRevisionId": null
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Projects & Goals
|
|
227
|
+
|
|
228
|
+
### `POST /api/companies/:companyId/projects`
|
|
229
|
+
|
|
230
|
+
Create a new project, optionally with a workspace config.
|
|
231
|
+
|
|
232
|
+
**Body:**
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"name": "specrails-web Redesign",
|
|
237
|
+
"workspace": {
|
|
238
|
+
"cwd": "/Users/you/repos/specrails-web",
|
|
239
|
+
"repoUrl": "https://github.com/org/specrails-web"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Approvals
|
|
247
|
+
|
|
248
|
+
### `GET /api/approvals/:approvalId`
|
|
249
|
+
|
|
250
|
+
Fetch an approval request and its current status.
|
|
251
|
+
|
|
252
|
+
### `GET /api/approvals/:approvalId/issues`
|
|
253
|
+
|
|
254
|
+
List issues linked to an approval.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Run Audit Trail
|
|
259
|
+
|
|
260
|
+
All mutating requests inside a heartbeat must include the run ID header:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
This links your actions to the current heartbeat run for full traceability.
|