@pmate/cli 0.28.1 → 0.28.2
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 +321 -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,91 @@ 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 = applyHostEnv(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
|
+
function applyHostEnv(values, home = (0, import_node_os11.homedir)()) {
|
|
24429
|
+
const hostDir = import_node_path30.default.join(home, ".pmate", "host");
|
|
24430
|
+
const envFile = import_node_path30.default.join(hostDir, "host.env");
|
|
24431
|
+
const tempFile = import_node_path30.default.join(hostDir, `.host.env.${process.pid}.tmp`);
|
|
24432
|
+
const profileFile = import_node_path30.default.join(home, ".profile");
|
|
24433
|
+
(0, import_node_fs25.mkdirSync)(hostDir, { recursive: true });
|
|
24434
|
+
const content = Object.entries(values).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${normalizeEnvKey(key)}=${shellQuote3(value)}`).join("\n") + "\n";
|
|
24435
|
+
(0, import_node_fs25.writeFileSync)(tempFile, content, { mode: 384 });
|
|
24436
|
+
(0, import_node_fs25.chmodSync)(tempFile, 384);
|
|
24437
|
+
(0, import_node_fs25.renameSync)(tempFile, envFile);
|
|
24438
|
+
(0, import_node_fs25.chmodSync)(envFile, 384);
|
|
24439
|
+
const existing = (0, import_node_fs25.existsSync)(profileFile) ? (0, import_node_fs25.readFileSync)(profileFile, "utf8") : "";
|
|
24440
|
+
const blockPattern = new RegExp(`${escapeRegExp(BLOCK_START)}[\\s\\S]*?${escapeRegExp(BLOCK_END)}\\n?`, "g");
|
|
24441
|
+
const withoutBlock = existing.replace(blockPattern, "").trimEnd();
|
|
24442
|
+
const profileContent = `${withoutBlock}${withoutBlock ? "\n\n" : ""}${PROFILE_BLOCK}
|
|
24443
|
+
`;
|
|
24444
|
+
const profileTemp = `${profileFile}.${process.pid}.tmp`;
|
|
24445
|
+
(0, import_node_fs25.writeFileSync)(profileTemp, profileContent);
|
|
24446
|
+
(0, import_node_fs25.renameSync)(profileTemp, profileFile);
|
|
24447
|
+
const check = (0, import_node_child_process13.spawnSync)("bash", ["-lc", `. ${shellQuote3(profileFile)}`], { cwd: home, env: { ...process.env, HOME: home }, encoding: "utf8" });
|
|
24448
|
+
if (check.status !== 0) throw new Error(`Host env refresh validation failed: ${check.stderr.trim()}`);
|
|
24449
|
+
return { envFile, profileFile, refreshed: true };
|
|
24450
|
+
}
|
|
24451
|
+
function normalizeHostId(value) {
|
|
24452
|
+
const normalized = value.trim();
|
|
24453
|
+
if (!/^[A-Za-z0-9._-]+$/.test(normalized)) throw new Error("Invalid host id");
|
|
24454
|
+
return normalized;
|
|
24455
|
+
}
|
|
24456
|
+
function normalizeEnvKey(value) {
|
|
24457
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) throw new Error(`Invalid env key: ${value}`);
|
|
24458
|
+
return value;
|
|
24459
|
+
}
|
|
24460
|
+
function shellQuote3(value) {
|
|
24461
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
24462
|
+
}
|
|
24463
|
+
function escapeRegExp(value) {
|
|
24464
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24465
|
+
}
|
|
24466
|
+
function requireArg(value, name) {
|
|
24467
|
+
if (value === void 0) throw new Error(`Missing ${name}`);
|
|
24468
|
+
return value;
|
|
24469
|
+
}
|
|
24470
|
+
|
|
24359
24471
|
// src/agentCommandParser.ts
|
|
24360
24472
|
init_namespacedRef();
|
|
24361
24473
|
var DEFAULT_AGENT_NAMESPACE = "pmate";
|
|
@@ -27342,6 +27454,47 @@ function requireValue9(tokens, optionName) {
|
|
|
27342
27454
|
return value;
|
|
27343
27455
|
}
|
|
27344
27456
|
|
|
27457
|
+
// src/hostCommandParser.ts
|
|
27458
|
+
function parseHostArgs(tokens) {
|
|
27459
|
+
const rest = [...tokens];
|
|
27460
|
+
const first = rest.shift();
|
|
27461
|
+
let action;
|
|
27462
|
+
let key;
|
|
27463
|
+
let value;
|
|
27464
|
+
if (first === "apply") action = "apply";
|
|
27465
|
+
else if (first === "env") {
|
|
27466
|
+
const envAction = rest.shift();
|
|
27467
|
+
if (envAction === "list") action = "env-list";
|
|
27468
|
+
else if (envAction === "set") {
|
|
27469
|
+
action = "env-set";
|
|
27470
|
+
key = requireValue10(rest, "key");
|
|
27471
|
+
value = requireValue10(rest, "value");
|
|
27472
|
+
} else if (envAction === "unset") {
|
|
27473
|
+
action = "env-unset";
|
|
27474
|
+
key = requireValue10(rest, "key");
|
|
27475
|
+
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
27476
|
+
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
27477
|
+
let host;
|
|
27478
|
+
let secret = false;
|
|
27479
|
+
let baseUrl;
|
|
27480
|
+
let json = false;
|
|
27481
|
+
while (rest.length > 0) {
|
|
27482
|
+
const token = rest.shift();
|
|
27483
|
+
if (token === "--host") host = requireValue10(rest, token);
|
|
27484
|
+
else if (token === "--secret") secret = true;
|
|
27485
|
+
else if (token === "--base-url") baseUrl = requireValue10(rest, token);
|
|
27486
|
+
else if (token === "--json") json = true;
|
|
27487
|
+
else throw new Error(`Unknown host option: ${token}`);
|
|
27488
|
+
}
|
|
27489
|
+
if (secret && action !== "env-set") throw new Error("--secret is only valid for host env set");
|
|
27490
|
+
return { type: "host" /* Host */, action, host, key, value, secret, baseUrl, json };
|
|
27491
|
+
}
|
|
27492
|
+
function requireValue10(tokens, label) {
|
|
27493
|
+
const value = tokens.shift();
|
|
27494
|
+
if (!value || value.startsWith("--")) throw new Error(`Missing value for ${label}`);
|
|
27495
|
+
return value;
|
|
27496
|
+
}
|
|
27497
|
+
|
|
27345
27498
|
// src/collectCommandParser.ts
|
|
27346
27499
|
function parseCollectArgs(tokens) {
|
|
27347
27500
|
const rest = [...tokens];
|
|
@@ -27361,7 +27514,7 @@ function parseCollectArgs(tokens) {
|
|
|
27361
27514
|
const token = rest.shift();
|
|
27362
27515
|
switch (token) {
|
|
27363
27516
|
case "--source": {
|
|
27364
|
-
const value =
|
|
27517
|
+
const value = requireValue11(rest, token);
|
|
27365
27518
|
if (value !== "cc" && value !== "yelling") {
|
|
27366
27519
|
throw new Error(`Unsupported collect source: ${value}`);
|
|
27367
27520
|
}
|
|
@@ -27369,11 +27522,11 @@ function parseCollectArgs(tokens) {
|
|
|
27369
27522
|
break;
|
|
27370
27523
|
}
|
|
27371
27524
|
case "--endpoint":
|
|
27372
|
-
options.endpoint =
|
|
27525
|
+
options.endpoint = requireValue11(rest, token);
|
|
27373
27526
|
break;
|
|
27374
27527
|
case "--thread":
|
|
27375
27528
|
case "--channel":
|
|
27376
|
-
options.thread =
|
|
27529
|
+
options.thread = requireValue11(rest, token);
|
|
27377
27530
|
break;
|
|
27378
27531
|
default:
|
|
27379
27532
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -27389,7 +27542,7 @@ function parseCollectArgs(tokens) {
|
|
|
27389
27542
|
}
|
|
27390
27543
|
return { type: "collect" /* Collect */, ...options };
|
|
27391
27544
|
}
|
|
27392
|
-
function
|
|
27545
|
+
function requireValue11(tokens, optionName) {
|
|
27393
27546
|
const value = tokens.shift();
|
|
27394
27547
|
if (!value) {
|
|
27395
27548
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -27447,13 +27600,13 @@ function parseIm1ThreadsArgs(tokens) {
|
|
|
27447
27600
|
switch (token) {
|
|
27448
27601
|
case "--q":
|
|
27449
27602
|
case "--query":
|
|
27450
|
-
query =
|
|
27603
|
+
query = requireValue12(rest, token);
|
|
27451
27604
|
break;
|
|
27452
27605
|
case "--search":
|
|
27453
|
-
search =
|
|
27606
|
+
search = requireValue12(rest, token);
|
|
27454
27607
|
break;
|
|
27455
27608
|
case "--limit":
|
|
27456
|
-
limit = parsePositiveInt2(
|
|
27609
|
+
limit = parsePositiveInt2(requireValue12(rest, token), token);
|
|
27457
27610
|
break;
|
|
27458
27611
|
case "--json":
|
|
27459
27612
|
json = true;
|
|
@@ -27477,10 +27630,10 @@ function parseIm1MessagesArgs(tokens) {
|
|
|
27477
27630
|
switch (token) {
|
|
27478
27631
|
case "--thread":
|
|
27479
27632
|
case "--channel":
|
|
27480
|
-
thread =
|
|
27633
|
+
thread = requireValue12(rest, token);
|
|
27481
27634
|
break;
|
|
27482
27635
|
case "--limit":
|
|
27483
|
-
limit = parsePositiveInt2(
|
|
27636
|
+
limit = parsePositiveInt2(requireValue12(rest, token), token);
|
|
27484
27637
|
break;
|
|
27485
27638
|
case "--json":
|
|
27486
27639
|
json = true;
|
|
@@ -27507,14 +27660,14 @@ function parseIm1ReplyArgs(tokens) {
|
|
|
27507
27660
|
const token = rest.shift();
|
|
27508
27661
|
switch (token) {
|
|
27509
27662
|
case "--thread":
|
|
27510
|
-
thread =
|
|
27663
|
+
thread = requireValue12(rest, token);
|
|
27511
27664
|
break;
|
|
27512
27665
|
case "--text":
|
|
27513
|
-
text =
|
|
27666
|
+
text = requireValue12(rest, token);
|
|
27514
27667
|
break;
|
|
27515
27668
|
case "--file":
|
|
27516
27669
|
case "--image":
|
|
27517
|
-
file =
|
|
27670
|
+
file = requireValue12(rest, token);
|
|
27518
27671
|
break;
|
|
27519
27672
|
case "--dryrun":
|
|
27520
27673
|
case "--dry-run":
|
|
@@ -27547,13 +27700,13 @@ function parseIm1ReactArgs(tokens) {
|
|
|
27547
27700
|
const token = rest.shift();
|
|
27548
27701
|
switch (token) {
|
|
27549
27702
|
case "--thread":
|
|
27550
|
-
thread =
|
|
27703
|
+
thread = requireValue12(rest, token);
|
|
27551
27704
|
break;
|
|
27552
27705
|
case "--emoji":
|
|
27553
|
-
emoji =
|
|
27706
|
+
emoji = requireValue12(rest, token);
|
|
27554
27707
|
break;
|
|
27555
27708
|
case "--message":
|
|
27556
|
-
message =
|
|
27709
|
+
message = requireValue12(rest, token);
|
|
27557
27710
|
break;
|
|
27558
27711
|
case "--remove":
|
|
27559
27712
|
remove = true;
|
|
@@ -27571,7 +27724,7 @@ function parseIm1ReactArgs(tokens) {
|
|
|
27571
27724
|
}
|
|
27572
27725
|
return { type: "collect" /* Collect */, action: "react", thread, emoji, message, remove, dryRun };
|
|
27573
27726
|
}
|
|
27574
|
-
function
|
|
27727
|
+
function requireValue12(tokens, optionName) {
|
|
27575
27728
|
const value = tokens.shift();
|
|
27576
27729
|
if (!value || value.startsWith("--")) {
|
|
27577
27730
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -27685,12 +27838,12 @@ function parseShared(tokens) {
|
|
|
27685
27838
|
case "--title":
|
|
27686
27839
|
case "--bot-a":
|
|
27687
27840
|
case "--bot-b":
|
|
27688
|
-
options.set(token,
|
|
27841
|
+
options.set(token, requireValue13(tokens, token));
|
|
27689
27842
|
break;
|
|
27690
27843
|
case "--member":
|
|
27691
27844
|
case "--recipient": {
|
|
27692
27845
|
const values = multiOptions.get(token) ?? [];
|
|
27693
|
-
values.push(
|
|
27846
|
+
values.push(requireValue13(tokens, token));
|
|
27694
27847
|
multiOptions.set(token, values);
|
|
27695
27848
|
break;
|
|
27696
27849
|
}
|
|
@@ -27716,7 +27869,7 @@ function requiredOption(options, option) {
|
|
|
27716
27869
|
}
|
|
27717
27870
|
return value;
|
|
27718
27871
|
}
|
|
27719
|
-
function
|
|
27872
|
+
function requireValue13(tokens, option) {
|
|
27720
27873
|
const value = tokens.shift();
|
|
27721
27874
|
if (!value || value.startsWith("--")) {
|
|
27722
27875
|
throw new Error(`Missing value for ${option}`);
|
|
@@ -27726,7 +27879,7 @@ function requireValue12(tokens, option) {
|
|
|
27726
27879
|
|
|
27727
27880
|
// src/index.ts
|
|
27728
27881
|
var pkg = JSON.parse(
|
|
27729
|
-
(0,
|
|
27882
|
+
(0, import_node_fs26.readFileSync)(import_node_path31.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
27730
27883
|
);
|
|
27731
27884
|
var HELP_TEXT = [
|
|
27732
27885
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -27920,6 +28073,11 @@ var HELP_TEXT = [
|
|
|
27920
28073
|
` ${import_chalk4.default.gray(" ssl refresh <ns:objectId> [--cert <key>] [--dry-run] [--base-url <url>] [--json]")}`,
|
|
27921
28074
|
` ${import_chalk4.default.gray(" log <ns:objectId> [--page <n>] [--history] [--search <keyword>] [--follow|-f] [--base-url <url>]")}`,
|
|
27922
28075
|
` ${import_chalk4.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
28076
|
+
` ${import_chalk4.default.cyan("host")} Manage host-level environment variables`,
|
|
28077
|
+
` ${import_chalk4.default.gray(" env list [--host <id>] [--json]")}`,
|
|
28078
|
+
` ${import_chalk4.default.gray(" env set <key> <value> [--host <id>] [--secret]")}`,
|
|
28079
|
+
` ${import_chalk4.default.gray(" env unset <key> [--host <id>]")}`,
|
|
28080
|
+
` ${import_chalk4.default.gray(" apply [--host <id>] [--json]")}`,
|
|
27923
28081
|
` ${import_chalk4.default.cyan("vercel")} Wrap common Vercel CLI inspection commands`,
|
|
27924
28082
|
` ${import_chalk4.default.gray(" projects [--scope <scope>]")}`,
|
|
27925
28083
|
` ${import_chalk4.default.gray(" deploys --project <name> [--last-week] [--scope <scope>]")}`
|
|
@@ -27985,10 +28143,10 @@ function parseCommandArgs(args) {
|
|
|
27985
28143
|
const token = rest.shift();
|
|
27986
28144
|
switch (token) {
|
|
27987
28145
|
case "--app":
|
|
27988
|
-
app =
|
|
28146
|
+
app = requireValue14(rest, token);
|
|
27989
28147
|
break;
|
|
27990
28148
|
case "--profile-id":
|
|
27991
|
-
profileId =
|
|
28149
|
+
profileId = requireValue14(rest, token);
|
|
27992
28150
|
break;
|
|
27993
28151
|
case "--access-key":
|
|
27994
28152
|
if (rest[0] && !rest[0].startsWith("--")) {
|
|
@@ -27998,7 +28156,7 @@ function parseCommandArgs(args) {
|
|
|
27998
28156
|
}
|
|
27999
28157
|
break;
|
|
28000
28158
|
case "--access-key-file":
|
|
28001
|
-
accessKeyFile =
|
|
28159
|
+
accessKeyFile = requireValue14(rest, token);
|
|
28002
28160
|
break;
|
|
28003
28161
|
case "--select-profile":
|
|
28004
28162
|
selectProfile = true;
|
|
@@ -28099,6 +28257,9 @@ function parseCommandArgs(args) {
|
|
|
28099
28257
|
if (args.rest[0] === "service") {
|
|
28100
28258
|
return parseServiceArgs(args.rest.slice(1));
|
|
28101
28259
|
}
|
|
28260
|
+
if (args.rest[0] === "host") {
|
|
28261
|
+
return parseHostArgs(args.rest.slice(1));
|
|
28262
|
+
}
|
|
28102
28263
|
if (args.rest[0] === "vercel") {
|
|
28103
28264
|
return parseVercelArgs(args.rest.slice(1));
|
|
28104
28265
|
}
|
|
@@ -28116,7 +28277,7 @@ function parseVercelArgs(tokens) {
|
|
|
28116
28277
|
const token = rest.shift();
|
|
28117
28278
|
switch (token) {
|
|
28118
28279
|
case "--scope":
|
|
28119
|
-
scope =
|
|
28280
|
+
scope = requireValue14(rest, token);
|
|
28120
28281
|
break;
|
|
28121
28282
|
default:
|
|
28122
28283
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -28136,10 +28297,10 @@ function parseVercelArgs(tokens) {
|
|
|
28136
28297
|
const token = rest.shift();
|
|
28137
28298
|
switch (token) {
|
|
28138
28299
|
case "--scope":
|
|
28139
|
-
scope =
|
|
28300
|
+
scope = requireValue14(rest, token);
|
|
28140
28301
|
break;
|
|
28141
28302
|
case "--project":
|
|
28142
|
-
project =
|
|
28303
|
+
project = requireValue14(rest, token);
|
|
28143
28304
|
break;
|
|
28144
28305
|
case "--last-week":
|
|
28145
28306
|
lastWeek = true;
|
|
@@ -28170,16 +28331,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
28170
28331
|
const token = rest.shift();
|
|
28171
28332
|
switch (token) {
|
|
28172
28333
|
case "--type":
|
|
28173
|
-
options.dnsType =
|
|
28334
|
+
options.dnsType = requireValue14(rest, token);
|
|
28174
28335
|
break;
|
|
28175
28336
|
case "--value":
|
|
28176
|
-
options.dnsValue =
|
|
28337
|
+
options.dnsValue = requireValue14(rest, token);
|
|
28177
28338
|
break;
|
|
28178
28339
|
case "--rr":
|
|
28179
|
-
options.dnsRr =
|
|
28340
|
+
options.dnsRr = requireValue14(rest, token);
|
|
28180
28341
|
break;
|
|
28181
28342
|
case "--ttl": {
|
|
28182
|
-
const ttlValue =
|
|
28343
|
+
const ttlValue = requireValue14(rest, token);
|
|
28183
28344
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
28184
28345
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
28185
28346
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -28188,7 +28349,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
28188
28349
|
break;
|
|
28189
28350
|
}
|
|
28190
28351
|
case "--domain":
|
|
28191
|
-
options.dnsDomain =
|
|
28352
|
+
options.dnsDomain = requireValue14(rest, token);
|
|
28192
28353
|
break;
|
|
28193
28354
|
default:
|
|
28194
28355
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -28221,13 +28382,13 @@ function parseBucketArgs(tokens) {
|
|
|
28221
28382
|
options.bucketCreate = true;
|
|
28222
28383
|
break;
|
|
28223
28384
|
case "--name":
|
|
28224
|
-
options.bucketName =
|
|
28385
|
+
options.bucketName = requireValue14(rest, token);
|
|
28225
28386
|
break;
|
|
28226
28387
|
case "--subdomain":
|
|
28227
|
-
options.bucketSubdomain =
|
|
28388
|
+
options.bucketSubdomain = requireValue14(rest, token);
|
|
28228
28389
|
break;
|
|
28229
28390
|
case "--domain":
|
|
28230
|
-
options.bucketDomain =
|
|
28391
|
+
options.bucketDomain = requireValue14(rest, token);
|
|
28231
28392
|
break;
|
|
28232
28393
|
default:
|
|
28233
28394
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -28259,7 +28420,7 @@ function parseDevArgs(tokens) {
|
|
|
28259
28420
|
const token = rest.shift();
|
|
28260
28421
|
switch (token) {
|
|
28261
28422
|
case "--cwd":
|
|
28262
|
-
options.devCwd =
|
|
28423
|
+
options.devCwd = requireValue14(rest, token);
|
|
28263
28424
|
break;
|
|
28264
28425
|
default:
|
|
28265
28426
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -28279,7 +28440,7 @@ function parseDeleteArgs(tokens) {
|
|
|
28279
28440
|
const token = rest.shift();
|
|
28280
28441
|
switch (token) {
|
|
28281
28442
|
case "--cwd":
|
|
28282
|
-
deleteCwd =
|
|
28443
|
+
deleteCwd = requireValue14(rest, token);
|
|
28283
28444
|
break;
|
|
28284
28445
|
default:
|
|
28285
28446
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -28313,13 +28474,13 @@ function parseOssArgs(tokens) {
|
|
|
28313
28474
|
const token = rest.shift();
|
|
28314
28475
|
switch (token) {
|
|
28315
28476
|
case "--bucket":
|
|
28316
|
-
bucket =
|
|
28477
|
+
bucket = requireValue14(rest, token);
|
|
28317
28478
|
break;
|
|
28318
28479
|
case "--file":
|
|
28319
|
-
filePath =
|
|
28480
|
+
filePath = requireValue14(rest, token);
|
|
28320
28481
|
break;
|
|
28321
28482
|
case "--key":
|
|
28322
|
-
objectKey =
|
|
28483
|
+
objectKey = requireValue14(rest, token);
|
|
28323
28484
|
break;
|
|
28324
28485
|
default:
|
|
28325
28486
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -28352,7 +28513,7 @@ function parseEnvArgs(tokens) {
|
|
|
28352
28513
|
throw new Error("Only one env action is allowed.");
|
|
28353
28514
|
}
|
|
28354
28515
|
action = "set";
|
|
28355
|
-
key =
|
|
28516
|
+
key = requireValue14(rest, token);
|
|
28356
28517
|
break;
|
|
28357
28518
|
case "--list":
|
|
28358
28519
|
if (action) {
|
|
@@ -28365,17 +28526,17 @@ function parseEnvArgs(tokens) {
|
|
|
28365
28526
|
throw new Error("Only one env action is allowed.");
|
|
28366
28527
|
}
|
|
28367
28528
|
action = "delete";
|
|
28368
|
-
key =
|
|
28529
|
+
key = requireValue14(rest, token);
|
|
28369
28530
|
break;
|
|
28370
28531
|
case "--value":
|
|
28371
|
-
value =
|
|
28532
|
+
value = requireValue14(rest, token);
|
|
28372
28533
|
break;
|
|
28373
28534
|
case "--verbose":
|
|
28374
28535
|
case "-v":
|
|
28375
28536
|
verbose = true;
|
|
28376
28537
|
break;
|
|
28377
28538
|
case "--cwd":
|
|
28378
|
-
cwd =
|
|
28539
|
+
cwd = requireValue14(rest, token);
|
|
28379
28540
|
break;
|
|
28380
28541
|
default:
|
|
28381
28542
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -28433,7 +28594,7 @@ function parseCommitArgs(tokens) {
|
|
|
28433
28594
|
push = true;
|
|
28434
28595
|
break;
|
|
28435
28596
|
case "--cwd":
|
|
28436
|
-
cwd =
|
|
28597
|
+
cwd = requireValue14(rest, token);
|
|
28437
28598
|
break;
|
|
28438
28599
|
default:
|
|
28439
28600
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -28449,10 +28610,10 @@ function parseSummaryArgs(tokens) {
|
|
|
28449
28610
|
const token = rest.shift();
|
|
28450
28611
|
switch (token) {
|
|
28451
28612
|
case "--pr":
|
|
28452
|
-
prRef =
|
|
28613
|
+
prRef = requireValue14(rest, token);
|
|
28453
28614
|
break;
|
|
28454
28615
|
case "--cwd":
|
|
28455
|
-
cwd =
|
|
28616
|
+
cwd = requireValue14(rest, token);
|
|
28456
28617
|
break;
|
|
28457
28618
|
default:
|
|
28458
28619
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -28477,13 +28638,13 @@ function parseQuizArgs(tokens) {
|
|
|
28477
28638
|
const token = rest.shift();
|
|
28478
28639
|
switch (token) {
|
|
28479
28640
|
case "--paper-id":
|
|
28480
|
-
paperId =
|
|
28641
|
+
paperId = requireValue14(rest, token);
|
|
28481
28642
|
break;
|
|
28482
28643
|
case "--base-url":
|
|
28483
|
-
apiBaseUrl =
|
|
28644
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28484
28645
|
break;
|
|
28485
28646
|
case "--link-base":
|
|
28486
|
-
linkBaseUrl =
|
|
28647
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28487
28648
|
break;
|
|
28488
28649
|
default:
|
|
28489
28650
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -28509,16 +28670,16 @@ function parseQuizArgs(tokens) {
|
|
|
28509
28670
|
const token = rest.shift();
|
|
28510
28671
|
switch (token) {
|
|
28511
28672
|
case "--paper-id":
|
|
28512
|
-
paperId =
|
|
28673
|
+
paperId = requireValue14(rest, token);
|
|
28513
28674
|
break;
|
|
28514
28675
|
case "--file":
|
|
28515
|
-
filePath =
|
|
28676
|
+
filePath = requireValue14(rest, token);
|
|
28516
28677
|
break;
|
|
28517
28678
|
case "--base-url":
|
|
28518
|
-
apiBaseUrl =
|
|
28679
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28519
28680
|
break;
|
|
28520
28681
|
case "--link-base":
|
|
28521
|
-
linkBaseUrl =
|
|
28682
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28522
28683
|
break;
|
|
28523
28684
|
default:
|
|
28524
28685
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -28548,16 +28709,16 @@ function parseQuizArgs(tokens) {
|
|
|
28548
28709
|
const token = rest.shift();
|
|
28549
28710
|
switch (token) {
|
|
28550
28711
|
case "--paper-id":
|
|
28551
|
-
paperId =
|
|
28712
|
+
paperId = requireValue14(rest, token);
|
|
28552
28713
|
break;
|
|
28553
28714
|
case "--file":
|
|
28554
|
-
filePath =
|
|
28715
|
+
filePath = requireValue14(rest, token);
|
|
28555
28716
|
break;
|
|
28556
28717
|
case "--base-url":
|
|
28557
|
-
apiBaseUrl =
|
|
28718
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28558
28719
|
break;
|
|
28559
28720
|
case "--link-base":
|
|
28560
|
-
linkBaseUrl =
|
|
28721
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28561
28722
|
break;
|
|
28562
28723
|
default:
|
|
28563
28724
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -28588,19 +28749,19 @@ function parseQuizArgs(tokens) {
|
|
|
28588
28749
|
const token = rest.shift();
|
|
28589
28750
|
switch (token) {
|
|
28590
28751
|
case "--paper-id":
|
|
28591
|
-
paperId =
|
|
28752
|
+
paperId = requireValue14(rest, token);
|
|
28592
28753
|
break;
|
|
28593
28754
|
case "--step-id":
|
|
28594
|
-
stepId =
|
|
28755
|
+
stepId = requireValue14(rest, token);
|
|
28595
28756
|
break;
|
|
28596
28757
|
case "--file":
|
|
28597
|
-
filePath =
|
|
28758
|
+
filePath = requireValue14(rest, token);
|
|
28598
28759
|
break;
|
|
28599
28760
|
case "--base-url":
|
|
28600
|
-
apiBaseUrl =
|
|
28761
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28601
28762
|
break;
|
|
28602
28763
|
case "--link-base":
|
|
28603
|
-
linkBaseUrl =
|
|
28764
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28604
28765
|
break;
|
|
28605
28766
|
default:
|
|
28606
28767
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -28634,16 +28795,16 @@ function parseQuizArgs(tokens) {
|
|
|
28634
28795
|
const token = rest.shift();
|
|
28635
28796
|
switch (token) {
|
|
28636
28797
|
case "--paper-id":
|
|
28637
|
-
paperId =
|
|
28798
|
+
paperId = requireValue14(rest, token);
|
|
28638
28799
|
break;
|
|
28639
28800
|
case "--step-ids":
|
|
28640
|
-
stepIdsRaw =
|
|
28801
|
+
stepIdsRaw = requireValue14(rest, token);
|
|
28641
28802
|
break;
|
|
28642
28803
|
case "--base-url":
|
|
28643
|
-
apiBaseUrl =
|
|
28804
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28644
28805
|
break;
|
|
28645
28806
|
case "--link-base":
|
|
28646
|
-
linkBaseUrl =
|
|
28807
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28647
28808
|
break;
|
|
28648
28809
|
default:
|
|
28649
28810
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -28677,16 +28838,16 @@ function parseQuizArgs(tokens) {
|
|
|
28677
28838
|
const token = rest.shift();
|
|
28678
28839
|
switch (token) {
|
|
28679
28840
|
case "--paper-id":
|
|
28680
|
-
paperId =
|
|
28841
|
+
paperId = requireValue14(rest, token);
|
|
28681
28842
|
break;
|
|
28682
28843
|
case "--step-id":
|
|
28683
|
-
stepId =
|
|
28844
|
+
stepId = requireValue14(rest, token);
|
|
28684
28845
|
break;
|
|
28685
28846
|
case "--base-url":
|
|
28686
|
-
apiBaseUrl =
|
|
28847
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28687
28848
|
break;
|
|
28688
28849
|
case "--link-base":
|
|
28689
|
-
linkBaseUrl =
|
|
28850
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28690
28851
|
break;
|
|
28691
28852
|
default:
|
|
28692
28853
|
throw new Error(`Unknown quiz delete-step option: ${token}`);
|
|
@@ -28715,13 +28876,13 @@ function parseQuizArgs(tokens) {
|
|
|
28715
28876
|
const token = rest.shift();
|
|
28716
28877
|
switch (token) {
|
|
28717
28878
|
case "--paper-id":
|
|
28718
|
-
paperId =
|
|
28879
|
+
paperId = requireValue14(rest, token);
|
|
28719
28880
|
break;
|
|
28720
28881
|
case "--base-url":
|
|
28721
|
-
apiBaseUrl =
|
|
28882
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28722
28883
|
break;
|
|
28723
28884
|
case "--link-base":
|
|
28724
|
-
linkBaseUrl =
|
|
28885
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28725
28886
|
break;
|
|
28726
28887
|
default:
|
|
28727
28888
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -28746,13 +28907,13 @@ function parseQuizArgs(tokens) {
|
|
|
28746
28907
|
const token = rest.shift();
|
|
28747
28908
|
switch (token) {
|
|
28748
28909
|
case "--paper-id":
|
|
28749
|
-
paperId =
|
|
28910
|
+
paperId = requireValue14(rest, token);
|
|
28750
28911
|
break;
|
|
28751
28912
|
case "--base-url":
|
|
28752
|
-
apiBaseUrl =
|
|
28913
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28753
28914
|
break;
|
|
28754
28915
|
case "--link-base":
|
|
28755
|
-
linkBaseUrl =
|
|
28916
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28756
28917
|
break;
|
|
28757
28918
|
default:
|
|
28758
28919
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -28781,22 +28942,22 @@ function parseQuizArgs(tokens) {
|
|
|
28781
28942
|
const token = rest.shift();
|
|
28782
28943
|
switch (token) {
|
|
28783
28944
|
case "--paper-id":
|
|
28784
|
-
paperId =
|
|
28945
|
+
paperId = requireValue14(rest, token);
|
|
28785
28946
|
break;
|
|
28786
28947
|
case "--step-id":
|
|
28787
|
-
stepId =
|
|
28948
|
+
stepId = requireValue14(rest, token);
|
|
28788
28949
|
break;
|
|
28789
28950
|
case "--file":
|
|
28790
|
-
filePath =
|
|
28951
|
+
filePath = requireValue14(rest, token);
|
|
28791
28952
|
break;
|
|
28792
28953
|
case "--new-paper-id":
|
|
28793
|
-
newPaperId =
|
|
28954
|
+
newPaperId = requireValue14(rest, token);
|
|
28794
28955
|
break;
|
|
28795
28956
|
case "--base-url":
|
|
28796
|
-
apiBaseUrl =
|
|
28957
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28797
28958
|
break;
|
|
28798
28959
|
case "--link-base":
|
|
28799
|
-
linkBaseUrl =
|
|
28960
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28800
28961
|
break;
|
|
28801
28962
|
case "--activate":
|
|
28802
28963
|
activate = true;
|
|
@@ -28886,10 +29047,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
28886
29047
|
const token = rest.shift();
|
|
28887
29048
|
switch (token) {
|
|
28888
29049
|
case "--account":
|
|
28889
|
-
account =
|
|
29050
|
+
account = requireValue14(rest, token);
|
|
28890
29051
|
break;
|
|
28891
29052
|
case "--cwd":
|
|
28892
|
-
cwd =
|
|
29053
|
+
cwd = requireValue14(rest, token);
|
|
28893
29054
|
break;
|
|
28894
29055
|
default:
|
|
28895
29056
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28918,35 +29079,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
28918
29079
|
const token = rest.shift();
|
|
28919
29080
|
switch (token) {
|
|
28920
29081
|
case "--account":
|
|
28921
|
-
account =
|
|
29082
|
+
account = requireValue14(rest, token);
|
|
28922
29083
|
break;
|
|
28923
29084
|
case "--repl":
|
|
28924
29085
|
useRepl = true;
|
|
28925
29086
|
break;
|
|
28926
29087
|
case "--title":
|
|
28927
|
-
title =
|
|
29088
|
+
title = requireValue14(rest, token);
|
|
28928
29089
|
break;
|
|
28929
29090
|
case "--desc":
|
|
28930
29091
|
case "--description":
|
|
28931
|
-
description = decodeEscapedNewlines(
|
|
29092
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
28932
29093
|
break;
|
|
28933
29094
|
case "--team-id":
|
|
28934
|
-
teamId =
|
|
29095
|
+
teamId = requireValue14(rest, token);
|
|
28935
29096
|
break;
|
|
28936
29097
|
case "--team-key":
|
|
28937
|
-
teamKey =
|
|
29098
|
+
teamKey = requireValue14(rest, token);
|
|
28938
29099
|
break;
|
|
28939
29100
|
case "--priority":
|
|
28940
|
-
priority = parseLinearPriority(
|
|
29101
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
28941
29102
|
break;
|
|
28942
29103
|
case "--parent-id":
|
|
28943
|
-
parentId =
|
|
29104
|
+
parentId = requireValue14(rest, token);
|
|
28944
29105
|
break;
|
|
28945
29106
|
case "--state-id":
|
|
28946
|
-
stateId =
|
|
29107
|
+
stateId = requireValue14(rest, token);
|
|
28947
29108
|
break;
|
|
28948
29109
|
case "--cwd":
|
|
28949
|
-
cwd =
|
|
29110
|
+
cwd = requireValue14(rest, token);
|
|
28950
29111
|
break;
|
|
28951
29112
|
default:
|
|
28952
29113
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28981,10 +29142,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
28981
29142
|
const token = rest.shift();
|
|
28982
29143
|
switch (token) {
|
|
28983
29144
|
case "--account":
|
|
28984
|
-
account =
|
|
29145
|
+
account = requireValue14(rest, token);
|
|
28985
29146
|
break;
|
|
28986
29147
|
case "--cwd":
|
|
28987
|
-
cwd =
|
|
29148
|
+
cwd = requireValue14(rest, token);
|
|
28988
29149
|
break;
|
|
28989
29150
|
default:
|
|
28990
29151
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29009,10 +29170,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
29009
29170
|
const token = rest.shift();
|
|
29010
29171
|
switch (token) {
|
|
29011
29172
|
case "--account":
|
|
29012
|
-
account =
|
|
29173
|
+
account = requireValue14(rest, token);
|
|
29013
29174
|
break;
|
|
29014
29175
|
case "--cwd":
|
|
29015
|
-
cwd =
|
|
29176
|
+
cwd = requireValue14(rest, token);
|
|
29016
29177
|
break;
|
|
29017
29178
|
default:
|
|
29018
29179
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29047,32 +29208,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
29047
29208
|
const token = rest.shift();
|
|
29048
29209
|
switch (token) {
|
|
29049
29210
|
case "--account":
|
|
29050
|
-
account =
|
|
29211
|
+
account = requireValue14(rest, token);
|
|
29051
29212
|
break;
|
|
29052
29213
|
case "--title":
|
|
29053
|
-
title =
|
|
29214
|
+
title = requireValue14(rest, token);
|
|
29054
29215
|
break;
|
|
29055
29216
|
case "--desc":
|
|
29056
29217
|
case "--description":
|
|
29057
|
-
description = decodeEscapedNewlines(
|
|
29218
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29058
29219
|
break;
|
|
29059
29220
|
case "--team-id":
|
|
29060
|
-
teamId =
|
|
29221
|
+
teamId = requireValue14(rest, token);
|
|
29061
29222
|
break;
|
|
29062
29223
|
case "--team-key":
|
|
29063
|
-
teamKey =
|
|
29224
|
+
teamKey = requireValue14(rest, token);
|
|
29064
29225
|
break;
|
|
29065
29226
|
case "--priority":
|
|
29066
|
-
priority = parseLinearPriority(
|
|
29227
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
29067
29228
|
break;
|
|
29068
29229
|
case "--parent-id":
|
|
29069
|
-
parentId =
|
|
29230
|
+
parentId = requireValue14(rest, token);
|
|
29070
29231
|
break;
|
|
29071
29232
|
case "--state-id":
|
|
29072
|
-
stateId =
|
|
29233
|
+
stateId = requireValue14(rest, token);
|
|
29073
29234
|
break;
|
|
29074
29235
|
case "--cwd":
|
|
29075
|
-
cwd =
|
|
29236
|
+
cwd = requireValue14(rest, token);
|
|
29076
29237
|
break;
|
|
29077
29238
|
default:
|
|
29078
29239
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29110,10 +29271,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
29110
29271
|
const token = rest.shift();
|
|
29111
29272
|
switch (token) {
|
|
29112
29273
|
case "--account":
|
|
29113
|
-
account =
|
|
29274
|
+
account = requireValue14(rest, token);
|
|
29114
29275
|
break;
|
|
29115
29276
|
case "--cwd":
|
|
29116
|
-
cwd =
|
|
29277
|
+
cwd = requireValue14(rest, token);
|
|
29117
29278
|
break;
|
|
29118
29279
|
default:
|
|
29119
29280
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29140,15 +29301,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
29140
29301
|
const token = rest.shift();
|
|
29141
29302
|
switch (token) {
|
|
29142
29303
|
case "--account":
|
|
29143
|
-
account =
|
|
29304
|
+
account = requireValue14(rest, token);
|
|
29144
29305
|
break;
|
|
29145
29306
|
case "--body":
|
|
29146
29307
|
case "--desc":
|
|
29147
29308
|
case "--description":
|
|
29148
|
-
body = decodeEscapedNewlines(
|
|
29309
|
+
body = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29149
29310
|
break;
|
|
29150
29311
|
case "--cwd":
|
|
29151
|
-
cwd =
|
|
29312
|
+
cwd = requireValue14(rest, token);
|
|
29152
29313
|
break;
|
|
29153
29314
|
default:
|
|
29154
29315
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29178,10 +29339,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
29178
29339
|
const token = rest.shift();
|
|
29179
29340
|
switch (token) {
|
|
29180
29341
|
case "--account":
|
|
29181
|
-
account =
|
|
29342
|
+
account = requireValue14(rest, token);
|
|
29182
29343
|
break;
|
|
29183
29344
|
case "--cwd":
|
|
29184
|
-
cwd =
|
|
29345
|
+
cwd = requireValue14(rest, token);
|
|
29185
29346
|
break;
|
|
29186
29347
|
default:
|
|
29187
29348
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29205,16 +29366,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
29205
29366
|
const token = rest.shift();
|
|
29206
29367
|
switch (token) {
|
|
29207
29368
|
case "--account":
|
|
29208
|
-
account =
|
|
29369
|
+
account = requireValue14(rest, token);
|
|
29209
29370
|
break;
|
|
29210
29371
|
case "--team-id":
|
|
29211
|
-
teamId =
|
|
29372
|
+
teamId = requireValue14(rest, token);
|
|
29212
29373
|
break;
|
|
29213
29374
|
case "--team-key":
|
|
29214
|
-
teamKey =
|
|
29375
|
+
teamKey = requireValue14(rest, token);
|
|
29215
29376
|
break;
|
|
29216
29377
|
case "--cwd":
|
|
29217
|
-
cwd =
|
|
29378
|
+
cwd = requireValue14(rest, token);
|
|
29218
29379
|
break;
|
|
29219
29380
|
default:
|
|
29220
29381
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29237,10 +29398,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
29237
29398
|
const token = rest.shift();
|
|
29238
29399
|
switch (token) {
|
|
29239
29400
|
case "--account":
|
|
29240
|
-
account =
|
|
29401
|
+
account = requireValue14(rest, token);
|
|
29241
29402
|
break;
|
|
29242
29403
|
case "--cwd":
|
|
29243
|
-
cwd =
|
|
29404
|
+
cwd = requireValue14(rest, token);
|
|
29244
29405
|
break;
|
|
29245
29406
|
default:
|
|
29246
29407
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29267,16 +29428,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
29267
29428
|
const token = rest.shift();
|
|
29268
29429
|
switch (token) {
|
|
29269
29430
|
case "--account":
|
|
29270
|
-
account =
|
|
29431
|
+
account = requireValue14(rest, token);
|
|
29271
29432
|
break;
|
|
29272
29433
|
case "--cycle":
|
|
29273
|
-
cycle = parseLinearCycle(
|
|
29434
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29274
29435
|
break;
|
|
29275
29436
|
case "--status":
|
|
29276
|
-
status = parseLinearStatus(
|
|
29437
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29277
29438
|
break;
|
|
29278
29439
|
case "--cwd":
|
|
29279
|
-
cwd =
|
|
29440
|
+
cwd = requireValue14(rest, token);
|
|
29280
29441
|
break;
|
|
29281
29442
|
default:
|
|
29282
29443
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29310,28 +29471,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29310
29471
|
const token = rest.shift();
|
|
29311
29472
|
switch (token) {
|
|
29312
29473
|
case "--account":
|
|
29313
|
-
account =
|
|
29474
|
+
account = requireValue14(rest, token);
|
|
29314
29475
|
break;
|
|
29315
29476
|
case "--team-id":
|
|
29316
|
-
teamId =
|
|
29477
|
+
teamId = requireValue14(rest, token);
|
|
29317
29478
|
break;
|
|
29318
29479
|
case "--team-key":
|
|
29319
|
-
teamKey =
|
|
29480
|
+
teamKey = requireValue14(rest, token);
|
|
29320
29481
|
break;
|
|
29321
29482
|
case "--user":
|
|
29322
|
-
user =
|
|
29483
|
+
user = requireValue14(rest, token);
|
|
29323
29484
|
break;
|
|
29324
29485
|
case "--cycle":
|
|
29325
|
-
cycle = parseLinearCycle(
|
|
29486
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29326
29487
|
break;
|
|
29327
29488
|
case "--status":
|
|
29328
|
-
status = parseLinearStatus(
|
|
29489
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29329
29490
|
break;
|
|
29330
29491
|
case "--query":
|
|
29331
|
-
query =
|
|
29492
|
+
query = requireValue14(rest, token).trim();
|
|
29332
29493
|
break;
|
|
29333
29494
|
case "--limit": {
|
|
29334
|
-
const value = Number.parseInt(
|
|
29495
|
+
const value = Number.parseInt(requireValue14(rest, token), 10);
|
|
29335
29496
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
29336
29497
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
29337
29498
|
}
|
|
@@ -29339,7 +29500,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29339
29500
|
break;
|
|
29340
29501
|
}
|
|
29341
29502
|
case "--cwd":
|
|
29342
|
-
cwd =
|
|
29503
|
+
cwd = requireValue14(rest, token);
|
|
29343
29504
|
break;
|
|
29344
29505
|
default:
|
|
29345
29506
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29380,10 +29541,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
29380
29541
|
useScreenshot = true;
|
|
29381
29542
|
break;
|
|
29382
29543
|
case "--account":
|
|
29383
|
-
account =
|
|
29544
|
+
account = requireValue14(rest, token);
|
|
29384
29545
|
break;
|
|
29385
29546
|
case "--cwd":
|
|
29386
|
-
cwd =
|
|
29547
|
+
cwd = requireValue14(rest, token);
|
|
29387
29548
|
break;
|
|
29388
29549
|
default:
|
|
29389
29550
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29477,19 +29638,19 @@ function parseNotionArgs(tokens) {
|
|
|
29477
29638
|
const token = rest.shift();
|
|
29478
29639
|
switch (token) {
|
|
29479
29640
|
case "--parent":
|
|
29480
|
-
parentPageId =
|
|
29641
|
+
parentPageId = requireValue14(rest, token);
|
|
29481
29642
|
break;
|
|
29482
29643
|
case "--title":
|
|
29483
|
-
title =
|
|
29644
|
+
title = requireValue14(rest, token);
|
|
29484
29645
|
break;
|
|
29485
29646
|
case "--private":
|
|
29486
29647
|
isPrivate = true;
|
|
29487
29648
|
break;
|
|
29488
29649
|
case "--content":
|
|
29489
|
-
content2 =
|
|
29650
|
+
content2 = requireValue14(rest, token);
|
|
29490
29651
|
break;
|
|
29491
29652
|
case "--file":
|
|
29492
|
-
filePath2 =
|
|
29653
|
+
filePath2 = requireValue14(rest, token);
|
|
29493
29654
|
break;
|
|
29494
29655
|
default:
|
|
29495
29656
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -29533,10 +29694,10 @@ function parseNotionArgs(tokens) {
|
|
|
29533
29694
|
const token = rest.shift();
|
|
29534
29695
|
switch (token) {
|
|
29535
29696
|
case "--content":
|
|
29536
|
-
content =
|
|
29697
|
+
content = requireValue14(rest, token);
|
|
29537
29698
|
break;
|
|
29538
29699
|
case "--file":
|
|
29539
|
-
filePath =
|
|
29700
|
+
filePath = requireValue14(rest, token);
|
|
29540
29701
|
break;
|
|
29541
29702
|
case "--append":
|
|
29542
29703
|
append = true;
|
|
@@ -29581,11 +29742,11 @@ function parseRandomArgs(tokens) {
|
|
|
29581
29742
|
mode = "easy";
|
|
29582
29743
|
break;
|
|
29583
29744
|
case "--length":
|
|
29584
|
-
length = parsePositiveInt3(
|
|
29745
|
+
length = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29585
29746
|
seenLength = true;
|
|
29586
29747
|
break;
|
|
29587
29748
|
case "--charset": {
|
|
29588
|
-
const value =
|
|
29749
|
+
const value = requireValue14(rest, token);
|
|
29589
29750
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
29590
29751
|
throw new Error(
|
|
29591
29752
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -29596,18 +29757,18 @@ function parseRandomArgs(tokens) {
|
|
|
29596
29757
|
break;
|
|
29597
29758
|
}
|
|
29598
29759
|
case "--count":
|
|
29599
|
-
count = parsePositiveInt3(
|
|
29760
|
+
count = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29600
29761
|
break;
|
|
29601
29762
|
case "--words":
|
|
29602
|
-
words = parsePositiveInt3(
|
|
29763
|
+
words = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29603
29764
|
seenWords = true;
|
|
29604
29765
|
break;
|
|
29605
29766
|
case "--digits":
|
|
29606
|
-
digits = parseNonNegativeInt(
|
|
29767
|
+
digits = parseNonNegativeInt(requireValue14(rest, token), token);
|
|
29607
29768
|
seenDigits = true;
|
|
29608
29769
|
break;
|
|
29609
29770
|
case "--separator":
|
|
29610
|
-
separator =
|
|
29771
|
+
separator = requireValue14(rest, token);
|
|
29611
29772
|
seenSeparator = true;
|
|
29612
29773
|
break;
|
|
29613
29774
|
default:
|
|
@@ -29638,7 +29799,7 @@ function parseRandomArgs(tokens) {
|
|
|
29638
29799
|
count
|
|
29639
29800
|
};
|
|
29640
29801
|
}
|
|
29641
|
-
function
|
|
29802
|
+
function requireValue14(tokens, optionName) {
|
|
29642
29803
|
const value = tokens.shift();
|
|
29643
29804
|
if (!value) {
|
|
29644
29805
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -29819,6 +29980,11 @@ async function main() {
|
|
|
29819
29980
|
await handler.handle(commandArgs);
|
|
29820
29981
|
return;
|
|
29821
29982
|
}
|
|
29983
|
+
case "host" /* Host */: {
|
|
29984
|
+
const handler = new HostCommandHandler();
|
|
29985
|
+
await handler.handle(commandArgs);
|
|
29986
|
+
return;
|
|
29987
|
+
}
|
|
29822
29988
|
case "vercel" /* Vercel */: {
|
|
29823
29989
|
const handler = new VercelCommandHandler();
|
|
29824
29990
|
await handler.handle(commandArgs);
|