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.
- package/README.md +38 -23
- package/dist/cli/context.js +110 -0
- package/dist/cli/help.js +6 -7
- package/dist/cli/init.js +56 -58
- package/dist/cli/main.js +12 -0
- package/dist/cli/session.js +37 -0
- package/dist/cli/task.js +52 -0
- package/dist/context/code-graph-extractor.js +123 -0
- package/dist/context/code-index.js +1154 -0
- package/dist/context/context-cache-store.js +925 -0
- package/dist/context/context-graph-builder.js +341 -0
- package/dist/context/context-graph.js +42 -0
- package/dist/context/context-pack.js +457 -0
- package/dist/context/context-slice-boundary.js +37 -0
- package/dist/context/context-slice.js +487 -0
- package/dist/context/document-extractors.js +343 -0
- package/dist/context/evidence-extractors.js +179 -0
- package/dist/context/extractor-contract.js +166 -0
- package/dist/context/registry-extractors.js +177 -0
- package/dist/context/release-extractors.js +175 -0
- package/dist/context/session-start.js +297 -0
- package/dist/context/source-manifest.js +566 -0
- package/dist/context/state-projection.js +196 -0
- package/dist/context/task-extractors.js +168 -0
- package/dist/core/schema.js +26 -0
- package/dist/harness/validate.js +7 -8
- package/dist/schemas/code-index.schema.json +173 -0
- package/dist/schemas/context-cache-record.schema.json +56 -0
- package/dist/schemas/context-cache-status.schema.json +167 -0
- package/dist/schemas/context-cache-warm.schema.json +222 -0
- package/dist/schemas/context-graph.schema.json +286 -0
- package/dist/schemas/context-pack.schema.json +246 -0
- package/dist/schemas/context-slice.schema.json +94 -0
- package/dist/schemas/context-source-manifest.schema.json +147 -0
- package/dist/schemas/schema-index.json +91 -0
- package/dist/schemas/session-start.schema.json +158 -0
- package/dist/schemas/task-close-repair-plan.schema.json +67 -0
- package/dist/schemas/task-context.schema.json +125 -0
- package/dist/schemas/task-finalize.schema.json +98 -0
- package/dist/schemas/task-lifecycle.schema.json +84 -0
- package/dist/services/capability-registry.js +266 -9
- package/dist/services/lifecycle-guide.js +23 -29
- package/dist/services/protocol-consistency.js +6 -8
- package/dist/task/acceptance.js +171 -0
- package/dist/task/task-close-repair-plan.js +190 -0
- package/dist/task/task-close.js +34 -35
- package/dist/task/task-finalize.js +377 -0
- package/dist/task/task-lifecycle.js +210 -0
- package/dist/task/task-next.js +10 -1
- package/dist/task/task-ready.js +4 -0
- package/package.json +1 -1
package/dist/cli/task.js
CHANGED
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handleTaskCommand = handleTaskCommand;
|
|
4
4
|
exports.extractTaskCreateTitle = extractTaskCreateTitle;
|
|
5
5
|
const task_close_1 = require("../task/task-close");
|
|
6
|
+
const task_close_repair_plan_1 = require("../task/task-close-repair-plan");
|
|
6
7
|
const task_complete_flow_1 = require("../task/task-complete-flow");
|
|
7
8
|
const task_create_1 = require("../task/task-create");
|
|
9
|
+
const task_finalize_1 = require("../task/task-finalize");
|
|
10
|
+
const task_lifecycle_1 = require("../task/task-lifecycle");
|
|
8
11
|
const task_ready_1 = require("../task/task-ready");
|
|
9
12
|
const task_finish_1 = require("../task/task-finish");
|
|
10
13
|
const task_next_1 = require("../task/task-next");
|
|
@@ -139,6 +142,55 @@ function handleTaskCommand(input) {
|
|
|
139
142
|
process.exitCode = 6;
|
|
140
143
|
return true;
|
|
141
144
|
}
|
|
145
|
+
if (sub === 'finalize') {
|
|
146
|
+
const id = (0, args_1.getStringOption)(input.args, '--task') ?? input.args[2];
|
|
147
|
+
if (!id || id.startsWith('--'))
|
|
148
|
+
throw new Error('task finalize requires --task <task-id>');
|
|
149
|
+
const report = (0, task_finalize_1.createTaskFinalizeReport)(input.projectRoot, id, {
|
|
150
|
+
executeRequested: (0, args_1.getFlag)(input.args, '--execute'),
|
|
151
|
+
planHash: (0, args_1.getStringOption)(input.args, '--plan-hash'),
|
|
152
|
+
actor: (0, actor_1.getActorContextOption)(input.args)
|
|
153
|
+
});
|
|
154
|
+
if (input.jsonOutput) {
|
|
155
|
+
console.log(JSON.stringify(report, null, 2));
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
console.log((0, task_finalize_1.formatTaskFinalizeReport)(report));
|
|
159
|
+
}
|
|
160
|
+
if (!report.ok)
|
|
161
|
+
process.exitCode = 6;
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
if (sub === 'lifecycle') {
|
|
165
|
+
const id = (0, args_1.getStringOption)(input.args, '--task') ?? input.args[2];
|
|
166
|
+
if (!id || id.startsWith('--'))
|
|
167
|
+
throw new Error('task lifecycle requires --task <task-id>');
|
|
168
|
+
const report = (0, task_lifecycle_1.createTaskLifecycleReport)(input.projectRoot, id, { actor: (0, actor_1.getActorContextOption)(input.args) });
|
|
169
|
+
if (input.jsonOutput) {
|
|
170
|
+
console.log(JSON.stringify(report, null, 2));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
console.log((0, task_lifecycle_1.formatTaskLifecycleReport)(report));
|
|
174
|
+
}
|
|
175
|
+
if (!report.ok)
|
|
176
|
+
process.exitCode = 6;
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (sub === 'close-repair-plan') {
|
|
180
|
+
const id = (0, args_1.getStringOption)(input.args, '--task') ?? input.args[2];
|
|
181
|
+
if (!id || id.startsWith('--'))
|
|
182
|
+
throw new Error('task close-repair-plan requires --task <task-id>');
|
|
183
|
+
const report = (0, task_close_repair_plan_1.createTaskCloseRepairPlanReport)(input.projectRoot, id, { actor: (0, actor_1.getActorContextOption)(input.args) });
|
|
184
|
+
if (input.jsonOutput) {
|
|
185
|
+
console.log(JSON.stringify(report, null, 2));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
console.log((0, task_close_repair_plan_1.formatTaskCloseRepairPlanReport)(report));
|
|
189
|
+
}
|
|
190
|
+
if (!report.ok)
|
|
191
|
+
process.exitCode = 6;
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
142
194
|
if (sub === 'finish') {
|
|
143
195
|
const id = (0, args_1.getStringOption)(input.args, '--task') ?? input.args[2];
|
|
144
196
|
if (!id || id.startsWith('--'))
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.extractCodeIndexGraph = extractCodeIndexGraph;
|
|
7
|
+
exports.codeIndexReportToGraphExtraction = codeIndexReportToGraphExtraction;
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const code_index_1 = require("./code-index");
|
|
10
|
+
function extractCodeIndexGraph(projectRoot, generatedAt) {
|
|
11
|
+
const report = (0, code_index_1.buildCodeIndexReport)({ projectRoot, ...(generatedAt ? { generatedAt } : {}) });
|
|
12
|
+
return codeIndexReportToGraphExtraction(report);
|
|
13
|
+
}
|
|
14
|
+
function codeIndexReportToGraphExtraction(report) {
|
|
15
|
+
const fileByPath = new Map(report.files.map((file) => [file.path, file]));
|
|
16
|
+
const nodes = [
|
|
17
|
+
...report.files.map(codeFileNodeToGraphNode),
|
|
18
|
+
...report.symbols.map((symbol) => codeSymbolNodeToGraphNode(symbol, fileByPath))
|
|
19
|
+
].sort((a, b) => a.id.localeCompare(b.id));
|
|
20
|
+
const edges = report.edges.map(codeEdgeToGraphEdge).sort((a, b) => a.id.localeCompare(b.id));
|
|
21
|
+
return {
|
|
22
|
+
source: {
|
|
23
|
+
extractor: 'extractCodeIndexGraph',
|
|
24
|
+
paths: report.files.map((file) => file.path).sort(),
|
|
25
|
+
sourceHash: report.sourceHash
|
|
26
|
+
},
|
|
27
|
+
nodes,
|
|
28
|
+
edges,
|
|
29
|
+
stateSources: [codeIndexStateSource(report)],
|
|
30
|
+
issues: report.issues.map(codeIndexIssueToGraphIssue)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function codeFileNodeToGraphNode(file) {
|
|
34
|
+
return {
|
|
35
|
+
id: file.id,
|
|
36
|
+
type: codeFileKindToGraphNodeType(file.kind),
|
|
37
|
+
label: node_path_1.default.posix.basename(file.path),
|
|
38
|
+
path: file.path,
|
|
39
|
+
kind: file.kind,
|
|
40
|
+
metadata: {
|
|
41
|
+
language: file.language,
|
|
42
|
+
lineCount: file.lineCount,
|
|
43
|
+
exports: file.exports,
|
|
44
|
+
imports: file.imports,
|
|
45
|
+
commandFamilies: file.commandFamilies
|
|
46
|
+
},
|
|
47
|
+
source: {
|
|
48
|
+
path: file.path,
|
|
49
|
+
hash: file.hash,
|
|
50
|
+
extractor: 'extractCodeIndexGraph'
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function codeSymbolNodeToGraphNode(symbol, fileByPath) {
|
|
55
|
+
const file = fileByPath.get(symbol.path);
|
|
56
|
+
return {
|
|
57
|
+
id: symbol.id,
|
|
58
|
+
type: 'Symbol',
|
|
59
|
+
label: symbol.name,
|
|
60
|
+
path: symbol.path,
|
|
61
|
+
kind: symbol.kind,
|
|
62
|
+
metadata: {
|
|
63
|
+
exported: symbol.exported,
|
|
64
|
+
...(symbol.endLine === undefined ? {} : { endLine: symbol.endLine })
|
|
65
|
+
},
|
|
66
|
+
source: {
|
|
67
|
+
path: symbol.path,
|
|
68
|
+
...(symbol.line === undefined ? {} : { line: symbol.line }),
|
|
69
|
+
...(file?.hash ? { hash: file.hash } : {}),
|
|
70
|
+
extractor: 'extractCodeIndexGraph'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function codeEdgeToGraphEdge(edge) {
|
|
75
|
+
return {
|
|
76
|
+
id: edge.id,
|
|
77
|
+
from: edge.from,
|
|
78
|
+
to: edge.to,
|
|
79
|
+
type: edge.type,
|
|
80
|
+
confidence: edge.confidence,
|
|
81
|
+
reason: edge.reason,
|
|
82
|
+
source: edge.source
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function codeIndexStateSource(report) {
|
|
86
|
+
return {
|
|
87
|
+
id: 'state:code-index',
|
|
88
|
+
path: '.',
|
|
89
|
+
kind: 'code-index',
|
|
90
|
+
hash: report.sourceHash,
|
|
91
|
+
extracted: {
|
|
92
|
+
command: report.command,
|
|
93
|
+
schemaVersion: report.schemaVersion,
|
|
94
|
+
summary: report.summary,
|
|
95
|
+
budget: report.budget,
|
|
96
|
+
cache: report.cache ?? { used: false, hit: false },
|
|
97
|
+
issues: report.issues.length
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function codeIndexIssueToGraphIssue(issue) {
|
|
102
|
+
return {
|
|
103
|
+
severity: issue.severity,
|
|
104
|
+
code: 'CONTEXT_GRAPH_DEGRADED',
|
|
105
|
+
message: `Code index ${issue.code}: ${issue.message}`,
|
|
106
|
+
...(issue.path ? { path: issue.path } : {}),
|
|
107
|
+
...(issue.fixHint ? { fixHint: issue.fixHint } : {})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function codeFileKindToGraphNodeType(kind) {
|
|
111
|
+
switch (kind) {
|
|
112
|
+
case 'test':
|
|
113
|
+
return 'TestFile';
|
|
114
|
+
case 'fixture':
|
|
115
|
+
return 'FixtureFile';
|
|
116
|
+
case 'config':
|
|
117
|
+
return 'ConfigFile';
|
|
118
|
+
case 'source':
|
|
119
|
+
case 'script':
|
|
120
|
+
case 'unknown':
|
|
121
|
+
return 'SourceFile';
|
|
122
|
+
}
|
|
123
|
+
}
|