@withone/cli 1.52.0 → 1.52.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.
package/README.md CHANGED
@@ -140,7 +140,7 @@ Supports Claude Code, Claude Desktop, Cursor, Windsurf, Codex, and Kiro.
140
140
 
141
141
  When you run `one` in a project, it uses the project config if one exists and falls back to the global config otherwise. Use `one config path` to see which config is active and the full resolution order.
142
142
 
143
- In a monorepo, the project root is the nearest ancestor with `.one/`, `.git`, or `package.json` — checked in that order. Run `mkdir .one` in a nested subproject to make it its own project root (so the config is keyed by the nested dir's slug instead of the monorepo's).
143
+ In a monorepo, the project root is the nearest ancestor with `.one/`, `.git`, or `package.json` — checked in that order. Run `mkdir .one` in a nested subproject to make it its own project root (so the config is keyed by the nested dir's slug instead of the monorepo's). Your home directory itself is never treated as a project root — `~/.one` is the CLI's own config directory, and a dotfiles `.git` or stray `package.json` in `$HOME` shouldn't turn everything under home into one project. Scope that applies to all of home is the global config.
144
144
 
145
145
  If you've already set up, `one init` shows your current status for the active scope and lets you update your key, install to more agents, or reconfigure.
146
146
 
@@ -683,6 +683,22 @@ ONE_PERMISSIONS=read
683
683
 
684
684
  > ⚠️ **Add `.onerc` to your `.gitignore`.** If you put `ONE_SECRET` in it, committing the file will leak your API key. Treat `.onerc` like `.env` — never check it in.
685
685
 
686
+ ### Relocating the CLI's state (`ONE_HOME`)
687
+
688
+ Everything the CLI stores — `~/.one/config.json`, the knowledge cache, memory
689
+ databases, sync schedules, and the installed skill files — is rooted at your
690
+ home directory. Set `ONE_HOME` to put it somewhere else:
691
+
692
+ ```bash
693
+ export ONE_HOME=/srv/one-state
694
+ one whoami # now reads /srv/one-state/.one/config.json
695
+ ```
696
+
697
+ Useful for containers, CI runners, and shared/multi-tenant shells where the
698
+ account's home directory isn't the right place for per-workspace state. It
699
+ works identically on every platform — unlike `HOME`, which `os.homedir()`
700
+ ignores on Windows.
701
+
686
702
  ## The workflow
687
703
 
688
704
  The power of One is in the workflow. Every interaction follows the same pattern:
@@ -3,7 +3,7 @@ import {
3
3
  readConfig,
4
4
  setOpenAiApiKey,
5
5
  writeConfig
6
- } from "./chunk-SO323PZP.js";
6
+ } from "./chunk-EVEUGRCB.js";
7
7
 
8
8
  // src/lib/memory/config.ts
9
9
  var DEFAULT_MEMORY_CONFIG = {
@@ -5,10 +5,11 @@ import {
5
5
  getMemoryConfig,
6
6
  getMemoryConfigOrDefault,
7
7
  updateMemoryConfig
8
- } from "./chunk-C7DWZ7B5.js";
8
+ } from "./chunk-5O5KODGV.js";
9
9
  import {
10
- getOpenAiApiKey
11
- } from "./chunk-SO323PZP.js";
10
+ getOpenAiApiKey,
11
+ homeDir
12
+ } from "./chunk-EVEUGRCB.js";
12
13
 
13
14
  // src/lib/memory/schema.ts
14
15
  var SCHEMA_VERSION = "2.3.1";
