@knolo/cli 3.1.2 → 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 +125 -0
  2. package/bin/knolo.mjs +15 -2
  3. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # @knolo/cli
2
+
3
+ The official CLI for building `.knolo` knowledge packs.
4
+
5
+ It indexes structured content and produces a deterministic, local-first knowledge bundle for use with `@knolo/core`.
6
+
7
+ ---
8
+
9
+ ## 📦 Installation
10
+
11
+ Global:
12
+
13
+ ```bash
14
+ npm install -g @knolo/cli
15
+ ```
16
+
17
+ Or use via npx:
18
+
19
+ ```bash
20
+ npx knolo build
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 🚀 Commands
26
+
27
+ ### Build a Knowledge Pack
28
+
29
+ ```bash
30
+ knolo build
31
+ ```
32
+
33
+ Indexes your configured content and outputs:
34
+
35
+ ```
36
+ dist/knowledge.knolo
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 📁 Expected Project Structure
42
+
43
+ Example:
44
+
45
+ ```
46
+ /knowledge
47
+ mobile.json
48
+ backend.json
49
+ knolo.config.ts
50
+ ```
51
+
52
+ ---
53
+
54
+ ## ⚙️ knolo.config.ts Example
55
+
56
+ ```ts
57
+ export default {
58
+ input: "./knowledge",
59
+ output: "./dist/knowledge.knolo"
60
+ };
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 🧱 What the CLI Does
66
+
67
+ * Parses structured documents
68
+ * Normalizes metadata
69
+ * Indexes namespaces
70
+ * Extracts agent routing profiles
71
+ * Validates agent registry
72
+ * Generates compact `.knolo` bundle
73
+
74
+ All builds are deterministic.
75
+
76
+ ---
77
+
78
+ ## 🧠 Agent Features
79
+
80
+ Phase 2 includes:
81
+
82
+ * Routing profile extraction
83
+ * Tool policy validation
84
+ * Mount-time registry validation
85
+ * Deterministic selection logic
86
+
87
+ ---
88
+
89
+ ## 🔍 Why No Embeddings?
90
+
91
+ KnoLo intentionally avoids:
92
+
93
+ * Vector databases
94
+ * Similarity search
95
+ * External inference APIs
96
+
97
+ This ensures:
98
+
99
+ * Reproducibility
100
+ * Security
101
+ * Low memory usage
102
+ * Predictable results
103
+
104
+ ---
105
+
106
+ ## 🗺 Roadmap
107
+
108
+ * Watch mode
109
+ * Incremental indexing
110
+ * Rust-powered build engine
111
+ * WASM build output
112
+
113
+ ---
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
+
122
+ ## 📄 License
123
+
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.2",
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
  }