@conveno/cli 0.2.0-rc.5 → 0.2.0-rc.6
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/README.md +22 -30
- package/dist/acp-3xehqLdo.js +82 -0
- package/dist/args-D9T-6TDw.js +315 -0
- package/dist/bin.js +2 -2
- package/dist/{ctx-CDLE-2f2.js → ctx-tYftvhz_.js} +2 -3
- package/dist/daemon.js +362 -1420
- package/dist/daemonError-CdLataBW.js +66 -0
- package/dist/{dist-BPPOKmbH.js → dist-BAlMjYqQ.js} +39 -148
- package/dist/{dist-TrWRppjR.js → dist-BTLBO1Rp.js} +363 -1139
- package/dist/{dist-CEJ2-wxh.js → dist-BYVibI3a.js} +4 -17
- package/dist/{dist-C8JRuLiZ.js → dist-CNyzLyZh.js} +161 -1554
- package/dist/{dist-E3XvoT1Q.js → dist-DIAtMDWW.js} +1 -1
- package/dist/dist-LkcRvVjE.js +449 -0
- package/dist/{doctor-CzIGTeNT.js → doctor-DjwXJvKw.js} +26 -94
- package/dist/fmt-C2SsP5Y0.js +96 -0
- package/dist/{hook-CLB_muZS.js → hook-BGJc4PHG.js} +2 -4
- package/dist/hook-entry-BWWJS7n3.js +2622 -0
- package/dist/hook-entry-rDISaMgP.js +1 -0
- package/dist/main-CRw-fISR.js +971 -0
- package/dist/pick-B-18E4Mx.js +9 -0
- package/dist/{run-CYH0CRbp.js → run-Yi48fiJN.js} +286 -1699
- package/dist/{runtime-B1Pb9Qqg.js → runtime-DyknkzAS.js} +109 -209
- package/dist/sidecar-CTKxOMie.js +98 -0
- package/dist/watch-CfYanJvt.js +109 -0
- package/package.json +15 -15
- package/dist/acp-BD7Oaerg.js +0 -142
- package/dist/args-BRB8QEQM.js +0 -554
- package/dist/dist-DcmKjrmu.js +0 -271
- package/dist/hook-entry-BlvSoNMm.js +0 -1289
- package/dist/hook-entry-CRDh36pe.js +0 -1
- package/dist/main-CsCsyq2G.js +0 -1645
package/dist/args-BRB8QEQM.js
DELETED
|
@@ -1,554 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from "node:util";
|
|
2
|
-
// src/fmt.ts
|
|
3
|
-
/** Shorten the home directory to `~`. */
|
|
4
|
-
function tilde(path, home) {
|
|
5
|
-
if (path === home) return "~";
|
|
6
|
-
for (const sep of ["/", "\\"]) if (path.startsWith(home + sep)) return `~${sep}${path.slice(home.length + 1)}`;
|
|
7
|
-
return path;
|
|
8
|
-
}
|
|
9
|
-
/** Length of a string without ANSI escapes. */
|
|
10
|
-
const visibleLength = (s) => s.replace(/\u001b\[[0-9;]*m/g, "").length;
|
|
11
|
-
const padEnd = (s, width) => s + " ".repeat(Math.max(0, width - visibleLength(s)));
|
|
12
|
-
/** Pad every column to its widest cell. The last column is left unpadded. */
|
|
13
|
-
function columns(rows, gap = 2) {
|
|
14
|
-
const widths = [];
|
|
15
|
-
for (const row of rows) row.forEach((cell, i) => {
|
|
16
|
-
widths[i] = Math.max(widths[i] ?? 0, visibleLength(cell));
|
|
17
|
-
});
|
|
18
|
-
return rows.map((row) => row.map((cell, i) => i === row.length - 1 ? cell : padEnd(cell, (widths[i] ?? 0) + gap)).join("").trimEnd());
|
|
19
|
-
}
|
|
20
|
-
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
21
|
-
const pad2 = (n) => String(n).padStart(2, "0");
|
|
22
|
-
/** `2026-11-27 14:02:11` in the machine's local time. */
|
|
23
|
-
function localStamp(iso) {
|
|
24
|
-
const d = new Date(iso);
|
|
25
|
-
if (Number.isNaN(d.getTime())) return iso;
|
|
26
|
-
return `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())} ${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;
|
|
27
|
-
}
|
|
28
|
-
/** `1.2s` between two times. */
|
|
29
|
-
const seconds = (from, to) => `${(Math.max(0, to.getTime() - from.getTime()) / 1e3).toFixed(1)}s`;
|
|
30
|
-
function levenshtein(a, b) {
|
|
31
|
-
let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
32
|
-
for (let i = 1; i <= a.length; i++) {
|
|
33
|
-
const row = [i];
|
|
34
|
-
for (let j = 1; j <= b.length; j++) row[j] = Math.min(row[j - 1] + 1, prev[j] + 1, prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
35
|
-
prev = row;
|
|
36
|
-
}
|
|
37
|
-
return prev[b.length];
|
|
38
|
-
}
|
|
39
|
-
/** The closest candidate within two edits, or undefined. */
|
|
40
|
-
function closest(word, candidates) {
|
|
41
|
-
let best;
|
|
42
|
-
let bestDistance = 3;
|
|
43
|
-
for (const c of candidates) {
|
|
44
|
-
const d = levenshtein(word.toLowerCase(), c.toLowerCase());
|
|
45
|
-
if (d < bestDistance) {
|
|
46
|
-
best = c;
|
|
47
|
-
bestDistance = d;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return best;
|
|
51
|
-
}
|
|
52
|
-
/** Error block: what happened, detail, fix, then `exit N · ref e_code`. Goes to stderr. */
|
|
53
|
-
function errorBlock(theme, f) {
|
|
54
|
-
const lines = [`${theme.status("error")} ${f.what}`];
|
|
55
|
-
for (const d of f.detail ?? []) lines.push(` ${d}`);
|
|
56
|
-
if (f.fix) lines.push(` ${theme.paint("quiet", "fix")} ${f.fix}`);
|
|
57
|
-
if (f.didYouMean) lines.push(` ${f.didYouMean}`);
|
|
58
|
-
lines.push("", theme.paint("quiet", `exit ${f.exit} ${theme.glyph("bullet")} ref ${f.ref}`));
|
|
59
|
-
return `${lines.join("\n")}\n`;
|
|
60
|
-
}
|
|
61
|
-
/** Print an error block on stderr and return its exit code. */
|
|
62
|
-
function fail(ctx, f) {
|
|
63
|
-
ctx.err(errorBlock(ctx.theme, f));
|
|
64
|
-
return f.exit;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A message safe to show a user. Errors raised by Node get a plain sentence; errors we wrote
|
|
68
|
-
* pass through. Never a stack trace or a bare `EACCES: ...`.
|
|
69
|
-
*/
|
|
70
|
-
function plainError(e) {
|
|
71
|
-
if (!(e instanceof Error)) return "Something unexpected stopped the command.";
|
|
72
|
-
const code = e.code;
|
|
73
|
-
const path = e.path;
|
|
74
|
-
const named = path ?? "a file it needs";
|
|
75
|
-
switch (code) {
|
|
76
|
-
case "EACCES":
|
|
77
|
-
case "EPERM": return `Conveno has no permission to use ${named}.`;
|
|
78
|
-
case "ENOENT": return `${path ?? "A file or folder"} does not exist.`;
|
|
79
|
-
case "ENOSPC": return "The disk is full.";
|
|
80
|
-
case "EROFS": return `${path ?? "The location"} is read-only.`;
|
|
81
|
-
case "EISDIR":
|
|
82
|
-
case "ENOTDIR": return `${path ?? "A path"} is not the kind of entry Conveno expected.`;
|
|
83
|
-
case "EMFILE": return "Too many files are open.";
|
|
84
|
-
}
|
|
85
|
-
if (typeof code === "string" && /^E[A-Z0-9]+$/.test(code)) return `The system refused an operation (${code}).`;
|
|
86
|
-
if (e instanceof TypeError || e instanceof RangeError || e instanceof ReferenceError) return "Conveno hit an internal error.";
|
|
87
|
-
return e.message.replace(/,? or enable autoStart\.?/i, ".").replace(/\.\.$/, ".");
|
|
88
|
-
}
|
|
89
|
-
function warnBlock(theme, what, fix, why) {
|
|
90
|
-
const lines = [`${theme.status("warn")} ${what}`];
|
|
91
|
-
if (why) lines.push(` ${theme.paint("quiet", "why")} ${why}`);
|
|
92
|
-
lines.push(` ${theme.paint("quiet", "fix")} ${fix}`);
|
|
93
|
-
return `${lines.join("\n")}\n`;
|
|
94
|
-
}
|
|
95
|
-
/** A command to run, in bold ink. */
|
|
96
|
-
const cmd = (theme, text) => theme.bold(text);
|
|
97
|
-
const COMMANDS = [
|
|
98
|
-
{
|
|
99
|
-
name: "init",
|
|
100
|
-
usage: "conveno init [--yes] [--dry-run] [--cli <list>] [--with-permission-relay] [--acp-adapters | --no-acp-adapters]",
|
|
101
|
-
summary: "Set up every supported CLI that is installed",
|
|
102
|
-
flags: {
|
|
103
|
-
yes: {
|
|
104
|
-
type: "boolean",
|
|
105
|
-
short: "y",
|
|
106
|
-
help: "Apply without asking"
|
|
107
|
-
},
|
|
108
|
-
"dry-run": {
|
|
109
|
-
type: "boolean",
|
|
110
|
-
help: "Show the changes and write nothing"
|
|
111
|
-
},
|
|
112
|
-
cli: {
|
|
113
|
-
type: "string",
|
|
114
|
-
value: "<list>",
|
|
115
|
-
help: "Only these CLIs, comma separated, such as claude,codex"
|
|
116
|
-
},
|
|
117
|
-
"with-permission-relay": {
|
|
118
|
-
type: "boolean",
|
|
119
|
-
help: "Also add the hook for the experimental permission relay (Claude Code, Codex)"
|
|
120
|
-
},
|
|
121
|
-
"acp-adapters": {
|
|
122
|
-
type: "boolean",
|
|
123
|
-
help: "Let ACP workers fetch the Codex and Claude adapters with npx, without asking"
|
|
124
|
-
},
|
|
125
|
-
"no-acp-adapters": {
|
|
126
|
-
type: "boolean",
|
|
127
|
-
help: "Do not let ACP workers fetch adapters; print how to install them"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
notes: [
|
|
131
|
-
"init shows every file it will change, with a diff, and asks first.",
|
|
132
|
-
"Without a terminal it needs --yes, and exits 2 without it.",
|
|
133
|
-
"When Codex or Claude Code is installed without its ACP adapter, init asks once whether npx may fetch it (third-party npm packages, pinned versions). The answer is kept; the two adapter flags change it."
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: "uninstall",
|
|
138
|
-
usage: "conveno uninstall [--yes]",
|
|
139
|
-
summary: "Undo what init changed",
|
|
140
|
-
flags: { yes: {
|
|
141
|
-
type: "boolean",
|
|
142
|
-
short: "y",
|
|
143
|
-
help: "Restore without asking"
|
|
144
|
-
} },
|
|
145
|
-
notes: ["Files that still match what init wrote are restored byte for byte.", "Files you or the CLI edited since lose only Conveno's own entries."]
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "status",
|
|
149
|
-
usage: "conveno status [--all]",
|
|
150
|
-
summary: "List online sessions by repo",
|
|
151
|
-
flags: { all: {
|
|
152
|
-
type: "boolean",
|
|
153
|
-
help: "Also list offline sessions"
|
|
154
|
-
} }
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "questions",
|
|
158
|
-
usage: "conveno questions [--open]",
|
|
159
|
-
summary: "List questions workers asked the lead",
|
|
160
|
-
flags: { open: {
|
|
161
|
-
type: "boolean",
|
|
162
|
-
help: "Only questions that still wait for an answer"
|
|
163
|
-
} },
|
|
164
|
-
notes: ["Workers ask with the ask tool. Answer one with conveno answer.", "The old name, conveno tickets, still works."]
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "send",
|
|
168
|
-
usage: "conveno send <to> <text...> [--urgent]",
|
|
169
|
-
summary: "Send a message to a session as you",
|
|
170
|
-
flags: { urgent: {
|
|
171
|
-
type: "boolean",
|
|
172
|
-
help: "Mark the message urgent"
|
|
173
|
-
} },
|
|
174
|
-
notes: [
|
|
175
|
-
"<to> is a session name or id, lead, or device:name for a session on another device.",
|
|
176
|
-
"Give - as the text to read it from standard input.",
|
|
177
|
-
"The session sees the message as coming from you."
|
|
178
|
-
],
|
|
179
|
-
positionals: true
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: "rename",
|
|
183
|
-
usage: "conveno rename <session> <new-name>",
|
|
184
|
-
summary: "Give an online session a new name",
|
|
185
|
-
flags: {},
|
|
186
|
-
notes: ["<session> is a name or id. Names use lowercase letters, digits and . _ @ -."],
|
|
187
|
-
positionals: true
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: "lead",
|
|
191
|
-
usage: "conveno lead <session>",
|
|
192
|
-
summary: "Make a session the lead",
|
|
193
|
-
flags: {},
|
|
194
|
-
notes: ["The lead gets the questions workers ask and the messages sent to lead.", "<session> is a name or id. The old lead is told."],
|
|
195
|
-
positionals: true
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: "answer",
|
|
199
|
-
usage: "conveno answer <ticket> <text>",
|
|
200
|
-
summary: "Answer a worker's question yourself",
|
|
201
|
-
flags: {},
|
|
202
|
-
notes: ["The ticket is a full id, or the end or start of one (at least 6 characters).", "The worker gets the answer as a message. For a permission request, answer allow or deny."],
|
|
203
|
-
positionals: true
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: "permissions",
|
|
207
|
-
usage: "conveno permissions [relay on|off [session]]",
|
|
208
|
-
summary: "Experimental: let the orchestrator answer a worker's permission prompts",
|
|
209
|
-
flags: { yes: {
|
|
210
|
-
type: "boolean",
|
|
211
|
-
short: "y",
|
|
212
|
-
help: "Add the CLI hook without asking"
|
|
213
|
-
} },
|
|
214
|
-
notes: [
|
|
215
|
-
"EXPERIMENTAL and off by default. It lets one agent approve another agent's tool calls.",
|
|
216
|
-
"Only for sessions started with conveno spawn or spawn_session, never for one you drive.",
|
|
217
|
-
"Calls outside the worker's repo, network and credential access always stay with you.",
|
|
218
|
-
"The CLI's own prompt takes over when nobody answers in time. SECURITY.md has the threat model.",
|
|
219
|
-
"Without arguments it lists the sessions with the relay on.",
|
|
220
|
-
"The first time, it adds the CLI's PermissionRequest hook (diff, backup, undo with conveno uninstall)."
|
|
221
|
-
],
|
|
222
|
-
positionals: true
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "forget",
|
|
226
|
-
usage: "conveno forget [<name|pattern>...] [options]",
|
|
227
|
-
summary: "Remove offline sessions from the list",
|
|
228
|
-
flags: {
|
|
229
|
-
offline: {
|
|
230
|
-
type: "boolean",
|
|
231
|
-
help: "Every offline session, when no name is given"
|
|
232
|
-
},
|
|
233
|
-
"older-than": {
|
|
234
|
-
type: "string",
|
|
235
|
-
value: "<duration>",
|
|
236
|
-
help: "Only sessions last seen this long ago, such as 30m, 24h or 7d"
|
|
237
|
-
},
|
|
238
|
-
"dry-run": {
|
|
239
|
-
type: "boolean",
|
|
240
|
-
help: "List the sessions and change nothing"
|
|
241
|
-
},
|
|
242
|
-
yes: {
|
|
243
|
-
type: "boolean",
|
|
244
|
-
short: "y",
|
|
245
|
-
help: "Forget without asking"
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
notes: [
|
|
249
|
-
"A name is an exact session name or a pattern where * matches any run of characters.",
|
|
250
|
-
"Quote a pattern so the shell leaves it alone: conveno forget 'conveno-real-*'.",
|
|
251
|
-
"Only offline sessions are forgotten. A running session is listed as skipped.",
|
|
252
|
-
"Forgetting deletes the queued messages of the session. Messages it sent stay with the receivers.",
|
|
253
|
-
"Without a terminal it needs --yes, and exits 2 without it."
|
|
254
|
-
],
|
|
255
|
-
positionals: true
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: "spawn",
|
|
259
|
-
usage: "conveno spawn <cli> [options]",
|
|
260
|
-
summary: "Start a worker session of any CLI",
|
|
261
|
-
flags: {
|
|
262
|
-
mode: {
|
|
263
|
-
type: "string",
|
|
264
|
-
value: "window|background|once",
|
|
265
|
-
help: "window: a terminal you can watch (default). background: kept running over ACP. once: one task, then it ends"
|
|
266
|
-
},
|
|
267
|
-
cwd: {
|
|
268
|
-
type: "string",
|
|
269
|
-
value: "<dir>",
|
|
270
|
-
help: "Folder to work in (default: the current one)"
|
|
271
|
-
},
|
|
272
|
-
name: {
|
|
273
|
-
type: "string",
|
|
274
|
-
value: "<name>",
|
|
275
|
-
help: "Session name (default: the usual one)"
|
|
276
|
-
},
|
|
277
|
-
task: {
|
|
278
|
-
type: "string",
|
|
279
|
-
value: "<text>",
|
|
280
|
-
help: "The first task"
|
|
281
|
-
},
|
|
282
|
-
"task-file": {
|
|
283
|
-
type: "string",
|
|
284
|
-
value: "<path>",
|
|
285
|
-
help: "Read the first task from a file"
|
|
286
|
-
},
|
|
287
|
-
headless: {
|
|
288
|
-
type: "boolean",
|
|
289
|
-
help: "Run in the background: over ACP when the CLI has it, else its one-shot mode"
|
|
290
|
-
},
|
|
291
|
-
acp: {
|
|
292
|
-
type: "boolean",
|
|
293
|
-
help: "Drive the CLI over its ACP server in the background, kept running for messages"
|
|
294
|
-
},
|
|
295
|
-
"one-shot": {
|
|
296
|
-
type: "boolean",
|
|
297
|
-
help: "With --headless: use the CLI's one-shot mode even when it has ACP"
|
|
298
|
-
},
|
|
299
|
-
allow: {
|
|
300
|
-
type: "string",
|
|
301
|
-
value: "<kinds>",
|
|
302
|
-
help: "ACP: tool calls to approve, such as read,search or execute:npm test*"
|
|
303
|
-
},
|
|
304
|
-
yes: {
|
|
305
|
-
type: "boolean",
|
|
306
|
-
short: "y",
|
|
307
|
-
help: "Start without asking"
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
notes: [
|
|
311
|
-
"By default (--mode window) the real CLI opens in a new terminal, so you can watch it and take over.",
|
|
312
|
-
"--mode background is --acp, and --mode once is --headless --one-shot. --mode wins over those flags.",
|
|
313
|
-
"--acp starts the CLI's Agent Client Protocol server in the background. Each message sent to",
|
|
314
|
-
"the worker becomes its next prompt: right away when it is idle, else when its turn ends.",
|
|
315
|
-
"Tool calls that need approval are denied unless --allow covers them. Follow it with",
|
|
316
|
-
"conveno attach, end it with conveno stop. claude and codex need an ACP adapter installed.",
|
|
317
|
-
"--headless uses ACP when the CLI's ACP server is installed. Otherwise, or with --one-shot,",
|
|
318
|
-
"it runs the CLI's one-shot mode, which needs a task, runs it and exits.",
|
|
319
|
-
"Waits until the session registers, then prints its name.",
|
|
320
|
-
"Without a terminal of your own it needs --yes, and exits 2 without it.",
|
|
321
|
-
"At most 8 spawned sessions run at once; CONVENO_SPAWN_MAX changes that."
|
|
322
|
-
],
|
|
323
|
-
positionals: true
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: "stop",
|
|
327
|
-
usage: "conveno stop <worker>",
|
|
328
|
-
summary: "Stop a background worker",
|
|
329
|
-
flags: {},
|
|
330
|
-
notes: ["An ACP worker cancels its current turn, stops its CLI and tells the session that spawned it.", "A one-shot --headless run is ended. A worker in a terminal is yours to close."],
|
|
331
|
-
positionals: true
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
name: "attach",
|
|
335
|
-
usage: "conveno attach <worker> [options]",
|
|
336
|
-
summary: "Follow an ACP worker's turns (read-only)",
|
|
337
|
-
flags: {
|
|
338
|
-
lines: {
|
|
339
|
-
type: "string",
|
|
340
|
-
value: "<n>",
|
|
341
|
-
help: "Recent entries to print first (default 20)"
|
|
342
|
-
},
|
|
343
|
-
"no-follow": {
|
|
344
|
-
type: "boolean",
|
|
345
|
-
help: "Print the recent entries and exit"
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
notes: ["Nothing typed here reaches the worker. Message it with send to give it work."],
|
|
349
|
-
positionals: true
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
name: "auto",
|
|
353
|
-
usage: "conveno auto [on|off|resume] [<session>]",
|
|
354
|
-
summary: "Turn auto mode on or off for a session",
|
|
355
|
-
flags: {},
|
|
356
|
-
notes: [
|
|
357
|
-
"In auto mode, waiting messages become the session's next prompt when a turn ends, and an",
|
|
358
|
-
"idle Claude Code or OpenCode session is woken. Off: they arrive at the next prompt you type.",
|
|
359
|
-
"Limit: 20 automatic turns per hour, and chains of sessions answering each other stop after 20.",
|
|
360
|
-
"resume lifts a pause by the limit; on also lifts it. The orchestrator may resume once per hour.",
|
|
361
|
-
"conveno auto limit <n|default> [<session>] changes the limit for one session.",
|
|
362
|
-
"Without a session name it changes the session it runs in, such as `! conveno auto on` in Claude Code.",
|
|
363
|
-
"Without arguments it lists the sessions with their auto state."
|
|
364
|
-
],
|
|
365
|
-
positionals: true
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: "peek",
|
|
369
|
-
usage: "conveno peek <session> [-n <turns>] [--raw-json]",
|
|
370
|
-
summary: "Read what another session did lately",
|
|
371
|
-
flags: {
|
|
372
|
-
n: {
|
|
373
|
-
type: "string",
|
|
374
|
-
short: "n",
|
|
375
|
-
value: "<turns>",
|
|
376
|
-
help: "How many recent turns, 1 to 50 (default 10)"
|
|
377
|
-
},
|
|
378
|
-
"raw-json": {
|
|
379
|
-
type: "boolean",
|
|
380
|
-
help: "Print the daemon's answer as JSON"
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
notes: [
|
|
384
|
-
"peek shows the last prompts, replies and tool calls of a session on this machine.",
|
|
385
|
-
"Secrets are redacted on a best-effort basis. Redaction cannot be turned off.",
|
|
386
|
-
"conveno peek on|off [session] allows or stops other sessions reading yours.",
|
|
387
|
-
"Without a session, on and off apply to every session that is online now.",
|
|
388
|
-
"The daemon log records who peeked at whom, never what was read.",
|
|
389
|
-
"Peek works for Claude Code, Codex, OpenCode, Copilot and Grok. Cursor and Antigravity answer that peek is not supported yet."
|
|
390
|
-
],
|
|
391
|
-
positionals: true
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
name: "devices",
|
|
395
|
-
usage: "conveno devices [pair|join|revoke|rename|accept|reset]",
|
|
396
|
-
summary: "Pair your machines over the relay (Pro)",
|
|
397
|
-
flags: { yes: {
|
|
398
|
-
type: "boolean",
|
|
399
|
-
short: "y",
|
|
400
|
-
help: "Revoke, accept or reset without asking"
|
|
401
|
-
} },
|
|
402
|
-
notes: [
|
|
403
|
-
"conveno devices lists your devices. revoke takes a device name or id, rename a new name.",
|
|
404
|
-
"pair runs on a device you already use, join on the new one, at the same time.",
|
|
405
|
-
"Each device shows an 8-digit code. Type the code from the other screen on each device.",
|
|
406
|
-
"revoke removes a device for good: it can no longer read or send for your sessions.",
|
|
407
|
-
"accept <head> ends a device list conflict by taking the relay's list with that head.",
|
|
408
|
-
"reset forgets this device's list after you reset your devices on the account page.",
|
|
409
|
-
"Needs a Conveno Pro login on both devices."
|
|
410
|
-
],
|
|
411
|
-
positionals: true
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
name: "relay",
|
|
415
|
-
usage: "conveno relay status",
|
|
416
|
-
summary: "Show the relay connection",
|
|
417
|
-
flags: {},
|
|
418
|
-
positionals: true
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
name: "doctor",
|
|
422
|
-
usage: "conveno doctor [--cli <list>]",
|
|
423
|
-
summary: "Check each CLI and the daemon",
|
|
424
|
-
flags: { cli: {
|
|
425
|
-
type: "string",
|
|
426
|
-
value: "<list>",
|
|
427
|
-
help: "Only these CLIs, comma separated, such as claude,codex"
|
|
428
|
-
} }
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name: "login",
|
|
432
|
-
usage: "conveno login [--no-browser]",
|
|
433
|
-
summary: "Sign in to your Conveno account",
|
|
434
|
-
flags: { "no-browser": {
|
|
435
|
-
type: "boolean",
|
|
436
|
-
help: "Print the sign-in link, do not open it"
|
|
437
|
-
} },
|
|
438
|
-
notes: [
|
|
439
|
-
"login shows a code and a link. Approve the code in your browser and the terminal signs in.",
|
|
440
|
-
"The account is only for Conveno Pro. Everything on this machine works without one.",
|
|
441
|
-
"The tokens are kept in the data dir, in account.json, readable by you only."
|
|
442
|
-
]
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
name: "logout",
|
|
446
|
-
usage: "conveno logout",
|
|
447
|
-
summary: "Sign out and delete the saved tokens",
|
|
448
|
-
flags: {}
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
name: "account",
|
|
452
|
-
usage: "conveno account",
|
|
453
|
-
summary: "Show your plan and trial",
|
|
454
|
-
flags: {}
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
name: "daemon",
|
|
458
|
-
usage: "conveno daemon start|stop|status",
|
|
459
|
-
summary: "Manage the background daemon",
|
|
460
|
-
flags: {},
|
|
461
|
-
positionals: true
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
name: "mcp",
|
|
465
|
-
usage: "conveno mcp --cli <cli>",
|
|
466
|
-
summary: "MCP server on stdio (CLIs launch this)",
|
|
467
|
-
flags: { cli: {
|
|
468
|
-
type: "string",
|
|
469
|
-
value: "<cli>",
|
|
470
|
-
help: "claude, codex or opencode"
|
|
471
|
-
} }
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
name: "hook",
|
|
475
|
-
usage: "conveno hook <cli> <event>",
|
|
476
|
-
summary: "Hook entry (CLIs launch this)",
|
|
477
|
-
flags: {},
|
|
478
|
-
positionals: true
|
|
479
|
-
}
|
|
480
|
-
];
|
|
481
|
-
const COMMAND_NAMES = COMMANDS.map((c) => c.name);
|
|
482
|
-
/** `conveno <command> --help`. */
|
|
483
|
-
function commandHelp(ctx, spec) {
|
|
484
|
-
const t = ctx.theme;
|
|
485
|
-
const lines = [
|
|
486
|
-
spec.summary,
|
|
487
|
-
"",
|
|
488
|
-
`Usage: ${spec.usage}`
|
|
489
|
-
];
|
|
490
|
-
const flags = Object.entries(spec.flags);
|
|
491
|
-
if (flags.length > 0) {
|
|
492
|
-
lines.push("", "Options:");
|
|
493
|
-
const rows = flags.map(([name, f]) => {
|
|
494
|
-
return [`${f.short ? `-${f.short}, ` : ""}--${name}${f.value ? ` ${f.value}` : ""}`, f.help];
|
|
495
|
-
});
|
|
496
|
-
const width = Math.max(...rows.map(([l]) => l.length)) + 2;
|
|
497
|
-
for (const [l, h] of rows) lines.push(` ${t.bold(l.padEnd(width))}${h}`);
|
|
498
|
-
}
|
|
499
|
-
if (spec.notes?.length) lines.push("", ...spec.notes);
|
|
500
|
-
return `${lines.join("\n")}\n`;
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Parse a command's arguments. Unknown flags and stray words are usage errors (exit 2) with a
|
|
504
|
-
* "Did you mean" when a known flag is within two edits. Returns the exit code on failure.
|
|
505
|
-
*/
|
|
506
|
-
function parseFlags(ctx, spec, argv) {
|
|
507
|
-
const options = {};
|
|
508
|
-
for (const [name, f] of Object.entries(spec.flags)) options[name] = {
|
|
509
|
-
type: f.type,
|
|
510
|
-
...f.short ? { short: f.short } : {}
|
|
511
|
-
};
|
|
512
|
-
try {
|
|
513
|
-
const r = parseArgs({
|
|
514
|
-
args: argv,
|
|
515
|
-
options,
|
|
516
|
-
allowPositionals: spec.positionals === true,
|
|
517
|
-
strict: true
|
|
518
|
-
});
|
|
519
|
-
return {
|
|
520
|
-
values: r.values,
|
|
521
|
-
positionals: r.positionals
|
|
522
|
-
};
|
|
523
|
-
} catch (e) {
|
|
524
|
-
const t = ctx.theme;
|
|
525
|
-
const code = e.code;
|
|
526
|
-
const message = e instanceof Error ? e.message : "";
|
|
527
|
-
const unknown = /Unknown option '(-{1,2}[^']+)'/.exec(message)?.[1];
|
|
528
|
-
if (code === "ERR_PARSE_ARGS_UNKNOWN_OPTION" && unknown) {
|
|
529
|
-
const suggestion = closest(unknown.replace(/^-+/, ""), Object.keys(spec.flags));
|
|
530
|
-
return fail(ctx, {
|
|
531
|
-
what: `Unknown option ${unknown} for conveno ${spec.name}`,
|
|
532
|
-
fix: `Run ${cmd(t, `conveno ${spec.name} --help`)} to see the options.`,
|
|
533
|
-
...suggestion ? { didYouMean: `Did you mean --${suggestion}?` } : {},
|
|
534
|
-
exit: 2,
|
|
535
|
-
ref: "e_usage"
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (code === "ERR_PARSE_ARGS_INVALID_OPTION_VALUE") return fail(ctx, {
|
|
539
|
-
what: `A conveno ${spec.name} option is missing its value`,
|
|
540
|
-
detail: [message.split("\n")[0] ?? message],
|
|
541
|
-
fix: `Run ${cmd(t, `conveno ${spec.name} --help`)} to see the options.`,
|
|
542
|
-
exit: 2,
|
|
543
|
-
ref: "e_usage"
|
|
544
|
-
});
|
|
545
|
-
const stray = /argument '([^']+)'/.exec(message)?.[1];
|
|
546
|
-
return fail(ctx, {
|
|
547
|
-
what: stray ? `Unexpected argument "${stray}" for conveno ${spec.name}` : `Could not read the arguments for conveno ${spec.name}`,
|
|
548
|
-
fix: `Run ${cmd(t, `conveno ${spec.name} --help`)} to see the options.`,
|
|
549
|
-
exit: 2,
|
|
550
|
-
ref: "e_usage"
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
export { closest as a, errorBlock as c, plainError as d, plural as f, warnBlock as h, parseFlags as i, fail as l, tilde as m, COMMAND_NAMES as n, cmd as o, seconds as p, commandHelp as r, columns as s, COMMANDS as t, localStamp as u };
|