@pmate/cli 0.21.1 → 0.21.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 +38 -1
- package/dist/index.js +585 -241
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12730,8 +12730,8 @@ __export(index_exports, {
|
|
|
12730
12730
|
parseCommandArgs: () => parseCommandArgs
|
|
12731
12731
|
});
|
|
12732
12732
|
module.exports = __toCommonJS(index_exports);
|
|
12733
|
-
var
|
|
12734
|
-
var
|
|
12733
|
+
var import_node_fs18 = require("fs");
|
|
12734
|
+
var import_node_path23 = __toESM(require("path"));
|
|
12735
12735
|
var import_chalk4 = __toESM(require("chalk"));
|
|
12736
12736
|
|
|
12737
12737
|
// src/cli.ts
|
|
@@ -17630,9 +17630,9 @@ ${indent}\`\`\``;
|
|
|
17630
17630
|
static richTextToPlain(richText) {
|
|
17631
17631
|
return richText.map((item) => item.plain_text ?? item.text?.content ?? "").join("").trim();
|
|
17632
17632
|
}
|
|
17633
|
-
static async requestJson(
|
|
17633
|
+
static async requestJson(path24, init) {
|
|
17634
17634
|
const token = this.getToken();
|
|
17635
|
-
const response = await fetch(`${this.baseUrl}${
|
|
17635
|
+
const response = await fetch(`${this.baseUrl}${path24}`, {
|
|
17636
17636
|
method: init.method,
|
|
17637
17637
|
headers: {
|
|
17638
17638
|
Authorization: `Bearer ${token}`,
|
|
@@ -19228,8 +19228,8 @@ function descriptorPathSegments(descriptor) {
|
|
|
19228
19228
|
return ["chains", normalized.chain, "namespaces", normalized.ns, normalized.kind, normalized.name];
|
|
19229
19229
|
}
|
|
19230
19230
|
function buildPathUrl(baseUrl, pathSegments, query) {
|
|
19231
|
-
const
|
|
19232
|
-
const url = new URL(
|
|
19231
|
+
const path24 = `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
19232
|
+
const url = new URL(path24, baseUrl);
|
|
19233
19233
|
if (query) {
|
|
19234
19234
|
for (const [key, value] of Object.entries(query)) {
|
|
19235
19235
|
url.searchParams.set(key, String(value));
|
|
@@ -19759,6 +19759,160 @@ var AgentCommandHandler = class {
|
|
|
19759
19759
|
}
|
|
19760
19760
|
};
|
|
19761
19761
|
|
|
19762
|
+
// src/commands/RunnerCommandHandler.ts
|
|
19763
|
+
var import_node_fs13 = require("fs");
|
|
19764
|
+
var import_node_path18 = __toESM(require("path"));
|
|
19765
|
+
init_sessionStore();
|
|
19766
|
+
init_namespacedRef();
|
|
19767
|
+
var RunnerCommandHandler = class {
|
|
19768
|
+
async handle(args) {
|
|
19769
|
+
const token = this.readToken();
|
|
19770
|
+
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
19771
|
+
switch (args.action) {
|
|
19772
|
+
case "list": {
|
|
19773
|
+
const items = (await this.request(
|
|
19774
|
+
baseUrl,
|
|
19775
|
+
token,
|
|
19776
|
+
"GET",
|
|
19777
|
+
args.namespace ? `/runners?namespace=${encodeURIComponent(args.namespace)}` : "/runners/all"
|
|
19778
|
+
)).items;
|
|
19779
|
+
this.renderList(items, args.json);
|
|
19780
|
+
return;
|
|
19781
|
+
}
|
|
19782
|
+
case "get":
|
|
19783
|
+
case "view": {
|
|
19784
|
+
const record = await this.request(
|
|
19785
|
+
baseUrl,
|
|
19786
|
+
token,
|
|
19787
|
+
"GET",
|
|
19788
|
+
`/runners/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
19789
|
+
);
|
|
19790
|
+
this.renderJson(record, true);
|
|
19791
|
+
return;
|
|
19792
|
+
}
|
|
19793
|
+
case "create": {
|
|
19794
|
+
await this.requireNamespace(args.namespace, baseUrl);
|
|
19795
|
+
const payload = this.readJsonFile(args.filePath);
|
|
19796
|
+
const record = await this.request(
|
|
19797
|
+
baseUrl,
|
|
19798
|
+
token,
|
|
19799
|
+
"POST",
|
|
19800
|
+
`/runners/${encodeURIComponent(args.namespace)}`,
|
|
19801
|
+
payload
|
|
19802
|
+
);
|
|
19803
|
+
ui.success(`Created runner ${record.id}`);
|
|
19804
|
+
this.renderJson(record, args.json);
|
|
19805
|
+
return;
|
|
19806
|
+
}
|
|
19807
|
+
case "update": {
|
|
19808
|
+
const payload = this.readJsonFile(args.filePath);
|
|
19809
|
+
const record = await this.request(
|
|
19810
|
+
baseUrl,
|
|
19811
|
+
token,
|
|
19812
|
+
"PUT",
|
|
19813
|
+
`/runners/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`,
|
|
19814
|
+
payload
|
|
19815
|
+
);
|
|
19816
|
+
ui.success(`Updated runner ${record.id}`);
|
|
19817
|
+
this.renderJson(record, args.json);
|
|
19818
|
+
return;
|
|
19819
|
+
}
|
|
19820
|
+
case "delete": {
|
|
19821
|
+
const record = await this.request(
|
|
19822
|
+
baseUrl,
|
|
19823
|
+
token,
|
|
19824
|
+
"DELETE",
|
|
19825
|
+
`/runners/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
19826
|
+
);
|
|
19827
|
+
ui.success(`Disabled runner ${record.id}`);
|
|
19828
|
+
this.renderJson(record, args.json);
|
|
19829
|
+
return;
|
|
19830
|
+
}
|
|
19831
|
+
}
|
|
19832
|
+
}
|
|
19833
|
+
resolveBaseUrl(baseUrl) {
|
|
19834
|
+
return (baseUrl || process.env.PMATE_AGENT_API_BASE_URL || "https://agent-api.pmate.chat").replace(/\/+$/, "");
|
|
19835
|
+
}
|
|
19836
|
+
async requireNamespace(namespace, registryBaseUrl) {
|
|
19837
|
+
const registry = new NamespaceRegistry({
|
|
19838
|
+
chain: "pmate",
|
|
19839
|
+
registryBaseUrl: this.resolveNamespaceBaseUrl(registryBaseUrl)
|
|
19840
|
+
});
|
|
19841
|
+
const exists = await registry.exists(namespace);
|
|
19842
|
+
if (!exists) {
|
|
19843
|
+
throw new Error(`Namespace "${namespace}" is not registered. Run: pmate ns create ${namespace}`);
|
|
19844
|
+
}
|
|
19845
|
+
}
|
|
19846
|
+
resolveNamespaceBaseUrl(baseUrl) {
|
|
19847
|
+
const envBaseUrl = process.env.PMATE_NAMESPACE_API_BASE_URL || process.env.PMATE_APPS_API_BASE_URL;
|
|
19848
|
+
if (envBaseUrl) {
|
|
19849
|
+
return envBaseUrl.replace(/\/+$/, "");
|
|
19850
|
+
}
|
|
19851
|
+
return baseUrl.includes("agent-api") || baseUrl.includes("agent.local") ? baseUrl.replace("agent-api", "apps-api").replace("agent.local", "apps.local") : baseUrl;
|
|
19852
|
+
}
|
|
19853
|
+
readToken() {
|
|
19854
|
+
return readRequiredSession({
|
|
19855
|
+
preferredApp: DEFAULT_APP_ID
|
|
19856
|
+
}).token;
|
|
19857
|
+
}
|
|
19858
|
+
readJsonFile(filePath) {
|
|
19859
|
+
const absolutePath = import_node_path18.default.resolve(process.cwd(), filePath);
|
|
19860
|
+
if (!(0, import_node_fs13.existsSync)(absolutePath)) {
|
|
19861
|
+
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
19862
|
+
}
|
|
19863
|
+
const raw = (0, import_node_fs13.readFileSync)(absolutePath, "utf8");
|
|
19864
|
+
try {
|
|
19865
|
+
return JSON.parse(raw);
|
|
19866
|
+
} catch (error) {
|
|
19867
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19868
|
+
throw new Error(`Invalid JSON in ${absolutePath}: ${message}`);
|
|
19869
|
+
}
|
|
19870
|
+
}
|
|
19871
|
+
async request(baseUrl, token, method, pathname, body) {
|
|
19872
|
+
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
19873
|
+
method,
|
|
19874
|
+
headers: {
|
|
19875
|
+
Authorization: `Bearer ${token}`,
|
|
19876
|
+
"Content-Type": "application/json"
|
|
19877
|
+
},
|
|
19878
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
19879
|
+
});
|
|
19880
|
+
let payload = null;
|
|
19881
|
+
try {
|
|
19882
|
+
payload = await response.json();
|
|
19883
|
+
} catch {
|
|
19884
|
+
payload = null;
|
|
19885
|
+
}
|
|
19886
|
+
if (!response.ok || !payload?.success) {
|
|
19887
|
+
throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
19888
|
+
}
|
|
19889
|
+
return payload.data;
|
|
19890
|
+
}
|
|
19891
|
+
renderList(items, asJson) {
|
|
19892
|
+
if (asJson) {
|
|
19893
|
+
ui.plain(JSON.stringify(items, null, 2));
|
|
19894
|
+
return;
|
|
19895
|
+
}
|
|
19896
|
+
if (items.length === 0) {
|
|
19897
|
+
ui.warn("No runners found.");
|
|
19898
|
+
return;
|
|
19899
|
+
}
|
|
19900
|
+
for (const item of items) {
|
|
19901
|
+
ui.info(formatNamespacedDisplayId(item.namespace, item.name), {
|
|
19902
|
+
status: item.status,
|
|
19903
|
+
runtime: item.payload.runtime,
|
|
19904
|
+
listen: item.payload.listen
|
|
19905
|
+
});
|
|
19906
|
+
}
|
|
19907
|
+
}
|
|
19908
|
+
renderJson(value, asJson) {
|
|
19909
|
+
if (!asJson) {
|
|
19910
|
+
return;
|
|
19911
|
+
}
|
|
19912
|
+
ui.plain(JSON.stringify(value, null, 2));
|
|
19913
|
+
}
|
|
19914
|
+
};
|
|
19915
|
+
|
|
19762
19916
|
// src/commands/NsCommandHandler.ts
|
|
19763
19917
|
init_sessionStore();
|
|
19764
19918
|
var NsCommandHandler = class {
|
|
@@ -19825,8 +19979,8 @@ var NsCommandHandler = class {
|
|
|
19825
19979
|
};
|
|
19826
19980
|
|
|
19827
19981
|
// src/commands/StoreCommandHandler.ts
|
|
19828
|
-
var
|
|
19829
|
-
var
|
|
19982
|
+
var import_node_fs14 = require("fs");
|
|
19983
|
+
var import_node_path19 = __toESM(require("path"));
|
|
19830
19984
|
var StoreCommandHandler = class {
|
|
19831
19985
|
async handle(args) {
|
|
19832
19986
|
if (args.scope === "namespace") {
|
|
@@ -19968,11 +20122,11 @@ var StoreCommandHandler = class {
|
|
|
19968
20122
|
return payload.data ?? [];
|
|
19969
20123
|
}
|
|
19970
20124
|
readJsonFile(filePath) {
|
|
19971
|
-
const absolutePath =
|
|
19972
|
-
if (!(0,
|
|
20125
|
+
const absolutePath = import_node_path19.default.resolve(process.cwd(), filePath);
|
|
20126
|
+
if (!(0, import_node_fs14.existsSync)(absolutePath)) {
|
|
19973
20127
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
19974
20128
|
}
|
|
19975
|
-
const raw = (0,
|
|
20129
|
+
const raw = (0, import_node_fs14.readFileSync)(absolutePath, "utf8");
|
|
19976
20130
|
try {
|
|
19977
20131
|
return JSON.parse(raw);
|
|
19978
20132
|
} catch (error) {
|
|
@@ -20024,8 +20178,8 @@ var StoreCommandHandler = class {
|
|
|
20024
20178
|
};
|
|
20025
20179
|
|
|
20026
20180
|
// src/commands/AppCommandHandler.ts
|
|
20027
|
-
var
|
|
20028
|
-
var
|
|
20181
|
+
var import_node_fs15 = require("fs");
|
|
20182
|
+
var import_node_path20 = __toESM(require("path"));
|
|
20029
20183
|
init_sessionStore();
|
|
20030
20184
|
init_namespacedRef();
|
|
20031
20185
|
var AppCommandHandler = class {
|
|
@@ -20142,11 +20296,11 @@ var AppCommandHandler = class {
|
|
|
20142
20296
|
}).token;
|
|
20143
20297
|
}
|
|
20144
20298
|
readJsonFile(filePath) {
|
|
20145
|
-
const absolutePath =
|
|
20146
|
-
if (!(0,
|
|
20299
|
+
const absolutePath = import_node_path20.default.resolve(process.cwd(), filePath);
|
|
20300
|
+
if (!(0, import_node_fs15.existsSync)(absolutePath)) {
|
|
20147
20301
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
20148
20302
|
}
|
|
20149
|
-
const raw = (0,
|
|
20303
|
+
const raw = (0, import_node_fs15.readFileSync)(absolutePath, "utf8");
|
|
20150
20304
|
try {
|
|
20151
20305
|
return JSON.parse(raw);
|
|
20152
20306
|
} catch (error) {
|
|
@@ -20226,13 +20380,13 @@ function readNamespaceFromPayload(payload) {
|
|
|
20226
20380
|
}
|
|
20227
20381
|
|
|
20228
20382
|
// src/commands/ServiceCommandHandler.ts
|
|
20229
|
-
var
|
|
20230
|
-
var
|
|
20383
|
+
var import_node_fs17 = require("fs");
|
|
20384
|
+
var import_node_path22 = __toESM(require("path"));
|
|
20231
20385
|
|
|
20232
20386
|
// src/services/ServiceRuntimeRunner.ts
|
|
20233
|
-
var
|
|
20387
|
+
var import_node_fs16 = require("fs");
|
|
20234
20388
|
var import_node_os7 = __toESM(require("os"));
|
|
20235
|
-
var
|
|
20389
|
+
var import_node_path21 = __toESM(require("path"));
|
|
20236
20390
|
var import_node_child_process9 = require("child_process");
|
|
20237
20391
|
var import_node_readline = require("readline");
|
|
20238
20392
|
var import_chalk3 = __toESM(require("chalk"));
|
|
@@ -20345,14 +20499,14 @@ var ServiceRuntimeRunner = class {
|
|
|
20345
20499
|
}
|
|
20346
20500
|
resolveRepoRoot(service, cwd) {
|
|
20347
20501
|
if (cwd) {
|
|
20348
|
-
return
|
|
20502
|
+
return import_node_path21.default.resolve(process.cwd(), cwd);
|
|
20349
20503
|
}
|
|
20350
20504
|
const repository = this.getDeploy(service).repository?.trim();
|
|
20351
20505
|
if (repository) {
|
|
20352
20506
|
const repoName = repository.replace(/\/+$/, "").split("/").pop()?.replace(/\.git$/i, "");
|
|
20353
20507
|
if (repoName) {
|
|
20354
|
-
const candidate =
|
|
20355
|
-
if ((0,
|
|
20508
|
+
const candidate = import_node_path21.default.join(import_node_os7.default.homedir(), "dev", "pmate", repoName);
|
|
20509
|
+
if ((0, import_node_fs16.existsSync)(candidate)) {
|
|
20356
20510
|
return candidate;
|
|
20357
20511
|
}
|
|
20358
20512
|
}
|
|
@@ -20365,12 +20519,12 @@ var ServiceRuntimeRunner = class {
|
|
|
20365
20519
|
if (!dir) {
|
|
20366
20520
|
throw new Error(`Missing deploy.dir for ${service.id}`);
|
|
20367
20521
|
}
|
|
20368
|
-
return
|
|
20522
|
+
return import_node_path21.default.resolve(repoRoot, dir);
|
|
20369
20523
|
}
|
|
20370
20524
|
async deployVite(service, options) {
|
|
20371
20525
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
20372
|
-
const packageJsonPath =
|
|
20373
|
-
if (!(0,
|
|
20526
|
+
const packageJsonPath = import_node_path21.default.join(appDir, "package.json");
|
|
20527
|
+
if (!(0, import_node_fs16.existsSync)(packageJsonPath)) {
|
|
20374
20528
|
throw new Error(`No package.json found at ${packageJsonPath}`);
|
|
20375
20529
|
}
|
|
20376
20530
|
const pkg2 = this.loadPackageJson(packageJsonPath);
|
|
@@ -20379,8 +20533,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20379
20533
|
throw new Error(`Missing package name in ${packageJsonPath}`);
|
|
20380
20534
|
}
|
|
20381
20535
|
await this.runCommand("pnpm", ["--filter", pkgName, "build"], this.resolveRepoRoot(service, options.cwd));
|
|
20382
|
-
const distDir =
|
|
20383
|
-
if (!(0,
|
|
20536
|
+
const distDir = import_node_path21.default.join(appDir, "dist");
|
|
20537
|
+
if (!(0, import_node_fs16.existsSync)(distDir)) {
|
|
20384
20538
|
throw new Error(`No dist directory found at ${distDir}`);
|
|
20385
20539
|
}
|
|
20386
20540
|
const bucketName = this.getDeploy(service).bucket?.trim();
|
|
@@ -20391,8 +20545,8 @@ var ServiceRuntimeRunner = class {
|
|
|
20391
20545
|
}
|
|
20392
20546
|
async deployStatic(service, options) {
|
|
20393
20547
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
20394
|
-
const srcDir =
|
|
20395
|
-
if (!(0,
|
|
20548
|
+
const srcDir = import_node_path21.default.join(appDir, "src");
|
|
20549
|
+
if (!(0, import_node_fs16.existsSync)(srcDir)) {
|
|
20396
20550
|
throw new Error(`No src directory found at ${srcDir}`);
|
|
20397
20551
|
}
|
|
20398
20552
|
const bucketName = this.getDeploy(service).bucket?.trim();
|
|
@@ -20510,7 +20664,7 @@ var ServiceRuntimeRunner = class {
|
|
|
20510
20664
|
const serverAddress = await resolveServerAddress(server);
|
|
20511
20665
|
const templateName = serviceType === "ws" ? "nginx.ws.template" : "nginx.rest.template";
|
|
20512
20666
|
const templatePath = this.resolveTemplatePath(templateName);
|
|
20513
|
-
const template = (0,
|
|
20667
|
+
const template = (0, import_node_fs16.readFileSync)(templatePath, "utf8");
|
|
20514
20668
|
const host = `${subdomain}.${deploy.domain?.trim() || "pmate.chat"}`;
|
|
20515
20669
|
const rendered = template.replace(/\$\{\{PORT\}\}/g, String(port)).replace(/\$\{\{HOSTS\}\}/g, host).replace(/\$\{\{HOST\}\}/g, host);
|
|
20516
20670
|
const remotePath = `/etc/nginx/sites-enabled/${subdomain}.conf`;
|
|
@@ -20542,11 +20696,11 @@ var ServiceRuntimeRunner = class {
|
|
|
20542
20696
|
}
|
|
20543
20697
|
if (config.ensurePackageJson) {
|
|
20544
20698
|
const appDir = this.resolveLocalDir(service, options.cwd);
|
|
20545
|
-
const packageJsonPath =
|
|
20546
|
-
if (!(0,
|
|
20699
|
+
const packageJsonPath = import_node_path21.default.join(appDir, "package.json");
|
|
20700
|
+
if (!(0, import_node_fs16.existsSync)(packageJsonPath)) {
|
|
20547
20701
|
throw new Error(`Missing package.json at ${packageJsonPath}`);
|
|
20548
20702
|
}
|
|
20549
|
-
const pkgStat = (0,
|
|
20703
|
+
const pkgStat = (0, import_node_fs16.statSync)(packageJsonPath);
|
|
20550
20704
|
if (!pkgStat.isFile()) {
|
|
20551
20705
|
throw new Error(`package.json is not a file at ${packageJsonPath}`);
|
|
20552
20706
|
}
|
|
@@ -20969,9 +21123,9 @@ var ServiceRuntimeRunner = class {
|
|
|
20969
21123
|
return tokens;
|
|
20970
21124
|
}
|
|
20971
21125
|
readPathValue(source, pathExpr) {
|
|
20972
|
-
const
|
|
21126
|
+
const path24 = pathExpr.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
20973
21127
|
let cursor = source;
|
|
20974
|
-
for (const segment of
|
|
21128
|
+
for (const segment of path24) {
|
|
20975
21129
|
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
20976
21130
|
return void 0;
|
|
20977
21131
|
}
|
|
@@ -21014,12 +21168,12 @@ var ServiceRuntimeRunner = class {
|
|
|
21014
21168
|
}
|
|
21015
21169
|
resolveTemplatePath(templateName) {
|
|
21016
21170
|
const candidates = [
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21171
|
+
import_node_path21.default.join(__dirname, "..", "templates", templateName),
|
|
21172
|
+
import_node_path21.default.join(__dirname, "..", "src", "templates", templateName),
|
|
21173
|
+
import_node_path21.default.join(__dirname, "templates", templateName)
|
|
21020
21174
|
];
|
|
21021
21175
|
for (const candidate of candidates) {
|
|
21022
|
-
if ((0,
|
|
21176
|
+
if ((0, import_node_fs16.existsSync)(candidate)) {
|
|
21023
21177
|
return candidate;
|
|
21024
21178
|
}
|
|
21025
21179
|
}
|
|
@@ -21051,7 +21205,7 @@ var ServiceRuntimeRunner = class {
|
|
|
21051
21205
|
});
|
|
21052
21206
|
}
|
|
21053
21207
|
loadPackageJson(packageJsonPath) {
|
|
21054
|
-
const raw = (0,
|
|
21208
|
+
const raw = (0, import_node_fs16.readFileSync)(packageJsonPath, "utf8");
|
|
21055
21209
|
const parsed = JSON.parse(raw);
|
|
21056
21210
|
if (!parsed || typeof parsed !== "object") {
|
|
21057
21211
|
throw new Error(`Invalid package.json at ${packageJsonPath}`);
|
|
@@ -21060,7 +21214,7 @@ var ServiceRuntimeRunner = class {
|
|
|
21060
21214
|
}
|
|
21061
21215
|
writePackageJson(packageJsonPath, data) {
|
|
21062
21216
|
const serialized = JSON.stringify(data, null, 2);
|
|
21063
|
-
(0,
|
|
21217
|
+
(0, import_node_fs16.writeFileSync)(packageJsonPath, `${serialized}
|
|
21064
21218
|
`, "utf8");
|
|
21065
21219
|
}
|
|
21066
21220
|
runCommand(command, args, cwd) {
|
|
@@ -21328,11 +21482,11 @@ var ServiceCommandHandler = class {
|
|
|
21328
21482
|
return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
21329
21483
|
}
|
|
21330
21484
|
readJsonFile(filePath) {
|
|
21331
|
-
const absolutePath =
|
|
21332
|
-
if (!(0,
|
|
21485
|
+
const absolutePath = import_node_path22.default.resolve(process.cwd(), filePath);
|
|
21486
|
+
if (!(0, import_node_fs17.existsSync)(absolutePath)) {
|
|
21333
21487
|
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
21334
21488
|
}
|
|
21335
|
-
const raw = (0,
|
|
21489
|
+
const raw = (0, import_node_fs17.readFileSync)(absolutePath, "utf8");
|
|
21336
21490
|
try {
|
|
21337
21491
|
return JSON.parse(raw);
|
|
21338
21492
|
} catch (error) {
|
|
@@ -22121,6 +22275,180 @@ function parseJsonObject(value, optionName) {
|
|
|
22121
22275
|
return parsed;
|
|
22122
22276
|
}
|
|
22123
22277
|
|
|
22278
|
+
// src/runnerCommandParser.ts
|
|
22279
|
+
init_namespacedRef();
|
|
22280
|
+
var DEFAULT_RUNNER_NAMESPACE = "pmate";
|
|
22281
|
+
function parseRunnerArgs(tokens) {
|
|
22282
|
+
const rest = [...tokens];
|
|
22283
|
+
const rawAction = rest.shift();
|
|
22284
|
+
const action = rawAction === "view" ? "view" : rawAction;
|
|
22285
|
+
if (!action) {
|
|
22286
|
+
throw new Error("Missing runner action. Use: runner list|get|view|create|update|delete");
|
|
22287
|
+
}
|
|
22288
|
+
let baseUrl;
|
|
22289
|
+
let json = false;
|
|
22290
|
+
const takeSharedOptions4 = () => {
|
|
22291
|
+
while (rest.length > 0) {
|
|
22292
|
+
const token = rest[0];
|
|
22293
|
+
if (token === "--base-url") {
|
|
22294
|
+
rest.shift();
|
|
22295
|
+
baseUrl = requireValue2(rest, token);
|
|
22296
|
+
continue;
|
|
22297
|
+
}
|
|
22298
|
+
if (token === "--json") {
|
|
22299
|
+
rest.shift();
|
|
22300
|
+
json = true;
|
|
22301
|
+
continue;
|
|
22302
|
+
}
|
|
22303
|
+
break;
|
|
22304
|
+
}
|
|
22305
|
+
};
|
|
22306
|
+
if (action === "list") {
|
|
22307
|
+
let namespace;
|
|
22308
|
+
while (rest.length > 0) {
|
|
22309
|
+
const token = rest.shift();
|
|
22310
|
+
switch (token) {
|
|
22311
|
+
case "--ns":
|
|
22312
|
+
case "--namespace":
|
|
22313
|
+
namespace = requireValue2(rest, token);
|
|
22314
|
+
break;
|
|
22315
|
+
case "--base-url":
|
|
22316
|
+
baseUrl = requireValue2(rest, token);
|
|
22317
|
+
break;
|
|
22318
|
+
case "--json":
|
|
22319
|
+
json = true;
|
|
22320
|
+
break;
|
|
22321
|
+
default:
|
|
22322
|
+
throw new Error(`Unknown runner list option: ${token}`);
|
|
22323
|
+
}
|
|
22324
|
+
}
|
|
22325
|
+
return { type: "runner" /* Runner */, action, namespace, baseUrl, json };
|
|
22326
|
+
}
|
|
22327
|
+
if (action === "view") {
|
|
22328
|
+
const ref = rest.shift();
|
|
22329
|
+
if (!ref) {
|
|
22330
|
+
throw new Error("Usage: runner view <ns:objectId> [--base-url <url>]");
|
|
22331
|
+
}
|
|
22332
|
+
while (rest.length > 0) {
|
|
22333
|
+
const token = rest.shift();
|
|
22334
|
+
switch (token) {
|
|
22335
|
+
case "--base-url":
|
|
22336
|
+
baseUrl = requireValue2(rest, token);
|
|
22337
|
+
break;
|
|
22338
|
+
default:
|
|
22339
|
+
throw new Error(`Unknown runner view option: ${token}`);
|
|
22340
|
+
}
|
|
22341
|
+
}
|
|
22342
|
+
const parsed = parseNamespacedRef(ref, {
|
|
22343
|
+
entityLabel: "runner ref"
|
|
22344
|
+
});
|
|
22345
|
+
return {
|
|
22346
|
+
type: "runner" /* Runner */,
|
|
22347
|
+
action,
|
|
22348
|
+
namespace: parsed.namespace,
|
|
22349
|
+
name: parsed.objectId,
|
|
22350
|
+
baseUrl,
|
|
22351
|
+
json
|
|
22352
|
+
};
|
|
22353
|
+
}
|
|
22354
|
+
if (action === "get" || action === "delete") {
|
|
22355
|
+
const ref = rest.shift();
|
|
22356
|
+
if (!ref) {
|
|
22357
|
+
throw new Error(
|
|
22358
|
+
`Usage: runner ${action} <ns:objectId> [--base-url <url>] [--json]`
|
|
22359
|
+
);
|
|
22360
|
+
}
|
|
22361
|
+
const parsed = parseNamespacedRef(ref, {
|
|
22362
|
+
entityLabel: "runner ref"
|
|
22363
|
+
});
|
|
22364
|
+
takeSharedOptions4();
|
|
22365
|
+
if (rest.length > 0) {
|
|
22366
|
+
throw new Error(`Unknown runner ${action} option: ${rest[0]}`);
|
|
22367
|
+
}
|
|
22368
|
+
return {
|
|
22369
|
+
type: "runner" /* Runner */,
|
|
22370
|
+
action,
|
|
22371
|
+
namespace: parsed.namespace,
|
|
22372
|
+
name: parsed.objectId,
|
|
22373
|
+
baseUrl,
|
|
22374
|
+
json
|
|
22375
|
+
};
|
|
22376
|
+
}
|
|
22377
|
+
if (action === "create") {
|
|
22378
|
+
let namespace = DEFAULT_RUNNER_NAMESPACE;
|
|
22379
|
+
if (rest[0] && !rest[0].startsWith("-")) {
|
|
22380
|
+
namespace = rest.shift();
|
|
22381
|
+
}
|
|
22382
|
+
let filePath;
|
|
22383
|
+
while (rest.length > 0) {
|
|
22384
|
+
const token = rest.shift();
|
|
22385
|
+
switch (token) {
|
|
22386
|
+
case "--file":
|
|
22387
|
+
filePath = requireValue2(rest, token);
|
|
22388
|
+
break;
|
|
22389
|
+
case "--base-url":
|
|
22390
|
+
baseUrl = requireValue2(rest, token);
|
|
22391
|
+
break;
|
|
22392
|
+
case "--json":
|
|
22393
|
+
json = true;
|
|
22394
|
+
break;
|
|
22395
|
+
default:
|
|
22396
|
+
throw new Error(`Unknown runner create option: ${token}`);
|
|
22397
|
+
}
|
|
22398
|
+
}
|
|
22399
|
+
if (!filePath) {
|
|
22400
|
+
throw new Error("Missing required option --file for runner create");
|
|
22401
|
+
}
|
|
22402
|
+
return { type: "runner" /* Runner */, action, namespace, filePath, baseUrl, json };
|
|
22403
|
+
}
|
|
22404
|
+
if (action === "update") {
|
|
22405
|
+
const ref = rest.shift();
|
|
22406
|
+
if (!ref) {
|
|
22407
|
+
throw new Error(
|
|
22408
|
+
"Usage: runner update <ns:objectId> --file <path> [--base-url <url>] [--json]"
|
|
22409
|
+
);
|
|
22410
|
+
}
|
|
22411
|
+
const parsed = parseNamespacedRef(ref, { entityLabel: "runner ref" });
|
|
22412
|
+
let filePath;
|
|
22413
|
+
while (rest.length > 0) {
|
|
22414
|
+
const token = rest.shift();
|
|
22415
|
+
switch (token) {
|
|
22416
|
+
case "--file":
|
|
22417
|
+
filePath = requireValue2(rest, token);
|
|
22418
|
+
break;
|
|
22419
|
+
case "--base-url":
|
|
22420
|
+
baseUrl = requireValue2(rest, token);
|
|
22421
|
+
break;
|
|
22422
|
+
case "--json":
|
|
22423
|
+
json = true;
|
|
22424
|
+
break;
|
|
22425
|
+
default:
|
|
22426
|
+
throw new Error(`Unknown runner update option: ${token}`);
|
|
22427
|
+
}
|
|
22428
|
+
}
|
|
22429
|
+
if (!filePath) {
|
|
22430
|
+
throw new Error("Missing required option --file for runner update");
|
|
22431
|
+
}
|
|
22432
|
+
return {
|
|
22433
|
+
type: "runner" /* Runner */,
|
|
22434
|
+
action,
|
|
22435
|
+
namespace: parsed.namespace,
|
|
22436
|
+
name: parsed.objectId,
|
|
22437
|
+
filePath,
|
|
22438
|
+
baseUrl,
|
|
22439
|
+
json
|
|
22440
|
+
};
|
|
22441
|
+
}
|
|
22442
|
+
throw new Error(`Unknown runner action: ${action}`);
|
|
22443
|
+
}
|
|
22444
|
+
function requireValue2(tokens, optionName) {
|
|
22445
|
+
const value = tokens.shift();
|
|
22446
|
+
if (!value || value.startsWith("-")) {
|
|
22447
|
+
throw new Error(`Missing value for ${optionName}`);
|
|
22448
|
+
}
|
|
22449
|
+
return value;
|
|
22450
|
+
}
|
|
22451
|
+
|
|
22124
22452
|
// src/nsCommandParser.ts
|
|
22125
22453
|
var DEFAULT_CHAIN = "pmate";
|
|
22126
22454
|
function parseNsArgs(tokens) {
|
|
@@ -22171,10 +22499,10 @@ function takeSharedOptions(rest, handlers) {
|
|
|
22171
22499
|
const token = rest.shift();
|
|
22172
22500
|
switch (token) {
|
|
22173
22501
|
case "--chain":
|
|
22174
|
-
handlers.onChain(
|
|
22502
|
+
handlers.onChain(requireValue3(rest, token));
|
|
22175
22503
|
break;
|
|
22176
22504
|
case "--base-url":
|
|
22177
|
-
handlers.onBaseUrl(
|
|
22505
|
+
handlers.onBaseUrl(requireValue3(rest, token));
|
|
22178
22506
|
break;
|
|
22179
22507
|
case "--json":
|
|
22180
22508
|
handlers.onJson();
|
|
@@ -22184,7 +22512,7 @@ function takeSharedOptions(rest, handlers) {
|
|
|
22184
22512
|
}
|
|
22185
22513
|
}
|
|
22186
22514
|
}
|
|
22187
|
-
function
|
|
22515
|
+
function requireValue3(tokens, optionName) {
|
|
22188
22516
|
const value = tokens.shift();
|
|
22189
22517
|
if (!value || value.startsWith("-")) {
|
|
22190
22518
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -22246,7 +22574,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
22246
22574
|
const token = rest.shift();
|
|
22247
22575
|
switch (token) {
|
|
22248
22576
|
case "--page":
|
|
22249
|
-
page = parsePage(
|
|
22577
|
+
page = parsePage(requireValue4(rest, token));
|
|
22250
22578
|
break;
|
|
22251
22579
|
default:
|
|
22252
22580
|
pushSharedOption(token, rest, shared);
|
|
@@ -22260,7 +22588,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
22260
22588
|
const token = rest.shift();
|
|
22261
22589
|
switch (token) {
|
|
22262
22590
|
case "--id":
|
|
22263
|
-
id =
|
|
22591
|
+
id = requireValue4(rest, token);
|
|
22264
22592
|
break;
|
|
22265
22593
|
default:
|
|
22266
22594
|
pushSharedOption(token, rest, shared);
|
|
@@ -22277,7 +22605,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
22277
22605
|
const token = rest.shift();
|
|
22278
22606
|
switch (token) {
|
|
22279
22607
|
case "--file":
|
|
22280
|
-
filePath =
|
|
22608
|
+
filePath = requireValue4(rest, token);
|
|
22281
22609
|
break;
|
|
22282
22610
|
default:
|
|
22283
22611
|
pushSharedOption(token, rest, shared);
|
|
@@ -22301,7 +22629,7 @@ function parseKvArgs(action, rest, shared) {
|
|
|
22301
22629
|
const token = rest.shift();
|
|
22302
22630
|
switch (token) {
|
|
22303
22631
|
case "--page":
|
|
22304
|
-
page = parsePage(
|
|
22632
|
+
page = parsePage(requireValue4(rest, token));
|
|
22305
22633
|
break;
|
|
22306
22634
|
default:
|
|
22307
22635
|
pushSharedOption(token, rest, shared);
|
|
@@ -22315,7 +22643,7 @@ function parseKvArgs(action, rest, shared) {
|
|
|
22315
22643
|
const token = rest.shift();
|
|
22316
22644
|
switch (token) {
|
|
22317
22645
|
case "--key":
|
|
22318
|
-
key =
|
|
22646
|
+
key = requireValue4(rest, token);
|
|
22319
22647
|
break;
|
|
22320
22648
|
default:
|
|
22321
22649
|
pushSharedOption(token, rest, shared);
|
|
@@ -22334,13 +22662,13 @@ function parseKvArgs(action, rest, shared) {
|
|
|
22334
22662
|
const token = rest.shift();
|
|
22335
22663
|
switch (token) {
|
|
22336
22664
|
case "--key":
|
|
22337
|
-
key =
|
|
22665
|
+
key = requireValue4(rest, token);
|
|
22338
22666
|
break;
|
|
22339
22667
|
case "--value":
|
|
22340
|
-
value =
|
|
22668
|
+
value = requireValue4(rest, token);
|
|
22341
22669
|
break;
|
|
22342
22670
|
case "--file":
|
|
22343
|
-
filePath =
|
|
22671
|
+
filePath = requireValue4(rest, token);
|
|
22344
22672
|
break;
|
|
22345
22673
|
default:
|
|
22346
22674
|
pushSharedOption(token, rest, shared);
|
|
@@ -22365,17 +22693,17 @@ function takeSharedOptions2(rest, shared) {
|
|
|
22365
22693
|
function pushSharedOption(token, rest, shared) {
|
|
22366
22694
|
switch (token) {
|
|
22367
22695
|
case "--chain":
|
|
22368
|
-
shared.chain =
|
|
22696
|
+
shared.chain = requireValue4(rest, token);
|
|
22369
22697
|
break;
|
|
22370
22698
|
case "--ns":
|
|
22371
22699
|
case "--namespace":
|
|
22372
|
-
shared.namespace =
|
|
22700
|
+
shared.namespace = requireValue4(rest, token);
|
|
22373
22701
|
break;
|
|
22374
22702
|
case "--base-url":
|
|
22375
|
-
shared.baseUrl =
|
|
22703
|
+
shared.baseUrl = requireValue4(rest, token);
|
|
22376
22704
|
break;
|
|
22377
22705
|
case "--indexer-base-url":
|
|
22378
|
-
shared.indexerBaseUrl =
|
|
22706
|
+
shared.indexerBaseUrl = requireValue4(rest, token);
|
|
22379
22707
|
break;
|
|
22380
22708
|
case "--json":
|
|
22381
22709
|
shared.json = true;
|
|
@@ -22384,7 +22712,7 @@ function pushSharedOption(token, rest, shared) {
|
|
|
22384
22712
|
throw new Error(`Unknown store option: ${token}`);
|
|
22385
22713
|
}
|
|
22386
22714
|
}
|
|
22387
|
-
function
|
|
22715
|
+
function requireValue4(tokens, optionName) {
|
|
22388
22716
|
const value = tokens.shift();
|
|
22389
22717
|
if (!value || value.startsWith("-")) {
|
|
22390
22718
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -22415,7 +22743,7 @@ function parseAppArgs(tokens) {
|
|
|
22415
22743
|
const token = rest[0];
|
|
22416
22744
|
if (token === "--base-url") {
|
|
22417
22745
|
rest.shift();
|
|
22418
|
-
baseUrl =
|
|
22746
|
+
baseUrl = requireValue5(rest, token);
|
|
22419
22747
|
continue;
|
|
22420
22748
|
}
|
|
22421
22749
|
if (token === "--json") {
|
|
@@ -22433,10 +22761,10 @@ function parseAppArgs(tokens) {
|
|
|
22433
22761
|
switch (token) {
|
|
22434
22762
|
case "--ns":
|
|
22435
22763
|
case "--namespace":
|
|
22436
|
-
namespace =
|
|
22764
|
+
namespace = requireValue5(rest, token);
|
|
22437
22765
|
break;
|
|
22438
22766
|
case "--base-url":
|
|
22439
|
-
baseUrl =
|
|
22767
|
+
baseUrl = requireValue5(rest, token);
|
|
22440
22768
|
break;
|
|
22441
22769
|
case "--json":
|
|
22442
22770
|
json = true;
|
|
@@ -22461,7 +22789,7 @@ function parseAppArgs(tokens) {
|
|
|
22461
22789
|
const token = rest.shift();
|
|
22462
22790
|
switch (token) {
|
|
22463
22791
|
case "--base-url":
|
|
22464
|
-
baseUrl =
|
|
22792
|
+
baseUrl = requireValue5(rest, token);
|
|
22465
22793
|
break;
|
|
22466
22794
|
default:
|
|
22467
22795
|
throw new Error(`Unknown app view option: ${token}`);
|
|
@@ -22491,10 +22819,10 @@ function parseAppArgs(tokens) {
|
|
|
22491
22819
|
const token = rest.shift();
|
|
22492
22820
|
switch (token) {
|
|
22493
22821
|
case "--file":
|
|
22494
|
-
filePath =
|
|
22822
|
+
filePath = requireValue5(rest, token);
|
|
22495
22823
|
break;
|
|
22496
22824
|
case "--base-url":
|
|
22497
|
-
baseUrl =
|
|
22825
|
+
baseUrl = requireValue5(rest, token);
|
|
22498
22826
|
break;
|
|
22499
22827
|
case "--json":
|
|
22500
22828
|
json = true;
|
|
@@ -22521,10 +22849,10 @@ function parseAppArgs(tokens) {
|
|
|
22521
22849
|
const token = rest.shift();
|
|
22522
22850
|
switch (token) {
|
|
22523
22851
|
case "--file":
|
|
22524
|
-
filePath =
|
|
22852
|
+
filePath = requireValue5(rest, token);
|
|
22525
22853
|
break;
|
|
22526
22854
|
case "--base-url":
|
|
22527
|
-
baseUrl =
|
|
22855
|
+
baseUrl = requireValue5(rest, token);
|
|
22528
22856
|
break;
|
|
22529
22857
|
case "--json":
|
|
22530
22858
|
json = true;
|
|
@@ -22547,16 +22875,16 @@ function parseAppArgs(tokens) {
|
|
|
22547
22875
|
switch (token) {
|
|
22548
22876
|
case "--ns":
|
|
22549
22877
|
case "--namespace":
|
|
22550
|
-
namespace =
|
|
22878
|
+
namespace = requireValue5(rest, token);
|
|
22551
22879
|
break;
|
|
22552
22880
|
case "--from":
|
|
22553
|
-
fromId = parseBareRenameId2(
|
|
22881
|
+
fromId = parseBareRenameId2(requireValue5(rest, token), "app");
|
|
22554
22882
|
break;
|
|
22555
22883
|
case "--to":
|
|
22556
|
-
toId = parseBareRenameId2(
|
|
22884
|
+
toId = parseBareRenameId2(requireValue5(rest, token), "app");
|
|
22557
22885
|
break;
|
|
22558
22886
|
case "--base-url":
|
|
22559
|
-
baseUrl =
|
|
22887
|
+
baseUrl = requireValue5(rest, token);
|
|
22560
22888
|
break;
|
|
22561
22889
|
case "--json":
|
|
22562
22890
|
json = true;
|
|
@@ -22582,20 +22910,20 @@ function parseAppArgs(tokens) {
|
|
|
22582
22910
|
switch (token) {
|
|
22583
22911
|
case "--ns":
|
|
22584
22912
|
case "--namespace":
|
|
22585
|
-
namespace =
|
|
22913
|
+
namespace = requireValue5(rest, token);
|
|
22586
22914
|
break;
|
|
22587
22915
|
case "--from":
|
|
22588
|
-
fromId = parseBareRenameId2(
|
|
22916
|
+
fromId = parseBareRenameId2(requireValue5(rest, token), "app");
|
|
22589
22917
|
break;
|
|
22590
22918
|
case "--to-ns":
|
|
22591
22919
|
case "--target-namespace":
|
|
22592
|
-
targetNamespace =
|
|
22920
|
+
targetNamespace = requireValue5(rest, token);
|
|
22593
22921
|
break;
|
|
22594
22922
|
case "--to":
|
|
22595
|
-
toId = parseBareRenameId2(
|
|
22923
|
+
toId = parseBareRenameId2(requireValue5(rest, token), "app");
|
|
22596
22924
|
break;
|
|
22597
22925
|
case "--base-url":
|
|
22598
|
-
baseUrl =
|
|
22926
|
+
baseUrl = requireValue5(rest, token);
|
|
22599
22927
|
break;
|
|
22600
22928
|
case "--json":
|
|
22601
22929
|
json = true;
|
|
@@ -22613,7 +22941,7 @@ function parseAppArgs(tokens) {
|
|
|
22613
22941
|
}
|
|
22614
22942
|
throw new Error(`Unknown app action: ${action}`);
|
|
22615
22943
|
}
|
|
22616
|
-
function
|
|
22944
|
+
function requireValue5(tokens, optionName) {
|
|
22617
22945
|
const value = tokens.shift();
|
|
22618
22946
|
if (!value || value.startsWith("-")) {
|
|
22619
22947
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -22647,16 +22975,16 @@ function parseServiceArgs(tokens) {
|
|
|
22647
22975
|
const token = rest.shift();
|
|
22648
22976
|
switch (token) {
|
|
22649
22977
|
case "--namespace":
|
|
22650
|
-
namespace =
|
|
22978
|
+
namespace = requireValue6(rest, token);
|
|
22651
22979
|
break;
|
|
22652
22980
|
case "--repo":
|
|
22653
|
-
repository =
|
|
22981
|
+
repository = requireValue6(rest, token);
|
|
22654
22982
|
break;
|
|
22655
22983
|
case "--server":
|
|
22656
|
-
server =
|
|
22984
|
+
server = requireValue6(rest, token);
|
|
22657
22985
|
break;
|
|
22658
22986
|
case "--base-url":
|
|
22659
|
-
baseUrl =
|
|
22987
|
+
baseUrl = requireValue6(rest, token);
|
|
22660
22988
|
break;
|
|
22661
22989
|
case "--json":
|
|
22662
22990
|
json = true;
|
|
@@ -22676,7 +23004,7 @@ function parseServiceArgs(tokens) {
|
|
|
22676
23004
|
const token = rest.shift();
|
|
22677
23005
|
switch (token) {
|
|
22678
23006
|
case "--base-url":
|
|
22679
|
-
baseUrl =
|
|
23007
|
+
baseUrl = requireValue6(rest, token);
|
|
22680
23008
|
break;
|
|
22681
23009
|
default:
|
|
22682
23010
|
throw new Error(`Unknown service view option: ${token}`);
|
|
@@ -22706,19 +23034,19 @@ function parseServiceArgs(tokens) {
|
|
|
22706
23034
|
const token = rest.shift();
|
|
22707
23035
|
switch (token) {
|
|
22708
23036
|
case "--base-url":
|
|
22709
|
-
baseUrl =
|
|
23037
|
+
baseUrl = requireValue6(rest, token);
|
|
22710
23038
|
break;
|
|
22711
23039
|
case "--cwd":
|
|
22712
|
-
cwd =
|
|
23040
|
+
cwd = requireValue6(rest, token);
|
|
22713
23041
|
break;
|
|
22714
23042
|
case "--page":
|
|
22715
|
-
page = Number.parseInt(
|
|
23043
|
+
page = Number.parseInt(requireValue6(rest, token), 10);
|
|
22716
23044
|
break;
|
|
22717
23045
|
case "--history":
|
|
22718
23046
|
history = true;
|
|
22719
23047
|
break;
|
|
22720
23048
|
case "--search":
|
|
22721
|
-
search =
|
|
23049
|
+
search = requireValue6(rest, token);
|
|
22722
23050
|
break;
|
|
22723
23051
|
case "--follow":
|
|
22724
23052
|
case "-f":
|
|
@@ -22748,10 +23076,10 @@ function parseServiceArgs(tokens) {
|
|
|
22748
23076
|
const token = rest.shift();
|
|
22749
23077
|
switch (token) {
|
|
22750
23078
|
case "--file":
|
|
22751
|
-
filePath =
|
|
23079
|
+
filePath = requireValue6(rest, token);
|
|
22752
23080
|
break;
|
|
22753
23081
|
case "--base-url":
|
|
22754
|
-
baseUrl =
|
|
23082
|
+
baseUrl = requireValue6(rest, token);
|
|
22755
23083
|
break;
|
|
22756
23084
|
case "--json":
|
|
22757
23085
|
json = true;
|
|
@@ -22780,10 +23108,10 @@ function parseServiceArgs(tokens) {
|
|
|
22780
23108
|
const token = rest.shift();
|
|
22781
23109
|
switch (token) {
|
|
22782
23110
|
case "--file":
|
|
22783
|
-
filePath =
|
|
23111
|
+
filePath = requireValue6(rest, token);
|
|
22784
23112
|
break;
|
|
22785
23113
|
case "--base-url":
|
|
22786
|
-
baseUrl =
|
|
23114
|
+
baseUrl = requireValue6(rest, token);
|
|
22787
23115
|
break;
|
|
22788
23116
|
case "--json":
|
|
22789
23117
|
json = true;
|
|
@@ -22806,16 +23134,16 @@ function parseServiceArgs(tokens) {
|
|
|
22806
23134
|
switch (token) {
|
|
22807
23135
|
case "--ns":
|
|
22808
23136
|
case "--namespace":
|
|
22809
|
-
namespace =
|
|
23137
|
+
namespace = requireValue6(rest, token);
|
|
22810
23138
|
break;
|
|
22811
23139
|
case "--from":
|
|
22812
|
-
from = parseBareRenameId3(
|
|
23140
|
+
from = parseBareRenameId3(requireValue6(rest, token), "service");
|
|
22813
23141
|
break;
|
|
22814
23142
|
case "--to":
|
|
22815
|
-
to = parseBareRenameId3(
|
|
23143
|
+
to = parseBareRenameId3(requireValue6(rest, token), "service");
|
|
22816
23144
|
break;
|
|
22817
23145
|
case "--base-url":
|
|
22818
|
-
baseUrl =
|
|
23146
|
+
baseUrl = requireValue6(rest, token);
|
|
22819
23147
|
break;
|
|
22820
23148
|
case "--json":
|
|
22821
23149
|
json = true;
|
|
@@ -22849,20 +23177,20 @@ function parseServiceArgs(tokens) {
|
|
|
22849
23177
|
switch (token) {
|
|
22850
23178
|
case "--ns":
|
|
22851
23179
|
case "--namespace":
|
|
22852
|
-
namespace =
|
|
23180
|
+
namespace = requireValue6(rest, token);
|
|
22853
23181
|
break;
|
|
22854
23182
|
case "--from":
|
|
22855
|
-
from = parseBareRenameId3(
|
|
23183
|
+
from = parseBareRenameId3(requireValue6(rest, token), "service");
|
|
22856
23184
|
break;
|
|
22857
23185
|
case "--to-ns":
|
|
22858
23186
|
case "--target-namespace":
|
|
22859
|
-
targetNamespace =
|
|
23187
|
+
targetNamespace = requireValue6(rest, token);
|
|
22860
23188
|
break;
|
|
22861
23189
|
case "--to":
|
|
22862
|
-
to = parseBareRenameId3(
|
|
23190
|
+
to = parseBareRenameId3(requireValue6(rest, token), "service");
|
|
22863
23191
|
break;
|
|
22864
23192
|
case "--base-url":
|
|
22865
|
-
baseUrl =
|
|
23193
|
+
baseUrl = requireValue6(rest, token);
|
|
22866
23194
|
break;
|
|
22867
23195
|
case "--json":
|
|
22868
23196
|
json = true;
|
|
@@ -22889,7 +23217,7 @@ function parseServiceArgs(tokens) {
|
|
|
22889
23217
|
}
|
|
22890
23218
|
throw new Error(`Unknown service action: ${action}`);
|
|
22891
23219
|
}
|
|
22892
|
-
function
|
|
23220
|
+
function requireValue6(tokens, optionName) {
|
|
22893
23221
|
const value = tokens.shift();
|
|
22894
23222
|
if (!value || value.startsWith("-")) {
|
|
22895
23223
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -22947,13 +23275,13 @@ function parseRoleArgs(tokens) {
|
|
|
22947
23275
|
const token = rest.shift();
|
|
22948
23276
|
switch (token) {
|
|
22949
23277
|
case "--display-name":
|
|
22950
|
-
displayName =
|
|
23278
|
+
displayName = requireValue7(rest, token);
|
|
22951
23279
|
break;
|
|
22952
23280
|
case "--description":
|
|
22953
|
-
description =
|
|
23281
|
+
description = requireValue7(rest, token);
|
|
22954
23282
|
break;
|
|
22955
23283
|
case "--base-url":
|
|
22956
|
-
baseUrl =
|
|
23284
|
+
baseUrl = requireValue7(rest, token);
|
|
22957
23285
|
break;
|
|
22958
23286
|
case "--json":
|
|
22959
23287
|
json = true;
|
|
@@ -22980,7 +23308,7 @@ function takeSharedOptions3(rest, handlers) {
|
|
|
22980
23308
|
const token = rest.shift();
|
|
22981
23309
|
switch (token) {
|
|
22982
23310
|
case "--base-url":
|
|
22983
|
-
handlers.onBaseUrl(
|
|
23311
|
+
handlers.onBaseUrl(requireValue7(rest, token));
|
|
22984
23312
|
break;
|
|
22985
23313
|
case "--json":
|
|
22986
23314
|
handlers.onJson();
|
|
@@ -22990,7 +23318,7 @@ function takeSharedOptions3(rest, handlers) {
|
|
|
22990
23318
|
}
|
|
22991
23319
|
}
|
|
22992
23320
|
}
|
|
22993
|
-
function
|
|
23321
|
+
function requireValue7(tokens, optionName) {
|
|
22994
23322
|
const value = tokens.shift();
|
|
22995
23323
|
if (!value || value.startsWith("-")) {
|
|
22996
23324
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -23017,17 +23345,17 @@ function parseAccountArgs(tokens) {
|
|
|
23017
23345
|
case void 0:
|
|
23018
23346
|
break;
|
|
23019
23347
|
case "--account":
|
|
23020
|
-
account2 =
|
|
23348
|
+
account2 = requireValue8(rest, token);
|
|
23021
23349
|
break;
|
|
23022
23350
|
case "--mobile":
|
|
23023
|
-
mobile =
|
|
23351
|
+
mobile = requireValue8(rest, token);
|
|
23024
23352
|
break;
|
|
23025
23353
|
case "--nickname":
|
|
23026
23354
|
case "--nickName":
|
|
23027
|
-
nickName =
|
|
23355
|
+
nickName = requireValue8(rest, token);
|
|
23028
23356
|
break;
|
|
23029
23357
|
case "--base-url":
|
|
23030
|
-
baseUrl2 =
|
|
23358
|
+
baseUrl2 = requireValue8(rest, token);
|
|
23031
23359
|
break;
|
|
23032
23360
|
case "--json":
|
|
23033
23361
|
json2 = true;
|
|
@@ -23072,16 +23400,16 @@ function parseAccountArgs(tokens) {
|
|
|
23072
23400
|
const token = rest.shift();
|
|
23073
23401
|
switch (token) {
|
|
23074
23402
|
case "--account":
|
|
23075
|
-
account =
|
|
23403
|
+
account = requireValue8(rest, token);
|
|
23076
23404
|
break;
|
|
23077
23405
|
case "--namespace":
|
|
23078
|
-
namespace =
|
|
23406
|
+
namespace = requireValue8(rest, token);
|
|
23079
23407
|
break;
|
|
23080
23408
|
case "--role":
|
|
23081
|
-
role =
|
|
23409
|
+
role = requireValue8(rest, token);
|
|
23082
23410
|
break;
|
|
23083
23411
|
case "--base-url":
|
|
23084
|
-
baseUrl =
|
|
23412
|
+
baseUrl = requireValue8(rest, token);
|
|
23085
23413
|
break;
|
|
23086
23414
|
case "--json":
|
|
23087
23415
|
json = true;
|
|
@@ -23123,7 +23451,7 @@ function parseAccountArgs(tokens) {
|
|
|
23123
23451
|
}
|
|
23124
23452
|
throw new Error(`Unknown account role action: ${roleAction}`);
|
|
23125
23453
|
}
|
|
23126
|
-
function
|
|
23454
|
+
function requireValue8(tokens, optionName) {
|
|
23127
23455
|
const value = tokens.shift();
|
|
23128
23456
|
if (!value || value.startsWith("-")) {
|
|
23129
23457
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -23149,7 +23477,7 @@ function parseCollectArgs(tokens) {
|
|
|
23149
23477
|
const token = rest.shift();
|
|
23150
23478
|
switch (token) {
|
|
23151
23479
|
case "--source": {
|
|
23152
|
-
const value =
|
|
23480
|
+
const value = requireValue9(rest, token);
|
|
23153
23481
|
if (value !== "cc" && value !== "yelling") {
|
|
23154
23482
|
throw new Error(`Unsupported collect source: ${value}`);
|
|
23155
23483
|
}
|
|
@@ -23157,7 +23485,7 @@ function parseCollectArgs(tokens) {
|
|
|
23157
23485
|
break;
|
|
23158
23486
|
}
|
|
23159
23487
|
case "--endpoint":
|
|
23160
|
-
options.endpoint =
|
|
23488
|
+
options.endpoint = requireValue9(rest, token);
|
|
23161
23489
|
break;
|
|
23162
23490
|
default:
|
|
23163
23491
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -23173,7 +23501,7 @@ function parseCollectArgs(tokens) {
|
|
|
23173
23501
|
}
|
|
23174
23502
|
return { type: "collect" /* Collect */, ...options };
|
|
23175
23503
|
}
|
|
23176
|
-
function
|
|
23504
|
+
function requireValue9(tokens, optionName) {
|
|
23177
23505
|
const value = tokens.shift();
|
|
23178
23506
|
if (!value) {
|
|
23179
23507
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -23183,7 +23511,7 @@ function requireValue8(tokens, optionName) {
|
|
|
23183
23511
|
|
|
23184
23512
|
// src/index.ts
|
|
23185
23513
|
var pkg = JSON.parse(
|
|
23186
|
-
(0,
|
|
23514
|
+
(0, import_node_fs18.readFileSync)(import_node_path23.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
23187
23515
|
);
|
|
23188
23516
|
var HELP_TEXT = [
|
|
23189
23517
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -23275,6 +23603,14 @@ var HELP_TEXT = [
|
|
|
23275
23603
|
` ${import_chalk4.default.gray(" call <ns:objectId> [--payload <json>] [--file <path>] [--base-url <url>] [--hub-base-url <url>] [--from <id>] [--json]")}`,
|
|
23276
23604
|
` ${import_chalk4.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
23277
23605
|
` ${import_chalk4.default.gray(" list defaults to all namespaces; create defaults to namespace: pmate; default base URL: https://agent-api.pmate.chat; call uses pmate:cli session and default hub: https://hub.pmate.chat")}`,
|
|
23606
|
+
` ${import_chalk4.default.cyan("runner")} Manage runner registry entries via agent-api`,
|
|
23607
|
+
` ${import_chalk4.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
|
|
23608
|
+
` ${import_chalk4.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
23609
|
+
` ${import_chalk4.default.gray(" view <ns:objectId> [--base-url <url>]")}`,
|
|
23610
|
+
` ${import_chalk4.default.gray(" create [<namespace>] --file <path> [--base-url <url>] [--json]")}`,
|
|
23611
|
+
` ${import_chalk4.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
23612
|
+
` ${import_chalk4.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
23613
|
+
` ${import_chalk4.default.gray(" list defaults to all namespaces; create defaults to namespace: pmate; default base URL: https://agent-api.pmate.chat")}`,
|
|
23278
23614
|
` ${import_chalk4.default.cyan("ns")} Manage registered namespaces`,
|
|
23279
23615
|
` ${import_chalk4.default.gray(" list [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
23280
23616
|
` ${import_chalk4.default.gray(" get <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
@@ -23377,7 +23713,7 @@ function parseCommandArgs(args) {
|
|
|
23377
23713
|
const token = rest.shift();
|
|
23378
23714
|
switch (token) {
|
|
23379
23715
|
case "--app":
|
|
23380
|
-
app =
|
|
23716
|
+
app = requireValue10(rest, token);
|
|
23381
23717
|
break;
|
|
23382
23718
|
default:
|
|
23383
23719
|
throw new Error(`Unknown login option: ${token}`);
|
|
@@ -23439,6 +23775,9 @@ function parseCommandArgs(args) {
|
|
|
23439
23775
|
if (args.rest[0] === "agent") {
|
|
23440
23776
|
return parseAgentArgs(args.rest.slice(1));
|
|
23441
23777
|
}
|
|
23778
|
+
if (args.rest[0] === "runner") {
|
|
23779
|
+
return parseRunnerArgs(args.rest.slice(1));
|
|
23780
|
+
}
|
|
23442
23781
|
if (args.rest[0] === "ns" || args.rest[0] === "namespace") {
|
|
23443
23782
|
return parseNsArgs(args.rest.slice(1));
|
|
23444
23783
|
}
|
|
@@ -23474,7 +23813,7 @@ function parseVercelArgs(tokens) {
|
|
|
23474
23813
|
const token = rest.shift();
|
|
23475
23814
|
switch (token) {
|
|
23476
23815
|
case "--scope":
|
|
23477
|
-
scope =
|
|
23816
|
+
scope = requireValue10(rest, token);
|
|
23478
23817
|
break;
|
|
23479
23818
|
default:
|
|
23480
23819
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -23494,10 +23833,10 @@ function parseVercelArgs(tokens) {
|
|
|
23494
23833
|
const token = rest.shift();
|
|
23495
23834
|
switch (token) {
|
|
23496
23835
|
case "--scope":
|
|
23497
|
-
scope =
|
|
23836
|
+
scope = requireValue10(rest, token);
|
|
23498
23837
|
break;
|
|
23499
23838
|
case "--project":
|
|
23500
|
-
project =
|
|
23839
|
+
project = requireValue10(rest, token);
|
|
23501
23840
|
break;
|
|
23502
23841
|
case "--last-week":
|
|
23503
23842
|
lastWeek = true;
|
|
@@ -23528,16 +23867,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
23528
23867
|
const token = rest.shift();
|
|
23529
23868
|
switch (token) {
|
|
23530
23869
|
case "--type":
|
|
23531
|
-
options.dnsType =
|
|
23870
|
+
options.dnsType = requireValue10(rest, token);
|
|
23532
23871
|
break;
|
|
23533
23872
|
case "--value":
|
|
23534
|
-
options.dnsValue =
|
|
23873
|
+
options.dnsValue = requireValue10(rest, token);
|
|
23535
23874
|
break;
|
|
23536
23875
|
case "--rr":
|
|
23537
|
-
options.dnsRr =
|
|
23876
|
+
options.dnsRr = requireValue10(rest, token);
|
|
23538
23877
|
break;
|
|
23539
23878
|
case "--ttl": {
|
|
23540
|
-
const ttlValue =
|
|
23879
|
+
const ttlValue = requireValue10(rest, token);
|
|
23541
23880
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
23542
23881
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
23543
23882
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -23546,7 +23885,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
23546
23885
|
break;
|
|
23547
23886
|
}
|
|
23548
23887
|
case "--domain":
|
|
23549
|
-
options.dnsDomain =
|
|
23888
|
+
options.dnsDomain = requireValue10(rest, token);
|
|
23550
23889
|
break;
|
|
23551
23890
|
default:
|
|
23552
23891
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -23579,13 +23918,13 @@ function parseBucketArgs(tokens) {
|
|
|
23579
23918
|
options.bucketCreate = true;
|
|
23580
23919
|
break;
|
|
23581
23920
|
case "--name":
|
|
23582
|
-
options.bucketName =
|
|
23921
|
+
options.bucketName = requireValue10(rest, token);
|
|
23583
23922
|
break;
|
|
23584
23923
|
case "--subdomain":
|
|
23585
|
-
options.bucketSubdomain =
|
|
23924
|
+
options.bucketSubdomain = requireValue10(rest, token);
|
|
23586
23925
|
break;
|
|
23587
23926
|
case "--domain":
|
|
23588
|
-
options.bucketDomain =
|
|
23927
|
+
options.bucketDomain = requireValue10(rest, token);
|
|
23589
23928
|
break;
|
|
23590
23929
|
default:
|
|
23591
23930
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -23617,7 +23956,7 @@ function parseDevArgs(tokens) {
|
|
|
23617
23956
|
const token = rest.shift();
|
|
23618
23957
|
switch (token) {
|
|
23619
23958
|
case "--cwd":
|
|
23620
|
-
options.devCwd =
|
|
23959
|
+
options.devCwd = requireValue10(rest, token);
|
|
23621
23960
|
break;
|
|
23622
23961
|
default:
|
|
23623
23962
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -23637,7 +23976,7 @@ function parseDeleteArgs(tokens) {
|
|
|
23637
23976
|
const token = rest.shift();
|
|
23638
23977
|
switch (token) {
|
|
23639
23978
|
case "--cwd":
|
|
23640
|
-
deleteCwd =
|
|
23979
|
+
deleteCwd = requireValue10(rest, token);
|
|
23641
23980
|
break;
|
|
23642
23981
|
default:
|
|
23643
23982
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -23671,13 +24010,13 @@ function parseOssArgs(tokens) {
|
|
|
23671
24010
|
const token = rest.shift();
|
|
23672
24011
|
switch (token) {
|
|
23673
24012
|
case "--bucket":
|
|
23674
|
-
bucket =
|
|
24013
|
+
bucket = requireValue10(rest, token);
|
|
23675
24014
|
break;
|
|
23676
24015
|
case "--file":
|
|
23677
|
-
filePath =
|
|
24016
|
+
filePath = requireValue10(rest, token);
|
|
23678
24017
|
break;
|
|
23679
24018
|
case "--key":
|
|
23680
|
-
objectKey =
|
|
24019
|
+
objectKey = requireValue10(rest, token);
|
|
23681
24020
|
break;
|
|
23682
24021
|
default:
|
|
23683
24022
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -23710,7 +24049,7 @@ function parseEnvArgs(tokens) {
|
|
|
23710
24049
|
throw new Error("Only one env action is allowed.");
|
|
23711
24050
|
}
|
|
23712
24051
|
action = "set";
|
|
23713
|
-
key =
|
|
24052
|
+
key = requireValue10(rest, token);
|
|
23714
24053
|
break;
|
|
23715
24054
|
case "--list":
|
|
23716
24055
|
if (action) {
|
|
@@ -23723,17 +24062,17 @@ function parseEnvArgs(tokens) {
|
|
|
23723
24062
|
throw new Error("Only one env action is allowed.");
|
|
23724
24063
|
}
|
|
23725
24064
|
action = "delete";
|
|
23726
|
-
key =
|
|
24065
|
+
key = requireValue10(rest, token);
|
|
23727
24066
|
break;
|
|
23728
24067
|
case "--value":
|
|
23729
|
-
value =
|
|
24068
|
+
value = requireValue10(rest, token);
|
|
23730
24069
|
break;
|
|
23731
24070
|
case "--verbose":
|
|
23732
24071
|
case "-v":
|
|
23733
24072
|
verbose = true;
|
|
23734
24073
|
break;
|
|
23735
24074
|
case "--cwd":
|
|
23736
|
-
cwd =
|
|
24075
|
+
cwd = requireValue10(rest, token);
|
|
23737
24076
|
break;
|
|
23738
24077
|
default:
|
|
23739
24078
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -23791,7 +24130,7 @@ function parseCommitArgs(tokens) {
|
|
|
23791
24130
|
push = true;
|
|
23792
24131
|
break;
|
|
23793
24132
|
case "--cwd":
|
|
23794
|
-
cwd =
|
|
24133
|
+
cwd = requireValue10(rest, token);
|
|
23795
24134
|
break;
|
|
23796
24135
|
default:
|
|
23797
24136
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -23807,10 +24146,10 @@ function parseSummaryArgs(tokens) {
|
|
|
23807
24146
|
const token = rest.shift();
|
|
23808
24147
|
switch (token) {
|
|
23809
24148
|
case "--pr":
|
|
23810
|
-
prRef =
|
|
24149
|
+
prRef = requireValue10(rest, token);
|
|
23811
24150
|
break;
|
|
23812
24151
|
case "--cwd":
|
|
23813
|
-
cwd =
|
|
24152
|
+
cwd = requireValue10(rest, token);
|
|
23814
24153
|
break;
|
|
23815
24154
|
default:
|
|
23816
24155
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -23835,13 +24174,13 @@ function parseQuizArgs(tokens) {
|
|
|
23835
24174
|
const token = rest.shift();
|
|
23836
24175
|
switch (token) {
|
|
23837
24176
|
case "--paper-id":
|
|
23838
|
-
paperId =
|
|
24177
|
+
paperId = requireValue10(rest, token);
|
|
23839
24178
|
break;
|
|
23840
24179
|
case "--base-url":
|
|
23841
|
-
apiBaseUrl =
|
|
24180
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
23842
24181
|
break;
|
|
23843
24182
|
case "--link-base":
|
|
23844
|
-
linkBaseUrl =
|
|
24183
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
23845
24184
|
break;
|
|
23846
24185
|
default:
|
|
23847
24186
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -23867,16 +24206,16 @@ function parseQuizArgs(tokens) {
|
|
|
23867
24206
|
const token = rest.shift();
|
|
23868
24207
|
switch (token) {
|
|
23869
24208
|
case "--paper-id":
|
|
23870
|
-
paperId =
|
|
24209
|
+
paperId = requireValue10(rest, token);
|
|
23871
24210
|
break;
|
|
23872
24211
|
case "--file":
|
|
23873
|
-
filePath =
|
|
24212
|
+
filePath = requireValue10(rest, token);
|
|
23874
24213
|
break;
|
|
23875
24214
|
case "--base-url":
|
|
23876
|
-
apiBaseUrl =
|
|
24215
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
23877
24216
|
break;
|
|
23878
24217
|
case "--link-base":
|
|
23879
|
-
linkBaseUrl =
|
|
24218
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
23880
24219
|
break;
|
|
23881
24220
|
default:
|
|
23882
24221
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -23906,16 +24245,16 @@ function parseQuizArgs(tokens) {
|
|
|
23906
24245
|
const token = rest.shift();
|
|
23907
24246
|
switch (token) {
|
|
23908
24247
|
case "--paper-id":
|
|
23909
|
-
paperId =
|
|
24248
|
+
paperId = requireValue10(rest, token);
|
|
23910
24249
|
break;
|
|
23911
24250
|
case "--file":
|
|
23912
|
-
filePath =
|
|
24251
|
+
filePath = requireValue10(rest, token);
|
|
23913
24252
|
break;
|
|
23914
24253
|
case "--base-url":
|
|
23915
|
-
apiBaseUrl =
|
|
24254
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
23916
24255
|
break;
|
|
23917
24256
|
case "--link-base":
|
|
23918
|
-
linkBaseUrl =
|
|
24257
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
23919
24258
|
break;
|
|
23920
24259
|
default:
|
|
23921
24260
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -23946,19 +24285,19 @@ function parseQuizArgs(tokens) {
|
|
|
23946
24285
|
const token = rest.shift();
|
|
23947
24286
|
switch (token) {
|
|
23948
24287
|
case "--paper-id":
|
|
23949
|
-
paperId =
|
|
24288
|
+
paperId = requireValue10(rest, token);
|
|
23950
24289
|
break;
|
|
23951
24290
|
case "--step-id":
|
|
23952
|
-
stepId =
|
|
24291
|
+
stepId = requireValue10(rest, token);
|
|
23953
24292
|
break;
|
|
23954
24293
|
case "--file":
|
|
23955
|
-
filePath =
|
|
24294
|
+
filePath = requireValue10(rest, token);
|
|
23956
24295
|
break;
|
|
23957
24296
|
case "--base-url":
|
|
23958
|
-
apiBaseUrl =
|
|
24297
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
23959
24298
|
break;
|
|
23960
24299
|
case "--link-base":
|
|
23961
|
-
linkBaseUrl =
|
|
24300
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
23962
24301
|
break;
|
|
23963
24302
|
default:
|
|
23964
24303
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -23992,16 +24331,16 @@ function parseQuizArgs(tokens) {
|
|
|
23992
24331
|
const token = rest.shift();
|
|
23993
24332
|
switch (token) {
|
|
23994
24333
|
case "--paper-id":
|
|
23995
|
-
paperId =
|
|
24334
|
+
paperId = requireValue10(rest, token);
|
|
23996
24335
|
break;
|
|
23997
24336
|
case "--step-ids":
|
|
23998
|
-
stepIdsRaw =
|
|
24337
|
+
stepIdsRaw = requireValue10(rest, token);
|
|
23999
24338
|
break;
|
|
24000
24339
|
case "--base-url":
|
|
24001
|
-
apiBaseUrl =
|
|
24340
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
24002
24341
|
break;
|
|
24003
24342
|
case "--link-base":
|
|
24004
|
-
linkBaseUrl =
|
|
24343
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
24005
24344
|
break;
|
|
24006
24345
|
default:
|
|
24007
24346
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -24034,13 +24373,13 @@ function parseQuizArgs(tokens) {
|
|
|
24034
24373
|
const token = rest.shift();
|
|
24035
24374
|
switch (token) {
|
|
24036
24375
|
case "--paper-id":
|
|
24037
|
-
paperId =
|
|
24376
|
+
paperId = requireValue10(rest, token);
|
|
24038
24377
|
break;
|
|
24039
24378
|
case "--base-url":
|
|
24040
|
-
apiBaseUrl =
|
|
24379
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
24041
24380
|
break;
|
|
24042
24381
|
case "--link-base":
|
|
24043
|
-
linkBaseUrl =
|
|
24382
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
24044
24383
|
break;
|
|
24045
24384
|
default:
|
|
24046
24385
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -24065,13 +24404,13 @@ function parseQuizArgs(tokens) {
|
|
|
24065
24404
|
const token = rest.shift();
|
|
24066
24405
|
switch (token) {
|
|
24067
24406
|
case "--paper-id":
|
|
24068
|
-
paperId =
|
|
24407
|
+
paperId = requireValue10(rest, token);
|
|
24069
24408
|
break;
|
|
24070
24409
|
case "--base-url":
|
|
24071
|
-
apiBaseUrl =
|
|
24410
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
24072
24411
|
break;
|
|
24073
24412
|
case "--link-base":
|
|
24074
|
-
linkBaseUrl =
|
|
24413
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
24075
24414
|
break;
|
|
24076
24415
|
default:
|
|
24077
24416
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -24100,22 +24439,22 @@ function parseQuizArgs(tokens) {
|
|
|
24100
24439
|
const token = rest.shift();
|
|
24101
24440
|
switch (token) {
|
|
24102
24441
|
case "--paper-id":
|
|
24103
|
-
paperId =
|
|
24442
|
+
paperId = requireValue10(rest, token);
|
|
24104
24443
|
break;
|
|
24105
24444
|
case "--step-id":
|
|
24106
|
-
stepId =
|
|
24445
|
+
stepId = requireValue10(rest, token);
|
|
24107
24446
|
break;
|
|
24108
24447
|
case "--file":
|
|
24109
|
-
filePath =
|
|
24448
|
+
filePath = requireValue10(rest, token);
|
|
24110
24449
|
break;
|
|
24111
24450
|
case "--new-paper-id":
|
|
24112
|
-
newPaperId =
|
|
24451
|
+
newPaperId = requireValue10(rest, token);
|
|
24113
24452
|
break;
|
|
24114
24453
|
case "--base-url":
|
|
24115
|
-
apiBaseUrl =
|
|
24454
|
+
apiBaseUrl = requireValue10(rest, token);
|
|
24116
24455
|
break;
|
|
24117
24456
|
case "--link-base":
|
|
24118
|
-
linkBaseUrl =
|
|
24457
|
+
linkBaseUrl = requireValue10(rest, token);
|
|
24119
24458
|
break;
|
|
24120
24459
|
case "--activate":
|
|
24121
24460
|
activate = true;
|
|
@@ -24205,10 +24544,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
24205
24544
|
const token = rest.shift();
|
|
24206
24545
|
switch (token) {
|
|
24207
24546
|
case "--account":
|
|
24208
|
-
account =
|
|
24547
|
+
account = requireValue10(rest, token);
|
|
24209
24548
|
break;
|
|
24210
24549
|
case "--cwd":
|
|
24211
|
-
cwd =
|
|
24550
|
+
cwd = requireValue10(rest, token);
|
|
24212
24551
|
break;
|
|
24213
24552
|
default:
|
|
24214
24553
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24237,35 +24576,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
24237
24576
|
const token = rest.shift();
|
|
24238
24577
|
switch (token) {
|
|
24239
24578
|
case "--account":
|
|
24240
|
-
account =
|
|
24579
|
+
account = requireValue10(rest, token);
|
|
24241
24580
|
break;
|
|
24242
24581
|
case "--repl":
|
|
24243
24582
|
useRepl = true;
|
|
24244
24583
|
break;
|
|
24245
24584
|
case "--title":
|
|
24246
|
-
title =
|
|
24585
|
+
title = requireValue10(rest, token);
|
|
24247
24586
|
break;
|
|
24248
24587
|
case "--desc":
|
|
24249
24588
|
case "--description":
|
|
24250
|
-
description = decodeEscapedNewlines(
|
|
24589
|
+
description = decodeEscapedNewlines(requireValue10(rest, token));
|
|
24251
24590
|
break;
|
|
24252
24591
|
case "--team-id":
|
|
24253
|
-
teamId =
|
|
24592
|
+
teamId = requireValue10(rest, token);
|
|
24254
24593
|
break;
|
|
24255
24594
|
case "--team-key":
|
|
24256
|
-
teamKey =
|
|
24595
|
+
teamKey = requireValue10(rest, token);
|
|
24257
24596
|
break;
|
|
24258
24597
|
case "--priority":
|
|
24259
|
-
priority = parseLinearPriority(
|
|
24598
|
+
priority = parseLinearPriority(requireValue10(rest, token));
|
|
24260
24599
|
break;
|
|
24261
24600
|
case "--parent-id":
|
|
24262
|
-
parentId =
|
|
24601
|
+
parentId = requireValue10(rest, token);
|
|
24263
24602
|
break;
|
|
24264
24603
|
case "--state-id":
|
|
24265
|
-
stateId =
|
|
24604
|
+
stateId = requireValue10(rest, token);
|
|
24266
24605
|
break;
|
|
24267
24606
|
case "--cwd":
|
|
24268
|
-
cwd =
|
|
24607
|
+
cwd = requireValue10(rest, token);
|
|
24269
24608
|
break;
|
|
24270
24609
|
default:
|
|
24271
24610
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24300,10 +24639,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
24300
24639
|
const token = rest.shift();
|
|
24301
24640
|
switch (token) {
|
|
24302
24641
|
case "--account":
|
|
24303
|
-
account =
|
|
24642
|
+
account = requireValue10(rest, token);
|
|
24304
24643
|
break;
|
|
24305
24644
|
case "--cwd":
|
|
24306
|
-
cwd =
|
|
24645
|
+
cwd = requireValue10(rest, token);
|
|
24307
24646
|
break;
|
|
24308
24647
|
default:
|
|
24309
24648
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24328,10 +24667,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
24328
24667
|
const token = rest.shift();
|
|
24329
24668
|
switch (token) {
|
|
24330
24669
|
case "--account":
|
|
24331
|
-
account =
|
|
24670
|
+
account = requireValue10(rest, token);
|
|
24332
24671
|
break;
|
|
24333
24672
|
case "--cwd":
|
|
24334
|
-
cwd =
|
|
24673
|
+
cwd = requireValue10(rest, token);
|
|
24335
24674
|
break;
|
|
24336
24675
|
default:
|
|
24337
24676
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24366,32 +24705,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
24366
24705
|
const token = rest.shift();
|
|
24367
24706
|
switch (token) {
|
|
24368
24707
|
case "--account":
|
|
24369
|
-
account =
|
|
24708
|
+
account = requireValue10(rest, token);
|
|
24370
24709
|
break;
|
|
24371
24710
|
case "--title":
|
|
24372
|
-
title =
|
|
24711
|
+
title = requireValue10(rest, token);
|
|
24373
24712
|
break;
|
|
24374
24713
|
case "--desc":
|
|
24375
24714
|
case "--description":
|
|
24376
|
-
description = decodeEscapedNewlines(
|
|
24715
|
+
description = decodeEscapedNewlines(requireValue10(rest, token));
|
|
24377
24716
|
break;
|
|
24378
24717
|
case "--team-id":
|
|
24379
|
-
teamId =
|
|
24718
|
+
teamId = requireValue10(rest, token);
|
|
24380
24719
|
break;
|
|
24381
24720
|
case "--team-key":
|
|
24382
|
-
teamKey =
|
|
24721
|
+
teamKey = requireValue10(rest, token);
|
|
24383
24722
|
break;
|
|
24384
24723
|
case "--priority":
|
|
24385
|
-
priority = parseLinearPriority(
|
|
24724
|
+
priority = parseLinearPriority(requireValue10(rest, token));
|
|
24386
24725
|
break;
|
|
24387
24726
|
case "--parent-id":
|
|
24388
|
-
parentId =
|
|
24727
|
+
parentId = requireValue10(rest, token);
|
|
24389
24728
|
break;
|
|
24390
24729
|
case "--state-id":
|
|
24391
|
-
stateId =
|
|
24730
|
+
stateId = requireValue10(rest, token);
|
|
24392
24731
|
break;
|
|
24393
24732
|
case "--cwd":
|
|
24394
|
-
cwd =
|
|
24733
|
+
cwd = requireValue10(rest, token);
|
|
24395
24734
|
break;
|
|
24396
24735
|
default:
|
|
24397
24736
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24429,10 +24768,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
24429
24768
|
const token = rest.shift();
|
|
24430
24769
|
switch (token) {
|
|
24431
24770
|
case "--account":
|
|
24432
|
-
account =
|
|
24771
|
+
account = requireValue10(rest, token);
|
|
24433
24772
|
break;
|
|
24434
24773
|
case "--cwd":
|
|
24435
|
-
cwd =
|
|
24774
|
+
cwd = requireValue10(rest, token);
|
|
24436
24775
|
break;
|
|
24437
24776
|
default:
|
|
24438
24777
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24459,15 +24798,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
24459
24798
|
const token = rest.shift();
|
|
24460
24799
|
switch (token) {
|
|
24461
24800
|
case "--account":
|
|
24462
|
-
account =
|
|
24801
|
+
account = requireValue10(rest, token);
|
|
24463
24802
|
break;
|
|
24464
24803
|
case "--body":
|
|
24465
24804
|
case "--desc":
|
|
24466
24805
|
case "--description":
|
|
24467
|
-
body = decodeEscapedNewlines(
|
|
24806
|
+
body = decodeEscapedNewlines(requireValue10(rest, token));
|
|
24468
24807
|
break;
|
|
24469
24808
|
case "--cwd":
|
|
24470
|
-
cwd =
|
|
24809
|
+
cwd = requireValue10(rest, token);
|
|
24471
24810
|
break;
|
|
24472
24811
|
default:
|
|
24473
24812
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24497,10 +24836,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
24497
24836
|
const token = rest.shift();
|
|
24498
24837
|
switch (token) {
|
|
24499
24838
|
case "--account":
|
|
24500
|
-
account =
|
|
24839
|
+
account = requireValue10(rest, token);
|
|
24501
24840
|
break;
|
|
24502
24841
|
case "--cwd":
|
|
24503
|
-
cwd =
|
|
24842
|
+
cwd = requireValue10(rest, token);
|
|
24504
24843
|
break;
|
|
24505
24844
|
default:
|
|
24506
24845
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24524,16 +24863,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
24524
24863
|
const token = rest.shift();
|
|
24525
24864
|
switch (token) {
|
|
24526
24865
|
case "--account":
|
|
24527
|
-
account =
|
|
24866
|
+
account = requireValue10(rest, token);
|
|
24528
24867
|
break;
|
|
24529
24868
|
case "--team-id":
|
|
24530
|
-
teamId =
|
|
24869
|
+
teamId = requireValue10(rest, token);
|
|
24531
24870
|
break;
|
|
24532
24871
|
case "--team-key":
|
|
24533
|
-
teamKey =
|
|
24872
|
+
teamKey = requireValue10(rest, token);
|
|
24534
24873
|
break;
|
|
24535
24874
|
case "--cwd":
|
|
24536
|
-
cwd =
|
|
24875
|
+
cwd = requireValue10(rest, token);
|
|
24537
24876
|
break;
|
|
24538
24877
|
default:
|
|
24539
24878
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24556,10 +24895,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
24556
24895
|
const token = rest.shift();
|
|
24557
24896
|
switch (token) {
|
|
24558
24897
|
case "--account":
|
|
24559
|
-
account =
|
|
24898
|
+
account = requireValue10(rest, token);
|
|
24560
24899
|
break;
|
|
24561
24900
|
case "--cwd":
|
|
24562
|
-
cwd =
|
|
24901
|
+
cwd = requireValue10(rest, token);
|
|
24563
24902
|
break;
|
|
24564
24903
|
default:
|
|
24565
24904
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24586,16 +24925,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
24586
24925
|
const token = rest.shift();
|
|
24587
24926
|
switch (token) {
|
|
24588
24927
|
case "--account":
|
|
24589
|
-
account =
|
|
24928
|
+
account = requireValue10(rest, token);
|
|
24590
24929
|
break;
|
|
24591
24930
|
case "--cycle":
|
|
24592
|
-
cycle = parseLinearCycle(
|
|
24931
|
+
cycle = parseLinearCycle(requireValue10(rest, token));
|
|
24593
24932
|
break;
|
|
24594
24933
|
case "--status":
|
|
24595
|
-
status = parseLinearStatus(
|
|
24934
|
+
status = parseLinearStatus(requireValue10(rest, token));
|
|
24596
24935
|
break;
|
|
24597
24936
|
case "--cwd":
|
|
24598
|
-
cwd =
|
|
24937
|
+
cwd = requireValue10(rest, token);
|
|
24599
24938
|
break;
|
|
24600
24939
|
default:
|
|
24601
24940
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24629,28 +24968,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
24629
24968
|
const token = rest.shift();
|
|
24630
24969
|
switch (token) {
|
|
24631
24970
|
case "--account":
|
|
24632
|
-
account =
|
|
24971
|
+
account = requireValue10(rest, token);
|
|
24633
24972
|
break;
|
|
24634
24973
|
case "--team-id":
|
|
24635
|
-
teamId =
|
|
24974
|
+
teamId = requireValue10(rest, token);
|
|
24636
24975
|
break;
|
|
24637
24976
|
case "--team-key":
|
|
24638
|
-
teamKey =
|
|
24977
|
+
teamKey = requireValue10(rest, token);
|
|
24639
24978
|
break;
|
|
24640
24979
|
case "--user":
|
|
24641
|
-
user =
|
|
24980
|
+
user = requireValue10(rest, token);
|
|
24642
24981
|
break;
|
|
24643
24982
|
case "--cycle":
|
|
24644
|
-
cycle = parseLinearCycle(
|
|
24983
|
+
cycle = parseLinearCycle(requireValue10(rest, token));
|
|
24645
24984
|
break;
|
|
24646
24985
|
case "--status":
|
|
24647
|
-
status = parseLinearStatus(
|
|
24986
|
+
status = parseLinearStatus(requireValue10(rest, token));
|
|
24648
24987
|
break;
|
|
24649
24988
|
case "--query":
|
|
24650
|
-
query =
|
|
24989
|
+
query = requireValue10(rest, token).trim();
|
|
24651
24990
|
break;
|
|
24652
24991
|
case "--limit": {
|
|
24653
|
-
const value = Number.parseInt(
|
|
24992
|
+
const value = Number.parseInt(requireValue10(rest, token), 10);
|
|
24654
24993
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
24655
24994
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
24656
24995
|
}
|
|
@@ -24658,7 +24997,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
24658
24997
|
break;
|
|
24659
24998
|
}
|
|
24660
24999
|
case "--cwd":
|
|
24661
|
-
cwd =
|
|
25000
|
+
cwd = requireValue10(rest, token);
|
|
24662
25001
|
break;
|
|
24663
25002
|
default:
|
|
24664
25003
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24699,10 +25038,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
24699
25038
|
useScreenshot = true;
|
|
24700
25039
|
break;
|
|
24701
25040
|
case "--account":
|
|
24702
|
-
account =
|
|
25041
|
+
account = requireValue10(rest, token);
|
|
24703
25042
|
break;
|
|
24704
25043
|
case "--cwd":
|
|
24705
|
-
cwd =
|
|
25044
|
+
cwd = requireValue10(rest, token);
|
|
24706
25045
|
break;
|
|
24707
25046
|
default:
|
|
24708
25047
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -24796,19 +25135,19 @@ function parseNotionArgs(tokens) {
|
|
|
24796
25135
|
const token = rest.shift();
|
|
24797
25136
|
switch (token) {
|
|
24798
25137
|
case "--parent":
|
|
24799
|
-
parentPageId =
|
|
25138
|
+
parentPageId = requireValue10(rest, token);
|
|
24800
25139
|
break;
|
|
24801
25140
|
case "--title":
|
|
24802
|
-
title =
|
|
25141
|
+
title = requireValue10(rest, token);
|
|
24803
25142
|
break;
|
|
24804
25143
|
case "--private":
|
|
24805
25144
|
isPrivate = true;
|
|
24806
25145
|
break;
|
|
24807
25146
|
case "--content":
|
|
24808
|
-
content2 =
|
|
25147
|
+
content2 = requireValue10(rest, token);
|
|
24809
25148
|
break;
|
|
24810
25149
|
case "--file":
|
|
24811
|
-
filePath2 =
|
|
25150
|
+
filePath2 = requireValue10(rest, token);
|
|
24812
25151
|
break;
|
|
24813
25152
|
default:
|
|
24814
25153
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -24852,10 +25191,10 @@ function parseNotionArgs(tokens) {
|
|
|
24852
25191
|
const token = rest.shift();
|
|
24853
25192
|
switch (token) {
|
|
24854
25193
|
case "--content":
|
|
24855
|
-
content =
|
|
25194
|
+
content = requireValue10(rest, token);
|
|
24856
25195
|
break;
|
|
24857
25196
|
case "--file":
|
|
24858
|
-
filePath =
|
|
25197
|
+
filePath = requireValue10(rest, token);
|
|
24859
25198
|
break;
|
|
24860
25199
|
case "--append":
|
|
24861
25200
|
append = true;
|
|
@@ -24900,11 +25239,11 @@ function parseRandomArgs(tokens) {
|
|
|
24900
25239
|
mode = "easy";
|
|
24901
25240
|
break;
|
|
24902
25241
|
case "--length":
|
|
24903
|
-
length = parsePositiveInt(
|
|
25242
|
+
length = parsePositiveInt(requireValue10(rest, token), token);
|
|
24904
25243
|
seenLength = true;
|
|
24905
25244
|
break;
|
|
24906
25245
|
case "--charset": {
|
|
24907
|
-
const value =
|
|
25246
|
+
const value = requireValue10(rest, token);
|
|
24908
25247
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
24909
25248
|
throw new Error(
|
|
24910
25249
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -24915,18 +25254,18 @@ function parseRandomArgs(tokens) {
|
|
|
24915
25254
|
break;
|
|
24916
25255
|
}
|
|
24917
25256
|
case "--count":
|
|
24918
|
-
count = parsePositiveInt(
|
|
25257
|
+
count = parsePositiveInt(requireValue10(rest, token), token);
|
|
24919
25258
|
break;
|
|
24920
25259
|
case "--words":
|
|
24921
|
-
words = parsePositiveInt(
|
|
25260
|
+
words = parsePositiveInt(requireValue10(rest, token), token);
|
|
24922
25261
|
seenWords = true;
|
|
24923
25262
|
break;
|
|
24924
25263
|
case "--digits":
|
|
24925
|
-
digits = parseNonNegativeInt(
|
|
25264
|
+
digits = parseNonNegativeInt(requireValue10(rest, token), token);
|
|
24926
25265
|
seenDigits = true;
|
|
24927
25266
|
break;
|
|
24928
25267
|
case "--separator":
|
|
24929
|
-
separator =
|
|
25268
|
+
separator = requireValue10(rest, token);
|
|
24930
25269
|
seenSeparator = true;
|
|
24931
25270
|
break;
|
|
24932
25271
|
default:
|
|
@@ -24957,7 +25296,7 @@ function parseRandomArgs(tokens) {
|
|
|
24957
25296
|
count
|
|
24958
25297
|
};
|
|
24959
25298
|
}
|
|
24960
|
-
function
|
|
25299
|
+
function requireValue10(tokens, optionName) {
|
|
24961
25300
|
const value = tokens.shift();
|
|
24962
25301
|
if (!value) {
|
|
24963
25302
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -25093,6 +25432,11 @@ async function main() {
|
|
|
25093
25432
|
await handler.handle(commandArgs);
|
|
25094
25433
|
return;
|
|
25095
25434
|
}
|
|
25435
|
+
case "runner" /* Runner */: {
|
|
25436
|
+
const handler = new RunnerCommandHandler();
|
|
25437
|
+
await handler.handle(commandArgs);
|
|
25438
|
+
return;
|
|
25439
|
+
}
|
|
25096
25440
|
case "ns" /* Ns */: {
|
|
25097
25441
|
const handler = new NsCommandHandler();
|
|
25098
25442
|
await handler.handle(commandArgs);
|