cleargate 0.8.2 → 0.11.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 (122) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/README.md +22 -1
  3. package/dist/MANIFEST.json +276 -31
  4. package/dist/chunk-HZPJ5QX4.js +459 -0
  5. package/dist/chunk-HZPJ5QX4.js.map +1 -0
  6. package/dist/{chunk-OM4FAEA7.js → chunk-Q3BTSXCK.js} +69 -3
  7. package/dist/chunk-Q3BTSXCK.js.map +1 -0
  8. package/dist/cli.cjs +2888 -598
  9. package/dist/cli.cjs.map +1 -1
  10. package/dist/cli.js +2481 -619
  11. package/dist/cli.js.map +1 -1
  12. package/dist/lib/ledger.cjs +120 -0
  13. package/dist/lib/ledger.cjs.map +1 -0
  14. package/dist/lib/ledger.d.cts +64 -0
  15. package/dist/lib/ledger.d.ts +64 -0
  16. package/dist/lib/ledger.js +96 -0
  17. package/dist/lib/ledger.js.map +1 -0
  18. package/dist/lib/lifecycle-reconcile.cjs +497 -0
  19. package/dist/lib/lifecycle-reconcile.cjs.map +1 -0
  20. package/dist/lib/lifecycle-reconcile.d.cts +136 -0
  21. package/dist/lib/lifecycle-reconcile.d.ts +136 -0
  22. package/dist/lib/lifecycle-reconcile.js +20 -0
  23. package/dist/lib/lifecycle-reconcile.js.map +1 -0
  24. package/dist/templates/cleargate-planning/.claude/agents/architect.md +65 -10
  25. package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-contradict.md +108 -0
  26. package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-ingest.md +49 -3
  27. package/dist/templates/cleargate-planning/.claude/agents/cleargate-wiki-lint.md +6 -1
  28. package/dist/templates/cleargate-planning/.claude/agents/developer.md +51 -2
  29. package/dist/templates/cleargate-planning/.claude/agents/devops.md +249 -0
  30. package/dist/templates/cleargate-planning/.claude/agents/qa.md +91 -1
  31. package/dist/templates/cleargate-planning/.claude/agents/reporter.md +72 -14
  32. package/dist/templates/cleargate-planning/.claude/hooks/pre-commit-surface-gate.sh +21 -0
  33. package/dist/templates/cleargate-planning/.claude/hooks/pre-tool-use-task.sh +148 -0
  34. package/dist/templates/cleargate-planning/.claude/hooks/session-start.sh +6 -0
  35. package/dist/templates/cleargate-planning/.claude/hooks/stamp-and-gate.sh +12 -1
  36. package/dist/templates/cleargate-planning/.claude/hooks/token-ledger.sh +334 -96
  37. package/dist/templates/cleargate-planning/.claude/settings.json +4 -0
  38. package/dist/templates/cleargate-planning/.claude/skills/sprint-execution/SKILL.md +644 -0
  39. package/dist/templates/cleargate-planning/.cleargate/config.example.yml +19 -0
  40. package/dist/templates/cleargate-planning/.cleargate/knowledge/cleargate-enforcement.md +542 -0
  41. package/dist/templates/cleargate-planning/.cleargate/knowledge/cleargate-protocol.md +102 -428
  42. package/dist/templates/cleargate-planning/.cleargate/knowledge/mid-sprint-triage-rubric.md +160 -0
  43. package/dist/templates/cleargate-planning/.cleargate/knowledge/readiness-gates.md +72 -9
  44. package/dist/templates/cleargate-planning/.cleargate/knowledge/sprint-closeout-checklist.md +71 -0
  45. package/dist/templates/cleargate-planning/.cleargate/scripts/assert_story_files.mjs +24 -2
  46. package/dist/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +471 -29
  47. package/dist/templates/cleargate-planning/.cleargate/scripts/dedupe_frontmatter.mjs +219 -0
  48. package/dist/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +3 -3
  49. package/dist/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +86 -10
  50. package/dist/templates/cleargate-planning/.cleargate/scripts/lib/report-filename.mjs +54 -0
  51. package/dist/templates/cleargate-planning/.cleargate/scripts/prep_doc_refresh.mjs +378 -0
  52. package/dist/templates/cleargate-planning/.cleargate/scripts/prep_qa_context.mjs +888 -0
  53. package/dist/templates/cleargate-planning/.cleargate/scripts/run_script.sh +173 -87
  54. package/dist/templates/cleargate-planning/.cleargate/scripts/sprint_trends.mjs +71 -0
  55. package/dist/templates/cleargate-planning/.cleargate/scripts/suggest_improvements.mjs +483 -13
  56. package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_prep_qa_context.sh +482 -0
  57. package/dist/templates/cleargate-planning/.cleargate/scripts/validate_state.mjs +32 -8
  58. package/dist/templates/cleargate-planning/.cleargate/scripts/write_dispatch.sh +136 -0
  59. package/dist/templates/cleargate-planning/.cleargate/templates/Bug.md +27 -1
  60. package/dist/templates/cleargate-planning/.cleargate/templates/CR.md +35 -1
  61. package/dist/templates/cleargate-planning/.cleargate/templates/Sprint Plan Template.md +48 -14
  62. package/dist/templates/cleargate-planning/.cleargate/templates/epic.md +40 -3
  63. package/dist/templates/cleargate-planning/.cleargate/templates/hotfix.md +53 -0
  64. package/dist/templates/cleargate-planning/.cleargate/templates/initiative.md +98 -29
  65. package/dist/templates/cleargate-planning/.cleargate/templates/proposal.md +17 -4
  66. package/dist/templates/cleargate-planning/.cleargate/templates/sprint_context.md +8 -0
  67. package/dist/templates/cleargate-planning/.cleargate/templates/sprint_report.md +23 -4
  68. package/dist/templates/cleargate-planning/.cleargate/templates/story.md +58 -3
  69. package/dist/templates/cleargate-planning/CLAUDE.md +30 -10
  70. package/dist/templates/cleargate-planning/MANIFEST.json +276 -31
  71. package/dist/{whoami-CX7CXJD5.js → whoami-W4U6DPVG.js} +17 -17
  72. package/dist/whoami-W4U6DPVG.js.map +1 -0
  73. package/package.json +20 -6
  74. package/templates/cleargate-planning/.claude/agents/architect.md +65 -10
  75. package/templates/cleargate-planning/.claude/agents/cleargate-wiki-contradict.md +108 -0
  76. package/templates/cleargate-planning/.claude/agents/cleargate-wiki-ingest.md +49 -3
  77. package/templates/cleargate-planning/.claude/agents/cleargate-wiki-lint.md +6 -1
  78. package/templates/cleargate-planning/.claude/agents/developer.md +51 -2
  79. package/templates/cleargate-planning/.claude/agents/devops.md +249 -0
  80. package/templates/cleargate-planning/.claude/agents/qa.md +91 -1
  81. package/templates/cleargate-planning/.claude/agents/reporter.md +72 -14
  82. package/templates/cleargate-planning/.claude/hooks/pre-commit-surface-gate.sh +21 -0
  83. package/templates/cleargate-planning/.claude/hooks/pre-tool-use-task.sh +148 -0
  84. package/templates/cleargate-planning/.claude/hooks/session-start.sh +6 -0
  85. package/templates/cleargate-planning/.claude/hooks/stamp-and-gate.sh +12 -1
  86. package/templates/cleargate-planning/.claude/hooks/token-ledger.sh +334 -96
  87. package/templates/cleargate-planning/.claude/settings.json +4 -0
  88. package/templates/cleargate-planning/.claude/skills/sprint-execution/SKILL.md +644 -0
  89. package/templates/cleargate-planning/.cleargate/config.example.yml +19 -0
  90. package/templates/cleargate-planning/.cleargate/knowledge/cleargate-enforcement.md +542 -0
  91. package/templates/cleargate-planning/.cleargate/knowledge/cleargate-protocol.md +102 -428
  92. package/templates/cleargate-planning/.cleargate/knowledge/mid-sprint-triage-rubric.md +160 -0
  93. package/templates/cleargate-planning/.cleargate/knowledge/readiness-gates.md +72 -9
  94. package/templates/cleargate-planning/.cleargate/knowledge/sprint-closeout-checklist.md +71 -0
  95. package/templates/cleargate-planning/.cleargate/scripts/assert_story_files.mjs +24 -2
  96. package/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +471 -29
  97. package/templates/cleargate-planning/.cleargate/scripts/dedupe_frontmatter.mjs +219 -0
  98. package/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +3 -3
  99. package/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +86 -10
  100. package/templates/cleargate-planning/.cleargate/scripts/lib/report-filename.mjs +54 -0
  101. package/templates/cleargate-planning/.cleargate/scripts/prep_doc_refresh.mjs +378 -0
  102. package/templates/cleargate-planning/.cleargate/scripts/prep_qa_context.mjs +888 -0
  103. package/templates/cleargate-planning/.cleargate/scripts/run_script.sh +173 -87
  104. package/templates/cleargate-planning/.cleargate/scripts/sprint_trends.mjs +71 -0
  105. package/templates/cleargate-planning/.cleargate/scripts/suggest_improvements.mjs +483 -13
  106. package/templates/cleargate-planning/.cleargate/scripts/test/test_prep_qa_context.sh +482 -0
  107. package/templates/cleargate-planning/.cleargate/scripts/validate_state.mjs +32 -8
  108. package/templates/cleargate-planning/.cleargate/scripts/write_dispatch.sh +136 -0
  109. package/templates/cleargate-planning/.cleargate/templates/Bug.md +27 -1
  110. package/templates/cleargate-planning/.cleargate/templates/CR.md +35 -1
  111. package/templates/cleargate-planning/.cleargate/templates/Sprint Plan Template.md +48 -14
  112. package/templates/cleargate-planning/.cleargate/templates/epic.md +40 -3
  113. package/templates/cleargate-planning/.cleargate/templates/hotfix.md +53 -0
  114. package/templates/cleargate-planning/.cleargate/templates/initiative.md +98 -29
  115. package/templates/cleargate-planning/.cleargate/templates/sprint_context.md +8 -0
  116. package/templates/cleargate-planning/.cleargate/templates/sprint_report.md +23 -4
  117. package/templates/cleargate-planning/.cleargate/templates/story.md +58 -3
  118. package/templates/cleargate-planning/CLAUDE.md +30 -10
  119. package/templates/cleargate-planning/MANIFEST.json +276 -31
  120. package/dist/chunk-OM4FAEA7.js.map +0 -1
  121. package/dist/whoami-CX7CXJD5.js.map +0 -1
  122. package/templates/cleargate-planning/.cleargate/templates/proposal.md +0 -61
