@conveno/cli 0.2.0-rc.8 → 0.2.0-rc.9
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/{acp-YHhVx0Ya.js → acp-BVk6rmXR.js} +3 -3
- package/dist/{agy-relay-BS2NeFlh.js → agy-relay-D8eZcLuc.js} +2 -2
- package/dist/{args-CGL-AmNd.js → args-B3Cj2Ie4.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/daemon.js +4 -4
- package/dist/{daemonError-DJ-P55nH.js → daemonError-C05GqdhQ.js} +1 -1
- package/dist/{dist-B6Sm0MRT.js → dist-BjdBeCHy.js} +143 -48
- package/dist/{dist-C6cMQ00I.js → dist-CVdpCNJo.js} +1 -1
- package/dist/{dist-WTkKRM39.js → dist-D_O_JLLq.js} +1 -1
- package/dist/{dist-CcoTmwrf.js → dist-DaIpdMke.js} +46 -50
- package/dist/{dist-BlWWt5gx.js → dist-DzpERiRx.js} +3 -3
- package/dist/{dist-B1EVHdIM.js → dist-MK-cK1JY.js} +487 -22
- package/dist/{dist-BBdba94T.js → dist-STNJjbNH.js} +177 -50
- package/dist/{hook-DxjJDCjz.js → hook-CDF1A8AY.js} +25 -5
- package/dist/{hook-entry-pHJioNgN.js → hook-entry-BTJK7aO0.js} +13 -7
- package/dist/hook-entry-D6zup0QV.js +1 -0
- package/dist/{main-DrzHsV5y.js → main-Kv31Qxro.js} +12 -12
- package/dist/{pick-Bi1yJDh6.js → pick-DLp6w_-z.js} +1 -1
- package/dist/{run-C32oP2c_.js → run-BPtFUGtu.js} +75 -16
- package/dist/{runtime-Db_YT5Xg.js → runtime-xjPzIGmp.js} +72 -13
- package/dist/{uninstall-D9rW_j7H.js → uninstall-8AHErPRN.js} +206 -32
- package/dist/{watch-BrTWYf3Y.js → watch-D0KIPowJ.js} +4 -4
- package/package.json +15 -15
- package/dist/hook-entry-CrpZz5QW.js +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
1
|
+
import { execFile, spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { delimiter, join, win32 } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { n as antigravityAdapter } from "./dist-
|
|
8
|
-
import { a as opencodeAdapter, c as claudeAdapter, o as cursorAdapter, r as readAllStdin, s as copilotAdapter } from "./hook-entry-
|
|
9
|
-
import { t as codexAdapter } from "./dist-
|
|
10
|
-
import { t as grokAdapter } from "./dist-
|
|
7
|
+
import { n as antigravityAdapter } from "./dist-BjdBeCHy.js";
|
|
8
|
+
import { a as opencodeAdapter, c as claudeAdapter, o as cursorAdapter, r as readAllStdin, s as copilotAdapter } from "./hook-entry-BTJK7aO0.js";
|
|
9
|
+
import { t as codexAdapter } from "./dist-MK-cK1JY.js";
|
|
10
|
+
import { t as grokAdapter } from "./dist-DaIpdMke.js";
|
|
11
11
|
import { t as createTheme } from "./dist-BRjg9CLd.js";
|
|
12
|
-
import { n as connect$1 } from "./dist-
|
|
13
|
-
import {
|
|
14
|
-
import "./dist-
|
|
12
|
+
import { n as connect$1 } from "./dist-D_O_JLLq.js";
|
|
13
|
+
import { Dt as readCommandLine, Et as readAncestry, Gt as spawnSession, In as _enum, Ln as array, P as dataDir, R as detectRepo, Rn as boolean, S as baseName, T as claimSpawnRecord, Un as string, Vn as number, Y as formatInbox, an as CLI_KINDS, at as launcherText, f as SpawnError, fn as MessageId, gn as RpcErrorCode, ht as parsePs1ShimTarget, it as launcherPath, jt as realSpawnDeps, lt as needsQuoting, mt as parseCmdShimTarget, o as HEARTBEAT_INTERVAL_MS, pn as OWNER_SESSION_ID, r as ConvenoError, s as NOT_FROM_USER_NOTICE, tn as validateRename, u as SPAWN_CLIS, xt as planSpawn, y as attachAcpSession, yn as SessionId, zt as resolveWindowsCommand } from "./dist-STNJjbNH.js";
|
|
14
|
+
import "./dist-CVdpCNJo.js";
|
|
15
15
|
import { access } from "node:fs/promises";
|
|
16
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
-
// ../daemon/dist/server
|
|
18
|
+
// ../daemon/dist/server-Bw6tm8hc.js
|
|
19
19
|
/** `kill(pid, 0)` liveness: EPERM means the process exists but belongs to someone else. */
|
|
20
20
|
function defaultIsAlive(pid) {
|
|
21
21
|
try {
|
|
@@ -28,7 +28,7 @@ function defaultIsAlive(pid) {
|
|
|
28
28
|
`${OWNER_SESSION_ID}`;
|
|
29
29
|
SessionId.parse("0".repeat(26));
|
|
30
30
|
// ../mcp/dist/index.js
|
|
31
|
-
const SERVER_VERSION = "0.2.0-rc.
|
|
31
|
+
const SERVER_VERSION = "0.2.0-rc.9";
|
|
32
32
|
const ok = (text) => ({ content: [{
|
|
33
33
|
type: "text",
|
|
34
34
|
text
|
|
@@ -564,6 +564,13 @@ function windowsConvenoIsThisInstall(env, binPath, io = defaultShimIo) {
|
|
|
564
564
|
const shim = found && /\.(cmd|bat)$/i.test(found) ? found : findPs1(env, io);
|
|
565
565
|
return shim !== void 0 && shimPointsAt(shim, binPath, io);
|
|
566
566
|
}
|
|
567
|
+
/** Windows: is there a `conveno.cmd` next to the `conveno` shim PATH finds. */
|
|
568
|
+
function windowsCmdShimOnPath(env, io = defaultShimIo) {
|
|
569
|
+
const found = resolveWindowsCommand("conveno", env, io.isFile);
|
|
570
|
+
if (found && /\.(cmd|bat)$/i.test(found)) return true;
|
|
571
|
+
const ps1 = findPs1(env, io);
|
|
572
|
+
return ps1 !== void 0 && io.isFile(win32.join(win32.dirname(ps1), "conveno.cmd"));
|
|
573
|
+
}
|
|
567
574
|
// src/runtime.ts
|
|
568
575
|
/**
|
|
569
576
|
* Path of the daemon's entry script: `daemon.js`, built next to `bin.js` in this package's dist.
|
|
@@ -602,6 +609,56 @@ function pathConvenoIsThisInstall(env, binPath, platform, shimIo) {
|
|
|
602
609
|
function convenoCommand(env, platform, binPath = cliBinPath(), nodePath = process.execPath, shimIo) {
|
|
603
610
|
return pathConvenoIsThisInstall(env, binPath, platform, shimIo) ? ["conveno"] : [nodePath, binPath];
|
|
604
611
|
}
|
|
612
|
+
/** The 8.3 short form of a Windows path, or the path itself when it cannot be read. */
|
|
613
|
+
function windowsShortPath(path, run = (c) => spawnSync("cmd", [
|
|
614
|
+
"/d",
|
|
615
|
+
"/c",
|
|
616
|
+
c
|
|
617
|
+
], {
|
|
618
|
+
encoding: "utf8",
|
|
619
|
+
windowsHide: true,
|
|
620
|
+
windowsVerbatimArguments: true
|
|
621
|
+
}).stdout ?? "", exists = existsSync) {
|
|
622
|
+
let head = path;
|
|
623
|
+
const tail = [];
|
|
624
|
+
while (!exists(head)) {
|
|
625
|
+
const up = win32.dirname(head);
|
|
626
|
+
if (up === head) return path;
|
|
627
|
+
tail.unshift(win32.basename(head));
|
|
628
|
+
head = up;
|
|
629
|
+
}
|
|
630
|
+
try {
|
|
631
|
+
const short = run(`for %I in ("${head}") do @echo %~sI`).trim();
|
|
632
|
+
return short ? win32.join(short, ...tail) : path;
|
|
633
|
+
} catch {
|
|
634
|
+
return path;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const isAscii = (s) => /^[\x20-\x7e]*$/.test(s);
|
|
638
|
+
/** The launcher script for this install, and how the PATH `conveno` relates to it. */
|
|
639
|
+
function convenoLauncher(env, platform, dir, binPath = cliBinPath(), nodePath = process.execPath, shimIo, home = homedir(), shortPath = windowsShortPath) {
|
|
640
|
+
const onPath = pathConvenoIsThisInstall(env, binPath, platform, shimIo);
|
|
641
|
+
const win = platform === "win32";
|
|
642
|
+
const plain = (p) => !needsQuoting(win ? p.replace(/\\/g, "/") : p);
|
|
643
|
+
let path = launcherPath(platform, dir, home);
|
|
644
|
+
if (win && !plain(path)) path = shortPath(path);
|
|
645
|
+
let node = nodePath;
|
|
646
|
+
let bin = binPath;
|
|
647
|
+
let ascii = true;
|
|
648
|
+
if (win) {
|
|
649
|
+
const short = (p) => isAscii(p) ? p : shortPath(p);
|
|
650
|
+
node = short(node);
|
|
651
|
+
bin = short(bin);
|
|
652
|
+
ascii = isAscii(node) && isAscii(bin);
|
|
653
|
+
}
|
|
654
|
+
return {
|
|
655
|
+
path,
|
|
656
|
+
...!plain(path) || !ascii ? { spaced: true } : {},
|
|
657
|
+
text: launcherText(platform, node, bin),
|
|
658
|
+
onPath,
|
|
659
|
+
cmdShim: platform === "win32" && onPath && windowsCmdShimOnPath(env, shimIo)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
605
662
|
function exec(cmd, args) {
|
|
606
663
|
const plan = planSpawn(cmd, args);
|
|
607
664
|
return new Promise((resolve, reject) => {
|
|
@@ -667,16 +724,18 @@ function createRuntimeCtx() {
|
|
|
667
724
|
const platform = process.platform;
|
|
668
725
|
const theme = createTheme();
|
|
669
726
|
const daemonEntry = resolveDaemonEntry();
|
|
727
|
+
const dir = dataDir(platform, env, home);
|
|
670
728
|
return {
|
|
671
729
|
home,
|
|
672
730
|
platform,
|
|
673
731
|
cwd: process.cwd(),
|
|
674
732
|
env,
|
|
675
|
-
dataDir:
|
|
733
|
+
dataDir: dir,
|
|
676
734
|
...daemonEntry ? { daemonEntry } : {},
|
|
677
735
|
conveno: {
|
|
678
736
|
command: convenoCommand(env, platform),
|
|
679
|
-
bin: cliBinPath()
|
|
737
|
+
bin: cliBinPath(),
|
|
738
|
+
launcher: convenoLauncher(env, platform, dir, void 0, void 0, void 0, home)
|
|
680
739
|
},
|
|
681
740
|
adapters: [
|
|
682
741
|
claudeAdapter,
|
|
@@ -710,4 +769,4 @@ function createRuntimeCtx() {
|
|
|
710
769
|
hookTimeoutMs: 2e3
|
|
711
770
|
};
|
|
712
771
|
}
|
|
713
|
-
export { ask, cliBinPath, convenoCommand, createRuntimeCtx, pathConvenoIsThisInstall, promptLine, resolveDaemonEntry };
|
|
772
|
+
export { ask, cliBinPath, convenoCommand, convenoLauncher, createRuntimeCtx, pathConvenoIsThisInstall, promptLine, resolveDaemonEntry, windowsShortPath };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as completeLogin, F as dataPaths, G as fetchAccountStatus, K as findOnPath, Lt as resolveAcpProgram, Nt as requestDeviceCode, St as pollDeviceCode, Tt as readAccountTokens, an as CLI_KINDS, d as SPAWN_TABLE, g as adapterNpxCommand, h as adapterInstallCommand, in as writeSettings, k as compatStatus, kt as readSettings, m as acpOverrideVar, n as AccountError, st as logoutAccount, vt as pinnedAdapter } from "./dist-STNJjbNH.js";
|
|
2
2
|
import { a as fail, c as plural, d as warnBlock, i as errorBlock, l as seconds, n as cmd, o as localStamp, r as columns, s as plainError, t as closest, u as tilde } from "./fmt-C2SsP5Y0.js";
|
|
3
|
-
import { a as parseFlags, n as COMMANDS } from "./args-
|
|
3
|
+
import { a as parseFlags, n as COMMANDS } from "./args-B3Cj2Ie4.js";
|
|
4
4
|
import { n as connectOpts, t as adapterEnv } from "./ctx-tYftvhz_.js";
|
|
5
|
-
import { t as daemonProblem } from "./daemonError-
|
|
5
|
+
import { t as daemonProblem } from "./daemonError-C05GqdhQ.js";
|
|
6
6
|
import { basename, dirname, join } from "node:path";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { access, chmod, mkdir, open, readFile, readdir, realpath, rename as rename$1, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
@@ -964,14 +964,14 @@ const realIo = {
|
|
|
964
964
|
* compare it with the plan just before writing, and `applyChanges` restores every file from its
|
|
965
965
|
* backup if any write fails. No temp file exists on this path, so none can be left behind.
|
|
966
966
|
*/
|
|
967
|
-
async function writeAtomic(path, data, io = realIo) {
|
|
967
|
+
async function writeAtomic(path, data, io = realIo, wantMode) {
|
|
968
968
|
const target = await io.realpath(path).catch(() => path);
|
|
969
969
|
await io.mkdir(dirname(target));
|
|
970
970
|
if (io.platform === "win32") {
|
|
971
971
|
await io.overwrite(target, data);
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
|
-
const mode = await io.mode(target);
|
|
974
|
+
const mode = wantMode ?? await io.mode(target);
|
|
975
975
|
const tmp = join(dirname(target), `.${basename(target)}.conveno-${randomBytes(6).toString("hex")}.tmp`);
|
|
976
976
|
try {
|
|
977
977
|
await io.writeFile(tmp, data, mode ?? 420);
|
|
@@ -1035,7 +1035,8 @@ async function applyChanges(ctx, items, opts = {}) {
|
|
|
1035
1035
|
path: change.path,
|
|
1036
1036
|
backup,
|
|
1037
1037
|
description: change.description,
|
|
1038
|
-
...change.deleteFile ? {} : { afterSha256: sha256(change.after) }
|
|
1038
|
+
...change.deleteFile ? {} : { afterSha256: sha256(change.after) },
|
|
1039
|
+
...change.pruneEmptyDir === void 0 ? {} : { pruneEmptyDir: change.pruneEmptyDir }
|
|
1039
1040
|
});
|
|
1040
1041
|
}
|
|
1041
1042
|
const manifest = {
|
|
@@ -1068,12 +1069,8 @@ async function applyChanges(ctx, items, opts = {}) {
|
|
|
1068
1069
|
await currentIfUnchanged(change);
|
|
1069
1070
|
if (change.deleteFile) {
|
|
1070
1071
|
await io.rm(change.path);
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
if (!await rmdir(dir).then(() => true, () => false)) break;
|
|
1074
|
-
dir = dirname(dir);
|
|
1075
|
-
}
|
|
1076
|
-
} else await writeAtomic(change.path, change.after, io);
|
|
1072
|
+
if (change.pruneEmptyDir !== void 0) await pruneEmptyDirs(change.path, change.pruneEmptyDir);
|
|
1073
|
+
} else await writeAtomic(change.path, change.after, io, change.mode);
|
|
1077
1074
|
}
|
|
1078
1075
|
how.push({
|
|
1079
1076
|
cli,
|
|
@@ -1166,12 +1163,22 @@ async function previewRestore(manifests) {
|
|
|
1166
1163
|
}
|
|
1167
1164
|
return rows;
|
|
1168
1165
|
}
|
|
1166
|
+
/** Remove up to `levels` empty folders above `file`, stopping at the first one with anything in it. */
|
|
1167
|
+
async function pruneEmptyDirs(file, levels) {
|
|
1168
|
+
let dir = dirname(file);
|
|
1169
|
+
for (let n = levels === true ? 1 : levels; n > 0; n--) {
|
|
1170
|
+
if (!await rmdir(dir).then(() => true, () => false)) break;
|
|
1171
|
+
dir = dirname(dir);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1169
1174
|
/** Restore one file as init found it, when it still matches. Returns the action taken. */
|
|
1170
1175
|
async function restoreEntry(dir, entry) {
|
|
1171
1176
|
const bytes = await readBytes(entry.path);
|
|
1172
1177
|
const action = actionFor(entry, bytes === null ? null : sha256(bytes));
|
|
1173
|
-
if (action === "remove")
|
|
1174
|
-
|
|
1178
|
+
if (action === "remove") {
|
|
1179
|
+
await rm(entry.path, { force: true });
|
|
1180
|
+
if (entry.pruneEmptyDir !== void 0) await pruneEmptyDirs(entry.path, entry.pruneEmptyDir);
|
|
1181
|
+
} else if (action === "restore" && entry.backup !== null) await writeAtomic(entry.path, await readFile(join(dir, entry.backup)));
|
|
1175
1182
|
return action;
|
|
1176
1183
|
}
|
|
1177
1184
|
async function markRestored(ctx, found) {
|
|
@@ -1241,11 +1248,14 @@ async function collectPlans(ctx, found, which, baseline, accept = []) {
|
|
|
1241
1248
|
const items = [];
|
|
1242
1249
|
const failures = [];
|
|
1243
1250
|
for (const { adapter, detection } of found) try {
|
|
1244
|
-
for (const change of await (which === "plan" ? adapter.plan(env, { accept }) : adapter.uninstallPlan(env, baseline)))
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1251
|
+
for (const change of await (which === "plan" ? adapter.plan(env, { accept }) : adapter.uninstallPlan(env, baseline))) {
|
|
1252
|
+
if (items.some((i) => i.change.path === change.path && i.change.after === change.after)) continue;
|
|
1253
|
+
items.push({
|
|
1254
|
+
cli: adapter.cli,
|
|
1255
|
+
installed: detection.installed,
|
|
1256
|
+
change
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1249
1259
|
} catch (e) {
|
|
1250
1260
|
failures.push({
|
|
1251
1261
|
cli: adapter.cli,
|
|
@@ -1277,8 +1287,10 @@ const staleFailure = (ctx, e, rerun) => fail(ctx, {
|
|
|
1277
1287
|
async function confirmAndApply(ctx, items, opts) {
|
|
1278
1288
|
const t = ctx.theme;
|
|
1279
1289
|
const files = new Set(items.map((i) => i.change.path)).size;
|
|
1280
|
-
|
|
1290
|
+
const notes = opts.notes ?? [];
|
|
1291
|
+
ctx.out(`${t.bold(`Conveno will change ${plural(files, "file")}.`)}${notes.length > 0 ? "" : " Nothing else is touched."}\n\n`);
|
|
1281
1292
|
presentChanges(ctx, items);
|
|
1293
|
+
for (const n of notes) ctx.out(` ${n}\n\n`);
|
|
1282
1294
|
const paths = dataPaths(ctx.platform, ctx.dataDir);
|
|
1283
1295
|
ctx.out(` ${t.paint("quiet", `Backups go to ${tilde(paths.backups, ctx.home)}/<timestamp>/`)}\n`);
|
|
1284
1296
|
ctx.out(` ${t.paint("quiet", "Undo any time with:")} ${cmd(t, "conveno uninstall")}\n\n`);
|
|
@@ -1300,7 +1312,7 @@ async function confirmAndApply(ctx, items, opts) {
|
|
|
1300
1312
|
if (code !== 0) return { exit: code };
|
|
1301
1313
|
}
|
|
1302
1314
|
try {
|
|
1303
|
-
return { applied: await applyChanges(ctx, items, opts.markRestored ? { markRestored: true } : {}) };
|
|
1315
|
+
return { applied: await applyChanges(ctx, [...items, ...opts.backups ?? []], opts.markRestored ? { markRestored: true } : {}) };
|
|
1304
1316
|
} catch (e) {
|
|
1305
1317
|
if (e instanceof StaleError) return { exit: staleFailure(ctx, e, opts.rerun) };
|
|
1306
1318
|
if (e instanceof ApplyError && !e.rolledBack) return { exit: fail(ctx, {
|
|
@@ -1319,20 +1331,135 @@ async function confirmAndApply(ctx, items, opts) {
|
|
|
1319
1331
|
}) };
|
|
1320
1332
|
}
|
|
1321
1333
|
}
|
|
1322
|
-
/**
|
|
1334
|
+
/**
|
|
1335
|
+
* Every optional question for these CLIs that is not yet turned on. `enabled` throwing counts as
|
|
1336
|
+
* on: nothing to offer. So does an option the tool cannot take (`available` false).
|
|
1337
|
+
*/
|
|
1323
1338
|
async function pendingOptions(ctx, adapters) {
|
|
1324
1339
|
const env = adapterEnv(ctx);
|
|
1325
1340
|
const out = [];
|
|
1326
1341
|
for (const a of adapters) for (const o of a.optional ?? []) {
|
|
1342
|
+
if (o.available && !await o.available(env).catch(() => false)) continue;
|
|
1327
1343
|
if (await o.enabled(env).catch(() => true)) continue;
|
|
1328
1344
|
out.push({
|
|
1329
1345
|
cli: a.cli,
|
|
1330
1346
|
id: o.id,
|
|
1331
|
-
question: o.question
|
|
1347
|
+
question: o.question,
|
|
1348
|
+
defaultYes: o.defaultYes === true
|
|
1332
1349
|
});
|
|
1333
1350
|
}
|
|
1334
1351
|
return out;
|
|
1335
1352
|
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Run the follow-up step of the options answered yes, for options that are not file edits (they
|
|
1355
|
+
* have `apply`). Each failure comes back as one friendly line and never stops the setup.
|
|
1356
|
+
*/
|
|
1357
|
+
async function applyOptions(ctx, adapters, accepted) {
|
|
1358
|
+
const env = adapterEnv(ctx);
|
|
1359
|
+
const yes = new Set(accepted);
|
|
1360
|
+
const done = [];
|
|
1361
|
+
const problems = [];
|
|
1362
|
+
for (const a of adapters) for (const o of a.optional ?? []) {
|
|
1363
|
+
if (!yes.has(o.id) || !o.apply) continue;
|
|
1364
|
+
try {
|
|
1365
|
+
const r = await o.apply(env);
|
|
1366
|
+
if (r.ok) done.push({
|
|
1367
|
+
cli: a.cli,
|
|
1368
|
+
id: o.id
|
|
1369
|
+
});
|
|
1370
|
+
else problems.push(r.message);
|
|
1371
|
+
} catch {
|
|
1372
|
+
problems.push(`Couldn't finish setting up ${a.displayName}.`);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return {
|
|
1376
|
+
done,
|
|
1377
|
+
problems
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Whether setup has taken care of a tool's first-run approvals: true when every approval option it
|
|
1382
|
+
* has is in place. Undefined when the tool has none, so its note is unchanged.
|
|
1383
|
+
*/
|
|
1384
|
+
async function approvedBySetup(ctx, adapter) {
|
|
1385
|
+
const env = adapterEnv(ctx);
|
|
1386
|
+
const approvals = (adapter.optional ?? []).filter((o) => o.approval === true);
|
|
1387
|
+
if (approvals.length === 0) return void 0;
|
|
1388
|
+
for (const o of approvals) if (!await o.enabled(env).catch(() => false)) return false;
|
|
1389
|
+
return true;
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* Approval options that are already on for a tool this run changes. Codex calls a hook it has
|
|
1393
|
+
* trusted "modified" once its command changes (a moved `conveno`), so the approval is given again.
|
|
1394
|
+
*/
|
|
1395
|
+
async function renewedApprovals(ctx, adapters, items) {
|
|
1396
|
+
const env = adapterEnv(ctx);
|
|
1397
|
+
const ids = [];
|
|
1398
|
+
for (const a of adapters) {
|
|
1399
|
+
if (!items.some((i) => i.cli === a.cli)) continue;
|
|
1400
|
+
for (const o of a.optional ?? []) {
|
|
1401
|
+
if (o.approval !== true || !o.apply) continue;
|
|
1402
|
+
if (o.available && !await o.available(env).catch(() => false)) continue;
|
|
1403
|
+
if (await o.enabled(env).catch(() => false)) ids.push(o.id);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
return ids;
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* What the options answered yes write outside the plan: a line for each, and the files as
|
|
1410
|
+
* no-change entries so they are backed up with the rest (a file the plan already changes is not
|
|
1411
|
+
* listed twice, and a file that does not exist has nothing to back up).
|
|
1412
|
+
*/
|
|
1413
|
+
async function approvalWrites(ctx, adapters, ids, items) {
|
|
1414
|
+
const env = adapterEnv(ctx);
|
|
1415
|
+
const notes = [];
|
|
1416
|
+
const backups = [];
|
|
1417
|
+
for (const a of adapters) for (const o of a.optional ?? []) {
|
|
1418
|
+
if (!ids.has(o.id) || !o.applyWrites) continue;
|
|
1419
|
+
const w = o.applyWrites(env);
|
|
1420
|
+
notes.push(w.note);
|
|
1421
|
+
for (const path of w.paths) {
|
|
1422
|
+
if ([...items, ...backups].some((i) => i.change.path === path)) continue;
|
|
1423
|
+
const text = await readFile(path, "utf8").catch(() => null);
|
|
1424
|
+
if (text === null) continue;
|
|
1425
|
+
backups.push({
|
|
1426
|
+
cli: a.cli,
|
|
1427
|
+
installed: true,
|
|
1428
|
+
change: {
|
|
1429
|
+
component: "hooks",
|
|
1430
|
+
kind: "update",
|
|
1431
|
+
path,
|
|
1432
|
+
before: text,
|
|
1433
|
+
after: text,
|
|
1434
|
+
description: `${a.displayName} approval of Conveno's hooks, written by ${a.displayName}.`
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
return {
|
|
1440
|
+
notes,
|
|
1441
|
+
backups
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* After a tool wrote its own approval into a backed-up file, record the file as it is now, so
|
|
1446
|
+
* `conveno uninstall` still sees it as the one setup left and can restore the backup.
|
|
1447
|
+
*/
|
|
1448
|
+
async function refreshManifest(backupDir, paths) {
|
|
1449
|
+
const file = join(backupDir, "manifest.json");
|
|
1450
|
+
try {
|
|
1451
|
+
const manifest = JSON.parse(await readFile(file, "utf8"));
|
|
1452
|
+
let changed = false;
|
|
1453
|
+
for (const e of manifest.entries) {
|
|
1454
|
+
if (!paths.includes(e.path)) continue;
|
|
1455
|
+
const now = await readFile(e.path).catch(() => null);
|
|
1456
|
+
if (now === null) continue;
|
|
1457
|
+
e.afterSha256 = sha256(now);
|
|
1458
|
+
changed = true;
|
|
1459
|
+
}
|
|
1460
|
+
if (changed) await writeFile(file, `${JSON.stringify(manifest, null, 2)}\n`, { mode: 384 });
|
|
1461
|
+
} catch {}
|
|
1462
|
+
}
|
|
1336
1463
|
/** The changes `with` has that `base` does not: a different file, or the same file with other text. */
|
|
1337
1464
|
function extraChanges(base, withOpt) {
|
|
1338
1465
|
const had = new Set(base.map((i) => `${i.change.path}\0${i.change.after}\0${i.change.kind}`));
|
|
@@ -1425,14 +1552,19 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1425
1552
|
const dryRun = Boolean(values["dry-run"]);
|
|
1426
1553
|
for (const o of pending) {
|
|
1427
1554
|
if (accepted.has(o.id)) continue;
|
|
1428
|
-
if (dryRun || values.yes === true || !ctx.interactive)
|
|
1429
|
-
|
|
1555
|
+
if (dryRun || values.yes === true || !ctx.interactive) {
|
|
1556
|
+
if (acceptRaw === void 0 && o.defaultYes) accepted.add(o.id);
|
|
1557
|
+
continue;
|
|
1558
|
+
}
|
|
1559
|
+
if (await ctx.confirm(o.question, o.defaultYes)) accepted.add(o.id);
|
|
1430
1560
|
}
|
|
1431
1561
|
const { items, failures } = await collectPlans(ctx, installed, "plan", void 0, [...accepted]);
|
|
1432
1562
|
if (failures.length > 0) {
|
|
1433
1563
|
reportFailures(ctx, failures, `conveno ${name} --cli <others>`);
|
|
1434
1564
|
return 1;
|
|
1435
1565
|
}
|
|
1566
|
+
const adapters = installed.map((f) => f.adapter);
|
|
1567
|
+
const applying = /* @__PURE__ */ new Set([...accepted, ...dryRun ? [] : await renewedApprovals(ctx, adapters, items)]);
|
|
1436
1568
|
const extras = [];
|
|
1437
1569
|
if (dryRun) for (const o of pending) {
|
|
1438
1570
|
if (accepted.has(o.id)) continue;
|
|
@@ -1444,13 +1576,16 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1444
1576
|
}
|
|
1445
1577
|
if (items.length === 0 && extras.length === 0) {
|
|
1446
1578
|
ctx.out(`${t.status("ok")} Conveno is already set up for ${installed.map((f) => f.adapter.cli).join(", ")}. Nothing to change.\n`);
|
|
1579
|
+
if (!dryRun) await approveTools(ctx, installed, accepted, /* @__PURE__ */ new Set());
|
|
1447
1580
|
outcome.offer = installed.map((f) => f.adapter);
|
|
1448
1581
|
return 0;
|
|
1449
1582
|
}
|
|
1450
1583
|
if (dryRun) {
|
|
1451
1584
|
const files = new Set(items.map((i) => i.change.path)).size;
|
|
1452
|
-
|
|
1585
|
+
const { notes } = await approvalWrites(ctx, installed.map((f) => f.adapter), applying, items);
|
|
1586
|
+
ctx.out(`${t.bold(`Conveno would change ${plural(files, "file")}.`)}${notes.length > 0 ? "" : " Nothing else is touched."}\n\n`);
|
|
1453
1587
|
presentChanges(ctx, items);
|
|
1588
|
+
for (const n of notes) ctx.out(` ${n}\n\n`);
|
|
1454
1589
|
for (const x of extras) {
|
|
1455
1590
|
ctx.out(`${t.bold(x.option.question)}\n ${t.paint("quiet", `Not turned on. With --accept ${x.option.id} Conveno would also change:`)}\n\n`);
|
|
1456
1591
|
presentChanges(ctx, x.items);
|
|
@@ -1458,10 +1593,13 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1458
1593
|
ctx.out(`${t.status("info")} Dry run: nothing was written. Run ${cmd(t, `conveno ${name}`)} to apply.\n`);
|
|
1459
1594
|
return 0;
|
|
1460
1595
|
}
|
|
1596
|
+
const writes = await approvalWrites(ctx, adapters, applying, items);
|
|
1461
1597
|
const result = await confirmAndApply(ctx, items, {
|
|
1462
1598
|
yes: values.yes === true,
|
|
1463
1599
|
verb: "Apply",
|
|
1464
|
-
rerun: `conveno ${name}
|
|
1600
|
+
rerun: `conveno ${name}`,
|
|
1601
|
+
notes: writes.notes,
|
|
1602
|
+
backups: writes.backups
|
|
1465
1603
|
});
|
|
1466
1604
|
if ("exit" in result) return result.exit;
|
|
1467
1605
|
const byCli = /* @__PURE__ */ new Map();
|
|
@@ -1471,13 +1609,39 @@ async function initSetup(ctx, argv, outcome, name) {
|
|
|
1471
1609
|
ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
|
|
1472
1610
|
ctx.out(` Backups are in ${tilde(result.applied.backupDir, ctx.home)}.\n`);
|
|
1473
1611
|
ctx.out(" Restart open sessions so they pick up Conveno.\n");
|
|
1474
|
-
|
|
1612
|
+
const approved = await approveTools(ctx, installed, applying, new Set(byCli.keys()), result.applied.backupDir);
|
|
1613
|
+
if (byCli.has("codex") && !approved.has("codex")) ctx.out(`${t.status("info")} ${CODEX_NOTE}\n`);
|
|
1475
1614
|
if (byCli.has("cursor")) ctx.out(`${t.status("info")} ${CURSOR_NOTE}\n`);
|
|
1476
1615
|
ctx.out(` Next: ${cmd(t, "conveno status")} lists your sessions.\n`);
|
|
1477
1616
|
outcome.offer = installed.map((f) => f.adapter);
|
|
1478
1617
|
return 0;
|
|
1479
1618
|
}
|
|
1480
1619
|
/**
|
|
1620
|
+
* Runs the follow-up of the options answered yes and says what it did. Returns the tools whose
|
|
1621
|
+
* first-run approvals are now in place among `touched`, so their note is left out.
|
|
1622
|
+
*/
|
|
1623
|
+
async function approveTools(ctx, installed, accepted, touched, backupDir) {
|
|
1624
|
+
const t = ctx.theme;
|
|
1625
|
+
const adapters = installed.map((f) => f.adapter);
|
|
1626
|
+
const { done, problems } = await applyOptions(ctx, adapters, accepted);
|
|
1627
|
+
if (backupDir && done.length > 0) {
|
|
1628
|
+
const env = adapterEnv(ctx);
|
|
1629
|
+
const ids = new Set(done.map((d) => d.id));
|
|
1630
|
+
await refreshManifest(backupDir, adapters.flatMap((a) => (a.optional ?? []).flatMap((o) => ids.has(o.id) && o.applyWrites ? o.applyWrites(env).paths : [])));
|
|
1631
|
+
}
|
|
1632
|
+
for (const d of done) {
|
|
1633
|
+
const name = adapters.find((a) => a.cli === d.cli)?.displayName ?? d.cli;
|
|
1634
|
+
ctx.out(`${t.status("ok")} Approved Conveno in ${name}.\n`);
|
|
1635
|
+
}
|
|
1636
|
+
for (const p of problems) ctx.out(`${t.status("info")} ${p}\n`);
|
|
1637
|
+
const approved = /* @__PURE__ */ new Set();
|
|
1638
|
+
for (const a of adapters) {
|
|
1639
|
+
if (!touched.has(a.cli)) continue;
|
|
1640
|
+
if (await approvedBySetup(ctx, a) === true) approved.add(a.cli);
|
|
1641
|
+
}
|
|
1642
|
+
return approved;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1481
1645
|
* `conveno setup`. In a terminal with no --yes it opens the onboarding in the app. Anywhere else
|
|
1482
1646
|
* it does what `conveno init` does, and also saves --lead.
|
|
1483
1647
|
*/
|
|
@@ -1487,7 +1651,7 @@ async function runSetup(ctx, argv) {
|
|
|
1487
1651
|
const parsed = parseFlags(ctx, spec, argv);
|
|
1488
1652
|
if (typeof parsed === "number") return parsed;
|
|
1489
1653
|
const v = parsed.values;
|
|
1490
|
-
if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-
|
|
1654
|
+
if (ctx.interactive && v.yes !== true && v["dry-run"] !== true) return (await import("./run-BPtFUGtu.js")).runTui(ctx, { start: "setup" });
|
|
1491
1655
|
return runInit(ctx, argv, "setup");
|
|
1492
1656
|
}
|
|
1493
1657
|
// src/doctor.ts
|
|
@@ -1538,9 +1702,10 @@ async function inspect(ctx, adapter) {
|
|
|
1538
1702
|
};
|
|
1539
1703
|
const hasHooks = adapter.deliveryTier !== "inbox" || hasAny(adapter.delivery?.(detection));
|
|
1540
1704
|
let idleWake;
|
|
1541
|
-
|
|
1705
|
+
const wakeOptions = (adapter.optional ?? []).filter((o) => o.approval !== true);
|
|
1706
|
+
if (wakeOptions.length > 0) {
|
|
1542
1707
|
idleWake = true;
|
|
1543
|
-
for (const o of
|
|
1708
|
+
for (const o of wakeOptions) if (!await o.enabled(env).catch(() => false)) idleWake = false;
|
|
1544
1709
|
}
|
|
1545
1710
|
const adapterNotes = await adapter.doctorNotes?.(env).catch(() => []);
|
|
1546
1711
|
try {
|
|
@@ -1731,6 +1896,13 @@ const NOTE = {
|
|
|
1731
1896
|
edit: "edited since setup, so only Conveno's entries are removed",
|
|
1732
1897
|
gone: "already gone, left as it is"
|
|
1733
1898
|
};
|
|
1899
|
+
/** The "asked once" markers the Grok and Antigravity Stop hooks keep in the data folder. */
|
|
1900
|
+
async function removeAskedMarkers(ctx) {
|
|
1901
|
+
for (const folder of ["grok-watch-asked", "agy-relay-asked"]) await rm(join(ctx.dataDir, folder), {
|
|
1902
|
+
recursive: true,
|
|
1903
|
+
force: true
|
|
1904
|
+
}).catch(() => void 0);
|
|
1905
|
+
}
|
|
1734
1906
|
/**
|
|
1735
1907
|
* The files as init found them, from the backups: their text, or null when they did not exist. A
|
|
1736
1908
|
* backup that cannot be read leaves its file out, and the adapter then treats what it finds as
|
|
@@ -1829,6 +2001,7 @@ async function runUninstall(ctx, argv) {
|
|
|
1829
2001
|
ref: "e_restore"
|
|
1830
2002
|
});
|
|
1831
2003
|
}
|
|
2004
|
+
await removeAskedMarkers(ctx);
|
|
1832
2005
|
ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
|
|
1833
2006
|
ctx.out(` Restored ${plural(result.restored.length, "file")} to how they were before setup.\n`);
|
|
1834
2007
|
if (result.edited.length > 0) ctx.out(` Edited, not restored, because they changed since setup: ${result.edited.map((p) => tilde(p, ctx.home)).join(", ")}. Only Conveno's entries were removed.\n`);
|
|
@@ -1853,8 +2026,9 @@ async function runUninstall(ctx, argv) {
|
|
|
1853
2026
|
beforeApply: () => stopDaemonIfRunning(ctx)
|
|
1854
2027
|
});
|
|
1855
2028
|
if ("exit" in result) return result.exit;
|
|
2029
|
+
await removeAskedMarkers(ctx);
|
|
1856
2030
|
ctx.out(`${t.status("ok")} ${t.bold("Done.")} ${seconds(started, ctx.now())}\n`);
|
|
1857
2031
|
ctx.out(" Removed the Conveno entries. Restart open sessions to drop Conveno.\n");
|
|
1858
2032
|
return 0;
|
|
1859
2033
|
}
|
|
1860
|
-
export { showCode as
|
|
2034
|
+
export { openInBrowser as C, showCode as D, runLogout as E, stopDaemonIfRunning as S, runLogin as T, unifiedDiff as _, applyOptions as a, runRelay as b, collectPlans as c, refreshManifest as d, renewedApprovals as f, applyChanges as g, StaleError as h, runDoctor as i, detectAll as l, runSetup as m, inspect as n, approvalWrites as o, runInit as p, partState as r, approvedBySetup as s, runUninstall as t, pendingOptions as u, PAIR_TIMEOUT_MS as v, runAccount as w, runDaemon as x, runDevices as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as isOneShotGrok } from "./dist-
|
|
2
|
-
import {
|
|
1
|
+
import { n as isOneShotGrok } from "./dist-DaIpdMke.js";
|
|
2
|
+
import { $ as isFromOwner, Mt as renderBody, Ut as senderOf, Vt as runWaker } from "./dist-STNJjbNH.js";
|
|
3
3
|
import { n as connectOpts } from "./ctx-tYftvhz_.js";
|
|
4
|
-
import { t as daemonProblem } from "./daemonError-
|
|
5
|
-
import { t as findSession } from "./pick-
|
|
4
|
+
import { t as daemonProblem } from "./daemonError-C05GqdhQ.js";
|
|
5
|
+
import { t as findSession } from "./pick-DLp6w_-z.js";
|
|
6
6
|
// src/watch.ts
|
|
7
7
|
const CONNECT_MAX_RETRY_MS = 3e4;
|
|
8
8
|
const CONNECT_GIVE_UP_MS = 3e5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conveno/cli",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.9",
|
|
4
4
|
"description": "Connect AI coding CLI sessions so they can message each other.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -52,20 +52,20 @@
|
|
|
52
52
|
"zod": "4.6.7"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@conveno/acp": "0.2.0-rc.
|
|
56
|
-
"@conveno/adapter-antigravity": "0.2.0-rc.
|
|
57
|
-
"@conveno/adapter-claude": "0.2.0-rc.
|
|
58
|
-
"@conveno/adapter-codex": "0.2.0-rc.
|
|
59
|
-
"@conveno/adapter-copilot": "0.2.0-rc.
|
|
60
|
-
"@conveno/adapter-cursor": "0.2.0-rc.
|
|
61
|
-
"@conveno/adapter-grok": "0.2.0-rc.
|
|
62
|
-
"@conveno/adapter-opencode": "0.2.0-rc.
|
|
63
|
-
"@conveno/brand": "0.2.0-rc.
|
|
64
|
-
"@conveno/client": "0.2.0-rc.
|
|
65
|
-
"@conveno/core": "0.2.0-rc.
|
|
66
|
-
"@conveno/daemon": "0.2.0-rc.
|
|
67
|
-
"@conveno/mcp": "0.2.0-rc.
|
|
68
|
-
"@conveno/protocol": "0.2.0-rc.
|
|
55
|
+
"@conveno/acp": "0.2.0-rc.9",
|
|
56
|
+
"@conveno/adapter-antigravity": "0.2.0-rc.9",
|
|
57
|
+
"@conveno/adapter-claude": "0.2.0-rc.9",
|
|
58
|
+
"@conveno/adapter-codex": "0.2.0-rc.9",
|
|
59
|
+
"@conveno/adapter-copilot": "0.2.0-rc.9",
|
|
60
|
+
"@conveno/adapter-cursor": "0.2.0-rc.9",
|
|
61
|
+
"@conveno/adapter-grok": "0.2.0-rc.9",
|
|
62
|
+
"@conveno/adapter-opencode": "0.2.0-rc.9",
|
|
63
|
+
"@conveno/brand": "0.2.0-rc.9",
|
|
64
|
+
"@conveno/client": "0.2.0-rc.9",
|
|
65
|
+
"@conveno/core": "0.2.0-rc.9",
|
|
66
|
+
"@conveno/daemon": "0.2.0-rc.9",
|
|
67
|
+
"@conveno/mcp": "0.2.0-rc.9",
|
|
68
|
+
"@conveno/protocol": "0.2.0-rc.9",
|
|
69
69
|
"@types/react": "19.3.0",
|
|
70
70
|
"ink-testing-library": "4.0.0"
|
|
71
71
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { i as runHookEntry } from "./hook-entry-pHJioNgN.js";
|