@warren-dean/code-kit 0.8.0 → 0.9.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.
@@ -17,7 +17,7 @@ The CLI is `node "${CLAUDE_PLUGIN_ROOT}/bin/code-kit.mjs"`, run from the project
17
17
  node "${CLAUDE_PLUGIN_ROOT}/bin/code-kit.mjs" status
18
18
  ```
19
19
 
20
- A story is **ready** when its dependencies are done and nobody has started it. `status` also lists gaps between the specs and the plan; a story with a gap (an unknown lane, a requirement no spec defines) isn't dispatched until the lead fixes the plan. Stories in the `lead` lane are never dispatched: the lead builds them itself.
20
+ A story is **ready** when its dependencies are done and nobody has started it. `status` also lists gaps between the specs and the plan; a story with a gap (an unknown lane, a requirement no spec defines) isn't dispatched until the lead fixes the plan. Stories in the `lead` lane are never dispatched: the lead builds them itself. Nor are design stories (`**Lane:** design`): the lead designs them with the person (`/code-kit:design`), and the screen stories that depend on them wait until their designs are approved and merged.
21
21
 
22
22
  If the project has no `docs.plan`, or the plan has no stories in the `### ST-n` form (`${CLAUDE_PLUGIN_ROOT}/templates/plan.md`), stop and suggest the spec-design skill.
23
23
 
@@ -40,6 +40,14 @@ Commit everything the lanes need first. Each lane branches from the lead's branc
40
40
 
41
41
  ## 3. Brief and start each lane
42
42
 
43
+ **In a team** (the config has `team`): claim each story before you brief its agent, leasing what it will change, so nobody else's agents build on the same files meanwhile:
44
+
45
+ ```bash
46
+ node "${CLAUDE_PLUGIN_ROOT}/bin/code-kit.mjs" team claim ST-<n> --lease "<glob>,<glob>"
47
+ ```
48
+
49
+ The lease is the paths the story will create or change: its lane's folders for this feature, and any contract it changes. A claim someone else holds is refused with who holds it; pick another story or ask them. Stories in a lane another person owns are theirs to dispatch. Making the story's branch also claims it, and each commit on it adds what it changed to the lease; merging it ends the claim.
50
+
43
51
  Start each story with the Agent tool: `subagent_type` is the lane's agent, `isolation: "worktree"`, and run them in the background. Start every story in the batch in the same message so they run in parallel.
44
52
 
45
53
  The brief is the agent's whole context. Write it so the agent needs nothing else:
@@ -59,10 +59,16 @@ Write `.claude/code-kit.draft.json`. Follow `${CLAUDE_PLUGIN_ROOT}/README.md`
59
59
  - **`lanes`:** one per documented or discovered ownership area. Each needs:
60
60
  - `agent`: a kebab-case agent name, for example `api-engineer`;
61
61
  - `paths` and `exclude`: every path must have exactly one owner.
62
+ - **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
+ - **`setup`:** `2`, the version of this setup, so `code-kit next` can tell an older project what re-running init adds.
62
64
  - **`lead.paths`:** contracts, specs, design, root config, and anything the docs reserve for the lead.
63
65
  - **`anyActor`:** lockfiles, if lanes may update them.
64
66
  - **`protected`:** registers and contracts that need a person's sign-off, each with an `approval` name and a `why`.
65
- - **`designGate`:** only if the docs require designs before screens.
67
+ - **`designGate`:** whenever a lane owns screens (web, mobile, desktop), designs come before code:
68
+ - `register`: `design/register.json`, written now as `{ "screens": [] }`;
69
+ - `screens`: a glob for each such lane's screen files (routes, pages, views), from the architecture's folders, with `not` for tests and stories;
70
+ - `howTo`: "Design it first: run /code-kit:design for this area's design story, and a person approves it.";
71
+ - a `protected` entry for the register (approval `design`, why "only approved designs are built"). Never put `design` in `approvals.delegate`: approving a design is the person's.
66
72
  - **`shell.block`:** deploy, release and production commands reserved for CI or a person.
67
73
  - **`shell.restricted`:** commands that affect a shared local service, limited to the lanes that own it.
68
74
  - **`postEdit`:** the project's existing per-file linters and formatters, with `{file}`.
@@ -97,7 +103,7 @@ Draft, alongside the config:
97
103
  - If an agent already exists, keep its content and add only what's missing.
98
104
  - Drop the spec-check lines if the config has no `docs.specs`.
99
105
  - **CLAUDE.md:** add the section from `${CLAUDE_PLUGIN_ROOT}/templates/claude-md.md`.
