hadara 0.3.2 → 0.3.3-rc.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 (51) hide show
  1. package/README.md +38 -23
  2. package/dist/cli/context.js +110 -0
  3. package/dist/cli/help.js +6 -7
  4. package/dist/cli/init.js +56 -58
  5. package/dist/cli/main.js +12 -0
  6. package/dist/cli/session.js +37 -0
  7. package/dist/cli/task.js +52 -0
  8. package/dist/context/code-graph-extractor.js +123 -0
  9. package/dist/context/code-index.js +1154 -0
  10. package/dist/context/context-cache-store.js +925 -0
  11. package/dist/context/context-graph-builder.js +341 -0
  12. package/dist/context/context-graph.js +42 -0
  13. package/dist/context/context-pack.js +457 -0
  14. package/dist/context/context-slice-boundary.js +37 -0
  15. package/dist/context/context-slice.js +487 -0
  16. package/dist/context/document-extractors.js +343 -0
  17. package/dist/context/evidence-extractors.js +179 -0
  18. package/dist/context/extractor-contract.js +166 -0
  19. package/dist/context/registry-extractors.js +177 -0
  20. package/dist/context/release-extractors.js +175 -0
  21. package/dist/context/session-start.js +297 -0
  22. package/dist/context/source-manifest.js +566 -0
  23. package/dist/context/state-projection.js +196 -0
  24. package/dist/context/task-extractors.js +168 -0
  25. package/dist/core/schema.js +26 -0
  26. package/dist/harness/validate.js +7 -8
  27. package/dist/schemas/code-index.schema.json +173 -0
  28. package/dist/schemas/context-cache-record.schema.json +56 -0
  29. package/dist/schemas/context-cache-status.schema.json +167 -0
  30. package/dist/schemas/context-cache-warm.schema.json +222 -0
  31. package/dist/schemas/context-graph.schema.json +286 -0
  32. package/dist/schemas/context-pack.schema.json +246 -0
  33. package/dist/schemas/context-slice.schema.json +94 -0
  34. package/dist/schemas/context-source-manifest.schema.json +147 -0
  35. package/dist/schemas/schema-index.json +91 -0
  36. package/dist/schemas/session-start.schema.json +158 -0
  37. package/dist/schemas/task-close-repair-plan.schema.json +67 -0
  38. package/dist/schemas/task-context.schema.json +125 -0
  39. package/dist/schemas/task-finalize.schema.json +98 -0
  40. package/dist/schemas/task-lifecycle.schema.json +84 -0
  41. package/dist/services/capability-registry.js +266 -9
  42. package/dist/services/lifecycle-guide.js +23 -29
  43. package/dist/services/protocol-consistency.js +6 -8
  44. package/dist/task/acceptance.js +171 -0
  45. package/dist/task/task-close-repair-plan.js +190 -0
  46. package/dist/task/task-close.js +34 -35
  47. package/dist/task/task-finalize.js +377 -0
  48. package/dist/task/task-lifecycle.js +210 -0
  49. package/dist/task/task-next.js +10 -1
  50. package/dist/task/task-ready.js +4 -0
  51. package/package.json +1 -1
