@cleocode/contracts 2026.5.112 → 2026.5.114

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 (108) hide show
  1. package/dist/__tests__/cli-meta-suggested-next.test.d.ts +21 -0
  2. package/dist/__tests__/cli-meta-suggested-next.test.d.ts.map +1 -0
  3. package/dist/__tests__/cli-meta-suggested-next.test.js +70 -0
  4. package/dist/__tests__/cli-meta-suggested-next.test.js.map +1 -0
  5. package/dist/config/__tests__/manifest.test.d.ts +13 -0
  6. package/dist/config/__tests__/manifest.test.d.ts.map +1 -0
  7. package/dist/config/__tests__/manifest.test.js +143 -0
  8. package/dist/config/__tests__/manifest.test.js.map +1 -0
  9. package/dist/config/manifest.d.ts +158 -0
  10. package/dist/config/manifest.d.ts.map +1 -0
  11. package/dist/config/manifest.js +123 -0
  12. package/dist/config/manifest.js.map +1 -0
  13. package/dist/docs/__tests__/provenance.test.d.ts +14 -0
  14. package/dist/docs/__tests__/provenance.test.d.ts.map +1 -0
  15. package/dist/docs/__tests__/provenance.test.js +579 -0
  16. package/dist/docs/__tests__/provenance.test.js.map +1 -0
  17. package/dist/docs/provenance.d.ts +731 -0
  18. package/dist/docs/provenance.d.ts.map +1 -0
  19. package/dist/docs/provenance.js +258 -0
  20. package/dist/docs/provenance.js.map +1 -0
  21. package/dist/docs-taxonomy.d.ts +24 -0
  22. package/dist/docs-taxonomy.d.ts.map +1 -1
  23. package/dist/docs-taxonomy.js +27 -0
  24. package/dist/docs-taxonomy.js.map +1 -1
  25. package/dist/doctor.d.ts +101 -0
  26. package/dist/doctor.d.ts.map +1 -1
  27. package/dist/errors.d.ts +4 -0
  28. package/dist/errors.d.ts.map +1 -1
  29. package/dist/errors.js +4 -0
  30. package/dist/errors.js.map +1 -1
  31. package/dist/exit-codes.d.ts +37 -0
  32. package/dist/exit-codes.d.ts.map +1 -1
  33. package/dist/exit-codes.js +37 -0
  34. package/dist/exit-codes.js.map +1 -1
  35. package/dist/index.d.ts +12 -4
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +11 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/invariants/__tests__/adr-056-release.test.d.ts +16 -0
  40. package/dist/invariants/__tests__/adr-056-release.test.d.ts.map +1 -0
  41. package/dist/invariants/__tests__/adr-056-release.test.js +88 -0
  42. package/dist/invariants/__tests__/adr-056-release.test.js.map +1 -0
  43. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts +22 -0
  44. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts.map +1 -0
  45. package/dist/invariants/__tests__/adr-070-orchestration.test.js +151 -0
  46. package/dist/invariants/__tests__/adr-070-orchestration.test.js.map +1 -0
  47. package/dist/invariants/adr-056-release.d.ts +42 -0
  48. package/dist/invariants/adr-056-release.d.ts.map +1 -0
  49. package/dist/invariants/adr-056-release.js +143 -0
  50. package/dist/invariants/adr-056-release.js.map +1 -0
  51. package/dist/invariants/adr-070-orchestration.d.ts +73 -0
  52. package/dist/invariants/adr-070-orchestration.d.ts.map +1 -0
  53. package/dist/invariants/adr-070-orchestration.js +290 -0
  54. package/dist/invariants/adr-070-orchestration.js.map +1 -0
  55. package/dist/invariants/index.d.ts +4 -1
  56. package/dist/invariants/index.d.ts.map +1 -1
  57. package/dist/invariants/index.js +11 -2
  58. package/dist/invariants/index.js.map +1 -1
  59. package/dist/operations/__tests__/input-contract.test.d.ts +20 -0
  60. package/dist/operations/__tests__/input-contract.test.d.ts.map +1 -0
  61. package/dist/operations/__tests__/input-contract.test.js +158 -0
  62. package/dist/operations/__tests__/input-contract.test.js.map +1 -0
  63. package/dist/operations/__tests__/tasks-input-contracts.test.d.ts +18 -0
  64. package/dist/operations/__tests__/tasks-input-contracts.test.d.ts.map +1 -0
  65. package/dist/operations/__tests__/tasks-input-contracts.test.js +80 -0
  66. package/dist/operations/__tests__/tasks-input-contracts.test.js.map +1 -0
  67. package/dist/operations/docs.d.ts +16 -0
  68. package/dist/operations/docs.d.ts.map +1 -1
  69. package/dist/operations/input-contract.d.ts +267 -0
  70. package/dist/operations/input-contract.d.ts.map +1 -0
  71. package/dist/operations/input-contract.js +29 -0
  72. package/dist/operations/input-contract.js.map +1 -0
  73. package/dist/operations/tasks.d.ts +96 -0
  74. package/dist/operations/tasks.d.ts.map +1 -1
  75. package/dist/operations/tasks.js +237 -1
  76. package/dist/operations/tasks.js.map +1 -1
  77. package/dist/templates/__tests__/manifest.test.d.ts +18 -0
  78. package/dist/templates/__tests__/manifest.test.d.ts.map +1 -0
  79. package/dist/templates/__tests__/manifest.test.js +123 -0
  80. package/dist/templates/__tests__/manifest.test.js.map +1 -0
  81. package/dist/templates/manifest.d.ts +186 -0
  82. package/dist/templates/manifest.d.ts.map +1 -0
  83. package/dist/templates/manifest.js +165 -0
  84. package/dist/templates/manifest.js.map +1 -0
  85. package/package.json +2 -2
  86. package/src/__tests__/cli-meta-suggested-next.test.ts +76 -0
  87. package/src/config/__tests__/manifest.test.ts +176 -0
  88. package/src/config/manifest.ts +218 -0
  89. package/src/docs/__tests__/__snapshots__/provenance.test.ts.snap +252 -0
  90. package/src/docs/__tests__/provenance.test.ts +648 -0
  91. package/src/docs/provenance.ts +601 -0
  92. package/src/docs-taxonomy.ts +55 -0
  93. package/src/doctor.ts +111 -0
  94. package/src/errors.ts +4 -0
  95. package/src/exit-codes.ts +39 -0
  96. package/src/index.ts +102 -0
  97. package/src/invariants/__tests__/adr-056-release.test.ts +102 -0
  98. package/src/invariants/__tests__/adr-070-orchestration.test.ts +186 -0
  99. package/src/invariants/adr-056-release.ts +154 -0
  100. package/src/invariants/adr-070-orchestration.ts +317 -0
  101. package/src/invariants/index.ts +11 -2
  102. package/src/operations/__tests__/input-contract.test.ts +188 -0
  103. package/src/operations/__tests__/tasks-input-contracts.test.ts +106 -0
  104. package/src/operations/docs.ts +16 -0
  105. package/src/operations/input-contract.ts +301 -0
  106. package/src/operations/tasks.ts +308 -0
  107. package/src/templates/__tests__/manifest.test.ts +140 -0
  108. package/src/templates/manifest.ts +208 -0
