@cleocode/core 2026.4.4 → 2026.4.6

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 (145) hide show
  1. package/dist/discovery.d.ts +69 -0
  2. package/dist/discovery.d.ts.map +1 -0
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1643 -2349
  6. package/dist/index.js.map +4 -4
  7. package/dist/init.d.ts +51 -0
  8. package/dist/init.d.ts.map +1 -1
  9. package/dist/internal.d.ts +9 -1
  10. package/dist/internal.d.ts.map +1 -1
  11. package/dist/lifecycle/default-chain.d.ts +8 -2
  12. package/dist/lifecycle/default-chain.d.ts.map +1 -1
  13. package/dist/lifecycle/index.d.ts +1 -0
  14. package/dist/lifecycle/index.d.ts.map +1 -1
  15. package/dist/lifecycle/stage-guidance.d.ts +140 -0
  16. package/dist/lifecycle/stage-guidance.d.ts.map +1 -0
  17. package/dist/orchestration/protocol-validators.d.ts +122 -3
  18. package/dist/orchestration/protocol-validators.d.ts.map +1 -1
  19. package/dist/paths.d.ts +91 -0
  20. package/dist/paths.d.ts.map +1 -1
  21. package/dist/scaffold.d.ts +31 -1
  22. package/dist/scaffold.d.ts.map +1 -1
  23. package/dist/skills/dispatch.d.ts +1 -1
  24. package/dist/skills/skill-paths.d.ts +9 -6
  25. package/dist/skills/skill-paths.d.ts.map +1 -1
  26. package/dist/validation/protocols/_shared.d.ts +40 -0
  27. package/dist/validation/protocols/_shared.d.ts.map +1 -0
  28. package/dist/validation/protocols/architecture-decision.d.ts +23 -0
  29. package/dist/validation/protocols/architecture-decision.d.ts.map +1 -0
  30. package/dist/validation/protocols/artifact-publish.d.ts +22 -0
  31. package/dist/validation/protocols/artifact-publish.d.ts.map +1 -0
  32. package/dist/validation/protocols/consensus.d.ts +11 -17
  33. package/dist/validation/protocols/consensus.d.ts.map +1 -1
  34. package/dist/validation/protocols/contribution.d.ts +12 -17
  35. package/dist/validation/protocols/contribution.d.ts.map +1 -1
  36. package/dist/validation/protocols/decomposition.d.ts +18 -21
  37. package/dist/validation/protocols/decomposition.d.ts.map +1 -1
  38. package/dist/validation/protocols/implementation.d.ts +9 -17
  39. package/dist/validation/protocols/implementation.d.ts.map +1 -1
  40. package/dist/validation/protocols/provenance.d.ts +23 -0
  41. package/dist/validation/protocols/provenance.d.ts.map +1 -0
  42. package/dist/validation/protocols/release.d.ts +25 -0
  43. package/dist/validation/protocols/release.d.ts.map +1 -0
  44. package/dist/validation/protocols/research.d.ts +9 -17
  45. package/dist/validation/protocols/research.d.ts.map +1 -1
  46. package/dist/validation/protocols/specification.d.ts +7 -17
  47. package/dist/validation/protocols/specification.d.ts.map +1 -1
  48. package/dist/validation/protocols/testing.d.ts +22 -0
  49. package/dist/validation/protocols/testing.d.ts.map +1 -0
  50. package/dist/validation/protocols/validation.d.ts +22 -0
  51. package/dist/validation/protocols/validation.d.ts.map +1 -0
  52. package/package.json +7 -7
  53. package/src/__tests__/injection-mvi-tiers.test.js +54 -90
  54. package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
  55. package/src/discovery.ts +235 -0
  56. package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +3 -1
  57. package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +1 -1
  58. package/src/index.ts +16 -0
  59. package/src/init.ts +196 -0
  60. package/src/internal.ts +31 -1
  61. package/src/lifecycle/default-chain.ts +11 -2
  62. package/src/lifecycle/index.ts +10 -0
  63. package/src/lifecycle/stage-guidance.ts +282 -0
  64. package/src/metrics/__tests__/provider-detection.test.js +19 -7
  65. package/src/metrics/__tests__/provider-detection.test.js.map +1 -1
  66. package/src/metrics/__tests__/provider-detection.test.ts +19 -7
  67. package/src/orchestration/__tests__/protocol-validators.test.js +228 -8
  68. package/src/orchestration/__tests__/protocol-validators.test.js.map +1 -1
  69. package/src/orchestration/__tests__/protocol-validators.test.ts +259 -7
  70. package/src/orchestration/protocol-validators.ts +419 -4
  71. package/src/paths.ts +110 -0
  72. package/src/scaffold.ts +240 -4
  73. package/src/skills/dispatch.ts +6 -6
  74. package/src/skills/skill-paths.ts +27 -23
  75. package/src/validation/protocols/_shared.ts +88 -0
  76. package/src/validation/protocols/architecture-decision.ts +52 -0
  77. package/src/validation/protocols/artifact-publish.ts +49 -0
  78. package/src/validation/protocols/consensus.ts +44 -74
  79. package/src/validation/protocols/contribution.ts +28 -65
  80. package/src/validation/protocols/decomposition.ts +37 -64
  81. package/src/validation/protocols/implementation.ts +25 -65
  82. package/src/validation/protocols/protocols-markdown/architecture-decision.md +303 -0
  83. package/src/validation/protocols/protocols-markdown/artifact-publish.md +600 -0
  84. package/src/validation/protocols/protocols-markdown/consensus.md +322 -0
  85. package/src/validation/protocols/protocols-markdown/contribution.md +388 -0
  86. package/src/validation/protocols/protocols-markdown/decomposition.md +421 -0
  87. package/src/validation/protocols/protocols-markdown/implementation.md +357 -0
  88. package/src/validation/protocols/protocols-markdown/provenance.md +613 -0
  89. package/src/validation/protocols/protocols-markdown/release.md +783 -0
  90. package/src/validation/protocols/protocols-markdown/research.md +261 -0
  91. package/src/validation/protocols/protocols-markdown/specification.md +300 -0
  92. package/src/validation/protocols/protocols-markdown/testing.md +287 -0
  93. package/src/validation/protocols/protocols-markdown/validation.md +242 -0
  94. package/src/validation/protocols/provenance.ts +50 -0
  95. package/src/validation/protocols/release.ts +44 -0
  96. package/src/validation/protocols/research.ts +25 -87
  97. package/src/validation/protocols/specification.ts +27 -89
  98. package/src/validation/protocols/testing.ts +46 -0
  99. package/src/validation/protocols/validation.ts +46 -0
  100. package/dist/validation/protocols/release-protocol.d.ts +0 -27
  101. package/dist/validation/protocols/release-protocol.d.ts.map +0 -1
  102. package/dist/validation/protocols/testing-protocol.d.ts +0 -27
  103. package/dist/validation/protocols/testing-protocol.d.ts.map +0 -1
  104. package/dist/validation/protocols/validation-protocol.d.ts +0 -27
  105. package/dist/validation/protocols/validation-protocol.d.ts.map +0 -1
  106. package/schemas/agent-configs.schema.json +0 -120
  107. package/schemas/agent-registry.schema.json +0 -132
  108. package/schemas/archive.schema.json +0 -450
  109. package/schemas/brain-decision.schema.json +0 -69
  110. package/schemas/brain-learning.schema.json +0 -57
  111. package/schemas/brain-pattern.schema.json +0 -72
  112. package/schemas/critical-path.schema.json +0 -246
  113. package/schemas/deps-cache.schema.json +0 -97
  114. package/schemas/doctor-output.schema.json +0 -283
  115. package/schemas/error.schema.json +0 -161
  116. package/schemas/global-config.schema.json +0 -219
  117. package/schemas/grade.schema.json +0 -49
  118. package/schemas/log.schema.json +0 -250
  119. package/schemas/metrics.schema.json +0 -328
  120. package/schemas/migrations.schema.json +0 -150
  121. package/schemas/nexus-registry.schema.json +0 -90
  122. package/schemas/operation-constitution.schema.json +0 -438
  123. package/schemas/output.schema.json +0 -164
  124. package/schemas/projects-registry.schema.json +0 -107
  125. package/schemas/protocol-frontmatter.schema.json +0 -72
  126. package/schemas/rcasd-consensus-report.schema.json +0 -10
  127. package/schemas/rcasd-evidence.schema.json +0 -42
  128. package/schemas/rcasd-gate-result.schema.json +0 -46
  129. package/schemas/rcasd-hitl-resolution.schema.json +0 -10
  130. package/schemas/rcasd-index.schema.json +0 -10
  131. package/schemas/rcasd-manifest.schema.json +0 -10
  132. package/schemas/rcasd-research-output.schema.json +0 -10
  133. package/schemas/rcasd-spec-frontmatter.schema.json +0 -10
  134. package/schemas/rcasd-stage-transition.schema.json +0 -38
  135. package/schemas/releases.schema.json +0 -267
  136. package/schemas/skills-manifest.schema.json +0 -91
  137. package/schemas/spec-index.schema.json +0 -196
  138. package/schemas/system-flow-atlas.schema.json +0 -125
  139. package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +0 -1
  140. package/src/conduit/__tests__/dual-api-e2e.test.js +0 -178
  141. package/src/conduit/__tests__/dual-api-e2e.test.js.map +0 -1
  142. package/src/conduit/__tests__/dual-api-e2e.test.ts +0 -212
  143. package/src/validation/protocols/release-protocol.ts +0 -80
  144. package/src/validation/protocols/testing-protocol.ts +0 -93
  145. package/src/validation/protocols/validation-protocol.ts +0 -93
