@pmate/cli 0.21.10 → 0.21.11
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 +97 -1
- package/dist/index.js +914 -140
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9435,8 +9435,8 @@ __export(index_exports, {
|
|
|
9435
9435
|
parseCommandArgs: () => parseCommandArgs
|
|
9436
9436
|
});
|
|
9437
9437
|
module.exports = __toCommonJS(index_exports);
|
|
9438
|
-
var
|
|
9439
|
-
var
|
|
9438
|
+
var import_node_fs22 = require("fs");
|
|
9439
|
+
var import_node_path27 = __toESM(require("path"));
|
|
9440
9440
|
var import_chalk4 = __toESM(require("chalk"));
|
|
9441
9441
|
|
|
9442
9442
|
// src/cli.ts
|
|
@@ -14585,9 +14585,9 @@ ${indent}\`\`\``;
|
|
|
14585
14585
|
static richTextToPlain(richText) {
|
|
14586
14586
|
return richText.map((item) => item.plain_text ?? item.text?.content ?? "").join("").trim();
|
|
14587
14587
|
}
|
|
14588
|
-
static async requestJson(
|
|
14588
|
+
static async requestJson(path28, init) {
|
|
14589
14589
|
const token = this.getToken();
|
|
14590
|
-
const response = await fetch(`${this.baseUrl}${
|
|
14590
|
+
const response = await fetch(`${this.baseUrl}${path28}`, {
|
|
14591
14591
|
method: init.method,
|
|
14592
14592
|
headers: {
|
|
14593
14593
|
Authorization: `Bearer ${token}`,
|
|
@@ -16223,8 +16223,8 @@ function descriptorPathSegments(descriptor) {
|
|
|
16223
16223
|
return ["chains", normalized.chain, "namespaces", normalized.ns, normalized.kind, normalized.name];
|
|
16224
16224
|
}
|
|
16225
16225
|
function buildPathUrl(baseUrl, pathSegments, query) {
|
|
16226
|
-
const
|
|
16227
|
-
const url = new URL(
|
|
16226
|
+
const path28 = `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
16227
|
+
const url = new URL(path28, baseUrl);
|
|
16228
16228
|
if (query) {
|
|
16229
16229
|
for (const [key, value] of Object.entries(query)) {
|
|
16230
16230
|
url.searchParams.set(key, String(value));
|
|
@@ -18306,9 +18306,9 @@ var ServiceRuntimeRunner = class {
|
|
|
18306
18306
|
return tokens;
|
|
18307
18307
|
}
|
|
18308
18308
|
readPathValue(source, pathExpr) {
|
|
18309
|
-
const
|
|
18309
|
+
const path28 = pathExpr.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
18310
18310
|
let cursor = source;
|
|
18311
|
-
for (const segment of
|
|
18311
|
+
for (const segment of path28) {
|
|
18312
18312
|
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
18313
18313
|
return void 0;
|
|
18314
18314
|
}
|
|
@@ -19101,13 +19101,15 @@ var RoleCommandHandler = class {
|
|
|
19101
19101
|
};
|
|
19102
19102
|
|
|
19103
19103
|
// src/commands/AccountCommandHandler.ts
|
|
19104
|
+
var import_node_fs20 = require("fs");
|
|
19105
|
+
var import_node_path25 = __toESM(require("path"));
|
|
19104
19106
|
init_sessionStore();
|
|
19105
19107
|
var AccountCommandHandler = class {
|
|
19106
19108
|
async handle(args) {
|
|
19107
19109
|
const token = this.readToken();
|
|
19108
|
-
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
19109
19110
|
switch (args.action) {
|
|
19110
19111
|
case "view": {
|
|
19112
|
+
const baseUrl = this.resolveAuthBaseUrl(args.baseUrl);
|
|
19111
19113
|
const result = await this.request(
|
|
19112
19114
|
baseUrl,
|
|
19113
19115
|
token,
|
|
@@ -19118,6 +19120,7 @@ var AccountCommandHandler = class {
|
|
|
19118
19120
|
return;
|
|
19119
19121
|
}
|
|
19120
19122
|
case "role-list": {
|
|
19123
|
+
const baseUrl = this.resolveAuthBaseUrl(args.baseUrl);
|
|
19121
19124
|
const items = await this.request(
|
|
19122
19125
|
baseUrl,
|
|
19123
19126
|
token,
|
|
@@ -19128,6 +19131,7 @@ var AccountCommandHandler = class {
|
|
|
19128
19131
|
return;
|
|
19129
19132
|
}
|
|
19130
19133
|
case "role-add": {
|
|
19134
|
+
const baseUrl = this.resolveAuthBaseUrl(args.baseUrl);
|
|
19131
19135
|
const item = await this.request(
|
|
19132
19136
|
baseUrl,
|
|
19133
19137
|
token,
|
|
@@ -19144,6 +19148,7 @@ var AccountCommandHandler = class {
|
|
|
19144
19148
|
return;
|
|
19145
19149
|
}
|
|
19146
19150
|
case "role-remove": {
|
|
19151
|
+
const baseUrl = this.resolveAuthBaseUrl(args.baseUrl);
|
|
19147
19152
|
await this.request(
|
|
19148
19153
|
baseUrl,
|
|
19149
19154
|
token,
|
|
@@ -19158,11 +19163,79 @@ var AccountCommandHandler = class {
|
|
|
19158
19163
|
ui.success(`Removed ${args.role} for ${args.account} in ${args.namespace}`);
|
|
19159
19164
|
return;
|
|
19160
19165
|
}
|
|
19166
|
+
case "visible-app-list": {
|
|
19167
|
+
const baseUrl = this.resolveAppsBaseUrl(args.baseUrl);
|
|
19168
|
+
const result = await this.request(
|
|
19169
|
+
baseUrl,
|
|
19170
|
+
token,
|
|
19171
|
+
"GET",
|
|
19172
|
+
`/accounts/${encodeURIComponent(args.account)}/visible-apps`
|
|
19173
|
+
);
|
|
19174
|
+
this.renderStringList(result.items, args.json, "No visible apps found.");
|
|
19175
|
+
return;
|
|
19176
|
+
}
|
|
19177
|
+
case "visible-app-add": {
|
|
19178
|
+
const baseUrl = this.resolveAppsBaseUrl(args.baseUrl);
|
|
19179
|
+
const item = await this.request(
|
|
19180
|
+
baseUrl,
|
|
19181
|
+
token,
|
|
19182
|
+
"PUT",
|
|
19183
|
+
`/accounts/${encodeURIComponent(args.account)}/visible-apps/${encodePathSegment(args.app)}`
|
|
19184
|
+
);
|
|
19185
|
+
ui.success(`Added visible app ${item.appId} for ${item.ownerId}`);
|
|
19186
|
+
this.renderJson(item, args.json);
|
|
19187
|
+
return;
|
|
19188
|
+
}
|
|
19189
|
+
case "visible-app-remove": {
|
|
19190
|
+
const baseUrl = this.resolveAppsBaseUrl(args.baseUrl);
|
|
19191
|
+
const result = await this.request(
|
|
19192
|
+
baseUrl,
|
|
19193
|
+
token,
|
|
19194
|
+
"DELETE",
|
|
19195
|
+
`/accounts/${encodeURIComponent(args.account)}/visible-apps/${encodePathSegment(args.app)}`
|
|
19196
|
+
);
|
|
19197
|
+
ui.success(
|
|
19198
|
+
result.removed ? `Removed visible app ${result.appId} for ${result.ownerId}` : `Visible app ${result.appId} was already absent for ${result.ownerId}`
|
|
19199
|
+
);
|
|
19200
|
+
this.renderJson(result, args.json);
|
|
19201
|
+
return;
|
|
19202
|
+
}
|
|
19203
|
+
case "visible-app-set": {
|
|
19204
|
+
const baseUrl = this.resolveAppsBaseUrl(args.baseUrl);
|
|
19205
|
+
const items = this.resolveVisibleAppsInput(args);
|
|
19206
|
+
const result = await this.request(
|
|
19207
|
+
baseUrl,
|
|
19208
|
+
token,
|
|
19209
|
+
"PUT",
|
|
19210
|
+
`/accounts/${encodeURIComponent(args.account)}/visible-apps`,
|
|
19211
|
+
items
|
|
19212
|
+
);
|
|
19213
|
+
ui.success(`Updated visible apps for ${args.account}`);
|
|
19214
|
+
this.renderJson(result.items, args.json);
|
|
19215
|
+
return;
|
|
19216
|
+
}
|
|
19217
|
+
case "visible-app-resolve": {
|
|
19218
|
+
const baseUrl = this.resolveAppsBaseUrl(args.baseUrl);
|
|
19219
|
+
const result = await this.request(
|
|
19220
|
+
baseUrl,
|
|
19221
|
+
token,
|
|
19222
|
+
"GET",
|
|
19223
|
+
"/me/visible-apps"
|
|
19224
|
+
);
|
|
19225
|
+
this.renderJson(result.items, args.json);
|
|
19226
|
+
if (!args.json) {
|
|
19227
|
+
this.renderResolvedApps(result.items);
|
|
19228
|
+
}
|
|
19229
|
+
return;
|
|
19230
|
+
}
|
|
19161
19231
|
}
|
|
19162
19232
|
}
|
|
19163
|
-
|
|
19233
|
+
resolveAuthBaseUrl(baseUrl) {
|
|
19164
19234
|
return (baseUrl || process.env.PMATE_AUTH_API_BASE_URL || process.env.AUTH_API_BASE_URL || "https://auth-api-v2.pmate.chat").replace(/\/+$/, "");
|
|
19165
19235
|
}
|
|
19236
|
+
resolveAppsBaseUrl(baseUrl) {
|
|
19237
|
+
return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
19238
|
+
}
|
|
19166
19239
|
readToken() {
|
|
19167
19240
|
return readRequiredSession({
|
|
19168
19241
|
preferredApp: DEFAULT_APP_ID,
|
|
@@ -19217,6 +19290,19 @@ var AccountCommandHandler = class {
|
|
|
19217
19290
|
});
|
|
19218
19291
|
}
|
|
19219
19292
|
}
|
|
19293
|
+
renderStringList(items, asJson, emptyMessage) {
|
|
19294
|
+
if (asJson) {
|
|
19295
|
+
ui.plain(JSON.stringify(items, null, 2));
|
|
19296
|
+
return;
|
|
19297
|
+
}
|
|
19298
|
+
if (items.length === 0) {
|
|
19299
|
+
ui.warn(emptyMessage);
|
|
19300
|
+
return;
|
|
19301
|
+
}
|
|
19302
|
+
for (const item of items) {
|
|
19303
|
+
ui.plain(item);
|
|
19304
|
+
}
|
|
19305
|
+
}
|
|
19220
19306
|
renderAccountView(items, asJson) {
|
|
19221
19307
|
if (asJson) {
|
|
19222
19308
|
ui.plain(JSON.stringify(items, null, 2));
|
|
@@ -19247,7 +19333,293 @@ var AccountCommandHandler = class {
|
|
|
19247
19333
|
}
|
|
19248
19334
|
ui.plain(JSON.stringify(value, null, 2));
|
|
19249
19335
|
}
|
|
19336
|
+
renderResolvedApps(items) {
|
|
19337
|
+
if (items.length === 0) {
|
|
19338
|
+
ui.warn("No visible apps found.");
|
|
19339
|
+
return;
|
|
19340
|
+
}
|
|
19341
|
+
for (const item of items) {
|
|
19342
|
+
ui.plain(item.id);
|
|
19343
|
+
}
|
|
19344
|
+
}
|
|
19345
|
+
resolveVisibleAppsInput(args) {
|
|
19346
|
+
if (args.apps && args.apps.length > 0) {
|
|
19347
|
+
return args.apps;
|
|
19348
|
+
}
|
|
19349
|
+
if (!args.filePath) {
|
|
19350
|
+
throw new Error("Missing visible apps input");
|
|
19351
|
+
}
|
|
19352
|
+
const absolutePath = this.resolveFilePath(args.filePath);
|
|
19353
|
+
if (!(0, import_node_fs20.existsSync)(absolutePath)) {
|
|
19354
|
+
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
19355
|
+
}
|
|
19356
|
+
const raw = (0, import_node_fs20.readFileSync)(absolutePath, "utf8");
|
|
19357
|
+
let parsed;
|
|
19358
|
+
try {
|
|
19359
|
+
parsed = JSON.parse(raw);
|
|
19360
|
+
} catch (error) {
|
|
19361
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19362
|
+
throw new Error(`Invalid JSON in ${absolutePath}: ${message}`);
|
|
19363
|
+
}
|
|
19364
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
19365
|
+
throw new Error(`Expected ${absolutePath} to contain a JSON string array`);
|
|
19366
|
+
}
|
|
19367
|
+
return parsed;
|
|
19368
|
+
}
|
|
19369
|
+
resolveFilePath(filePath) {
|
|
19370
|
+
return import_node_path25.default.resolve(process.cwd(), filePath);
|
|
19371
|
+
}
|
|
19250
19372
|
};
|
|
19373
|
+
function encodePathSegment(value) {
|
|
19374
|
+
return value.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
19375
|
+
}
|
|
19376
|
+
|
|
19377
|
+
// src/commands/OrgCommandHandler.ts
|
|
19378
|
+
var import_node_fs21 = require("fs");
|
|
19379
|
+
var import_node_path26 = __toESM(require("path"));
|
|
19380
|
+
init_sessionStore();
|
|
19381
|
+
var OrgCommandHandler = class {
|
|
19382
|
+
async handle(args) {
|
|
19383
|
+
const token = this.readToken();
|
|
19384
|
+
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
19385
|
+
switch (args.action) {
|
|
19386
|
+
case "list": {
|
|
19387
|
+
const result = await this.request(baseUrl, token, "GET", "/orgs");
|
|
19388
|
+
this.renderJson(result.items, args.json);
|
|
19389
|
+
if (!args.json) {
|
|
19390
|
+
this.renderOrgList(result.items);
|
|
19391
|
+
}
|
|
19392
|
+
return;
|
|
19393
|
+
}
|
|
19394
|
+
case "get":
|
|
19395
|
+
case "view": {
|
|
19396
|
+
const record = await this.request(
|
|
19397
|
+
baseUrl,
|
|
19398
|
+
token,
|
|
19399
|
+
"GET",
|
|
19400
|
+
`/orgs/${encodeURIComponent(args.orgId)}`
|
|
19401
|
+
);
|
|
19402
|
+
this.renderJson(record, true);
|
|
19403
|
+
return;
|
|
19404
|
+
}
|
|
19405
|
+
case "create": {
|
|
19406
|
+
const record = await this.request(baseUrl, token, "POST", "/orgs", {
|
|
19407
|
+
id: args.orgId,
|
|
19408
|
+
displayName: args.displayName,
|
|
19409
|
+
members: args.members
|
|
19410
|
+
});
|
|
19411
|
+
ui.success(`Created org ${record.id}`);
|
|
19412
|
+
this.renderJson(record, args.json);
|
|
19413
|
+
return;
|
|
19414
|
+
}
|
|
19415
|
+
case "update": {
|
|
19416
|
+
const record = await this.request(
|
|
19417
|
+
baseUrl,
|
|
19418
|
+
token,
|
|
19419
|
+
"PATCH",
|
|
19420
|
+
`/orgs/${encodeURIComponent(args.orgId)}`,
|
|
19421
|
+
{
|
|
19422
|
+
...args.displayName !== void 0 ? { displayName: args.displayName } : {}
|
|
19423
|
+
}
|
|
19424
|
+
);
|
|
19425
|
+
ui.success(`Updated org ${record.id}`);
|
|
19426
|
+
this.renderJson(record, args.json);
|
|
19427
|
+
return;
|
|
19428
|
+
}
|
|
19429
|
+
case "disable": {
|
|
19430
|
+
const record = await this.request(
|
|
19431
|
+
baseUrl,
|
|
19432
|
+
token,
|
|
19433
|
+
"DELETE",
|
|
19434
|
+
`/orgs/${encodeURIComponent(args.orgId)}`
|
|
19435
|
+
);
|
|
19436
|
+
ui.success(`Disabled org ${record.id}`);
|
|
19437
|
+
this.renderJson(record, args.json);
|
|
19438
|
+
return;
|
|
19439
|
+
}
|
|
19440
|
+
case "member-list": {
|
|
19441
|
+
const result = await this.request(
|
|
19442
|
+
baseUrl,
|
|
19443
|
+
token,
|
|
19444
|
+
"GET",
|
|
19445
|
+
`/orgs/${encodeURIComponent(args.orgId)}/members`
|
|
19446
|
+
);
|
|
19447
|
+
this.renderStringList(result.items, args.json, "No members found.");
|
|
19448
|
+
return;
|
|
19449
|
+
}
|
|
19450
|
+
case "member-add": {
|
|
19451
|
+
const record = await this.request(
|
|
19452
|
+
baseUrl,
|
|
19453
|
+
token,
|
|
19454
|
+
"PUT",
|
|
19455
|
+
`/orgs/${encodeURIComponent(args.orgId)}/members/${encodeURIComponent(args.account)}`
|
|
19456
|
+
);
|
|
19457
|
+
ui.success(`Added ${args.account} to ${record.id}`);
|
|
19458
|
+
this.renderJson(record, args.json);
|
|
19459
|
+
return;
|
|
19460
|
+
}
|
|
19461
|
+
case "member-remove": {
|
|
19462
|
+
const record = await this.request(
|
|
19463
|
+
baseUrl,
|
|
19464
|
+
token,
|
|
19465
|
+
"DELETE",
|
|
19466
|
+
`/orgs/${encodeURIComponent(args.orgId)}/members/${encodeURIComponent(args.account)}`
|
|
19467
|
+
);
|
|
19468
|
+
ui.success(`Removed ${args.account} from ${record.id}`);
|
|
19469
|
+
this.renderJson(record, args.json);
|
|
19470
|
+
return;
|
|
19471
|
+
}
|
|
19472
|
+
case "member-set": {
|
|
19473
|
+
const accounts = this.resolveStringArrayInput(args.accounts, args.filePath, "account");
|
|
19474
|
+
const record = await this.request(
|
|
19475
|
+
baseUrl,
|
|
19476
|
+
token,
|
|
19477
|
+
"PUT",
|
|
19478
|
+
`/orgs/${encodeURIComponent(args.orgId)}/members`,
|
|
19479
|
+
accounts
|
|
19480
|
+
);
|
|
19481
|
+
ui.success(`Updated members for ${record.id}`);
|
|
19482
|
+
this.renderJson(record, args.json);
|
|
19483
|
+
return;
|
|
19484
|
+
}
|
|
19485
|
+
case "visible-app-list": {
|
|
19486
|
+
const result = await this.request(
|
|
19487
|
+
baseUrl,
|
|
19488
|
+
token,
|
|
19489
|
+
"GET",
|
|
19490
|
+
`/orgs/${encodeURIComponent(args.orgId)}/visible-apps`
|
|
19491
|
+
);
|
|
19492
|
+
this.renderStringList(result.items, args.json, "No visible apps found.");
|
|
19493
|
+
return;
|
|
19494
|
+
}
|
|
19495
|
+
case "visible-app-add": {
|
|
19496
|
+
const record = await this.request(
|
|
19497
|
+
baseUrl,
|
|
19498
|
+
token,
|
|
19499
|
+
"PUT",
|
|
19500
|
+
`/orgs/${encodeURIComponent(args.orgId)}/visible-apps/${encodePathSegment2(args.app)}`
|
|
19501
|
+
);
|
|
19502
|
+
ui.success(`Added visible app ${record.appId} to ${args.orgId}`);
|
|
19503
|
+
this.renderJson(record, args.json);
|
|
19504
|
+
return;
|
|
19505
|
+
}
|
|
19506
|
+
case "visible-app-remove": {
|
|
19507
|
+
const result = await this.request(
|
|
19508
|
+
baseUrl,
|
|
19509
|
+
token,
|
|
19510
|
+
"DELETE",
|
|
19511
|
+
`/orgs/${encodeURIComponent(args.orgId)}/visible-apps/${encodePathSegment2(args.app)}`
|
|
19512
|
+
);
|
|
19513
|
+
ui.success(
|
|
19514
|
+
result.removed ? `Removed visible app ${result.appId} from ${result.ownerId}` : `Visible app ${result.appId} was already absent from ${result.ownerId}`
|
|
19515
|
+
);
|
|
19516
|
+
this.renderJson(result, args.json);
|
|
19517
|
+
return;
|
|
19518
|
+
}
|
|
19519
|
+
case "visible-app-set": {
|
|
19520
|
+
const apps = this.resolveStringArrayInput(args.apps, args.filePath, "app ref");
|
|
19521
|
+
const result = await this.request(
|
|
19522
|
+
baseUrl,
|
|
19523
|
+
token,
|
|
19524
|
+
"PUT",
|
|
19525
|
+
`/orgs/${encodeURIComponent(args.orgId)}/visible-apps`,
|
|
19526
|
+
apps
|
|
19527
|
+
);
|
|
19528
|
+
ui.success(`Updated visible apps for ${args.orgId}`);
|
|
19529
|
+
this.renderJson(result.items, args.json);
|
|
19530
|
+
return;
|
|
19531
|
+
}
|
|
19532
|
+
}
|
|
19533
|
+
}
|
|
19534
|
+
resolveBaseUrl(baseUrl) {
|
|
19535
|
+
return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
19536
|
+
}
|
|
19537
|
+
readToken() {
|
|
19538
|
+
return readRequiredSession({
|
|
19539
|
+
preferredApp: DEFAULT_APP_ID,
|
|
19540
|
+
fallbackToActiveApp: true
|
|
19541
|
+
}).token;
|
|
19542
|
+
}
|
|
19543
|
+
resolveStringArrayInput(values, filePath, itemLabel) {
|
|
19544
|
+
if (values && values.length > 0) {
|
|
19545
|
+
return values;
|
|
19546
|
+
}
|
|
19547
|
+
if (!filePath) {
|
|
19548
|
+
throw new Error(`Missing ${itemLabel} input`);
|
|
19549
|
+
}
|
|
19550
|
+
const absolutePath = import_node_path26.default.resolve(process.cwd(), filePath);
|
|
19551
|
+
if (!(0, import_node_fs21.existsSync)(absolutePath)) {
|
|
19552
|
+
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
19553
|
+
}
|
|
19554
|
+
const raw = (0, import_node_fs21.readFileSync)(absolutePath, "utf8");
|
|
19555
|
+
let parsed;
|
|
19556
|
+
try {
|
|
19557
|
+
parsed = JSON.parse(raw);
|
|
19558
|
+
} catch (error) {
|
|
19559
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19560
|
+
throw new Error(`Invalid JSON in ${absolutePath}: ${message}`);
|
|
19561
|
+
}
|
|
19562
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
19563
|
+
throw new Error(`Expected ${absolutePath} to contain a JSON string array`);
|
|
19564
|
+
}
|
|
19565
|
+
return parsed;
|
|
19566
|
+
}
|
|
19567
|
+
async request(baseUrl, token, method, pathname, body) {
|
|
19568
|
+
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
19569
|
+
method,
|
|
19570
|
+
headers: {
|
|
19571
|
+
Authorization: `Bearer ${token}`,
|
|
19572
|
+
"Content-Type": "application/json"
|
|
19573
|
+
},
|
|
19574
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
19575
|
+
});
|
|
19576
|
+
let payload = null;
|
|
19577
|
+
try {
|
|
19578
|
+
payload = await response.json();
|
|
19579
|
+
} catch {
|
|
19580
|
+
payload = null;
|
|
19581
|
+
}
|
|
19582
|
+
if (!response.ok || !payload?.success) {
|
|
19583
|
+
throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
19584
|
+
}
|
|
19585
|
+
return payload.data;
|
|
19586
|
+
}
|
|
19587
|
+
renderOrgList(items) {
|
|
19588
|
+
if (items.length === 0) {
|
|
19589
|
+
ui.warn("No orgs found.");
|
|
19590
|
+
return;
|
|
19591
|
+
}
|
|
19592
|
+
for (const item of items) {
|
|
19593
|
+
ui.info(item.id, {
|
|
19594
|
+
displayName: item.displayName,
|
|
19595
|
+
status: item.status,
|
|
19596
|
+
members: item.members
|
|
19597
|
+
});
|
|
19598
|
+
}
|
|
19599
|
+
}
|
|
19600
|
+
renderStringList(items, asJson, emptyMessage) {
|
|
19601
|
+
if (asJson) {
|
|
19602
|
+
ui.plain(JSON.stringify(items, null, 2));
|
|
19603
|
+
return;
|
|
19604
|
+
}
|
|
19605
|
+
if (items.length === 0) {
|
|
19606
|
+
ui.warn(emptyMessage);
|
|
19607
|
+
return;
|
|
19608
|
+
}
|
|
19609
|
+
for (const item of items) {
|
|
19610
|
+
ui.plain(item);
|
|
19611
|
+
}
|
|
19612
|
+
}
|
|
19613
|
+
renderJson(value, asJson) {
|
|
19614
|
+
if (!asJson) {
|
|
19615
|
+
return;
|
|
19616
|
+
}
|
|
19617
|
+
ui.plain(JSON.stringify(value, null, 2));
|
|
19618
|
+
}
|
|
19619
|
+
};
|
|
19620
|
+
function encodePathSegment2(value) {
|
|
19621
|
+
return value.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
19622
|
+
}
|
|
19251
19623
|
|
|
19252
19624
|
// src/agentCommandParser.ts
|
|
19253
19625
|
init_namespacedRef();
|
|
@@ -21020,6 +21392,7 @@ function requireValue7(tokens, optionName) {
|
|
|
21020
21392
|
}
|
|
21021
21393
|
|
|
21022
21394
|
// src/accountCommandParser.ts
|
|
21395
|
+
init_namespacedRef();
|
|
21023
21396
|
function parseAccountArgs(tokens) {
|
|
21024
21397
|
const rest = [...tokens];
|
|
21025
21398
|
const action = rest.shift();
|
|
@@ -21077,6 +21450,102 @@ function parseAccountArgs(tokens) {
|
|
|
21077
21450
|
json: json2
|
|
21078
21451
|
};
|
|
21079
21452
|
}
|
|
21453
|
+
if (action === "visible-app") {
|
|
21454
|
+
const visibleAction = rest.shift();
|
|
21455
|
+
if (!visibleAction) {
|
|
21456
|
+
throw new Error("Missing account visible-app action. Use: account visible-app list|add|remove|set|resolve");
|
|
21457
|
+
}
|
|
21458
|
+
let account2;
|
|
21459
|
+
let app;
|
|
21460
|
+
const apps = [];
|
|
21461
|
+
let filePath;
|
|
21462
|
+
let baseUrl2;
|
|
21463
|
+
let json2 = false;
|
|
21464
|
+
while (rest.length > 0) {
|
|
21465
|
+
const token = rest.shift();
|
|
21466
|
+
switch (token) {
|
|
21467
|
+
case "--account":
|
|
21468
|
+
account2 = requireValue8(rest, token);
|
|
21469
|
+
break;
|
|
21470
|
+
case "--app":
|
|
21471
|
+
app = parseNamespacedRef(requireValue8(rest, token), {
|
|
21472
|
+
entityLabel: "app ref"
|
|
21473
|
+
}).fullId;
|
|
21474
|
+
apps.push(app);
|
|
21475
|
+
break;
|
|
21476
|
+
case "--file":
|
|
21477
|
+
filePath = requireValue8(rest, token);
|
|
21478
|
+
break;
|
|
21479
|
+
case "--base-url":
|
|
21480
|
+
baseUrl2 = requireValue8(rest, token);
|
|
21481
|
+
break;
|
|
21482
|
+
case "--json":
|
|
21483
|
+
json2 = true;
|
|
21484
|
+
break;
|
|
21485
|
+
default:
|
|
21486
|
+
throw new Error(`Unknown account visible-app option: ${token}`);
|
|
21487
|
+
}
|
|
21488
|
+
}
|
|
21489
|
+
if (visibleAction === "resolve") {
|
|
21490
|
+
if (account2 || app || apps.length > 0 || filePath) {
|
|
21491
|
+
throw new Error(
|
|
21492
|
+
"Usage: account visible-app resolve [--base-url <url>] [--json]"
|
|
21493
|
+
);
|
|
21494
|
+
}
|
|
21495
|
+
return {
|
|
21496
|
+
type: "account" /* Account */,
|
|
21497
|
+
action: "visible-app-resolve",
|
|
21498
|
+
baseUrl: baseUrl2,
|
|
21499
|
+
json: json2
|
|
21500
|
+
};
|
|
21501
|
+
}
|
|
21502
|
+
if (visibleAction === "list") {
|
|
21503
|
+
if (!account2) {
|
|
21504
|
+
throw new Error(
|
|
21505
|
+
"Usage: account visible-app list --account <id> [--base-url <url>] [--json]"
|
|
21506
|
+
);
|
|
21507
|
+
}
|
|
21508
|
+
return {
|
|
21509
|
+
type: "account" /* Account */,
|
|
21510
|
+
action: "visible-app-list",
|
|
21511
|
+
account: account2,
|
|
21512
|
+
baseUrl: baseUrl2,
|
|
21513
|
+
json: json2
|
|
21514
|
+
};
|
|
21515
|
+
}
|
|
21516
|
+
if (visibleAction === "add" || visibleAction === "remove") {
|
|
21517
|
+
if (!account2 || !app) {
|
|
21518
|
+
throw new Error(
|
|
21519
|
+
`Usage: account visible-app ${visibleAction} --account <id> --app <ns:app> [--base-url <url>] [--json]`
|
|
21520
|
+
);
|
|
21521
|
+
}
|
|
21522
|
+
return {
|
|
21523
|
+
type: "account" /* Account */,
|
|
21524
|
+
action: visibleAction === "add" ? "visible-app-add" : "visible-app-remove",
|
|
21525
|
+
account: account2,
|
|
21526
|
+
app,
|
|
21527
|
+
baseUrl: baseUrl2,
|
|
21528
|
+
json: json2
|
|
21529
|
+
};
|
|
21530
|
+
}
|
|
21531
|
+
if (visibleAction === "set") {
|
|
21532
|
+
if (!account2 || apps.length === 0 && !filePath || apps.length > 0 && filePath) {
|
|
21533
|
+
throw new Error(
|
|
21534
|
+
"Usage: account visible-app set --account <id> (--app <ns:app> ... | --file <path>) [--base-url <url>] [--json]"
|
|
21535
|
+
);
|
|
21536
|
+
}
|
|
21537
|
+
return {
|
|
21538
|
+
type: "account" /* Account */,
|
|
21539
|
+
action: "visible-app-set",
|
|
21540
|
+
account: account2,
|
|
21541
|
+
apps: apps.length > 0 ? apps : void 0,
|
|
21542
|
+
filePath,
|
|
21543
|
+
baseUrl: baseUrl2,
|
|
21544
|
+
json: json2
|
|
21545
|
+
};
|
|
21546
|
+
}
|
|
21547
|
+
throw new Error(`Unknown account visible-app action: ${visibleAction}`);
|
|
21548
|
+
}
|
|
21080
21549
|
if (action !== "role") {
|
|
21081
21550
|
throw new Error(`Unknown account action: ${action}`);
|
|
21082
21551
|
}
|
|
@@ -21152,6 +21621,283 @@ function requireValue8(tokens, optionName) {
|
|
|
21152
21621
|
return value;
|
|
21153
21622
|
}
|
|
21154
21623
|
|
|
21624
|
+
// src/orgCommandParser.ts
|
|
21625
|
+
init_namespacedRef();
|
|
21626
|
+
function parseOrgArgs(tokens) {
|
|
21627
|
+
const rest = [...tokens];
|
|
21628
|
+
const rawAction = rest.shift();
|
|
21629
|
+
const action = rawAction === "view" ? "view" : rawAction;
|
|
21630
|
+
if (!action) {
|
|
21631
|
+
throw new Error(
|
|
21632
|
+
"Missing org action. Use: org list|get|view|create|update|disable|member|visible-app"
|
|
21633
|
+
);
|
|
21634
|
+
}
|
|
21635
|
+
let baseUrl;
|
|
21636
|
+
let json = false;
|
|
21637
|
+
const takeSharedOptions4 = () => {
|
|
21638
|
+
while (rest.length > 0) {
|
|
21639
|
+
const token = rest[0];
|
|
21640
|
+
if (token === "--base-url") {
|
|
21641
|
+
rest.shift();
|
|
21642
|
+
baseUrl = requireValue9(rest, token);
|
|
21643
|
+
continue;
|
|
21644
|
+
}
|
|
21645
|
+
if (token === "--json") {
|
|
21646
|
+
rest.shift();
|
|
21647
|
+
json = true;
|
|
21648
|
+
continue;
|
|
21649
|
+
}
|
|
21650
|
+
break;
|
|
21651
|
+
}
|
|
21652
|
+
};
|
|
21653
|
+
if (action === "list") {
|
|
21654
|
+
takeSharedOptions4();
|
|
21655
|
+
if (rest.length > 0) {
|
|
21656
|
+
throw new Error(`Unknown org list option: ${rest[0]}`);
|
|
21657
|
+
}
|
|
21658
|
+
return { type: "org" /* Org */, action, baseUrl, json };
|
|
21659
|
+
}
|
|
21660
|
+
if (action === "get" || action === "view" || action === "disable") {
|
|
21661
|
+
const orgId = parseRequiredOrgRef(rest.shift(), action);
|
|
21662
|
+
takeSharedOptions4();
|
|
21663
|
+
if (rest.length > 0) {
|
|
21664
|
+
throw new Error(`Unknown org ${action} option: ${rest[0]}`);
|
|
21665
|
+
}
|
|
21666
|
+
return { type: "org" /* Org */, action, orgId, baseUrl, json };
|
|
21667
|
+
}
|
|
21668
|
+
if (action === "create") {
|
|
21669
|
+
const orgId = parseRequiredOrgRef(rest.shift(), action);
|
|
21670
|
+
let displayName;
|
|
21671
|
+
const members = [];
|
|
21672
|
+
while (rest.length > 0) {
|
|
21673
|
+
const token = rest.shift();
|
|
21674
|
+
switch (token) {
|
|
21675
|
+
case "--display-name":
|
|
21676
|
+
displayName = requireValue9(rest, token);
|
|
21677
|
+
break;
|
|
21678
|
+
case "--member":
|
|
21679
|
+
members.push(requireValue9(rest, token));
|
|
21680
|
+
break;
|
|
21681
|
+
case "--base-url":
|
|
21682
|
+
baseUrl = requireValue9(rest, token);
|
|
21683
|
+
break;
|
|
21684
|
+
case "--json":
|
|
21685
|
+
json = true;
|
|
21686
|
+
break;
|
|
21687
|
+
default:
|
|
21688
|
+
throw new Error(`Unknown org create option: ${token}`);
|
|
21689
|
+
}
|
|
21690
|
+
}
|
|
21691
|
+
if (!displayName) {
|
|
21692
|
+
throw new Error(
|
|
21693
|
+
"Usage: org create <ns:org> --display-name <name> [--member <id> ...] [--base-url <url>] [--json]"
|
|
21694
|
+
);
|
|
21695
|
+
}
|
|
21696
|
+
return {
|
|
21697
|
+
type: "org" /* Org */,
|
|
21698
|
+
action,
|
|
21699
|
+
orgId,
|
|
21700
|
+
displayName,
|
|
21701
|
+
members,
|
|
21702
|
+
baseUrl,
|
|
21703
|
+
json
|
|
21704
|
+
};
|
|
21705
|
+
}
|
|
21706
|
+
if (action === "update") {
|
|
21707
|
+
const orgId = parseRequiredOrgRef(rest.shift(), action);
|
|
21708
|
+
let displayName;
|
|
21709
|
+
while (rest.length > 0) {
|
|
21710
|
+
const token = rest.shift();
|
|
21711
|
+
switch (token) {
|
|
21712
|
+
case "--display-name":
|
|
21713
|
+
displayName = requireValue9(rest, token);
|
|
21714
|
+
break;
|
|
21715
|
+
case "--base-url":
|
|
21716
|
+
baseUrl = requireValue9(rest, token);
|
|
21717
|
+
break;
|
|
21718
|
+
case "--json":
|
|
21719
|
+
json = true;
|
|
21720
|
+
break;
|
|
21721
|
+
default:
|
|
21722
|
+
throw new Error(`Unknown org update option: ${token}`);
|
|
21723
|
+
}
|
|
21724
|
+
}
|
|
21725
|
+
if (displayName === void 0) {
|
|
21726
|
+
throw new Error(
|
|
21727
|
+
"Usage: org update <ns:org> --display-name <name> [--base-url <url>] [--json]"
|
|
21728
|
+
);
|
|
21729
|
+
}
|
|
21730
|
+
return {
|
|
21731
|
+
type: "org" /* Org */,
|
|
21732
|
+
action,
|
|
21733
|
+
orgId,
|
|
21734
|
+
displayName,
|
|
21735
|
+
baseUrl,
|
|
21736
|
+
json
|
|
21737
|
+
};
|
|
21738
|
+
}
|
|
21739
|
+
if (action === "member") {
|
|
21740
|
+
return parseOrgMemberArgs(rest);
|
|
21741
|
+
}
|
|
21742
|
+
if (action === "visible-app") {
|
|
21743
|
+
return parseOrgVisibleAppArgs(rest);
|
|
21744
|
+
}
|
|
21745
|
+
throw new Error(`Unknown org action: ${action}`);
|
|
21746
|
+
function parseOrgMemberArgs(memberTokens) {
|
|
21747
|
+
const subAction = memberTokens.shift();
|
|
21748
|
+
if (!subAction) {
|
|
21749
|
+
throw new Error("Missing org member action. Use: org member list|add|remove|set");
|
|
21750
|
+
}
|
|
21751
|
+
const orgId = parseRequiredOrgRef(memberTokens.shift(), `member ${subAction}`);
|
|
21752
|
+
let account;
|
|
21753
|
+
const accounts = [];
|
|
21754
|
+
let filePath;
|
|
21755
|
+
while (memberTokens.length > 0) {
|
|
21756
|
+
const token = memberTokens.shift();
|
|
21757
|
+
switch (token) {
|
|
21758
|
+
case "--account": {
|
|
21759
|
+
const value = requireValue9(memberTokens, token);
|
|
21760
|
+
account = value;
|
|
21761
|
+
accounts.push(value);
|
|
21762
|
+
break;
|
|
21763
|
+
}
|
|
21764
|
+
case "--file":
|
|
21765
|
+
filePath = requireValue9(memberTokens, token);
|
|
21766
|
+
break;
|
|
21767
|
+
case "--base-url":
|
|
21768
|
+
baseUrl = requireValue9(memberTokens, token);
|
|
21769
|
+
break;
|
|
21770
|
+
case "--json":
|
|
21771
|
+
json = true;
|
|
21772
|
+
break;
|
|
21773
|
+
default:
|
|
21774
|
+
throw new Error(`Unknown org member option: ${token}`);
|
|
21775
|
+
}
|
|
21776
|
+
}
|
|
21777
|
+
if (subAction === "list") {
|
|
21778
|
+
return { type: "org" /* Org */, action: "member-list", orgId, baseUrl, json };
|
|
21779
|
+
}
|
|
21780
|
+
if (subAction === "add" || subAction === "remove") {
|
|
21781
|
+
if (!account) {
|
|
21782
|
+
throw new Error(
|
|
21783
|
+
`Usage: org member ${subAction} <ns:org> --account <id> [--base-url <url>] [--json]`
|
|
21784
|
+
);
|
|
21785
|
+
}
|
|
21786
|
+
return {
|
|
21787
|
+
type: "org" /* Org */,
|
|
21788
|
+
action: subAction === "add" ? "member-add" : "member-remove",
|
|
21789
|
+
orgId,
|
|
21790
|
+
account,
|
|
21791
|
+
baseUrl,
|
|
21792
|
+
json
|
|
21793
|
+
};
|
|
21794
|
+
}
|
|
21795
|
+
if (subAction === "set") {
|
|
21796
|
+
if (accounts.length === 0 && !filePath || accounts.length > 0 && filePath) {
|
|
21797
|
+
throw new Error(
|
|
21798
|
+
"Usage: org member set <ns:org> (--account <id> ... | --file <path>) [--base-url <url>] [--json]"
|
|
21799
|
+
);
|
|
21800
|
+
}
|
|
21801
|
+
return {
|
|
21802
|
+
type: "org" /* Org */,
|
|
21803
|
+
action: "member-set",
|
|
21804
|
+
orgId,
|
|
21805
|
+
accounts: accounts.length > 0 ? accounts : void 0,
|
|
21806
|
+
filePath,
|
|
21807
|
+
baseUrl,
|
|
21808
|
+
json
|
|
21809
|
+
};
|
|
21810
|
+
}
|
|
21811
|
+
throw new Error(`Unknown org member action: ${subAction}`);
|
|
21812
|
+
}
|
|
21813
|
+
function parseOrgVisibleAppArgs(visibleTokens) {
|
|
21814
|
+
const subAction = visibleTokens.shift();
|
|
21815
|
+
if (!subAction) {
|
|
21816
|
+
throw new Error(
|
|
21817
|
+
"Missing org visible-app action. Use: org visible-app list|add|remove|set"
|
|
21818
|
+
);
|
|
21819
|
+
}
|
|
21820
|
+
const orgId = parseRequiredOrgRef(visibleTokens.shift(), `visible-app ${subAction}`);
|
|
21821
|
+
let app;
|
|
21822
|
+
const apps = [];
|
|
21823
|
+
let filePath;
|
|
21824
|
+
while (visibleTokens.length > 0) {
|
|
21825
|
+
const token = visibleTokens.shift();
|
|
21826
|
+
switch (token) {
|
|
21827
|
+
case "--app": {
|
|
21828
|
+
const value = parseNamespacedRef(requireValue9(visibleTokens, token), {
|
|
21829
|
+
entityLabel: "app ref"
|
|
21830
|
+
}).fullId;
|
|
21831
|
+
app = value;
|
|
21832
|
+
apps.push(value);
|
|
21833
|
+
break;
|
|
21834
|
+
}
|
|
21835
|
+
case "--file":
|
|
21836
|
+
filePath = requireValue9(visibleTokens, token);
|
|
21837
|
+
break;
|
|
21838
|
+
case "--base-url":
|
|
21839
|
+
baseUrl = requireValue9(visibleTokens, token);
|
|
21840
|
+
break;
|
|
21841
|
+
case "--json":
|
|
21842
|
+
json = true;
|
|
21843
|
+
break;
|
|
21844
|
+
default:
|
|
21845
|
+
throw new Error(`Unknown org visible-app option: ${token}`);
|
|
21846
|
+
}
|
|
21847
|
+
}
|
|
21848
|
+
if (subAction === "list") {
|
|
21849
|
+
return { type: "org" /* Org */, action: "visible-app-list", orgId, baseUrl, json };
|
|
21850
|
+
}
|
|
21851
|
+
if (subAction === "add" || subAction === "remove") {
|
|
21852
|
+
if (!app) {
|
|
21853
|
+
throw new Error(
|
|
21854
|
+
`Usage: org visible-app ${subAction} <ns:org> --app <ns:app> [--base-url <url>] [--json]`
|
|
21855
|
+
);
|
|
21856
|
+
}
|
|
21857
|
+
return {
|
|
21858
|
+
type: "org" /* Org */,
|
|
21859
|
+
action: subAction === "add" ? "visible-app-add" : "visible-app-remove",
|
|
21860
|
+
orgId,
|
|
21861
|
+
app,
|
|
21862
|
+
baseUrl,
|
|
21863
|
+
json
|
|
21864
|
+
};
|
|
21865
|
+
}
|
|
21866
|
+
if (subAction === "set") {
|
|
21867
|
+
if (apps.length === 0 && !filePath || apps.length > 0 && filePath) {
|
|
21868
|
+
throw new Error(
|
|
21869
|
+
"Usage: org visible-app set <ns:org> (--app <ns:app> ... | --file <path>) [--base-url <url>] [--json]"
|
|
21870
|
+
);
|
|
21871
|
+
}
|
|
21872
|
+
return {
|
|
21873
|
+
type: "org" /* Org */,
|
|
21874
|
+
action: "visible-app-set",
|
|
21875
|
+
orgId,
|
|
21876
|
+
apps: apps.length > 0 ? apps : void 0,
|
|
21877
|
+
filePath,
|
|
21878
|
+
baseUrl,
|
|
21879
|
+
json
|
|
21880
|
+
};
|
|
21881
|
+
}
|
|
21882
|
+
throw new Error(`Unknown org visible-app action: ${subAction}`);
|
|
21883
|
+
}
|
|
21884
|
+
}
|
|
21885
|
+
function parseRequiredOrgRef(value, action) {
|
|
21886
|
+
if (!value || value.startsWith("-")) {
|
|
21887
|
+
throw new Error(`Usage: org ${action} <ns:org>`);
|
|
21888
|
+
}
|
|
21889
|
+
return parseNamespacedRef(value, {
|
|
21890
|
+
entityLabel: "org ref"
|
|
21891
|
+
}).fullId;
|
|
21892
|
+
}
|
|
21893
|
+
function requireValue9(tokens, optionName) {
|
|
21894
|
+
const value = tokens.shift();
|
|
21895
|
+
if (!value || value.startsWith("-")) {
|
|
21896
|
+
throw new Error(`Missing value for ${optionName}`);
|
|
21897
|
+
}
|
|
21898
|
+
return value;
|
|
21899
|
+
}
|
|
21900
|
+
|
|
21155
21901
|
// src/collectCommandParser.ts
|
|
21156
21902
|
function parseCollectArgs(tokens) {
|
|
21157
21903
|
const rest = [...tokens];
|
|
@@ -21170,7 +21916,7 @@ function parseCollectArgs(tokens) {
|
|
|
21170
21916
|
const token = rest.shift();
|
|
21171
21917
|
switch (token) {
|
|
21172
21918
|
case "--source": {
|
|
21173
|
-
const value =
|
|
21919
|
+
const value = requireValue10(rest, token);
|
|
21174
21920
|
if (value !== "cc" && value !== "yelling") {
|
|
21175
21921
|
throw new Error(`Unsupported collect source: ${value}`);
|
|
21176
21922
|
}
|
|
@@ -21178,7 +21924,7 @@ function parseCollectArgs(tokens) {
|
|
|
21178
21924
|
break;
|
|
21179
21925
|
}
|
|
21180
21926
|
case "--endpoint":
|
|
21181
|
-
options.endpoint =
|
|
21927
|
+
options.endpoint = requireValue10(rest, token);
|
|
21182
21928
|
break;
|
|
21183
21929
|
default:
|
|
21184
21930
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -21194,7 +21940,7 @@ function parseCollectArgs(tokens) {
|
|
|
21194
21940
|
}
|
|
21195
21941
|
return { type: "collect" /* Collect */, ...options };
|
|
21196
21942
|
}
|
|
21197
|
-
function
|
|
21943
|
+
function requireValue10(tokens, optionName) {
|
|
21198
21944
|
const value = tokens.shift();
|
|
21199
21945
|
if (!value) {
|
|
21200
21946
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -21229,7 +21975,7 @@ function parsePrepareDevArgs(tokens) {
|
|
|
21229
21975
|
close = true;
|
|
21230
21976
|
break;
|
|
21231
21977
|
case "--env": {
|
|
21232
|
-
const rawValue =
|
|
21978
|
+
const rawValue = requireValue11(rest, token);
|
|
21233
21979
|
const parsed = Number.parseInt(rawValue, 10);
|
|
21234
21980
|
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
21235
21981
|
throw new Error(`Invalid --env value: ${rawValue}`);
|
|
@@ -21238,13 +21984,13 @@ function parsePrepareDevArgs(tokens) {
|
|
|
21238
21984
|
break;
|
|
21239
21985
|
}
|
|
21240
21986
|
case "--env-root":
|
|
21241
|
-
envRoot =
|
|
21987
|
+
envRoot = requireValue11(rest, token);
|
|
21242
21988
|
break;
|
|
21243
21989
|
case "--base-root":
|
|
21244
|
-
baseRoot =
|
|
21990
|
+
baseRoot = requireValue11(rest, token);
|
|
21245
21991
|
break;
|
|
21246
21992
|
case "--note":
|
|
21247
|
-
note =
|
|
21993
|
+
note = requireValue11(rest, token);
|
|
21248
21994
|
break;
|
|
21249
21995
|
case "--json":
|
|
21250
21996
|
json = true;
|
|
@@ -21280,7 +22026,7 @@ function parsePrepareDevArgs(tokens) {
|
|
|
21280
22026
|
json
|
|
21281
22027
|
};
|
|
21282
22028
|
}
|
|
21283
|
-
function
|
|
22029
|
+
function requireValue11(tokens, option) {
|
|
21284
22030
|
const value = tokens.shift();
|
|
21285
22031
|
if (!value || value.startsWith("-")) {
|
|
21286
22032
|
throw new Error(`Missing value for ${option}`);
|
|
@@ -21290,7 +22036,7 @@ function requireValue10(tokens, option) {
|
|
|
21290
22036
|
|
|
21291
22037
|
// src/index.ts
|
|
21292
22038
|
var pkg = JSON.parse(
|
|
21293
|
-
(0,
|
|
22039
|
+
(0, import_node_fs22.readFileSync)(import_node_path27.default.resolve(__dirname, "..", "package.json"), "utf8")
|
|
21294
22040
|
);
|
|
21295
22041
|
var HELP_TEXT = [
|
|
21296
22042
|
import_chalk4.default.bold(`pmate v${pkg.version}`),
|
|
@@ -21406,7 +22152,27 @@ var HELP_TEXT = [
|
|
|
21406
22152
|
` ${import_chalk4.default.gray(" role list --account <id> [--namespace <ns>] [--base-url <url>] [--json]")}`,
|
|
21407
22153
|
` ${import_chalk4.default.gray(" role add --account <id> --namespace <ns> --role <role> [--base-url <url>] [--json]")}`,
|
|
21408
22154
|
` ${import_chalk4.default.gray(" role remove --account <id> --namespace <ns> --role <role> [--base-url <url>] [--json]")}`,
|
|
22155
|
+
` ${import_chalk4.default.gray(" visible-app list --account <id> [--base-url <url>] [--json]")}`,
|
|
22156
|
+
` ${import_chalk4.default.gray(" visible-app add --account <id> --app <ns:app> [--base-url <url>] [--json]")}`,
|
|
22157
|
+
` ${import_chalk4.default.gray(" visible-app remove --account <id> --app <ns:app> [--base-url <url>] [--json]")}`,
|
|
22158
|
+
` ${import_chalk4.default.gray(" visible-app set --account <id> (--app <ns:app> ... | --file <path>) [--base-url <url>] [--json]")}`,
|
|
22159
|
+
` ${import_chalk4.default.gray(" visible-app resolve [--base-url <url>] [--json]")}`,
|
|
21409
22160
|
` ${import_chalk4.default.gray(" default base URL: https://auth-api-v2.pmate.chat")}`,
|
|
22161
|
+
` ${import_chalk4.default.cyan("org")} Manage orgs, org members, and org visible apps via apps-api`,
|
|
22162
|
+
` ${import_chalk4.default.gray(" list [--base-url <url>] [--json]")}`,
|
|
22163
|
+
` ${import_chalk4.default.gray(" get <ns:org> [--base-url <url>] [--json]")}`,
|
|
22164
|
+
` ${import_chalk4.default.gray(" create <ns:org> --display-name <name> [--member <id> ...] [--base-url <url>] [--json]")}`,
|
|
22165
|
+
` ${import_chalk4.default.gray(" update <ns:org> --display-name <name> [--base-url <url>] [--json]")}`,
|
|
22166
|
+
` ${import_chalk4.default.gray(" disable <ns:org> [--base-url <url>] [--json]")}`,
|
|
22167
|
+
` ${import_chalk4.default.gray(" member list <ns:org> [--base-url <url>] [--json]")}`,
|
|
22168
|
+
` ${import_chalk4.default.gray(" member add <ns:org> --account <id> [--base-url <url>] [--json]")}`,
|
|
22169
|
+
` ${import_chalk4.default.gray(" member remove <ns:org> --account <id> [--base-url <url>] [--json]")}`,
|
|
22170
|
+
` ${import_chalk4.default.gray(" member set <ns:org> (--account <id> ... | --file <path>) [--base-url <url>] [--json]")}`,
|
|
22171
|
+
` ${import_chalk4.default.gray(" visible-app list <ns:org> [--base-url <url>] [--json]")}`,
|
|
22172
|
+
` ${import_chalk4.default.gray(" visible-app add <ns:org> --app <ns:app> [--base-url <url>] [--json]")}`,
|
|
22173
|
+
` ${import_chalk4.default.gray(" visible-app remove <ns:org> --app <ns:app> [--base-url <url>] [--json]")}`,
|
|
22174
|
+
` ${import_chalk4.default.gray(" visible-app set <ns:org> (--app <ns:app> ... | --file <path>) [--base-url <url>] [--json]")}`,
|
|
22175
|
+
` ${import_chalk4.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
21410
22176
|
` ${import_chalk4.default.cyan("store")} Manage @pmate/store namespaces, tables, and kv stores`,
|
|
21411
22177
|
` ${import_chalk4.default.gray(" namespace list [--chain <chain>] [--indexer-base-url <url>] [--json]")}`,
|
|
21412
22178
|
` ${import_chalk4.default.gray(" table list|get|exists|create|update|delete <name> [options]")}`,
|
|
@@ -21498,7 +22264,7 @@ function parseCommandArgs(args) {
|
|
|
21498
22264
|
const token = rest.shift();
|
|
21499
22265
|
switch (token) {
|
|
21500
22266
|
case "--app":
|
|
21501
|
-
app =
|
|
22267
|
+
app = requireValue12(rest, token);
|
|
21502
22268
|
break;
|
|
21503
22269
|
default:
|
|
21504
22270
|
throw new Error(`Unknown login option: ${token}`);
|
|
@@ -21575,6 +22341,9 @@ function parseCommandArgs(args) {
|
|
|
21575
22341
|
if (args.rest[0] === "account") {
|
|
21576
22342
|
return parseAccountArgs(args.rest.slice(1));
|
|
21577
22343
|
}
|
|
22344
|
+
if (args.rest[0] === "org") {
|
|
22345
|
+
return parseOrgArgs(args.rest.slice(1));
|
|
22346
|
+
}
|
|
21578
22347
|
if (args.rest[0] === "store") {
|
|
21579
22348
|
return parseStoreArgs(args.rest.slice(1));
|
|
21580
22349
|
}
|
|
@@ -21601,7 +22370,7 @@ function parseVercelArgs(tokens) {
|
|
|
21601
22370
|
const token = rest.shift();
|
|
21602
22371
|
switch (token) {
|
|
21603
22372
|
case "--scope":
|
|
21604
|
-
scope =
|
|
22373
|
+
scope = requireValue12(rest, token);
|
|
21605
22374
|
break;
|
|
21606
22375
|
default:
|
|
21607
22376
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -21621,10 +22390,10 @@ function parseVercelArgs(tokens) {
|
|
|
21621
22390
|
const token = rest.shift();
|
|
21622
22391
|
switch (token) {
|
|
21623
22392
|
case "--scope":
|
|
21624
|
-
scope =
|
|
22393
|
+
scope = requireValue12(rest, token);
|
|
21625
22394
|
break;
|
|
21626
22395
|
case "--project":
|
|
21627
|
-
project =
|
|
22396
|
+
project = requireValue12(rest, token);
|
|
21628
22397
|
break;
|
|
21629
22398
|
case "--last-week":
|
|
21630
22399
|
lastWeek = true;
|
|
@@ -21655,16 +22424,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
21655
22424
|
const token = rest.shift();
|
|
21656
22425
|
switch (token) {
|
|
21657
22426
|
case "--type":
|
|
21658
|
-
options.dnsType =
|
|
22427
|
+
options.dnsType = requireValue12(rest, token);
|
|
21659
22428
|
break;
|
|
21660
22429
|
case "--value":
|
|
21661
|
-
options.dnsValue =
|
|
22430
|
+
options.dnsValue = requireValue12(rest, token);
|
|
21662
22431
|
break;
|
|
21663
22432
|
case "--rr":
|
|
21664
|
-
options.dnsRr =
|
|
22433
|
+
options.dnsRr = requireValue12(rest, token);
|
|
21665
22434
|
break;
|
|
21666
22435
|
case "--ttl": {
|
|
21667
|
-
const ttlValue =
|
|
22436
|
+
const ttlValue = requireValue12(rest, token);
|
|
21668
22437
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
21669
22438
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
21670
22439
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -21673,7 +22442,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
21673
22442
|
break;
|
|
21674
22443
|
}
|
|
21675
22444
|
case "--domain":
|
|
21676
|
-
options.dnsDomain =
|
|
22445
|
+
options.dnsDomain = requireValue12(rest, token);
|
|
21677
22446
|
break;
|
|
21678
22447
|
default:
|
|
21679
22448
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -21706,13 +22475,13 @@ function parseBucketArgs(tokens) {
|
|
|
21706
22475
|
options.bucketCreate = true;
|
|
21707
22476
|
break;
|
|
21708
22477
|
case "--name":
|
|
21709
|
-
options.bucketName =
|
|
22478
|
+
options.bucketName = requireValue12(rest, token);
|
|
21710
22479
|
break;
|
|
21711
22480
|
case "--subdomain":
|
|
21712
|
-
options.bucketSubdomain =
|
|
22481
|
+
options.bucketSubdomain = requireValue12(rest, token);
|
|
21713
22482
|
break;
|
|
21714
22483
|
case "--domain":
|
|
21715
|
-
options.bucketDomain =
|
|
22484
|
+
options.bucketDomain = requireValue12(rest, token);
|
|
21716
22485
|
break;
|
|
21717
22486
|
default:
|
|
21718
22487
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -21744,7 +22513,7 @@ function parseDevArgs(tokens) {
|
|
|
21744
22513
|
const token = rest.shift();
|
|
21745
22514
|
switch (token) {
|
|
21746
22515
|
case "--cwd":
|
|
21747
|
-
options.devCwd =
|
|
22516
|
+
options.devCwd = requireValue12(rest, token);
|
|
21748
22517
|
break;
|
|
21749
22518
|
default:
|
|
21750
22519
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -21764,7 +22533,7 @@ function parseDeleteArgs(tokens) {
|
|
|
21764
22533
|
const token = rest.shift();
|
|
21765
22534
|
switch (token) {
|
|
21766
22535
|
case "--cwd":
|
|
21767
|
-
deleteCwd =
|
|
22536
|
+
deleteCwd = requireValue12(rest, token);
|
|
21768
22537
|
break;
|
|
21769
22538
|
default:
|
|
21770
22539
|
throw new Error(`Unknown delete option: ${token}`);
|
|
@@ -21798,13 +22567,13 @@ function parseOssArgs(tokens) {
|
|
|
21798
22567
|
const token = rest.shift();
|
|
21799
22568
|
switch (token) {
|
|
21800
22569
|
case "--bucket":
|
|
21801
|
-
bucket =
|
|
22570
|
+
bucket = requireValue12(rest, token);
|
|
21802
22571
|
break;
|
|
21803
22572
|
case "--file":
|
|
21804
|
-
filePath =
|
|
22573
|
+
filePath = requireValue12(rest, token);
|
|
21805
22574
|
break;
|
|
21806
22575
|
case "--key":
|
|
21807
|
-
objectKey =
|
|
22576
|
+
objectKey = requireValue12(rest, token);
|
|
21808
22577
|
break;
|
|
21809
22578
|
default:
|
|
21810
22579
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -21837,7 +22606,7 @@ function parseEnvArgs(tokens) {
|
|
|
21837
22606
|
throw new Error("Only one env action is allowed.");
|
|
21838
22607
|
}
|
|
21839
22608
|
action = "set";
|
|
21840
|
-
key =
|
|
22609
|
+
key = requireValue12(rest, token);
|
|
21841
22610
|
break;
|
|
21842
22611
|
case "--list":
|
|
21843
22612
|
if (action) {
|
|
@@ -21850,17 +22619,17 @@ function parseEnvArgs(tokens) {
|
|
|
21850
22619
|
throw new Error("Only one env action is allowed.");
|
|
21851
22620
|
}
|
|
21852
22621
|
action = "delete";
|
|
21853
|
-
key =
|
|
22622
|
+
key = requireValue12(rest, token);
|
|
21854
22623
|
break;
|
|
21855
22624
|
case "--value":
|
|
21856
|
-
value =
|
|
22625
|
+
value = requireValue12(rest, token);
|
|
21857
22626
|
break;
|
|
21858
22627
|
case "--verbose":
|
|
21859
22628
|
case "-v":
|
|
21860
22629
|
verbose = true;
|
|
21861
22630
|
break;
|
|
21862
22631
|
case "--cwd":
|
|
21863
|
-
cwd =
|
|
22632
|
+
cwd = requireValue12(rest, token);
|
|
21864
22633
|
break;
|
|
21865
22634
|
default:
|
|
21866
22635
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -21918,7 +22687,7 @@ function parseCommitArgs(tokens) {
|
|
|
21918
22687
|
push = true;
|
|
21919
22688
|
break;
|
|
21920
22689
|
case "--cwd":
|
|
21921
|
-
cwd =
|
|
22690
|
+
cwd = requireValue12(rest, token);
|
|
21922
22691
|
break;
|
|
21923
22692
|
default:
|
|
21924
22693
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -21934,10 +22703,10 @@ function parseSummaryArgs(tokens) {
|
|
|
21934
22703
|
const token = rest.shift();
|
|
21935
22704
|
switch (token) {
|
|
21936
22705
|
case "--pr":
|
|
21937
|
-
prRef =
|
|
22706
|
+
prRef = requireValue12(rest, token);
|
|
21938
22707
|
break;
|
|
21939
22708
|
case "--cwd":
|
|
21940
|
-
cwd =
|
|
22709
|
+
cwd = requireValue12(rest, token);
|
|
21941
22710
|
break;
|
|
21942
22711
|
default:
|
|
21943
22712
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -21962,13 +22731,13 @@ function parseQuizArgs(tokens) {
|
|
|
21962
22731
|
const token = rest.shift();
|
|
21963
22732
|
switch (token) {
|
|
21964
22733
|
case "--paper-id":
|
|
21965
|
-
paperId =
|
|
22734
|
+
paperId = requireValue12(rest, token);
|
|
21966
22735
|
break;
|
|
21967
22736
|
case "--base-url":
|
|
21968
|
-
apiBaseUrl =
|
|
22737
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
21969
22738
|
break;
|
|
21970
22739
|
case "--link-base":
|
|
21971
|
-
linkBaseUrl =
|
|
22740
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
21972
22741
|
break;
|
|
21973
22742
|
default:
|
|
21974
22743
|
throw new Error(`Unknown quiz create-draft option: ${token}`);
|
|
@@ -21994,16 +22763,16 @@ function parseQuizArgs(tokens) {
|
|
|
21994
22763
|
const token = rest.shift();
|
|
21995
22764
|
switch (token) {
|
|
21996
22765
|
case "--paper-id":
|
|
21997
|
-
paperId =
|
|
22766
|
+
paperId = requireValue12(rest, token);
|
|
21998
22767
|
break;
|
|
21999
22768
|
case "--file":
|
|
22000
|
-
filePath =
|
|
22769
|
+
filePath = requireValue12(rest, token);
|
|
22001
22770
|
break;
|
|
22002
22771
|
case "--base-url":
|
|
22003
|
-
apiBaseUrl =
|
|
22772
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22004
22773
|
break;
|
|
22005
22774
|
case "--link-base":
|
|
22006
|
-
linkBaseUrl =
|
|
22775
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22007
22776
|
break;
|
|
22008
22777
|
default:
|
|
22009
22778
|
throw new Error(`Unknown quiz update-meta option: ${token}`);
|
|
@@ -22033,16 +22802,16 @@ function parseQuizArgs(tokens) {
|
|
|
22033
22802
|
const token = rest.shift();
|
|
22034
22803
|
switch (token) {
|
|
22035
22804
|
case "--paper-id":
|
|
22036
|
-
paperId =
|
|
22805
|
+
paperId = requireValue12(rest, token);
|
|
22037
22806
|
break;
|
|
22038
22807
|
case "--file":
|
|
22039
|
-
filePath =
|
|
22808
|
+
filePath = requireValue12(rest, token);
|
|
22040
22809
|
break;
|
|
22041
22810
|
case "--base-url":
|
|
22042
|
-
apiBaseUrl =
|
|
22811
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22043
22812
|
break;
|
|
22044
22813
|
case "--link-base":
|
|
22045
|
-
linkBaseUrl =
|
|
22814
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22046
22815
|
break;
|
|
22047
22816
|
default:
|
|
22048
22817
|
throw new Error(`Unknown quiz append-step option: ${token}`);
|
|
@@ -22073,19 +22842,19 @@ function parseQuizArgs(tokens) {
|
|
|
22073
22842
|
const token = rest.shift();
|
|
22074
22843
|
switch (token) {
|
|
22075
22844
|
case "--paper-id":
|
|
22076
|
-
paperId =
|
|
22845
|
+
paperId = requireValue12(rest, token);
|
|
22077
22846
|
break;
|
|
22078
22847
|
case "--step-id":
|
|
22079
|
-
stepId =
|
|
22848
|
+
stepId = requireValue12(rest, token);
|
|
22080
22849
|
break;
|
|
22081
22850
|
case "--file":
|
|
22082
|
-
filePath =
|
|
22851
|
+
filePath = requireValue12(rest, token);
|
|
22083
22852
|
break;
|
|
22084
22853
|
case "--base-url":
|
|
22085
|
-
apiBaseUrl =
|
|
22854
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22086
22855
|
break;
|
|
22087
22856
|
case "--link-base":
|
|
22088
|
-
linkBaseUrl =
|
|
22857
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22089
22858
|
break;
|
|
22090
22859
|
default:
|
|
22091
22860
|
throw new Error(`Unknown quiz update-step option: ${token}`);
|
|
@@ -22119,16 +22888,16 @@ function parseQuizArgs(tokens) {
|
|
|
22119
22888
|
const token = rest.shift();
|
|
22120
22889
|
switch (token) {
|
|
22121
22890
|
case "--paper-id":
|
|
22122
|
-
paperId =
|
|
22891
|
+
paperId = requireValue12(rest, token);
|
|
22123
22892
|
break;
|
|
22124
22893
|
case "--step-ids":
|
|
22125
|
-
stepIdsRaw =
|
|
22894
|
+
stepIdsRaw = requireValue12(rest, token);
|
|
22126
22895
|
break;
|
|
22127
22896
|
case "--base-url":
|
|
22128
|
-
apiBaseUrl =
|
|
22897
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22129
22898
|
break;
|
|
22130
22899
|
case "--link-base":
|
|
22131
|
-
linkBaseUrl =
|
|
22900
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22132
22901
|
break;
|
|
22133
22902
|
default:
|
|
22134
22903
|
throw new Error(`Unknown quiz reorder option: ${token}`);
|
|
@@ -22161,13 +22930,13 @@ function parseQuizArgs(tokens) {
|
|
|
22161
22930
|
const token = rest.shift();
|
|
22162
22931
|
switch (token) {
|
|
22163
22932
|
case "--paper-id":
|
|
22164
|
-
paperId =
|
|
22933
|
+
paperId = requireValue12(rest, token);
|
|
22165
22934
|
break;
|
|
22166
22935
|
case "--base-url":
|
|
22167
|
-
apiBaseUrl =
|
|
22936
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22168
22937
|
break;
|
|
22169
22938
|
case "--link-base":
|
|
22170
|
-
linkBaseUrl =
|
|
22939
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22171
22940
|
break;
|
|
22172
22941
|
default:
|
|
22173
22942
|
throw new Error(`Unknown quiz activate option: ${token}`);
|
|
@@ -22192,13 +22961,13 @@ function parseQuizArgs(tokens) {
|
|
|
22192
22961
|
const token = rest.shift();
|
|
22193
22962
|
switch (token) {
|
|
22194
22963
|
case "--paper-id":
|
|
22195
|
-
paperId =
|
|
22964
|
+
paperId = requireValue12(rest, token);
|
|
22196
22965
|
break;
|
|
22197
22966
|
case "--base-url":
|
|
22198
|
-
apiBaseUrl =
|
|
22967
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22199
22968
|
break;
|
|
22200
22969
|
case "--link-base":
|
|
22201
|
-
linkBaseUrl =
|
|
22970
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22202
22971
|
break;
|
|
22203
22972
|
default:
|
|
22204
22973
|
throw new Error(`Unknown quiz view option: ${token}`);
|
|
@@ -22227,22 +22996,22 @@ function parseQuizArgs(tokens) {
|
|
|
22227
22996
|
const token = rest.shift();
|
|
22228
22997
|
switch (token) {
|
|
22229
22998
|
case "--paper-id":
|
|
22230
|
-
paperId =
|
|
22999
|
+
paperId = requireValue12(rest, token);
|
|
22231
23000
|
break;
|
|
22232
23001
|
case "--step-id":
|
|
22233
|
-
stepId =
|
|
23002
|
+
stepId = requireValue12(rest, token);
|
|
22234
23003
|
break;
|
|
22235
23004
|
case "--file":
|
|
22236
|
-
filePath =
|
|
23005
|
+
filePath = requireValue12(rest, token);
|
|
22237
23006
|
break;
|
|
22238
23007
|
case "--new-paper-id":
|
|
22239
|
-
newPaperId =
|
|
23008
|
+
newPaperId = requireValue12(rest, token);
|
|
22240
23009
|
break;
|
|
22241
23010
|
case "--base-url":
|
|
22242
|
-
apiBaseUrl =
|
|
23011
|
+
apiBaseUrl = requireValue12(rest, token);
|
|
22243
23012
|
break;
|
|
22244
23013
|
case "--link-base":
|
|
22245
|
-
linkBaseUrl =
|
|
23014
|
+
linkBaseUrl = requireValue12(rest, token);
|
|
22246
23015
|
break;
|
|
22247
23016
|
case "--activate":
|
|
22248
23017
|
activate = true;
|
|
@@ -22332,10 +23101,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
22332
23101
|
const token = rest.shift();
|
|
22333
23102
|
switch (token) {
|
|
22334
23103
|
case "--account":
|
|
22335
|
-
account =
|
|
23104
|
+
account = requireValue12(rest, token);
|
|
22336
23105
|
break;
|
|
22337
23106
|
case "--cwd":
|
|
22338
|
-
cwd =
|
|
23107
|
+
cwd = requireValue12(rest, token);
|
|
22339
23108
|
break;
|
|
22340
23109
|
default:
|
|
22341
23110
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22364,35 +23133,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
22364
23133
|
const token = rest.shift();
|
|
22365
23134
|
switch (token) {
|
|
22366
23135
|
case "--account":
|
|
22367
|
-
account =
|
|
23136
|
+
account = requireValue12(rest, token);
|
|
22368
23137
|
break;
|
|
22369
23138
|
case "--repl":
|
|
22370
23139
|
useRepl = true;
|
|
22371
23140
|
break;
|
|
22372
23141
|
case "--title":
|
|
22373
|
-
title =
|
|
23142
|
+
title = requireValue12(rest, token);
|
|
22374
23143
|
break;
|
|
22375
23144
|
case "--desc":
|
|
22376
23145
|
case "--description":
|
|
22377
|
-
description = decodeEscapedNewlines(
|
|
23146
|
+
description = decodeEscapedNewlines(requireValue12(rest, token));
|
|
22378
23147
|
break;
|
|
22379
23148
|
case "--team-id":
|
|
22380
|
-
teamId =
|
|
23149
|
+
teamId = requireValue12(rest, token);
|
|
22381
23150
|
break;
|
|
22382
23151
|
case "--team-key":
|
|
22383
|
-
teamKey =
|
|
23152
|
+
teamKey = requireValue12(rest, token);
|
|
22384
23153
|
break;
|
|
22385
23154
|
case "--priority":
|
|
22386
|
-
priority = parseLinearPriority(
|
|
23155
|
+
priority = parseLinearPriority(requireValue12(rest, token));
|
|
22387
23156
|
break;
|
|
22388
23157
|
case "--parent-id":
|
|
22389
|
-
parentId =
|
|
23158
|
+
parentId = requireValue12(rest, token);
|
|
22390
23159
|
break;
|
|
22391
23160
|
case "--state-id":
|
|
22392
|
-
stateId =
|
|
23161
|
+
stateId = requireValue12(rest, token);
|
|
22393
23162
|
break;
|
|
22394
23163
|
case "--cwd":
|
|
22395
|
-
cwd =
|
|
23164
|
+
cwd = requireValue12(rest, token);
|
|
22396
23165
|
break;
|
|
22397
23166
|
default:
|
|
22398
23167
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22427,10 +23196,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
22427
23196
|
const token = rest.shift();
|
|
22428
23197
|
switch (token) {
|
|
22429
23198
|
case "--account":
|
|
22430
|
-
account =
|
|
23199
|
+
account = requireValue12(rest, token);
|
|
22431
23200
|
break;
|
|
22432
23201
|
case "--cwd":
|
|
22433
|
-
cwd =
|
|
23202
|
+
cwd = requireValue12(rest, token);
|
|
22434
23203
|
break;
|
|
22435
23204
|
default:
|
|
22436
23205
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22455,10 +23224,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
22455
23224
|
const token = rest.shift();
|
|
22456
23225
|
switch (token) {
|
|
22457
23226
|
case "--account":
|
|
22458
|
-
account =
|
|
23227
|
+
account = requireValue12(rest, token);
|
|
22459
23228
|
break;
|
|
22460
23229
|
case "--cwd":
|
|
22461
|
-
cwd =
|
|
23230
|
+
cwd = requireValue12(rest, token);
|
|
22462
23231
|
break;
|
|
22463
23232
|
default:
|
|
22464
23233
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22493,32 +23262,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
22493
23262
|
const token = rest.shift();
|
|
22494
23263
|
switch (token) {
|
|
22495
23264
|
case "--account":
|
|
22496
|
-
account =
|
|
23265
|
+
account = requireValue12(rest, token);
|
|
22497
23266
|
break;
|
|
22498
23267
|
case "--title":
|
|
22499
|
-
title =
|
|
23268
|
+
title = requireValue12(rest, token);
|
|
22500
23269
|
break;
|
|
22501
23270
|
case "--desc":
|
|
22502
23271
|
case "--description":
|
|
22503
|
-
description = decodeEscapedNewlines(
|
|
23272
|
+
description = decodeEscapedNewlines(requireValue12(rest, token));
|
|
22504
23273
|
break;
|
|
22505
23274
|
case "--team-id":
|
|
22506
|
-
teamId =
|
|
23275
|
+
teamId = requireValue12(rest, token);
|
|
22507
23276
|
break;
|
|
22508
23277
|
case "--team-key":
|
|
22509
|
-
teamKey =
|
|
23278
|
+
teamKey = requireValue12(rest, token);
|
|
22510
23279
|
break;
|
|
22511
23280
|
case "--priority":
|
|
22512
|
-
priority = parseLinearPriority(
|
|
23281
|
+
priority = parseLinearPriority(requireValue12(rest, token));
|
|
22513
23282
|
break;
|
|
22514
23283
|
case "--parent-id":
|
|
22515
|
-
parentId =
|
|
23284
|
+
parentId = requireValue12(rest, token);
|
|
22516
23285
|
break;
|
|
22517
23286
|
case "--state-id":
|
|
22518
|
-
stateId =
|
|
23287
|
+
stateId = requireValue12(rest, token);
|
|
22519
23288
|
break;
|
|
22520
23289
|
case "--cwd":
|
|
22521
|
-
cwd =
|
|
23290
|
+
cwd = requireValue12(rest, token);
|
|
22522
23291
|
break;
|
|
22523
23292
|
default:
|
|
22524
23293
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22556,10 +23325,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
22556
23325
|
const token = rest.shift();
|
|
22557
23326
|
switch (token) {
|
|
22558
23327
|
case "--account":
|
|
22559
|
-
account =
|
|
23328
|
+
account = requireValue12(rest, token);
|
|
22560
23329
|
break;
|
|
22561
23330
|
case "--cwd":
|
|
22562
|
-
cwd =
|
|
23331
|
+
cwd = requireValue12(rest, token);
|
|
22563
23332
|
break;
|
|
22564
23333
|
default:
|
|
22565
23334
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22586,15 +23355,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
22586
23355
|
const token = rest.shift();
|
|
22587
23356
|
switch (token) {
|
|
22588
23357
|
case "--account":
|
|
22589
|
-
account =
|
|
23358
|
+
account = requireValue12(rest, token);
|
|
22590
23359
|
break;
|
|
22591
23360
|
case "--body":
|
|
22592
23361
|
case "--desc":
|
|
22593
23362
|
case "--description":
|
|
22594
|
-
body = decodeEscapedNewlines(
|
|
23363
|
+
body = decodeEscapedNewlines(requireValue12(rest, token));
|
|
22595
23364
|
break;
|
|
22596
23365
|
case "--cwd":
|
|
22597
|
-
cwd =
|
|
23366
|
+
cwd = requireValue12(rest, token);
|
|
22598
23367
|
break;
|
|
22599
23368
|
default:
|
|
22600
23369
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22624,10 +23393,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
22624
23393
|
const token = rest.shift();
|
|
22625
23394
|
switch (token) {
|
|
22626
23395
|
case "--account":
|
|
22627
|
-
account =
|
|
23396
|
+
account = requireValue12(rest, token);
|
|
22628
23397
|
break;
|
|
22629
23398
|
case "--cwd":
|
|
22630
|
-
cwd =
|
|
23399
|
+
cwd = requireValue12(rest, token);
|
|
22631
23400
|
break;
|
|
22632
23401
|
default:
|
|
22633
23402
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22651,16 +23420,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
22651
23420
|
const token = rest.shift();
|
|
22652
23421
|
switch (token) {
|
|
22653
23422
|
case "--account":
|
|
22654
|
-
account =
|
|
23423
|
+
account = requireValue12(rest, token);
|
|
22655
23424
|
break;
|
|
22656
23425
|
case "--team-id":
|
|
22657
|
-
teamId =
|
|
23426
|
+
teamId = requireValue12(rest, token);
|
|
22658
23427
|
break;
|
|
22659
23428
|
case "--team-key":
|
|
22660
|
-
teamKey =
|
|
23429
|
+
teamKey = requireValue12(rest, token);
|
|
22661
23430
|
break;
|
|
22662
23431
|
case "--cwd":
|
|
22663
|
-
cwd =
|
|
23432
|
+
cwd = requireValue12(rest, token);
|
|
22664
23433
|
break;
|
|
22665
23434
|
default:
|
|
22666
23435
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22683,10 +23452,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
22683
23452
|
const token = rest.shift();
|
|
22684
23453
|
switch (token) {
|
|
22685
23454
|
case "--account":
|
|
22686
|
-
account =
|
|
23455
|
+
account = requireValue12(rest, token);
|
|
22687
23456
|
break;
|
|
22688
23457
|
case "--cwd":
|
|
22689
|
-
cwd =
|
|
23458
|
+
cwd = requireValue12(rest, token);
|
|
22690
23459
|
break;
|
|
22691
23460
|
default:
|
|
22692
23461
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22713,16 +23482,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
22713
23482
|
const token = rest.shift();
|
|
22714
23483
|
switch (token) {
|
|
22715
23484
|
case "--account":
|
|
22716
|
-
account =
|
|
23485
|
+
account = requireValue12(rest, token);
|
|
22717
23486
|
break;
|
|
22718
23487
|
case "--cycle":
|
|
22719
|
-
cycle = parseLinearCycle(
|
|
23488
|
+
cycle = parseLinearCycle(requireValue12(rest, token));
|
|
22720
23489
|
break;
|
|
22721
23490
|
case "--status":
|
|
22722
|
-
status = parseLinearStatus(
|
|
23491
|
+
status = parseLinearStatus(requireValue12(rest, token));
|
|
22723
23492
|
break;
|
|
22724
23493
|
case "--cwd":
|
|
22725
|
-
cwd =
|
|
23494
|
+
cwd = requireValue12(rest, token);
|
|
22726
23495
|
break;
|
|
22727
23496
|
default:
|
|
22728
23497
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22756,28 +23525,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
22756
23525
|
const token = rest.shift();
|
|
22757
23526
|
switch (token) {
|
|
22758
23527
|
case "--account":
|
|
22759
|
-
account =
|
|
23528
|
+
account = requireValue12(rest, token);
|
|
22760
23529
|
break;
|
|
22761
23530
|
case "--team-id":
|
|
22762
|
-
teamId =
|
|
23531
|
+
teamId = requireValue12(rest, token);
|
|
22763
23532
|
break;
|
|
22764
23533
|
case "--team-key":
|
|
22765
|
-
teamKey =
|
|
23534
|
+
teamKey = requireValue12(rest, token);
|
|
22766
23535
|
break;
|
|
22767
23536
|
case "--user":
|
|
22768
|
-
user =
|
|
23537
|
+
user = requireValue12(rest, token);
|
|
22769
23538
|
break;
|
|
22770
23539
|
case "--cycle":
|
|
22771
|
-
cycle = parseLinearCycle(
|
|
23540
|
+
cycle = parseLinearCycle(requireValue12(rest, token));
|
|
22772
23541
|
break;
|
|
22773
23542
|
case "--status":
|
|
22774
|
-
status = parseLinearStatus(
|
|
23543
|
+
status = parseLinearStatus(requireValue12(rest, token));
|
|
22775
23544
|
break;
|
|
22776
23545
|
case "--query":
|
|
22777
|
-
query =
|
|
23546
|
+
query = requireValue12(rest, token).trim();
|
|
22778
23547
|
break;
|
|
22779
23548
|
case "--limit": {
|
|
22780
|
-
const value = Number.parseInt(
|
|
23549
|
+
const value = Number.parseInt(requireValue12(rest, token), 10);
|
|
22781
23550
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
22782
23551
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
22783
23552
|
}
|
|
@@ -22785,7 +23554,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
22785
23554
|
break;
|
|
22786
23555
|
}
|
|
22787
23556
|
case "--cwd":
|
|
22788
|
-
cwd =
|
|
23557
|
+
cwd = requireValue12(rest, token);
|
|
22789
23558
|
break;
|
|
22790
23559
|
default:
|
|
22791
23560
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22826,10 +23595,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
22826
23595
|
useScreenshot = true;
|
|
22827
23596
|
break;
|
|
22828
23597
|
case "--account":
|
|
22829
|
-
account =
|
|
23598
|
+
account = requireValue12(rest, token);
|
|
22830
23599
|
break;
|
|
22831
23600
|
case "--cwd":
|
|
22832
|
-
cwd =
|
|
23601
|
+
cwd = requireValue12(rest, token);
|
|
22833
23602
|
break;
|
|
22834
23603
|
default:
|
|
22835
23604
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -22923,19 +23692,19 @@ function parseNotionArgs(tokens) {
|
|
|
22923
23692
|
const token = rest.shift();
|
|
22924
23693
|
switch (token) {
|
|
22925
23694
|
case "--parent":
|
|
22926
|
-
parentPageId =
|
|
23695
|
+
parentPageId = requireValue12(rest, token);
|
|
22927
23696
|
break;
|
|
22928
23697
|
case "--title":
|
|
22929
|
-
title =
|
|
23698
|
+
title = requireValue12(rest, token);
|
|
22930
23699
|
break;
|
|
22931
23700
|
case "--private":
|
|
22932
23701
|
isPrivate = true;
|
|
22933
23702
|
break;
|
|
22934
23703
|
case "--content":
|
|
22935
|
-
content2 =
|
|
23704
|
+
content2 = requireValue12(rest, token);
|
|
22936
23705
|
break;
|
|
22937
23706
|
case "--file":
|
|
22938
|
-
filePath2 =
|
|
23707
|
+
filePath2 = requireValue12(rest, token);
|
|
22939
23708
|
break;
|
|
22940
23709
|
default:
|
|
22941
23710
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -22979,10 +23748,10 @@ function parseNotionArgs(tokens) {
|
|
|
22979
23748
|
const token = rest.shift();
|
|
22980
23749
|
switch (token) {
|
|
22981
23750
|
case "--content":
|
|
22982
|
-
content =
|
|
23751
|
+
content = requireValue12(rest, token);
|
|
22983
23752
|
break;
|
|
22984
23753
|
case "--file":
|
|
22985
|
-
filePath =
|
|
23754
|
+
filePath = requireValue12(rest, token);
|
|
22986
23755
|
break;
|
|
22987
23756
|
case "--append":
|
|
22988
23757
|
append = true;
|
|
@@ -23027,11 +23796,11 @@ function parseRandomArgs(tokens) {
|
|
|
23027
23796
|
mode = "easy";
|
|
23028
23797
|
break;
|
|
23029
23798
|
case "--length":
|
|
23030
|
-
length = parsePositiveInt(
|
|
23799
|
+
length = parsePositiveInt(requireValue12(rest, token), token);
|
|
23031
23800
|
seenLength = true;
|
|
23032
23801
|
break;
|
|
23033
23802
|
case "--charset": {
|
|
23034
|
-
const value =
|
|
23803
|
+
const value = requireValue12(rest, token);
|
|
23035
23804
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
23036
23805
|
throw new Error(
|
|
23037
23806
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -23042,18 +23811,18 @@ function parseRandomArgs(tokens) {
|
|
|
23042
23811
|
break;
|
|
23043
23812
|
}
|
|
23044
23813
|
case "--count":
|
|
23045
|
-
count = parsePositiveInt(
|
|
23814
|
+
count = parsePositiveInt(requireValue12(rest, token), token);
|
|
23046
23815
|
break;
|
|
23047
23816
|
case "--words":
|
|
23048
|
-
words = parsePositiveInt(
|
|
23817
|
+
words = parsePositiveInt(requireValue12(rest, token), token);
|
|
23049
23818
|
seenWords = true;
|
|
23050
23819
|
break;
|
|
23051
23820
|
case "--digits":
|
|
23052
|
-
digits = parseNonNegativeInt(
|
|
23821
|
+
digits = parseNonNegativeInt(requireValue12(rest, token), token);
|
|
23053
23822
|
seenDigits = true;
|
|
23054
23823
|
break;
|
|
23055
23824
|
case "--separator":
|
|
23056
|
-
separator =
|
|
23825
|
+
separator = requireValue12(rest, token);
|
|
23057
23826
|
seenSeparator = true;
|
|
23058
23827
|
break;
|
|
23059
23828
|
default:
|
|
@@ -23084,7 +23853,7 @@ function parseRandomArgs(tokens) {
|
|
|
23084
23853
|
count
|
|
23085
23854
|
};
|
|
23086
23855
|
}
|
|
23087
|
-
function
|
|
23856
|
+
function requireValue12(tokens, optionName) {
|
|
23088
23857
|
const value = tokens.shift();
|
|
23089
23858
|
if (!value) {
|
|
23090
23859
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -23245,6 +24014,11 @@ async function main() {
|
|
|
23245
24014
|
await handler.handle(commandArgs);
|
|
23246
24015
|
return;
|
|
23247
24016
|
}
|
|
24017
|
+
case "org" /* Org */: {
|
|
24018
|
+
const handler = new OrgCommandHandler();
|
|
24019
|
+
await handler.handle(commandArgs);
|
|
24020
|
+
return;
|
|
24021
|
+
}
|
|
23248
24022
|
case "store" /* Store */: {
|
|
23249
24023
|
const handler = new StoreCommandHandler();
|
|
23250
24024
|
await handler.handle(commandArgs);
|