@knolo/cli 3.1.3 → 3.2.1

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 (3) hide show
  1. package/README.md +10 -2
  2. package/bin/knolo.mjs +15 -2
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -12,7 +12,7 @@ Global:
12
12
 
13
13
  ```bash
14
14
  npm install -g @knolo/cli
15
- ````
15
+ ```
16
16
 
17
17
  Or use via npx:
18
18
 
@@ -112,6 +112,14 @@ This ensures:
112
112
 
113
113
  ---
114
114
 
115
+ ## ClaimGraph section compatibility
116
+
117
+ New `.knolo` packs may include an optional trailing **ClaimGraph** JSON section.
118
+ This section is deterministic, offline-safe, and additive; runtimes that ignore trailing sections remain backward compatible.
119
+
120
+ ---
121
+
115
122
  ## 📄 License
116
123
 
117
- MIT
124
+ MIT
125
+
package/bin/knolo.mjs CHANGED
@@ -47,7 +47,10 @@ async function tryImport(filePath) {
47
47
  }
48
48
 
49
49
  async function loadCore() {
50
- const candidates = ['@knolo/core', path.resolve(__dirname, '../../core/dist/index.js')];
50
+ const candidates = [
51
+ path.resolve(__dirname, '../../core/dist/index.js'),
52
+ '@knolo/core',
53
+ ];
51
54
  for (const candidate of candidates) {
52
55
  const mod = await tryImport(candidate);
53
56
  if (mod?.buildPack && mod?.mountPack && mod?.query) return mod;
@@ -278,7 +281,9 @@ async function cmdQuery(core, args) {
278
281
  const topK = opts.k !== undefined ? Number(opts.k) : (config.query?.topK ?? 5);
279
282
  if (!Number.isInteger(topK) || topK <= 0) throw createError('--k must be a positive integer.');
280
283
 
281
- const kb = await core.mountPack({ src: packPath });
284
+ const packBuffer = readFileSync(packPath);
285
+ const bytes = Uint8Array.from(packBuffer);
286
+ const kb = await mountPackFromBytes(core, bytes);
282
287
  const hits = core.query(kb, question, { topK }).map((hit) => ({
283
288
  title: kb.headings?.[hit.blockId] || hit.source || `Block ${hit.blockId}`,
284
289
  source: hit.source || kb.docIds?.[hit.blockId] || 'unknown',
@@ -308,6 +313,14 @@ async function cmdQuery(core, args) {
308
313
  });
309
314
  }
310
315
 
316
+ async function mountPackFromBytes(core, bytes) {
317
+ try {
318
+ return await core.mountPack({ bytes });
319
+ } catch {
320
+ return await core.mountPack({ src: bytes });
321
+ }
322
+ }
323
+
311
324
  function listDirectoriesRecursively(root) {
312
325
  const dirs = [root];
313
326
  for (let i = 0; i < dirs.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knolo/cli",
3
- "version": "3.1.3",
3
+ "version": "3.2.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "knolo": "bin/knolo.mjs"
@@ -13,7 +13,7 @@
13
13
  "test": "npm run build --prefix ../core && node --test test/cli.test.mjs"
14
14
  },
15
15
  "dependencies": {
16
- "@knolo/core": "^3.1.2"
16
+ "@knolo/core": "^3.2.0"
17
17
  },
18
18
  "private": false
19
19
  }