@@ -0,0 +1,286 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.contextGraph.v1",
4
+ "x-hadara-schema-id": "hadara.contextGraph.v1",
5
+ "title": "HADARA Context Graph Report",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "command",
11
+ "ok",
12
+ "generatedAt",
13
+ "projectRoot",
14
+ "sourceHash",
15
+ "mode",
16
+ "nodes",
17
+ "edges",
18
+ "stateProjection",
19
+ "summary",
20
+ "issues"
21
+ ],
22
+ "properties": {
23
+ "schemaVersion": { "const": "hadara.contextGraph.v1" },
24
+ "command": { "const": "context.graph" },
25
+ "ok": { "type": "boolean" },
26
+ "generatedAt": { "type": "string" },
27
+ "projectRoot": { "type": "string" },
28
+ "sourceHash": { "type": "string", "minLength": 1 },
29
+ "mode": { "enum": ["full", "task"] },
30
+ "taskId": { "type": "string" },
31
+ "nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } },
32
+ "edges": { "type": "array", "items": { "$ref": "#/$defs/edge" } },
33
+ "taskContext": { "$ref": "#/$defs/taskContext" },
34
+ "stateProjection": { "$ref": "#/$defs/stateProjection" },
35
+ "summary": {
36
+ "type": "object",
37
+ "additionalProperties": true,
38
+ "required": ["nodeCounts", "edgeCounts", "sourcesRead", "degraded"],
39
+ "properties": {
40
+ "nodeCounts": { "type": "object" },
41
+ "edgeCounts": { "type": "object" },
42
+ "sourcesRead": { "type": "number" },
43
+ "degraded": { "type": "boolean" }
44
+ }
45
+ },
46
+ "cache": {
47
+ "type": "object",
48
+ "additionalProperties": true,
49
+ "required": ["used", "hit"],
50
+ "properties": {
51
+ "used": { "type": "boolean" },
52
+ "hit": { "type": "boolean" },
53
+ "manifestHash": { "type": "string" },
54
+ "createdAt": { "type": "string" },
55
+ "cachePath": { "type": "string" },
56
+ "mode": { "type": "string" },
57
+ "readShardCount": { "type": "number" },
58
+ "hitShardCount": { "type": "number" },
59
+ "missShardCount": { "type": "number" },
60
+ "staleShardCount": { "type": "number" },
61
+ "corruptShardCount": { "type": "number" },
62
+ "schemaMismatchShardCount": { "type": "number" },
63
+ "shardPaths": {
64
+ "type": "array",
65
+ "items": { "type": "string" }
66
+ },
67
+ "staleExtractorKeys": {
68
+ "type": "array",
69
+ "items": { "type": "string" }
70
+ }
71
+ }
72
+ },
73
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/graphIssue" } }
74
+ },
75
+ "$defs": {
76
+ "confidence": { "enum": ["explicit", "derived", "heuristic"] },
77
+ "nodeType": {
78
+ "enum": [
79
+ "Task",
80
+ "Document",
81
+ "ManagedSection",
82
+ "Evidence",
83
+ "Command",
84
+ "ReleaseCheck",
85
+ "Decision",
86
+ "KnownProblem",
87
+ "SourceFile",
88
+ "TestFile",
89
+ "FixtureFile",
90
+ "ConfigFile",
91
+ "Symbol"
92
+ ]
93
+ },
94
+ "edgeType": {
95
+ "enum": [
96
+ "HAS_EVIDENCE",
97
+ "CLOSES_WITH",
98
+ "REFERENCES_DOC",
99
+ "REQUIRED_FOR",
100
+ "SUPERSEDES",
101
+ "DESCRIBES_COMMAND",
102
+ "BELONGS_TO_DOCUMENT",
103
+ "CHECKS_COMMAND",
104
+ "AFFECTS_SURFACE",
105
+ "DEPENDS_ON_EVIDENCE",
106
+ "HAS_DECISION",
107
+ "HAS_KNOWN_PROBLEM",
108
+ "IMPORTS",
109
+ "EXPORTS",
110
+ "DEFINES_SYMBOL",
111
+ "TESTS_FILE",
112
+ "IMPLEMENTS_COMMAND",
113
+ "REFERENCED_BY_DOC",
114
+ "VALIDATED_BY_EVIDENCE"
115
+ ]
116
+ },
117
+ "source": {
118
+ "type": "object",
119
+ "additionalProperties": true,
120
+ "required": ["path", "extractor"],
121
+ "properties": {
122
+ "path": { "type": "string", "minLength": 1 },
123
+ "line": { "type": "number" },
124
+ "hash": { "type": "string" },
125
+ "extractor": { "type": "string", "minLength": 1 }
126
+ }
127
+ },
128
+ "node": {
129
+ "type": "object",
130
+ "additionalProperties": true,
131
+ "required": ["id", "type", "label", "source"],
132
+ "properties": {
133
+ "id": { "type": "string", "minLength": 1 },
134
+ "type": { "$ref": "#/$defs/nodeType" },
135
+ "label": { "type": "string", "minLength": 1 },
136
+ "path": { "type": "string" },
137
+ "status": { "type": "string" },
138
+ "kind": { "type": "string" },
139
+ "owner": { "type": "string" },
140
+ "metadata": { "type": "object" },
141
+ "source": { "$ref": "#/$defs/source" }
142
+ }
143
+ },
144
+ "edge": {
145
+ "type": "object",
146
+ "additionalProperties": true,
147
+ "required": ["id", "from", "to", "type", "confidence", "reason", "source"],
148
+ "properties": {
149
+ "id": { "type": "string", "minLength": 1 },
150
+ "from": { "type": "string", "minLength": 1 },
151
+ "to": { "type": "string", "minLength": 1 },
152
+ "type": { "$ref": "#/$defs/edgeType" },
153
+ "confidence": { "$ref": "#/$defs/confidence" },
154
+ "reason": { "type": "string", "minLength": 1 },
155
+ "source": { "$ref": "#/$defs/source" }
156
+ }
157
+ },
158
+ "candidate": {
159
+ "type": "object",
160
+ "additionalProperties": true,
161
+ "required": ["id", "type", "reason", "confidence"],
162
+ "properties": {
163
+ "id": { "type": "string", "minLength": 1 },
164
+ "type": { "$ref": "#/$defs/nodeType" },
165
+ "path": { "type": "string" },
166
+ "reason": { "type": "string", "minLength": 1 },
167
+ "confidence": { "$ref": "#/$defs/confidence" },
168
+ "sourceHash": { "type": "string" }
169
+ }
170
+ },
171
+ "taskContext": {
172
+ "type": "object",
173
+ "additionalProperties": true,
174
+ "required": [
175
+ "schemaVersion",
176
+ "taskId",
177
+ "readFirst",
178
+ "readIfNeeded",
179
+ "doNotReadByDefault",
180
+ "relatedEvidence",
181
+ "relatedCommands",
182
+ "knownProblems",
183
+ "validationSuggestions",
184
+ "stateIssues",
185
+ "issues"
186
+ ],
187
+ "properties": {
188
+ "schemaVersion": { "const": "hadara.taskContext.v1" },
189
+ "taskId": { "type": "string", "minLength": 1 },
190
+ "task": { "$ref": "#/$defs/node" },
191
+ "readFirst": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
192
+ "readIfNeeded": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
193
+ "doNotReadByDefault": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
194
+ "relatedEvidence": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
195
+ "relatedCommands": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
196
+ "knownProblems": { "type": "array", "items": { "$ref": "#/$defs/candidate" } },
197
+ "validationSuggestions": { "type": "array", "items": { "type": "string" } },
198
+ "stateIssues": { "type": "array", "items": { "$ref": "#/$defs/stateIssue" } },
199
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/graphIssue" } }
200
+ }
201
+ },
202
+ "stateProjection": {
203
+ "type": "object",
204
+ "additionalProperties": true,
205
+ "required": ["schemaVersion", "command", "ok", "generatedAt", "summary", "sources", "issues"],
206
+ "properties": {
207
+ "schemaVersion": { "const": "hadara.stateProjection.v1" },
208
+ "command": { "const": "state.projection" },
209
+ "ok": { "type": "boolean" },
210
+ "generatedAt": { "type": "string" },
211
+ "summary": {
212
+ "type": "object",
213
+ "additionalProperties": true,
214
+ "required": ["stateConsistency"],
215
+ "properties": {
216
+ "latestCompletedTask": { "type": "string" },
217
+ "activeTask": { "type": "string" },
218
+ "latestClosedTask": { "type": "string" },
219
+ "releaseState": { "type": "string" },
220
+ "stateConsistency": { "enum": ["consistent", "warning", "error", "unknown"] }
221
+ }
222
+ },
223
+ "sources": { "type": "array", "items": { "$ref": "#/$defs/stateSource" } },
224
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/stateIssue" } }
225
+ }
226
+ },
227
+ "stateSource": {
228
+ "type": "object",
229
+ "additionalProperties": true,
230
+ "required": ["id", "path", "kind", "extracted"],
231
+ "properties": {
232
+ "id": { "type": "string", "minLength": 1 },
233
+ "path": { "type": "string", "minLength": 1 },
234
+ "kind": {
235
+ "enum": ["task-board", "task-capsule", "project-state", "agent-handoff", "docs-registry", "release-readiness", "evidence", "code-index"]
236
+ },
237
+ "hash": { "type": "string" },
238
+ "extracted": { "type": "object" }
239
+ }
240
+ },
241
+ "stateIssue": {
242
+ "type": "object",
243
+ "additionalProperties": true,
244
+ "required": ["severity", "code", "message", "paths"],
245
+ "properties": {
246
+ "severity": { "enum": ["info", "warning", "error"] },
247
+ "code": {
248
+ "enum": [
249
+ "STATE_LATEST_TASK_MISMATCH",
250
+ "STATE_ACTIVE_TASK_MISMATCH",
251
+ "STATE_TASK_BOARD_MISSING_ROW",
252
+ "STATE_TASK_CAPSULE_MISSING",
253
+ "STATE_CLOSE_PROOF_STALE",
254
+ "STATE_RELEASE_EVIDENCE_STALE",
255
+ "STATE_DOC_REQUIRED_READING_DRIFT",
256
+ "STATE_UNKNOWN"
257
+ ]
258
+ },
259
+ "message": { "type": "string", "minLength": 1 },
260
+ "paths": { "type": "array", "items": { "type": "string" } },
261
+ "fixHint": { "type": "string" }
262
+ }
263
+ },
264
+ "graphIssue": {
265
+ "type": "object",
266
+ "additionalProperties": true,
267
+ "required": ["severity", "code", "message"],
268
+ "properties": {
269
+ "severity": { "enum": ["info", "warning", "error"] },
270
+ "code": {
271
+ "enum": [
272
+ "CONTEXT_GRAPH_SOURCE_MISSING",
273
+ "CONTEXT_GRAPH_PARSE_FAILED",
274
+ "CONTEXT_GRAPH_DOC_REGISTRY_MISSING",
275
+ "CONTEXT_GRAPH_COMMAND_REGISTRY_MISSING",
276
+ "CONTEXT_GRAPH_EVIDENCE_READ_FAILED",
277
+ "CONTEXT_GRAPH_DEGRADED"
278
+ ]
279
+ },
280
+ "message": { "type": "string", "minLength": 1 },
281
+ "path": { "type": "string" },
282
+ "fixHint": { "type": "string" }
283
+ }
284
+ }
285
+ }
286
+ }
@@ -0,0 +1,246 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.contextPack.v1",
4
+ "x-hadara-schema-id": "hadara.contextPack.v1",
5
+ "title": "HADARA Context Pack Report",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "command",
11
+ "ok",
12
+ "generatedAt",
13
+ "projectRoot",
14
+ "budget",
15
+ "readFirst",
16
+ "readIfNeeded",
17
+ "doNotReadByDefault",
18
+ "validateWith",
19
+ "writeBoundaries",
20
+ "sliceCandidates",
21
+ "knownProblems",
22
+ "stateProjection",
23
+ "sourceSummary",
24
+ "cache",
25
+ "issues"
26
+ ],
27
+ "properties": {
28
+ "schemaVersion": { "const": "hadara.contextPack.v1" },
29
+ "command": { "const": "context.pack" },
30
+ "ok": { "type": "boolean" },
31
+ "generatedAt": { "type": "string" },
32
+ "taskId": { "type": "string" },
33
+ "projectRoot": { "type": "string" },
34
+ "budget": { "$ref": "#/$defs/budget" },
35
+ "readFirst": { "type": "array", "items": { "$ref": "#/$defs/item" } },
36
+ "readIfNeeded": { "type": "array", "items": { "$ref": "#/$defs/item" } },
37
+ "doNotReadByDefault": { "type": "array", "items": { "$ref": "#/$defs/item" } },
38
+ "validateWith": { "type": "array", "items": { "$ref": "#/$defs/validationSuggestion" } },
39
+ "writeBoundaries": { "type": "array", "items": { "$ref": "#/$defs/writeBoundary" } },
40
+ "sliceCandidates": { "type": "array", "items": { "$ref": "#/$defs/sliceCandidate" } },
41
+ "knownProblems": { "type": "array", "items": { "$ref": "#/$defs/item" } },
42
+ "stateProjection": { "$ref": "#/$defs/stateProjection" },
43
+ "sourceSummary": { "$ref": "#/$defs/sourceSummary" },
44
+ "cache": { "$ref": "#/$defs/cache" },
45
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/issue" } }
46
+ },
47
+ "$defs": {
48
+ "confidence": { "enum": ["explicit", "derived", "heuristic"] },
49
+ "itemType": {
50
+ "enum": [
51
+ "Task",
52
+ "Document",
53
+ "ManagedSection",
54
+ "Evidence",
55
+ "Command",
56
+ "ReleaseCheck",
57
+ "Decision",
58
+ "KnownProblem",
59
+ "SourceFile",
60
+ "TestFile",
61
+ "FixtureFile",
62
+ "ConfigFile",
63
+ "Symbol"
64
+ ]
65
+ },
66
+ "budget": {
67
+ "type": "object",
68
+ "additionalProperties": true,
69
+ "required": ["maxReadFirstItems", "mode"],
70
+ "properties": {
71
+ "targetTokens": { "type": "number" },
72
+ "maxItems": { "type": "number" },
73
+ "maxReadFirstItems": { "type": "number" },
74
+ "mode": { "enum": ["minimal", "bounded", "expanded"] }
75
+ }
76
+ },
77
+ "item": {
78
+ "type": "object",
79
+ "additionalProperties": true,
80
+ "required": ["id", "type", "reason", "confidence", "required"],
81
+ "properties": {
82
+ "id": { "type": "string", "minLength": 1 },
83
+ "type": { "$ref": "#/$defs/itemType" },
84
+ "path": { "type": "string" },
85
+ "lineStart": { "type": "number" },
86
+ "lineEnd": { "type": "number" },
87
+ "title": { "type": "string" },
88
+ "reason": { "type": "string", "minLength": 1 },
89
+ "confidence": { "$ref": "#/$defs/confidence" },
90
+ "sourceHash": {
91
+ "type": "string",
92
+ "description": "Hash of the raw-sliceable item file text when available, otherwise the graph node source hash."
93
+ },
94
+ "estimatedTokens": { "type": "number" },
95
+ "required": { "type": "boolean" },
96
+ "sourceAccess": { "$ref": "#/$defs/sourceAccess" }
97
+ }
98
+ },
99
+ "sourceAccess": {
100
+ "type": "object",
101
+ "additionalProperties": true,
102
+ "required": ["rawSlice", "reason"],
103
+ "properties": {
104
+ "rawSlice": { "enum": ["sliceable", "not-sliceable", "not-applicable"] },
105
+ "reason": { "type": "string", "minLength": 1 }
106
+ }
107
+ },
108
+ "validationSuggestion": {
109
+ "type": "object",
110
+ "additionalProperties": true,
111
+ "required": ["command", "reason", "requiredForClose", "source"],
112
+ "properties": {
113
+ "command": { "type": "string", "minLength": 1 },
114
+ "reason": { "type": "string", "minLength": 1 },
115
+ "requiredForClose": { "type": "boolean" },
116
+ "source": { "enum": ["task-tests", "command-registry", "evidence-history", "release-readiness", "heuristic"] }
117
+ }
118
+ },
119
+ "writeBoundary": {
120
+ "type": "object",
121
+ "additionalProperties": true,
122
+ "required": ["path", "boundary", "reason"],
123
+ "properties": {
124
+ "path": { "type": "string", "minLength": 1 },
125
+ "boundary": {
126
+ "enum": ["read-only", "agent-freeform", "managed-section", "append-only", "dry-run-first", "release-mutation"]
127
+ },
128
+ "reason": { "type": "string", "minLength": 1 }
129
+ }
130
+ },
131
+ "sliceCandidate": {
132
+ "type": "object",
133
+ "additionalProperties": true,
134
+ "required": ["id", "path", "strategy", "reason", "suggestedCommand", "suggestedCommandArgs"],
135
+ "properties": {
136
+ "id": { "type": "string", "minLength": 1 },
137
+ "path": { "type": "string", "minLength": 1 },
138
+ "strategy": {
139
+ "enum": ["explicit-range", "symbol-neighborhood", "keyword-window", "tail-window", "diff-hunk", "managed-section"]
140
+ },
141
+ "lineStart": { "type": "number" },
142
+ "lineEnd": { "type": "number" },
143
+ "symbol": { "type": "string" },
144
+ "managedSection": { "type": "string" },
145
+ "reason": { "type": "string", "minLength": 1 },
146
+ "suggestedCommand": { "type": "string", "minLength": 1 },
147
+ "suggestedCommandArgs": {
148
+ "type": "array",
149
+ "minItems": 1,
150
+ "items": { "type": "string", "minLength": 1 }
151
+ }
152
+ }
153
+ },
154
+ "stateProjection": {
155
+ "type": "object",
156
+ "additionalProperties": true,
157
+ "required": ["stateConsistency", "issues"],
158
+ "properties": {
159
+ "latestCompletedTask": { "type": "string" },
160
+ "activeTask": { "type": "string" },
161
+ "latestClosedTask": { "type": "string" },
162
+ "releaseState": { "type": "string" },
163
+ "stateConsistency": { "enum": ["consistent", "warning", "error", "unknown"] },
164
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/stateIssue" } }
165
+ }
166
+ },
167
+ "sourceSummary": {
168
+ "type": "object",
169
+ "additionalProperties": true,
170
+ "required": [
171
+ "graphAvailable",
172
+ "codeIndexAvailable",
173
+ "stateProjectionAvailable",
174
+ "docsRegistryAvailable",
175
+ "commandRegistryAvailable",
176
+ "degraded"
177
+ ],
178
+ "properties": {
179
+ "graphAvailable": { "type": "boolean" },
180
+ "codeIndexAvailable": { "type": "boolean" },
181
+ "stateProjectionAvailable": { "type": "boolean" },
182
+ "docsRegistryAvailable": { "type": "boolean" },
183
+ "commandRegistryAvailable": { "type": "boolean" },
184
+ "degraded": { "type": "boolean" },
185
+ "graphSourceHash": { "type": "string" },
186
+ "sourcesRead": { "type": "number" }
187
+ }
188
+ },
189
+ "cache": {
190
+ "type": "object",
191
+ "additionalProperties": true,
192
+ "required": ["used", "hit"],
193
+ "properties": {
194
+ "used": { "type": "boolean" },
195
+ "hit": { "type": "boolean" },
196
+ "manifestHash": { "type": "string" },
197
+ "createdAt": { "type": "string" },
198
+ "cachePath": { "type": "string" }
199
+ }
200
+ },
201
+ "stateIssue": {
202
+ "type": "object",
203
+ "additionalProperties": true,
204
+ "required": ["severity", "code", "message", "paths"],
205
+ "properties": {
206
+ "severity": { "enum": ["info", "warning", "error"] },
207
+ "code": {
208
+ "enum": [
209
+ "STATE_LATEST_TASK_MISMATCH",
210
+ "STATE_ACTIVE_TASK_MISMATCH",
211
+ "STATE_TASK_BOARD_MISSING_ROW",
212
+ "STATE_TASK_CAPSULE_MISSING",
213
+ "STATE_CLOSE_PROOF_STALE",
214
+ "STATE_RELEASE_EVIDENCE_STALE",
215
+ "STATE_DOC_REQUIRED_READING_DRIFT",
216
+ "STATE_UNKNOWN"
217
+ ]
218
+ },
219
+ "message": { "type": "string", "minLength": 1 },
220
+ "paths": { "type": "array", "items": { "type": "string" } },
221
+ "fixHint": { "type": "string" }
222
+ }
223
+ },
224
+ "issue": {
225
+ "type": "object",
226
+ "additionalProperties": true,
227
+ "required": ["severity", "code", "message"],
228
+ "properties": {
229
+ "severity": { "enum": ["info", "warning", "error"] },
230
+ "code": {
231
+ "enum": [
232
+ "CONTEXT_PACK_TASK_NOT_FOUND",
233
+ "CONTEXT_PACK_GRAPH_UNAVAILABLE",
234
+ "CONTEXT_PACK_CODE_INDEX_UNAVAILABLE",
235
+ "CONTEXT_PACK_STATE_PROJECTION_UNAVAILABLE",
236
+ "CONTEXT_PACK_BUDGET_TRUNCATED",
237
+ "CONTEXT_PACK_DEGRADED"
238
+ ]
239
+ },
240
+ "message": { "type": "string", "minLength": 1 },
241
+ "path": { "type": "string" },
242
+ "fixHint": { "type": "string" }
243
+ }
244
+ }
245
+ }
246
+ }
@@ -0,0 +1,94 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.contextSlice.v1",
4
+ "x-hadara-schema-id": "hadara.contextSlice.v1",
5
+ "title": "HADARA Context Slice Report",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "command",
11
+ "ok",
12
+ "generatedAt",
13
+ "projectRoot",
14
+ "path",
15
+ "sourceHash",
16
+ "lineCount",
17
+ "strategy",
18
+ "slices",
19
+ "summary",
20
+ "issues"
21
+ ],
22
+ "properties": {
23
+ "schemaVersion": { "const": "hadara.contextSlice.v1" },
24
+ "command": { "const": "context.slice" },
25
+ "ok": { "type": "boolean" },
26
+ "generatedAt": { "type": "string" },
27
+ "projectRoot": { "type": "string" },
28
+ "path": { "type": "string" },
29
+ "sourceHash": { "type": "string" },
30
+ "lineCount": { "type": "number" },
31
+ "strategy": { "$ref": "#/$defs/strategy" },
32
+ "slices": { "type": "array", "items": { "$ref": "#/$defs/slice" } },
33
+ "summary": { "$ref": "#/$defs/summary" },
34
+ "issues": { "type": "array", "items": { "$ref": "#/$defs/issue" } }
35
+ },
36
+ "$defs": {
37
+ "strategy": {
38
+ "enum": ["explicit-range", "symbol-neighborhood", "keyword-window", "tail-window", "diff-hunk", "managed-section", "context-candidate"]
39
+ },
40
+ "slice": {
41
+ "type": "object",
42
+ "additionalProperties": true,
43
+ "required": ["id", "path", "strategy", "startLine", "endLine", "text", "sourceHash", "reason", "confidence"],
44
+ "properties": {
45
+ "id": { "type": "string", "minLength": 1 },
46
+ "path": { "type": "string", "minLength": 1 },
47
+ "strategy": { "$ref": "#/$defs/strategy" },
48
+ "startLine": { "type": "number" },
49
+ "endLine": { "type": "number" },
50
+ "text": { "type": "string" },
51
+ "sourceHash": { "type": "string", "minLength": 1 },
52
+ "reason": { "type": "string", "minLength": 1 },
53
+ "confidence": { "enum": ["explicit", "derived", "heuristic"] }
54
+ }
55
+ },
56
+ "summary": {
57
+ "type": "object",
58
+ "additionalProperties": true,
59
+ "required": ["sliceCount", "totalLines", "totalBytes", "truncated"],
60
+ "properties": {
61
+ "sliceCount": { "type": "number" },
62
+ "totalLines": { "type": "number" },
63
+ "totalBytes": { "type": "number" },
64
+ "truncated": { "type": "boolean" }
65
+ }
66
+ },
67
+ "issue": {
68
+ "type": "object",
69
+ "additionalProperties": true,
70
+ "required": ["severity", "code", "message"],
71
+ "properties": {
72
+ "severity": { "enum": ["info", "warning", "error"] },
73
+ "code": {
74
+ "enum": [
75
+ "CONTEXT_SLICE_FILE_NOT_FOUND",
76
+ "CONTEXT_SLICE_OUTSIDE_PROJECT",
77
+ "CONTEXT_SLICE_BINARY_FILE",
78
+ "CONTEXT_SLICE_RANGE_INVALID",
79
+ "CONTEXT_SLICE_RANGE_CLAMPED",
80
+ "CONTEXT_SLICE_SYMBOL_NOT_FOUND",
81
+ "CONTEXT_SLICE_KEYWORD_NOT_FOUND",
82
+ "CONTEXT_SLICE_CANDIDATE_NOT_FOUND",
83
+ "CONTEXT_SLICE_TOO_LARGE",
84
+ "CONTEXT_SLICE_UNSUPPORTED_STRATEGY",
85
+ "CONTEXT_SLICE_DEGRADED"
86
+ ]
87
+ },
88
+ "message": { "type": "string", "minLength": 1 },
89
+ "path": { "type": "string" },
90
+ "fixHint": { "type": "string" }
91
+ }
92
+ }
93
+ }
94
+ }