conare 0.5.16 → 0.5.18

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/index.js +60 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1898,7 +1898,7 @@ async function promptAuth(options) {
1898
1898
  }
1899
1899
  async function selectChatSources(targets) {
1900
1900
  return ensureValue(await fe({
1901
- message: "Select chat sources to index",
1901
+ message: "Select chat sources to index (space to toggle, enter to confirm)",
1902
1902
  required: false,
1903
1903
  initialValues: targets.filter((target) => target.available !== false && (target.detectedCount ?? 0) > 0).map((target) => target.id),
1904
1904
  options: targets.map((target) => ({
@@ -1910,7 +1910,7 @@ async function selectChatSources(targets) {
1910
1910
  }
1911
1911
  async function selectMcpTargets(targets) {
1912
1912
  return ensureValue(await fe({
1913
- message: "Select where to install the MCP",
1913
+ message: "Select where to install the MCP (space to toggle, enter to confirm)",
1914
1914
  required: false,
1915
1915
  initialValues: targets.filter((target) => target.available !== false && (target.detectedCount ?? 0) > 0).map((target) => target.id),
1916
1916
  options: targets.map((target) => ({
@@ -3454,43 +3454,64 @@ function configureMcp(apiKey, targets = ["claude", "codex"]) {
3454
3454
  }
3455
3455
 
3456
3456
  // src/config.ts
3457
- import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "node:fs";
3457
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync7, unlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
3458
3458
  import { join as join8 } from "node:path";
3459
3459
  import { homedir as homedir7 } from "node:os";
3460
- var CONFIG_DIR = join8(homedir7(), ".conare");
3461
- var CONFIG_PATH = join8(CONFIG_DIR, "config.json");
3462
3460
  function readConfig() {
3461
+ const configPath = getConfigPath();
3463
3462
  try {
3464
- if (!existsSync8(CONFIG_PATH))
3463
+ if (!existsSync8(configPath))
3465
3464
  return {};
3466
- return JSON.parse(readFileSync7(CONFIG_PATH, "utf-8"));
3465
+ return JSON.parse(readFileSync7(configPath, "utf-8"));
3467
3466
  } catch {
3468
3467
  return {};
3469
3468
  }
3470
3469
  }
3471
3470
  function writeConfig(config) {
3472
- mkdirSync3(CONFIG_DIR, { recursive: true, mode: 448 });
3473
- writeFileSync3(CONFIG_PATH, JSON.stringify(config, null, 2) + `
3471
+ mkdirSync3(getConfigDir(), { recursive: true, mode: 448 });
3472
+ writeFileSync3(getConfigPath(), JSON.stringify(config, null, 2) + `
3474
3473
  `, { mode: 384 });
3475
3474
  }
3475
+ function getConfigDir() {
3476
+ return join8(homedir7(), ".conare");
3477
+ }
3478
+ function getConfigPath() {
3479
+ return join8(getConfigDir(), "config.json");
3480
+ }
3476
3481
  function saveApiKey(apiKey) {
3477
3482
  const config = readConfig();
3478
3483
  config.apiKey = apiKey;
3484
+ delete config.key;
3479
3485
  writeConfig(config);
3480
3486
  }
3481
3487
  function getSavedApiKey() {
3482
- return readConfig().apiKey;
3488
+ const config = readConfig();
3489
+ return config.apiKey || config.key;
3490
+ }
3491
+ function clearSavedApiKey() {
3492
+ const config = readConfig();
3493
+ const hadApiKey = !!(config.apiKey || config.key);
3494
+ delete config.apiKey;
3495
+ delete config.key;
3496
+ if (Object.keys(config).length === 0) {
3497
+ const configPath = getConfigPath();
3498
+ if (existsSync8(configPath))
3499
+ unlinkSync(configPath);
3500
+ } else {
3501
+ writeConfig(config);
3502
+ }
3503
+ return hadApiKey;
3483
3504
  }
3484
3505
 
3485
3506
  // src/sync.ts
3486
- import { existsSync as existsSync9, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4, unlinkSync, readFileSync as readFileSync8, chmodSync, cpSync, rmSync as rmSync2, symlinkSync as symlinkSync2, readlinkSync as readlinkSync2, appendFileSync } from "node:fs";
3507
+ import { existsSync as existsSync9, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, readFileSync as readFileSync8, chmodSync, cpSync, rmSync as rmSync2, symlinkSync as symlinkSync2, readlinkSync as readlinkSync2, appendFileSync } from "node:fs";
3487
3508
  import { join as join9, dirname as dirname3 } from "node:path";
3488
3509
  import { homedir as homedir8, platform as platform6 } from "node:os";
3489
3510
  import { execSync as execSync3 } from "node:child_process";
3490
3511
  import { createRequire as createRequire3 } from "node:module";
3491
3512
  var CONARE_DIR = join9(homedir8(), ".conare");
3492
3513
  var BIN_DIR = join9(CONARE_DIR, "bin");
3493
- var CONFIG_PATH2 = join9(CONARE_DIR, "config.json");
3514
+ var CONFIG_PATH = join9(CONARE_DIR, "config.json");
3494
3515
  var PLIST_LABEL = "ai.conare.ingest";
3495
3516
  var PLIST_PATH = join9(homedir8(), "Library", "LaunchAgents", `${PLIST_LABEL}.plist`);
3496
3517
  var SYSTEMD_DIR = join9(homedir8(), ".config", "systemd", "user");
@@ -3654,7 +3675,7 @@ function persistBinary(apiKey) {
3654
3675
  writeFileSync4(runCmdPath, RUN_CMD);
3655
3676
  const runVbsPath = join9(BIN_DIR, "run.vbs");
3656
3677
  writeFileSync4(runVbsPath, RUN_VBS);
3657
- writeFileSync4(CONFIG_PATH2, JSON.stringify({ apiKey }, null, 2) + `
3678
+ writeFileSync4(CONFIG_PATH, JSON.stringify({ apiKey }, null, 2) + `
3658
3679
  `, { mode: 384 });
3659
3680
  }
3660
3681
  function isValidJsBundle(path) {
@@ -3712,7 +3733,7 @@ function cleanupOldLaunchAgent() {
3712
3733
  execSync3(`launchctl bootout gui/${uid()} "${PLIST_PATH}" 2>/dev/null`, { stdio: "ignore" });
3713
3734
  } catch {}
3714
3735
  if (existsSync9(PLIST_PATH)) {
3715
- unlinkSync(PLIST_PATH);
3736
+ unlinkSync2(PLIST_PATH);
3716
3737
  }
3717
3738
  }
3718
3739
  function setupLinuxSystemd(intervalMinutes) {
@@ -3830,7 +3851,7 @@ exec "$NODE" "$CONARE_DIR/bin/conare-ingest.mjs" "$@"
3830
3851
  if (existing === wrapper)
3831
3852
  return "Global command: conare (already linked)";
3832
3853
  } catch {}
3833
- unlinkSync(symlinkTarget);
3854
+ unlinkSync2(symlinkTarget);
3834
3855
  }
3835
3856
  symlinkSync2(wrapper, symlinkTarget);
3836
3857
  return "Global command: conare (linked to /usr/local/bin)";
@@ -3925,7 +3946,7 @@ function installSync(apiKey, intervalMinutes = 10) {
3925
3946
  messages.push("First sync scheduled");
3926
3947
  return messages;
3927
3948
  }
3928
- function uninstallSync() {
3949
+ function removeSyncTimer() {
3929
3950
  const messages = [];
3930
3951
  const os = platform6();
3931
3952
  if (os === "darwin") {
@@ -3942,9 +3963,9 @@ function uninstallSync() {
3942
3963
  execSync3("systemctl --user disable --now conare-sync.timer 2>/dev/null", { stdio: "ignore" });
3943
3964
  } catch {}
3944
3965
  if (existsSync9(SYSTEMD_SERVICE))
3945
- unlinkSync(SYSTEMD_SERVICE);
3966
+ unlinkSync2(SYSTEMD_SERVICE);
3946
3967
  if (existsSync9(SYSTEMD_TIMER))
3947
- unlinkSync(SYSTEMD_TIMER);
3968
+ unlinkSync2(SYSTEMD_TIMER);
3948
3969
  try {
3949
3970
  execSync3("systemctl --user daemon-reload", { stdio: "ignore" });
3950
3971
  } catch {}
@@ -3953,15 +3974,21 @@ function uninstallSync() {
3953
3974
  removeCronEntry() && messages.push("Removed cron job");
3954
3975
  }
3955
3976
  }
3956
- const configPath = join9(CONARE_DIR, "config.json");
3957
- if (existsSync9(configPath))
3958
- unlinkSync(configPath);
3977
+ return messages;
3978
+ }
3979
+ function clearSyncLocks() {
3959
3980
  const lockDir = join9(CONARE_DIR, "sync.lock.d");
3960
3981
  if (existsSync9(lockDir))
3961
3982
  rmSync2(lockDir, { recursive: true, force: true });
3962
3983
  const lockFile = join9(CONARE_DIR, "sync.lock");
3963
3984
  if (existsSync9(lockFile))
3964
- unlinkSync(lockFile);
3985
+ unlinkSync2(lockFile);
3986
+ }
3987
+ function uninstallSync() {
3988
+ const messages = removeSyncTimer();
3989
+ if (existsSync9(CONFIG_PATH))
3990
+ unlinkSync2(CONFIG_PATH);
3991
+ clearSyncLocks();
3965
3992
  if (existsSync9(BIN_DIR)) {
3966
3993
  rmSync2(BIN_DIR, { recursive: true, force: true });
3967
3994
  messages.push("Removed ~/.conare/bin/");
@@ -4112,7 +4139,7 @@ conare — AI memory for your coding tools
4112
4139
  Usage:
4113
4140
  conare Interactive setup with browser auth
4114
4141
  conare install Just install the MCP (all detected clients)
4115
- conare logout Clear saved API key, sync timer, and local index history
4142
+ conare logout Clear saved API key and local hashes; keep conare installed
4116
4143
  conare --key <api_key> Index chat history (key optional with browser auth)
4117
4144
  conare --key <api_key> --index [path] Index codebase
4118
4145
 
@@ -4206,20 +4233,17 @@ async function runInstall() {
4206
4233
  console.log("");
4207
4234
  }
4208
4235
  async function runLogout() {
4209
- const { unlinkSync: unlinkSync2, existsSync: existsSync11 } = await import("node:fs");
4210
- const { join: join11 } = await import("node:path");
4211
- const { homedir: homedir9 } = await import("node:os");
4212
- const messages = uninstallSync();
4213
- const manifestPath = join11(homedir9(), ".conare", "ingested.json");
4214
- if (existsSync11(manifestPath)) {
4215
- unlinkSync2(manifestPath);
4216
- messages.push("Removed local index history");
4217
- }
4236
+ const messages = removeSyncTimer();
4237
+ clearSyncLocks();
4238
+ const hadApiKey = clearSavedApiKey();
4239
+ messages.push(hadApiKey ? "Cleared saved API key" : "No saved API key found");
4240
+ clearIngested();
4241
+ messages.push("Reset local hashes");
4218
4242
  console.log("");
4219
4243
  for (const msg of messages)
4220
4244
  console.log(` ${msg}`);
4221
4245
  console.log("");
4222
- console.log(" \x1B[32m✓\x1B[0m Logged out. API key cleared from ~/.conare/.");
4246
+ console.log(" \x1B[32m✓\x1B[0m Logged out. The conare command is still installed.");
4223
4247
  console.log("");
4224
4248
  }
4225
4249
  async function main() {
@@ -4265,6 +4289,7 @@ async function main() {
4265
4289
  detectedCountApproximate: undefined
4266
4290
  }));
4267
4291
  let interactiveMode = false;
4292
+ let detectedTools;
4268
4293
  if (shouldRunInteractive) {
4269
4294
  startSetup();
4270
4295
  interactiveMode = true;
@@ -4287,7 +4312,7 @@ async function main() {
4287
4312
  }
4288
4313
  }
4289
4314
  showCountingLocalChats();
4290
- const detectedTools = await detect({ onProgress: renderDetectProgress });
4315
+ detectedTools = await detect({ onProgress: renderDetectProgress });
4291
4316
  showLocalChatsCounted();
4292
4317
  interactiveTargets = MCP_TARGETS.map((target) => {
4293
4318
  const detected = detectedTools.find((tool) => tool.id === target.id);
@@ -4475,7 +4500,7 @@ Nothing new to index.`);
4475
4500
  }
4476
4501
  log();
4477
4502
  }
4478
- const tools = await detect();
4503
+ const tools = detectedTools ?? await detect();
4479
4504
  if (!interactiveMode) {
4480
4505
  log("Detected AI tools:");
4481
4506
  for (const t of tools) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conare",
3
- "version": "0.5.16",
3
+ "version": "0.5.18",
4
4
  "description": "Conare CLI for indexing AI chat history and configuring memory at conare.ai",
5
5
  "type": "module",
6
6
  "bin": {