@phuthuycoding/kanban-flow 0.3.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/LICENSE +21 -0
- package/README.md +173 -0
- package/dist/cli/args.js +219 -0
- package/dist/cli/commands/approve.js +44 -0
- package/dist/cli/commands/archive.js +245 -0
- package/dist/cli/commands/artifacts.js +100 -0
- package/dist/cli/commands/autoconfig.js +180 -0
- package/dist/cli/commands/cancel.js +129 -0
- package/dist/cli/commands/contexts.js +101 -0
- package/dist/cli/commands/doctor.js +35 -0
- package/dist/cli/commands/harness.js +60 -0
- package/dist/cli/commands/helpers.js +22 -0
- package/dist/cli/commands/init.js +119 -0
- package/dist/cli/commands/inspect.js +141 -0
- package/dist/cli/commands/new.js +80 -0
- package/dist/cli/commands/rules.js +69 -0
- package/dist/cli/commands/run.js +156 -0
- package/dist/cli/commands/stage.js +186 -0
- package/dist/cli/result.js +1 -0
- package/dist/dashboard/dashboard-view.js +238 -0
- package/dist/dashboard/dashboard.js +206 -0
- package/dist/harness/chain.js +41 -0
- package/dist/harness/config.js +168 -0
- package/dist/harness/prompt.js +105 -0
- package/dist/harness/run.js +245 -0
- package/dist/harness/session.js +78 -0
- package/dist/harness/supervise.js +65 -0
- package/dist/index.js +123 -0
- package/dist/integrations/agents.js +67 -0
- package/dist/integrations/hooks.js +59 -0
- package/dist/integrations/install.js +193 -0
- package/dist/project/bootstrap.js +358 -0
- package/dist/project/config.js +111 -0
- package/dist/project/contexts.js +98 -0
- package/dist/project/doctor.js +163 -0
- package/dist/shared/frontmatter.js +54 -0
- package/dist/shared/paths.js +78 -0
- package/dist/shared/time.js +5 -0
- package/dist/workflow/direction.js +56 -0
- package/dist/workflow/features.js +198 -0
- package/dist/workflow/findings.js +3 -0
- package/dist/workflow/schema.js +148 -0
- package/dist/workflow/secrets.js +52 -0
- package/dist/workflow/status.js +188 -0
- package/dist/workflow/validate-approval.js +25 -0
- package/dist/workflow/validate-artifacts.js +89 -0
- package/dist/workflow/validate-cancel.js +14 -0
- package/dist/workflow/validate-reports.js +121 -0
- package/dist/workflow/validate-traceability.js +91 -0
- package/dist/workflow/validate.js +73 -0
- package/docs/workflow/README.md +67 -0
- package/docs/workflow/artifacts.md +60 -0
- package/docs/workflow/cli-reference.md +78 -0
- package/docs/workflow/dashboard.md +35 -0
- package/docs/workflow/gates.md +103 -0
- package/docs/workflow/harness.md +144 -0
- package/docs/workflow/lifecycle.md +107 -0
- package/docs/workflow/skills.md +52 -0
- package/docs/workflow/source-layout.md +47 -0
- package/docs/workflow/state-machine.md +83 -0
- package/kanban-flow/review/rules/README.md +30 -0
- package/kanban-flow/review/rules/general.md +41 -0
- package/kanban-flow/review/rules/performance.md +29 -0
- package/kanban-flow/review/rules/security.md +32 -0
- package/kanban-flow/review/stacks/go.md +33 -0
- package/kanban-flow/review/stacks/java.md +38 -0
- package/kanban-flow/review/stacks/node.md +28 -0
- package/kanban-flow/review/stacks/php.md +30 -0
- package/kanban-flow/review/stacks/python.md +34 -0
- package/kanban-flow/review/stacks/ruby.md +32 -0
- package/kanban-flow/review/stacks/rust.md +33 -0
- package/kanban-flow/templates/phase-1-bug-report.md +76 -0
- package/kanban-flow/templates/phase-1-spec-requirement.md +67 -0
- package/kanban-flow/templates/phase-2-implementation-plan.md +85 -0
- package/kanban-flow/templates/phase-2-test-case.md +68 -0
- package/kanban-flow/templates/phase-2-use-case-diagram.md +18 -0
- package/kanban-flow/templates/phase-2-use-case-specification.md +33 -0
- package/kanban-flow/templates/phase-2-use-case.md +60 -0
- package/kanban-flow/templates/phase-4-testing-result.md +63 -0
- package/kanban-flow/templates/phase-5-review-report.md +68 -0
- package/kanban-flow/templates/phase-6-feature-report.md +78 -0
- package/package.json +63 -0
- package/skills/kanban-archive/SKILL.md +78 -0
- package/skills/kanban-brainstorm/SKILL.md +310 -0
- package/skills/kanban-bug/SKILL.md +55 -0
- package/skills/kanban-flow/SKILL.md +136 -0
- package/skills/kanban-implement/SKILL.md +72 -0
- package/skills/kanban-plan/SKILL.md +102 -0
- package/skills/kanban-review/SKILL.md +90 -0
- package/skills/kanban-test/SKILL.md +76 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kanban-flow
|
|
3
|
+
description: Drive a kanban feature or bug through brainstorm, planning approval, start-or-backlog decision, implementation, testing, review and archive using the kf CLI. Use when the user requests the kanban workflow or resumes a work item managed in .works. Delegates each phase to its dedicated skill.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kanban Flow — Orchestrator
|
|
7
|
+
|
|
8
|
+
**The user describes the idea; the agent decides the rest.** One command runs the whole lifecycle; each phase runs a dedicated skill.
|
|
9
|
+
|
|
10
|
+
**ARGUMENTS:** `<context> <feature_name>` — e.g. `kanban auth user-login` or `kanban billing payment-timeout --type bug`
|
|
11
|
+
|
|
12
|
+
State is enforced by the `kf` CLI: artifact gates, approval fingerprints, execution ids, report statuses and traceability. The agent authors and verifies the content; file presence alone cannot prove that code was tested.
|
|
13
|
+
|
|
14
|
+
**Human boundary:** user participates in **Phase 1 (brainstorm/bug triage)**, **Phase 2 (approval)** and the explicit **start-now vs backlog** decision. After the user chooses start, run everything autonomously within the approved scope. Stop and ask only for a decision on backlog start, REQUIREMENT_BUG or a scope change; do not ask "continue?" between normal phases.
|
|
15
|
+
|
|
16
|
+
**Preflight:** if the project has no `.works/`, run `kf init --defaults` first (full bootstrap without prompts; use `kf init -i` when the user should answer the setup questions). Detect project stack/tooling by READING the repository — never assume.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Phase model & artifact contract
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
brainstorm → planning → implementation → testing → review → dones
|
|
24
|
+
↘ backlog ↗
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Folder name: `{feature_name}_{timestamp}` (created by `kf new`). Artifacts follow `phase-{x}-{name}.md`.
|
|
28
|
+
|
|
29
|
+
| Phase | Skill | Gate artifacts (filled to LEAVE) | Notes |
|
|
30
|
+
|-------|-------|----------------------------------|-------|
|
|
31
|
+
| 1. Brainstorm / Bug triage | `kanban-brainstorm` or `kanban-bug` | `phase-1-spec-requirement.md` (`status: confirmed`) | Human + agent refine requirement or reproduce bug |
|
|
32
|
+
| 2. Planning | `kanban-plan` | Feature: four phase-2 files + `use-cases/UC-###.md`; bug: confirmed bug report | **Human approval, then start/backlog decision** |
|
|
33
|
+
| Backlog | — | Approved planning contract remains intact | Waiting for explicit user decision to start |
|
|
34
|
+
| 3. Implement | `kanban-implement` | — (tasks.md tracks) | Autonomous |
|
|
35
|
+
| 4. Testing | `kanban-test` | `phase-4-testing-result.md` (`status: PASS`) | FAIL/REJECT → loop to implementation |
|
|
36
|
+
| 5. Review | `kanban-review` | `phase-5-review-report.md` (`status: PASS`) | FAIL/REJECT → loop; REQUIREMENT_BUG → STOP |
|
|
37
|
+
| 6. Closure | `kanban-archive` | Feature: `phase-6-feature-report.md`; bug: current test/review evidence | Feature canonical docs or affected bug docs, then archive |
|
|
38
|
+
|
|
39
|
+
**Two gate layers on every move:**
|
|
40
|
+
1. **Artifact gate** — files exist and contain no template placeholders.
|
|
41
|
+
2. **Directional gate** — report `status` semantics: FAIL/REJECT blocks forward motion and forces a loop back to implementation; REQUIREMENT_BUG blocks **all** motion (STOP FEATURE — never silently rewrite the requirement).
|
|
42
|
+
|
|
43
|
+
For features, `kf validate` checks each `## TC-###` for FR references and matching individual UC files. Approval fingerprints the requirement, four planning artifacts and individual UC files. For bugs, approval fingerprints only the bug report; feature planning artifacts and feature report are not required. A changed contract must return to planning for human approval. Each entry to testing creates a new execution id; testing and review reports must carry that id in `execution:`. Read templates with `kf instruct <artifact> --change <feature>` to obtain the current id and exact output path.
|
|
44
|
+
|
|
45
|
+
Feature canonical docs are synced by the CLI on archive:
|
|
46
|
+
- Requirement: `docs/requirement/{context}/{feature_name}.md`
|
|
47
|
+
- Use cases: `docs/use-cases/{context}/{feature_name}/README.md`, one `UC-###.md` per use case and `diagram.md`
|
|
48
|
+
- Test plan/result: `docs/testplan/{context}/{feature_name}.md` and `{feature_name}-result.md`
|
|
49
|
+
|
|
50
|
+
Work item type is stored in `.kfw.json` as `kind: feature|bug`. Create a bug with `kf new <name> --type bug`; route it to `kanban-bug` for reproduction and triage before planning.
|
|
51
|
+
|
|
52
|
+
Bug closure updates the existing related feature docs only if needed. Do not auto-create feature docs for a bug or overwrite a feature requirement with bug-report content.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## How to delegate phases
|
|
57
|
+
|
|
58
|
+
The pipeline is ONE run but each phase has a specialist skill. Drive it like this:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
kf status --all # which phase is each feature in?
|
|
62
|
+
kf status --change {feature} # current phase + artifact checklist + Next: + Approval
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then **load the skill for the feature's CURRENT phase** and follow it to its endpoint (each skill ends pointing at the next one). Do not re-read old phase instructions you've already executed; go straight at the target.
|
|
66
|
+
|
|
67
|
+
If planning is already approved and its fingerprint is unchanged, ask whether to start now or keep the item in backlog. If an item is in backlog, do not start implementation without an explicit user decision. If review has a current PASS report, hand off to kanban-archive. If already in dones, validate and finish only missing closure work; never implement again. Resume existing artifacts and tasks instead of recreating the item or approved plan. `kf status --all` includes backlog and dones.
|
|
68
|
+
|
|
69
|
+
## Multi-agent harness
|
|
70
|
+
|
|
71
|
+
If `.kf/config.json` has `harness.stages`, some stages are assigned to **roles** (writer, coder, tester…), each backed by a runner CLI. Before doing a stage's work yourself, read `kf status --change {feature} --json`: when `assignedRoles` is non-empty, you are the orchestrator for that stage — do not do the work, hand it off:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
kf run {feature} # blocking; runs the stage's whole role chain in order
|
|
75
|
+
kf run {feature} --detach # long stages (implementation): returns a chain id
|
|
76
|
+
kf runs {feature} # poll until the runs are done, then read their STATUS
|
|
77
|
+
kf run {feature} --role writer # re-run one role of the chain
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
A stage can list several roles (`brainstorm: ["researcher", "writer"]`); they run one after another and each gets told where the previous one wrote. If a role does not finish `DONE`/`DONE_WITH_CONCERNS`, the chain stops there and the later roles never run — read the log of the role that stopped, do not simply re-run the chain.
|
|
81
|
+
|
|
82
|
+
When polling a detached chain, check the chain column in `kf runs` (`1/2`, `2/2`): a run marked `chain stopped 1/2` means the later roles never ran, so the stage is **not** done even though nothing is running. Treat it like a stopped chain: read that role's log before deciding.
|
|
83
|
+
|
|
84
|
+
Then act on the worker's `STATUS:`: `DONE` → `kf validate --change {feature}` and decide the transition as usual (gates, not the worker's word, decide); `DONE_WITH_CONCERNS` → read the concerns in the run log, then decide; `BLOCKED` / `NEEDS_CONTEXT` → stop and ask the user. A run without a `STATUS:` line or with a non-zero exit is not done. Never do an assigned stage yourself unless the user says so. Human gates stay with you.
|
|
85
|
+
|
|
86
|
+
If you are resuming mid-pipeline (the feature already exists), skip straight to the phase skill for its current phase. **Never trust a folder location alone — a stage folder is not "done"; artifact + report completeness is.**
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Interaction policy
|
|
91
|
+
|
|
92
|
+
- User gives ONE command. Agent does everything else automatically.
|
|
93
|
+
- Brainstorm asks about **material ambiguity** only (missing scope, unclear behavior, conflicting acceptance criteria). Minor details → reasonable assumption + record it in the spec.
|
|
94
|
+
- Confirm the requirement in Phase 1, then obtain execution-contract approval in Phase 2. Present a tight summary + implementation plan and ask for approval. On approval run `kf approve`. Without approval, do not start autonomous execution.
|
|
95
|
+
- If scope must change after approval, stop implementation and explain the change. On the user's direction run `kf stage <feature> planning`, revise the contract and obtain fresh approval. REQUIREMENT_BUG blocks this route too; report it and await a human decision.
|
|
96
|
+
- Auto-fix benign blockers once. Stop + ask only when genuinely stuck.
|
|
97
|
+
- Never bypass a failed gate with `--force` unless the user explicitly approves.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## CLI reference
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
kf init # scaffold .works/ + hooks + docs
|
|
105
|
+
kf doctor [--json] # diagnose the project (stage dirs, config, metadata, skills); exit 1 when broken
|
|
106
|
+
kf contexts [--json] # declared contexts + counts, or a survey brief when none
|
|
107
|
+
kf new {feature} --context {ctx} [--type feature|bug] # Phase 1: create feature/bug + seed spec
|
|
108
|
+
kf status --change {feature} # artefact checklist + Next: + approval state
|
|
109
|
+
kf instruct {artifact} --change {feature} # current execution id + exact output path
|
|
110
|
+
kf approve {feature} # Phase 2 HITL gate
|
|
111
|
+
kf validate --change {feature} # gate + traceability issues
|
|
112
|
+
kf stage {feature} {phase} # move (gates + hooks run; planning → backlog/implementation)
|
|
113
|
+
kf run {feature} [--detach] # run the roles assigned to the current stage (harness.stages), in order
|
|
114
|
+
kf runs {feature} # worker run history (role, runner) + STATUS lines
|
|
115
|
+
kf archive {feature} # review(PASS) → dones + copy canonical docs
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Contexts: a project may declare the ones it uses in `.kf/config.json`, and the first entry is the default. `kf new` refuses a context outside that list and names the nearest declared one; a case-only variant is refused too. Run `kf contexts --json` before `kf new` and use a declared name exactly. When `restricted` is false nothing is declared and any valid name works. Never add a context to the config to get past a refusal — naming a business domain is the human's call.
|
|
119
|
+
|
|
120
|
+
Phase hooks: `<project>/.kf/hooks/{phase}.sh` run automatically before entering a phase (project → user `~/.kf/hooks` → package precedence). Exit non-zero blocks the transition (`--skip-hooks` bypasses). The agent does NOT run hooks manually — `kf stage` does.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Hard rules
|
|
125
|
+
|
|
126
|
+
- Do NOT ask "continue to next step?" — autonomous after the user chooses start at the Phase 2 decision gate.
|
|
127
|
+
- Obtain requirement confirmation and planning approval; after approval continue within the approved scope.
|
|
128
|
+
- After planning approval, explicitly ask whether to start implementation now or move to backlog. Never infer this choice.
|
|
129
|
+
- Never `mv` feature folders manually — always `kf stage` / `kf archive`.
|
|
130
|
+
- Never bypass a failed gate with `--force` unless the user explicitly approves. Every real bypass (`--force` on a failing gate, `--skip-hooks` on an existing hook) is recorded in `.kfw.json` and reported by `kf status`/`kf validate`.
|
|
131
|
+
- Always write `phase-4-testing-result.md` and `phase-5-review-report.md` — gates enforce it.
|
|
132
|
+
- FAIL/REJECT loops back to implementation and re-testing before review. REQUIREMENT_BUG → STOP, never rewrite the requirement. When the item should be dropped for good (requirement wrong at the root, work superseded, user says stop), **propose** `kf cancel {feature} --reason "<why>"` and let the user decide; never cancel on your own. Reopening later is `kf stage {feature} <the stage it was cancelled from>`.
|
|
133
|
+
- No scope creep beyond the approved plan.
|
|
134
|
+
- Follow the project's AGENTS.md and the user's permissions. Autonomous execution does not authorize unrelated changes, database operations, deployment or messages to others.
|
|
135
|
+
- Never silently swallow errors. If a step can't complete and can't be auto-fixed, STOP and report.
|
|
136
|
+
- The user's single command IS authorization for the full pipeline — up to the Phase 2 approval gate.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kanban-implement
|
|
3
|
+
description: 'Implement an approved kanban feature or bug, track tasks and verify the build. Use in implementation, or after an explicit start decision from planning/backlog or a FAIL/REJECT repair loop.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kanban Phase 3 — Implement (Autonomous)
|
|
7
|
+
|
|
8
|
+
Argument: `<feature_name>`.
|
|
9
|
+
|
|
10
|
+
Execute the approved implementation plan for a feature, or the approved bug report's fix scope and regression strategy for a bug. If implementation requires a scope change, explain it and obtain the user's decision before revising the contract.
|
|
11
|
+
|
|
12
|
+
**Invoked through `kf run`?** If your prompt starts with `kf-run:`, you are a worker for this stage only: skip the "move to stage" step below, never run `kf stage` / `kf approve` / `kf archive` / `kf run`, never edit approved contract artifacts, do not commit, and end your final message with two lines exactly: `STATUS: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT` and `Summary: <one or two sentences>`. The main agent reads them and decides the transition.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Move to implementation
|
|
17
|
+
|
|
18
|
+
Read `kf status --change {feature_name}`. Move only when coming from planning or backlog with a valid approval, or when a FAIL/REJECT report requires a loop. If already in implementation, skip the move and resume existing tasks. If approval changed, stop and return to planning on the user's direction. Entering implementation from backlog requires the user's explicit start decision.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
kf stage {feature_name} implementation
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Create tasks.md if missing: `- [ ] 1. ...` checkboxes mapping tasks to the approved test cases for a feature, or reproduction/acceptance/regression scope in the bug report for a bug. Preserve completed tasks on resume; add the required fix tasks when looping. Record the starting HEAD and pre-existing working-tree changes in a `## Baseline` section at the top of `tasks.md` so review can distinguish this work item's changes.
|
|
25
|
+
|
|
26
|
+
## 2. Work by dependency order
|
|
27
|
+
|
|
28
|
+
- Independent tasks → **parallelize via subagents**.
|
|
29
|
+
- Sequential / dependent tasks → main agent.
|
|
30
|
+
|
|
31
|
+
**Subagent prompt contract** — every subagent prompt must state:
|
|
32
|
+
|
|
33
|
+
- Task: the exact task + the TC it must satisfy
|
|
34
|
+
- Files to read: plan excerpt, reference files, repo conventions
|
|
35
|
+
- Files it may modify: explicit allowlist — nothing else
|
|
36
|
+
- Acceptance criteria: what "done" means, verifiable
|
|
37
|
+
- Constraints: no contract changes, no unrelated edits
|
|
38
|
+
- Context: `.works/implementation/{feature}/` path (and reports path when applicable)
|
|
39
|
+
|
|
40
|
+
**Subagent status protocol** — require every subagent to end with:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
|
|
44
|
+
Summary: one or two sentences
|
|
45
|
+
Concerns/Blockers: (optional)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Treat `DONE_WITH_CONCERNS` and `BLOCKED` as not-done: resolve the concern or unblock before ticking the task.
|
|
49
|
+
|
|
50
|
+
## 3. Tick tasks as they land; gate on build
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
{build_command}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- PASS → continue.
|
|
57
|
+
- FAIL → analyze, fix, re-run.
|
|
58
|
+
- Failed again → STOP, show error, ask.
|
|
59
|
+
|
|
60
|
+
When all tasks ticked, run the FULL build (not just the touched module).
|
|
61
|
+
|
|
62
|
+
Do not modify the approved requirement, plan or test-case contract. Project-specific permissions for database operations and other external actions still apply.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Done
|
|
67
|
+
|
|
68
|
+
All tasks done, build green, no test regressions. Hand off:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
Load the kanban-test skill and move the feature to testing.
|
|
72
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kanban-plan
|
|
3
|
+
description: 'Plan and obtain human approval for a kanban feature contract or lightweight bug triage contract, then ask whether to start or defer to backlog. Use when a work item is in planning.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kanban Phase 2 — Planning → Execution Contract (Human + Agent)
|
|
7
|
+
|
|
8
|
+
Argument: `<feature_name>`.
|
|
9
|
+
|
|
10
|
+
Phase 2 turns the confirmed requirement into a **binding execution contract** that the human approves. Everything written here is law for the rest of the pipeline — no silent scope creep afterwards.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Verify stage
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
kf status --change {feature_name} # must show stage = planning
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If approval is already valid, keep the contract unchanged and go to the start/backlog decision in section 4. If the approval is changed or pending, finish the applicable contract and obtain fresh human approval.
|
|
21
|
+
|
|
22
|
+
Read work item kind from `kf status --change {feature_name} --json`. For `kind: bug`, use the confirmed bug report as the contract: reproduction, expected fix, scope, regression strategy and docs impact. Skip section 2; present this concise contract, run approval in section 3 and ask start/backlog in section 4. Do not create feature planning artifacts for a bug. If the request introduces behavior beyond correcting the defect, explain the scope change and follow the user's decision before creating a related feature.
|
|
23
|
+
|
|
24
|
+
## 2. Write the four plan artifacts (in order)
|
|
25
|
+
|
|
26
|
+
Read the confirmed Test Strategy from `phase-1-spec-requirement.md` (`Level` in a feature spec, `Test Level` in a bug report, plus `UI Tests`, `Tools`, `Coverage Target`) — it was agreed with the human in Phase 1. Everything below must honour it.
|
|
27
|
+
|
|
28
|
+
Print each template and fill the file at its path:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
kf instruct implementation-plan --change {feature_name}
|
|
32
|
+
kf instruct use-case-specification --change {feature_name}
|
|
33
|
+
kf instruct use-case-diagram --change {feature_name}
|
|
34
|
+
kf instruct test-cases --change {feature_name}
|
|
35
|
+
kf instruct use-case --change {feature_name} --id UC-001
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### implementation-plan
|
|
39
|
+
- Scope: now / supporting / future / not-in-scope
|
|
40
|
+
- `TASK-###` breakdown, complexity, impact analysis (backend / frontend / DB / API / infra / security / performance / regression / deps)
|
|
41
|
+
- Testing strategy incl. **coverage target from the spec's Test Strategy (default >= 80%)** and Definition of Done
|
|
42
|
+
- When Test Level is `full`: name the UI/E2E framework you will use (Playwright, Cypress and so on) and say which suite covers the critical flows and which covers everything.
|
|
43
|
+
|
|
44
|
+
### use-case-specification
|
|
45
|
+
- Use `phase-2-use-case-specification.md` only as an index and coverage summary.
|
|
46
|
+
- Write **one file per use case** under `use-cases/UC-###.md`, using `kf instruct use-case --id UC-###`.
|
|
47
|
+
- Each file contains one `UC-###`: goal, actors, preconditions, trigger, main / alternative / exception flows, postconditions, business rules, data and acceptance criteria.
|
|
48
|
+
- The file name and declared ID must match exactly. Do not put multiple UC narratives in one file.
|
|
49
|
+
|
|
50
|
+
### use-case-diagram
|
|
51
|
+
- Mermaid `graph TD` / `flowchart`: actors → use cases (one box per UC-###)
|
|
52
|
+
|
|
53
|
+
### test-cases
|
|
54
|
+
- **Generate test cases from the spec's Test Level (unit | unit+integration | full):**
|
|
55
|
+
- `unit` → `Unit` cases only, one per acceptance criterion and per edge case, each tied to an FR and a UC.
|
|
56
|
+
- `unit+integration` → add `Integration` cases wherever the change meets another system, the database or an API.
|
|
57
|
+
- `full` → add **`UI / E2E`** cases for the user-facing flows: what is clicked, what is typed, what appears on screen, following the `UI Tests` scope (critical or all). Add the matching `## TC-###` sections from the detailed template, with references that match that scope.
|
|
58
|
+
- Keep the plan table-driven: fill overall totals, per-type counts, use-case coverage matrix and requirement coverage matrix before the detailed `## TC-###` tables.
|
|
59
|
+
- Define each test in a `## TC-###` section referencing `FR-###` (spec) and `UC-###` (the matching individual use-case file). `kf validate` blocks missing or unknown references before approval.
|
|
60
|
+
- If the user wants to change the test level during Phase 2, which is rare: update the Test Strategy in `phase-1-spec-requirement.md` before generating the cases, and say so when you present the contract for approval.
|
|
61
|
+
|
|
62
|
+
## 3. Human approval gate
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
kf validate --change {feature_name}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Before approval, `approval_required` is expected; `approval_changed` is expected when revising an old contract. Fix all other errors and assess warnings before presenting the contract. `kf approve` validates the artifacts without requiring an existing approval. Present a tight summary to the user:
|
|
69
|
+
|
|
70
|
+
- what the feature does (2-3 lines)
|
|
71
|
+
- implementation plan headlines (tasks, approach, risks)
|
|
72
|
+
- test strategy + coverage target *(as agreed in the spec's Test Strategy: unit / unit+integration / full + UI scope)*
|
|
73
|
+
- Definition of Done
|
|
74
|
+
|
|
75
|
+
Ask once: **"approve?"** On approval:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
kf approve {feature_name}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`kf approve` fingerprints the requirement, four planning artifacts and all individual UC files for a feature; for a bug it fingerprints only the bug report. `kf stage` requires the approved contents to remain unchanged. Progress and test outcomes belong in tasks.md and the testing report; do not rewrite the approved contract during execution.
|
|
82
|
+
|
|
83
|
+
## 4. Start/backlog decision gate
|
|
84
|
+
|
|
85
|
+
Approval means the contract is valid; it does not mean implementation must start immediately. Ask the user once:
|
|
86
|
+
|
|
87
|
+
**"The plan is ready. Start implementation now, or put it in the backlog?"**
|
|
88
|
+
|
|
89
|
+
- Start now → `kf stage {feature_name} implementation`
|
|
90
|
+
- Defer → `kf stage {feature_name} backlog`
|
|
91
|
+
|
|
92
|
+
Do not choose on the user's behalf. A deferred item keeps its approved contract in `backlog` and can resume to implementation later after the user chooses to start.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Done
|
|
97
|
+
|
|
98
|
+
Approval and the start/defer decision are recorded. Hand off:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
If the user chose start, load kanban-implement and move the feature to implementation. If the user chose defer, leave it in backlog and resume only after an explicit start decision.
|
|
102
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kanban-review
|
|
3
|
+
description: 'Review a kanban feature or bug against its approved scope, current testing evidence and layered review rules. Write PASS/FAIL/REJECT/REQUIREMENT_BUG for the current execution. Use in review.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kanban Phase 5 — Review (Autonomous)
|
|
7
|
+
|
|
8
|
+
Argument: `<feature_name>`.
|
|
9
|
+
|
|
10
|
+
Stand on quality, not survivor. Load layered review rules, audit the changes, and write a report whose `status:` is the truth `kf` trusts.
|
|
11
|
+
|
|
12
|
+
**Invoked through `kf run`?** If your prompt starts with `kf-run:`, you are a worker for this stage only: skip the "move to stage" step below, never run `kf stage` / `kf approve` / `kf archive` / `kf run`, never edit approved contract artifacts, do not commit, and end your final message with two lines exactly: `STATUS: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT` and `Summary: <one or two sentences>`. The main agent reads them and decides the transition.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Move to review
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
kf stage {feature_name} review
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
(Already there → skip. If the move is refused, run `kf validate --change {feature_name}` — a missing/stale or non-PASS testing report blocks this direction; loop back through kanban-test.)
|
|
23
|
+
|
|
24
|
+
## 2. Load review rules
|
|
25
|
+
|
|
26
|
+
- Resolve rules per filename in project → user → package order. Include general, security and performance plus the project's stack rule when available.
|
|
27
|
+
- Project: `{project_root}/.kf/review/rules/*.md`; user: `~/.kf/review/rules/*.md`; package: `kanban-flow/review/rules/*.md` beside the installed CLI's package.json. If no rule source is available, report the missing rules instead of silently skipping review.
|
|
28
|
+
- Stack packs (`node`, `go`, `rust`, `python`, `php`, `ruby`, `java`) are opt-in: if the project's stack has no `{stack}.md`, suggest `kf rules` (auto-detect) or `kf rules --stack <id>` to install it — they are not auto-loaded from `kanban-flow/review/stacks/`.
|
|
29
|
+
|
|
30
|
+
Review **only files actually changed**. Record findings with severity HIGH / MEDIUM / LOW. Reproduce plausible failures — don't infer.
|
|
31
|
+
|
|
32
|
+
**AI-assisted code risk lens** — hunt for the failure modes AI-generated code produces most:
|
|
33
|
+
|
|
34
|
+
- Phantom tests: tests that execute code but never assert the behavior the spec requires
|
|
35
|
+
- Catch-and-swallow: catches that hide errors instead of handling or rethrowing with context
|
|
36
|
+
- Generic helpers without a domain anchor: abstractions invented for one call site
|
|
37
|
+
- Scope drift: changes outside the approved contract and task list
|
|
38
|
+
- Unrelated broad rewrites: reformatting or refactoring files beyond the diff's purpose
|
|
39
|
+
- Polished comments/commits that describe the change but never explain intent or risk
|
|
40
|
+
|
|
41
|
+
Preserve decisions: do not reopen verified findings or silently undo user-chosen scope, libraries, or thresholds. Before applying a security finding, threat-model it — state what the code stores, protects, and exposes; a finding without a reachable attack path is LOW.
|
|
42
|
+
|
|
43
|
+
Use the `## Baseline` recorded at the top of `tasks.md` (starting HEAD + pre-existing working-tree changes) to include committed, staged, unstaged and new untracked feature files. Preserve unrelated pre-existing changes. Verify the testing report is PASS for the current execution id. After any implementation fix, loop through testing again before writing a new review result.
|
|
44
|
+
|
|
45
|
+
## 3. Write review-report
|
|
46
|
+
|
|
47
|
+
For `kind: bug`, review against the bug report and existing feature behavior. Check reproduction evidence, regression tests and fix scope; do not demand feature planning artifacts. Record the verified root cause and whether related feature docs need an update. If no documentation changes are needed, say why.
|
|
48
|
+
|
|
49
|
+
A bug fix is reviewed adversarially, because a narrow fix is the most common way a bug comes back wearing different clothes. Two things go in every bug review report, and "none" is a valid answer only when you say what you looked at:
|
|
50
|
+
|
|
51
|
+
- **Reachable regressions.** Name what else calls the code you changed, and what a plausible caller passes that the fix did not consider. A guard added for one entry point rarely covers the others — list the sibling paths and say, for each, whether you checked it or not. Do not write "no regressions"; write what you reached for.
|
|
52
|
+
- **Claims you disproved.** State at least one thing the implementer asserted that you tried to break and could not — the root cause, the blast radius, a "this cannot happen" in a comment. Re-run the reproduction yourself rather than trusting the report, and if an explanation in a comment is load-bearing, verify it instead of reading it. Comments that justify a fix have been wrong in exactly the direction that made the fix look correct.
|
|
53
|
+
|
|
54
|
+
A test that passes proves the code does something; it does not prove the test would fail if the fix were removed. When a fix turns on one predicate, delete or invert it and confirm a test goes red. A test that stays green under that is not protecting anything, and should be reported as a finding.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
kf instruct review-report --change {feature_name}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Fill `phase-5-review-report.md`, set frontmatter `status:` to exactly one of:
|
|
61
|
+
|
|
62
|
+
- `PASS` — no HIGH blockers; change is shippable
|
|
63
|
+
- `FAIL` — HIGH blockers / broken tests
|
|
64
|
+
- `REJECT` — does not meet DoD / acceptance criteria
|
|
65
|
+
- `REQUIREMENT_BUG` — the requirement itself is wrong vs. real product need
|
|
66
|
+
|
|
67
|
+
Set `execution:` to the current id from instruct and keep Review Status/Final Decision consistent with frontmatter. Assess MEDIUM findings against acceptance and DoD; do not declare PASS merely because there are no HIGH findings.
|
|
68
|
+
|
|
69
|
+
## 4. The directional gate decides
|
|
70
|
+
|
|
71
|
+
- `PASS` → load kanban-archive for the applicable feature/bug closure before running `kf archive`.
|
|
72
|
+
- `FAIL`/`REJECT` → **structural fix needed**: loop back, re-implement, then the feature must be **re-tested before review again** (kanban-test skill).
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
kf stage {feature_name} implementation
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- `REQUIREMENT_BUG` → **STOP FEATURE.** Do not silently rewrite the requirement — report back to the user what the review found and ask how to proceed. `kf stage` blocks all movement here by design.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Done
|
|
83
|
+
|
|
84
|
+
A decisive report written. Hand off:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
If PASS: load the kanban-archive skill.
|
|
88
|
+
If FAIL/REJECT: load kanban-implement (then kanban-test before returning here).
|
|
89
|
+
If REQUIREMENT_BUG: stop and report to the user.
|
|
90
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kanban-test
|
|
3
|
+
description: 'Test a kanban feature against its approved test plan or a bug against reproduction and regression scope. Write current-execution results with PASS/FAIL/REJECT/BLOCKED. Use in testing.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kanban Phase 4 — Testing (Autonomous)
|
|
7
|
+
|
|
8
|
+
Argument: `<feature_name>`.
|
|
9
|
+
|
|
10
|
+
Prove the feature against the plan's test cases. The report's `status:` IS the decision — `kf stage` reads it and blocks the wrong direction.
|
|
11
|
+
|
|
12
|
+
**Invoked through `kf run`?** If your prompt starts with `kf-run:`, you are a worker for this stage only: skip the "move to stage" step below, never run `kf stage` / `kf approve` / `kf archive` / `kf run`, never edit approved contract artifacts, do not commit, and end your final message with two lines exactly: `STATUS: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT` and `Summary: <one or two sentences>`. The main agent reads them and decides the transition.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Move to testing
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
kf stage {feature_name} testing
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
(Already there → skip.)
|
|
23
|
+
|
|
24
|
+
If `kf stage` refuses the move, run `kf validate --change {feature_name}` to see what is missing — unfinished `tasks.md` checkboxes block entry to testing (DoD), so tick them in implementation first.
|
|
25
|
+
|
|
26
|
+
Every entry to testing creates a new execution id. Keep old reports as evidence, but never reuse them as proof for the current implementation. Read the current id from `kf status` or `kf instruct ... --change`.
|
|
27
|
+
|
|
28
|
+
## 2. Run against the plan's test cases
|
|
29
|
+
|
|
30
|
+
Read the Test Strategy from `phase-1-spec-requirement.md` (Test Level / UI Tests / Tools / Coverage Target) — it was committed in the approved plan. Detect the real test tooling from the repo. Execute exactly what the level promises: `unit` → unit suite; `unit+integration` → + integration; `full` → + UI/E2E suite (Playwright/Cypress/...). If `full` and the UI tests are missing or skipped, that's a gap — report it, don't fake coverage.
|
|
31
|
+
|
|
32
|
+
Track TC-by-TC: Status / Actual / Expected / Tool / Evidence.
|
|
33
|
+
|
|
34
|
+
For `kind: bug`, use the bug report's reproduction, expected result, acceptance criteria and regression strategy instead of a phase-2 test plan. Verify the defect is fixed and run the affected regression suite; use descriptive test IDs or actual test names in the results table. Do not require FR/UC/TC artifacts for a bug.
|
|
35
|
+
|
|
36
|
+
## 3. Write testing-result
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
kf instruct testing-result --change {feature_name}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Fill `phase-4-testing-result.md`, set frontmatter `status:` to exactly one of:
|
|
43
|
+
|
|
44
|
+
- `PASS` — all tests pass, coverage target met
|
|
45
|
+
- `FAIL` — tests failing
|
|
46
|
+
- `REJECT` — feature does not meet acceptance criteria
|
|
47
|
+
- `BLOCKED` — cannot test (env/tooling)
|
|
48
|
+
|
|
49
|
+
Always write the report, including `execution:` from the current template. Include per-TC results, actual commands, evidence and coverage against the approved target. In the "Commands and Evidence" table the Exit code column must be the real numeric exit code of each command you ran; `kf validate` rejects a `PASS` report that has no command row or any exit code other than `0` (`testing_exit_code`). Keep status and conclusion consistent. Missing tooling, skipped required tests or unmeasured required coverage cannot count as PASS. Write outcomes here; keep phase-2-test-case.md unchanged.
|
|
50
|
+
|
|
51
|
+
## 4. The directional gate decides
|
|
52
|
+
|
|
53
|
+
- `PASS` → `kf stage {feature_name} review`
|
|
54
|
+
- `FAIL`/`REJECT` → loop to implementation, apply the fix, then enter testing again and write a result for the new execution id:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
kf stage {feature_name} implementation
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
...then return here and re-test before attempting review again.
|
|
61
|
+
|
|
62
|
+
- `BLOCKED` → stop and report the environment/tooling blocker. Do not advance or substitute a known issue for required passing tests.
|
|
63
|
+
|
|
64
|
+
Still failing after one fix cycle → STOP, show failing tests, ask: fix deeper / record as known issue / abort.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Done
|
|
69
|
+
|
|
70
|
+
Report written with a decisive status. Hand off:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
If PASS: load the kanban-review skill.
|
|
74
|
+
If FAIL/REJECT: kanban-implement first, then testing with a new execution id.
|
|
75
|
+
If BLOCKED: stop and report the blocker.
|
|
76
|
+
```
|