conare 0.3.3 → 0.3.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.
- package/dist/index.js +93 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1024,7 +1024,7 @@ var import_sisteransi, import_picocolors, uD, W, tD, eD, FD = function() {
|
|
|
1024
1024
|
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
1025
1025
|
}
|
|
1026
1026
|
return F;
|
|
1027
|
-
}, xD, B, AD, S, gD, vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t), dD, A, kD, $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t), SD, TD, jD = (e, u, t) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, U = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t), MD;
|
|
1027
|
+
}, xD, B, AD, S, gD, vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t), dD, A, kD, $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t), SD, TD, jD = (e, u, t) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, U = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t), MD, OD, PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t), LD;
|
|
1028
1028
|
var init_dist = __esm(() => {
|
|
1029
1029
|
import_sisteransi = __toESM(require_src(), 1);
|
|
1030
1030
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1148,6 +1148,30 @@ var init_dist = __esm(() => {
|
|
|
1148
1148
|
return this.value.replaceAll(/./g, this._mask);
|
|
1149
1149
|
}
|
|
1150
1150
|
};
|
|
1151
|
+
OD = Object.defineProperty;
|
|
1152
|
+
LD = class LD extends x {
|
|
1153
|
+
constructor(u) {
|
|
1154
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
1155
|
+
switch (t) {
|
|
1156
|
+
case "left":
|
|
1157
|
+
case "up":
|
|
1158
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1159
|
+
break;
|
|
1160
|
+
case "down":
|
|
1161
|
+
case "right":
|
|
1162
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
this.changeValue();
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
get _value() {
|
|
1169
|
+
return this.options[this.cursor];
|
|
1170
|
+
}
|
|
1171
|
+
changeValue() {
|
|
1172
|
+
this.value = this._value.value;
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1151
1175
|
});
|
|
1152
1176
|
|
|
1153
1177
|
// node_modules/@clack/prompts/dist/index.mjs
|
|
@@ -1212,6 +1236,37 @@ ${import_picocolors2.default.gray(o)}`;
|
|
|
1212
1236
|
default:
|
|
1213
1237
|
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
1214
1238
|
${import_picocolors2.default.cyan(d2)}
|
|
1239
|
+
`;
|
|
1240
|
+
}
|
|
1241
|
+
} }).prompt();
|
|
1242
|
+
}, ve = (t) => {
|
|
1243
|
+
const n = (r2, i) => {
|
|
1244
|
+
const s = r2.label ?? String(r2.value);
|
|
1245
|
+
switch (i) {
|
|
1246
|
+
case "selected":
|
|
1247
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
1248
|
+
case "active":
|
|
1249
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
1250
|
+
case "cancelled":
|
|
1251
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
1252
|
+
default:
|
|
1253
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
1257
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
1258
|
+
${b2(this.state)} ${t.message}
|
|
1259
|
+
`;
|
|
1260
|
+
switch (this.state) {
|
|
1261
|
+
case "submit":
|
|
1262
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
1263
|
+
case "cancel":
|
|
1264
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
1265
|
+
${import_picocolors2.default.gray(o)}`;
|
|
1266
|
+
default:
|
|
1267
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
1268
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
1269
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1215
1270
|
`;
|
|
1216
1271
|
}
|
|
1217
1272
|
} }).prompt();
|
|
@@ -1281,7 +1336,7 @@ ${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
|
1281
1336
|
${import_picocolors2.default.gray(d2)} ${t}
|
|
1282
1337
|
|
|
1283
1338
|
`);
|
|
1284
|
-
},
|
|
1339
|
+
}, J2, Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1285
1340
|
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
1286
1341
|
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
1287
1342
|
const p2 = (m2) => {
|
|
@@ -1359,7 +1414,7 @@ var init_dist2 = __esm(() => {
|
|
|
1359
1414
|
D = u("◆", "*");
|
|
1360
1415
|
U2 = u("▲", "!");
|
|
1361
1416
|
K2 = u("■", "x");
|
|
1362
|
-
|
|
1417
|
+
J2 = `${import_picocolors2.default.gray(o)} `;
|
|
1363
1418
|
});
|
|
1364
1419
|
|
|
1365
1420
|
// src/interactive.ts
|
|
@@ -1446,10 +1501,15 @@ async function confirmIndexCodebase() {
|
|
|
1446
1501
|
}));
|
|
1447
1502
|
}
|
|
1448
1503
|
async function confirmBackgroundSync() {
|
|
1449
|
-
|
|
1504
|
+
const value = ensureValue(await ve({
|
|
1450
1505
|
message: "Auto-ingest new chats every 10 minutes?",
|
|
1451
|
-
initialValue:
|
|
1506
|
+
initialValue: "yes",
|
|
1507
|
+
options: [
|
|
1508
|
+
{ value: "yes", label: "Yes" },
|
|
1509
|
+
{ value: "no", label: "No" }
|
|
1510
|
+
]
|
|
1452
1511
|
}));
|
|
1512
|
+
return value === "yes";
|
|
1453
1513
|
}
|
|
1454
1514
|
var init_interactive = __esm(() => {
|
|
1455
1515
|
init_dist2();
|
|
@@ -2380,18 +2440,29 @@ function persistBinary(apiKey) {
|
|
|
2380
2440
|
writeFileSync4(CONFIG_PATH2, JSON.stringify({ apiKey }, null, 2) + `
|
|
2381
2441
|
`);
|
|
2382
2442
|
}
|
|
2443
|
+
function isValidJsBundle(path) {
|
|
2444
|
+
if (!existsSync8(path))
|
|
2445
|
+
return false;
|
|
2446
|
+
if (path.endsWith(".ts") || path.endsWith(".tsx"))
|
|
2447
|
+
return false;
|
|
2448
|
+
const head = readFileSync9(path, "utf-8").slice(0, 2000);
|
|
2449
|
+
if (/\btype\s+\{/.test(head) || /,\s*type\s+\w+/.test(head))
|
|
2450
|
+
return false;
|
|
2451
|
+
return true;
|
|
2452
|
+
}
|
|
2383
2453
|
function findCliBundle() {
|
|
2384
|
-
const
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
join9(dirname2(new URL(import.meta.url).pathname), "index.js"),
|
|
2389
|
-
join9(dirname2(new URL(import.meta.url).pathname), "..", "dist", "index.js")
|
|
2454
|
+
const dir = dirname2(new URL(import.meta.url).pathname);
|
|
2455
|
+
const distCandidates = [
|
|
2456
|
+
join9(dir, "index.js"),
|
|
2457
|
+
join9(dir, "..", "dist", "index.js")
|
|
2390
2458
|
];
|
|
2391
|
-
for (const c of
|
|
2392
|
-
if (
|
|
2459
|
+
for (const c of distCandidates) {
|
|
2460
|
+
if (isValidJsBundle(c))
|
|
2393
2461
|
return c;
|
|
2394
2462
|
}
|
|
2463
|
+
const entry = process.argv[1];
|
|
2464
|
+
if (entry && isValidJsBundle(entry))
|
|
2465
|
+
return entry;
|
|
2395
2466
|
return null;
|
|
2396
2467
|
}
|
|
2397
2468
|
function findSqlJs() {
|
|
@@ -2553,15 +2624,19 @@ function setupWindows(intervalMinutes) {
|
|
|
2553
2624
|
} catch {}
|
|
2554
2625
|
execSync2(`schtasks /Create /TN "${TASK_NAME}" /TR "wscript.exe \\"${runVbs}\\"" /SC MINUTE /MO ${intervalMinutes} /F`, { stdio: "ignore" });
|
|
2555
2626
|
}
|
|
2556
|
-
function
|
|
2627
|
+
function persistAndInstallGlobal(apiKey) {
|
|
2557
2628
|
const messages = [];
|
|
2558
|
-
const os = platform5();
|
|
2559
2629
|
persistBinary(apiKey);
|
|
2560
2630
|
messages.push("Persisted CLI to ~/.conare/bin/");
|
|
2561
2631
|
messages.push("Saved config to ~/.conare/config.json");
|
|
2562
2632
|
const globalMsg = installGlobalCommand();
|
|
2563
2633
|
if (globalMsg)
|
|
2564
2634
|
messages.push(globalMsg);
|
|
2635
|
+
return messages;
|
|
2636
|
+
}
|
|
2637
|
+
function installSync(apiKey, intervalMinutes = 10) {
|
|
2638
|
+
const messages = persistAndInstallGlobal(apiKey);
|
|
2639
|
+
const os = platform5();
|
|
2565
2640
|
if (os === "darwin") {
|
|
2566
2641
|
setupMacOS(intervalMinutes);
|
|
2567
2642
|
messages.push(`Installed launchd agent (every ${intervalMinutes} min)`);
|
|
@@ -3195,6 +3270,9 @@ Nothing new to index.`);
|
|
|
3195
3270
|
log("");
|
|
3196
3271
|
}
|
|
3197
3272
|
if (!opts.dryRun && !opts.quiet) {
|
|
3273
|
+
try {
|
|
3274
|
+
persistAndInstallGlobal(apiKey);
|
|
3275
|
+
} catch {}
|
|
3198
3276
|
const shouldSync = interactiveMode ? await confirmBackgroundSync() : true;
|
|
3199
3277
|
if (shouldSync) {
|
|
3200
3278
|
const syncSpinner = Y2();
|