@ant0/cli 0.0.0-stage → 0.3.22-beta.8
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 +11615 -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 +217 -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 +72 -0
- package/dist/shared/proxy-parse.js +294 -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,294 @@
|
|
|
1
|
+
import { ParseError } from "./parse-error.js";
|
|
2
|
+
/**
|
|
3
|
+
* Internal failure carrying the code and the offending fragment. It never leaves this module:
|
|
4
|
+
* `parseProxyUrl`/`parseProxyLine` rethrow it as a {@link ParseError} with the generic message
|
|
5
|
+
* only, so thrown errors never echo input or credentials.
|
|
6
|
+
*/
|
|
7
|
+
class ProxyParseFailure extends Error {
|
|
8
|
+
code;
|
|
9
|
+
fragment;
|
|
10
|
+
constructor(code, message, fragment) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.fragment = fragment;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function fail(code, message, fragment) {
|
|
17
|
+
throw new ProxyParseFailure(code, message, fragment);
|
|
18
|
+
}
|
|
19
|
+
const SCHEME_ALIASES = {
|
|
20
|
+
http: "http",
|
|
21
|
+
https: "https",
|
|
22
|
+
socks5: "socks5",
|
|
23
|
+
socks5h: "socks5",
|
|
24
|
+
socks4: "socks4",
|
|
25
|
+
socks4a: "socks4",
|
|
26
|
+
};
|
|
27
|
+
const DEFAULT_PORTS = {
|
|
28
|
+
http: 80,
|
|
29
|
+
https: 443,
|
|
30
|
+
socks5: 1080,
|
|
31
|
+
socks4: 1080,
|
|
32
|
+
};
|
|
33
|
+
/** Same character rules as `proxy-v1.schema.json#/properties/host` (bare IPv6, no brackets). */
|
|
34
|
+
const HOST_RE = /^[^\s/\\@?#[\]]+$/;
|
|
35
|
+
const PORT_RE = /^\d{1,5}$/;
|
|
36
|
+
const URL_RE = /^([A-Za-z][A-Za-z0-9+.-]*):\/\/(.*)$/;
|
|
37
|
+
/** `host[:port]` (bracketed IPv6 allowed) immediately followed by a path/query/fragment char. */
|
|
38
|
+
const PATH_AFTER_HOST_PORT = /^(?:\[[^\]]*\]|[^:[/?#]+)(?::\d*)?[/?#]/;
|
|
39
|
+
/** Display form used for default names: IPv6 hosts are bracketed. */
|
|
40
|
+
export function formatHostPort(host, port) {
|
|
41
|
+
return host.includes(":") ? `[${host}]:${port}` : `${host}:${port}`;
|
|
42
|
+
}
|
|
43
|
+
function parsePort(text) {
|
|
44
|
+
if (!PORT_RE.test(text))
|
|
45
|
+
fail("bad_port", "invalid port: expected 1..65535", text);
|
|
46
|
+
const port = Number(text);
|
|
47
|
+
if (port < 1 || port > 65535)
|
|
48
|
+
fail("port_range", "port is out of range 1..65535", String(port));
|
|
49
|
+
return port;
|
|
50
|
+
}
|
|
51
|
+
function checkHost(host) {
|
|
52
|
+
if (host === "")
|
|
53
|
+
fail("missing_host", "missing host");
|
|
54
|
+
if (!HOST_RE.test(host))
|
|
55
|
+
fail("bad_host", "invalid host", host);
|
|
56
|
+
return host;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An unbracketed `a:b:c...` is an IPv6 literal (not `host:port[:user:pass]`) when it contains
|
|
60
|
+
* `::`, or when it has two or more colons and the segment after the first one is not a port.
|
|
61
|
+
* Only hex digits, dots and colons are considered so `host:8080:user:pass` never matches.
|
|
62
|
+
*/
|
|
63
|
+
function looksLikeBareIpv6(text) {
|
|
64
|
+
if (!/^[0-9A-Fa-f:.]+$/.test(text))
|
|
65
|
+
return false;
|
|
66
|
+
const colons = text.split(":").length - 1;
|
|
67
|
+
if (colons < 2)
|
|
68
|
+
return false;
|
|
69
|
+
if (text.includes("::"))
|
|
70
|
+
return true;
|
|
71
|
+
const second = text.split(":")[1] ?? "";
|
|
72
|
+
return !PORT_RE.test(second);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parse `host:port`, `[v6]:port`, or a bare host (port optional when `defaultPort` is given).
|
|
76
|
+
* Returns the remaining text after the port (starting with `:`) so callers can consume
|
|
77
|
+
* `:user:pass` suffixes.
|
|
78
|
+
*/
|
|
79
|
+
function splitHostPort(text, defaultPort) {
|
|
80
|
+
let host;
|
|
81
|
+
let after;
|
|
82
|
+
if (text.startsWith("[")) {
|
|
83
|
+
const close = text.indexOf("]");
|
|
84
|
+
if (close < 0)
|
|
85
|
+
fail("ipv6_bracket", "unterminated IPv6 bracket");
|
|
86
|
+
host = text.slice(1, close);
|
|
87
|
+
after = text.slice(close + 1);
|
|
88
|
+
if (!host.includes(":"))
|
|
89
|
+
fail("bad_ipv6_host", "invalid IPv6 host", host);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (looksLikeBareIpv6(text)) {
|
|
93
|
+
fail("ipv6_bare", "IPv6 hosts must be written in brackets, e.g. [2001:db8::1]:1080");
|
|
94
|
+
}
|
|
95
|
+
const colon = text.indexOf(":");
|
|
96
|
+
host = colon < 0 ? text : text.slice(0, colon);
|
|
97
|
+
after = colon < 0 ? "" : text.slice(colon);
|
|
98
|
+
}
|
|
99
|
+
checkHost(host);
|
|
100
|
+
if (after === "") {
|
|
101
|
+
if (defaultPort === undefined)
|
|
102
|
+
fail("missing_port", "missing port");
|
|
103
|
+
return { host, port: defaultPort, rest: "" };
|
|
104
|
+
}
|
|
105
|
+
if (!after.startsWith(":"))
|
|
106
|
+
fail("trailing", "unexpected text after host", after);
|
|
107
|
+
const next = after.indexOf(":", 1);
|
|
108
|
+
const portText = next < 0 ? after.slice(1) : after.slice(1, next);
|
|
109
|
+
const rest = next < 0 ? "" : after.slice(next);
|
|
110
|
+
if (portText === "") {
|
|
111
|
+
if (defaultPort === undefined)
|
|
112
|
+
fail("missing_port", "missing port");
|
|
113
|
+
return { host, port: defaultPort, rest };
|
|
114
|
+
}
|
|
115
|
+
return { host, port: parsePort(portText), rest };
|
|
116
|
+
}
|
|
117
|
+
function decodeComponent(text, what) {
|
|
118
|
+
try {
|
|
119
|
+
return decodeURIComponent(text);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
fail("bad_encoding", `invalid percent-encoding in ${what}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function splitUserInfo(userInfo, decode) {
|
|
126
|
+
const colon = userInfo.indexOf(":");
|
|
127
|
+
let username = colon < 0 ? userInfo : userInfo.slice(0, colon);
|
|
128
|
+
let password = colon < 0 ? undefined : userInfo.slice(colon + 1);
|
|
129
|
+
if (decode) {
|
|
130
|
+
username = decodeComponent(username, "username");
|
|
131
|
+
if (password !== undefined)
|
|
132
|
+
password = decodeComponent(password, "password");
|
|
133
|
+
}
|
|
134
|
+
const out = {};
|
|
135
|
+
if (username !== "")
|
|
136
|
+
out.username = username;
|
|
137
|
+
if (password !== undefined && password !== "")
|
|
138
|
+
out.password = password;
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
function build(type, host, port, creds) {
|
|
142
|
+
if (type === "socks4" && creds.password !== undefined) {
|
|
143
|
+
fail("socks4_password", "SOCKS4 proxies have a user ID but no password; remove the password or use socks5");
|
|
144
|
+
}
|
|
145
|
+
const out = { name: formatHostPort(host, port).slice(0, 120), type, host, port };
|
|
146
|
+
if (creds.username !== undefined)
|
|
147
|
+
out.username = creds.username;
|
|
148
|
+
if (creds.password !== undefined)
|
|
149
|
+
out.password = creds.password;
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
/** Run a parser and rethrow its failure as a {@link ParseError} carrying the generic message only. */
|
|
153
|
+
function generic(run) {
|
|
154
|
+
try {
|
|
155
|
+
return run();
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (error instanceof ProxyParseFailure)
|
|
159
|
+
throw new ParseError(error.message);
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* `parseProxyLine` as a result instead of a throw, with the stable failure code (and the
|
|
165
|
+
* offending fragment) so a UI can phrase its own message. Same grammar, same checks, same order.
|
|
166
|
+
* Unlike a thrown error, a failure here may carry input fragments; see {@link ProxyLineInspection}.
|
|
167
|
+
*/
|
|
168
|
+
export function inspectProxyLine(line) {
|
|
169
|
+
try {
|
|
170
|
+
return { ok: true, proxy: proxyLine(line) };
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (error instanceof ProxyParseFailure) {
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
code: error.code,
|
|
177
|
+
message: error.message,
|
|
178
|
+
...(error.fragment === undefined ? {} : { fragment: error.fragment }),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Parse `scheme://[user[:pass]@]host[:port][/]` for `http`, `https`, `socks5` (and `socks5h`,
|
|
186
|
+
* mapped to `socks5`) and `socks4` (and `socks4a`, mapped to `socks4`; no password). Credentials before `@` are percent-decoded; a raw `@` inside the password
|
|
187
|
+
* is tolerated (the last `@` separates user info from the host). Missing port falls back to
|
|
188
|
+
* 80 / 443 / 1080. The provider export form `scheme://host:port:user:pass` is also accepted;
|
|
189
|
+
* its credentials are taken verbatim (no percent-decoding).
|
|
190
|
+
*
|
|
191
|
+
* @throws {ParseError}
|
|
192
|
+
*/
|
|
193
|
+
export function parseProxyUrl(url) {
|
|
194
|
+
return generic(() => proxyUrl(url));
|
|
195
|
+
}
|
|
196
|
+
function proxyUrl(url) {
|
|
197
|
+
const m = URL_RE.exec(url.trim());
|
|
198
|
+
if (!m)
|
|
199
|
+
fail("not_url", "not a proxy URL: expected scheme://host:port");
|
|
200
|
+
const scheme = (m[1] ?? "").toLowerCase();
|
|
201
|
+
const type = SCHEME_ALIASES[scheme];
|
|
202
|
+
if (!type) {
|
|
203
|
+
fail("bad_scheme", "unsupported proxy type: expected http, https, socks5 or socks4", scheme);
|
|
204
|
+
}
|
|
205
|
+
let rest = m[2] ?? "";
|
|
206
|
+
// Strip an optional trailing "/" (providers often paste "http://host:port/").
|
|
207
|
+
if (rest.endsWith("/"))
|
|
208
|
+
rest = rest.slice(0, -1);
|
|
209
|
+
const at = rest.lastIndexOf("@");
|
|
210
|
+
const userInfo = at < 0 ? "" : rest.slice(0, at);
|
|
211
|
+
const hostPort = at < 0 ? rest : rest.slice(at + 1);
|
|
212
|
+
// With "@" the host:port part must be clean; without it only the host/port segment is checked
|
|
213
|
+
// so a "/" inside a verbatim ":user:pass" suffix is not mistaken for a path.
|
|
214
|
+
if (at >= 0 ? /[/?#]/.test(hostPort) : PATH_AFTER_HOST_PORT.test(hostPort)) {
|
|
215
|
+
fail("has_path", "proxy URL must not contain a path, query or fragment");
|
|
216
|
+
}
|
|
217
|
+
const { host, port, rest: tail } = splitHostPort(hostPort, DEFAULT_PORTS[type]);
|
|
218
|
+
if (at >= 0) {
|
|
219
|
+
if (tail !== "")
|
|
220
|
+
fail("trailing", "unexpected text after port", tail);
|
|
221
|
+
return build(type, host, port, splitUserInfo(userInfo, true));
|
|
222
|
+
}
|
|
223
|
+
if (tail === "")
|
|
224
|
+
return build(type, host, port, {});
|
|
225
|
+
// scheme://host:port:user:pass (a common provider export format); credentials verbatim.
|
|
226
|
+
const creds = splitUserInfo(tail.slice(1), false);
|
|
227
|
+
if (creds.username === undefined && creds.password === undefined) {
|
|
228
|
+
fail("trailing", "unexpected text after port", tail);
|
|
229
|
+
}
|
|
230
|
+
return build(type, host, port, creds);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Parse one provider-style line. Accepted forms (type defaults to `http`):
|
|
234
|
+
*
|
|
235
|
+
* - `host:port`
|
|
236
|
+
* - `host:port:user:pass` (a password may itself contain `:`)
|
|
237
|
+
* - `user:pass@host:port`
|
|
238
|
+
* - `scheme://...` (delegates to `parseProxyUrl`)
|
|
239
|
+
*
|
|
240
|
+
* IPv6 hosts must be bracketed, e.g. `[2001:db8::1]:1080:user:pass`.
|
|
241
|
+
*
|
|
242
|
+
* @throws {ParseError}
|
|
243
|
+
*/
|
|
244
|
+
export function parseProxyLine(line) {
|
|
245
|
+
return generic(() => proxyLine(line));
|
|
246
|
+
}
|
|
247
|
+
function proxyLine(line) {
|
|
248
|
+
const text = line.trim();
|
|
249
|
+
if (text === "")
|
|
250
|
+
fail("empty", "empty proxy line");
|
|
251
|
+
if (/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(text))
|
|
252
|
+
return proxyUrl(text);
|
|
253
|
+
if (/\s/.test(text))
|
|
254
|
+
fail("whitespace", "proxy line must not contain whitespace");
|
|
255
|
+
const at = text.lastIndexOf("@");
|
|
256
|
+
if (at >= 0) {
|
|
257
|
+
const creds = splitUserInfo(text.slice(0, at), false);
|
|
258
|
+
const { host, port, rest } = splitHostPort(text.slice(at + 1));
|
|
259
|
+
if (rest !== "")
|
|
260
|
+
fail("trailing", "unexpected text after port", rest);
|
|
261
|
+
return build("http", host, port, creds);
|
|
262
|
+
}
|
|
263
|
+
const { host, port, rest } = splitHostPort(text);
|
|
264
|
+
if (rest === "")
|
|
265
|
+
return build("http", host, port, {});
|
|
266
|
+
// rest is ":user[:pass[:more...]]"; everything after the user's colon is the password.
|
|
267
|
+
const creds = splitUserInfo(rest.slice(1), false);
|
|
268
|
+
if (creds.username === undefined && creds.password === undefined) {
|
|
269
|
+
fail("expected_form", "expected host:port or host:port:user:pass");
|
|
270
|
+
}
|
|
271
|
+
return build("http", host, port, creds);
|
|
272
|
+
}
|
|
273
|
+
/** Parse a multi-line provider export; blank lines and `#` comments are skipped. */
|
|
274
|
+
export function parseProxyLines(text) {
|
|
275
|
+
const proxies = [];
|
|
276
|
+
const errors = [];
|
|
277
|
+
const lines = text.split(/\r?\n/);
|
|
278
|
+
lines.forEach((raw, index) => {
|
|
279
|
+
const line = raw.trim();
|
|
280
|
+
if (line === "" || line.startsWith("#"))
|
|
281
|
+
return;
|
|
282
|
+
try {
|
|
283
|
+
proxies.push(parseProxyLine(line));
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
errors.push({
|
|
287
|
+
line: index + 1,
|
|
288
|
+
message: error instanceof Error ? error.message : String(error),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return { proxies, errors };
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=proxy-parse.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ProxyType = "http" | "https" | "socks5" | "socks4";
|
|
2
|
+
/**
|
|
3
|
+
* Input for `POST /proxies` (object form). `password` is PLAINTEXT on input; the daemon stores it
|
|
4
|
+
* in the secrets table and writes `password_ref` on the stored document.
|
|
5
|
+
*/
|
|
6
|
+
export interface ProxyCreate {
|
|
7
|
+
name: string;
|
|
8
|
+
type: ProxyType;
|
|
9
|
+
host: string;
|
|
10
|
+
port: number;
|
|
11
|
+
username?: string;
|
|
12
|
+
password?: string;
|
|
13
|
+
change_ip_url?: string;
|
|
14
|
+
session_pattern?: string;
|
|
15
|
+
provider?: string;
|
|
16
|
+
/** socks5 only; defaults to `false`. */
|
|
17
|
+
udp?: boolean;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
notes?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=proxy-types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A recovery code encodes exactly this many raw bytes. */
|
|
2
|
+
export declare const RECOVERY_CODE_BYTES = 32;
|
|
3
|
+
/** Format 32 raw bytes as 13 dash-separated groups of four base32 characters. */
|
|
4
|
+
export declare function formatRecoveryCode(raw: Uint8Array): string;
|
|
5
|
+
/** Parse a recovery code (dashes and case ignored) back to its 32 raw bytes. */
|
|
6
|
+
export declare function parseRecoveryCode(text: string): Buffer;
|
|
7
|
+
//# sourceMappingURL=recovery-code.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ParseError } from "./parse-error.js";
|
|
2
|
+
/** A recovery code encodes exactly this many raw bytes. */
|
|
3
|
+
export const RECOVERY_CODE_BYTES = 32;
|
|
4
|
+
const BASE32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
5
|
+
/** Format 32 raw bytes as 13 dash-separated groups of four base32 characters. */
|
|
6
|
+
export function formatRecoveryCode(raw) {
|
|
7
|
+
if (raw.length !== RECOVERY_CODE_BYTES)
|
|
8
|
+
throw new ParseError("recovery code must be 32 bytes");
|
|
9
|
+
let bits = 0;
|
|
10
|
+
let value = 0;
|
|
11
|
+
let encoded = "";
|
|
12
|
+
for (const byte of raw) {
|
|
13
|
+
value = (value << 8) | byte;
|
|
14
|
+
bits += 8;
|
|
15
|
+
while (bits >= 5) {
|
|
16
|
+
encoded += BASE32[(value >>> (bits - 5)) & 31];
|
|
17
|
+
bits -= 5;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (bits > 0)
|
|
21
|
+
encoded += BASE32[(value << (5 - bits)) & 31];
|
|
22
|
+
return encoded.match(/.{4}/g).join("-");
|
|
23
|
+
}
|
|
24
|
+
/** Parse a recovery code (dashes and case ignored) back to its 32 raw bytes. */
|
|
25
|
+
export function parseRecoveryCode(text) {
|
|
26
|
+
if (typeof text !== "string" || text.length > 128 || /[^A-Za-z2-7-]/.test(text)) {
|
|
27
|
+
throw new ParseError("recovery code contains an invalid character");
|
|
28
|
+
}
|
|
29
|
+
const encoded = text.replaceAll("-", "").toUpperCase();
|
|
30
|
+
if (encoded.length !== 52)
|
|
31
|
+
throw new ParseError("recovery code must contain 52 base32 characters");
|
|
32
|
+
const out = Buffer.alloc(RECOVERY_CODE_BYTES);
|
|
33
|
+
let bits = 0;
|
|
34
|
+
let value = 0;
|
|
35
|
+
let offset = 0;
|
|
36
|
+
for (const char of encoded) {
|
|
37
|
+
const digit = BASE32.indexOf(char);
|
|
38
|
+
if (digit < 0)
|
|
39
|
+
throw new ParseError("recovery code contains an invalid base32 character");
|
|
40
|
+
value = (value << 5) | digit;
|
|
41
|
+
bits += 5;
|
|
42
|
+
if (bits >= 8) {
|
|
43
|
+
bits -= 8;
|
|
44
|
+
if (offset < out.length)
|
|
45
|
+
out[offset++] = (value >>> bits) & 0xff;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (offset !== RECOVERY_CODE_BYTES || bits !== 4 || (value & 0x0f) !== 0) {
|
|
49
|
+
throw new ParseError("recovery code has non-zero unused base32 bits");
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=recovery-code.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** What `ant0 --version` prints: the Ant0 release this CLI belongs to, else the package version. */
|
|
2
|
+
export declare const CLI_VERSION: string;
|
|
3
|
+
/**
|
|
4
|
+
* A warning when the daemon and the CLI differ in major.minor (the local API is not versioned
|
|
5
|
+
* separately), else undefined. Unparseable versions never warn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function versionSkewWarning(daemonVersion: string, cliVersion?: string): string | undefined;
|
|
8
|
+
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** What `ant0 --version` prints: the Ant0 release this CLI belongs to, else the package version. */
|
|
2
|
+
export const CLI_VERSION = typeof __ANT0_VERSION__ === "string" ? __ANT0_VERSION__ : "0.3.22-beta.8";
|
|
3
|
+
function majorMinor(version) {
|
|
4
|
+
return /^(\d+)\.(\d+)(?:\.|-|$)/.exec(version)?.slice(1, 3).join(".");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A warning when the daemon and the CLI differ in major.minor (the local API is not versioned
|
|
8
|
+
* separately), else undefined. Unparseable versions never warn.
|
|
9
|
+
*/
|
|
10
|
+
export function versionSkewWarning(daemonVersion, cliVersion = CLI_VERSION) {
|
|
11
|
+
const daemon = majorMinor(daemonVersion);
|
|
12
|
+
const cli = majorMinor(cliVersion);
|
|
13
|
+
if (daemon === undefined || cli === undefined || daemon === cli)
|
|
14
|
+
return undefined;
|
|
15
|
+
return (`warning: the daemon is version ${daemonVersion} but this CLI is ${cliVersion}; ` +
|
|
16
|
+
"commands may fail until both are on the same release");
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Dependency notices
|
|
2
|
+
|
|
3
|
+
`THIRD_PARTY_NOTICES` holds the licence and notice files of this package's runtime dependencies,
|
|
4
|
+
copied unchanged from the installed packages. `pnpm generate:notices` rewrites it from `node_modules`;
|
|
5
|
+
CI does not edit it. It ships in the npm package.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
THIRD-PARTY NOTICES
|
|
2
|
+
|
|
3
|
+
This package depends on the packages below; npm installs them next to it. Each
|
|
4
|
+
package's licence and notice files follow, copied unchanged from the package.
|
|
5
|
+
|
|
6
|
+
==============================================================================
|
|
7
|
+
@ant0/mcp@0.3.22-beta.2 (BSD-3-Clause)
|
|
8
|
+
==============================================================================
|
|
9
|
+
|
|
10
|
+
--- LICENSE ---
|
|
11
|
+
|
|
12
|
+
BSD 3-Clause License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2026, RENEWBYTE LABS LTD
|
|
15
|
+
|
|
16
|
+
Redistribution and use in source and binary forms, with or without
|
|
17
|
+
modification, are permitted provided that the following conditions are met:
|
|
18
|
+
|
|
19
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
20
|
+
list of conditions and the following disclaimer.
|
|
21
|
+
|
|
22
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
23
|
+
this list of conditions and the following disclaimer in the documentation
|
|
24
|
+
and/or other materials provided with the distribution.
|
|
25
|
+
|
|
26
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
27
|
+
contributors may be used to endorse or promote products derived from
|
|
28
|
+
this software without specific prior written permission.
|
|
29
|
+
|
|
30
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
31
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
32
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
33
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
34
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
35
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
36
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
37
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
38
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
39
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
40
|
+
|
|
41
|
+
==============================================================================
|
|
42
|
+
commander@15.0.0 (MIT)
|
|
43
|
+
==============================================================================
|
|
44
|
+
|
|
45
|
+
--- LICENSE ---
|
|
46
|
+
|
|
47
|
+
(The MIT License)
|
|
48
|
+
|
|
49
|
+
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
|
50
|
+
|
|
51
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
52
|
+
a copy of this software and associated documentation files (the
|
|
53
|
+
'Software'), to deal in the Software without restriction, including
|
|
54
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
55
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
56
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
57
|
+
the following conditions:
|
|
58
|
+
|
|
59
|
+
The above copyright notice and this permission notice shall be
|
|
60
|
+
included in all copies or substantial portions of the Software.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
63
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
64
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
65
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
66
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
67
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
68
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
69
|
+
|
|
70
|
+
==============================================================================
|
|
71
|
+
openapi-fetch@0.17.0 (MIT)
|
|
72
|
+
==============================================================================
|
|
73
|
+
|
|
74
|
+
--- LICENSE ---
|
|
75
|
+
|
|
76
|
+
MIT License
|
|
77
|
+
|
|
78
|
+
Copyright (c) 2023 Drew Powers
|
|
79
|
+
|
|
80
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
82
|
+
in the Software without restriction, including without limitation the rights
|
|
83
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
84
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
85
|
+
furnished to do so, subject to the following conditions:
|
|
86
|
+
|
|
87
|
+
The above copyright notice and this permission notice shall be included in all
|
|
88
|
+
copies or substantial portions of the Software.
|
|
89
|
+
|
|
90
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
91
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
92
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
93
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
94
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
95
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
96
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant0/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.22-beta.8",
|
|
4
|
+
"description": "The Ant0 command line: profiles, proxies, browsers and more, over the local Ant0 API.",
|
|
5
|
+
"license": "BSD-3-Clause",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"homepage": "https://ant0.link",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Ant0-Browser/ant0-cli.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Ant0-Browser/ant0-cli/issues"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=24",
|
|
18
|
+
"pnpm": ">=10"
|
|
19
|
+
},
|
|
20
|
+
"packageManager": "pnpm@11.25.0",
|
|
21
|
+
"bin": {
|
|
22
|
+
"ant0": "./dist/bin.js"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"!dist/**/*.map",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md",
|
|
35
|
+
"licenses"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": true
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.json",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"lint": "prettier --check .",
|
|
46
|
+
"format": "prettier --write .",
|
|
47
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
48
|
+
"generate:api": "node scripts/generate-api.mjs",
|
|
49
|
+
"generate:notices": "node scripts/generate-notices.mjs",
|
|
50
|
+
"check:forbidden": "node scripts/check-forbidden.mjs"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@ant0/mcp": "0.3.22-beta.8",
|
|
54
|
+
"commander": "15.0.0",
|
|
55
|
+
"openapi-fetch": "0.17.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@modelcontextprotocol/client": "2.4.0",
|
|
59
|
+
"@types/node": "^24.13.3",
|
|
60
|
+
"openapi-typescript": "^7.13.0",
|
|
61
|
+
"prettier": "3.9.6",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^4.1.12"
|
|
64
|
+
}
|
|
65
|
+
}
|