@cleocode/contracts 2026.5.104 → 2026.5.105

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 (54) hide show
  1. package/dist/boundary.js +5 -5
  2. package/dist/boundary.js.map +1 -1
  3. package/dist/errors.d.ts +61 -0
  4. package/dist/errors.d.ts.map +1 -1
  5. package/dist/errors.js +46 -0
  6. package/dist/errors.js.map +1 -1
  7. package/dist/exit-codes.d.ts +13 -0
  8. package/dist/exit-codes.d.ts.map +1 -1
  9. package/dist/exit-codes.js +13 -0
  10. package/dist/exit-codes.js.map +1 -1
  11. package/dist/index.d.ts +5 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +5 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/release/ship-e2e-smoke.d.ts +97 -0
  16. package/dist/release/ship-e2e-smoke.d.ts.map +1 -0
  17. package/dist/release/ship-e2e-smoke.js +20 -0
  18. package/dist/release/ship-e2e-smoke.js.map +1 -0
  19. package/dist/render/__tests__/envelope.test.d.ts +14 -0
  20. package/dist/render/__tests__/envelope.test.d.ts.map +1 -0
  21. package/dist/render/__tests__/envelope.test.js +178 -0
  22. package/dist/render/__tests__/envelope.test.js.map +1 -0
  23. package/dist/render/envelope.d.ts +103 -0
  24. package/dist/render/envelope.d.ts.map +1 -0
  25. package/dist/render/envelope.js +53 -0
  26. package/dist/render/envelope.js.map +1 -0
  27. package/dist/render/index.d.ts +16 -0
  28. package/dist/render/index.d.ts.map +1 -0
  29. package/dist/render/index.js +12 -0
  30. package/dist/render/index.js.map +1 -0
  31. package/dist/render/list.d.ts +77 -0
  32. package/dist/render/list.d.ts.map +1 -0
  33. package/dist/render/list.js +39 -0
  34. package/dist/render/list.js.map +1 -0
  35. package/dist/render/table.d.ts +73 -0
  36. package/dist/render/table.d.ts.map +1 -0
  37. package/dist/render/table.js +32 -0
  38. package/dist/render/table.js.map +1 -0
  39. package/dist/render/tree.d.ts +94 -0
  40. package/dist/render/tree.d.ts.map +1 -0
  41. package/dist/render/tree.js +30 -0
  42. package/dist/render/tree.js.map +1 -0
  43. package/package.json +2 -2
  44. package/src/boundary.ts +5 -5
  45. package/src/errors.ts +71 -0
  46. package/src/exit-codes.ts +13 -0
  47. package/src/index.ts +15 -1
  48. package/src/release/ship-e2e-smoke.ts +113 -0
  49. package/src/render/__tests__/envelope.test.ts +194 -0
  50. package/src/render/envelope.ts +112 -0
  51. package/src/render/index.ts +40 -0
  52. package/src/render/list.ts +90 -0
  53. package/src/render/table.ts +85 -0
  54. package/src/render/tree.ts +114 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Ship E2E Smoke contracts — types for the `cleo release ship-e2e-smoke`