@@ -0,0 +1,783 @@
1
+ ---
2
+ id: REL
3
+ title: Release Protocol
4
+ version: 1.0.0
5
+ status: active
6
+ type: conditional
7
+ audience: [llm-agent, orchestrator]
8
+ tags: [release, semver, changelog]
9
+ skillRef: ct-release-orchestrator
10
+ lastUpdated: 2026-04-07
11
+ enforcement: strict
12
+ ---
13
+
14
+ # Release Protocol
15
+
16
+ **Provenance**: @task T3155, @epic T3147
17
+ **Version**: 2.2.0
18
+ **Type**: Conditional Protocol
19
+ **Max Active**: 3 protocols (including base)
20
+
21
+ ---
22
+
23
+ ## Trigger Conditions
24
+
25
+ This protocol activates when the task involves:
26
+
27
+ | Trigger | Keywords | Context |
28
+ |---------|----------|---------|
29
+ | Version | "release", "version", "v1.x.x" | Version management |
30
+ | Publish | "publish", "deploy", "ship" | Distribution |
31
+ | Changelog | "changelog", "release notes" | Documentation |
32
+ | Tag | "tag", "milestone", "GA" | Version marking |
33
+
34
+ **Explicit Override**: `--protocol release` flag on task creation.
35
+
36
+ ---
37
+
38
+ ## Requirements (RFC 2119)
39
+
40
+ ### MUST
41
+
42
+ | Requirement | Description |
43
+ |-------------|-------------|
44
+ | RLSE-001 | MUST follow semantic versioning (semver) |
45
+ | RLSE-002 | MUST update changelog with all changes |
46
+ | RLSE-003 | MUST pass all validation gates before release |
47
+ | RLSE-004 | MUST tag release in version control |
48
+ | RLSE-005 | MUST document breaking changes with migration path |
49
+ | RLSE-006 | MUST verify version consistency across files |
50
+ | RLSE-007 | MUST set `agent_type: "documentation"` in manifest |
51
+
52
+ ### SHOULD
53
+
54
+ | Requirement | Description |
55
+ |-------------|-------------|
56
+ | RLSE-010 | SHOULD include upgrade instructions |
57
+ | RLSE-011 | SHOULD verify documentation is current |
58
+ | RLSE-012 | SHOULD test installation process |
59
+ | RLSE-013 | SHOULD create backup before release |
60
+ | RLSE-014 | SHOULD run test suite for major/minor releases (use `--run-tests`) |
61
+ | RLSE-015 | SHOULD verify tests pass before tagging (opt-in to avoid timeout) |
62
+
63
+ ### MAY
64
+
65
+ | Requirement | Description |
66
+ |-------------|-------------|
67
+ | RLSE-020 | MAY include performance benchmarks |
68
+ | RLSE-021 | MAY announce on communication channels |
69
+ | RLSE-022 | MAY batch minor fixes into single release |
70
+
71
+ ---
72
+
73
+ ## State Machine
74
+
75
+ ```
76
+ create → planned → active → released (immutable)
77
+ ```
78
+
79
+ | Transition | Trigger | Condition |
80
+ |------------|---------|-----------|
81
+ | (none) → planned | `cleo release create <version>` | User action |
82
+ | planned → active | `cleo release ship <version>` (automatic) | Ship begins execution |
83
+ | active → released | `cleo release ship <version>` (automatic) | All steps complete |
84
+
85
+ The `active` state is automatic and transitional -- it is set internally during `ship` execution. Agents interact with `create` (→ planned) and `ship` (→ released). The `plan` command works on releases in `planned` or `active` status. Once `released`, the entry is **immutable** -- no task additions, no metadata changes.
86
+
87
+ ---
88
+
89
+ ## Release Schema
90
+
91
+ Releases are stored as an array in `todo.json` under `project.releases`:
92
+
93
+ ```json
94
+ {
95
+ "releaseDefinition": {
96
+ "required": ["version", "status", "createdAt"],
97
+ "properties": {
98
+ "version": { "type": "string", "pattern": "^v\\d+\\.\\d+\\.\\d+(-[a-z0-9.-]+)?$" },
99
+ "status": { "enum": ["planned", "active", "released"] },
100
+ "name": { "type": ["string", "null"], "maxLength": 100 },
101
+ "description": { "type": ["string", "null"], "maxLength": 500 },
102
+ "tasks": { "type": "array", "items": { "pattern": "^T\\d{3,}$" } },
103
+ "createdAt": { "format": "date-time" },
104
+ "targetDate": { "format": "date" },
105
+ "releasedAt": { "format": "date-time" },
106
+ "gitTag": { "type": ["string", "null"] },
107
+ "changelog": { "type": ["string", "null"] },
108
+ "notes": { "type": "array", "items": { "maxLength": 500 } }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ---
115
+
116
+ ## CLI Commands (8 subcommands)
117
+
118
+ ### `create`
119
+
120
+ Create a new planned release.
121
+
122
+ ```bash
123
+ cleo release create <version> [--target-date DATE] [--tasks T001,T002] [--notes "text"]
124
+ ```
125
+
126
+ | Flag | Type | Default | Description |
127
+ |------|------|---------|-------------|
128
+ | `--target-date` | DATE (YYYY-MM-DD) | null | Target release date |
129
+ | `--tasks` | string (comma-separated) | [] | Tasks to include |
130
+ | `--notes` | string | null | Release notes |
131
+
132
+ **Exit codes**: 0 (success), 51 (`E_RELEASE_EXISTS`), 53 (`E_INVALID_VERSION`)
133
+
134
+ **Behavior**: Creates a new release entry with status `planned`. Validates version is valid semver and doesn't already exist. Tasks are stored as an array; target date and notes are optional metadata.
135
+
136
+ ---
137
+
138
+ ### `plan`
139
+
140
+ Add or remove tasks from a release.
141
+
142
+ ```bash
143
+ cleo release plan <version> [--tasks T001,T002] [--remove T003] [--notes "text"]
144
+ ```
145
+
146
+ | Flag | Type | Default | Description |
147
+ |------|------|---------|-------------|
148
+ | `--tasks` | string (comma-separated) | — | Tasks to add (appends, deduplicates) |
149
+ | `--remove` | string | — | Task to remove |
150
+ | `--notes` | string | — | Update release notes |
151
+
152
+ **Exit codes**: 0 (success), 50 (`E_RELEASE_NOT_FOUND`), 52 (`E_RELEASE_LOCKED`)
153
+
154
+ **Behavior**: Modifies an existing release in `planned` or `active` status. The `--tasks` flag appends to existing tasks and deduplicates automatically. Calling `plan --tasks T001` then `plan --tasks T002` results in both tasks being included. Released entries are immutable and reject modification.
155
+
156
+ ---
157
+
158
+ ### `ship`
159
+
160
+ Mark a release as released. This is the primary release workflow command.
161
+
162
+ ```bash
163
+ cleo release ship <version> [FLAGS]
164
+ ```
165
+
166
+ | Flag | Type | Default | Description |
167
+ |------|------|---------|-------------|
168
+ | `--bump-version` | boolean | false | Bump version in all files configured in `release.versionBump` |
169
+ | `--create-tag` | boolean | false | Create annotated git tag |
170
+ | `--force-tag` | boolean | false | Overwrite existing git tag (requires `--create-tag`) |
171
+ | `--push` | boolean | false | Push commits and tag to remote |
172
+ | `--no-changelog` | boolean | false | Skip changelog generation |
173
+ | `--no-commit` | boolean | false | Skip git commit (update files only) |
174
+ | `--run-tests` | boolean | false | Run test suite during validation (opt-in, slow) |
175
+ | `--skip-validation` | boolean | false | Skip all validation gates (emergency releases) |
176
+ | `--dry-run` | boolean | false | Preview what would happen without making changes |
177
+ | `--preview` | boolean | false | Preview tasks and guards without shipping |
178
+ | `--force` | boolean | false | Override epic completeness blocking and tag conflicts |
179
+ | `--notes` | string | "" | Release notes |
180
+ | `--output` | string | CHANGELOG.md | Changelog output file |
181
+
182
+ **Exit codes**: 0 (success), 50 (`E_RELEASE_NOT_FOUND`), 52 (`E_RELEASE_LOCKED`), 54 (`E_VALIDATION_FAILED`), 55 (`E_VERSION_BUMP_FAILED`), 56 (`E_TAG_CREATION_FAILED`), 57 (`E_CHANGELOG_GENERATION_FAILED`), 58 (`E_TAG_EXISTS`), 59 (`E_TASKS_INCOMPLETE`)
183
+
184
+ **Ship Workflow** (10 steps):
185
+
186
+ ```
187
+ 1. Auto-populate release tasks (date window + label matching from todo.json)
188
+ 1.5. Run release guards (epic completeness check, double-listing check)
189
+ 2. Bump version (if --bump-version)
190
+ 3. Ensure [Unreleased] section exists in CHANGELOG.md (creates if missing)
191
+ 4. Generate changelog from task metadata via lib/changelog.sh (unless --no-changelog)
192
+ 5. Validate changelog content is not empty (unless --no-changelog)
193
+ 6. Append to CHANGELOG.md + generate platform-specific outputs (if configured)
194
+ 7. Run validation gates (tests opt-in, schema, version, changelog)
195
+ 8. Create release commit staging VERSION, README, CHANGELOG.md, platform docs, todo.json (unless --no-commit)
196
+ 9. Create annotated tag with changelog/commit/description fallback (if --create-tag)
197
+ 10. Push to remote (if --push)
198
+ 11. Update release status to "released" in todo.json with releasedAt timestamp
199
+ ```
200
+
201
+ Steps 2-6 are conditional on flags. Step 1.5 runs always unless `release.guards.epicCompleteness` is `off`. The `--dry-run` flag previews all steps and task list without executing. The `--preview` flag shows only the task preview and guard results. Use `--force` to override epic completeness blocking.
202
+
203
+ **`changelog` vs `ship`**: The `changelog` subcommand generates and previews changelog content without modifying release state. The `ship` subcommand performs the full release workflow including changelog generation, git operations, and status transition.
204
+
205
+ ---
206
+
207
+ ### `changelog`
208
+
209
+ Generate changelog from release tasks without shipping.
210
+
211
+ ```bash
212
+ cleo release changelog <version> [--output FILE]
213
+ ```
214
+
215
+ | Flag | Type | Default | Description |
216
+ |------|------|---------|-------------|
217
+ | `--output` | string | — | Write changelog to file |
218
+
219
+ **Exit codes**: 0 (success), 50 (`E_RELEASE_NOT_FOUND`), 53 (`E_INVALID_VERSION`)
220
+
221
+ **Behavior**: Generates changelog content from task metadata (title, description, labels) for the specified release. Outputs to stdout by default. Use `--output` to write to a file. Does not modify release status. Useful for previewing changelog before shipping.
222
+
223
+ ---
224
+
225
+ ### `list`
226
+
227
+ List all releases.
228
+
229
+ ```bash
230
+ cleo release list [--status STATUS] [--format FORMAT]
231
+ ```
232
+
233
+ | Flag | Type | Default | Description |
234
+ |------|------|---------|-------------|
235
+ | `--status` | string | — | Filter by status (planned, active, released) |
236
+ | `--format` | text\|json | auto | Output format |
237
+
238
+ **Exit codes**: 0 (success)
239
+
240
+ **Behavior**: Lists all releases with version, status, target date, task count, and released timestamp. Supports JSON and text output. Color-coded by status: yellow=planned, cyan=active, green=released.
241
+
242
+ ---
243
+
244
+ ### `show`
245
+
246
+ Show details of a specific release.
247
+
248
+ ```bash
249
+ cleo release show <version> [--format FORMAT]
250
+ ```
251
+
252
+ | Flag | Type | Default | Description |
253
+ |------|------|---------|-------------|
254
+ | `--format` | text\|json | auto | Output format |
255
+
256
+ **Exit codes**: 0 (success), 50 (`E_RELEASE_NOT_FOUND`), 53 (`E_INVALID_VERSION`)
257
+
258
+ **Behavior**: Displays full details for a release including version, status, dates, tasks, notes, git tag, and changelog content.
259
+
260
+ ---
261
+
262
+ ### `init-ci`
263
+
264
+ Initialize CI/CD workflow configuration for automated releases.
265
+
266
+ ```bash
267
+ cleo release init-ci [--platform PLATFORM] [--force] [--dry-run]
268
+ ```
269
+
270
+ | Flag | Type | Default | Description |
271
+ |------|------|---------|-------------|
272
+ | `--platform` | string | from config | CI platform: `github-actions`, `gitlab-ci`, `circleci` |
273
+ | `--force` | boolean | false | Overwrite existing CI config file |
274
+ | `--dry-run` | boolean | false | Preview without writing files |
275
+
276
+ **Exit codes**: 0 (success), 72 (`E_CI_INIT_FAILED`)
277
+
278
+ **Behavior**: Generates CI/CD workflow configuration files from templates in `lib/release-ci.sh`. Platform is auto-detected from config or specified via `--platform`. Use `--force` to overwrite existing configuration files.
279
+
280
+ ---
281
+
282
+ ### `validate`
283
+
284
+ Validate release protocol compliance for a task.
285
+
286
+ ```bash
287
+ cleo release validate <task-id> [--strict] [--format FORMAT]
288
+ ```
289
+
290
+ | Flag | Type | Default | Description |
291
+ |------|------|---------|-------------|
292
+ | `--strict` | boolean | false | Enable strict validation mode |
293
+ | `--format` | text\|json | auto | Output format |
294
+
295
+ **Exit codes**: 0 (valid), 4 (`E_NOT_FOUND` -- manifest or task not found), 66 (protocol violation in strict mode)
296
+
297
+ **Behavior**: Validates a task's manifest entry against the release protocol. Checks for required fields, correct `agent_type`, semver compliance, and changelog presence. The `--strict` flag enforces stricter checks (e.g., all SHOULD requirements become violations). Outputs validation score (0-100) and violation details.
298
+
299
+ ---
300
+
301
+ ## Task Discovery (6-Filter Pipeline)
302
+
303
+ During `cleo release ship`, tasks are auto-discovered via `populate_release_tasks()`:
304
+
305
+ | Filter | Purpose |
306
+ |--------|---------|
307
+ | 1. `completedAt` | Must have completion timestamp |
308
+ | 2. Date window | Completed between previous and current release |
309
+ | 3. `status == "done"` | Must be done (not pending/active/blocked) |
310
+ | 4. `type != "epic"` | Excludes organizational epics |
311
+ | 5. Label match | Has version label, `changelog`, or `release` label |
312
+ | 6. Version exclusivity | Tasks with explicit version labels aren't claimed by other releases |
313
+
314
+ Tasks are also included if explicitly assigned via `cleo release plan --tasks T001,T002`.
315
+
316
+ ---
317
+
318
+ <!-- @task T4436, @epic T4431 -->
319
+ ## Release Guards (v0.95.0+)
320
+
321
+ Guards provide safety checks during `ship` without blocking by default.
322
+
323
+ ### Epic Completeness
324
+
325
+ Checks whether all child tasks of an epic are included in the release. If epic T001 has 13 children but only 10 are shipping, the guard warns about the 3 missing tasks and their statuses.
326
+
327
+ **Configuration** (`release.guards.epicCompleteness` in `.cleo/config.json`):
328
+
329
+ | Mode | Behavior |
330
+ |------|----------|
331
+ | `warn` (default) | Log warnings about incomplete epics, continue shipping |
332
+ | `block` | Exit with code 59 (`E_TASKS_INCOMPLETE`). Override with `--force` |
333
+ | `off` | Skip epic completeness checks entirely |
334
+
335
+ ```json
336
+ {
337
+ "release": {
338
+ "guards": {
339
+ "epicCompleteness": "warn"
340
+ }
341
+ }
342
+ }
343
+ ```
344
+
345
+ ### Double-Listing Detection
346
+
347
+ Warns when a task appears in both the current release and a previously-shipped release. This is always a warning, never blocks. Catches accidental overlap from manual `--tasks` additions.
348
+
349
+ ### Task Preview (`--preview`)
350
+
351
+ Preview which tasks would be included in a release without shipping:
352
+
353
+ ```bash
354
+ cleo release ship v0.95.0 --preview
355
+ ```
356
+
357
+ Shows:
358
+ - Auto-discovered tasks (from 6-filter pipeline)
359
+ - Manually planned tasks (from `plan --tasks`)
360
+ - Source classification: `auto`, `manual`, or `both`
361
+ - Epic completeness warnings
362
+ - Double-listing warnings
363
+
364
+ The `--dry-run` flag includes the same preview plus the step enumeration.
365
+
366
+ ---
367
+
368
+ ## Validation Gates
369
+
370
+ | Gate | Check | Required | Notes |
371
+ |------|-------|----------|-------|
372
+ | Tests | All tests pass | SHOULD | Opt-in with `--run-tests` flag to avoid timeout |
373
+ | Schema | All schemas valid | MUST | Always enforced via `cleo validate` |
374
+ | Version | Version bumped correctly | MUST | If `--bump-version` used |
375
+ | Changelog | Entry for new version | MUST | Unless `--no-changelog` |
376
+ | Docs | Documentation current | SHOULD | Manual verification |
377
+ | Install | Installation works | SHOULD | Manual verification |
378
+
379
+ Use `--skip-validation` to bypass all gates for emergency releases. Use `--run-tests` to opt into running the full test suite (slow, disabled by default to avoid ship timeout).
380
+
381
+ ---
382
+
383
+ ## Tag Annotation Fallback (v0.83.0+)
384
+
385
+ When `--create-tag` is used, the tag annotation is populated from a fallback chain:
386
+
387
+ 1. **CHANGELOG.md section** -- extracted via `extract_changelog_section()`
388
+ 2. **Git commit notes** -- generated via `generate_changelog_from_commits()` from previous tag
389
+ 3. **Release description** -- from `release.notes` field in todo.json
390
+
391
+ This ensures tags always have meaningful content for GitHub Actions, even when `--no-changelog` skips CHANGELOG.md generation.
392
+
393
+ ---
394
+
395
+ ## Platform Changelog Configuration (v0.84.0+)
396
+
397
+ Platform-specific changelog generation is controlled by `.cleo/config.json`:
398
+
399
+ ```json
400
+ {
401
+ "release": {
402
+ "changelog": {
403
+ "outputs": [
404
+ { "platform": "mintlify", "enabled": true, "path": "docs/changelog/overview.mdx" }
405
+ ]
406
+ }
407
+ }
408
+ }
409
+ ```
410
+
411
+ Supported platforms: `mintlify`, `docusaurus`, `github`, `gitbook`, `plain`, `custom`.
412
+ Default for fresh installs: no platforms configured (only CHANGELOG.md generated).
413
+ GitHub URLs in generated output are resolved dynamically from `git remote origin`.
414
+
415
+ ---
416
+
417
+ ## CI/CD Integration
418
+
419
+ CLEO generates platform-specific CI workflow templates via `cleo release init-ci`. The general release automation pattern is:
420
+
421
+ ```
422
+ cleo release ship <version> --bump-version --create-tag --push
423
+ → tag push detected by CI
424
+ → CI: build → test → publish to registry
425
+ ```
426
+
427
+ Supported CI platforms: `github-actions`, `gitlab-ci`, `circleci` (see `init-ci` command above).
428
+
429
+ The generated workflow handles the CI side (build/test/publish). CLEO handles the CLEO side (changelog, version bump, tag, manifest entry). These are separate responsibilities.
430
+
431
+ ---
432
+
433
+ ## Version Bump Configuration
434
+
435
+ Version bumping is config-driven via `release.versionBump` in `.cleo/config.json`. The portable library (`lib/release/version-bump.sh`) supports four strategies: `plain` (VERSION files), `json` (package.json via jq), `toml` (Cargo.toml), and `sed` (custom patterns like README badges). Files marked `optional: true` are silently skipped if not present.
436
+
437
+ ---
438
+
439
+ ## Error Codes (50-59)
440
+
441
+ | Code | Constant | Meaning | Recovery |
442
+ |------|----------|---------|----------|
443
+ | 50 | `E_RELEASE_NOT_FOUND` | Release version not found | `cleo release list` |
444
+ | 51 | `E_RELEASE_EXISTS` | Version already exists | Use different version |
445
+ | 52 | `E_RELEASE_LOCKED` | Released = immutable | Create hotfix version |
446
+ | 53 | `E_INVALID_VERSION` | Bad semver format | Use `v{major}.{minor}.{patch}` |
447
+ | 54 | `E_VALIDATION_FAILED` | Validation gate failed | Fix validation errors |
448
+ | 55 | `E_VERSION_BUMP_FAILED` | bump-version.sh failed | Check VERSION file |
449
+ | 56 | `E_TAG_CREATION_FAILED` | Git tag/commit failed | Check git status, existing tags |
450
+ | 57 | `E_CHANGELOG_GENERATION_FAILED` | Changelog failed | Check lib/changelog.sh |
451
+ | 58 | `E_TAG_EXISTS` | Git tag already exists | Use `--force-tag` to overwrite |
452
+ | 59 | `E_TASKS_INCOMPLETE` | Epic completeness guard (block mode) | Complete remaining tasks, use `--force`, or set guard to `warn` |
453
+
454
+ ---
455
+
456
+ ## Output Format
457
+
458
+ ### Semantic Versioning
459
+
460
+ | Version Part | When to Increment | Example |
461
+ |--------------|-------------------|---------|
462
+ | Major (X.0.0) | Breaking changes | 1.0.0 → 2.0.0 |
463
+ | Minor (X.Y.0) | New features, backward compatible | 1.0.0 → 1.1.0 |
464
+ | Patch (X.Y.Z) | Bug fixes, backward compatible | 1.0.0 → 1.0.1 |
465
+
466
+ ### Changelog Format
467
+
468
+ ```markdown
469
+ # Changelog
470
+
471
+ All notable changes to this project will be documented in this file.
472
+
473
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
474
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
475
+
476
+ ## [Unreleased]
477
+
478
+ ### Added
479
+ - New features
480
+
481
+ ### Changed
482
+ - Changes in existing functionality
483
+
484
+ ### Deprecated
485
+ - Soon-to-be removed features
486
+
487
+ ### Removed
488
+ - Removed features
489
+
490
+ ### Fixed
491
+ - Bug fixes
492
+
493
+ ### Security
494
+ - Security fixes
495
+
496
+ ## [X.Y.Z] - YYYY-MM-DD
497
+
498
+ ### Added
499
+ - {Feature description} (T####)
500
+
501
+ ### Fixed
502
+ - {Bug fix description} (T####)
503
+
504
+ ### Changed
505
+ - {Change description} (T####)
506
+
507
+ ### Breaking Changes
508
+ - {Breaking change with migration path}
509
+ ```
510
+
511
+ ### Release Checklist
512
+
513
+ ```markdown
514
+ ## Release Checklist: vX.Y.Z
515
+
516
+ ### Pre-Release
517
+
518
+ - [ ] All features complete and merged
519
+ - [ ] Tests passing (recommended: ./tests/run-all-tests.sh)
520
+ - [ ] Version bumped (cleo release ship vX.Y.Z --bump-version)
521
+ - [ ] Version consistency verified (./dev/validate-version.sh)
522
+ - [ ] Changelog updated
523
+ - [ ] Documentation current
524
+ - [ ] Breaking changes documented
525
+ - [ ] For major/minor: Run `cleo release ship --run-tests` to validate
526
+
527
+ ### Release
528
+
529
+ - [ ] Create release commit
530
+ - [ ] Tag release (git tag vX.Y.Z)
531
+ - [ ] Push to remote (git push && git push --tags)
532
+ - [ ] Create GitHub release (if applicable)
533
+
534
+ ### Post-Release
535
+
536
+ - [ ] Verify installation works
537
+ - [ ] Update any dependent projects
538
+ - [ ] Announce release (if applicable)
539
+ - [ ] Archive completed tasks (cleo archive)
540
+ ```
541
+
542
+ ### File Output
543
+
544
+ ```markdown
545
+ # Release: vX.Y.Z
546
+
547
+ **Task**: T####
548
+ **Date**: YYYY-MM-DD
549
+ **Status**: complete|partial|blocked
550
+ **Agent Type**: documentation
551
+
552
+ ---
553
+
554
+ ## Release Summary
555
+
556
+ {2-3 sentence summary of this release}
557
+
558
+ ## Version Information
559
+
560
+ | Field | Value |
561
+ |-------|-------|
562
+ | Version | X.Y.Z |
563
+ | Previous | X.Y.W |
564
+ | Type | Major/Minor/Patch |
565
+ | Tag | vX.Y.Z |
566
+
567
+ ## Changes in This Release
568
+
569
+ ### Features
570
+
571
+ | Feature | Task | Description |
572
+ |---------|------|-------------|
573
+ | {Name} | T#### | {Description} |
574
+
575
+ ### Bug Fixes
576
+
577
+ | Fix | Task | Description |
578
+ |-----|------|-------------|
579
+ | {Name} | T#### | {Description} |
580
+
581
+ ### Breaking Changes
582
+
583
+ | Change | Migration |
584
+ |--------|-----------|
585
+ | {Change} | {How to migrate} |
586
+
587
+ ## Validation Results
588
+
589
+ | Gate | Status | Notes |
590
+ |------|--------|-------|
591
+ | Tests | PASS | 142 tests, 0 failures |
592
+ | Lint | PASS | No warnings |
593
+ | Version | PASS | Consistent across files |
594
+ | Changelog | PASS | Entry present |
595
+
596
+ ## Release Commands
597
+
598
+ ```bash
599
+ # Tag and push
600
+ git tag -a vX.Y.Z -m "Release vX.Y.Z"
601
+ git push origin main --tags
602
+
603
+ # Verify
604
+ git describe --tags
605
+ ```
606
+
607
+ ## Post-Release Tasks
608
+
609
+ - [ ] Verify GitHub release created
610
+ - [ ] Update documentation site
611
+ - [ ] Notify stakeholders
612
+ ```
613
+
614
+ ### Manifest Entry
615
+
616
+ @skills/_shared/manifest-operations.md
617
+
618
+ Use `cleo research add` to create the manifest entry:
619
+
620
+ ```bash
621
+ cleo research add \
622
+ --title "Release: vX.Y.Z" \
623
+ --file "YYYY-MM-DD_release-vXYZ.md" \
624
+ --topics "release,version,changelog" \
625
+ --findings "Version X.Y.Z released,3 features added,2 bugs fixed" \
626
+ --status complete \
627
+ --task T#### \
628
+ --not-actionable \
629
+ --agent-type documentation
630
+ ```
631
+
632
+ ---
633
+
634
+ ## Integration Points
635
+
636
+ ### Base Protocol
637
+
638
+ - Inherits task lifecycle (start, execute, complete)
639
+ - Inherits manifest append requirement
640
+ - Inherits error handling patterns
641
+
642
+ ### Protocol Interactions
643
+
644
+ | Combined With | Behavior |
645
+ |---------------|----------|
646
+ | contribution | Contributions feed changelog |
647
+ | implementation | Implementation changes tracked |
648
+ | specification | Spec changes documented |
649
+ | **artifact-publish** | Conditional sub-protocol — release triggers artifact-publish for the distribution phase when the release config has at least one enabled artifact handler. Source-only releases skip it. See composition pipeline below. |
650
+ | **provenance** | Conditional sub-protocol — invoked transitively via artifact-publish to sign artifacts (sigstore/cosign), generate SBOMs (CycloneDX/SPDX), and record the in-toto attestation chain in `.cleo/releases.json`. |
651
+
652
+ ---
653
+
654
+ ## Composition with Cross-Cutting Sub-Protocols
655
+
656
+ The release protocol is the **parent protocol** for the distribution flow. It composes two cross-cutting sub-protocols (`artifact-publish` and `provenance`) conditionally based on release config. **Not every release needs artifact publishing** — source-only releases (docs, chore bumps) skip both sub-protocols entirely.
657
+
658
+ ### Pipeline Diagram
659
+
660
+ ```
661
+ Release Protocol Artifact-Publish Protocol
662
+ ───────────────── ─────────────────────────
663
+ 1. Version bump
664
+ 2. Changelog generation
665
+ 3. Validation gates (RLSE-003)
666
+ 4. Git commit + tag
667
+ 5. ─ HANDOFF (if artifacts.enabled) ─► 6. Load artifact config
668
+ 7. Pre-validate (ARTP-001)
669
+ 8. Dry-run (ARTP-002)
670
+ 9. Build all artifacts
671
+ 10. Publish sequentially (ARTP-006)
672
+ 11. ─ Delegate to Provenance ─► Provenance Protocol
673
+ ─────────────────
674
+ 12. Compute SHA-256 digests (PROV-002)
675
+ 13. Generate in-toto v1 attestation (PROV-003)
676
+ 14. Sign (sigstore default, gpg, or none)
677
+ 15. Generate SBOM (CycloneDX/SPDX)
678
+ 16. Record chain in .cleo/releases.json (PROV-005)
679
+ 17. ◄─ RETURN attestation ───── 17. Return signed result
680
+ 18. Record provenance (ARTP-005)
681
+ 19. ◄─ RETURN pipeline result ─────── 19. Return artifacts + provenance
682
+ 20. Push tags to remote
683
+ 21. Mark release as released
684
+ ```
685
+
686
+ ### Conditional Trigger Matrix
687
+
688
+ Not every release needs both sub-protocols. The release skill (`ct-release-orchestrator`) MUST consult the release config and decide:
689
+
690
+ | Release Type | artifact-publish? | provenance? | Notes |
691
+ |--------------|-------------------|-------------|-------|
692
+ | Source-only (docs, chore) | no | no | Tag + push only; no distributable produced |
693
+ | npm package | **yes** | **yes** | npm registry publish via `--provenance` (SLSA L3 via OIDC) |
694
+ | Python wheel/sdist | yes | yes | PyPI publish; provenance via cosign attestation |
695
+ | Cargo crate | yes | yes | crates.io publish; provenance attached to crate manifest |
696
+ | Go module | yes (tag-only) | optional | Module proxy resolves from tag; provenance is advisory |
697
+ | Docker image | **yes** | **yes** | Registry push + cosign sign + SBOM attached |
698
+ | GitHub release tarball | yes | optional | Tarball + checksum; provenance recommended for binaries |
699
+ | Generic tarball | yes | optional | Custom handler; provenance configurable |
700
+
701
+ ### Composition Invariants
702
+
703
+ | ID | Rule |
704
+ |----|------|
705
+ | COMP-001 | Release MUST NOT push tags before artifact-publish completes successfully (rollback safety). |
706
+ | COMP-002 | Artifact-publish MUST delegate signing/attestation to provenance — it MUST NOT generate attestations directly. |
707
+ | COMP-003 | If artifact-publish fails, release MUST attempt rollback and exit with code 88 ARTIFACT_PUBLISH_FAILED. |
708
+ | COMP-004 | If provenance fails, artifact-publish MUST exit with code 94 ATTESTATION_INVALID — release does not finalize. |
709
+ | COMP-005 | The release manifest entry MUST reference both the artifact-publish manifest entry and the provenance manifest entry (full chain traceability). |
710
+ | COMP-006 | The skill `ct-release-orchestrator` is the parent. It loads `ct-artifact-publisher` and `ct-provenance-keeper` as sub-skills via progressive disclosure. |
711
+
712
+ ### Where the Composition Lives in Code
713
+
714
+ | Layer | Location |
715
+ |-------|----------|
716
+ | Skill orchestration | `packages/skills/skills/ct-release-orchestrator/SKILL.md` |
717
+ | Sub-skill (artifact) | `packages/skills/skills/ct-artifact-publisher/SKILL.md` |
718
+ | Sub-skill (provenance) | `packages/skills/skills/ct-provenance-keeper/SKILL.md` |
719
+ | Engine composition | `packages/cleo/src/dispatch/engines/release-engine.ts#releaseShip()` (conditional fork after commit + tag, before push) |
720
+ | Validators | `packages/core/src/orchestration/protocol-validators.ts` (`validateReleaseProtocol`, `validateArtifactPublishProtocol`, `validateProvenanceProtocol`) |
721
+ | CI integration | `.github/workflows/release.yml` already uses `npm publish --provenance` (SLSA L3 via OIDC trusted publishing) — the protocol layer surfaces this in the manifest |
722
+
723
+ ### Dispatch Examples
724
+
725
+ ```bash
726
+ # Source-only release: skip both sub-protocols
727
+ cleo release ship v2026.4.5 --epic T### # release config has no artifact handlers
728
+
729
+ # Full release with artifacts + provenance
730
+ cleo release ship v2026.4.5 --epic T### # release config has npm-package handler enabled
731
+ # → release-engine.ts forks to artifact-publish after commit+tag
732
+ # → artifact-publish delegates to provenance for signing
733
+ # → all three manifest entries get linked in .cleo/releases.json
734
+
735
+ # Validate the chain after a release
736
+ cleo check protocol --protocolType release --version v2026.4.5 --hasChangelog true
737
+ cleo check protocol --protocolType artifact-publish --artifactType npm-package --buildPassed true
738
+ cleo check protocol --protocolType provenance --hasAttestation true --hasSbom true
739
+ ```
740
+
741
+ ---
742
+
743
+ ## Example
744
+
745
+ **Task**: Release CLEO v0.70.0
746
+
747
+ **Manifest Entry Command**:
748
+ ```bash
749
+ cleo research add \
750
+ --title "Release: v0.70.0" \
751
+ --file "2026-01-26_release-v0700.md" \
752
+ --topics "release,v0.70.0,changelog" \
753
+ --findings "Multi-agent support added,12 new commands,Full test coverage" \
754
+ --status complete \
755
+ --task T2350 \
756
+ --epic T2308 \
757
+ --not-actionable \
758
+ --agent-type documentation
759
+ ```
760
+
761
+ **Return Message**:
762
+ ```
763
+ Release complete. See MANIFEST.jsonl for summary.
764
+ ```
765
+
766
+ ---
767
+
768
+ ## Anti-Patterns
769
+
770
+ | Pattern | Why Avoid |
771
+ |---------|-----------|
772
+ | Skipping version bump | Version confusion |
773
+ | Missing changelog entry | Lost history |
774
+ | Undocumented breaking changes | User frustration |
775
+ | No release tag | Cannot reference version |
776
+ | Incomplete checklist | Missed steps |
777
+ | Major releases without `--run-tests` | Quality risk for breaking changes |
778
+ | Ignoring epic completeness warnings | Shipping partial epics without review |
779
+ | Overusing --force | Bypasses guards that catch legitimate issues |
780
+
781
+ ---
782
+
783
+ *Protocol Version 2.2.0 - Canonical release reference (consolidated from RELEASE-MANAGEMENT.mdx)*