@@ -17,5 +17,241 @@
17
17
  * @task T1446 — strip redundant Params/Result aliases (T1435-W2)
18
18
  * @task T1703 — Fill Result=unknown stubs with canonical typed shapes
19
19
  */
20
- export {};
20
+ /**
21
+ * JSON Schema draft-07 document describing the accepted input shape for
22
+ * the `tasks.add` mutate operation.
23
+ *
24
+ * Mirrors {@link TasksAddParams} field-for-field. Set
25
+ * `additionalProperties: false` so a typo'd flag fails fast with a typed
26
+ * `E_VAL_ADDITIONALPROPERTIES` error instead of being silently dropped.
27
+ *
28
+ * @task T9917
29
+ */
30
+ export const TASKS_ADD_INPUT_SCHEMA = {
31
+ type: 'object',
32
+ required: ['title'],
33
+ additionalProperties: false,
34
+ properties: {
35
+ title: { type: 'string', minLength: 1, maxLength: 500 },
36
+ description: { type: 'string' },
37
+ parent: { type: 'string' },
38
+ depends: { type: 'array', items: { type: 'string' } },
39
+ priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
40
+ labels: { type: 'array', items: { type: 'string' } },
41
+ type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
42
+ acceptance: { type: 'array', items: { type: 'string' } },
43
+ phase: { type: 'string' },
44
+ size: { type: 'string', enum: ['small', 'medium', 'large'] },
45
+ notes: { type: 'string' },
46
+ files: { type: 'array', items: { type: 'string' } },
47
+ dryRun: { type: 'boolean' },
48
+ parentSearch: { type: 'string' },
49
+ kind: {
50
+ type: 'string',
51
+ enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
52
+ },
53
+ scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
54
+ severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
55
+ forceDuplicate: { type: 'boolean' },
56
+ },
57
+ };
58
+ /**
59
+ * Schema-first input contract for `tasks.add`.
60
+ *
61
+ * @task T9917
62
+ */
63
+ export const tasksAddInputContract = {
64
+ operation: 'tasks.add',
65
+ schema: TASKS_ADD_INPUT_SCHEMA,
66
+ examples: [
67
+ {
68
+ name: 'minimal',
69
+ value: { title: 'Ship E7-MUTATE-DX-SCHEMA-FIRST' },
70
+ description: 'Smallest valid input — title is the only required field.',
71
+ },
72
+ {
73
+ name: 'subtask-with-acceptance',
74
+ value: {
75
+ title: 'Wire validator into add command',
76
+ parent: 'T9903',
77
+ priority: 'high',
78
+ acceptance: ['validator runs before dispatch', 'errors surface in envelope'],
79
+ },
80
+ },
81
+ ],
82
+ };
83
+ /**
84
+ * JSON Schema draft-07 document describing the accepted input shape for
85
+ * the `tasks.add-batch` mutate operation.
86
+ *
87
+ * Wraps N `tasks.add` specs in a single atomic transaction. `dryRun` is
88
+ * hoisted to the batch level (single rollback unit), so the per-entry
89
+ * schema OMITS `dryRun` deliberately.
90
+ *
91
+ * @task T9917
92
+ */
93
+ export const TASKS_ADD_BATCH_INPUT_SCHEMA = {
94
+ type: 'object',
95
+ required: ['tasks'],
96
+ additionalProperties: false,
97
+ properties: {
98
+ tasks: {
99
+ type: 'array',
100
+ minItems: 1,
101
+ items: {
102
+ type: 'object',
103
+ required: ['title'],
104
+ additionalProperties: false,
105
+ properties: {
106
+ title: { type: 'string', minLength: 1, maxLength: 500 },
107
+ description: { type: 'string' },
108
+ parent: { type: 'string' },
109
+ depends: { type: 'array', items: { type: 'string' } },
110
+ priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
111
+ labels: { type: 'array', items: { type: 'string' } },
112
+ type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
113
+ acceptance: { type: 'array', items: { type: 'string' } },
114
+ phase: { type: 'string' },
115
+ size: { type: 'string', enum: ['small', 'medium', 'large'] },
116
+ notes: { type: 'string' },
117
+ files: { type: 'array', items: { type: 'string' } },
118
+ kind: {
119
+ type: 'string',
120
+ enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
121
+ },
122
+ scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
123
+ severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
124
+ forceDuplicate: { type: 'boolean' },
125
+ },
126
+ },
127
+ },
128
+ defaultParent: { type: 'string' },
129
+ dryRun: { type: 'boolean' },
130
+ },
131
+ };
132
+ /**
133
+ * Schema-first input contract for `tasks.add-batch`.
134
+ *
135
+ * @task T9917
136
+ */
137
+ export const tasksAddBatchInputContract = {
138
+ operation: 'tasks.add-batch',
139
+ schema: TASKS_ADD_BATCH_INPUT_SCHEMA,
140
+ examples: [
141
+ {
142
+ name: 'two-tasks',
143
+ value: {
144
+ tasks: [{ title: 'first task' }, { title: 'second task' }],
145
+ },
146
+ description: 'Atomic insert of two tasks under no shared parent.',
147
+ },
148
+ {
149
+ name: 'with-default-parent',
150
+ value: {
151
+ defaultParent: 'T9903',
152
+ tasks: [{ title: 'a' }, { title: 'b', parent: 'T9914' }],
153
+ },
154
+ description: 'defaultParent applies to entries without an explicit parent.',
155
+ },
156
+ ],
157
+ };
158
+ /**
159
+ * JSON Schema draft-07 document describing the accepted input shape for
160
+ * the `tasks.update` mutate operation.
161
+ *
162
+ * Mirrors {@link TasksUpdateQueryParams}. `taskId` is REQUIRED. All other
163
+ * fields are optional — `tasks.update` is a partial update; only the
164
+ * fields supplied are mutated.
165
+ *
166
+ * @task T9917
167
+ */
168
+ export const TASKS_UPDATE_INPUT_SCHEMA = {
169
+ type: 'object',
170
+ required: ['taskId'],
171
+ additionalProperties: false,
172
+ properties: {
173
+ taskId: { type: 'string', minLength: 1 },
174
+ title: { type: 'string', minLength: 1, maxLength: 500 },
175
+ description: { type: 'string' },
176
+ status: {
177
+ type: 'string',
178
+ enum: ['pending', 'active', 'blocked', 'done', 'cancelled'],
179
+ },
180
+ priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
181
+ notes: { type: 'string' },
182
+ labels: { type: 'array', items: { type: 'string' } },
183
+ addLabels: { type: 'array', items: { type: 'string' } },
184
+ removeLabels: { type: 'array', items: { type: 'string' } },
185
+ depends: { type: 'array', items: { type: 'string' } },
186
+ addDepends: { type: 'array', items: { type: 'string' } },
187
+ removeDepends: { type: 'array', items: { type: 'string' } },
188
+ acceptance: { type: 'array', items: { type: 'string' } },
189
+ parent: { type: ['string', 'null'] },
190
+ type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
191
+ size: { type: 'string', enum: ['small', 'medium', 'large'] },
192
+ files: { type: 'array', items: { type: 'string' } },
193
+ addFiles: { type: 'array', items: { type: 'string' } },
194
+ removeFiles: { type: 'array', items: { type: 'string' } },
195
+ pipelineStage: { type: 'string' },
196
+ kind: {
197
+ type: 'string',
198
+ enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
199
+ },
200
+ scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
201
+ severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
202
+ reason: { type: 'string' },
203
+ dependsWaiver: { type: 'string' },
204
+ clearBlockedBy: { type: 'boolean' },
205
+ relates: {
206
+ type: 'array',
207
+ items: {
208
+ type: 'object',
209
+ required: ['taskId', 'type'],
210
+ additionalProperties: false,
211
+ properties: {
212
+ taskId: { type: 'string', minLength: 1 },
213
+ type: { type: 'string', minLength: 1 },
214
+ reason: { type: 'string' },
215
+ },
216
+ },
217
+ },
218
+ addRelates: {
219
+ type: 'array',
220
+ items: {
221
+ type: 'object',
222
+ required: ['taskId', 'type'],
223
+ additionalProperties: false,
224
+ properties: {
225
+ taskId: { type: 'string', minLength: 1 },
226
+ type: { type: 'string', minLength: 1 },
227
+ reason: { type: 'string' },
228
+ },
229
+ },
230
+ },
231
+ removeRelates: { type: 'array', items: { type: 'string' } },
232
+ },
233
+ };
234
+ /**
235
+ * Schema-first input contract for `tasks.update`.
236
+ *
237
+ * @task T9917
238
+ */
239
+ export const tasksUpdateInputContract = {
240
+ operation: 'tasks.update',
241
+ schema: TASKS_UPDATE_INPUT_SCHEMA,
242
+ examples: [
243
+ {
244
+ name: 'set-status',
245
+ value: { taskId: 'T9917', status: 'active' },
246
+ description: 'Transition status to active.',
247
+ },
248
+ {
249
+ name: 'add-labels-incrementally',
250
+ value: {
251
+ taskId: 'T9917',
252
+ addLabels: ['saga.t9855', 'epic.t9903'],
253
+ },
254
+ },
255
+ ],
256
+ };
21
257
  //# sourceMappingURL=tasks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/operations/tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/operations/tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA03CH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAe;IAChD,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;QACvD,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACrD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE;QACzE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACpD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;QACnE,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,E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AS,EAAE,cAAc;IACzB,MAAM,EAAE,yBAAyB;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;YAC5C,WAAW,EAAE,8BAA8B;SAC5C;QACD;YACE,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE;gBACL,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;aACxC;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Contract tests for the TemplateManifest schema.
