@pmate/cli 0.42.7 → 0.44.0
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/README.md +24 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +313 -390
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22667,86 +22667,39 @@ var VercelCommandHandler = class {
|
|
|
22667
22667
|
init_sessionStore();
|
|
22668
22668
|
var RoleCommandHandler = class {
|
|
22669
22669
|
async handle(args) {
|
|
22670
|
-
const token =
|
|
22671
|
-
const
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
}
|
|
22704
|
-
readToken() {
|
|
22705
|
-
return readRequiredSession({
|
|
22706
|
-
preferredApp: DEFAULT_APP_ID
|
|
22707
|
-
}).token;
|
|
22708
|
-
}
|
|
22709
|
-
async request(baseUrl2, token, method, pathname, body) {
|
|
22710
|
-
const response = await fetch(`${baseUrl2}${pathname}`, {
|
|
22711
|
-
method,
|
|
22712
|
-
headers: {
|
|
22713
|
-
Authorization: `Bearer ${token}`,
|
|
22714
|
-
"Content-Type": "application/json"
|
|
22715
|
-
},
|
|
22716
|
-
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
22717
|
-
});
|
|
22718
|
-
let payload = null;
|
|
22719
|
-
try {
|
|
22720
|
-
payload = await response.json();
|
|
22721
|
-
} catch {
|
|
22722
|
-
payload = null;
|
|
22723
|
-
}
|
|
22724
|
-
if (!response.ok || !payload?.success) {
|
|
22725
|
-
throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
22726
|
-
}
|
|
22727
|
-
return payload.data;
|
|
22728
|
-
}
|
|
22729
|
-
renderList(items, asJson) {
|
|
22730
|
-
if (asJson) {
|
|
22731
|
-
ui.plain(JSON.stringify(items, null, 2));
|
|
22732
|
-
return;
|
|
22733
|
-
}
|
|
22734
|
-
if (items.length === 0) {
|
|
22735
|
-
ui.warn("No role definitions found.");
|
|
22736
|
-
return;
|
|
22737
|
-
}
|
|
22738
|
-
for (const item of items) {
|
|
22739
|
-
ui.info(item.role, {
|
|
22740
|
-
builtin: item.builtin,
|
|
22741
|
-
status: item.status
|
|
22742
|
-
});
|
|
22743
|
-
}
|
|
22744
|
-
}
|
|
22745
|
-
renderJson(value, asJson) {
|
|
22746
|
-
if (!asJson) {
|
|
22747
|
-
return;
|
|
22748
|
-
}
|
|
22749
|
-
ui.plain(JSON.stringify(value, null, 2));
|
|
22670
|
+
const token = readRequiredSession({ preferredApp: DEFAULT_APP_ID }).token;
|
|
22671
|
+
const base = (args.baseUrl || process.env.PMATE_AUTH_API_BASE_URL || process.env.AUTH_API_BASE_URL || "https://auth-api-v2.pmate.chat").replace(/\/+$/, "");
|
|
22672
|
+
const request2 = async (method, path36, body) => {
|
|
22673
|
+
const response = await fetch(base + path36, { method, redirect: "error", signal: AbortSignal.timeout(3e4), headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" }, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
|
|
22674
|
+
const payload = await response.json().catch(() => null);
|
|
22675
|
+
if (!response.ok || !payload?.success) throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
22676
|
+
return payload.data;
|
|
22677
|
+
};
|
|
22678
|
+
const scope = args.scope === "platform" ? { type: "platform" } : { type: "namespace", namespace: args.namespace };
|
|
22679
|
+
let result;
|
|
22680
|
+
if (args.resource === "migration") result = await request2("POST", args.riskModel ? "/authorization/migrate-risk" : "/authorization/migrate", { dryRun: args.action !== "apply" });
|
|
22681
|
+
else if (args.resource === "check") result = await request2("POST", "/authz/permission", { permission: args.permission, scope, ...args.account ? { account: args.account } : {} });
|
|
22682
|
+
else if (args.action === "list") {
|
|
22683
|
+
const data = await request2("GET", "/authorization");
|
|
22684
|
+
const key = { definition: "definitions", permission: "permissions", grant: "rolePermissions", binding: "bindings" }[args.resource];
|
|
22685
|
+
result = data[key].filter((row) => (!args.role || (row.roleId ?? row.id) === args.role) && (!args.account || row.account === args.account) && (!args.namespace || row.namespace === args.namespace || row.scope?.namespace === args.namespace));
|
|
22686
|
+
} else if (args.resource === "definition" || args.resource === "permission") {
|
|
22687
|
+
let existing;
|
|
22688
|
+
const id = args.resource === "definition" ? args.role : args.permission;
|
|
22689
|
+
if (args.action === "update") {
|
|
22690
|
+
const inventory = await request2("GET", "/authorization");
|
|
22691
|
+
existing = inventory[args.resource === "definition" ? "definitions" : "permissions"].find((row) => row.id === id);
|
|
22692
|
+
if (!existing) throw new Error(`Not found: ${id}`);
|
|
22693
|
+
}
|
|
22694
|
+
const body = { ...args.resource === "definition" ? { roleId: id, level: args.level ?? existing?.level ?? "dev" } : { id, risk: args.risk ?? existing?.risk ?? "H", scopeType: args.scopeType ?? existing?.scopeType }, displayName: args.displayName ?? existing?.displayName ?? id, description: args.description ?? existing?.description ?? id, status: args.status ?? existing?.status ?? "active" };
|
|
22695
|
+
result = await request2(args.action === "update" ? "PUT" : "POST", `/authorization/${args.resource === "definition" ? "roles" : "permissions"}`, body);
|
|
22696
|
+
} else if (args.resource === "binding") result = await request2(args.action === "remove" ? "DELETE" : "POST", "/authorization/bindings", { account: args.account, roleId: args.role });
|
|
22697
|
+
else result = await request2(args.action === "remove" ? "DELETE" : "POST", "/authorization/role-permissions", { roleId: args.role, permission: args.permission, scope });
|
|
22698
|
+
if (args.json) ui.plain(JSON.stringify(result, null, 2));
|
|
22699
|
+
else if (Array.isArray(result)) {
|
|
22700
|
+
if (result.length) console.table(result);
|
|
22701
|
+
else ui.warn("No authorization records found.");
|
|
22702
|
+
} else ui.plain(JSON.stringify(result, null, 2));
|
|
22750
22703
|
}
|
|
22751
22704
|
};
|
|
22752
22705
|
|
|
@@ -23262,7 +23215,7 @@ var AccountCommandHandler = class {
|
|
|
23262
23215
|
return;
|
|
23263
23216
|
}
|
|
23264
23217
|
for (const item of items) {
|
|
23265
|
-
ui.info(`${item.account} ${item.namespace}/${item.role}`, {
|
|
23218
|
+
ui.info(`${item.account} ${item.roleId ?? `${item.namespace}/${item.role}`}`, {
|
|
23266
23219
|
source: item.source
|
|
23267
23220
|
});
|
|
23268
23221
|
}
|
|
@@ -23302,7 +23255,7 @@ var AccountCommandHandler = class {
|
|
|
23302
23255
|
role: profile.role
|
|
23303
23256
|
})),
|
|
23304
23257
|
nickNames: item.nickNames,
|
|
23305
|
-
roles: item.roles.map((role) => `${role.namespace}/${role.role}`)
|
|
23258
|
+
roles: item.roles.map((role) => role.roleId ?? `${role.namespace}/${role.role}`)
|
|
23306
23259
|
});
|
|
23307
23260
|
}
|
|
23308
23261
|
}
|
|
@@ -23333,7 +23286,7 @@ var AccountCommandHandler = class {
|
|
|
23333
23286
|
ui.info(item.account.id, {
|
|
23334
23287
|
mobile: item.account.mobile,
|
|
23335
23288
|
nickNames: item.nickNames,
|
|
23336
|
-
roles: item.roles.map((role) => `${role.namespace}/${role.role}`),
|
|
23289
|
+
roles: item.roles.map((role) => role.roleId ?? `${role.namespace}/${role.role}`),
|
|
23337
23290
|
sources: item.sources
|
|
23338
23291
|
});
|
|
23339
23292
|
}
|
|
@@ -24315,7 +24268,7 @@ function parseAppArgs(tokens) {
|
|
|
24315
24268
|
if (action === "build") throw new Error("app build was removed; register an electron service and use pmate service deploy <ns:service>");
|
|
24316
24269
|
let baseUrl2;
|
|
24317
24270
|
let json = false;
|
|
24318
|
-
const
|
|
24271
|
+
const takeSharedOptions3 = () => {
|
|
24319
24272
|
while (rest.length > 0) {
|
|
24320
24273
|
const token = rest[0];
|
|
24321
24274
|
if (token === "--base-url") {
|
|
@@ -24388,7 +24341,7 @@ function parseAppArgs(tokens) {
|
|
|
24388
24341
|
const id = parseNamespacedRef(rawRef, {
|
|
24389
24342
|
entityLabel: "app ref"
|
|
24390
24343
|
}).fullId;
|
|
24391
|
-
|
|
24344
|
+
takeSharedOptions3();
|
|
24392
24345
|
if (rest.length > 0) {
|
|
24393
24346
|
throw new Error(`Unknown app ${action} option: ${rest[0]}`);
|
|
24394
24347
|
}
|
|
@@ -25651,97 +25604,60 @@ function parseLogsArgs(input) {
|
|
|
25651
25604
|
}
|
|
25652
25605
|
|
|
25653
25606
|
// src/roleCommandParser.ts
|
|
25607
|
+
var rolePattern = /^[a-z0-9][a-z0-9_-]{0,62}(\/[a-z0-9][a-z0-9_-]{0,62})?$/;
|
|
25608
|
+
var permissionPattern = /^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/;
|
|
25654
25609
|
function parseRoleArgs(tokens) {
|
|
25655
|
-
const rest = [...tokens];
|
|
25656
|
-
const
|
|
25657
|
-
if (resource
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
|
|
25672
|
-
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
25677
|
-
|
|
25678
|
-
action,
|
|
25679
|
-
baseUrl: baseUrl2,
|
|
25680
|
-
json
|
|
25681
|
-
};
|
|
25682
|
-
}
|
|
25683
|
-
if (action === "create") {
|
|
25684
|
-
const role = rest.shift();
|
|
25685
|
-
if (!role || role.startsWith("-")) {
|
|
25686
|
-
throw new Error(
|
|
25687
|
-
"Usage: role definition create <role> [--display-name <name>] [--description <text>] [--base-url <url>] [--json]"
|
|
25688
|
-
);
|
|
25689
|
-
}
|
|
25690
|
-
let displayName;
|
|
25691
|
-
let description;
|
|
25692
|
-
while (rest.length > 0) {
|
|
25693
|
-
const token = rest.shift();
|
|
25694
|
-
switch (token) {
|
|
25695
|
-
case "--display-name":
|
|
25696
|
-
displayName = requireValue5(rest, token);
|
|
25697
|
-
break;
|
|
25698
|
-
case "--description":
|
|
25699
|
-
description = requireValue5(rest, token);
|
|
25700
|
-
break;
|
|
25701
|
-
case "--base-url":
|
|
25702
|
-
baseUrl2 = requireValue5(rest, token);
|
|
25703
|
-
break;
|
|
25704
|
-
case "--json":
|
|
25705
|
-
json = true;
|
|
25706
|
-
break;
|
|
25707
|
-
default:
|
|
25708
|
-
throw new Error(`Unknown role create option: ${token}`);
|
|
25709
|
-
}
|
|
25610
|
+
const rest = [...tokens], resource = rest.shift();
|
|
25611
|
+
const actions = { definition: ["list", "create", "update"], permission: ["list", "create", "update"], grant: ["list", "add", "remove"], binding: ["list", "add", "remove"], migration: ["preview", "apply"], check: ["check"] };
|
|
25612
|
+
if (!actions[resource]) throw new Error("Missing role resource. Use: role definition|permission|grant|binding|migration|check");
|
|
25613
|
+
const action = resource === "check" ? "check" : rest.shift();
|
|
25614
|
+
if (!action) throw new Error("Missing role action");
|
|
25615
|
+
if (!actions[resource].includes(action)) throw new Error(`Unknown role action: ${action}`);
|
|
25616
|
+
const args = { type: "role" /* Role */, resource, action, baseUrl: void 0, json: false };
|
|
25617
|
+
if (["create", "update"].includes(action)) {
|
|
25618
|
+
const id = rest.shift();
|
|
25619
|
+
if (!id || id.startsWith("-")) throw new Error(`Usage: role ${resource} ${action} <${resource === "definition" ? "role" : "permission"}>`);
|
|
25620
|
+
if (resource === "definition") {
|
|
25621
|
+
args.role = id;
|
|
25622
|
+
args.displayName = void 0;
|
|
25623
|
+
args.description = void 0;
|
|
25624
|
+
} else args.permission = id;
|
|
25625
|
+
}
|
|
25626
|
+
const options = { "--risk": "risk", "--level": "level", "--role": "role", "--permission": "permission", "--account": "account", "--namespace": "namespace", "--scope": "scope", "--scope-type": "scopeType", "--status": "status", "--display-name": "displayName", "--description": "description", "--base-url": "baseUrl" };
|
|
25627
|
+
while (rest.length) {
|
|
25628
|
+
const flag = rest.shift();
|
|
25629
|
+
if (flag === "--risk-model") {
|
|
25630
|
+
if (resource !== "migration") throw new Error("--risk-model requires role migration");
|
|
25631
|
+
args.riskModel = true;
|
|
25632
|
+
continue;
|
|
25710
25633
|
}
|
|
25711
|
-
|
|
25712
|
-
|
|
25713
|
-
|
|
25714
|
-
action,
|
|
25715
|
-
role,
|
|
25716
|
-
displayName,
|
|
25717
|
-
description,
|
|
25718
|
-
baseUrl: baseUrl2,
|
|
25719
|
-
json
|
|
25720
|
-
};
|
|
25721
|
-
}
|
|
25722
|
-
throw new Error(`Unknown role action: ${action}`);
|
|
25723
|
-
}
|
|
25724
|
-
function takeSharedOptions3(rest, handlers) {
|
|
25725
|
-
while (rest.length > 0) {
|
|
25726
|
-
const token = rest.shift();
|
|
25727
|
-
switch (token) {
|
|
25728
|
-
case "--base-url":
|
|
25729
|
-
handlers.onBaseUrl(requireValue5(rest, token));
|
|
25730
|
-
break;
|
|
25731
|
-
case "--json":
|
|
25732
|
-
handlers.onJson();
|
|
25733
|
-
break;
|
|
25734
|
-
default:
|
|
25735
|
-
throw new Error(`Unknown role option: ${token}`);
|
|
25634
|
+
if (flag === "--json") {
|
|
25635
|
+
args.json = true;
|
|
25636
|
+
continue;
|
|
25736
25637
|
}
|
|
25737
|
-
|
|
25738
|
-
}
|
|
25739
|
-
|
|
25740
|
-
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25638
|
+
const key = options[flag], value = rest.shift();
|
|
25639
|
+
if (!key) throw new Error(`Unknown role option: ${flag}`);
|
|
25640
|
+
if (!value || value.startsWith("--")) throw new Error(`Missing value for ${flag}`);
|
|
25641
|
+
if (args[key] !== void 0) throw new Error(`Duplicate role option: ${flag}`);
|
|
25642
|
+
Object.assign(args, { [key]: value });
|
|
25643
|
+
}
|
|
25644
|
+
if (args.risk && (!["H", "M", "L"].includes(args.risk) || resource !== "permission" || !["create", "update"].includes(action))) throw new Error("--risk H|M|L requires permission create/update");
|
|
25645
|
+
if (args.level && (!["admin", "maintainer", "dev"].includes(args.level) || resource !== "definition" || !["create", "update"].includes(action))) throw new Error("--level admin|maintainer|dev requires definition create/update");
|
|
25646
|
+
if (args.role && !rolePattern.test(args.role)) throw new Error("Invalid role reference: use admin or blue/admin");
|
|
25647
|
+
if (args.permission && !permissionPattern.test(args.permission)) throw new Error("Invalid permission: use app:create");
|
|
25648
|
+
if (args.scopeType && !["platform", "namespace"].includes(args.scopeType)) throw new Error("Invalid --scope-type");
|
|
25649
|
+
if (args.scope && args.scope !== "platform") throw new Error("Use --scope platform or --namespace <name>");
|
|
25650
|
+
if (args.status && !["active", "disabled"].includes(args.status)) throw new Error("Invalid --status");
|
|
25651
|
+
if (args.namespace && !/^(\*|[a-z0-9][a-z0-9_-]{0,62})$/.test(args.namespace)) throw new Error("Invalid namespace");
|
|
25652
|
+
if (args.scope && args.namespace) throw new Error("Choose --scope platform or --namespace, not both");
|
|
25653
|
+
if (resource === "permission" && action === "create" && !args.scopeType) throw new Error("Permission creation requires --scope-type platform|namespace");
|
|
25654
|
+
if (["add", "remove"].includes(action) && !args.role) throw new Error("Missing --role");
|
|
25655
|
+
if (resource === "binding" && ["add", "remove"].includes(action) && !args.account) throw new Error("Missing --account");
|
|
25656
|
+
if (resource === "grant" && action !== "list" || resource === "check") {
|
|
25657
|
+
if (!args.permission || !args.scope && !args.namespace) throw new Error("Requires --permission and --scope platform or --namespace <name>");
|
|
25658
|
+
if (resource === "check" && args.namespace === "*") throw new Error("Permission checks require a concrete namespace");
|
|
25659
|
+
}
|
|
25660
|
+
return args;
|
|
25745
25661
|
}
|
|
25746
25662
|
|
|
25747
25663
|
// src/accountCommandParser.ts
|
|
@@ -25763,20 +25679,20 @@ function parseAccountArgs(tokens) {
|
|
|
25763
25679
|
const token = rest.shift();
|
|
25764
25680
|
switch (token) {
|
|
25765
25681
|
case "--mobile":
|
|
25766
|
-
mobile =
|
|
25682
|
+
mobile = requireValue5(rest, token);
|
|
25767
25683
|
break;
|
|
25768
25684
|
case "--nickname":
|
|
25769
25685
|
case "--nickName":
|
|
25770
|
-
nickName =
|
|
25686
|
+
nickName = requireValue5(rest, token);
|
|
25771
25687
|
break;
|
|
25772
25688
|
case "--page":
|
|
25773
|
-
page = parsePositiveInt(
|
|
25689
|
+
page = parsePositiveInt(requireValue5(rest, token), token);
|
|
25774
25690
|
break;
|
|
25775
25691
|
case "--page-size":
|
|
25776
|
-
pageSize = parsePositiveInt(
|
|
25692
|
+
pageSize = parsePositiveInt(requireValue5(rest, token), token);
|
|
25777
25693
|
break;
|
|
25778
25694
|
case "--base-url":
|
|
25779
|
-
baseUrl3 =
|
|
25695
|
+
baseUrl3 = requireValue5(rest, token);
|
|
25780
25696
|
break;
|
|
25781
25697
|
case "--json":
|
|
25782
25698
|
json2 = true;
|
|
@@ -25802,7 +25718,7 @@ function parseAccountArgs(tokens) {
|
|
|
25802
25718
|
};
|
|
25803
25719
|
}
|
|
25804
25720
|
if (action === "app-users") {
|
|
25805
|
-
const app = parseNamespacedRef(
|
|
25721
|
+
const app = parseNamespacedRef(requireValue5(rest, "app-users"), {
|
|
25806
25722
|
entityLabel: "app ref"
|
|
25807
25723
|
}).fullId;
|
|
25808
25724
|
let page;
|
|
@@ -25813,13 +25729,13 @@ function parseAccountArgs(tokens) {
|
|
|
25813
25729
|
const token = rest.shift();
|
|
25814
25730
|
switch (token) {
|
|
25815
25731
|
case "--page":
|
|
25816
|
-
page = parsePositiveInt(
|
|
25732
|
+
page = parsePositiveInt(requireValue5(rest, token), token);
|
|
25817
25733
|
break;
|
|
25818
25734
|
case "--page-size":
|
|
25819
|
-
pageSize = parsePositiveInt(
|
|
25735
|
+
pageSize = parsePositiveInt(requireValue5(rest, token), token);
|
|
25820
25736
|
break;
|
|
25821
25737
|
case "--base-url":
|
|
25822
|
-
baseUrl3 =
|
|
25738
|
+
baseUrl3 = requireValue5(rest, token);
|
|
25823
25739
|
break;
|
|
25824
25740
|
case "--json":
|
|
25825
25741
|
json2 = true;
|
|
@@ -25850,17 +25766,17 @@ function parseAccountArgs(tokens) {
|
|
|
25850
25766
|
case void 0:
|
|
25851
25767
|
break;
|
|
25852
25768
|
case "--account":
|
|
25853
|
-
account2 =
|
|
25769
|
+
account2 = requireValue5(rest, token);
|
|
25854
25770
|
break;
|
|
25855
25771
|
case "--mobile":
|
|
25856
|
-
mobile =
|
|
25772
|
+
mobile = requireValue5(rest, token);
|
|
25857
25773
|
break;
|
|
25858
25774
|
case "--nickname":
|
|
25859
25775
|
case "--nickName":
|
|
25860
|
-
nickName =
|
|
25776
|
+
nickName = requireValue5(rest, token);
|
|
25861
25777
|
break;
|
|
25862
25778
|
case "--base-url":
|
|
25863
|
-
baseUrl3 =
|
|
25779
|
+
baseUrl3 = requireValue5(rest, token);
|
|
25864
25780
|
break;
|
|
25865
25781
|
case "--json":
|
|
25866
25782
|
json2 = true;
|
|
@@ -25904,19 +25820,19 @@ function parseAccountArgs(tokens) {
|
|
|
25904
25820
|
const token = rest.shift();
|
|
25905
25821
|
switch (token) {
|
|
25906
25822
|
case "--account":
|
|
25907
|
-
account2 =
|
|
25823
|
+
account2 = requireValue5(rest, token);
|
|
25908
25824
|
break;
|
|
25909
25825
|
case "--app":
|
|
25910
|
-
app = parseNamespacedRef(
|
|
25826
|
+
app = parseNamespacedRef(requireValue5(rest, token), {
|
|
25911
25827
|
entityLabel: "app ref"
|
|
25912
25828
|
}).fullId;
|
|
25913
25829
|
apps.push(app);
|
|
25914
25830
|
break;
|
|
25915
25831
|
case "--file":
|
|
25916
|
-
filePath =
|
|
25832
|
+
filePath = requireValue5(rest, token);
|
|
25917
25833
|
break;
|
|
25918
25834
|
case "--base-url":
|
|
25919
|
-
baseUrl3 =
|
|
25835
|
+
baseUrl3 = requireValue5(rest, token);
|
|
25920
25836
|
break;
|
|
25921
25837
|
case "--json":
|
|
25922
25838
|
json2 = true;
|
|
@@ -26006,35 +25922,35 @@ function parseAccountArgs(tokens) {
|
|
|
26006
25922
|
const token = rest.shift();
|
|
26007
25923
|
switch (token) {
|
|
26008
25924
|
case "--app":
|
|
26009
|
-
app = parseNamespacedRef(
|
|
25925
|
+
app = parseNamespacedRef(requireValue5(rest, token), {
|
|
26010
25926
|
entityLabel: "app ref"
|
|
26011
25927
|
}).fullId;
|
|
26012
25928
|
break;
|
|
26013
25929
|
case "--name":
|
|
26014
|
-
name =
|
|
25930
|
+
name = requireValue5(rest, token);
|
|
26015
25931
|
break;
|
|
26016
25932
|
case "--out":
|
|
26017
|
-
out =
|
|
25933
|
+
out = requireValue5(rest, token);
|
|
26018
25934
|
break;
|
|
26019
25935
|
case "--key-file":
|
|
26020
|
-
keyFile =
|
|
25936
|
+
keyFile = requireValue5(rest, token);
|
|
26021
25937
|
break;
|
|
26022
25938
|
case "--public-key":
|
|
26023
|
-
publicKey =
|
|
25939
|
+
publicKey = requireValue5(rest, token);
|
|
26024
25940
|
break;
|
|
26025
25941
|
case "--private-key":
|
|
26026
|
-
privateKey =
|
|
25942
|
+
privateKey = requireValue5(rest, token);
|
|
26027
25943
|
break;
|
|
26028
25944
|
case "--new-name":
|
|
26029
25945
|
case "--newName":
|
|
26030
|
-
newName =
|
|
25946
|
+
newName = requireValue5(rest, token);
|
|
26031
25947
|
break;
|
|
26032
25948
|
case "--nickname":
|
|
26033
25949
|
case "--nickName":
|
|
26034
|
-
nickName =
|
|
25950
|
+
nickName = requireValue5(rest, token);
|
|
26035
25951
|
break;
|
|
26036
25952
|
case "--role": {
|
|
26037
|
-
const value =
|
|
25953
|
+
const value = requireValue5(rest, token);
|
|
26038
25954
|
if (value !== "practitioner" && value !== "mate") {
|
|
26039
25955
|
throw new Error("--role must be practitioner or mate");
|
|
26040
25956
|
}
|
|
@@ -26042,7 +25958,7 @@ function parseAccountArgs(tokens) {
|
|
|
26042
25958
|
break;
|
|
26043
25959
|
}
|
|
26044
25960
|
case "--base-url":
|
|
26045
|
-
baseUrl3 =
|
|
25961
|
+
baseUrl3 = requireValue5(rest, token);
|
|
26046
25962
|
break;
|
|
26047
25963
|
case "--json":
|
|
26048
25964
|
json2 = true;
|
|
@@ -26127,36 +26043,36 @@ function parseAccountArgs(tokens) {
|
|
|
26127
26043
|
const token = rest.shift();
|
|
26128
26044
|
switch (token) {
|
|
26129
26045
|
case "--app":
|
|
26130
|
-
app = parseNamespacedRef(
|
|
26046
|
+
app = parseNamespacedRef(requireValue5(rest, token), {
|
|
26131
26047
|
entityLabel: "app ref"
|
|
26132
26048
|
}).fullId;
|
|
26133
26049
|
break;
|
|
26134
26050
|
case "--name":
|
|
26135
|
-
name =
|
|
26051
|
+
name = requireValue5(rest, token);
|
|
26136
26052
|
break;
|
|
26137
26053
|
case "--namespace":
|
|
26138
|
-
namespace2 =
|
|
26054
|
+
namespace2 = requireValue5(rest, token);
|
|
26139
26055
|
break;
|
|
26140
26056
|
case "--expires-at":
|
|
26141
|
-
expiresAt =
|
|
26057
|
+
expiresAt = requireValue5(rest, token);
|
|
26142
26058
|
break;
|
|
26143
26059
|
case "--expires-in":
|
|
26144
|
-
expiresAt = parseExpiresIn(
|
|
26060
|
+
expiresAt = parseExpiresIn(requireValue5(rest, token));
|
|
26145
26061
|
break;
|
|
26146
26062
|
case "--grace-period":
|
|
26147
|
-
gracePeriodSeconds = parseDurationSeconds(
|
|
26063
|
+
gracePeriodSeconds = parseDurationSeconds(requireValue5(rest, token), token);
|
|
26148
26064
|
break;
|
|
26149
26065
|
case "--out":
|
|
26150
|
-
out =
|
|
26066
|
+
out = requireValue5(rest, token);
|
|
26151
26067
|
break;
|
|
26152
26068
|
case "--key":
|
|
26153
|
-
key =
|
|
26069
|
+
key = requireValue5(rest, token);
|
|
26154
26070
|
break;
|
|
26155
26071
|
case "--key-file":
|
|
26156
|
-
keyFile =
|
|
26072
|
+
keyFile = requireValue5(rest, token);
|
|
26157
26073
|
break;
|
|
26158
26074
|
case "--base-url":
|
|
26159
|
-
baseUrl3 =
|
|
26075
|
+
baseUrl3 = requireValue5(rest, token);
|
|
26160
26076
|
break;
|
|
26161
26077
|
case "--json":
|
|
26162
26078
|
json2 = true;
|
|
@@ -26217,16 +26133,16 @@ function parseAccountArgs(tokens) {
|
|
|
26217
26133
|
const token = rest.shift();
|
|
26218
26134
|
switch (token) {
|
|
26219
26135
|
case "--account":
|
|
26220
|
-
account =
|
|
26136
|
+
account = requireValue5(rest, token);
|
|
26221
26137
|
break;
|
|
26222
26138
|
case "--namespace":
|
|
26223
|
-
namespace =
|
|
26139
|
+
namespace = requireValue5(rest, token);
|
|
26224
26140
|
break;
|
|
26225
26141
|
case "--role":
|
|
26226
|
-
role =
|
|
26142
|
+
role = requireValue5(rest, token);
|
|
26227
26143
|
break;
|
|
26228
26144
|
case "--base-url":
|
|
26229
|
-
baseUrl2 =
|
|
26145
|
+
baseUrl2 = requireValue5(rest, token);
|
|
26230
26146
|
break;
|
|
26231
26147
|
case "--json":
|
|
26232
26148
|
json = true;
|
|
@@ -26268,7 +26184,7 @@ function parseAccountArgs(tokens) {
|
|
|
26268
26184
|
}
|
|
26269
26185
|
throw new Error(`Unknown account role action: ${roleAction}`);
|
|
26270
26186
|
}
|
|
26271
|
-
function
|
|
26187
|
+
function requireValue5(tokens, optionName) {
|
|
26272
26188
|
const value = tokens.shift();
|
|
26273
26189
|
if (!value || value.startsWith("-")) {
|
|
26274
26190
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -26309,12 +26225,12 @@ function parseOrgArgs(tokens) {
|
|
|
26309
26225
|
}
|
|
26310
26226
|
let baseUrl2;
|
|
26311
26227
|
let json = false;
|
|
26312
|
-
const
|
|
26228
|
+
const takeSharedOptions3 = () => {
|
|
26313
26229
|
while (rest.length > 0) {
|
|
26314
26230
|
const token = rest[0];
|
|
26315
26231
|
if (token === "--base-url") {
|
|
26316
26232
|
rest.shift();
|
|
26317
|
-
baseUrl2 =
|
|
26233
|
+
baseUrl2 = requireValue6(rest, token);
|
|
26318
26234
|
continue;
|
|
26319
26235
|
}
|
|
26320
26236
|
if (token === "--json") {
|
|
@@ -26326,7 +26242,7 @@ function parseOrgArgs(tokens) {
|
|
|
26326
26242
|
}
|
|
26327
26243
|
};
|
|
26328
26244
|
if (action === "list") {
|
|
26329
|
-
|
|
26245
|
+
takeSharedOptions3();
|
|
26330
26246
|
if (rest.length > 0) {
|
|
26331
26247
|
throw new Error(`Unknown org list option: ${rest[0]}`);
|
|
26332
26248
|
}
|
|
@@ -26334,7 +26250,7 @@ function parseOrgArgs(tokens) {
|
|
|
26334
26250
|
}
|
|
26335
26251
|
if (action === "get" || action === "view" || action === "disable") {
|
|
26336
26252
|
const orgId = parseRequiredOrgRef(rest.shift(), action);
|
|
26337
|
-
|
|
26253
|
+
takeSharedOptions3();
|
|
26338
26254
|
if (rest.length > 0) {
|
|
26339
26255
|
throw new Error(`Unknown org ${action} option: ${rest[0]}`);
|
|
26340
26256
|
}
|
|
@@ -26348,13 +26264,13 @@ function parseOrgArgs(tokens) {
|
|
|
26348
26264
|
const token = rest.shift();
|
|
26349
26265
|
switch (token) {
|
|
26350
26266
|
case "--display-name":
|
|
26351
|
-
displayName =
|
|
26267
|
+
displayName = requireValue6(rest, token);
|
|
26352
26268
|
break;
|
|
26353
26269
|
case "--member":
|
|
26354
|
-
members.push(
|
|
26270
|
+
members.push(requireValue6(rest, token));
|
|
26355
26271
|
break;
|
|
26356
26272
|
case "--base-url":
|
|
26357
|
-
baseUrl2 =
|
|
26273
|
+
baseUrl2 = requireValue6(rest, token);
|
|
26358
26274
|
break;
|
|
26359
26275
|
case "--json":
|
|
26360
26276
|
json = true;
|
|
@@ -26385,10 +26301,10 @@ function parseOrgArgs(tokens) {
|
|
|
26385
26301
|
const token = rest.shift();
|
|
26386
26302
|
switch (token) {
|
|
26387
26303
|
case "--display-name":
|
|
26388
|
-
displayName =
|
|
26304
|
+
displayName = requireValue6(rest, token);
|
|
26389
26305
|
break;
|
|
26390
26306
|
case "--base-url":
|
|
26391
|
-
baseUrl2 =
|
|
26307
|
+
baseUrl2 = requireValue6(rest, token);
|
|
26392
26308
|
break;
|
|
26393
26309
|
case "--json":
|
|
26394
26310
|
json = true;
|
|
@@ -26431,16 +26347,16 @@ function parseOrgArgs(tokens) {
|
|
|
26431
26347
|
const token = memberTokens.shift();
|
|
26432
26348
|
switch (token) {
|
|
26433
26349
|
case "--account": {
|
|
26434
|
-
const value =
|
|
26350
|
+
const value = requireValue6(memberTokens, token);
|
|
26435
26351
|
account = value;
|
|
26436
26352
|
accounts.push(value);
|
|
26437
26353
|
break;
|
|
26438
26354
|
}
|
|
26439
26355
|
case "--file":
|
|
26440
|
-
filePath =
|
|
26356
|
+
filePath = requireValue6(memberTokens, token);
|
|
26441
26357
|
break;
|
|
26442
26358
|
case "--base-url":
|
|
26443
|
-
baseUrl2 =
|
|
26359
|
+
baseUrl2 = requireValue6(memberTokens, token);
|
|
26444
26360
|
break;
|
|
26445
26361
|
case "--json":
|
|
26446
26362
|
json = true;
|
|
@@ -26500,7 +26416,7 @@ function parseOrgArgs(tokens) {
|
|
|
26500
26416
|
const token = visibleTokens.shift();
|
|
26501
26417
|
switch (token) {
|
|
26502
26418
|
case "--app": {
|
|
26503
|
-
const value = parseNamespacedRef(
|
|
26419
|
+
const value = parseNamespacedRef(requireValue6(visibleTokens, token), {
|
|
26504
26420
|
entityLabel: "app ref"
|
|
26505
26421
|
}).fullId;
|
|
26506
26422
|
app = value;
|
|
@@ -26508,10 +26424,10 @@ function parseOrgArgs(tokens) {
|
|
|
26508
26424
|
break;
|
|
26509
26425
|
}
|
|
26510
26426
|
case "--file":
|
|
26511
|
-
filePath =
|
|
26427
|
+
filePath = requireValue6(visibleTokens, token);
|
|
26512
26428
|
break;
|
|
26513
26429
|
case "--base-url":
|
|
26514
|
-
baseUrl2 =
|
|
26430
|
+
baseUrl2 = requireValue6(visibleTokens, token);
|
|
26515
26431
|
break;
|
|
26516
26432
|
case "--json":
|
|
26517
26433
|
json = true;
|
|
@@ -26565,7 +26481,7 @@ function parseRequiredOrgRef(value, action) {
|
|
|
26565
26481
|
entityLabel: "org ref"
|
|
26566
26482
|
}).fullId;
|
|
26567
26483
|
}
|
|
26568
|
-
function
|
|
26484
|
+
function requireValue6(tokens, optionName) {
|
|
26569
26485
|
const value = tokens.shift();
|
|
26570
26486
|
if (!value || value.startsWith("-")) {
|
|
26571
26487
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -26586,11 +26502,11 @@ function parseHostArgs(tokens) {
|
|
|
26586
26502
|
if (envAction === "list") action = "env-list";
|
|
26587
26503
|
else if (envAction === "set") {
|
|
26588
26504
|
action = "env-set";
|
|
26589
|
-
key =
|
|
26590
|
-
value =
|
|
26505
|
+
key = requireValue7(rest, "key");
|
|
26506
|
+
value = requireValue7(rest, "value");
|
|
26591
26507
|
} else if (envAction === "unset") {
|
|
26592
26508
|
action = "env-unset";
|
|
26593
|
-
key =
|
|
26509
|
+
key = requireValue7(rest, "key");
|
|
26594
26510
|
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
26595
26511
|
} else throw new Error("Usage: host env list|set|unset ... | host apply");
|
|
26596
26512
|
let host;
|
|
@@ -26599,16 +26515,16 @@ function parseHostArgs(tokens) {
|
|
|
26599
26515
|
let json = false;
|
|
26600
26516
|
while (rest.length > 0) {
|
|
26601
26517
|
const token = rest.shift();
|
|
26602
|
-
if (token === "--host") host =
|
|
26518
|
+
if (token === "--host") host = requireValue7(rest, token);
|
|
26603
26519
|
else if (token === "--secret") secret = true;
|
|
26604
|
-
else if (token === "--base-url") baseUrl2 =
|
|
26520
|
+
else if (token === "--base-url") baseUrl2 = requireValue7(rest, token);
|
|
26605
26521
|
else if (token === "--json") json = true;
|
|
26606
26522
|
else throw new Error(`Unknown host option: ${token}`);
|
|
26607
26523
|
}
|
|
26608
26524
|
if (secret && action !== "env-set") throw new Error("--secret is only valid for host env set");
|
|
26609
26525
|
return { type: "host" /* Host */, action, host, key, value, secret, baseUrl: baseUrl2, json };
|
|
26610
26526
|
}
|
|
26611
|
-
function
|
|
26527
|
+
function requireValue7(tokens, label) {
|
|
26612
26528
|
const value = tokens.shift();
|
|
26613
26529
|
if (!value || value.startsWith("--")) throw new Error(`Missing value for ${label}`);
|
|
26614
26530
|
return value;
|
|
@@ -26633,7 +26549,7 @@ function parseCollectArgs(tokens) {
|
|
|
26633
26549
|
const token = rest.shift();
|
|
26634
26550
|
switch (token) {
|
|
26635
26551
|
case "--source": {
|
|
26636
|
-
const value =
|
|
26552
|
+
const value = requireValue8(rest, token);
|
|
26637
26553
|
if (value !== "cc" && value !== "yelling") {
|
|
26638
26554
|
throw new Error(`Unsupported collect source: ${value}`);
|
|
26639
26555
|
}
|
|
@@ -26641,11 +26557,11 @@ function parseCollectArgs(tokens) {
|
|
|
26641
26557
|
break;
|
|
26642
26558
|
}
|
|
26643
26559
|
case "--endpoint":
|
|
26644
|
-
options.endpoint =
|
|
26560
|
+
options.endpoint = requireValue8(rest, token);
|
|
26645
26561
|
break;
|
|
26646
26562
|
case "--thread":
|
|
26647
26563
|
case "--channel":
|
|
26648
|
-
options.thread =
|
|
26564
|
+
options.thread = requireValue8(rest, token);
|
|
26649
26565
|
break;
|
|
26650
26566
|
default:
|
|
26651
26567
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -26661,7 +26577,7 @@ function parseCollectArgs(tokens) {
|
|
|
26661
26577
|
}
|
|
26662
26578
|
return { type: "collect" /* Collect */, ...options };
|
|
26663
26579
|
}
|
|
26664
|
-
function
|
|
26580
|
+
function requireValue8(tokens, optionName) {
|
|
26665
26581
|
const value = tokens.shift();
|
|
26666
26582
|
if (!value) {
|
|
26667
26583
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -26709,22 +26625,22 @@ function parseIm1PendingMentionsArgs(tokens) {
|
|
|
26709
26625
|
const token = rest.shift();
|
|
26710
26626
|
switch (token) {
|
|
26711
26627
|
case "--me":
|
|
26712
|
-
me =
|
|
26628
|
+
me = requireValue9(rest, token);
|
|
26713
26629
|
break;
|
|
26714
26630
|
case "--from":
|
|
26715
|
-
from = parseIsoDate(
|
|
26631
|
+
from = parseIsoDate(requireValue9(rest, token), token);
|
|
26716
26632
|
break;
|
|
26717
26633
|
case "--to":
|
|
26718
|
-
to = parseIsoDate(
|
|
26634
|
+
to = parseIsoDate(requireValue9(rest, token), token);
|
|
26719
26635
|
break;
|
|
26720
26636
|
case "--hours":
|
|
26721
|
-
hours = parsePositiveInt2(
|
|
26637
|
+
hours = parsePositiveInt2(requireValue9(rest, token), token);
|
|
26722
26638
|
break;
|
|
26723
26639
|
case "--context":
|
|
26724
|
-
context = parseBoundedPositiveInt(
|
|
26640
|
+
context = parseBoundedPositiveInt(requireValue9(rest, token), token, 50);
|
|
26725
26641
|
break;
|
|
26726
26642
|
case "--limit":
|
|
26727
|
-
limit = parseBoundedPositiveInt(
|
|
26643
|
+
limit = parseBoundedPositiveInt(requireValue9(rest, token), token, 500);
|
|
26728
26644
|
break;
|
|
26729
26645
|
case "--json":
|
|
26730
26646
|
json = true;
|
|
@@ -26767,13 +26683,13 @@ function parseIm1ThreadsArgs(tokens) {
|
|
|
26767
26683
|
switch (token) {
|
|
26768
26684
|
case "--q":
|
|
26769
26685
|
case "--query":
|
|
26770
|
-
query =
|
|
26686
|
+
query = requireValue9(rest, token);
|
|
26771
26687
|
break;
|
|
26772
26688
|
case "--search":
|
|
26773
|
-
search =
|
|
26689
|
+
search = requireValue9(rest, token);
|
|
26774
26690
|
break;
|
|
26775
26691
|
case "--limit":
|
|
26776
|
-
limit = parsePositiveInt2(
|
|
26692
|
+
limit = parsePositiveInt2(requireValue9(rest, token), token);
|
|
26777
26693
|
break;
|
|
26778
26694
|
case "--json":
|
|
26779
26695
|
json = true;
|
|
@@ -26797,10 +26713,10 @@ function parseIm1MessagesArgs(tokens) {
|
|
|
26797
26713
|
switch (token) {
|
|
26798
26714
|
case "--thread":
|
|
26799
26715
|
case "--channel":
|
|
26800
|
-
thread =
|
|
26716
|
+
thread = requireValue9(rest, token);
|
|
26801
26717
|
break;
|
|
26802
26718
|
case "--limit":
|
|
26803
|
-
limit = parsePositiveInt2(
|
|
26719
|
+
limit = parsePositiveInt2(requireValue9(rest, token), token);
|
|
26804
26720
|
break;
|
|
26805
26721
|
case "--json":
|
|
26806
26722
|
json = true;
|
|
@@ -26827,14 +26743,14 @@ function parseIm1ReplyArgs(tokens) {
|
|
|
26827
26743
|
const token = rest.shift();
|
|
26828
26744
|
switch (token) {
|
|
26829
26745
|
case "--thread":
|
|
26830
|
-
thread =
|
|
26746
|
+
thread = requireValue9(rest, token);
|
|
26831
26747
|
break;
|
|
26832
26748
|
case "--text":
|
|
26833
|
-
text =
|
|
26749
|
+
text = requireValue9(rest, token);
|
|
26834
26750
|
break;
|
|
26835
26751
|
case "--file":
|
|
26836
26752
|
case "--image":
|
|
26837
|
-
file =
|
|
26753
|
+
file = requireValue9(rest, token);
|
|
26838
26754
|
break;
|
|
26839
26755
|
case "--dryrun":
|
|
26840
26756
|
case "--dry-run":
|
|
@@ -26867,13 +26783,13 @@ function parseIm1ReactArgs(tokens) {
|
|
|
26867
26783
|
const token = rest.shift();
|
|
26868
26784
|
switch (token) {
|
|
26869
26785
|
case "--thread":
|
|
26870
|
-
thread =
|
|
26786
|
+
thread = requireValue9(rest, token);
|
|
26871
26787
|
break;
|
|
26872
26788
|
case "--emoji":
|
|
26873
|
-
emoji =
|
|
26789
|
+
emoji = requireValue9(rest, token);
|
|
26874
26790
|
break;
|
|
26875
26791
|
case "--message":
|
|
26876
|
-
message =
|
|
26792
|
+
message = requireValue9(rest, token);
|
|
26877
26793
|
break;
|
|
26878
26794
|
case "--remove":
|
|
26879
26795
|
remove = true;
|
|
@@ -26891,7 +26807,7 @@ function parseIm1ReactArgs(tokens) {
|
|
|
26891
26807
|
}
|
|
26892
26808
|
return { type: "collect" /* Collect */, action: "react", thread, emoji, message, remove, dryRun };
|
|
26893
26809
|
}
|
|
26894
|
-
function
|
|
26810
|
+
function requireValue9(tokens, optionName) {
|
|
26895
26811
|
const value = tokens.shift();
|
|
26896
26812
|
if (!value || value.startsWith("--")) {
|
|
26897
26813
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -27015,12 +26931,12 @@ function parseShared(tokens) {
|
|
|
27015
26931
|
case "--title":
|
|
27016
26932
|
case "--bot-a":
|
|
27017
26933
|
case "--bot-b":
|
|
27018
|
-
options.set(token,
|
|
26934
|
+
options.set(token, requireValue10(tokens, token));
|
|
27019
26935
|
break;
|
|
27020
26936
|
case "--member":
|
|
27021
26937
|
case "--recipient": {
|
|
27022
26938
|
const values = multiOptions.get(token) ?? [];
|
|
27023
|
-
values.push(
|
|
26939
|
+
values.push(requireValue10(tokens, token));
|
|
27024
26940
|
multiOptions.set(token, values);
|
|
27025
26941
|
break;
|
|
27026
26942
|
}
|
|
@@ -27046,7 +26962,7 @@ function requiredOption(options, option) {
|
|
|
27046
26962
|
}
|
|
27047
26963
|
return value;
|
|
27048
26964
|
}
|
|
27049
|
-
function
|
|
26965
|
+
function requireValue10(tokens, option) {
|
|
27050
26966
|
const value = tokens.shift();
|
|
27051
26967
|
if (!value || value.startsWith("--")) {
|
|
27052
26968
|
throw new Error(`Missing value for ${option}`);
|
|
@@ -27156,9 +27072,16 @@ var HELP_TEXT = [
|
|
|
27156
27072
|
` ${import_chalk4.default.gray(" list [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
27157
27073
|
` ${import_chalk4.default.gray(" get <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
27158
27074
|
` ${import_chalk4.default.gray(" create <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
27159
|
-
` ${import_chalk4.default.cyan("role")} Manage
|
|
27075
|
+
` ${import_chalk4.default.cyan("role")} Manage scoped roles and permissions via auth-api`,
|
|
27160
27076
|
` ${import_chalk4.default.gray(" definition list [--base-url <url>] [--json]")}`,
|
|
27161
27077
|
` ${import_chalk4.default.gray(" definition create <role> [--display-name <name>] [--description <text>] [--base-url <url>] [--json]")}`,
|
|
27078
|
+
` ${import_chalk4.default.gray(" definition update <role> [--display-name <name>] [--description <text>] [--status active|disabled]")}`,
|
|
27079
|
+
` ${import_chalk4.default.gray(" permission list|create|update [<action>] [--scope-type platform|namespace] [--risk H|M|L] [--status active|disabled]")}`,
|
|
27080
|
+
` ${import_chalk4.default.gray(" grant list|add|remove --role <role> [--permission <action>] [--scope platform | --namespace <ns|*>]")}`,
|
|
27081
|
+
` ${import_chalk4.default.gray(" binding list|add|remove [--account <id>] [--role <role>]")}`,
|
|
27082
|
+
` ${import_chalk4.default.gray(" check --permission <action> (--scope platform | --namespace <ns>) [--account <id>]")}`,
|
|
27083
|
+
` ${import_chalk4.default.gray(" migration preview|apply [--risk-model] (root only)")}`,
|
|
27084
|
+
` ${import_chalk4.default.gray(" roles: admin (platform), blue/admin (namespace); shared flags: --base-url <url> --json")}`,
|
|
27162
27085
|
` ${import_chalk4.default.gray(" default base URL: https://auth-api-v2.pmate.chat")}`,
|
|
27163
27086
|
` ${import_chalk4.default.cyan("account")} View accounts and manage account role bindings`,
|
|
27164
27087
|
` ${import_chalk4.default.gray(" list [--page <n>] [--page-size <n>] [--mobile <mobile> | --nickname <nickname>] [--base-url <url>] [--json]")}`,
|
|
@@ -27308,10 +27231,10 @@ function parseCommandArgs(args) {
|
|
|
27308
27231
|
const token = rest.shift();
|
|
27309
27232
|
switch (token) {
|
|
27310
27233
|
case "--app":
|
|
27311
|
-
app =
|
|
27234
|
+
app = requireValue11(rest, token);
|
|
27312
27235
|
break;
|
|
27313
27236
|
case "--profile-id":
|
|
27314
|
-
profileId =
|
|
27237
|
+
profileId = requireValue11(rest, token);
|
|
27315
27238
|
break;
|
|
27316
27239
|
case "--access-key":
|
|
27317
27240
|
if (rest[0] && !rest[0].startsWith("--")) {
|
|
@@ -27321,7 +27244,7 @@ function parseCommandArgs(args) {
|
|
|
27321
27244
|
}
|
|
27322
27245
|
break;
|
|
27323
27246
|
case "--access-key-file":
|
|
27324
|
-
accessKeyFile =
|
|
27247
|
+
accessKeyFile = requireValue11(rest, token);
|
|
27325
27248
|
break;
|
|
27326
27249
|
case "--select-profile":
|
|
27327
27250
|
selectProfile = true;
|
|
@@ -27443,7 +27366,7 @@ function parseVercelArgs(tokens) {
|
|
|
27443
27366
|
const token = rest.shift();
|
|
27444
27367
|
switch (token) {
|
|
27445
27368
|
case "--scope":
|
|
27446
|
-
scope =
|
|
27369
|
+
scope = requireValue11(rest, token);
|
|
27447
27370
|
break;
|
|
27448
27371
|
default:
|
|
27449
27372
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -27463,10 +27386,10 @@ function parseVercelArgs(tokens) {
|
|
|
27463
27386
|
const token = rest.shift();
|
|
27464
27387
|
switch (token) {
|
|
27465
27388
|
case "--scope":
|
|
27466
|
-
scope =
|
|
27389
|
+
scope = requireValue11(rest, token);
|
|
27467
27390
|
break;
|
|
27468
27391
|
case "--project":
|
|
27469
|
-
project =
|
|
27392
|
+
project = requireValue11(rest, token);
|
|
27470
27393
|
break;
|
|
27471
27394
|
case "--last-week":
|
|
27472
27395
|
lastWeek = true;
|
|
@@ -27497,16 +27420,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
27497
27420
|
const token = rest.shift();
|
|
27498
27421
|
switch (token) {
|
|
27499
27422
|
case "--type":
|
|
27500
|
-
options.dnsType =
|
|
27423
|
+
options.dnsType = requireValue11(rest, token);
|
|
27501
27424
|
break;
|
|
27502
27425
|
case "--value":
|
|
27503
|
-
options.dnsValue =
|
|
27426
|
+
options.dnsValue = requireValue11(rest, token);
|
|
27504
27427
|
break;
|
|
27505
27428
|
case "--rr":
|
|
27506
|
-
options.dnsRr =
|
|
27429
|
+
options.dnsRr = requireValue11(rest, token);
|
|
27507
27430
|
break;
|
|
27508
27431
|
case "--ttl": {
|
|
27509
|
-
const ttlValue =
|
|
27432
|
+
const ttlValue = requireValue11(rest, token);
|
|
27510
27433
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
27511
27434
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
27512
27435
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -27515,7 +27438,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
27515
27438
|
break;
|
|
27516
27439
|
}
|
|
27517
27440
|
case "--domain":
|
|
27518
|
-
options.dnsDomain =
|
|
27441
|
+
options.dnsDomain = requireValue11(rest, token);
|
|
27519
27442
|
break;
|
|
27520
27443
|
default:
|
|
27521
27444
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -27548,13 +27471,13 @@ function parseBucketArgs(tokens) {
|
|
|
27548
27471
|
options.bucketCreate = true;
|
|
27549
27472
|
break;
|
|
27550
27473
|
case "--name":
|
|
27551
|
-
options.bucketName =
|
|
27474
|
+
options.bucketName = requireValue11(rest, token);
|
|
27552
27475
|
break;
|
|
27553
27476
|
case "--subdomain":
|
|
27554
|
-
options.bucketSubdomain =
|
|
27477
|
+
options.bucketSubdomain = requireValue11(rest, token);
|
|
27555
27478
|
break;
|
|
27556
27479
|
case "--domain":
|
|
27557
|
-
options.bucketDomain =
|
|
27480
|
+
options.bucketDomain = requireValue11(rest, token);
|
|
27558
27481
|
break;
|
|
27559
27482
|
default:
|
|
27560
27483
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -27586,7 +27509,7 @@ function parseDevArgs(tokens) {
|
|
|
27586
27509
|
const token = rest.shift();
|
|
27587
27510
|
switch (token) {
|
|
27588
27511
|
case "--cwd":
|
|
27589
|
-
options.devCwd =
|
|
27512
|
+
options.devCwd = requireValue11(rest, token);
|
|
27590
27513
|
break;
|
|
27591
27514
|
default:
|
|
27592
27515
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -27606,7 +27529,7 @@ function parseDeleteArgs(tokens) {
|
|
|
27606
27529
|
const token = rest.shift();
|
|
27607
27530
|
switch (token) {
|
|
27608
27531
|
case "--cwd":
|
|
27609
|
-
deleteCwd =
|
|
27532
|
+
deleteCwd = requireValue11(rest, token);
|
|
27610
27533
|
break;
|
|
27611
27534
|
default:
|
|
27612
27535
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -27640,13 +27563,13 @@ function parseOssArgs(tokens) {
|
|
|
27640
27563
|
const token = rest.shift();
|
|
27641
27564
|
switch (token) {
|
|
27642
27565
|
case "--bucket":
|
|
27643
|
-
bucket2 =
|
|
27566
|
+
bucket2 = requireValue11(rest, token);
|
|
27644
27567
|
break;
|
|
27645
27568
|
case "--file":
|
|
27646
|
-
filePath =
|
|
27569
|
+
filePath = requireValue11(rest, token);
|
|
27647
27570
|
break;
|
|
27648
27571
|
case "--key":
|
|
27649
|
-
objectKey =
|
|
27572
|
+
objectKey = requireValue11(rest, token);
|
|
27650
27573
|
break;
|
|
27651
27574
|
default:
|
|
27652
27575
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -27679,7 +27602,7 @@ function parseEnvArgs(tokens) {
|
|
|
27679
27602
|
throw new Error("Only one env action is allowed.");
|
|
27680
27603
|
}
|
|
27681
27604
|
action = "set";
|
|
27682
|
-
key =
|
|
27605
|
+
key = requireValue11(rest, token);
|
|
27683
27606
|
break;
|
|
27684
27607
|
case "--list":
|
|
27685
27608
|
if (action) {
|
|
@@ -27692,17 +27615,17 @@ function parseEnvArgs(tokens) {
|
|
|
27692
27615
|
throw new Error("Only one env action is allowed.");
|
|
27693
27616
|
}
|
|
27694
27617
|
action = "delete";
|
|
27695
|
-
key =
|
|
27618
|
+
key = requireValue11(rest, token);
|
|
27696
27619
|
break;
|
|
27697
27620
|
case "--value":
|
|
27698
|
-
value =
|
|
27621
|
+
value = requireValue11(rest, token);
|
|
27699
27622
|
break;
|
|
27700
27623
|
case "--verbose":
|
|
27701
27624
|
case "-v":
|
|
27702
27625
|
verbose = true;
|
|
27703
27626
|
break;
|
|
27704
27627
|
case "--cwd":
|
|
27705
|
-
cwd =
|
|
27628
|
+
cwd = requireValue11(rest, token);
|
|
27706
27629
|
break;
|
|
27707
27630
|
default:
|
|
27708
27631
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -27737,7 +27660,7 @@ function parseCommitArgs(tokens) {
|
|
|
27737
27660
|
push = true;
|
|
27738
27661
|
break;
|
|
27739
27662
|
case "--cwd":
|
|
27740
|
-
cwd =
|
|
27663
|
+
cwd = requireValue11(rest, token);
|
|
27741
27664
|
break;
|
|
27742
27665
|
default:
|
|
27743
27666
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -27753,10 +27676,10 @@ function parseSummaryArgs(tokens) {
|
|
|
27753
27676
|
const token = rest.shift();
|
|
27754
27677
|
switch (token) {
|
|
27755
27678
|
case "--pr":
|
|
27756
|
-
prRef =
|
|
27679
|
+
prRef = requireValue11(rest, token);
|
|
27757
27680
|
break;
|
|
27758
27681
|
case "--cwd":
|
|
27759
|
-
cwd =
|
|
27682
|
+
cwd = requireValue11(rest, token);
|
|
27760
27683
|
break;
|
|
27761
27684
|
default:
|
|
27762
27685
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -27781,13 +27704,13 @@ function parseQuizArgs(tokens) {
|
|
|
27781
27704
|
const token = rest.shift();
|
|
27782
27705
|
switch (token) {
|
|
27783
27706
|
case "--paper-id":
|
|
27784
|
-
paperId =
|
|
27707
|
+
paperId = requireValue11(rest, token);
|
|
27785
27708
|
break;
|
|
27786
27709
|
case "--base-url":
|
|
27787
|
-
apiBaseUrl =
|
|
27710
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27788
27711
|
break;
|
|
27789
27712
|
case "--link-base":
|
|
27790
|
-
linkBaseUrl =
|
|
27713
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27791
27714
|
break;
|
|
27792
27715
|
default:
|
|
27793
27716
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -27813,16 +27736,16 @@ function parseQuizArgs(tokens) {
|
|
|
27813
27736
|
const token = rest.shift();
|
|
27814
27737
|
switch (token) {
|
|
27815
27738
|
case "--paper-id":
|
|
27816
|
-
paperId =
|
|
27739
|
+
paperId = requireValue11(rest, token);
|
|
27817
27740
|
break;
|
|
27818
27741
|
case "--file":
|
|
27819
|
-
filePath =
|
|
27742
|
+
filePath = requireValue11(rest, token);
|
|
27820
27743
|
break;
|
|
27821
27744
|
case "--base-url":
|
|
27822
|
-
apiBaseUrl =
|
|
27745
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27823
27746
|
break;
|
|
27824
27747
|
case "--link-base":
|
|
27825
|
-
linkBaseUrl =
|
|
27748
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27826
27749
|
break;
|
|
27827
27750
|
default:
|
|
27828
27751
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -27852,16 +27775,16 @@ function parseQuizArgs(tokens) {
|
|
|
27852
27775
|
const token = rest.shift();
|
|
27853
27776
|
switch (token) {
|
|
27854
27777
|
case "--paper-id":
|
|
27855
|
-
paperId =
|
|
27778
|
+
paperId = requireValue11(rest, token);
|
|
27856
27779
|
break;
|
|
27857
27780
|
case "--file":
|
|
27858
|
-
filePath =
|
|
27781
|
+
filePath = requireValue11(rest, token);
|
|
27859
27782
|
break;
|
|
27860
27783
|
case "--base-url":
|
|
27861
|
-
apiBaseUrl =
|
|
27784
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27862
27785
|
break;
|
|
27863
27786
|
case "--link-base":
|
|
27864
|
-
linkBaseUrl =
|
|
27787
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27865
27788
|
break;
|
|
27866
27789
|
default:
|
|
27867
27790
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -27892,19 +27815,19 @@ function parseQuizArgs(tokens) {
|
|
|
27892
27815
|
const token = rest.shift();
|
|
27893
27816
|
switch (token) {
|
|
27894
27817
|
case "--paper-id":
|
|
27895
|
-
paperId =
|
|
27818
|
+
paperId = requireValue11(rest, token);
|
|
27896
27819
|
break;
|
|
27897
27820
|
case "--step-id":
|
|
27898
|
-
stepId =
|
|
27821
|
+
stepId = requireValue11(rest, token);
|
|
27899
27822
|
break;
|
|
27900
27823
|
case "--file":
|
|
27901
|
-
filePath =
|
|
27824
|
+
filePath = requireValue11(rest, token);
|
|
27902
27825
|
break;
|
|
27903
27826
|
case "--base-url":
|
|
27904
|
-
apiBaseUrl =
|
|
27827
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27905
27828
|
break;
|
|
27906
27829
|
case "--link-base":
|
|
27907
|
-
linkBaseUrl =
|
|
27830
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27908
27831
|
break;
|
|
27909
27832
|
default:
|
|
27910
27833
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -27938,16 +27861,16 @@ function parseQuizArgs(tokens) {
|
|
|
27938
27861
|
const token = rest.shift();
|
|
27939
27862
|
switch (token) {
|
|
27940
27863
|
case "--paper-id":
|
|
27941
|
-
paperId =
|
|
27864
|
+
paperId = requireValue11(rest, token);
|
|
27942
27865
|
break;
|
|
27943
27866
|
case "--step-ids":
|
|
27944
|
-
stepIdsRaw =
|
|
27867
|
+
stepIdsRaw = requireValue11(rest, token);
|
|
27945
27868
|
break;
|
|
27946
27869
|
case "--base-url":
|
|
27947
|
-
apiBaseUrl =
|
|
27870
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27948
27871
|
break;
|
|
27949
27872
|
case "--link-base":
|
|
27950
|
-
linkBaseUrl =
|
|
27873
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27951
27874
|
break;
|
|
27952
27875
|
default:
|
|
27953
27876
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -27981,16 +27904,16 @@ function parseQuizArgs(tokens) {
|
|
|
27981
27904
|
const token = rest.shift();
|
|
27982
27905
|
switch (token) {
|
|
27983
27906
|
case "--paper-id":
|
|
27984
|
-
paperId =
|
|
27907
|
+
paperId = requireValue11(rest, token);
|
|
27985
27908
|
break;
|
|
27986
27909
|
case "--step-id":
|
|
27987
|
-
stepId =
|
|
27910
|
+
stepId = requireValue11(rest, token);
|
|
27988
27911
|
break;
|
|
27989
27912
|
case "--base-url":
|
|
27990
|
-
apiBaseUrl =
|
|
27913
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
27991
27914
|
break;
|
|
27992
27915
|
case "--link-base":
|
|
27993
|
-
linkBaseUrl =
|
|
27916
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
27994
27917
|
break;
|
|
27995
27918
|
default:
|
|
27996
27919
|
throw new Error(`Unknown quiz delete-step option: ${token}`);
|
|
@@ -28019,13 +27942,13 @@ function parseQuizArgs(tokens) {
|
|
|
28019
27942
|
const token = rest.shift();
|
|
28020
27943
|
switch (token) {
|
|
28021
27944
|
case "--paper-id":
|
|
28022
|
-
paperId =
|
|
27945
|
+
paperId = requireValue11(rest, token);
|
|
28023
27946
|
break;
|
|
28024
27947
|
case "--base-url":
|
|
28025
|
-
apiBaseUrl =
|
|
27948
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
28026
27949
|
break;
|
|
28027
27950
|
case "--link-base":
|
|
28028
|
-
linkBaseUrl =
|
|
27951
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
28029
27952
|
break;
|
|
28030
27953
|
default:
|
|
28031
27954
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -28050,13 +27973,13 @@ function parseQuizArgs(tokens) {
|
|
|
28050
27973
|
const token = rest.shift();
|
|
28051
27974
|
switch (token) {
|
|
28052
27975
|
case "--paper-id":
|
|
28053
|
-
paperId =
|
|
27976
|
+
paperId = requireValue11(rest, token);
|
|
28054
27977
|
break;
|
|
28055
27978
|
case "--base-url":
|
|
28056
|
-
apiBaseUrl =
|
|
27979
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
28057
27980
|
break;
|
|
28058
27981
|
case "--link-base":
|
|
28059
|
-
linkBaseUrl =
|
|
27982
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
28060
27983
|
break;
|
|
28061
27984
|
default:
|
|
28062
27985
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -28085,22 +28008,22 @@ function parseQuizArgs(tokens) {
|
|
|
28085
28008
|
const token = rest.shift();
|
|
28086
28009
|
switch (token) {
|
|
28087
28010
|
case "--paper-id":
|
|
28088
|
-
paperId =
|
|
28011
|
+
paperId = requireValue11(rest, token);
|
|
28089
28012
|
break;
|
|
28090
28013
|
case "--step-id":
|
|
28091
|
-
stepId =
|
|
28014
|
+
stepId = requireValue11(rest, token);
|
|
28092
28015
|
break;
|
|
28093
28016
|
case "--file":
|
|
28094
|
-
filePath =
|
|
28017
|
+
filePath = requireValue11(rest, token);
|
|
28095
28018
|
break;
|
|
28096
28019
|
case "--new-paper-id":
|
|
28097
|
-
newPaperId =
|
|
28020
|
+
newPaperId = requireValue11(rest, token);
|
|
28098
28021
|
break;
|
|
28099
28022
|
case "--base-url":
|
|
28100
|
-
apiBaseUrl =
|
|
28023
|
+
apiBaseUrl = requireValue11(rest, token);
|
|
28101
28024
|
break;
|
|
28102
28025
|
case "--link-base":
|
|
28103
|
-
linkBaseUrl =
|
|
28026
|
+
linkBaseUrl = requireValue11(rest, token);
|
|
28104
28027
|
break;
|
|
28105
28028
|
case "--activate":
|
|
28106
28029
|
activate = true;
|
|
@@ -28190,10 +28113,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
28190
28113
|
const token = rest.shift();
|
|
28191
28114
|
switch (token) {
|
|
28192
28115
|
case "--account":
|
|
28193
|
-
account =
|
|
28116
|
+
account = requireValue11(rest, token);
|
|
28194
28117
|
break;
|
|
28195
28118
|
case "--cwd":
|
|
28196
|
-
cwd =
|
|
28119
|
+
cwd = requireValue11(rest, token);
|
|
28197
28120
|
break;
|
|
28198
28121
|
default:
|
|
28199
28122
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28222,35 +28145,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
28222
28145
|
const token = rest.shift();
|
|
28223
28146
|
switch (token) {
|
|
28224
28147
|
case "--account":
|
|
28225
|
-
account =
|
|
28148
|
+
account = requireValue11(rest, token);
|
|
28226
28149
|
break;
|
|
28227
28150
|
case "--repl":
|
|
28228
28151
|
useRepl = true;
|
|
28229
28152
|
break;
|
|
28230
28153
|
case "--title":
|
|
28231
|
-
title =
|
|
28154
|
+
title = requireValue11(rest, token);
|
|
28232
28155
|
break;
|
|
28233
28156
|
case "--desc":
|
|
28234
28157
|
case "--description":
|
|
28235
|
-
description = decodeEscapedNewlines(
|
|
28158
|
+
description = decodeEscapedNewlines(requireValue11(rest, token));
|
|
28236
28159
|
break;
|
|
28237
28160
|
case "--team-id":
|
|
28238
|
-
teamId =
|
|
28161
|
+
teamId = requireValue11(rest, token);
|
|
28239
28162
|
break;
|
|
28240
28163
|
case "--team-key":
|
|
28241
|
-
teamKey =
|
|
28164
|
+
teamKey = requireValue11(rest, token);
|
|
28242
28165
|
break;
|
|
28243
28166
|
case "--priority":
|
|
28244
|
-
priority = parseLinearPriority(
|
|
28167
|
+
priority = parseLinearPriority(requireValue11(rest, token));
|
|
28245
28168
|
break;
|
|
28246
28169
|
case "--parent-id":
|
|
28247
|
-
parentId =
|
|
28170
|
+
parentId = requireValue11(rest, token);
|
|
28248
28171
|
break;
|
|
28249
28172
|
case "--state-id":
|
|
28250
|
-
stateId =
|
|
28173
|
+
stateId = requireValue11(rest, token);
|
|
28251
28174
|
break;
|
|
28252
28175
|
case "--cwd":
|
|
28253
|
-
cwd =
|
|
28176
|
+
cwd = requireValue11(rest, token);
|
|
28254
28177
|
break;
|
|
28255
28178
|
default:
|
|
28256
28179
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28285,10 +28208,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
28285
28208
|
const token = rest.shift();
|
|
28286
28209
|
switch (token) {
|
|
28287
28210
|
case "--account":
|
|
28288
|
-
account =
|
|
28211
|
+
account = requireValue11(rest, token);
|
|
28289
28212
|
break;
|
|
28290
28213
|
case "--cwd":
|
|
28291
|
-
cwd =
|
|
28214
|
+
cwd = requireValue11(rest, token);
|
|
28292
28215
|
break;
|
|
28293
28216
|
default:
|
|
28294
28217
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28313,10 +28236,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
28313
28236
|
const token = rest.shift();
|
|
28314
28237
|
switch (token) {
|
|
28315
28238
|
case "--account":
|
|
28316
|
-
account =
|
|
28239
|
+
account = requireValue11(rest, token);
|
|
28317
28240
|
break;
|
|
28318
28241
|
case "--cwd":
|
|
28319
|
-
cwd =
|
|
28242
|
+
cwd = requireValue11(rest, token);
|
|
28320
28243
|
break;
|
|
28321
28244
|
default:
|
|
28322
28245
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28351,32 +28274,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
28351
28274
|
const token = rest.shift();
|
|
28352
28275
|
switch (token) {
|
|
28353
28276
|
case "--account":
|
|
28354
|
-
account =
|
|
28277
|
+
account = requireValue11(rest, token);
|
|
28355
28278
|
break;
|
|
28356
28279
|
case "--title":
|
|
28357
|
-
title =
|
|
28280
|
+
title = requireValue11(rest, token);
|
|
28358
28281
|
break;
|
|
28359
28282
|
case "--desc":
|
|
28360
28283
|
case "--description":
|
|
28361
|
-
description = decodeEscapedNewlines(
|
|
28284
|
+
description = decodeEscapedNewlines(requireValue11(rest, token));
|
|
28362
28285
|
break;
|
|
28363
28286
|
case "--team-id":
|
|
28364
|
-
teamId =
|
|
28287
|
+
teamId = requireValue11(rest, token);
|
|
28365
28288
|
break;
|
|
28366
28289
|
case "--team-key":
|
|
28367
|
-
teamKey =
|
|
28290
|
+
teamKey = requireValue11(rest, token);
|
|
28368
28291
|
break;
|
|
28369
28292
|
case "--priority":
|
|
28370
|
-
priority = parseLinearPriority(
|
|
28293
|
+
priority = parseLinearPriority(requireValue11(rest, token));
|
|
28371
28294
|
break;
|
|
28372
28295
|
case "--parent-id":
|
|
28373
|
-
parentId =
|
|
28296
|
+
parentId = requireValue11(rest, token);
|
|
28374
28297
|
break;
|
|
28375
28298
|
case "--state-id":
|
|
28376
|
-
stateId =
|
|
28299
|
+
stateId = requireValue11(rest, token);
|
|
28377
28300
|
break;
|
|
28378
28301
|
case "--cwd":
|
|
28379
|
-
cwd =
|
|
28302
|
+
cwd = requireValue11(rest, token);
|
|
28380
28303
|
break;
|
|
28381
28304
|
default:
|
|
28382
28305
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28414,10 +28337,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
28414
28337
|
const token = rest.shift();
|
|
28415
28338
|
switch (token) {
|
|
28416
28339
|
case "--account":
|
|
28417
|
-
account =
|
|
28340
|
+
account = requireValue11(rest, token);
|
|
28418
28341
|
break;
|
|
28419
28342
|
case "--cwd":
|
|
28420
|
-
cwd =
|
|
28343
|
+
cwd = requireValue11(rest, token);
|
|
28421
28344
|
break;
|
|
28422
28345
|
default:
|
|
28423
28346
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28444,15 +28367,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
28444
28367
|
const token = rest.shift();
|
|
28445
28368
|
switch (token) {
|
|
28446
28369
|
case "--account":
|
|
28447
|
-
account =
|
|
28370
|
+
account = requireValue11(rest, token);
|
|
28448
28371
|
break;
|
|
28449
28372
|
case "--body":
|
|
28450
28373
|
case "--desc":
|
|
28451
28374
|
case "--description":
|
|
28452
|
-
body = decodeEscapedNewlines(
|
|
28375
|
+
body = decodeEscapedNewlines(requireValue11(rest, token));
|
|
28453
28376
|
break;
|
|
28454
28377
|
case "--cwd":
|
|
28455
|
-
cwd =
|
|
28378
|
+
cwd = requireValue11(rest, token);
|
|
28456
28379
|
break;
|
|
28457
28380
|
default:
|
|
28458
28381
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28482,10 +28405,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
28482
28405
|
const token = rest.shift();
|
|
28483
28406
|
switch (token) {
|
|
28484
28407
|
case "--account":
|
|
28485
|
-
account =
|
|
28408
|
+
account = requireValue11(rest, token);
|
|
28486
28409
|
break;
|
|
28487
28410
|
case "--cwd":
|
|
28488
|
-
cwd =
|
|
28411
|
+
cwd = requireValue11(rest, token);
|
|
28489
28412
|
break;
|
|
28490
28413
|
default:
|
|
28491
28414
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28509,16 +28432,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
28509
28432
|
const token = rest.shift();
|
|
28510
28433
|
switch (token) {
|
|
28511
28434
|
case "--account":
|
|
28512
|
-
account =
|
|
28435
|
+
account = requireValue11(rest, token);
|
|
28513
28436
|
break;
|
|
28514
28437
|
case "--team-id":
|
|
28515
|
-
teamId =
|
|
28438
|
+
teamId = requireValue11(rest, token);
|
|
28516
28439
|
break;
|
|
28517
28440
|
case "--team-key":
|
|
28518
|
-
teamKey =
|
|
28441
|
+
teamKey = requireValue11(rest, token);
|
|
28519
28442
|
break;
|
|
28520
28443
|
case "--cwd":
|
|
28521
|
-
cwd =
|
|
28444
|
+
cwd = requireValue11(rest, token);
|
|
28522
28445
|
break;
|
|
28523
28446
|
default:
|
|
28524
28447
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28541,10 +28464,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
28541
28464
|
const token = rest.shift();
|
|
28542
28465
|
switch (token) {
|
|
28543
28466
|
case "--account":
|
|
28544
|
-
account =
|
|
28467
|
+
account = requireValue11(rest, token);
|
|
28545
28468
|
break;
|
|
28546
28469
|
case "--cwd":
|
|
28547
|
-
cwd =
|
|
28470
|
+
cwd = requireValue11(rest, token);
|
|
28548
28471
|
break;
|
|
28549
28472
|
default:
|
|
28550
28473
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28571,16 +28494,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
28571
28494
|
const token = rest.shift();
|
|
28572
28495
|
switch (token) {
|
|
28573
28496
|
case "--account":
|
|
28574
|
-
account =
|
|
28497
|
+
account = requireValue11(rest, token);
|
|
28575
28498
|
break;
|
|
28576
28499
|
case "--cycle":
|
|
28577
|
-
cycle = parseLinearCycle(
|
|
28500
|
+
cycle = parseLinearCycle(requireValue11(rest, token));
|
|
28578
28501
|
break;
|
|
28579
28502
|
case "--status":
|
|
28580
|
-
status = parseLinearStatus(
|
|
28503
|
+
status = parseLinearStatus(requireValue11(rest, token));
|
|
28581
28504
|
break;
|
|
28582
28505
|
case "--cwd":
|
|
28583
|
-
cwd =
|
|
28506
|
+
cwd = requireValue11(rest, token);
|
|
28584
28507
|
break;
|
|
28585
28508
|
default:
|
|
28586
28509
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28614,28 +28537,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
28614
28537
|
const token = rest.shift();
|
|
28615
28538
|
switch (token) {
|
|
28616
28539
|
case "--account":
|
|
28617
|
-
account =
|
|
28540
|
+
account = requireValue11(rest, token);
|
|
28618
28541
|
break;
|
|
28619
28542
|
case "--team-id":
|
|
28620
|
-
teamId =
|
|
28543
|
+
teamId = requireValue11(rest, token);
|
|
28621
28544
|
break;
|
|
28622
28545
|
case "--team-key":
|
|
28623
|
-
teamKey =
|
|
28546
|
+
teamKey = requireValue11(rest, token);
|
|
28624
28547
|
break;
|
|
28625
28548
|
case "--user":
|
|
28626
|
-
user =
|
|
28549
|
+
user = requireValue11(rest, token);
|
|
28627
28550
|
break;
|
|
28628
28551
|
case "--cycle":
|
|
28629
|
-
cycle = parseLinearCycle(
|
|
28552
|
+
cycle = parseLinearCycle(requireValue11(rest, token));
|
|
28630
28553
|
break;
|
|
28631
28554
|
case "--status":
|
|
28632
|
-
status = parseLinearStatus(
|
|
28555
|
+
status = parseLinearStatus(requireValue11(rest, token));
|
|
28633
28556
|
break;
|
|
28634
28557
|
case "--query":
|
|
28635
|
-
query =
|
|
28558
|
+
query = requireValue11(rest, token).trim();
|
|
28636
28559
|
break;
|
|
28637
28560
|
case "--limit": {
|
|
28638
|
-
const value = Number.parseInt(
|
|
28561
|
+
const value = Number.parseInt(requireValue11(rest, token), 10);
|
|
28639
28562
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
28640
28563
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
28641
28564
|
}
|
|
@@ -28643,7 +28566,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
28643
28566
|
break;
|
|
28644
28567
|
}
|
|
28645
28568
|
case "--cwd":
|
|
28646
|
-
cwd =
|
|
28569
|
+
cwd = requireValue11(rest, token);
|
|
28647
28570
|
break;
|
|
28648
28571
|
default:
|
|
28649
28572
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28684,10 +28607,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
28684
28607
|
useScreenshot = true;
|
|
28685
28608
|
break;
|
|
28686
28609
|
case "--account":
|
|
28687
|
-
account =
|
|
28610
|
+
account = requireValue11(rest, token);
|
|
28688
28611
|
break;
|
|
28689
28612
|
case "--cwd":
|
|
28690
|
-
cwd =
|
|
28613
|
+
cwd = requireValue11(rest, token);
|
|
28691
28614
|
break;
|
|
28692
28615
|
default:
|
|
28693
28616
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -28781,19 +28704,19 @@ function parseNotionArgs(tokens) {
|
|
|
28781
28704
|
const token = rest.shift();
|
|
28782
28705
|
switch (token) {
|
|
28783
28706
|
case "--parent":
|
|
28784
|
-
parentPageId =
|
|
28707
|
+
parentPageId = requireValue11(rest, token);
|
|
28785
28708
|
break;
|
|
28786
28709
|
case "--title":
|
|
28787
|
-
title =
|
|
28710
|
+
title = requireValue11(rest, token);
|
|
28788
28711
|
break;
|
|
28789
28712
|
case "--private":
|
|
28790
28713
|
isPrivate = true;
|
|
28791
28714
|
break;
|
|
28792
28715
|
case "--content":
|
|
28793
|
-
content2 =
|
|
28716
|
+
content2 = requireValue11(rest, token);
|
|
28794
28717
|
break;
|
|
28795
28718
|
case "--file":
|
|
28796
|
-
filePath2 =
|
|
28719
|
+
filePath2 = requireValue11(rest, token);
|
|
28797
28720
|
break;
|
|
28798
28721
|
default:
|
|
28799
28722
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -28837,10 +28760,10 @@ function parseNotionArgs(tokens) {
|
|
|
28837
28760
|
const token = rest.shift();
|
|
28838
28761
|
switch (token) {
|
|
28839
28762
|
case "--content":
|
|
28840
|
-
content =
|
|
28763
|
+
content = requireValue11(rest, token);
|
|
28841
28764
|
break;
|
|
28842
28765
|
case "--file":
|
|
28843
|
-
filePath =
|
|
28766
|
+
filePath = requireValue11(rest, token);
|
|
28844
28767
|
break;
|
|
28845
28768
|
case "--append":
|
|
28846
28769
|
append = true;
|
|
@@ -28885,11 +28808,11 @@ function parseRandomArgs(tokens) {
|
|
|
28885
28808
|
mode = "easy";
|
|
28886
28809
|
break;
|
|
28887
28810
|
case "--length":
|
|
28888
|
-
length = parsePositiveInt3(
|
|
28811
|
+
length = parsePositiveInt3(requireValue11(rest, token), token);
|
|
28889
28812
|
seenLength = true;
|
|
28890
28813
|
break;
|
|
28891
28814
|
case "--charset": {
|
|
28892
|
-
const value =
|
|
28815
|
+
const value = requireValue11(rest, token);
|
|
28893
28816
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
28894
28817
|
throw new Error(
|
|
28895
28818
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -28900,18 +28823,18 @@ function parseRandomArgs(tokens) {
|
|
|
28900
28823
|
break;
|
|
28901
28824
|
}
|
|
28902
28825
|
case "--count":
|
|
28903
|
-
count = parsePositiveInt3(
|
|
28826
|
+
count = parsePositiveInt3(requireValue11(rest, token), token);
|
|
28904
28827
|
break;
|
|
28905
28828
|
case "--words":
|
|
28906
|
-
words = parsePositiveInt3(
|
|
28829
|
+
words = parsePositiveInt3(requireValue11(rest, token), token);
|
|
28907
28830
|
seenWords = true;
|
|
28908
28831
|
break;
|
|
28909
28832
|
case "--digits":
|
|
28910
|
-
digits = parseNonNegativeInt(
|
|
28833
|
+
digits = parseNonNegativeInt(requireValue11(rest, token), token);
|
|
28911
28834
|
seenDigits = true;
|
|
28912
28835
|
break;
|
|
28913
28836
|
case "--separator":
|
|
28914
|
-
separator =
|
|
28837
|
+
separator = requireValue11(rest, token);
|
|
28915
28838
|
seenSeparator = true;
|
|
28916
28839
|
break;
|
|
28917
28840
|
default:
|
|
@@ -28942,7 +28865,7 @@ function parseRandomArgs(tokens) {
|
|
|
28942
28865
|
count
|
|
28943
28866
|
};
|
|
28944
28867
|
}
|
|
28945
|
-
function
|
|
28868
|
+
function requireValue11(tokens, optionName) {
|
|
28946
28869
|
const value = tokens.shift();
|
|
28947
28870
|
if (!value) {
|
|
28948
28871
|
throw new Error(`Missing value for ${optionName}`);
|