@agent-smith/cli 0.0.86 → 0.0.87

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/conf.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- declare const confDir: string;
2
- declare const dbPath: string;
1
+ declare const confDir: string, dbPath: string;
3
2
  declare function processConfPath(confPath: string): Promise<{
4
3
  paths: Array<string>;
5
4
  pf: string;
package/dist/conf.js CHANGED
@@ -1,17 +1,33 @@
1
- import path from "path";
2
1
  import { readConf } from "./cmd/sys/read_conf.js";
3
2
  import { upsertBackends, insertFeaturesPathIfNotExists, insertPluginIfNotExists } from "./db/write.js";
4
3
  import { buildPluginsPaths } from "./state/plugins.js";
5
4
  import { runtimeError } from "./cmd/lib/user_msgs.js";
6
5
  import { localBackends } from "./const.js";
7
- const confDir = path.join(process.env.HOME, ".config/agent-smith/cli");
8
- const dbPath = path.join(confDir, "config.db");
6
+ import { homedir } from 'os';
7
+ import { join } from 'path';
8
+ function getConfigPath(appName, filename) {
9
+ let confDir;
10
+ let dbPath;
11
+ if (process.platform === 'win32') {
12
+ confDir = join(process.env.APPDATA, appName);
13
+ dbPath = join(process.env.APPDATA, appName, filename);
14
+ }
15
+ else if (process.platform === 'darwin') {
16
+ confDir = join(homedir(), 'Library', 'Application Support', appName);
17
+ dbPath = join(homedir(), 'Library', 'Application Support', appName, filename);
18
+ }
19
+ else {
20
+ confDir = join(homedir(), '.config', appName);
21
+ dbPath = join(homedir(), '.config', appName, filename);
22
+ }
23
+ return { confDir: confDir, dbPath: dbPath };
24
+ }
25
+ const { confDir, dbPath } = getConfigPath("agent-smith", "config.db");
9
26
  async function processConfPath(confPath) {
10
27
  const { found, data } = readConf(confPath);
11
28
  if (!found) {
12
29
  runtimeError(`Config file ${confPath} not found`);
13
30
  }
14
- console.log(data);
15
31
  const allPaths = new Array();
16
32
  const backends = {};
17
33
  let defaultBackendName = "";
@@ -53,7 +69,6 @@ async function processConfPath(confPath) {
53
69
  }
54
70
  }
55
71
  console.log("Default backend:", defaultBackendName);
56
- console.dir(backends, { depth: 4 });
57
72
  if (!Object.keys(backends).includes(defaultBackendName)) {
58
73
  throw new Error(`Undeclared default backend: ${defaultBackendName}`);
59
74
  }
package/dist/db/db.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Database } from "better-sqlite3";
2
- declare const dbPath: string;
3
2
  declare let db: Database;
4
3
  declare function initDb(isVerbose: boolean, execSchema: boolean): void;
5
- export { db, dbPath, initDb, };
4
+ export { db, initDb, };
package/dist/db/db.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import DatabaseConstructor from "better-sqlite3";
2
2
  import { schemas } from "./schemas.js";
3
- import path from "path";
4
3
  import { createDirectoryIfNotExists } from "../cmd/sys/dirs.js";
5
- const confDir = path.join(process.env.HOME ?? "~/", ".config/agent-smith/cli");
6
- const dbPath = path.join(confDir, "config.db");
4
+ import { confDir, dbPath } from "../conf.js";
7
5
  let db;
8
6
  const debugDb = false;
9
7
  function initDb(isVerbose, execSchema) {
@@ -21,4 +19,4 @@ function initDb(isVerbose, execSchema) {
21
19
  db = new DatabaseConstructor(dbPath);
22
20
  }
23
21
  }
24
- export { db, dbPath, initDb, };
22
+ export { db, initDb, };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@agent-smith/cli",
3
3
  "description": "Agent Smith: terminal client for language model agents",
4
4
  "repository": "https://github.com/synw/agent-smith",
5
- "version": "0.0.86",
5
+ "version": "0.0.87",
6
6
  "scripts": {
7
7
  "buildrl": "rm -rf dist/* && rollup -c",
8
8
  "build": "rm -rf dist/* && tsc",