@cleocode/contracts 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/adapter.d.ts +36 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +8 -0
  4. package/dist/adapter.js.map +1 -0
  5. package/dist/archive.d.ts +100 -0
  6. package/dist/archive.d.ts.map +1 -0
  7. package/dist/archive.js +7 -0
  8. package/dist/archive.js.map +1 -0
  9. package/dist/brain.d.ts +36 -0
  10. package/dist/brain.d.ts.map +1 -0
  11. package/dist/brain.js +10 -0
  12. package/dist/brain.js.map +1 -0
  13. package/dist/capabilities.d.ts +21 -0
  14. package/dist/capabilities.d.ts.map +1 -0
  15. package/dist/capabilities.js +7 -0
  16. package/dist/capabilities.js.map +1 -0
  17. package/dist/config.d.ts +118 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +12 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/context-monitor.d.ts +16 -0
  22. package/dist/context-monitor.d.ts.map +1 -0
  23. package/dist/context-monitor.js +7 -0
  24. package/dist/context-monitor.js.map +1 -0
  25. package/dist/data-accessor.d.ts +167 -0
  26. package/dist/data-accessor.d.ts.map +1 -0
  27. package/dist/data-accessor.js +18 -0
  28. package/dist/data-accessor.js.map +1 -0
  29. package/dist/discovery.d.ts +29 -0
  30. package/dist/discovery.d.ts.map +1 -0
  31. package/dist/discovery.js +7 -0
  32. package/dist/discovery.js.map +1 -0
  33. package/dist/exit-codes.d.ts +109 -0
  34. package/dist/exit-codes.d.ts.map +1 -0
  35. package/dist/exit-codes.js +158 -0
  36. package/dist/exit-codes.js.map +1 -0
  37. package/dist/hooks.d.ts +17 -0
  38. package/dist/hooks.d.ts.map +1 -0
  39. package/dist/hooks.js +8 -0
  40. package/dist/hooks.js.map +1 -0
  41. package/dist/index.d.ts +39 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +24 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/install.d.ts +26 -0
  46. package/dist/install.d.ts.map +1 -0
  47. package/dist/install.js +8 -0
  48. package/dist/install.js.map +1 -0
  49. package/dist/lafs.d.ts +132 -0
  50. package/dist/lafs.d.ts.map +1 -0
  51. package/dist/lafs.js +26 -0
  52. package/dist/lafs.js.map +1 -0
  53. package/dist/memory.d.ts +51 -0
  54. package/dist/memory.d.ts.map +1 -0
  55. package/dist/memory.js +8 -0
  56. package/dist/memory.js.map +1 -0
  57. package/dist/operations/index.d.ts +17 -0
  58. package/dist/operations/index.d.ts.map +1 -0
  59. package/dist/operations/index.js +17 -0
  60. package/dist/operations/index.js.map +1 -0
  61. package/dist/operations/issues.d.ts +75 -0
  62. package/dist/operations/issues.d.ts.map +1 -0
  63. package/dist/operations/issues.js +10 -0
  64. package/dist/operations/issues.js.map +1 -0
  65. package/dist/operations/lifecycle.d.ts +141 -0
  66. package/dist/operations/lifecycle.d.ts.map +1 -0
  67. package/dist/operations/lifecycle.js +8 -0
  68. package/dist/operations/lifecycle.js.map +1 -0
  69. package/dist/operations/orchestrate.d.ts +202 -0
  70. package/dist/operations/orchestrate.d.ts.map +1 -0
  71. package/dist/operations/orchestrate.js +8 -0
  72. package/dist/operations/orchestrate.js.map +1 -0
  73. package/dist/operations/release.d.ts +97 -0
  74. package/dist/operations/release.d.ts.map +1 -0
  75. package/dist/operations/release.js +7 -0
  76. package/dist/operations/release.js.map +1 -0
  77. package/dist/operations/research.d.ts +126 -0
  78. package/dist/operations/research.d.ts.map +1 -0
  79. package/dist/operations/research.js +11 -0
  80. package/dist/operations/research.js.map +1 -0
  81. package/dist/operations/session.d.ts +99 -0
  82. package/dist/operations/session.d.ts.map +1 -0
  83. package/dist/operations/session.js +12 -0
  84. package/dist/operations/session.js.map +1 -0
  85. package/dist/operations/skills.d.ts +182 -0
  86. package/dist/operations/skills.d.ts.map +1 -0
  87. package/dist/operations/skills.js +10 -0
  88. package/dist/operations/skills.js.map +1 -0
  89. package/dist/operations/system.d.ts +147 -0
  90. package/dist/operations/system.d.ts.map +1 -0
  91. package/dist/operations/system.js +8 -0
  92. package/dist/operations/system.js.map +1 -0
  93. package/dist/operations/tasks.d.ts +231 -0
  94. package/dist/operations/tasks.d.ts.map +1 -0
  95. package/dist/operations/tasks.js +13 -0
  96. package/dist/operations/tasks.js.map +1 -0
  97. package/dist/operations/validate.d.ts +170 -0
  98. package/dist/operations/validate.d.ts.map +1 -0
  99. package/dist/operations/validate.js +8 -0
  100. package/dist/operations/validate.js.map +1 -0
  101. package/dist/provider-paths.d.ts +16 -0
  102. package/dist/provider-paths.d.ts.map +1 -0
  103. package/dist/provider-paths.js +7 -0
  104. package/dist/provider-paths.js.map +1 -0
  105. package/dist/results.d.ts +188 -0
  106. package/dist/results.d.ts.map +1 -0
  107. package/dist/results.js +10 -0
  108. package/dist/results.js.map +1 -0
  109. package/dist/session.d.ts +106 -0
  110. package/dist/session.d.ts.map +1 -0
  111. package/dist/session.js +77 -0
  112. package/dist/session.js.map +1 -0
  113. package/dist/spawn-types.d.ts +119 -0
  114. package/dist/spawn-types.d.ts.map +1 -0
  115. package/dist/spawn-types.js +12 -0
  116. package/dist/spawn-types.js.map +1 -0
  117. package/dist/spawn.d.ts +30 -0
  118. package/dist/spawn.d.ts.map +1 -0
  119. package/dist/spawn.js +7 -0
  120. package/dist/spawn.js.map +1 -0
  121. package/dist/status-registry.d.ts +50 -0
  122. package/dist/status-registry.d.ts.map +1 -0
  123. package/dist/status-registry.js +125 -0
  124. package/dist/status-registry.js.map +1 -0
  125. package/dist/task-record.d.ts +67 -0
  126. package/dist/task-record.d.ts.map +1 -0
  127. package/dist/task-record.js +11 -0
  128. package/dist/task-record.js.map +1 -0
  129. package/dist/task-sync.d.ts +143 -0
  130. package/dist/task-sync.d.ts.map +1 -0
  131. package/dist/task-sync.js +11 -0
  132. package/dist/task-sync.js.map +1 -0
  133. package/dist/task.d.ts +294 -0
  134. package/dist/task.d.ts.map +1 -0
  135. package/dist/task.js +24 -0
  136. package/dist/task.js.map +1 -0
  137. package/dist/tessera.d.ts +32 -0
  138. package/dist/tessera.d.ts.map +1 -0
  139. package/dist/tessera.js +11 -0
  140. package/dist/tessera.js.map +1 -0
  141. package/dist/todowrite.d.ts +53 -0
  142. package/dist/todowrite.d.ts.map +1 -0
  143. package/dist/todowrite.js +7 -0
  144. package/dist/todowrite.js.map +1 -0
  145. package/dist/transport.d.ts +12 -0
  146. package/dist/transport.d.ts.map +1 -0
  147. package/dist/transport.js +7 -0
  148. package/dist/transport.js.map +1 -0
  149. package/dist/warp-chain.d.ts +121 -0
  150. package/dist/warp-chain.d.ts.map +1 -0
  151. package/dist/warp-chain.js +13 -0
  152. package/dist/warp-chain.js.map +1 -0
  153. package/package.json +29 -0
  154. package/src/adapter.ts +38 -0
  155. package/src/archive.ts +121 -0
  156. package/src/brain.ts +39 -0
  157. package/src/capabilities.ts +21 -0
  158. package/src/config.ts +135 -0
  159. package/src/context-monitor.ts +16 -0
  160. package/src/data-accessor.ts +239 -0
  161. package/src/discovery.ts +31 -0
  162. package/src/exit-codes.ts +175 -0
  163. package/src/hooks.ts +17 -0
  164. package/src/index.ts +298 -0
  165. package/src/install.ts +28 -0
  166. package/src/lafs.ts +194 -0
  167. package/src/memory.ts +57 -0
  168. package/src/operations/index.ts +17 -0
  169. package/src/operations/issues.ts +86 -0
  170. package/src/operations/lifecycle.ts +176 -0
  171. package/src/operations/orchestrate.ts +199 -0
  172. package/src/operations/release.ts +114 -0
  173. package/src/operations/research.ts +156 -0
  174. package/src/operations/session.ts +119 -0
  175. package/src/operations/skills.ts +210 -0
  176. package/src/operations/system.ts +174 -0
  177. package/src/operations/tasks.ts +279 -0
  178. package/src/operations/validate.ts +199 -0
  179. package/src/provider-paths.ts +16 -0
  180. package/src/results.ts +207 -0
  181. package/src/session.ts +157 -0
  182. package/src/spawn-types.ts +140 -0
  183. package/src/spawn.ts +32 -0
  184. package/src/status-registry.ts +166 -0
  185. package/src/task-record.ts +71 -0
  186. package/src/task-sync.ts +167 -0
  187. package/src/task.ts +387 -0
  188. package/src/tessera.ts +35 -0
  189. package/src/todowrite.ts +58 -0
  190. package/src/transport.ts +12 -0
  191. package/src/warp-chain.ts +174 -0
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Unified Status Registry — single source of truth for all status enums.
3
+ *
4
+ * ADR-018: All status constants and types MUST be defined here.
5
+ * No other file may define status enum arrays as constants.
6
+ *
7
+ * Dependency direction:
8
+ * status-registry.ts → schema.ts, types/task.ts, validation/engine.ts,
9
+ * mcp/lib/security.ts, dispatch/lib/security.ts, ...
10
+ */
11
+ // === WORKFLOW NAMESPACE ===
12
+ // Statuses for entities representing work being performed.
13
+ export const TASK_STATUSES = [
14
+ 'pending',
15
+ 'active',
16
+ 'blocked',
17
+ 'done',
18
+ 'cancelled',
19
+ 'archived',
20
+ ];
21
+ export const SESSION_STATUSES = ['active', 'ended', 'orphaned', 'suspended'];
22
+ export const LIFECYCLE_PIPELINE_STATUSES = [
23
+ 'active',
24
+ 'completed',
25
+ 'blocked',
26
+ 'failed',
27
+ 'cancelled',
28
+ 'aborted',
29
+ ];
30
+ export const LIFECYCLE_STAGE_STATUSES = [
31
+ 'not_started',
32
+ 'in_progress',
33
+ 'blocked',
34
+ 'completed',
35
+ 'skipped',
36
+ 'failed',
37
+ ];
38
+ // === GOVERNANCE NAMESPACE ===
39
+ // Statuses for decisions and approvals.
40
+ export const ADR_STATUSES = ['proposed', 'accepted', 'superseded', 'deprecated'];
41
+ export const GATE_STATUSES = ['pending', 'passed', 'failed', 'waived'];
42
+ // === MANIFEST NAMESPACE ===
43
+ // Statuses for protocol output artifacts.
44
+ // NOTE: 'complete' was the old value — it is now 'completed' everywhere.
45
+ export const MANIFEST_STATUSES = ['completed', 'partial', 'blocked', 'archived'];
46
+ // === TERMINAL STATE SETS ===
47
+ export const TERMINAL_TASK_STATUSES = new Set([
48
+ 'done',
49
+ 'cancelled',
50
+ 'archived',
51
+ ]);
52
+ export const TERMINAL_PIPELINE_STATUSES = new Set([
53
+ 'completed',
54
+ 'failed',
55
+ 'cancelled',
56
+ 'aborted',
57
+ ]);
58
+ export const TERMINAL_STAGE_STATUSES = new Set([
59
+ 'completed',
60
+ 'skipped',
61
+ 'failed',
62
+ ]);
63
+ export const STATUS_REGISTRY = {
64
+ task: TASK_STATUSES,
65
+ session: SESSION_STATUSES,
66
+ lifecycle_pipeline: LIFECYCLE_PIPELINE_STATUSES,
67
+ lifecycle_stage: LIFECYCLE_STAGE_STATUSES,
68
+ adr: ADR_STATUSES,
69
+ gate: GATE_STATUSES,
70
+ manifest: MANIFEST_STATUSES,
71
+ };
72
+ export function isValidStatus(entityType, value) {
73
+ return STATUS_REGISTRY[entityType].includes(value);
74
+ }
75
+ // === DISPLAY ICONS ===
76
+ // Typed Record maps — exhaustiveness is enforced by the compiler.
77
+ // All icon consumers MUST import from here instead of hardcoding comparisons.
78
+ /**
79
+ * Pipeline status → Unicode progress icon.
80
+ * Used wherever lifecycle pipeline status is rendered to a terminal.
81
+ */
82
+ export const PIPELINE_STATUS_ICONS = {
83
+ active: '\u25b6', // pipeline is running
84
+ completed: '\u2713', // all stages done successfully
85
+ blocked: '\u23f8', // cannot advance; waiting
86
+ failed: '\u2717', // terminal failure
87
+ cancelled: '\u2298', // user-initiated abandonment
88
+ aborted: '\u23f9', // system-forced termination
89
+ };
90
+ /**
91
+ * Stage status → Unicode progress icon.
92
+ * Used wherever pipeline stage status is rendered to a terminal.
93
+ */
94
+ export const STAGE_STATUS_ICONS = {
95
+ not_started: '\u23f9', // not yet entered
96
+ in_progress: '\u25b6', // actively running
97
+ blocked: '\u23f8', // paused / waiting
98
+ completed: '\u2713', // finished successfully
99
+ skipped: '\u23ed', // intentionally bypassed
100
+ failed: '\u2717', // terminal failure
101
+ };
102
+ /**
103
+ * Task status → Unicode symbol (rich terminal / Unicode-enabled).
104
+ * Falls back to TASK_STATUS_SYMBOLS_ASCII when Unicode is unavailable.
105
+ */
106
+ export const TASK_STATUS_SYMBOLS_UNICODE = {
107
+ pending: '\u25cb', // ○ not yet started
108
+ active: '\u25c9', // ◉ in progress
109
+ blocked: '\u2297', // ⊗ cannot advance
110
+ done: '\u2713', // ✓ complete
111
+ cancelled: '\u2717', // ✗ abandoned
112
+ archived: '\u25a3', // ▣ stored, inactive
113
+ };
114
+ /**
115
+ * Task status → ASCII fallback symbol (non-Unicode terminals, CI output).
116
+ */
117
+ export const TASK_STATUS_SYMBOLS_ASCII = {
118
+ pending: '-',
119
+ active: '*',
120
+ blocked: 'x',
121
+ done: '+',
122
+ cancelled: '~',
123
+ archived: '#',
124
+ };
125
+ //# sourceMappingURL=status-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-registry.js","sourceRoot":"","sources":["../src/status-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6BAA6B;AAC7B,2DAA2D;AAE3D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,QAAQ;IACR,SAAS;IACT,MAAM;IACN,WAAW;IACX,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC;AAEtF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,QAAQ;IACR,WAAW;IACX,SAAS;IACT,QAAQ;IACR,WAAW;IACX,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,aAAa;IACb,aAAa;IACb,SAAS;IACT,WAAW;IACX,SAAS;IACT,QAAQ;CACA,CAAC;AAEX,+BAA+B;AAC/B,wCAAwC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,CAAU,CAAC;AAE1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAA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GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,WAAW,EAAE,QAAQ,EAAE,kBAAkB;IACzC,WAAW,EAAE,QAAQ,EAAE,mBAAmB;IAC1C,OAAO,EAAE,QAAQ,EAAE,mBAAmB;IACtC,SAAS,EAAE,QAAQ,EAAE,wBAAwB;IAC7C,OAAO,EAAE,QAAQ,EAAE,yBAAyB;IAC5C,MAAM,EAAE,QAAQ,EAAE,mBAAmB;CACtC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA+B;IACrE,OAAO,EAAE,QAAQ,EAAE,qBAAqB;IACxC,MAAM,EAAE,QAAQ,EAAE,iBAAiB;IACnC,OAAO,EAAE,QAAQ,EAAE,oBAAoB;IACvC,IAAI,EAAE,QAAQ,EAAE,cAAc;IAC9B,SAAS,EAAE,QAAQ,EAAE,eAAe;IACpC,QAAQ,EAAE,QAAQ,EAAE,sBAAsB;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA+B;IACnE,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;IACZ,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;CACd,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * TaskRecord — string-widened version of Task for JSON serialization in dispatch/LAFS layer.
3
+ *
4
+ * Union-typed fields (status, priority, origin, etc.) are widened to string
5
+ * so that the dispatch layer does not need to validate enum membership.
6
+ *
7
+ * @task T4657
8
+ * @epic T4654
9
+ */
10
+ import type { TaskVerification } from './task.js';
11
+ /** A single task relation entry (string-widened version). */
12
+ export interface TaskRecordRelation {
13
+ taskId: string;
14
+ type: string;
15
+ reason?: string;
16
+ }
17
+ /** Validation history entry. */
18
+ export interface ValidationHistoryEntry {
19
+ round: number;
20
+ agent: string;
21
+ result: string;
22
+ timestamp: string;
23
+ }
24
+ /** String-widened Task for JSON serialization in dispatch/LAFS layer. */
25
+ export interface TaskRecord {
26
+ id: string;
27
+ title: string;
28
+ description: string;
29
+ status: string;
30
+ priority: string;
31
+ type?: string;
32
+ phase?: string;
33
+ createdAt: string;
34
+ updatedAt: string | null;
35
+ completedAt?: string | null;
36
+ cancelledAt?: string | null;
37
+ parentId?: string | null;
38
+ position?: number | null;
39
+ positionVersion?: number;
40
+ depends?: string[];
41
+ relates?: TaskRecordRelation[];
42
+ files?: string[];
43
+ acceptance?: string[];
44
+ notes?: string[];
45
+ labels?: string[];
46
+ size?: string | null;
47
+ epicLifecycle?: string | null;
48
+ noAutoComplete?: boolean | null;
49
+ verification?: TaskVerification | null;
50
+ origin?: string | null;
51
+ createdBy?: string | null;
52
+ validatedBy?: string | null;
53
+ testedBy?: string | null;
54
+ lifecycleState?: string | null;
55
+ validationHistory?: ValidationHistoryEntry[];
56
+ blockedBy?: string[];
57
+ cancellationReason?: string;
58
+ }
59
+ /** Minimal task representation for find results. */
60
+ export interface MinimalTaskRecord {
61
+ id: string;
62
+ title: string;
63
+ status: string;
64
+ priority: string;
65
+ parentId?: string | null;
66
+ }
67
+ //# sourceMappingURL=task-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-record.d.ts","sourceRoot":"","sources":["../src/task-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gCAAgC;AAChC,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yEAAyE;AACzE,MAAM,WAA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/B,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * TaskRecord — string-widened version of Task for JSON serialization in dispatch/LAFS layer.
3
+ *
4
+ * Union-typed fields (status, priority, origin, etc.) are widened to string
5
+ * so that the dispatch layer does not need to validate enum membership.
6
+ *
7
+ * @task T4657
8
+ * @epic T4654
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=task-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-record.js","sourceRoot":"","sources":["../src/task-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Task synchronization contracts for provider-agnostic task reconciliation.
3
+ *
4
+ * Replaces the legacy Claude Code-specific TodoWrite integration with a
5
+ * provider-agnostic system. Any provider adapter can implement
6
+ * AdapterTaskSyncProvider to sync its external task system with CLEO as SSoT.
7
+ *
8
+ * @task T5800
9
+ */
10
+ /** Normalized status for tasks coming from an external provider. */
11
+ export type ExternalTaskStatus = 'pending' | 'active' | 'completed' | 'removed';
12
+ /**
13
+ * A task as reported by an external provider, normalized to a common shape.
14
+ * Provider-specific adapters translate their native format into this.
15
+ */
16
+ export interface ExternalTask {
17
+ /** Provider-assigned identifier for this task (opaque to core). */
18
+ externalId: string;
19
+ /** Mapped CLEO task ID, or null if the task is new / unmatched. */
20
+ cleoTaskId: string | null;
21
+ /** Human-readable title. */
22
+ title: string;
23
+ /** Normalized status. */
24
+ status: ExternalTaskStatus;
25
+ /** Optional description text. */
26
+ description?: string;
27
+ /** Optional labels/tags from the provider. */
28
+ labels?: string[];
29
+ /** Arbitrary provider-specific metadata (opaque to core). */
30
+ providerMeta?: Record<string, unknown>;
31
+ }
32
+ /**
33
+ * Persistent state for a sync session between CLEO and a provider.
34
+ * Stored per-provider under `.cleo/sync/<providerId>-session.json`.
35
+ */
36
+ export interface SyncSessionState {
37
+ /** CLEO task IDs that were injected into the provider's task list. */
38
+ injectedTaskIds: string[];
39
+ /** Optional phase context when tasks were injected. */
40
+ injectedPhase?: string;
41
+ /** Per-task metadata at injection time. */
42
+ taskMetadata?: Record<string, {
43
+ phase?: string;
44
+ }>;
45
+ /** ISO timestamp of the last successful reconciliation. */
46
+ lastSyncAt?: string;
47
+ }
48
+ /**
49
+ * Policy for resolving conflicts between CLEO and provider state.
50
+ *
51
+ * - `cleo-wins`: CLEO state takes precedence (default).
52
+ * - `provider-wins`: Provider state takes precedence.
53
+ * - `latest-wins`: Most recently modified value wins.
54
+ * - `report-only`: Report conflicts without applying changes.
55
+ */
56
+ export type ConflictPolicy = 'cleo-wins' | 'provider-wins' | 'latest-wins' | 'report-only';
57
+ /** Options for the reconciliation engine. */
58
+ export interface ReconcileOptions {
59
+ /** Provider ID (e.g. 'claude-code', 'cursor'). */
60
+ providerId: string;
61
+ /** Working directory (project root). */
62
+ cwd?: string;
63
+ /** If true, compute actions without applying them. */
64
+ dryRun?: boolean;
65
+ /** Conflict resolution policy. Defaults to 'cleo-wins'. */
66
+ conflictPolicy?: ConflictPolicy;
67
+ /** Default phase for newly created tasks. */
68
+ defaultPhase?: string;
69
+ /** Default labels for newly created tasks. */
70
+ defaultLabels?: string[];
71
+ }
72
+ /** The type of action the reconciliation engine will take. */
73
+ export type ReconcileActionType = 'complete' | 'activate' | 'create' | 'remove' | 'skip' | 'conflict';
74
+ /** A single reconciliation action (planned or applied). */
75
+ export interface ReconcileAction {
76
+ /** What kind of change. */
77
+ type: ReconcileActionType;
78
+ /** The CLEO task ID affected (null for creates before they happen). */
79
+ cleoTaskId: string | null;
80
+ /** The external task that triggered this action. */
81
+ externalId: string;
82
+ /** Human-readable description of the action. */
83
+ summary: string;
84
+ /** Whether this action was actually applied. */
85
+ applied: boolean;
86
+ /** Error message if the action failed during apply. */
87
+ error?: string;
88
+ }
89
+ /** Result of a full reconciliation run. */
90
+ export interface ReconcileResult {
91
+ /** Whether this was a dry run. */
92
+ dryRun: boolean;
93
+ /** Provider that was reconciled. */
94
+ providerId: string;
95
+ /** Individual actions taken (or planned). */
96
+ actions: ReconcileAction[];
97
+ /** Summary counts. */
98
+ summary: {
99
+ completed: number;
100
+ activated: number;
101
+ created: number;
102
+ removed: number;
103
+ skipped: number;
104
+ conflicts: number;
105
+ applied: number;
106
+ };
107
+ /** Whether sync session state was cleared after apply. */
108
+ sessionCleared: boolean;
109
+ }
110
+ /**
111
+ * Interface that provider adapters implement to expose their external
112
+ * task system to the reconciliation engine.
113
+ *
114
+ * Provider-specific parsing lives here — core never sees native formats.
115
+ */
116
+ export interface AdapterTaskSyncProvider {
117
+ /**
118
+ * Read the provider's current task state and return normalized ExternalTasks.
119
+ *
120
+ * @param projectDir - Project root directory.
121
+ * @returns Array of external tasks in normalized form.
122
+ */
123
+ getExternalTasks(projectDir: string): Promise<ExternalTask[]>;
124
+ /**
125
+ * Optionally push CLEO task state back to the provider.
126
+ * Not all providers support bidirectional sync.
127
+ *
128
+ * @param tasks - Current CLEO tasks to push.
129
+ * @param projectDir - Project root directory.
130
+ */
131
+ pushTaskState?(tasks: ReadonlyArray<{
132
+ id: string;
133
+ title: string;
134
+ status: string;
135
+ }>, projectDir: string): Promise<void>;
136
+ /**
137
+ * Clean up provider-specific sync artifacts (e.g. state files).
138
+ *
139
+ * @param projectDir - Project root directory.
140
+ */
141
+ cleanup?(projectDir: string): Promise<void>;
142
+ }
143
+ //# sourceMappingURL=task-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-sync.d.ts","sourceR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ACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvH;;;;OAIG;IACH,OAAO,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Task synchronization contracts for provider-agnostic task reconciliation.
3
+ *
4
+ * Replaces the legacy Claude Code-specific TodoWrite integration with a
5
+ * provider-agnostic system. Any provider adapter can implement
6
+ * AdapterTaskSyncProvider to sync its external task system with CLEO as SSoT.
7
+ *
8
+ * @task T5800
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=task-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-sync.js","sourceRoot":"","sources":["../src/task-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
package/dist/task.d.ts ADDED
@@ -0,0 +1,294 @@
1
+ /**
2
+ * Task type definitions matching todo.schema.json (v2.10.0).
3
+ *
4
+ * Consolidates types from src/types/task.ts and packages/contracts/src/task-types.ts.
5
+ *
6
+ * ## Type Safety Design
7
+ *
8
+ * - {@link Task} represents a fully-materialized task as stored in the database.
9
+ * Fields that CLEO's anti-hallucination rules require at runtime are marked as
10
+ * required (non-optional) so the type system enforces what the business rules demand.
11
+ *
12
+ * - {@link TaskCreate} represents the input for creating a new task. Only fields the
13
+ * caller MUST supply are required; everything else has sensible defaults applied
14
+ * by the `addTask` function.
15
+ *
16
+ * - {@link CompletedTask} and {@link CancelledTask} are discriminated union types
17
+ * that narrow `Task` for status-specific contexts where additional fields become
18
+ * required (e.g., `completedAt` is required when `status = 'done'`).
19
+ *
20
+ * @epic T4454
21
+ * @task T4456
22
+ */
23
+ import type { TaskStatus } from './status-registry.js';
24
+ export type { TaskStatus };
25
+ /** Task priority levels. */
26
+ export type TaskPriority = 'critical' | 'high' | 'medium' | 'low';
27
+ /** Task type in hierarchy. */
28
+ export type TaskType = 'epic' | 'task' | 'subtask';
29
+ /** Task size (scope, NOT time). */
30
+ export type TaskSize = 'small' | 'medium' | 'large';
31
+ /** Epic lifecycle states. */
32
+ export type EpicLifecycle = 'backlog' | 'planning' | 'active' | 'review' | 'released' | 'archived';
33
+ /** Task origin (provenance). */
34
+ export type TaskOrigin = 'internal' | 'bug-report' | 'feature-request' | 'security' | 'technical-debt' | 'dependency' | 'regression';
35
+ /** Verification agent types. */
36
+ export type VerificationAgent = 'planner' | 'coder' | 'testing' | 'qa' | 'cleanup' | 'security' | 'docs';
37
+ /** Verification gate names. */
38
+ export type VerificationGate = 'implemented' | 'testsPassed' | 'qaPassed' | 'cleanupDone' | 'securityPassed' | 'documented';
39
+ /** Verification failure log entry. */
40
+ export interface VerificationFailure {
41
+ round: number;
42
+ agent: string;
43
+ reason: string;
44
+ timestamp: string;
45
+ }
46
+ /** Task verification state. */
47
+ export interface TaskVerification {
48
+ passed: boolean;
49
+ round: number;
50
+ gates: Partial<Record<VerificationGate, boolean | null>>;
51
+ lastAgent: VerificationAgent | null;
52
+ lastUpdated: string | null;
53
+ failureLog: VerificationFailure[];
54
+ }
55
+ /** Task provenance tracking. */
56
+ export interface TaskProvenance {
57
+ createdBy: string | null;
58
+ modifiedBy: string | null;
59
+ sessionId: string | null;
60
+ }
61
+ /** A single task relation entry. */
62
+ export interface TaskRelation {
63
+ taskId: string;
64
+ type: string;
65
+ reason?: string;
66
+ }
67
+ /**
68
+ * A single CLEO task as stored in the database.
69
+ *
70
+ * Fields marked as required are enforced by CLEO's anti-hallucination validation
71
+ * at runtime. Making them required here ensures the type system catches violations
72
+ * at compile time rather than deferring to runtime checks.
73
+ */
74
+ export interface Task {
75
+ /** Unique task identifier. Must match pattern `T\d{3,}` (e.g., T001, T5800). */
76
+ id: string;
77
+ /** Human-readable task title. Required, max 120 characters. */
78
+ title: string;
79
+ /**
80
+ * Task description. **Required** — CLEO's anti-hallucination rules reject tasks
81
+ * without a description, and require it to differ from the title.
82
+ */
83
+ description: string;
84
+ /** Current task status. Must be a valid {@link TaskStatus} enum value. */
85
+ status: TaskStatus;
86
+ /** Task priority level. Defaults to `'medium'` on creation. */
87
+ priority: TaskPriority;
88
+ /** Task type in hierarchy. Inferred from parent context if not specified. */
89
+ type?: TaskType;
90
+ /** ID of the parent task. `null` for root-level tasks. */
91
+ parentId?: string | null;
92
+ /** Sort position within sibling scope. */
93
+ position?: number | null;
94
+ /** Optimistic concurrency version for position changes. */
95
+ positionVersion?: number;
96
+ /** Relative scope sizing (small/medium/large). NOT a time estimate. */
97
+ size?: TaskSize | null;
98
+ /** Phase slug this task belongs to. */
99
+ phase?: string;
100
+ /** File paths associated with this task. */
101
+ files?: string[];
102
+ /** Acceptance criteria for completion. */
103
+ acceptance?: string[];
104
+ /** IDs of tasks this task depends on. */
105
+ depends?: string[];
106
+ /** Related task entries (non-dependency relationships). */
107
+ relates?: TaskRelation[];
108
+ /** Epic lifecycle state. Only meaningful when `type = 'epic'`. */
109
+ epicLifecycle?: EpicLifecycle | null;
110
+ /** When true, epic will not auto-complete when all children are done. */
111
+ noAutoComplete?: boolean | null;
112
+ /** Reason the task is blocked (free-form text). */
113
+ blockedBy?: string;
114
+ /** Timestamped notes appended during task lifecycle. */
115
+ notes?: string[];
116
+ /** Classification labels for filtering and grouping. */
117
+ labels?: string[];
118
+ /** Task origin/provenance category. */
119
+ origin?: TaskOrigin | null;
120
+ /** ISO 8601 timestamp of task creation. Must not be in the future. */
121
+ createdAt: string;
122
+ /** ISO 8601 timestamp of last update. Set automatically on mutation. */
123
+ updatedAt?: string | null;
124
+ /**
125
+ * ISO 8601 timestamp of task completion. Set when `status` transitions to `'done'`.
126
+ * See {@link CompletedTask} for the status-narrowed type where this is required.
127
+ */
128
+ completedAt?: string;
129
+ /**
130
+ * ISO 8601 timestamp of task cancellation. Set when `status` transitions to `'cancelled'`.
131
+ * See {@link CancelledTask} for the status-narrowed type where this is required.
132
+ */
133
+ cancelledAt?: string;
134
+ /**
135
+ * Reason for cancellation. Required when `status = 'cancelled'`.
136
+ * See {@link CancelledTask} for the status-narrowed type where this is required.
137
+ */
138
+ cancellationReason?: string;
139
+ /** Verification pipeline state. */
140
+ verification?: TaskVerification | null;
141
+ /** Provenance tracking (who created/modified, which session). */
142
+ provenance?: TaskProvenance | null;
143
+ }
144
+ /**
145
+ * Input type for creating a new task via `addTask()`.
146
+ *
147
+ * Only the fields the caller MUST provide are required. All other fields
148
+ * have sensible defaults applied by the creation logic:
149
+ * - `status` defaults to `'pending'`
150
+ * - `priority` defaults to `'medium'`
151
+ * - `type` is inferred from parent context
152
+ * - `size` defaults to `'medium'`
153
+ */
154
+ export interface TaskCreate {
155
+ /** Human-readable task title. Required, max 120 characters. */
156
+ title: string;
157
+ /**
158
+ * Task description. **Required** — CLEO's anti-hallucination rules reject tasks
159
+ * without a description, and require it to differ from the title.
160
+ */
161
+ description: string;
162
+ /** Initial status. Defaults to `'pending'`. */
163
+ status?: TaskStatus;
164
+ /** Priority level. Defaults to `'medium'`. */
165
+ priority?: TaskPriority;
166
+ /** Task type. Inferred from parent context if not specified. */
167
+ type?: TaskType;
168
+ /** Parent task ID for hierarchy placement. */
169
+ parentId?: string | null;
170
+ /** Relative scope sizing. Defaults to `'medium'`. */
171
+ size?: TaskSize;
172
+ /** Phase slug to assign. Inherited from project.currentPhase if not specified. */
173
+ phase?: string;
174
+ /** Classification labels. */
175
+ labels?: string[];
176
+ /** File paths associated with this task. */
177
+ files?: string[];
178
+ /** Acceptance criteria. */
179
+ acceptance?: string[];
180
+ /** IDs of tasks this task depends on. */
181
+ depends?: string[];
182
+ /** Initial note to attach. */
183
+ notes?: string;
184
+ /** Sort position. Auto-calculated if not specified. */
185
+ position?: number;
186
+ }
187
+ /**
188
+ * A task with `status = 'done'`. Narrows {@link Task} to require `completedAt`.
189
+ *
190
+ * Use this type when you need to guarantee a completed task has its completion
191
+ * timestamp — for example, in cycle-time calculations or archive operations.
192
+ */
193
+ export type CompletedTask = Task & {
194
+ /** Discriminant: status is always `'done'` for a completed task. */
195
+ status: 'done';
196
+ /** ISO 8601 timestamp of completion. Required for done tasks. */
197
+ completedAt: string;
198
+ };
199
+ /**
200
+ * A task with `status = 'cancelled'`. Narrows {@link Task} to require
201
+ * `cancelledAt` and `cancellationReason`.
202
+ *
203
+ * Use this type when processing cancelled tasks where the cancellation
204
+ * metadata is guaranteed to be present.
205
+ */
206
+ export type CancelledTask = Task & {
207
+ /** Discriminant: status is always `'cancelled'` for a cancelled task. */
208
+ status: 'cancelled';
209
+ /** ISO 8601 timestamp of cancellation. Required for cancelled tasks. */
210
+ cancelledAt: string;
211
+ /** Reason for cancellation. Required for cancelled tasks (min 5 chars). */
212
+ cancellationReason: string;
213
+ };
214
+ /** Phase status. */
215
+ export type PhaseStatus = 'pending' | 'active' | 'completed';
216
+ /** Phase definition. */
217
+ export interface Phase {
218
+ order: number;
219
+ name: string;
220
+ description?: string;
221
+ status: PhaseStatus;
222
+ startedAt?: string | null;
223
+ completedAt?: string | null;
224
+ }
225
+ /** Phase transition record. */
226
+ export interface PhaseTransition {
227
+ phase: string;
228
+ transitionType: 'started' | 'completed' | 'rollback';
229
+ timestamp: string;
230
+ taskCount: number;
231
+ fromPhase?: string | null;
232
+ reason?: string;
233
+ }
234
+ /** Release status. */
235
+ export type ReleaseStatus = 'planned' | 'active' | 'released';
236
+ /** Release definition. */
237
+ export interface Release {
238
+ version: string;
239
+ status: ReleaseStatus;
240
+ targetDate?: string | null;
241
+ releasedAt?: string | null;
242
+ tasks: string[];
243
+ notes?: string | null;
244
+ changelog?: string | null;
245
+ }
246
+ /** Project metadata. */
247
+ export interface ProjectMeta {
248
+ name: string;
249
+ currentPhase?: string | null;
250
+ phases: Record<string, Phase>;
251
+ phaseHistory?: PhaseTransition[];
252
+ releases?: Release[];
253
+ }
254
+ /** File metadata (_meta block). */
255
+ export interface FileMeta {
256
+ schemaVersion: string;
257
+ specVersion?: string;
258
+ checksum: string;
259
+ configVersion: string;
260
+ lastSessionId?: string | null;
261
+ activeSession?: string | null;
262
+ activeSessionCount?: number;
263
+ sessionsFile?: string | null;
264
+ generation?: number;
265
+ }
266
+ /** Session note in taskWork block. */
267
+ export interface SessionNote {
268
+ note: string;
269
+ timestamp: string;
270
+ conversationId?: string | null;
271
+ agent?: string | null;
272
+ }
273
+ /** Task work state. */
274
+ export interface TaskWorkState {
275
+ currentTask?: string | null;
276
+ currentPhase?: string | null;
277
+ blockedUntil?: string | null;
278
+ sessionNote?: string | null;
279
+ sessionNotes?: SessionNote[];
280
+ nextAction?: string | null;
281
+ primarySession?: string | null;
282
+ }
283
+ /** Root task data structure. */
284
+ export interface TaskFile {
285
+ version: string;
286
+ project: ProjectMeta;
287
+ lastUpdated: string;
288
+ _meta: FileMeta;
289
+ taskWork?: TaskWorkState;
290
+ focus?: TaskWorkState;
291
+ tasks: Task[];
292
+ labels?: Record<string, string[]>;
293
+ }
294
+ //# sourceMappingURL=task.d.ts.map