@ant0/cli 0.0.0-stage → 0.3.22-beta.3
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/LICENSE +28 -0
- package/README.md +97 -2
- package/dist/api/generated/schema.d.ts +11600 -0
- package/dist/api/generated/schema.js +6 -0
- package/dist/api/index.d.ts +219 -0
- package/dist/api/index.js +342 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.js +12 -0
- package/dist/bulk.d.ts +38 -0
- package/dist/bulk.js +66 -0
- package/dist/commands/account.d.ts +48 -0
- package/dist/commands/account.js +337 -0
- package/dist/commands/api-keys.d.ts +5 -0
- package/dist/commands/api-keys.js +310 -0
- package/dist/commands/browsers.d.ts +4 -0
- package/dist/commands/browsers.js +165 -0
- package/dist/commands/daemon.d.ts +15 -0
- package/dist/commands/daemon.js +202 -0
- package/dist/commands/events.d.ts +8 -0
- package/dist/commands/events.js +81 -0
- package/dist/commands/extensions.d.ts +4 -0
- package/dist/commands/extensions.js +74 -0
- package/dist/commands/profiles.d.ts +36 -0
- package/dist/commands/profiles.js +552 -0
- package/dist/commands/proxies.d.ts +23 -0
- package/dist/commands/proxies.js +170 -0
- package/dist/commands/sync.d.ts +4 -0
- package/dist/commands/sync.js +435 -0
- package/dist/commands/team.d.ts +7 -0
- package/dist/commands/team.js +403 -0
- package/dist/commands/trash.d.ts +10 -0
- package/dist/commands/trash.js +54 -0
- package/dist/commands/workspace.d.ts +10 -0
- package/dist/commands/workspace.js +56 -0
- package/dist/context.d.ts +111 -0
- package/dist/context.js +300 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +96 -0
- package/dist/format.d.ts +23 -0
- package/dist/format.js +85 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +35 -0
- package/dist/inventory.d.ts +50 -0
- package/dist/inventory.js +202 -0
- package/dist/management-transport.d.ts +3 -0
- package/dist/management-transport.js +90 -0
- package/dist/native-terminal.d.ts +50 -0
- package/dist/native-terminal.js +228 -0
- package/dist/program.d.ts +10 -0
- package/dist/program.js +185 -0
- package/dist/runtime-types.d.ts +20 -0
- package/dist/runtime-types.js +2 -0
- package/dist/set.d.ts +15 -0
- package/dist/set.js +87 -0
- package/dist/shared/parse-error.d.ts +6 -0
- package/dist/shared/parse-error.js +8 -0
- package/dist/shared/proxy-parse.d.ts +42 -0
- package/dist/shared/proxy-parse.js +238 -0
- package/dist/shared/proxy-types.d.ts +21 -0
- package/dist/shared/proxy-types.js +2 -0
- package/dist/shared/recovery-code.d.ts +7 -0
- package/dist/shared/recovery-code.js +53 -0
- package/dist/version.d.ts +8 -0
- package/dist/version.js +18 -0
- package/licenses/README.md +5 -0
- package/licenses/THIRD_PARTY_NOTICES +96 -0
- package/package.json +63 -4
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ant0 daemon start [--foreground] | stop | status`.
|
|
3
|
+
*
|
|
4
|
+
* `start` spawns the daemon detached with stdio appended to `<home>/logs/ant0d.out`, then waits
|
|
5
|
+
* up to 10 s for `GET /v1/health`. `stop` reads the pid file and sends SIGTERM. `status` is
|
|
6
|
+
* health + pid.
|
|
7
|
+
*/
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { existsSync, mkdirSync, openSync, statSync } from "node:fs";
|
|
10
|
+
import { delimiter, extname, isAbsolute, join } from "node:path";
|
|
11
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
12
|
+
import { unwrap } from "../api/index.js";
|
|
13
|
+
import { CliError, DaemonNotRunningError, isConnectionRefused } from "../errors.js";
|
|
14
|
+
import { formatDuration, keyValues } from "../format.js";
|
|
15
|
+
import { versionSkewWarning } from "../version.js";
|
|
16
|
+
export const START_TIMEOUT_MS = 10_000;
|
|
17
|
+
export const STOP_TIMEOUT_MS = 10_000;
|
|
18
|
+
const POLL_MS = 200;
|
|
19
|
+
function isFile(path) {
|
|
20
|
+
try {
|
|
21
|
+
return statSync(path).isFile();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Where the Ant0 desktop app installs the daemon, when it is not on PATH. */
|
|
28
|
+
function packagedDaemonPaths(env, platform) {
|
|
29
|
+
if (platform === "win32") {
|
|
30
|
+
const local = env.LOCALAPPDATA;
|
|
31
|
+
return local ? [join(local, "Programs", "Ant0", "ant0d.exe")] : [];
|
|
32
|
+
}
|
|
33
|
+
return ["/usr/bin/ant0d"];
|
|
34
|
+
}
|
|
35
|
+
function onPath(env, platform) {
|
|
36
|
+
const names = platform === "win32" ? ["ant0d.exe", "ant0d.cmd"] : ["ant0d"];
|
|
37
|
+
for (const dir of (env.PATH ?? env.Path ?? "").split(delimiter)) {
|
|
38
|
+
if (!dir)
|
|
39
|
+
continue;
|
|
40
|
+
for (const name of names) {
|
|
41
|
+
const candidate = join(dir, name);
|
|
42
|
+
if (isFile(candidate))
|
|
43
|
+
return candidate;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The daemon to launch: `$ANT0D_BIN` (a `.js` file runs under this Node), else `ant0d` on PATH,
|
|
50
|
+
* else the desktop app's install location. Throws when none exists.
|
|
51
|
+
*/
|
|
52
|
+
export function resolveDaemonCommand(runtime, env = process.env, platform = process.platform) {
|
|
53
|
+
if (runtime)
|
|
54
|
+
return runtime.daemon;
|
|
55
|
+
const override = env.ANT0D_BIN;
|
|
56
|
+
if (override !== undefined && override !== "") {
|
|
57
|
+
if (!isAbsolute(override))
|
|
58
|
+
throw new CliError("ANT0D_BIN must be an absolute path");
|
|
59
|
+
if (!existsSync(override))
|
|
60
|
+
throw new CliError(`ANT0D_BIN does not exist: ${override}`);
|
|
61
|
+
return /^\.[cm]?js$/.test(extname(override))
|
|
62
|
+
? { command: process.execPath, args: [override] }
|
|
63
|
+
: { command: override, args: [] };
|
|
64
|
+
}
|
|
65
|
+
const found = onPath(env, platform) ?? packagedDaemonPaths(env, platform).find(isFile);
|
|
66
|
+
if (found)
|
|
67
|
+
return { command: found, args: [] };
|
|
68
|
+
throw new CliError("ant0d not found: install the Ant0 desktop app, put ant0d on PATH, or set ANT0D_BIN to its path");
|
|
69
|
+
}
|
|
70
|
+
export function processAlive(pid) {
|
|
71
|
+
try {
|
|
72
|
+
process.kill(pid, 0);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return err.code === "EPERM";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** One warning per invocation, however many health polls `daemon start` makes. */
|
|
80
|
+
const warned = new WeakSet();
|
|
81
|
+
async function health(ctx) {
|
|
82
|
+
try {
|
|
83
|
+
const result = unwrap(await ctx.openClient().GET("/v1/health"));
|
|
84
|
+
const warning = versionSkewWarning(result.version);
|
|
85
|
+
if (warning !== undefined && !warned.has(ctx)) {
|
|
86
|
+
warned.add(ctx);
|
|
87
|
+
ctx.err(`ant0: ${warning}`);
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
if (isConnectionRefused(err))
|
|
93
|
+
return undefined;
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function statusLines(h, baseUrl) {
|
|
98
|
+
return keyValues([
|
|
99
|
+
["state", "running"],
|
|
100
|
+
["url", baseUrl],
|
|
101
|
+
["pid", h.pid],
|
|
102
|
+
["version", h.version],
|
|
103
|
+
["uptime", formatDuration(h.uptime_s)],
|
|
104
|
+
["home", h.home],
|
|
105
|
+
]);
|
|
106
|
+
}
|
|
107
|
+
export function registerDaemon(program, ctx) {
|
|
108
|
+
const daemon = program.command("daemon").description("Run and inspect the local ant0d daemon");
|
|
109
|
+
daemon
|
|
110
|
+
.command("start")
|
|
111
|
+
.description("Start ant0d in the background (or attached with --foreground)")
|
|
112
|
+
.option("--foreground", "run attached to this terminal")
|
|
113
|
+
.action(async (opts) => {
|
|
114
|
+
const conn = ctx.connection();
|
|
115
|
+
const port = new URL(conn.baseUrl).port;
|
|
116
|
+
const existing = await health(ctx);
|
|
117
|
+
if (existing) {
|
|
118
|
+
ctx.emit({ ...existing, url: conn.baseUrl, started: false }, () => `ant0d ${existing.version} already running at ${conn.baseUrl} (pid ${existing.pid})`);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const { command, args } = resolveDaemonCommand(ctx.runtime, ctx.io.env);
|
|
122
|
+
const daemonArgs = [...args, "--home", conn.home, "--port", port];
|
|
123
|
+
if (opts.foreground) {
|
|
124
|
+
const code = await new Promise((resolve, reject) => {
|
|
125
|
+
const child = spawn(command, daemonArgs, { stdio: "inherit" });
|
|
126
|
+
child.on("error", reject);
|
|
127
|
+
child.on("exit", (c) => resolve(c ?? 1));
|
|
128
|
+
});
|
|
129
|
+
if (code !== 0)
|
|
130
|
+
throw new CliError(`ant0d exited with code ${code}`, code);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
mkdirSync(join(conn.home, "logs"), { recursive: true });
|
|
134
|
+
const logFile = join(conn.home, "logs", "ant0d.out");
|
|
135
|
+
const fd = openSync(logFile, "a");
|
|
136
|
+
let exited;
|
|
137
|
+
const child = spawn(command, [...daemonArgs, "--quiet"], {
|
|
138
|
+
detached: true,
|
|
139
|
+
stdio: ["ignore", fd, fd],
|
|
140
|
+
windowsHide: true,
|
|
141
|
+
});
|
|
142
|
+
child.on("error", (err) => {
|
|
143
|
+
exited = -1;
|
|
144
|
+
ctx.err(`ant0: could not spawn ant0d: ${err.message}`);
|
|
145
|
+
});
|
|
146
|
+
child.on("exit", (code) => {
|
|
147
|
+
exited = code ?? 1;
|
|
148
|
+
});
|
|
149
|
+
child.unref();
|
|
150
|
+
const deadline = Date.now() + START_TIMEOUT_MS;
|
|
151
|
+
while (Date.now() < deadline) {
|
|
152
|
+
if (exited !== undefined) {
|
|
153
|
+
throw new CliError(`ant0d exited early (code ${exited}); see ${logFile}`);
|
|
154
|
+
}
|
|
155
|
+
const h = await health(ctx);
|
|
156
|
+
if (h) {
|
|
157
|
+
ctx.emit({ ...h, url: conn.baseUrl, started: true }, () => `ant0d ${h.version} running at ${conn.baseUrl} (pid ${h.pid})`);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
await sleep(POLL_MS);
|
|
161
|
+
}
|
|
162
|
+
throw new CliError(`ant0d did not answer on ${conn.baseUrl} within ${START_TIMEOUT_MS / 1000} s; see ${logFile}`);
|
|
163
|
+
});
|
|
164
|
+
daemon
|
|
165
|
+
.command("stop")
|
|
166
|
+
.description("Stop the running daemon (SIGTERM, waits up to 10 s)")
|
|
167
|
+
.action(async () => {
|
|
168
|
+
const conn = ctx.connection();
|
|
169
|
+
const pid = conn.pidFile?.pid;
|
|
170
|
+
if (pid === undefined || !processAlive(pid))
|
|
171
|
+
throw new DaemonNotRunningError();
|
|
172
|
+
try {
|
|
173
|
+
process.kill(pid, "SIGTERM");
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
throw new CliError(`could not signal pid ${pid}: ${err.message}`);
|
|
177
|
+
}
|
|
178
|
+
const deadline = Date.now() + STOP_TIMEOUT_MS;
|
|
179
|
+
while (Date.now() < deadline) {
|
|
180
|
+
if (!processAlive(pid)) {
|
|
181
|
+
ctx.emit({ pid, stopped: true }, () => `stopped ant0d (pid ${pid})`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
await sleep(POLL_MS);
|
|
185
|
+
}
|
|
186
|
+
throw new CliError(`ant0d (pid ${pid}) did not exit within ${STOP_TIMEOUT_MS / 1000} s`);
|
|
187
|
+
});
|
|
188
|
+
daemon
|
|
189
|
+
.command("status")
|
|
190
|
+
.description("Show whether the daemon answers and where")
|
|
191
|
+
.action(async () => {
|
|
192
|
+
const conn = ctx.connection();
|
|
193
|
+
const h = await health(ctx);
|
|
194
|
+
if (!h) {
|
|
195
|
+
if (ctx.json)
|
|
196
|
+
ctx.out(JSON.stringify({ ok: false, url: conn.baseUrl }, null, 2));
|
|
197
|
+
throw new DaemonNotRunningError();
|
|
198
|
+
}
|
|
199
|
+
ctx.emit(h, () => statusLines(h, conn.baseUrl));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=daemon.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ant0 events [--since <iso>] [--replay <n>]`: tail the daemon's event stream over WebSocket and
|
|
3
|
+
* print one JSON line per event until Ctrl-C (or the injected AbortSignal fires).
|
|
4
|
+
*/
|
|
5
|
+
import type { Command } from "commander";
|
|
6
|
+
import type { Context } from "../context.js";
|
|
7
|
+
export declare function registerEvents(program: Command, ctx: Context): void;
|
|
8
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { eventsUrl, unwrap } from "../api/index.js";
|
|
2
|
+
import { CliError, DaemonNotRunningError, UsageError, isConnectionRefused } from "../errors.js";
|
|
3
|
+
export function registerEvents(program, ctx) {
|
|
4
|
+
program
|
|
5
|
+
.command("events")
|
|
6
|
+
.description("Tail the event stream (one JSON object per line; Ctrl-C to stop)")
|
|
7
|
+
.option("--since <iso-date>", "replay buffered events at or after this time")
|
|
8
|
+
.option("--replay <n>", "how many buffered events to replay first (default 50)")
|
|
9
|
+
.action(async (opts) => {
|
|
10
|
+
const conn = ctx.authenticatedConnection();
|
|
11
|
+
if (conn.token === undefined)
|
|
12
|
+
throw new DaemonNotRunningError();
|
|
13
|
+
// A clean "not running" exit beats a WebSocket error event with no cause attached.
|
|
14
|
+
try {
|
|
15
|
+
unwrap(await ctx.openClient().GET("/v1/health"));
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (isConnectionRefused(err))
|
|
19
|
+
throw new DaemonNotRunningError();
|
|
20
|
+
throw err;
|
|
21
|
+
}
|
|
22
|
+
const url = new URL(eventsUrl(conn.baseUrl, conn.token));
|
|
23
|
+
if (opts.since !== undefined) {
|
|
24
|
+
if (Number.isNaN(Date.parse(opts.since)))
|
|
25
|
+
throw new UsageError("--since expects an ISO date");
|
|
26
|
+
url.searchParams.set("since", opts.since);
|
|
27
|
+
}
|
|
28
|
+
if (opts.replay !== undefined) {
|
|
29
|
+
if (!/^\d+$/.test(opts.replay))
|
|
30
|
+
throw new UsageError("--replay expects an integer");
|
|
31
|
+
url.searchParams.set("limit", opts.replay);
|
|
32
|
+
}
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
const socket = new WebSocket(url.toString());
|
|
35
|
+
let settled = false;
|
|
36
|
+
const finish = (err) => {
|
|
37
|
+
if (settled)
|
|
38
|
+
return;
|
|
39
|
+
settled = true;
|
|
40
|
+
cleanup();
|
|
41
|
+
if (err)
|
|
42
|
+
reject(err);
|
|
43
|
+
else
|
|
44
|
+
resolve();
|
|
45
|
+
};
|
|
46
|
+
const stop = () => {
|
|
47
|
+
if (socket.readyState === WebSocket.OPEN || socket.readyState === WebSocket.CONNECTING) {
|
|
48
|
+
socket.close(1000, "client stop");
|
|
49
|
+
}
|
|
50
|
+
finish();
|
|
51
|
+
};
|
|
52
|
+
const onSigint = () => stop();
|
|
53
|
+
const cleanup = () => {
|
|
54
|
+
process.off("SIGINT", onSigint);
|
|
55
|
+
process.off("SIGTERM", onSigint);
|
|
56
|
+
ctx.io.signal?.removeEventListener("abort", onSigint);
|
|
57
|
+
};
|
|
58
|
+
process.on("SIGINT", onSigint);
|
|
59
|
+
process.on("SIGTERM", onSigint);
|
|
60
|
+
if (ctx.io.signal) {
|
|
61
|
+
if (ctx.io.signal.aborted)
|
|
62
|
+
return stop();
|
|
63
|
+
ctx.io.signal.addEventListener("abort", onSigint, { once: true });
|
|
64
|
+
}
|
|
65
|
+
socket.addEventListener("message", (event) => {
|
|
66
|
+
const data = event.data;
|
|
67
|
+
ctx.out(typeof data === "string" ? data : String(data));
|
|
68
|
+
});
|
|
69
|
+
socket.addEventListener("error", () => {
|
|
70
|
+
finish(new CliError(`event stream failed (${url.origin})`));
|
|
71
|
+
});
|
|
72
|
+
socket.addEventListener("close", (event) => {
|
|
73
|
+
if (event.code === 1000 || event.code === 1005)
|
|
74
|
+
finish();
|
|
75
|
+
else
|
|
76
|
+
finish(new CliError(`event stream closed (${event.code}${event.reason ? ` ${event.reason}` : ""})`));
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ant0 extensions ls | add <path> | show <id> | rm <id> [--force]`.
|
|
3
|
+
*
|
|
4
|
+
* The library keeps one unpacked copy per extension under `<home>/extensions/<id>/`; profiles
|
|
5
|
+
* reference that folder in `launch.extensions`. `add` takes a folder, a `.zip` or a `.crx`; the
|
|
6
|
+
* path is made absolute here because the daemon may run with another working directory.
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from "node:path";
|
|
9
|
+
import { unwrap } from "../api/index.js";
|
|
10
|
+
import { flatten, formatBytes, keyValues, table } from "../format.js";
|
|
11
|
+
const HEADERS = ["id", "name", "version", "mv", "size", "used by", "path"];
|
|
12
|
+
function extensionRows(items) {
|
|
13
|
+
return items.map((e) => [
|
|
14
|
+
e.id,
|
|
15
|
+
e.name,
|
|
16
|
+
e.version,
|
|
17
|
+
e.manifest_version,
|
|
18
|
+
formatBytes(e.size_bytes),
|
|
19
|
+
e.used_by.length,
|
|
20
|
+
e.path,
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
/** `show`/`add` rendering: every field except the inline icon, which is not for a terminal. */
|
|
24
|
+
function extensionText(e) {
|
|
25
|
+
const { icon_data_url: _icon, ...rest } = e;
|
|
26
|
+
return keyValues(flatten(rest));
|
|
27
|
+
}
|
|
28
|
+
export function registerExtensions(program, ctx) {
|
|
29
|
+
const extensions = program
|
|
30
|
+
.command("extensions")
|
|
31
|
+
.description("Extension library shared by profiles (unpacked folders under <home>/extensions)");
|
|
32
|
+
extensions
|
|
33
|
+
.command("ls")
|
|
34
|
+
.description("List library extensions and how many profiles use each")
|
|
35
|
+
.action(async () => {
|
|
36
|
+
const data = unwrap(await ctx.client().GET("/v1/extensions"));
|
|
37
|
+
ctx.emit(data, () => table(HEADERS, extensionRows(data.items)));
|
|
38
|
+
});
|
|
39
|
+
extensions
|
|
40
|
+
.command("add <path>")
|
|
41
|
+
.description("Add an unpacked extension folder, a .zip or a .crx to the library")
|
|
42
|
+
.action(async (path) => {
|
|
43
|
+
const added = unwrap(await ctx.client().POST("/v1/extensions", { body: { path: resolve(path) } }));
|
|
44
|
+
ctx.emit(added, () => added.existing
|
|
45
|
+
? `already in the library as ${added.id}\n${extensionText(added)}`
|
|
46
|
+
: extensionText(added));
|
|
47
|
+
});
|
|
48
|
+
extensions
|
|
49
|
+
.command("show <id>")
|
|
50
|
+
.description("Show one library extension")
|
|
51
|
+
.action(async (id) => {
|
|
52
|
+
const data = unwrap(await ctx.client().GET("/v1/extensions/{id}", { params: { path: { id } } }));
|
|
53
|
+
ctx.emit(data, () => extensionText(data));
|
|
54
|
+
});
|
|
55
|
+
extensions
|
|
56
|
+
.command("rm <id>")
|
|
57
|
+
.description("Remove an extension from the library (refused while a profile uses it)")
|
|
58
|
+
.option("--force", "also drop it from the launch.extensions of every profile using it")
|
|
59
|
+
.action(async (id, opts) => {
|
|
60
|
+
const result = unwrap(await ctx.client().DELETE("/v1/extensions/{id}", {
|
|
61
|
+
params: { path: { id }, query: opts.force ? { force: true } : {} },
|
|
62
|
+
}));
|
|
63
|
+
ctx.emit(result, () => {
|
|
64
|
+
const lines = [`removed ${result.id}`];
|
|
65
|
+
if (result.updated_profiles.length > 0) {
|
|
66
|
+
lines.push(`updated ${result.updated_profiles.length} profile(s)`);
|
|
67
|
+
for (const p of result.updated_profiles)
|
|
68
|
+
lines.push(` ${p}`);
|
|
69
|
+
}
|
|
70
|
+
return lines.join("\n");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type ProfileCreate, type ProfileSummary, type paths } from "../api/index.js";
|
|
3
|
+
import type { Context } from "../context.js";
|
|
4
|
+
export declare const SUMMARY_HEADERS: string[];
|
|
5
|
+
export declare function summaryRows(items: ProfileSummary[]): (string | boolean | null)[][];
|
|
6
|
+
interface SetOptions {
|
|
7
|
+
/** `--group <name>` = string, `--no-group` = false, absent = undefined. */
|
|
8
|
+
group?: string | false;
|
|
9
|
+
tagAdd: string[];
|
|
10
|
+
tagRemove: string[];
|
|
11
|
+
/** `--pin` = true, `--no-pin` = false. */
|
|
12
|
+
pin?: boolean;
|
|
13
|
+
/** `--proxy <id>` = proxy id, `--no-proxy` = false (direct connection). */
|
|
14
|
+
proxy?: string | false;
|
|
15
|
+
/** `--status <text>` = status, `--no-status` = false (clear). */
|
|
16
|
+
status?: string | false;
|
|
17
|
+
webrtc?: string;
|
|
18
|
+
}
|
|
19
|
+
type BulkPatch = NonNullable<paths["/v1/profiles/bulk-update"]["post"]["requestBody"]>["content"]["application/json"]["patch"];
|
|
20
|
+
/** `profiles set` flags -> `patch` of `POST /profiles/bulk-update`; empty patch is a usage error. */
|
|
21
|
+
export declare function setPatch(opts: SetOptions): BulkPatch;
|
|
22
|
+
/** `--proxy <id|url|line>` -> `network` fragment of a create/patch body. */
|
|
23
|
+
export declare function proxyNetwork(value: string): NonNullable<ProfileCreate["network"]>;
|
|
24
|
+
interface CreateOptions {
|
|
25
|
+
proxy?: string;
|
|
26
|
+
group?: string;
|
|
27
|
+
tag: string[];
|
|
28
|
+
startUrl: string[];
|
|
29
|
+
pin?: boolean;
|
|
30
|
+
headless?: boolean;
|
|
31
|
+
notes?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function createBody(name: string, opts: CreateOptions): ProfileCreate;
|
|
34
|
+
export declare function registerProfiles(program: Command, ctx: Context): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=profiles.d.ts.map
|