@cleocode/contracts 2026.4.100 → 2026.4.102

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 (96) hide show
  1. package/dist/brain-graph.d.ts +245 -0
  2. package/dist/brain-graph.d.ts.map +1 -0
  3. package/dist/brain-graph.js +30 -0
  4. package/dist/brain-graph.js.map +1 -0
  5. package/dist/branch-lock.d.ts +225 -0
  6. package/dist/branch-lock.d.ts.map +1 -0
  7. package/dist/branch-lock.js +43 -0
  8. package/dist/branch-lock.js.map +1 -0
  9. package/dist/exit-codes.d.ts +1 -1
  10. package/dist/exit-codes.d.ts.map +1 -1
  11. package/dist/exit-codes.js +1 -1
  12. package/dist/exit-codes.js.map +1 -1
  13. package/dist/graph.d.ts +2 -0
  14. package/dist/graph.d.ts.map +1 -1
  15. package/dist/index.d.ts +11 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/nexus-contract-ops.d.ts +186 -0
  20. package/dist/nexus-contract-ops.d.ts.map +1 -0
  21. package/dist/nexus-contract-ops.js +11 -0
  22. package/dist/nexus-contract-ops.js.map +1 -0
  23. package/dist/nexus-living-brain-ops.d.ts +314 -0
  24. package/dist/nexus-living-brain-ops.d.ts.map +1 -0
  25. package/dist/nexus-living-brain-ops.js +15 -0
  26. package/dist/nexus-living-brain-ops.js.map +1 -0
  27. package/dist/nexus-query-ops.d.ts +82 -0
  28. package/dist/nexus-query-ops.d.ts.map +1 -0
  29. package/dist/nexus-query-ops.js +11 -0
  30. package/dist/nexus-query-ops.js.map +1 -0
  31. package/dist/nexus-route-ops.d.ts +103 -0
  32. package/dist/nexus-route-ops.d.ts.map +1 -0
  33. package/dist/nexus-route-ops.js +10 -0
  34. package/dist/nexus-route-ops.js.map +1 -0
  35. package/dist/nexus-tasks-bridge-ops.d.ts +68 -0
  36. package/dist/nexus-tasks-bridge-ops.d.ts.map +1 -0
  37. package/dist/nexus-tasks-bridge-ops.js +11 -0
  38. package/dist/nexus-tasks-bridge-ops.js.map +1 -0
  39. package/dist/nexus-wiki-ops.d.ts +127 -0
  40. package/dist/nexus-wiki-ops.d.ts.map +1 -0
  41. package/dist/nexus-wiki-ops.js +12 -0
  42. package/dist/nexus-wiki-ops.js.map +1 -0
  43. package/dist/operations/admin.d.ts +1781 -0
  44. package/dist/operations/admin.d.ts.map +1 -0
  45. package/dist/operations/admin.js +27 -0
  46. package/dist/operations/admin.js.map +1 -0
  47. package/dist/operations/brain.d.ts +34 -26
  48. package/dist/operations/brain.d.ts.map +1 -1
  49. package/dist/operations/brain.js +7 -6
  50. package/dist/operations/brain.js.map +1 -1
  51. package/dist/operations/docs.d.ts +279 -0
  52. package/dist/operations/docs.d.ts.map +1 -0
  53. package/dist/operations/docs.js +31 -0
  54. package/dist/operations/docs.js.map +1 -0
  55. package/dist/operations/intelligence.d.ts +319 -0
  56. package/dist/operations/intelligence.d.ts.map +1 -0
  57. package/dist/operations/intelligence.js +24 -0
  58. package/dist/operations/intelligence.js.map +1 -0
  59. package/dist/operations/orchestrate.d.ts +113 -2
  60. package/dist/operations/orchestrate.d.ts.map +1 -1
  61. package/dist/operations/orchestrate.js +3 -2
  62. package/dist/operations/orchestrate.js.map +1 -1
  63. package/dist/operations/session.d.ts +193 -47
  64. package/dist/operations/session.d.ts.map +1 -1
  65. package/dist/operations/session.js +7 -6
  66. package/dist/operations/session.js.map +1 -1
  67. package/dist/operations/sticky.d.ts +264 -0
  68. package/dist/operations/sticky.d.ts.map +1 -0
  69. package/dist/operations/sticky.js +19 -0
  70. package/dist/operations/sticky.js.map +1 -0
  71. package/dist/operations/validate.d.ts +145 -19
  72. package/dist/operations/validate.d.ts.map +1 -1
  73. package/dist/operations/validate.js +3 -3
  74. package/dist/task-record.d.ts +19 -0
  75. package/dist/task-record.d.ts.map +1 -1
  76. package/package.json +41 -1
  77. package/src/brain-graph.ts +282 -0
  78. package/src/branch-lock.ts +254 -0
  79. package/src/exit-codes.ts +1 -1
  80. package/src/graph.ts +2 -0
  81. package/src/index.ts +128 -0
  82. package/src/nexus-contract-ops.ts +244 -0
  83. package/src/nexus-living-brain-ops.ts +345 -0
  84. package/src/nexus-query-ops.ts +100 -0
  85. package/src/nexus-route-ops.ts +134 -0
  86. package/src/nexus-tasks-bridge-ops.ts +71 -0
  87. package/src/nexus-wiki-ops.ts +133 -0
  88. package/src/operations/admin.ts +2087 -0
  89. package/src/operations/brain.ts +34 -26
  90. package/src/operations/docs.ts +322 -0
  91. package/src/operations/intelligence.ts +399 -0
  92. package/src/operations/orchestrate.ts +117 -2
  93. package/src/operations/session.ts +225 -48
  94. package/src/operations/sticky.ts +308 -0
  95. package/src/operations/validate.ts +161 -55
  96. package/src/task-record.ts +19 -0