package/CHANGELOG.md ADDED
@@ -0,0 +1,210 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+ Format: [Common Changelog](https://common-changelog.org/) — most-recent version first.
5
+
6
+ ## [0.11.0] — 2026-05-04
7
+
8
+ SDLC Hardening Wrap-Up + Docs Aligned (SPRINT-25). Six CRs shipped (CR-053..CR-058); the SDLC Hardening arc closes here.
9
+
10
+ ### Added
11
+ - **`run_script.sh` byte-correct UTF-8 truncation** (CR-054) — `_truncate_stream()` now uses `head -c $MAX_BYTES` with a separate `wc -c` source-file check gating the suffix append; `${var:0:N}` was char-index, not byte-count, and silently mis-truncated multi-byte input (cyrillic, CJK).
12
+ - **wrapScript helper adoption in 4 caller tests** (CR-055) — `cleargate-cli/test/commands/{sprint,state,gate,story}.node.test.ts` now consume the `wrapScript` helper end-to-end (one new `await wrapScript(...)` scenario per file). JSDoc canonical-pattern block added at top of `cleargate-cli/test/helpers/wrap-script.ts`. Suite runtime: 52s → 57s (1.09×).
13
+ - **Skill-candidate heuristic — session-shared filter + cross-sprint dedup + threshold raise** (CR-056) — `.cleargate/scripts/suggest_improvements.mjs` (live + canonical) tightens `scanSkillCandidates`: (1) `isSessionShared()` filters buckets where all entries share one session UUID (token-attribution artifact); (2) cross-sprint hash dedup scans prior `improvement-suggestions.md`; (3) threshold raised to "≥3× across ≥2 distinct sprints AND not session-shared". Eliminates the every-sprint "CR-045 × architect" false-positive.
14
+ - **`script-incident-corpus-analysis.md` knowledge doc** (CR-057) — `.cleargate/knowledge/script-incident-corpus-analysis.md` formally closes CR-046 §0.5 Q3 deferred self-repair question. DOCS-MODE shipped (no `run_script.sh` self-repair logic) — corpus = 3 incidents, no recurring failure pattern. Revisit-trigger documented.
15
+ - **Five-role agent team** in README (CR-058) — root `README.md` rebranded "Four-Agent Loop" → "Five-Role Agent Loop"; describes Architect (4 modes: SDR/M1/TPV/post-flight), Developer, QA (Red + Verify modes), DevOps (mechanical merge + state), Reporter (sprint close); 4 explicit gates documented (Gate 1 Initiative, Gate 2 Ambiguity, Gate 3 preflight, Gate 4 close); §What's New section recaps SPRINT-22..SPRINT-24 (CR-042..CR-052); MCP adapter claim softened to "in development" (only LinearAdapter currently shipped). New `.cleargate/sprint-runs/SPRINT-25/lifecycle-diagram-prompt.md` (164 lines, structured headings) ready for external image-generator.
16
+ - **`cleargate-cli/README.md` Commands section** (CR-058) — documents `sprint preflight/init/close`, `gate check`, `doctor`, `state update/validate`, `story start/done/bouncing`.
17
+
18
+ ### Fixed
19
+ - **`cleargate init` no longer writes `MANIFEST.json` to user-repo root** (CR-053) — `cleargate-cli/src/init/copy-payload.ts` `SKIP_FILES` adds `'MANIFEST.json'`; the npm-payload-root MANIFEST.json (parity manifest for the meta-repo's payload-copy verification) was being copied into every user repo as a side-effect of `copyPayload` walking the payload root. Removes the SPRINT-24 `.gitignore` `/MANIFEST.json` stopgap (commit `5fd8b22`).
20
+
21
+ ### Changed
22
+ - Package description rebranded "four-agent loop" → "five-role agent team".
23
+
24
+ ---
25
+
26
+ ## [0.10.0] — 2026-05-02
27
+
28
+ ### Added
29
+ - **Sprint-execution skill** (EPIC-026) — `.claude/skills/sprint-execution/SKILL.md` is now the canonical orchestration playbook (auto-loaded on sprint-active sessions); SessionStart hook + `cleargate sprint preflight|init` emit `→ Load skill: sprint-execution` directive (STORY-026-01).
30
+ - **Composite preflight gate** (CR-027) — `cleargate sprint preflight` now runs five checks (was four); new check #5 verifies per-item `cached_gate_result.pass=true` for every in-scope work item; new `discovery-checked` + `risk-table-populated` readiness criteria.
31
+ - **Code-truth triage stack** (CR-028) — protocol unnumbered "Code-Truth Principle" preamble; new `## Existing Surfaces` + `## Why not simpler?` sections in epic/story/CR templates; new `reuse-audit-recorded` + `simplest-form-justified` predicates.
32
+ - **PreToolUse:Task hook** (CR-026) — `.claude/hooks/pre-tool-use-task.sh` auto-writes dispatch markers by parsing tool_input.prompt for work-item IDs; banner-immune; uniquified filename avoids parallel-spawn collision.
33
+ - **Inner-loop test runner guidance** (CR-029 Phase E partial) — `.claude/agents/developer.md` instructs Dev agents to write new test files in `node:test` + `node:assert/strict` for ~80MB RAM vs ~400MB vitest fork.
34
+ - `.cleargate/scripts/dedupe_frontmatter.mjs` — corpus dedupe pass for any duplicate frontmatter keys (BUG-025 follow-on).
35
+
36
+ ### Changed
37
+ - **Token-ledger attribution** (CR-026) — `.claude/hooks/token-ledger.sh` now uses newest-file dispatch lookup (not session-id-keyed) + skips `^[0-9]+ items? blocked:` SessionStart-banner prefixes via `BANNER_SKIP_RE`; resolves three BUG-024 attribution defects.
38
+ - **CLAUDE.md (live + canonical)** (STORY-026-02) — pruned ~26 lines of orchestration prose now lives in the sprint-execution skill; preserved halt rules, Gate 1 / Gate 4 contracts, Sprint-mode v1/v2, Boundary-gates pointers; added always-on "Skill auto-load directive" rule.
39
+ - **`assert_story_files.mjs`** (CR-027) — exports `extractWorkItemIds` + `findWorkItemFile`; adds `--emit-json` flag for CLI shell-out.
40
+
41
+ ### Fixed
42
+ - **`backfill_hierarchy.mjs::spliceKeys()`** (BUG-025) — was inserting NEW line for existing-null keys, producing duplicate frontmatter lines on each PostToolUse stamp; fix is two-phase: Phase 1 in-place replace, Phase 2 insert-absent-only.
43
+ - 4 corpus files de-duplicated of orphaned `parent_cleargate_id:` lines (BUG-024, SPRINT-17, CR-023, EPIC-024).
44
+
45
+ ### Caveats (live wiring deferred)
46
+ - `.claude/settings.json` (live) is gitignored and not yet wired to the new `pre-tool-use-task.sh`; only the canonical mirror (`cleargate-planning/.claude/settings.json`) is updated. Effect: takes hold on next `cleargate init` or manual settings edit.
47
+ - Templates use numbered headings (`## 3.5 Existing Surfaces`) which don't match bare-substring predicates (`## Existing Surfaces`); SPRINT-20 anchors are backfilled with bare headings, but fresh template drafts will fail the new gates until follow-up CR ships.
48
+
49
+ ---
50
+
51
+ ## [0.9.0] — 2026-04-30
52
+
53
+ ### Added
54
+ - `src/lib/ledger.ts` — `sumDeltas()` helper for per-turn token delta math; exported via `package.json` `exports["./lib/ledger"]` (CR-018, closes BUG-022).
55
+ - Reporter agent contract updated to sum `delta.*` fields instead of flat `input/output/cache_*` fields; `pre_v2_caveat` emitted for mixed/legacy ledgers.
56
+ - `cleargate wiki contradict` CLI command + `lib/wiki/contradict.ts` helper (STORY-020-03).
57
+ - `cleargate push` hierarchy keys in wiki-ingest Phase 4 + backfill script (STORY-015-06).
58
+
59
+ ### Changed
60
+ - Token-ledger hook now maintains `.cleargate/sprint-runs/<sprint>/.session-totals.json` keyed by `session_id`; each SubagentStop computes `delta = current_session_total − prior_session_total`, replacing the former flat fields that caused N×cost inflation across multi-fire sessions.
61
+ - `src/lib/wiki/ingest.ts` — wiki-ingest Phase 4 prepare/commit split: advisory log + ledger role attribution (STORY-020-02).
62
+
63
+ ### Fixed
64
+ - `fix(SPRINT-15)` CR-018 QA bounce — bundle `src/lib/ledger.ts` in tsup output + correct `package.json` export path.
65
+
66
+ ---
67
+
68
+ ## [0.8.2] — 2026-04-27
69
+
70
+ ### Fixed
71
+ - Strip `cleargate`-internal cross-reference comments from scaffolded templates on `cleargate init` (BUG-020) — prevents canonical-repo comments from leaking into user repos.
72
+
73
+ ---
74
+
75
+ ## [0.8.1] — 2026-04-27
76
+
77
+ ### Fixed
78
+ - `.mcp.json` now uses `npx -y cleargate@<pin>` so the MCP server spawn works without a global install (BUG-019 follow-up).
79
+
80
+ ---
81
+
82
+ ## [0.8.0] — 2026-04-27
83
+
84
+ ### Added
85
+ - `cleargate mcp serve` — stdio↔HTTP MCP proxy with auto-refresh auth; required for Claude Desktop integration (BUG-019).
86
+
87
+ ---
88
+
89
+ ## [0.7.0] — 2026-04-27
90
+
91
+ ### Added
92
+ - `cleargate init` now writes `.mcp.json` for Claude Desktop MCP configuration (BUG-017).
93
+
94
+ ### Fixed
95
+ - `cleargate init` preserves `+x` executable bit on hook files; previously lost on content-identical overwrites (BUG-018).
96
+
97
+ ---
98
+
99
+ ## [0.6.2] — 2026-04-27
100
+
101
+ ### Fixed
102
+ - Exclude `CLAUDE.md` from `copyPayload` during `cleargate init` — prevents the canonical meta-repo preamble from being written into user repos (BUG-016).
103
+
104
+ ---
105
+
106
+ ## [0.6.1] — 2026-04-27
107
+
108
+ ### Fixed
109
+ - `cleargate init` resolver-probe failure is now warn-only, not a blocking error — fixes CI regression introduced in 0.6.0 (BUG-015).
110
+ - Resolver-probe and hook fallback use the correct package name `cleargate` instead of `@cleargate/cli` (BUG-013).
111
+
112
+ ---
113
+
114
+ ## [0.6.0] — 2026-04-27
115
+
116
+ ### Added
117
+ - SPRINT-14 M3–M5 deliverables: `cleargate hotfix new` command + hotfix lane scaffold (STORY-022-06).
118
+ - State.json schema v1→v2 migration + lane CLI flags (`--fast` / `--standard`) for story dispatch (STORY-022-02).
119
+ - Developer agent lane-aware execution + demotion delegation (STORY-022-05).
120
+ - `pre_gate_runner.sh` lane-aware demotion logic + LD event emission (STORY-022-04).
121
+ - Architect Lane Classification rubric; fast-lane protocol §24 (STORY-022-01).
122
+ - Reporter sprint-report v2.1 + `close_sprint.mjs` validation (activation-gated) (STORY-022-07).
123
+
124
+ ### Changed
125
+ - Doctor exit-code semantics: 0 = clean, 1 = blocked, 2 = config-error (STORY-014-01; closes CR-009 carry-over).
126
+ - `cleargate gate` planning-first enforcement: Phase A stdout routing + Phase B PreToolUse warn-only (CR-008).
127
+ - Hook resolver pin + loud preflight + pin-aware manifest; hook fallback uses versioned `npx` call (CR-009).
128
+
129
+ ### Fixed
130
+ - Token-ledger detector scopes to dispatch marker, not transcript content (BUG-010).
131
+ - Token-ledger `PROP↔PROPOSAL` regex normalization + alternation fix (BUG-009).
132
+ - Gate criteria over-match on `proposal-approved` / `no-tbds` / `blast-radius-populated` fields (BUG-008).
133
+ - `cleargate init` participant prompt now visible inline (BUG-007).
134
+
135
+ ---
136
+
137
+ ## [0.5.0] — 2026-04-26
138
+
139
+ ### Fixed
140
+ - Init scaffold hooks now resolve `cleargate` via PATH correctly; removes the broken `@cleargate/cli` fallback reference (BUG-006).
141
+
142
+ ---
143
+
144
+ ## [0.4.0] — 2026-04-25
145
+
146
+ ### Added
147
+ - `cleargate join` two-step flow + admin-login refactored onto identity-flow helpers (CR-006, EPIC-019).
148
+ - Admin-login CLI snapshot regression test (CR-004).
149
+
150
+ ---
151
+
152
+ ## [0.3.0] — 2026-04-25
153
+
154
+ ### Added
155
+ - MIT `LICENSE` file shipped with the npm tarball (STORY-018-01).
156
+ - `cleargate gate` config-driven gate subcommands with Commander v12 routing (STORY-018-03).
157
+ - `cleargate init` scaffold-lint + CI workflow (STORY-018-04).
158
+ - Foreign-repo integration test (`test/integration/foreign-repo.test.ts`) (STORY-018-05).
159
+ - `cleargate wiki` hierarchical index rendering + golden-file test (STORY-015-01, STORY-015-02).
160
+ - `cleargate wiki audit-status` command for lifecycle status drift reconciliation (STORY-015-02).
161
+ - Wiki index token-budget lint (STORY-015-03).
162
+ - `abandoned` work-item status + sprint-close stamp on `cleargate sprint close` (STORY-015-04).
163
+ - `cleargate sprint archive` wrapper command (STORY-014-08).
164
+ - `cleargate sprint story start` and `story complete` atomic commands (STORY-014-07).
165
+ - `cleargate sprint` CLI flag plumbing (STORY-014-06).
166
+ - `execution_mode` flag + CLI wrappers (STORY-013-08).
167
+ - Immediate flashcard hard-gate enforcement (STORY-013-06).
168
+
169
+ ### Changed
170
+ - `cleargate` package published as public npm package under the unscoped name `cleargate` (replacing `@cleargate/cli`).
171
+
172
+ ### Fixed
173
+ - Bootstrap-root FK teardown + PreToolUse pending-task sentinel hook.
174
+ - Swallow `exitFn` sentinel in async handler to prevent false exit-code propagation (STORY-015-04 fix).
175
+
176
+ ---
177
+
178
+ ## [0.2.1] — 2026-04-19
179
+
180
+ ### Fixed
181
+ - Frontmatter YAML round-trip corruption (BUG-001) — keys with special characters were being mangled on stamp.
182
+ - Flashcard and story scaffold template updates (CR-001).
183
+
184
+ ---
185
+
186
+ ## [0.2.0] — 2026-04-19
187
+
188
+ ### Added
189
+ - `cleargate doctor` base command + `--check-scaffold` mode (STORY-009-04).
190
+ - `cleargate doctor --session-start` + `--pricing` flags (STORY-008-06).
191
+ - `cleargate upgrade` three-way merge driver for scaffold updates (STORY-009-05).
192
+ - `cleargate init` snapshot + restore (STORY-009-03); scaffold manifest + uninstall protocol §13 (STORY-009-08).
193
+ - `cleargate uninstall` with preservation marker (STORY-009-07).
194
+ - `cleargate stamp` CLI command + `stamp-frontmatter` helper (STORY-001-05, STORY-001-04).
195
+ - `cleargate stamp-tokens` command (STORY-008-05).
196
+ - `cleargate gate check|explain` CLI (STORY-008-03).
197
+ - `cleargate wiki build`, `ingest`, `query`, `lint` commands (EPIC-002, STORY-002-05 through STORY-002-09).
198
+ - PostToolUse + SessionStart hooks scaffold (STORY-008-06).
199
+ - Hook-health log scan in doctor (STORY-008-06 QA kickback).
200
+ - Predicate evaluator + frontmatter-cache libraries (STORY-008-02).
201
+ - Build-manifest script + changelog diff tooling (STORY-009-02).
202
+ - SHA-256 + manifest libraries (STORY-009-01).
203
+ - `claude-md-surgery` + `settings-json-surgery` libraries (STORY-009-06).
204
+ - Ledger hook generalization + sprint-routing fix + ledger-reader (STORY-008-04).
205
+ - `cleargate init` writes scaffold, PostToolUse hook, and CLAUDE.md block (STORY-002-05).
206
+ - Root README + CLI README/description sync (STORY-007-02, STORY-007-03).
207
+ - Wiki synthesis templates (STORY-002-09).
208
+ - Codebase-version helper (STORY-001-03).
209
+ - Readiness-gates.md with 6 gate definitions (STORY-008-01).
210
+ - Template stubs + protocol §12 + wiki-lint gate checks (STORY-008-07).
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # cleargate
2
2
 
3
- **ClearGate** gives Claude Code a disciplined ship-loop — proposals → epics → stories → sprints → four-agent execution (architect plans, developer codes, qa verifies, reporter retrospects). One command bootstraps a downstream repo:
3
+ **ClearGate** gives Claude Code a disciplined ship-loop — proposals → epics → stories → sprints → five-role agent execution (architect plans, developer codes, qa verifies, devops merges, reporter retrospects). One command bootstraps a downstream repo:
4
4
 
5
5
  ```bash
6
6
  npx cleargate init
@@ -22,6 +22,7 @@ npm i -D cleargate # local devDep, run via `npx cleargate ...`
22
22
 
23
23
  ```bash
24
24
  cleargate init # scaffold a target repo (CLAUDE.md block, .claude/, .cleargate/)
25
+ cleargate doctor # check scaffold health — drift, missing hooks, blocked items
25
26
  cleargate wiki build # full rebuild from .cleargate/delivery/ → .cleargate/wiki/
26
27
  cleargate wiki ingest <file> # single-file update (also called by PostToolUse hook)
27
28
  cleargate wiki query "<topic>" # read-only synthesis with [[ID]] citations
@@ -29,10 +30,30 @@ cleargate wiki query "<topic>" --persist # file the answer to wiki/topics/<slu
29
30
  cleargate wiki lint # drift check — exits non-zero on inconsistency, blocks Gates 1 + 3
30
31
  cleargate wiki lint --suggest # advisory mode — surfaces candidate cross-refs, exits 0
31
32
  cleargate join <invite-url> # join an existing ClearGate workspace via MCP
33
+ cleargate sprint init # initialize a sprint — cut sprint branch, create state.json
34
+ cleargate sprint preflight # Gate 3 readiness check — no orphans, no ambiguity drift
35
+ cleargate sprint close # close a sprint — runs lifecycle reconciler, prints handoff summary
36
+ cleargate gate check # run the configured gate command (test/typecheck/lint/precommit)
37
+ cleargate state update <id> <state> # transition a work item to the given state
38
+ cleargate state validate # validate state.json against the schema
39
+ cleargate story start <id> # create worktree + branch for a story, flip state to In Progress
40
+ cleargate story done <id> # mark a story done after DevOps merge (alias for state update Done)
41
+ cleargate story bouncing <id> # flag a story as bouncing (QA kick-back); increments bounce counter
32
42
  ```
33
43
 
34
44
  After `init`, edits to `.cleargate/delivery/**` auto-trigger `wiki ingest` via the PostToolUse hook. The wiki stays fresh; no manual maintenance.
35
45
 
46
+ ### Dogfood
47
+
48
+ ClearGate framework maintainers who work directly in the meta-repo can install the scaffold from the local `cleargate-planning/` directory instead of the published npm package:
49
+
50
+ ```bash
51
+ # In a fresh target directory:
52
+ cleargate init --from-source /path/to/cleargate-repo/cleargate-planning
53
+ ```
54
+
55
+ This routes through the same `copyPayload` code path that downstream users hit, closing the dogfood gap where the meta-repo previously edited `cleargate-planning/` in place and never exercised the `cleargate init` flow. All other `init` behaviour (MANIFEST.json generation, overwrite policies, prompt flow, exit codes) is identical. The `--from-source` path must contain `.claude/`, `.cleargate/`, and `CLAUDE.md` at its root; the command exits 2 with a clear error if any are missing.
56
+
36
57
  ## Requirements
37
58
 
38
59
  Node ≥ 24 LTS. `git` available on PATH (for content-hash drift detection).