@pmate/cli 0.28.1 → 0.28.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/dist/index.d.ts +12 -1
- package/dist/index.js +355 -155
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,19 @@ declare enum Command {
|
|
|
32
32
|
App = "app",
|
|
33
33
|
Service = "service",
|
|
34
34
|
Vercel = "vercel",
|
|
35
|
+
Host = "host",
|
|
35
36
|
Quiz = "quiz"
|
|
36
37
|
}
|
|
38
|
+
type HostCommandArgs = {
|
|
39
|
+
type: Command.Host;
|
|
40
|
+
action: "env-list" | "env-set" | "env-unset" | "apply";
|
|
41
|
+
host?: string;
|
|
42
|
+
key?: string;
|
|
43
|
+
value?: string;
|
|
44
|
+
secret?: boolean;
|
|
45
|
+
baseUrl?: string;
|
|
46
|
+
json: boolean;
|
|
47
|
+
};
|
|
37
48
|
type NoneCommandArgs = {
|
|
38
49
|
type: Command.None;
|
|
39
50
|
};
|
|
@@ -1163,7 +1174,7 @@ type VercelDeploysCommandArgs = {
|
|
|
1163
1174
|
lastWeek: boolean;
|
|
1164
1175
|
};
|
|
1165
1176
|
type VercelCommandArgs = VercelProjectsCommandArgs | VercelDeploysCommandArgs;
|
|
1166
|
-
type CommandArgs = NoneCommandArgs | ListCommandArgs | LoginCommandArgs | AddDnsCommandArgs | StsCommandArgs | BucketCommandArgs | DeployCommandArgs | LogCommandArgs | InitCommandArgs | DeleteCommandArgs | DevCommandArgs | EnvCommandArgs | PrCommandArgs | CommitCommandArgs | SummaryCommandArgs | QuizCommandArgs | ServiceCommandArgs | LinearCommandArgs | NotionCommandArgs | OssCommandArgs | QrcodeCommandArgs | RandomCommandArgs | CollectCommandArgs | ChatRoomCommandArgs | AgentCommandArgs | RunnerCommandArgs | NsCommandArgs | RoleCommandArgs | AccountCommandArgs | OrgCommandArgs | StoreCommandArgs | AppCommandArgs | VercelCommandArgs;
|
|
1177
|
+
type CommandArgs = NoneCommandArgs | ListCommandArgs | LoginCommandArgs | AddDnsCommandArgs | StsCommandArgs | BucketCommandArgs | DeployCommandArgs | LogCommandArgs | InitCommandArgs | DeleteCommandArgs | DevCommandArgs | EnvCommandArgs | PrCommandArgs | CommitCommandArgs | SummaryCommandArgs | QuizCommandArgs | ServiceCommandArgs | LinearCommandArgs | NotionCommandArgs | OssCommandArgs | QrcodeCommandArgs | RandomCommandArgs | CollectCommandArgs | ChatRoomCommandArgs | AgentCommandArgs | RunnerCommandArgs | NsCommandArgs | RoleCommandArgs | AccountCommandArgs | OrgCommandArgs | StoreCommandArgs | AppCommandArgs | VercelCommandArgs | HostCommandArgs;
|
|
1167
1178
|
|
|
1168
1179
|
interface ParsedArgs {
|
|
1169
1180
|
help: boolean;
|
package/dist/index.js
CHANGED
|
@@ -10288,8 +10288,8 @@ __export(index_exports, {
|
|
|
10288
10288
|
parseCommandArgs: () => parseCommandArgs
|
|
10289
10289
|
});
|
|
10290
10290
|
module.exports = __toCommonJS(index_exports);
|
|
10291
|
-
var
|
|
10292
|
-
var
|
|
10291
|
+
var import_node_fs26 = require("fs");
|
|
10292
|
+
var import_node_path31 = __toESM(require("path"));
|
|
10293
10293
|
var import_chalk4 = __toESM(require("chalk"));
|
|
10294
10294
|
|
|
10295
10295
|
// src/cli.ts
|
|
@@ -15708,9 +15708,9 @@ ${indent}\`\`\``;
|
|
|
15708
15708
|
static richTextToPlain(richText) {
|
|
15709
15709
|
return richText.map((item) => item.plain_text ?? item.text?.content ?? "").join("").trim();
|
|
15710
15710
|
}
|
|
15711
|
-
static async requestJson(
|
|
15711
|
+
static async requestJson(path32, init) {
|
|
15712
15712
|
const token = this.getToken();
|
|
15713
|
-
const response = await fetch(`${this.baseUrl}${
|
|
15713
|
+
const response = await fetch(`${this.baseUrl}${path32}`, {
|
|
15714
15714
|
method: init.method,
|
|
15715
15715
|
headers: {
|
|
15716
15716
|
Authorization: `Bearer ${token}`,
|
|
@@ -18254,8 +18254,8 @@ function descriptorPathSegments(descriptor) {
|
|
|
18254
18254
|
return ["chains", normalized.chain, "namespaces", normalized.ns, normalized.kind, normalized.name];
|
|
18255
18255
|
}
|
|
18256
18256
|
function buildPathUrl(baseUrl, pathSegments, query) {
|
|
18257
|
-
const
|
|
18258
|
-
const url = new URL(
|
|
18257
|
+
const path32 = `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
18258
|
+
const url = new URL(path32, baseUrl);
|
|
18259
18259
|
if (query) {
|
|
18260
18260
|
for (const [key, value] of Object.entries(query)) {
|
|
18261
18261
|
url.searchParams.set(key, String(value));
|
|
@@ -20351,6 +20351,33 @@ var ServiceRegistryClient = class {
|
|
|
20351
20351
|
constructor(baseUrl) {
|
|
20352
20352
|
this.baseUrl = baseUrl;
|
|
20353
20353
|
}
|
|
20354
|
+
async listHostEnv(hostId) {
|
|
20355
|
+
const payload = await this.request(
|
|
20356
|
+
"GET",
|
|
20357
|
+
`/hosts/${encodeURIComponent(hostId)}/env-vars`
|
|
20358
|
+
);
|
|
20359
|
+
return payload.items;
|
|
20360
|
+
}
|
|
20361
|
+
async setHostEnv(hostId, key, value, kind) {
|
|
20362
|
+
const payload = await this.requestWithBody(
|
|
20363
|
+
"PUT",
|
|
20364
|
+
`/hosts/${encodeURIComponent(hostId)}/env-vars/${encodeURIComponent(key)}`,
|
|
20365
|
+
{ value, kind }
|
|
20366
|
+
);
|
|
20367
|
+
return payload.item;
|
|
20368
|
+
}
|
|
20369
|
+
async deleteHostEnv(hostId, key) {
|
|
20370
|
+
return this.request(
|
|
20371
|
+
"DELETE",
|
|
20372
|
+
`/hosts/${encodeURIComponent(hostId)}/env-vars/${encodeURIComponent(key)}`
|
|
20373
|
+
);
|
|
20374
|
+
}
|
|
20375
|
+
async resolveHostEnv(hostId) {
|
|
20376
|
+
return this.request(
|
|
20377
|
+
"GET",
|
|
20378
|
+
`/hosts/${encodeURIComponent(hostId)}/env-vars/resolve`
|
|
20379
|
+
);
|
|
20380
|
+
}
|
|
20354
20381
|
async listServices(filters) {
|
|
20355
20382
|
const searchParams = new URLSearchParams();
|
|
20356
20383
|
const repository = normalizeRepository(filters?.repository);
|
|
@@ -21685,9 +21712,9 @@ var ServiceRuntimeRunner = class {
|
|
|
21685
21712
|
return tokens;
|
|
21686
21713
|
}
|
|
21687
21714
|
readPathValue(source, pathExpr) {
|
|
21688
|
-
const
|
|
21715
|
+
const path32 = pathExpr.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
21689
21716
|
let cursor = source;
|
|
21690
|
-
for (const segment of
|
|
21717
|
+
for (const segment of path32) {
|
|
21691
21718
|
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
21692
21719
|
return void 0;
|
|
21693
21720
|
}
|
|
@@ -24356,6 +24383,125 @@ function encodePathSegment3(value) {
|
|
|
24356
24383
|
return value.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
24357
24384
|
}
|
|
24358
24385
|
|
|
24386
|
+
// src/commands/HostCommandHandler.ts
|
|
24387
|
+
var import_node_fs25 = require("fs");
|
|
24388
|
+
var import_node_os11 = require("os");
|
|
24389
|
+
var import_node_path30 = __toESM(require("path"));
|
|
24390
|
+
var import_node_child_process13 = require("child_process");
|
|
24391
|
+
var BLOCK_START = "# >>> pmate host env >>>";
|
|
24392
|
+
var BLOCK_END = "# <<< pmate host env <<<";
|
|
24393
|
+
var PROFILE_BLOCK = `${BLOCK_START}
|
|
24394
|
+
if [ -f "$HOME/.pmate/host/host.env" ]; then
|
|
24395
|
+
set -a
|
|
24396
|
+
. "$HOME/.pmate/host/host.env"
|
|
24397
|
+
set +a
|
|
24398
|
+
fi
|
|
24399
|
+
${BLOCK_END}`;
|
|
24400
|
+
var HostCommandHandler = class {
|
|
24401
|
+
async handle(args) {
|
|
24402
|
+
const hostId = normalizeHostId(args.host ?? process.env.PMATE_HOST_ID ?? (0, import_node_os11.hostname)());
|
|
24403
|
+
const client = new ServiceRegistryClient(args.baseUrl);
|
|
24404
|
+
if (args.action === "env-list") {
|
|
24405
|
+
const items = await client.listHostEnv(hostId);
|
|
24406
|
+
if (args.json) ui.plain(JSON.stringify({ hostId, items }, null, 2));
|
|
24407
|
+
else for (const item of items) ui.plain(`${item.key} ${item.kind} ${item.value}`);
|
|
24408
|
+
return;
|
|
24409
|
+
}
|
|
24410
|
+
if (args.action === "env-set") {
|
|
24411
|
+
const item = await client.setHostEnv(hostId, requireArg(args.key, "key"), requireArg(args.value, "value"), args.secret ? "secret" : "plain");
|
|
24412
|
+
if (args.json) ui.plain(JSON.stringify({ hostId, item }, null, 2));
|
|
24413
|
+
else ui.success(`Set host env ${item.key}`, hostId);
|
|
24414
|
+
return;
|
|
24415
|
+
}
|
|
24416
|
+
if (args.action === "env-unset") {
|
|
24417
|
+
const result2 = await client.deleteHostEnv(hostId, requireArg(args.key, "key"));
|
|
24418
|
+
if (args.json) ui.plain(JSON.stringify(result2, null, 2));
|
|
24419
|
+
else ui.success(`Unset host env ${result2.key}`, hostId);
|
|
24420
|
+
return;
|
|
24421
|
+
}
|
|
24422
|
+
const resolved = await client.resolveHostEnv(hostId);
|
|
24423
|
+
const result = await applyHostEnvRemote(hostId, resolved.values);
|
|
24424
|
+
if (args.json) ui.plain(JSON.stringify({ hostId, ...result }, null, 2));
|
|
24425
|
+
else ui.success(`Applied ${Object.keys(resolved.values).length} host env vars`, result.envFile);
|
|
24426
|
+
}
|
|
24427
|
+
};
|
|
24428
|
+
async function applyHostEnvRemote(host, values) {
|
|
24429
|
+
const target = `pmate@${normalizeHostId(host)}`;
|
|
24430
|
+
const content = serializeHostEnv(values);
|
|
24431
|
+
const script = buildRemoteApplyScript(Buffer.from(content, "utf8").toString("base64"));
|
|
24432
|
+
await new Promise((resolve, reject) => {
|
|
24433
|
+
const child = (0, import_node_child_process13.spawn)("ssh", [target, "bash -s"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
24434
|
+
let stdout = "";
|
|
24435
|
+
let stderr = "";
|
|
24436
|
+
child.stdout.on("data", (chunk) => {
|
|
24437
|
+
stdout += chunk.toString();
|
|
24438
|
+
});
|
|
24439
|
+
child.stderr.on("data", (chunk) => {
|
|
24440
|
+
stderr += chunk.toString();
|
|
24441
|
+
});
|
|
24442
|
+
child.on("error", reject);
|
|
24443
|
+
child.on("close", (code) => {
|
|
24444
|
+
if (code === 0) resolve();
|
|
24445
|
+
else reject(new Error(`ssh to ${host} failed${stderr.trim() ? `: ${stderr.trim()}` : ` with code ${code}`}
|
|
24446
|
+
${stdout.trim()}`.trim()));
|
|
24447
|
+
});
|
|
24448
|
+
child.stdin.end(script);
|
|
24449
|
+
});
|
|
24450
|
+
return {
|
|
24451
|
+
envFile: "~/.pmate/host/host.env",
|
|
24452
|
+
profileFile: "~/.profile",
|
|
24453
|
+
refreshed: true
|
|
24454
|
+
};
|
|
24455
|
+
}
|
|
24456
|
+
function buildRemoteApplyScript(contentBase64) {
|
|
24457
|
+
return `set -euo pipefail
|
|
24458
|
+
host_dir="$HOME/.pmate/host"
|
|
24459
|
+
env_file="$host_dir/host.env"
|
|
24460
|
+
profile_file="$HOME/.profile"
|
|
24461
|
+
mkdir -p "$host_dir"
|
|
24462
|
+
env_tmp="$(mktemp "$host_dir/.host.env.XXXXXX")"
|
|
24463
|
+
profile_tmp=""
|
|
24464
|
+
cleanup() { rm -f "$env_tmp"; [ -z "$profile_tmp" ] || rm -f "$profile_tmp"; }
|
|
24465
|
+
trap cleanup EXIT
|
|
24466
|
+
printf '%s' '${contentBase64}' | base64 --decode > "$env_tmp"
|
|
24467
|
+
chmod 600 "$env_tmp"
|
|
24468
|
+
mv "$env_tmp" "$env_file"
|
|
24469
|
+
touch "$profile_file"
|
|
24470
|
+
profile_tmp="$(mktemp "$HOME/.profile.XXXXXX")"
|
|
24471
|
+
awk '
|
|
24472
|
+
$0 == "${BLOCK_START}" { managed = 1; next }
|
|
24473
|
+
$0 == "${BLOCK_END}" { managed = 0; next }
|
|
24474
|
+
!managed { print }
|
|
24475
|
+
' "$profile_file" > "$profile_tmp"
|
|
24476
|
+
while [ -s "$profile_tmp" ] && [ "$(tail -c 1 "$profile_tmp" | wc -l)" -eq 0 ]; do printf '\\n' >> "$profile_tmp"; done
|
|
24477
|
+
cat >> "$profile_tmp" <<'PMATE_PROFILE_BLOCK'
|
|
24478
|
+
${PROFILE_BLOCK}
|
|
24479
|
+
PMATE_PROFILE_BLOCK
|
|
24480
|
+
mv "$profile_tmp" "$profile_file"
|
|
24481
|
+
bash -lc '. "$HOME/.profile"'
|
|
24482
|
+
printf 'applied %s\\n' "$env_file"
|
|
24483
|
+
`;
|
|
24484
|
+
}
|
|
24485
|
+
function serializeHostEnv(values) {
|
|
24486
|
+
return Object.entries(values).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${normalizeEnvKey(key)}=${shellQuote3(value)}`).join("\n") + "\n";
|
|
24487
|
+
}
|
|
24488
|
+
function normalizeHostId(value) {
|
|
24489
|
+
const normalized = value.trim();
|
|
24490
|
+
if (!/^[A-Za-z0-9._-]+$/.test(normalized)) throw new Error("Invalid host id");
|
|
24491
|
+
return normalized;
|
|
24492
|
+
}
|
|
24493
|
+
function normalizeEnvKey(value) {
|
|
24494
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) throw new Error(`Invalid env key: ${value}`);
|
|
24495
|
+
return value;
|
|
24496
|
+
}
|
|
24497
|
+
function shellQuote3(value) {
|
|
24498
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
24499
|
+
}
|
|
24500
|
+
function requireArg(value, name) {
|
|
24501
|
+
if (value === void 0) throw new Error(`Missing ${name}`);
|
|
24502
|
+
return value;
|
|
24503
|
+
}
|
|
24504
|
+
|
|
24359
24505
|
// src/agentCommandParser.ts
|
|
24360
24506
|
init_namespacedRef();
|
|
24361
24507
|
var DEFAULT_AGENT_NAMESPACE = "pmate";
|
|
@@ -27342,6 +27488,47 @@ function requireValue9(tokens, optionName) {
|
|
|
27342
27488
|
return value;
|
|
27343
27489
|
}
|
|
27344
27490
|
|
|
27491
|
+
// src/hostCommandParser.ts
|
|
27492
|
+
function parseHostArgs(tokens) {
|
|
27493
|
+
const rest = [...tokens];
|
|
27494
|
+
const first = rest.shift();
|
|
27495
|
+
let action;
|
|
27496
|
+
let key;
|
|
27497
|
+
let value;
|
|
27498
|
+
if (first === "apply") action = "apply";
|
|
27499
|
+
else if (first === "env") {
|
|
27500
|
+
const envAction = rest.shift();
|
|
27501
|
+
if (envAction === "list") action = "env-list";
|
|
27502
|
+
else if (envAction === "set") {
|
|
27503
|
+
action = "env-set";
|
|
27504
|
+
key = requireValue10(rest, "key");
|
|
27505
|
+
value = requireValue10(rest, "value");
|
|
27506
|
+
} else if (envAction === "unset") {
|
|
27507
|
+
action = "env-unset";
|
|
27508
|
+
key = requireValue10(rest, "key");
|
|
27509
|
+
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
27510
|
+
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
27511
|
+
let host;
|
|
27512
|
+
let secret = false;
|
|
27513
|
+
let baseUrl;
|
|
27514
|
+
let json = false;
|
|
27515
|
+
while (rest.length > 0) {
|
|
27516
|
+
const token = rest.shift();
|
|
27517
|
+
if (token === "--host") host = requireValue10(rest, token);
|
|
27518
|
+
else if (token === "--secret") secret = true;
|
|
27519
|
+
else if (token === "--base-url") baseUrl = requireValue10(rest, token);
|
|
27520
|
+
else if (token === "--json") json = true;
|
|
27521
|
+
else throw new Error(`Unknown host option: ${token}`);
|
|
27522
|
+
}
|
|
27523
|
+
if (secret && action !== "env-set") throw new Error("--secret is only valid for host env set");
|
|
27524
|
+
return { type: "host" /* Host */, action, host, key, value, secret, baseUrl, json };
|
|
27525
|
+
}
|
|
27526
|
+
function requireValue10(tokens, label) {
|
|
27527
|
+
const value = tokens.shift();
|
|
27528
|
+
if (!value || value.startsWith("--")) throw new Error(`Missing value for ${label}`);
|
|
27529
|
+
return value;
|
|
27530
|
+
}
|
|
27531
|
+
|
|
27345
27532
|
// src/collectCommandParser.ts
|
|
27346
27533
|
function parseCollectArgs(tokens) {
|
|
27347
27534
|
const rest = [...tokens];
|
|
@@ -27361,7 +27548,7 @@ function parseCollectArgs(tokens) {
|
|
|
27361
27548
|
const token = rest.shift();
|
|
27362
27549
|
switch (token) {
|
|
27363
27550
|
case "--source": {
|
|
27364
|
-
const value =
|
|
27551
|
+
const value = requireValue11(rest, token);
|
|
27365
27552
|
if (value !== "cc" && value !== "yelling") {
|
|
27366
27553
|
throw new Error(`Unsupported collect source: ${value}`);
|
|
27367
27554
|
}
|
|
@@ -27369,11 +27556,11 @@ function parseCollectArgs(tokens) {
|
|
|
27369
27556
|
break;
|
|
27370
27557
|
}
|
|
27371
27558
|
case "--endpoint":
|
|
27372
|
-
options.endpoint =
|
|
27559
|
+
options.endpoint = requireValue11(rest, token);
|
|
27373
27560
|
break;
|
|
27374
27561
|
case "--thread":
|
|
27375
27562
|
case "--channel":
|
|
27376
|
-
options.thread =
|
|
27563
|
+
options.thread = requireValue11(rest, token);
|
|
27377
27564
|
break;
|
|
27378
27565
|
default:
|
|
27379
27566
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -27389,7 +27576,7 @@ function parseCollectArgs(tokens) {
|
|
|
27389
27576
|
}
|
|
27390
27577
|
return { type: "collect" /* Collect */, ...options };
|
|
27391
27578
|
}
|
|
27392
|
-
function
|
|
27579
|
+
function requireValue11(tokens, optionName) {
|
|
27393
27580
|
const value = tokens.shift();
|
|
27394
27581
|
if (!value) {
|
|
27395
27582
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -27447,13 +27634,13 @@ function parseIm1ThreadsArgs(tokens) {
|
|
|
27447
27634
|
switch (token) {
|
|
27448
27635
|
case "--q":
|
|
27449
27636
|
case "--query":
|
|
27450
|
-
query =
|
|
27637
|
+
query = requireValue12(rest, token);
|
|
27451
27638
|
break;
|
|
27452
27639
|
case "--search":
|
|
27453
|
-
search =
|
|
27640
|
+
search = requireValue12(rest, token);
|
|
27454
27641
|
break;
|
|
27455
27642
|
case "--limit":
|
|
27456
|
-
limit = parsePositiveInt2(
|
|
27643
|
+
limit = parsePositiveInt2(requireValue12(rest, token), token);
|
|
27457
27644
|
break;
|
|
27458
27645
|
case "--json":
|
|
27459
27646
|
json = true;
|
|
@@ -27477,10 +27664,10 @@ function parseIm1MessagesArgs(tokens) {
|
|
|
27477
27664
|
switch (token) {
|
|
27478
27665
|
case "--thread":
|
|
27479
27666
|
case "--channel":
|
|
27480
|
-
thread =
|
|
27667
|
+
thread = requireValue12(rest, token);
|
|
27481
27668
|
break;
|
|
27482
27669
|
case "--limit":
|
|
27483
|
-
limit = parsePositiveInt2(
|
|
27670
|
+
limit = parsePositiveInt2(requireValue12(rest, token), token);
|
|
27484
27671
|
break;
|
|
27485
27672
|
case "--json":
|
|
27486
27673
|
json = true;
|
|
@@ -27507,14 +27694,14 @@ function parseIm1ReplyArgs(tokens) {
|
|
|
27507
27694
|
const token = rest.shift();
|
|
27508
27695
|
switch (token) {
|
|
27509
27696
|
case "--thread":
|
|
27510
|
-
thread =
|
|
27697
|
+
thread = requireValue12(rest, token);
|
|
27511
27698
|
break;
|
|
27512
27699
|
case "--text":
|
|
27513
|
-
text =
|
|
27700
|
+
text = requireValue12(rest, token);
|
|
27514
27701
|
break;
|
|
27515
27702
|
case "--file":
|
|
27516
27703
|
case "--image":
|
|
27517
|
-
file =
|
|
27704
|
+
file = requireValue12(rest, token);
|
|
27518
27705
|
break;
|
|
27519
27706
|
case "--dryrun":
|
|
27520
27707
|
case "--dry-run":
|
|
@@ -27547,13 +27734,13 @@ function parseIm1ReactArgs(tokens) {
|
|
|
27547
27734
|
const token = rest.shift();
|
|
27548
27735
|
switch (token) {
|
|
27549
27736
|
case "--thread":
|
|
27550
|
-
thread =
|
|
27737
|
+
thread = requireValue12(rest, token);
|
|
27551
27738
|
break;
|
|
27552
27739
|
case "--emoji":
|
|
27553
|
-
emoji =
|
|
27740
|
+
emoji = requireValue12(rest, token);
|
|
27554
27741
|
break;
|
|
27555
27742
|
case "--message":
|
|
27556
|
-
message =
|
|
27743
|
+
message = requireValue12(rest, token);
|
|
27557
27744
|
break;
|
|
27558
27745
|
case "--remove":
|
|
27559
27746
|
remove = true;
|
|
@@ -27571,7 +27758,7 @@ function parseIm1ReactArgs(tokens) {
|
|
|
27571
27758
|
}
|
|
27572
27759
|
return { type: "collect" /* Collect */, action: "react", thread, emoji, message, remove, dryRun };
|
|
27573
27760
|
}
|
|
27574
|
-
function
|
|
27761
|
+
function requireValue12(tokens, optionName) {
|
|
27575
27762
|
const value = tokens.shift();
|
|
27576
27763
|
if (!value || value.startsWith("--")) {
|
|
27577
27764
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -27685,12 +27872,12 @@ function parseShared(tokens) {
|
|
|
27685
27872
|
case "--title":
|
|
27686
27873
|
case "--bot-a":
|
|
27687
27874
|
case "--bot-b":
|
|
27688
|
-
options.set(token,
|
|
27875
|
+
options.set(token, requireValue13(tokens, token));
|
|
27689
27876
|
break;
|
|
27690
27877
|
case "--member":
|
|
27691
27878
|
case "--recipient": {
|
|
27692
27879
|
const values = multiOptions.get(token) ?? [];
|
|
27693
|
-
values.push(
|
|
27880
|
+
values.push(requireValue13(tokens, token));
|
|
27694
27881
|
multiOptions.set(token, values);
|
|
27695
27882
|
break;
|
|
27696
27883
|
}
|
|
@@ -27716,7 +27903,7 @@ function requiredOption(options, option) {
|
|
|
27716
27903
|
}
|
|
27717
27904
|
return value;
|
|
27718
27905
|
}
|
|
27719
|
-
function
|
|
27906
|
+
function requireValue13(tokens, option) {
|
|
27720
27907
|
const value = tokens.shift();
|
|
27721
27908
|
if (!value || value.startsWith("--")) {
|
|
27722
27909
|
throw new Error(`Missing value for ${option}`);
|
|
@@ -27726,7 +27913,7 @@ function requireValue12(tokens, option) {
|
|
|
27726
27913
|
|
|
27727
27914
|
// src/index.ts
|
|
27728
27915
|
var pkg = JSON.parse(
|
|
27729
|
-
(0,
|
|
27916
|
+
(0, import_node_fs26.readFileSync)(import_node_path31.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
27730
27917
|
);
|
|
27731
27918
|
var HELP_TEXT = [
|
|
27732
27919
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -27920,6 +28107,11 @@ var HELP_TEXT = [
|
|
|
27920
28107
|
` ${import_chalk4.default.gray(" ssl refresh <ns:objectId> [--cert <key>] [--dry-run] [--base-url <url>] [--json]")}`,
|
|
27921
28108
|
` ${import_chalk4.default.gray(" log <ns:objectId> [--page <n>] [--history] [--search <keyword>] [--follow|-f] [--base-url <url>]")}`,
|
|
27922
28109
|
` ${import_chalk4.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
28110
|
+
` ${import_chalk4.default.cyan("host")} Manage host-level environment variables`,
|
|
28111
|
+
` ${import_chalk4.default.gray(" env list [--host <id>] [--json]")}`,
|
|
28112
|
+
` ${import_chalk4.default.gray(" env set <key> <value> [--host <id>] [--secret]")}`,
|
|
28113
|
+
` ${import_chalk4.default.gray(" env unset <key> [--host <id>]")}`,
|
|
28114
|
+
` ${import_chalk4.default.gray(" apply [--host <id>] [--json]")}`,
|
|
27923
28115
|
` ${import_chalk4.default.cyan("vercel")} Wrap common Vercel CLI inspection commands`,
|
|
27924
28116
|
` ${import_chalk4.default.gray(" projects [--scope <scope>]")}`,
|
|
27925
28117
|
` ${import_chalk4.default.gray(" deploys --project <name> [--last-week] [--scope <scope>]")}`
|
|
@@ -27985,10 +28177,10 @@ function parseCommandArgs(args) {
|
|
|
27985
28177
|
const token = rest.shift();
|
|
27986
28178
|
switch (token) {
|
|
27987
28179
|
case "--app":
|
|
27988
|
-
app =
|
|
28180
|
+
app = requireValue14(rest, token);
|
|
27989
28181
|
break;
|
|
27990
28182
|
case "--profile-id":
|
|
27991
|
-
profileId =
|
|
28183
|
+
profileId = requireValue14(rest, token);
|
|
27992
28184
|
break;
|
|
27993
28185
|
case "--access-key":
|
|
27994
28186
|
if (rest[0] && !rest[0].startsWith("--")) {
|
|
@@ -27998,7 +28190,7 @@ function parseCommandArgs(args) {
|
|
|
27998
28190
|
}
|
|
27999
28191
|
break;
|
|
28000
28192
|
case "--access-key-file":
|
|
28001
|
-
accessKeyFile =
|
|
28193
|
+
accessKeyFile = requireValue14(rest, token);
|
|
28002
28194
|
break;
|
|
28003
28195
|
case "--select-profile":
|
|
28004
28196
|
selectProfile = true;
|
|
@@ -28099,6 +28291,9 @@ function parseCommandArgs(args) {
|
|
|
28099
28291
|
if (args.rest[0] === "service") {
|
|
28100
28292
|
return parseServiceArgs(args.rest.slice(1));
|
|
28101
28293
|
}
|
|
28294
|
+
if (args.rest[0] === "host") {
|
|
28295
|
+
return parseHostArgs(args.rest.slice(1));
|
|
28296
|
+
}
|
|
28102
28297
|
if (args.rest[0] === "vercel") {
|
|
28103
28298
|
return parseVercelArgs(args.rest.slice(1));
|
|
28104
28299
|
}
|
|
@@ -28116,7 +28311,7 @@ function parseVercelArgs(tokens) {
|
|
|
28116
28311
|
const token = rest.shift();
|
|
28117
28312
|
switch (token) {
|
|
28118
28313
|
case "--scope":
|
|
28119
|
-
scope =
|
|
28314
|
+
scope = requireValue14(rest, token);
|
|
28120
28315
|
break;
|
|
28121
28316
|
default:
|
|
28122
28317
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -28136,10 +28331,10 @@ function parseVercelArgs(tokens) {
|
|
|
28136
28331
|
const token = rest.shift();
|
|
28137
28332
|
switch (token) {
|
|
28138
28333
|
case "--scope":
|
|
28139
|
-
scope =
|
|
28334
|
+
scope = requireValue14(rest, token);
|
|
28140
28335
|
break;
|
|
28141
28336
|
case "--project":
|
|
28142
|
-
project =
|
|
28337
|
+
project = requireValue14(rest, token);
|
|
28143
28338
|
break;
|
|
28144
28339
|
case "--last-week":
|
|
28145
28340
|
lastWeek = true;
|
|
@@ -28170,16 +28365,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
28170
28365
|
const token = rest.shift();
|
|
28171
28366
|
switch (token) {
|
|
28172
28367
|
case "--type":
|
|
28173
|
-
options.dnsType =
|
|
28368
|
+
options.dnsType = requireValue14(rest, token);
|
|
28174
28369
|
break;
|
|
28175
28370
|
case "--value":
|
|
28176
|
-
options.dnsValue =
|
|
28371
|
+
options.dnsValue = requireValue14(rest, token);
|
|
28177
28372
|
break;
|
|
28178
28373
|
case "--rr":
|
|
28179
|
-
options.dnsRr =
|
|
28374
|
+
options.dnsRr = requireValue14(rest, token);
|
|
28180
28375
|
break;
|
|
28181
28376
|
case "--ttl": {
|
|
28182
|
-
const ttlValue =
|
|
28377
|
+
const ttlValue = requireValue14(rest, token);
|
|
28183
28378
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
28184
28379
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
28185
28380
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -28188,7 +28383,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
28188
28383
|
break;
|
|
28189
28384
|
}
|
|
28190
28385
|
case "--domain":
|
|
28191
|
-
options.dnsDomain =
|
|
28386
|
+
options.dnsDomain = requireValue14(rest, token);
|
|
28192
28387
|
break;
|
|
28193
28388
|
default:
|
|
28194
28389
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -28221,13 +28416,13 @@ function parseBucketArgs(tokens) {
|
|
|
28221
28416
|
options.bucketCreate = true;
|
|
28222
28417
|
break;
|
|
28223
28418
|
case "--name":
|
|
28224
|
-
options.bucketName =
|
|
28419
|
+
options.bucketName = requireValue14(rest, token);
|
|
28225
28420
|
break;
|
|
28226
28421
|
case "--subdomain":
|
|
28227
|
-
options.bucketSubdomain =
|
|
28422
|
+
options.bucketSubdomain = requireValue14(rest, token);
|
|
28228
28423
|
break;
|
|
28229
28424
|
case "--domain":
|
|
28230
|
-
options.bucketDomain =
|
|
28425
|
+
options.bucketDomain = requireValue14(rest, token);
|
|
28231
28426
|
break;
|
|
28232
28427
|
default:
|
|
28233
28428
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -28259,7 +28454,7 @@ function parseDevArgs(tokens) {
|
|
|
28259
28454
|
const token = rest.shift();
|
|
28260
28455
|
switch (token) {
|
|
28261
28456
|
case "--cwd":
|
|
28262
|
-
options.devCwd =
|
|
28457
|
+
options.devCwd = requireValue14(rest, token);
|
|
28263
28458
|
break;
|
|
28264
28459
|
default:
|
|
28265
28460
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -28279,7 +28474,7 @@ function parseDeleteArgs(tokens) {
|
|
|
28279
28474
|
const token = rest.shift();
|
|
28280
28475
|
switch (token) {
|
|
28281
28476
|
case "--cwd":
|
|
28282
|
-
deleteCwd =
|
|
28477
|
+
deleteCwd = requireValue14(rest, token);
|
|
28283
28478
|
break;
|
|
28284
28479
|
default:
|
|
28285
28480
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -28313,13 +28508,13 @@ function parseOssArgs(tokens) {
|
|
|
28313
28508
|
const token = rest.shift();
|
|
28314
28509
|
switch (token) {
|
|
28315
28510
|
case "--bucket":
|
|
28316
|
-
bucket =
|
|
28511
|
+
bucket = requireValue14(rest, token);
|
|
28317
28512
|
break;
|
|
28318
28513
|
case "--file":
|
|
28319
|
-
filePath =
|
|
28514
|
+
filePath = requireValue14(rest, token);
|
|
28320
28515
|
break;
|
|
28321
28516
|
case "--key":
|
|
28322
|
-
objectKey =
|
|
28517
|
+
objectKey = requireValue14(rest, token);
|
|
28323
28518
|
break;
|
|
28324
28519
|
default:
|
|
28325
28520
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -28352,7 +28547,7 @@ function parseEnvArgs(tokens) {
|
|
|
28352
28547
|
throw new Error("Only one env action is allowed.");
|
|
28353
28548
|
}
|
|
28354
28549
|
action = "set";
|
|
28355
|
-
key =
|
|
28550
|
+
key = requireValue14(rest, token);
|
|
28356
28551
|
break;
|
|
28357
28552
|
case "--list":
|
|
28358
28553
|
if (action) {
|
|
@@ -28365,17 +28560,17 @@ function parseEnvArgs(tokens) {
|
|
|
28365
28560
|
throw new Error("Only one env action is allowed.");
|
|
28366
28561
|
}
|
|
28367
28562
|
action = "delete";
|
|
28368
|
-
key =
|
|
28563
|
+
key = requireValue14(rest, token);
|
|
28369
28564
|
break;
|
|
28370
28565
|
case "--value":
|
|
28371
|
-
value =
|
|
28566
|
+
value = requireValue14(rest, token);
|
|
28372
28567
|
break;
|
|
28373
28568
|
case "--verbose":
|
|
28374
28569
|
case "-v":
|
|
28375
28570
|
verbose = true;
|
|
28376
28571
|
break;
|
|
28377
28572
|
case "--cwd":
|
|
28378
|
-
cwd =
|
|
28573
|
+
cwd = requireValue14(rest, token);
|
|
28379
28574
|
break;
|
|
28380
28575
|
default:
|
|
28381
28576
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -28433,7 +28628,7 @@ function parseCommitArgs(tokens) {
|
|
|
28433
28628
|
push = true;
|
|
28434
28629
|
break;
|
|
28435
28630
|
case "--cwd":
|
|
28436
|
-
cwd =
|
|
28631
|
+
cwd = requireValue14(rest, token);
|
|
28437
28632
|
break;
|
|
28438
28633
|
default:
|
|
28439
28634
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -28449,10 +28644,10 @@ function parseSummaryArgs(tokens) {
|
|
|
28449
28644
|
const token = rest.shift();
|
|
28450
28645
|
switch (token) {
|
|
28451
28646
|
case "--pr":
|
|
28452
|
-
prRef =
|
|
28647
|
+
prRef = requireValue14(rest, token);
|
|
28453
28648
|
break;
|
|
28454
28649
|
case "--cwd":
|
|
28455
|
-
cwd =
|
|
28650
|
+
cwd = requireValue14(rest, token);
|
|
28456
28651
|
break;
|
|
28457
28652
|
default:
|
|
28458
28653
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -28477,13 +28672,13 @@ function parseQuizArgs(tokens) {
|
|
|
28477
28672
|
const token = rest.shift();
|
|
28478
28673
|
switch (token) {
|
|
28479
28674
|
case "--paper-id":
|
|
28480
|
-
paperId =
|
|
28675
|
+
paperId = requireValue14(rest, token);
|
|
28481
28676
|
break;
|
|
28482
28677
|
case "--base-url":
|
|
28483
|
-
apiBaseUrl =
|
|
28678
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28484
28679
|
break;
|
|
28485
28680
|
case "--link-base":
|
|
28486
|
-
linkBaseUrl =
|
|
28681
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28487
28682
|
break;
|
|
28488
28683
|
default:
|
|
28489
28684
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -28509,16 +28704,16 @@ function parseQuizArgs(tokens) {
|
|
|
28509
28704
|
const token = rest.shift();
|
|
28510
28705
|
switch (token) {
|
|
28511
28706
|
case "--paper-id":
|
|
28512
|
-
paperId =
|
|
28707
|
+
paperId = requireValue14(rest, token);
|
|
28513
28708
|
break;
|
|
28514
28709
|
case "--file":
|
|
28515
|
-
filePath =
|
|
28710
|
+
filePath = requireValue14(rest, token);
|
|
28516
28711
|
break;
|
|
28517
28712
|
case "--base-url":
|
|
28518
|
-
apiBaseUrl =
|
|
28713
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28519
28714
|
break;
|
|
28520
28715
|
case "--link-base":
|
|
28521
|
-
linkBaseUrl =
|
|
28716
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28522
28717
|
break;
|
|
28523
28718
|
default:
|
|
28524
28719
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -28548,16 +28743,16 @@ function parseQuizArgs(tokens) {
|
|
|
28548
28743
|
const token = rest.shift();
|
|
28549
28744
|
switch (token) {
|
|
28550
28745
|
case "--paper-id":
|
|
28551
|
-
paperId =
|
|
28746
|
+
paperId = requireValue14(rest, token);
|
|
28552
28747
|
break;
|
|
28553
28748
|
case "--file":
|
|
28554
|
-
filePath =
|
|
28749
|
+
filePath = requireValue14(rest, token);
|
|
28555
28750
|
break;
|
|
28556
28751
|
case "--base-url":
|
|
28557
|
-
apiBaseUrl =
|
|
28752
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28558
28753
|
break;
|
|
28559
28754
|
case "--link-base":
|
|
28560
|
-
linkBaseUrl =
|
|
28755
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28561
28756
|
break;
|
|
28562
28757
|
default:
|
|
28563
28758
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -28588,19 +28783,19 @@ function parseQuizArgs(tokens) {
|
|
|
28588
28783
|
const token = rest.shift();
|
|
28589
28784
|
switch (token) {
|
|
28590
28785
|
case "--paper-id":
|
|
28591
|
-
paperId =
|
|
28786
|
+
paperId = requireValue14(rest, token);
|
|
28592
28787
|
break;
|
|
28593
28788
|
case "--step-id":
|
|
28594
|
-
stepId =
|
|
28789
|
+
stepId = requireValue14(rest, token);
|
|
28595
28790
|
break;
|
|
28596
28791
|
case "--file":
|
|
28597
|
-
filePath =
|
|
28792
|
+
filePath = requireValue14(rest, token);
|
|
28598
28793
|
break;
|
|
28599
28794
|
case "--base-url":
|
|
28600
|
-
apiBaseUrl =
|
|
28795
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28601
28796
|
break;
|
|
28602
28797
|
case "--link-base":
|
|
28603
|
-
linkBaseUrl =
|
|
28798
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28604
28799
|
break;
|
|
28605
28800
|
default:
|
|
28606
28801
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -28634,16 +28829,16 @@ function parseQuizArgs(tokens) {
|
|
|
28634
28829
|
const token = rest.shift();
|
|
28635
28830
|
switch (token) {
|
|
28636
28831
|
case "--paper-id":
|
|
28637
|
-
paperId =
|
|
28832
|
+
paperId = requireValue14(rest, token);
|
|
28638
28833
|
break;
|
|
28639
28834
|
case "--step-ids":
|
|
28640
|
-
stepIdsRaw =
|
|
28835
|
+
stepIdsRaw = requireValue14(rest, token);
|
|
28641
28836
|
break;
|
|
28642
28837
|
case "--base-url":
|
|
28643
|
-
apiBaseUrl =
|
|
28838
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28644
28839
|
break;
|
|
28645
28840
|
case "--link-base":
|
|
28646
|
-
linkBaseUrl =
|
|
28841
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28647
28842
|
break;
|
|
28648
28843
|
default:
|
|
28649
28844
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -28677,16 +28872,16 @@ function parseQuizArgs(tokens) {
|
|
|
28677
28872
|
const token = rest.shift();
|
|
28678
28873
|
switch (token) {
|
|
28679
28874
|
case "--paper-id":
|
|
28680
|
-
paperId =
|
|
28875
|
+
paperId = requireValue14(rest, token);
|
|
28681
28876
|
break;
|
|
28682
28877
|
case "--step-id":
|
|
28683
|
-
stepId =
|
|
28878
|
+
stepId = requireValue14(rest, token);
|
|
28684
28879
|
break;
|
|
28685
28880
|
case "--base-url":
|
|
28686
|
-
apiBaseUrl =
|
|
28881
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28687
28882
|
break;
|
|
28688
28883
|
case "--link-base":
|
|
28689
|
-
linkBaseUrl =
|
|
28884
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28690
28885
|
break;
|
|
28691
28886
|
default:
|
|
28692
28887
|
throw new Error(`Unknown quiz delete-step option: ${token}`);
|
|
@@ -28715,13 +28910,13 @@ function parseQuizArgs(tokens) {
|
|
|
28715
28910
|
const token = rest.shift();
|
|
28716
28911
|
switch (token) {
|
|
28717
28912
|
case "--paper-id":
|
|
28718
|
-
paperId =
|
|
28913
|
+
paperId = requireValue14(rest, token);
|
|
28719
28914
|
break;
|
|
28720
28915
|
case "--base-url":
|
|
28721
|
-
apiBaseUrl =
|
|
28916
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28722
28917
|
break;
|
|
28723
28918
|
case "--link-base":
|
|
28724
|
-
linkBaseUrl =
|
|
28919
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28725
28920
|
break;
|
|
28726
28921
|
default:
|
|
28727
28922
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -28746,13 +28941,13 @@ function parseQuizArgs(tokens) {
|
|
|
28746
28941
|
const token = rest.shift();
|
|
28747
28942
|
switch (token) {
|
|
28748
28943
|
case "--paper-id":
|
|
28749
|
-
paperId =
|
|
28944
|
+
paperId = requireValue14(rest, token);
|
|
28750
28945
|
break;
|
|
28751
28946
|
case "--base-url":
|
|
28752
|
-
apiBaseUrl =
|
|
28947
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28753
28948
|
break;
|
|
28754
28949
|
case "--link-base":
|
|
28755
|
-
linkBaseUrl =
|
|
28950
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28756
28951
|
break;
|
|
28757
28952
|
default:
|
|
28758
28953
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -28781,22 +28976,22 @@ function parseQuizArgs(tokens) {
|
|
|
28781
28976
|
const token = rest.shift();
|
|
28782
28977
|
switch (token) {
|
|
28783
28978
|
case "--paper-id":
|
|
28784
|
-
paperId =
|
|
28979
|
+
paperId = requireValue14(rest, token);
|
|
28785
28980
|
break;
|
|
28786
28981
|
case "--step-id":
|
|
28787
|
-
stepId =
|
|
28982
|
+
stepId = requireValue14(rest, token);
|
|
28788
28983
|
break;
|
|
28789
28984
|
case "--file":
|
|
28790
|
-
filePath =
|
|
28985
|
+
filePath = requireValue14(rest, token);
|
|
28791
28986
|
break;
|
|
28792
28987
|
case "--new-paper-id":
|
|
28793
|
-
newPaperId =
|
|
28988
|
+
newPaperId = requireValue14(rest, token);
|
|
28794
28989
|
break;
|
|
28795
28990
|
case "--base-url":
|
|
28796
|
-
apiBaseUrl =
|
|
28991
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28797
28992
|
break;
|
|
28798
28993
|
case "--link-base":
|
|
28799
|
-
linkBaseUrl =
|
|
28994
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28800
28995
|
break;
|
|
28801
28996
|
case "--activate":
|
|
28802
28997
|
activate = true;
|
|
@@ -28886,10 +29081,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
28886
29081
|
const token = rest.shift();
|
|
28887
29082
|
switch (token) {
|
|
28888
29083
|
case "--account":
|
|
28889
|
-
account =
|
|
29084
|
+
account = requireValue14(rest, token);
|
|
28890
29085
|
break;
|
|
28891
29086
|
case "--cwd":
|
|
28892
|
-
cwd =
|
|
29087
|
+
cwd = requireValue14(rest, token);
|
|
28893
29088
|
break;
|
|
28894
29089
|
default:
|
|
28895
29090
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28918,35 +29113,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
28918
29113
|
const token = rest.shift();
|
|
28919
29114
|
switch (token) {
|
|
28920
29115
|
case "--account":
|
|
28921
|
-
account =
|
|
29116
|
+
account = requireValue14(rest, token);
|
|
28922
29117
|
break;
|
|
28923
29118
|
case "--repl":
|
|
28924
29119
|
useRepl = true;
|
|
28925
29120
|
break;
|
|
28926
29121
|
case "--title":
|
|
28927
|
-
title =
|
|
29122
|
+
title = requireValue14(rest, token);
|
|
28928
29123
|
break;
|
|
28929
29124
|
case "--desc":
|
|
28930
29125
|
case "--description":
|
|
28931
|
-
description = decodeEscapedNewlines(
|
|
29126
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
28932
29127
|
break;
|
|
28933
29128
|
case "--team-id":
|
|
28934
|
-
teamId =
|
|
29129
|
+
teamId = requireValue14(rest, token);
|
|
28935
29130
|
break;
|
|
28936
29131
|
case "--team-key":
|
|
28937
|
-
teamKey =
|
|
29132
|
+
teamKey = requireValue14(rest, token);
|
|
28938
29133
|
break;
|
|
28939
29134
|
case "--priority":
|
|
28940
|
-
priority = parseLinearPriority(
|
|
29135
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
28941
29136
|
break;
|
|
28942
29137
|
case "--parent-id":
|
|
28943
|
-
parentId =
|
|
29138
|
+
parentId = requireValue14(rest, token);
|
|
28944
29139
|
break;
|
|
28945
29140
|
case "--state-id":
|
|
28946
|
-
stateId =
|
|
29141
|
+
stateId = requireValue14(rest, token);
|
|
28947
29142
|
break;
|
|
28948
29143
|
case "--cwd":
|
|
28949
|
-
cwd =
|
|
29144
|
+
cwd = requireValue14(rest, token);
|
|
28950
29145
|
break;
|
|
28951
29146
|
default:
|
|
28952
29147
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28981,10 +29176,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
28981
29176
|
const token = rest.shift();
|
|
28982
29177
|
switch (token) {
|
|
28983
29178
|
case "--account":
|
|
28984
|
-
account =
|
|
29179
|
+
account = requireValue14(rest, token);
|
|
28985
29180
|
break;
|
|
28986
29181
|
case "--cwd":
|
|
28987
|
-
cwd =
|
|
29182
|
+
cwd = requireValue14(rest, token);
|
|
28988
29183
|
break;
|
|
28989
29184
|
default:
|
|
28990
29185
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29009,10 +29204,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
29009
29204
|
const token = rest.shift();
|
|
29010
29205
|
switch (token) {
|
|
29011
29206
|
case "--account":
|
|
29012
|
-
account =
|
|
29207
|
+
account = requireValue14(rest, token);
|
|
29013
29208
|
break;
|
|
29014
29209
|
case "--cwd":
|
|
29015
|
-
cwd =
|
|
29210
|
+
cwd = requireValue14(rest, token);
|
|
29016
29211
|
break;
|
|
29017
29212
|
default:
|
|
29018
29213
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29047,32 +29242,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
29047
29242
|
const token = rest.shift();
|
|
29048
29243
|
switch (token) {
|
|
29049
29244
|
case "--account":
|
|
29050
|
-
account =
|
|
29245
|
+
account = requireValue14(rest, token);
|
|
29051
29246
|
break;
|
|
29052
29247
|
case "--title":
|
|
29053
|
-
title =
|
|
29248
|
+
title = requireValue14(rest, token);
|
|
29054
29249
|
break;
|
|
29055
29250
|
case "--desc":
|
|
29056
29251
|
case "--description":
|
|
29057
|
-
description = decodeEscapedNewlines(
|
|
29252
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29058
29253
|
break;
|
|
29059
29254
|
case "--team-id":
|
|
29060
|
-
teamId =
|
|
29255
|
+
teamId = requireValue14(rest, token);
|
|
29061
29256
|
break;
|
|
29062
29257
|
case "--team-key":
|
|
29063
|
-
teamKey =
|
|
29258
|
+
teamKey = requireValue14(rest, token);
|
|
29064
29259
|
break;
|
|
29065
29260
|
case "--priority":
|
|
29066
|
-
priority = parseLinearPriority(
|
|
29261
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
29067
29262
|
break;
|
|
29068
29263
|
case "--parent-id":
|
|
29069
|
-
parentId =
|
|
29264
|
+
parentId = requireValue14(rest, token);
|
|
29070
29265
|
break;
|
|
29071
29266
|
case "--state-id":
|
|
29072
|
-
stateId =
|
|
29267
|
+
stateId = requireValue14(rest, token);
|
|
29073
29268
|
break;
|
|
29074
29269
|
case "--cwd":
|
|
29075
|
-
cwd =
|
|
29270
|
+
cwd = requireValue14(rest, token);
|
|
29076
29271
|
break;
|
|
29077
29272
|
default:
|
|
29078
29273
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29110,10 +29305,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
29110
29305
|
const token = rest.shift();
|
|
29111
29306
|
switch (token) {
|
|
29112
29307
|
case "--account":
|
|
29113
|
-
account =
|
|
29308
|
+
account = requireValue14(rest, token);
|
|
29114
29309
|
break;
|
|
29115
29310
|
case "--cwd":
|
|
29116
|
-
cwd =
|
|
29311
|
+
cwd = requireValue14(rest, token);
|
|
29117
29312
|
break;
|
|
29118
29313
|
default:
|
|
29119
29314
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29140,15 +29335,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
29140
29335
|
const token = rest.shift();
|
|
29141
29336
|
switch (token) {
|
|
29142
29337
|
case "--account":
|
|
29143
|
-
account =
|
|
29338
|
+
account = requireValue14(rest, token);
|
|
29144
29339
|
break;
|
|
29145
29340
|
case "--body":
|
|
29146
29341
|
case "--desc":
|
|
29147
29342
|
case "--description":
|
|
29148
|
-
body = decodeEscapedNewlines(
|
|
29343
|
+
body = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29149
29344
|
break;
|
|
29150
29345
|
case "--cwd":
|
|
29151
|
-
cwd =
|
|
29346
|
+
cwd = requireValue14(rest, token);
|
|
29152
29347
|
break;
|
|
29153
29348
|
default:
|
|
29154
29349
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29178,10 +29373,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
29178
29373
|
const token = rest.shift();
|
|
29179
29374
|
switch (token) {
|
|
29180
29375
|
case "--account":
|
|
29181
|
-
account =
|
|
29376
|
+
account = requireValue14(rest, token);
|
|
29182
29377
|
break;
|
|
29183
29378
|
case "--cwd":
|
|
29184
|
-
cwd =
|
|
29379
|
+
cwd = requireValue14(rest, token);
|
|
29185
29380
|
break;
|
|
29186
29381
|
default:
|
|
29187
29382
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29205,16 +29400,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
29205
29400
|
const token = rest.shift();
|
|
29206
29401
|
switch (token) {
|
|
29207
29402
|
case "--account":
|
|
29208
|
-
account =
|
|
29403
|
+
account = requireValue14(rest, token);
|
|
29209
29404
|
break;
|
|
29210
29405
|
case "--team-id":
|
|
29211
|
-
teamId =
|
|
29406
|
+
teamId = requireValue14(rest, token);
|
|
29212
29407
|
break;
|
|
29213
29408
|
case "--team-key":
|
|
29214
|
-
teamKey =
|
|
29409
|
+
teamKey = requireValue14(rest, token);
|
|
29215
29410
|
break;
|
|
29216
29411
|
case "--cwd":
|
|
29217
|
-
cwd =
|
|
29412
|
+
cwd = requireValue14(rest, token);
|
|
29218
29413
|
break;
|
|
29219
29414
|
default:
|
|
29220
29415
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29237,10 +29432,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
29237
29432
|
const token = rest.shift();
|
|
29238
29433
|
switch (token) {
|
|
29239
29434
|
case "--account":
|
|
29240
|
-
account =
|
|
29435
|
+
account = requireValue14(rest, token);
|
|
29241
29436
|
break;
|
|
29242
29437
|
case "--cwd":
|
|
29243
|
-
cwd =
|
|
29438
|
+
cwd = requireValue14(rest, token);
|
|
29244
29439
|
break;
|
|
29245
29440
|
default:
|
|
29246
29441
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29267,16 +29462,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
29267
29462
|
const token = rest.shift();
|
|
29268
29463
|
switch (token) {
|
|
29269
29464
|
case "--account":
|
|
29270
|
-
account =
|
|
29465
|
+
account = requireValue14(rest, token);
|
|
29271
29466
|
break;
|
|
29272
29467
|
case "--cycle":
|
|
29273
|
-
cycle = parseLinearCycle(
|
|
29468
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29274
29469
|
break;
|
|
29275
29470
|
case "--status":
|
|
29276
|
-
status = parseLinearStatus(
|
|
29471
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29277
29472
|
break;
|
|
29278
29473
|
case "--cwd":
|
|
29279
|
-
cwd =
|
|
29474
|
+
cwd = requireValue14(rest, token);
|
|
29280
29475
|
break;
|
|
29281
29476
|
default:
|
|
29282
29477
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29310,28 +29505,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29310
29505
|
const token = rest.shift();
|
|
29311
29506
|
switch (token) {
|
|
29312
29507
|
case "--account":
|
|
29313
|
-
account =
|
|
29508
|
+
account = requireValue14(rest, token);
|
|
29314
29509
|
break;
|
|
29315
29510
|
case "--team-id":
|
|
29316
|
-
teamId =
|
|
29511
|
+
teamId = requireValue14(rest, token);
|
|
29317
29512
|
break;
|
|
29318
29513
|
case "--team-key":
|
|
29319
|
-
teamKey =
|
|
29514
|
+
teamKey = requireValue14(rest, token);
|
|
29320
29515
|
break;
|
|
29321
29516
|
case "--user":
|
|
29322
|
-
user =
|
|
29517
|
+
user = requireValue14(rest, token);
|
|
29323
29518
|
break;
|
|
29324
29519
|
case "--cycle":
|
|
29325
|
-
cycle = parseLinearCycle(
|
|
29520
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29326
29521
|
break;
|
|
29327
29522
|
case "--status":
|
|
29328
|
-
status = parseLinearStatus(
|
|
29523
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29329
29524
|
break;
|
|
29330
29525
|
case "--query":
|
|
29331
|
-
query =
|
|
29526
|
+
query = requireValue14(rest, token).trim();
|
|
29332
29527
|
break;
|
|
29333
29528
|
case "--limit": {
|
|
29334
|
-
const value = Number.parseInt(
|
|
29529
|
+
const value = Number.parseInt(requireValue14(rest, token), 10);
|
|
29335
29530
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
29336
29531
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
29337
29532
|
}
|
|
@@ -29339,7 +29534,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29339
29534
|
break;
|
|
29340
29535
|
}
|
|
29341
29536
|
case "--cwd":
|
|
29342
|
-
cwd =
|
|
29537
|
+
cwd = requireValue14(rest, token);
|
|
29343
29538
|
break;
|
|
29344
29539
|
default:
|
|
29345
29540
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29380,10 +29575,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
29380
29575
|
useScreenshot = true;
|
|
29381
29576
|
break;
|
|
29382
29577
|
case "--account":
|
|
29383
|
-
account =
|
|
29578
|
+
account = requireValue14(rest, token);
|
|
29384
29579
|
break;
|
|
29385
29580
|
case "--cwd":
|
|
29386
|
-
cwd =
|
|
29581
|
+
cwd = requireValue14(rest, token);
|
|
29387
29582
|
break;
|
|
29388
29583
|
default:
|
|
29389
29584
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29477,19 +29672,19 @@ function parseNotionArgs(tokens) {
|
|
|
29477
29672
|
const token = rest.shift();
|
|
29478
29673
|
switch (token) {
|
|
29479
29674
|
case "--parent":
|
|
29480
|
-
parentPageId =
|
|
29675
|
+
parentPageId = requireValue14(rest, token);
|
|
29481
29676
|
break;
|
|
29482
29677
|
case "--title":
|
|
29483
|
-
title =
|
|
29678
|
+
title = requireValue14(rest, token);
|
|
29484
29679
|
break;
|
|
29485
29680
|
case "--private":
|
|
29486
29681
|
isPrivate = true;
|
|
29487
29682
|
break;
|
|
29488
29683
|
case "--content":
|
|
29489
|
-
content2 =
|
|
29684
|
+
content2 = requireValue14(rest, token);
|
|
29490
29685
|
break;
|
|
29491
29686
|
case "--file":
|
|
29492
|
-
filePath2 =
|
|
29687
|
+
filePath2 = requireValue14(rest, token);
|
|
29493
29688
|
break;
|
|
29494
29689
|
default:
|
|
29495
29690
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -29533,10 +29728,10 @@ function parseNotionArgs(tokens) {
|
|
|
29533
29728
|
const token = rest.shift();
|
|
29534
29729
|
switch (token) {
|
|
29535
29730
|
case "--content":
|
|
29536
|
-
content =
|
|
29731
|
+
content = requireValue14(rest, token);
|
|
29537
29732
|
break;
|
|
29538
29733
|
case "--file":
|
|
29539
|
-
filePath =
|
|
29734
|
+
filePath = requireValue14(rest, token);
|
|
29540
29735
|
break;
|
|
29541
29736
|
case "--append":
|
|
29542
29737
|
append = true;
|
|
@@ -29581,11 +29776,11 @@ function parseRandomArgs(tokens) {
|
|
|
29581
29776
|
mode = "easy";
|
|
29582
29777
|
break;
|
|
29583
29778
|
case "--length":
|
|
29584
|
-
length = parsePositiveInt3(
|
|
29779
|
+
length = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29585
29780
|
seenLength = true;
|
|
29586
29781
|
break;
|
|
29587
29782
|
case "--charset": {
|
|
29588
|
-
const value =
|
|
29783
|
+
const value = requireValue14(rest, token);
|
|
29589
29784
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
29590
29785
|
throw new Error(
|
|
29591
29786
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -29596,18 +29791,18 @@ function parseRandomArgs(tokens) {
|
|
|
29596
29791
|
break;
|
|
29597
29792
|
}
|
|
29598
29793
|
case "--count":
|
|
29599
|
-
count = parsePositiveInt3(
|
|
29794
|
+
count = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29600
29795
|
break;
|
|
29601
29796
|
case "--words":
|
|
29602
|
-
words = parsePositiveInt3(
|
|
29797
|
+
words = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29603
29798
|
seenWords = true;
|
|
29604
29799
|
break;
|
|
29605
29800
|
case "--digits":
|
|
29606
|
-
digits = parseNonNegativeInt(
|
|
29801
|
+
digits = parseNonNegativeInt(requireValue14(rest, token), token);
|
|
29607
29802
|
seenDigits = true;
|
|
29608
29803
|
break;
|
|
29609
29804
|
case "--separator":
|
|
29610
|
-
separator =
|
|
29805
|
+
separator = requireValue14(rest, token);
|
|
29611
29806
|
seenSeparator = true;
|
|
29612
29807
|
break;
|
|
29613
29808
|
default:
|
|
@@ -29638,7 +29833,7 @@ function parseRandomArgs(tokens) {
|
|
|
29638
29833
|
count
|
|
29639
29834
|
};
|
|
29640
29835
|
}
|
|
29641
|
-
function
|
|
29836
|
+
function requireValue14(tokens, optionName) {
|
|
29642
29837
|
const value = tokens.shift();
|
|
29643
29838
|
if (!value) {
|
|
29644
29839
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -29819,6 +30014,11 @@ async function main() {
|
|
|
29819
30014
|
await handler.handle(commandArgs);
|
|
29820
30015
|
return;
|
|
29821
30016
|
}
|
|
30017
|
+
case "host" /* Host */: {
|
|
30018
|
+
const handler = new HostCommandHandler();
|
|
30019
|
+
await handler.handle(commandArgs);
|
|
30020
|
+
return;
|
|
30021
|
+
}
|
|
29822
30022
|
case "vercel" /* Vercel */: {
|
|
29823
30023
|
const handler = new VercelCommandHandler();
|
|
29824
30024
|
await handler.handle(commandArgs);
|