@madewithremy/admin 0.1.22 → 0.1.24

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/prod.js CHANGED
@@ -65,6 +65,9 @@ var PAGINATION = {
65
65
  limit: { type: "number", min: 0 },
66
66
  offset: { type: "number", min: 0 }
67
67
  };
68
+ var APP = {
69
+ app: { type: "string" }
70
+ };
68
71
  var Args = class {
69
72
  constructor(spec, positionals, flags) {
70
73
  this.spec = spec;
@@ -97,6 +100,11 @@ var Args = class {
97
100
  const value = this.flags[flag];
98
101
  return value === void 0 ? void 0 : String(value);
99
102
  }
103
+ /** A repeatable flag's values (`multiple: true`). Absent → undefined. */
104
+ list(flag) {
105
+ const value = this.flags[flag];
106
+ return Array.isArray(value) ? value : void 0;
107
+ }
100
108
  num(flag) {
101
109
  const value = this.flags[flag];
102
110
  return value === void 0 ? void 0 : Number(value);
@@ -116,6 +124,15 @@ var Args = class {
116
124
  return index;
117
125
  }
118
126
  };
127
+ function checkChoice(value, flag, flagSpec, usage) {
128
+ if (!flagSpec.choices || flagSpec.choices.includes(value)) {
129
+ return;
130
+ }
131
+ throw new UsageError(
132
+ `Invalid value "${value}" for --${flag}. Valid: ${flagSpec.choices.join("|")}.`,
133
+ usage
134
+ );
135
+ }
119
136
  function preflightUnknownFlags(argv, spec) {
120
137
  const declared = new Set(Object.keys(spec.flags ?? {}));
121
138
  for (const token of argv) {
@@ -199,7 +216,8 @@ function parseCommand(spec, argv) {
199
216
  const options = {};
200
217
  for (const [flag, flagSpec] of Object.entries(spec.flags ?? {})) {
201
218
  options[flag] = {
202
- type: flagSpec.type === "boolean" ? "boolean" : "string"
219
+ type: flagSpec.type === "boolean" ? "boolean" : "string",
220
+ ...flagSpec.multiple ? { multiple: true } : {}
203
221
  };
204
222
  }
205
223
  let parsed;
@@ -219,7 +237,20 @@ function parseCommand(spec, argv) {
219
237
  if (raw === void 0) {
220
238
  continue;
221
239
  }
222
- flags[flag] = flagSpec.type === "number" ? coerceNumber(String(raw), flag, flagSpec, spec.usage) : raw;
240
+ if (flagSpec.multiple) {
241
+ const values = raw.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter((v) => v.length > 0);
242
+ for (const value of values) {
243
+ checkChoice(value, flag, flagSpec, spec.usage);
244
+ }
245
+ flags[flag] = values;
246
+ continue;
247
+ }
248
+ if (flagSpec.type === "number") {
249
+ flags[flag] = coerceNumber(String(raw), flag, flagSpec, spec.usage);
250
+ continue;
251
+ }
252
+ checkChoice(String(raw), flag, flagSpec, spec.usage);
253
+ flags[flag] = raw;
223
254
  }
224
255
  const positionals = bindPositionals(parsed.positionals, spec);
225
256
  checkRequireAnyOf(spec, positionals, flags);
@@ -248,6 +279,12 @@ function qs(params) {
248
279
  if (value === void 0 || value === null) {
249
280
  continue;
250
281
  }
282
+ if (Array.isArray(value)) {
283
+ for (const entry of value) {
284
+ search2.append(key, String(entry));
285
+ }
286
+ continue;
287
+ }
251
288
  search2.set(key, String(value));
252
289
  }
253
290
  const text = search2.toString();
@@ -2286,11 +2323,27 @@ Examples:
2286
2323
  import fs from "fs";
2287
2324
 
2288
2325
  // src/ops/issues.ts
2326
+ function listQuery(params) {
2327
+ return qs({
2328
+ status: params.status,
2329
+ label: params.labels,
2330
+ originAppId: params.originAppId,
2331
+ limit: params.limit,
2332
+ cursor: params.cursor
2333
+ });
2334
+ }
2289
2335
  function list7(ctx, params = {}) {
2290
2336
  return call(
2291
2337
  ctx,
2292
2338
  "GET",
2293
- `/_internal/v2/apps/${ctx.appId}/issues${qs(params)}`
2339
+ `/_internal/v2/apps/${ctx.appId}/issues${listQuery(params)}`
2340
+ );
2341
+ }
2342
+ function filed(ctx, params = {}) {
2343
+ return call(
2344
+ ctx,
2345
+ "GET",
2346
+ `/_internal/v2/apps/${ctx.appId}/issues/filed${listQuery(params)}`
2294
2347
  );
2295
2348
  }
2296
2349
  function get6(ctx, number) {
@@ -2308,8 +2361,11 @@ function create(ctx, params) {
2308
2361
  if (params.body !== void 0) {
2309
2362
  requestBody.body = params.body;
2310
2363
  }
2311
- if (params.kind !== void 0) {
2312
- requestBody.kind = params.kind;
2364
+ if (params.labels !== void 0) {
2365
+ requestBody.labels = params.labels;
2366
+ }
2367
+ if (params.originAppId !== void 0) {
2368
+ requestBody.originAppId = params.originAppId;
2313
2369
  }
2314
2370
  return call(
2315
2371
  ctx,
@@ -2326,12 +2382,19 @@ function comment(ctx, number, body) {
2326
2382
  { body, authorKind: "agent" }
2327
2383
  );
2328
2384
  }
2329
- function close(ctx, number) {
2385
+ function close(ctx, number, comment2) {
2386
+ const requestBody = {
2387
+ status: "closed",
2388
+ authorKind: "agent"
2389
+ };
2390
+ if (comment2 !== void 0) {
2391
+ requestBody.comment = comment2;
2392
+ }
2330
2393
  return call(
2331
2394
  ctx,
2332
2395
  "POST",
2333
2396
  `/_internal/v2/apps/${ctx.appId}/issues/${seg(number)}/update`,
2334
- { status: "closed", authorKind: "agent" }
2397
+ requestBody
2335
2398
  );
2336
2399
  }
2337
2400
  function reopen(ctx, number) {
@@ -2350,8 +2413,8 @@ function edit(ctx, number, params) {
2350
2413
  if (params.body !== void 0) {
2351
2414
  requestBody.body = params.body;
2352
2415
  }
2353
- if (params.kind !== void 0) {
2354
- requestBody.kind = params.kind;
2416
+ if (params.labels !== void 0) {
2417
+ requestBody.labels = params.labels;
2355
2418
  }
2356
2419
  if (params.status !== void 0) {
2357
2420
  requestBody.status = params.status;
@@ -2372,29 +2435,48 @@ function del2(ctx, number) {
2372
2435
  }
2373
2436
 
2374
2437
  // src/commands/issues.ts
2438
+ var STATES = ["open", "closed"];
2439
+ var LIST_STATES = ["open", "closed", "all"];
2375
2440
  var issuesSpecs = {
2376
2441
  "issues list": {
2377
- usage: "Usage: remy-admin issues list [--status open|closed] [--kind bug|idea|task] [--limit 50] [--cursor <c>]",
2442
+ usage: "Usage: remy-admin issues list [--app <appId>] [--state open|closed|all] [--label <l>] [--from-app <appId>] [--limit 50] [--cursor <c>]",
2378
2443
  flags: {
2379
- status: { type: "string" },
2380
- kind: { type: "string" },
2444
+ ...APP,
2445
+ state: { type: "string", choices: LIST_STATES },
2446
+ label: { type: "string", multiple: true },
2447
+ "from-app": { type: "string" },
2448
+ limit: { type: "number", min: 0 },
2449
+ cursor: { type: "string" }
2450
+ }
2451
+ },
2452
+ "issues filed": {
2453
+ usage: "Usage: remy-admin issues filed [--app <appId>] [--state open|closed|all] [--label <l>] [--limit 50] [--cursor <c>]",
2454
+ flags: {
2455
+ ...APP,
2456
+ state: { type: "string", choices: LIST_STATES },
2457
+ label: { type: "string", multiple: true },
2381
2458
  limit: { type: "number", min: 0 },
2382
2459
  cursor: { type: "string" }
2383
2460
  }
2384
2461
  },
2385
2462
  "issues get": {
2386
- usage: "Usage: remy-admin issues get <number>",
2387
- positionals: [{ name: "number", required: true }]
2463
+ usage: "Usage: remy-admin issues get <number> [--app <appId>]",
2464
+ positionals: [{ name: "number", required: true }],
2465
+ flags: { ...APP }
2388
2466
  },
2389
2467
  "issues create": {
2390
- usage: "Usage: remy-admin issues create <title> [--body <text>|--body -] [--kind bug|idea|task]",
2468
+ usage: "Usage: remy-admin issues create <title> [--app <appId>] [--body <text>|--body -] [--label <l>]",
2391
2469
  positionals: [{ name: "title", required: true }],
2392
- flags: { body: { type: "string" }, kind: { type: "string" } }
2470
+ flags: {
2471
+ ...APP,
2472
+ body: { type: "string" },
2473
+ label: { type: "string", multiple: true }
2474
+ }
2393
2475
  },
2394
2476
  "issues comment": {
2395
- usage: "Usage: remy-admin issues comment <number> <body> (or --body - to read stdin)",
2477
+ usage: "Usage: remy-admin issues comment <number> <body> [--app <appId>] (or --body - to read stdin)",
2396
2478
  positionals: [{ name: "number", required: true }, { name: "body" }],
2397
- flags: { body: { type: "string" } },
2479
+ flags: { ...APP, body: { type: "string" } },
2398
2480
  requireAnyOf: {
2399
2481
  flags: ["body"],
2400
2482
  positionals: ["body"],
@@ -2402,34 +2484,38 @@ var issuesSpecs = {
2402
2484
  }
2403
2485
  },
2404
2486
  "issues close": {
2405
- usage: "Usage: remy-admin issues close <number>",
2406
- positionals: [{ name: "number", required: true }]
2487
+ usage: "Usage: remy-admin issues close <number> [--app <appId>] [--comment <text>|--comment -]",
2488
+ positionals: [{ name: "number", required: true }],
2489
+ flags: { ...APP, comment: { type: "string" } }
2407
2490
  },
2408
2491
  "issues reopen": {
2409
- usage: "Usage: remy-admin issues reopen <number>",
2410
- positionals: [{ name: "number", required: true }]
2492
+ usage: "Usage: remy-admin issues reopen <number> [--app <appId>]",
2493
+ positionals: [{ name: "number", required: true }],
2494
+ flags: { ...APP }
2411
2495
  },
2412
2496
  "issues edit": {
2413
- usage: "Usage: remy-admin issues edit <number> [--title <t>] [--body <t>|--body -] [--kind ...] [--status open|closed]",
2497
+ usage: "Usage: remy-admin issues edit <number> [--app <appId>] [--title <t>] [--body <t>|--body -] [--label <l>] [--state open|closed]",
2414
2498
  positionals: [{ name: "number", required: true }],
2415
2499
  flags: {
2500
+ ...APP,
2416
2501
  title: { type: "string" },
2417
2502
  body: { type: "string" },
2418
- kind: { type: "string" },
2419
- status: { type: "string" }
2503
+ label: { type: "string", multiple: true },
2504
+ state: { type: "string", choices: STATES }
2420
2505
  },
2421
2506
  requireAnyOf: {
2422
- flags: ["title", "body", "kind", "status"],
2423
- message: "Provide at least one of --title, --body, --kind, --status"
2507
+ flags: ["title", "body", "label", "state"],
2508
+ message: "Provide at least one of --title, --body, --label, --state"
2424
2509
  }
2425
2510
  },
2426
2511
  "issues delete": {
2427
- usage: "Usage: remy-admin issues delete <number>",
2428
- positionals: [{ name: "number", required: true }]
2512
+ usage: "Usage: remy-admin issues delete <number> [--app <appId>]",
2513
+ positionals: [{ name: "number", required: true }],
2514
+ flags: { ...APP }
2429
2515
  }
2430
2516
  };
2431
- function readBodyFlag(a) {
2432
- const val = a.str("body");
2517
+ function readStdinFlag(a, flag) {
2518
+ const val = a.str(flag);
2433
2519
  if (val === void 0) {
2434
2520
  return void 0;
2435
2521
  }
@@ -2438,11 +2524,29 @@ function readBodyFlag(a) {
2438
2524
  }
2439
2525
  return val;
2440
2526
  }
2527
+ function readBodyFlag(a) {
2528
+ return readStdinFlag(a, "body");
2529
+ }
2530
+ function readStateFilter(a) {
2531
+ const state = a.str("state");
2532
+ return state === "all" ? void 0 : state;
2533
+ }
2441
2534
  async function issuesList(ctx, a) {
2442
2535
  out(
2443
2536
  await list7(ctx, {
2444
- status: a.str("status"),
2445
- kind: a.str("kind"),
2537
+ status: readStateFilter(a),
2538
+ labels: a.list("label"),
2539
+ originAppId: a.str("from-app"),
2540
+ limit: a.num("limit"),
2541
+ cursor: a.str("cursor")
2542
+ })
2543
+ );
2544
+ }
2545
+ async function issuesFiled(ctx, a) {
2546
+ out(
2547
+ await filed(ctx, {
2548
+ status: readStateFilter(a),
2549
+ labels: a.list("label"),
2446
2550
  limit: a.num("limit"),
2447
2551
  cursor: a.str("cursor")
2448
2552
  })
@@ -2453,12 +2557,11 @@ async function issuesGet(ctx, a) {
2453
2557
  }
2454
2558
  async function issuesCreate(ctx, a) {
2455
2559
  const issueBody = readBodyFlag(a);
2456
- const kind = a.str("kind");
2457
2560
  out(
2458
2561
  await create(ctx, {
2459
2562
  title: a.req("title"),
2460
2563
  body: issueBody,
2461
- kind
2564
+ labels: a.list("label")
2462
2565
  })
2463
2566
  );
2464
2567
  }
@@ -2467,7 +2570,7 @@ async function issuesComment(ctx, a) {
2467
2570
  out(await comment(ctx, a.req("number"), commentBody));
2468
2571
  }
2469
2572
  async function issuesClose(ctx, a) {
2470
- out(await close(ctx, a.req("number")));
2573
+ out(await close(ctx, a.req("number"), readStdinFlag(a, "comment")));
2471
2574
  }
2472
2575
  async function issuesReopen(ctx, a) {
2473
2576
  out(await reopen(ctx, a.req("number")));
@@ -2478,8 +2581,8 @@ async function issuesEdit(ctx, a) {
2478
2581
  await edit(ctx, a.req("number"), {
2479
2582
  title: a.str("title"),
2480
2583
  body: editBody,
2481
- kind: a.str("kind"),
2482
- status: a.str("status")
2584
+ labels: a.list("label"),
2585
+ status: a.str("state")
2483
2586
  })
2484
2587
  );
2485
2588
  }
@@ -2488,6 +2591,7 @@ async function issuesDelete(ctx, a) {
2488
2591
  }
2489
2592
  var issuesHandlers = {
2490
2593
  "issues list": issuesList,
2594
+ "issues filed": issuesFiled,
2491
2595
  "issues get": issuesGet,
2492
2596
  "issues create": issuesCreate,
2493
2597
  "issues comment": issuesComment,
@@ -2496,39 +2600,51 @@ var issuesHandlers = {
2496
2600
  "issues edit": issuesEdit,
2497
2601
  "issues delete": issuesDelete
2498
2602
  };
2499
- var issuesHelp = `remy-admin issues \u2014 File and manage issues (bugs, ideas, tasks) for the app.
2603
+ var issuesHelp = `remy-admin issues \u2014 File and manage issues for this app, or for another app in the workspace.
2500
2604
 
2501
2605
  Subcommands:
2502
- list List issues (newest first)
2606
+ list List issues filed in an app (newest first)
2607
+ filed List issues this app filed into other apps
2503
2608
  get Get one issue + its comment thread
2504
2609
  create File a new issue
2505
2610
  comment Post a comment on an issue's thread
2506
- close Close an issue
2611
+ close Close an issue, optionally with a closing comment
2507
2612
  reopen Reopen a closed issue
2508
- edit Edit an issue's title / body / kind / status
2613
+ edit Edit an issue's title / body / labels / state
2509
2614
  delete Delete an issue
2510
2615
 
2511
2616
  Usage:
2512
- remy-admin issues list [--status open|closed] [--kind bug|idea|task] [--limit 50] [--cursor <c>]
2513
- remy-admin issues get <number>
2514
- remy-admin issues create <title> [--body <text>|--body -] [--kind bug|idea|task]
2515
- remy-admin issues comment <number> <body> (or --body - to read stdin)
2516
- remy-admin issues close <number>
2517
- remy-admin issues reopen <number>
2518
- remy-admin issues edit <number> [--title <t>] [--body <t>|--body -] [--kind ...] [--status open|closed]
2519
- remy-admin issues delete <number>
2617
+ remy-admin issues list [--app <appId>] [--state open|closed|all] [--label <l>] [--from-app <appId>] [--limit 50] [--cursor <c>]
2618
+ remy-admin issues filed [--app <appId>] [--state open|closed|all] [--label <l>] [--limit 50] [--cursor <c>]
2619
+ remy-admin issues get <number> [--app <appId>]
2620
+ remy-admin issues create <title> [--app <appId>] [--body <text>|--body -] [--label <l>]
2621
+ remy-admin issues comment <number> <body> [--app <appId>] (or --body - to read stdin)
2622
+ remy-admin issues close <number> [--app <appId>] [--comment <text>|--comment -]
2623
+ remy-admin issues reopen <number> [--app <appId>]
2624
+ remy-admin issues edit <number> [--app <appId>] [--title <t>] [--body <t>|--body -] [--label <l>] [--state open|closed]
2625
+ remy-admin issues delete <number> [--app <appId>]
2520
2626
 
2521
2627
  Notes:
2522
2628
  - <number> is the friendly per-app issue number (e.g. 42), shown as 'number' in output.
2629
+ - '--app <appId>' targets another app in the same workspace. Every app there is reachable
2630
+ with this credential, so it is a targeting flag: the issue lands in THAT app's tracker,
2631
+ and 'originAppId' on the row records that this app filed it. Cross-reference it in prose
2632
+ as 'app#42'.
2633
+ - 'list' shows what was filed IN an app; 'filed' shows what an app sent OUT to others \u2014
2634
+ the whole fan-out in one call instead of one call per app.
2635
+ - '--label' repeats ('--label a --label b') or takes a comma-separated list ('--label a,b').
2636
+ Filtering matches an issue carrying ANY of them. Labels are an open set: pick your own.
2637
+ - '--state all' means no state filter (the default is also every state).
2523
2638
  - Issues and comments filed via this CLI are authored as the agent (authorKind: "agent").
2524
- - '--body -' reads the body from stdin \u2014 use it for long multi-line markdown.
2639
+ - '--body -' / '--comment -' read from stdin \u2014 use for long multi-line markdown.
2525
2640
 
2526
2641
  Examples:
2527
- remy-admin issues list --status open --kind bug
2528
- remy-admin issues create "Checkout 500s on empty cart" --kind bug --body "Repro in comments"
2529
- echo "Long markdown body..." | remy-admin issues create "Refactor auth flow" --kind task --body -
2642
+ remy-admin issues list --state open --label bug
2643
+ remy-admin issues create "Checkout 500s on empty cart" --label bug --body "Repro in comments"
2644
+ remy-admin issues create "Apply the new auth spec" --app 8f3c... --label fleet-patch --body -
2645
+ remy-admin issues filed --state open
2530
2646
  remy-admin issues comment 42 "Fixed in the latest release."
2531
- remy-admin issues close 42`;
2647
+ remy-admin issues close 42 --comment "Already fixed in v3 \u2014 no change needed."`;
2532
2648
 
2533
2649
  // src/ops/prerender.ts
2534
2650
  function pages(ctx, params = {}) {
@@ -6940,7 +7056,6 @@ var SETTABLE_KEYS = [
6940
7056
  "signupAllowlistEnabled",
6941
7057
  "testAccountsEnabled",
6942
7058
  "telemetryCaptureResponseBodies",
6943
- "autoTriageIssues",
6944
7059
  "analyticsExtraQueryParams"
6945
7060
  ];
6946
7061
  var settingsSpecs = {
@@ -7214,8 +7329,6 @@ Settable keys (settings set):
7214
7329
  telemetryCaptureResponseBodies Include failed-request response bodies (~1KB) in
7215
7330
  frontend error reports. Default: true; turn off if API
7216
7331
  responses may carry PII or tokens.
7217
- autoTriageIssues Auto-run the read-only triage agent on new bug issues.
7218
- Default: false.
7219
7332
  analyticsExtraQueryParams JSON array of query-param names to preserve in
7220
7333
  analytics URLs beyond the UTM/ad-click defaults.
7221
7334
 
@@ -8295,7 +8408,7 @@ Commands:
8295
8408
  secrets Manage app secrets (env vars)
8296
8409
  methods List and invoke methods
8297
8410
  data Sync databases between dev and live (lift-from-dev / lift-from-live)
8298
- issues File and manage issues (bugs, ideas, tasks)
8411
+ issues File and manage issues, in this app or another app in the workspace
8299
8412
  prerender Manage + verify prerendered snapshots served to bots/crawlers
8300
8413
  files Store, retrieve, share (signed links) + manage files in the app's stores
8301
8414
  datasources Build and query searchable document corpora (RAG)
@@ -8415,9 +8528,10 @@ async function main() {
8415
8528
  if (!apiKey) {
8416
8529
  fatal("MINDSTUDIO_API_KEY environment variable is not set");
8417
8530
  }
8531
+ const appIdOverride = a.str("app");
8418
8532
  const ctx = {
8419
8533
  apiKey,
8420
- appId: loadWorkspaceAppId(),
8534
+ appId: appIdOverride ?? loadWorkspaceAppId(),
8421
8535
  baseUrl: process.env["API_BASE_URL"] || DEFAULT_BASE_URL
8422
8536
  };
8423
8537
  return HANDLERS[route.key](ctx, a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madewithremy/admin",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Admin SDK + CLI for managing production Remy apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",