pan-wizard 3.26.0 → 3.27.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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/commands/pan/hygiene.md +14 -8
  3. package/commands/pan/milestone-audit.md +10 -4
  4. package/hooks/dist/pan-cost-logger.js +69 -5
  5. package/hooks/dist/pan-stop-guard.js +32 -1
  6. package/hooks/dist/pan-trace-logger.js +35 -2
  7. package/package.json +1 -1
  8. package/pan-wizard-core/bin/lib/bridge.cjs +0 -1
  9. package/pan-wizard-core/bin/lib/bus.cjs +0 -1
  10. package/pan-wizard-core/bin/lib/campaign.cjs +3 -2
  11. package/pan-wizard-core/bin/lib/commands-learnings.cjs +8 -8
  12. package/pan-wizard-core/bin/lib/commands.cjs +15 -14
  13. package/pan-wizard-core/bin/lib/config.cjs +5 -5
  14. package/pan-wizard-core/bin/lib/constants.cjs +27 -0
  15. package/pan-wizard-core/bin/lib/context-budget.cjs +28 -0
  16. package/pan-wizard-core/bin/lib/core.cjs +190 -26
  17. package/pan-wizard-core/bin/lib/cost.cjs +0 -1
  18. package/pan-wizard-core/bin/lib/distill.cjs +3 -3
  19. package/pan-wizard-core/bin/lib/focus.cjs +16 -16
  20. package/pan-wizard-core/bin/lib/hud.cjs +1 -1
  21. package/pan-wizard-core/bin/lib/hygiene.cjs +397 -37
  22. package/pan-wizard-core/bin/lib/init.cjs +90 -13
  23. package/pan-wizard-core/bin/lib/knowledge.cjs +0 -1
  24. package/pan-wizard-core/bin/lib/memory.cjs +1 -1
  25. package/pan-wizard-core/bin/lib/milestone.cjs +3 -3
  26. package/pan-wizard-core/bin/lib/optimize.cjs +3 -3
  27. package/pan-wizard-core/bin/lib/phase.cjs +4 -4
  28. package/pan-wizard-core/bin/lib/planning-root.cjs +327 -0
  29. package/pan-wizard-core/bin/lib/preview.cjs +0 -1
  30. package/pan-wizard-core/bin/lib/review-deep.cjs +0 -1
  31. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -1
  32. package/pan-wizard-core/bin/lib/state-compact.cjs +339 -0
  33. package/pan-wizard-core/bin/lib/state.cjs +0 -1
  34. package/pan-wizard-core/bin/lib/template.cjs +1 -1
  35. package/pan-wizard-core/bin/lib/utils.cjs +39 -11
  36. package/pan-wizard-core/bin/lib/verify.cjs +4 -3
  37. package/pan-wizard-core/bin/lib/whatif.cjs +0 -1
  38. package/pan-wizard-core/bin/pan-tools.cjs +58 -4
  39. package/pan-wizard-core/workflows/milestone-audit.md +35 -6
@@ -16,6 +16,35 @@ INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init milestone-op)
16
16
 
