work-kit-cli 0.3.0 → 0.4.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 +11 -0
- package/cli/src/commands/bootstrap.test.ts +40 -0
- package/cli/src/commands/bootstrap.ts +38 -0
- package/cli/src/commands/extract.ts +207 -0
- package/cli/src/commands/init.test.ts +50 -0
- package/cli/src/commands/init.ts +32 -5
- package/cli/src/commands/learn.test.ts +244 -0
- package/cli/src/commands/learn.ts +104 -0
- package/cli/src/commands/next.ts +30 -10
- package/cli/src/commands/observe.ts +16 -21
- package/cli/src/commands/pause-resume.test.ts +2 -2
- package/cli/src/commands/resume.ts +95 -7
- package/cli/src/commands/setup.ts +160 -0
- package/cli/src/commands/status.ts +2 -0
- package/cli/src/commands/workflow.ts +19 -9
- package/cli/src/config/constants.ts +10 -0
- package/cli/src/config/model-routing.test.ts +190 -0
- package/cli/src/config/model-routing.ts +208 -0
- package/cli/src/config/workflow.ts +5 -5
- package/cli/src/index.ts +70 -5
- package/cli/src/observer/data.ts +132 -9
- package/cli/src/observer/renderer.ts +34 -36
- package/cli/src/observer/watcher.ts +28 -16
- package/cli/src/state/schema.ts +50 -3
- package/cli/src/state/store.ts +39 -4
- package/cli/src/utils/fs.ts +13 -0
- package/cli/src/utils/knowledge.ts +471 -0
- package/package.json +1 -1
- package/skills/auto-kit/SKILL.md +27 -10
- package/skills/full-kit/SKILL.md +25 -8
- package/skills/resume-kit/SKILL.md +44 -8
- package/skills/wk-bootstrap/SKILL.md +6 -0
- package/skills/wk-build/SKILL.md +3 -2
- package/skills/wk-deploy/SKILL.md +1 -0
- package/skills/wk-plan/SKILL.md +3 -2
- package/skills/wk-review/SKILL.md +1 -0
- package/skills/wk-test/SKILL.md +1 -0
- package/skills/wk-test/steps/e2e.md +15 -12
- package/skills/wk-wrap-up/SKILL.md +15 -2
- package/skills/wk-wrap-up/steps/knowledge.md +76 -0
package/skills/auto-kit/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: auto-kit
|
|
3
3
|
description: "Smart pipeline that analyzes the request and builds a dynamic workflow. Usage: /auto-kit <description> to start, /auto-kit to continue."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
argument-hint: "[--gated] [description]"
|
|
5
|
+
argument-hint: "[--gated] [--opus|--sonnet|--haiku|--inherit] [description]"
|
|
6
6
|
allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -91,17 +91,34 @@ The table is a guide, not a rigid rule. Adjust based on the actual request:
|
|
|
91
91
|
|
|
92
92
|
### Step 3: Initialize
|
|
93
93
|
|
|
94
|
-
1.
|
|
94
|
+
1. Parse flags out of the user's input before building the init command:
|
|
95
|
+
- `--gated` → append `--gated`
|
|
96
|
+
- `--opus` → append `--model-policy opus`
|
|
97
|
+
- `--sonnet` → append `--model-policy sonnet`
|
|
98
|
+
- `--haiku` → append `--model-policy haiku`
|
|
99
|
+
- `--inherit` → append `--model-policy inherit` (no model override; lets Claude Code's default pick)
|
|
100
|
+
- No model flag → omit `--model-policy` (defaults to `auto` = work-kit step-level routing)
|
|
101
|
+
|
|
102
|
+
Strip recognized flags from the description text. Only one model flag at a time — if the user passes more than one, report the conflict and stop.
|
|
103
|
+
|
|
104
|
+
2. Create a git worktree and initialize state with the CLI:
|
|
95
105
|
```bash
|
|
96
106
|
git worktree add worktrees/<slug> -b feature/<slug>
|
|
97
107
|
cd worktrees/<slug>
|
|
98
|
-
work-kit init --mode auto --description "<description>" --classification <classification>
|
|
108
|
+
work-kit init --mode auto --description "<description>" --classification <classification> [--gated] [--model-policy <value>]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
```
|
|
113
|
+
/auto-kit fix login bug → work-kit init --mode auto --description "fix login bug" --classification bug-fix
|
|
114
|
+
/auto-kit --inherit fix the typo → work-kit init --mode auto --description "fix the typo" --classification small-change --model-policy inherit
|
|
115
|
+
/auto-kit --haiku tweak copy → work-kit init --mode auto --description "tweak copy" --classification small-change --model-policy haiku
|
|
99
116
|
```
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
117
|
+
|
|
118
|
+
3. Show the workflow to the user: `work-kit workflow` (output now includes the resolved model per step and the active policy; review it before approving)
|
|
119
|
+
4. User can adjust: `work-kit workflow --add review/security` or `work-kit workflow --remove test/e2e`
|
|
120
|
+
5. **Wait for approval** — user can add/remove steps before proceeding
|
|
121
|
+
6. Once approved, start the execution loop
|
|
105
122
|
|
|
106
123
|
## Continuing Work (`/auto-kit` with no args)
|
|
107
124
|
|
|
@@ -186,8 +203,8 @@ The CLI manages all state transitions, prerequisites, and loopbacks. Follow this
|
|
|
186
203
|
1. Run `work-kit next` to get the next action
|
|
187
204
|
2. Parse the JSON response
|
|
188
205
|
3. Follow the action type:
|
|
189
|
-
- **`spawn_agent`**: Use the Agent tool with the provided `agentPrompt`. Pass `skillFile` path for reference. After the agent completes: `work-kit complete <phase>/<step> --outcome <outcome>`
|
|
190
|
-
- **`spawn_parallel_agents`**: Spawn all agents in the `agents` array in parallel using the Agent tool. Wait for all to complete. Then spawn `thenSequential` if provided. After all complete: `work-kit complete <onComplete target>`
|
|
206
|
+
- **`spawn_agent`**: Use the Agent tool with the provided `agentPrompt`. Pass `skillFile` path for reference. **If the action includes a `model` field, pass it as the Agent tool's `model` parameter; if the field is absent, do not set `model` (let Claude Code's default pick).** After the agent completes: `work-kit complete <phase>/<step> --outcome <outcome>`
|
|
207
|
+
- **`spawn_parallel_agents`**: Spawn all agents in the `agents` array in parallel using the Agent tool. **For each agent, pass its `model` field as the Agent tool's `model` parameter when present; omit when absent.** Wait for all to complete. Then spawn `thenSequential` if provided (same rule for its `model` field). After all complete: `work-kit complete <onComplete target>`
|
|
191
208
|
- **`wait_for_user`**: Report the message to the user and stop. Wait for them to say "proceed" before running `work-kit next` again.
|
|
192
209
|
- **`loopback`**: Report the loopback to the user, then run `work-kit next` to continue from the target.
|
|
193
210
|
- **`complete`**: Done — run wrap-up if not already done.
|
package/skills/full-kit/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: full-kit
|
|
3
3
|
description: "Full pipeline for feature development. Runs all phases and steps in order. Usage: /full-kit <description> to start, /full-kit to continue."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
argument-hint: "[--gated] [description]"
|
|
5
|
+
argument-hint: "[--gated] [--opus|--sonnet|--haiku|--inherit] [description]"
|
|
6
6
|
allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -33,15 +33,32 @@ Do not proceed until `doctor` reports all checks passed.
|
|
|
33
33
|
|
|
34
34
|
## Starting New Work (`/full-kit <description>`)
|
|
35
35
|
|
|
36
|
-
1.
|
|
36
|
+
1. Parse flags out of the user's input before building the init command:
|
|
37
|
+
- `--gated` → append `--gated` to init
|
|
38
|
+
- `--opus` → append `--model-policy opus`
|
|
39
|
+
- `--sonnet` → append `--model-policy sonnet`
|
|
40
|
+
- `--haiku` → append `--model-policy haiku`
|
|
41
|
+
- `--inherit` → append `--model-policy inherit` (no model override; lets Claude Code's default pick)
|
|
42
|
+
- No model flag → omit `--model-policy` (defaults to `auto` = work-kit step-level routing)
|
|
43
|
+
|
|
44
|
+
Strip any recognized flags from the description text before passing it through. Only one model flag may be set at a time — if the user passes more than one, report the conflict and stop.
|
|
45
|
+
|
|
46
|
+
2. Create a git worktree and initialize state:
|
|
37
47
|
```bash
|
|
38
48
|
git worktree add worktrees/<slug> -b feature/<slug>
|
|
39
49
|
cd worktrees/<slug>
|
|
40
|
-
work-kit init --mode full --description "<description>"
|
|
50
|
+
work-kit init --mode full --description "<description>" [--gated] [--model-policy <value>]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
```
|
|
55
|
+
/full-kit add user avatar → work-kit init --mode full --description "add user avatar"
|
|
56
|
+
/full-kit --opus add user avatar → work-kit init --mode full --description "add user avatar" --model-policy opus
|
|
57
|
+
/full-kit --gated --inherit fix login → work-kit init --mode full --description "fix login" --gated --model-policy inherit
|
|
41
58
|
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
|
|
60
|
+
3. Parse the JSON response and follow the action
|
|
61
|
+
4. Continue with the execution loop below
|
|
45
62
|
|
|
46
63
|
## Continuing Work (`/full-kit` with no args)
|
|
47
64
|
|
|
@@ -61,8 +78,8 @@ The CLI manages all state transitions, prerequisites, and loopbacks. Follow this
|
|
|
61
78
|
1. Run `work-kit next` to get the next action
|
|
62
79
|
2. Parse the JSON response
|
|
63
80
|
3. Follow the action type:
|
|
64
|
-
- **`spawn_agent`**: Use the Agent tool with the provided `agentPrompt`. Pass `skillFile` path for reference. After the agent completes: `work-kit complete <phase>/<step> --outcome <outcome>`
|
|
65
|
-
- **`spawn_parallel_agents`**: Spawn all agents in the `agents` array in parallel using the Agent tool. Wait for all to complete. Then spawn `thenSequential` if provided. After all complete: `work-kit complete <onComplete target>`
|
|
81
|
+
- **`spawn_agent`**: Use the Agent tool with the provided `agentPrompt`. Pass `skillFile` path for reference. **If the action includes a `model` field, pass it as the Agent tool's `model` parameter; if the field is absent, do not set `model` (let Claude Code's default pick).** After the agent completes: `work-kit complete <phase>/<step> --outcome <outcome>`
|
|
82
|
+
- **`spawn_parallel_agents`**: Spawn all agents in the `agents` array in parallel using the Agent tool. **For each agent, pass its `model` field as the Agent tool's `model` parameter when present; omit when absent.** Wait for all to complete. Then spawn `thenSequential` if provided (same rule for its `model` field). After all complete: `work-kit complete <onComplete target>`
|
|
66
83
|
- **`wait_for_user`**: Report the message to the user and stop. Wait for them to say "proceed" before running `work-kit next` again. (Only appears in `--gated` mode.)
|
|
67
84
|
- **`loopback`**: Report the loopback to the user, then run `work-kit next` to continue from the target.
|
|
68
85
|
- **`complete`**: Done — run wrap-up if not already done.
|
|
@@ -1,28 +1,64 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: resume-kit
|
|
3
|
-
description: "Resume a paused work-kit session and continue where it left off. Usage: /resume-kit"
|
|
3
|
+
description: "Resume a paused or abandoned work-kit session and continue where it left off. Usage: /resume-kit"
|
|
4
4
|
user-invocable: true
|
|
5
5
|
allowed-tools: Bash, Read, Agent, Write, Edit, Glob, Grep
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
You are resuming a
|
|
8
|
+
You are resuming a work-kit session. The user typically runs Claude Code from the **main repo root**, not from inside a worktree, so you must discover resumable sessions across all worktrees of the current repo and let the user pick one. Both `paused` and `in-progress` sessions are listed, since a crashed terminal leaves state as `in-progress`.
|
|
9
9
|
|
|
10
10
|
## Steps
|
|
11
11
|
|
|
12
|
-
1.
|
|
13
|
-
2. `cd` into the worktree path reported by bootstrap.
|
|
14
|
-
3. Run:
|
|
12
|
+
1. From the main repo root, run:
|
|
15
13
|
```bash
|
|
16
14
|
work-kit resume
|
|
17
15
|
```
|
|
18
|
-
|
|
16
|
+
This scans every worktree of the current git repo for `.work-kit/tracker.json` files in `paused` or `in-progress` state and returns one of:
|
|
17
|
+
|
|
18
|
+
- `action: "error"` — no resumable sessions in this repo. Tell the user and stop.
|
|
19
|
+
- `action: "select_session"` — one or more sessions found. The `sessions` array is sorted by most-recently-updated first and contains entries like:
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"slug": "item-count-badge",
|
|
23
|
+
"branch": "feat/item-count-badge",
|
|
24
|
+
"worktreeRoot": "/abs/path/to/worktree",
|
|
25
|
+
"status": "paused",
|
|
26
|
+
"pausedAt": "2026-04-06T18:42:11.000Z",
|
|
27
|
+
"currentPhase": "build",
|
|
28
|
+
"currentStep": "implement",
|
|
29
|
+
"lastUpdatedAgoMs": 7320000
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
- `action: "resumed"` — only happens if you passed `--worktree-root` directly (not the default flow).
|
|
33
|
+
|
|
34
|
+
2. **Show the list to the user.** Format it as a numbered list with: slug, status, current phase/step, **last updated time** (humanized from `lastUpdatedAgoMs`), and branch. The last-updated column is critical — it lets the user spot a session that was "closed by mistake" (high age + `in-progress` = likely a crashed terminal). Example:
|
|
35
|
+
```
|
|
36
|
+
Found 3 resumable sessions (most recent first):
|
|
37
|
+
1. fix-csv-export in-progress (test/e2e, updated 30s ago) ← still running elsewhere?
|
|
38
|
+
2. item-count-badge paused (build/implement, updated 2h ago) feat/item-count-badge
|
|
39
|
+
3. dark-mode-toggle in-progress (plan/clarify, updated 3d ago) ← likely abandoned
|
|
40
|
+
Which one do you want to resume? (number or slug)
|
|
41
|
+
```
|
|
42
|
+
When you see an `in-progress` session with a recent `lastUpdatedAgoMs` (< a few minutes), warn the user that another Claude instance may still be working on it. When you see one with a large age, hint that it was probably closed without pausing.
|
|
43
|
+
Wait for the user to reply.
|
|
44
|
+
|
|
45
|
+
3. Once the user picks one, resolve it to a slug and run:
|
|
46
|
+
```bash
|
|
47
|
+
work-kit resume --slug <slug>
|
|
48
|
+
```
|
|
49
|
+
The result will be `action: "resumed"` with `worktreeRoot`, `phase`, and `step` populated.
|
|
50
|
+
|
|
51
|
+
4. **`cd` into the returned `worktreeRoot`.** All subsequent commands must run from there, not from the main repo root.
|
|
52
|
+
|
|
19
53
|
5. Continue the orchestrator loop (same as `/full-kit` / `/auto-kit`):
|
|
20
54
|
```bash
|
|
21
55
|
work-kit next
|
|
22
56
|
```
|
|
23
|
-
Then follow the action returned (`spawn_agent`, `spawn_parallel_agents`, `wait_for_user`, etc.) using the Agent tool.
|
|
57
|
+
Then follow the action returned (`spawn_agent`, `spawn_parallel_agents`, `wait_for_user`, etc.) using the Agent tool. Keep looping `work-kit next` until you hit `wait_for_user`, `complete`, or `error`.
|
|
24
58
|
|
|
25
59
|
## Notes
|
|
26
60
|
|
|
27
|
-
- `resume` is
|
|
61
|
+
- `work-kit resume` (no args) is read-only — it just lists paused sessions, it doesn't flip any state. State changes only happen on `--slug`.
|
|
62
|
+
- `work-kit resume --slug <slug>` is idempotent: if the matched session is already in-progress, it returns `action: "resumed"` without re-writing the tracker.
|
|
28
63
|
- A paused session keeps all state — phases, steps, loopbacks, timing — exactly as they were.
|
|
64
|
+
- If the user invokes `/resume-kit <slug>` (passing a slug directly), skip the listing step and call `work-kit resume --slug <slug>` immediately.
|
|
@@ -12,6 +12,12 @@ Run `work-kit bootstrap` to detect work-kit state.
|
|
|
12
12
|
## If active work exists
|
|
13
13
|
|
|
14
14
|
- Report current state to the user: slug, phase, step, status
|
|
15
|
+
- **If `knowledge` is present in the bootstrap output**, surface it to the agent and the user:
|
|
16
|
+
- `knowledge.lessons` — project-specific learnings from prior sessions
|
|
17
|
+
- `knowledge.conventions` — codified rules this project follows
|
|
18
|
+
- `knowledge.risks` — fragile or dangerous areas to handle with care
|
|
19
|
+
- Read each of these silently into your working context — they're prior knowledge you should respect when planning and building. Briefly mention to the user that prior knowledge was loaded (one line; do not dump the full text into the chat).
|
|
20
|
+
- `workflow.md` is intentionally NOT loaded — it's a write-only artifact for human curators.
|
|
15
21
|
- If recovery is suggested: follow the recovery instruction
|
|
16
22
|
- Otherwise: run `work-kit next` to continue the workflow
|
|
17
23
|
|
package/skills/wk-build/SKILL.md
CHANGED
|
@@ -33,12 +33,13 @@ For each step:
|
|
|
33
33
|
|
|
34
34
|
## Recording
|
|
35
35
|
|
|
36
|
-
Throughout every step, capture
|
|
36
|
+
Throughout every step, capture these things in the shared state.md sections:
|
|
37
37
|
|
|
38
38
|
- **`## Decisions`** — Whenever you choose between real alternatives, append: `**<context>**: chose <X> over <Y> — <why>`. Skip obvious choices.
|
|
39
39
|
- **`## Deviations`** — Whenever you diverge from the Blueprint, append: `**<Blueprint step>**: <what changed> — <why>`. Every deviation needs a reason.
|
|
40
|
+
- **`## Observations`** — Whenever you notice a project convention, a fragile area, a learning, or feedback about the work-kit workflow itself, append a typed bullet: `- [lesson|convention|risk|workflow] text` (workflow tag may include `:phase/step`). At `wrap-up/knowledge` these are routed to `.work-kit-knowledge/` so future sessions benefit.
|
|
40
41
|
|
|
41
|
-
These feed into the final work-kit log summary. If you don't record them here, they're lost.
|
|
42
|
+
These feed into the final work-kit log summary and the project knowledge files. If you don't record them here, they're lost.
|
|
42
43
|
|
|
43
44
|
## Boundaries
|
|
44
45
|
|
|
@@ -30,6 +30,7 @@ For each step:
|
|
|
30
30
|
Update the shared state.md sections:
|
|
31
31
|
|
|
32
32
|
- **`## Decisions`** — Record merge method choice, any rollback decisions.
|
|
33
|
+
- **`## Observations`** — Whenever you notice deploy fragility, a missing convention, or feedback about the deploy phase itself, append: `- [lesson|convention|risk|workflow] text` (workflow tag may include `:phase/step`). At `wrap-up/knowledge` these are routed to `.work-kit-knowledge/` so future sessions benefit.
|
|
33
34
|
|
|
34
35
|
## This phase is optional
|
|
35
36
|
|
package/skills/wk-plan/SKILL.md
CHANGED
|
@@ -33,11 +33,12 @@ Maintain context across all steps — each builds on the previous. Reference pri
|
|
|
33
33
|
|
|
34
34
|
## Recording
|
|
35
35
|
|
|
36
|
-
Throughout every step, capture
|
|
36
|
+
Throughout every step, capture these things in the shared state.md sections:
|
|
37
37
|
|
|
38
38
|
- **`## Decisions`** — Whenever you choose between real alternatives, append: `**<context>**: chose <X> over <Y> — <why>`. Skip obvious choices.
|
|
39
|
+
- **`## Observations`** — Whenever you notice a project convention, a fragile area, a learning, or feedback about the work-kit workflow itself, append a typed bullet: `- [lesson|convention|risk|workflow] text` (workflow tag may include `:phase/step`). At `wrap-up/knowledge` these are routed to `.work-kit-knowledge/` so future sessions benefit.
|
|
39
40
|
|
|
40
|
-
These feed into the final work-kit log summary. If you don't record
|
|
41
|
+
These feed into the final work-kit log summary and the project knowledge files. If you don't record them here, they're lost.
|
|
41
42
|
|
|
42
43
|
## Loop-back
|
|
43
44
|
|
|
@@ -33,6 +33,7 @@ Throughout every step, update the shared state.md sections:
|
|
|
33
33
|
|
|
34
34
|
- **`## Decisions`** — If you make judgment calls during review (e.g., "accepted this deviation because..."), record them.
|
|
35
35
|
- **`## Deviations`** — Compliance step will audit these. If you fix a deviation during review, note that it was resolved.
|
|
36
|
+
- **`## Observations`** — Whenever you spot a fragile area, a missing convention, or feedback about the review phase itself, append: `- [lesson|convention|risk|workflow] text` (workflow tag may include `:phase/step`). At `wrap-up/knowledge` these are routed to `.work-kit-knowledge/` so future sessions benefit.
|
|
36
37
|
|
|
37
38
|
Review findings feed directly into the Handoff decision and the final work-kit log.
|
|
38
39
|
|
package/skills/wk-test/SKILL.md
CHANGED
|
@@ -31,6 +31,7 @@ Throughout every step, update the shared state.md sections:
|
|
|
31
31
|
|
|
32
32
|
- **`## Criteria`** — Check off criteria as they're verified. Add evidence inline: `- [x] <criterion> — verified by <test name / screenshot / manual check>`.
|
|
33
33
|
- **`## Decisions`** — If you discover a criterion is untestable or needs reinterpretation, record the decision and why.
|
|
34
|
+
- **`## Observations`** — Whenever you notice a fragile area, a missing test pattern, or feedback about the test phase itself, append: `- [lesson|convention|risk|workflow] text` (workflow tag may include `:phase/step`). At `wrap-up/knowledge` these are routed to `.work-kit-knowledge/` so future sessions benefit.
|
|
34
35
|
|
|
35
36
|
The criteria checklist is copied directly into the final work-kit log. Make it accurate.
|
|
36
37
|
|
|
@@ -9,13 +9,15 @@ description: "Test step: Test user flows end-to-end."
|
|
|
9
9
|
|
|
10
10
|
## Instructions
|
|
11
11
|
|
|
12
|
-
1.
|
|
13
|
-
2.
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
- Test
|
|
17
|
-
|
|
18
|
-
4.
|
|
12
|
+
1. **Verify Playwright is installed.** Run `npx playwright --version`. If it fails or `@playwright/test` is missing from `package.json`, STOP and tell the user to run `work-kit setup` (which installs Playwright + Chromium and scaffolds a config).
|
|
13
|
+
2. Review the UX Flow from the Plan phase.
|
|
14
|
+
3. For each user flow defined:
|
|
15
|
+
- Write a Playwright test under the project's configured `testDir` (see `playwright.config.*`).
|
|
16
|
+
- Test the happy path.
|
|
17
|
+
- Test key edge cases (empty state, error state, boundary values).
|
|
18
|
+
4. Run the tests with `npx playwright test`. All flows must pass before marking this step done.
|
|
19
|
+
5. Capture screenshots at key states using Playwright's `page.screenshot()` or the `--trace on` flag.
|
|
20
|
+
6. Focus on the most important flows — don't test every permutation.
|
|
19
21
|
|
|
20
22
|
## Output (append to state.md)
|
|
21
23
|
|
|
@@ -39,15 +41,16 @@ description: "Test step: Test user flows end-to-end."
|
|
|
39
41
|
|
|
40
42
|
## Rules
|
|
41
43
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
44
|
+
- Playwright is the required E2E framework. Manual verification does NOT satisfy this step.
|
|
45
|
+
- If Playwright is missing, halt and direct the user to `work-kit setup` — do not fall back to curl, manual steps, or another framework.
|
|
46
|
+
- Focus on user-visible behavior, not internal implementation.
|
|
47
|
+
- Screenshots are evidence — capture them for key states.
|
|
48
|
+
- If a flow fails, fix the implementation (not the test) unless the test expectation is wrong.
|
|
46
49
|
|
|
47
50
|
## Anti-Rationalization
|
|
48
51
|
|
|
49
52
|
| Excuse | Reality |
|
|
50
53
|
|--------|---------|
|
|
51
|
-
| "Manual verification counts as E2E testing" |
|
|
54
|
+
| "Manual verification counts as E2E testing" | It does not. The E2E step requires automated Playwright tests. If Playwright is unavailable, halt and ask the user to run `work-kit setup`. |
|
|
52
55
|
| "Unit tests already cover this flow" | Unit tests mock boundaries. E2E tests verify the real flow across boundaries — database, API, UI. A function can pass its unit test and still fail in the real pipeline. |
|
|
53
56
|
| "E2E tests are slow and fragile, not worth the effort" | Slow tests that catch real bugs are more valuable than fast tests that miss them. Write focused E2E tests for critical paths, not exhaustive ones for every edge case. |
|
|
@@ -10,15 +10,28 @@ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
|
|
|
10
10
|
**Role:** Work Historian
|
|
11
11
|
**Goal:** Produce a concise, useful summary of what was built and why — then clean up.
|
|
12
12
|
|
|
13
|
-
This phase has **
|
|
13
|
+
This phase has **two steps** (in order):
|
|
14
|
+
|
|
15
|
+
1. **`wrap-up/summary`** — distill state.md into a useful summary for future developers. See `.claude/skills/wk-wrap-up/steps/summary.md`.
|
|
16
|
+
2. **`wrap-up/knowledge`** — harvest learnings from this session into the project's `.work-kit-knowledge/` files so the next session benefits. See `.claude/skills/wk-wrap-up/steps/knowledge.md`.
|
|
17
|
+
|
|
18
|
+
The summary you write goes into `.work-kit/summary.md`; the CLI archives it into `.work-kit-tracker/archive/<slug>-<date>/` when you call `work-kit complete wrap-up/summary --outcome done`. After summary completes, the `knowledge` step runs `work-kit extract` and (optionally) one or more `work-kit learn` calls.
|
|
14
19
|
|
|
15
20
|
## Instructions
|
|
16
21
|
|
|
22
|
+
### Step 1: summary
|
|
17
23
|
1. **Read the full `.work-kit/state.md`** — every phase output from Plan through the last completed phase
|
|
18
24
|
2. **Synthesize the summary** — not a copy-paste of state, but a distilled record that a future developer (or agent) would find useful
|
|
19
25
|
3. **Write `.work-kit/summary.md`** in the format described in the step file
|
|
20
26
|
4. **Run** `work-kit complete wrap-up/summary --outcome done`
|
|
21
|
-
|
|
27
|
+
|
|
28
|
+
### Step 2: knowledge
|
|
29
|
+
5. **Run `work-kit extract`** — routes typed `## Observations` bullets and tracker loopbacks/skipped/failed steps into `.work-kit-knowledge/` files. `## Decisions` and `## Deviations` are not auto-harvested (they're scratch space).
|
|
30
|
+
6. **Review the summary you just wrote** for subjective additions the parser would miss. For each, call `work-kit learn --type <lesson|convention|risk|workflow> --text "..."`.
|
|
31
|
+
7. **Run** `work-kit complete wrap-up/knowledge --outcome done`
|
|
32
|
+
|
|
33
|
+
### Cleanup
|
|
34
|
+
8. **Ask the user** if they want the worktree and branch removed
|
|
22
35
|
|
|
23
36
|
## Summary File Format
|
|
24
37
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Step: Knowledge
|
|
2
|
+
|
|
3
|
+
**Phase:** Wrap-up
|
|
4
|
+
**Role:** Knowledge Harvester
|
|
5
|
+
**Goal:** Route this session's learnings into the project's `.work-kit-knowledge/` files so the next session — and the next developer — starts smarter.
|
|
6
|
+
|
|
7
|
+
## When this step runs
|
|
8
|
+
|
|
9
|
+
After `wrap-up/summary`. By now you've just re-read the full `state.md` and distilled it into a summary, so your working memory of this session is at its peak. This is the right moment to capture observations the parser would miss.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. **Run mechanical extraction:**
|
|
14
|
+
```bash
|
|
15
|
+
work-kit extract
|
|
16
|
+
```
|
|
17
|
+
This parses `.work-kit/state.md` and `.work-kit/tracker.json` and routes entries to `.work-kit-knowledge/{lessons,conventions,risks,workflow}.md`. It pulls from:
|
|
18
|
+
- `## Observations` typed bullets (`- [lesson|convention|risk|workflow] text`) — the only section that is auto-harvested
|
|
19
|
+
- `tracker.json.loopbacks[]` → workflow feedback
|
|
20
|
+
- Skipped/failed steps → workflow feedback
|
|
21
|
+
|
|
22
|
+
`## Decisions` and `## Deviations` are **not** auto-harvested — they're agent scratch space and routinely contain test plans and review notes. If something in there is worth preserving, restate it as a typed bullet under `## Observations` (or call `work-kit learn` directly in step 2).
|
|
23
|
+
|
|
24
|
+
The output JSON tells you how many entries were `written` vs `duplicates`. Re-running is idempotent.
|
|
25
|
+
|
|
26
|
+
2. **Read your `.work-kit/summary.md`** (the one you just wrote). For each non-obvious thing in it that the parser would NOT have captured automatically, call `work-kit learn`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
work-kit learn --type lesson --text "Discovered that the test fixtures must be reset between Playwright suites, otherwise auth state leaks."
|
|
30
|
+
work-kit learn --type risk --text "src/payment/webhook.ts has no integration test coverage for retries."
|
|
31
|
+
work-kit learn --type convention --text "All new API endpoints must register a Zod schema in src/schemas/."
|
|
32
|
+
work-kit learn --type workflow --text "The wk-test/e2e step doesn't tell agents to start the dev server before running Playwright."
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Each call appends one entry to the appropriate `.md` file under a lockfile, with secret redaction applied automatically.
|
|
36
|
+
|
|
37
|
+
3. **Mark the step complete:**
|
|
38
|
+
```bash
|
|
39
|
+
work-kit complete wrap-up/knowledge --outcome done
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## What goes where
|
|
43
|
+
|
|
44
|
+
| Type | File | What belongs here |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `lesson` | lessons.md | Project-specific learnings — facts about *this* codebase. |
|
|
47
|
+
| `convention` | conventions.md | Codified rules this project follows. Future sessions should respect these. |
|
|
48
|
+
| `risk` | risks.md | Fragile or dangerous areas. Touch with care. |
|
|
49
|
+
| `workflow` | workflow.md | Feedback about the work-kit kit itself — skill quality, step skips, loopbacks, failure modes. **Mined manually across projects to improve work-kit upstream.** |
|
|
50
|
+
|
|
51
|
+
## Boundaries
|
|
52
|
+
|
|
53
|
+
### Always
|
|
54
|
+
- Run `work-kit extract` first, then add manual `learn` calls.
|
|
55
|
+
- Keep `learn --text` entries to one sentence — they're for humans skimming a list.
|
|
56
|
+
- Use `workflow` type only for feedback about the work-kit *itself*, not for project facts.
|
|
57
|
+
|
|
58
|
+
### Never
|
|
59
|
+
- Edit the `## Manual` section of any knowledge file. That's human-curated and tooling never touches it.
|
|
60
|
+
- Use `workflow.md` for project-specific facts. Use `lessons.md` instead.
|
|
61
|
+
- Paste large code blocks, file contents, or stack traces into `--text`. Distill into one sentence.
|
|
62
|
+
- Skip extraction. Even if you have nothing to add manually, `work-kit extract` still routes loopbacks and deviations.
|
|
63
|
+
|
|
64
|
+
### Failure mode
|
|
65
|
+
- Non-fatal. If extract or learn fails, the summary step has already succeeded — the session isn't lost. Report the error to the user; they can retry manually or run `work-kit complete wrap-up/knowledge --outcome done` anyway.
|
|
66
|
+
|
|
67
|
+
## Output
|
|
68
|
+
|
|
69
|
+
No file output for this step — entries land in `.work-kit-knowledge/*.md`. Optionally append a one-line note to `.work-kit/state.md` describing what you captured, e.g.:
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
### Wrap-up: Knowledge
|
|
73
|
+
|
|
74
|
+
**Extracted:** 4 entries (2 conventions, 1 risk, 1 workflow)
|
|
75
|
+
**Manual additions:** 2 lessons, 1 workflow feedback
|
|
76
|
+
```
|