@warren-dean/code-kit 0.26.2 → 0.28.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +24 -0
- package/README.md +8 -6
- package/bin/code-kit.mjs +269 -52
- package/hooks/act.mjs +14 -5
- package/hooks/guard-bash.mjs +82 -17
- package/hooks/lib/adapters/hub/client.mjs +22 -0
- package/hooks/lib/checkout.mjs +105 -0
- package/hooks/lib/checks.mjs +34 -8
- package/hooks/lib/config.mjs +16 -2
- package/hooks/lib/dependencies.mjs +4 -0
- package/hooks/lib/designs.mjs +138 -0
- package/hooks/lib/events.mjs +9 -4
- package/hooks/lib/hook.mjs +61 -2
- package/hooks/lib/next.mjs +26 -5
- package/hooks/lib/plan.mjs +55 -13
- package/hooks/lib/queue.mjs +86 -1
- package/hooks/lib/regression.mjs +54 -44
- package/hooks/lib/rules.mjs +63 -20
- package/hooks/lib/security.mjs +20 -0
- package/hooks/lib/sessions.mjs +49 -9
- package/hooks/lib/snapshot.mjs +227 -22
- package/hooks/lib/team.mjs +27 -1
- package/hooks/lib/verify.mjs +37 -4
- package/hooks/lib/worktrees.mjs +18 -1
- package/hooks/mod/board.mjs +10 -1
- package/hooks/mod/loop.mjs +44 -1
- package/hooks/mod/register.mjs +96 -8
- package/hooks/mod/view.mjs +8 -0
- package/hooks/post-edit-check.mjs +3 -1
- package/hooks/session.mjs +3 -1
- package/hooks/stop-check.mjs +6 -1
- package/package.json +1 -1
- package/skills/design/SKILL.md +36 -7
- package/skills/dispatch/SKILL.md +1 -0
- package/skills/init/SKILL.md +2 -0
- package/skills/review/SKILL.md +2 -1
- package/skills/spec-design/SKILL.md +1 -1
- package/skills/status/SKILL.md +1 -1
- package/templates/agent.md +2 -1
package/skills/design/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: design
|
|
3
|
-
description: Design a design story's screens with the person before any of them is built, and record each approved design so its screen can be coded. Reads the screens the specs list, designs them in the project's design tool (Paper, Figma, Pencil) or as design files under design/, shows them, iterates on the person's feedback,
|
|
3
|
+
description: Design a design story's screens with the person before any of them is built, and record each approved design so its screen can be coded. Reads the screens the specs list, designs them in the project's design tool (Paper, Figma, Pencil) or as design files under design/, shows them, iterates on the person's feedback, exports each approved screen's states into design/ as files a lane can read, and adds them to the design register the design gate reads. --hand-over exports designs approved before that are still only in the tool. Use when code-kit next or the loop gives the design step, when a lane was refused for a screen whose design isn't approved, or runs /code-kit:design [story IDs].
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Design before code
|
|
@@ -32,25 +32,54 @@ Use the spec's own content: the real labels, fields, messages and limits from it
|
|
|
32
32
|
|
|
33
33
|
Show the person each screen (a screenshot, or the file to open) with one line on what it does and which requirements it serves. Ask what to change. Make the changes and show them again until they say a screen is approved. A screen they want rethought goes back to step 2; one that needs the spec changed goes to `/code-kit:spec-design` first.
|
|
34
34
|
|
|
35
|
-
## 4.
|
|
35
|
+
## 4. Export what's approved
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
A lane agent has no connection to the design tool: it builds from files in the repository. So when the person approves a screen, export every state they approved into `design/<area>/<screen>/<state>.<ext>` (`design/bookings/list/empty.png`, `design/bookings/list/empty.jsx`) before you record it, as it was approved: an artboard changed afterwards is a new approval. For each state, its code where the tool gives code, and a PNG at the size the product targets; once per project, the design tokens as JSON (`design/tokens.json`).
|
|
38
|
+
|
|
39
|
+
- **Paper:** `get_jsx` and `get_computed_styles` for each artboard, `export` for its PNG, `get_tokens` for the tokens.
|
|
40
|
+
- **Figma:** its MCP server's code and screenshot tools for each frame, and its variables for the tokens.
|
|
41
|
+
- **Claude Design and artifacts:** the page's HTML, read through the artifact; a headless browser's screenshot of each state for the PNG.
|
|
42
|
+
- **Pencil, or HTML files under `design/`:** the HTML is already the code; a headless browser's screenshot gives the PNG.
|
|
43
|
+
- **Anything else:** whatever code it gives, and the PNG. A tool that gives no code has an image only, and the state says why.
|
|
44
|
+
|
|
45
|
+
The export is the target the lane matches, not code to paste: it builds the screen from the project's design system and components.
|
|
46
|
+
|
|
47
|
+
## 5. Record the approved designs
|
|
48
|
+
|
|
49
|
+
For each approved screen, add an entry to the register, naming the code file the lane will write (from the architecture's folders and the project's routing), the screen as the spec's `## Screens` section names it, and every state with its files, the viewport it was drawn at and the sha256 of each file (`shasum -a 256 <file>`):
|
|
38
50
|
|
|
39
51
|
```json
|
|
40
52
|
{
|
|
41
53
|
"screens": [
|
|
42
54
|
{
|
|
43
55
|
"file": "apps/web/app/bookings/page.tsx",
|
|
44
|
-
"
|
|
45
|
-
"story": "ST-
|
|
46
|
-
"approved": "2026-10-11"
|
|
56
|
+
"screen": "Bookings list",
|
|
57
|
+
"story": "ST-1",
|
|
58
|
+
"approved": "2026-10-11",
|
|
59
|
+
"source": { "tool": "paper", "ref": "<file id> — Bookings list" },
|
|
60
|
+
"tokens": "design/tokens.json",
|
|
61
|
+
"states": [
|
|
62
|
+
{
|
|
63
|
+
"name": "default",
|
|
64
|
+
"code": "design/bookings/list/default.jsx",
|
|
65
|
+
"image": "design/bookings/list/default.png",
|
|
66
|
+
"viewport": "390x844",
|
|
67
|
+
"sha256": { "code": "<sha256>", "image": "<sha256>" }
|
|
68
|
+
}
|
|
69
|
+
]
|
|
47
70
|
}
|
|
48
71
|
]
|
|
49
72
|
}
|
|
50
73
|
```
|
|
51
74
|
|
|
75
|
+
`story` is this design story. One design can serve several code files, such as the web and the mobile screen: each has its own entry, naming the same states. Committing the register is refused while an entry names a file that isn't there, a hash that isn't the file's, a state with no image, or leaves out a state the spec lists for the screen; `code-kit designs` lists every entry and what's wrong with it.
|
|
76
|
+
|
|
52
77
|
The register is protected by the `design` approval, which is the person's: writing it is refused until they approve, and in a session with the code-kit mod the write waits in the band for their Approve. Give the approval a reason in their words ("bookings list and detail, as shown"). Then commit the designs and the register on `design/st-<n>`, and review and merge it like the lead's own story. Once it's merged, `code-kit next` dispatches the screen stories that waited on it.
|
|
53
78
|
|
|
54
|
-
##
|
|
79
|
+
## Handing over designs approved before (`--hand-over`)
|
|
80
|
+
|
|
81
|
+
`code-kit next` names register entries whose design is only in a design tool ("6 approved screens are only in paper"). For each, find the artboard the entry names, and ask the person whether it's still the design they approved: the tool's copy may have changed since. Once they confirm, export it as in step 4 and rewrite its entry as in step 5. Then, for each of those screens that's already built, compare the build with the export as the review does (each state's screenshot beside its PNG), and add a fix story to the plan for each difference, citing the screen's requirements.
|
|
82
|
+
|
|
83
|
+
## 6. Report
|
|
55
84
|
|
|
56
85
|
Say which screens were approved, which are still open and why, and what's dispatched next.
|
package/skills/dispatch/SKILL.md
CHANGED
|
@@ -65,6 +65,7 @@ Requirements (read each one in full, with its acceptance criteria):
|
|
|
65
65
|
What to build: <the story's description, and anything the lead decided that the spec doesn't say>
|
|
66
66
|
Fixes: <for a fix story, what was broken and where it was seen; write the test that fails because of it first>
|
|
67
67
|
Contracts to use: <paths of the schemas, events or tables this story relies on>
|
|
68
|
+
Designs: <for a story that builds screens, what `code-kit designs ST-<n>` lists: each screen file, and for every state its image, its code and its viewport, and the tokens file. Read every state's image and code before writing the screen; match its layout, copy, spacing and states exactly; build it from the design system's components rather than pasting the export; and account for every state in your report>
|
|
68
69
|
Out of scope: <what neighbouring stories or other lanes will do>
|
|
69
70
|
|
|
70
71
|
Steps:
|
package/skills/init/SKILL.md
CHANGED
|
@@ -54,11 +54,13 @@ Write `.claude/code-kit.draft.json`. Follow `${CLAUDE_PLUGIN_ROOT}/README.md`
|
|
|
54
54
|
- `paths`: globs matching where that layer's code really lives;
|
|
55
55
|
- `mayImport`: the direction the docs set. For brownfield code, the direction most of the code already follows;
|
|
56
56
|
- `denyPackages`: packages forbidden for that layer, for example `node:*` or a vendor SDK outside its adapter.
|
|
57
|
+
- `label` (optional): what the layer delivers, in a few words ("API contract", "Data", "Service"), when its name doesn't say it.
|
|
57
58
|
- Also add `importAliases` for path aliases in `tsconfig` `paths` that the graph can't see. Workspace package names are found automatically.
|
|
58
59
|
- The import check reads JavaScript and TypeScript. For another language, record the layers anyway (agents and spec-check use them), and say the import check doesn't cover that language yet.
|
|
59
60
|
- **`lanes`:** one per documented or discovered ownership area. Each needs:
|
|
60
61
|
- `agent`: a kebab-case agent name, for example `api-engineer`;
|
|
61
62
|
- `paths` and `exclude`: every path must have exactly one owner.
|
|
63
|
+
- `label` (optional): what the lane delivers, in a few words ("Screens", "Tests"), when its name doesn't say it.
|
|
62
64
|
- **A QA lane:** when lanes own screens, or the plan's journeys cross lanes, a `qa` lane with a `test-engineer` agent owning the end-to-end suites (the plan's work split names them; brownfield: the folders the existing end-to-end tests live in), even if the docs forgot it. Its agent's proving command runs the suites. Add a `checks` entry for them scoped by `files` to the suites, so verify runs them when they change. Unit tests stay with each lane.
|
|
63
65
|
- **`setup`:** `3`, the version of this setup, so `code-kit next` can tell an older project what re-running init adds.
|
|
64
66
|
- **`lead.paths`:** contracts, specs, design, root config, and anything the docs reserve for the lead.
|
package/skills/review/SKILL.md
CHANGED
|
@@ -48,6 +48,7 @@ Read the story and every requirement it cites. Then start from what's already be
|
|
|
48
48
|
- **Its journeys still pass end to end:** where the project has a QA lane, run the end-to-end suites that cover this story's requirements (the qa lane's command, filtered to them) against the branch. A journey that broke fails the review, even when the story's own tests pass. A story the QA lane delivered is reviewed the same way: each journey's test proves the requirements it cites, through the real screens and services, with no mocked responses.
|
|
49
49
|
- **The spec-check report matches:** its table has no row still `missing` or `conflicts` without an answer, and its questions were answered, not guessed.
|
|
50
50
|
- **Only the story:** changes beyond the story (refactors elsewhere, other stories' requirements) are sent back, or split into their own story. A new dependency is yours to judge, as in `/code-kit:decide`: the story's requirements need it, nothing the project has does the job, and it fits the principles and the layer. Only what crosses a guardrail (the spec, a contract, the architecture) is the person's call.
|
|
51
|
+
- **Built to its design:** for a story that builds screens, `code-kit designs ST-<n>` lists each screen's approved states. Take a screenshot of each built state at the design's viewport (the project's end-to-end runner, or a headless browser) and set it beside the state's PNG. A missing state or a different layout is a blocker, naming the state and its design file; different copy or components fail it too; spacing within the design system's scale is a nit. A state the build can't serve yet (the contract has no field for what the design shows) goes in the report with what's missing, and you add the story that provides it, rather than leaving a gap nobody sees.
|
|
51
52
|
- **Contracts respected:** the code uses the contracts as written. A lane that needed a contract change should have asked, not worked around it.
|
|
52
53
|
- **Standards kept:** `code-kit standards --for <changed files>` lists the project's standards for those files' layers. Check each changed file against the ones marked `checked` (the hooks already refuse what an `enforced` one names). A broken required standard sends the branch back, naming the standard's id and where; a broken recommended one is a concern; advice is at most a nit.
|
|
53
54
|
|
|
@@ -77,7 +78,7 @@ Report the table, `verify`'s result, the security review's findings (or that non
|
|
|
77
78
|
node "${CLAUDE_PLUGIN_ROOT}/bin/code-kit.mjs" queue add <branch>
|
|
78
79
|
```
|
|
79
80
|
|
|
80
|
-
Branches merge from the queue one at a time, in the order their reviews passed, each verified against the base as it is then. Where `approvals.delegate.merge` is on and the harness's autonomy is `autonomous`, you merge the head: `code-kit queue merge --delegated` (code-kit's loop asks you when it's its turn). Otherwise the person merges it, with Merge in the code-kit band or `code-kit queue merge --person`. The queue records the commit your review passed and merges exactly that commit. A branch that moves on after your review leaves the queue: review it again, then queue it again. A head that no longer merges cleanly, or fails verify against the moved base, is sent back to its lane on its own; dispatch the fix as for any send-back. When the branch is merged, remove its worktree. Where the base's rules set `branches.publish`, the merge also reaches the remote's base on its own: pushed, or as a pull request code-kit opens from `code-kit/publish-<base>` (and merges, where pushing the base is delegated to you). Never merge a story into another branch to get it there: `code-kit publish --delegated` tries again when GitHub held it back.
|
|
81
|
+
Branches merge from the queue one at a time, in the order their reviews passed, each verified against the base as it is then. Where `approvals.delegate.merge` is on and the harness's autonomy is `autonomous`, you merge the head: `code-kit queue merge --delegated` (code-kit's loop asks you when it's its turn). Otherwise the person merges it, with Merge in the code-kit band or `code-kit queue merge --person`. The queue records the commit your review passed and merges exactly that commit. A branch that moves on after your review leaves the queue: review it again, then queue it again. A head that no longer merges cleanly, or fails verify against the moved base, is sent back to its lane on its own; dispatch the fix as for any send-back. When the branch is merged, remove its worktree. Where the base's rules set `branches.publish`, the merge also reaches the remote's base on its own: pushed, or as a pull request code-kit opens from `code-kit/publish-<base>` (and merges, where pushing the base is delegated to you). Never merge a story into another branch to get it there: `code-kit publish --delegated` tries again when GitHub held it back. A branch that breaks the base merged on its own (a new API whose callers another story updates) is queued with the branches it lands with: `queue add <branch> --with <other>`. It waits in the queue, without asking for review again, until they're reviewed and queued too, and then they're verified and merged as one.
|
|
81
82
|
|
|
82
83
|
- **Send back.** List each problem, where it is, and what "fixed" looks like, with the requirement or the standard's id it breaks. Record the send-back, so `status` and `next` read the branch as waiting for its fix rather than finished:
|
|
83
84
|
|
|
@@ -88,7 +88,7 @@ Each requirement gets an ID (`<AREA>-<n>`, for example `BOOK-4`) and its own hea
|
|
|
88
88
|
- **Acceptance criteria:** Given / When / Then for the main path and for each important error.
|
|
89
89
|
- **Threat model:** a short `## Threat model` per area: what in it is sensitive (personal data, children's data, credentials, money), who might attack it (a signed-out visitor, another customer, a staff member with the wrong role), and its trust boundaries (where outside input enters). A few concrete lines, not a compliance checklist; leave it out for an area that holds nothing sensitive and takes no outside input.
|
|
90
90
|
- **Security requirements:** under `## Security requirements`, the rules that stop the attacks the threat model names, each with an ID and heading like any other requirement (`### BOOK-9 A customer sees only their own bookings`) and acceptance criteria written from the attacker's side. Stories cite them like any other requirement; a story that cites one always gets the security review.
|
|
91
|
-
- **Screens** (any area a person uses through a web, mobile or desktop interface): a `## Screens` section
|
|
91
|
+
- **Screens** (any area a person uses through a web, mobile or desktop interface): a `## Screens` section with a `### <Screen name>` heading for each screen: what it shows, what the person can do on it and which requirements it serves, and a `**States:**` line naming its states (`default, empty, loading, error`, and any others it has). These are what gets designed before anything is built.
|
|
92
92
|
|
|
93
93
|
A spec answers what and why, not how: no framework, file or function names unless the person requires them. Anything still undecided goes in the spec's open questions and the brief's, never into a requirement. `Status: specified`.
|
|
94
94
|
|
package/skills/status/SKILL.md
CHANGED
|
@@ -37,6 +37,6 @@ Then the detail only if the person asks: the story table and the requirement tab
|
|
|
37
37
|
|
|
38
38
|
## Keep the plan current
|
|
39
39
|
|
|
40
|
-
`status` shows where the plan's `**Status:**` lines disagree with git ("the plan is out of date"). Offer to fix them. The lead edits the plan, updates the lines, and commits on the lead's branch. Git is right about branches; the plan is right about `done` for stories whose branch was merged and deleted.
|
|
40
|
+
`status` shows where the plan's `**Status:**` lines disagree with git ("the plan is out of date"). Offer to fix them. The lead edits the plan, updates the lines, and commits on the lead's branch. Git is right about branches; the plan is right about `done` for stories whose branch was merged and deleted. A story taken out of the plan (folded into another, or no longer wanted) gets `**Status:** dropped` rather than being deleted: code-kit never dispatches it or waits on it.
|
|
41
41
|
|
|
42
42
|
Gaps between the specs and the plan (a requirement in no story, an unknown lane, a duplicate ID) are the lead's to fix in the plan or the spec. If fixing one needs a product decision, ask the person rather than guessing.
|
package/templates/agent.md
CHANGED
|
@@ -26,12 +26,13 @@ Always:
|
|
|
26
26
|
- You answer to the lead, never the person. A question the spec doesn't settle (a product choice, UX the spec is silent on, an account): write it for the lead, with the choices and what each does, and carry on with what doesn't depend on it, or stop. The lead decides, or asks the person.
|
|
27
27
|
- A new dependency needs the lead's approval. Before asking, check the project doesn't already have something that does the job. If the install is refused, put in a change request for the lead: the package, the story and requirement that need it, what you checked, and anything lighter that would do; then stop. The lead approves it, or tells you what to use instead.
|
|
28
28
|
- Build every feature end to end. No mocks, stubs, placeholder screens or "coming soon".
|
|
29
|
+
- A screen is built to its approved design: the brief names every state's image and code under `design/`. Read each before you write the screen, match its layout, copy, spacing and states, and build it from the project's components rather than pasting the export. Your report lists each state with what you built for it.
|
|
29
30
|
- Prove each acceptance criterion with a test whose title names the requirement ID, e.g. `BOOK-4 …`.
|
|
30
31
|
- Fixing a bug: first write a test that fails because of the bug, through the code that's already there, then fix it. `verify` runs your test without the fix, and it must fail on an assertion, not because it calls something the fix adds.
|
|
31
32
|
- Never weaken a test to get to green: no deleting, skipping or focusing tests, cutting cases or assertions, or rewriting snapshots. The commit is refused without the person's approval. Fix the code; if the test itself is wrong, say why in a change request for the lead.
|
|
32
33
|
- Run the narrowest tests that prove each step, with failures only in the output (a quiet reporter, or `| tail -40` on failure); run the full suite once, before you commit. Long output stays in your context and is paid for on every step after it.
|
|
33
34
|
- Commit after each step whose tests pass, not once at the end, so a crash loses at most the step you're on; and commit your work before finishing: the stop hook runs the checks and requires it.
|
|
34
35
|
- Don't message the lead while you work: it hears from you once, when you finish. If you're blocked on something only the lead or the person can settle, finish and say so.
|
|
35
|
-
- One story per agent. If you're asked to wrap up because your context is large, finish the step you're on, commit, write your report and hand back: a fresh agent carries
|
|
36
|
+
- One story per agent. If you're asked to wrap up because your context is large, finish the step you're on, commit, write your report and hand back. If the story isn't done, start the hand-back with `Not finished:` and what's left: a fresh agent carries it on from your report. If it is done, hand back as usual and it goes to review.
|
|
36
37
|
- Before you finish, write your full report to `.claude/state/reports/<branch>.md` (the branch with `/` as `_`, as for spec-check): what you did and why, the spec section, the commands you ran with their output, what's left, and anything you need decided, with the choices and any text you'd otherwise paste. The stop hook requires it.
|
|
37
38
|
- Finish with a short hand-back, at most ten lines: the story and branch, done or blocked, any decision the lead must make, and the report's path. No output or code in it: the lead reads the report when it reviews.
|