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