conare 0.4.3 → 0.4.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 +343 -84
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -817,6 +817,21 @@ function Y(e, u, t) {
|
|
|
817
817
|
`).map((F) => lD(F, u, t)).join(`
|
|
818
818
|
`);
|
|
819
819
|
}
|
|
820
|
+
function cD(e) {
|
|
821
|
+
for (const u in e) {
|
|
822
|
+
const t = u;
|
|
823
|
+
if (!Object.hasOwn(e, t))
|
|
824
|
+
continue;
|
|
825
|
+
const F = e[t];
|
|
826
|
+
switch (t) {
|
|
827
|
+
case "aliases": {
|
|
828
|
+
for (const s in F)
|
|
829
|
+
Object.hasOwn(F, s) && (B.aliases.has(s) || B.aliases.set(s, F[s]));
|
|
830
|
+
break;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
820
835
|
function $(e, u) {
|
|
821
836
|
if (typeof e == "string")
|
|
822
837
|
return B.aliases.get(e) === u;
|
|
@@ -1024,7 +1039,14 @@ var import_sisteransi, import_picocolors, uD, W, tD, eD, FD = function() {
|
|
|
1024
1039
|
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
1025
1040
|
}
|
|
1026
1041
|
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,
|
|
1042
|
+
}, 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, mD, bD = (e, u, t) => (u in e) ? mD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, Z = (e, u, t) => (bD(e, typeof u != "symbol" ? u + "" : u, t), t), q = (e, u, t) => {
|
|
1043
|
+
if (!u.has(e))
|
|
1044
|
+
throw TypeError("Cannot " + t);
|
|
1045
|
+
}, T = (e, u, t) => (q(e, u, "read from private field"), t ? t.call(e) : u.get(e)), wD = (e, u, t) => {
|
|
1046
|
+
if (u.has(e))
|
|
1047
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
1048
|
+
u instanceof WeakSet ? u.add(e) : u.set(e, t);
|
|
1049
|
+
}, yD = (e, u, t, F) => (q(e, u, "write to private field"), F ? F.call(e, t) : u.set(e, t), t), A, _D, 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, WD, ND = (e, u, t) => (u in e) ? WD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, Q = (e, u, t) => (ND(e, typeof u != "symbol" ? u + "" : u, t), t), ID, RD;
|
|
1028
1050
|
var init_dist = __esm(() => {
|
|
1029
1051
|
import_sisteransi = __toESM(require_src(), 1);
|
|
1030
1052
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1093,6 +1115,50 @@ var init_dist = __esm(() => {
|
|
|
1093
1115
|
});
|
|
1094
1116
|
}
|
|
1095
1117
|
};
|
|
1118
|
+
mD = Object.defineProperty;
|
|
1119
|
+
_D = class extends x {
|
|
1120
|
+
constructor(u) {
|
|
1121
|
+
super(u, false), Z(this, "options"), Z(this, "cursor", 0), wD(this, A, undefined);
|
|
1122
|
+
const { options: t } = u;
|
|
1123
|
+
yD(this, A, u.selectableGroups !== false), this.options = Object.entries(t).flatMap(([F, s]) => [{ value: F, group: true, label: F }, ...s.map((i) => ({ ...i, group: F }))]), this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), T(this, A) ? 0 : 1), this.on("cursor", (F) => {
|
|
1124
|
+
switch (F) {
|
|
1125
|
+
case "left":
|
|
1126
|
+
case "up": {
|
|
1127
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1128
|
+
const s = this.options[this.cursor]?.group === true;
|
|
1129
|
+
!T(this, A) && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "down":
|
|
1133
|
+
case "right": {
|
|
1134
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1135
|
+
const s = this.options[this.cursor]?.group === true;
|
|
1136
|
+
!T(this, A) && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
case "space":
|
|
1140
|
+
this.toggleValue();
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
getGroupItems(u) {
|
|
1146
|
+
return this.options.filter((t) => t.group === u);
|
|
1147
|
+
}
|
|
1148
|
+
isGroupSelected(u) {
|
|
1149
|
+
return this.getGroupItems(u).every((t) => this.value.includes(t.value));
|
|
1150
|
+
}
|
|
1151
|
+
toggleValue() {
|
|
1152
|
+
const u = this.options[this.cursor];
|
|
1153
|
+
if (u.group === true) {
|
|
1154
|
+
const t = u.value, F = this.getGroupItems(t);
|
|
1155
|
+
this.isGroupSelected(t) ? this.value = this.value.filter((s) => F.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...F.map((s) => s.value)], this.value = Array.from(new Set(this.value));
|
|
1156
|
+
} else {
|
|
1157
|
+
const t = this.value.includes(u.value);
|
|
1158
|
+
this.value = t ? this.value.filter((F) => F !== u.value) : [...this.value, u.value];
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1096
1162
|
A = new WeakMap;
|
|
1097
1163
|
kD = Object.defineProperty;
|
|
1098
1164
|
SD = class extends x {
|
|
@@ -1172,15 +1238,67 @@ var init_dist = __esm(() => {
|
|
|
1172
1238
|
this.value = this._value.value;
|
|
1173
1239
|
}
|
|
1174
1240
|
};
|
|
1241
|
+
WD = Object.defineProperty;
|
|
1242
|
+
ID = class ID extends x {
|
|
1243
|
+
constructor(u) {
|
|
1244
|
+
super(u, false), Q(this, "options"), Q(this, "cursor", 0), this.options = u.options;
|
|
1245
|
+
const t = this.options.map(({ value: [F] }) => F?.toLowerCase());
|
|
1246
|
+
this.cursor = Math.max(t.indexOf(u.initialValue), 0), this.on("key", (F) => {
|
|
1247
|
+
if (!t.includes(F))
|
|
1248
|
+
return;
|
|
1249
|
+
const s = this.options.find(({ value: [i] }) => i?.toLowerCase() === F);
|
|
1250
|
+
s && (this.value = s.value, this.state = "submit", this.emit("submit"));
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
RD = class RD extends x {
|
|
1255
|
+
get valueWithCursor() {
|
|
1256
|
+
if (this.state === "submit")
|
|
1257
|
+
return this.value;
|
|
1258
|
+
if (this.cursor >= this.value.length)
|
|
1259
|
+
return `${this.value}█`;
|
|
1260
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
1261
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
1262
|
+
}
|
|
1263
|
+
get cursor() {
|
|
1264
|
+
return this._cursor;
|
|
1265
|
+
}
|
|
1266
|
+
constructor(u) {
|
|
1267
|
+
super(u), this.on("finalize", () => {
|
|
1268
|
+
this.value || (this.value = u.defaultValue);
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1175
1272
|
});
|
|
1176
1273
|
|
|
1177
1274
|
// node_modules/@clack/prompts/dist/index.mjs
|
|
1275
|
+
var exports_dist = {};
|
|
1276
|
+
__export(exports_dist, {
|
|
1277
|
+
updateSettings: () => cD,
|
|
1278
|
+
text: () => he,
|
|
1279
|
+
tasks: () => Te,
|
|
1280
|
+
stream: () => x2,
|
|
1281
|
+
spinner: () => Y2,
|
|
1282
|
+
selectKey: () => we,
|
|
1283
|
+
select: () => ve,
|
|
1284
|
+
password: () => ge,
|
|
1285
|
+
outro: () => Se,
|
|
1286
|
+
note: () => Me,
|
|
1287
|
+
multiselect: () => fe,
|
|
1288
|
+
log: () => M2,
|
|
1289
|
+
isCancel: () => pD,
|
|
1290
|
+
intro: () => Ie,
|
|
1291
|
+
groupMultiselect: () => be,
|
|
1292
|
+
group: () => Ce,
|
|
1293
|
+
confirm: () => ye,
|
|
1294
|
+
cancel: () => xe
|
|
1295
|
+
});
|
|
1178
1296
|
import { stripVTControlCharacters as S2 } from "node:util";
|
|
1179
1297
|
import y2 from "node:process";
|
|
1180
1298
|
function ce() {
|
|
1181
1299
|
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1182
1300
|
}
|
|
1183
|
-
var import_picocolors2, import_sisteransi2, V2, u = (t, n) => V2 ? t : n, le, L2, W2, C, ue, o, d2, k2, P2, A2,
|
|
1301
|
+
var import_picocolors2, import_sisteransi2, V2, u = (t, n) => V2 ? t : n, le, L2, W2, C, ue, o, d2, k2, P2, A2, T2, F, $e, _2, me, de, pe, q2, D, U2, K2, b2 = (t) => {
|
|
1184
1302
|
switch (t) {
|
|
1185
1303
|
case "initial":
|
|
1186
1304
|
case "active":
|
|
@@ -1201,7 +1319,27 @@ var import_picocolors2, import_sisteransi2, V2, u = (t, n) => V2 ? t : n, le, L2
|
|
|
1201
1319
|
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
|
|
1202
1320
|
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
1203
1321
|
});
|
|
1204
|
-
},
|
|
1322
|
+
}, he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
1323
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
1324
|
+
${b2(this.state)} ${t.message}
|
|
1325
|
+
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
1326
|
+
switch (this.state) {
|
|
1327
|
+
case "error":
|
|
1328
|
+
return `${n.trim()}
|
|
1329
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
1330
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
1331
|
+
`;
|
|
1332
|
+
case "submit":
|
|
1333
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
1334
|
+
case "cancel":
|
|
1335
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
1336
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
1337
|
+
default:
|
|
1338
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
1339
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1340
|
+
`;
|
|
1341
|
+
}
|
|
1342
|
+
} }).prompt(), ge = (t) => new MD({ validate: t.validate, mask: t.mask ?? $e, render() {
|
|
1205
1343
|
const n = `${import_picocolors2.default.gray(o)}
|
|
1206
1344
|
${b2(this.state)} ${t.message}
|
|
1207
1345
|
`, r2 = this.valueWithCursor, i = this.masked;
|
|
@@ -1267,13 +1405,35 @@ ${import_picocolors2.default.gray(o)}`;
|
|
|
1267
1405
|
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
1406
|
${import_picocolors2.default.cyan(o)} `)}
|
|
1269
1407
|
${import_picocolors2.default.cyan(d2)}
|
|
1408
|
+
`;
|
|
1409
|
+
}
|
|
1410
|
+
} }).prompt();
|
|
1411
|
+
}, we = (t) => {
|
|
1412
|
+
const n = (r2, i = "inactive") => {
|
|
1413
|
+
const s = r2.label ?? String(r2.value);
|
|
1414
|
+
return i === "selected" ? `${import_picocolors2.default.dim(s)}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active" ? `${import_picocolors2.default.bgCyan(import_picocolors2.default.gray(` ${r2.value} `))} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : `${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(` ${r2.value} `)))} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
1415
|
+
};
|
|
1416
|
+
return new ID({ options: t.options, initialValue: t.initialValue, render() {
|
|
1417
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
1418
|
+
${b2(this.state)} ${t.message}
|
|
1419
|
+
`;
|
|
1420
|
+
switch (this.state) {
|
|
1421
|
+
case "submit":
|
|
1422
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
|
|
1423
|
+
case "cancel":
|
|
1424
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[0], "cancelled")}
|
|
1425
|
+
${import_picocolors2.default.gray(o)}`;
|
|
1426
|
+
default:
|
|
1427
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
|
|
1428
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
1429
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1270
1430
|
`;
|
|
1271
1431
|
}
|
|
1272
1432
|
} }).prompt();
|
|
1273
1433
|
}, fe = (t) => {
|
|
1274
1434
|
const n = (r2, i) => {
|
|
1275
1435
|
const s = r2.label ?? String(r2.value);
|
|
1276
|
-
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(
|
|
1436
|
+
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T2)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
1277
1437
|
};
|
|
1278
1438
|
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
1279
1439
|
if (this.required && r2.length === 0)
|
|
@@ -1307,6 +1467,66 @@ ${s}
|
|
|
1307
1467
|
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
1308
1468
|
${import_picocolors2.default.cyan(o)} `)}
|
|
1309
1469
|
${import_picocolors2.default.cyan(d2)}
|
|
1470
|
+
`;
|
|
1471
|
+
}
|
|
1472
|
+
} }).prompt();
|
|
1473
|
+
}, be = (t) => {
|
|
1474
|
+
const { selectableGroups: n = true } = t, r2 = (i, s, c = []) => {
|
|
1475
|
+
const a = i.label ?? String(i.value), l2 = typeof i.group == "string", $2 = l2 && (c[c.indexOf(i) + 1] ?? { group: true }), g2 = l2 && $2.group === true, p2 = l2 ? n ? `${g2 ? d2 : o} ` : " " : "";
|
|
1476
|
+
if (s === "active")
|
|
1477
|
+
return `${import_picocolors2.default.dim(p2)}${import_picocolors2.default.cyan(A2)} ${a} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}`;
|
|
1478
|
+
if (s === "group-active")
|
|
1479
|
+
return `${p2}${import_picocolors2.default.cyan(A2)} ${import_picocolors2.default.dim(a)}`;
|
|
1480
|
+
if (s === "group-active-selected")
|
|
1481
|
+
return `${p2}${import_picocolors2.default.green(T2)} ${import_picocolors2.default.dim(a)}`;
|
|
1482
|
+
if (s === "selected") {
|
|
1483
|
+
const f = l2 || n ? import_picocolors2.default.green(T2) : "";
|
|
1484
|
+
return `${import_picocolors2.default.dim(p2)}${f} ${import_picocolors2.default.dim(a)} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}`;
|
|
1485
|
+
}
|
|
1486
|
+
if (s === "cancelled")
|
|
1487
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}`;
|
|
1488
|
+
if (s === "active-selected")
|
|
1489
|
+
return `${import_picocolors2.default.dim(p2)}${import_picocolors2.default.green(T2)} ${a} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}`;
|
|
1490
|
+
if (s === "submitted")
|
|
1491
|
+
return `${import_picocolors2.default.dim(a)}`;
|
|
1492
|
+
const v2 = l2 || n ? import_picocolors2.default.dim(F) : "";
|
|
1493
|
+
return `${import_picocolors2.default.dim(p2)}${v2} ${import_picocolors2.default.dim(a)}`;
|
|
1494
|
+
};
|
|
1495
|
+
return new _D({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, selectableGroups: n, validate(i) {
|
|
1496
|
+
if (this.required && i.length === 0)
|
|
1497
|
+
return `Please select at least one option.
|
|
1498
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
1499
|
+
}, render() {
|
|
1500
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
1501
|
+
${b2(this.state)} ${t.message}
|
|
1502
|
+
`;
|
|
1503
|
+
switch (this.state) {
|
|
1504
|
+
case "submit":
|
|
1505
|
+
return `${i}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => r2(s, "submitted")).join(import_picocolors2.default.dim(", "))}`;
|
|
1506
|
+
case "cancel": {
|
|
1507
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => r2(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
1508
|
+
return `${i}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
1509
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
1510
|
+
}
|
|
1511
|
+
case "error": {
|
|
1512
|
+
const s = this.error.split(`
|
|
1513
|
+
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
1514
|
+
`);
|
|
1515
|
+
return `${i}${import_picocolors2.default.yellow(o)} ${this.options.map((c, a, l2) => {
|
|
1516
|
+
const $2 = this.value.includes(c.value) || c.group === true && this.isGroupSelected(`${c.value}`), g2 = a === this.cursor;
|
|
1517
|
+
return !g2 && typeof c.group == "string" && this.options[this.cursor].value === c.group ? r2(c, $2 ? "group-active-selected" : "group-active", l2) : g2 && $2 ? r2(c, "active-selected", l2) : $2 ? r2(c, "selected", l2) : r2(c, g2 ? "active" : "inactive", l2);
|
|
1518
|
+
}).join(`
|
|
1519
|
+
${import_picocolors2.default.yellow(o)} `)}
|
|
1520
|
+
${s}
|
|
1521
|
+
`;
|
|
1522
|
+
}
|
|
1523
|
+
default:
|
|
1524
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.options.map((s, c, a) => {
|
|
1525
|
+
const l2 = this.value.includes(s.value) || s.group === true && this.isGroupSelected(`${s.value}`), $2 = c === this.cursor;
|
|
1526
|
+
return !$2 && typeof s.group == "string" && this.options[this.cursor].value === s.group ? r2(s, l2 ? "group-active-selected" : "group-active", a) : $2 && l2 ? r2(s, "active-selected", a) : l2 ? r2(s, "selected", a) : r2(s, $2 ? "active" : "inactive", a);
|
|
1527
|
+
}).join(`
|
|
1528
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
1529
|
+
${import_picocolors2.default.cyan(d2)}
|
|
1310
1530
|
`;
|
|
1311
1531
|
}
|
|
1312
1532
|
} }).prompt();
|
|
@@ -1336,7 +1556,7 @@ ${import_picocolors2.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
|
1336
1556
|
${import_picocolors2.default.gray(d2)} ${t}
|
|
1337
1557
|
|
|
1338
1558
|
`);
|
|
1339
|
-
}, J2, Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1559
|
+
}, M2, J2, x2, Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
1340
1560
|
const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
1341
1561
|
let s, c, a = false, l2 = "", $2, g2 = performance.now();
|
|
1342
1562
|
const p2 = (m2) => {
|
|
@@ -1386,6 +1606,28 @@ ${import_picocolors2.default.gray(d2)} ${t}
|
|
|
1386
1606
|
return { start: H2, stop: N2, message: (m2 = "") => {
|
|
1387
1607
|
l2 = R2(m2 ?? l2);
|
|
1388
1608
|
} };
|
|
1609
|
+
}, Ce = async (t, n) => {
|
|
1610
|
+
const r2 = {}, i = Object.keys(t);
|
|
1611
|
+
for (const s of i) {
|
|
1612
|
+
const c = t[s], a = await c({ results: r2 })?.catch((l2) => {
|
|
1613
|
+
throw l2;
|
|
1614
|
+
});
|
|
1615
|
+
if (typeof n?.onCancel == "function" && pD(a)) {
|
|
1616
|
+
r2[s] = "canceled", n.onCancel({ results: r2 });
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
r2[s] = a;
|
|
1620
|
+
}
|
|
1621
|
+
return r2;
|
|
1622
|
+
}, Te = async (t) => {
|
|
1623
|
+
for (const n of t) {
|
|
1624
|
+
if (n.enabled === false)
|
|
1625
|
+
continue;
|
|
1626
|
+
const r2 = Y2();
|
|
1627
|
+
r2.start(n.title);
|
|
1628
|
+
const i = await n.task(r2.message);
|
|
1629
|
+
r2.stop(i || n.title);
|
|
1630
|
+
}
|
|
1389
1631
|
};
|
|
1390
1632
|
var init_dist2 = __esm(() => {
|
|
1391
1633
|
init_dist();
|
|
@@ -1403,18 +1645,57 @@ var init_dist2 = __esm(() => {
|
|
|
1403
1645
|
k2 = u("●", ">");
|
|
1404
1646
|
P2 = u("○", " ");
|
|
1405
1647
|
A2 = u("◻", "[•]");
|
|
1406
|
-
|
|
1648
|
+
T2 = u("◼", "[+]");
|
|
1407
1649
|
F = u("◻", "[ ]");
|
|
1408
1650
|
$e = u("▪", "•");
|
|
1409
1651
|
_2 = u("─", "-");
|
|
1410
1652
|
me = u("╮", "+");
|
|
1411
1653
|
de = u("├", "+");
|
|
1412
1654
|
pe = u("╯", "+");
|
|
1413
|
-
|
|
1655
|
+
q2 = u("●", "•");
|
|
1414
1656
|
D = u("◆", "*");
|
|
1415
1657
|
U2 = u("▲", "!");
|
|
1416
1658
|
K2 = u("■", "x");
|
|
1659
|
+
M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
1660
|
+
const r2 = [`${import_picocolors2.default.gray(o)}`];
|
|
1661
|
+
if (t) {
|
|
1662
|
+
const [i, ...s] = t.split(`
|
|
1663
|
+
`);
|
|
1664
|
+
r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
1665
|
+
}
|
|
1666
|
+
process.stdout.write(`${r2.join(`
|
|
1667
|
+
`)}
|
|
1668
|
+
`);
|
|
1669
|
+
}, info: (t) => {
|
|
1670
|
+
M2.message(t, { symbol: import_picocolors2.default.blue(q2) });
|
|
1671
|
+
}, success: (t) => {
|
|
1672
|
+
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
1673
|
+
}, step: (t) => {
|
|
1674
|
+
M2.message(t, { symbol: import_picocolors2.default.green(C) });
|
|
1675
|
+
}, warn: (t) => {
|
|
1676
|
+
M2.message(t, { symbol: import_picocolors2.default.yellow(U2) });
|
|
1677
|
+
}, warning: (t) => {
|
|
1678
|
+
M2.warn(t);
|
|
1679
|
+
}, error: (t) => {
|
|
1680
|
+
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
1681
|
+
} };
|
|
1417
1682
|
J2 = `${import_picocolors2.default.gray(o)} `;
|
|
1683
|
+
x2 = { message: async (t, { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
1684
|
+
process.stdout.write(`${import_picocolors2.default.gray(o)}
|
|
1685
|
+
${n} `);
|
|
1686
|
+
let r2 = 3;
|
|
1687
|
+
for await (let i of t) {
|
|
1688
|
+
i = i.replace(/\n/g, `
|
|
1689
|
+
${J2}`), i.includes(`
|
|
1690
|
+
`) && (r2 = 3 + S2(i.slice(i.lastIndexOf(`
|
|
1691
|
+
`))).length);
|
|
1692
|
+
const s = S2(i).length;
|
|
1693
|
+
r2 + s < process.stdout.columns ? (r2 += s, process.stdout.write(i)) : (process.stdout.write(`
|
|
1694
|
+
${J2}${i.trimStart()}`), r2 = 3 + S2(i.trimStart()).length);
|
|
1695
|
+
}
|
|
1696
|
+
process.stdout.write(`
|
|
1697
|
+
`);
|
|
1698
|
+
}, info: (t) => x2.message(t, { symbol: import_picocolors2.default.blue(q2) }), success: (t) => x2.message(t, { symbol: import_picocolors2.default.green(D) }), step: (t) => x2.message(t, { symbol: import_picocolors2.default.green(C) }), warn: (t) => x2.message(t, { symbol: import_picocolors2.default.yellow(U2) }), warning: (t) => x2.warn(t), error: (t) => x2.message(t, { symbol: import_picocolors2.default.red(K2) }) };
|
|
1418
1699
|
});
|
|
1419
1700
|
|
|
1420
1701
|
// src/interactive.ts
|
|
@@ -1428,7 +1709,6 @@ __export(exports_interactive, {
|
|
|
1428
1709
|
promptAuth: () => promptAuth,
|
|
1429
1710
|
promptApiKey: () => promptApiKey,
|
|
1430
1711
|
finishSetup: () => finishSetup,
|
|
1431
|
-
confirmIndexCodebase: () => confirmIndexCodebase,
|
|
1432
1712
|
confirmBackgroundSync: () => confirmBackgroundSync
|
|
1433
1713
|
});
|
|
1434
1714
|
function formatDetectedCount(count) {
|
|
@@ -1531,12 +1811,6 @@ async function selectMcpTargets(targets) {
|
|
|
1531
1811
|
}))
|
|
1532
1812
|
}));
|
|
1533
1813
|
}
|
|
1534
|
-
async function confirmIndexCodebase() {
|
|
1535
|
-
return ensureValue(await ye({
|
|
1536
|
-
message: "Index this codebase too?",
|
|
1537
|
-
initialValue: false
|
|
1538
|
-
}));
|
|
1539
|
-
}
|
|
1540
1814
|
async function confirmBackgroundSync() {
|
|
1541
1815
|
const value = ensureValue(await ve({
|
|
1542
1816
|
message: "Auto-ingest new chats every 10 minutes?",
|
|
@@ -1712,6 +1986,21 @@ async function detect() {
|
|
|
1712
1986
|
path: join(openclawDir, "openclaw.json"),
|
|
1713
1987
|
sessionCount: 0
|
|
1714
1988
|
});
|
|
1989
|
+
const antigravityDir = join(home, ".gemini", "antigravity");
|
|
1990
|
+
const antigravityConvDir = join(antigravityDir, "conversations");
|
|
1991
|
+
let antigravityCount = 0;
|
|
1992
|
+
if (existsSync(antigravityConvDir)) {
|
|
1993
|
+
try {
|
|
1994
|
+
antigravityCount = readdirSync(antigravityConvDir).filter((f) => f.endsWith(".pb")).length;
|
|
1995
|
+
} catch {}
|
|
1996
|
+
}
|
|
1997
|
+
tools.push({
|
|
1998
|
+
name: "Antigravity",
|
|
1999
|
+
id: "antigravity",
|
|
2000
|
+
available: existsSync(antigravityDir),
|
|
2001
|
+
path: join(antigravityDir, "mcp_config.json"),
|
|
2002
|
+
sessionCount: antigravityCount
|
|
2003
|
+
});
|
|
1715
2004
|
return tools;
|
|
1716
2005
|
}
|
|
1717
2006
|
|
|
@@ -2327,7 +2616,8 @@ var MCP_TARGETS = [
|
|
|
2327
2616
|
{ id: "vscode", label: "VS Code Copilot", defaultSelected: false },
|
|
2328
2617
|
{ id: "cline", label: "Cline", defaultSelected: false },
|
|
2329
2618
|
{ id: "zed", label: "Zed", defaultSelected: false },
|
|
2330
|
-
{ id: "openclaw", label: "OpenClaw", defaultSelected: false }
|
|
2619
|
+
{ id: "openclaw", label: "OpenClaw", defaultSelected: false },
|
|
2620
|
+
{ id: "antigravity", label: "Antigravity", defaultSelected: false }
|
|
2331
2621
|
];
|
|
2332
2622
|
function readJsonFile(path) {
|
|
2333
2623
|
try {
|
|
@@ -2536,6 +2826,19 @@ function configureOpenclaw(apiKey) {
|
|
|
2536
2826
|
writeJsonFile(configPath, config);
|
|
2537
2827
|
return "\x1B[32m✓\x1B[0m OpenClaw";
|
|
2538
2828
|
}
|
|
2829
|
+
function configureAntigravity(apiKey) {
|
|
2830
|
+
const configPath = join7(homedir5(), ".gemini", "antigravity", "mcp_config.json");
|
|
2831
|
+
const config = readJsonFile(configPath);
|
|
2832
|
+
if (!config.mcpServers || typeof config.mcpServers !== "object") {
|
|
2833
|
+
config.mcpServers = {};
|
|
2834
|
+
}
|
|
2835
|
+
config.mcpServers[SERVER_NAME] = {
|
|
2836
|
+
serverUrl: `${CONARE_URL}/mcp`,
|
|
2837
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2838
|
+
};
|
|
2839
|
+
writeJsonFile(configPath, config);
|
|
2840
|
+
return "\x1B[32m✓\x1B[0m Antigravity";
|
|
2841
|
+
}
|
|
2539
2842
|
var CLIENT_CONFIGURATORS = {
|
|
2540
2843
|
claude: configureClaude,
|
|
2541
2844
|
codex: configureCodex,
|
|
@@ -2544,7 +2847,8 @@ var CLIENT_CONFIGURATORS = {
|
|
|
2544
2847
|
vscode: configureVscode,
|
|
2545
2848
|
cline: configureCline,
|
|
2546
2849
|
zed: configureZed,
|
|
2547
|
-
openclaw: configureOpenclaw
|
|
2850
|
+
openclaw: configureOpenclaw,
|
|
2851
|
+
antigravity: configureAntigravity
|
|
2548
2852
|
};
|
|
2549
2853
|
var SKILL_MD = `---
|
|
2550
2854
|
name: conare
|
|
@@ -2697,16 +3001,6 @@ function saveApiKey(apiKey) {
|
|
|
2697
3001
|
function getSavedApiKey() {
|
|
2698
3002
|
return readConfig().apiKey;
|
|
2699
3003
|
}
|
|
2700
|
-
function addIndexedPath(absPath) {
|
|
2701
|
-
const config = readConfig();
|
|
2702
|
-
const paths = new Set(config.indexedPaths || []);
|
|
2703
|
-
paths.add(absPath);
|
|
2704
|
-
config.indexedPaths = [...paths];
|
|
2705
|
-
writeConfig(config);
|
|
2706
|
-
}
|
|
2707
|
-
function getIndexedPaths() {
|
|
2708
|
-
return readConfig().indexedPaths || [];
|
|
2709
|
-
}
|
|
2710
3004
|
|
|
2711
3005
|
// src/sync.ts
|
|
2712
3006
|
import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4, unlinkSync, readFileSync as readFileSync9, chmodSync, cpSync, rmSync as rmSync2, symlinkSync as symlinkSync2, readlinkSync as readlinkSync2, appendFileSync } from "node:fs";
|
|
@@ -3233,10 +3527,12 @@ function renderProgressSummary(success, failed, noun) {
|
|
|
3233
3527
|
return `\r \x1B[32m✓\x1B[0m [\x1B[36m${bar}\x1B[0m] ${success} ${noun}, ${failed} failed (${pct}%)${" ".repeat(12)}
|
|
3234
3528
|
`;
|
|
3235
3529
|
}
|
|
3236
|
-
function renderDiscoverySummary(discovered,
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3530
|
+
function renderDiscoverySummary(discovered, _filtered, deduped) {
|
|
3531
|
+
if (discovered === 0 && deduped === 0)
|
|
3532
|
+
return "no conversations found";
|
|
3533
|
+
if (discovered === 0 && deduped > 0)
|
|
3534
|
+
return `${deduped} already imported, nothing new`;
|
|
3535
|
+
const parts = [`${discovered} new`];
|
|
3240
3536
|
if (deduped > 0)
|
|
3241
3537
|
parts.push(`${deduped} already imported`);
|
|
3242
3538
|
return parts.join(", ");
|
|
@@ -3420,7 +3716,6 @@ async function main() {
|
|
|
3420
3716
|
let effectiveConfigOnly = opts.configOnly;
|
|
3421
3717
|
let effectiveIngestOnly = opts.ingestOnly;
|
|
3422
3718
|
let effectiveIndexPath = opts.indexPath;
|
|
3423
|
-
let postIngestIndexPath;
|
|
3424
3719
|
let selectedSources = opts.source ? [opts.source] : ["claude", "cursor", "codex"];
|
|
3425
3720
|
let apiKey = opts.key || configFileKey || process.env.CONARE_API_KEY || savedApiKey;
|
|
3426
3721
|
let interactiveTargets = MCP_TARGETS.map((target) => ({
|
|
@@ -3613,7 +3908,6 @@ Nothing new to index.`);
|
|
|
3613
3908
|
write(renderProgressSummary(success, failed, "indexed"));
|
|
3614
3909
|
const fileHashes = results.filter((result) => result.success).map((result) => getManifestFingerprint(memories[result.index])).filter((key) => !!key);
|
|
3615
3910
|
markIngested("codebase", fileHashes);
|
|
3616
|
-
addIndexedPath(absPath);
|
|
3617
3911
|
if (!opts.quiet)
|
|
3618
3912
|
printFailureSummary(results, memories);
|
|
3619
3913
|
}
|
|
@@ -3694,6 +3988,22 @@ Nothing new to index.`);
|
|
|
3694
3988
|
return db.localeCompare(da);
|
|
3695
3989
|
});
|
|
3696
3990
|
log();
|
|
3991
|
+
if (allMemories.length > 2000 && !opts.dryRun && !opts.quiet) {
|
|
3992
|
+
if (hasTty) {
|
|
3993
|
+
const { confirm: confirm2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
3994
|
+
const proceed = await confirm2({
|
|
3995
|
+
message: `That's ${allMemories.length.toLocaleString()} memories — this may take a while and use significant resources. Continue?`
|
|
3996
|
+
});
|
|
3997
|
+
if (!proceed || typeof proceed === "symbol") {
|
|
3998
|
+
log("Aborted.");
|
|
3999
|
+
process.exit(0);
|
|
4000
|
+
}
|
|
4001
|
+
} else {
|
|
4002
|
+
log(`Warning: ${allMemories.length.toLocaleString()} memories detected. Skipping large upload in non-interactive mode.`);
|
|
4003
|
+
log("Re-run interactively or with --force to proceed.");
|
|
4004
|
+
process.exit(0);
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
3697
4007
|
if (allMemories.length === 0) {
|
|
3698
4008
|
log("Nothing new to upload.");
|
|
3699
4009
|
} else if (opts.dryRun) {
|
|
@@ -3747,36 +4057,14 @@ Nothing new to index.`);
|
|
|
3747
4057
|
}
|
|
3748
4058
|
}
|
|
3749
4059
|
log();
|
|
3750
|
-
if (effectiveIngestOnly && !opts.dryRun) {
|
|
3751
|
-
const savedPaths = getIndexedPaths();
|
|
3752
|
-
for (const savedPath of savedPaths) {
|
|
3753
|
-
if (!existsSync9(savedPath))
|
|
3754
|
-
continue;
|
|
3755
|
-
try {
|
|
3756
|
-
const { memories: codeMemories, project } = indexCodebase(savedPath, { changedOnly: true });
|
|
3757
|
-
if (codeMemories.length === 0)
|
|
3758
|
-
continue;
|
|
3759
|
-
log(` Re-indexing ${project}: ${codeMemories.length} changed files`);
|
|
3760
|
-
const { success, failed, results } = await uploadBulk(apiKey, codeMemories, () => {});
|
|
3761
|
-
if (!opts.quiet)
|
|
3762
|
-
log(` ${project}: ${success} indexed, ${failed} failed`);
|
|
3763
|
-
const fileHashes = results.filter((r2) => r2.success).map((r2) => getManifestFingerprint(codeMemories[r2.index])).filter((k3) => !!k3);
|
|
3764
|
-
markIngested("codebase", fileHashes);
|
|
3765
|
-
} catch {}
|
|
3766
|
-
}
|
|
3767
|
-
}
|
|
3768
4060
|
if (interactiveMode) {
|
|
3769
4061
|
selectedTargets = await selectMcpTargets(interactiveTargets);
|
|
3770
|
-
|
|
3771
|
-
if (selectedTargets.length === 0 && selectedSources.length === 0 && !shouldIndexCurrentCodebase) {
|
|
4062
|
+
if (selectedTargets.length === 0 && selectedSources.length === 0) {
|
|
3772
4063
|
effectiveConfigOnly = false;
|
|
3773
4064
|
effectiveIngestOnly = false;
|
|
3774
4065
|
} else {
|
|
3775
4066
|
effectiveIngestOnly = selectedTargets.length === 0;
|
|
3776
4067
|
}
|
|
3777
|
-
if (shouldIndexCurrentCodebase) {
|
|
3778
|
-
postIngestIndexPath = ".";
|
|
3779
|
-
}
|
|
3780
4068
|
finishSetup();
|
|
3781
4069
|
}
|
|
3782
4070
|
if (!opts.dryRun && !effectiveIngestOnly) {
|
|
@@ -3787,35 +4075,6 @@ Nothing new to index.`);
|
|
|
3787
4075
|
for (const line of mcpLines)
|
|
3788
4076
|
log(` ${line}`);
|
|
3789
4077
|
}
|
|
3790
|
-
if (postIngestIndexPath) {
|
|
3791
|
-
const { resolve: resolve2 } = await import("node:path");
|
|
3792
|
-
const absPath = resolve2(postIngestIndexPath);
|
|
3793
|
-
const idxSpinner = Y2();
|
|
3794
|
-
idxSpinner.start("Indexing codebase...");
|
|
3795
|
-
const { memories, fileCount, skipped, project } = indexCodebase(absPath, {
|
|
3796
|
-
project: opts.indexProject
|
|
3797
|
-
});
|
|
3798
|
-
idxSpinner.stop(`Codebase: ${fileCount} files found, ${skipped} skipped (project: ${project})`);
|
|
3799
|
-
if (memories.length === 0) {
|
|
3800
|
-
log(`
|
|
3801
|
-
Nothing new to index.`);
|
|
3802
|
-
} else {
|
|
3803
|
-
const barWidth = 20;
|
|
3804
|
-
const { success, failed, results } = await uploadBulk(apiKey, memories, (uploaded, total, _failed) => {
|
|
3805
|
-
const pct = (uploaded / total * 100).toFixed(1);
|
|
3806
|
-
const filled = Math.round(uploaded / total * barWidth);
|
|
3807
|
-
const bar = "█".repeat(filled) + "░".repeat(barWidth - filled);
|
|
3808
|
-
write(`\r Uploading [\x1B[36m${bar}\x1B[0m] ${uploaded}/${total} (${pct}%)`);
|
|
3809
|
-
});
|
|
3810
|
-
write(renderProgressSummary(success, failed, "indexed"));
|
|
3811
|
-
const fileHashes = results.filter((result) => result.success).map((result) => getManifestFingerprint(memories[result.index])).filter((key) => !!key);
|
|
3812
|
-
markIngested("codebase", fileHashes);
|
|
3813
|
-
addIndexedPath(absPath);
|
|
3814
|
-
if (!opts.quiet)
|
|
3815
|
-
printFailureSummary(results, memories);
|
|
3816
|
-
}
|
|
3817
|
-
log("");
|
|
3818
|
-
}
|
|
3819
4078
|
if (!opts.dryRun && !opts.quiet) {
|
|
3820
4079
|
try {
|
|
3821
4080
|
persistAndInstallGlobal(apiKey);
|