@knolo/cli 4.0.0 → 5.0.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 +21 -6
- package/bin/knolo.mjs +39 -1
- package/package.json +19 -2
- package/templates/icp-knowledge-canister/README.md +5 -0
- package/templates/icp-knowledge-canister/canisters/knolo-core-rust/Cargo.toml +1 -1
- package/templates/icp-knowledge-canister/canisters/knolo-core-rust/src/lib.rs +1105 -1
- package/templates/icp-knowledge-canister/canisters/knolo-icp-canister/Cargo.lock +2 -2
- package/templates/icp-knowledge-canister/canisters/knolo-icp-canister/Cargo.toml +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @knolo/cli
|
|
2
2
|
|
|
3
|
-
The CLI
|
|
4
|
-
|
|
3
|
+
The CLI preserves the Knolo V4 pack workflow and adds read-only V5 Knowledge
|
|
4
|
+
Image inspection. Normal builds emit V4; the ICP legacy build path explicitly
|
|
5
|
+
emits V3 until the canister gains a V4 profile. V5 Studio output is a verified
|
|
6
|
+
management snapshot, not a mutation interface.
|
|
5
7
|
|
|
6
8
|
The official CLI for building `.knolo` knowledge packs.
|
|
7
9
|
|
|
@@ -50,6 +52,20 @@ knolo explain receipt.json --pack dist/knowledge.knolo
|
|
|
50
52
|
knolo diff old.knolo new.knolo
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
V5 runtime diagnostics:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
knolo v5 info ./dist/knowledge.v5
|
|
59
|
+
knolo v5 health ./dist/knowledge.v5
|
|
60
|
+
knolo v5 studio ./dist/knowledge.v5
|
|
61
|
+
knolo v5 info ./dist/knowledge.v5 --index ./dist/query-index.v5 --history ./dist/query-history.v5
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
These commands verify the V5 image and optional state-root-bound runtime
|
|
65
|
+
artifacts before printing deterministic diagnostics. The `studio` variant
|
|
66
|
+
prints the KIP-0026 read-only management snapshot with artifact-panel
|
|
67
|
+
availability and a management root. All variants are read-only.
|
|
68
|
+
|
|
53
69
|
### ICP Canister Workflow (LIVE)
|
|
54
70
|
|
|
55
71
|
Deploy a Knolo knowledge canister on a local ICP replica, upload a `.knolo` pack, and query it with no middleware.
|
|
@@ -152,10 +168,9 @@ This ensures:
|
|
|
152
168
|
|
|
153
169
|
## 🗺 Roadmap
|
|
154
170
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* WASM build output
|
|
171
|
+
The active roadmap is maintained in [`../../docs/ROADMAP.md`](../../docs/ROADMAP.md).
|
|
172
|
+
The current release focuses on V5 verification, migration, diagnostics, and
|
|
173
|
+
read-only Studio management while preserving the V4 CLI behavior.
|
|
159
174
|
|
|
160
175
|
---
|
|
161
176
|
|
package/bin/knolo.mjs
CHANGED
|
@@ -33,7 +33,7 @@ const DEFAULT_CONFIG = {
|
|
|
33
33
|
};
|
|
34
34
|
const SUPPORTED_EXTENSIONS = new Set(['.md', '.txt', '.json']);
|
|
35
35
|
const SKIP_DIRS = new Set(['node_modules', 'dist', '.git', '.dfx', '.cargo-target']);
|
|
36
|
-
const SUBCOMMANDS = new Set(['init', 'add', 'build', 'query', 'inspect', 'migrate', 'verify', 'explain', 'diff', 'dev', 'semantic:index', 'semantic:inspect', 'semantic:validate']);
|
|
36
|
+
const SUBCOMMANDS = new Set(['init', 'add', 'build', 'query', 'inspect', 'migrate', 'verify', 'explain', 'diff', 'dev', 'v5', 'semantic:index', 'semantic:inspect', 'semantic:validate']);
|
|
37
37
|
const ICP_SUBCOMMANDS = new Set(['init', 'build-pack', 'upload', 'query', 'health', 'info', 'clear']);
|
|
38
38
|
const ICP_TEMPLATE_CANDIDATES = [
|
|
39
39
|
path.resolve(__dirname, '../templates/icp-knowledge-canister'),
|
|
@@ -88,6 +88,7 @@ Commands:
|
|
|
88
88
|
explain <receipt> Verify and explain a query receipt
|
|
89
89
|
diff <pack-a> <pack-b> Compare pack identities and source/chunk counts
|
|
90
90
|
dev Watch config/sources and rebuild on change
|
|
91
|
+
v5 Inspect, health-check, and manage a V5 Knowledge Image
|
|
91
92
|
icp Scaffold and operate an ICP-native knowledge canister
|
|
92
93
|
|
|
93
94
|
Global options:
|
|
@@ -109,6 +110,7 @@ function printCommandHelp(command) {
|
|
|
109
110
|
explain: 'Usage: knolo explain <receipt.json> --pack <pack.knolo>',
|
|
110
111
|
diff: 'Usage: knolo diff <pack-a.knolo> <pack-b.knolo>',
|
|
111
112
|
dev: 'Usage: knolo dev',
|
|
113
|
+
v5: 'Usage: knolo v5 <info|health|studio> <image.v5> [--index <file>] [--history <file>] [--run <file>] [--replay <file>]',
|
|
112
114
|
icp: 'Usage: knolo icp <command> [options]',
|
|
113
115
|
'semantic:index': 'Usage: knolo semantic:index --pack <path> [--out <path>] [--model <id>] [--endpoint <url>]',
|
|
114
116
|
'semantic:inspect': 'Usage: knolo semantic:inspect --sidecar <path>',
|
|
@@ -773,6 +775,41 @@ async function cmdDiff(core, args) {
|
|
|
773
775
|
console.log(JSON.stringify({ equal: aDigest === bDigest, a: { packDigest: aDigest, blocks: a.pack.blocks.length, terms: a.pack.lexicon.size }, b: { packDigest: bDigest, blocks: b.pack.blocks.length, terms: b.pack.lexicon.size }, addedSources: [...bSources].filter((id) => !aSources.has(id)).sort(), removedSources: [...aSources].filter((id) => !bSources.has(id)).sort() }, null, 2));
|
|
774
776
|
}
|
|
775
777
|
|
|
778
|
+
function parseV5Args(args) {
|
|
779
|
+
const positional = [];
|
|
780
|
+
const flags = {};
|
|
781
|
+
for (let i = 0; i < args.length; i++) {
|
|
782
|
+
const arg = args[i];
|
|
783
|
+
if (arg === '--image' || arg === '--index' || arg === '--history' || arg === '--run' || arg === '--replay') flags[arg.slice(2)] = args[++i];
|
|
784
|
+
else if (arg.startsWith('--')) throw createError(`Unknown flag for v5: ${arg}`);
|
|
785
|
+
else positional.push(arg);
|
|
786
|
+
}
|
|
787
|
+
return { positional, flags };
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
async function cmdV5(core, args) {
|
|
791
|
+
const subcommand = args[0] || 'info';
|
|
792
|
+
if (!['info', 'health', 'studio'].includes(subcommand)) throw createError(`Unknown V5 command: ${subcommand}`);
|
|
793
|
+
const { positional, flags } = parseV5Args(args.slice(['info', 'health', 'studio'].includes(args[0]) ? 1 : 0));
|
|
794
|
+
const imagePath = path.resolve(process.cwd(), flags.image || positional[0] || 'dist/knowledge.v5');
|
|
795
|
+
if (!existsSync(imagePath)) throw createError(`V5 image file not found at ${path.relative(process.cwd(), imagePath)}.`);
|
|
796
|
+
const readOptional = (file, decode) => file ? decode(Uint8Array.from(readFileSync(path.resolve(process.cwd(), file)))) : undefined;
|
|
797
|
+
const input = {
|
|
798
|
+
image: Uint8Array.from(readFileSync(imagePath)),
|
|
799
|
+
...(flags.index ? { queryIndex: readOptional(flags.index, core.deserializeKnowledgeQueryIndexV1) } : {}),
|
|
800
|
+
...(flags.history ? { queryHistory: readOptional(flags.history, core.deserializeKnowledgeQueryHistoryV1) } : {}),
|
|
801
|
+
...(flags.run ? { run: readOptional(flags.run, core.deserializeKnowledgeRunV1) } : {}),
|
|
802
|
+
...(flags.replay ? { replayState: readOptional(flags.replay, core.deserializeKnowledgeSyncReplayStateV1) } : {}),
|
|
803
|
+
};
|
|
804
|
+
if (subcommand === 'studio') {
|
|
805
|
+
console.log(JSON.stringify(core.inspectKnowledgeStudioManagementV5(input), null, 2));
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const diagnostics = core.inspectKnowledgeRuntimeV5(input);
|
|
809
|
+
if (subcommand === 'health') console.log(JSON.stringify({ healthy: true, ...diagnostics }, null, 2));
|
|
810
|
+
else console.log(JSON.stringify(diagnostics, null, 2));
|
|
811
|
+
}
|
|
812
|
+
|
|
776
813
|
function parseKeyValueArgs(args) {
|
|
777
814
|
const out = {};
|
|
778
815
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -1142,6 +1179,7 @@ async function main() {
|
|
|
1142
1179
|
if (command === 'explain') return await cmdExplain(core, commandArgs);
|
|
1143
1180
|
if (command === 'diff') return await cmdDiff(core, commandArgs);
|
|
1144
1181
|
if (command === 'dev') return await cmdDev(core);
|
|
1182
|
+
if (command === 'v5') return await cmdV5(core, commandArgs);
|
|
1145
1183
|
if (command === 'semantic:index') return await cmdSemanticIndex(core, commandArgs);
|
|
1146
1184
|
if (command === 'semantic:inspect') return await cmdSemanticInspect(core, commandArgs);
|
|
1147
1185
|
if (command === 'semantic:validate') return await cmdSemanticValidate(core, commandArgs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knolo/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"knolo": "bin/knolo.mjs"
|
|
@@ -9,12 +9,29 @@
|
|
|
9
9
|
"bin/",
|
|
10
10
|
"templates/"
|
|
11
11
|
],
|
|
12
|
+
"description": "CLI for building, inspecting, verifying, and operating Knolo V4 packs and V5 Knowledge Images.",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/HiveForensics-AI/knolo-core.git",
|
|
17
|
+
"directory": "packages/cli"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/HiveForensics-AI/knolo-core#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/HiveForensics-AI/knolo-core/issues"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
12
29
|
"scripts": {
|
|
13
30
|
"build": "node -e \"console.log('cli is executable via bin/knolo.mjs')\"",
|
|
14
31
|
"test": "npm run build --prefix ../core && node --test test/cli.test.mjs"
|
|
15
32
|
},
|
|
16
33
|
"dependencies": {
|
|
17
|
-
"@knolo/core": "^
|
|
34
|
+
"@knolo/core": "^5.0.0"
|
|
18
35
|
},
|
|
19
36
|
"private": false
|
|
20
37
|
}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Minimal local `dfx` example for deploying a Knolo ICP canister without any middleware server.
|
|
4
4
|
|
|
5
|
+
This scaffold remains on the legacy ICP V3 profile. The V5 foundation is
|
|
6
|
+
available in the TypeScript/Rust runtimes and through the root CLI’s read-only
|
|
7
|
+
Knowledge Image commands; see the repository `docs/ROADMAP.md` for the staged
|
|
8
|
+
ICP upgrade path.
|
|
9
|
+
|
|
5
10
|
This scaffold:
|
|
6
11
|
|
|
7
12
|
- builds a real `.knolo` pack from local sample docs
|