@@ -1458,7 +1459,6 @@ var postgresPlugin = {
1458
1459
  import fs from "fs";
1459
1460
  import net from "net";
1460
1461
  import path from "path";
1461
- import os from "os";
1462
1462
  import { createRequire } from "module";
1463
1463
  import { spawn } from "child_process";
1464
1464
  var requireFromHere = createRequire(import.meta.url);
@@ -1473,7 +1473,12 @@ var BASE_CAPABILITIES = {
1473
1473
  rawSql: true
1474
1474
  };
1475
1475
  var DEFAULTS = {
1476
- dataDir: path.join(os.homedir(), ".one", "pg"),
1476
+ // Getter, not a bound value: DEFAULTS is built at module load, so a plain
1477
+ // `path.join(homeDir(), ...)` here would capture the home directory before
1478
+ // ONE_HOME could take effect. See lib/home.ts.
1479
+ get dataDir() {
1480
+ return path.join(homeDir(), ".one", "pg");
1481
+ },
1477
1482
  database: "one_mem",
1478
1483
  schema: "public",
1479
1484
  pgvector: true,
@@ -1,10 +1,17 @@
1
+ // src/lib/home.ts
2
+ import os from "os";
3
+ function homeDir() {
4
+ const override = process.env.ONE_HOME;
5
+ if (override && override.trim() !== "") return override;
6
+ return os.homedir();
7
+ }
8
+
1
9
  // src/lib/config.ts
2
10
  import fs from "fs";
3
11
  import path from "path";
4
- import os from "os";
5
12
  import { randomUUID } from "crypto";
6
13
  function configDir() {
7
- return path.join(os.homedir(), ".one");
14
+ return path.join(homeDir(), ".one");
8
15
  }
9
16
  function configFile() {
10
17
  return path.join(configDir(), "config.json");
@@ -15,10 +22,12 @@ function projectsDir() {
15
22
  function getProjectRoot(cwd = process.cwd()) {
16
23
  let dir = path.resolve(cwd);
17
24
  const root = path.parse(dir).root;
25
+ const home = homeDir();
18
26
  while (dir !== root) {
19
- if (fs.existsSync(path.join(dir, ".one")) || fs.existsSync(path.join(dir, ".git")) || fs.existsSync(path.join(dir, "package.json"))) {
27
+ if (dir !== home && (fs.existsSync(path.join(dir, ".one")) || fs.existsSync(path.join(dir, ".git")) || fs.existsSync(path.join(dir, "package.json")))) {
20
28
  return dir;
21
29
  }
30
+ if (dir === home) break;
22
31
  dir = path.dirname(dir);
23
32
  }
24
33
  return path.resolve(cwd);
@@ -365,6 +374,7 @@ function writeUsageState(state) {
365
374
  }
366
375
 
367
376
  export {
377
+ homeDir,
368
378
  getProjectRoot,
369
379
  getProjectConfigPath,
370
380
  getGlobalConfigPath,
@@ -6,11 +6,11 @@ import {
6
6
  note,
7
7
  okJson,
8
8
  requireMemoryInit
9
- } from "./chunk-CLJFSFFM.js";
9
+ } from "./chunk-GNSR3NYN.js";
10
10
  import {
11
11
  getBackend,
12
12
  upsertRecord
13
- } from "./chunk-Z4KAQGIG.js";
13
+ } from "./chunk-DDCDPVJH.js";
14
14
 
15
15
  // src/commands/mem/migrate.ts
16
16
  import fs4 from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getMemoryConfigOrDefault
3
- } from "./chunk-C7DWZ7B5.js";
3
+ } from "./chunk-5O5KODGV.js";
4
4
  import {
5
5
  getOpenAiApiKey,
6
6
  readConfig
7
- } from "./chunk-SO323PZP.js";
7
+ } from "./chunk-EVEUGRCB.js";
8
8
 
9
9
  // src/lib/output.ts
10
10
  import * as p from "@clack/prompts";
@@ -3,10 +3,10 @@ import {
3
3
  isAgentMode,
4
4
  json,
5
5
  requireMemoryInit
6
- } from "./chunk-CLJFSFFM.js";
6
+ } from "./chunk-GNSR3NYN.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-Z4KAQGIG.js";
9
+ } from "./chunk-DDCDPVJH.js";
10
10
 
11
11
  // src/commands/mem/sql.ts
12
12
  async function memSqlCommand(sql) {
@@ -3,8 +3,9 @@ import {
3
3
  setByDotPath
4
4
  } from "./chunk-44CV5IMX.js";
5
5
  import {
6
- getCacheTtl
7
- } from "./chunk-SO323PZP.js";
6
+ getCacheTtl,
7
+ homeDir
8
+ } from "./chunk-EVEUGRCB.js";
8
9
 
9
10
  // src/lib/flow-runner.ts
10
11
  import fs3 from "fs";
@@ -13,7 +14,7 @@ import crypto from "crypto";
13
14
 
14
15
  // src/lib/flow-engine.ts
15
16
  import fs2 from "fs";
16
- import os2 from "os";
17
+ import os from "os";
17
18
  import path2 from "path";
18
19
  import { exec, spawn } from "child_process";
19
20
  import { promisify } from "util";
