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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-map-codebase
|
|
3
|
+
description: Analyse the current codebase via 4 parallel sub-agents and write .planning/codebase/ docs that ground all later cp work. Native to cp — does NOT require Superpowers or any other workflow provider.
|
|
4
|
+
argument-hint: "[--force] [--fast [--focus tech|arch|quality|concerns]]"
|
|
5
|
+
requires: []
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-map-codebase
|
|
9
|
+
|
|
10
|
+
You are running `cp-map-codebase`. This is a **cp-native** command — it does
|
|
11
|
+
not call the workflow provider. The provider abstraction is for *workflow*
|
|
12
|
+
work (brainstorm/plan/execute/review/debug); map-codebase is *upfront context
|
|
13
|
+
gathering* and lives entirely in the state layer.
|
|
14
|
+
|
|
15
|
+
What you'll produce: 7 markdown docs in `.planning/codebase/` that match the
|
|
16
|
+
GSD layout exactly, so `cp gsd-import` stays clean and the user can switch
|
|
17
|
+
between cp and GSD any time.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
.planning/codebase/
|
|
21
|
+
├── STACK.md ← tech focus (agent 1)
|
|
22
|
+
├── INTEGRATIONS.md ← tech focus (agent 1)
|
|
23
|
+
├── ARCHITECTURE.md ← arch focus (agent 2)
|
|
24
|
+
├── STRUCTURE.md ← arch focus (agent 2)
|
|
25
|
+
├── CONVENTIONS.md ← quality focus (agent 3)
|
|
26
|
+
├── TESTING.md ← quality focus (agent 3)
|
|
27
|
+
└── CONCERNS.md ← concerns focus (agent 4)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Why this is cp-native
|
|
31
|
+
|
|
32
|
+
The work decomposes into 4 independent reads + 7 file writes. Every modern
|
|
33
|
+
agent harness has a native sub-agent dispatch (Copilot CLI's `task` tool,
|
|
34
|
+
Claude Code's Task tool, etc.) that does this faster than any provider could.
|
|
35
|
+
Delegating to a workflow skill would add latency and lose the parallelism.
|
|
36
|
+
|
|
37
|
+
## Step 1 — Parse flags
|
|
38
|
+
|
|
39
|
+
Parse `$ARGUMENTS`:
|
|
40
|
+
|
|
41
|
+
- `--force` — pass through to `cp scaffold-codebase --force` (overwrites stubs).
|
|
42
|
+
- `--fast [--focus <area>]` — single-agent scan mode. Spawn ONE agent for the
|
|
43
|
+
named focus (default `tech+arch`) instead of four. Useful for incremental
|
|
44
|
+
refreshes.
|
|
45
|
+
- No flags — full parallel map.
|
|
46
|
+
|
|
47
|
+
## Step 2 — Scaffold the stub files
|
|
48
|
+
|
|
49
|
+
Run the cp wrapper. This creates `.planning/codebase/` and seeds 7 stub
|
|
50
|
+
files from the templates. Idempotent — refuses to overwrite without `--force`.
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
cp scaffold-codebase
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If `cp codebase-status` shows files already exist with content, ask the user
|
|
57
|
+
whether to refresh (`--force`) or skip. **Never overwrite filled docs without
|
|
58
|
+
explicit confirmation.**
|
|
59
|
+
|
|
60
|
+
## Step 3 — Detect the host's sub-agent dispatch mechanism
|
|
61
|
+
|
|
62
|
+
Pick the right one for your runtime:
|
|
63
|
+
|
|
64
|
+
| Harness | Mechanism |
|
|
65
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
66
|
+
| Copilot CLI | `task` tool, `agent_type: "explore"` (Haiku) or `"general-purpose"`|
|
|
67
|
+
| Claude Code | Task tool with `subagent_type: "general-purpose"` |
|
|
68
|
+
| Cursor / others | Whatever native parallel-agent primitive exists |
|
|
69
|
+
|
|
70
|
+
If you cannot find a parallel sub-agent primitive: skip to **Fallback (inline
|
|
71
|
+
mode)** at the bottom of this command.
|
|
72
|
+
|
|
73
|
+
## Step 4 — Dispatch 4 parallel mapper agents
|
|
74
|
+
|
|
75
|
+
Spawn 4 agents IN PARALLEL (one tool-call block, all four invocations).
|
|
76
|
+
Each agent gets:
|
|
77
|
+
|
|
78
|
+
- A focus area (`tech` | `arch` | `quality` | `concerns`)
|
|
79
|
+
- The exact output file paths it owns
|
|
80
|
+
- The "be prescriptive, include file paths, current-state only" rules
|
|
81
|
+
|
|
82
|
+
### Agent 1 — tech focus
|
|
83
|
+
|
|
84
|
+
> You are a codebase mapper. Focus: **tech stack and external integrations**.
|
|
85
|
+
>
|
|
86
|
+
> Explore `{repo_root}` and write TWO files:
|
|
87
|
+
>
|
|
88
|
+
> 1. `.planning/codebase/STACK.md` — languages with versions (from manifest
|
|
89
|
+
> files), frameworks, top ~10 prod deps with purpose, dev tooling
|
|
90
|
+
> (build/test/lint/format with their npm/script commands), package manager
|
|
91
|
+
> and lockfile.
|
|
92
|
+
> 2. `.planning/codebase/INTEGRATIONS.md` — APIs called (endpoint + auth +
|
|
93
|
+
> calling file path), DBs / data stores, message queues, auth providers,
|
|
94
|
+
> CI/CD pipelines, secrets/env-var loading paths. NEVER paste secret values.
|
|
95
|
+
>
|
|
96
|
+
> Rules: always cite file paths in backticks (e.g. `src/db/client.ts`). Be
|
|
97
|
+
> prescriptive ("Use X") not descriptive ("X is used"). Describe current
|
|
98
|
+
> state only — no history, no alternatives considered. Replace the stub
|
|
99
|
+
> content entirely. Return only a one-line confirmation per file written.
|
|
100
|
+
|
|
101
|
+
### Agent 2 — arch focus
|
|
102
|
+
|
|
103
|
+
> You are a codebase mapper. Focus: **architecture and folder structure**.
|
|
104
|
+
>
|
|
105
|
+
> Explore `{repo_root}` and write TWO files:
|
|
106
|
+
>
|
|
107
|
+
> 1. `.planning/codebase/ARCHITECTURE.md` — architectural style (one paragraph),
|
|
108
|
+
> module boundaries (cite dirs), one end-to-end data-flow trace with file
|
|
109
|
+
> paths at each hop, key design patterns in use with file refs, cross-cutting
|
|
110
|
+
> concerns (logging/auth/caching/config/error handling) and where each lives,
|
|
111
|
+
> boundaries the executor must respect ("never import X from Y").
|
|
112
|
+
> 2. `.planning/codebase/STRUCTURE.md` — annotated top-level tree, per-folder
|
|
113
|
+
> responsibilities (what belongs / does not), "where do I put a NEW
|
|
114
|
+
> CLI subcommand / HTTP route / test / migration?", filename conventions,
|
|
115
|
+
> generated/vendored/ignored paths to never edit.
|
|
116
|
+
>
|
|
117
|
+
> Rules as above. Replace stubs entirely. Return only confirmations.
|
|
118
|
+
|
|
119
|
+
### Agent 3 — quality focus
|
|
120
|
+
|
|
121
|
+
> You are a codebase mapper. Focus: **code conventions and testing**.
|
|
122
|
+
>
|
|
123
|
+
> Explore `{repo_root}` and write TWO files:
|
|
124
|
+
>
|
|
125
|
+
> 1. `.planning/codebase/CONVENTIONS.md` — naming (functions/vars/types/files),
|
|
126
|
+
> import/export style with example file ref, error handling pattern, logging
|
|
127
|
+
> (logger choice, levels, init location), comment & docs style, formatting/
|
|
128
|
+
> linting (tool + config path + commands).
|
|
129
|
+
> 2. `.planning/codebase/TESTING.md` — test framework + version + all-tests
|
|
130
|
+
> and single-file commands, file layout (co-located vs mirror dir), naming
|
|
131
|
+
> pattern, AAA structure with one real example from the codebase, fixtures
|
|
132
|
+
> & mocks strategy, honest coverage picture, copy-pasteable run commands.
|
|
133
|
+
>
|
|
134
|
+
> Rules as above. Replace stubs entirely. Return only confirmations.
|
|
135
|
+
|
|
136
|
+
### Agent 4 — concerns focus
|
|
137
|
+
|
|
138
|
+
> You are a codebase mapper. Focus: **technical debt and risk**.
|
|
139
|
+
>
|
|
140
|
+
> Explore `{repo_root}` and write ONE file:
|
|
141
|
+
>
|
|
142
|
+
> 1. `.planning/codebase/CONCERNS.md` — issues bucketed Critical / High /
|
|
143
|
+
> Medium / Low. For each: file path + line range + symptom + fix approach.
|
|
144
|
+
> Plus a "Workarounds & gotchas" section ("if you change X, also update Y")
|
|
145
|
+
> and an "Areas that look safe to touch" section for low-risk regions with
|
|
146
|
+
> good test coverage.
|
|
147
|
+
>
|
|
148
|
+
> Rules: be specific — vague concerns are not actionable. Replace stub entirely.
|
|
149
|
+
> Return only a confirmation.
|
|
150
|
+
|
|
151
|
+
## Step 5 — Verify and commit
|
|
152
|
+
|
|
153
|
+
Once all four agents complete:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
cp codebase-status
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Confirm every row shows `filled`, not `stub`. If any still look like stubs,
|
|
160
|
+
ask the user whether to redispatch the matching agent.
|
|
161
|
+
|
|
162
|
+
Then commit:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
git add .planning/codebase/
|
|
166
|
+
git commit -m "cp: map-codebase (7 docs)"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Step 6 — Report
|
|
170
|
+
|
|
171
|
+
Print:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
✓ Codebase mapped → .planning/codebase/ (7 docs, N total lines)
|
|
175
|
+
Focus areas: tech ✓ arch ✓ quality ✓ concerns ✓
|
|
176
|
+
Next: cp init (for brownfield first-time setup)
|
|
177
|
+
/cp-plan-phase N (to start using the new context)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## --fast mode
|
|
181
|
+
|
|
182
|
+
When `--fast` is in `$ARGUMENTS`: spawn only ONE agent, with the focus area
|
|
183
|
+
from `--focus` (default `tech+arch`, meaning it writes 4 files: STACK,
|
|
184
|
+
INTEGRATIONS, ARCHITECTURE, STRUCTURE). Same prompt style, just sequential
|
|
185
|
+
rather than 4-way parallel. Useful for quick refreshes after small changes.
|
|
186
|
+
|
|
187
|
+
## Fallback (inline mode, no sub-agent dispatch available)
|
|
188
|
+
|
|
189
|
+
If the harness has no parallel sub-agent primitive, do the work inline:
|
|
190
|
+
|
|
191
|
+
1. Run `cp scaffold-codebase`.
|
|
192
|
+
2. For each of the 4 focus areas in sequence, do an exploration pass (read
|
|
193
|
+
manifest files, glob for representative source files, sample 5–10 each)
|
|
194
|
+
and rewrite the corresponding doc(s) in place.
|
|
195
|
+
3. Run `cp codebase-status` to verify, then commit.
|
|
196
|
+
|
|
197
|
+
This is slower and consumes more context (no offloading), but produces the
|
|
198
|
+
same output.
|
|
199
|
+
|
|
200
|
+
## Notes
|
|
201
|
+
|
|
202
|
+
- **No provider involved.** `cp doctor` will not show a `codebase_mapper`
|
|
203
|
+
role — that's correct; this command is built into cp.
|
|
204
|
+
- **Stub markers:** the templates contain `fill via \`/cp-map-codebase\``
|
|
205
|
+
comments and an HTML comment per section explaining what to include.
|
|
206
|
+
Mapper agents should DELETE those markers when writing real content (so
|
|
207
|
+
`cp codebase-status` correctly reports `filled`).
|
|
208
|
+
- **Brownfield bootstrap:** the recommended order for an existing project is
|
|
209
|
+
`cp scaffold-codebase` → `/cp-map-codebase` → `cp init`. The map gives
|
|
210
|
+
`cp init` real context to ground PROJECT.md against.
|
|
211
|
+
- **Re-run any time** the codebase changes materially: `/cp-map-codebase --force`.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-new-milestone
|
|
3
|
+
description: Start a new milestone on an existing cp project — gather goals, break into phases, update PROJECT.md/ROADMAP.md/STATE.md.
|
|
4
|
+
argument-hint: "<milestone name, e.g. 'v1.1 Notifications'>"
|
|
5
|
+
requires: [cp-plan-phase, cp-execute-phase]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-new-milestone
|
|
9
|
+
|
|
10
|
+
You are running `cp-new-milestone`. The project already exists. Your job is
|
|
11
|
+
to add a new milestone on top — gather its goals (delegated to the provider's
|
|
12
|
+
brainstorm skill), break it into phases, and update the state layer.
|
|
13
|
+
|
|
14
|
+
## TL;DR — use the v0.3 `cp` CLI wrapper
|
|
15
|
+
|
|
16
|
+
After brainstorming the milestone name + goals with the user (Steps 1–3
|
|
17
|
+
below), you can produce the ROADMAP shape the parser expects with a single
|
|
18
|
+
shell call instead of hand-editing `## Phases`:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
cp scaffold-milestone "v1.1 Notifications"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Output:
|
|
25
|
+
```
|
|
26
|
+
✓ .planning/ROADMAP.md
|
|
27
|
+
Milestone: v1.1 Notifications [in-progress]
|
|
28
|
+
committed <hash>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This appends `### 🚧 v1.1 Notifications (In Progress)` inside `## Phases` and
|
|
32
|
+
auto-commits. Refuses if a milestone of that name already exists. Use
|
|
33
|
+
`--planned` for `### 📋 ... (Planned)` if you're queueing milestones rather
|
|
34
|
+
than starting one now. Use `--dry-run` to preview without writing.
|
|
35
|
+
|
|
36
|
+
Then for each phase the brainstorm identified, call `cp scaffold-phase`
|
|
37
|
+
(see `/cp-plan-phase` for details) — no need to hand-edit ROADMAP anywhere.
|
|
38
|
+
|
|
39
|
+
## Step 1 — Validate state
|
|
40
|
+
|
|
41
|
+
- Read `.planning/PROJECT.md`. If it doesn't exist, stop and tell the user to
|
|
42
|
+
run `/cp-new-project` first.
|
|
43
|
+
- Read `.planning/ROADMAP.md`, `.planning/STATE.md`.
|
|
44
|
+
- Run `npx cp doctor` and note which provider/skills are available.
|
|
45
|
+
|
|
46
|
+
## Step 2 — Get milestone name and intent
|
|
47
|
+
|
|
48
|
+
- Milestone name comes from `$ARGUMENTS`. If empty, ask the user for it.
|
|
49
|
+
- Briefly summarise what shipped previously (read the most recent
|
|
50
|
+
`### Phase N: ...` entries with all plans checked, or the last `<details>`
|
|
51
|
+
block in ROADMAP.md).
|
|
52
|
+
|
|
53
|
+
## Step 3 — Delegate brainstorming
|
|
54
|
+
|
|
55
|
+
Invoke the provider's `brainstorm` skill (e.g. Superpowers' `brainstorming`),
|
|
56
|
+
passing the milestone name + the user's stated intent + a short summary of
|
|
57
|
+
the project context (Core Value, last 3 validated requirements).
|
|
58
|
+
|
|
59
|
+
Goal of the brainstorm: a clear, scoped specification for the milestone.
|
|
60
|
+
|
|
61
|
+
**v0.7 design-capture (TWO destinations):**
|
|
62
|
+
1. Save the FULL brainstorm transcript (verbatim Q&A) to
|
|
63
|
+
`.planning/MILESTONE-CONTEXT.md`. This is the unedited working file.
|
|
64
|
+
2. Save the structured ADR summary (Status / Context / Decision /
|
|
65
|
+
Consequences / Architecture / etc.) to
|
|
66
|
+
`.planning/milestones/<slug>/DESIGN.md`. `cp scaffold-milestone`
|
|
67
|
+
already created the empty template — SP brainstorming overwrites it
|
|
68
|
+
with the populated version using its `path:` override parameter.
|
|
69
|
+
|
|
70
|
+
At `cp complete-milestone`, MILESTONE-CONTEXT.md is automatically
|
|
71
|
+
promoted into the milestone DESIGN.md as a "Brainstorm transcript"
|
|
72
|
+
appendix and the transient file is deleted.
|
|
73
|
+
|
|
74
|
+
## Step 4 — Update PROJECT.md
|
|
75
|
+
|
|
76
|
+
- Move any newly-completed requirements from Active to Validated.
|
|
77
|
+
- Add this milestone's new requirements to Active.
|
|
78
|
+
- Update "Last updated" line to `today — added {milestone name}`.
|
|
79
|
+
|
|
80
|
+
Show the diff, confirm with the user, write.
|
|
81
|
+
|
|
82
|
+
## Step 5 — Break into phases
|
|
83
|
+
|
|
84
|
+
Propose 2–6 phases for this milestone based on the spec. For each:
|
|
85
|
+
|
|
86
|
+
- Continue phase numbering from the highest existing phase (DON'T restart at 1).
|
|
87
|
+
- Heading: `### Phase N: {Name}`
|
|
88
|
+
- Goal, Depends on, Success Criteria, plans list (start with 1 plan each).
|
|
89
|
+
|
|
90
|
+
Confirm with the user, then append each phase block to `.planning/ROADMAP.md`.
|
|
91
|
+
|
|
92
|
+
**Preferred (v0.3)** — for each phase, call:
|
|
93
|
+
```
|
|
94
|
+
cp scaffold-phase {N} --name "{phase name}" --plans {initial-plan-count}
|
|
95
|
+
```
|
|
96
|
+
This inserts `### Phase N: {name}` under the active milestone, creates
|
|
97
|
+
`.planning/phases/{NN-slug}/PLAN.md` from the phase-PLAN template, and
|
|
98
|
+
auto-commits. Pre-fills `- [ ] NN-MM: TBD` checkboxes for the requested
|
|
99
|
+
plan count. Refuses if the phase number already exists.
|
|
100
|
+
|
|
101
|
+
**Fallback (manual)** — if `cp` CLI is unavailable, edit ROADMAP.md by hand
|
|
102
|
+
using `lib/roadmap.appendPhaseBlock`. Then rebuild the Progress table.
|
|
103
|
+
|
|
104
|
+
Skip the "milestone bullet under `## Milestones`" step — the v0.3 template
|
|
105
|
+
no longer has that section; the H3 milestone heading inside `## Phases` is
|
|
106
|
+
the source of truth.
|
|
107
|
+
|
|
108
|
+
## Step 6 — Update STATE.md
|
|
109
|
+
|
|
110
|
+
- `Phase:` = the first new phase number of this milestone
|
|
111
|
+
- `Plan:` = 1 of {plan count}
|
|
112
|
+
- `Status:` = `Ready to plan`
|
|
113
|
+
- `Current focus:` = first new phase name
|
|
114
|
+
- `Last activity:` = `today — started milestone {name}`
|
|
115
|
+
|
|
116
|
+
## Step 7 — Commit and report
|
|
117
|
+
|
|
118
|
+
If `cp.behavior.atomic_commits` is true and we're in a git repo:
|
|
119
|
+
```
|
|
120
|
+
cp: start milestone {name} (phases X-Y)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Print:
|
|
124
|
+
```
|
|
125
|
+
✓ Milestone "{name}" planned.
|
|
126
|
+
Phases: X-Y
|
|
127
|
+
Spec: .planning/MILESTONE-CONTEXT.md
|
|
128
|
+
Next: /cp-plan-phase X
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Notes
|
|
132
|
+
|
|
133
|
+
- The user should be able to interrupt and refine at any step.
|
|
134
|
+
- Never write to ROADMAP/PROJECT before showing the proposed changes.
|
|
135
|
+
- If the provider's brainstorm skill is unavailable, fall back to inline
|
|
136
|
+
Socratic questioning — but warn the user once.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-new-project
|
|
3
|
+
description: Initialise a new context-planning project — scaffold .planning/, fill PROJECT.md via the provider's brainstorm skill, then create a first milestone + phase breakdown.
|
|
4
|
+
argument-hint: "[project description, optional]"
|
|
5
|
+
requires: [cp-new-milestone, cp-plan-phase]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-new-project
|
|
9
|
+
|
|
10
|
+
You are running the `cp-new-project` command. Your job is to set up a fresh
|
|
11
|
+
`.planning/` directory in the user's repo and use the configured workflow
|
|
12
|
+
provider to fill in PROJECT.md and break the work into a first set of phases.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Initialise the state layer
|
|
15
|
+
|
|
16
|
+
Run:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx cp init
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This is idempotent. It creates:
|
|
23
|
+
|
|
24
|
+
- `.planning/PROJECT.md` (template — empty)
|
|
25
|
+
- `.planning/ROADMAP.md` (template — single placeholder phase)
|
|
26
|
+
- `.planning/STATE.md` (template — position = pre-planning)
|
|
27
|
+
- `.planning/cp-config.json` (default provider: superpowers)
|
|
28
|
+
- `.planning/phases/`, `.planning/quick/`
|
|
29
|
+
|
|
30
|
+
Report what was created vs kept.
|
|
31
|
+
|
|
32
|
+
## Step 2 — Resolve the workflow provider
|
|
33
|
+
|
|
34
|
+
Run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx cp doctor
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Read the output. Identify:
|
|
41
|
+
|
|
42
|
+
- `Provider:` line — which provider is configured (default: `superpowers`).
|
|
43
|
+
- For role `brainstorm`, is the skill installed? (✓ or ✗)
|
|
44
|
+
|
|
45
|
+
**If the brainstorm skill is missing AND the user has a way to install it,**
|
|
46
|
+
print a one-line note recommending they install the provider and continue.
|
|
47
|
+
Don't block.
|
|
48
|
+
|
|
49
|
+
## Step 3 — Delegate to the brainstorm skill
|
|
50
|
+
|
|
51
|
+
Hand off to the provider's `brainstorm` skill.
|
|
52
|
+
|
|
53
|
+
For Superpowers users, that means invoking the `brainstorming` skill: explain
|
|
54
|
+
to the user that you're going to refine the design through questions before
|
|
55
|
+
writing any code, then run the skill's workflow with `$ARGUMENTS` (the
|
|
56
|
+
project description) as seed.
|
|
57
|
+
|
|
58
|
+
If the provider is `manual` (no real skill available), inline a minimal
|
|
59
|
+
brainstorm:
|
|
60
|
+
|
|
61
|
+
> Ask the user, one question at a time, until you have enough to fill the
|
|
62
|
+
> PROJECT.md sections (What This Is, Core Value, Active Requirements, Out of
|
|
63
|
+
> Scope, Constraints). Always confirm before writing.
|
|
64
|
+
|
|
65
|
+
## Step 4 — Write PROJECT.md
|
|
66
|
+
|
|
67
|
+
When the brainstorming skill returns the design (or the manual flow gathers
|
|
68
|
+
enough info), populate `.planning/PROJECT.md`:
|
|
69
|
+
|
|
70
|
+
- **What This Is** — 2-3 sentences in the user's words
|
|
71
|
+
- **Core Value** — the ONE thing that matters
|
|
72
|
+
- **Active Requirements** — `- [ ] {requirement}` bullets
|
|
73
|
+
- **Out of Scope** — explicit exclusions with reasoning
|
|
74
|
+
- **Constraints** — `- **{Type}**: {what} — {why}`
|
|
75
|
+
- **Key Decisions** — initial table (can be empty)
|
|
76
|
+
|
|
77
|
+
Show the user the proposed PROJECT.md (or the key sections) and confirm
|
|
78
|
+
before writing.
|
|
79
|
+
|
|
80
|
+
## Step 5 — Decide the first milestone + phase breakdown
|
|
81
|
+
|
|
82
|
+
Propose **1 milestone** and **3–6 phases** based on the requirements.
|
|
83
|
+
For each phase write:
|
|
84
|
+
|
|
85
|
+
- `### Phase N: {Name}` heading
|
|
86
|
+
- `**Goal**:` one line
|
|
87
|
+
- `**Depends on**:` previous phase or "Nothing"
|
|
88
|
+
- `**Success Criteria**:` 2-5 observable behaviors
|
|
89
|
+
- Plans list: `- [ ] NN-01: {brief}` (start with 1 plan per phase; we
|
|
90
|
+
refine in /cp-plan-phase)
|
|
91
|
+
|
|
92
|
+
Show the user the proposed roadmap and confirm.
|
|
93
|
+
|
|
94
|
+
Then update `.planning/ROADMAP.md`:
|
|
95
|
+
|
|
96
|
+
- Replace the placeholder milestone heading with the real milestone
|
|
97
|
+
- Replace the placeholder phase block with the real phase blocks
|
|
98
|
+
- Rebuild the Progress table (`require('context-planning/lib/roadmap').rebuildProgressTable`)
|
|
99
|
+
|
|
100
|
+
## Step 6 — Update STATE.md and commit
|
|
101
|
+
|
|
102
|
+
- Set `Phase: 1 of N`, `Plan: 1 of {phase1 plan count}`, `Status: Ready to plan`
|
|
103
|
+
- Set `Current focus:` to phase 1 name
|
|
104
|
+
- Set `Last activity:` to `today — initialised project`
|
|
105
|
+
- Update `Last session` and `Stopped at` in Session Continuity
|
|
106
|
+
|
|
107
|
+
If `cp.behavior.atomic_commits` is `true` in `.planning/config.json` and
|
|
108
|
+
we're in a git repo, commit with:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
cp: init project state for {project name}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Step 7 — Tell the user what's next
|
|
115
|
+
|
|
116
|
+
Print:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
✓ Project initialised.
|
|
120
|
+
Phase 1: {name} — {N} plans
|
|
121
|
+
Next: /cp-plan-phase 1
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Notes
|
|
125
|
+
|
|
126
|
+
- Never invent requirements the user didn't agree to.
|
|
127
|
+
- Confirm before writing each major file.
|
|
128
|
+
- Read `.planning/config.json` (the merged GSD+cp config) for the provider
|
|
129
|
+
mapping. cp-specific keys live under `cp.*`. Don't hard-code `superpowers`
|
|
130
|
+
skill names.
|
|
131
|
+
- If `.planning/PROJECT.md` already exists with real content (not the
|
|
132
|
+
placeholder), stop and tell the user to run `/cp-new-milestone` instead.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cp-plan-phase
|
|
3
|
+
description: Create the phase directory and PLAN.md for phase N by delegating to the provider's plan skill.
|
|
4
|
+
argument-hint: "<phase number, e.g. 1 or 2.1>"
|
|
5
|
+
requires: [cp-execute-phase]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /cp-plan-phase
|
|
9
|
+
|
|
10
|
+
You are running `cp-plan-phase`. Your job is to take a phase that exists in
|
|
11
|
+
ROADMAP.md and turn it into a concrete `PLAN.md` ready for execution.
|
|
12
|
+
|
|
13
|
+
## TL;DR — use the v0.3 `cp` CLI wrapper
|
|
14
|
+
|
|
15
|
+
If the phase doesn't yet exist in ROADMAP (e.g. the user jumped here from
|
|
16
|
+
`/cp-new-milestone` without scaffolding the phases yet), create the phase
|
|
17
|
+
shell first:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
cp scaffold-phase {N} --name "{phase name}" --plans {initial-plan-count}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Output:
|
|
24
|
+
```
|
|
25
|
+
✓ .planning/ROADMAP.md
|
|
26
|
+
✓ .planning/phases/{NN-slug}/PLAN.md
|
|
27
|
+
Phase {N} added to milestone "{active milestone}" ({M} plans: {NN-01}, ...)
|
|
28
|
+
committed <hash>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The wrapper inserts the `### Phase N: {name}` heading under the active
|
|
32
|
+
milestone in ROADMAP, creates `.planning/phases/{NN-slug}/PLAN.md` from the
|
|
33
|
+
`templates/phase-PLAN.md` template, pre-fills `- [ ] NN-MM: TBD` checkboxes
|
|
34
|
+
for the requested plan count, and auto-commits. Use `--dry-run` to preview,
|
|
35
|
+
`--milestone <name>` to target a non-active milestone, `--no-commit` to skip
|
|
36
|
+
the commit.
|
|
37
|
+
|
|
38
|
+
After the wrapper runs (or if the phase already exists), proceed below to
|
|
39
|
+
fill in the per-plan details (objectives, tasks, success criteria) by
|
|
40
|
+
delegating to the provider's plan skill.
|
|
41
|
+
|
|
42
|
+
## Step 1 — Resolve the phase
|
|
43
|
+
|
|
44
|
+
- `PHASE_NUM` = `$ARGUMENTS` (sanitize: must match `^[\d]+(\.\d+)?$`).
|
|
45
|
+
- Read `.planning/ROADMAP.md`. Find the matching `### Phase {PHASE_NUM}: {Name}`
|
|
46
|
+
block. Extract:
|
|
47
|
+
- phase name
|
|
48
|
+
- goal
|
|
49
|
+
- success criteria
|
|
50
|
+
- requirements (the `**Requirements**:` line)
|
|
51
|
+
- planned plans list
|
|
52
|
+
- If not found, stop and tell the user to add it first via `/cp-new-milestone`
|
|
53
|
+
or by editing ROADMAP.md.
|
|
54
|
+
|
|
55
|
+
## Step 2 — Create the phase directory and PLAN file
|
|
56
|
+
|
|
57
|
+
Use the cp helpers (`require('context-planning/lib/paths')`) to derive
|
|
58
|
+
GSD-compatible filenames:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
phaseDirName(N, name) -> "01-foundation" (zero-padded; decimals kept as-is)
|
|
62
|
+
phasePlanPrefix(N, planN) -> "01-01"
|
|
63
|
+
planFile(N, name, planN) -> ".planning/phases/01-foundation/01-01-PLAN.md"
|
|
64
|
+
summaryFile(...) -> ".planning/phases/01-foundation/01-01-SUMMARY.md"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Create the dir if missing. For each planned plan in the ROADMAP, create the
|
|
68
|
+
stub PLAN file from `templates/PLAN.md`, substituting:
|
|
69
|
+
|
|
70
|
+
- `{{PHASE_DIR}}` — e.g. `01-foundation`
|
|
71
|
+
- `{{PLAN_NUM_PADDED}}` — e.g. `01`
|
|
72
|
+
- `{{PHASE_PLAN_PREFIX}}` — e.g. `01-01`
|
|
73
|
+
- `{{WAVE}}` — `1` initially; the plan skill or a future
|
|
74
|
+
parallelization pass can update it
|
|
75
|
+
- `{{OBJECTIVE}}`, `{{PURPOSE}}`, `{{OUTPUT}}` — derived from the ROADMAP
|
|
76
|
+
goal + this plan's brief description
|
|
77
|
+
- `{{PROVIDER}}`, `{{PLAN_SKILL}}` — from `cp doctor`
|
|
78
|
+
|
|
79
|
+
PLAN frontmatter is GSD-shaped:
|
|
80
|
+
```
|
|
81
|
+
phase: 01-foundation
|
|
82
|
+
plan: 01
|
|
83
|
+
type: execute
|
|
84
|
+
wave: 1
|
|
85
|
+
depends_on: []
|
|
86
|
+
files_modified: []
|
|
87
|
+
autonomous: true
|
|
88
|
+
requirements: [REQ-01, REQ-02] # populate from ROADMAP **Requirements**: line
|
|
89
|
+
user_setup: []
|
|
90
|
+
must_haves:
|
|
91
|
+
truths: []
|
|
92
|
+
artifacts: []
|
|
93
|
+
key_links: []
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `<tasks>` block stays empty for the plan skill to fill in (see Step 4).
|
|
97
|
+
|
|
98
|
+
## Step 3 — Resolve the plan skill
|
|
99
|
+
|
|
100
|
+
Run `npx cp doctor`. Find the `plan` role's resolved provider + skill.
|
|
101
|
+
|
|
102
|
+
- If installed (default: Superpowers' `writing-plans`): invoke it.
|
|
103
|
+
- If `manual`: warn the user the provider's plan skill is missing, then fall
|
|
104
|
+
back to inline plan-writing — ask the user about each task, scope, success.
|
|
105
|
+
|
|
106
|
+
## Step 3.5 — Delegate to brainstorming for DESIGN.md (v0.7)
|
|
107
|
+
|
|
108
|
+
Before invoking the plan skill, invoke the provider's `brainstorm` skill
|
|
109
|
+
to fill in the phase-tier DESIGN.md.
|
|
110
|
+
|
|
111
|
+
- `cp scaffold-phase` already created an empty template at
|
|
112
|
+
`.planning/phases/{phase-dir}/DESIGN.md`.
|
|
113
|
+
- Pass to the brainstorm skill:
|
|
114
|
+
- The phase Goal, Success Criteria, and Requirements (from ROADMAP.md)
|
|
115
|
+
- The milestone DESIGN.md at `.planning/milestones/<slug>/DESIGN.md` as
|
|
116
|
+
context (so the phase design stays consistent with the milestone)
|
|
117
|
+
- A `path:` override pointing to
|
|
118
|
+
`.planning/phases/{phase-dir}/DESIGN.md` so SP writes there directly
|
|
119
|
+
instead of `docs/superpowers/specs/...`
|
|
120
|
+
- Do NOT touch frontmatter keys cp populated (`phase`, `milestone`,
|
|
121
|
+
`status`, `created`). SP fills in Status, Context, Decision,
|
|
122
|
+
Consequences, Architecture, Components, Data Flow, Error Handling,
|
|
123
|
+
Testing Strategy, Alternatives Considered, Open Questions, References.
|
|
124
|
+
|
|
125
|
+
If the brainstorm skill is unavailable (provider = manual), skip this
|
|
126
|
+
step — DESIGN.md stays empty and the user can fill it later.
|
|
127
|
+
|
|
128
|
+
The DESIGN.md becomes a context input to the plan skill in Step 4.
|
|
129
|
+
|
|
130
|
+
## Step 4 — Delegate to the plan skill
|
|
131
|
+
|
|
132
|
+
Pass to the plan skill:
|
|
133
|
+
- The phase DESIGN.md at `.planning/phases/{phase-dir}/DESIGN.md` (v0.7)
|
|
134
|
+
as the architectural source-of-truth; plan tasks should align with the
|
|
135
|
+
Decision and Components sections.
|
|
136
|
+
- The phase Goal and Success Criteria (verbatim from ROADMAP.md)
|
|
137
|
+
- The Requirements list (from ROADMAP's `**Requirements**:` line)
|
|
138
|
+
- The Context block from PROJECT.md (Core Value, related Active requirements)
|
|
139
|
+
- A pointer to write the resulting plan into the GSD-shaped file
|
|
140
|
+
`.planning/phases/{phase-dir}/{phase}-{plan}-PLAN.md` — replacing the
|
|
141
|
+
`<tasks>` block. **Do not rename the file.** Do not touch frontmatter
|
|
142
|
+
keys cp populated (phase, plan, type, wave, depends_on, requirements);
|
|
143
|
+
the skill MAY append/refine `files_modified`, `must_haves.*`, and
|
|
144
|
+
`autonomous` once it has decomposed the work.
|
|
145
|
+
- The instruction that each task should be 2-5 minutes, file-scoped, with a
|
|
146
|
+
clear verification step (per Superpowers' writing-plans conventions), and
|
|
147
|
+
each task expressed as a `<task type="auto">...</task>` block (GSD shape).
|
|
148
|
+
|
|
149
|
+
The plan skill is expected to populate the `<tasks>` section of PLAN.md with
|
|
150
|
+
one `<task>` block per actionable step.
|
|
151
|
+
|
|
152
|
+
## Step 5 — Reconcile with ROADMAP.md plans list
|
|
153
|
+
|
|
154
|
+
After the plan skill returns:
|
|
155
|
+
|
|
156
|
+
- Count `<task type="auto">` blocks in the new PLAN.md.
|
|
157
|
+
- If the count differs from the plans listed in ROADMAP.md for this phase,
|
|
158
|
+
show the user and ask whether to:
|
|
159
|
+
(a) keep the original ROADMAP plan count (let PLAN.md just decompose
|
|
160
|
+
each into sub-tasks), or
|
|
161
|
+
(b) replace the ROADMAP plans list with one entry per task in PLAN.md.
|
|
162
|
+
|
|
163
|
+
Default to (a). The plans list in ROADMAP.md is the COARSE checklist;
|
|
164
|
+
PLAN.md is the fine detail.
|
|
165
|
+
|
|
166
|
+
## Step 6 — Update STATE.md
|
|
167
|
+
|
|
168
|
+
- `Plan:` = `1 of {plan count}`
|
|
169
|
+
- `Status:` = `Ready to execute`
|
|
170
|
+
- `Last activity:` = `today — planned phase {N}`
|
|
171
|
+
|
|
172
|
+
## Step 7 — Commit and report
|
|
173
|
+
|
|
174
|
+
If `cp.behavior.atomic_commits` is true:
|
|
175
|
+
```
|
|
176
|
+
cp: plan phase {N} ({phase name})
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Print:
|
|
180
|
+
```
|
|
181
|
+
✓ Phase {N} planned: {phase name}
|
|
182
|
+
Tasks: {count}
|
|
183
|
+
File: .planning/phases/{phase-dir}/{phase}-{plan}-PLAN.md
|
|
184
|
+
Next: /cp-execute-phase {N}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Notes
|
|
188
|
+
|
|
189
|
+
- The plan skill OWNS the content of PLAN.md's `<tasks>` block.
|
|
190
|
+
- Don't second-guess the plan skill's output — it's the workflow provider's
|
|
191
|
+
area of expertise.
|
|
192
|
+
- If the user wants to tweak the plan, let them edit PLAN.md directly and
|
|
193
|
+
re-invoke `/cp-execute-phase`.
|
|
194
|
+
- Filenames follow GSD convention: `{phase}-{plan}-PLAN.md` so a GSD
|
|
195
|
+
workflow can read and continue from the same file.
|