@2kw/ai 5.1.0-dev.7 → 5.2.0-dev.6

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 (2) hide show
  1. package/dist/lib/config.js +10 -0
  2. package/package.json +8 -3
@@ -22,6 +22,14 @@ function warnLegacyEnv(legacyName, canonicalName) {
22
22
  `Switch to ${canonicalName} — the BACKBONE_* names will be removed ` +
23
23
  `in a future release.\n`);
24
24
  }
25
+ /**
26
+ * Optional override for where the config store lives. Set AI_2KW_CONFIG_DIR to
27
+ * relocate the store — e.g. to isolate an environment, or so the test suite
28
+ * never touches the real user profile. When set, it applies to both the active
29
+ * store and the legacy store the migration reads, so a redirected run stays
30
+ * fully self-contained.
31
+ */
32
+ const CONFIG_DIR_OVERRIDE = process.env.AI_2KW_CONFIG_DIR;
25
33
  const store = new Conf({
26
34
  projectName: "2kw",
27
35
  projectSuffix: "",
@@ -29,6 +37,7 @@ const store = new Conf({
29
37
  activeContext: "default",
30
38
  contexts: {},
31
39
  },
40
+ ...(CONFIG_DIR_OVERRIDE ? { cwd: CONFIG_DIR_OVERRIDE } : {}),
32
41
  });
33
42
  // One-shot migration: copy any legacy ~/.config/backbone/ store into the new
34
43
  // ~/.config/2kw/ store on first run. Triggered only if the new store has no
@@ -48,6 +57,7 @@ const store = new Conf({
48
57
  projectName: "backbone",
49
58
  projectSuffix: "",
50
59
  defaults: { activeContext: "default", contexts: {} },
60
+ ...(CONFIG_DIR_OVERRIDE ? { cwd: CONFIG_DIR_OVERRIDE } : {}),
51
61
  });
52
62
  if (!existsSync(legacy.path))
53
63
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2kw/ai",
3
- "version": "5.1.0-dev.7",
3
+ "version": "5.2.0-dev.6",
4
4
  "description": "CLI for the 2kw.ai platform (engineering name: Backbone)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,11 @@
17
17
  "generate:types": "openapi-typescript openapi/openapi.json -o src/generated/openapi.d.ts",
18
18
  "generate": "npm run generate:spec && npm run generate:types",
19
19
  "check:spec": "tsx --env-file=.env openapi/scripts/check-drift.ts",
20
- "typecheck": "tsc --noEmit"
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "vitest",
22
+ "test:run": "vitest run",
23
+ "test:unit": "vitest run tests/unit",
24
+ "test:contract": "vitest run tests/contract"
21
25
  },
22
26
  "dependencies": {
23
27
  "chalk": "^5.6.2",
@@ -31,7 +35,8 @@
31
35
  "@types/node": "^22.19.17",
32
36
  "openapi-typescript": "^7.13.0",
33
37
  "tsx": "^4.21.1",
34
- "typescript": "^5.9.3"
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^4.1.10"
35
40
  },
36
41
  "engines": {
37
42
  "node": ">=18.20.8"