100
- - **Project skills** (recipes like "new migration" or "new endpoint"): list the recipes the docs describe step by step, and offer to write them. Don't write them unasked, and never write an empty one.
106
+ - **Project skills, with the agents** (recipes like "new screen", "new migration" or "new endpoint"): one per recipe in the architecture's `## Recipes`, or any other doc that describes one step by step. Draft them now, alongside the agents, and show them in the same approval; the agents and their skills are one piece of work. Brownfield code without recipes in its docs: propose recipes from the patterns the code already follows (how its existing screens, endpoints or migrations are built), as drafts the person approves. Never write an empty one.
101
107
  - Write each as `.claude/skills/<name>/SKILL.md`, saying in its description which recipe in which doc it comes from, so an update can find it again.
102
108
  - List it under **Skills to use** on every lane agent whose paths the recipe touches, not only one: a recipe that adds a migration and the endpoint that uses it belongs to both lanes. A recipe only the lead follows goes in the CLAUDE.md section instead.
103
109
 
@@ -107,8 +113,9 @@ Show the person:
107
113
  2. the lanes, their agents and their paths;
108
114
  3. protected paths, blocked and restricted commands, and checks (including any left out because they fail today);
109
115
  and whether the lead may record approvals given in chat (`approvals.lead`), and how hands-off the build is (`harness.autonomy`);
110
- 4. the active adapters and what each adds, from `adapters`;
111
- 5. every **question**: where the docs or the code are silent, ambiguous or contradictory. Don't guess; a wrong owner or layer blocks real work.
116
+ 4. the project skills, and which lane agents use each;
117
+ 5. the active adapters and what each adds, from `adapters`. A companion tool that's installed but not set up here (its init skill is in your skills list, for example `/context-graph:init` with no `.ctx/` folder): add `"adapters": { "<name>": true }` to the draft and say it will be set up before any code is written;
118
+ 6. every **question**: where the docs or the code are silent, ambiguous or contradictory. Don't guess; a wrong owner or layer blocks real work.
112
119
 
113
120
  Once they approve (with any changes):
114
121
 
@@ -125,10 +132,11 @@ Once they approve (with any changes):
125
132
  - tell the person to make the `code-kit` check required on the protected branches.
126
133
  7. Run `check` and `unowned` again, without `--config`.
127
134
  8. Commit the setup straight onto the base branch (usually `main`), not a branch: while the base has no `.claude/code-kit.json` committed, the hooks let the lead make that one commit, so the rules the person just approved are in force on `main` and the lead can merge reviewed work from the start, with no first merge for anyone to make. The kit records the protected files in `.claude/approval-log.jsonl`. If the base already has rules (an update, section 4), commit on a branch as usual.
135
+ 9. Set up each companion the config now wants (`"adapters": { "<name>": true }`) by running its init skill, for example `/context-graph:init`, which asks nothing. Do it before reporting, so it's in place before the coding loop starts; `code-kit next` also gives `setup` until it is.
128
136
 
129
137
  Report what was set up, what's enforced from now on, how many existing violations the baseline holds, and the open questions. Say who does what from here: the person owns the intent and the rules; the lead owns delivery, so it dispatches, reviews, sends back and merges, and approves within the delegated limits, and only a real decision (scope, something outside those limits, a problem it couldn't solve) comes to the person.
130
138
 
131
- If the project has no `.ctx/` folder, end the report with one line about the companion plugin. If Context Graph is already installed (its `/context-graph:init` command is available to you), offer to run it now: "Context Graph is installed but has no graph here yet. `/context-graph:init` gives each lane agent the why behind the files it edits (cards, rules and decisions kept in git), with this spec's requirements and layer rules in them. Shall I run it?" If it isn't installed, don't install it unless the person asks: "Context Graph can give each lane agent the why behind the files it edits (cards, rules and decisions kept in git), with this spec's requirements and layer rules in them: `/plugin marketplace add warrendeanlangeveldt/context-graph`, then `/plugin install context-graph@context-graph`."
139
+ If the project has no `.ctx/` folder and Context Graph isn't installed, don't install it unless the person asks: "Context Graph can give each lane agent the why behind the files it edits (cards, rules and decisions kept in git), with this spec's requirements and layer rules in them: `/plugin marketplace add warrendeanlangeveldt/context-graph`, then `/plugin install context-graph@context-graph`."
132
140
 
133
141
  ## 4. Update an existing setup
134
142
 
@@ -136,6 +144,11 @@ Re-run whenever the build has moved on: new apps or packages, folders that moved
136
144
 
137
145
  1. **Re-read** the docs and the repository as in section 1, including the brownfield steps if the code has grown past the docs.