@@ -597,12 +598,11 @@ ${knowledge}`;
597
598
  // src/lib/cache.ts
598
599
  import fs from "fs";
599
600
  import path from "path";
600
- import os from "os";
601
601
  function knowledgeDir() {
602
- return path.join(os.homedir(), ".one", "cache", "knowledge");
602
+ return path.join(homeDir(), ".one", "cache", "knowledge");
603
603
  }
604
604
  function searchDir() {
605
- return path.join(os.homedir(), ".one", "cache", "search");
605
+ return path.join(homeDir(), ".one", "cache", "search");
606
606
  }
607
607
  function sanitizeFilename(input) {
608
608
  return input.replace(/[^a-zA-Z0-9_\-\.]/g, "_");
@@ -2354,7 +2354,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
2354
2354
  if (flowStack.includes(resolvedKey)) {
2355
2355
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
2356
2356
  }
2357
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-WZIYXW47.js");
2357
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-MVSJ2GB7.js");
2358
2358
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
2359
2359
  const subContext = await executeFlow(
2360
2360
  subFlow,
@@ -2458,7 +2458,7 @@ function resolveBashEnv(envConfig, context, stepId) {
2458
2458
  const resolved2 = resolveValue(obj.json, context);
2459
2459
  const json = JSON.stringify(resolved2 ?? null);
2460
2460
  const tmp = path2.join(
2461
- os2.tmpdir(),
2461
+ os.tmpdir(),
2462
2462
  `one-flow-${stepId}-${key}-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`
2463
2463
  );
2464
2464
  fs2.writeFileSync(tmp, json, { encoding: "utf-8" });
@@ -2,8 +2,8 @@ import {
2
2
  defaultSearchableText,
3
3
  embed,
4
4
  embedBatch
5
- } from "./chunk-C7DWZ7B5.js";
6
- import "./chunk-SO323PZP.js";
5
+ } from "./chunk-5O5KODGV.js";
6
+ import "./chunk-EVEUGRCB.js";
7
7
  export {
8
8
  defaultSearchableText,
9
9
  embed,
@@ -12,9 +12,9 @@ import {
12
12
  stripStepsAlias,
13
13
  summarizeFlowInputs,
14
14
  walkSteps
15
- } from "./chunk-K56Z5BTM.js";
15
+ } from "./chunk-WXJWF7QG.js";
16
16
  import "./chunk-44CV5IMX.js";
17
- import "./chunk-SO323PZP.js";
17
+ import "./chunk-EVEUGRCB.js";
18
18
  export {
19
19
  FlowRunner,
20
20
  collectStepTypes,
package/dist/index.js CHANGED
@@ -32,10 +32,10 @@ import {
32
32
  validateActionInput,
33
33
  walkSteps,
34
34
  writeCache
35
- } from "./chunk-K56Z5BTM.js";
35
+ } from "./chunk-WXJWF7QG.js";
36
36
  import {
37
37
  memSqlCommand
38
- } from "./chunk-UV4YYDF3.js";
38
+ } from "./chunk-OWDR5L3Q.js";
39
39
  import {
40
40
  collectIdentityKeys,
41
41
  countRecords,
@@ -65,7 +65,7 @@ import {
65
65
  writeDraftProfile,
66
66
  writePageToMemory,
67
67
  writeProfile
68
- } from "./chunk-ZOJW6IMU.js";
68
+ } from "./chunk-FKHUH223.js";
69
69
  import {
70
70
  getByDotPath
71
71
  } from "./chunk-44CV5IMX.js";
@@ -89,7 +89,7 @@ import {
89
89
  semanticSearchUpgradeLine,
90
90
  setAgentMode,
91
91
  silenceWarningsInAgentMode
92
- } from "./chunk-CLJFSFFM.js";
92
+ } from "./chunk-GNSR3NYN.js";
93
93
  import {
94
94
  SCHEMA_VERSION,
95
95
  addRecord,
@@ -99,7 +99,7 @@ import {
99
99
  listBackendPlugins,
100
100
  loadBackendFromConfig,
101
101
  updateRecord
102
- } from "./chunk-Z4KAQGIG.js";
102
+ } from "./chunk-DDCDPVJH.js";
103
103
  import {
104
104
  DEFAULT_MEMORY_CONFIG,
105
105
  defaultSearchableText,
@@ -109,7 +109,7 @@ import {
109
109
  memoryConfigExists,
110
110
  setOpenAiApiKey,
111
111
  updateMemoryConfig
112
- } from "./chunk-C7DWZ7B5.js";
112
+ } from "./chunk-5O5KODGV.js";
113
113
  import {
114
114
  appendAnalyticsQueue,
115
115
  appendUsageLog,
@@ -128,6 +128,7 @@ import {
128
128
  getProjectRoot,
129
129
  getWhoAmI,
130
130
  globalConfigExists,
131
+ homeDir,
131
132
  markTelemetryNoticeShown,
132
133
  projectConfigExists,
133
134
  readAnalyticsQueue,
@@ -144,7 +145,7 @@ import {
144
145
  writeConfig,
145
146
  writeUsageLog,
146
147
  writeUsageState
147
- } from "./chunk-SO323PZP.js";
148
+ } from "./chunk-EVEUGRCB.js";
148
149
 
149
150
  // src/cli.ts
150
151
  import { createRequire as createRequire3 } from "module";
@@ -156,17 +157,15 @@ import * as p3 from "@clack/prompts";
156
157
  import pc2 from "picocolors";
157
158
  import fs3 from "fs";
158
159
  import path3 from "path";
159
- import os3 from "os";
160
160
  import { fileURLToPath as fileURLToPath2 } from "url";
161
161
 
162
162
  // src/lib/agents.ts
163
163
  import fs from "fs";
164
164
  import path from "path";
165
- import os from "os";
166
165
  import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
167
166
  function expandPath(p10) {
168
167
  if (p10.startsWith("~/")) {
169
- return path.join(os.homedir(), p10.slice(2));
168
+ return path.join(homeDir(), p10.slice(2));
170
169
  }
171
170
  return p10;
172
171
  }
@@ -192,71 +191,73 @@ function getClaudeDesktopDetectDir() {
192
191
  }
193
192
  function getWindsurfConfigPath() {
194
193
  if (process.platform === "win32") {
195
- return path.join(process.env.USERPROFILE || os.homedir(), ".codeium", "windsurf", "mcp_config.json");
194
+ return path.join(homeDir(), ".codeium", "windsurf", "mcp_config.json");
196
195
  }
197
196
  return "~/.codeium/windsurf/mcp_config.json";
198
197
  }
199
198
  function getWindsurfDetectDir() {
200
199
  if (process.platform === "win32") {
201
- return path.join(process.env.USERPROFILE || os.homedir(), ".codeium", "windsurf");
200
+ return path.join(homeDir(), ".codeium", "windsurf");
202
201
  }
203
202
  return "~/.codeium/windsurf";
204
203
  }
205
204
  function getCursorConfigPath() {
206
205
  if (process.platform === "win32") {
207
- return path.join(process.env.USERPROFILE || os.homedir(), ".cursor", "mcp.json");
206
+ return path.join(homeDir(), ".cursor", "mcp.json");
208
207
  }
209
208
  return "~/.cursor/mcp.json";
210
209
  }
211
- var AGENTS = [
212
- {
213
- id: "claude-code",
214
- name: "Claude Code",
215
- configPath: "~/.claude.json",
216
- configKey: "mcpServers",
217
- detectDir: "~/.claude",
218
- projectConfigPath: ".mcp.json"
219
- },
220
- {
221
- id: "claude-desktop",
222
- name: "Claude Desktop",
223
- configPath: getClaudeDesktopConfigPath(),
224
- configKey: "mcpServers",
225
- detectDir: getClaudeDesktopDetectDir()
226
- },
227
- {
228
- id: "cursor",
229
- name: "Cursor",
230
- configPath: getCursorConfigPath(),
231
- configKey: "mcpServers",
232
- detectDir: "~/.cursor",
233
- projectConfigPath: ".cursor/mcp.json"
234
- },
235
- {
236
- id: "windsurf",
237
- name: "Windsurf",
238
- configPath: getWindsurfConfigPath(),
239
- configKey: "mcpServers",
240
- detectDir: getWindsurfDetectDir()
241
- },
242
- {
243
- id: "codex",
244
- name: "Codex",
245
- configPath: "~/.codex/config.toml",
246
- configKey: "mcp_servers",
247
- detectDir: "~/.codex",
248
- projectConfigPath: ".codex/config.toml",
249
- configFormat: "toml"
250
- },
251
- {
252
- id: "kiro",
253
- name: "Kiro",
254
- configPath: "~/.kiro/settings/mcp.json",
255
- configKey: "mcpServers",
256
- detectDir: "~/.kiro",
257
- projectConfigPath: ".kiro/settings/mcp.json"
258
- }
259
- ];
210
+ function getAgents() {
211
+ return [
212
+ {
213
+ id: "claude-code",
214
+ name: "Claude Code",
215
+ configPath: "~/.claude.json",
216
+ configKey: "mcpServers",
217
+ detectDir: "~/.claude",
218
+ projectConfigPath: ".mcp.json"
219
+ },
220
+ {
221
+ id: "claude-desktop",
222
+ name: "Claude Desktop",
223
+ configPath: getClaudeDesktopConfigPath(),
224
+ configKey: "mcpServers",
225
+ detectDir: getClaudeDesktopDetectDir()
226
+ },
227
+ {
228
+ id: "cursor",
229
+ name: "Cursor",
230
+ configPath: getCursorConfigPath(),
231
+ configKey: "mcpServers",
232
+ detectDir: "~/.cursor",
233
+ projectConfigPath: ".cursor/mcp.json"
234
+ },
235
+ {
236
+ id: "windsurf",
237
+ name: "Windsurf",
238
+ configPath: getWindsurfConfigPath(),
239
+ configKey: "mcpServers",
240
+ detectDir: getWindsurfDetectDir()
241
+ },
242
+ {
243
+ id: "codex",
244
+ name: "Codex",
245
+ configPath: "~/.codex/config.toml",
246
+ configKey: "mcp_servers",
247
+ detectDir: "~/.codex",
248
+ projectConfigPath: ".codex/config.toml",
249
+ configFormat: "toml"
250
+ },
251
+ {
252
+ id: "kiro",
253
+ name: "Kiro",
254
+ configPath: "~/.kiro/settings/mcp.json",
255
+ configKey: "mcpServers",
256
+ detectDir: "~/.kiro",
257
+ projectConfigPath: ".kiro/settings/mcp.json"
258
+ }
259
+ ];
260
+ }
260
261
  function getAgentConfigPath(agent, scope = "global") {
261
262
  if (scope === "project" && agent.projectConfigPath) {
262
263
  return path.join(process.cwd(), agent.projectConfigPath);
@@ -329,7 +330,7 @@ function isMcpInstalled(agent, scope = "global") {
329
330
  return mcpServers?.["one"] !== void 0;
330
331
  }
331
332
  function getAgentStatuses() {
332
- return AGENTS.map((agent) => {
333
+ return getAgents().map((agent) => {
333
334
  const detected = fs.existsSync(expandPath(agent.detectDir));
334
335
  const globalMcp = detected && isMcpInstalled(agent, "global");
335
336
  const projectMcp = agent.projectConfigPath ? isMcpInstalled(agent, "project") : null;
@@ -647,7 +648,6 @@ import open2 from "open";
647
648
 
648
649
  // src/lib/skill-sync.ts
649
650
  import fs2 from "fs";
650
- import os2 from "os";
651
651
  import path2 from "path";
652
652
  import { fileURLToPath } from "url";
653
653
 
@@ -655,13 +655,12 @@ import { fileURLToPath } from "url";
655
655
  import { createRequire } from "module";
656
656
  import { spawn } from "child_process";
657
657
  import { readFileSync, writeFileSync, mkdirSync, rmSync } from "fs";
658
- import { homedir } from "os";
659
658
  import { join } from "path";
660
659
  var require2 = createRequire(import.meta.url);
661
660
  var { version: currentVersion } = require2("../package.json");
662
- var ONE_DIR = join(homedir(), ".one");
663
- var CACHE_PATH = join(ONE_DIR, "update-check.json");
664
- var LOCK_PATH = join(ONE_DIR, "auto-update.lock");
661
+ var ONE_DIR = () => join(homeDir(), ".one");
662
+ var CACHE_PATH = () => join(ONE_DIR(), "update-check.json");
663
+ var LOCK_PATH = () => join(ONE_DIR(), "auto-update.lock");
665
664
  var CHECK_INTERVAL_MS = 4 * 60 * 60 * 1e3;
666
665
  var AGE_GATE_MS = 30 * 60 * 1e3;
667
666
  var LOCK_TTL_MS = 10 * 60 * 1e3;
@@ -679,15 +678,15 @@ async function fetchLatestVersionInfo() {
679
678
  }
680
679
  function readCache2() {
681
680
  try {
682
- return JSON.parse(readFileSync(CACHE_PATH, "utf8"));
681
+ return JSON.parse(readFileSync(CACHE_PATH(), "utf8"));
683
682
  } catch {
684
683
  return null;
685
684
  }
686
685
  }
687
686
  function writeCache2(latestVersion, publishedAt) {
688
687
  try {
689
- mkdirSync(join(homedir(), ".one"), { recursive: true });
690
- writeFileSync(CACHE_PATH, JSON.stringify({ lastCheck: Date.now(), latestVersion, publishedAt }));
688
+ mkdirSync(join(homeDir(), ".one"), { recursive: true });
689
+ writeFileSync(CACHE_PATH(), JSON.stringify({ lastCheck: Date.now(), latestVersion, publishedAt }));
691
690
  } catch {
692
691
  }
693
692
  }
@@ -767,19 +766,19 @@ function isAutoUpdateDisabled() {
767
766
  }
768
767
  function acquireUpdateLock(targetVersion) {
769
768
  try {
770
- mkdirSync(ONE_DIR, { recursive: true });
769
+ mkdirSync(ONE_DIR(), { recursive: true });
771
770
  } catch {
772
771
  }
773
772
  try {
774
- const lock = JSON.parse(readFileSync(LOCK_PATH, "utf8"));
773
+ const lock = JSON.parse(readFileSync(LOCK_PATH(), "utf8"));
775
774
  const startedAt = typeof lock.startedAt === "number" ? lock.startedAt : 0;
776
775
  if (Date.now() - startedAt < LOCK_TTL_MS) return false;
777
- rmSync(LOCK_PATH, { force: true });
776
+ rmSync(LOCK_PATH(), { force: true });
778
777
  } catch {
779
778
  }
780
779
  try {
781
780
  writeFileSync(
782
- LOCK_PATH,
781
+ LOCK_PATH(),
783
782
  JSON.stringify({ pid: process.pid, startedAt: Date.now(), targetVersion }),
784
783
  { flag: "wx" }
785
784
  // fail if another invocation created it first
@@ -803,7 +802,7 @@ function autoUpdate(targetVersion, publishedAt) {
803
802
  });
804
803
  child.on("error", () => {
805
804
  try {
806
- rmSync(LOCK_PATH, { force: true });
805
+ rmSync(LOCK_PATH(), { force: true });
807
806
  } catch {
808
807
  }
809
808
  });
@@ -818,7 +817,7 @@ function getPackagedSkillDir() {
818
817
  return path2.resolve(here, "..", "skills", "one");
819
818
  }
820
819
  function getCanonicalSkillPath() {
821
- return path2.join(os2.homedir(), CANONICAL_SKILL_DIR, "one");
820
+ return path2.join(homeDir(), CANONICAL_SKILL_DIR, "one");
822
821
  }
823
822
  function getVersionMarkerPath() {
824
823
  return path2.join(getCanonicalSkillPath(), VERSION_MARKER);
@@ -1292,7 +1291,7 @@ async function chooseConfigScope(options) {
1292
1291
  return which;
1293
1292
  }
1294
1293
  function tildify(filePath) {
1295
- const home = os3.homedir();
1294
+ const home = homeDir();
1296
1295
  return filePath.startsWith(home) ? "~" + filePath.slice(home.length) : filePath;
1297
1296
  }
1298
1297
  function scopeLabel(scope) {
@@ -1529,10 +1528,10 @@ function getSkillSourceDir() {
1529
1528
  return path3.resolve(__dirname2, "..", "skills", "one");
1530
1529
  }
1531
1530
  function getCanonicalSkillPath2() {
1532
- return path3.join(os3.homedir(), CANONICAL_SKILL_DIR2, "one");
1531
+ return path3.join(homeDir(), CANONICAL_SKILL_DIR2, "one");
1533
1532
  }
1534
1533
  function getAgentSkillPath(agent) {
1535
- return path3.join(os3.homedir(), agent.skillDir, "one");
1534
+ return path3.join(homeDir(), agent.skillDir, "one");
1536
1535
  }
1537
1536
  function isSkillInstalled2() {
1538
1537
  return fs3.existsSync(path3.join(getCanonicalSkillPath2(), "SKILL.md"));
@@ -6053,7 +6052,7 @@ async function syncModel(api, profile, options) {
6053
6052
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
6054
6053
  (async () => {
6055
6054
  try {
6056
- const { getBackend: getBackend2 } = await import("./runtime-HDZCBTWH.js");
6055
+ const { getBackend: getBackend2 } = await import("./runtime-AFXLC4IC.js");
6057
6056
  const backend = await getBackend2();
6058
6057
  await Promise.race([
6059
6058
  backend.close(),
@@ -6419,7 +6418,7 @@ async function syncModel(api, profile, options) {
6419
6418
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
6420
6419
  }
6421
6420
  if (options.toMemory !== false) {
6422
- const backend = await (await import("./runtime-HDZCBTWH.js")).getBackend();
6421
+ const backend = await (await import("./runtime-AFXLC4IC.js")).getBackend();
6423
6422
  const type = `${platform}/${model}`;
6424
6423
  const existing = await backend.listKeysByType(type);
6425
6424
  const sourcePrefix = `${type}:`;
@@ -6505,7 +6504,7 @@ async function syncModel(api, profile, options) {
6505
6504
  let statusCounts;
6506
6505
  if (options.toMemory !== false) {
6507
6506
  try {
6508
- const backend = await (await import("./runtime-HDZCBTWH.js")).getBackend();
6507
+ const backend = await (await import("./runtime-AFXLC4IC.js")).getBackend();
6509
6508
  const typeName = `${platform}/${model}`;
6510
6509
  const [active, archived] = await Promise.all([
6511
6510
  backend.count(typeName, { status: "active" }),
@@ -7035,19 +7034,18 @@ function inferProfileFromKnowledge(knowledge, modelName, platform) {
7035
7034
  // src/lib/memory/sync/schedule.ts
7036
7035
  import { spawnSync as spawnSync2 } from "child_process";
7037
7036
  import fs10 from "fs";
7038
- import os5 from "os";
7037
+ import os from "os";
7039
7038
  import path10 from "path";
7040
7039
 
7041
7040
  // src/lib/memory/sync/schedule-registry.ts
7042
7041
  import fs9 from "fs";
7043
- import os4 from "os";
7044
7042
  import path9 from "path";
7045
- var REGISTRY_DIR = path9.join(os4.homedir(), ".one", "sync");
7046
- var REGISTRY_FILE = path9.join(REGISTRY_DIR, "schedules.json");
7043
+ var REGISTRY_DIR = () => path9.join(homeDir(), ".one", "sync");
7044
+ var REGISTRY_FILE = () => path9.join(REGISTRY_DIR(), "schedules.json");
7047
7045
  function readRaw() {
7048
7046
  try {
7049
- if (!fs9.existsSync(REGISTRY_FILE)) return { schedules: [] };
7050
- const raw = fs9.readFileSync(REGISTRY_FILE, "utf-8");
7047
+ if (!fs9.existsSync(REGISTRY_FILE())) return { schedules: [] };
7048
+ const raw = fs9.readFileSync(REGISTRY_FILE(), "utf-8");
7051
7049
  const parsed = JSON.parse(raw);
7052
7050
  if (!parsed || !Array.isArray(parsed.schedules)) return { schedules: [] };
7053
7051
  return parsed;
@@ -7056,10 +7054,10 @@ function readRaw() {
7056
7054
  }
7057
7055
  }
7058
7056
  function writeRaw(file) {
7059
- fs9.mkdirSync(REGISTRY_DIR, { recursive: true });
7060
- const tmp = REGISTRY_FILE + ".tmp";
7057
+ fs9.mkdirSync(REGISTRY_DIR(), { recursive: true });
7058
+ const tmp = REGISTRY_FILE() + ".tmp";
7061
7059
  fs9.writeFileSync(tmp, JSON.stringify(file, null, 2));
7062
- fs9.renameSync(tmp, REGISTRY_FILE);
7060
+ fs9.renameSync(tmp, REGISTRY_FILE());
7063
7061
  }
7064
7062
  function makeScheduleId(platform, cwd) {
7065
7063
  const slug = path9.basename(cwd).replace(/[^a-zA-Z0-9_-]/g, "-").toLowerCase();
@@ -7129,7 +7127,7 @@ function cronExprToDuration(expr) {
7129
7127
  return null;
7130
7128
  }
7131
7129
  function isWindows() {
7132
- return os5.platform() === "win32";
7130
+ return os.platform() === "win32";
7133
7131
  }
7134
7132
  function resolveOneBinary() {
7135
7133
  try {
@@ -8194,7 +8192,7 @@ ${result.total} results`);
8194
8192
  }
