context-planning 0.7.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 +454 -0
- package/bin/commands/_helpers.js +53 -0
- package/bin/commands/_usage.js +67 -0
- package/bin/commands/capture.js +46 -0
- package/bin/commands/codebase-status.js +41 -0
- package/bin/commands/complete-milestone.js +57 -0
- package/bin/commands/config.js +70 -0
- package/bin/commands/doctor.js +139 -0
- package/bin/commands/gsd-import.js +90 -0
- package/bin/commands/inbox.js +81 -0
- package/bin/commands/index.js +33 -0
- package/bin/commands/init.js +87 -0
- package/bin/commands/install.js +43 -0
- package/bin/commands/scaffold-codebase.js +53 -0
- package/bin/commands/scaffold-milestone.js +58 -0
- package/bin/commands/scaffold-phase.js +65 -0
- package/bin/commands/status.js +42 -0
- package/bin/commands/statusline.js +108 -0
- package/bin/commands/tick.js +49 -0
- package/bin/commands/version.js +9 -0
- package/bin/commands/worktree.js +218 -0
- package/bin/commands/write-summary.js +54 -0
- package/bin/cp.cmd +2 -0
- package/bin/cp.js +54 -0
- package/commands/cp/capture.md +107 -0
- package/commands/cp/complete-milestone.md +166 -0
- package/commands/cp/execute-phase.md +220 -0
- package/commands/cp/map-codebase.md +211 -0
- package/commands/cp/new-milestone.md +136 -0
- package/commands/cp/new-project.md +132 -0
- package/commands/cp/plan-phase.md +195 -0
- package/commands/cp/progress.md +147 -0
- package/commands/cp/quick.md +104 -0
- package/commands/cp/resume.md +125 -0
- package/commands/cp/write-summary.md +33 -0
- package/docs/MIGRATION-v0.5.md +140 -0
- package/docs/architecture.md +189 -0
- package/docs/superpowers/plans/2026-05-20-v0-7-plan-16-01-design-md-infrastructure.md +1064 -0
- package/docs/superpowers/plans/2026-05-20-v0-7-plan-16-02-review-log-infrastructure.md +418 -0
- package/docs/superpowers/plans/2026-05-20-v0-7-plan-16-03-key-decisions-hard-block.md +295 -0
- package/docs/superpowers/specs/2026-05-20-generic-provider-harness-detection-design.md +380 -0
- package/docs/superpowers/specs/2026-05-20-v0-7-design-capture-design.md +400 -0
- package/docs/writing-providers.md +76 -0
- package/install/aider.js +204 -0
- package/install/claude.js +116 -0
- package/install/common.js +65 -0
- package/install/copilot.js +86 -0
- package/install/cursor.js +120 -0
- package/install/echo-provider.js +50 -0
- package/lib/codebase-mapper.js +169 -0
- package/lib/detect.js +280 -0
- package/lib/frontmatter.js +72 -0
- package/lib/gsd-compat.js +165 -0
- package/lib/import.js +543 -0
- package/lib/inbox.js +226 -0
- package/lib/lifecycle.js +929 -0
- package/lib/merge.js +157 -0
- package/lib/milestone.js +595 -0
- package/lib/paths.js +191 -0
- package/lib/provider.js +168 -0
- package/lib/roadmap.js +134 -0
- package/lib/state.js +99 -0
- package/lib/worktree.js +253 -0
- package/package.json +45 -0
- package/templates/DESIGN.md +78 -0
- package/templates/INBOX.md +13 -0
- package/templates/MILESTONE-CONTEXT.md +40 -0
- package/templates/MILESTONES.md +29 -0
- package/templates/PLAN.md +84 -0
- package/templates/PROJECT.md +43 -0
- package/templates/REVIEW-LOG.md +38 -0
- package/templates/ROADMAP.md +34 -0
- package/templates/STATE.md +78 -0
- package/templates/SUMMARY.md +75 -0
- package/templates/codebase/ARCHITECTURE.md +30 -0
- package/templates/codebase/CONCERNS.md +30 -0
- package/templates/codebase/CONVENTIONS.md +30 -0
- package/templates/codebase/INTEGRATIONS.md +30 -0
- package/templates/codebase/STACK.md +26 -0
- package/templates/codebase/STRUCTURE.md +32 -0
- package/templates/codebase/TESTING.md +39 -0
- package/templates/config.json +173 -0
- package/templates/phase-PLAN.md +32 -0
- package/templates/quick-PLAN.md +24 -0
- package/templates/quick-SUMMARY.md +25 -0
package/bin/cp.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* cp — context-planning CLI entry.
|
|
6
|
+
*
|
|
7
|
+
* v0.6: thin dispatcher. Each command lives in bin/commands/<name>.js as
|
|
8
|
+
* a module exporting { name, run(args) }. The registry in
|
|
9
|
+
* bin/commands/index.js maps subcommand names to their handlers.
|
|
10
|
+
*
|
|
11
|
+
* To add a new command:
|
|
12
|
+
* 1. Drop bin/commands/<name>.js exporting { name, run }.
|
|
13
|
+
* 2. Add an entry to bin/commands/index.js.
|
|
14
|
+
* 3. (Optional) Update bin/commands/_usage.js if it should appear in `cp help`.
|
|
15
|
+
*
|
|
16
|
+
* To see the full subcommand list, run: `cp help`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const usage = require('./commands/_usage');
|
|
20
|
+
const registry = require('./commands');
|
|
21
|
+
const { normalizeArgv } = require('./commands/_helpers');
|
|
22
|
+
|
|
23
|
+
function main(argv) {
|
|
24
|
+
const normalized = normalizeArgv(argv.slice(2));
|
|
25
|
+
const [cmd, ...rest] = normalized;
|
|
26
|
+
|
|
27
|
+
// Registry-first dispatch.
|
|
28
|
+
if (cmd && Object.prototype.hasOwnProperty.call(registry, cmd)) {
|
|
29
|
+
return registry[cmd].run(rest);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Built-in aliases not in the registry.
|
|
33
|
+
switch (cmd) {
|
|
34
|
+
case '--version':
|
|
35
|
+
case '-v':
|
|
36
|
+
return registry.version.run();
|
|
37
|
+
case 'help':
|
|
38
|
+
case '--help':
|
|
39
|
+
case '-h':
|
|
40
|
+
case undefined:
|
|
41
|
+
return usage();
|
|
42
|
+
default:
|
|
43
|
+
console.error(`unknown command: ${cmd}`);
|
|
44
|
+
usage();
|
|
45
|
+
process.exit(2);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (require.main === module) {
|
|
50
|
+
main(process.argv);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Public exports — kept for back-compat with tests and external require()s.
|
|
54
|
+
module.exports = { normalizeArgv, main, registry };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Triage open inbox items — route each to a quick task, phase note, seed, or discard
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /cp-capture — inbox triage
|
|
6
|
+
|
|
7
|
+
`/cp-capture` walks the user through the open `.planning/INBOX.md` items
|
|
8
|
+
one at a time and routes each to its right destination. cp owns the inbox
|
|
9
|
+
state; the **workflow provider** (default: Superpowers) does the actual
|
|
10
|
+
implementation work for items that become quick tasks or phase additions.
|
|
11
|
+
|
|
12
|
+
`/cp-capture` is the COMPANION to `cp capture "..."`. The CLI command
|
|
13
|
+
appends a free-form line to `INBOX.md`; this slash command processes the
|
|
14
|
+
backlog interactively.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Behaviour
|
|
19
|
+
|
|
20
|
+
You are the orchestrator. Do this in order:
|
|
21
|
+
|
|
22
|
+
1. **Inspect the inbox.**
|
|
23
|
+
Run `cp inbox --json` and parse it. If `open` is empty, tell the user
|
|
24
|
+
"Inbox is empty — nothing to triage." and stop. Otherwise show a brief
|
|
25
|
+
summary: `N open items, M previously triaged. Walk through the open
|
|
26
|
+
items one at a time?` and confirm.
|
|
27
|
+
|
|
28
|
+
2. **For each open item (in `open` order):**
|
|
29
|
+
|
|
30
|
+
a. Display the item to the user (timestamp + text).
|
|
31
|
+
|
|
32
|
+
b. Propose a classification. Use one of these destination tags:
|
|
33
|
+
|
|
34
|
+
| Tag | When to use | Action |
|
|
35
|
+
|------------------------------|---------------------------------------------------------------------------|--------|
|
|
36
|
+
| `quick:<slug>` | Small bug / fix / chore. Single PR, no planning. | Defer to the workflow provider's quick-task skill. |
|
|
37
|
+
| `phase:<NN-name>` | Goes into an existing phase as a sub-task or PLAN.md update. | Append the item text to that phase's PLAN.md `## Notes` (or appropriate section). |
|
|
38
|
+
| `phase-seed:<short-name>` | Future phase — write it down for the next roadmap cut. | Append to `.planning/STATE.md` `### Pending Todos`. |
|
|
39
|
+
| `milestone-seed:<name>` | Bigger than a phase — surfaces a future milestone. | Append to `.planning/STATE.md` `## Deferred Items`. |
|
|
40
|
+
| `note:<where>` | Standalone reference info (a decision, an observation, a constraint). | Append to `.planning/STATE.md` `## Accumulated Context > ### Decisions` (or where the user picks). |
|
|
41
|
+
| `discard` | Noise. Tracking complete; nothing to do. | No side-effect beyond marking triaged. |
|
|
42
|
+
|
|
43
|
+
Propose one classification with a one-sentence rationale. Always ask
|
|
44
|
+
the user to confirm or override (use AskUserQuestion when available,
|
|
45
|
+
otherwise plain text). The user can also pick **skip** (leave open) or
|
|
46
|
+
**edit** (rewrite the item before classifying).
|
|
47
|
+
|
|
48
|
+
c. **Execute the routing action.**
|
|
49
|
+
- For `quick:*`: hand off to the workflow provider's quick-task
|
|
50
|
+
primitive (Superpowers's `/quick`, GSD's `/gsd-quick`, etc.). Pass
|
|
51
|
+
the item text as the task description.
|
|
52
|
+
- For `phase:*`: read the matching phase's `PLAN.md` (long-form or
|
|
53
|
+
short-form), append a bullet under `## Notes` with the item text
|
|
54
|
+
prefixed by `> inbox [<ts>]:`. Use `cp tick`'s file convention. Do
|
|
55
|
+
NOT auto-tick anything.
|
|
56
|
+
- For `phase-seed:*` / `milestone-seed:*` / `note:*`: read
|
|
57
|
+
`.planning/STATE.md`, append a bullet to the right section
|
|
58
|
+
(preserve all other content verbatim), write it back.
|
|
59
|
+
- For `discard`: no extra file write.
|
|
60
|
+
|
|
61
|
+
d. **Mark triaged.** Once the routing action succeeds (or for `discard`,
|
|
62
|
+
immediately), run:
|
|
63
|
+
```
|
|
64
|
+
cp inbox --tick <N> --note "<destination-tag>"
|
|
65
|
+
```
|
|
66
|
+
where `<N>` is the open item's index from step 2a. This moves the
|
|
67
|
+
item from `Open` to `Triaged` in `INBOX.md` and auto-commits.
|
|
68
|
+
|
|
69
|
+
3. **Summary.** After the loop, run `cp inbox --all` and show the user
|
|
70
|
+
what was triaged. End with: "Inbox triaged. `M` items moved, `K` left
|
|
71
|
+
open."
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Rules
|
|
76
|
+
|
|
77
|
+
- **Always confirm classifications with the user.** Never silently route an
|
|
78
|
+
item — these are the user's notes; they get final say on what each one means.
|
|
79
|
+
- **One item at a time.** Don't batch-classify; the user might catch a bad
|
|
80
|
+
routing decision mid-loop and want to stop.
|
|
81
|
+
- **Atomic commits.** `cp inbox --tick` commits each triage on its own. If
|
|
82
|
+
you also wrote to a phase PLAN or STATE.md, those go in a separate commit
|
|
83
|
+
via your normal file-edit flow — don't try to bundle the inbox tick with
|
|
84
|
+
unrelated file edits.
|
|
85
|
+
- **Idempotent.** If the user re-runs `/cp-capture` mid-session, items
|
|
86
|
+
already in `Triaged` should not be revisited; only items still in `Open`.
|
|
87
|
+
|
|
88
|
+
## Provider integration
|
|
89
|
+
|
|
90
|
+
The Mappings table assumes the workflow provider is one of:
|
|
91
|
+
- **Superpowers** (default): `/quick` for quick tasks; for phase edits and
|
|
92
|
+
state edits, use your own filesystem tools.
|
|
93
|
+
- **GSD**: `/gsd-quick` or `/gsd-capture` for quick tasks; otherwise as above.
|
|
94
|
+
- **None**: cp's CLI still works (`cp capture`, `cp inbox --tick`); you
|
|
95
|
+
perform routing edits with your harness's filesystem tools.
|
|
96
|
+
|
|
97
|
+
Read `.planning/config.json` `cp.workflow_provider` to know which is active.
|
|
98
|
+
|
|
99
|
+
## Don't
|
|
100
|
+
|
|
101
|
+
- Don't write to `INBOX.md` directly — always go through `cp inbox --tick`.
|
|
102
|
+
- Don't strip the original item text when writing to a phase / state file
|
|
103
|
+
— preserve `> inbox [<ts>]: <text>` so the provenance stays clear.
|
|
104
|
+
- Don't classify the same item twice in one run.
|
|
105
|
+
- Don't auto-create new phases or milestones from inbox items. Surface them
|
|
106
|
+
as `phase-seed:*` / `milestone-seed:*` and let `/cp-new-milestone` or
|
|
107
|
+
`/cp-plan-phase` pick them up later.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-complete-milestone
|
|
3
|
+
description: Close out a milestone — verify all phases done, roll up SUMMARYs, collapse in ROADMAP, archive to MILESTONES.md.
|
|
4
|
+
argument-hint: "<milestone name, optional — defaults to current>"
|
|
5
|
+
requires: []
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-complete-milestone
|
|
9
|
+
|
|
10
|
+
You are running `cp-complete-milestone`. A milestone has finished all its
|
|
11
|
+
phases; your job is to archive it cleanly so the project state shows the
|
|
12
|
+
milestone shipped and the next milestone has a clean slate.
|
|
13
|
+
|
|
14
|
+
**This command is destructive in the GSD-compatible way:** it COLLAPSES the
|
|
15
|
+
shipped phases inside `<details>` in ROADMAP.md (does NOT delete them),
|
|
16
|
+
APPENDS a digest to MILESTONES.md, and DELETES `.planning/MILESTONE-CONTEXT.md`
|
|
17
|
+
(since GSD treats this file as transient per-milestone).
|
|
18
|
+
|
|
19
|
+
## TL;DR — use the `cp` CLI wrapper
|
|
20
|
+
|
|
21
|
+
The entire 7-step close-out is wrapped by **`cp complete-milestone`**. The
|
|
22
|
+
wrapper handles verification, digest aggregation, ROADMAP collapse,
|
|
23
|
+
MILESTONE-CONTEXT deletion, STATE reset, AND the atomic git commit.
|
|
24
|
+
|
|
25
|
+
**Recommended flow:**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Confirm what's about to change (no writes)
|
|
29
|
+
cp complete-milestone --dry-run "$MILESTONE_NAME"
|
|
30
|
+
# (omit name to use the current in-progress milestone)
|
|
31
|
+
|
|
32
|
+
# 2. Show the user the action plan and the rendered digest preview
|
|
33
|
+
# (Get the rendered digest from MILESTONES.md after the dry-run? No —
|
|
34
|
+
# dry-run doesn't write. Use --json to get the agg object and render
|
|
35
|
+
# a preview inline, OR just describe the actions list and run real.)
|
|
36
|
+
|
|
37
|
+
# 3. Run real
|
|
38
|
+
cp complete-milestone "$MILESTONE_NAME"
|
|
39
|
+
|
|
40
|
+
# 4. Confirm
|
|
41
|
+
cp status # should now show "(none in-progress)" for milestone
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Exit-code contract:**
|
|
45
|
+
- `0` → milestone successfully closed (or dry-run produced an action list)
|
|
46
|
+
- `1` → blocking error (incomplete phases, missing SUMMARYs, milestone not found, etc.)
|
|
47
|
+
|
|
48
|
+
If the wrapper fails, read the structured error and tell the user exactly
|
|
49
|
+
which phase / plan / SUMMARY is missing.
|
|
50
|
+
|
|
51
|
+
## Step 1 — Resolve the milestone name
|
|
52
|
+
|
|
53
|
+
- If `$ARGUMENTS` is provided, use it as the milestone name.
|
|
54
|
+
- Else, read `.planning/MILESTONE-CONTEXT.md` and pull its name.
|
|
55
|
+
- Else, let `cp complete-milestone` (with no arg) detect the current
|
|
56
|
+
in-progress milestone via `cp status`.
|
|
57
|
+
- If `cp` returns `reason: no-current-milestone`, stop and ask the user.
|
|
58
|
+
|
|
59
|
+
## Step 2 — Dry-run preview
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cp complete-milestone --dry-run [<milestone name>]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The CLI prints:
|
|
66
|
+
```
|
|
67
|
+
Milestone: v0.1 MVP
|
|
68
|
+
Phases: 1, 2
|
|
69
|
+
Subsystems: storage, search
|
|
70
|
+
Files: 5 created, 1 modified
|
|
71
|
+
|
|
72
|
+
Actions (dry-run):
|
|
73
|
+
✓ write .planning\MILESTONES.md
|
|
74
|
+
✓ write .planning\ROADMAP.md
|
|
75
|
+
✗ delete .planning\MILESTONE-CONTEXT.md
|
|
76
|
+
✓ write .planning\STATE.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If `--dry-run` exits non-zero, the milestone isn't complete — `cp` lists
|
|
80
|
+
which phases still have unticked plans or missing SUMMARYs. Tell the user
|
|
81
|
+
and stop; suggest `/cp-execute-phase {N}` for any incomplete phase.
|
|
82
|
+
|
|
83
|
+
## Step 3 — Show the user; ask for sign-off
|
|
84
|
+
|
|
85
|
+
Present the action list + a short summary (which milestone, how many
|
|
86
|
+
phases, what subsystems). Ask for explicit confirmation. **Do not auto-run
|
|
87
|
+
the real `cp complete-milestone` without it.**
|
|
88
|
+
|
|
89
|
+
## Step 4 — Run for real
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cp complete-milestone [<milestone name>]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The CLI does everything atomically:
|
|
96
|
+
1. Verifies every phase has all plans `[x]` and a SUMMARY on disk.
|
|
97
|
+
2. Reads + aggregates every SUMMARY frontmatter (union-and-dedupe of
|
|
98
|
+
`subsystem`, `tags`, `requires/provides/affects`, `tech-stack`,
|
|
99
|
+
`key-files`, `key-decisions`, `patterns-established`,
|
|
100
|
+
`requirements-completed`).
|
|
101
|
+
3. Renders the milestone digest (heading, requirements delivered,
|
|
102
|
+
subsystems touched, key decisions/patterns with phase tags, files
|
|
103
|
+
created/modified, phase-summary links).
|
|
104
|
+
4. Appends the digest to `.planning/MILESTONES.md` (preserves prior
|
|
105
|
+
content; adds blank line before the new entry).
|
|
106
|
+
5. Collapses the milestone in `.planning/ROADMAP.md` — wraps the
|
|
107
|
+
`### {emoji} {name} (In Progress)` heading and every `### Phase N: ...`
|
|
108
|
+
block inside a single `<details>` element with
|
|
109
|
+
`<summary>✅ {name} (Phases X-Y) — SHIPPED {today}</summary>`.
|
|
110
|
+
Preserves every phase block byte-for-byte for GSD round-tripping.
|
|
111
|
+
6. Deletes `.planning/MILESTONE-CONTEXT.md` if present.
|
|
112
|
+
7. Resets `.planning/STATE.md` Current Position to `Idle`, Last activity
|
|
113
|
+
to `shipped {milestone}`, Session Continuity Stopped at →
|
|
114
|
+
`shipped {milestone}`.
|
|
115
|
+
8. Runs `git add -A && git commit -m "cp: /cp-complete-milestone {name}"`
|
|
116
|
+
(unless `--no-commit` is passed).
|
|
117
|
+
|
|
118
|
+
The CLI prints the actions list and the commit hash.
|
|
119
|
+
|
|
120
|
+
## Step 5 — Report
|
|
121
|
+
|
|
122
|
+
After the wrapper completes, print:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
✓ Milestone "{name}" shipped.
|
|
126
|
+
Phases: X-Y ({plan count} plans)
|
|
127
|
+
Archived to: .planning/MILESTONES.md
|
|
128
|
+
Roadmap: collapsed inside <details>
|
|
129
|
+
Cleared: .planning/MILESTONE-CONTEXT.md
|
|
130
|
+
Committed: {short hash}
|
|
131
|
+
|
|
132
|
+
Next:
|
|
133
|
+
/cp-new-milestone "{suggested next}" # start the next milestone
|
|
134
|
+
cp status # confirm the new "you are here"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Fallback — when `cp` CLI is not available
|
|
138
|
+
|
|
139
|
+
If `cp` is not on PATH (e.g. the user installed cp into a harness without
|
|
140
|
+
the Node CLI), drive the same flow by calling the lib functions directly.
|
|
141
|
+
**Beware of the lib contracts** — these were the bugs the wrapper hides:
|
|
142
|
+
|
|
143
|
+
- `milestone.aggregateSummaries(summaries)` takes `[{fm, phaseNum}]`
|
|
144
|
+
— NOT raw strings. Use `milestone.readSummaries(phaseNums, root)` to
|
|
145
|
+
build that shape.
|
|
146
|
+
- `milestone.collapseMilestoneInRoadmap(content, name, isoDate)` returns
|
|
147
|
+
`{content, changed, reason?}`. Always use `.content`.
|
|
148
|
+
- `milestone.renderDigest(name, isoDate, phaseNums, agg, phaseNames)` —
|
|
149
|
+
positional args, not an options object.
|
|
150
|
+
- SUMMARY frontmatter uses **kebab-case**: `subsystem` (singular!),
|
|
151
|
+
`key-files.{created,modified}`, `key-decisions`,
|
|
152
|
+
`patterns-established`, `requirements-completed`, `tech-stack.added`.
|
|
153
|
+
- `state.updatePosition(content, opts)` takes `content`, NOT a path.
|
|
154
|
+
- Append to `MILESTONES.md` AFTER all other edits succeed, so a mid-flight
|
|
155
|
+
failure leaves the archive intact.
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- **GSD-compat hard contract:** do NOT change phase numbering, do NOT
|
|
160
|
+
remove any phase block, do NOT alter frontmatter inside SUMMARY/PLAN
|
|
161
|
+
files. Everything stays parseable by GSD's `gsd-complete-milestone`.
|
|
162
|
+
- This command is the only one in cp that DELETES a file
|
|
163
|
+
(`MILESTONE-CONTEXT.md`). Show the user the dry-run actions list before
|
|
164
|
+
running real.
|
|
165
|
+
- If the user wants to undo, the atomic commit makes `git revert HEAD` a
|
|
166
|
+
one-shot rollback.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-execute-phase
|
|
3
|
+
description: Execute a planned phase by handing PLAN.md to the provider's execute skill, then record SUMMARY.md and update STATE.md/ROADMAP.md.
|
|
4
|
+
argument-hint: "<phase number>"
|
|
5
|
+
requires: []
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-execute-phase
|
|
9
|
+
|
|
10
|
+
You are running `cp-execute-phase`. PLAN.md exists; your job is to drive it
|
|
11
|
+
through to a green build and atomic commits via the configured workflow
|
|
12
|
+
provider, then record the result back into the state layer.
|
|
13
|
+
|
|
14
|
+
**The state-layer bookkeeping is wrapped by `cp tick` and
|
|
15
|
+
`cp write-summary`** — you don't need to touch `lib/roadmap.setPlanDone` or
|
|
16
|
+
write SUMMARY files by hand. Use the wrappers; they validate frontmatter,
|
|
17
|
+
keep ROADMAP + phase PLAN.md in sync, and commit atomically.
|
|
18
|
+
|
|
19
|
+
## Step 1 — Resolve the phase + plan
|
|
20
|
+
|
|
21
|
+
- `PHASE_NUM` = `$ARGUMENTS` (sanitize as in cp-plan-phase).
|
|
22
|
+
- Run `cp status --json` to confirm the milestone, current phase, and the
|
|
23
|
+
**next pending plan** (`.nextPlan.planId`). If `nextPlan` is null, all
|
|
24
|
+
plans in this phase are done — suggest `/cp-plan-phase {PHASE_NUM+1}` or
|
|
25
|
+
`/cp-complete-milestone`.
|
|
26
|
+
- If `cp status` reports a *different* phase than `PHASE_NUM`, ask the user
|
|
27
|
+
whether to switch.
|
|
28
|
+
- Read the phase's `PLAN.md` and each `{NN-MM}-PLAN.md` per-plan file to
|
|
29
|
+
pull tasks + acceptance criteria. Read the milestone's ROADMAP block for
|
|
30
|
+
Goal / Success Criteria / Requirements.
|
|
31
|
+
|
|
32
|
+
## Step 2 — Set the start markers
|
|
33
|
+
|
|
34
|
+
Update PLAN.md frontmatter for the current plan: add `status: in-progress`,
|
|
35
|
+
`started: {ISO timestamp}`. Update STATE.md is OPTIONAL here — the wrappers
|
|
36
|
+
in steps 6-7 will reset it correctly on completion.
|
|
37
|
+
|
|
38
|
+
If `cp.behavior.atomic_commits` is true, commit:
|
|
39
|
+
```
|
|
40
|
+
cp: start {phase}-{plan} execution
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Step 3 — Resolve the execute skill
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cp doctor
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Find the resolved `execute` role under "Roles -> resolved skill":
|
|
50
|
+
|
|
51
|
+
- Default: Superpowers' `subagent-driven-development` — fires one fresh
|
|
52
|
+
subagent per task with two-stage review.
|
|
53
|
+
- Alternative: Superpowers' `executing-plans` (simpler batch execution).
|
|
54
|
+
- If the resolved provider is `manual`: walk through each task one at a
|
|
55
|
+
time, confirming intent, doing the work, running verification, committing.
|
|
56
|
+
|
|
57
|
+
## Step 4 — Delegate execution
|
|
58
|
+
|
|
59
|
+
Invoke the execute skill with:
|
|
60
|
+
- The current plan's `{phase}-{plan}-PLAN.md` as the work plan
|
|
61
|
+
- The phase Goal, Success Criteria, and Requirements as the must-haves
|
|
62
|
+
- An instruction: each task gets an atomic commit using Conventional
|
|
63
|
+
Commits style (feat/fix/refactor/test/docs), prefixed with
|
|
64
|
+
`({phase}-{plan}) ` (e.g. `feat(01-02): add JWT verifier`).
|
|
65
|
+
|
|
66
|
+
The execute skill OWNS what happens during the work — TDD, verification,
|
|
67
|
+
code review between tasks, deviations. Do not intervene unless it returns
|
|
68
|
+
control.
|
|
69
|
+
|
|
70
|
+
## Step 4.5 — Append to REVIEW-LOG.md (v0.7)
|
|
71
|
+
|
|
72
|
+
After EACH review cycle returned by SP `subagent-driven-development`
|
|
73
|
+
(spec-compliance OR code-quality), append one block to
|
|
74
|
+
`.planning/phases/{phase-dir}/REVIEW-LOG.md` BEFORE the
|
|
75
|
+
`<!-- REVIEW-LOG-ENTRIES-BELOW -->` marker is irrelevant — APPEND after
|
|
76
|
+
the marker:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
## {{DATE}} {{TIME}} — Plan {{PLAN-ID}} Task {{TASK-N}} — {{REVIEWER-ROLE}}
|
|
80
|
+
|
|
81
|
+
**Verdict:** {approved | rejected | needs-revision}
|
|
82
|
+
|
|
83
|
+
**Findings:**
|
|
84
|
+
|
|
85
|
+
- {bullet list of substantive findings}
|
|
86
|
+
|
|
87
|
+
**Resolution:**
|
|
88
|
+
|
|
89
|
+
{what changed; commit SHA if applied; "N/A — accepted on first pass" allowed}
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Skip empty findings on clean approvals (use "Resolution: approved on
|
|
95
|
+
first pass" and omit findings bullet list).
|
|
96
|
+
|
|
97
|
+
If the file does not exist (older milestones), create it from
|
|
98
|
+
`templates/REVIEW-LOG.md` with substituted frontmatter first.
|
|
99
|
+
|
|
100
|
+
The cp aggregator counts these entries (via `aggregateSummaries`
|
|
101
|
+
`reviewCount`) when rolling up the milestone summary.
|
|
102
|
+
|
|
103
|
+
## Step 5 — Verify Success Criteria
|
|
104
|
+
|
|
105
|
+
When the execute skill reports the plan complete:
|
|
106
|
+
|
|
107
|
+
1. Verify Success Criteria from ROADMAP.md actually hold. (Ask the
|
|
108
|
+
provider's `verify` skill, e.g. `verification-before-completion`, or
|
|
109
|
+
do an inline check.)
|
|
110
|
+
2. If any criterion fails: **do not** tick or write SUMMARY. Tell the user
|
|
111
|
+
and pause for instructions.
|
|
112
|
+
|
|
113
|
+
## Step 6 — Write SUMMARY with `cp write-summary`
|
|
114
|
+
|
|
115
|
+
Collect the per-plan facts into a JSON blob, then call:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cp write-summary {phase}-{plan} --from /tmp/summary-{phase}-{plan}.json [--body /tmp/summary-{phase}-{plan}-body.md]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The CLI:
|
|
122
|
+
- Writes to `.planning/phases/{phase-dir}/{phase}-{plan}-SUMMARY.md`
|
|
123
|
+
(correct GSD-compatible filename — NO slug in the middle).
|
|
124
|
+
- Validates and **normalises both kebab-case AND snake_case** field names
|
|
125
|
+
(`subsystem`/`subsystems`, `key-files.created`/`files_created`,
|
|
126
|
+
`requirements-completed`/`requirements_completed`,
|
|
127
|
+
`key-decisions`/`key_decisions`, etc.).
|
|
128
|
+
- Backfills `phase`, `plan`, and `completed` if absent.
|
|
129
|
+
|
|
130
|
+
Required JSON fields (kebab-case canonical names — snake_case also accepted):
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"subsystem": "<pick one: auth, payments, ui, api, database, infra, testing, docs, tooling — ask user if ambiguous>",
|
|
135
|
+
"tags": ["jwt", "prisma", "react"],
|
|
136
|
+
"requires": ["..."],
|
|
137
|
+
"provides": ["..."],
|
|
138
|
+
"affects": ["src/..."],
|
|
139
|
+
"tech-stack": { "added": ["..."], "patterns": ["..."] },
|
|
140
|
+
"key-files": { "created": ["..."], "modified": ["..."] },
|
|
141
|
+
"key-decisions": ["decision 1", "decision 2"],
|
|
142
|
+
"patterns-established": ["pattern 1"],
|
|
143
|
+
"requirements-completed":["REQ-04"],
|
|
144
|
+
"duration": "32min"
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The body markdown file should contain the human-readable
|
|
149
|
+
**Accomplishments / Task Commits / Files Created / Decisions Made /
|
|
150
|
+
Deviations / Issues / Next Phase Readiness** sections — derive from
|
|
151
|
+
`git log --oneline {start_sha}..HEAD` and `git diff --name-only`.
|
|
152
|
+
|
|
153
|
+
After `cp write-summary` succeeds, update the per-plan PLAN.md frontmatter:
|
|
154
|
+
`status: complete`, `completed: {ISO ts}`.
|
|
155
|
+
|
|
156
|
+
## Step 7 — Tick the plan with `cp tick`
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
cp tick {phase}-{plan}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The CLI:
|
|
163
|
+
- Marks the plan `[x]` in BOTH `.planning/ROADMAP.md` AND
|
|
164
|
+
`.planning/phases/{phase-dir}/PLAN.md` (one command, not two).
|
|
165
|
+
- Idempotent — no-op if already ticked.
|
|
166
|
+
- Commits as `cp: tick plan {phase}-{plan}` (pass `--no-commit` to skip).
|
|
167
|
+
|
|
168
|
+
## Step 8 — Status check + next step
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
cp status
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
If `cp status` shows another pending plan in the same phase:
|
|
175
|
+
```
|
|
176
|
+
Next: /cp-execute-phase {N} # continues with next plan
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If `nextPlan` is null for this phase but other phases remain pending:
|
|
180
|
+
```
|
|
181
|
+
Next: /cp-plan-phase {N+1} # if next phase has no PLAN yet
|
|
182
|
+
/cp-execute-phase {N+1} # if it does
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If all plans across all phases are done:
|
|
186
|
+
```
|
|
187
|
+
Next: /cp-complete-milestone # ship it!
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Step 9 — Report
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
✓ Plan {phase}-{plan} complete: {phase name}
|
|
194
|
+
Duration: {X} min, {tasks} tasks, {files} files
|
|
195
|
+
SUMMARY: .planning/phases/{phase-dir}/{phase}-{plan}-SUMMARY.md
|
|
196
|
+
Next: {derived from `cp status` in Step 8}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Fallback — when `cp` CLI is not available
|
|
200
|
+
|
|
201
|
+
If `cp` is not on PATH, write the SUMMARY manually using the exact
|
|
202
|
+
filename `{phase}-{plan}-SUMMARY.md` (NOT `{phase}-{plan}-{slug}-SUMMARY.md`)
|
|
203
|
+
and tick the plan in BOTH `ROADMAP.md` AND the phase `PLAN.md` using
|
|
204
|
+
`lib/roadmap.setPlanDone(content, '{phase}-{plan}', true)`. Frontmatter
|
|
205
|
+
**must** use kebab-case canonical names (`subsystem` singular,
|
|
206
|
+
`key-files.created`, etc.) for `aggregateSummaries` to pick them up at
|
|
207
|
+
milestone close.
|
|
208
|
+
|
|
209
|
+
## Notes
|
|
210
|
+
|
|
211
|
+
- Never write SUMMARY.md if Success Criteria aren't met.
|
|
212
|
+
- If the execute skill pauses mid-task, leave PLAN.md `status: in-progress`
|
|
213
|
+
so the user can resume by re-invoking `/cp-execute-phase {N}`.
|
|
214
|
+
- Don't re-implement the execute skill. Delegate. Your job is the state
|
|
215
|
+
layer + bookkeeping.
|
|
216
|
+
- Filenames are GSD-compatible: `{phase}-{plan}-PLAN.md` and
|
|
217
|
+
`{phase}-{plan}-SUMMARY.md`. The `cp` wrappers enforce this.
|
|
218
|
+
- Frontmatter is the canonical cross-tool interop surface — GSD's
|
|
219
|
+
gsd-planner relies on these fields, so populate them faithfully. The
|
|
220
|
+
`cp write-summary` wrapper validates this.
|