138
146
  2. **Draft** the whole config again into `.claude/code-kit.draft.json`, starting from the live one. Keep everything that's still right, so the diff shows only real changes. If the live config has no `harness.autonomy`, ask the person about it as in section 2.
147
+ A config without `"setup": 2` predates what setup now includes; add whichever of these the project is missing, as section 2 and 3 describe, and set `"setup": 2`:
148
+ - project skills for the recipes in the docs (or, without recipes, the patterns the code follows), listed on the lane agents;
149
+ - the design gate for every lane that owns screens, with its register; and design stories in the plan for screens not yet built (ask the person before adding stories);
150
+ - the QA lane, its agent and its checks, when there are screens or journeys across lanes;
151
+ - `"adapters": { "<name>": true }` for a companion that's installed but not set up, which is then set up before any code.
139
152
  3. **Show the difference:**
140
153
 
141
154
  ```bash
@@ -156,7 +169,7 @@ Re-run whenever the build has moved on: new apps or packages, folders that moved
156
169
  - a smaller baseline when `baseline` shows violations were fixed. It only ever shrinks.
157
170
  5. **On approval:**
158
171
  1. Replace `.claude/code-kit.json` with the draft and delete the draft.
159
- 2. Write or update the agents, and write, update or remove the project skills as approved.
172
+ 2. Write or update the agents, and write, update or remove the project skills as approved, together.
160
173
  3. Run `baseline --write` if it shrank.
161
174
  4. Run `check` and `unowned`.
162
175
  5. Commit on a branch.
@@ -24,7 +24,9 @@ It returns `step`, `why`, `args`, `then` (steps that can follow straight after)
24
24
  | No config, existing code or docs | `init` |
25
25
  | Nothing at all | `spec-design` |
26
26
  | Config, but no specs, plan or stories | `spec-design` |
27
+ | A companion the config wants, not set up yet | `setup`: run that tool's init skill (`args`), before code |
27
28
  | Stories finished on their branches | `review`, then `dispatch` what's ready |
29
+ | Design stories ready (`**Lane:** design`) | `design`, then `dispatch` what needs no design |
28
30
  | Stories ready | `dispatch` |
29
31
  | The lead's own stories ready (`**Lane:** lead`) | `lead`: the lead builds them itself |
30
32
  | Stories being built, nothing else can start | wait |
@@ -37,6 +39,7 @@ Tell the person in one or two lines what you found and what you're about to run,
37
39
 
38
40
  Run the named skill with the Skill tool: `code-kit:<step>`, with `args` (and the person's argument, if they gave one). Follow that skill in full. This skill only chooses; it never does a step's work itself.
39
41
 
42
+ - **`setup`:** run the skill named in `args` (for example `context-graph:init`); it's another plugin's, so call it by that full name.
40
43
  - **`lead`:** there's no skill to run. Build each story yourself, on the branch `lead/st-<n>`: spec-check it first if it cites requirements, do the work, commit, then run `code-kit:review` on the branch like any other. A spike's result goes in the docs it names.
41
44
  - **`wait`:** say which stories are being built and on which branches, then stop. When a lane agent finishes, its notification arrives in this session; run this skill again then. If a story has been in progress with no agent running (the session ended, or the agent stopped without committing), dispatch it again.
42
45
  - **`done`:** give the `status` summary in a few lines, then offer to run spec-design for the next milestone or feature.
@@ -42,6 +42,7 @@ Read the story, every requirement it cites, and the full diff (`git diff <base>.
42
42
 
43
43
  - **Built end to end:** the behaviour works from the entry point to storage and back, including the errors, permissions and states the spec lists. A mock, stub, hard-coded response, placeholder screen, `TODO` or "coming soon" in shipped code fails the requirement.
44
44
  - **Tested:** a test proves each acceptance criterion and names the requirement ID. The test would fail if the behaviour were broken; one that asserts nothing, or only asserts a mock, doesn't count.
45
+ - **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.
45
46
  - **The spec-check report matches:** its table has no row still `missing` or `conflicts` without an answer, and its questions were answered, not guessed.
