@dansyuqri/spark-joy 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +101 -2
- package/bin/spark-joy.mjs +10 -0
- package/dist/app/assets/index-1qEXDj-s.js +40 -0
- package/dist/app/assets/index-DyYm7_iM.css +1 -0
- package/dist/app/favicon.svg +31 -0
- package/dist/app/index.html +14 -0
- package/dist/cli.js +1271 -0
- package/dist/cli.js.map +1 -0
- package/package.json +68 -4
- package/skill/SKILL.md +118 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dansyuqri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,102 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
|
|
4
|
+
<img src="assets/logo.svg" width="240" alt="A drawer of neatly folded diffs, one sparking joy">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<h1 align="center">spark-joy</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center"><em>Make PRs spark joy again.</em></p>
|
|
11
|
+
|
|
12
|
+
AI-assisted pull requests are often thousands of lines long, too big to review properly in one go. spark-joy has Claude break a big PR or MR into small, ordered chunks, then opens a local app where you review them one batch at a time. You tick chunks off, leave notes, and finish with a summary of everything the PR changes.
|
|
13
|
+
|
|
14
|
+
It works from plain git, so it works the same for GitHub, GitLab or anything else. Nothing is posted anywhere; your notes export as markdown you can paste into the PR.
|
|
15
|
+
|
|
16
|
+
Inspired by [mr-cast](https://github.com/phanshiyu/mr-cast).
|
|
17
|
+
|
|
18
|
+
## How it works
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
spark-joy extract → hunks.json every hunk of the diff gets an id (h001, h012.1, …)
|
|
22
|
+
Claude (the skill) → plan.json hunks grouped into chunks, in two review orders, plus a feature list
|
|
23
|
+
spark-joy validate → ok / errors every non-mechanical hunk is in exactly one chunk, sizes are sane
|
|
24
|
+
spark-joy serve → review app choose an order, review chunk by chunk, export review.md
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **Claude never copies code into the plan.** It refers to hunks by id, and `validate` checks that no change is missing or reviewed twice.
|
|
28
|
+
- **Two review orders.** *Foundations first* goes types → logic → callers → tests. *By feature* follows one capability at a time, end to end. You pick one, and can switch later without losing progress.
|
|
29
|
+
- **Mechanical changes are separated.** Lockfiles, generated files, binaries, renames and whitespace-only changes go into a collapsed *skim* section.
|
|
30
|
+
- **Chunks stay small.** The target is 100–300 changed lines and validation warns above 400. Large hunks are split at function boundaries so they can go into different chunks.
|
|
31
|
+
- **Progress survives new commits.** Review state is stored by hunk content, so after a push you re-extract and only new or changed hunks need another look.
|
|
32
|
+
- **Map.** Chunks as a graph. Click one to see how its files' diffs link; click a file to review it.
|
|
33
|
+
- **Summary.** A *What this PR does* list ties each feature to the chunks that implement it and shows how much of each has been reviewed.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
Requires Node 22 or newer and git.
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install -g @dansyuqri/spark-joy
|
|
41
|
+
spark-joy install-skill # or --project to install into ./.claude/skills
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Use
|
|
45
|
+
|
|
46
|
+
In Claude Code, inside the repo with the branch checked out:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
/spark-joy
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or say "help me review this PR in chunks". Claude extracts the diff, reads it, writes and validates the plan, and starts the app at http://127.0.0.1:4848.
|
|
53
|
+
|
|
54
|
+
In the app:
|
|
55
|
+
|
|
56
|
+
- `j` / `k` move between chunks and `x` toggles reviewed.
|
|
57
|
+
- Click a line number to leave a note on that line.
|
|
58
|
+
- **Summary → Export review.md** writes a markdown report with progress, notes (including `file:line`) and the feature list.
|
|
59
|
+
|
|
60
|
+
### Commands
|
|
61
|
+
|
|
62
|
+
| Command | What it does |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `spark-joy extract [base] [--working]` | Diff `merge-base(base, HEAD)..HEAD` (or the working tree) into a run in `.spark-joy/<branch>/` |
|
|
65
|
+
| `spark-joy outline` | Compact list of every file and hunk with sizes and flags |
|
|
66
|
+
| `spark-joy show <ids…> \| --file <path>` | Print hunks in full; accepts ranges like `h003..h010` |
|
|
67
|
+
| `spark-joy links` | Cross-file links: which hunk uses a name another defines |
|
|
68
|
+
| `spark-joy validate [--json]` | Check `plan.json` against the hunks |
|
|
69
|
+
| `spark-joy serve [--port n]` | Start the review app |
|
|
70
|
+
| `spark-joy export [--stdout]` | Write `review.md` |
|
|
71
|
+
| `spark-joy install-skill [--project]` | Install the Claude Code skill |
|
|
72
|
+
|
|
73
|
+
`base` defaults to `origin/HEAD`, then `origin/main`, `origin/master` or `main`. Runs are stored in `.spark-joy/`, which ignores itself in git.
|
|
74
|
+
|
|
75
|
+
The plan format is documented in [skill/SKILL.md](skill/SKILL.md), and the schema is in [shared/schema.ts](shared/schema.ts).
|
|
76
|
+
|
|
77
|
+
## Develop
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npm install
|
|
81
|
+
npm run build # CLI (tsup) and app (Vite)
|
|
82
|
+
npm test # unit and integration tests
|
|
83
|
+
npm run test:e2e # browser walkthrough of the app (Playwright + Chromium)
|
|
84
|
+
npm run typecheck
|
|
85
|
+
npm run dev:app # Vite dev server; proxies /api to a running `spark-joy serve`
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Layout:
|
|
89
|
+
|
|
90
|
+
- `cli/`: commands, diff parsing, splitting, classification, server.
|
|
91
|
+
- `shared/`: schemas, validation and derived state, used by both the CLI and the app.
|
|
92
|
+
- `src/`: the React review app.
|
|
93
|
+
- `skill/`: the Claude Code skill.
|
|
94
|
+
- `test/`: Vitest, with a fixture git repo.
|
|
95
|
+
|
|
96
|
+
## Releasing
|
|
97
|
+
|
|
98
|
+
Releases publish to npm from GitHub Actions with [trusted publishing](https://docs.npmjs.com/trusted-publishers), so no npm token is stored anywhere.
|
|
99
|
+
|
|
100
|
+
1. **First release only, by hand.** npm needs the package to exist before a trusted publisher can be added: `npm login`, then `npm publish`.
|
|
101
|
+
2. **Once, on npmjs.com:** open the package's Settings → Trusted publishing → GitHub Actions. Enter owner `Dansyuqri`, repository `spark-joy` and workflow `release.yml` (case-sensitive); leave the environment blank.
|
|
102
|
+
3. **Every release after that:** `npm version patch` (or `minor`/`major`), then `git push --follow-tags`. The `v*` tag runs `.github/workflows/release.yml`, which tests and publishes with provenance.
|