@ganziliang/kb 0.1.1 → 0.1.3

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/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ export declare function main(): Promise<void>;
package/dist/cli.js CHANGED
@@ -6,10 +6,18 @@ import { mkdirSync } from "node:fs";
6
6
  import { ensureModelConfig, saveModels } from "./config.js";
7
7
  import { Agent, fetchTransport } from "./model.js";
8
8
  import { copyOriginal, defaultDataRoot, ensureKnowledgeBase, KnowledgeStore, readLocalFile, listKnowledgeBases, deleteKnowledgeBase, backupKnowledgeBase, restoreKnowledgeBase } from "./storage.js";
9
+ const banner = [
10
+ " _ __ ____ ",
11
+ " | |/ // __ ) ",
12
+ " | // __ | ",
13
+ " | |/ /_/ / ",
14
+ " |_|\\_\\____/ ",
15
+ " Welcome to KB Knowledge Base",
16
+ ];
9
17
  function App({ config, root, knowledgeBase }) {
10
18
  const { exit } = useApp();
11
19
  const [input, setInput] = useState("");
12
- const [lines, setLines] = useState(["Local Knowledge Agent", `knowledge base: ${knowledgeBase.name}`, "Type a question, or /help."]);
20
+ const [lines, setLines] = useState([...banner, `knowledge base: ${knowledgeBase.name}`, "Type a question, or /help."]);
13
21
  const [busy, setBusy] = useState(false);
14
22
  const [messages, setMessages] = useState([]);
15
23
  const [modelIndex, setModelIndex] = useState(0);
@@ -162,7 +170,7 @@ async function ingestOrAsk(value, store, modelConfig, previous) {
162
170
  const agent = new Agent(store, modelConfig, fetchTransport);
163
171
  return agent.answer(`Answer only from the local knowledge below. If it is insufficient, say no knowledge was found. Include source filename and version.\n\n${context}\n\nQuestion: ${value}`, previous);
164
172
  }
165
- async function main() {
173
+ export async function main() {
166
174
  const root = defaultDataRoot();
167
175
  mkdirSync(root, { recursive: true });
168
176
  const knowledgeRoot = root;
@@ -170,4 +178,3 @@ async function main() {
170
178
  const configs = await ensureModelConfig();
171
179
  render(_jsx(App, { config: configs, root: knowledgeRoot, knowledgeBase: base }));
172
180
  }
173
- void main();
@@ -0,0 +1 @@
1
+ export {};
package/dist/entry.js ADDED
@@ -0,0 +1,9 @@
1
+ // Install the warning filter before loading node:sqlite through the CLI module.
2
+ process.on("warning", (warning) => {
3
+ if (warning.name === "ExperimentalWarning" && /SQLite/i.test(warning.message))
4
+ return;
5
+ console.warn(warning.stack ?? warning.message);
6
+ });
7
+ const { main } = await import("./cli.js");
8
+ await main();
9
+ export {};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ganziliang/kb",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local knowledge base agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
- "kb": "dist/cli.js"
7
+ "kb": "dist/entry.js"
8
8
  },
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "node": ">=22.5.0"
21
21
  },
22
22
  "dependencies": {
23
- "@ganziliang/kb-model-setup": "^0.1.0",
23
+ "@ganziliang/kb-model-setup": "^0.1.2",
24
24
  "ink": "^5.1.0",
25
25
  "react": "^18.3.1",
26
26
  "xlsx": "^0.18.5"