3
+ * one-shot walker that exercises the full release lifecycle end-to-end.
4
+ *
5
+ * The smoke runs `plan` → `open` → wait-for-PR-merge → wait-for-tag →
6
+ * verify-npm-published. Each step records its status, duration, and any
7
+ * side-effect identifier (PR number, tag SHA, npm version) for downstream
8
+ * inspection. The aggregate envelope reports the final lifecycle state
9
+ * reached so failures can be resumed.
10
+ *
11
+ * Dry-run is the default; `--execute` flips the runner to perform real
12
+ * mutations. Both modes return the same envelope shape so consumers can
13
+ * diff a dry-run preview against a real run.
14
+ *
15
+ * @task T10103
16
+ * @epic E-CLEO-RELEASE-VERBS
17
+ * @saga T10099
18
+ */
19
+ /**
20
+ * The discrete steps the smoke walker executes, in order. The aggregate
21
+ * envelope records one entry per step with status + duration.
22
+ */
23
+ export type ShipE2eSmokeStepName = 'plan' | 'open' | 'wait-for-pr' | 'wait-for-tag' | 'verify-npm-published';
24
+ /** Outcome of a single smoke step. */
25
+ export type ShipE2eSmokeStepStatus =
26
+ /** Step completed successfully (or, in dry-run, would have run). */
27
+ 'ok'
28
+ /** Step was skipped — e.g. dry-run mode shortcuts post-plan. */
29
+ | 'skipped'
30
+ /** Step failed; the smoke envelope's success flag will be false. */
31
+ | 'failed';
32
+ /** Per-step result attached to the smoke envelope. */
33
+ export interface ShipE2eSmokeStep {
34
+ /** The step name. */
35
+ name: ShipE2eSmokeStepName;
36
+ /** Outcome. */
37
+ status: ShipE2eSmokeStepStatus;
38
+ /** Wall-clock duration in milliseconds. */
39
+ durationMs: number;
40
+ /**
41
+ * Optional human-readable detail string captured at step completion
42
+ * (e.g. "plan written to .cleo/release/v2026.5.104.plan.json",
43
+ * "PR #524 merged", "tag v2026.5.104 found", "npm @cleocode/cleo@…
44
+ * published").
45
+ */
46
+ detail?: string;
47
+ /**
48
+ * Optional error message when `status === 'failed'`. Single-line so
49
+ * the envelope stays compact for CLI consumers.
50
+ */
51
+ error?: string;
52
+ }
53
+ /**
54
+ * Final lifecycle state the smoke reached. Mirrors the `releases.status`
55
+ * column values plus a synthetic `npm-published` terminal state captured
56
+ * by the verify step.
57
+ */
58
+ export type ShipE2eSmokeFinalState = 'not-started' | 'planned' | 'pr-opened' | 'pr-merged' | 'tag-pushed' | 'npm-published';
59
+ /** Parameters accepted by the smoke walker. */
60
+ export interface ShipE2eSmokeParams {
61
+ /** Candidate release version (e.g. "v2026.6.0" or "2026.6.0"). */
62
+ version: string;
63
+ /** Epic task ID that scopes the release (forwarded to `release plan`). */
64
+ epicId: string;
65
+ /**
66
+ * When false (default), no side effects — every step reports what it
67
+ * WOULD do. When true, each step performs its real mutation.
68
+ */
69
+ execute: boolean;
70
+ /**
71
+ * Total wall-clock budget across all polling waits, in milliseconds.
72
+ * Default 30 minutes when omitted. Per-step waits MUST respect this
73
+ * shared budget so a stuck PR doesn't hang the whole smoke.
74
+ */
75
+ totalTimeoutMs?: number;
76
+ /**
77
+ * Poll interval for wait-* steps, in milliseconds. Default 5_000.
78
+ * Lowered in tests via DI to keep the suite fast.
79
+ */
80
+ pollIntervalMs?: number;
81
+ }
82
+ /** Top-level envelope returned by the smoke walker. */
83
+ export interface ShipE2eSmokeResult {
84
+ /** True when every step completed (or was intentionally skipped). */
85
+ success: boolean;
86
+ /** Echo of the version under smoke. */
87
+ version: string;
88
+ /** True when --execute was passed; false for dry-run preview. */
89
+ executed: boolean;
90
+ /** Ordered step log. */
91
+ steps: ShipE2eSmokeStep[];
92
+ /** Lifecycle state at smoke termination. */
93
+ finalState: ShipE2eSmokeFinalState;
94
+ /** Total wall-clock duration across all steps, in milliseconds. */
95
+ totalDurationMs: number;
96
+ }
97
+ //# sourceMappingURL=ship-e2e-smoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ship-e2e-smoke.d.ts","sourceRoot":"","sources":["../../src/release/ship-e2e-smoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,MAAM,GACN,aAAa,GACb,cAAc,GACd,sBAAsB,CAAC;AAE3B,sCAAsC;AACtC,MAAM,MAAM,sBAAsB;AAChC,oEAAoE;AAClE,IAAI;AACN,gEAAgE;GAC9D,SAAS;AACX,oEAAoE;GAClE,QAAQ,CAAC;AAEb,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB;IACrB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,eAAe;IACf,MAAM,EAAE,sBAAsB,CAAC;IAC/B,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAC9B,aAAa,GACb,SAAS,GACT,WAAW,GACX,WAAW,GACX,YAAY,GACZ,eAAe,CAAC;AAEpB,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,QAAQ,EAAE,OAAO,CAAC;IAClB,wBAAwB;IACxB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,4CAA4C;IAC5C,UAAU,EAAE,sBAAsB,CAAC;IACnC,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Ship E2E Smoke contracts — types for the `cleo release ship-e2e-smoke`
3
+ * one-shot walker that exercises the full release lifecycle end-to-end.
4
+ *
5
+ * The smoke runs `plan` → `open` → wait-for-PR-merge → wait-for-tag →
6
+ * verify-npm-published. Each step records its status, duration, and any
7
+ * side-effect identifier (PR number, tag SHA, npm version) for downstream
8
+ * inspection. The aggregate envelope reports the final lifecycle state
9
+ * reached so failures can be resumed.
10
+ *
11
+ * Dry-run is the default; `--execute` flips the runner to perform real
12
+ * mutations. Both modes return the same envelope shape so consumers can
13
+ * diff a dry-run preview against a real run.
14
+ *
15
+ * @task T10103
16
+ * @epic E-CLEO-RELEASE-VERBS
17
+ * @saga T10099
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=ship-e2e-smoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ship-e2e-smoke.js","sourceRoot":"","sources":["../../src/release/ship-e2e-smoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Compile-time + runtime narrowing tests for `RenderableEnvelope<T>` and the
3
+ * per-kind type guards.
4
+ *
5
+ * Each test constructs a valid envelope of a single `kind` and asserts that
6
+ * the matching guard narrows it correctly while every other guard returns
7
+ * `false`. This catches both schema drift and accidental short-circuits in
8
+ * the guards.
9
+ *
10
+ * @epic T10114
11
+ * @task T10141
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=envelope.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.test.d.ts","sourceRoot":"","sources":["../../../src/render/__tests__/envelope.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Compile-time + runtime narrowing tests for `RenderableEnvelope<T>` and the
3
+ * per-kind type guards.
4
+ *
5
+ * Each test constructs a valid envelope of a single `kind` and asserts that
6
+ * the matching guard narrows it correctly while every other guard returns
7
+ * `false`. This catches both schema drift and accidental short-circuits in
8
+ * the guards.
9
+ *
10
+ * @epic T10114
11
+ * @task T10141
12
+ */
13
+ import { describe, expect, it } from 'vitest';
14
+ import { isGenericEnvelope, isGroupedListEnvelope, isListEnvelope, isSectionEnvelope, isSingleEnvelope, isTableEnvelope, isTreeEnvelope, } from '../envelope.js';
15
+ import { isGroupedListResponse, isListResponse } from '../list.js';
16
+ import { isTableResponse } from '../table.js';
17
+ import { isTreeResponse } from '../tree.js';
18
+ describe('RenderableEnvelope<T> discriminated-union narrowing', () => {
19
+ it('narrows the tree variant and rejects all others', () => {
20
+ const env = {
21
+ kind: 'tree',
22
+ data: { tree: [], root: 'T1', totalNodes: 0, maxDepth: 0 },
23
+ };
24
+ expect(isTreeEnvelope(env)).toBe(true);
25
+ expect(isTableEnvelope(env)).toBe(false);
26
+ expect(isListEnvelope(env)).toBe(false);
27
+ expect(isGroupedListEnvelope(env)).toBe(false);
28
+ expect(isSectionEnvelope(env)).toBe(false);
29
+ expect(isSingleEnvelope(env)).toBe(false);
30
+ expect(isGenericEnvelope(env)).toBe(false);
31
+ if (isTreeEnvelope(env)) {
32
+ expect(env.data.root).toBe('T1');
33
+ }
34
+ else {
35
+ throw new Error('expected tree narrowing');
36
+ }
37
+ });
38
+ it('narrows the table variant and rejects all others', () => {
39
+ const env = {
40
+ kind: 'table',
41
+ data: {
42
+ rows: [{ x: 1 }],
43
+ schema: { columns: [{ key: 'x', header: 'X' }] },
44
+ total: 1,
45
+ },
46
+ };
47
+ expect(isTableEnvelope(env)).toBe(true);
48
+ expect(isTreeEnvelope(env)).toBe(false);
49
+ if (isTableEnvelope(env)) {
50
+ expect(env.data.rows[0]?.x).toBe(1);
51
+ }
52
+ else {
53
+ throw new Error('expected table narrowing');
54
+ }
55
+ });
56
+ it('narrows the flat list variant', () => {
57
+ const env = {
58
+ kind: 'list',
59
+ data: { items: [{ x: 7 }], total: 1, renderItem: 'kv' },
60
+ };
61
+ expect(isListEnvelope(env)).toBe(true);
62
+ expect(isGroupedListEnvelope(env)).toBe(false);
63
+ if (isListEnvelope(env)) {
64
+ expect(env.data.items[0]?.x).toBe(7);
65
+ expect(env.data.renderItem).toBe('kv');
66
+ }
67
+ else {
68
+ throw new Error('expected list narrowing');
69
+ }
70
+ });
71
+ it('narrows the grouped-list variant', () => {
72
+ const env = {
73
+ kind: 'grouped-list',
74
+ data: {
75
+ groups: [{ key: 'a', label: 'A', items: [{ x: 2 }] }],
76
+ total: 1,
77
+ },
78
+ };
79
+ expect(isGroupedListEnvelope(env)).toBe(true);
80
+ expect(isListEnvelope(env)).toBe(false);
81
+ if (isGroupedListEnvelope(env)) {
82
+ expect(env.data.groups[0]?.items[0]?.x).toBe(2);
83
+ }
84
+ else {
85
+ throw new Error('expected grouped-list narrowing');
86
+ }
87
+ });
88
+ it('narrows the section variant', () => {
89
+ const env = {
90
+ kind: 'section',
91
+ data: { header: 'Summary', icon: 'i', items: ['a', 'b'] },
92
+ };
93
+ expect(isSectionEnvelope(env)).toBe(true);
94
+ if (isSectionEnvelope(env)) {
95
+ expect(env.data.items).toEqual(['a', 'b']);
96
+ }
97
+ else {
98
+ throw new Error('expected section narrowing');
99
+ }
100
+ });
101
+ it('narrows the single variant', () => {
102
+ const env = {
103
+ kind: 'single',
104
+ data: { x: 42 },
105
+ };
106
+ expect(isSingleEnvelope(env)).toBe(true);
107
+ if (isSingleEnvelope(env)) {
108
+ expect(env.data.x).toBe(42);
109
+ }
110
+ else {
111
+ throw new Error('expected single narrowing');
112
+ }
113
+ });
114
+ it('narrows the generic variant', () => {
115
+ const env = {
116
+ kind: 'generic',
117
+ data: { foo: 'bar', count: 3 },
118
+ };
119
+ expect(isGenericEnvelope(env)).toBe(true);
120
+ if (isGenericEnvelope(env)) {
121
+ expect(env.data.foo).toBe('bar');
122
+ }
123
+ else {
124
+ throw new Error('expected generic narrowing');
125
+ }
126
+ });
127
+ it('exhaustively switches on kind without falling through', () => {
128
+ const envelopes = [
129
+ { kind: 'tree', data: { tree: [], root: 'r', totalNodes: 0, maxDepth: 0 } },
130
+ {
131
+ kind: 'table',
132
+ data: { rows: [], schema: { columns: [] }, total: 0 },
133
+ },
134
+ { kind: 'list', data: { items: [], total: 0 } },
135
+ { kind: 'grouped-list', data: { groups: [], total: 0 } },
136
+ { kind: 'section', data: { header: 'h', items: [] } },
137
+ { kind: 'single', data: { x: 0 } },
138
+ { kind: 'generic', data: {} },
139
+ ];
140
+ const seen = new Set();
141
+ for (const env of envelopes) {
142
+ switch (env.kind) {
143
+ case 'tree':
144
+ case 'table':
145
+ case 'list':
146
+ case 'grouped-list':
147
+ case 'section':
148
+ case 'single':
149
+ case 'generic':
150
+ seen.add(env.kind);
151
+ break;
152
+ default: {
153
+ const _exhaustive = env;
154
+ throw new Error(`unreachable: ${JSON.stringify(_exhaustive)}`);
155
+ }
156
+ }
157
+ }
158
+ expect(seen.size).toBe(7);
159
+ });
160
+ });
161
+ describe('per-response type guards', () => {
162
+ it('accepts valid response shapes', () => {
163
+ expect(isTreeResponse({ tree: [], root: 'r', totalNodes: 0, maxDepth: 0 })).toBe(true);
164
+ expect(isTableResponse({ rows: [], schema: { columns: [] }, total: 0 })).toBe(true);
165
+ expect(isListResponse({ items: [], total: 0 })).toBe(true);
166
+ expect(isGroupedListResponse({ groups: [], total: 0 })).toBe(true);
167
+ });
168
+ it('rejects invalid response shapes', () => {
169
+ expect(isTreeResponse(null)).toBe(false);
170
+ expect(isTreeResponse({})).toBe(false);
171
+ expect(isTreeResponse({ tree: 'nope', root: 'r', totalNodes: 0, maxDepth: 0 })).toBe(false);
172
+ expect(isTableResponse({ rows: [], total: 0 })).toBe(false);
173
+ expect(isTableResponse({ rows: [], schema: 'nope', total: 0 })).toBe(false);
174
+ expect(isListResponse({ items: 'nope', total: 0 })).toBe(false);
175
+ expect(isGroupedListResponse({ groups: 'nope', total: 0 })).toBe(false);
176
+ });
177
+ });
178
+ //# sourceMappingURL=envelope.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.test.js","sourceRoot":"","sources":["../../../src/render/__tests__/envelope.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,GAEf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,QAAQ,CAAC,qDAAqD,EAAE,GAAG,EAAE;IACnE,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,GAAG,GAA+B;YACtC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE;SAC3D,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,eAAe,CAAC,GAAG,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e,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Typed render contracts — top-level `RenderableEnvelope<T>` discriminated union.
3
+ *
4
+ * Part of the Human Render Contract (Epic T10114, ADR-077). Every renderable
5
+ * value flowing from CLEO commands to presenters MUST be wrapped in one of the
6
+ * variants below. Presenters dispatch on `kind` to pick the right renderer.
7
+ *
8
+ * @epic T10114
9
+ * @task T10141
10
+ */
11
+ import type { GroupedListResponse, ListResponse } from './list.js';
12
+ import type { TableResponse } from './table.js';
13
+ import type { TreeResponse } from './tree.js';
14
+ /**
15
+ * Free-form section block — a labelled header with an ordered set of
16
+ * pre-formatted item strings. Used for ad-hoc human output that doesn't fit
17
+ * the structured `tree` / `table` / `list` shapes.
18
+ */
19
+ export interface SectionResponse {
20
+ /** Heading rendered above the items. */
21
+ readonly header: string;
22
+ /** Optional icon hint — presenters MAY prepend it to the header. */
23
+ readonly icon?: string;
24
+ /** Pre-formatted item strings rendered as a bulleted block. */
25
+ readonly items: ReadonlyArray<string>;
26
+ }
27
+ /**
28
+ * Discriminated union of every renderable envelope variant CLEO presenters
29
+ * understand.
30
+ *
31
+ * The `kind` field is the discriminator — narrow on it inside a `switch`
32
+ * statement or via the per-kind type guards exported below.
33
+ *
34
+ * @typeParam T — caller-defined payload shape. For `single` it is the entire
35
+ * payload; for the collection variants it parameterises the
36
+ * inner response type. `section` and `generic` are independent
37
+ * of `T`.
38
+ */
39
+ export type RenderableEnvelope<T> = {
40
+ readonly kind: 'tree';
41
+ readonly data: TreeResponse<T>;
42
+ } | {
43
+ readonly kind: 'table';
44
+ readonly data: TableResponse<T>;
45
+ } | {
46
+ readonly kind: 'list';
47
+ readonly data: ListResponse<T>;
48
+ } | {
49
+ readonly kind: 'grouped-list';
50
+ readonly data: GroupedListResponse<T>;
51
+ } | {
52
+ readonly kind: 'section';
53
+ readonly data: SectionResponse;
54
+ } | {
55
+ readonly kind: 'single';
56
+ readonly data: T;
57
+ } | {
58
+ readonly kind: 'generic';
59
+ readonly data: Record<string, unknown>;
60
+ };
61
+ /**
62
+ * Type guard — narrows to the `tree` variant.
63
+ */
64
+ export declare function isTreeEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
65
+ kind: 'tree';
66
+ }>;
67
+ /**
68
+ * Type guard — narrows to the `table` variant.
69
+ */
70
+ export declare function isTableEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
71
+ kind: 'table';
72
+ }>;
73
+ /**
74
+ * Type guard — narrows to the flat `list` variant.
75
+ */
76
+ export declare function isListEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
77
+ kind: 'list';
78
+ }>;
79
+ /**
80
+ * Type guard — narrows to the `grouped-list` variant.
81
+ */
82
+ export declare function isGroupedListEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
83
+ kind: 'grouped-list';
84
+ }>;
85
+ /**
86
+ * Type guard — narrows to the `section` variant.
87
+ */
88
+ export declare function isSectionEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
89
+ kind: 'section';
90
+ }>;
91
+ /**
92
+ * Type guard — narrows to the `single` variant.
93
+ */
94
+ export declare function isSingleEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
95
+ kind: 'single';
96
+ }>;
97
+ /**
98
+ * Type guard — narrows to the `generic` variant.
99
+ */
100
+ export declare function isGenericEnvelope<T>(env: RenderableEnvelope<T>): env is Extract<RenderableEnvelope<T>, {
101
+ kind: 'generic';
102
+ }>;
103
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/render/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAA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IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC,CAEjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GACzB,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAE5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GACzB,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAE3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,GACzB,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,CAE5D"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Typed render contracts — top-level `RenderableEnvelope<T>` discriminated union.
3
+ *
4
+ * Part of the Human Render Contract (Epic T10114, ADR-077). Every renderable
5
+ * value flowing from CLEO commands to presenters MUST be wrapped in one of the
6
+ * variants below. Presenters dispatch on `kind` to pick the right renderer.
7
+ *
8
+ * @epic T10114
9
+ * @task T10141
10
+ */
11
+ /**
12
+ * Type guard — narrows to the `tree` variant.
13
+ */
14
+ export function isTreeEnvelope(env) {
15
+ return env.kind === 'tree';
16
+ }
17
+ /**
18
+ * Type guard — narrows to the `table` variant.
19
+ */
20
+ export function isTableEnvelope(env) {
21
+ return env.kind === 'table';
22
+ }
23
+ /**
24
+ * Type guard — narrows to the flat `list` variant.
25
+ */
26
+ export function isListEnvelope(env) {
27
+ return env.kind === 'list';
28
+ }
29
+ /**
30
+ * Type guard — narrows to the `grouped-list` variant.
31
+ */
32
+ export function isGroupedListEnvelope(env) {
33
+ return env.kind === 'grouped-list';
34
+ }
35
+ /**
36
+ * Type guard — narrows to the `section` variant.
37
+ */
38
+ export function isSectionEnvelope(env) {
39
+ return env.kind === 'section';
40
+ }
41
+ /**
42
+ * Type guard — narrows to the `single` variant.
43
+ */
44
+ export function isSingleEnvelope(env) {
45
+ return env.kind === 'single';
46
+ }
47
+ /**
48
+ * Type guard — narrows to the `generic` variant.
49
+ */
50
+ export function isGenericEnvelope(env) {
51
+ return env.kind === 'generic';
52
+ }
53
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/render/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyCH;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAA0B;IAE1B,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAChC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Barrel for the typed render contracts (Epic T10114, ADR-077).
3
+ *
4
+ * Icon enums are intentionally omitted — they ship with T10127 (B2).
5
+ *
6
+ * @epic T10114
7
+ */
8
+ export type { RenderableEnvelope, SectionResponse } from './envelope.js';
9
+ export { isGenericEnvelope, isGroupedListEnvelope, isListEnvelope, isSectionEnvelope, isSingleEnvelope, isTableEnvelope, isTreeEnvelope, } from './envelope.js';
10
+ export type { GroupedListResponse, ListGroup, ListItemStyle, ListResponse, } from './list.js';
11
+ export { isGroupedListResponse, isListResponse } from './list.js';
12
+ export type { ColumnAlign, TableColumn, TableResponse, TableSchema, } from './table.js';
13
+ export { isTableResponse } from './table.js';
14
+ export type { FlatTreeNode, RenderTreeOptions, TreeNodeKind, TreeNodeStatus, TreeResponse, } from './tree.js';
15
+ export { isTreeResponse } from './tree.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAClE,YAAY,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Barrel for the typed render contracts (Epic T10114, ADR-077).
3
+ *
4
+ * Icon enums are intentionally omitted — they ship with T10127 (B2).
5
+ *
6
+ * @epic T10114
7
+ */
8
+ export { isGenericEnvelope, isGroupedListEnvelope, isListEnvelope, isSectionEnvelope, isSingleEnvelope, isTableEnvelope, isTreeEnvelope, } from './envelope.js';
9
+ export { isGroupedListResponse, isListResponse } from './list.js';
10
+ export { isTableResponse } from './table.js';
11
+ export { isTreeResponse } from './tree.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAOlE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQ7C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Typed render contracts — list (flat) and grouped-list.
3
+ *
4
+ * Part of the Human Render Contract (Epic T10114, ADR-077). The list shape is
5
+ * the canonical wire format for ordered or grouped sequential output —
6
+ * presenters render each item according to `renderItem` (or a default).
7
+ *
8
+ * @epic T10114
9
+ * @task T10140
10
+ */
11
+ /**
12
+ * Per-item rendering style hint for list responses.
13
+ *
14
+ * - `'text'` — render the item as a plain string (default presenter behaviour).
15
+ * - `'badge'` — render with status / category styling.
16
+ * - `'kv'` — render as a key/value pair block.
17
+ */
18
+ export type ListItemStyle = 'text' | 'badge' | 'kv';
19
+ /**
20
+ * Flat list response — items rendered in `items` order.
21
+ *
22
+ * @typeParam T — caller-defined item payload shape.
23
+ */
24
+ export interface ListResponse<T> {
25
+ /** Item payloads in render order. */
26
+ readonly items: ReadonlyArray<T>;
27
+ /**
28
+ * Total item count. May exceed `items.length` when the response is paginated
29
+ * or truncated.
30
+ */
31
+ readonly total: number;
32
+ /** Optional per-item rendering style hint. */
33
+ readonly renderItem?: ListItemStyle;
34
+ }
35
+ /**
36
+ * One labelled bucket inside a grouped list response.
37
+ *
38
+ * @typeParam T — caller-defined item payload shape.
39
+ */
40
+ export interface ListGroup<T> {
41
+ /** Stable group identifier — used for diff / equality, not display. */
42
+ readonly key: string;
43
+ /** Human-readable group label rendered above its items. */
44
+ readonly label: string;
45
+ /** Item payloads inside this group, in render order. */
46
+ readonly items: ReadonlyArray<T>;
47
+ }
48
+ /**
49
+ * Grouped list response — items split across labelled buckets.
50
+ *
51
+ * @typeParam T — caller-defined item payload shape.
52
+ */
53
+ export interface GroupedListResponse<T> {
54
+ /** Ordered list of labelled groups. */
55
+ readonly groups: ReadonlyArray<ListGroup<T>>;
56
+ /** Total item count across all groups. */
57
+ readonly total: number;
58
+ }
59
+ /**
60
+ * Runtime type guard for `ListResponse<T>`.
61
+ *
62
+ * Checks the envelope shape only — does not inspect item payloads against `T`.
63
+ *
64
+ * @param value — candidate value to inspect.
65
+ * @returns `true` iff `value` matches the `ListResponse<T>` envelope shape.
66
+ */
67
+ export declare function isListResponse<T>(value: unknown): value is ListResponse<T>;
68
+ /**
69
+ * Runtime type guard for `GroupedListResponse<T>`.
70
+ *
71
+ * Checks the envelope shape only — does not inspect item payloads against `T`.
72
+ *
73
+ * @param value — candidate value to inspect.
74
+ * @returns `true` iff `value` matches the `GroupedListResponse<T>` envelope shape.
75
+ */
76
+ export declare function isGroupedListResponse<T>(value: unknown): value is GroupedListResponse<T>;
77
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/render/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAC,CAAC,CAAC,CAI1E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAIxF"}