@@ -0,0 +1,345 @@
1
+ /**
2
+ * Contract types for the Living Brain SDK traversal primitives (T1068).
3
+ *
4
+ * The Living Brain is the cross-substrate query surface for the CLEO agent
5
+ * intelligence layer. It unifies five substrates — NEXUS (code graph),
6
+ * BRAIN (memory), TASKS, SENTIENT (proposals), and CONDUIT (messages) — into
7
+ * a single traversal API.
8
+ *
9
+ * These are LEAF types — zero runtime dependencies.
10
+ *
11
+ * @task T1068
12
+ * @epic T1042
13
+ */
14
+
15
+ // ---------------------------------------------------------------------------
16
+ // Sub-interfaces — each substrate's projection
17
+ // ---------------------------------------------------------------------------
18
+
19
+ /**
20
+ * Caller or callee within the nexus code graph.
21
+ */
22
+ export interface NexusEdgeRef {
23
+ /** Nexus node ID. */
24
+ nodeId: string;
25
+ /** Human-readable display name. */
26
+ name: string;
27
+ /** Source file path (relative to project root). */
28
+ filePath: string | null;
29
+ /** Node kind ('function', 'class', 'method', etc.). */
30
+ kind: string;
31
+ /** Relation type ('calls', 'imports', 'accesses'). */
32
+ relationType: string;
33
+ }
34
+
35
+ /**
36
+ * Nexus context for a symbol: callers, callees, community, process membership.
37
+ */
38
+ export interface NexusContext {
39
+ /** Symbol's own nexus node ID. */
40
+ symbolId: string;
41
+ /** Display label. */
42
+ label: string;
43
+ /** File path. */
44
+ filePath: string | null;
45
+ /** Node kind. */
46
+ kind: string;
47
+ /** Community ID this symbol belongs to (if any). */
48
+ communityId: string | null;
49
+ /** Nodes that call/import this symbol. */
50
+ callers: NexusEdgeRef[];
51
+ /** Nodes this symbol calls/imports. */
52
+ callees: NexusEdgeRef[];
53
+ /** Process nodes this symbol participates in. */
54
+ processes: string[];
55
+ }
56
+
57
+ /**
58
+ * A brain memory node (observation, decision, pattern, learning) that
59
+ * references a code symbol via one of the cross-substrate edge types.
60
+ */
61
+ export interface BrainMemoryRef {
62
+ /** Brain page node ID (e.g., 'observation:abc123'). */
63
+ nodeId: string;
64
+ /** Node type. */
65
+ nodeType: string;
66
+ /** Human-readable label for the memory entry. */
67
+ label: string;
68
+ /** Quality score of this memory entry (0.0–1.0). */
69
+ qualityScore: number;
70
+ /** Edge type used to connect this memory to the symbol. */
71
+ edgeType: string;
72
+ /** Edge weight. */
73
+ weight: number;
74
+ }
75
+
76
+ /**
77
+ * A task reference linking a task to a code symbol.
78
+ */
79
+ export interface LbTaskRef {
80
+ /** Task ID (e.g., 'T001'). */
81
+ taskId: string;
82
+ /** Display label for the task. */
83
+ label: string;
84
+ /** Edge weight (confidence). */
85
+ weight: number;
86
+ /** Strategy used to detect the link. */
87
+ matchStrategy: string;
88
+ }
89
+
90
+ /**
91
+ * A sentient proposal entry referencing a code symbol.
92
+ */
93
+ export interface ProposalRef {
94
+ /** Source system. */
95
+ source: string;
96
+ /** Source ID (nexus node ID for nexus proposals). */
97
+ sourceId: string;
98
+ /** Structured proposal title. */
99
+ title: string;
100
+ /** Proposal rationale. */
101
+ rationale: string;
102
+ /** Proposal weight in [0, 1]. */
103
+ weight: number;
104
+ }
105
+
106
+ /**
107
+ * A conduit message thread that mentions a symbol.
108
+ *
109
+ * Returns empty array when conduit.db is absent (T1071 schema not yet present).
110
+ */
111
+ export interface ConduitThreadRef {
112
+ /** Conduit message node ID (format: 'conduit:<id>'). */
113
+ nodeId: string;
114
+ /** Edge weight. */
115
+ weight: number;
116
+ }
117
+
118
+ /**
119
+ * Plasticity measurement for a symbol — aggregate edge weight from nexus_relations.
120
+ */
121
+ export interface PlasticityMeasure {
122
+ /** Sum of edge weights across all nexus_relations involving this symbol. */
123
+ totalWeight: number;
124
+ /** Number of edges included in the sum. */
125
+ edgeCount: number;
126
+ }
127
+
128
+ // ---------------------------------------------------------------------------
129
+ // Primary return shapes
130
+ // ---------------------------------------------------------------------------
131
+
132
+ /**
133
+ * Full cross-substrate context for a code symbol.
134
+ *
135
+ * Returned by {@link getSymbolFullContext}.
136
+ */
137
+ export interface SymbolFullContext {
138
+ /** Symbol identifier (nexus node ID or name). */
139
+ symbolId: string;
140
+ /** Nexus code graph context: callers, callees, community, process. */
141
+ nexus: NexusContext | null;
142
+ /** Brain memory nodes (observations, decisions, patterns, learnings) linked to this symbol. */
143
+ brainMemories: BrainMemoryRef[];
144
+ /** Tasks that touched files containing this symbol. */
145
+ tasks: LbTaskRef[];
146
+ /** Sentient proposals whose sourceId matches this symbol. */
147
+ sentientProposals: ProposalRef[];
148
+ /** Conduit message threads mentioning this symbol (empty if conduit.db absent). */
149
+ conduitThreads: ConduitThreadRef[];
150
+ /** Plasticity weight sum from nexus_relations. */
151
+ plasticityWeight: PlasticityMeasure;
152
+ }
153
+
154
+ /**
155
+ * Code impact analysis for a task.
156
+ *
157
+ * Returned by {@link getTaskCodeImpact}.
158
+ */
159
+ export interface TaskCodeImpact {
160
+ /** Task ID. */
161
+ taskId: string;
162
+ /** Files listed in the task's files_json array. */
163
+ files: string[];
164
+ /** Symbols in those files (from NEXUS). */
165
+ symbols: SymbolImpactEntry[];
166
+ /** Aggregate blast radius across all symbols. */
167
+ blastRadius: BlastRadiusSummary;
168
+ /** Brain observations with modified_by edges to the task's files. */
169
+ brainObservations: BrainMemoryRef[];
170
+ /** Brain decisions linked to this task via brain_memory_links. */
171
+ decisions: DecisionRef[];
172
+ /** Highest risk tier across all symbols. */
173
+ riskScore: RiskTier;
174
+ }
175
+
176
+ /**
177
+ * Impact entry for a single symbol in a task's footprint.
178
+ */
179
+ export interface SymbolImpactEntry {
180
+ /** Nexus node ID. */
181
+ nexusNodeId: string;
182
+ /** Display label. */
183
+ label: string;
184
+ /** Symbol kind. */
185
+ kind: string;
186
+ /** File path. */
187
+ filePath: string | null;
188
+ /** Risk tier from analyzeImpact BFS. */
189
+ riskLevel: RiskTier;
190
+ /** Total number of affected nodes in BFS. */
191
+ totalAffected: number;
192
+ /** Direct callers (d=1) count. */
193
+ directCallers: number;
194
+ }
195
+
196
+ /**
197
+ * Aggregate blast radius across all symbols in a task's footprint.
198
+ */
199
+ export interface BlastRadiusSummary {
200
+ /** Total unique affected nodes across all symbols. */
201
+ totalAffected: number;
202
+ /** Maximum risk tier observed. */
203
+ maxRisk: RiskTier;
204
+ /** Number of symbols analyzed. */
205
+ symbolsAnalyzed: number;
206
+ }
207
+
208
+ /**
209
+ * A brain decision linked to a task.
210
+ */
211
+ export interface DecisionRef {
212
+ /** Decision ID. */
213
+ decisionId: string;
214
+ /** Decision text. */
215
+ decision: string;
216
+ /** Link type. */
217
+ linkType: string;
218
+ }
219
+
220
+ /**
221
+ * Risk tier for a symbol's impact analysis.
222
+ */
223
+ export type RiskTier = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
224
+
225
+ // ---------------------------------------------------------------------------
226
+ // T1069 — Extended Code Reasoning types
227
+ // ---------------------------------------------------------------------------
228
+
229
+ /**
230
+ * A single step in a code reasoning trace chain.
231
+ */
232
+ export interface ReasonTraceStep {
233
+ /** Step type discriminant. */
234
+ type: 'decision' | 'observation' | 'task' | 'symbol';
235
+ /** ID of this entry (brain ID, task ID, or nexus node ID). */
236
+ id: string;
237
+ /** Human-readable title or label for this entry. */
238
+ title: string;
239
+ /** References or related IDs (e.g., learning IDs for a decision step). */
240
+ refs: string[];
241
+ }
242
+
243
+ /**
244
+ * Full causal trace from a code symbol through brain decisions to tasks.
245
+ *
246
+ * Returned by {@link reasonWhySymbol}.
247
+ */
248
+ export interface CodeReasonTrace {
249
+ /** The nexus symbol ID queried. */
250
+ symbolId: string;
251
+ /** Human-readable narrative summarizing the trace. */
252
+ narrative: string;
253
+ /** Ordered chain of trace steps from symbol to root context. */
254
+ chain: ReasonTraceStep[];
255
+ }
256
+
257
+ /**
258
+ * A brain risk note associated with a symbol change.
259
+ */
260
+ export interface BrainRiskNote {
261
+ /** Brain node ID. */
262
+ nodeId: string;
263
+ /** Node type (observation, decision, etc.). */
264
+ nodeType: string;
265
+ /** Human-readable label. */
266
+ label: string;
267
+ /** Edge type that connects this note to the symbol. */
268
+ edgeType: string;
269
+ /** Risk contribution weight. */
270
+ weight: number;
271
+ }
272
+
273
+ /**
274
+ * Full merged impact report for a code symbol.
275
+ *
276
+ * Returned by {@link reasonImpactOfChange}.
277
+ */
278
+ export interface ImpactFullReport {
279
+ /** The nexus symbol ID analyzed. */
280
+ symbolId: string;
281
+ /** Structural blast radius from analyzeImpact BFS. */
282
+ structural: {
283
+ directCallers: number;
284
+ likelyAffected: number;
285
+ mayNeedTesting: number;
286
+ totalAffected: number;
287
+ riskLevel: RiskTier;
288
+ };
289
+ /** Open tasks that reference this symbol (from task_touches_symbol edges). */
290
+ openTasks: Array<{
291
+ taskId: string;
292
+ label: string;
293
+ weight: number;
294
+ }>;
295
+ /** Brain observations/decisions flagging risk for this symbol. */
296
+ brainRiskNotes: BrainRiskNote[];
297
+ /** Merged risk score (highest of structural, open-task count, brain notes). */
298
+ mergedRiskScore: RiskTier;
299
+ /** Human-readable narrative summarizing the combined risk. */
300
+ narrative: string;
301
+ }
302
+
303
+ /**
304
+ * Code anchor result for a brain memory entry.
305
+ *
306
+ * Returned by {@link getBrainEntryCodeAnchors}.
307
+ */
308
+ export interface CodeAnchorResult {
309
+ /** Brain entry ID that was queried. */
310
+ entryId: string;
311
+ /** Nexus nodes linked to this brain entry via code-reference edges. */
312
+ nexusNodes: NexusNodeAnchor[];
313
+ /** For each nexus node, which tasks touched it. */
314
+ tasksForNodes: TasksForNodeEntry[];
315
+ /** Sum of weights on all edges anchoring this brain entry to code. */
316
+ plasticitySignal: number;
317
+ }
318
+
319
+ /**
320
+ * A nexus node anchored to a brain entry.
321
+ */
322
+ export interface NexusNodeAnchor {
323
+ /** Nexus node ID. */
324
+ nexusNodeId: string;
325
+ /** Display label. */
326
+ label: string;
327
+ /** File path. */
328
+ filePath: string | null;
329
+ /** Node kind. */
330
+ kind: string;
331
+ /** Edge type connecting this node to the brain entry. */
332
+ edgeType: string;
333
+ /** Edge weight. */
334
+ weight: number;
335
+ }
336
+
337
+ /**
338
+ * Tasks that touched a specific nexus node.
339
+ */
340
+ export interface TasksForNodeEntry {
341
+ /** Nexus node ID. */
342
+ nexusNodeId: string;
343
+ /** Tasks that touched this node. */
344
+ tasks: LbTaskRef[];
345
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Nexus SQLite Recursive CTE Query Operations - Contract Layer
3
+ *
4
+ * Defines types for parameterized CTE execution against nexus.db.
5
+ * Contracts for the query DSL and template alias system.
6
+ *
7
+ * @task T1057
8
+ * @epic T1042
9
+ */
10
+
11
+ /**
12
+ * Result of a recursive CTE query against nexus.db.
13
+ * Returns rows as generic Record[] and metadata about the query.
14
+ */
15
+ export interface NexusCteResult {
16
+ /**
17
+ * Whether the query executed successfully.
18
+ */
19
+ success: boolean;
20
+
21
+ /**
22
+ * Query result rows. Empty array if no results.
23
+ */
24
+ rows: Array<Record<string, unknown>>;
25
+
26
+ /**
27
+ * Total number of rows returned.
28
+ */
29
+ row_count: number;
30
+
31
+ /**
32
+ * Query execution time in milliseconds.
33
+ */
34
+ execution_time_ms: number;
35
+
36
+ /**
37
+ * If success is false, error message describing the parse/execution failure.
38
+ * e.g. "CTE syntax error: ...", "Parameter mismatch: ..."
39
+ */
40
+ error?: string;
41
+ }
42
+
43
+ /**
44
+ * Parameters for CTE execution.
45
+ * Supports positional (?) and named (:name) parameter binding.
46
+ */
47
+ export type NexusCteParams = (string | number | null)[];
48
+
49
+ /**
50
+ * Named template alias for common CTE patterns.
51
+ * Compiles to parameterized CTE before execution.
52
+ */
53
+ export type NexusCteAlias =
54
+ | 'callers-of'
55
+ | 'callees-of'
56
+ | 'co-changed'
57
+ | 'co-cited'
58
+ | 'path-between'
59
+ | 'community-members';
60
+
61
+ /**
62
+ * Represents a compiled CTE template ready for execution.
63
+ * Internal: generated by compileCteAlias().
64
+ */
65
+ export interface NexusCtePlaceholder {
66
+ /**
67
+ * The CTE SQL string with parameter placeholders.
68
+ */
69
+ cte: string;
70
+
71
+ /**
72
+ * Human-readable description of what this CTE queries.
73
+ */
74
+ description: string;
75
+
76
+ /**
77
+ * Expected parameter count for this template.
78
+ */
79
+ paramCount: number;
80
+
81
+ /**
82
+ * Parameter names for documentation.
83
+ */
84
+ paramNames: string[];
85
+ }
86
+
87
+ /**
88
+ * Formatted markdown table of query results.
89
+ */
90
+ export interface NexusCteMarkdownTable {
91
+ /**
92
+ * Markdown-formatted table string.
93
+ */
94
+ markdown: string;
95
+
96
+ /**
97
+ * Number of rows in the table.
98
+ */
99
+ row_count: number;
100
+ }
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Route and API shape analysis contracts for NEXUS.
3
+ *
4
+ * Routes are first-class nodes in the code graph (kind: 'route').
5
+ * This module defines the query results for route mapping and shape checking.
6
+ *
7
+ * @task T1064 — Route-Map and Shape-Check Commands
8
+ */
9
+
10
+ /**
11
+ * A single route handler entry from `route-map`.
12
+ *
13
+ * Maps a route node to its handler functions and downstream dependencies.
14
+ */
15
+ export interface RouteMapEntry {
16
+ /** Route node ID (format: `<filePath>::<routeName>`). */
17
+ routeId: string;
18
+
19
+ /** Route handler function symbol ID. */
20
+ handlerId: string;
21
+
22
+ /** Human-readable handler name. */
23
+ handlerName: string;
24
+
25
+ /** File path of the handler (relative to project root). */
26
+ handlerFile: string;
27
+
28
+ /** Source language (typescript, python, etc.). */
29
+ language: string;
30
+
31
+ /** Route metadata from metaJson (method, path, etc.). */
32
+ routeMeta: {
33
+ /** HTTP method (GET, POST, PUT, DELETE, PATCH). */
34
+ method?: string;
35
+
36
+ /** Route path pattern (e.g., `/api/v1/tasks`). */
37
+ path?: string;
38
+
39
+ /** Additional metadata fields. */
40
+ [key: string]: unknown;
41
+ };
42
+
43
+ /** Symbols/modules fetched by this handler (external dependencies). */
44
+ fetchedDeps: Array<{
45
+ /** Dependency target symbol or module name. */
46
+ target: string;
47
+
48
+ /** Relation type (fetches, imports, calls). */
49
+ relationType: string;
50
+
51
+ /** Confidence score [0..1]. */
52
+ confidence: number;
53
+ }>;
54
+
55
+ /** Count of downstream callers of this handler. */
56
+ callerCount: number;
57
+ }
58
+
59
+ /**
60
+ * Result of `route-map` command — all routes with handlers and deps.
61
+ */
62
+ export interface RouteMapResult {
63
+ /** Project ID the routes belong to. */
64
+ projectId: string;
65
+
66
+ /** All routes with their handlers and dependencies. */
67
+ routes: RouteMapEntry[];
68
+
69
+ /** Count of route nodes analyzed. */
70
+ routeCount: number;
71
+
72
+ /** Count of handler functions found. */
73
+ handlerCount: number;
74
+
75
+ /** External dependencies (distinct modules/specs fetched). */
76
+ distinctDeps: string[];
77
+ }
78
+
79
+ /**
80
+ * Shape compatibility verdict from `shape-check`.
81
+ */
82
+ export type ShapeCheckStatus = 'compatible' | 'incompatible' | 'partial' | 'unknown';
83
+
84
+ /**
85
+ * A single caller of a route handler and its expected response shape.
86
+ */
87
+ export interface ShapeCheckCaller {
88
+ /** Caller symbol ID. */
89
+ callerId: string;
90
+
91
+ /** Caller name. */
92
+ callerName: string;
93
+
94
+ /** File path of the caller. */
95
+ callerFile: string;
96
+
97
+ /** Inferred expected response shape (from return type or usage). */
98
+ expectedShape: string;
99
+
100
+ /** Compatibility status versus the route's declared shape. */
101
+ status: ShapeCheckStatus;
102
+
103
+ /** Human-readable diagnosis. */
104
+ diagnosis: string;
105
+ }
106
+
107
+ /**
108
+ * Result of `shape-check` command — route's shape vs all callers.
109
+ */
110
+ export interface ShapeCheckResult {
111
+ /** Route symbol ID being checked. */
112
+ routeId: string;
113
+
114
+ /** Route handler symbol ID. */
115
+ handlerId: string;
116
+
117
+ /** Declared response shape from meta_json or return type. */
118
+ declaredShape: string;
119
+
120
+ /** All callers and their expected shapes. */
121
+ callers: ShapeCheckCaller[];
122
+
123
+ /** Count of compatible callers. */
124
+ compatibleCount: number;
125
+
126
+ /** Count of incompatible callers. */
127
+ incompatibleCount: number;
128
+
129
+ /** Overall compatibility status. */
130
+ overallStatus: ShapeCheckStatus;
131
+
132
+ /** Recommendation. */
133
+ recommendation: string;
134
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Types for TASKS → NEXUS bridge operations.
3
+ *
4
+ * Enables querying which tasks touched which symbols (T1067).
5
+ * Supports forward lookup (task → symbols) and reverse lookup (symbol → tasks).
6
+ *
7
+ * @task T1067
8
+ * @epic T1042
9
+ */
10
+
11
+ /**
12
+ * A single task reference in a symbol context.
13
+ * Used by getTasksForSymbol() reverse-lookup queries.
14
+ */
15
+ export interface TaskReference {
16
+ /** Task ID (e.g., 'T001'). */
17
+ taskId: string;
18
+ /** Display label for the task. */
19
+ label: string;
20
+ /** Edge weight (confidence) that this task touched the symbol. */
21
+ weight: number;
22
+ /** Human-readable match strategy used ('git-log-file', 'file-symbol-match', etc.). */
23
+ matchStrategy: string;
24
+ }
25
+
26
+ /**
27
+ * A single symbol reference in a task context.
28
+ * Used by getSymbolsForTask() forward-lookup queries.
29
+ */
30
+ export interface SymbolReference {
31
+ /** Nexus node ID (format: '<filePath>::<name>' or '<filePath>'). */
32
+ nexusNodeId: string;
33
+ /** Display label for the symbol (file path or function name). */
34
+ label: string;
35
+ /** Symbol kind ('function', 'class', 'file', etc.). */
36
+ kind: string;
37
+ /** File path where this symbol is defined. */
38
+ filePath: string | null;
39
+ /** Edge weight (confidence) that the task touched this symbol. */
40
+ weight: number;
41
+ /** Human-readable match strategy used ('git-log-file', 'file-symbol-match', etc.). */
42
+ matchStrategy: string;
43
+ }
44
+
45
+ /**
46
+ * Result from linkTaskToSymbols() operation.
47
+ */
48
+ export interface LinkTaskResult {
49
+ /** Number of task_touches_symbol edges created or found. */
50
+ linked: number;
51
+ /** Task ID that was linked. */
52
+ taskId: string;
53
+ /** Number of files processed from task.files_json. */
54
+ filesProcessed: number;
55
+ /** Number of symbols found in those files. */
56
+ symbolsFound: number;
57
+ }
58
+
59
+ /**
60
+ * Result from runGitLogTaskLinker() git-log sweep operation.
61
+ */
62
+ export interface GitLogLinkerResult {
63
+ /** Total number of task_touches_symbol edges created or found across all tasks. */
64
+ linked: number;
65
+ /** Commits processed from git log since --since. */
66
+ commitsProcessed: number;
67
+ /** Unique task IDs extracted from commit messages. */
68
+ tasksFound: number;
69
+ /** Last commit hash processed (stored for idempotency). */
70
+ lastCommitHash: string | null;
71
+ }