@nodetool-ai/cli-local 0.0.0-stage → 0.8.9-beta.2

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.
@@ -0,0 +1 @@
1
+ 2026-10-31T10:34:51.639Z
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Local single-user DB bootstrap for CLI commands that run in-process rather
3
+ * than against a running server. Mirrors the `setupDb` in nodetool.ts (secrets
4
+ * commands) without pulling in the heavy deploy stack.
5
+ */
6
+ /** Local single-user id used across the TS stack. */
7
+ export declare const LOCAL_USER_ID = "1";
8
+ /**
9
+ * Initialize the local SQLite DB and best-effort unlock the secret store
10
+ * (needed for any provider that resolves API keys, e.g. embeddings). If the
11
+ * store can't be unlocked it warns to stderr and still resolves — a command
12
+ * that then needs a secret fails at that later point, so the DB stays usable
13
+ * for commands that don't. Idempotent.
14
+ */
15
+ export declare function setupLocalDb(): Promise<void>;
16
+ /** Migrate a standalone command database before unlocking its local credentials. */
17
+ export declare function setupCliDb(): Promise<void>;
18
+ //# sourceMappingURL=local-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-db.d.ts","sourceRoot":"","sources":["../src/local-db.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,qDAAqD;AACrD,eAAO,MAAM,aAAa,MAAM,CAAC;AAIjC;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAc5C;AAED,oFAAoF;AACpF,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAIhD"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Local single-user DB bootstrap for CLI commands that run in-process rather
3
+ * than against a running server. Mirrors the `setupDb` in nodetool.ts (secrets
4
+ * commands) without pulling in the heavy deploy stack.
5
+ */
6
+ import { initDb } from "@nodetool-ai/models";
7
+ import { initMasterKey } from "@nodetool-ai/security";
8
+ import { getDefaultDbPath } from "@nodetool-ai/config";
9
+ /** Local single-user id used across the TS stack. */
10
+ export const LOCAL_USER_ID = "1";
11
+ let ready = null;
12
+ /**
13
+ * Initialize the local SQLite DB and best-effort unlock the secret store
14
+ * (needed for any provider that resolves API keys, e.g. embeddings). If the
15
+ * store can't be unlocked it warns to stderr and still resolves — a command
16
+ * that then needs a secret fails at that later point, so the DB stays usable
17
+ * for commands that don't. Idempotent.
18
+ */
19
+ export function setupLocalDb() {
20
+ ready ??= (async () => {
21
+ initDb(getDefaultDbPath());
22
+ try {
23
+ await initMasterKey();
24
+ }
25
+ catch (err) {
26
+ const msg = err instanceof Error ? err.message : String(err);
27
+ process.stderr.write(`Could not unlock the secret store: ${msg}\n` +
28
+ `Tip: set SECRETS_MASTER_KEY or grant keychain access.\n`);
29
+ }
30
+ })();
31
+ return ready;
32
+ }
33
+ /** Migrate a standalone command database before unlocking its local credentials. */
34
+ export async function setupCliDb() {
35
+ const { migrateSqliteDb } = await import("@nodetool-ai/models");
36
+ await migrateSqliteDb(getDefaultDbPath());
37
+ await setupLocalDb();
38
+ }
39
+ //# sourceMappingURL=local-db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-db.js","sourceRoot":"","sources":["../src/local-db.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,IAAI,KAAK,GAAyB,IAAI,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY;IAC1B,KAAK,KAAK,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,aAAa,EAAE,CAAC;QACxB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sCAAsC,GAAG,IAAI;gBAC3C,yDAAyD,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAChE,MAAM,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1C,MAAM,YAAY,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Resolve a secret for the local user: encrypted store first, then env. */
2
+ export declare function resolveLocalSecret(key: string): Promise<string | null>;
3
+ //# sourceMappingURL=local-secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-secrets.d.ts","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAaA,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEtE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Secret resolution for CLI runs.
3
+ *
4
+ * `getSecret(key)` with no user id never reads the encrypted store — the DB
5
+ * lookup inside it is guarded by the caller's user id, so a bare reference
6
+ * resolves from `process.env` alone. Every CLI surface runs as the local user,
7
+ * so it must ask for that user's secrets explicitly, or a key the user stored
8
+ * with `nodetool secrets store` is invisible and the provider answers 401.
9
+ */
10
+ import { getSecret } from "@nodetool-ai/models";
11
+ import { LOCAL_USER_ID } from "./local-db.js";
12
+ /** Resolve a secret for the local user: encrypted store first, then env. */
13
+ export function resolveLocalSecret(key) {
14
+ return getSecret(key, LOCAL_USER_ID);
15
+ }
16
+ //# sourceMappingURL=local-secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-secrets.js","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,OAAO,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@nodetool-ai/cli-local",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.8.9-beta.2",
4
+ "description": "Shared NodeTool local host helpers",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=22.0.0"
8
+ },
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "nodetool-dev": "./src/index.ts",
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./*": {
19
+ "nodetool-dev": "./src/*.ts",
20
+ "types": "./dist/*.d.ts",
21
+ "import": "./dist/*.js",
22
+ "default": "./dist/*.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "node ../../scripts/build-typescript-workspace.mjs",
27
+ "test": "node ../../scripts/run-vitest.mjs run",
28
+ "lint": "node ../../scripts/run-tsc.mjs --noEmit"
29
+ },
30
+ "dependencies": {
31
+ "@nodetool-ai/cli-common": "0.8.9-beta.2",
32
+ "@nodetool-ai/config": "0.8.9-beta.2",
33
+ "@nodetool-ai/models": "0.8.9-beta.2",
34
+ "@nodetool-ai/security": "0.8.9-beta.2"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.0.0",
38
+ "typescript": "npm:@typescript/typescript6@6.0.2",
39
+ "vitest": "^5.0.1"
40
+ },
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/nodetool-ai/nodetool.git",
45
+ "directory": "packages/cli-local"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "files": [
51
+ "dist",
52
+ "README.md"
53
+ ]
54
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.