@withone/cli 1.43.2 → 1.43.4

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-MRGKKO54.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-5TT27ORC.js";
9
+ } from "./chunk-IAFQVFCB.js";
10
10
 
11
11
  // src/commands/mem/sql.ts
12
12
  async function memSqlCommand(sql) {
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  getBackend,
12
12
  upsertRecord
13
- } from "./chunk-5TT27ORC.js";
13
+ } from "./chunk-IAFQVFCB.js";
14
14
 
15
15
  // src/commands/mem/migrate.ts
16
16
  import fs4 from "fs";
@@ -1648,6 +1648,15 @@ function bootstrapMemoryDefaults() {
1648
1648
  function resetBackendSingleton() {
1649
1649
  cached = null;
1650
1650
  }
1651
+ async function closeBackendIfCached() {
1652
+ if (!cached) return;
1653
+ try {
1654
+ const backend = await cached;
1655
+ await backend.close();
1656
+ } catch {
1657
+ }
1658
+ cached = null;
1659
+ }
1651
1660
  async function addRecord(input, opts = {}) {
1652
1661
  const backend = await getBackend();
1653
1662
  const { searchable_text, content_hash, embedding, embedding_model } = await prepareRecord(input, opts, "add");
@@ -1693,6 +1702,7 @@ export {
1693
1702
  loadBackendFromConfig,
1694
1703
  getBackend,
1695
1704
  resetBackendSingleton,
1705
+ closeBackendIfCached,
1696
1706
  addRecord,
1697
1707
  upsertRecord
1698
1708
  };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-EMAQVPRD.js";
22
22
  import {
23
23
  memSqlCommand
24
- } from "./chunk-7N5EJTYW.js";
24
+ } from "./chunk-3ZJVO4GP.js";
25
25
  import {
26
26
  countRecords,
27
27
  deleteDatabase,
@@ -46,7 +46,7 @@ import {
46
46
  upsertRecords,
47
47
  writeDraftProfile,
48
48
  writeProfile
49
- } from "./chunk-AD4QM6R5.js";
49
+ } from "./chunk-C3ORS3RG.js";
50
50
  import {
51
51
  getByDotPath
52
52
  } from "./chunk-44CV5IMX.js";
@@ -73,12 +73,13 @@ import {
73
73
  import {
74
74
  SCHEMA_VERSION,
75
75
  addRecord,
76
+ closeBackendIfCached,
76
77
  getBackend,
77
78
  getBackendPlugin,
78
79
  listBackendPlugins,
79
80
  loadBackendFromConfig,
80
81
  upsertRecord
81
- } from "./chunk-5TT27ORC.js";
82
+ } from "./chunk-IAFQVFCB.js";
82
83
  import {
83
84
  DEFAULT_MEMORY_CONFIG,
84
85
  configExists,
@@ -1978,8 +1979,9 @@ async function connectionListCommand(options) {
1978
1979
  const accessFiltered = allowedKeys.includes("*") ? allConnections : allConnections.filter((conn) => allowedKeys.includes(conn.key));
1979
1980
  const searchQuery = options?.search?.toLowerCase();
1980
1981
  const filtered = searchQuery ? accessFiltered.filter((conn) => conn.platform.toLowerCase().includes(searchQuery)) : accessFiltered;
1982
+ const limitArg = options?.limit ? parseInt(options.limit, 10) : void 0;
1981
1983
  if (isAgentMode()) {
1982
- const limit = options?.limit ? parseInt(options.limit, 10) : 20;
1984
+ const limit = limitArg ?? 20;
1983
1985
  const limited = filtered.slice(0, limit);
1984
1986
  json({
1985
1987
  total: filtered.length,
@@ -1998,6 +2000,7 @@ async function connectionListCommand(options) {
1998
2000
  });
1999
2001
  return;
2000
2002
  }
2003
+ const displayed = limitArg !== void 0 ? filtered.slice(0, limitArg) : filtered;
2001
2004
  spinner5.stop(`${filtered.length} connection${filtered.length === 1 ? "" : "s"} found`);
2002
2005
  if (filtered.length === 0) {
2003
2006
  if (searchQuery) {
@@ -2018,7 +2021,7 @@ Add one with: ${pc4.cyan("one connection add gmail")}`,
2018
2021
  return;
2019
2022
  }
2020
2023
  console.log();
2021
- const rows = filtered.map((conn) => ({
2024
+ const rows = displayed.map((conn) => ({
2022
2025
  status: getStatusIndicator(conn.state),
2023
2026
  platform: conn.platform,
2024
2027
  state: conn.state,
@@ -2037,7 +2040,14 @@ Add one with: ${pc4.cyan("one connection add gmail")}`,
2037
2040
  rows
2038
2041
  );
2039
2042
  console.log();
2040
- p4.note(`Add more with: ${pc4.cyan("one connection add <platform>")}`, "Tip");
2043
+ if (displayed.length < filtered.length) {
2044
+ p4.note(
2045
+ `Showing ${displayed.length} of ${filtered.length}. Increase --limit or run without it to see all.`,
2046
+ "Limited"
2047
+ );
2048
+ } else {
2049
+ p4.note(`Add more with: ${pc4.cyan("one connection add <platform>")}`, "Tip");
2050
+ }
2041
2051
  } catch (error2) {
2042
2052
  spinner5.stop("Failed to load connections");
2043
2053
  error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
@@ -5681,7 +5691,7 @@ async function syncModel(api, profile, options) {
5681
5691
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
5682
5692
  (async () => {
5683
5693
  try {
5684
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
5694
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
5685
5695
  const backend = await getBackend2();
5686
5696
  await Promise.race([
5687
5697
  backend.close(),
@@ -6036,7 +6046,7 @@ async function syncModel(api, profile, options) {
6036
6046
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
6037
6047
  }
6038
6048
  if (options.toMemory !== false) {
6039
- const backend = await (await import("./runtime-O3PX562N.js")).getBackend();
6049
+ const backend = await (await import("./runtime-NVC7KAJZ.js")).getBackend();
6040
6050
  const type = `${platform}/${model}`;
6041
6051
  const existing = await backend.listKeysByType(type);
6042
6052
  const sourcePrefix = `${type}:`;
@@ -6116,7 +6126,7 @@ async function syncModel(api, profile, options) {
6116
6126
  let statusCounts;
6117
6127
  if (options.toMemory !== false) {
6118
6128
  try {
6119
- const backend = await (await import("./runtime-O3PX562N.js")).getBackend();
6129
+ const backend = await (await import("./runtime-NVC7KAJZ.js")).getBackend();
6120
6130
  const typeName = `${platform}/${model}`;
6121
6131
  const [active, archived] = await Promise.all([
6122
6132
  backend.count(typeName, { status: "active" }),
@@ -7735,7 +7745,7 @@ ${result.total} results`);
7735
7745
  }
7736
7746
  }
7737
7747
  async function syncSqlCommand(platformModel, sql) {
7738
- const { syncSqlCommand: runSyncSql } = await import("./sql-JEBAPGJP.js");
7748
+ const { syncSqlCommand: runSyncSql } = await import("./sql-EGTWQIU5.js");
7739
7749
  await runSyncSql(platformModel, sql);
7740
7750
  }
7741
7751
  async function syncDeleteCommand(platformModel, options) {
@@ -7813,7 +7823,7 @@ async function syncDeleteCommand(platformModel, options) {
7813
7823
  async function maybeAutoMigrateLegacy(platform, models) {
7814
7824
  const dbSize = getDatabaseSize(platform);
7815
7825
  if (!dbSize || dbSize === "0 B") return;
7816
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
7826
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
7817
7827
  const backend = await getBackend2();
7818
7828
  let memoryHasData = false;
7819
7829
  for (const model of models) {
@@ -7829,7 +7839,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
7829
7839
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
7830
7840
  `
7831
7841
  );
7832
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-LHFWCO6M.js");
7842
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-BEARUBLO.js");
7833
7843
  await memMigrateCommand3({ platform, yes: true });
7834
7844
  return;
7835
7845
  }
@@ -7838,7 +7848,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
7838
7848
  initialValue: true
7839
7849
  });
7840
7850
  if (p7.isCancel(shouldMigrate) || !shouldMigrate) return;
7841
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-LHFWCO6M.js");
7851
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-BEARUBLO.js");
7842
7852
  await memMigrateCommand2({ platform, yes: true });
7843
7853
  }
7844
7854
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -7899,7 +7909,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
7899
7909
  async function syncListCommand(platform) {
7900
7910
  const profiles = listProfiles(platform);
7901
7911
  const state = await readSyncState();
7902
- const { getBackend: getBackend2 } = await import("./runtime-O3PX562N.js");
7912
+ const { getBackend: getBackend2 } = await import("./runtime-NVC7KAJZ.js");
7903
7913
  const backend = await getBackend2();
7904
7914
  const syncs = await Promise.all(profiles.map(async (p10) => {
7905
7915
  const modelState = state[p10.platform]?.[p10.model];
@@ -10713,6 +10723,7 @@ program.hook("preAction", (thisCommand) => {
10713
10723
  }
10714
10724
  });
10715
10725
  program.hook("postAction", async () => {
10726
+ await closeBackendIfCached();
10716
10727
  if (!updateCheckPromise) return;
10717
10728
  const info = await updateCheckPromise;
10718
10729
  if (!info) return;
@@ -11050,7 +11061,7 @@ program.command("whoami").description("Show the user, organization, and project
11050
11061
  program.command("add [platform]").description("Shortcut for: connection add").action(async (platform) => {
11051
11062
  await connectionAddCommand(platform);
11052
11063
  });
11053
- program.command("list").alias("ls").description("Shortcut for: connection list").action(async () => {
11054
- await connectionListCommand();
11064
+ program.command("list").alias("ls").description("Shortcut for: connection list").option("-s, --search <query>", "Filter connections by platform name").option("-l, --limit <n>", "Max connections to return (agent mode default: 20)").action(async (options) => {
11065
+ await connectionListCommand(options);
11055
11066
  });
11056
11067
  program.parse();
@@ -3,10 +3,10 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-AD4QM6R5.js";
6
+ } from "./chunk-C3ORS3RG.js";
7
7
  import "./chunk-44CV5IMX.js";
8
8
  import "./chunk-MRGKKO54.js";
9
- import "./chunk-5TT27ORC.js";
9
+ import "./chunk-IAFQVFCB.js";
10
10
  import "./chunk-AU2ZEEMS.js";
11
11
  export {
12
12
  buildIdentityMap,
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  addRecord,
3
+ closeBackendIfCached,
3
4
  getBackend,
4
5
  resetBackendSingleton,
5
6
  upsertRecord
6
- } from "./chunk-5TT27ORC.js";
7
+ } from "./chunk-IAFQVFCB.js";
7
8
  import "./chunk-AU2ZEEMS.js";
8
9
  export {
9
10
  addRecord,
11
+ closeBackendIfCached,
10
12
  getBackend,
11
13
  resetBackendSingleton,
12
14
  upsertRecord
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  memSqlCommand,
3
3
  syncSqlCommand
4
- } from "./chunk-7N5EJTYW.js";
4
+ } from "./chunk-3ZJVO4GP.js";
5
5
  import "./chunk-MRGKKO54.js";
6
- import "./chunk-5TT27ORC.js";
6
+ import "./chunk-IAFQVFCB.js";
7
7
  import "./chunk-AU2ZEEMS.js";
8
8
  export {
9
9
  memSqlCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.43.2",
3
+ "version": "1.43.4",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [