@pmate/cli 0.28.0 → 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 +323 -156
- 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}`),
|
|
@@ -27810,7 +27963,8 @@ var HELP_TEXT = [
|
|
|
27810
27963
|
` ${import_chalk4.default.gray(" health [--json]")}`,
|
|
27811
27964
|
` ${import_chalk4.default.gray(" threads [--q <keyword>] [--search <title>] [--limit <n>] [--json|--text]")}`,
|
|
27812
27965
|
` ${import_chalk4.default.gray(" messages --thread <name|conversation-id> [--limit <n>] [--json|--text]")}`,
|
|
27813
|
-
` ${import_chalk4.default.gray(" reply --thread <name|conversation-id> --text <text> [--dryrun]")}`,
|
|
27966
|
+
` ${import_chalk4.default.gray(" reply --thread <name|conversation-id> [--text <text>] [--file|--image <path>] [--dryrun]")}`,
|
|
27967
|
+
` ${import_chalk4.default.gray(" react --thread <name|conversation-id> --emoji <emoji> [--message <id|timestamp>] [--remove] [--dryrun]")}`,
|
|
27814
27968
|
` ${import_chalk4.default.cyan("collect")} Legacy alias for CC/yelling collection`,
|
|
27815
27969
|
` ${import_chalk4.default.gray(" sync [--thread <name|conversation-id>] (--source <cc|yelling> | --endpoint <url>)")}`,
|
|
27816
27970
|
` ${import_chalk4.default.cyan("chat-room")} Run social chat regression commands with PMate bot key JSON`,
|
|
@@ -27919,6 +28073,11 @@ var HELP_TEXT = [
|
|
|
27919
28073
|
` ${import_chalk4.default.gray(" ssl refresh <ns:objectId> [--cert <key>] [--dry-run] [--base-url <url>] [--json]")}`,
|
|
27920
28074
|
` ${import_chalk4.default.gray(" log <ns:objectId> [--page <n>] [--history] [--search <keyword>] [--follow|-f] [--base-url <url>]")}`,
|
|
27921
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]")}`,
|
|
27922
28081
|
` ${import_chalk4.default.cyan("vercel")} Wrap common Vercel CLI inspection commands`,
|
|
27923
28082
|
` ${import_chalk4.default.gray(" projects [--scope <scope>]")}`,
|
|
27924
28083
|
` ${import_chalk4.default.gray(" deploys --project <name> [--last-week] [--scope <scope>]")}`
|
|
@@ -27984,10 +28143,10 @@ function parseCommandArgs(args) {
|
|
|
27984
28143
|
const token = rest.shift();
|
|
27985
28144
|
switch (token) {
|
|
27986
28145
|
case "--app":
|
|
27987
|
-
app =
|
|
28146
|
+
app = requireValue14(rest, token);
|
|
27988
28147
|
break;
|
|
27989
28148
|
case "--profile-id":
|
|
27990
|
-
profileId =
|
|
28149
|
+
profileId = requireValue14(rest, token);
|
|
27991
28150
|
break;
|
|
27992
28151
|
case "--access-key":
|
|
27993
28152
|
if (rest[0] && !rest[0].startsWith("--")) {
|
|
@@ -27997,7 +28156,7 @@ function parseCommandArgs(args) {
|
|
|
27997
28156
|
}
|
|
27998
28157
|
break;
|
|
27999
28158
|
case "--access-key-file":
|
|
28000
|
-
accessKeyFile =
|
|
28159
|
+
accessKeyFile = requireValue14(rest, token);
|
|
28001
28160
|
break;
|
|
28002
28161
|
case "--select-profile":
|
|
28003
28162
|
selectProfile = true;
|
|
@@ -28098,6 +28257,9 @@ function parseCommandArgs(args) {
|
|
|
28098
28257
|
if (args.rest[0] === "service") {
|
|
28099
28258
|
return parseServiceArgs(args.rest.slice(1));
|
|
28100
28259
|
}
|
|
28260
|
+
if (args.rest[0] === "host") {
|
|
28261
|
+
return parseHostArgs(args.rest.slice(1));
|
|
28262
|
+
}
|
|
28101
28263
|
if (args.rest[0] === "vercel") {
|
|
28102
28264
|
return parseVercelArgs(args.rest.slice(1));
|
|
28103
28265
|
}
|
|
@@ -28115,7 +28277,7 @@ function parseVercelArgs(tokens) {
|
|
|
28115
28277
|
const token = rest.shift();
|
|
28116
28278
|
switch (token) {
|
|
28117
28279
|
case "--scope":
|
|
28118
|
-
scope =
|
|
28280
|
+
scope = requireValue14(rest, token);
|
|
28119
28281
|
break;
|
|
28120
28282
|
default:
|
|
28121
28283
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -28135,10 +28297,10 @@ function parseVercelArgs(tokens) {
|
|
|
28135
28297
|
const token = rest.shift();
|
|
28136
28298
|
switch (token) {
|
|
28137
28299
|
case "--scope":
|
|
28138
|
-
scope =
|
|
28300
|
+
scope = requireValue14(rest, token);
|
|
28139
28301
|
break;
|
|
28140
28302
|
case "--project":
|
|
28141
|
-
project =
|
|
28303
|
+
project = requireValue14(rest, token);
|
|
28142
28304
|
break;
|
|
28143
28305
|
case "--last-week":
|
|
28144
28306
|
lastWeek = true;
|
|
@@ -28169,16 +28331,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
28169
28331
|
const token = rest.shift();
|
|
28170
28332
|
switch (token) {
|
|
28171
28333
|
case "--type":
|
|
28172
|
-
options.dnsType =
|
|
28334
|
+
options.dnsType = requireValue14(rest, token);
|
|
28173
28335
|
break;
|
|
28174
28336
|
case "--value":
|
|
28175
|
-
options.dnsValue =
|
|
28337
|
+
options.dnsValue = requireValue14(rest, token);
|
|
28176
28338
|
break;
|
|
28177
28339
|
case "--rr":
|
|
28178
|
-
options.dnsRr =
|
|
28340
|
+
options.dnsRr = requireValue14(rest, token);
|
|
28179
28341
|
break;
|
|
28180
28342
|
case "--ttl": {
|
|
28181
|
-
const ttlValue =
|
|
28343
|
+
const ttlValue = requireValue14(rest, token);
|
|
28182
28344
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
28183
28345
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
28184
28346
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -28187,7 +28349,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
28187
28349
|
break;
|
|
28188
28350
|
}
|
|
28189
28351
|
case "--domain":
|
|
28190
|
-
options.dnsDomain =
|
|
28352
|
+
options.dnsDomain = requireValue14(rest, token);
|
|
28191
28353
|
break;
|
|
28192
28354
|
default:
|
|
28193
28355
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -28220,13 +28382,13 @@ function parseBucketArgs(tokens) {
|
|
|
28220
28382
|
options.bucketCreate = true;
|
|
28221
28383
|
break;
|
|
28222
28384
|
case "--name":
|
|
28223
|
-
options.bucketName =
|
|
28385
|
+
options.bucketName = requireValue14(rest, token);
|
|
28224
28386
|
break;
|
|
28225
28387
|
case "--subdomain":
|
|
28226
|
-
options.bucketSubdomain =
|
|
28388
|
+
options.bucketSubdomain = requireValue14(rest, token);
|
|
28227
28389
|
break;
|
|
28228
28390
|
case "--domain":
|
|
28229
|
-
options.bucketDomain =
|
|
28391
|
+
options.bucketDomain = requireValue14(rest, token);
|
|
28230
28392
|
break;
|
|
28231
28393
|
default:
|
|
28232
28394
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -28258,7 +28420,7 @@ function parseDevArgs(tokens) {
|
|
|
28258
28420
|
const token = rest.shift();
|
|
28259
28421
|
switch (token) {
|
|
28260
28422
|
case "--cwd":
|
|
28261
|
-
options.devCwd =
|
|
28423
|
+
options.devCwd = requireValue14(rest, token);
|
|
28262
28424
|
break;
|
|
28263
28425
|
default:
|
|
28264
28426
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -28278,7 +28440,7 @@ function parseDeleteArgs(tokens) {
|
|
|
28278
28440
|
const token = rest.shift();
|
|
28279
28441
|
switch (token) {
|
|
28280
28442
|
case "--cwd":
|
|
28281
|
-
deleteCwd =
|
|
28443
|
+
deleteCwd = requireValue14(rest, token);
|
|
28282
28444
|
break;
|
|
28283
28445
|
default:
|
|
28284
28446
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -28312,13 +28474,13 @@ function parseOssArgs(tokens) {
|
|
|
28312
28474
|
const token = rest.shift();
|
|
28313
28475
|
switch (token) {
|
|
28314
28476
|
case "--bucket":
|
|
28315
|
-
bucket =
|
|
28477
|
+
bucket = requireValue14(rest, token);
|
|
28316
28478
|
break;
|
|
28317
28479
|
case "--file":
|
|
28318
|
-
filePath =
|
|
28480
|
+
filePath = requireValue14(rest, token);
|
|
28319
28481
|
break;
|
|
28320
28482
|
case "--key":
|
|
28321
|
-
objectKey =
|
|
28483
|
+
objectKey = requireValue14(rest, token);
|
|
28322
28484
|
break;
|
|
28323
28485
|
default:
|
|
28324
28486
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -28351,7 +28513,7 @@ function parseEnvArgs(tokens) {
|
|
|
28351
28513
|
throw new Error("Only one env action is allowed.");
|
|
28352
28514
|
}
|
|
28353
28515
|
action = "set";
|
|
28354
|
-
key =
|
|
28516
|
+
key = requireValue14(rest, token);
|
|
28355
28517
|
break;
|
|
28356
28518
|
case "--list":
|
|
28357
28519
|
if (action) {
|
|
@@ -28364,17 +28526,17 @@ function parseEnvArgs(tokens) {
|
|
|
28364
28526
|
throw new Error("Only one env action is allowed.");
|
|
28365
28527
|
}
|
|
28366
28528
|
action = "delete";
|
|
28367
|
-
key =
|
|
28529
|
+
key = requireValue14(rest, token);
|
|
28368
28530
|
break;
|
|
28369
28531
|
case "--value":
|
|
28370
|
-
value =
|
|
28532
|
+
value = requireValue14(rest, token);
|
|
28371
28533
|
break;
|
|
28372
28534
|
case "--verbose":
|
|
28373
28535
|
case "-v":
|
|
28374
28536
|
verbose = true;
|
|
28375
28537
|
break;
|
|
28376
28538
|
case "--cwd":
|
|
28377
|
-
cwd =
|
|
28539
|
+
cwd = requireValue14(rest, token);
|
|
28378
28540
|
break;
|
|
28379
28541
|
default:
|
|
28380
28542
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -28432,7 +28594,7 @@ function parseCommitArgs(tokens) {
|
|
|
28432
28594
|
push = true;
|
|
28433
28595
|
break;
|
|
28434
28596
|
case "--cwd":
|
|
28435
|
-
cwd =
|
|
28597
|
+
cwd = requireValue14(rest, token);
|
|
28436
28598
|
break;
|
|
28437
28599
|
default:
|
|
28438
28600
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -28448,10 +28610,10 @@ function parseSummaryArgs(tokens) {
|
|
|
28448
28610
|
const token = rest.shift();
|
|
28449
28611
|
switch (token) {
|
|
28450
28612
|
case "--pr":
|
|
28451
|
-
prRef =
|
|
28613
|
+
prRef = requireValue14(rest, token);
|
|
28452
28614
|
break;
|
|
28453
28615
|
case "--cwd":
|
|
28454
|
-
cwd =
|
|
28616
|
+
cwd = requireValue14(rest, token);
|
|
28455
28617
|
break;
|
|
28456
28618
|
default:
|
|
28457
28619
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -28476,13 +28638,13 @@ function parseQuizArgs(tokens) {
|
|
|
28476
28638
|
const token = rest.shift();
|
|
28477
28639
|
switch (token) {
|
|
28478
28640
|
case "--paper-id":
|
|
28479
|
-
paperId =
|
|
28641
|
+
paperId = requireValue14(rest, token);
|
|
28480
28642
|
break;
|
|
28481
28643
|
case "--base-url":
|
|
28482
|
-
apiBaseUrl =
|
|
28644
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28483
28645
|
break;
|
|
28484
28646
|
case "--link-base":
|
|
28485
|
-
linkBaseUrl =
|
|
28647
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28486
28648
|
break;
|
|
28487
28649
|
default:
|
|
28488
28650
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -28508,16 +28670,16 @@ function parseQuizArgs(tokens) {
|
|
|
28508
28670
|
const token = rest.shift();
|
|
28509
28671
|
switch (token) {
|
|
28510
28672
|
case "--paper-id":
|
|
28511
|
-
paperId =
|
|
28673
|
+
paperId = requireValue14(rest, token);
|
|
28512
28674
|
break;
|
|
28513
28675
|
case "--file":
|
|
28514
|
-
filePath =
|
|
28676
|
+
filePath = requireValue14(rest, token);
|
|
28515
28677
|
break;
|
|
28516
28678
|
case "--base-url":
|
|
28517
|
-
apiBaseUrl =
|
|
28679
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28518
28680
|
break;
|
|
28519
28681
|
case "--link-base":
|
|
28520
|
-
linkBaseUrl =
|
|
28682
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28521
28683
|
break;
|
|
28522
28684
|
default:
|
|
28523
28685
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -28547,16 +28709,16 @@ function parseQuizArgs(tokens) {
|
|
|
28547
28709
|
const token = rest.shift();
|
|
28548
28710
|
switch (token) {
|
|
28549
28711
|
case "--paper-id":
|
|
28550
|
-
paperId =
|
|
28712
|
+
paperId = requireValue14(rest, token);
|
|
28551
28713
|
break;
|
|
28552
28714
|
case "--file":
|
|
28553
|
-
filePath =
|
|
28715
|
+
filePath = requireValue14(rest, token);
|
|
28554
28716
|
break;
|
|
28555
28717
|
case "--base-url":
|
|
28556
|
-
apiBaseUrl =
|
|
28718
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28557
28719
|
break;
|
|
28558
28720
|
case "--link-base":
|
|
28559
|
-
linkBaseUrl =
|
|
28721
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28560
28722
|
break;
|
|
28561
28723
|
default:
|
|
28562
28724
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -28587,19 +28749,19 @@ function parseQuizArgs(tokens) {
|
|
|
28587
28749
|
const token = rest.shift();
|
|
28588
28750
|
switch (token) {
|
|
28589
28751
|
case "--paper-id":
|
|
28590
|
-
paperId =
|
|
28752
|
+
paperId = requireValue14(rest, token);
|
|
28591
28753
|
break;
|
|
28592
28754
|
case "--step-id":
|
|
28593
|
-
stepId =
|
|
28755
|
+
stepId = requireValue14(rest, token);
|
|
28594
28756
|
break;
|
|
28595
28757
|
case "--file":
|
|
28596
|
-
filePath =
|
|
28758
|
+
filePath = requireValue14(rest, token);
|
|
28597
28759
|
break;
|
|
28598
28760
|
case "--base-url":
|
|
28599
|
-
apiBaseUrl =
|
|
28761
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28600
28762
|
break;
|
|
28601
28763
|
case "--link-base":
|
|
28602
|
-
linkBaseUrl =
|
|
28764
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28603
28765
|
break;
|
|
28604
28766
|
default:
|
|
28605
28767
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -28633,16 +28795,16 @@ function parseQuizArgs(tokens) {
|
|
|
28633
28795
|
const token = rest.shift();
|
|
28634
28796
|
switch (token) {
|
|
28635
28797
|
case "--paper-id":
|
|
28636
|
-
paperId =
|
|
28798
|
+
paperId = requireValue14(rest, token);
|
|
28637
28799
|
break;
|
|
28638
28800
|
case "--step-ids":
|
|
28639
|
-
stepIdsRaw =
|
|
28801
|
+
stepIdsRaw = requireValue14(rest, token);
|
|
28640
28802
|
break;
|
|
28641
28803
|
case "--base-url":
|
|
28642
|
-
apiBaseUrl =
|
|
28804
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28643
28805
|
break;
|
|
28644
28806
|
case "--link-base":
|
|
28645
|
-
linkBaseUrl =
|
|
28807
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28646
28808
|
break;
|
|
28647
28809
|
default:
|
|
28648
28810
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -28676,16 +28838,16 @@ function parseQuizArgs(tokens) {
|
|
|
28676
28838
|
const token = rest.shift();
|
|
28677
28839
|
switch (token) {
|
|
28678
28840
|
case "--paper-id":
|
|
28679
|
-
paperId =
|
|
28841
|
+
paperId = requireValue14(rest, token);
|
|
28680
28842
|
break;
|
|
28681
28843
|
case "--step-id":
|
|
28682
|
-
stepId =
|
|
28844
|
+
stepId = requireValue14(rest, token);
|
|
28683
28845
|
break;
|
|
28684
28846
|
case "--base-url":
|
|
28685
|
-
apiBaseUrl =
|
|
28847
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28686
28848
|
break;
|
|
28687
28849
|
case "--link-base":
|
|
28688
|
-
linkBaseUrl =
|
|
28850
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28689
28851
|
break;
|
|
28690
28852
|
default:
|
|
28691
28853
|
throw new Error(`Unknown quiz delete-step option: ${token}`);
|
|
@@ -28714,13 +28876,13 @@ function parseQuizArgs(tokens) {
|
|
|
28714
28876
|
const token = rest.shift();
|
|
28715
28877
|
switch (token) {
|
|
28716
28878
|
case "--paper-id":
|
|
28717
|
-
paperId =
|
|
28879
|
+
paperId = requireValue14(rest, token);
|
|
28718
28880
|
break;
|
|
28719
28881
|
case "--base-url":
|
|
28720
|
-
apiBaseUrl =
|
|
28882
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28721
28883
|
break;
|
|
28722
28884
|
case "--link-base":
|
|
28723
|
-
linkBaseUrl =
|
|
28885
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28724
28886
|
break;
|
|
28725
28887
|
default:
|
|
28726
28888
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -28745,13 +28907,13 @@ function parseQuizArgs(tokens) {
|
|
|
28745
28907
|
const token = rest.shift();
|
|
28746
28908
|
switch (token) {
|
|
28747
28909
|
case "--paper-id":
|
|
28748
|
-
paperId =
|
|
28910
|
+
paperId = requireValue14(rest, token);
|
|
28749
28911
|
break;
|
|
28750
28912
|
case "--base-url":
|
|
28751
|
-
apiBaseUrl =
|
|
28913
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28752
28914
|
break;
|
|
28753
28915
|
case "--link-base":
|
|
28754
|
-
linkBaseUrl =
|
|
28916
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28755
28917
|
break;
|
|
28756
28918
|
default:
|
|
28757
28919
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -28780,22 +28942,22 @@ function parseQuizArgs(tokens) {
|
|
|
28780
28942
|
const token = rest.shift();
|
|
28781
28943
|
switch (token) {
|
|
28782
28944
|
case "--paper-id":
|
|
28783
|
-
paperId =
|
|
28945
|
+
paperId = requireValue14(rest, token);
|
|
28784
28946
|
break;
|
|
28785
28947
|
case "--step-id":
|
|
28786
|
-
stepId =
|
|
28948
|
+
stepId = requireValue14(rest, token);
|
|
28787
28949
|
break;
|
|
28788
28950
|
case "--file":
|
|
28789
|
-
filePath =
|
|
28951
|
+
filePath = requireValue14(rest, token);
|
|
28790
28952
|
break;
|
|
28791
28953
|
case "--new-paper-id":
|
|
28792
|
-
newPaperId =
|
|
28954
|
+
newPaperId = requireValue14(rest, token);
|
|
28793
28955
|
break;
|
|
28794
28956
|
case "--base-url":
|
|
28795
|
-
apiBaseUrl =
|
|
28957
|
+
apiBaseUrl = requireValue14(rest, token);
|
|
28796
28958
|
break;
|
|
28797
28959
|
case "--link-base":
|
|
28798
|
-
linkBaseUrl =
|
|
28960
|
+
linkBaseUrl = requireValue14(rest, token);
|
|
28799
28961
|
break;
|
|
28800
28962
|
case "--activate":
|
|
28801
28963
|
activate = true;
|
|
@@ -28885,10 +29047,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
28885
29047
|
const token = rest.shift();
|
|
28886
29048
|
switch (token) {
|
|
28887
29049
|
case "--account":
|
|
28888
|
-
account =
|
|
29050
|
+
account = requireValue14(rest, token);
|
|
28889
29051
|
break;
|
|
28890
29052
|
case "--cwd":
|
|
28891
|
-
cwd =
|
|
29053
|
+
cwd = requireValue14(rest, token);
|
|
28892
29054
|
break;
|
|
28893
29055
|
default:
|
|
28894
29056
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28917,35 +29079,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
28917
29079
|
const token = rest.shift();
|
|
28918
29080
|
switch (token) {
|
|
28919
29081
|
case "--account":
|
|
28920
|
-
account =
|
|
29082
|
+
account = requireValue14(rest, token);
|
|
28921
29083
|
break;
|
|
28922
29084
|
case "--repl":
|
|
28923
29085
|
useRepl = true;
|
|
28924
29086
|
break;
|
|
28925
29087
|
case "--title":
|
|
28926
|
-
title =
|
|
29088
|
+
title = requireValue14(rest, token);
|
|
28927
29089
|
break;
|
|
28928
29090
|
case "--desc":
|
|
28929
29091
|
case "--description":
|
|
28930
|
-
description = decodeEscapedNewlines(
|
|
29092
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
28931
29093
|
break;
|
|
28932
29094
|
case "--team-id":
|
|
28933
|
-
teamId =
|
|
29095
|
+
teamId = requireValue14(rest, token);
|
|
28934
29096
|
break;
|
|
28935
29097
|
case "--team-key":
|
|
28936
|
-
teamKey =
|
|
29098
|
+
teamKey = requireValue14(rest, token);
|
|
28937
29099
|
break;
|
|
28938
29100
|
case "--priority":
|
|
28939
|
-
priority = parseLinearPriority(
|
|
29101
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
28940
29102
|
break;
|
|
28941
29103
|
case "--parent-id":
|
|
28942
|
-
parentId =
|
|
29104
|
+
parentId = requireValue14(rest, token);
|
|
28943
29105
|
break;
|
|
28944
29106
|
case "--state-id":
|
|
28945
|
-
stateId =
|
|
29107
|
+
stateId = requireValue14(rest, token);
|
|
28946
29108
|
break;
|
|
28947
29109
|
case "--cwd":
|
|
28948
|
-
cwd =
|
|
29110
|
+
cwd = requireValue14(rest, token);
|
|
28949
29111
|
break;
|
|
28950
29112
|
default:
|
|
28951
29113
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28980,10 +29142,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
28980
29142
|
const token = rest.shift();
|
|
28981
29143
|
switch (token) {
|
|
28982
29144
|
case "--account":
|
|
28983
|
-
account =
|
|
29145
|
+
account = requireValue14(rest, token);
|
|
28984
29146
|
break;
|
|
28985
29147
|
case "--cwd":
|
|
28986
|
-
cwd =
|
|
29148
|
+
cwd = requireValue14(rest, token);
|
|
28987
29149
|
break;
|
|
28988
29150
|
default:
|
|
28989
29151
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29008,10 +29170,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
29008
29170
|
const token = rest.shift();
|
|
29009
29171
|
switch (token) {
|
|
29010
29172
|
case "--account":
|
|
29011
|
-
account =
|
|
29173
|
+
account = requireValue14(rest, token);
|
|
29012
29174
|
break;
|
|
29013
29175
|
case "--cwd":
|
|
29014
|
-
cwd =
|
|
29176
|
+
cwd = requireValue14(rest, token);
|
|
29015
29177
|
break;
|
|
29016
29178
|
default:
|
|
29017
29179
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29046,32 +29208,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
29046
29208
|
const token = rest.shift();
|
|
29047
29209
|
switch (token) {
|
|
29048
29210
|
case "--account":
|
|
29049
|
-
account =
|
|
29211
|
+
account = requireValue14(rest, token);
|
|
29050
29212
|
break;
|
|
29051
29213
|
case "--title":
|
|
29052
|
-
title =
|
|
29214
|
+
title = requireValue14(rest, token);
|
|
29053
29215
|
break;
|
|
29054
29216
|
case "--desc":
|
|
29055
29217
|
case "--description":
|
|
29056
|
-
description = decodeEscapedNewlines(
|
|
29218
|
+
description = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29057
29219
|
break;
|
|
29058
29220
|
case "--team-id":
|
|
29059
|
-
teamId =
|
|
29221
|
+
teamId = requireValue14(rest, token);
|
|
29060
29222
|
break;
|
|
29061
29223
|
case "--team-key":
|
|
29062
|
-
teamKey =
|
|
29224
|
+
teamKey = requireValue14(rest, token);
|
|
29063
29225
|
break;
|
|
29064
29226
|
case "--priority":
|
|
29065
|
-
priority = parseLinearPriority(
|
|
29227
|
+
priority = parseLinearPriority(requireValue14(rest, token));
|
|
29066
29228
|
break;
|
|
29067
29229
|
case "--parent-id":
|
|
29068
|
-
parentId =
|
|
29230
|
+
parentId = requireValue14(rest, token);
|
|
29069
29231
|
break;
|
|
29070
29232
|
case "--state-id":
|
|
29071
|
-
stateId =
|
|
29233
|
+
stateId = requireValue14(rest, token);
|
|
29072
29234
|
break;
|
|
29073
29235
|
case "--cwd":
|
|
29074
|
-
cwd =
|
|
29236
|
+
cwd = requireValue14(rest, token);
|
|
29075
29237
|
break;
|
|
29076
29238
|
default:
|
|
29077
29239
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29109,10 +29271,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
29109
29271
|
const token = rest.shift();
|
|
29110
29272
|
switch (token) {
|
|
29111
29273
|
case "--account":
|
|
29112
|
-
account =
|
|
29274
|
+
account = requireValue14(rest, token);
|
|
29113
29275
|
break;
|
|
29114
29276
|
case "--cwd":
|
|
29115
|
-
cwd =
|
|
29277
|
+
cwd = requireValue14(rest, token);
|
|
29116
29278
|
break;
|
|
29117
29279
|
default:
|
|
29118
29280
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29139,15 +29301,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
29139
29301
|
const token = rest.shift();
|
|
29140
29302
|
switch (token) {
|
|
29141
29303
|
case "--account":
|
|
29142
|
-
account =
|
|
29304
|
+
account = requireValue14(rest, token);
|
|
29143
29305
|
break;
|
|
29144
29306
|
case "--body":
|
|
29145
29307
|
case "--desc":
|
|
29146
29308
|
case "--description":
|
|
29147
|
-
body = decodeEscapedNewlines(
|
|
29309
|
+
body = decodeEscapedNewlines(requireValue14(rest, token));
|
|
29148
29310
|
break;
|
|
29149
29311
|
case "--cwd":
|
|
29150
|
-
cwd =
|
|
29312
|
+
cwd = requireValue14(rest, token);
|
|
29151
29313
|
break;
|
|
29152
29314
|
default:
|
|
29153
29315
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29177,10 +29339,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
29177
29339
|
const token = rest.shift();
|
|
29178
29340
|
switch (token) {
|
|
29179
29341
|
case "--account":
|
|
29180
|
-
account =
|
|
29342
|
+
account = requireValue14(rest, token);
|
|
29181
29343
|
break;
|
|
29182
29344
|
case "--cwd":
|
|
29183
|
-
cwd =
|
|
29345
|
+
cwd = requireValue14(rest, token);
|
|
29184
29346
|
break;
|
|
29185
29347
|
default:
|
|
29186
29348
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29204,16 +29366,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
29204
29366
|
const token = rest.shift();
|
|
29205
29367
|
switch (token) {
|
|
29206
29368
|
case "--account":
|
|
29207
|
-
account =
|
|
29369
|
+
account = requireValue14(rest, token);
|
|
29208
29370
|
break;
|
|
29209
29371
|
case "--team-id":
|
|
29210
|
-
teamId =
|
|
29372
|
+
teamId = requireValue14(rest, token);
|
|
29211
29373
|
break;
|
|
29212
29374
|
case "--team-key":
|
|
29213
|
-
teamKey =
|
|
29375
|
+
teamKey = requireValue14(rest, token);
|
|
29214
29376
|
break;
|
|
29215
29377
|
case "--cwd":
|
|
29216
|
-
cwd =
|
|
29378
|
+
cwd = requireValue14(rest, token);
|
|
29217
29379
|
break;
|
|
29218
29380
|
default:
|
|
29219
29381
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29236,10 +29398,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
29236
29398
|
const token = rest.shift();
|
|
29237
29399
|
switch (token) {
|
|
29238
29400
|
case "--account":
|
|
29239
|
-
account =
|
|
29401
|
+
account = requireValue14(rest, token);
|
|
29240
29402
|
break;
|
|
29241
29403
|
case "--cwd":
|
|
29242
|
-
cwd =
|
|
29404
|
+
cwd = requireValue14(rest, token);
|
|
29243
29405
|
break;
|
|
29244
29406
|
default:
|
|
29245
29407
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29266,16 +29428,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
29266
29428
|
const token = rest.shift();
|
|
29267
29429
|
switch (token) {
|
|
29268
29430
|
case "--account":
|
|
29269
|
-
account =
|
|
29431
|
+
account = requireValue14(rest, token);
|
|
29270
29432
|
break;
|
|
29271
29433
|
case "--cycle":
|
|
29272
|
-
cycle = parseLinearCycle(
|
|
29434
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29273
29435
|
break;
|
|
29274
29436
|
case "--status":
|
|
29275
|
-
status = parseLinearStatus(
|
|
29437
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29276
29438
|
break;
|
|
29277
29439
|
case "--cwd":
|
|
29278
|
-
cwd =
|
|
29440
|
+
cwd = requireValue14(rest, token);
|
|
29279
29441
|
break;
|
|
29280
29442
|
default:
|
|
29281
29443
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29309,28 +29471,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29309
29471
|
const token = rest.shift();
|
|
29310
29472
|
switch (token) {
|
|
29311
29473
|
case "--account":
|
|
29312
|
-
account =
|
|
29474
|
+
account = requireValue14(rest, token);
|
|
29313
29475
|
break;
|
|
29314
29476
|
case "--team-id":
|
|
29315
|
-
teamId =
|
|
29477
|
+
teamId = requireValue14(rest, token);
|
|
29316
29478
|
break;
|
|
29317
29479
|
case "--team-key":
|
|
29318
|
-
teamKey =
|
|
29480
|
+
teamKey = requireValue14(rest, token);
|
|
29319
29481
|
break;
|
|
29320
29482
|
case "--user":
|
|
29321
|
-
user =
|
|
29483
|
+
user = requireValue14(rest, token);
|
|
29322
29484
|
break;
|
|
29323
29485
|
case "--cycle":
|
|
29324
|
-
cycle = parseLinearCycle(
|
|
29486
|
+
cycle = parseLinearCycle(requireValue14(rest, token));
|
|
29325
29487
|
break;
|
|
29326
29488
|
case "--status":
|
|
29327
|
-
status = parseLinearStatus(
|
|
29489
|
+
status = parseLinearStatus(requireValue14(rest, token));
|
|
29328
29490
|
break;
|
|
29329
29491
|
case "--query":
|
|
29330
|
-
query =
|
|
29492
|
+
query = requireValue14(rest, token).trim();
|
|
29331
29493
|
break;
|
|
29332
29494
|
case "--limit": {
|
|
29333
|
-
const value = Number.parseInt(
|
|
29495
|
+
const value = Number.parseInt(requireValue14(rest, token), 10);
|
|
29334
29496
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
29335
29497
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
29336
29498
|
}
|
|
@@ -29338,7 +29500,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
29338
29500
|
break;
|
|
29339
29501
|
}
|
|
29340
29502
|
case "--cwd":
|
|
29341
|
-
cwd =
|
|
29503
|
+
cwd = requireValue14(rest, token);
|
|
29342
29504
|
break;
|
|
29343
29505
|
default:
|
|
29344
29506
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29379,10 +29541,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
29379
29541
|
useScreenshot = true;
|
|
29380
29542
|
break;
|
|
29381
29543
|
case "--account":
|
|
29382
|
-
account =
|
|
29544
|
+
account = requireValue14(rest, token);
|
|
29383
29545
|
break;
|
|
29384
29546
|
case "--cwd":
|
|
29385
|
-
cwd =
|
|
29547
|
+
cwd = requireValue14(rest, token);
|
|
29386
29548
|
break;
|
|
29387
29549
|
default:
|
|
29388
29550
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -29476,19 +29638,19 @@ function parseNotionArgs(tokens) {
|
|
|
29476
29638
|
const token = rest.shift();
|
|
29477
29639
|
switch (token) {
|
|
29478
29640
|
case "--parent":
|
|
29479
|
-
parentPageId =
|
|
29641
|
+
parentPageId = requireValue14(rest, token);
|
|
29480
29642
|
break;
|
|
29481
29643
|
case "--title":
|
|
29482
|
-
title =
|
|
29644
|
+
title = requireValue14(rest, token);
|
|
29483
29645
|
break;
|
|
29484
29646
|
case "--private":
|
|
29485
29647
|
isPrivate = true;
|
|
29486
29648
|
break;
|
|
29487
29649
|
case "--content":
|
|
29488
|
-
content2 =
|
|
29650
|
+
content2 = requireValue14(rest, token);
|
|
29489
29651
|
break;
|
|
29490
29652
|
case "--file":
|
|
29491
|
-
filePath2 =
|
|
29653
|
+
filePath2 = requireValue14(rest, token);
|
|
29492
29654
|
break;
|
|
29493
29655
|
default:
|
|
29494
29656
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -29532,10 +29694,10 @@ function parseNotionArgs(tokens) {
|
|
|
29532
29694
|
const token = rest.shift();
|
|
29533
29695
|
switch (token) {
|
|
29534
29696
|
case "--content":
|
|
29535
|
-
content =
|
|
29697
|
+
content = requireValue14(rest, token);
|
|
29536
29698
|
break;
|
|
29537
29699
|
case "--file":
|
|
29538
|
-
filePath =
|
|
29700
|
+
filePath = requireValue14(rest, token);
|
|
29539
29701
|
break;
|
|
29540
29702
|
case "--append":
|
|
29541
29703
|
append = true;
|
|
@@ -29580,11 +29742,11 @@ function parseRandomArgs(tokens) {
|
|
|
29580
29742
|
mode = "easy";
|
|
29581
29743
|
break;
|
|
29582
29744
|
case "--length":
|
|
29583
|
-
length = parsePositiveInt3(
|
|
29745
|
+
length = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29584
29746
|
seenLength = true;
|
|
29585
29747
|
break;
|
|
29586
29748
|
case "--charset": {
|
|
29587
|
-
const value =
|
|
29749
|
+
const value = requireValue14(rest, token);
|
|
29588
29750
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
29589
29751
|
throw new Error(
|
|
29590
29752
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -29595,18 +29757,18 @@ function parseRandomArgs(tokens) {
|
|
|
29595
29757
|
break;
|
|
29596
29758
|
}
|
|
29597
29759
|
case "--count":
|
|
29598
|
-
count = parsePositiveInt3(
|
|
29760
|
+
count = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29599
29761
|
break;
|
|
29600
29762
|
case "--words":
|
|
29601
|
-
words = parsePositiveInt3(
|
|
29763
|
+
words = parsePositiveInt3(requireValue14(rest, token), token);
|
|
29602
29764
|
seenWords = true;
|
|
29603
29765
|
break;
|
|
29604
29766
|
case "--digits":
|
|
29605
|
-
digits = parseNonNegativeInt(
|
|
29767
|
+
digits = parseNonNegativeInt(requireValue14(rest, token), token);
|
|
29606
29768
|
seenDigits = true;
|
|
29607
29769
|
break;
|
|
29608
29770
|
case "--separator":
|
|
29609
|
-
separator =
|
|
29771
|
+
separator = requireValue14(rest, token);
|
|
29610
29772
|
seenSeparator = true;
|
|
29611
29773
|
break;
|
|
29612
29774
|
default:
|
|
@@ -29637,7 +29799,7 @@ function parseRandomArgs(tokens) {
|
|
|
29637
29799
|
count
|
|
29638
29800
|
};
|
|
29639
29801
|
}
|
|
29640
|
-
function
|
|
29802
|
+
function requireValue14(tokens, optionName) {
|
|
29641
29803
|
const value = tokens.shift();
|
|
29642
29804
|
if (!value) {
|
|
29643
29805
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -29818,6 +29980,11 @@ async function main() {
|
|
|
29818
29980
|
await handler.handle(commandArgs);
|
|
29819
29981
|
return;
|
|
29820
29982
|
}
|
|
29983
|
+
case "host" /* Host */: {
|
|
29984
|
+
const handler = new HostCommandHandler();
|
|
29985
|
+
await handler.handle(commandArgs);
|
|
29986
|
+
return;
|
|
29987
|
+
}
|
|
29821
29988
|
case "vercel" /* Vercel */: {
|
|
29822
29989
|
const handler = new VercelCommandHandler();
|
|
29823
29990
|
await handler.handle(commandArgs);
|