17
17
  Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`.
18
18
 
19
+ **Also extract `planning_root` and `track`, and use `$PLANNING_ROOT` for every planning path in this workflow** — the project may hold several planning trees, and auditing the wrong one produces a confident, plausible, wrong report:
20
+
21
+ ```bash
22
+ PLANNING_ROOT=$(printf '%s' "$INIT" | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).planning_root))")
23
+ ```
24
+
25
+ ### 0a. Which tree am I auditing?
26
+
27
+ **Always state the resolved `planning_root` at the top of the audit report.** If `planning_root_exists` is `false`, STOP — that is a mistyped `--track`, not an empty milestone.
28
+
29
+ To audit a specific tree, pass `--track <name>`. To see every tree's milestone state before choosing:
30
+
31
+ ```bash
32
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init milestone-op --all-tracks
33
+ ```
34
+
35
+ That returns `{track_count, ambiguous_tracks, tracks[]}`, one entry per planning tree, each with its own `planning_root`, `milestone_version`, `milestone_name`, and `milestone_basis`.
36
+
37
+ ### 0b. Refuse to audit an unresolvable milestone
38
+
39
+ The init payload carries how the milestone was decided:
40
+
41
+ - `milestone_basis` — `marked-current` (a `(current)` / 🚧 marker), `first-unshipped`, `last-shipped`, or `default`
42
+ - `milestone_ambiguous` — **`true` means the roadmap marks more than one milestone current**
43
+
44
+ **If `milestone_ambiguous` is `true`, STOP and report the planning-state error.** Do not audit. Two milestones marked current is a roadmap defect the owner must resolve; picking one silently is how an audit ends up describing a milestone that does not exist.
45
+
46
+ If `milestone_basis` is `default`, there is no milestone heading in the roadmap at all — say so rather than auditing `v1.0 milestone`.
47
+
19
48
  Resolve integration checker model:
20
49
  ```bash
21
50
  CHECKER_MODEL=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-integration-checker --raw)
@@ -103,7 +132,7 @@ For each phase's verification.md, extract the expanded requirements table:
103
132
 
104
133
  For each phase's summary.md, extract `requirements-completed` from YAML frontmatter:
105
134
  ```bash
106
- for summary in .planning/phases/*-*/*-summary.md; do
135
+ for summary in "$PLANNING_ROOT"/phases/*-*/*-summary.md; do
107
136
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields requirements_completed | jq -r '.requirements_completed'
108
137
  done
109
138
  ```
@@ -129,7 +158,7 @@ For each REQ-ID, determine status using all three sources:
129
158
 
130
159
  ## 6. Aggregate into v{version}-milestone-audit.md
131
160
 
132
- Create `.planning/v{version}-milestone-audit.md` with:
161
+ Create `{planning_root}/v{version}-milestone-audit.md` with:
133
162
 
134
163
  ```yaml
135
164
  ---
@@ -186,7 +215,7 @@ Output this markdown directly (not as a code block). Route based on status:
186
215
  ## ✓ Milestone {version} — Audit Passed
187
216
 
188
217
  **Score:** {N}/{M} requirements satisfied
189
- **Report:** .planning/v{version}-milestone-audit.md
218
+ **Report:** {planning_root}/v{version}-milestone-audit.md
190
219
 
191
220
  All requirements covered. Cross-phase integration verified. E2E flows complete.
192
221
 
@@ -209,7 +238,7 @@ All requirements covered. Cross-phase integration verified. E2E flows complete.
209
238
  ## ⚠ Milestone {version} — Gaps Found
210
239
 
211
240
  **Score:** {N}/{M} requirements satisfied
212
- **Report:** .planning/v{version}-milestone-audit.md
241
+ **Report:** {planning_root}/v{version}-milestone-audit.md
213
242
 
214
243
  ### Unsatisfied Requirements
215
244
 
@@ -240,7 +269,7 @@ All requirements covered. Cross-phase integration verified. E2E flows complete.
240
269
  ───────────────────────────────────────────────────────────────
241
270
 
242
271
  **Also available:**
243
- - cat .planning/v{version}-milestone-audit.md — see full report
272
+ - cat {planning_root}/v{version}-milestone-audit.md — see full report
244
273
  - /pan:milestone-done {version} — proceed anyway (accept tech debt)
245
274
 
246
275
  ───────────────────────────────────────────────────────────────
@@ -252,7 +281,7 @@ All requirements covered. Cross-phase integration verified. E2E flows complete.
252
281
  ## ⚡ Milestone {version} — Tech Debt Review
253
282
 
254
283
  **Score:** {N}/{M} requirements satisfied
255
- **Report:** .planning/v{version}-milestone-audit.md
284
+ **Report:** {planning_root}/v{version}-milestone-audit.md
256
285
 
257
286
  All requirements met. No critical blockers. Accumulated tech debt needs review.
258
287