3
+ *
4
+ * Asserts:
5
+ *
6
+ * 1. A valid entry for every {@link TemplateKind} parses successfully.
7
+ * 2. An entry with an unknown `kind` is rejected.
8
+ * 3. An entry missing `installPath` is rejected.
9
+ * 4. The {@link PlaceholderSpec} `source` field is exhaustively typed —
10
+ * every member of {@link PLACEHOLDER_SOURCES} parses, and a bogus
11
+ * source value is rejected.
12
+ *
13
+ * @task T9875
14
+ * @epic T9874
15
+ * @saga T9855
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=manifest.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.test.d.ts","sourceRoot":"","sources":["../../../src/templates/__tests__/manifest.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Contract tests for the TemplateManifest schema.
3
+ *
4
+ * Asserts:
5
+ *
6
+ * 1. A valid entry for every {@link TemplateKind} parses successfully.
7
+ * 2. An entry with an unknown `kind` is rejected.
8
+ * 3. An entry missing `installPath` is rejected.
9
+ * 4. The {@link PlaceholderSpec} `source` field is exhaustively typed —
10
+ * every member of {@link PLACEHOLDER_SOURCES} parses, and a bogus
11
+ * source value is rejected.
12
+ *
13
+ * @task T9875
14
+ * @epic T9874
15
+ * @saga T9855
16
+ */
17
+ import { describe, expect, it } from 'vitest';
18
+ import { PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TEMPLATE_KINDS, TemplateManifestEntrySchema, } from '../manifest.js';
19
+ /**
20
+ * Build a valid baseline entry parameterized by `kind` so each
21
+ * assertion below stays minimal.
22
+ */
23
+ function baseEntry(kind) {
24
+ return {
25
+ id: `sample-${kind}`,
26
+ kind,
27
+ sourcePath: `packages/core/templates/${kind}s/sample.tmpl`,
28
+ installPath: `.cleo/${kind}s/sample`,
29
+ substitution: 'regex-tmpl',
30
+ placeholders: [
31
+ {
32
+ name: 'NODE_VERSION',
33
+ source: 'project-context',
34
+ sourcePath: 'engines.node',
35
+ defaultValue: 24,
36
+ },
37
+ ],
38
+ updateStrategy: 'overwrite-on-bump',
39
+ };
40
+ }
41
+ describe('TemplateManifestEntrySchema (T9875)', () => {
42
+ it('accepts a valid entry for every TemplateKind', () => {
43
+ for (const kind of TEMPLATE_KINDS) {
44
+ const entry = baseEntry(kind);
45
+ const parsed = TemplateManifestEntrySchema.parse(entry);
46
+ expect(parsed.kind, `kind '${kind}' must round-trip`).toBe(kind);
47
+ expect(parsed.installPath).toBe(entry.installPath);
48
+ }
49
+ });
50
+ it('rejects an entry with an unknown kind', () => {
51
+ const bogus = {
52
+ ...baseEntry('workflow'),
53
+ kind: 'not-a-real-kind',
54
+ };
55
+ const result = TemplateManifestEntrySchema.safeParse(bogus);
56
+ expect(result.success).toBe(false);
57
+ });
58
+ it('rejects an entry missing installPath', () => {
59
+ const { installPath: _drop, ...rest } = baseEntry('config');
60
+ const result = TemplateManifestEntrySchema.safeParse(rest);
61
+ expect(result.success).toBe(false);
62
+ });
63
+ it('accepts an entry whose placeholders array is empty', () => {
64
+ const entry = { ...baseEntry('doc'), placeholders: [] };
65
+ const result = TemplateManifestEntrySchema.safeParse(entry);
66
+ expect(result.success).toBe(true);
67
+ });
68
+ it('accepts a defaultValue of every supported literal type and null', () => {
69
+ const types = [
70
+ { defaultValue: 'string-default' },
71
+ { defaultValue: 42 },
72
+ { defaultValue: true },
73
+ { defaultValue: null },
74
+ {},
75
+ ];
76
+ for (const extra of types) {
77
+ const result = PlaceholderSpecSchema.safeParse({
78
+ name: 'X',
79
+ source: 'literal',
80
+ sourcePath: 'X',
81
+ ...extra,
82
+ });
83
+ expect(result.success, `defaultValue case ${JSON.stringify(extra)} must parse`).toBe(true);
84
+ }
85
+ });
86
+ });
87
+ describe('PlaceholderSpecSchema source enum (T9875)', () => {
88
+ it('exhaustively accepts every member of PLACEHOLDER_SOURCES', () => {
89
+ for (const source of PLACEHOLDER_SOURCES) {
90
+ const result = PlaceholderSpecSchema.safeParse({
91
+ name: 'PLACEHOLDER',
92
+ source,
93
+ sourcePath: 'some.path',
94
+ });
95
+ expect(result.success, `source '${source}' must parse`).toBe(true);
96
+ }
97
+ });
98
+ it('rejects an unknown source value', () => {
99
+ const result = PlaceholderSpecSchema.safeParse({
100
+ name: 'PLACEHOLDER',
101
+ source: 'not-a-source',
102
+ sourcePath: 'some.path',
103
+ });
104
+ expect(result.success).toBe(false);
105
+ });
106
+ it('rejects an empty name', () => {
107
+ const result = PlaceholderSpecSchema.safeParse({
108
+ name: '',
109
+ source: 'project-context',
110
+ sourcePath: 'some.path',
111
+ });
112
+ expect(result.success).toBe(false);
113
+ });
114
+ it('rejects an empty sourcePath', () => {
115
+ const result = PlaceholderSpecSchema.safeParse({
116
+ name: 'X',
117
+ source: 'project-context',
118
+ sourcePath: '',
119
+ });
120
+ expect(result.success).toBe(false);
121
+ });
122
+ });
123
+ //# sourceMappingURL=manifest.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.test.js","sourceRoot":"","sources":["../../../src/templates/__tests__/manifest.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EAGd,2BAA2B,GAC5B,MAAM,g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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * TemplateManifest contract — SSoT for every template CLEO ships, installs,
3
+ * or rewrites during `cleo init` / `cleo upgrade` / `cleo scaffold-*`.
4
+ *
5
+ * A {@link TemplateManifestEntry} declares one template file: where its
6
+ * source lives in the monorepo, where it installs into a consumer project,
7
+ * how its placeholders are substituted, which placeholders it accepts, and
8
+ * how it MUST be reconciled when the shipped version moves ahead of the
9
+ * deployed copy.
10
+ *
11
+ * This contract is the leaf type. The CORE-side template registry
12
+ * (T9877) consumes it; the CLI verbs (`cleo init --workflows`,
13
+ * `cleo upgrade`, the scaffold sweeper) read the manifest at runtime to
14
+ * decide what to write, what to skip, and what to diff-prompt the user on.
15
+ *
16
+ * @example minimal workflow template entry
17
+ * ```ts
18
+ * import { TemplateManifestEntrySchema, type TemplateManifestEntry } from '@cleocode/contracts';
19
+ *
20
+ * const entry: TemplateManifestEntry = TemplateManifestEntrySchema.parse({
21
+ * id: 'ci.yml',
22
+ * kind: 'workflow',
23
+ * sourcePath: 'packages/core/templates/workflows/ci.yml.tmpl',
24
+ * installPath: '.github/workflows/ci.yml',
25
+ * substitution: 'regex-tmpl',
26
+ * placeholders: [
27
+ * {
28
+ * name: 'NODE_VERSION',
29
+ * source: 'project-context',
30
+ * sourcePath: 'engines.node',
31
+ * defaultValue: 24,
32
+ * },
33
+ * ],
34
+ * updateStrategy: 'overwrite-on-bump',
35
+ * });
36
+ * ```
37
+ *
38
+ * @task T9875
39
+ * @epic T9874
40
+ * @saga T9855
41
+ * @see ADR-076 (canonical doc routing — same boundary discipline applies here)
42
+ */
43
+ import { z } from 'zod';
44
+ /**
45
+ * Allowed categories of template the manifest can describe.
46
+ *
47
+ * - `workflow` — GitHub Actions / CI workflow files.
48
+ * - `config` — Configuration files (e.g. `.editorconfig`, `tsconfig.json`).
49
+ * - `agent` — Agent definition files shipped to `.claude/agents/` etc.
50
+ * - `skill` — Skill markdown shipped to `.claude/skills/` etc.
51
+ * - `provider` — Provider-specific bootstrap files (Anthropic, OpenAI, …).
52
+ * - `doc` — Documentation scaffolds (e.g. README.md, AGENTS.md).
53
+ */
54
+ export declare const TEMPLATE_KINDS: readonly ["workflow", "config", "agent", "skill", "provider", "doc"];
55
+ /** Discriminator for the category of file a template represents. */
56
+ export type TemplateKind = (typeof TEMPLATE_KINDS)[number];
57
+ /**
58
+ * Allowed substitution strategies a template can request.
59
+ *
60
+ * - `regex-tmpl` — `{{KEY}}` placeholder substitution via regex.
61
+ * - `static` — No substitution; the file is copied byte-for-byte.
62
+ * - `json-merge` — The template is parsed as JSON and merged into any
63
+ * existing JSON file at `installPath`; placeholders inside
64
+ * string values still go through `regex-tmpl`.
65
+ */
66
+ export declare const TEMPLATE_SUBSTITUTIONS: readonly ["regex-tmpl", "static", "json-merge"];
67
+ /** Strategy the installer uses to materialize a template's `sourcePath`. */
68
+ export type TemplateSubstitution = (typeof TEMPLATE_SUBSTITUTIONS)[number];
69
+ /**
70
+ * How an installed template is reconciled with the shipped copy on
71
+ * `cleo upgrade` / `cleo init --force`.
72
+ *
73
+ * - `overwrite-on-bump` — Always overwrite when the manifest version is
74
+ * newer than the deployed copy.
75
+ * - `diff-prompt` — Show a diff and ask the user before overwriting.
76
+ * - `immutable` — Never overwrite once installed.
77
+ * - `manifest-merge` — Apply structural merge (e.g. JSON deep-merge,
78
+ * respecting existing user keys).
79
+ */
80
+ export declare const TEMPLATE_UPDATE_STRATEGIES: readonly ["overwrite-on-bump", "diff-prompt", "immutable", "manifest-merge"];
81
+ /** Reconciliation policy for an installed template on upgrade. */
82
+ export type UpdateStrategy = (typeof TEMPLATE_UPDATE_STRATEGIES)[number];
83
+ /**
84
+ * Allowed resolver sources a {@link PlaceholderSpec} can reference.
85
+ *
86
+ * - `project-context` — `.cleo/project-context.json` (detected ecosystem hints).
87
+ * - `project-info` — `.cleo/project-info.json` (per-project metadata).
88
+ * - `.cleo/config` — Per-project config (`<projectRoot>/.cleo/config.json`).
89
+ * - `~/.cleo/config` — User-global config (`$XDG_CONFIG_HOME/cleo/config.json`).
90
+ * - `tool-resolver` — Resolved via the per-language tool resolver
91
+ * (e.g. `pnpm` vs `npm` chosen by `primaryType`).
92
+ * - `literal` — Hard-coded value baked into the manifest entry.
93
+ */
94
+ export declare const PLACEHOLDER_SOURCES: readonly ["project-context", "project-info", ".cleo/config", "~/.cleo/config", "tool-resolver", "literal"];
95
+ /** Resolver source enum for {@link PlaceholderSpec.source}. */
96
+ export type PlaceholderSource = (typeof PLACEHOLDER_SOURCES)[number];
97
+ /**
98
+ * Zod schema for a single placeholder declaration on a template entry.
99
+ *
100
+ * Each placeholder is resolved at install time by reading `sourcePath` from
101
+ * the named `source`. If resolution returns `undefined`, the installer
102
+ * falls back to `defaultValue`; if neither yields a value, installation
103
+ * fails with `E_PLACEHOLDER_UNRESOLVED`.
104
+ */
105
+ export declare const PlaceholderSpecSchema: z.ZodObject<{
106
+ name: z.ZodString;
107
+ source: z.ZodEnum<{
108
+ literal: "literal";
109
+ "project-info": "project-info";
110
+ "project-context": "project-context";
111
+ ".cleo/config": ".cleo/config";
112
+ "~/.cleo/config": "~/.cleo/config";
113
+ "tool-resolver": "tool-resolver";
114
+ }>;
115
+ sourcePath: z.ZodString;
116
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
117
+ }, z.core.$strip>;
118
+ /**
119
+ * Zod-inferred input shape for a placeholder declaration.
120
+ *
121
+ * Identical to {@link PlaceholderSpec} — there are no schema transforms.
122
+ */
123
+ export type PlaceholderSpecInput = z.infer<typeof PlaceholderSpecSchema>;
124
+ /** Declared placeholder on a {@link TemplateManifestEntry}. */
125
+ export type PlaceholderSpec = PlaceholderSpecInput;
126
+ /**
127
+ * Zod schema for a single template manifest entry.
128
+ *
129
+ * Validates the full descriptor a template registry consumer needs to
130
+ * install a template file:
131
+ *
132
+ * - `id` — Stable identifier (kebab-case, matches install basename
133
+ * or a domain-unique slug).
134
+ * - `kind` — One of {@link TEMPLATE_KINDS}.
135
+ * - `sourcePath` — Repo-relative path of the template source.
136
+ * - `installPath` — Project-relative path where the rendered file lands.
137
+ * - `substitution` — One of {@link TEMPLATE_SUBSTITUTIONS}.
138
+ * - `placeholders` — Declared placeholders the installer must resolve.
139
+ * - `updateStrategy` — Reconciliation policy on upgrade.
140
+ */
141
+ export declare const TemplateManifestEntrySchema: z.ZodObject<{
142
+ id: z.ZodString;
143
+ kind: z.ZodEnum<{
144
+ agent: "agent";
145
+ config: "config";
146
+ provider: "provider";
147
+ workflow: "workflow";
148
+ doc: "doc";
149
+ skill: "skill";
150
+ }>;
151
+ sourcePath: z.ZodString;
152
+ installPath: z.ZodString;
153
+ substitution: z.ZodEnum<{
154
+ static: "static";
155
+ "regex-tmpl": "regex-tmpl";
156
+ "json-merge": "json-merge";
157
+ }>;
158
+ placeholders: z.ZodArray<z.ZodObject<{
159
+ name: z.ZodString;
160
+ source: z.ZodEnum<{
161
+ literal: "literal";
162
+ "project-info": "project-info";
163
+ "project-context": "project-context";
164
+ ".cleo/config": ".cleo/config";
165
+ "~/.cleo/config": "~/.cleo/config";
166
+ "tool-resolver": "tool-resolver";
167
+ }>;
168
+ sourcePath: z.ZodString;
169
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
170
+ }, z.core.$strip>>;
171
+ updateStrategy: z.ZodEnum<{
172
+ "overwrite-on-bump": "overwrite-on-bump";
173
+ "diff-prompt": "diff-prompt";
174
+ immutable: "immutable";
175
+ "manifest-merge": "manifest-merge";
176
+ }>;
177
+ }, z.core.$strip>;
178
+ /**
179
+ * Zod-inferred input shape for a template manifest entry.
180
+ *
181
+ * Identical to {@link TemplateManifestEntry} — there are no schema transforms.
182
+ */
183
+ export type TemplateManifestEntryInput = z.infer<typeof TemplateManifestEntrySchema>;
184
+ /** Public type for a fully-validated template manifest entry. */
185
+ export type TemplateManifestEntry = TemplateManifestEntryInput;
186
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/templates/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,sEAAuE,CAAC;AAEnG,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAI3D;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,iDAAkD,CAAC;AAEtF,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI3E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,8EAK7B,CAAC;AAEX,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,4GAOtB,CAAC;AAEX,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAmBhC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAInD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B;;;;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