@h1v35/hivex 0.2.0 → 0.2.2
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 +55 -163
- package/docs/CONTEXT.md +20 -36
- package/docs/README.md +6 -12
- package/docs/adr/0003-independent-bun-installation.md +5 -19
- package/docs/adr/0010-practical-knowledge-assistance.md +28 -81
- package/docs/adr/0011-shared-knowledge-and-selective-history.md +16 -43
- package/docs/guidelines/engineering.md +74 -0
- package/docs/procedures/self-hosted-runner.md +7 -0
- package/package.json +32 -11
- package/skills/hivex/SKILL.md +28 -92
- package/skills/hivex/references/markdown.md +12 -42
- package/src/cli/diagnostic.ts +21 -11
- package/src/cli.ts +46 -36
- package/src/documents.ts +502 -320
- package/src/errors.ts +8 -6
- package/src/implementation.ts +185 -87
- package/src/ingestion-units.ts +107 -64
- package/src/knowledge-maintenance.ts +35 -22
- package/src/knowledge-model.ts +386 -268
- package/src/knowledge-serialization.ts +239 -0
- package/src/knowledge-snapshot.ts +100 -77
- package/src/knowledge-store.ts +634 -453
- package/src/knowledge.ts +1001 -758
- package/src/markdown.ts +107 -45
- package/src/model/connection.ts +134 -76
- package/src/model/failure.ts +46 -23
- package/src/model/invoke.ts +346 -166
- package/src/model/profile.ts +201 -103
- package/src/model/rpc-error.ts +21 -0
- package/src/model/server.ts +151 -82
- package/src/model/thread.ts +24 -14
- package/src/model/transcript.ts +87 -46
- package/src/ordering.ts +9 -0
- package/src/retrieval/lexical.ts +64 -41
- package/src/review.ts +83 -55
- package/src/runtime.d.ts +4 -0
- package/src/snapshot-command.ts +82 -43
- package/src/source-relocation.ts +222 -0
- package/docs/engineering.md +0 -174
package/src/cli.ts
CHANGED
|
@@ -6,95 +6,105 @@ import { knowledgeCommand } from './knowledge.ts';
|
|
|
6
6
|
import { snapshotCommand } from './snapshot-command.ts';
|
|
7
7
|
import { diagnostic } from './cli/diagnostic.ts';
|
|
8
8
|
|
|
9
|
-
async
|
|
10
|
-
if (!
|
|
9
|
+
const main = async (input: string[]) => {
|
|
10
|
+
if (!input.length || input.includes('--help')) {
|
|
11
11
|
return {
|
|
12
12
|
application: 'hivex',
|
|
13
|
-
purpose: 'Project decisions, dependencies and exceptions for the responsible agent.',
|
|
14
13
|
commands: [
|
|
15
14
|
{
|
|
15
|
+
modelCalls: 0,
|
|
16
16
|
name: 'sources',
|
|
17
17
|
usage:
|
|
18
18
|
'sources [--root <project>] [--limit <count>] [--cursor <continuation>] [--max-bytes <bytes>]',
|
|
19
|
-
modelCalls: 0,
|
|
20
19
|
},
|
|
21
20
|
{
|
|
21
|
+
modelCalls: 0,
|
|
22
22
|
name: 'read',
|
|
23
23
|
usage:
|
|
24
24
|
'read <document> [--root <project>] [--from <line>] [--to <line>] [--max-bytes <bytes>]',
|
|
25
|
-
modelCalls: 0,
|
|
26
25
|
},
|
|
27
26
|
{
|
|
27
|
+
modelCalls:
|
|
28
|
+
'One extraction and one check per batch; retained work resumes within the same budget.',
|
|
28
29
|
name: 'update',
|
|
29
30
|
usage:
|
|
30
31
|
'update [--root <project>] [--max-calls <total>] [--max-input-bytes <total>] [--repair <document> --reason <correction>]',
|
|
31
|
-
modelCalls:
|
|
32
|
-
'One extraction and one check per batch; retained work resumes within the same budget.',
|
|
33
32
|
},
|
|
34
33
|
{
|
|
34
|
+
modelCalls: 0,
|
|
35
35
|
name: 'search',
|
|
36
36
|
usage: 'search <query> [--root <project>] [--limit <count>]',
|
|
37
|
-
modelCalls: 0,
|
|
38
37
|
},
|
|
39
38
|
{
|
|
39
|
+
modelCalls: 0,
|
|
40
40
|
name: 'neighbors',
|
|
41
41
|
usage: 'neighbors <decision-id> [--root <project>] [--limit <count>]',
|
|
42
|
-
modelCalls: 0,
|
|
43
42
|
},
|
|
44
43
|
{
|
|
44
|
+
modelCalls:
|
|
45
|
+
'One bounded automatic update/check batch and Luna/max assistance share a total budget; identical retained answers are reused.',
|
|
45
46
|
name: 'ask',
|
|
46
47
|
usage:
|
|
47
48
|
'ask <task> [--root <project>] [--source <document>] [--max-calls <total>] [--max-input-bytes <total>] [--max-context-bytes <bytes>]',
|
|
48
|
-
modelCalls:
|
|
49
|
-
'One bounded automatic update/check batch and Luna/max assistance share a total budget; identical retained answers are reused.',
|
|
50
49
|
},
|
|
51
50
|
{
|
|
51
|
+
modelCalls:
|
|
52
|
+
'One automatic update/check batch and a review share one budget. Checking saved versions needs no model.',
|
|
52
53
|
name: 'review',
|
|
53
54
|
usage:
|
|
54
55
|
'review <task> --base <git-ref> [--root <project>] [--source <document>] [--max-calls <total>] [--max-context-bytes <bytes>] | review --check <saved-report.json> [--root <project>]',
|
|
55
|
-
modelCalls:
|
|
56
|
-
'One automatic update/check batch and a review share one budget. Checking saved versions needs no model.',
|
|
57
56
|
},
|
|
58
57
|
{
|
|
58
|
+
modelCalls: 0,
|
|
59
59
|
name: 'recover',
|
|
60
60
|
usage: 'recover [--root <project>] [--acknowledge-uncertain]',
|
|
61
|
-
modelCalls: 0,
|
|
62
61
|
},
|
|
63
62
|
{
|
|
63
|
+
modelCalls: 0,
|
|
64
64
|
name: 'prune',
|
|
65
65
|
usage: 'prune [--root <project>] [--keep-completed <count>] [--keep-caches <count>]',
|
|
66
|
-
modelCalls: 0,
|
|
67
66
|
},
|
|
68
67
|
{
|
|
69
|
-
name: 'snapshot',
|
|
70
|
-
usage: 'snapshot export | import [--root <project>]',
|
|
71
68
|
modelCalls: 0,
|
|
69
|
+
name: 'snapshot',
|
|
70
|
+
usage: 'snapshot export | import | relocate <from> <to> [--root <project>]',
|
|
72
71
|
},
|
|
73
|
-
{ name: 'status', usage: 'status [--root <project>]'
|
|
72
|
+
{ modelCalls: 0, name: 'status', usage: 'status [--root <project>]' },
|
|
74
73
|
],
|
|
75
|
-
modelOptions: '--codex <native-binary> --deadline-ms <100..1800000> --retry-failed',
|
|
76
74
|
configuration:
|
|
77
75
|
'Optional hivex.json with include/exclude/history relative Markdown globs; history sources are focused evidence.',
|
|
76
|
+
modelOptions: '--codex <native-binary> --deadline-ms <100..1800000> --retry-failed',
|
|
77
|
+
purpose: 'Project decisions, dependencies and exceptions for the responsible agent.',
|
|
78
78
|
stage: 'Incremental project knowledge and task/diff assistance for the principal agent.',
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
}
|
|
81
|
+
if (input[0] === 'review' && input.includes('--check')) {
|
|
82
|
+
return checkReview(input);
|
|
83
|
+
}
|
|
84
|
+
if (input[0] === 'sources' || input[0] === 'read') {
|
|
85
|
+
return documentCommand(input);
|
|
86
|
+
}
|
|
87
|
+
if (input[0] === 'snapshot') {
|
|
88
|
+
return snapshotCommand(input);
|
|
89
|
+
}
|
|
90
|
+
if (input[0] === 'recover' || input[0] === 'prune') {
|
|
91
|
+
return knowledgeMaintenance(input);
|
|
92
|
+
}
|
|
93
|
+
return await knowledgeCommand(input);
|
|
94
|
+
};
|
|
95
|
+
const printResult = async () => {
|
|
96
|
+
const result: unknown = await main(process.argv.slice(2));
|
|
97
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
98
|
+
if (result === null || typeof result !== 'object' || !('status' in result)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (result.status === 'failed' || result.status === 'blocked') {
|
|
96
102
|
process.exitCode = 1;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
try {
|
|
106
|
+
await printResult();
|
|
97
107
|
} catch (error) {
|
|
98
|
-
process.stderr.write(JSON.stringify(diagnostic(error))
|
|
108
|
+
process.stderr.write(`${JSON.stringify(diagnostic(error))}\n`);
|
|
99
109
|
process.exitCode = 1;
|
|
100
110
|
}
|