stonecut 1.1.0 → 1.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.
- package/README.md +225 -46
- package/package.json +1 -1
- package/src/cli.ts +175 -123
- package/src/config.ts +56 -0
- package/src/frontmatter.ts +73 -0
- package/src/import.ts +92 -0
- package/src/init.ts +38 -0
- package/src/local.ts +5 -2
- package/src/logger.ts +27 -4
- package/src/prompt.ts +0 -20
- package/src/runner.ts +97 -1
- package/src/{github.ts → sources/github.ts} +85 -68
- package/src/sources/index.ts +21 -0
- package/src/sources/types.ts +47 -0
- package/src/templates/execute.md +1 -0
- package/src/types.ts +1 -15
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Stonecut
|
|
2
2
|
|
|
3
|
+
[](https://github.com/elkinjosetm/stonecut/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/stonecut)
|
|
5
|
+
|
|
3
6
|
A CLI that drives PRD-driven development with agentic coding CLIs. You write the PRD, Stonecut executes the issues one by one.
|
|
4
7
|
|
|
5
8
|
## Workflow
|
|
@@ -9,13 +12,14 @@ Ideas can come from anywhere — Jira tickets, Slack threads, MCP servers, or ju
|
|
|
9
12
|
1. **`/stonecut-interview`** — Stress-test the idea. Get grilled on the plan until it's solid.
|
|
10
13
|
2. **`/stonecut-prd`** — Turn the validated idea into a PRD (local file or GitHub issue).
|
|
11
14
|
3. **`/stonecut-issues`** — Break the PRD into independently-grabbable issues (local markdown files or GitHub sub-issues).
|
|
12
|
-
4. **`stonecut
|
|
15
|
+
4. **`stonecut import`** _(optional)_ — If the PRD lives in GitHub, import it and its issues into `.stonecut/`.
|
|
16
|
+
5. **`stonecut`** — Execute the issues sequentially with an agentic coding CLI.
|
|
13
17
|
|
|
14
|
-
Steps 1–3 are Claude Code skills installed via `stonecut setup-skills`.
|
|
18
|
+
Steps 1–3 are Claude Code skills installed via `stonecut setup-skills`. Steps 4–5 are the Stonecut CLI.
|
|
15
19
|
|
|
16
20
|
### Suggested: managing your idea backlog
|
|
17
21
|
|
|
18
|
-
For projects using GitHub issues, we recommend tracking ideas with a `roadmap` label. When an idea is ready, interview it, write the PRD (which closes the roadmap issue), break it into sub-issues, and execute. See [DESIGN.md](DESIGN.md#suggested-practice-managing-your-idea-backlog-with-github-labels) for the full flow.
|
|
22
|
+
For projects using GitHub issues, we recommend tracking ideas with a `roadmap` label. When an idea is ready, interview it, write the PRD (which closes the roadmap issue), break it into sub-issues, import with `stonecut import --github`, and execute. See [DESIGN.md](DESIGN.md#suggested-practice-managing-your-idea-backlog-with-github-labels) for the full flow.
|
|
19
23
|
|
|
20
24
|
## Installation
|
|
21
25
|
|
|
@@ -23,7 +27,7 @@ For projects using GitHub issues, we recommend tracking ideas with a `roadmap` l
|
|
|
23
27
|
|
|
24
28
|
- [Bun](https://bun.sh/) — install with `curl -fsSL https://bun.sh/install | bash`
|
|
25
29
|
- An agentic coding CLI — [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (`claude`) is the default runner and must be in your PATH. [OpenAI Codex CLI](https://github.com/openai/codex) (`codex`) is required only when using `--runner codex`.
|
|
26
|
-
- [GitHub CLI](https://cli.github.com/) — `gh`, authenticated. Required for GitHub
|
|
30
|
+
- [GitHub CLI](https://cli.github.com/) — `gh`, authenticated. Required for importing from GitHub (`stonecut import --github`), syncing issue completion back to GitHub, and for pushing branches / creating PRs.
|
|
27
31
|
|
|
28
32
|
### Install from npm
|
|
29
33
|
|
|
@@ -31,10 +35,11 @@ For projects using GitHub issues, we recommend tracking ideas with a `roadmap` l
|
|
|
31
35
|
bun add -g stonecut
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
This makes the `stonecut` command globally available. Then install the Claude Code skills:
|
|
38
|
+
This makes the `stonecut` command globally available. Then initialize your project and install the Claude Code skills:
|
|
35
39
|
|
|
36
40
|
```sh
|
|
37
|
-
stonecut
|
|
41
|
+
stonecut init # scaffold .stonecut/ with config and gitignore
|
|
42
|
+
stonecut setup-skills # install Claude Code skills
|
|
38
43
|
```
|
|
39
44
|
|
|
40
45
|
### Install from source
|
|
@@ -68,26 +73,98 @@ bun test
|
|
|
68
73
|
|
|
69
74
|
## Usage
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
Running bare `stonecut` starts the interactive run wizard — the primary workflow for executing PRD issues. Use `stonecut --help` to discover all available commands.
|
|
77
|
+
|
|
78
|
+
### `stonecut` — Interactive wizard
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
Stonecut uses a local-first execution model: `stonecut run` always reads from `.stonecut/<name>/`. External sources like GitHub are handled via `stonecut import`, which pulls PRDs and issues into the local structure before execution.
|
|
74
81
|
|
|
75
82
|
When flags are omitted, Stonecut prompts for each missing parameter:
|
|
76
83
|
|
|
77
84
|
```sh
|
|
78
|
-
# Full wizard — prompted for
|
|
79
|
-
stonecut
|
|
85
|
+
# Full wizard — prompted for PRD, iterations, branch, and base branch
|
|
86
|
+
stonecut
|
|
80
87
|
|
|
81
88
|
# Partial — only iterations, branch, and base are prompted
|
|
82
|
-
stonecut
|
|
89
|
+
stonecut --local my-feature
|
|
90
|
+
|
|
91
|
+
# Partial — only PRD selection, branch, and base are prompted
|
|
92
|
+
stonecut -i all
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
You can also use `stonecut run` explicitly — it's identical to bare `stonecut`.
|
|
96
|
+
|
|
97
|
+
The wizard scans `.stonecut/*/` for local PRDs and presents them with completion counts (e.g. "my-feature (3/7 done)"). An "Import from GitHub" option is always available at the bottom of the list for importing PRDs inline.
|
|
98
|
+
|
|
99
|
+
Flags provided via CLI skip the corresponding prompts. When all flags are given, the command runs without any prompts.
|
|
100
|
+
|
|
101
|
+
If no `.stonecut/` directory exists, the wizard prints a hint suggesting `stonecut init`.
|
|
102
|
+
|
|
103
|
+
### `stonecut init` — Project setup
|
|
104
|
+
|
|
105
|
+
Scaffolds a `.stonecut/` directory with project-level configuration:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
stonecut init
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This creates:
|
|
112
|
+
|
|
113
|
+
- **`.stonecut/config.json`** — Project defaults for the run wizard (see [Configuration](#configuration) below).
|
|
114
|
+
- **`.stonecut/.gitignore`** — Ignores runtime artifacts (`logs/`, `status.json`, `progress.txt`) so only meaningful files (config, PRDs, issues) are committed.
|
|
115
|
+
|
|
116
|
+
The command errors if `config.json` already exists, preventing accidental overwrites. To reconfigure, edit the file directly.
|
|
83
117
|
|
|
84
|
-
|
|
85
|
-
|
|
118
|
+
### Configuration
|
|
119
|
+
|
|
120
|
+
`.stonecut/config.json` controls wizard defaults. All fields are optional:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"runner": "claude",
|
|
125
|
+
"baseBranch": "main",
|
|
126
|
+
"branchPrefix": "stonecut/"
|
|
127
|
+
}
|
|
86
128
|
```
|
|
87
129
|
|
|
88
|
-
|
|
130
|
+
| Field | Default | Description |
|
|
131
|
+
| -------------- | ------------- | ------------------------------------------------------------------------------- |
|
|
132
|
+
| `runner` | `"claude"` | Agentic CLI runner (`claude`, `codex`). Used when `--runner` is omitted. |
|
|
133
|
+
| `baseBranch` | `"main"` | Default PR target branch. Suggested in the wizard's base branch prompt. |
|
|
134
|
+
| `branchPrefix` | `"stonecut/"` | Prefix for suggested branch names (e.g. `feat/stonecut/` for team conventions). |
|
|
135
|
+
|
|
136
|
+
When config is present, the wizard uses these as default values — you can hit enter through prompts for the common case. When config is absent, the current hardcoded defaults apply.
|
|
89
137
|
|
|
90
|
-
### `stonecut
|
|
138
|
+
### `stonecut import` — Import from external sources
|
|
139
|
+
|
|
140
|
+
Pulls a PRD and its sub-issues from an external source into `.stonecut/<name>/` so they can be executed locally with `stonecut run`.
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
# Import GitHub PRD #42 — spec name derived from PRD title
|
|
144
|
+
stonecut import --github 42
|
|
145
|
+
|
|
146
|
+
# Import with a custom local name
|
|
147
|
+
stonecut import --github 42 --name auth-refactor
|
|
148
|
+
|
|
149
|
+
# Overwrite an existing local spec
|
|
150
|
+
stonecut import --github 42 --force
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The import command:
|
|
154
|
+
|
|
155
|
+
1. Fetches the PRD content and title from the source.
|
|
156
|
+
2. Fetches all sub-issues, ordered by number.
|
|
157
|
+
3. Derives a local spec name from the PRD title (e.g. "Add user authentication" becomes `add-user-authentication`). Override with `--name`.
|
|
158
|
+
4. Writes `prd.md` and numbered issue files into `.stonecut/<name>/issues/`.
|
|
159
|
+
5. Creates initial `status.json` and `progress.txt`.
|
|
160
|
+
|
|
161
|
+
Import errors if the spec directory already exists (to avoid overwriting in-progress work). Use `--force` to overwrite intentionally.
|
|
162
|
+
|
|
163
|
+
Imported files include [frontmatter](#frontmatter) with source metadata, enabling automatic sync-back (e.g. closing GitHub issues on completion).
|
|
164
|
+
|
|
165
|
+
### `stonecut run` — Execute issues
|
|
166
|
+
|
|
167
|
+
Executes issues from a local PRD directory. All execution is local-first — use `stonecut import` to pull in PRDs from external sources first.
|
|
91
168
|
|
|
92
169
|
```sh
|
|
93
170
|
# Run 5 issues, then push and create a PR
|
|
@@ -97,49 +174,87 @@ stonecut run --local my-feature -i 5
|
|
|
97
174
|
stonecut run --local my-feature -i all
|
|
98
175
|
```
|
|
99
176
|
|
|
100
|
-
###
|
|
177
|
+
### GitHub workflow
|
|
178
|
+
|
|
179
|
+
For PRDs managed as GitHub issues, use import followed by run:
|
|
101
180
|
|
|
102
181
|
```sh
|
|
103
|
-
#
|
|
104
|
-
stonecut
|
|
182
|
+
# 1. Import the PRD and its sub-issues
|
|
183
|
+
stonecut import --github 42
|
|
184
|
+
|
|
185
|
+
# 2. Execute locally (spec name derived from PRD title)
|
|
186
|
+
stonecut run --local add-user-authentication -i all
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Or use the interactive wizard, which offers inline GitHub import:
|
|
105
190
|
|
|
106
|
-
|
|
107
|
-
stonecut
|
|
191
|
+
```sh
|
|
192
|
+
stonecut
|
|
193
|
+
# → Select "Import from GitHub"
|
|
194
|
+
# → Pick a PRD from the list (filtered by `prd` label)
|
|
195
|
+
# → Continue with iterations, branch, and base branch prompts
|
|
108
196
|
```
|
|
109
197
|
|
|
198
|
+
When issues imported from GitHub are completed, Stonecut automatically closes the corresponding GitHub issues. When all issues are done, the parent PRD issue is closed as well.
|
|
199
|
+
|
|
200
|
+
### Commands
|
|
201
|
+
|
|
202
|
+
| Command | Description |
|
|
203
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
204
|
+
| _(bare)_ | Start the interactive run wizard (default command). |
|
|
205
|
+
| `run` | Alias for bare `stonecut` — execute issues from a local PRD. |
|
|
206
|
+
| `import` | Import a PRD and its issues from an external source. |
|
|
207
|
+
| `init` | Scaffold `.stonecut/` directory with project config and gitignore. |
|
|
208
|
+
| `setup-skills` | Install Stonecut skills as symlinks into `~/.claude/skills/`. |
|
|
209
|
+
| `remove-skills` | Remove Stonecut skill symlinks from `~/.claude/skills/`. |
|
|
210
|
+
|
|
110
211
|
### Flags
|
|
111
212
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
| `--
|
|
117
|
-
| `--
|
|
118
|
-
| `--
|
|
213
|
+
**`run` flags:**
|
|
214
|
+
|
|
215
|
+
| Flag | Short | Required | Description |
|
|
216
|
+
| -------------- | ----- | -------- | ------------------------------------------------------------------------ |
|
|
217
|
+
| `--local` | — | No | Local PRD name (`.stonecut/<name>/`). Prompted if omitted. |
|
|
218
|
+
| `--iterations` | `-i` | No | Positive integer or `all`. Prompted with default `all` if omitted. |
|
|
219
|
+
| `--runner` | — | No | Agentic CLI runner (`claude`, `codex`). Default from config or `claude`. |
|
|
220
|
+
|
|
221
|
+
**`import` flags:**
|
|
222
|
+
|
|
223
|
+
| Flag | Short | Required | Description |
|
|
224
|
+
| ---------- | ----- | -------- | ------------------------------------- |
|
|
225
|
+
| `--github` | — | Yes\* | GitHub PRD issue number. |
|
|
226
|
+
| `--name` | — | No | Override the auto-derived spec name. |
|
|
227
|
+
| `--force` | — | No | Overwrite an existing spec directory. |
|
|
228
|
+
|
|
229
|
+
\*At least one source flag is required. Currently only `--github` is supported.
|
|
230
|
+
|
|
231
|
+
**Global flags:**
|
|
232
|
+
|
|
233
|
+
| Flag | Short | Description |
|
|
234
|
+
| ----------- | ----- | ---------------------- |
|
|
235
|
+
| `--version` | `-V` | Show version and exit. |
|
|
119
236
|
|
|
120
237
|
### Pre-execution prompts
|
|
121
238
|
|
|
122
239
|
Before starting, Stonecut prompts for any missing parameters in order:
|
|
123
240
|
|
|
124
|
-
1. **
|
|
125
|
-
2. **
|
|
126
|
-
3. **
|
|
127
|
-
4. **
|
|
128
|
-
5.
|
|
129
|
-
6. Creates or checks out the branch
|
|
241
|
+
1. **PRD** — select from local PRDs or import from GitHub (skipped when `--local` provided)
|
|
242
|
+
2. **Iterations** — number of issues to process, default `all` (skipped when `-i` provided)
|
|
243
|
+
3. **Branch name** — suggests `<branchPrefix><slug>` based on the spec name (prefix from config or `stonecut/`)
|
|
244
|
+
4. **Base branch** — suggests the configured `baseBranch` or the repository's default branch (usually `main`)
|
|
245
|
+
5. Creates or checks out the branch
|
|
130
246
|
|
|
131
|
-
When all parameters are provided via flags,
|
|
247
|
+
When all parameters are provided via flags, no prompts appear and the command runs non-interactively.
|
|
132
248
|
|
|
133
249
|
### After a run
|
|
134
250
|
|
|
135
251
|
Stonecut automatically pushes the branch, creates a PR, and includes a Stonecut Report listing each issue with its status (completed or failed with error reason). The report also shows which runner was used. Timing stats are printed per iteration and for the full session.
|
|
136
|
-
In GitHub mode, the PR title defaults to the PRD issue title with a `PRD #<number>` fallback if the title is unavailable.
|
|
137
252
|
|
|
138
|
-
|
|
253
|
+
For imported PRDs, the PR body includes a `Closes #<number>` reference to the parent GitHub issue when all issues are complete.
|
|
139
254
|
|
|
140
|
-
|
|
255
|
+
## Local PRD structure
|
|
141
256
|
|
|
142
|
-
|
|
257
|
+
All execution reads from `.stonecut/<name>/` directories with this structure:
|
|
143
258
|
|
|
144
259
|
```
|
|
145
260
|
.stonecut/my-feature/
|
|
@@ -148,18 +263,82 @@ Expects a local PRD directory at `.stonecut/<name>/` with this structure:
|
|
|
148
263
|
│ ├── 01-setup.md # Issue files, numbered for ordering
|
|
149
264
|
│ ├── 02-core.md
|
|
150
265
|
│ └── 03-api.md
|
|
151
|
-
├── status.json # Auto-created: tracks completed issues
|
|
152
|
-
└── progress.txt # Auto-created: timestamped completion log
|
|
266
|
+
├── status.json # Auto-created: tracks completed issues (gitignored)
|
|
267
|
+
└── progress.txt # Auto-created: timestamped completion log (gitignored)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
PRDs and issues are committed to git; runtime state (`status.json`, `progress.txt`, `logs/`) is gitignored by the `.stonecut/.gitignore` created during `stonecut init`.
|
|
271
|
+
|
|
272
|
+
### Frontmatter
|
|
273
|
+
|
|
274
|
+
Issue and PRD files support YAML frontmatter for metadata. Locally-authored files don't need frontmatter — it's added automatically by `stonecut import`.
|
|
275
|
+
|
|
276
|
+
**PRD frontmatter** (`.stonecut/<name>/prd.md`):
|
|
277
|
+
|
|
278
|
+
```markdown
|
|
279
|
+
---
|
|
280
|
+
source: github
|
|
281
|
+
issue: 42
|
|
282
|
+
title: Add user authentication
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
The actual PRD content starts here...
|
|
153
286
|
```
|
|
154
287
|
|
|
155
|
-
|
|
288
|
+
**Issue frontmatter** (`.stonecut/<name>/issues/01-setup.md`):
|
|
289
|
+
|
|
290
|
+
```markdown
|
|
291
|
+
---
|
|
292
|
+
source: github
|
|
293
|
+
issue: 101
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
The actual issue content starts here...
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
| Field | Description |
|
|
300
|
+
| -------- | ---------------------------------------------------------------------------- |
|
|
301
|
+
| `source` | Source provider name (e.g. `github`). Enables sync-back on completion. |
|
|
302
|
+
| `issue` | Issue number in the external system. Used to close the issue when completed. |
|
|
303
|
+
| `title` | PRD title from the external source. Present only on `prd.md`. |
|
|
304
|
+
|
|
305
|
+
When an issue with `source` metadata is completed, Stonecut automatically syncs the completion back to the external system (e.g. closes the GitHub issue). Issues without frontmatter (locally-authored) execute normally with no sync-back.
|
|
306
|
+
|
|
307
|
+
## Source providers
|
|
308
|
+
|
|
309
|
+
Source providers are the abstraction that lets `stonecut import` pull PRDs from external systems. Each provider implements the `SourceProvider` interface:
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
interface SourceProvider {
|
|
313
|
+
fetchPrd(identifier: string): Promise<PrdData>;
|
|
314
|
+
fetchIssues(identifier: string): Promise<IssueData[]>;
|
|
315
|
+
listPrds(): Promise<PrdSummary[]>;
|
|
316
|
+
onIssueComplete(issueId: string): Promise<void>;
|
|
317
|
+
onPrdComplete(prdId: string): Promise<void>;
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- **`fetchPrd`** / **`fetchIssues`** — Read-only: fetch data from the external source during import.
|
|
322
|
+
- **`listPrds`** — Read-only: list available PRDs (used by the wizard's inline import).
|
|
323
|
+
- **`onIssueComplete`** / **`onPrdComplete`** — Side effects: sync completion back to the source (e.g. close a GitHub issue).
|
|
324
|
+
|
|
325
|
+
Providers are stateless — they talk to external APIs and return data. The provider registry at `src/sources/index.ts` maps names to implementations.
|
|
326
|
+
|
|
327
|
+
### Built-in: GitHub
|
|
328
|
+
|
|
329
|
+
The GitHub provider (`--github`) uses the [GitHub CLI](https://cli.github.com/) (`gh`). It requires `gh` to be installed and authenticated.
|
|
330
|
+
|
|
331
|
+
- PRDs are GitHub issues labeled `prd`
|
|
332
|
+
- Sub-issues are fetched via the GitHub GraphQL API
|
|
333
|
+
- Completion syncs back by closing issues via `gh issue close`
|
|
334
|
+
|
|
335
|
+
### Adding new providers
|
|
156
336
|
|
|
157
|
-
|
|
337
|
+
To add a new source provider (e.g. Jira, Linear):
|
|
158
338
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- Completed issues are closed via `gh issue close`
|
|
339
|
+
1. Create `src/sources/<name>.ts` implementing `SourceProvider`.
|
|
340
|
+
2. Register it in `src/sources/index.ts` by adding an entry to the `PROVIDERS` map.
|
|
341
|
+
3. Add a `--<name>` flag to the `import` command in `src/cli.ts`.
|
|
163
342
|
|
|
164
343
|
## Skills
|
|
165
344
|
|