hadara 0.3.2 → 0.3.3

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 (52) hide show
  1. package/README.md +49 -34
  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 +209 -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/services/workbench-next-actions.js +2 -0
  45. package/dist/task/acceptance.js +171 -0
  46. package/dist/task/task-close-repair-plan.js +190 -0
  47. package/dist/task/task-close.js +34 -35
  48. package/dist/task/task-finalize.js +377 -0
  49. package/dist/task/task-lifecycle.js +210 -0
  50. package/dist/task/task-next.js +10 -1
  51. package/dist/task/task-ready.js +4 -0
  52. package/package.json +1 -1
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.context.cacheRecord.v1",
4
+ "x-hadara-schema-id": "hadara.context.cacheRecord.v1",
5
+ "title": "HADARA Context Cache Record",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "cacheRecordVersion",
11
+ "cacheKey",
12
+ "projection",
13
+ "projectionSchemaVersion",
14
+ "createdAt",
15
+ "manifestHash",
16
+ "sourceSubsetHash",
17
+ "extractorVersions",
18
+ "degraded",
19
+ "issues",
20
+ "payload"
21
+ ],
22
+ "properties": {
23
+ "schemaVersion": { "const": "hadara.context.cacheRecord.v1" },
24
+ "cacheRecordVersion": { "type": "string" },
25
+ "cacheKey": { "type": "string", "minLength": 1 },
26
+ "projection": { "type": "string", "minLength": 1 },
27
+ "projectionSchemaVersion": { "type": "string", "minLength": 1 },
28
+ "createdAt": { "type": "string" },
29
+ "manifestHash": { "type": "string", "minLength": 1 },
30
+ "sourceSubsetHash": { "type": "string", "minLength": 1 },
31
+ "extractorVersions": {
32
+ "type": "object",
33
+ "additionalProperties": { "type": "string" }
34
+ },
35
+ "degraded": { "type": "boolean" },
36
+ "issues": {
37
+ "type": "array",
38
+ "items": { "$ref": "#/$defs/issue" }
39
+ },
40
+ "payload": {}
41
+ },
42
+ "$defs": {
43
+ "issue": {
44
+ "type": "object",
45
+ "additionalProperties": true,
46
+ "required": ["severity", "code", "message"],
47
+ "properties": {
48
+ "severity": { "enum": ["info", "warning", "error"] },
49
+ "code": { "type": "string" },
50
+ "message": { "type": "string" },
51
+ "path": { "type": "string" },
52
+ "fixHint": { "type": "string" }
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,167 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.context.cacheStatus.v1",
4
+ "x-hadara-schema-id": "hadara.context.cacheStatus.v1",
5
+ "title": "HADARA Context Cache Status",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "command",
11
+ "ok",
12
+ "generatedAt",
13
+ "projectRoot",
14
+ "cacheRoot",
15
+ "readOnly",
16
+ "summary",
17
+ "manifest",
18
+ "issues"
19
+ ],
20
+ "properties": {
21
+ "schemaVersion": { "const": "hadara.context.cacheStatus.v1" },
22
+ "command": { "const": "context.cache.status" },
23
+ "ok": { "type": "boolean" },
24
+ "generatedAt": { "type": "string" },
25
+ "projectRoot": { "type": "string" },
26
+ "cacheRoot": { "type": "string" },
27
+ "readOnly": { "const": true },
28
+ "summary": { "$ref": "#/$defs/summary" },
29
+ "manifest": { "$ref": "#/$defs/manifestStatus" },
30
+ "diagnostics": { "$ref": "#/$defs/diagnostics" },
31
+ "issues": {
32
+ "type": "array",
33
+ "items": { "$ref": "#/$defs/issue" }
34
+ }
35
+ },
36
+ "$defs": {
37
+ "summary": {
38
+ "type": "object",
39
+ "additionalProperties": true,
40
+ "required": ["mode", "cachePresent", "cacheFresh", "degraded", "staleExtractorKeys"],
41
+ "properties": {
42
+ "mode": { "enum": ["miss", "hit", "stale", "corrupt"] },
43
+ "cachePresent": { "type": "boolean" },
44
+ "cacheFresh": { "type": "boolean" },
45
+ "degraded": { "type": "boolean" },
46
+ "staleExtractorKeys": {
47
+ "type": "array",
48
+ "items": { "type": "string" }
49
+ }
50
+ }
51
+ },
52
+ "manifestStatus": {
53
+ "type": "object",
54
+ "additionalProperties": true,
55
+ "required": [
56
+ "cachePath",
57
+ "status",
58
+ "currentManifestHash",
59
+ "currentSourceCount",
60
+ "currentSkippedSourceCount",
61
+ "addedPaths",
62
+ "removedPaths",
63
+ "changedPaths",
64
+ "unchangedSourceCount",
65
+ "staleExtractorKeys"
66
+ ],
67
+ "properties": {
68
+ "cachePath": { "type": "string" },
69
+ "status": { "enum": ["missing", "fresh", "stale", "corrupt", "schema-mismatch"] },
70
+ "currentManifestHash": { "type": "string" },
71
+ "currentSourceCount": { "type": "number" },
72
+ "currentSkippedSourceCount": { "type": "number" },
73
+ "cachedManifestHash": { "type": "string" },
74
+ "cachedGeneratedAt": { "type": "string" },
75
+ "cachedSourceCount": { "type": "number" },
76
+ "addedPaths": {
77
+ "type": "array",
78
+ "items": { "type": "string" }
79
+ },
80
+ "removedPaths": {
81
+ "type": "array",
82
+ "items": { "type": "string" }
83
+ },
84
+ "changedPaths": {
85
+ "type": "array",
86
+ "items": { "type": "string" }
87
+ },
88
+ "unchangedSourceCount": { "type": "number" },
89
+ "staleExtractorKeys": {
90
+ "type": "array",
91
+ "items": { "type": "string" }
92
+ }
93
+ }
94
+ },
95
+ "issue": {
96
+ "type": "object",
97
+ "additionalProperties": true,
98
+ "required": ["severity", "code", "message"],
99
+ "properties": {
100
+ "severity": { "enum": ["info", "warning", "error"] },
101
+ "code": { "type": "string" },
102
+ "message": { "type": "string" },
103
+ "path": { "type": "string" },
104
+ "fixHint": { "type": "string" }
105
+ }
106
+ },
107
+ "diagnostics": {
108
+ "type": "object",
109
+ "additionalProperties": true,
110
+ "required": ["state", "operatorSummary", "slowPath", "manifestChanges", "shardSummary"],
111
+ "properties": {
112
+ "state": { "enum": ["fresh", "missing", "stale", "corrupt", "partial"] },
113
+ "operatorSummary": { "type": "string" },
114
+ "recommendedCommand": { "type": "string" },
115
+ "recommendedCommandArgs": {
116
+ "type": "array",
117
+ "items": { "type": "string" }
118
+ },
119
+ "slowPath": {
120
+ "type": "object",
121
+ "additionalProperties": true,
122
+ "required": ["mountedWorkspace", "fullManifestBuilt", "fastPath"],
123
+ "properties": {
124
+ "mountedWorkspace": { "type": "boolean" },
125
+ "fullManifestBuilt": { "type": "boolean" },
126
+ "fastPath": { "enum": ["hit", "miss", "skipped"] },
127
+ "reason": { "type": "string" },
128
+ "strategy": { "type": "string" }
129
+ }
130
+ },
131
+ "manifestChanges": {
132
+ "type": "object",
133
+ "additionalProperties": true,
134
+ "required": ["addedPathCount", "removedPathCount", "changedPathCount", "unchangedSourceCount", "staleExtractorKeys"],
135
+ "properties": {
136
+ "addedPathCount": { "type": "number" },
137
+ "removedPathCount": { "type": "number" },
138
+ "changedPathCount": { "type": "number" },
139
+ "unchangedSourceCount": { "type": "number" },
140
+ "staleExtractorKeys": {
141
+ "type": "array",
142
+ "items": { "type": "string" }
143
+ }
144
+ }
145
+ },
146
+ "shardSummary": {
147
+ "type": "object",
148
+ "additionalProperties": true,
149
+ "required": ["total", "fresh", "missing", "stale", "corrupt", "schemaMismatch", "planned", "plannedShardKeys"],
150
+ "properties": {
151
+ "total": { "type": "number" },
152
+ "fresh": { "type": "number" },
153
+ "missing": { "type": "number" },
154
+ "stale": { "type": "number" },
155
+ "corrupt": { "type": "number" },
156
+ "schemaMismatch": { "type": "number" },
157
+ "planned": { "type": "number" },
158
+ "plannedShardKeys": {
159
+ "type": "array",
160
+ "items": { "type": "string" }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,222 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "hadara.context.cacheWarm.v1",
4
+ "x-hadara-schema-id": "hadara.context.cacheWarm.v1",
5
+ "title": "HADARA Context Cache Warm",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": [
9
+ "schemaVersion",
10
+ "command",
11
+ "ok",
12
+ "generatedAt",
13
+ "projectRoot",
14
+ "cacheRoot",
15
+ "mode",
16
+ "summary",
17
+ "manifest",
18
+ "write",
19
+ "issues"
20
+ ],
21
+ "properties": {
22
+ "schemaVersion": { "const": "hadara.context.cacheWarm.v1" },
23
+ "command": { "const": "context.cache.warm" },
24
+ "ok": { "type": "boolean" },
25
+ "generatedAt": { "type": "string" },
26
+ "projectRoot": { "type": "string" },
27
+ "cacheRoot": { "type": "string" },
28
+ "mode": { "enum": ["dry-run", "execute"] },
29
+ "summary": { "$ref": "#/$defs/summary" },
30
+ "manifest": { "$ref": "#/$defs/manifestStatus" },
31
+ "write": { "$ref": "#/$defs/write" },
32
+ "shards": { "$ref": "#/$defs/shards" },
33
+ "diagnostics": { "$ref": "#/$defs/diagnostics" },
34
+ "issues": {
35
+ "type": "array",
36
+ "items": { "$ref": "#/$defs/issue" }
37
+ }
38
+ },
39
+ "$defs": {
40
+ "summary": {
41
+ "type": "object",
42
+ "additionalProperties": true,
43
+ "required": ["cacheMode", "cachePresent", "cacheFresh", "writePlanned", "writeExecuted", "degraded", "staleExtractorKeys"],
44
+ "properties": {
45
+ "cacheMode": { "enum": ["miss", "fresh", "stale", "corrupt"] },
46
+ "cachePresent": { "type": "boolean" },
47
+ "cacheFresh": { "type": "boolean" },
48
+ "writePlanned": { "type": "boolean" },
49
+ "writeExecuted": { "type": "boolean" },
50
+ "shardWritePlanned": { "type": "boolean" },
51
+ "shardWriteExecuted": { "type": "boolean" },
52
+ "shardHitCount": { "type": "number" },
53
+ "shardMissCount": { "type": "number" },
54
+ "shardStaleCount": { "type": "number" },
55
+ "shardCorruptCount": { "type": "number" },
56
+ "shardSchemaMismatchCount": { "type": "number" },
57
+ "degraded": { "type": "boolean" },
58
+ "staleExtractorKeys": {
59
+ "type": "array",
60
+ "items": { "type": "string" }
61
+ }
62
+ }
63
+ },
64
+ "manifestStatus": {
65
+ "type": "object",
66
+ "additionalProperties": true,
67
+ "required": [
68
+ "cachePath",
69
+ "status",
70
+ "currentManifestHash",
71
+ "currentSourceCount",
72
+ "currentSkippedSourceCount",
73
+ "addedPaths",
74
+ "removedPaths",
75
+ "changedPaths",
76
+ "unchangedSourceCount",
77
+ "staleExtractorKeys"
78
+ ],
79
+ "properties": {
80
+ "cachePath": { "type": "string" },
81
+ "status": { "enum": ["missing", "fresh", "stale", "corrupt", "schema-mismatch"] },
82
+ "currentManifestHash": { "type": "string" },
83
+ "currentSourceCount": { "type": "number" },
84
+ "currentSkippedSourceCount": { "type": "number" },
85
+ "cachedManifestHash": { "type": "string" },
86
+ "cachedGeneratedAt": { "type": "string" },
87
+ "cachedSourceCount": { "type": "number" },
88
+ "addedPaths": {
89
+ "type": "array",
90
+ "items": { "type": "string" }
91
+ },
92
+ "removedPaths": {
93
+ "type": "array",
94
+ "items": { "type": "string" }
95
+ },
96
+ "changedPaths": {
97
+ "type": "array",
98
+ "items": { "type": "string" }
99
+ },
100
+ "unchangedSourceCount": { "type": "number" },
101
+ "staleExtractorKeys": {
102
+ "type": "array",
103
+ "items": { "type": "string" }
104
+ }
105
+ }
106
+ },
107
+ "write": {
108
+ "type": "object",
109
+ "additionalProperties": true,
110
+ "required": ["policy", "planned", "executed", "cachePath", "beforeStatus", "afterManifestHash"],
111
+ "properties": {
112
+ "policy": { "enum": ["dry-run", "execute"] },
113
+ "planned": { "type": "boolean" },
114
+ "executed": { "type": "boolean" },
115
+ "cachePath": { "type": "string" },
116
+ "beforeStatus": { "enum": ["missing", "valid", "corrupt", "schema-mismatch"] },
117
+ "beforeManifestHash": { "type": "string" },
118
+ "afterManifestHash": { "type": "string" },
119
+ "skippedReason": { "enum": ["cache-fresh"] }
120
+ }
121
+ },
122
+ "shards": {
123
+ "type": "object",
124
+ "additionalProperties": true,
125
+ "required": ["planned", "executed", "items"],
126
+ "properties": {
127
+ "planned": { "type": "boolean" },
128
+ "executed": { "type": "boolean" },
129
+ "items": {
130
+ "type": "array",
131
+ "items": { "$ref": "#/$defs/shardItem" }
132
+ }
133
+ }
134
+ },
135
+ "shardItem": {
136
+ "type": "object",
137
+ "additionalProperties": true,
138
+ "required": ["extractorKey", "cachePath", "beforeStatus", "planned", "executed"],
139
+ "properties": {
140
+ "extractorKey": { "type": "string" },
141
+ "cachePath": { "type": "string" },
142
+ "beforeStatus": { "enum": ["missing", "fresh", "stale", "corrupt", "schema-mismatch"] },
143
+ "planned": { "type": "boolean" },
144
+ "executed": { "type": "boolean" },
145
+ "beforeCacheKey": { "type": "string" },
146
+ "afterCacheKey": { "type": "string" },
147
+ "skippedReason": { "enum": ["cache-fresh"] }
148
+ }
149
+ },
150
+ "issue": {
151
+ "type": "object",
152
+ "additionalProperties": true,
153
+ "required": ["severity", "code", "message"],
154
+ "properties": {
155
+ "severity": { "enum": ["info", "warning", "error"] },
156
+ "code": { "type": "string" },
157
+ "message": { "type": "string" },
158
+ "path": { "type": "string" },
159
+ "fixHint": { "type": "string" }
160
+ }
161
+ },
162
+ "diagnostics": {
163
+ "type": "object",
164
+ "additionalProperties": true,
165
+ "required": ["state", "operatorSummary", "slowPath", "manifestChanges", "shardSummary"],
166
+ "properties": {
167
+ "state": { "enum": ["fresh", "missing", "stale", "corrupt", "partial"] },
168
+ "operatorSummary": { "type": "string" },
169
+ "recommendedCommand": { "type": "string" },
170
+ "recommendedCommandArgs": {
171
+ "type": "array",
172
+ "items": { "type": "string" }
173
+ },
174
+ "slowPath": {
175
+ "type": "object",
176
+ "additionalProperties": true,
177
+ "required": ["mountedWorkspace", "fullManifestBuilt", "fastPath"],
178
+ "properties": {
179
+ "mountedWorkspace": { "type": "boolean" },
180
+ "fullManifestBuilt": { "type": "boolean" },
181
+ "fastPath": { "enum": ["hit", "miss", "skipped"] },
182
+ "reason": { "type": "string" },
183
+ "strategy": { "type": "string" }
184
+ }
185
+ },
186
+ "manifestChanges": {
187
+ "type": "object",
188
+ "additionalProperties": true,
189
+ "required": ["addedPathCount", "removedPathCount", "changedPathCount", "unchangedSourceCount", "staleExtractorKeys"],
190
+ "properties": {
191
+ "addedPathCount": { "type": "number" },
192
+ "removedPathCount": { "type": "number" },
193
+ "changedPathCount": { "type": "number" },
194
+ "unchangedSourceCount": { "type": "number" },
195
+ "staleExtractorKeys": {
196
+ "type": "array",
197
+ "items": { "type": "string" }
198
+ }
199
+ }
200
+ },
201
+ "shardSummary": {
202
+ "type": "object",
203
+ "additionalProperties": true,
204
+ "required": ["total", "fresh", "missing", "stale", "corrupt", "schemaMismatch", "planned", "plannedShardKeys"],
205
+ "properties": {
206
+ "total": { "type": "number" },
207
+ "fresh": { "type": "number" },
208
+ "missing": { "type": "number" },
209
+ "stale": { "type": "number" },
210
+ "corrupt": { "type": "number" },
211
+ "schemaMismatch": { "type": "number" },
212
+ "planned": { "type": "number" },
213
+ "plannedShardKeys": {
214
+ "type": "array",
215
+ "items": { "type": "string" }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }