@dansyuqri/spark-joy 0.1.4 → 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.
- package/README.md +41 -7
- package/dist/app/assets/index-CX9CpO88.js +8 -0
- package/dist/app/assets/index-ChCdW9F8.css +1 -0
- package/dist/app/index.html +2 -2
- package/dist/cli.js +339 -41
- package/dist/cli.js.map +1 -1
- package/package.json +8 -8
- package/{skill → plugin/skills/spark-joy}/SKILL.md +41 -2
- package/dist/app/assets/index-1qEXDj-s.js +0 -40
- package/dist/app/assets/index-DyYm7_iM.css +0 -1
package/README.md
CHANGED
|
@@ -14,9 +14,15 @@
|
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT license">
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
-
AI-
|
|
17
|
+
AI-written PRs are often thousands of lines long: too big to review properly. spark-joy has Claude split a PR into small, ordered chunks, then opens a local app where you review them one at a time, see how they connect on a map, and finish with a summary of what the PR does.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**Example:** spark-joy's own history, one 7.8k-line diff, became **18 chunks of 141–369 lines**, every hunk placed exactly once. The 2.7k-line lockfile went straight to *skim*.
|
|
20
|
+
|
|
21
|
+
<p align="center"><img src="assets/demo.gif" width="800" alt="Choosing a review order, reviewing a chunk with a line note, then zooming into a chunk on the map"></p>
|
|
22
|
+
|
|
23
|
+
Writing the big PR yourself? spark-joy can also split your staged, uncommitted or branch changes into small stacked PRs. See [Split your own changes](#split-your-own-changes).
|
|
24
|
+
|
|
25
|
+
Works from plain git, so GitHub, GitLab or anything else. Nothing is posted anywhere; notes export as markdown for the PR.
|
|
20
26
|
|
|
21
27
|
Inspired by [mr-cast](https://github.com/phanshiyu/mr-cast).
|
|
22
28
|
|
|
@@ -39,13 +45,19 @@ spark-joy serve → review app choose an order, review chunk by chunk, e
|
|
|
39
45
|
|
|
40
46
|
## Install
|
|
41
47
|
|
|
42
|
-
Requires Node
|
|
48
|
+
Requires Node 24 or newer and git. Published on npm as [`@dansyuqri/spark-joy`](https://www.npmjs.com/package/@dansyuqri/spark-joy).
|
|
49
|
+
|
|
50
|
+
Install the CLI, then add the skill to Claude Code, either as a plugin:
|
|
43
51
|
|
|
44
52
|
```sh
|
|
45
53
|
npm install -g @dansyuqri/spark-joy
|
|
46
|
-
|
|
54
|
+
```
|
|
55
|
+
```
|
|
56
|
+
/plugin install spark-joy --marketplace Dansyuqri/spark-joy
|
|
47
57
|
```
|
|
48
58
|
|
|
59
|
+
or straight from the CLI: `spark-joy install-skill` (add `--project` to install into `./.claude/skills`).
|
|
60
|
+
|
|
49
61
|
## Use
|
|
50
62
|
|
|
51
63
|
In Claude Code, inside the repo with the branch checked out:
|
|
@@ -67,17 +79,39 @@ In the app:
|
|
|
67
79
|
| Command | What it does |
|
|
68
80
|
| --- | --- |
|
|
69
81
|
| `spark-joy extract [base] [--working]` | Diff `merge-base(base, HEAD)..HEAD` (or the working tree) into a run in `.spark-joy/<branch>/` |
|
|
82
|
+
| `spark-joy extract --staged \| --uncommitted` | Diff `HEAD` against the index or the working tree, for splitting |
|
|
70
83
|
| `spark-joy outline` | Compact list of every file and hunk with sizes and flags |
|
|
71
84
|
| `spark-joy show <ids…> \| --file <path>` | Print hunks in full; accepts ranges like `h003..h010` |
|
|
72
85
|
| `spark-joy links` | Cross-file links: which hunk uses a name another defines |
|
|
73
86
|
| `spark-joy validate [--json]` | Check `plan.json` against the hunks |
|
|
74
87
|
| `spark-joy serve [--port n]` | Start the review app |
|
|
75
88
|
| `spark-joy export [--stdout]` | Write `review.md` |
|
|
89
|
+
| `spark-joy split [--check cmd] [--apply]` | Turn a split plan into stacked local branches |
|
|
76
90
|
| `spark-joy install-skill [--project]` | Install the Claude Code skill |
|
|
77
91
|
|
|
78
92
|
`base` defaults to `origin/HEAD`, then `origin/main`, `origin/master` or `main`. Runs are stored in `.spark-joy/`, which ignores itself in git.
|
|
79
93
|
|
|
80
|
-
The plan format is documented in [
|
|
94
|
+
The plan format is documented in [SKILL.md](plugin/skills/spark-joy/SKILL.md), and the schema is in [shared/schema.ts](shared/schema.ts).
|
|
95
|
+
|
|
96
|
+
## Split your own changes
|
|
97
|
+
|
|
98
|
+
Writing the big PR yourself? Ask Claude to "split my changes into smaller PRs". It turns your staged changes, uncommitted changes or whole branch into small PRs, each built on the one before.
|
|
99
|
+
|
|
100
|
+
<p align="center"><img src="assets/split.gif" width="800" alt="Extracting uncommitted changes, previewing five stacked PRs in the app, checking each PR's tests, then creating the branches"></p>
|
|
101
|
+
|
|
102
|
+
1. **Extract** what you want to split: `--staged`, `--uncommitted`, or a base branch for the whole branch.
|
|
103
|
+
2. **Plan.** Claude groups every change into ordered PRs: each must build on the ones before, and lockfiles go with the change that needs them. Preview the stack in the app; the Map shows how the PRs depend on each other.
|
|
104
|
+
3. **Check.** `split` builds the PRs and confirms the last one matches your changes exactly. `--check` runs your tests on each PR in a temporary worktree.
|
|
105
|
+
4. **Apply.** `split --apply` creates the local branches and writes each PR's title and description to `prs.md`. Nothing is pushed.
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
spark-joy extract --uncommitted # or --staged, or a base for the whole branch
|
|
109
|
+
spark-joy split # dry run
|
|
110
|
+
spark-joy split --check "npm ci && npm test" # optional
|
|
111
|
+
spark-joy split --apply # creates <branch>-split/1-…, 2-…
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Your working tree, staged files and current branch are never touched: the PRs are built from a temporary git index. If anything doesn't add up, no branches are created.
|
|
81
115
|
|
|
82
116
|
## Develop
|
|
83
117
|
|
|
@@ -92,8 +126,8 @@ npm run dev:app # Vite dev server; proxies /api to a running `spark-joy ser
|
|
|
92
126
|
|
|
93
127
|
Layout:
|
|
94
128
|
|
|
95
|
-
- `cli/`: commands, diff parsing, splitting, classification, server.
|
|
129
|
+
- `cli/`: commands, diff parsing, splitting, classification, server, stacked-branch builder.
|
|
96
130
|
- `shared/`: schemas, validation and derived state, used by both the CLI and the app.
|
|
97
131
|
- `src/`: the React review app.
|
|
98
|
-
- `
|
|
132
|
+
- `plugin/`: the Claude Code plugin and skill.
|
|
99
133
|
- `test/`: Vitest, with a fixture git repo.
|