8195
8193
  }
8196
8194
  async function syncSqlCommand(platformModel, sql) {
8197
- const { syncSqlCommand: runSyncSql } = await import("./sql-AZDCMY7G.js");
8195
+ const { syncSqlCommand: runSyncSql } = await import("./sql-3WNYRCWP.js");
8198
8196
  await runSyncSql(platformModel, sql);
8199
8197
  }
8200
8198
  async function syncDeleteCommand(platformModel, options) {
@@ -8272,7 +8270,7 @@ async function syncDeleteCommand(platformModel, options) {
8272
8270
  async function maybeAutoMigrateLegacy(platform, models) {
8273
8271
  const dbSize = getDatabaseSize(platform);
8274
8272
  if (!dbSize || dbSize === "0 B") return;
8275
- const { getBackend: getBackend2 } = await import("./runtime-HDZCBTWH.js");
8273
+ const { getBackend: getBackend2 } = await import("./runtime-AFXLC4IC.js");
8276
8274
  const backend = await getBackend2();
8277
8275
  let memoryHasData = false;
8278
8276
  for (const model of models) {
@@ -8288,7 +8286,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
8288
8286
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
8289
8287
  `
8290
8288
  );
8291
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-LXDIZMXH.js");
8289
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-LA7I3OQN.js");
8292
8290
  await memMigrateCommand3({ platform, yes: true });
8293
8291
  return;
8294
8292
  }
@@ -8297,7 +8295,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
8297
8295
  initialValue: true
8298
8296
  });
8299
8297
  if (p7.isCancel(shouldMigrate) || !shouldMigrate) return;
8300
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-LXDIZMXH.js");
8298
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-LA7I3OQN.js");
8301
8299
  await memMigrateCommand2({ platform, yes: true });
8302
8300
  }
8303
8301
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -8358,7 +8356,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
8358
8356
  async function syncListCommand(platform) {
8359
8357
  const profiles = listProfiles(platform);
8360
8358
  const state = await readSyncState();
8361
- const { getBackend: getBackend2 } = await import("./runtime-HDZCBTWH.js");
8359
+ const { getBackend: getBackend2 } = await import("./runtime-AFXLC4IC.js");
8362
8360
  const backend = await getBackend2();
8363
8361
  const syncs = await Promise.all(profiles.map(async (p10) => {
8364
8362
  const modelState = state[p10.platform]?.[p10.model];
@@ -8633,7 +8631,7 @@ function registerSyncSubcommands(sync) {
8633
8631
  await syncSqlCommand(platformModel, sql);
8634
8632
  });
8635
8633
  sync.command("schema <platform/model>").description("Inspect the JSON structure of synced records (field paths, types, examples) \u2014 useful before writing `sync sql` queries").action(async (platformModel) => {
8636
- const { syncSchemaCommand } = await import("./schema-SYMG6SRC.js");
8634
+ const { syncSchemaCommand } = await import("./schema-4JJO2CIZ.js");
8637
8635
  await syncSchemaCommand(platformModel);
8638
8636
  });
8639
8637
  sync.command("delete <platform/model>").description('Delete records from local sync data (e.g. one sync delete notion/pages --id "abc-123")').option("--id <value>", "Delete record by ID").option("--where <conditions>", 'Delete records matching conditions (e.g. "status=archived")').option("--where-sql <predicate>", `Delete using a raw SQL WHERE clause (e.g. "json_extract(data, '$.type') = 'promotion'")`).option("--yes", "Skip confirmation prompt").action(async (platformModel, options) => {
@@ -9410,7 +9408,7 @@ async function memDoctorCommand() {
9410
9408
  }
9411
9409
  if (cfg.embedding.provider === "openai") {
9412
9410
  try {
9413
- const { embed: embed2 } = await import("./embedding-2YB6CGBA.js");
9411
+ const { embed: embed2 } = await import("./embedding-Z2WCDN6R.js");
9414
9412
  const result = await embed2("connectivity check");
9415
9413
  checks.push({
9416
9414
  name: "OpenAI embedding provider reachable",
@@ -3,12 +3,12 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-ZOJW6IMU.js";
6
+ } from "./chunk-FKHUH223.js";
7
7
  import "./chunk-44CV5IMX.js";
8
- import "./chunk-CLJFSFFM.js";
9
- import "./chunk-Z4KAQGIG.js";
10
- import "./chunk-C7DWZ7B5.js";
11
- import "./chunk-SO323PZP.js";
8
+ import "./chunk-GNSR3NYN.js";
9
+ import "./chunk-DDCDPVJH.js";
10
+ import "./chunk-5O5KODGV.js";
11
+ import "./chunk-EVEUGRCB.js";
12
12
  export {
13
13
  buildIdentityMap,
14
14
  dotPathToJsonbExpr,
@@ -5,9 +5,9 @@ import {
5
5
  resetBackendSingleton,
6
6
  updateRecord,
7
7
  upsertRecord
8
- } from "./chunk-Z4KAQGIG.js";
9
- import "./chunk-C7DWZ7B5.js";
10
- import "./chunk-SO323PZP.js";
8
+ } from "./chunk-DDCDPVJH.js";
9
+ import "./chunk-5O5KODGV.js";
10
+ import "./chunk-EVEUGRCB.js";
11
11
  export {
12
12
  addRecord,
13
13
  closeBackendIfCached,
@@ -3,12 +3,12 @@ import {
3
3
  note,
4
4
  okJson,
5
5
  requireMemoryInit
6
- } from "./chunk-CLJFSFFM.js";
6
+ } from "./chunk-GNSR3NYN.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-Z4KAQGIG.js";
10
- import "./chunk-C7DWZ7B5.js";
11
- import "./chunk-SO323PZP.js";
9
+ } from "./chunk-DDCDPVJH.js";
10
+ import "./chunk-5O5KODGV.js";
11
+ import "./chunk-EVEUGRCB.js";
12
12
 
13
13
  // src/lib/memory/sync/schema.ts
14
14
  import pc from "picocolors";
@@ -0,0 +1,12 @@
1
+ import {
2
+ memSqlCommand,
3
+ syncSqlCommand
4
+ } from "./chunk-OWDR5L3Q.js";
5
+ import "./chunk-GNSR3NYN.js";
6
+ import "./chunk-DDCDPVJH.js";
7
+ import "./chunk-5O5KODGV.js";
8
+ import "./chunk-EVEUGRCB.js";
9
+ export {
10
+ memSqlCommand,
11
+ syncSqlCommand
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.52.0",
3
+ "version": "1.52.2",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,7 +23,7 @@
23
23
  "dev": "tsup --watch",
24
24
  "start": "node bin/cli.js",
25
25
  "typecheck": "tsc --noEmit",
26
- "test": "tsx --test \"src/**/*.test.ts\"",
26
+ "test": "node scripts/run-tests.mjs",
27
27
  "prepare": "tsup"
28
28
  },
29
29
  "dependencies": {
@@ -5,7 +5,7 @@ The One CLI can be configured at two scopes:
5
5
  - **Global** — `~/.one/config.json`. Applies everywhere the user runs `one`.
6
6
  - **Project** — `~/.one/projects/<slug>/config.json`, where `<slug>` is the project root path with path separators (and any character Windows forbids in a path component) replaced by dashes (e.g. `/Users/jane/acme` → `-Users-jane-acme`; on Windows, `C:\Users\jane\acme` → `C--Users-jane-acme`). Only applies when running `one` from inside that project folder.
7
7
 
8
- **Detecting the project root.** The CLI walks up from cwd looking for `.one`, `.git`, or `package.json` and treats the nearest hit as the project root — `.one` is checked first so a monorepo subproject can opt into being its own root with `mkdir .one`. Without a `.one` opt-in, every cwd under a parent `.git`/`package.json` shares one project config keyed by that parent.
8
+ **Detecting the project root.** The CLI walks up from cwd looking for `.one`, `.git`, or `package.json` and treats the nearest hit as the project root — `.one` is checked first so a monorepo subproject can opt into being its own root with `mkdir .one`. Without a `.one` opt-in, every cwd under a parent `.git`/`package.json` shares one project config keyed by that parent. Exception: `$HOME` itself is never a project root — `~/.one` is the CLI's own config directory (not an opt-in marker), and a dotfiles `.git` or stray `package.json` in home must not shadow the global config for every directory under it. If a marker-less dir should be its own project, `mkdir .one` inside it before picking project scope.
9
9
 
10
10
  **Resolution order:** env vars → `.onerc` in cwd → project config → global config. The project lookup walks from cwd up — the nearest ancestor that has a config under `~/.one/projects/<slug>/config.json` wins, so cwd's own slug is checked before any parent's.
11
11
 
@@ -1,12 +0,0 @@
1
- import {
2
- memSqlCommand,
3
- syncSqlCommand
4
- } from "./chunk-UV4YYDF3.js";
5
- import "./chunk-CLJFSFFM.js";
6
- import "./chunk-Z4KAQGIG.js";
7
- import "./chunk-C7DWZ7B5.js";
8
- import "./chunk-SO323PZP.js";
9
- export {
10
- memSqlCommand,
11
- syncSqlCommand
12
- };