46
47
  - **Only the story:** changes beyond the story (refactors elsewhere, other stories' requirements, new dependencies) are called out. They may be fine, but they're the person's call.
47
48
  - **Contracts respected:** the code uses the contracts as written. A lane that needed a contract change should have asked, not worked around it.
@@ -85,6 +85,7 @@ Each requirement gets an ID (`<AREA>-<n>`, for example `BOOK-4`) and its own hea
85
85
  - **Errors and edge cases:** invalid input, duplicates, concurrency, partial failure, timeouts, an external service being down, empty and very large data.
86
86
  - **Events and integrations:** what other parts of the system or external services are told, and what they send back.
87
87
  - **Acceptance criteria:** Given / When / Then for the main path and for each important error.
88
+ - **Screens** (any area a person uses through a web, mobile or desktop interface): a `## Screens` section listing each screen, what it shows, what the person can do on it and which requirements it serves, with its empty, loading and error states. These are what gets designed before anything is built.
88
89
 
89
90
  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`.
90
91
 
@@ -98,14 +99,19 @@ These are what `/code-kit:init` turns into enforced rules, so be concrete.
98
99
  - what each layer must not use, for example no database client in the domain;
99
100
  - the **contracts** (API schemas, events, database schema) and who may change them;
100
101
  - external services and how each is isolated;
101
- - how the quality targets from phase 3 are met.
102
+ - how the quality targets from phase 3 are met;
103
+ - **recipes**: under `## Recipes`, a `### <recipe-name>` for each layer's common addition (a new screen, endpoint, migration, domain service, job): the steps in order, the files each step creates or changes, and how it's tested. Each becomes a project skill when init sets up the lanes, so every lane agent builds the same thing the same way;
104
+ - the **design tool** for screens, when there are any: the one the person uses (Paper, Figma, Pencil), or design files under `design/` when they have none.
102
105
  Propose the architecture from the specs and constraints, explain the choices, and ask about the ones that matter. Record each in the decision log.
103
106
  - **`docs/principles.md`:** the engineering rules; what counts as a contract; the definition of done (tests, checks, reviews, end-to-end working features); the test, lint, typecheck and database commands once they're known; and which commands only CI or a person may run, such as deploys.
104
107
  - **`docs/plan.md`**, from `${CLAUDE_PLUGIN_ROOT}/templates/plan.md`:
105
- - the **work split**: lanes (for example web, api, data), the paths each will own, the agent name for it and the command that proves its work, so work can run in parallel without overlap;
108
+ - the **work split**: lanes (for example web, api, data), the paths each will own, the agent name for it and the command that proves its work, so work can run in parallel without overlap. Each lane writes and runs the unit tests for its own code;
109
+ - a **QA lane** (`qa`, agent `test-engineer`) whenever the product has screens or journeys that cross lanes: it owns the end-to-end suites (for example `e2e/**` or `apps/*/e2e/**`), in the runner that suits each surface (Playwright for web, Maestro or Detox for mobile), and its command runs them. Nobody else owns these tests, so without it nothing proves a journey works across the lanes;
106
110
  - milestones, each a usable increment;
107
111
  - stories, each small enough for one lane to finish on one branch. Each story is a `### ST-<n> Title` heading with `**Lane:**`, `**Requirements:**` (the IDs it delivers, or `none` for a spike or a foundation that delivers none), `**Depends on:**` and `**Status:** todo` lines. `code-kit status` and the dispatch skill read them. A story that needs two lanes is two stories, with a dependency between them;
108
- - sequencing: contracts and shared foundations first, as the lead's own stories (`**Lane:** lead`, built by the lead rather than dispatched), then work that can run in parallel.
112
+ - sequencing: contracts and shared foundations first, as the lead's own stories (`**Lane:** lead`, built by the lead rather than dispatched), then work that can run in parallel;
113
+ - **a test story per journey**: for each main user journey, a story in the `qa` lane citing the journey's requirements and depending on the screen and service stories it goes through, so the journey is proven end to end as soon as its parts are built;
114
+ - **design before code**: when there are screens, a design story for each area's screens (`**Lane:** design`, citing the requirements its screens serve), early in the plan, and every story that builds those screens depends on it. The lead designs them with the person (`/code-kit:design`), and no screen is built until its design is approved.
109
115
 
110
116
  `Status: planned`.
111
117
 
package/templates/plan.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Plan
2
2
 
3
- `code-kit status` reads this file. Keep each story's heading and its four `**…:**` lines in this form. Use `**Lane:** lead` for the lead's own stories (contracts, foundations, spikes), and `**Requirements:** none` for a story that delivers no requirement.
3
+ `code-kit status` reads this file. Keep each story's heading and its four `**…:**` lines in this form. Use `**Lane:** lead` for the lead's own stories (contracts, foundations, spikes), `**Lane:** qa` for a journey's end-to-end test story (it depends on the screen and service stories the journey goes through), `**Lane:** design` for a design story (an area's screens, designed with the person before any of them is built; the stories building them depend on it), and `**Requirements:** none` for a story that delivers no requirement.
4
4
 
5
5
  ## Lanes
6
6