@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.
- package/dist/adapter.d.ts +36 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +8 -0
- package/dist/adapter.js.map +1 -0
- package/dist/archive.d.ts +100 -0
- package/dist/archive.d.ts.map +1 -0
- package/dist/archive.js +7 -0
- package/dist/archive.js.map +1 -0
- package/dist/brain.d.ts +36 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +10 -0
- package/dist/brain.js.map +1 -0
- package/dist/capabilities.d.ts +21 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +7 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/config.d.ts +118 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/context-monitor.d.ts +16 -0
- package/dist/context-monitor.d.ts.map +1 -0
- package/dist/context-monitor.js +7 -0
- package/dist/context-monitor.js.map +1 -0
- package/dist/data-accessor.d.ts +167 -0
- package/dist/data-accessor.d.ts.map +1 -0
- package/dist/data-accessor.js +18 -0
- package/dist/data-accessor.js.map +1 -0
- package/dist/discovery.d.ts +29 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +7 -0
- package/dist/discovery.js.map +1 -0
- package/dist/exit-codes.d.ts +109 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +158 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/hooks.d.ts +17 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +8 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +26 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +8 -0
- package/dist/install.js.map +1 -0
- package/dist/lafs.d.ts +132 -0
- package/dist/lafs.d.ts.map +1 -0
- package/dist/lafs.js +26 -0
- package/dist/lafs.js.map +1 -0
- package/dist/memory.d.ts +51 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +8 -0
- package/dist/memory.js.map +1 -0
- package/dist/operations/index.d.ts +17 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +17 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/issues.d.ts +75 -0
- package/dist/operations/issues.d.ts.map +1 -0
- package/dist/operations/issues.js +10 -0
- package/dist/operations/issues.js.map +1 -0
- package/dist/operations/lifecycle.d.ts +141 -0
- package/dist/operations/lifecycle.d.ts.map +1 -0
- package/dist/operations/lifecycle.js +8 -0
- package/dist/operations/lifecycle.js.map +1 -0
- package/dist/operations/orchestrate.d.ts +202 -0
- package/dist/operations/orchestrate.d.ts.map +1 -0
- package/dist/operations/orchestrate.js +8 -0
- package/dist/operations/orchestrate.js.map +1 -0
- package/dist/operations/release.d.ts +97 -0
- package/dist/operations/release.d.ts.map +1 -0
- package/dist/operations/release.js +7 -0
- package/dist/operations/release.js.map +1 -0
- package/dist/operations/research.d.ts +126 -0
- package/dist/operations/research.d.ts.map +1 -0
- package/dist/operations/research.js +11 -0
- package/dist/operations/research.js.map +1 -0
- package/dist/operations/session.d.ts +99 -0
- package/dist/operations/session.d.ts.map +1 -0
- package/dist/operations/session.js +12 -0
- package/dist/operations/session.js.map +1 -0
- package/dist/operations/skills.d.ts +182 -0
- package/dist/operations/skills.d.ts.map +1 -0
- package/dist/operations/skills.js +10 -0
- package/dist/operations/skills.js.map +1 -0
- package/dist/operations/system.d.ts +147 -0
- package/dist/operations/system.d.ts.map +1 -0
- package/dist/operations/system.js +8 -0
- package/dist/operations/system.js.map +1 -0
- package/dist/operations/tasks.d.ts +231 -0
- package/dist/operations/tasks.d.ts.map +1 -0
- package/dist/operations/tasks.js +13 -0
- package/dist/operations/tasks.js.map +1 -0
- package/dist/operations/validate.d.ts +170 -0
- package/dist/operations/validate.d.ts.map +1 -0
- package/dist/operations/validate.js +8 -0
- package/dist/operations/validate.js.map +1 -0
- package/dist/provider-paths.d.ts +16 -0
- package/dist/provider-paths.d.ts.map +1 -0
- package/dist/provider-paths.js +7 -0
- package/dist/provider-paths.js.map +1 -0
- package/dist/results.d.ts +188 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +10 -0
- package/dist/results.js.map +1 -0
- package/dist/session.d.ts +106 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +77 -0
- package/dist/session.js.map +1 -0
- package/dist/spawn-types.d.ts +119 -0
- package/dist/spawn-types.d.ts.map +1 -0
- package/dist/spawn-types.js +12 -0
- package/dist/spawn-types.js.map +1 -0
- package/dist/spawn.d.ts +30 -0
- package/dist/spawn.d.ts.map +1 -0
- package/dist/spawn.js +7 -0
- package/dist/spawn.js.map +1 -0
- package/dist/status-registry.d.ts +50 -0
- package/dist/status-registry.d.ts.map +1 -0
- package/dist/status-registry.js +125 -0
- package/dist/status-registry.js.map +1 -0
- package/dist/task-record.d.ts +67 -0
- package/dist/task-record.d.ts.map +1 -0
- package/dist/task-record.js +11 -0
- package/dist/task-record.js.map +1 -0
- package/dist/task-sync.d.ts +143 -0
- package/dist/task-sync.d.ts.map +1 -0
- package/dist/task-sync.js +11 -0
- package/dist/task-sync.js.map +1 -0
- package/dist/task.d.ts +294 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +24 -0
- package/dist/task.js.map +1 -0
- package/dist/tessera.d.ts +32 -0
- package/dist/tessera.d.ts.map +1 -0
- package/dist/tessera.js +11 -0
- package/dist/tessera.js.map +1 -0
- package/dist/todowrite.d.ts +53 -0
- package/dist/todowrite.d.ts.map +1 -0
- package/dist/todowrite.js +7 -0
- package/dist/todowrite.js.map +1 -0
- package/dist/transport.d.ts +12 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +7 -0
- package/dist/transport.js.map +1 -0
- package/dist/warp-chain.d.ts +121 -0
- package/dist/warp-chain.d.ts.map +1 -0
- package/dist/warp-chain.js +13 -0
- package/dist/warp-chain.js.map +1 -0
- package/package.json +29 -0
- package/src/adapter.ts +38 -0
- package/src/archive.ts +121 -0
- package/src/brain.ts +39 -0
- package/src/capabilities.ts +21 -0
- package/src/config.ts +135 -0
- package/src/context-monitor.ts +16 -0
- package/src/data-accessor.ts +239 -0
- package/src/discovery.ts +31 -0
- package/src/exit-codes.ts +175 -0
- package/src/hooks.ts +17 -0
- package/src/index.ts +298 -0
- package/src/install.ts +28 -0
- package/src/lafs.ts +194 -0
- package/src/memory.ts +57 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/issues.ts +86 -0
- package/src/operations/lifecycle.ts +176 -0
- package/src/operations/orchestrate.ts +199 -0
- package/src/operations/release.ts +114 -0
- package/src/operations/research.ts +156 -0
- package/src/operations/session.ts +119 -0
- package/src/operations/skills.ts +210 -0
- package/src/operations/system.ts +174 -0
- package/src/operations/tasks.ts +279 -0
- package/src/operations/validate.ts +199 -0
- package/src/provider-paths.ts +16 -0
- package/src/results.ts +207 -0
- package/src/session.ts +157 -0
- package/src/spawn-types.ts +140 -0
- package/src/spawn.ts +32 -0
- package/src/status-registry.ts +166 -0
- package/src/task-record.ts +71 -0
- package/src/task-sync.ts +167 -0
- package/src/task.ts +387 -0
- package/src/tessera.ts +35 -0
- package/src/todowrite.ts +58 -0
- package/src/transport.ts +12 -0
- package/src/warp-chain.ts +174 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @cleocode/contracts — Domain types, interfaces, and contracts for the CLEO ecosystem.
|
|
3
|
+
*
|
|
4
|
+
* This is the LEAF package in the dependency graph — ZERO runtime dependencies.
|
|
5
|
+
* All domain types (Task, Session, DataAccessor, etc.) are defined here.
|
|
6
|
+
* Implementation packages (@cleocode/core, @cleocode/cleo) import from here.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// === Status Registry (MUST be first — everything depends on this) ===
|
|
10
|
+
export {
|
|
11
|
+
// Constants
|
|
12
|
+
TASK_STATUSES,
|
|
13
|
+
SESSION_STATUSES,
|
|
14
|
+
LIFECYCLE_PIPELINE_STATUSES,
|
|
15
|
+
LIFECYCLE_STAGE_STATUSES,
|
|
16
|
+
ADR_STATUSES,
|
|
17
|
+
GATE_STATUSES,
|
|
18
|
+
MANIFEST_STATUSES,
|
|
19
|
+
// Derived types
|
|
20
|
+
type TaskStatus,
|
|
21
|
+
type SessionStatus,
|
|
22
|
+
type PipelineStatus,
|
|
23
|
+
type StageStatus,
|
|
24
|
+
type AdrStatus,
|
|
25
|
+
type GateStatus,
|
|
26
|
+
type ManifestStatus,
|
|
27
|
+
// Terminal state sets
|
|
28
|
+
TERMINAL_TASK_STATUSES,
|
|
29
|
+
TERMINAL_PIPELINE_STATUSES,
|
|
30
|
+
TERMINAL_STAGE_STATUSES,
|
|
31
|
+
// Registry
|
|
32
|
+
type EntityType,
|
|
33
|
+
STATUS_REGISTRY,
|
|
34
|
+
isValidStatus,
|
|
35
|
+
// Display icons
|
|
36
|
+
PIPELINE_STATUS_ICONS,
|
|
37
|
+
STAGE_STATUS_ICONS,
|
|
38
|
+
TASK_STATUS_SYMBOLS_UNICODE,
|
|
39
|
+
TASK_STATUS_SYMBOLS_ASCII,
|
|
40
|
+
} from './status-registry.js';
|
|
41
|
+
|
|
42
|
+
// === Task Types ===
|
|
43
|
+
export type {
|
|
44
|
+
TaskPriority,
|
|
45
|
+
TaskType,
|
|
46
|
+
TaskSize,
|
|
47
|
+
EpicLifecycle,
|
|
48
|
+
TaskOrigin,
|
|
49
|
+
VerificationAgent,
|
|
50
|
+
VerificationGate,
|
|
51
|
+
VerificationFailure,
|
|
52
|
+
TaskVerification,
|
|
53
|
+
TaskProvenance,
|
|
54
|
+
TaskRelation,
|
|
55
|
+
Task,
|
|
56
|
+
TaskCreate,
|
|
57
|
+
CompletedTask,
|
|
58
|
+
CancelledTask,
|
|
59
|
+
PhaseStatus,
|
|
60
|
+
Phase,
|
|
61
|
+
PhaseTransition,
|
|
62
|
+
ReleaseStatus,
|
|
63
|
+
Release,
|
|
64
|
+
ProjectMeta,
|
|
65
|
+
FileMeta,
|
|
66
|
+
SessionNote,
|
|
67
|
+
TaskWorkState,
|
|
68
|
+
TaskFile,
|
|
69
|
+
} from './task.js';
|
|
70
|
+
|
|
71
|
+
// === Session Types ===
|
|
72
|
+
export { SessionView } from './session.js';
|
|
73
|
+
export type {
|
|
74
|
+
SessionScope,
|
|
75
|
+
SessionStats,
|
|
76
|
+
SessionTaskWork,
|
|
77
|
+
Session,
|
|
78
|
+
} from './session.js';
|
|
79
|
+
|
|
80
|
+
// === Exit Codes ===
|
|
81
|
+
export {
|
|
82
|
+
ExitCode,
|
|
83
|
+
isErrorCode,
|
|
84
|
+
isSuccessCode,
|
|
85
|
+
isNoChangeCode,
|
|
86
|
+
isRecoverableCode,
|
|
87
|
+
getExitCodeName,
|
|
88
|
+
} from './exit-codes.js';
|
|
89
|
+
|
|
90
|
+
// === Configuration Types ===
|
|
91
|
+
export type {
|
|
92
|
+
OutputFormat,
|
|
93
|
+
DateFormat,
|
|
94
|
+
OutputConfig,
|
|
95
|
+
BackupConfig,
|
|
96
|
+
EnforcementProfile,
|
|
97
|
+
HierarchyConfig,
|
|
98
|
+
SessionConfig,
|
|
99
|
+
LogLevel,
|
|
100
|
+
LoggingConfig,
|
|
101
|
+
LifecycleEnforcementMode,
|
|
102
|
+
LifecycleConfig,
|
|
103
|
+
SharingMode,
|
|
104
|
+
SharingConfig,
|
|
105
|
+
SignalDockMode,
|
|
106
|
+
SignalDockConfig,
|
|
107
|
+
CleoConfig,
|
|
108
|
+
ConfigSource,
|
|
109
|
+
ResolvedValue,
|
|
110
|
+
} from './config.js';
|
|
111
|
+
|
|
112
|
+
// === LAFS Envelope Types ===
|
|
113
|
+
export {
|
|
114
|
+
isLafsSuccess,
|
|
115
|
+
isLafsError,
|
|
116
|
+
isGatewayEnvelope,
|
|
117
|
+
} from './lafs.js';
|
|
118
|
+
export type {
|
|
119
|
+
LAFSErrorCategory,
|
|
120
|
+
LAFSError,
|
|
121
|
+
Warning,
|
|
122
|
+
LAFSTransport,
|
|
123
|
+
MVILevel,
|
|
124
|
+
LAFSPageNone,
|
|
125
|
+
LAFSPageOffset,
|
|
126
|
+
LAFSPage,
|
|
127
|
+
LAFSMeta,
|
|
128
|
+
LAFSEnvelope,
|
|
129
|
+
FlagInput,
|
|
130
|
+
ConformanceReport,
|
|
131
|
+
LafsAlternative,
|
|
132
|
+
LafsErrorDetail,
|
|
133
|
+
LafsSuccess,
|
|
134
|
+
LafsError,
|
|
135
|
+
LafsEnvelope,
|
|
136
|
+
GatewayMeta,
|
|
137
|
+
GatewaySuccess,
|
|
138
|
+
GatewayError,
|
|
139
|
+
GatewayEnvelope,
|
|
140
|
+
CleoResponse,
|
|
141
|
+
} from './lafs.js';
|
|
142
|
+
|
|
143
|
+
// === DataAccessor Interface ===
|
|
144
|
+
export type {
|
|
145
|
+
ArchiveFields,
|
|
146
|
+
ArchiveFile,
|
|
147
|
+
TaskQueryFilters,
|
|
148
|
+
QueryTasksResult,
|
|
149
|
+
TaskFieldUpdates,
|
|
150
|
+
TransactionAccessor,
|
|
151
|
+
DataAccessor,
|
|
152
|
+
} from './data-accessor.js';
|
|
153
|
+
|
|
154
|
+
// === Provider Adapter Contracts ===
|
|
155
|
+
export type { CLEOProviderAdapter, AdapterHealthStatus } from './adapter.js';
|
|
156
|
+
export type { AdapterCapabilities } from './capabilities.js';
|
|
157
|
+
export type { AdapterManifest, DetectionPattern } from './discovery.js';
|
|
158
|
+
export type { AdapterHookProvider } from './hooks.js';
|
|
159
|
+
export type { AdapterInstallProvider, InstallOptions, InstallResult } from './install.js';
|
|
160
|
+
export type {
|
|
161
|
+
MemoryBridgeConfig,
|
|
162
|
+
MemoryBridgeContent,
|
|
163
|
+
SessionSummary,
|
|
164
|
+
BridgeLearning,
|
|
165
|
+
BridgePattern,
|
|
166
|
+
BridgeDecision,
|
|
167
|
+
BridgeObservation,
|
|
168
|
+
} from './memory.js';
|
|
169
|
+
export type { AdapterSpawnProvider, SpawnContext, SpawnResult } from './spawn.js';
|
|
170
|
+
export type { AdapterPathProvider } from './provider-paths.js';
|
|
171
|
+
export type { AdapterContextMonitorProvider } from './context-monitor.js';
|
|
172
|
+
export type { AdapterTransportProvider } from './transport.js';
|
|
173
|
+
|
|
174
|
+
// === CLEO Spawn Types (distinct from adapter spawn) ===
|
|
175
|
+
export type {
|
|
176
|
+
Provider,
|
|
177
|
+
CAAMPSpawnOptions,
|
|
178
|
+
CAAMPSpawnResult,
|
|
179
|
+
CLEOSpawnContext,
|
|
180
|
+
CLEOSpawnResult,
|
|
181
|
+
CLEOSpawnAdapter,
|
|
182
|
+
TokenResolution,
|
|
183
|
+
SpawnStatus,
|
|
184
|
+
} from './spawn-types.js';
|
|
185
|
+
|
|
186
|
+
// === WarpChain Types ===
|
|
187
|
+
export type {
|
|
188
|
+
ProtocolType,
|
|
189
|
+
GateName,
|
|
190
|
+
WarpStage,
|
|
191
|
+
WarpLink,
|
|
192
|
+
ChainShape,
|
|
193
|
+
GateCheck,
|
|
194
|
+
GateContract,
|
|
195
|
+
WarpChain,
|
|
196
|
+
ChainValidation,
|
|
197
|
+
WarpChainInstance,
|
|
198
|
+
GateResult,
|
|
199
|
+
WarpChainExecution,
|
|
200
|
+
} from './warp-chain.js';
|
|
201
|
+
|
|
202
|
+
// === Tessera Types ===
|
|
203
|
+
export type {
|
|
204
|
+
TesseraVariable,
|
|
205
|
+
TesseraTemplate,
|
|
206
|
+
TesseraInstantiationInput,
|
|
207
|
+
} from './tessera.js';
|
|
208
|
+
|
|
209
|
+
// === Archive Types ===
|
|
210
|
+
export type {
|
|
211
|
+
ArchiveMetadata,
|
|
212
|
+
ArchivedTask,
|
|
213
|
+
ArchiveReportType,
|
|
214
|
+
ArchiveSummaryReport,
|
|
215
|
+
ArchivePhaseEntry,
|
|
216
|
+
ArchiveLabelEntry,
|
|
217
|
+
ArchivePriorityEntry,
|
|
218
|
+
CycleTimeDistribution,
|
|
219
|
+
CycleTimePercentiles,
|
|
220
|
+
ArchiveCycleTimesReport,
|
|
221
|
+
ArchiveDailyTrend,
|
|
222
|
+
ArchiveMonthlyTrend,
|
|
223
|
+
ArchiveTrendsReport,
|
|
224
|
+
ArchiveStatsEnvelope,
|
|
225
|
+
} from './archive.js';
|
|
226
|
+
|
|
227
|
+
// === TodoWrite Types (deprecated — use task-sync types) ===
|
|
228
|
+
export type {
|
|
229
|
+
TodoWriteItemStatus,
|
|
230
|
+
TodoWriteItem,
|
|
231
|
+
TodoWriteState,
|
|
232
|
+
TodoWriteSyncSessionState,
|
|
233
|
+
TodoWriteChangeSet,
|
|
234
|
+
TodoWriteChangeAction,
|
|
235
|
+
TodoWriteChange,
|
|
236
|
+
TodoWriteMergeResult,
|
|
237
|
+
} from './todowrite.js';
|
|
238
|
+
|
|
239
|
+
// === Task Sync Types (provider-agnostic reconciliation) ===
|
|
240
|
+
export type {
|
|
241
|
+
ExternalTaskStatus,
|
|
242
|
+
ExternalTask,
|
|
243
|
+
SyncSessionState,
|
|
244
|
+
ConflictPolicy,
|
|
245
|
+
ReconcileOptions,
|
|
246
|
+
ReconcileActionType,
|
|
247
|
+
ReconcileAction,
|
|
248
|
+
ReconcileResult,
|
|
249
|
+
AdapterTaskSyncProvider,
|
|
250
|
+
} from './task-sync.js';
|
|
251
|
+
|
|
252
|
+
// === Result Types (Dashboard, Stats, Log, Context, Sequence, Analysis, Deps) ===
|
|
253
|
+
export type {
|
|
254
|
+
TaskSummary,
|
|
255
|
+
LabelCount,
|
|
256
|
+
DashboardResult,
|
|
257
|
+
StatsCurrentState,
|
|
258
|
+
StatsCompletionMetrics,
|
|
259
|
+
StatsActivityMetrics,
|
|
260
|
+
StatsAllTime,
|
|
261
|
+
StatsCycleTimes,
|
|
262
|
+
StatsResult,
|
|
263
|
+
LogQueryResult,
|
|
264
|
+
ContextResult,
|
|
265
|
+
SequenceResult,
|
|
266
|
+
TaskRef,
|
|
267
|
+
TaskRefPriority,
|
|
268
|
+
LeveragedTask,
|
|
269
|
+
BottleneckTask,
|
|
270
|
+
TaskAnalysisResult,
|
|
271
|
+
TaskDepsResult,
|
|
272
|
+
CompleteTaskUnblocked,
|
|
273
|
+
} from './results.js';
|
|
274
|
+
|
|
275
|
+
// === Brain/Memory Types ===
|
|
276
|
+
export type {
|
|
277
|
+
BrainEntryRef,
|
|
278
|
+
BrainEntrySummary,
|
|
279
|
+
ContradictionDetail,
|
|
280
|
+
SupersededEntry,
|
|
281
|
+
} from './brain.js';
|
|
282
|
+
|
|
283
|
+
// === TaskRecord Types (string-widened for dispatch/LAFS) ===
|
|
284
|
+
export type {
|
|
285
|
+
TaskRecordRelation,
|
|
286
|
+
ValidationHistoryEntry,
|
|
287
|
+
TaskRecord,
|
|
288
|
+
MinimalTaskRecord,
|
|
289
|
+
} from './task-record.js';
|
|
290
|
+
|
|
291
|
+
// === Session Start Result ===
|
|
292
|
+
export type { SessionStartResult } from './session.js';
|
|
293
|
+
|
|
294
|
+
// === Operations Types (API wire format, namespaced to avoid collision with domain types) ===
|
|
295
|
+
export * as ops from './operations/index.js';
|
|
296
|
+
|
|
297
|
+
// Commonly used ops types re-exported at top level for convenience
|
|
298
|
+
export type { BrainState } from './operations/orchestrate.js';
|
package/src/install.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install provider interface for CLEO provider adapters.
|
|
3
|
+
* Handles registration with the provider and instruction file references.
|
|
4
|
+
*
|
|
5
|
+
* @task T5240
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface AdapterInstallProvider {
|
|
9
|
+
install(options: InstallOptions): Promise<InstallResult>;
|
|
10
|
+
uninstall(): Promise<void>;
|
|
11
|
+
isInstalled(): Promise<boolean>;
|
|
12
|
+
/** Ensure the provider's instruction file references CLEO (e.g. @AGENTS.md in CLAUDE.md). */
|
|
13
|
+
ensureInstructionReferences(projectDir: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface InstallOptions {
|
|
17
|
+
projectDir: string;
|
|
18
|
+
global?: boolean;
|
|
19
|
+
mcpServerPath?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface InstallResult {
|
|
23
|
+
success: boolean;
|
|
24
|
+
installedAt: string;
|
|
25
|
+
instructionFileUpdated: boolean;
|
|
26
|
+
mcpRegistered: boolean;
|
|
27
|
+
details?: Record<string, unknown>;
|
|
28
|
+
}
|
package/src/lafs.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAFS (LLM-Agent-First Schema) unified envelope types.
|
|
3
|
+
*
|
|
4
|
+
* Defines canonical LAFS types inline (contracts has ZERO external dependencies).
|
|
5
|
+
* In the main CLEO codebase these are re-exported from @cleocode/lafs-protocol;
|
|
6
|
+
* here they are defined as plain interfaces for maximum portability.
|
|
7
|
+
*
|
|
8
|
+
* @epic T4654
|
|
9
|
+
* @task T4655
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Canonical LAFS types (inlined from @cleocode/lafs-protocol)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
/** LAFS error category. */
|
|
17
|
+
export type LAFSErrorCategory =
|
|
18
|
+
| 'validation'
|
|
19
|
+
| 'not_found'
|
|
20
|
+
| 'conflict'
|
|
21
|
+
| 'authorization'
|
|
22
|
+
| 'internal'
|
|
23
|
+
| 'rate_limit'
|
|
24
|
+
| 'timeout'
|
|
25
|
+
| 'dependency';
|
|
26
|
+
|
|
27
|
+
/** LAFS error object. */
|
|
28
|
+
export interface LAFSError {
|
|
29
|
+
code: number | string;
|
|
30
|
+
category: LAFSErrorCategory;
|
|
31
|
+
message: string;
|
|
32
|
+
fix?: string;
|
|
33
|
+
details?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** LAFS warning. */
|
|
37
|
+
export interface Warning {
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** LAFS transport metadata. */
|
|
43
|
+
export type LAFSTransport = 'mcp' | 'cli' | 'http' | 'sdk';
|
|
44
|
+
|
|
45
|
+
/** MVI (Minimal Viable Information) level. */
|
|
46
|
+
export type MVILevel = 'minimal' | 'standard' | 'full';
|
|
47
|
+
|
|
48
|
+
/** LAFS page — no pagination. */
|
|
49
|
+
export interface LAFSPageNone {
|
|
50
|
+
strategy: 'none';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** LAFS page — offset-based pagination. */
|
|
54
|
+
export interface LAFSPageOffset {
|
|
55
|
+
strategy: 'offset';
|
|
56
|
+
offset: number;
|
|
57
|
+
limit: number;
|
|
58
|
+
total: number;
|
|
59
|
+
hasMore: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** LAFS page union. */
|
|
63
|
+
export type LAFSPage = LAFSPageNone | LAFSPageOffset;
|
|
64
|
+
|
|
65
|
+
/** LAFS metadata block. */
|
|
66
|
+
export interface LAFSMeta {
|
|
67
|
+
transport: LAFSTransport;
|
|
68
|
+
mvi: MVILevel;
|
|
69
|
+
page?: LAFSPage;
|
|
70
|
+
warnings?: Warning[];
|
|
71
|
+
durationMs?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** LAFS envelope (canonical protocol type). */
|
|
75
|
+
export interface LAFSEnvelope<T = unknown> {
|
|
76
|
+
success: boolean;
|
|
77
|
+
data?: T;
|
|
78
|
+
error?: LAFSError;
|
|
79
|
+
_meta?: LAFSMeta;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Flag input for conformance checks. */
|
|
83
|
+
export interface FlagInput {
|
|
84
|
+
flag: string;
|
|
85
|
+
value: unknown;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Conformance report. */
|
|
89
|
+
export interface ConformanceReport {
|
|
90
|
+
valid: boolean;
|
|
91
|
+
violations: string[];
|
|
92
|
+
warnings: string[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// CLEO-specific error detail (backward compatible)
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
/** Actionable alternative the caller can try. */
|
|
100
|
+
export interface LafsAlternative {
|
|
101
|
+
action: string;
|
|
102
|
+
command: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** LAFS error detail shared between CLI and MCP. */
|
|
106
|
+
export interface LafsErrorDetail {
|
|
107
|
+
code: number | string;
|
|
108
|
+
name?: string;
|
|
109
|
+
message: string;
|
|
110
|
+
fix?: string;
|
|
111
|
+
alternatives?: LafsAlternative[];
|
|
112
|
+
details?: Record<string, unknown>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
// CLI envelope (base) - backward compatible
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
|
|
119
|
+
/** LAFS success envelope (CLI). */
|
|
120
|
+
export interface LafsSuccess<T = unknown> {
|
|
121
|
+
success: true;
|
|
122
|
+
data: T;
|
|
123
|
+
message?: string;
|
|
124
|
+
noChange?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** LAFS error envelope (CLI). */
|
|
128
|
+
export interface LafsError {
|
|
129
|
+
success: false;
|
|
130
|
+
error: LafsErrorDetail;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** CLI envelope union type. */
|
|
134
|
+
export type LafsEnvelope<T = unknown> = LafsSuccess<T> | LafsError;
|
|
135
|
+
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// MCP / gateway envelope extension (extends LAFSMeta)
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Metadata attached to every MCP gateway response.
|
|
142
|
+
* Extends the canonical LAFSMeta with CLEO gateway-specific fields.
|
|
143
|
+
*
|
|
144
|
+
* @task T4655
|
|
145
|
+
*/
|
|
146
|
+
export interface GatewayMeta extends LAFSMeta {
|
|
147
|
+
gateway: string;
|
|
148
|
+
domain: string;
|
|
149
|
+
duration_ms: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** MCP success envelope (extends CLI base with _meta). */
|
|
153
|
+
export interface GatewaySuccess<T = unknown> extends LafsSuccess<T> {
|
|
154
|
+
_meta: GatewayMeta;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** MCP error envelope (extends CLI base with _meta). */
|
|
158
|
+
export interface GatewayError extends LafsError {
|
|
159
|
+
_meta: GatewayMeta;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** MCP envelope union type. */
|
|
163
|
+
export type GatewayEnvelope<T = unknown> = GatewaySuccess<T> | GatewayError;
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Unified envelope (covers both CLI and MCP)
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Unified CLEO response envelope.
|
|
171
|
+
*
|
|
172
|
+
* Every CLEO response (CLI or MCP) is a CleoResponse. MCP responses include
|
|
173
|
+
* the _meta field; CLI responses do not.
|
|
174
|
+
*/
|
|
175
|
+
export type CleoResponse<T = unknown> = LafsEnvelope<T> | GatewayEnvelope<T>;
|
|
176
|
+
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
// Type guards
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
/** Type guard for success responses. */
|
|
182
|
+
export function isLafsSuccess<T>(envelope: LafsEnvelope<T>): envelope is LafsSuccess<T> {
|
|
183
|
+
return envelope.success === true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Type guard for error responses. */
|
|
187
|
+
export function isLafsError<T>(envelope: LafsEnvelope<T>): envelope is LafsError {
|
|
188
|
+
return envelope.success === false;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Type guard for MCP gateway responses (has _meta). */
|
|
192
|
+
export function isGatewayEnvelope<T>(envelope: CleoResponse<T>): envelope is GatewayEnvelope<T> {
|
|
193
|
+
return '_meta' in envelope && envelope._meta !== undefined;
|
|
194
|
+
}
|
package/src/memory.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory bridge types for CLEO provider adapters.
|
|
3
|
+
* Defines the shape of .cleo/memory-bridge.md content for cross-provider memory sharing.
|
|
4
|
+
*
|
|
5
|
+
* @task T5240
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface MemoryBridgeConfig {
|
|
9
|
+
maxObservations: number;
|
|
10
|
+
maxLearnings: number;
|
|
11
|
+
maxPatterns: number;
|
|
12
|
+
maxDecisions: number;
|
|
13
|
+
includeHandoff: boolean;
|
|
14
|
+
includeAntiPatterns: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MemoryBridgeContent {
|
|
18
|
+
generatedAt: string;
|
|
19
|
+
lastSession?: SessionSummary;
|
|
20
|
+
learnings: BridgeLearning[];
|
|
21
|
+
patterns: BridgePattern[];
|
|
22
|
+
antiPatterns: BridgePattern[];
|
|
23
|
+
decisions: BridgeDecision[];
|
|
24
|
+
recentObservations: BridgeObservation[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SessionSummary {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
date: string;
|
|
30
|
+
tasksCompleted: string[];
|
|
31
|
+
decisions: string[];
|
|
32
|
+
nextSuggested: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface BridgeLearning {
|
|
36
|
+
id: string;
|
|
37
|
+
text: string;
|
|
38
|
+
confidence: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface BridgePattern {
|
|
42
|
+
id: string;
|
|
43
|
+
text: string;
|
|
44
|
+
type: 'follow' | 'avoid';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface BridgeDecision {
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
date: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface BridgeObservation {
|
|
54
|
+
id: string;
|
|
55
|
+
date: string;
|
|
56
|
+
summary: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations types barrel — API wire format types for all CLEO domains.
|
|
3
|
+
*
|
|
4
|
+
* These are re-exported under `ops` namespace from the package root
|
|
5
|
+
* to avoid name collisions with canonical domain types.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * from './issues.js';
|
|
9
|
+
export * from './lifecycle.js';
|
|
10
|
+
export * from './orchestrate.js';
|
|
11
|
+
export * from './release.js';
|
|
12
|
+
export * from './research.js';
|
|
13
|
+
export * from './session.js';
|
|
14
|
+
export * from './skills.js';
|
|
15
|
+
export * from './system.js';
|
|
16
|
+
export * from './tasks.js';
|
|
17
|
+
export * from './validate.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issues Domain Operations (4 operations)
|
|
3
|
+
*
|
|
4
|
+
* Query operations: 1 (diagnostics)
|
|
5
|
+
* Mutate operations: 3 (add.bug, add.feature, add.help)
|
|
6
|
+
*
|
|
7
|
+
* @task T4494
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Common issue types
|
|
12
|
+
*/
|
|
13
|
+
export type IssueSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
14
|
+
export type IssueArea = 'cli' | 'mcp' | 'docs' | 'tests' | 'other';
|
|
15
|
+
export type IssueType = 'bug' | 'feature' | 'help';
|
|
16
|
+
|
|
17
|
+
export interface Diagnostics {
|
|
18
|
+
cleoVersion: string;
|
|
19
|
+
bashVersion: string;
|
|
20
|
+
jqVersion: string;
|
|
21
|
+
os: string;
|
|
22
|
+
shell: string;
|
|
23
|
+
cleoHome: string;
|
|
24
|
+
ghVersion: string;
|
|
25
|
+
installLocation: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Query Operations
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// issues.diagnostics
|
|
33
|
+
export type IssuesDiagnosticsParams = Record<string, never>;
|
|
34
|
+
export interface IssuesDiagnosticsResult {
|
|
35
|
+
diagnostics: Diagnostics;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Mutate Operations
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// issues.add.bug (alias: create.bug)
|
|
43
|
+
export interface IssuesCreateBugParams {
|
|
44
|
+
title: string;
|
|
45
|
+
body: string;
|
|
46
|
+
severity?: IssueSeverity;
|
|
47
|
+
area?: IssueArea;
|
|
48
|
+
dryRun?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface IssuesCreateBugResult {
|
|
51
|
+
type: 'bug';
|
|
52
|
+
url: string;
|
|
53
|
+
number: number;
|
|
54
|
+
title: string;
|
|
55
|
+
labels: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// issues.add.feature (alias: create.feature)
|
|
59
|
+
export interface IssuesCreateFeatureParams {
|
|
60
|
+
title: string;
|
|
61
|
+
body: string;
|
|
62
|
+
area?: IssueArea;
|
|
63
|
+
dryRun?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface IssuesCreateFeatureResult {
|
|
66
|
+
type: 'feature';
|
|
67
|
+
url: string;
|
|
68
|
+
number: number;
|
|
69
|
+
title: string;
|
|
70
|
+
labels: string[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// issues.add.help (alias: create.help)
|
|
74
|
+
export interface IssuesCreateHelpParams {
|
|
75
|
+
title: string;
|
|
76
|
+
body: string;
|
|
77
|
+
area?: IssueArea;
|
|
78
|
+
dryRun?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface IssuesCreateHelpResult {
|
|
81
|
+
type: 'help';
|
|
82
|
+
url: string;
|
|
83
|
+
number: number;
|
|
84
|
+
title: string;
|
|
85
|
+
labels: string[];
|
|
86
|
+
}
|