@reminix/cli 1.0.0-rc.1 → 1.0.0-rc.10

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/reminix.mjs CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
2
7
 
3
8
  // src/main.ts
4
9
  import { spawn } from "node:child_process";
@@ -12,8 +17,13 @@ var brand_default = {
12
17
  productName: "Reminix",
13
18
  legalName: "Omsome L.L.C-FZ",
14
19
  releaseMirrors: true,
20
+ keywords: ["scripts", "internal-tools", "automation", "ai-agents", "mcp"],
15
21
  domain: "reminix.com",
16
- summary: "Reminix lets your whole team, your software and your agents run your team's scripts, and the ones AI writes: one publish gives a form, an API and an agent tool, with keys kept out of the code and every run on record.",
22
+ devDomain: "reminix.dev",
23
+ labs: ["lab"],
24
+ discordInvite: "https://discord.gg/UU9NbEcNQj",
25
+ profiles: { x: "reminixhq", github: "reminixhq" },
26
+ summary: "Reminix turns your scripts into internal tools. Upload a Python, shell or Node script, and Reminix runs it from a form, the API, the CLI or your AI agents, on a schedule or from a webhook. Keys stay out of the code, and every run is on record.",
17
27
  expectedAssets: [
18
28
  "logo.svg",
19
29
  "logo-dark.svg",
@@ -24,25 +34,52 @@ var brand_default = {
24
34
  "apple-touch-icon.png"
25
35
  ],
26
36
  colors: {
27
- brand: "#1F5A45",
28
- brandForeground: "#F2F5F3",
29
- brandDark: "#8DBFA3",
30
- brandDarkForeground: "#1C2421",
31
- bench: "#1F5A45",
32
- moss: "#8DBFA3",
33
- chalk: "#F2F5F3",
34
- graphite: "#1C2421",
35
- tag: "#F0C4D1",
36
- hold: "#D9902F"
37
+ brand: "#151515",
38
+ brandForeground: "#F7F6F2",
39
+ brandDark: "#FFC72C",
40
+ brandDarkForeground: "#151515",
41
+ black: "#151515",
42
+ signal: "#FFC72C",
43
+ paper: "#F7F6F2",
44
+ graphite: "#1A1A19",
45
+ lemon: "#FFF2C2",
46
+ done: "#2F9E44",
47
+ waiting: "#C2410C",
48
+ failed: "#C92A2A",
49
+ night: "#0D0D0D",
50
+ signalDark: "#FFC72C",
51
+ paperDark: "#0D0D0D",
52
+ graphiteDark: "#1F1F1D",
53
+ lemonDark: "#1E1B10",
54
+ doneDark: "#51CF66",
55
+ waitingDark: "#FF8A4C",
56
+ failedDark: "#FF6B6B",
57
+ lemonBorder: "#F0DC8E",
58
+ lemonBorderDark: "#3A3315",
59
+ waitingBackground: "#FFF1E8",
60
+ waitingBackgroundDark: "#2A1A12"
37
61
  },
38
62
  fonts: {
39
- display: "Bricolage Grotesque Variable",
40
- body: "Figtree Variable"
63
+ display: "Schibsted Grotesk Variable",
64
+ body: "Instrument Sans Variable",
65
+ code: "IBM Plex Mono"
66
+ },
67
+ layout: {
68
+ radius: "12px",
69
+ gutter: "1.5rem",
70
+ contentWidth: "72rem",
71
+ readableWidth: "42rem",
72
+ sectionGap: "2rem",
73
+ navGap: "1.5rem",
74
+ barPadding: "1rem",
75
+ navCurrentWeight: "400",
76
+ radiusControl: "8px"
41
77
  },
42
78
  signIn: {
43
79
  providerOrder: ["github", "google"],
44
80
  emailSignUp: "button"
45
- }
81
+ },
82
+ devPortOffset: 200
46
83
  };
47
84
 
48
85
  // src/brand/index.ts
@@ -67,13 +104,62 @@ var brand = {
67
104
  */
68
105
  legalName: optional.legalName ?? brand_default.productName,
69
106
  domain: brand_default.domain,
107
+ /**
108
+ * The apex of everything that isn't prod: stage is `*.stage.<devDomain>`
109
+ * (docs/deployment.md "Domains for stage and lab"). `domain` unless
110
+ * brand.json sets one.
111
+ */
112
+ devDomain: optional.devDomain ?? brand_default.domain,
113
+ /**
114
+ * Where the product's community talks: https://<domain>/discord, the
115
+ * site's redirect to brand.json `discordInvite` (pnpm brand:sync); null
116
+ * when the product has no Discord.
117
+ */
118
+ discord: optional.discordInvite ? `https://${brand_default.domain}/discord` : null,
119
+ /**
120
+ * The product's accounts, for the site footer's icons, the docs
121
+ * header's and the app's help menu (owner, 2026-11-09): GitHub (the
122
+ * organisation, which lists the public SDKs), Discord (the /discord
123
+ * redirect) and X, each only when brand.json has it.
124
+ */
125
+ socialLinks: [
126
+ optional.profiles?.github && {
127
+ network: "github",
128
+ label: "GitHub",
129
+ href: `https://github.com/${optional.profiles.github}`
130
+ },
131
+ optional.discordInvite && {
132
+ network: "discord",
133
+ label: "Discord",
134
+ href: `https://${brand_default.domain}/discord`
135
+ },
136
+ optional.profiles?.x && {
137
+ network: "x",
138
+ label: "X",
139
+ href: `https://x.com/${optional.profiles.x}`
140
+ }
141
+ ].filter(Boolean),
70
142
  /** One sentence: what the product is — llms.txt and the agent skill lead with it. */
71
143
  summary: optional.summary ?? `${brand_default.productName} documentation and API.`,
72
144
  /** Where vulnerability reports go — /.well-known/security.txt and /security publish it. Defaults to security@<domain>. */
73
145
  securityContact: optional.securityContact ?? `security@${brand_default.domain}`,
74
146
  /** The support address the /contact page shows. Defaults to support@<domain>. */
75
147
  supportContact: optional.supportContact ?? `support@${brand_default.domain}`,
148
+ /**
149
+ * Where operational alerts go (dead letters, failed crons, unhandled
150
+ * API errors, failed uptime probes — the worker's `sendOpsAlert`).
151
+ * Defaults to ops@<domain>; null when brand.json sets `false` (the
152
+ * platform's own deployment: no customers, alerts only logged).
153
+ */
154
+ opsContact: optional.opsContact === false ? null : optional.opsContact ?? `ops@${brand_default.domain}`,
76
155
  colors: brand_default.colors,
156
+ /**
157
+ * True once the product has launched (brand.json `launched`, set at
158
+ * launch, never back): its data is customers', so the pre-launch
159
+ * product reset's `/ops` route is not mounted at all
160
+ * (docs/deployment.md "Resetting product data"). False when absent.
161
+ */
162
+ launched: optional.launched === true,
77
163
  /** True once the product has its own brand (brand.json `status: "ready"`), not the platform's placeholders. */
78
164
  ready: brand_default.status === "ready"
79
165
  };
@@ -93,11 +179,11 @@ function resolveProductFeatures(features) {
93
179
  guests: teams && on("guests"),
94
180
  /** The public `/v1` API: its router, the OpenAPI spec and reference, SDK and CLI publishing. */
95
181
  publicApi,
96
- /** Workspace API keys: Settings → API Keys, `/internal/workspace/api-keys`, `sk_` authentication on `/v1`. */
182
+ /** Workspace API keys: Settings → Developers, `/internal/workspace/api-keys`, `sk_` authentication on `/v1`. */
97
183
  apiKeys: publicApi && on("apiKeys"),
98
184
  /** Personal access tokens: Account → API tokens, `/internal/account/pats`, `/v1/user/*`, `pat_` authentication, the CLI's sign-in. */
99
185
  personalTokens: publicApi && on("personalTokens"),
100
- /** Outgoing webhooks: Settings → Webhooks, `/internal/workspace/webhooks`, the admin tab, queued deliveries. */
186
+ /** Outgoing webhooks: Settings → Developers, `/internal/workspace/webhooks`, the admin tab, queued deliveries. */
101
187
  webhooks: on("webhooks"),
102
188
  /** Billing: Settings → Billing, the Stripe plugin, the admin Billing surfaces, the site's pricing page; a free product. */
103
189
  billing: on("billing"),
@@ -115,7 +201,8 @@ function resolveProductEnvironments(environments, defaultEnvironment, docs) {
115
201
  name: env.name,
116
202
  keyPrefix: env.keyPrefix,
117
203
  readOnlyWorkspace: env.readOnlyWorkspace ?? false,
118
- description: env.description ?? ""
204
+ description: env.description ?? "",
205
+ agentLabel: env.agentLabel ?? env.description ?? ""
119
206
  }));
120
207
  const names = new Set(list.map((env) => env.name));
121
208
  const prefixes = new Set(list.map((env) => env.keyPrefix));
@@ -658,17 +745,27 @@ function apiErrorFrom(error, response) {
658
745
  return new ApiError(response.status, envelope.error?.code ?? "http_error", envelope.error?.message ?? `HTTP ${response.status}`, envelope.error?.requestId);
659
746
  }
660
747
 
748
+ // node_modules/@reminix/sdk/dist/product/index.js
749
+ var product_exports = {};
750
+ __export(product_exports, {
751
+ RunError: () => RunError,
752
+ productMethods: () => productMethods,
753
+ run: () => run,
754
+ uploadFile: () => uploadFile,
755
+ waitForRun: () => waitForRun
756
+ });
757
+
661
758
  // node_modules/@reminix/sdk/dist/product/upload.js
662
759
  async function uploadFile(client, file, options = {}) {
663
760
  const body = file.data instanceof Blob ? file.data : new Blob([file.data], {
664
- type: file.type ?? "application/octet-stream"
761
+ type: file.mediaType ?? "application/octet-stream"
665
762
  });
666
763
  return unwrap(await client.POST("/files", {
667
764
  params: { query: { name: file.name } },
668
765
  body,
669
766
  bodySerializer: (value) => value,
670
767
  headers: {
671
- "content-type": file.type ?? (body.type || "application/octet-stream"),
768
+ "content-type": file.mediaType ?? (body.type || "application/octet-stream"),
672
769
  ...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
673
770
  }
674
771
  }));
@@ -678,7 +775,7 @@ async function uploadFile(client, file, options = {}) {
678
775
  var RunError = class extends Error {
679
776
  run;
680
777
  constructor(run3) {
681
- super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: its approval was denied or expired` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
778
+ super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: ${run3.error ?? "no reason given"}` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
682
779
  this.name = "RunError";
683
780
  this.run = run3;
684
781
  }
@@ -689,7 +786,7 @@ async function withFileIds(client, inputs, idempotencyKey) {
689
786
  let uploaded = 0;
690
787
  const upload = async (value) => (await uploadFile(client, value instanceof Blob ? {
691
788
  name: "name" in value ? String(value.name) : "upload",
692
- type: value.type,
789
+ mediaType: value.type,
693
790
  data: value
694
791
  } : value, idempotencyKey ? { idempotencyKey: `${idempotencyKey}:file-${++uploaded}` } : {})).id;
695
792
  const out = {};
@@ -731,7 +828,7 @@ async function run(client, slug, inputs = {}, options = {}) {
731
828
  inputs: await withFileIds(client, inputs, options.idempotencyKey)
732
829
  };
733
830
  const keyed = options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {};
734
- const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.run(slug, options.version, body, keyed);
831
+ const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.testRun(slug, options.version, body, keyed);
735
832
  if (started.status === "awaiting_approval") {
736
833
  options.onApproval?.(started.approval?.approveUrl ?? null);
737
834
  }
@@ -807,11 +904,7 @@ function resources(client) {
807
904
  files: {
808
905
  download: (
809
906
  /** Download a file */
810
- (fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/content", "query": [], "hasBody": false, "rawResponse": "application/octet-stream" }, { "fileId": fileId }, void 0, options)
811
- ),
812
- upload: (
813
- /** Upload a file */
814
- (content, input, options) => call(client, { "method": "post", "path": "/files", "query": ["name"], "hasBody": false, "rawBody": "application/octet-stream" }, {}, input, options, content)
907
+ (fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/download", "query": [], "hasBody": false, "rawResponse": "application/octet-stream" }, { "fileId": fileId }, void 0, options)
815
908
  ),
816
909
  get: (
817
910
  /** Get a file */
@@ -819,7 +912,11 @@ function resources(client) {
819
912
  ),
820
913
  list: (
821
914
  /** List files */
822
- (input, options) => call(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "script", "direction", "q"], "hasBody": false }, {}, input, options)
915
+ (input, options) => call(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "before", "script", "origin", "name"], "hasBody": false }, {}, input, options)
916
+ ),
917
+ upload: (
918
+ /** Upload a file */
919
+ (content, input, options) => call(client, { "method": "post", "path": "/files", "query": ["name"], "hasBody": false, "rawBody": "application/octet-stream" }, {}, input, options, content)
823
920
  )
824
921
  },
825
922
  runs: {
@@ -837,11 +934,11 @@ function resources(client) {
837
934
  ),
838
935
  list: (
839
936
  /** List runs */
840
- (input, options) => call(client, { "method": "get", "path": "/runs", "query": ["limit", "cursor", "script"], "hasBody": false }, {}, input, options)
937
+ (input, options) => call(client, { "method": "get", "path": "/runs", "query": ["limit", "cursor", "before", "script", "status"], "hasBody": false }, {}, input, options)
841
938
  ),
842
- logs: (
939
+ log: (
843
940
  /** Get a run's log */
844
- (runId, options) => call(client, { "method": "get", "path": "/runs/{runId}/logs", "query": [], "hasBody": false }, { "runId": runId }, void 0, options)
941
+ (runId, options) => call(client, { "method": "get", "path": "/runs/{runId}/log", "query": [], "hasBody": false }, { "runId": runId }, void 0, options)
845
942
  )
846
943
  },
847
944
  schedules: {
@@ -899,21 +996,21 @@ function resources(client) {
899
996
  )
900
997
  },
901
998
  scriptVersions: {
902
- create: (
903
- /** Upload a version */
904
- (slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions", "query": [], "hasBody": true }, { "slug": slug }, input, options)
905
- ),
906
999
  list: (
907
1000
  /** List a script's versions */
908
1001
  (slug, options) => call(client, { "method": "get", "path": "/scripts/{slug}/versions", "query": [], "hasBody": false }, { "slug": slug }, void 0, options)
909
1002
  ),
910
1003
  publish: (
911
1004
  /** Publish a version */
912
- (slug, number, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{number}/publish", "query": [], "hasBody": false }, { "slug": slug, "number": number }, void 0, options)
1005
+ (slug, version, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{version}/publish", "query": [], "hasBody": false }, { "slug": slug, "version": version }, void 0, options)
913
1006
  ),
914
- run: (
1007
+ testRun: (
915
1008
  /** Test-run a version */
916
- (slug, number, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{number}/runs", "query": [], "hasBody": true }, { "slug": slug, "number": number }, input, options)
1009
+ (slug, version, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions/{version}/runs", "query": [], "hasBody": true }, { "slug": slug, "version": version }, input, options)
1010
+ ),
1011
+ upload: (
1012
+ /** Upload a version */
1013
+ (slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/versions", "query": [], "hasBody": true }, { "slug": slug }, input, options)
917
1014
  )
918
1015
  },
919
1016
  secrets: {
@@ -928,8 +1025,10 @@ function resources(client) {
928
1025
  set: (
929
1026
  /** Save a secret */
930
1027
  (name, input, options) => call(client, { "method": "put", "path": "/secrets/{name}", "query": [], "hasBody": true }, { "name": name }, input, options)
931
- ),
932
- unset: (
1028
+ )
1029
+ },
1030
+ secretValues: {
1031
+ delete: (
933
1032
  /** Remove a secret's value from an environment */
934
1033
  (name, environment2, options) => call(client, { "method": "delete", "path": "/secrets/{name}/values/{environment}", "query": [], "hasBody": false }, { "name": name, "environment": environment2 }, void 0, options)
935
1034
  )
@@ -986,7 +1085,7 @@ function resources(client) {
986
1085
  auditEvents: {
987
1086
  list: (
988
1087
  /** List workspace audit events */
989
- (input, options) => call(client, { "method": "get", "path": "/workspace/audit-events", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options)
1088
+ (input, options) => call(client, { "method": "get", "path": "/workspace/audit-events", "query": ["limit", "cursor", "before", "action", "actor"], "hasBody": false }, {}, input, options)
990
1089
  )
991
1090
  },
992
1091
  eventTypes: {
@@ -1024,7 +1123,7 @@ function resources(client) {
1024
1123
  webhookDeliveries: {
1025
1124
  list: (
1026
1125
  /** List an endpoint's deliveries */
1027
- (endpointId, input, options) => call(client, { "method": "get", "path": "/workspace/webhook-endpoints/{endpointId}/deliveries", "query": ["limit", "cursor"], "hasBody": false }, { "endpointId": endpointId }, input, options)
1126
+ (endpointId, input, options) => call(client, { "method": "get", "path": "/workspace/webhook-endpoints/{endpointId}/deliveries", "query": ["limit", "cursor", "before", "status"], "hasBody": false }, { "endpointId": endpointId }, input, options)
1028
1127
  ),
1029
1128
  redeliver: (
1030
1129
  /** Redeliver an event */
@@ -1055,6 +1154,10 @@ function resources(client) {
1055
1154
  test: (
1056
1155
  /** Send a test event */
1057
1156
  (endpointId, options) => call(client, { "method": "post", "path": "/workspace/webhook-endpoints/{endpointId}/test", "query": [], "hasBody": false }, { "endpointId": endpointId }, void 0, options)
1157
+ ),
1158
+ update: (
1159
+ /** Update a webhook endpoint */
1160
+ (endpointId, input, options) => call(client, { "method": "patch", "path": "/workspace/webhook-endpoints/{endpointId}", "query": [], "hasBody": true }, { "endpointId": endpointId }, input, options)
1058
1161
  )
1059
1162
  }
1060
1163
  }
@@ -1067,6 +1170,8 @@ var RETRY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
1067
1170
  var DEFAULT_MAX_RETRIES = 2;
1068
1171
  var MAX_WAIT_MS = 2e4;
1069
1172
  var MAX_BASE_KEY = 200;
1173
+ var PRODUCT_RETRY_HEADER = "x-sdk-product-retry";
1174
+ var productRetry = () => "productRetry" in product_exports ? Reflect.get(product_exports, "productRetry") ?? null : null;
1070
1175
  var wait = (ms) => new Promise((done) => setTimeout(done, ms));
1071
1176
  function backoff(attempt) {
1072
1177
  const base = Math.min(500 * 2 ** attempt, 8e3);
@@ -1094,10 +1199,24 @@ async function retryable(response) {
1094
1199
  return false;
1095
1200
  }
1096
1201
  }
1202
+ function takeProductRetryHeader(request) {
1203
+ if (!request.headers.has(PRODUCT_RETRY_HEADER))
1204
+ return [request, false];
1205
+ const returns = request.headers.get(PRODUCT_RETRY_HEADER) === "return";
1206
+ const headers = new Headers(request.headers);
1207
+ headers.delete(PRODUCT_RETRY_HEADER);
1208
+ return [new Request(request, { headers }), returns];
1209
+ }
1210
+ function withoutProductRetryHeader(fetch2) {
1211
+ return (request) => fetch2(takeProductRetryHeader(request)[0]);
1212
+ }
1097
1213
  function withRetries(fetch2, options = {}) {
1098
1214
  const maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
1099
1215
  const sleep = options.sleep ?? wait;
1216
+ const later = options.product === void 0 ? productRetry() : options.product;
1100
1217
  return async (request) => {
1218
+ let returnLater;
1219
+ [request, returnLater] = takeProductRetryHeader(request);
1101
1220
  if (WRITES.has(request.method) && !request.headers.has("idempotency-key")) {
1102
1221
  const url = new URL(request.url);
1103
1222
  const key = options.key ? await options.key(request.method, url.pathname) : crypto.randomUUID();
@@ -1105,9 +1224,11 @@ function withRetries(fetch2, options = {}) {
1105
1224
  headers.set("idempotency-key", key);
1106
1225
  request = new Request(request, { headers });
1107
1226
  }
1227
+ let laterTries = 0;
1228
+ let laterWaited = 0;
1108
1229
  for (let attempt = 0; ; attempt++) {
1109
1230
  const last = attempt >= maxRetries;
1110
- const sending = last ? request : request.clone();
1231
+ const sending = last && !later ? request : request.clone();
1111
1232
  let response;
1112
1233
  try {
1113
1234
  response = await fetch2(sending);
@@ -1117,6 +1238,18 @@ function withRetries(fetch2, options = {}) {
1117
1238
  await sleep(backoff(attempt));
1118
1239
  continue;
1119
1240
  }
1241
+ const laterMs = later ? await later.wait(response, laterTries) : null;
1242
+ if (laterMs !== null && later) {
1243
+ if (returnLater || laterWaited + laterMs > later.budgetMs) {
1244
+ return response;
1245
+ }
1246
+ laterTries++;
1247
+ laterWaited += laterMs;
1248
+ await response.body?.cancel();
1249
+ await sleep(laterMs);
1250
+ attempt--;
1251
+ continue;
1252
+ }
1120
1253
  if (last || !await retryable(response))
1121
1254
  return response;
1122
1255
  const delay = retryAfter(response) ?? backoff(attempt);
@@ -1218,10 +1351,11 @@ async function verifyWebhook(body, headers, secret, options = {}) {
1218
1351
 
1219
1352
  // node_modules/@reminix/sdk/dist/index.js
1220
1353
  var API_KEY_ENV = `${brand2.identifier.toUpperCase()}_API_KEY`;
1354
+ var TOKEN_ENV = `${brand2.identifier.toUpperCase()}_TOKEN`;
1221
1355
  var DEFAULT_API = `https://api.${brand2.domain}`;
1222
1356
  function createClient2(options = {}) {
1223
1357
  const client = createBaseClient(options);
1224
- const extend = productMethods;
1358
+ const extend = Reflect.get(product_exports, "productMethods");
1225
1359
  if (!extend)
1226
1360
  return client;
1227
1361
  const methods = extend(client);
@@ -1233,15 +1367,18 @@ function createClient2(options = {}) {
1233
1367
  return Object.assign(client, methods);
1234
1368
  }
1235
1369
  function createBaseClient(options) {
1236
- const token = options.token ?? keyFromEnvironment();
1370
+ if (options.apiKey && options.token) {
1371
+ throw new Error(`${brand2.productName}: pass apiKey or token, not both.`);
1372
+ }
1373
+ const token = options.apiKey || options.token || credentialFromEnvironment();
1237
1374
  if (!token) {
1238
- throw new Error(`${brand2.productName}: no API key. Pass { token } or set ${API_KEY_ENV}.`);
1375
+ throw new Error(`${brand2.productName}: no API key. Pass { apiKey } or set ${API_KEY_ENV}.`);
1239
1376
  }
1240
- const origin = (options.api ?? DEFAULT_API).replace(/\/+$/, "");
1377
+ const origin = withoutTrailingSlashes(options.api ?? DEFAULT_API);
1241
1378
  const send = options.fetch ?? ((request) => fetch(request));
1242
1379
  const client = createClient({
1243
1380
  baseUrl: `${origin}/v1`,
1244
- fetch: options.maxRetries === 0 ? send : withRetries(send, { maxRetries: options.maxRetries })
1381
+ fetch: options.maxRetries === 0 ? withoutProductRetryHeader(send) : withRetries(send, { maxRetries: options.maxRetries })
1245
1382
  });
1246
1383
  client.use({
1247
1384
  onRequest({ request }) {
@@ -1259,9 +1396,10 @@ function createBaseClient(options) {
1259
1396
  webhooks: { verify: verifyWebhook }
1260
1397
  });
1261
1398
  }
1262
- function keyFromEnvironment() {
1399
+ function credentialFromEnvironment() {
1263
1400
  const runtime = globalThis;
1264
- return runtime.process?.env?.[API_KEY_ENV] || void 0;
1401
+ const env = runtime.process?.env;
1402
+ return env?.[API_KEY_ENV] || env?.[TOKEN_ENV] || void 0;
1265
1403
  }
1266
1404
  function unwrap(result) {
1267
1405
  if (result.error !== void 0 || !result.response.ok) {
@@ -1269,6 +1407,12 @@ function unwrap(result) {
1269
1407
  }
1270
1408
  return result.data;
1271
1409
  }
1410
+ function withoutTrailingSlashes(url) {
1411
+ let end = url.length;
1412
+ while (end > 0 && url[end - 1] === "/")
1413
+ end--;
1414
+ return url.slice(0, end);
1415
+ }
1272
1416
 
1273
1417
  // node_modules/commander/lib/error.js
1274
1418
  var CommanderError = class extends Error {
@@ -1497,11 +1641,11 @@ var Help = class {
1497
1641
  visibleOptions.push(helpOption);
1498
1642
  } else if (helpOption.long && !removeLong) {
1499
1643
  visibleOptions.push(
1500
- cmd.createOption(helpOption.long, helpOption.description)
1644
+ cmd.createOption(helpOption.long, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1501
1645
  );
1502
1646
  } else if (helpOption.short && !removeShort) {
1503
1647
  visibleOptions.push(
1504
- cmd.createOption(helpOption.short, helpOption.description)
1648
+ cmd.createOption(helpOption.short, helpOption.description).helpGroup(helpOption.helpGroupHeading)
1505
1649
  );
1506
1650
  }
1507
1651
  }
@@ -2033,7 +2177,7 @@ var Option = class {
2033
2177
  this.description = description || "";
2034
2178
  this.required = flags.includes("<");
2035
2179
  this.optional = flags.includes("[");
2036
- this.variadic = /\w\.\.\.[>\]]$/.test(flags);
2180
+ this.variadic = new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$", "u").test(flags);
2037
2181
  this.mandatory = false;
2038
2182
  const optionFlags = splitOptionFlags(flags);
2039
2183
  this.short = optionFlags.shortFlag;
@@ -3216,7 +3360,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3216
3360
  getOptionValueSourceWithGlobals(key) {
3217
3361
  let source;
3218
3362
  this._getCommandAndAncestors().forEach((cmd) => {
3219
- if (cmd.getOptionValueSource(key) !== void 0) {
3363
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
3220
3364
  source = cmd.getOptionValueSource(key);
3221
3365
  }
3222
3366
  });
@@ -3859,7 +4003,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3859
4003
  return arg.length > 1 && arg[0] === "-";
3860
4004
  }
3861
4005
  const negativeNumberArg = (arg) => {
3862
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
4006
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
3863
4007
  return !this._getCommandAndAncestors().some(
3864
4008
  (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
3865
4009
  );
@@ -4307,7 +4451,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4307
4451
  * (This does not override a group set directly on the subcommand using .helpGroup().)
4308
4452
  *
4309
4453
  * @example
4310
- * program.commandsGroup('Development Commands:);
4454
+ * program.commandsGroup('Development Commands:');
4311
4455
  * program.command('watch')...
4312
4456
  * program.command('lint')...
4313
4457
  * ...
@@ -4478,7 +4622,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
4478
4622
  * Pass in false to disable the built-in help option.
4479
4623
  *
4480
4624
  * @example
4481
- * program.helpOption('-?, --help' 'show help'); // customise
4625
+ * program.helpOption('-?, --help', 'show help'); // customise
4482
4626
  * program.helpOption(false); // disable
4483
4627
  *
4484
4628
  * @param {(string | boolean)} flags
@@ -4607,16 +4751,20 @@ function incrementNodeInspectorPort(args) {
4607
4751
  let debugHost = "127.0.0.1";
4608
4752
  let debugPort = "9229";
4609
4753
  let match;
4610
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
4754
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
4611
4755
  debugOption = match[1];
4612
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
4756
+ } else if ((match = arg.match(
4757
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/
4758
+ )) !== null) {
4613
4759
  debugOption = match[1];
4614
4760
  if (/^\d+$/.test(match[3])) {
4615
4761
  debugPort = match[3];
4616
4762
  } else {
4617
4763
  debugHost = match[3];
4618
4764
  }
4619
- } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
4765
+ } else if ((match = arg.match(
4766
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/
4767
+ )) !== null) {
4620
4768
  debugOption = match[1];
4621
4769
  debugHost = match[3];
4622
4770
  debugPort = match[4];
@@ -4639,12 +4787,35 @@ function useColor() {
4639
4787
  var program = new Command();
4640
4788
 
4641
4789
  // src/browser-login.ts
4642
- import { randomBytes } from "node:crypto";
4790
+ import {
4791
+ constants,
4792
+ generateKeyPairSync,
4793
+ privateDecrypt,
4794
+ randomBytes
4795
+ } from "node:crypto";
4643
4796
  import { createServer } from "node:http";
4644
4797
  var PAGE = (title, body) => `<!doctype html><html><head><meta charset="utf-8"><title>${title}</title><meta name="viewport" content="width=device-width, initial-scale=1"></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;padding:0 1rem"><h1 style="font-size:1.25rem">${title}</h1><p>${body}</p></body></html>`;
4645
- var MAX_BODY = 16 * 1024;
4798
+ var MAX_URL = 16 * 1024;
4646
4799
  function browserLogin(options) {
4647
4800
  const state = randomBytes(24).toString("base64url");
4801
+ const { publicKey, privateKey } = generateKeyPairSync("rsa", {
4802
+ modulusLength: 2048
4803
+ });
4804
+ const key = publicKey.export({ type: "spki", format: "der" }).toString("base64url");
4805
+ const decrypt = (sealed) => {
4806
+ try {
4807
+ return privateDecrypt(
4808
+ {
4809
+ key: privateKey,
4810
+ padding: constants.RSA_PKCS1_OAEP_PADDING,
4811
+ oaepHash: "sha256"
4812
+ },
4813
+ Buffer.from(sealed, "base64url")
4814
+ ).toString("utf8");
4815
+ } catch {
4816
+ return null;
4817
+ }
4818
+ };
4648
4819
  return new Promise((resolve4, reject) => {
4649
4820
  let settled = false;
4650
4821
  const finish = (outcome) => {
@@ -4655,49 +4826,46 @@ function browserLogin(options) {
4655
4826
  outcome();
4656
4827
  };
4657
4828
  const server = createServer((req, res) => {
4658
- if (req.method !== "POST" || req.url !== "/callback") {
4829
+ const url = new URL(req.url ?? "/", "http://127.0.0.1");
4830
+ if (req.method !== "GET" || url.pathname !== "/callback" || (req.url ?? "").length > MAX_URL) {
4659
4831
  res.writeHead(404).end();
4660
4832
  return;
4661
4833
  }
4662
- let body = "";
4663
- req.setEncoding("utf8");
4664
- req.on("data", (chunk) => {
4665
- body += chunk;
4666
- if (body.length > MAX_BODY) req.destroy();
4667
- });
4668
- req.on("end", () => {
4669
- const fields = new URLSearchParams(body);
4670
- const send = (status, title, text) => res.writeHead(status, { "content-type": "text/html; charset=utf-8" }).end(PAGE(title, text));
4671
- if (fields.get("state") !== state) {
4672
- send(
4673
- 400,
4674
- "Not this login",
4675
- "This sign-in did not come from the terminal that is waiting. Run login again."
4676
- );
4677
- return;
4678
- }
4679
- if (fields.get("error")) {
4680
- send(200, "Sign-in cancelled", "You can close this tab.");
4681
- finish(() => reject(new Error("sign-in was denied in the browser")));
4682
- return;
4683
- }
4684
- const token = fields.get("token");
4685
- if (!token) {
4686
- send(400, "Something went wrong", "Run login again.");
4687
- return;
4688
- }
4834
+ const fields = url.searchParams;
4835
+ const send = (status, title, text) => res.writeHead(status, {
4836
+ "content-type": "text/html; charset=utf-8",
4837
+ "cache-control": "no-store",
4838
+ "referrer-policy": "no-referrer"
4839
+ }).end(PAGE(title, text));
4840
+ if (fields.get("state") !== state) {
4689
4841
  send(
4690
- 200,
4691
- "You are signed in",
4692
- "Return to your terminal \u2014 you can close this tab."
4842
+ 400,
4843
+ "Not this login",
4844
+ "This sign-in did not come from the terminal that is waiting. Run login again."
4693
4845
  );
4694
- finish(() => resolve4(token));
4695
- });
4846
+ return;
4847
+ }
4848
+ if (fields.get("error")) {
4849
+ send(200, "Sign-in cancelled", "You can close this tab.");
4850
+ finish(() => reject(new Error("sign-in was denied in the browser")));
4851
+ return;
4852
+ }
4853
+ const token = decrypt(fields.get("token") ?? "");
4854
+ if (!token) {
4855
+ send(400, "Something went wrong", "Run login again.");
4856
+ return;
4857
+ }
4858
+ send(
4859
+ 200,
4860
+ "You are signed in",
4861
+ "Return to your terminal. You can close this tab."
4862
+ );
4863
+ finish(() => resolve4(token));
4696
4864
  });
4697
4865
  const timer = setTimeout(
4698
4866
  () => finish(
4699
4867
  () => reject(
4700
- new Error("timed out waiting for the browser \u2014 run login again")
4868
+ new Error("timed out waiting for the browser. Run login again.")
4701
4869
  )
4702
4870
  ),
4703
4871
  options.timeoutMs ?? 5 * 60 * 1e3
@@ -4709,6 +4877,7 @@ function browserLogin(options) {
4709
4877
  const url = `${options.webOrigin}/cli/authorize?${new URLSearchParams({
4710
4878
  port: String(port),
4711
4879
  state,
4880
+ key,
4712
4881
  name: options.computer
4713
4882
  })}`;
4714
4883
  options.onUrl(url);
@@ -4722,8 +4891,8 @@ function webOriginFor(api2) {
4722
4891
  url.hostname = `app.${url.hostname.slice(4)}`;
4723
4892
  return url.origin;
4724
4893
  }
4725
- if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") && url.port === "8787") {
4726
- url.port = "3000";
4894
+ if ((url.hostname === "localhost" || url.hostname === "127.0.0.1") && Number(url.port) >= 8787 && Number(url.port) % 100 === 87) {
4895
+ url.port = String(Number(url.port) - 5787);
4727
4896
  return url.origin;
4728
4897
  }
4729
4898
  return null;
@@ -4750,7 +4919,7 @@ function readConfig(homeDir) {
4750
4919
  try {
4751
4920
  return JSON.parse(readFileSync(path2, "utf8"));
4752
4921
  } catch {
4753
- throw new Error(`${path2} is not valid JSON \u2014 fix or delete it`);
4922
+ throw new Error(`${path2} is not valid JSON. Fix or delete it.`);
4754
4923
  }
4755
4924
  }
4756
4925
  function writeConfig(homeDir, config2) {
@@ -4768,11 +4937,18 @@ function resolveSettings(env, homeDir, flags = {}) {
4768
4937
  const environment2 = flags.environment ? { environment: flags.environment, environmentSource: "flag" } : env[environmentEnvVar()] ? { environment: env[environmentEnvVar()], environmentSource: "env" } : config2.environment ? { environment: config2.environment, environmentSource: "config" } : { environment: void 0, environmentSource: null };
4769
4938
  return {
4770
4939
  ...environment2,
4771
- api: (env[`${brand.identifier.toUpperCase()}_API`] ?? config2.api ?? DEFAULT_API).replace(/\/+$/, ""),
4940
+ api: withoutTrailingSlashes2(
4941
+ env[`${brand.identifier.toUpperCase()}_API`] ?? config2.api ?? DEFAULT_API
4942
+ ),
4772
4943
  token: env[tokenEnvVar()] ?? config2.token,
4773
4944
  workspace: env[`${brand.identifier.toUpperCase()}_WORKSPACE`] ?? config2.workspace
4774
4945
  };
4775
4946
  }
4947
+ function withoutTrailingSlashes2(url) {
4948
+ let end = url.length;
4949
+ while (end > 0 && url[end - 1] === "/") end--;
4950
+ return url.slice(0, end);
4951
+ }
4776
4952
 
4777
4953
  // src/http.ts
4778
4954
  async function rawRequest(ctx, options) {
@@ -4822,7 +4998,9 @@ function writeEnvVar(path2, name, value) {
4822
4998
  }
4823
4999
  var approvals = (program3, ctx) => {
4824
5000
  const workspace2 = program3.commands.find((c) => c.name() === "workspace") ?? program3.command("workspace");
4825
- const group = workspace2.command("approval-requests").description("approval-requests commands");
5001
+ const group = workspace2.command("approval-requests").description(
5002
+ "Ask a person to approve an action, and collect what it creates"
5003
+ );
4826
5004
  group.command("redeem <request-id>").description(
4827
5005
  "Collect an approved secret once, into an env file (never printed)"
4828
5006
  ).requiredOption(
@@ -4853,7 +5031,7 @@ var approvals = (program3, ctx) => {
4853
5031
  }
4854
5032
  if (request.status !== "approved") {
4855
5033
  throw new Error(
4856
- request.status === "pending" ? `Not approved yet \u2014 ask a person to approve it: ${request.approveUrl}` : `This request is ${request.status}; nothing to collect.`
5034
+ request.status === "pending" ? `Not approved yet. Ask a person to approve it: ${request.approveUrl}` : `This request is ${request.status}; nothing to collect.`
4857
5035
  );
4858
5036
  }
4859
5037
  const redeemed = await call3(
@@ -4895,7 +5073,7 @@ async function saveToken(ctx, token, api2) {
4895
5073
  writeConfig(ctx.io.homeDir, previous);
4896
5074
  const reason = error instanceof Error ? error.message : String(error);
4897
5075
  throw new Error(
4898
- `could not verify the token (${reason}) \u2014 nothing was saved`,
5076
+ `could not verify the token (${reason}). Nothing was saved.`,
4899
5077
  { cause: error }
4900
5078
  );
4901
5079
  }
@@ -4903,7 +5081,7 @@ async function saveToken(ctx, token, api2) {
4903
5081
  `Logged in. Token stored in ${configPath(ctx.io.homeDir)} (0600).`
4904
5082
  );
4905
5083
  ctx.io.stdout(
4906
- `Hello ${user.name} <${user.email}> \u2014 ${user.workspaces.length} workspace(s).`
5084
+ `Hello ${user.name} <${user.email}>. You have ${user.workspaces.length} workspace(s).`
4907
5085
  );
4908
5086
  if (!config2.workspace && user.workspaces.length === 1) {
4909
5087
  config2.workspace = user.workspaces[0].slug;
@@ -4915,7 +5093,7 @@ async function saveToken(ctx, token, api2) {
4915
5093
  }
4916
5094
  var login = (program3, ctx) => {
4917
5095
  program3.command("login").description(
4918
- "Sign in through the browser (or store a personal access token with --token)"
5096
+ "Sign in through the browser, or store a personal access token with --token"
4919
5097
  ).option("--token <pat>", "a personal access token (CI, servers)").option("--api <origin>", `API origin (default ${DEFAULT_API})`).option("--web <origin>", "web app origin for the browser sign-in").action(async (options) => {
4920
5098
  if (!productFeatures.personalTokens) {
4921
5099
  throw new Error(
@@ -4928,7 +5106,7 @@ var login = (program3, ctx) => {
4928
5106
  }
4929
5107
  if (!ctx.io.interactive) {
4930
5108
  ctx.io.stderr(
4931
- `Paste a personal access token (Account \u2192 API tokens in ${brand.productName}), then Enter:`
5109
+ `Paste a personal access token (Account \u2192 Personal access tokens in ${brand.productName}), then Enter:`
4932
5110
  );
4933
5111
  await saveToken(ctx, (await ctx.io.stdin()).trim(), options.api);
4934
5112
  return;
@@ -4937,7 +5115,7 @@ var login = (program3, ctx) => {
4937
5115
  const webOrigin = options.web ?? webOriginFor(api2);
4938
5116
  if (!webOrigin) {
4939
5117
  throw new Error(
4940
- `cannot tell the web app's address from ${api2} \u2014 pass --web <origin>`
5118
+ `cannot tell the web app's address from ${api2}. Pass --web <origin>.`
4941
5119
  );
4942
5120
  }
4943
5121
  const token = await browserLogin({
@@ -4964,13 +5142,13 @@ var logout = (program3, ctx) => {
4964
5142
  ).catch(() => null);
4965
5143
  if (revoked && !revoked.ok && revoked.status !== 401) {
4966
5144
  ctx.io.stderr(
4967
- `Could not revoke the token (HTTP ${revoked.status}) \u2014 revoke it under Account \u2192 API tokens.`
5145
+ `Could not revoke the token (HTTP ${revoked.status}). Revoke it under Account \u2192 Personal access tokens.`
4968
5146
  );
4969
5147
  }
4970
5148
  }
4971
5149
  delete config2.token;
4972
5150
  writeConfig(ctx.io.homeDir, config2);
4973
- ctx.io.stdout("Logged out \u2014 the token is revoked and forgotten.");
5151
+ ctx.io.stdout("Logged out. The token is revoked and forgotten.");
4974
5152
  });
4975
5153
  };
4976
5154
  async function printWorkspaces(ctx, asJson) {
@@ -4993,13 +5171,13 @@ async function printWorkspaces(ctx, asJson) {
4993
5171
  );
4994
5172
  }
4995
5173
  var whoami = (program3, ctx) => {
4996
- program3.command("whoami").description("Who the token acts as, and their workspaces").option("--json", "machine-readable output").action(
5174
+ program3.command("whoami").description("Show who the token acts as and which workspaces it can use").option("--json", "machine-readable output").action(
4997
5175
  (options) => printWorkspaces(ctx, options.json === true)
4998
5176
  );
4999
5177
  };
5000
5178
  var workspace = (program3, ctx) => {
5001
5179
  const group = program3.command("workspace").description(
5002
- "Your workspaces (list, use), and the current one's members, webhooks, approvals, usage \u2026"
5180
+ "Work with your workspaces and the current one's members, webhooks, approvals and usage"
5003
5181
  );
5004
5182
  group.command("list", { isDefault: true }).description("List the workspaces the token can act in").option("--json", "machine-readable output").action(
5005
5183
  (options) => printWorkspaces(ctx, options.json === true)
@@ -5016,7 +5194,7 @@ var workspace = (program3, ctx) => {
5016
5194
  });
5017
5195
  };
5018
5196
  var environment = (program3, ctx) => {
5019
- const group = program3.command("environment").description("The environment commands act in (list, use, unset)");
5197
+ const group = program3.command("environment").description("Choose the environment commands act in");
5020
5198
  group.command("list", { isDefault: true }).description("Show the environment commands act in").action(() => {
5021
5199
  const { environment: current, environmentSource } = ctx.settings();
5022
5200
  const from = environmentSource ? `(from ${{ flag: "--environment", env: environmentEnvVar(), config: "config" }[environmentSource]})` : null;
@@ -5030,14 +5208,14 @@ var environment = (program3, ctx) => {
5030
5208
  return;
5031
5209
  }
5032
5210
  ctx.io.stdout(
5033
- current ? `${current} ${from}` : "None set \u2014 the API acts in the workspace's default."
5211
+ current ? `${current} ${from}` : "None set. The API acts in the workspace's default."
5034
5212
  );
5035
5213
  });
5036
5214
  group.command("use <name>").description("Make <name> the default environment for commands").action((name) => {
5037
5215
  const declared = productEnvironments.list.map((env) => env.name);
5038
5216
  if (declared.length > 0 && !declared.includes(name)) {
5039
5217
  throw new Error(
5040
- `unknown environment '${name}' \u2014 ${brand.productName}'s are ${declared.join(", ")}`
5218
+ `unknown environment '${name}'. ${brand.productName}'s environments are ${declared.join(", ")}.`
5041
5219
  );
5042
5220
  }
5043
5221
  const config2 = readConfig(ctx.io.homeDir);
@@ -5046,7 +5224,7 @@ var environment = (program3, ctx) => {
5046
5224
  ctx.io.stdout(`Default environment: ${name}`);
5047
5225
  });
5048
5226
  group.command("unset").description(
5049
- "Forget the default environment (the product's default applies)"
5227
+ "Forget the default environment and go back to the product's default"
5050
5228
  ).action(() => {
5051
5229
  const config2 = readConfig(ctx.io.homeDir);
5052
5230
  delete config2.environment;
@@ -5055,7 +5233,7 @@ var environment = (program3, ctx) => {
5055
5233
  });
5056
5234
  };
5057
5235
  var api = (program3, ctx) => {
5058
- program3.command("api <method> <path>").description("Call any endpoint as the selected workspace (escape hatch)").option("--data <json>", "JSON request body").option("--workspace <slug>", "act in this workspace for one call").action(
5236
+ program3.command("api <method> <path>").description("Call any API endpoint directly, in the selected workspace").option("--data <json>", "JSON request body").option("--workspace <slug>", "act in this workspace for one call").action(
5059
5237
  async (method, path2, options) => {
5060
5238
  if (!path2.startsWith("/")) {
5061
5239
  throw new Error("usage: api <method> </v1/...> [--data '<json>']");
@@ -5075,7 +5253,7 @@ var api = (program3, ctx) => {
5075
5253
  );
5076
5254
  };
5077
5255
  var config = (program3, ctx) => {
5078
- program3.command("config").description("Show the effective settings (token masked)").action(() => {
5256
+ program3.command("config").description("Show the settings in effect, with the token hidden").action(() => {
5079
5257
  const settings = ctx.settings();
5080
5258
  ctx.io.stdout(
5081
5259
  json({
@@ -5121,8 +5299,11 @@ function operationRequest(op, input, body = {}) {
5121
5299
  json2[field.name] = value;
5122
5300
  }
5123
5301
  }
5124
- const missing = path2.match(/\{([^}]+)\}/);
5125
- if (missing) throw new Error(`missing ${missing[1]}`);
5302
+ const open = path2.indexOf("{");
5303
+ const close = open === -1 ? -1 : path2.indexOf("}", open + 1);
5304
+ if (close > open + 1) {
5305
+ throw new Error(`missing ${path2.slice(open + 1, close)}`);
5306
+ }
5126
5307
  const qs = query.toString();
5127
5308
  return {
5128
5309
  method: op.method.toUpperCase(),
@@ -5145,20 +5326,20 @@ var OPERATIONS = [
5145
5326
  },
5146
5327
  "mcp": {
5147
5328
  "exposed": false,
5148
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5329
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5149
5330
  },
5150
- "description": "Adds an environment with no secret values yet \u2014 save them with X-Environment set to it. Lowercase letters, digits and dashes. Owners and admins, or a workspace API key.",
5331
+ "description": "Adds an environment with no secret values yet. To save its values, call secrets.set with X-Environment set to the new environment. Workspace owners, admins and API keys can add an environment.",
5151
5332
  "fields": [
5152
5333
  {
5153
5334
  "name": "name",
5154
5335
  "in": "body",
5155
5336
  "type": "string",
5156
5337
  "required": true,
5157
- "description": "Its name, unique in the workspace.",
5338
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.",
5158
5339
  "example": "staging",
5159
5340
  "schema": {
5160
5341
  "type": "string",
5161
- "description": "Its name, unique in the workspace."
5342
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter."
5162
5343
  }
5163
5344
  },
5164
5345
  {
@@ -5166,7 +5347,8 @@ var OPERATIONS = [
5166
5347
  "in": "body",
5167
5348
  "type": "string",
5168
5349
  "required": false,
5169
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy. Default: none.",
5350
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. The default is `none`.",
5351
+ "example": "agents",
5170
5352
  "schema": {
5171
5353
  "type": "string",
5172
5354
  "enum": [
@@ -5174,7 +5356,7 @@ var OPERATIONS = [
5174
5356
  "agents",
5175
5357
  "always"
5176
5358
  ],
5177
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy. Default: none."
5359
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy. The default is `none`."
5178
5360
  }
5179
5361
  },
5180
5362
  {
@@ -5182,15 +5364,16 @@ var OPERATIONS = [
5182
5364
  "in": "body",
5183
5365
  "type": "boolean",
5184
5366
  "required": false,
5185
- "description": "Whether agents (MCP) may run scripts here, or schedule them to. Default: true.",
5367
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here. The default is true.",
5186
5368
  "schema": {
5187
5369
  "type": "boolean",
5188
- "description": "Whether agents (MCP) may run scripts here, or schedule them to. Default: true."
5370
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here. The default is true."
5189
5371
  }
5190
5372
  }
5191
5373
  ],
5192
5374
  "hasBody": true,
5193
5375
  "workspace": true,
5376
+ "acceptsApiKey": true,
5194
5377
  "scope": "environments:write"
5195
5378
  },
5196
5379
  {
@@ -5207,23 +5390,26 @@ var OPERATIONS = [
5207
5390
  },
5208
5391
  "mcp": {
5209
5392
  "exposed": false,
5210
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5393
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5211
5394
  },
5212
- "description": "Deletes it and every secret value it holds (GET it first to see how many). Refused for the only environment, the default, and one a schedule or trigger runs in. Owners and admins, or a workspace API key.",
5395
+ "description": "Deletes an environment and every secret value it holds. Get the environment first to see how many values that is. You can't delete the only environment, the default environment, or one that a schedule or trigger runs in. Workspace owners, admins and API keys can delete an environment.",
5213
5396
  "fields": [
5214
5397
  {
5215
5398
  "name": "environment",
5216
5399
  "in": "path",
5217
5400
  "type": "string",
5218
5401
  "required": true,
5402
+ "description": "The environment's ID.",
5219
5403
  "example": "staging",
5220
5404
  "schema": {
5221
- "type": "string"
5405
+ "type": "string",
5406
+ "description": "The environment's ID."
5222
5407
  }
5223
5408
  }
5224
5409
  ],
5225
5410
  "hasBody": false,
5226
5411
  "workspace": true,
5412
+ "acceptsApiKey": true,
5227
5413
  "scope": "environments:write"
5228
5414
  },
5229
5415
  {
@@ -5247,21 +5433,24 @@ var OPERATIONS = [
5247
5433
  "idempotentHint": true
5248
5434
  }
5249
5435
  },
5250
- "description": "One environment, with what uses it: the secret values deleting it would delete, and the schedules and triggers that keep it from being deleted.",
5436
+ "description": "Returns one environment and what uses it: its secret values, and the schedules and triggers that run in it. Deleting the environment deletes its secret values. You can't delete it while a schedule or trigger runs in it.",
5251
5437
  "fields": [
5252
5438
  {
5253
5439
  "name": "environment",
5254
5440
  "in": "path",
5255
5441
  "type": "string",
5256
5442
  "required": true,
5443
+ "description": "The environment's ID.",
5257
5444
  "example": "staging",
5258
5445
  "schema": {
5259
- "type": "string"
5446
+ "type": "string",
5447
+ "description": "The environment's ID."
5260
5448
  }
5261
5449
  }
5262
5450
  ],
5263
5451
  "hasBody": false,
5264
5452
  "workspace": true,
5453
+ "acceptsApiKey": true,
5265
5454
  "scope": "environments:read"
5266
5455
  },
5267
5456
  {
@@ -5283,10 +5472,11 @@ var OPERATIONS = [
5283
5472
  "idempotentHint": true
5284
5473
  }
5285
5474
  },
5286
- "description": "The workspace's environments, oldest first, with which is the default. Name one with the X-Environment header to act in it.",
5475
+ "description": "Lists the workspace's environments, oldest first, and shows which one is the default. To act in an environment, name it in the X-Environment header.",
5287
5476
  "fields": [],
5288
5477
  "hasBody": false,
5289
5478
  "workspace": true,
5479
+ "acceptsApiKey": true,
5290
5480
  "scope": "environments:read"
5291
5481
  },
5292
5482
  {
@@ -5303,18 +5493,20 @@ var OPERATIONS = [
5303
5493
  },
5304
5494
  "mcp": {
5305
5495
  "exposed": false,
5306
- "reason": "Environments hold secret values and rules \u2014 a person sets them up; an agent asks"
5496
+ "reason": "Environments hold secret values and rules. A person sets them up, and an agent asks a person to."
5307
5497
  },
5308
- "description": "Renames it, changes its rules, or makes it the workspace's default (`isDefault: true`). Runs keep the name they ran under. Owners and admins, or a workspace API key.",
5498
+ "description": "Renames an environment, changes its rules, or makes it the workspace's default with `isDefault: true`. Runs keep the environment name they ran under. Workspace owners, admins and API keys can change an environment.",
5309
5499
  "fields": [
5310
5500
  {
5311
5501
  "name": "environment",
5312
5502
  "in": "path",
5313
5503
  "type": "string",
5314
5504
  "required": true,
5505
+ "description": "The environment's ID.",
5315
5506
  "example": "staging",
5316
5507
  "schema": {
5317
- "type": "string"
5508
+ "type": "string",
5509
+ "description": "The environment's ID."
5318
5510
  }
5319
5511
  },
5320
5512
  {
@@ -5322,10 +5514,10 @@ var OPERATIONS = [
5322
5514
  "in": "body",
5323
5515
  "type": "string",
5324
5516
  "required": false,
5325
- "description": "Its name, unique in the workspace.",
5517
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter.",
5326
5518
  "schema": {
5327
5519
  "type": "string",
5328
- "description": "Its name, unique in the workspace."
5520
+ "description": "The environment's name, unique in the workspace. It's up to 32 lowercase letters, digits and dashes, and starts with a letter."
5329
5521
  }
5330
5522
  },
5331
5523
  {
@@ -5333,7 +5525,8 @@ var OPERATIONS = [
5333
5525
  "in": "body",
5334
5526
  "type": "string",
5335
5527
  "required": false,
5336
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy.",
5528
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy.",
5529
+ "example": "agents",
5337
5530
  "schema": {
5338
5531
  "type": "string",
5339
5532
  "enum": [
@@ -5341,7 +5534,7 @@ var OPERATIONS = [
5341
5534
  "agents",
5342
5535
  "always"
5343
5536
  ],
5344
- "description": "Which runs here wait for a person's approval: `none`, `agents` (runs an agent starts) or `always`. A run uses the stricter of this and its script's policy."
5537
+ "description": "Which runs here wait for a person's approval: `none`, `agents` for runs an agent starts, or `always` for every run. A run uses the stricter of this policy and its script's policy."
5345
5538
  }
5346
5539
  },
5347
5540
  {
@@ -5349,10 +5542,10 @@ var OPERATIONS = [
5349
5542
  "in": "body",
5350
5543
  "type": "boolean",
5351
5544
  "required": false,
5352
- "description": "Whether agents (MCP) may run scripts here, or schedule them to.",
5545
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here.",
5353
5546
  "schema": {
5354
5547
  "type": "boolean",
5355
- "description": "Whether agents (MCP) may run scripts here, or schedule them to."
5548
+ "description": "Whether agents connected through MCP can run scripts in this environment. When it's false, Reminix also refuses schedules and triggers an agent adds here."
5356
5549
  }
5357
5550
  },
5358
5551
  {
@@ -5360,24 +5553,25 @@ var OPERATIONS = [
5360
5553
  "in": "body",
5361
5554
  "type": "boolean",
5362
5555
  "required": false,
5363
- "description": "Make it the default. To change the default, make another one the default.",
5556
+ "description": "Makes this the default environment. To change the default, make another environment the default.",
5364
5557
  "schema": {
5365
5558
  "type": "boolean",
5366
5559
  "enum": [
5367
5560
  true
5368
5561
  ],
5369
- "description": "Make it the default. To change the default, make another one the default."
5562
+ "description": "Makes this the default environment. To change the default, make another environment the default."
5370
5563
  }
5371
5564
  }
5372
5565
  ],
5373
5566
  "hasBody": true,
5374
5567
  "workspace": true,
5568
+ "acceptsApiKey": true,
5375
5569
  "scope": "environments:write"
5376
5570
  },
5377
5571
  {
5378
- "operationId": "files.content",
5572
+ "operationId": "files.download",
5379
5573
  "method": "get",
5380
- "path": "/files/{fileId}/content",
5574
+ "path": "/files/{fileId}/download",
5381
5575
  "summary": "Download a file",
5382
5576
  "cli": {
5383
5577
  "command": "files download",
@@ -5390,59 +5584,27 @@ var OPERATIONS = [
5390
5584
  "exposed": false,
5391
5585
  "reason": "Returns raw bytes; agents use the file's downloadUrl (files.get) instead."
5392
5586
  },
5393
- "description": "The file's bytes, always as an attachment (`Content-Disposition: attachment`) \u2014 never shown as a page.",
5587
+ "description": "Returns the file's bytes as a download. The response always has `Content-Disposition: attachment`, so a browser saves the file instead of showing it as a page.",
5394
5588
  "fields": [
5395
5589
  {
5396
5590
  "name": "fileId",
5397
5591
  "in": "path",
5398
5592
  "type": "string",
5399
5593
  "required": true,
5594
+ "description": "The file's ID.",
5595
+ "example": "file_4c1e\u2026",
5400
5596
  "schema": {
5401
- "type": "string"
5597
+ "type": "string",
5598
+ "description": "The file's ID."
5402
5599
  }
5403
5600
  }
5404
5601
  ],
5405
5602
  "hasBody": false,
5406
5603
  "rawResponse": "application/octet-stream",
5407
5604
  "workspace": true,
5605
+ "acceptsApiKey": true,
5408
5606
  "scope": "runs:read"
5409
5607
  },
5410
- {
5411
- "operationId": "files.create",
5412
- "method": "post",
5413
- "path": "/files",
5414
- "summary": "Upload a file",
5415
- "cli": {
5416
- "command": "files upload",
5417
- "args": [],
5418
- "confirm": false
5419
- },
5420
- "mcp": {
5421
- "exposed": false,
5422
- "reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
5423
- },
5424
- "description": 'Uploads a file to give a run: send its bytes as the body with its `Content-Type` and `Content-Length`, and its name as `?name=`. Then pass the returned id as a file input (`{ "<input>": "file_\u2026" }`). An upload no run uses within a day is deleted; one run uses it.',
5425
- "fields": [
5426
- {
5427
- "name": "name",
5428
- "in": "query",
5429
- "type": "string",
5430
- "required": true,
5431
- "description": "The file's name.",
5432
- "example": "adjustments.csv",
5433
- "schema": {
5434
- "type": "string",
5435
- "minLength": 1,
5436
- "maxLength": 500,
5437
- "description": "The file's name."
5438
- }
5439
- }
5440
- ],
5441
- "hasBody": false,
5442
- "rawBody": "application/octet-stream",
5443
- "workspace": true,
5444
- "scope": "runs:write"
5445
- },
5446
5608
  {
5447
5609
  "operationId": "files.get",
5448
5610
  "method": "get",
@@ -5464,20 +5626,24 @@ var OPERATIONS = [
5464
5626
  "idempotentHint": true
5465
5627
  }
5466
5628
  },
5467
- "description": "A file's name, type, size and the run that took or wrote it, with a download link valid for an hour. A run's files are readable by whoever can see the run; an upload not yet used, by whoever uploaded it.",
5629
+ "description": "Returns a file's name, media type and size, the run that took or saved it, and a download link that works for an hour. Anyone who can see a run can read its files. Until a run uses an upload, only the person who uploaded it, a workspace owner or admin, or a workspace API key can read it.",
5468
5630
  "fields": [
5469
5631
  {
5470
5632
  "name": "fileId",
5471
5633
  "in": "path",
5472
5634
  "type": "string",
5473
5635
  "required": true,
5636
+ "description": "The file's ID.",
5637
+ "example": "file_4c1e\u2026",
5474
5638
  "schema": {
5475
- "type": "string"
5639
+ "type": "string",
5640
+ "description": "The file's ID."
5476
5641
  }
5477
5642
  }
5478
5643
  ],
5479
5644
  "hasBody": false,
5480
5645
  "workspace": true,
5646
+ "acceptsApiKey": true,
5481
5647
  "scope": "runs:read"
5482
5648
  },
5483
5649
  {
@@ -5499,7 +5665,7 @@ var OPERATIONS = [
5499
5665
  "idempotentHint": true
5500
5666
  }
5501
5667
  },
5502
- "description": "Files runs wrote, newest first, across the scripts you can see \u2014 until they expire. `?script=<slug>` narrows to one script, `?direction=in` lists the files runs were given (`all` for both), and `?q=` matches names. Each comes with a download link valid for an hour. Paginate with the opaque `nextCursor` token.",
5668
+ "description": "Lists the files that runs saved, newest first, across the scripts you can see. A file stays in the list until it expires. Pass `?script=<slug>` for one script's files. Pass `?origin=input` for the files runs took as inputs, or `?origin=all` for both. Pass `?name=` to match file names. Each file comes with a download link that works for an hour. Pass `?before=` to start from a moment. Paginate with the opaque `nextCursor` token.",
5503
5669
  "fields": [
5504
5670
  {
5505
5671
  "name": "limit",
@@ -5527,52 +5693,105 @@ var OPERATIONS = [
5527
5693
  "description": "Opaque token from a previous page's nextCursor."
5528
5694
  }
5529
5695
  },
5696
+ {
5697
+ "name": "before",
5698
+ "in": "query",
5699
+ "type": "string",
5700
+ "required": false,
5701
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on.",
5702
+ "example": "2026-11-01T00:00:00.000Z",
5703
+ "schema": {
5704
+ "type": "string",
5705
+ "format": "date-time",
5706
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on."
5707
+ }
5708
+ },
5530
5709
  {
5531
5710
  "name": "script",
5532
5711
  "in": "query",
5533
5712
  "type": "string",
5534
5713
  "required": false,
5535
- "description": "Only files from this script's runs (its slug).",
5714
+ "description": "Only files from this script's runs, by its slug.",
5536
5715
  "example": "monthly-report",
5537
5716
  "schema": {
5538
5717
  "type": "string",
5539
- "description": "Only files from this script's runs (its slug)."
5718
+ "maxLength": 100,
5719
+ "description": "Only files from this script's runs, by its slug."
5540
5720
  }
5541
5721
  },
5542
5722
  {
5543
- "name": "direction",
5723
+ "name": "origin",
5544
5724
  "in": "query",
5545
5725
  "type": "string",
5546
5726
  "required": false,
5547
- "description": "`out` (default): written by runs; `in`: given to them.",
5727
+ "description": "Which files to list: `saved` for files runs saved (the default), `input` for files runs took as inputs, or `all` for both.",
5548
5728
  "schema": {
5549
5729
  "type": "string",
5550
5730
  "enum": [
5551
- "in",
5552
- "out",
5731
+ "input",
5732
+ "saved",
5553
5733
  "all"
5554
5734
  ],
5555
- "description": "`out` (default): written by runs; `in`: given to them."
5735
+ "description": "Which files to list: `saved` for files runs saved (the default), `input` for files runs took as inputs, or `all` for both."
5556
5736
  }
5557
5737
  },
5558
5738
  {
5559
- "name": "q",
5739
+ "name": "name",
5560
5740
  "in": "query",
5561
5741
  "type": "string",
5562
5742
  "required": false,
5563
- "description": "Only files whose name contains this.",
5743
+ "description": "Only files whose name contains this text.",
5564
5744
  "example": "revenue",
5565
5745
  "schema": {
5566
5746
  "type": "string",
5567
5747
  "maxLength": 200,
5568
- "description": "Only files whose name contains this."
5748
+ "description": "Only files whose name contains this text."
5569
5749
  }
5570
5750
  }
5571
5751
  ],
5572
5752
  "hasBody": false,
5573
5753
  "workspace": true,
5754
+ "acceptsApiKey": true,
5574
5755
  "scope": "runs:read"
5575
5756
  },
5757
+ {
5758
+ "operationId": "files.upload",
5759
+ "method": "post",
5760
+ "path": "/files",
5761
+ "summary": "Upload a file",
5762
+ "cli": {
5763
+ "command": "files upload",
5764
+ "args": [],
5765
+ "confirm": false,
5766
+ "sample": "reminix files upload ./adjustments.csv"
5767
+ },
5768
+ "mcp": {
5769
+ "exposed": false,
5770
+ "reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
5771
+ },
5772
+ "description": 'Uploads a file that a run can take as a file input. Send the file\'s bytes as the request body, with `Content-Type` and `Content-Length` headers, and its name as `?name=`. Then pass the returned id as the file input\'s value (`{ "adjustments": "file_4c1e\u2026" }`). You can give each upload to only one run. If no run uses an upload within a day, Reminix deletes it. Your plan sets the largest file you can upload. Reminix refuses a file over 1,000 MB on every plan.',
5773
+ "fields": [
5774
+ {
5775
+ "name": "name",
5776
+ "in": "query",
5777
+ "type": "string",
5778
+ "required": true,
5779
+ "description": "The file's name.",
5780
+ "example": "adjustments.csv",
5781
+ "schema": {
5782
+ "type": "string",
5783
+ "minLength": 1,
5784
+ "maxLength": 500,
5785
+ "description": "The file's name."
5786
+ }
5787
+ }
5788
+ ],
5789
+ "hasBody": false,
5790
+ "rawBody": "application/octet-stream",
5791
+ "workspace": true,
5792
+ "acceptsApiKey": true,
5793
+ "scope": "runs:write"
5794
+ },
5576
5795
  {
5577
5796
  "operationId": "runs.cancel",
5578
5797
  "method": "post",
@@ -5594,20 +5813,24 @@ var OPERATIONS = [
5594
5813
  "idempotentHint": false
5595
5814
  }
5596
5815
  },
5597
- "description": "Stops a LONG run that is still running: its code stops and the run ends `cancelled`. For the person who started it, the script's owner, or an owner or admin.",
5816
+ "description": "Cancels a long run that is still running. The run's code stops, the run ends `cancelled`, and Reminix sends a `run.cancelled` event. The person who started the run, the script owner, a workspace owner or admin, or a workspace API key can cancel it.",
5598
5817
  "fields": [
5599
5818
  {
5600
5819
  "name": "runId",
5601
5820
  "in": "path",
5602
5821
  "type": "string",
5603
5822
  "required": true,
5823
+ "description": "The run's ID.",
5824
+ "example": "run_7b1a\u2026",
5604
5825
  "schema": {
5605
- "type": "string"
5826
+ "type": "string",
5827
+ "description": "The run's ID."
5606
5828
  }
5607
5829
  }
5608
5830
  ],
5609
5831
  "hasBody": false,
5610
5832
  "workspace": true,
5833
+ "acceptsApiKey": true,
5611
5834
  "scope": "runs:write"
5612
5835
  },
5613
5836
  {
@@ -5632,16 +5855,18 @@ var OPERATIONS = [
5632
5855
  "idempotentHint": false
5633
5856
  }
5634
5857
  },
5635
- "description": "Runs the script's PUBLISHED version with these inputs and answers when it finishes, with its output (or error). The inputs are checked against the version's input schema first \u2014 a mismatch is a 400 with one `details` entry per field. A file input takes a file id (upload it with files.create first, or pass another run's output) or an https link Reminix fetches. The script runs in its own container, reaching only the hosts its version declares, for at most 30 seconds \u2014 a script whose `timeout` is longer runs durably and answers 202 at once. Every run counts toward the workspace's `runs` usage.",
5858
+ "description": "Runs the script's published version with these inputs, and returns the run when it finishes, with its output or error. Reminix first checks the inputs against the version's input schema. If they don't match, the request returns 400 with one `details` entry per field. For a file input, pass a file id or an https link that Reminix fetches. The id can be a file you uploaded with files.upload, or a file another run saved. The script runs on its own fresh machine and can reach only the hosts its version declares. A run can last up to its version's `timeoutSeconds`, at most 30, counted from when its code starts. Getting a machine can take up to 2 minutes first. If the run is still in progress after 60 seconds, the request returns 202 with status `running`, and you follow the run with runs.get. If the version's `timeoutSeconds` is over 30, the run is a long run. A long run runs durably, and the request returns 202 at once. Every run counts toward the workspace's `runs` usage.",
5636
5859
  "fields": [
5637
5860
  {
5638
5861
  "name": "slug",
5639
5862
  "in": "path",
5640
5863
  "type": "string",
5641
5864
  "required": true,
5865
+ "description": "The slug's ID.",
5642
5866
  "example": "unlock-account",
5643
5867
  "schema": {
5644
- "type": "string"
5868
+ "type": "string",
5869
+ "description": "The slug's ID."
5645
5870
  }
5646
5871
  },
5647
5872
  {
@@ -5649,7 +5874,7 @@ var OPERATIONS = [
5649
5874
  "in": "body",
5650
5875
  "type": "json",
5651
5876
  "required": false,
5652
- "description": "The script's inputs, by name. Default: none.",
5877
+ "description": "The script's inputs, by name. The default is no inputs.",
5653
5878
  "example": {
5654
5879
  "email": "jane@example.com"
5655
5880
  },
@@ -5657,7 +5882,7 @@ var OPERATIONS = [
5657
5882
  "type": "object",
5658
5883
  "additionalProperties": {},
5659
5884
  "default": {},
5660
- "description": "The script's inputs, by name. Default: none."
5885
+ "description": "The script's inputs, by name. The default is no inputs."
5661
5886
  }
5662
5887
  },
5663
5888
  {
@@ -5665,19 +5890,20 @@ var OPERATIONS = [
5665
5890
  "in": "body",
5666
5891
  "type": "string",
5667
5892
  "required": false,
5668
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp.",
5893
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says.",
5669
5894
  "schema": {
5670
5895
  "type": "string",
5671
5896
  "enum": [
5672
5897
  "api",
5673
5898
  "cli"
5674
5899
  ],
5675
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp."
5900
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says."
5676
5901
  }
5677
5902
  }
5678
5903
  ],
5679
5904
  "hasBody": true,
5680
5905
  "workspace": true,
5906
+ "acceptsApiKey": true,
5681
5907
  "scope": "runs:write"
5682
5908
  },
5683
5909
  {
@@ -5701,20 +5927,24 @@ var OPERATIONS = [
5701
5927
  "idempotentHint": true
5702
5928
  }
5703
5929
  },
5704
- "description": "One run: its inputs, status, output or error, who started it and how, and its files \u2014 given to it and written by it \u2014 with download links.",
5930
+ "description": "Returns one run, with its inputs, status, output or error, and who started it and how. The response also has the run's files, both given and saved, each with a download link.",
5705
5931
  "fields": [
5706
5932
  {
5707
5933
  "name": "runId",
5708
5934
  "in": "path",
5709
5935
  "type": "string",
5710
5936
  "required": true,
5937
+ "description": "The run's ID.",
5938
+ "example": "run_7b1a\u2026",
5711
5939
  "schema": {
5712
- "type": "string"
5940
+ "type": "string",
5941
+ "description": "The run's ID."
5713
5942
  }
5714
5943
  }
5715
5944
  ],
5716
5945
  "hasBody": false,
5717
5946
  "workspace": true,
5947
+ "acceptsApiKey": true,
5718
5948
  "scope": "runs:read"
5719
5949
  },
5720
5950
  {
@@ -5736,7 +5966,7 @@ var OPERATIONS = [
5736
5966
  "idempotentHint": true
5737
5967
  }
5738
5968
  },
5739
- "description": "The workspace's runs, newest first \u2014 of one script with `?script=<slug>`. Paginate with the opaque `nextCursor` token.",
5969
+ "description": "Lists the workspace's runs, newest first. Pass `?script=<slug>` for one script's runs and `?status=` for runs in one state. Pass `?before=` to start from a moment. Paginate with the opaque `nextCursor` token.",
5740
5970
  "fields": [
5741
5971
  {
5742
5972
  "name": "limit",
@@ -5764,30 +5994,64 @@ var OPERATIONS = [
5764
5994
  "description": "Opaque token from a previous page's nextCursor."
5765
5995
  }
5766
5996
  },
5997
+ {
5998
+ "name": "before",
5999
+ "in": "query",
6000
+ "type": "string",
6001
+ "required": false,
6002
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on.",
6003
+ "example": "2026-11-01T00:00:00.000Z",
6004
+ "schema": {
6005
+ "type": "string",
6006
+ "format": "date-time",
6007
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on."
6008
+ }
6009
+ },
5767
6010
  {
5768
6011
  "name": "script",
5769
6012
  "in": "query",
5770
6013
  "type": "string",
5771
6014
  "required": false,
5772
- "description": "Only this script's runs (its slug).",
6015
+ "description": "Only this script's runs, by its slug.",
5773
6016
  "example": "unlock-account",
5774
6017
  "schema": {
5775
6018
  "type": "string",
5776
- "description": "Only this script's runs (its slug)."
6019
+ "maxLength": 100,
6020
+ "description": "Only this script's runs, by its slug."
6021
+ }
6022
+ },
6023
+ {
6024
+ "name": "status",
6025
+ "in": "query",
6026
+ "type": "string",
6027
+ "required": false,
6028
+ "description": "Only runs in this state.",
6029
+ "example": "failed",
6030
+ "schema": {
6031
+ "type": "string",
6032
+ "enum": [
6033
+ "awaiting_approval",
6034
+ "running",
6035
+ "succeeded",
6036
+ "failed",
6037
+ "cancelled"
6038
+ ],
6039
+ "description": "Only runs in this state."
5777
6040
  }
5778
6041
  }
5779
6042
  ],
5780
6043
  "hasBody": false,
5781
6044
  "workspace": true,
6045
+ "acceptsApiKey": true,
5782
6046
  "scope": "runs:read"
5783
6047
  },
5784
6048
  {
5785
- "operationId": "runs.logs",
6049
+ "operationId": "runs.log",
5786
6050
  "method": "get",
5787
- "path": "/runs/{runId}/logs",
6051
+ "path": "/runs/{runId}/log",
5788
6052
  "summary": "Get a run's log",
5789
6053
  "cli": {
5790
- "command": "runs logs",
6054
+ "command": "runs log",
5791
6055
  "args": [
5792
6056
  "runId"
5793
6057
  ],
@@ -5795,27 +6059,31 @@ var OPERATIONS = [
5795
6059
  },
5796
6060
  "mcp": {
5797
6061
  "exposed": true,
5798
- "name": "runs_logs",
6062
+ "name": "runs_log",
5799
6063
  "hints": {
5800
6064
  "readOnlyHint": true,
5801
6065
  "destructiveHint": false,
5802
6066
  "idempotentHint": true
5803
6067
  }
5804
6068
  },
5805
- "description": "What the script wrote to standard error, line by line, with a line per request it made.",
6069
+ "description": "Returns the run's log: what the script wrote to standard error, line by line. The log also has a line for each request the script made.",
5806
6070
  "fields": [
5807
6071
  {
5808
6072
  "name": "runId",
5809
6073
  "in": "path",
5810
6074
  "type": "string",
5811
6075
  "required": true,
6076
+ "description": "The run's ID.",
6077
+ "example": "run_7b1a\u2026",
5812
6078
  "schema": {
5813
- "type": "string"
6079
+ "type": "string",
6080
+ "description": "The run's ID."
5814
6081
  }
5815
6082
  }
5816
6083
  ],
5817
6084
  "hasBody": false,
5818
6085
  "workspace": true,
6086
+ "acceptsApiKey": true,
5819
6087
  "scope": "runs:read"
5820
6088
  },
5821
6089
  {
@@ -5832,18 +6100,20 @@ var OPERATIONS = [
5832
6100
  },
5833
6101
  "mcp": {
5834
6102
  "exposed": false,
5835
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6103
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
5836
6104
  },
5837
- "description": "Runs the published version on a 5-field cron in a timezone, with these inputs, as you \u2014 at least 5 minutes apart. Switched off (with why) if you can no longer run it.",
6105
+ "description": "Schedules the script's published version to run on a cron in a timezone, with these inputs. The runs act as you. The cron has 5 fields, and its runs must be at least 5 minutes apart. If every run of the script, or every run in the environment, needs approval, only workspace owners and admins can create a schedule. If you can no longer run the script, Reminix disables the schedule and sets `disabledReason`.",
5838
6106
  "fields": [
5839
6107
  {
5840
6108
  "name": "slug",
5841
6109
  "in": "path",
5842
6110
  "type": "string",
5843
6111
  "required": true,
6112
+ "description": "The slug's ID.",
5844
6113
  "example": "monthly-report",
5845
6114
  "schema": {
5846
- "type": "string"
6115
+ "type": "string",
6116
+ "description": "The slug's ID."
5847
6117
  }
5848
6118
  },
5849
6119
  {
@@ -5879,11 +6149,11 @@ var OPERATIONS = [
5879
6149
  "in": "body",
5880
6150
  "type": "string",
5881
6151
  "required": false,
5882
- "description": "The timezone the cron is read in. Default: UTC.",
6152
+ "description": "The timezone the cron is read in. The default is UTC.",
5883
6153
  "example": "Europe/Berlin",
5884
6154
  "schema": {
5885
6155
  "type": "string",
5886
- "description": "The timezone the cron is read in. Default: UTC."
6156
+ "description": "The timezone the cron is read in. The default is UTC."
5887
6157
  }
5888
6158
  },
5889
6159
  {
@@ -5903,15 +6173,16 @@ var OPERATIONS = [
5903
6173
  "in": "body",
5904
6174
  "type": "string",
5905
6175
  "required": false,
5906
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default.",
6176
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment.",
5907
6177
  "schema": {
5908
6178
  "type": "string",
5909
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default."
6179
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment."
5910
6180
  }
5911
6181
  }
5912
6182
  ],
5913
6183
  "hasBody": true,
5914
6184
  "workspace": true,
6185
+ "acceptsApiKey": false,
5915
6186
  "scope": "scripts:write"
5916
6187
  },
5917
6188
  {
@@ -5929,18 +6200,20 @@ var OPERATIONS = [
5929
6200
  },
5930
6201
  "mcp": {
5931
6202
  "exposed": false,
5932
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6203
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
5933
6204
  },
5934
- "description": "Its creator, or an owner or admin.",
6205
+ "description": "Deletes a schedule. The schedule's creator, a workspace owner or admin, or a workspace API key can delete it.",
5935
6206
  "fields": [
5936
6207
  {
5937
6208
  "name": "slug",
5938
6209
  "in": "path",
5939
6210
  "type": "string",
5940
6211
  "required": true,
6212
+ "description": "The slug's ID.",
5941
6213
  "example": "monthly-report",
5942
6214
  "schema": {
5943
- "type": "string"
6215
+ "type": "string",
6216
+ "description": "The slug's ID."
5944
6217
  }
5945
6218
  },
5946
6219
  {
@@ -5948,13 +6221,17 @@ var OPERATIONS = [
5948
6221
  "in": "path",
5949
6222
  "type": "string",
5950
6223
  "required": true,
6224
+ "description": "The schedule's ID.",
6225
+ "example": "sch_2b9f\u2026",
5951
6226
  "schema": {
5952
- "type": "string"
6227
+ "type": "string",
6228
+ "description": "The schedule's ID."
5953
6229
  }
5954
6230
  }
5955
6231
  ],
5956
6232
  "hasBody": false,
5957
6233
  "workspace": true,
6234
+ "acceptsApiKey": true,
5958
6235
  "scope": "scripts:write"
5959
6236
  },
5960
6237
  {
@@ -5978,21 +6255,24 @@ var OPERATIONS = [
5978
6255
  "idempotentHint": true
5979
6256
  }
5980
6257
  },
5981
- "description": "Its schedules, with when each runs next.",
6258
+ "description": "Lists a script's schedules, with when each one runs next.",
5982
6259
  "fields": [
5983
6260
  {
5984
6261
  "name": "slug",
5985
6262
  "in": "path",
5986
6263
  "type": "string",
5987
6264
  "required": true,
6265
+ "description": "The slug's ID.",
5988
6266
  "example": "monthly-report",
5989
6267
  "schema": {
5990
- "type": "string"
6268
+ "type": "string",
6269
+ "description": "The slug's ID."
5991
6270
  }
5992
6271
  }
5993
6272
  ],
5994
6273
  "hasBody": false,
5995
6274
  "workspace": true,
6275
+ "acceptsApiKey": true,
5996
6276
  "scope": "scripts:read"
5997
6277
  },
5998
6278
  {
@@ -6010,18 +6290,20 @@ var OPERATIONS = [
6010
6290
  },
6011
6291
  "mcp": {
6012
6292
  "exposed": false,
6013
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
6293
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
6014
6294
  },
6015
- "description": "Its name, cron, timezone, inputs, or switch it on or off. Its creator, or an owner or admin.",
6295
+ "description": "Changes a schedule's name, cron, timezone, inputs or environment, or whether it's enabled. The schedule's creator, a workspace owner or admin, or a workspace API key can change it.",
6016
6296
  "fields": [
6017
6297
  {
6018
6298
  "name": "slug",
6019
6299
  "in": "path",
6020
6300
  "type": "string",
6021
6301
  "required": true,
6302
+ "description": "The slug's ID.",
6022
6303
  "example": "monthly-report",
6023
6304
  "schema": {
6024
- "type": "string"
6305
+ "type": "string",
6306
+ "description": "The slug's ID."
6025
6307
  }
6026
6308
  },
6027
6309
  {
@@ -6029,8 +6311,11 @@ var OPERATIONS = [
6029
6311
  "in": "path",
6030
6312
  "type": "string",
6031
6313
  "required": true,
6314
+ "description": "The schedule's ID.",
6315
+ "example": "sch_2b9f\u2026",
6032
6316
  "schema": {
6033
- "type": "string"
6317
+ "type": "string",
6318
+ "description": "The schedule's ID."
6034
6319
  }
6035
6320
  },
6036
6321
  {
@@ -6065,11 +6350,11 @@ var OPERATIONS = [
6065
6350
  "in": "body",
6066
6351
  "type": "string",
6067
6352
  "required": false,
6068
- "description": "The timezone the cron is read in. Default: UTC.",
6353
+ "description": "The timezone the cron is read in. The default is UTC.",
6069
6354
  "example": "Europe/Berlin",
6070
6355
  "schema": {
6071
6356
  "type": "string",
6072
- "description": "The timezone the cron is read in. Default: UTC."
6357
+ "description": "The timezone the cron is read in. The default is UTC."
6073
6358
  }
6074
6359
  },
6075
6360
  {
@@ -6089,10 +6374,10 @@ var OPERATIONS = [
6089
6374
  "in": "body",
6090
6375
  "type": "boolean",
6091
6376
  "required": false,
6092
- "description": "Whether it runs. Default: true.",
6377
+ "description": "Whether the schedule runs. With `false`, it's disabled.",
6093
6378
  "schema": {
6094
6379
  "type": "boolean",
6095
- "description": "Whether it runs. Default: true."
6380
+ "description": "Whether the schedule runs. With `false`, it's disabled."
6096
6381
  }
6097
6382
  },
6098
6383
  {
@@ -6100,15 +6385,16 @@ var OPERATIONS = [
6100
6385
  "in": "body",
6101
6386
  "type": "string",
6102
6387
  "required": false,
6103
- "description": "Move its runs to another environment.",
6388
+ "description": "Another environment for the schedule's runs to use.",
6104
6389
  "schema": {
6105
6390
  "type": "string",
6106
- "description": "Move its runs to another environment."
6391
+ "description": "Another environment for the schedule's runs to use."
6107
6392
  }
6108
6393
  }
6109
6394
  ],
6110
6395
  "hasBody": true,
6111
6396
  "workspace": true,
6397
+ "acceptsApiKey": true,
6112
6398
  "scope": "scripts:write"
6113
6399
  },
6114
6400
  {
@@ -6125,23 +6411,26 @@ var OPERATIONS = [
6125
6411
  },
6126
6412
  "mcp": {
6127
6413
  "exposed": false,
6128
- "reason": "Stopping a script the team relies on is a person's decision; an agent asks one to"
6414
+ "reason": "Stopping a script the team relies on is a person's decision. An agent asks a person to."
6129
6415
  },
6130
- "description": "Stops it: it leaves the scripts list, can't be run, and its schedules and triggers skip it. Its runs, versions and files stay on record \u2014 scripts are archived, never deleted. Refused while a run of it is going or waiting for approval. The script's owner, or a workspace owner or admin.",
6416
+ "description": "Archives a script, which stops it. An archived script leaves the scripts list, nobody can run it, and its schedules and triggers skip it. Reminix never deletes a script, so its runs and versions stay. You can't archive a script while one of its runs is in progress or waiting for approval. The script owner, a workspace owner or admin, or a workspace API key can archive a script.",
6131
6417
  "fields": [
6132
6418
  {
6133
6419
  "name": "slug",
6134
6420
  "in": "path",
6135
6421
  "type": "string",
6136
6422
  "required": true,
6423
+ "description": "The slug's ID.",
6137
6424
  "example": "unlock-account",
6138
6425
  "schema": {
6139
- "type": "string"
6426
+ "type": "string",
6427
+ "description": "The slug's ID."
6140
6428
  }
6141
6429
  }
6142
6430
  ],
6143
6431
  "hasBody": false,
6144
6432
  "workspace": true,
6433
+ "acceptsApiKey": true,
6145
6434
  "scope": "scripts:write"
6146
6435
  },
6147
6436
  {
@@ -6163,18 +6452,18 @@ var OPERATIONS = [
6163
6452
  "idempotentHint": false
6164
6453
  }
6165
6454
  },
6166
- "description": "Creates an empty script \u2014 upload a version, then publish it. The `slug` names it everywhere (the API path, the agent tool, the command line) and is unique in the workspace.",
6455
+ "description": "Creates an empty script. Upload a version next, then publish it. The `slug` names the script everywhere: in the API path, in the agent's tool name and in the CLI. Each slug is unique in the workspace.",
6167
6456
  "fields": [
6168
6457
  {
6169
6458
  "name": "slug",
6170
6459
  "in": "body",
6171
6460
  "type": "string",
6172
6461
  "required": true,
6173
- "description": "Its id in URLs and commands: lowercase letters, digits and dashes, unique in the workspace.",
6462
+ "description": "The script's id in URLs and commands. It's 2 to 64 lowercase letters, digits and dashes, starts with a letter, and is unique in the workspace.",
6174
6463
  "example": "unlock-account",
6175
6464
  "schema": {
6176
6465
  "type": "string",
6177
- "description": "Its id in URLs and commands: lowercase letters, digits and dashes, unique in the workspace."
6466
+ "description": "The script's id in URLs and commands. It's 2 to 64 lowercase letters, digits and dashes, starts with a letter, and is unique in the workspace."
6178
6467
  }
6179
6468
  },
6180
6469
  {
@@ -6182,13 +6471,13 @@ var OPERATIONS = [
6182
6471
  "in": "body",
6183
6472
  "type": "string",
6184
6473
  "required": true,
6185
- "description": "What people see in the app.",
6474
+ "description": "The name people see in the app.",
6186
6475
  "example": "Unlock an account",
6187
6476
  "schema": {
6188
6477
  "type": "string",
6189
6478
  "minLength": 1,
6190
6479
  "maxLength": 100,
6191
- "description": "What people see in the app."
6480
+ "description": "The name people see in the app."
6192
6481
  }
6193
6482
  },
6194
6483
  {
@@ -6196,16 +6485,18 @@ var OPERATIONS = [
6196
6485
  "in": "body",
6197
6486
  "type": "string",
6198
6487
  "required": false,
6199
- "description": "What it does, in a sentence or two.",
6488
+ "description": "What the script does, in a sentence or two.",
6489
+ "example": "Unlocks a customer's account after too many failed sign-ins.",
6200
6490
  "schema": {
6201
6491
  "type": "string",
6202
6492
  "maxLength": 1e3,
6203
- "description": "What it does, in a sentence or two."
6493
+ "description": "What the script does, in a sentence or two."
6204
6494
  }
6205
6495
  }
6206
6496
  ],
6207
6497
  "hasBody": true,
6208
6498
  "workspace": true,
6499
+ "acceptsApiKey": true,
6209
6500
  "scope": "scripts:write"
6210
6501
  },
6211
6502
  {
@@ -6229,21 +6520,24 @@ var OPERATIONS = [
6229
6520
  "idempotentHint": true
6230
6521
  }
6231
6522
  },
6232
- "description": "One script by its slug: its name, owner, status, published version, README, and who uses it \u2014 people, schedules, triggers and the scripts that follow it.",
6523
+ "description": "Returns one script by its slug, with its name, owner, status, published version and README. The response also lists what uses the script: the people who run it, its schedules and triggers, and the scripts its runs start.",
6233
6524
  "fields": [
6234
6525
  {
6235
6526
  "name": "slug",
6236
6527
  "in": "path",
6237
6528
  "type": "string",
6238
6529
  "required": true,
6530
+ "description": "The slug's ID.",
6239
6531
  "example": "unlock-account",
6240
6532
  "schema": {
6241
- "type": "string"
6533
+ "type": "string",
6534
+ "description": "The slug's ID."
6242
6535
  }
6243
6536
  }
6244
6537
  ],
6245
6538
  "hasBody": false,
6246
6539
  "workspace": true,
6540
+ "acceptsApiKey": true,
6247
6541
  "scope": "scripts:read"
6248
6542
  },
6249
6543
  {
@@ -6265,7 +6559,7 @@ var OPERATIONS = [
6265
6559
  "idempotentHint": true
6266
6560
  }
6267
6561
  },
6268
- "description": "The workspace's scripts you may see, newest first, with the version each runs, tags and 30-day stats. Search with `q` (best match first) and filter by `tag`, `owner` or `published` \u2014 look here before writing a new one. Paginate with the opaque `nextCursor` token.",
6562
+ "description": "Lists the workspace's scripts that you can see, newest first, with the version each one runs, its tags and its 30-day stats. Search with `q` to get the best match first. Filter with `tag`, `owner` or `published`. Check here for an existing script before writing a new one. Paginate with the opaque `nextCursor` token.",
6269
6563
  "fields": [
6270
6564
  {
6271
6565
  "name": "limit",
@@ -6298,11 +6592,11 @@ var OPERATIONS = [
6298
6592
  "in": "query",
6299
6593
  "type": "string",
6300
6594
  "required": false,
6301
- "description": "Search the name, slug, description and tags \u2014 each word matches the start of a word. Results are best match first, one page (no cursor).",
6595
+ "description": "Words to search for in the name, slug, description and tags. Each word matches the start of a word. Results come best match first, on one page with no cursor.",
6302
6596
  "schema": {
6303
6597
  "type": "string",
6304
6598
  "maxLength": 200,
6305
- "description": "Search the name, slug, description and tags \u2014 each word matches the start of a word. Results are best match first, one page (no cursor)."
6599
+ "description": "Words to search for in the name, slug, description and tags. Each word matches the start of a word. Results come best match first, on one page with no cursor."
6306
6600
  }
6307
6601
  },
6308
6602
  {
@@ -6322,10 +6616,10 @@ var OPERATIONS = [
6322
6616
  "in": "query",
6323
6617
  "type": "string",
6324
6618
  "required": false,
6325
- "description": "An owner's user id.",
6619
+ "description": "Only scripts this person owns, by their user id.",
6326
6620
  "schema": {
6327
6621
  "type": "string",
6328
- "description": "An owner's user id."
6622
+ "description": "Only scripts this person owns, by their user id."
6329
6623
  }
6330
6624
  },
6331
6625
  {
@@ -6333,14 +6627,14 @@ var OPERATIONS = [
6333
6627
  "in": "query",
6334
6628
  "type": "string",
6335
6629
  "required": false,
6336
- "description": "`true`: only scripts with a published version.",
6630
+ "description": "With `true`, only scripts that have a published version.",
6337
6631
  "schema": {
6338
6632
  "type": "string",
6339
6633
  "enum": [
6340
6634
  "true",
6341
6635
  "false"
6342
6636
  ],
6343
- "description": "`true`: only scripts with a published version."
6637
+ "description": "With `true`, only scripts that have a published version."
6344
6638
  }
6345
6639
  },
6346
6640
  {
@@ -6348,19 +6642,20 @@ var OPERATIONS = [
6348
6642
  "in": "query",
6349
6643
  "type": "string",
6350
6644
  "required": false,
6351
- "description": "`true`: the archived scripts instead (they are left out otherwise).",
6645
+ "description": "With `true`, only archived scripts. The list leaves them out otherwise.",
6352
6646
  "schema": {
6353
6647
  "type": "string",
6354
6648
  "enum": [
6355
6649
  "true",
6356
6650
  "false"
6357
6651
  ],
6358
- "description": "`true`: the archived scripts instead (they are left out otherwise)."
6652
+ "description": "With `true`, only archived scripts. The list leaves them out otherwise."
6359
6653
  }
6360
6654
  }
6361
6655
  ],
6362
6656
  "hasBody": false,
6363
6657
  "workspace": true,
6658
+ "acceptsApiKey": true,
6364
6659
  "scope": "scripts:read"
6365
6660
  },
6366
6661
  {
@@ -6377,23 +6672,26 @@ var OPERATIONS = [
6377
6672
  },
6378
6673
  "mcp": {
6379
6674
  "exposed": false,
6380
- "reason": "Stopping a script the team relies on is a person's decision; an agent asks one to"
6675
+ "reason": "Stopping a script the team relies on is a person's decision. An agent asks a person to."
6381
6676
  },
6382
- "description": "Brings an archived script back: listed and runnable again, its schedules and triggers resumed. The script's owner, or a workspace owner or admin.",
6677
+ "description": "Restores an archived script. The script comes back to the scripts list, people can run it again, and its schedules and triggers resume. The script owner, a workspace owner or admin, or a workspace API key can restore a script.",
6383
6678
  "fields": [
6384
6679
  {
6385
6680
  "name": "slug",
6386
6681
  "in": "path",
6387
6682
  "type": "string",
6388
6683
  "required": true,
6684
+ "description": "The slug's ID.",
6389
6685
  "example": "unlock-account",
6390
6686
  "schema": {
6391
- "type": "string"
6687
+ "type": "string",
6688
+ "description": "The slug's ID."
6392
6689
  }
6393
6690
  }
6394
6691
  ],
6395
6692
  "hasBody": false,
6396
6693
  "workspace": true,
6694
+ "acceptsApiKey": true,
6397
6695
  "scope": "scripts:write"
6398
6696
  },
6399
6697
  {
@@ -6417,16 +6715,18 @@ var OPERATIONS = [
6417
6715
  "idempotentHint": false
6418
6716
  }
6419
6717
  },
6420
- "description": "Changes its name or description, who may see and run it (access, teams), and which runs need a person's approval. The script's owner, or a workspace owner or admin.",
6718
+ "description": "Changes a script's name, description or tags, who can see and run it, and which runs need a person's approval. The script owner, a workspace owner or admin, or a workspace API key can change a script. An agent can't change `access`, `teamIds` or `approvalPolicy`.",
6421
6719
  "fields": [
6422
6720
  {
6423
6721
  "name": "slug",
6424
6722
  "in": "path",
6425
6723
  "type": "string",
6426
6724
  "required": true,
6725
+ "description": "The slug's ID.",
6427
6726
  "example": "unlock-account",
6428
6727
  "schema": {
6429
- "type": "string"
6728
+ "type": "string",
6729
+ "description": "The slug's ID."
6430
6730
  }
6431
6731
  },
6432
6732
  {
@@ -6434,12 +6734,12 @@ var OPERATIONS = [
6434
6734
  "in": "body",
6435
6735
  "type": "string",
6436
6736
  "required": false,
6437
- "description": "What people see in the app.",
6737
+ "description": "The name people see in the app.",
6438
6738
  "schema": {
6439
6739
  "type": "string",
6440
6740
  "minLength": 1,
6441
6741
  "maxLength": 100,
6442
- "description": "What people see in the app."
6742
+ "description": "The name people see in the app."
6443
6743
  }
6444
6744
  },
6445
6745
  {
@@ -6447,11 +6747,11 @@ var OPERATIONS = [
6447
6747
  "in": "body",
6448
6748
  "type": "string",
6449
6749
  "required": false,
6450
- "description": "What it does, in a sentence or two.",
6750
+ "description": "What the script does, in a sentence or two.",
6451
6751
  "schema": {
6452
6752
  "type": "string",
6453
6753
  "maxLength": 1e3,
6454
- "description": "What it does, in a sentence or two."
6754
+ "description": "What the script does, in a sentence or two."
6455
6755
  }
6456
6756
  },
6457
6757
  {
@@ -6459,14 +6759,14 @@ var OPERATIONS = [
6459
6759
  "in": "body",
6460
6760
  "type": "string",
6461
6761
  "required": false,
6462
- "description": "`workspace`: every member may see and run it. `teams`: only members of `teamIds` (and owners and admins).",
6762
+ "description": "Who can see and run the script. With `workspace`, every member can. With `teams`, only members of `teamIds` and workspace owners and admins can.",
6463
6763
  "schema": {
6464
6764
  "type": "string",
6465
6765
  "enum": [
6466
6766
  "workspace",
6467
6767
  "teams"
6468
6768
  ],
6469
- "description": "`workspace`: every member may see and run it. `teams`: only members of `teamIds` (and owners and admins)."
6769
+ "description": "Who can see and run the script. With `workspace`, every member can. With `teams`, only members of `teamIds` and workspace owners and admins can."
6470
6770
  }
6471
6771
  },
6472
6772
  {
@@ -6474,14 +6774,14 @@ var OPERATIONS = [
6474
6774
  "in": "body",
6475
6775
  "type": "json",
6476
6776
  "required": false,
6477
- "description": "With `access: teams`: the teams whose members may see and run it.",
6777
+ "description": "With `access: teams`, the teams whose members can see and run the script.",
6478
6778
  "schema": {
6479
6779
  "type": "array",
6480
6780
  "items": {
6481
6781
  "type": "string"
6482
6782
  },
6483
6783
  "maxItems": 50,
6484
- "description": "With `access: teams`: the teams whose members may see and run it."
6784
+ "description": "With `access: teams`, the teams whose members can see and run the script."
6485
6785
  }
6486
6786
  },
6487
6787
  {
@@ -6489,7 +6789,7 @@ var OPERATIONS = [
6489
6789
  "in": "body",
6490
6790
  "type": "json",
6491
6791
  "required": false,
6492
- "description": "Up to 10; lowercase letters, digits and dashes.",
6792
+ "description": "Up to 10 tags, each 1 to 30 lowercase letters, digits and dashes.",
6493
6793
  "example": [
6494
6794
  "support",
6495
6795
  "accounts"
@@ -6500,7 +6800,7 @@ var OPERATIONS = [
6500
6800
  "type": "string"
6501
6801
  },
6502
6802
  "maxItems": 10,
6503
- "description": "Up to 10; lowercase letters, digits and dashes."
6803
+ "description": "Up to 10 tags, each 1 to 30 lowercase letters, digits and dashes."
6504
6804
  }
6505
6805
  },
6506
6806
  {
@@ -6508,7 +6808,7 @@ var OPERATIONS = [
6508
6808
  "in": "body",
6509
6809
  "type": "string",
6510
6810
  "required": false,
6511
- "description": "Which runs wait for a person's approval: `none`, `agents` (runs started through an agent's token) or `always`.",
6811
+ "description": "Which runs wait for a person's approval: `none`, `agents` for runs started with an agent's token, or `always` for every run. A token issued for the MCP server can't change this field, `access` or `teamIds`.",
6512
6812
  "schema": {
6513
6813
  "type": "string",
6514
6814
  "enum": [
@@ -6516,12 +6816,13 @@ var OPERATIONS = [
6516
6816
  "agents",
6517
6817
  "always"
6518
6818
  ],
6519
- "description": "Which runs wait for a person's approval: `none`, `agents` (runs started through an agent's token) or `always`."
6819
+ "description": "Which runs wait for a person's approval: `none`, `agents` for runs started with an agent's token, or `always` for every run. A token issued for the MCP server can't change this field, `access` or `teamIds`."
6520
6820
  }
6521
6821
  }
6522
6822
  ],
6523
6823
  "hasBody": true,
6524
6824
  "workspace": true,
6825
+ "acceptsApiKey": true,
6525
6826
  "scope": "scripts:write"
6526
6827
  },
6527
6828
  {
@@ -6543,10 +6844,11 @@ var OPERATIONS = [
6543
6844
  "idempotentHint": true
6544
6845
  }
6545
6846
  },
6546
- "description": "How the workspace governs scripts \u2014 e.g. whether publishing needs a second person.",
6847
+ "description": "Returns how the workspace governs scripts, such as whether publishing needs a second person.",
6547
6848
  "fields": [],
6548
6849
  "hasBody": false,
6549
6850
  "workspace": true,
6851
+ "acceptsApiKey": true,
6550
6852
  "scope": "scripts:read"
6551
6853
  },
6552
6854
  {
@@ -6563,86 +6865,271 @@ var OPERATIONS = [
6563
6865
  "exposed": false,
6564
6866
  "reason": "Governance settings are a person's to change; an agent must not loosen them"
6565
6867
  },
6566
- "description": "Workspace owners and admins, or a workspace API key.",
6868
+ "description": "Changes how the workspace governs scripts. Workspace owners and admins can change these settings, and so can a workspace API key. Turning on second-person publishing needs the Business plan.",
6567
6869
  "fields": [
6568
6870
  {
6569
6871
  "name": "publishNeedsSecondPerson",
6570
6872
  "in": "body",
6571
6873
  "type": "boolean",
6572
6874
  "required": false,
6573
- "description": "Publishing needs a person other than the one who asks: a publish becomes a request an owner or admin approves.",
6875
+ "description": "Whether publishing needs a second person. When it's on, each publish becomes a request. Another owner or admin, not the person who asked, approves it.",
6876
+ "example": false,
6574
6877
  "schema": {
6575
6878
  "type": "boolean",
6576
- "description": "Publishing needs a person other than the one who asks: a publish becomes a request an owner or admin approves."
6879
+ "description": "Whether publishing needs a second person. When it's on, each publish becomes a request. Another owner or admin, not the person who asked, approves it."
6577
6880
  }
6578
6881
  }
6579
6882
  ],
6580
6883
  "hasBody": true,
6581
6884
  "workspace": true,
6885
+ "acceptsApiKey": true,
6582
6886
  "scope": "scripts:write"
6583
6887
  },
6584
6888
  {
6585
- "operationId": "scriptVersions.create",
6586
- "method": "post",
6889
+ "operationId": "scriptVersions.list",
6890
+ "method": "get",
6587
6891
  "path": "/scripts/{slug}/versions",
6588
- "summary": "Upload a version",
6892
+ "summary": "List a script's versions",
6589
6893
  "cli": {
6590
- "command": "script-versions create",
6894
+ "command": "script-versions list",
6591
6895
  "args": [
6592
6896
  "slug"
6593
6897
  ],
6594
- "confirm": false,
6595
- "shortcut": "publish --draft [dir...]"
6898
+ "confirm": false
6596
6899
  },
6597
6900
  "mcp": {
6598
6901
  "exposed": true,
6599
- "name": "script_versions_create",
6902
+ "name": "script_versions_list",
6600
6903
  "hints": {
6601
- "readOnlyHint": false,
6904
+ "readOnlyHint": true,
6602
6905
  "destructiveHint": false,
6603
- "idempotentHint": false
6906
+ "idempotentHint": true
6604
6907
  }
6605
6908
  },
6606
- "description": "Uploads a new DRAFT version: the script's folder (a .tar.gz, base64 \u2014 the CLI makes it), the command that runs it and the JSON Schema of its inputs. Leave the command out and it is worked out from the folder: pyproject.toml's one script, package.json's bin, start or main, or the folder's one .py, .js, .ts or .sh file; leave the schema out and each `{name}` in the command is a text input. Its dependencies (requirements.txt, pyproject.toml, package.json) are installed now, once; a failed install answers 400 with what it printed. Runs keep using the published version until this one is published.",
6909
+ "description": "Lists every version of a script, newest first, and marks the published one.",
6607
6910
  "fields": [
6608
6911
  {
6609
6912
  "name": "slug",
6610
6913
  "in": "path",
6611
6914
  "type": "string",
6612
6915
  "required": true,
6916
+ "description": "The slug's ID.",
6613
6917
  "example": "unlock-account",
6614
6918
  "schema": {
6615
- "type": "string"
6919
+ "type": "string",
6920
+ "description": "The slug's ID."
6616
6921
  }
6617
- },
6922
+ }
6923
+ ],
6924
+ "hasBody": false,
6925
+ "workspace": true,
6926
+ "acceptsApiKey": true,
6927
+ "scope": "scripts:read"
6928
+ },
6929
+ {
6930
+ "operationId": "scriptVersions.publish",
6931
+ "method": "post",
6932
+ "path": "/scripts/{slug}/versions/{version}/publish",
6933
+ "summary": "Publish a version",
6934
+ "cli": {
6935
+ "command": "script-versions publish",
6936
+ "args": [
6937
+ "slug",
6938
+ "version"
6939
+ ],
6940
+ "confirm": false
6941
+ },
6942
+ "mcp": {
6943
+ "exposed": true,
6944
+ "name": "script_versions_publish",
6945
+ "hints": {
6946
+ "readOnlyHint": false,
6947
+ "destructiveHint": false,
6948
+ "idempotentHint": false
6949
+ }
6950
+ },
6951
+ "description": "Makes a version the one every run of the script uses, however the run starts. Publishing an older version again rolls the script back. The script owner or a workspace owner or admin can publish. An agent's publish becomes a request that a person approves, and the call returns 202. If the workspace requires a second person to publish, everyone's publish becomes a request like this.",
6952
+ "fields": [
6618
6953
  {
6619
- "name": "command",
6620
- "in": "body",
6954
+ "name": "slug",
6955
+ "in": "path",
6621
6956
  "type": "string",
6622
- "required": false,
6623
- "description": "What a run executes. `{name}` is an input; `[ \u2026 ]` is left out when its inputs are empty. Run as arguments, never through a shell. Omitted: worked out from the folder, or a 400 saying what to add.",
6624
- "example": "python unlock.py {email}",
6957
+ "required": true,
6958
+ "description": "The slug's ID.",
6959
+ "example": "unlock-account",
6625
6960
  "schema": {
6626
6961
  "type": "string",
6627
- "minLength": 1,
6628
- "maxLength": 2e3,
6629
- "description": "What a run executes. `{name}` is an input; `[ \u2026 ]` is left out when its inputs are empty. Run as arguments, never through a shell. Omitted: worked out from the folder, or a 400 saying what to add."
6962
+ "description": "The slug's ID."
6630
6963
  }
6631
6964
  },
6632
6965
  {
6633
- "name": "build",
6634
- "in": "body",
6635
- "type": "string",
6636
- "required": false,
6637
- "description": "Replaces the usual install (requirements.txt, else pyproject.toml, into .deps; package.json with npm). Runs in the folder with the package registries reachable.",
6638
- "example": "pip install -r requirements.txt",
6966
+ "name": "version",
6967
+ "in": "path",
6968
+ "type": "number",
6969
+ "required": true,
6970
+ "description": "The version's ID.",
6971
+ "example": 3,
6639
6972
  "schema": {
6640
- "type": [
6641
- "string",
6973
+ "type": "integer",
6974
+ "minimum": 1,
6975
+ "description": "The version's ID."
6976
+ }
6977
+ }
6978
+ ],
6979
+ "hasBody": false,
6980
+ "workspace": true,
6981
+ "acceptsApiKey": false,
6982
+ "scope": "scripts:write"
6983
+ },
6984
+ {
6985
+ "operationId": "scriptVersions.testRun",
6986
+ "method": "post",
6987
+ "path": "/scripts/{slug}/versions/{version}/runs",
6988
+ "summary": "Test-run a version",
6989
+ "cli": {
6990
+ "command": "script-versions test-run",
6991
+ "args": [
6992
+ "slug",
6993
+ "version"
6994
+ ],
6995
+ "confirm": false
6996
+ },
6997
+ "mcp": {
6998
+ "exposed": true,
6999
+ "name": "script_versions_test_run",
7000
+ "hints": {
7001
+ "readOnlyHint": false,
7002
+ "destructiveHint": false,
7003
+ "idempotentHint": false
7004
+ }
7005
+ },
7006
+ "description": "Test-runs one version of a script with these inputs, such as a draft before it's published. Reminix records a test run with `test: true` and leaves it out of the script's stats. A test run sends no run events, so no webhooks or triggers fire. The version's uploader, the script owner, a workspace owner or admin, or a workspace API key can test-run a version. The script's approval policy still applies. Use a test run to prove a draft works before asking a person to publish it.",
7007
+ "fields": [
7008
+ {
7009
+ "name": "slug",
7010
+ "in": "path",
7011
+ "type": "string",
7012
+ "required": true,
7013
+ "description": "The slug's ID.",
7014
+ "example": "unlock-account",
7015
+ "schema": {
7016
+ "type": "string",
7017
+ "description": "The slug's ID."
7018
+ }
7019
+ },
7020
+ {
7021
+ "name": "version",
7022
+ "in": "path",
7023
+ "type": "number",
7024
+ "required": true,
7025
+ "description": "The version's ID.",
7026
+ "example": 3,
7027
+ "schema": {
7028
+ "type": "integer",
7029
+ "minimum": 1,
7030
+ "description": "The version's ID."
7031
+ }
7032
+ },
7033
+ {
7034
+ "name": "inputs",
7035
+ "in": "body",
7036
+ "type": "json",
7037
+ "required": false,
7038
+ "description": "The script's inputs, by name. The default is no inputs.",
7039
+ "example": {
7040
+ "email": "jane@example.com"
7041
+ },
7042
+ "schema": {
7043
+ "type": "object",
7044
+ "additionalProperties": {},
7045
+ "default": {},
7046
+ "description": "The script's inputs, by name. The default is no inputs."
7047
+ }
7048
+ },
7049
+ {
7050
+ "name": "via",
7051
+ "in": "body",
7052
+ "type": "string",
7053
+ "required": false,
7054
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says.",
7055
+ "schema": {
7056
+ "type": "string",
7057
+ "enum": [
7058
+ "api",
7059
+ "cli"
7060
+ ],
7061
+ "description": "Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says."
7062
+ }
7063
+ }
7064
+ ],
7065
+ "hasBody": true,
7066
+ "workspace": true,
7067
+ "acceptsApiKey": true,
7068
+ "scope": "runs:write"
7069
+ },
7070
+ {
7071
+ "operationId": "scriptVersions.upload",
7072
+ "method": "post",
7073
+ "path": "/scripts/{slug}/versions",
7074
+ "summary": "Upload a version",
7075
+ "cli": {
7076
+ "command": "script-versions upload",
7077
+ "args": [
7078
+ "slug"
7079
+ ],
7080
+ "confirm": false,
7081
+ "shortcut": "upload [dir...]"
7082
+ },
7083
+ "mcp": {
7084
+ "exposed": true,
7085
+ "name": "script_versions_upload",
7086
+ "hints": {
7087
+ "readOnlyHint": false,
7088
+ "destructiveHint": false,
7089
+ "idempotentHint": false
7090
+ }
7091
+ },
7092
+ "description": "Uploads a new draft version of a script. Send the version's source, the command that runs it and the JSON Schema of its inputs. The source is the script's folder as a .tar.gz file in base64, and the CLI makes it for you. If you leave out the command, Reminix works it out from the folder: the one script in pyproject.toml, the `bin`, `start` or `main` in package.json, or the folder's one .py, .js, .ts or .sh file. If you leave out the input schema, each `{name}` in the command becomes a text input. If you leave out the README, Reminix uses the folder's README.md. Reminix installs the dependencies from requirements.txt, pyproject.toml or package.json once, during the upload. If the install fails, the request returns 400 with what the install printed. Runs keep using the published version until you publish this one. To upload and publish in one call, pass `publish: true`, and add `create: true` for a new script.",
7093
+ "fields": [
7094
+ {
7095
+ "name": "slug",
7096
+ "in": "path",
7097
+ "type": "string",
7098
+ "required": true,
7099
+ "description": "The slug's ID.",
7100
+ "example": "unlock-account",
7101
+ "schema": {
7102
+ "type": "string",
7103
+ "description": "The slug's ID."
7104
+ }
7105
+ },
7106
+ {
7107
+ "name": "command",
7108
+ "in": "body",
7109
+ "type": "string",
7110
+ "required": false,
7111
+ "description": "The command a run executes. Each `{name}` in it is an input, and Reminix drops a part inside `[ \u2026 ]` when its inputs are empty. Reminix runs the command as arguments, never through a shell. If you leave it out, Reminix works it out from the folder, or returns 400 saying what to add.",
7112
+ "example": "python unlock.py {email}",
7113
+ "schema": {
7114
+ "type": "string",
7115
+ "minLength": 1,
7116
+ "maxLength": 2e3,
7117
+ "description": "The command a run executes. Each `{name}` in it is an input, and Reminix drops a part inside `[ \u2026 ]` when its inputs are empty. Reminix runs the command as arguments, never through a shell. If you leave it out, Reminix works it out from the folder, or returns 400 saying what to add."
7118
+ }
7119
+ },
7120
+ {
7121
+ "name": "install",
7122
+ "in": "body",
7123
+ "type": "string",
7124
+ "required": false,
7125
+ "description": "A command that replaces the usual install. The usual install puts Python packages from requirements.txt, or else pyproject.toml, into .deps, and installs package.json with npm. Your command runs in the folder, and it can reach the package registries.",
7126
+ "schema": {
7127
+ "type": [
7128
+ "string",
6642
7129
  "null"
6643
7130
  ],
6644
7131
  "maxLength": 2e3,
6645
- "description": "Replaces the usual install (requirements.txt, else pyproject.toml, into .deps; package.json with npm). Runs in the folder with the package registries reachable."
7132
+ "description": "A command that replaces the usual install. The usual install puts Python packages from requirements.txt, or else pyproject.toml, into .deps, and installs package.json with npm. Your command runs in the folder, and it can reach the package registries."
6646
7133
  }
6647
7134
  },
6648
7135
  {
@@ -6650,11 +7137,11 @@ var OPERATIONS = [
6650
7137
  "in": "body",
6651
7138
  "type": "json",
6652
7139
  "required": false,
6653
- "description": "The inputs, as JSON Schema. Omitted: a required text input for each `{name}` in the command (optional inside `[ \u2026 ]`).",
7140
+ "description": "The inputs, as JSON Schema. If you leave it out, each `{name}` in the command becomes a required text input, or an optional one inside `[ \u2026 ]`.",
6654
7141
  "schema": {
6655
7142
  "type": "object",
6656
7143
  "additionalProperties": {},
6657
- "description": "The inputs, as JSON Schema. Omitted: a required text input for each `{name}` in the command (optional inside `[ \u2026 ]`)."
7144
+ "description": "The inputs, as JSON Schema. If you leave it out, each `{name}` in the command becomes a required text input, or an optional one inside `[ \u2026 ]`."
6658
7145
  }
6659
7146
  },
6660
7147
  {
@@ -6662,25 +7149,26 @@ var OPERATIONS = [
6662
7149
  "in": "body",
6663
7150
  "type": "json",
6664
7151
  "required": false,
6665
- "description": "A JSON Schema document.",
7152
+ "description": "What the script returns on standard output, as JSON Schema.",
6666
7153
  "schema": {
6667
7154
  "type": [
6668
7155
  "object",
6669
7156
  "null"
6670
7157
  ],
6671
7158
  "additionalProperties": {},
6672
- "description": "A JSON Schema document."
7159
+ "description": "What the script returns on standard output, as JSON Schema."
6673
7160
  }
6674
7161
  },
6675
7162
  {
6676
- "name": "archive",
7163
+ "name": "source",
6677
7164
  "in": "body",
6678
7165
  "type": "string",
6679
7166
  "required": true,
6680
- "description": "The script's folder as a .tar.gz, base64 \u2014 at most 10 MB, without its dependencies.",
7167
+ "description": "The script's folder as a .tar.gz file in base64, at most 10 MB. Leave out its dependencies, because Reminix installs them during the upload.",
7168
+ "example": "H4sIAAAAAAAAA\u2026",
6681
7169
  "schema": {
6682
7170
  "type": "string",
6683
- "description": "The script's folder as a .tar.gz, base64 \u2014 at most 10 MB, without its dependencies."
7171
+ "description": "The script's folder as a .tar.gz file in base64, at most 10 MB. Leave out its dependencies, because Reminix installs them during the upload."
6684
7172
  }
6685
7173
  },
6686
7174
  {
@@ -6688,7 +7176,7 @@ var OPERATIONS = [
6688
7176
  "in": "body",
6689
7177
  "type": "json",
6690
7178
  "required": false,
6691
- "description": "The only hosts the script may reach (HTTPS). Omitted: no network.",
7179
+ "description": "The only hosts the script can reach, over HTTPS. If you leave it out, the script has no network access.",
6692
7180
  "example": [
6693
7181
  "api.yourapp.com"
6694
7182
  ],
@@ -6697,7 +7185,7 @@ var OPERATIONS = [
6697
7185
  "items": {
6698
7186
  "type": "string"
6699
7187
  },
6700
- "description": "The only hosts the script may reach (HTTPS). Omitted: no network."
7188
+ "description": "The only hosts the script can reach, over HTTPS. If you leave it out, the script has no network access."
6701
7189
  }
6702
7190
  },
6703
7191
  {
@@ -6705,7 +7193,14 @@ var OPERATIONS = [
6705
7193
  "in": "body",
6706
7194
  "type": "json",
6707
7195
  "required": false,
6708
- "description": "Secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of them.",
7196
+ "description": "The secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of those hosts.",
7197
+ "example": {
7198
+ "ADMIN_KEY": {
7199
+ "host": "api.yourapp.com",
7200
+ "header": "Authorization",
7201
+ "format": "Bearer {secret}"
7202
+ }
7203
+ },
6709
7204
  "schema": {
6710
7205
  "type": "object",
6711
7206
  "additionalProperties": {
@@ -6716,7 +7211,7 @@ var OPERATIONS = [
6716
7211
  "items": {
6717
7212
  "type": "string"
6718
7213
  },
6719
- "description": "Some of the version's hosts. A run attaches the secret to those its environment's value may go to."
7214
+ "description": "Which of the version's hosts get the secret. A run attaches it only to those that the secret's value in the run's environment allows."
6720
7215
  },
6721
7216
  "host": {
6722
7217
  "type": "string",
@@ -6725,44 +7220,44 @@ var OPERATIONS = [
6725
7220
  "header": {
6726
7221
  "type": "string"
6727
7222
  },
6728
- "value": {
7223
+ "format": {
6729
7224
  "type": "string",
6730
- "description": "The header's value; `{secret}` is replaced. Default: `{secret}`."
7225
+ "description": "The header's value, with `{secret}` where the secret goes. Default: `{secret}`."
6731
7226
  }
6732
7227
  },
6733
7228
  "required": [
6734
7229
  "header"
6735
7230
  ]
6736
7231
  },
6737
- "description": "Secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of them."
7232
+ "description": "The secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of those hosts."
6738
7233
  }
6739
7234
  },
6740
7235
  {
6741
- "name": "env",
7236
+ "name": "envVars",
6742
7237
  "in": "body",
6743
7238
  "type": "json",
6744
7239
  "required": false,
6745
- "description": "Secrets the script reads as environment variables (only those whose owner allowed it).",
7240
+ "description": "Secrets the script reads as environment variables. Each secret must allow this with `allowEnvVar`.",
6746
7241
  "schema": {
6747
7242
  "type": "array",
6748
7243
  "items": {
6749
7244
  "type": "string"
6750
7245
  },
6751
- "description": "Secrets the script reads as environment variables (only those whose owner allowed it)."
7246
+ "description": "Secrets the script reads as environment variables. Each secret must allow this with `allowEnvVar`."
6752
7247
  }
6753
7248
  },
6754
7249
  {
6755
- "name": "timeout",
7250
+ "name": "timeoutSeconds",
6756
7251
  "in": "body",
6757
7252
  "type": "number",
6758
7253
  "required": false,
6759
- "description": "Seconds a run may take (default 30). Over 30 makes a LONG script: runs answer 202 at once and run durably, with live logs and progress, and can be cancelled.",
6760
- "example": 600,
7254
+ "description": "How long a run can take, in seconds. The default is 30. With more than 30, the script's runs are long runs. A long run returns 202 at once. It shows a live log and progress, and you can cancel it. Long runs need the Pro plan or above.",
7255
+ "example": 30,
6761
7256
  "schema": {
6762
7257
  "type": "integer",
6763
7258
  "minimum": 1,
6764
7259
  "maximum": 900,
6765
- "description": "Seconds a run may take (default 30). Over 30 makes a LONG script: runs answer 202 at once and run durably, with live logs and progress, and can be cancelled."
7260
+ "description": "How long a run can take, in seconds. The default is 30. With more than 30, the script's runs are long runs. A long run returns 202 at once. It shows a live log and progress, and you can cancel it. Long runs need the Pro plan or above."
6766
7261
  }
6767
7262
  },
6768
7263
  {
@@ -6770,14 +7265,14 @@ var OPERATIONS = [
6770
7265
  "in": "body",
6771
7266
  "type": "string",
6772
7267
  "required": false,
6773
- "description": "README.md (markdown), shown on the script's page while this version is published.",
7268
+ "description": "The README, in Markdown. The script's page shows it while this version is the published one.",
6774
7269
  "schema": {
6775
7270
  "type": [
6776
7271
  "string",
6777
7272
  "null"
6778
7273
  ],
6779
7274
  "maxLength": 1e5,
6780
- "description": "README.md (markdown), shown on the script's page while this version is published."
7275
+ "description": "The README, in Markdown. The script's page shows it while this version is the published one."
6781
7276
  }
6782
7277
  },
6783
7278
  {
@@ -6785,7 +7280,7 @@ var OPERATIONS = [
6785
7280
  "in": "body",
6786
7281
  "type": "json",
6787
7282
  "required": false,
6788
- "description": "When given, become the script's tags.",
7283
+ "description": "If given, these become the script's tags.",
6789
7284
  "example": [
6790
7285
  "support",
6791
7286
  "accounts"
@@ -6796,7 +7291,7 @@ var OPERATIONS = [
6796
7291
  "type": "string"
6797
7292
  },
6798
7293
  "maxItems": 10,
6799
- "description": "When given, become the script's tags."
7294
+ "description": "If given, these become the script's tags."
6800
7295
  }
6801
7296
  },
6802
7297
  {
@@ -6804,7 +7299,7 @@ var OPERATIONS = [
6804
7299
  "in": "body",
6805
7300
  "type": "string",
6806
7301
  "required": false,
6807
- "description": "How it was uploaded (for the history). Default: api.",
7302
+ "description": "Where the upload came from, kept in the history. The default is `api`.",
6808
7303
  "schema": {
6809
7304
  "type": "string",
6810
7305
  "enum": [
@@ -6812,182 +7307,62 @@ var OPERATIONS = [
6812
7307
  "api",
6813
7308
  "app"
6814
7309
  ],
6815
- "description": "How it was uploaded (for the history). Default: api."
6816
- }
6817
- }
6818
- ],
6819
- "hasBody": true,
6820
- "workspace": true,
6821
- "scope": "scripts:write"
6822
- },
6823
- {
6824
- "operationId": "scriptVersions.list",
6825
- "method": "get",
6826
- "path": "/scripts/{slug}/versions",
6827
- "summary": "List a script's versions",
6828
- "cli": {
6829
- "command": "script-versions list",
6830
- "args": [
6831
- "slug"
6832
- ],
6833
- "confirm": false
6834
- },
6835
- "mcp": {
6836
- "exposed": true,
6837
- "name": "script_versions_list",
6838
- "hints": {
6839
- "readOnlyHint": true,
6840
- "destructiveHint": false,
6841
- "idempotentHint": true
6842
- }
6843
- },
6844
- "description": "Every version, newest first, and which one is published.",
6845
- "fields": [
6846
- {
6847
- "name": "slug",
6848
- "in": "path",
6849
- "type": "string",
6850
- "required": true,
6851
- "example": "unlock-account",
6852
- "schema": {
6853
- "type": "string"
6854
- }
6855
- }
6856
- ],
6857
- "hasBody": false,
6858
- "workspace": true,
6859
- "scope": "scripts:read"
6860
- },
6861
- {
6862
- "operationId": "scriptVersions.publish",
6863
- "method": "post",
6864
- "path": "/scripts/{slug}/versions/{number}/publish",
6865
- "summary": "Publish a version",
6866
- "cli": {
6867
- "command": "script-versions publish",
6868
- "args": [
6869
- "slug",
6870
- "number"
6871
- ],
6872
- "confirm": false
6873
- },
6874
- "mcp": {
6875
- "exposed": true,
6876
- "name": "script_versions_publish",
6877
- "hints": {
6878
- "readOnlyHint": false,
6879
- "destructiveHint": false,
6880
- "idempotentHint": false
6881
- }
6882
- },
6883
- "description": "Makes this version the one every run uses \u2014 from the app, the API, agents and schedules. Publishing an older version again rolls back. The script's owner, or a workspace owner or admin. An agent's publish (and anyone's, when the workspace requires a second person) becomes a request a person approves \u2014 answered 202.",
6884
- "fields": [
6885
- {
6886
- "name": "slug",
6887
- "in": "path",
6888
- "type": "string",
6889
- "required": true,
6890
- "example": "unlock-account",
6891
- "schema": {
6892
- "type": "string"
7310
+ "description": "Where the upload came from, kept in the history. The default is `api`."
6893
7311
  }
6894
7312
  },
6895
7313
  {
6896
- "name": "number",
6897
- "in": "path",
6898
- "type": "number",
6899
- "required": true,
6900
- "example": 3,
6901
- "schema": {
6902
- "type": "integer",
6903
- "minimum": 1
6904
- }
6905
- }
6906
- ],
6907
- "hasBody": false,
6908
- "workspace": true,
6909
- "scope": "scripts:write"
6910
- },
6911
- {
6912
- "operationId": "scriptVersions.run",
6913
- "method": "post",
6914
- "path": "/scripts/{slug}/versions/{number}/runs",
6915
- "summary": "Test-run a version",
6916
- "cli": {
6917
- "command": "script-versions run",
6918
- "args": [
6919
- "slug",
6920
- "number"
6921
- ],
6922
- "confirm": false
6923
- },
6924
- "mcp": {
6925
- "exposed": true,
6926
- "name": "script_versions_run",
6927
- "hints": {
6928
- "readOnlyHint": false,
6929
- "destructiveHint": false,
6930
- "idempotentHint": false
6931
- }
6932
- },
6933
- "description": "Runs one VERSION \u2014 a draft before publishing \u2014 with these inputs, as a test run: recorded with `test: true`, not counted as the script's use, and without run events (no webhooks, no triggers). For the version's uploader, the script's owner, or an owner or admin; the script's approval policy still applies. Prove a draft works before asking a person to publish it.",
6934
- "fields": [
6935
- {
6936
- "name": "slug",
6937
- "in": "path",
6938
- "type": "string",
6939
- "required": true,
6940
- "example": "unlock-account",
7314
+ "name": "create",
7315
+ "in": "body",
7316
+ "type": "boolean",
7317
+ "required": false,
7318
+ "description": "With `true`, creates the script if no script has this slug. The new script's name comes from `name` if you send one. Otherwise it comes from pyproject.toml or package.json, or else from the slug. By default an unknown slug returns 404 instead, which keeps a typo from creating a script.",
6941
7319
  "schema": {
6942
- "type": "string"
7320
+ "type": "boolean",
7321
+ "description": "With `true`, creates the script if no script has this slug. The new script's name comes from `name` if you send one. Otherwise it comes from pyproject.toml or package.json, or else from the slug. By default an unknown slug returns 404 instead, which keeps a typo from creating a script."
6943
7322
  }
6944
7323
  },
6945
7324
  {
6946
- "name": "number",
6947
- "in": "path",
6948
- "type": "number",
6949
- "required": true,
6950
- "example": 2,
7325
+ "name": "name",
7326
+ "in": "body",
7327
+ "type": "string",
7328
+ "required": false,
7329
+ "description": "If given, this becomes the script's name. It applies to every upload that sends it.",
7330
+ "example": "Unlock an account",
6951
7331
  "schema": {
6952
- "type": "integer",
6953
- "minimum": 1
7332
+ "type": "string",
7333
+ "minLength": 1,
7334
+ "maxLength": 100,
7335
+ "description": "If given, this becomes the script's name. It applies to every upload that sends it."
6954
7336
  }
6955
7337
  },
6956
7338
  {
6957
- "name": "inputs",
7339
+ "name": "description",
6958
7340
  "in": "body",
6959
- "type": "json",
7341
+ "type": "string",
6960
7342
  "required": false,
6961
- "description": "The script's inputs, by name. Default: none.",
6962
- "example": {
6963
- "email": "jane@example.com"
6964
- },
7343
+ "description": "If given, this becomes the script's description, in the same way as `name`.",
6965
7344
  "schema": {
6966
- "type": "object",
6967
- "additionalProperties": {},
6968
- "default": {},
6969
- "description": "The script's inputs, by name. Default: none."
7345
+ "type": "string",
7346
+ "maxLength": 500,
7347
+ "description": "If given, this becomes the script's description, in the same way as `name`."
6970
7348
  }
6971
7349
  },
6972
7350
  {
6973
- "name": "via",
7351
+ "name": "publish",
6974
7352
  "in": "body",
6975
- "type": "string",
7353
+ "type": "boolean",
6976
7354
  "required": false,
6977
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp.",
7355
+ "description": "With `true`, also publishes this version in the same call, exactly as Publish a version does. If publishing needs a person's approval, the response carries `approval`, and Reminix publishes the version once a person approves it.",
6978
7356
  "schema": {
6979
- "type": "string",
6980
- "enum": [
6981
- "api",
6982
- "cli"
6983
- ],
6984
- "description": "How it was started (for the history). Default: api; agents' runs are recorded as mcp."
7357
+ "type": "boolean",
7358
+ "description": "With `true`, also publishes this version in the same call, exactly as Publish a version does. If publishing needs a person's approval, the response carries `approval`, and Reminix publishes the version once a person approves it."
6985
7359
  }
6986
7360
  }
6987
7361
  ],
6988
7362
  "hasBody": true,
6989
7363
  "workspace": true,
6990
- "scope": "runs:write"
7364
+ "acceptsApiKey": false,
7365
+ "scope": "scripts:write"
6991
7366
  },
6992
7367
  {
6993
7368
  "operationId": "secrets.delete",
@@ -7005,21 +7380,24 @@ var OPERATIONS = [
7005
7380
  "exposed": false,
7006
7381
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7007
7382
  },
7008
- "description": "Deletes it and its value in every environment; runs of scripts that use it fail until it is saved again. Workspace owners and admins, or a workspace API key.",
7383
+ "description": "Deletes a secret and its value in every environment. Runs of scripts that use it fail until someone saves it again. Workspace owners, admins and API keys can delete a secret.",
7009
7384
  "fields": [
7010
7385
  {
7011
7386
  "name": "name",
7012
7387
  "in": "path",
7013
7388
  "type": "string",
7014
7389
  "required": true,
7390
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7015
7391
  "example": "ADMIN_KEY",
7016
7392
  "schema": {
7017
- "type": "string"
7393
+ "type": "string",
7394
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7018
7395
  }
7019
7396
  }
7020
7397
  ],
7021
7398
  "hasBody": false,
7022
7399
  "workspace": true,
7400
+ "acceptsApiKey": true,
7023
7401
  "scope": "secrets:write"
7024
7402
  },
7025
7403
  {
@@ -7041,10 +7419,11 @@ var OPERATIONS = [
7041
7419
  "idempotentHint": true
7042
7420
  }
7043
7421
  },
7044
- "description": "The workspace's secrets by name, with the environments that have a value and the hosts each value may be sent to \u2014 never the values.",
7422
+ "description": "Lists the workspace's secrets by name, with the environments that have a value and the hosts each value may go to. The list never includes the values themselves.",
7045
7423
  "fields": [],
7046
7424
  "hasBody": false,
7047
7425
  "workspace": true,
7426
+ "acceptsApiKey": true,
7048
7427
  "scope": "secrets:read"
7049
7428
  },
7050
7429
  {
@@ -7057,22 +7436,25 @@ var OPERATIONS = [
7057
7436
  "args": [
7058
7437
  "name"
7059
7438
  ],
7060
- "confirm": false
7439
+ "confirm": false,
7440
+ "sample": 'printf %s "$ADMIN_KEY" | \\\n reminix secrets set ADMIN_KEY \\\n --hosts api.yourapp.com'
7061
7441
  },
7062
7442
  "mcp": {
7063
7443
  "exposed": false,
7064
7444
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7065
7445
  },
7066
- "description": "Saves the secret's value in the request's environment: creates it, or replaces the value and its hosts (rotation). The value is encrypted and never returned by any call. `hosts` are the ONLY hosts that value is ever sent to \u2014 a script cannot send it anywhere else. Workspace owners and admins, or a workspace API key.",
7446
+ "description": "Saves a secret's value in the request's environment. Saving creates the secret if it's new, or replaces the value and its hosts to rotate it. Reminix encrypts the value, and no call ever returns it. Reminix sends the value only to the hosts in `hosts`. Workspace owners, admins and API keys can save a secret.",
7067
7447
  "fields": [
7068
7448
  {
7069
7449
  "name": "name",
7070
7450
  "in": "path",
7071
7451
  "type": "string",
7072
7452
  "required": true,
7453
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7073
7454
  "example": "ADMIN_KEY",
7074
7455
  "schema": {
7075
- "type": "string"
7456
+ "type": "string",
7457
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7076
7458
  }
7077
7459
  },
7078
7460
  {
@@ -7080,10 +7462,11 @@ var OPERATIONS = [
7080
7462
  "in": "body",
7081
7463
  "type": "string",
7082
7464
  "required": true,
7083
- "description": "The secret itself.",
7465
+ "description": "The secret itself, at most 16,384 bytes.",
7466
+ "example": "ak_live_\u2026",
7084
7467
  "schema": {
7085
7468
  "type": "string",
7086
- "description": "The secret itself."
7469
+ "description": "The secret itself, at most 16,384 bytes."
7087
7470
  }
7088
7471
  },
7089
7472
  {
@@ -7091,6 +7474,7 @@ var OPERATIONS = [
7091
7474
  "in": "body",
7092
7475
  "type": "json",
7093
7476
  "required": true,
7477
+ "description": "The only hosts Reminix sends this value to, such as `api.stripe.com`.",
7094
7478
  "example": [
7095
7479
  "api.yourapp.com"
7096
7480
  ],
@@ -7098,32 +7482,34 @@ var OPERATIONS = [
7098
7482
  "type": "array",
7099
7483
  "items": {
7100
7484
  "type": "string"
7101
- }
7485
+ },
7486
+ "description": "The only hosts Reminix sends this value to, such as `api.stripe.com`."
7102
7487
  }
7103
7488
  },
7104
7489
  {
7105
- "name": "allowEnv",
7490
+ "name": "allowEnvVar",
7106
7491
  "in": "body",
7107
7492
  "type": "boolean",
7108
7493
  "required": false,
7109
- "description": "Let scripts read it as a plain value. Default false \u2014 attached to requests only.",
7494
+ "description": "Whether scripts can read the secret as an environment variable. The default is false, so Reminix only attaches it to requests.",
7110
7495
  "schema": {
7111
7496
  "type": "boolean",
7112
- "description": "Let scripts read it as a plain value. Default false \u2014 attached to requests only."
7497
+ "description": "Whether scripts can read the secret as an environment variable. The default is false, so Reminix only attaches it to requests."
7113
7498
  }
7114
7499
  }
7115
7500
  ],
7116
7501
  "hasBody": true,
7117
7502
  "workspace": true,
7503
+ "acceptsApiKey": true,
7118
7504
  "scope": "secrets:write"
7119
7505
  },
7120
7506
  {
7121
- "operationId": "secrets.unset",
7507
+ "operationId": "secretValues.delete",
7122
7508
  "method": "delete",
7123
7509
  "path": "/secrets/{name}/values/{environment}",
7124
7510
  "summary": "Remove a secret's value from an environment",
7125
7511
  "cli": {
7126
- "command": "secrets unset",
7512
+ "command": "secret-values delete",
7127
7513
  "args": [
7128
7514
  "name",
7129
7515
  "environment"
@@ -7134,16 +7520,18 @@ var OPERATIONS = [
7134
7520
  "exposed": false,
7135
7521
  "reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
7136
7522
  },
7137
- "description": "Removes the value in that environment only; the secret and its other values stay. Runs there that use it fail until a value is saved again. Workspace owners and admins, or a workspace API key.",
7523
+ "description": "Removes a secret's value from one environment. The secret and its values in other environments stay. Runs in that environment that use the secret fail until someone saves a value there again. Workspace owners, admins and API keys can remove a value.",
7138
7524
  "fields": [
7139
7525
  {
7140
7526
  "name": "name",
7141
7527
  "in": "path",
7142
7528
  "type": "string",
7143
7529
  "required": true,
7530
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
7144
7531
  "example": "ADMIN_KEY",
7145
7532
  "schema": {
7146
- "type": "string"
7533
+ "type": "string",
7534
+ "description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
7147
7535
  }
7148
7536
  },
7149
7537
  {
@@ -7151,14 +7539,17 @@ var OPERATIONS = [
7151
7539
  "in": "path",
7152
7540
  "type": "string",
7153
7541
  "required": true,
7542
+ "description": "The environment's ID.",
7154
7543
  "example": "staging",
7155
7544
  "schema": {
7156
- "type": "string"
7545
+ "type": "string",
7546
+ "description": "The environment's ID."
7157
7547
  }
7158
7548
  }
7159
7549
  ],
7160
7550
  "hasBody": false,
7161
7551
  "workspace": true,
7552
+ "acceptsApiKey": true,
7162
7553
  "scope": "secrets:write"
7163
7554
  },
7164
7555
  {
@@ -7175,18 +7566,20 @@ var OPERATIONS = [
7175
7566
  },
7176
7567
  "mcp": {
7177
7568
  "exposed": false,
7178
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7569
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7179
7570
  },
7180
- "description": "Starts a run, as you, when an event of `eventType` happens in the workspace (GET /v1/workspace/event-types lists them) and its data matches `filter` \u2014 within about a minute. A chain of triggered runs stops after 3.",
7571
+ "description": "Starts a run of the script, as you, when an event of `eventType` happens in the workspace and its data matches `filter`. GET /v1/workspace/event-types lists the event types. The run starts within about a minute of the event. A chain of triggered runs stops after 3. If every run of the script, or every run in the environment, needs approval, only workspace owners and admins can create a trigger.",
7181
7572
  "fields": [
7182
7573
  {
7183
7574
  "name": "slug",
7184
7575
  "in": "path",
7185
7576
  "type": "string",
7186
7577
  "required": true,
7578
+ "description": "The slug's ID.",
7187
7579
  "example": "alert-on-failure",
7188
7580
  "schema": {
7189
- "type": "string"
7581
+ "type": "string",
7582
+ "description": "The slug's ID."
7190
7583
  }
7191
7584
  },
7192
7585
  {
@@ -7208,12 +7601,12 @@ var OPERATIONS = [
7208
7601
  "in": "body",
7209
7602
  "type": "string",
7210
7603
  "required": true,
7211
- "description": "The event that starts a run: any webhook event type, such as run.failed.",
7604
+ "description": "The event that starts a run. It can be any webhook event type, such as `run.failed`.",
7212
7605
  "example": "run.failed",
7213
7606
  "schema": {
7214
7607
  "type": "string",
7215
7608
  "minLength": 1,
7216
- "description": "The event that starts a run: any webhook event type, such as run.failed."
7609
+ "description": "The event that starts a run. It can be any webhook event type, such as `run.failed`."
7217
7610
  }
7218
7611
  },
7219
7612
  {
@@ -7221,14 +7614,14 @@ var OPERATIONS = [
7221
7614
  "in": "body",
7222
7615
  "type": "json",
7223
7616
  "required": false,
7224
- "description": "Event data fields (dotted paths) that must equal these values.",
7617
+ "description": "Event data fields, as dotted paths, that must equal these values.",
7225
7618
  "example": {
7226
7619
  "script.slug": "nightly-sync"
7227
7620
  },
7228
7621
  "schema": {
7229
7622
  "type": "object",
7230
7623
  "additionalProperties": {},
7231
- "description": "Event data fields (dotted paths) that must equal these values."
7624
+ "description": "Event data fields, as dotted paths, that must equal these values."
7232
7625
  }
7233
7626
  },
7234
7627
  {
@@ -7236,7 +7629,7 @@ var OPERATIONS = [
7236
7629
  "in": "body",
7237
7630
  "type": "json",
7238
7631
  "required": false,
7239
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`,
7632
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`,
7240
7633
  "example": {
7241
7634
  "runId": "{{event.data.runId}}",
7242
7635
  "error": "{{event.data.error}}"
@@ -7244,7 +7637,7 @@ var OPERATIONS = [
7244
7637
  "schema": {
7245
7638
  "type": "object",
7246
7639
  "additionalProperties": {},
7247
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`
7640
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`
7248
7641
  }
7249
7642
  },
7250
7643
  {
@@ -7252,15 +7645,16 @@ var OPERATIONS = [
7252
7645
  "in": "body",
7253
7646
  "type": "string",
7254
7647
  "required": false,
7255
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default.",
7648
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment.",
7256
7649
  "schema": {
7257
7650
  "type": "string",
7258
- "description": "The environment its runs use. Default: the request's (X-Environment), else the workspace's default."
7651
+ "description": "The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment."
7259
7652
  }
7260
7653
  }
7261
7654
  ],
7262
7655
  "hasBody": true,
7263
7656
  "workspace": true,
7657
+ "acceptsApiKey": false,
7264
7658
  "scope": "scripts:write"
7265
7659
  },
7266
7660
  {
@@ -7278,18 +7672,20 @@ var OPERATIONS = [
7278
7672
  },
7279
7673
  "mcp": {
7280
7674
  "exposed": false,
7281
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7675
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7282
7676
  },
7283
- "description": "Its creator, or an owner or admin.",
7677
+ "description": "Deletes a trigger. The trigger's creator, a workspace owner or admin, or a workspace API key can delete it.",
7284
7678
  "fields": [
7285
7679
  {
7286
7680
  "name": "slug",
7287
7681
  "in": "path",
7288
7682
  "type": "string",
7289
7683
  "required": true,
7684
+ "description": "The slug's ID.",
7290
7685
  "example": "alert-on-failure",
7291
7686
  "schema": {
7292
- "type": "string"
7687
+ "type": "string",
7688
+ "description": "The slug's ID."
7293
7689
  }
7294
7690
  },
7295
7691
  {
@@ -7297,13 +7693,17 @@ var OPERATIONS = [
7297
7693
  "in": "path",
7298
7694
  "type": "string",
7299
7695
  "required": true,
7696
+ "description": "The trigger's ID.",
7697
+ "example": "trg_6e4a\u2026",
7300
7698
  "schema": {
7301
- "type": "string"
7699
+ "type": "string",
7700
+ "description": "The trigger's ID."
7302
7701
  }
7303
7702
  }
7304
7703
  ],
7305
7704
  "hasBody": false,
7306
7705
  "workspace": true,
7706
+ "acceptsApiKey": true,
7307
7707
  "scope": "scripts:write"
7308
7708
  },
7309
7709
  {
@@ -7327,21 +7727,24 @@ var OPERATIONS = [
7327
7727
  "idempotentHint": true
7328
7728
  }
7329
7729
  },
7330
- "description": "The events that start it.",
7730
+ "description": "Lists a script's triggers, which are the events that start it.",
7331
7731
  "fields": [
7332
7732
  {
7333
7733
  "name": "slug",
7334
7734
  "in": "path",
7335
7735
  "type": "string",
7336
7736
  "required": true,
7737
+ "description": "The slug's ID.",
7337
7738
  "example": "alert-on-failure",
7338
7739
  "schema": {
7339
- "type": "string"
7740
+ "type": "string",
7741
+ "description": "The slug's ID."
7340
7742
  }
7341
7743
  }
7342
7744
  ],
7343
7745
  "hasBody": false,
7344
7746
  "workspace": true,
7747
+ "acceptsApiKey": true,
7345
7748
  "scope": "scripts:read"
7346
7749
  },
7347
7750
  {
@@ -7359,18 +7762,20 @@ var OPERATIONS = [
7359
7762
  },
7360
7763
  "mcp": {
7361
7764
  "exposed": false,
7362
- "reason": "Schedules and triggers run as the person who created them \u2014 a person creates and changes them"
7765
+ "reason": "Schedules and triggers run as the person who created them. Only a person can create or change them."
7363
7766
  },
7364
- "description": "Its name, filter, inputs, or switch it on or off. Its creator, or an owner or admin.",
7767
+ "description": "Changes a trigger's name, filter, inputs or environment, or whether it's enabled. The trigger's creator, a workspace owner or admin, or a workspace API key can change it.",
7365
7768
  "fields": [
7366
7769
  {
7367
7770
  "name": "slug",
7368
7771
  "in": "path",
7369
7772
  "type": "string",
7370
7773
  "required": true,
7774
+ "description": "The slug's ID.",
7371
7775
  "example": "alert-on-failure",
7372
7776
  "schema": {
7373
- "type": "string"
7777
+ "type": "string",
7778
+ "description": "The slug's ID."
7374
7779
  }
7375
7780
  },
7376
7781
  {
@@ -7378,8 +7783,11 @@ var OPERATIONS = [
7378
7783
  "in": "path",
7379
7784
  "type": "string",
7380
7785
  "required": true,
7786
+ "description": "The trigger's ID.",
7787
+ "example": "trg_6e4a\u2026",
7381
7788
  "schema": {
7382
- "type": "string"
7789
+ "type": "string",
7790
+ "description": "The trigger's ID."
7383
7791
  }
7384
7792
  },
7385
7793
  {
@@ -7400,14 +7808,14 @@ var OPERATIONS = [
7400
7808
  "in": "body",
7401
7809
  "type": "json",
7402
7810
  "required": false,
7403
- "description": "Event data fields (dotted paths) that must equal these values.",
7811
+ "description": "Event data fields, as dotted paths, that must equal these values.",
7404
7812
  "example": {
7405
7813
  "script.slug": "nightly-sync"
7406
7814
  },
7407
7815
  "schema": {
7408
7816
  "type": "object",
7409
7817
  "additionalProperties": {},
7410
- "description": "Event data fields (dotted paths) that must equal these values."
7818
+ "description": "Event data fields, as dotted paths, that must equal these values."
7411
7819
  }
7412
7820
  },
7413
7821
  {
@@ -7415,7 +7823,7 @@ var OPERATIONS = [
7415
7823
  "in": "body",
7416
7824
  "type": "json",
7417
7825
  "required": false,
7418
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`,
7826
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`,
7419
7827
  "example": {
7420
7828
  "runId": "{{event.data.runId}}",
7421
7829
  "error": "{{event.data.error}}"
@@ -7423,7 +7831,7 @@ var OPERATIONS = [
7423
7831
  "schema": {
7424
7832
  "type": "object",
7425
7833
  "additionalProperties": {},
7426
- "description": `The script's inputs for each run, by name; a value "{{event.data.<path>}}" takes it from the event.`
7834
+ "description": `The script's inputs for each run, by name. A value like "{{event.data.<path>}}" takes its value from the event.`
7427
7835
  }
7428
7836
  },
7429
7837
  {
@@ -7431,10 +7839,10 @@ var OPERATIONS = [
7431
7839
  "in": "body",
7432
7840
  "type": "boolean",
7433
7841
  "required": false,
7434
- "description": "Whether it fires. Default: true.",
7842
+ "description": "Whether the trigger starts runs. With `false`, it's disabled.",
7435
7843
  "schema": {
7436
7844
  "type": "boolean",
7437
- "description": "Whether it fires. Default: true."
7845
+ "description": "Whether the trigger starts runs. With `false`, it's disabled."
7438
7846
  }
7439
7847
  },
7440
7848
  {
@@ -7442,15 +7850,16 @@ var OPERATIONS = [
7442
7850
  "in": "body",
7443
7851
  "type": "string",
7444
7852
  "required": false,
7445
- "description": "Move its runs to another environment.",
7853
+ "description": "Another environment for the trigger's runs to use.",
7446
7854
  "schema": {
7447
7855
  "type": "string",
7448
- "description": "Move its runs to another environment."
7856
+ "description": "Another environment for the trigger's runs to use."
7449
7857
  }
7450
7858
  }
7451
7859
  ],
7452
7860
  "hasBody": true,
7453
7861
  "workspace": true,
7862
+ "acceptsApiKey": true,
7454
7863
  "scope": "scripts:write"
7455
7864
  },
7456
7865
  {
@@ -7465,12 +7874,13 @@ var OPERATIONS = [
7465
7874
  },
7466
7875
  "mcp": {
7467
7876
  "exposed": false,
7468
- "reason": "Personal access tokens only; an agent's connection acts in one workspace (workspace_get)."
7877
+ "reason": "Only a personal access token can call this. An agent's connection acts in one workspace, which workspace_get returns."
7469
7878
  },
7470
- "description": 'Returns the user the personal access token belongs to, with their workspace memberships. Useful as an integration smoke test ("who am I?").',
7879
+ "description": 'Returns the user the personal access token belongs to, and their workspace memberships. Use it as a smoke test for an integration ("who am I?").',
7471
7880
  "fields": [],
7472
7881
  "hasBody": false,
7473
- "workspace": false
7882
+ "workspace": false,
7883
+ "acceptsApiKey": false
7474
7884
  },
7475
7885
  {
7476
7886
  "operationId": "user.revokeToken",
@@ -7484,12 +7894,13 @@ var OPERATIONS = [
7484
7894
  },
7485
7895
  "mcp": {
7486
7896
  "exposed": false,
7487
- "reason": "Revokes a person's own credential; agents connect through OAuth, not personal tokens."
7897
+ "reason": "Revokes a person's own credential. Agents connect through OAuth and never use personal tokens."
7488
7898
  },
7489
- "description": "Revokes the personal access token used to call it \u2014 signing out from a script or the CLI (`logout`). The token stops working immediately; other tokens are untouched.",
7899
+ "description": "Revokes the personal access token that makes the request. Use it to sign out from a script or the CLI (`logout`). The token stops working immediately. Your other tokens keep working.",
7490
7900
  "fields": [],
7491
7901
  "hasBody": false,
7492
- "workspace": false
7902
+ "workspace": false,
7903
+ "acceptsApiKey": false
7493
7904
  },
7494
7905
  {
7495
7906
  "operationId": "workspace.approvalActions.list",
@@ -7510,10 +7921,11 @@ var OPERATIONS = [
7510
7921
  "idempotentHint": true
7511
7922
  }
7512
7923
  },
7513
- "description": "Actions a credential may not take itself but may ASK a person to approve: each one's input (JSON Schema), who can approve it, and whether it creates a secret.",
7924
+ "description": "Lists the actions a credential can't take itself but can ask a person to approve. Each action comes with its input as a JSON Schema, who can approve it and whether it creates a secret.",
7514
7925
  "fields": [],
7515
7926
  "hasBody": false,
7516
7927
  "workspace": true,
7928
+ "acceptsApiKey": true,
7517
7929
  "scope": "workspace.approvals:read"
7518
7930
  },
7519
7931
  {
@@ -7535,7 +7947,7 @@ var OPERATIONS = [
7535
7947
  "idempotentHint": false
7536
7948
  }
7537
7949
  },
7538
- "description": "Files a request for an action you may not take yourself (see approval-actions) and notifies everyone who can approve it. Show the person `approveUrl` and why you need it; then check the request until it is decided (it expires after 24 hours). A personal access token or an app a person connected may ask \u2014 not a workspace API key.",
7950
+ "description": "Creates a request for an action you can't take yourself and notifies everyone who can approve it. The actions you can ask for are in approval-actions. Show the person `approveUrl` and why you need the action. Then check the request until a person decides. A request expires after 24 hours. A personal access token or an app a person connected can ask. A workspace API key can't.",
7539
7951
  "fields": [
7540
7952
  {
7541
7953
  "name": "action",
@@ -7554,7 +7966,7 @@ var OPERATIONS = [
7554
7966
  "in": "body",
7555
7967
  "type": "json",
7556
7968
  "required": true,
7557
- "description": "The action's input, per its JSON Schema.",
7969
+ "description": "The action's input. It must match the action's JSON Schema.",
7558
7970
  "example": {
7559
7971
  "name": "acme-web",
7560
7972
  "scopes": [
@@ -7564,7 +7976,7 @@ var OPERATIONS = [
7564
7976
  "schema": {
7565
7977
  "type": "object",
7566
7978
  "additionalProperties": {},
7567
- "description": "The action's input, per its JSON Schema."
7979
+ "description": "The action's input. It must match the action's JSON Schema."
7568
7980
  }
7569
7981
  },
7570
7982
  {
@@ -7572,17 +7984,19 @@ var OPERATIONS = [
7572
7984
  "in": "body",
7573
7985
  "type": "string",
7574
7986
  "required": true,
7575
- "description": "Why \u2014 the person reads it before deciding.",
7987
+ "description": "Why you need the action. The person reads it before deciding.",
7988
+ "example": "A key for the deploy pipeline.",
7576
7989
  "schema": {
7577
7990
  "type": "string",
7578
7991
  "minLength": 1,
7579
7992
  "maxLength": 500,
7580
- "description": "Why \u2014 the person reads it before deciding."
7993
+ "description": "Why you need the action. The person reads it before deciding."
7581
7994
  }
7582
7995
  }
7583
7996
  ],
7584
7997
  "hasBody": true,
7585
7998
  "workspace": true,
7999
+ "acceptsApiKey": false,
7586
8000
  "scope": "workspace.approvals:write"
7587
8001
  },
7588
8002
  {
@@ -7606,7 +8020,7 @@ var OPERATIONS = [
7606
8020
  "idempotentHint": true
7607
8021
  }
7608
8022
  },
7609
- "description": "The request you filed: pending, denied, completed (the action ran \u2014 see `result`), approved (waiting for the CLI to redeem it), failed or expired.",
8023
+ "description": "Returns an approval request you created, with its status. A `pending` request is waiting for a person to decide. A `completed` request's action ran, and `result` holds the outcome. An `approved` request is waiting for the CLI to redeem it. A request can also be `denied`, `failed` or `expired`.",
7610
8024
  "fields": [
7611
8025
  {
7612
8026
  "name": "requestId",
@@ -7614,6 +8028,7 @@ var OPERATIONS = [
7614
8028
  "type": "string",
7615
8029
  "required": true,
7616
8030
  "description": "The request's id.",
8031
+ "example": "apr_7c2e\u2026",
7617
8032
  "schema": {
7618
8033
  "type": "string",
7619
8034
  "description": "The request's id."
@@ -7622,6 +8037,7 @@ var OPERATIONS = [
7622
8037
  ],
7623
8038
  "hasBody": false,
7624
8039
  "workspace": true,
8040
+ "acceptsApiKey": true,
7625
8041
  "scope": "workspace.approvals:read"
7626
8042
  },
7627
8043
  {
@@ -7638,9 +8054,9 @@ var OPERATIONS = [
7638
8054
  },
7639
8055
  "mcp": {
7640
8056
  "exposed": false,
7641
- "reason": "Returns a secret; secrets never enter an agent's conversation \u2014 the CLI writes them to a file."
8057
+ "reason": "Returns a secret. Secrets never enter an agent's conversation. The CLI writes them to a file instead."
7642
8058
  },
7643
- "description": "Runs an approved, secret-producing action ONCE and returns its secret \u2014 to the personal access token that asked, only. The CLI writes it to a file without printing it.",
8059
+ "description": "Runs an approved action that creates a secret, and returns the secret. The action runs only once. Only the personal access token that asked can redeem it. The CLI writes the secret to a file without printing it.",
7644
8060
  "fields": [
7645
8061
  {
7646
8062
  "name": "requestId",
@@ -7648,6 +8064,7 @@ var OPERATIONS = [
7648
8064
  "type": "string",
7649
8065
  "required": true,
7650
8066
  "description": "The request's id.",
8067
+ "example": "apr_7c2e\u2026",
7651
8068
  "schema": {
7652
8069
  "type": "string",
7653
8070
  "description": "The request's id."
@@ -7656,6 +8073,7 @@ var OPERATIONS = [
7656
8073
  ],
7657
8074
  "hasBody": false,
7658
8075
  "workspace": true,
8076
+ "acceptsApiKey": false,
7659
8077
  "scope": "workspace.approvals:write"
7660
8078
  },
7661
8079
  {
@@ -7677,7 +8095,7 @@ var OPERATIONS = [
7677
8095
  "idempotentHint": true
7678
8096
  }
7679
8097
  },
7680
- "description": "The workspace's audit trail, newest first. Paginate with the opaque `nextCursor` token; `limit` is clamped to 1\u2013100 (default 25). Owner-only for personal access tokens, like the audit page in the application; a Workspace API key is its workspace and always passes.",
8098
+ "description": "Lists the workspace's audit events, newest first. Paginate with the opaque `nextCursor` token. `limit` takes 1 to 100 and defaults to 25. `before` starts from a moment. `action` keeps one kind of event, and `actor` what one person, key or token did. With a personal access token, only workspace owners can call this, as with the audit page in the app. A workspace API key always can, because it acts as the workspace itself.",
7681
8099
  "fields": [
7682
8100
  {
7683
8101
  "name": "limit",
@@ -7704,10 +8122,50 @@ var OPERATIONS = [
7704
8122
  "type": "string",
7705
8123
  "description": "Opaque token from a previous page's nextCursor."
7706
8124
  }
8125
+ },
8126
+ {
8127
+ "name": "before",
8128
+ "in": "query",
8129
+ "type": "string",
8130
+ "required": false,
8131
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on.",
8132
+ "example": "2026-11-01T00:00:00.000Z",
8133
+ "schema": {
8134
+ "type": "string",
8135
+ "format": "date-time",
8136
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on."
8137
+ }
8138
+ },
8139
+ {
8140
+ "name": "action",
8141
+ "in": "query",
8142
+ "type": "string",
8143
+ "required": false,
8144
+ "description": "Only events of this action.",
8145
+ "example": "workspace.member_invited",
8146
+ "schema": {
8147
+ "type": "string",
8148
+ "maxLength": 100,
8149
+ "description": "Only events of this action."
8150
+ }
8151
+ },
8152
+ {
8153
+ "name": "actor",
8154
+ "in": "query",
8155
+ "type": "string",
8156
+ "required": false,
8157
+ "description": "Only what one person did (`user:` and the item's `actor.id`), or one key or token (`credential:` and the item's `credential.id`).",
8158
+ "example": "user:usr_k3TAiF2ZP5sQ",
8159
+ "schema": {
8160
+ "type": "string",
8161
+ "pattern": "^(user|credential):[\\w-]+$",
8162
+ "description": "Only what one person did (`user:` and the item's `actor.id`), or one key or token (`credential:` and the item's `credential.id`)."
8163
+ }
7707
8164
  }
7708
8165
  ],
7709
8166
  "hasBody": false,
7710
8167
  "workspace": true,
8168
+ "acceptsApiKey": true,
7711
8169
  "scope": "workspace.audit:read"
7712
8170
  },
7713
8171
  {
@@ -7729,10 +8187,11 @@ var OPERATIONS = [
7729
8187
  "idempotentHint": true
7730
8188
  }
7731
8189
  },
7732
- "description": "Every workspace event a webhook endpoint can subscribe to, with what it means. Pass some as `eventTypes` when adding an endpoint; an endpoint without a list receives them all.",
8190
+ "description": "Lists every workspace event a webhook endpoint can subscribe to, and what each one means. Pass some as `eventTypes` when you add an endpoint. An endpoint without a list receives every event.",
7733
8191
  "fields": [],
7734
8192
  "hasBody": false,
7735
8193
  "workspace": true,
8194
+ "acceptsApiKey": true,
7736
8195
  "scope": "workspace.webhooks:read"
7737
8196
  },
7738
8197
  {
@@ -7754,10 +8213,11 @@ var OPERATIONS = [
7754
8213
  "idempotentHint": true
7755
8214
  }
7756
8215
  },
7757
- "description": `Returns the Workspace the credential acts in \u2014 the API key's own, or the one named by X-Workspace for a personal access token. Useful as an integration smoke test ("who am I?").`,
8216
+ "description": 'Returns the workspace the credential acts in. For an API key, that is the key\'s own workspace. For a personal access token, it is the one named in `X-Workspace`. Use it as a smoke test for an integration ("who am I?").',
7758
8217
  "fields": [],
7759
8218
  "hasBody": false,
7760
8219
  "workspace": true,
8220
+ "acceptsApiKey": true,
7761
8221
  "scope": "workspace:read"
7762
8222
  },
7763
8223
  {
@@ -7779,7 +8239,7 @@ var OPERATIONS = [
7779
8239
  "idempotentHint": true
7780
8240
  }
7781
8241
  },
7782
- "description": "Invitations sent and not yet accepted, declined or expired, newest first. Owners and admins only for a personal credential, as in the app. Paginate with the opaque `nextCursor`.",
8242
+ "description": "Lists the invitations that are not yet accepted, declined or expired, newest first. With a personal credential, only owners and admins can call this, as in the app. A workspace API key always can. Paginate with the opaque `nextCursor`.",
7783
8243
  "fields": [
7784
8244
  {
7785
8245
  "name": "limit",
@@ -7810,6 +8270,7 @@ var OPERATIONS = [
7810
8270
  ],
7811
8271
  "hasBody": false,
7812
8272
  "workspace": true,
8273
+ "acceptsApiKey": true,
7813
8274
  "scope": "workspace.members:read"
7814
8275
  },
7815
8276
  {
@@ -7831,7 +8292,7 @@ var OPERATIONS = [
7831
8292
  "idempotentHint": true
7832
8293
  }
7833
8294
  },
7834
- "description": "The workspace's members with their roles, newest first. Paginate with the opaque `nextCursor`; `limit` is clamped to 1\u2013100 (default 25). Members are invited, removed and given roles in the app.",
8295
+ "description": "Lists the workspace's members and their roles, newest first. Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Invite members, remove them and give them roles in the app.",
7835
8296
  "fields": [
7836
8297
  {
7837
8298
  "name": "limit",
@@ -7862,6 +8323,7 @@ var OPERATIONS = [
7862
8323
  ],
7863
8324
  "hasBody": false,
7864
8325
  "workspace": true,
8326
+ "acceptsApiKey": true,
7865
8327
  "scope": "workspace.members:read"
7866
8328
  },
7867
8329
  {
@@ -7883,7 +8345,7 @@ var OPERATIONS = [
7883
8345
  "idempotentHint": true
7884
8346
  }
7885
8347
  },
7886
- "description": "The workspace's teams with their members' user ids, newest first. Paginate with the opaque `nextCursor`; `limit` is clamped to 1\u2013100 (default 25). Teams are created and staffed in the app.",
8348
+ "description": "Lists the workspace's teams and their members' user ids, newest first. Paginate with the opaque `nextCursor`. `limit` takes 1 to 100 and defaults to 25. Create teams and add members to them in the app.",
7887
8349
  "fields": [
7888
8350
  {
7889
8351
  "name": "limit",
@@ -7914,6 +8376,7 @@ var OPERATIONS = [
7914
8376
  ],
7915
8377
  "hasBody": false,
7916
8378
  "workspace": true,
8379
+ "acceptsApiKey": true,
7917
8380
  "scope": "workspace.teams:read"
7918
8381
  },
7919
8382
  {
@@ -7935,10 +8398,11 @@ var OPERATIONS = [
7935
8398
  "idempotentHint": true
7936
8399
  }
7937
8400
  },
7938
- "description": "How much of each meter the workspace used this period, with the plan's limit for it (null = unlimited). A period is a month from the workspace's billing date: its subscription's (an annual plan refills monthly from its start), else the day the workspace was created.",
8401
+ "description": "Returns what the workspace used this period, with one entry for each thing its plan counts. Each entry has the plan's limit, or null when there is no limit. A period is one month from the workspace's billing date. That date comes from its subscription or, without one, from the day you created the workspace. On an annual plan, the counts still reset every month from the subscription's start.",
7939
8402
  "fields": [],
7940
8403
  "hasBody": false,
7941
8404
  "workspace": true,
8405
+ "acceptsApiKey": true,
7942
8406
  "scope": "workspace:read"
7943
8407
  },
7944
8408
  {
@@ -7962,16 +8426,18 @@ var OPERATIONS = [
7962
8426
  "idempotentHint": true
7963
8427
  }
7964
8428
  },
7965
- "description": "Delivery history for one endpoint, newest first: each event's status, attempts and last HTTP status (payloads are not returned). Kept for 30 days. Paginate with the opaque `nextCursor`.",
8429
+ "description": "Lists one endpoint's delivery history, newest first. Each entry shows the event's status, attempts and last HTTP status. Payloads aren't included. We keep the history for 30 days. Paginate with the opaque `nextCursor`. `before` starts from a moment, and `status` keeps one kind of delivery. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
7966
8430
  "fields": [
7967
8431
  {
7968
8432
  "name": "endpointId",
7969
8433
  "in": "path",
7970
8434
  "type": "string",
7971
8435
  "required": true,
8436
+ "description": "The endpoint's ID.",
7972
8437
  "example": "we_3f0c\u2026",
7973
8438
  "schema": {
7974
- "type": "string"
8439
+ "type": "string",
8440
+ "description": "The endpoint's ID."
7975
8441
  }
7976
8442
  },
7977
8443
  {
@@ -7999,10 +8465,41 @@ var OPERATIONS = [
7999
8465
  "type": "string",
8000
8466
  "description": "Opaque token from a previous page's nextCursor."
8001
8467
  }
8468
+ },
8469
+ {
8470
+ "name": "before",
8471
+ "in": "query",
8472
+ "type": "string",
8473
+ "required": false,
8474
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on.",
8475
+ "example": "2026-11-01T00:00:00.000Z",
8476
+ "schema": {
8477
+ "type": "string",
8478
+ "format": "date-time",
8479
+ "description": "Start from this moment: items older than it, newest first. Ignored with `cursor`, which already says where to go on."
8480
+ }
8481
+ },
8482
+ {
8483
+ "name": "status",
8484
+ "in": "query",
8485
+ "type": "string",
8486
+ "required": false,
8487
+ "description": "Only deliveries with this status.",
8488
+ "example": "failed",
8489
+ "schema": {
8490
+ "type": "string",
8491
+ "enum": [
8492
+ "pending",
8493
+ "delivered",
8494
+ "failed"
8495
+ ],
8496
+ "description": "Only deliveries with this status."
8497
+ }
8002
8498
  }
8003
8499
  ],
8004
8500
  "hasBody": false,
8005
8501
  "workspace": true,
8502
+ "acceptsApiKey": true,
8006
8503
  "scope": "workspace.webhooks:read"
8007
8504
  },
8008
8505
  {
@@ -8027,16 +8524,18 @@ var OPERATIONS = [
8027
8524
  "idempotentHint": false
8028
8525
  }
8029
8526
  },
8030
- "description": "Sends a recorded delivery's event again, as a new delivery with its own history entry; the event id is unchanged, so receivers can deduplicate. The endpoint must be enabled.",
8527
+ "description": "Sends a recorded delivery's event again, as a new delivery. The new delivery gets its own history entry. The event id stays the same, so receivers can deduplicate. Redelivery only works on an enabled endpoint. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8031
8528
  "fields": [
8032
8529
  {
8033
8530
  "name": "endpointId",
8034
8531
  "in": "path",
8035
8532
  "type": "string",
8036
8533
  "required": true,
8534
+ "description": "The endpoint's ID.",
8037
8535
  "example": "we_3f0c\u2026",
8038
8536
  "schema": {
8039
- "type": "string"
8537
+ "type": "string",
8538
+ "description": "The endpoint's ID."
8040
8539
  }
8041
8540
  },
8042
8541
  {
@@ -8044,14 +8543,17 @@ var OPERATIONS = [
8044
8543
  "in": "path",
8045
8544
  "type": "string",
8046
8545
  "required": true,
8546
+ "description": "The delivery's ID.",
8047
8547
  "example": "del_8a1b\u2026",
8048
8548
  "schema": {
8049
- "type": "string"
8549
+ "type": "string",
8550
+ "description": "The delivery's ID."
8050
8551
  }
8051
8552
  }
8052
8553
  ],
8053
8554
  "hasBody": false,
8054
8555
  "workspace": true,
8556
+ "acceptsApiKey": true,
8055
8557
  "scope": "workspace.webhooks:write"
8056
8558
  },
8057
8559
  {
@@ -8066,22 +8568,22 @@ var OPERATIONS = [
8066
8568
  },
8067
8569
  "mcp": {
8068
8570
  "exposed": false,
8069
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8571
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8070
8572
  },
8071
- "description": "Registers an https URL to receive the workspace's events, signed Svix-compatibly. The response carries the endpoint's signing secret (`whsec_\u2026`) \u2014 shown ONCE, store it to verify deliveries. Private and non-https hosts are refused; at most 10 per workspace.",
8573
+ "description": "Registers an HTTPS URL to receive the workspace's events. Deliveries use the same signature format as Svix. The response includes the endpoint's signing secret (`whsec_\u2026`). You see it only once, so store it to verify deliveries. The API refuses private hosts and hosts without HTTPS. A workspace can have at most 10 endpoints. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8072
8574
  "fields": [
8073
8575
  {
8074
8576
  "name": "url",
8075
8577
  "in": "body",
8076
8578
  "type": "string",
8077
8579
  "required": true,
8078
- "description": "The https URL that receives the events.",
8580
+ "description": "The HTTPS URL that receives the events.",
8079
8581
  "example": "https://example.com/hooks",
8080
8582
  "schema": {
8081
8583
  "type": "string",
8082
8584
  "minLength": 1,
8083
8585
  "maxLength": 2048,
8084
- "description": "The https URL that receives the events."
8586
+ "description": "The HTTPS URL that receives the events."
8085
8587
  }
8086
8588
  },
8087
8589
  {
@@ -8101,7 +8603,7 @@ var OPERATIONS = [
8101
8603
  "in": "body",
8102
8604
  "type": "json",
8103
8605
  "required": false,
8104
- "description": "Only these event types (see event-types); omit for every event.",
8606
+ "description": "Send only these event types, from event-types. Leave it out for every event.",
8105
8607
  "example": [
8106
8608
  "workspace.member.joined"
8107
8609
  ],
@@ -8111,12 +8613,13 @@ var OPERATIONS = [
8111
8613
  "type": "string"
8112
8614
  },
8113
8615
  "maxItems": 100,
8114
- "description": "Only these event types (see event-types); omit for every event."
8616
+ "description": "Send only these event types, from event-types. Leave it out for every event."
8115
8617
  }
8116
8618
  }
8117
8619
  ],
8118
8620
  "hasBody": true,
8119
8621
  "workspace": true,
8622
+ "acceptsApiKey": true,
8120
8623
  "scope": "workspace.webhooks:write"
8121
8624
  },
8122
8625
  {
@@ -8133,23 +8636,26 @@ var OPERATIONS = [
8133
8636
  },
8134
8637
  "mcp": {
8135
8638
  "exposed": false,
8136
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8639
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8137
8640
  },
8138
- "description": "Stops all deliveries to the endpoint and deletes it with its secret. Its delivery history goes with it.",
8641
+ "description": "Deletes the endpoint and its signing secret. All deliveries to the endpoint stop. Its delivery history goes with it. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8139
8642
  "fields": [
8140
8643
  {
8141
8644
  "name": "endpointId",
8142
8645
  "in": "path",
8143
8646
  "type": "string",
8144
8647
  "required": true,
8648
+ "description": "The endpoint's ID.",
8145
8649
  "example": "we_3f0c\u2026",
8146
8650
  "schema": {
8147
- "type": "string"
8651
+ "type": "string",
8652
+ "description": "The endpoint's ID."
8148
8653
  }
8149
8654
  }
8150
8655
  ],
8151
8656
  "hasBody": false,
8152
8657
  "workspace": true,
8658
+ "acceptsApiKey": true,
8153
8659
  "scope": "workspace.webhooks:write"
8154
8660
  },
8155
8661
  {
@@ -8166,23 +8672,26 @@ var OPERATIONS = [
8166
8672
  },
8167
8673
  "mcp": {
8168
8674
  "exposed": false,
8169
- "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Webhooks in the app)."
8675
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8170
8676
  },
8171
- "description": "Resumes deliveries to an endpoint that was disabled after repeated failures, keeping its signing secret; the failure count resets.",
8677
+ "description": "Resumes deliveries to an endpoint that stopped after repeated failures. The endpoint keeps its signing secret. Its failure count resets. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8172
8678
  "fields": [
8173
8679
  {
8174
8680
  "name": "endpointId",
8175
8681
  "in": "path",
8176
8682
  "type": "string",
8177
8683
  "required": true,
8684
+ "description": "The endpoint's ID.",
8178
8685
  "example": "we_3f0c\u2026",
8179
8686
  "schema": {
8180
- "type": "string"
8687
+ "type": "string",
8688
+ "description": "The endpoint's ID."
8181
8689
  }
8182
8690
  }
8183
8691
  ],
8184
8692
  "hasBody": false,
8185
8693
  "workspace": true,
8694
+ "acceptsApiKey": true,
8186
8695
  "scope": "workspace.webhooks:write"
8187
8696
  },
8188
8697
  {
@@ -8206,21 +8715,24 @@ var OPERATIONS = [
8206
8715
  "idempotentHint": true
8207
8716
  }
8208
8717
  },
8209
- "description": "One endpoint, without its signing secret: whether it is enabled, its consecutive failures and its last delivery status.",
8718
+ "description": "Returns one endpoint without its signing secret. It shows whether the endpoint is on, its consecutive failures and its last delivery status. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8210
8719
  "fields": [
8211
8720
  {
8212
8721
  "name": "endpointId",
8213
8722
  "in": "path",
8214
8723
  "type": "string",
8215
8724
  "required": true,
8725
+ "description": "The endpoint's ID.",
8216
8726
  "example": "we_3f0c\u2026",
8217
8727
  "schema": {
8218
- "type": "string"
8728
+ "type": "string",
8729
+ "description": "The endpoint's ID."
8219
8730
  }
8220
8731
  }
8221
8732
  ],
8222
8733
  "hasBody": false,
8223
8734
  "workspace": true,
8735
+ "acceptsApiKey": true,
8224
8736
  "scope": "workspace.webhooks:read"
8225
8737
  },
8226
8738
  {
@@ -8242,10 +8754,11 @@ var OPERATIONS = [
8242
8754
  "idempotentHint": true
8243
8755
  }
8244
8756
  },
8245
- "description": "The workspace's outgoing webhook endpoints, newest first, without their signing secrets. A workspace has at most 10, so the list is a single page (`nextCursor` is null).",
8757
+ "description": "Lists the workspace's outgoing webhook endpoints, newest first. The list leaves out their signing secrets. A workspace has at most 10 endpoints, so the list is a single page. Its `nextCursor` is null. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8246
8758
  "fields": [],
8247
8759
  "hasBody": false,
8248
8760
  "workspace": true,
8761
+ "acceptsApiKey": true,
8249
8762
  "scope": "workspace.webhooks:read"
8250
8763
  },
8251
8764
  {
@@ -8269,21 +8782,110 @@ var OPERATIONS = [
8269
8782
  "idempotentHint": false
8270
8783
  }
8271
8784
  },
8272
- "description": "Sends a `ping` event to the endpoint, signed like every delivery \u2014 the way to check an integration verifies and accepts deliveries.",
8785
+ "description": "Sends a `ping` event to the endpoint, signed like every delivery. Use it to check that an integration verifies and accepts deliveries. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8273
8786
  "fields": [
8274
8787
  {
8275
8788
  "name": "endpointId",
8276
8789
  "in": "path",
8277
8790
  "type": "string",
8278
8791
  "required": true,
8792
+ "description": "The endpoint's ID.",
8279
8793
  "example": "we_3f0c\u2026",
8280
8794
  "schema": {
8281
- "type": "string"
8795
+ "type": "string",
8796
+ "description": "The endpoint's ID."
8282
8797
  }
8283
8798
  }
8284
8799
  ],
8285
8800
  "hasBody": false,
8286
8801
  "workspace": true,
8802
+ "acceptsApiKey": true,
8803
+ "scope": "workspace.webhooks:write"
8804
+ },
8805
+ {
8806
+ "operationId": "workspace.webhookEndpoints.update",
8807
+ "method": "patch",
8808
+ "path": "/workspace/webhook-endpoints/{endpointId}",
8809
+ "summary": "Update a webhook endpoint",
8810
+ "cli": {
8811
+ "command": "workspace webhook-endpoints update",
8812
+ "args": [
8813
+ "endpointId"
8814
+ ],
8815
+ "confirm": false
8816
+ },
8817
+ "mcp": {
8818
+ "exposed": false,
8819
+ "reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
8820
+ },
8821
+ "description": "Changes an endpoint's URL, description or event types in place. Only the fields you send change. The endpoint keeps its signing secret, so receivers keep verifying deliveries. A new URL must pass the same checks as on create. It must use HTTPS and can't be a private host. With a personal access token, only the workspace owner can call this. A workspace API key with this scope can.",
8822
+ "fields": [
8823
+ {
8824
+ "name": "endpointId",
8825
+ "in": "path",
8826
+ "type": "string",
8827
+ "required": true,
8828
+ "description": "The endpoint's ID.",
8829
+ "example": "we_3f0c\u2026",
8830
+ "schema": {
8831
+ "type": "string",
8832
+ "description": "The endpoint's ID."
8833
+ }
8834
+ },
8835
+ {
8836
+ "name": "url",
8837
+ "in": "body",
8838
+ "type": "string",
8839
+ "required": false,
8840
+ "description": "The HTTPS URL that receives the events.",
8841
+ "example": "https://example.com/hooks",
8842
+ "schema": {
8843
+ "type": "string",
8844
+ "minLength": 1,
8845
+ "maxLength": 2048,
8846
+ "description": "The HTTPS URL that receives the events."
8847
+ }
8848
+ },
8849
+ {
8850
+ "name": "description",
8851
+ "in": "body",
8852
+ "type": "string",
8853
+ "required": false,
8854
+ "description": "A note for people managing the endpoint. Null clears it.",
8855
+ "schema": {
8856
+ "type": [
8857
+ "string",
8858
+ "null"
8859
+ ],
8860
+ "maxLength": 200,
8861
+ "description": "A note for people managing the endpoint. Null clears it."
8862
+ }
8863
+ },
8864
+ {
8865
+ "name": "eventTypes",
8866
+ "in": "body",
8867
+ "type": "json",
8868
+ "required": false,
8869
+ "description": "Send only these event types, from event-types. Null or an empty list means every event.",
8870
+ "example": [
8871
+ "workspace.member.joined"
8872
+ ],
8873
+ "schema": {
8874
+ "type": [
8875
+ "array",
8876
+ "null"
8877
+ ],
8878
+ "items": {
8879
+ "type": "string"
8880
+ },
8881
+ "maxItems": 100,
8882
+ "description": "Send only these event types, from event-types. Null or an empty list means every event."
8883
+ }
8884
+ }
8885
+ ],
8886
+ "hasBody": true,
8887
+ "workspace": true,
8888
+ "acceptsApiKey": true,
8287
8889
  "scope": "workspace.webhooks:write"
8288
8890
  }
8289
8891
  ];
@@ -8373,14 +8975,15 @@ ${op.description}`);
8373
8975
  if (op.workspace) {
8374
8976
  command.option("--workspace <slug>", "act in this workspace for one call");
8375
8977
  }
8376
- if (op.cli.confirm) command.option("--yes", "confirm \u2014 it cannot be undone");
8978
+ if (op.cli.confirm)
8979
+ command.option("--yes", "confirm an operation that cannot be undone");
8377
8980
  command.option("--json", "machine-readable output");
8378
8981
  command.action(async (...input) => {
8379
8982
  const values = input.slice(0, op.cli.args.length);
8380
8983
  const options = input[op.cli.args.length];
8381
8984
  if (op.cli.confirm && !options.yes) {
8382
8985
  throw new Error(
8383
- `${op.summary} cannot be undone \u2014 re-run with --yes to confirm`
8986
+ `${op.summary} cannot be undone. Run it again with --yes to confirm.`
8384
8987
  );
8385
8988
  }
8386
8989
  const args = Object.fromEntries(
@@ -8515,24 +9118,6 @@ function print(ctx, data, asJson) {
8515
9118
  // src/product/files.ts
8516
9119
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
8517
9120
  import { basename, dirname, join as join2, resolve, sep } from "node:path";
8518
- var TYPES = {
8519
- csv: "text/csv",
8520
- tsv: "text/tab-separated-values",
8521
- txt: "text/plain",
8522
- md: "text/markdown",
8523
- json: "application/json",
8524
- xml: "application/xml",
8525
- pdf: "application/pdf",
8526
- zip: "application/zip",
8527
- gz: "application/gzip",
8528
- ofx: "application/x-ofx",
8529
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
8530
- xls: "application/vnd.ms-excel",
8531
- png: "image/png",
8532
- jpg: "image/jpeg",
8533
- jpeg: "image/jpeg"
8534
- };
8535
- var typeOf = (path2) => TYPES[path2.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream";
8536
9121
  async function uploadPath(ctx, path2, workspace2) {
8537
9122
  let data;
8538
9123
  try {
@@ -8543,13 +9128,13 @@ async function uploadPath(ctx, path2, workspace2) {
8543
9128
  });
8544
9129
  }
8545
9130
  return uploadFile(ctx.client({ workspace: workspace2 }), {
9131
+ // No type: the API takes it from the name (one table for every client).
8546
9132
  name: basename(path2),
8547
- type: typeOf(path2),
8548
9133
  data: new Uint8Array(data)
8549
9134
  });
8550
9135
  }
8551
9136
  async function downloadBytes(ctx, id, workspace2) {
8552
- const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/content", {
9137
+ const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/download", {
8553
9138
  params: { path: { fileId: id } },
8554
9139
  parseAs: "arrayBuffer"
8555
9140
  });
@@ -8561,7 +9146,7 @@ async function downloadBytes(ctx, id, workspace2) {
8561
9146
  }
8562
9147
  return new Uint8Array(result.data);
8563
9148
  }
8564
- function outputPath(dir, name) {
9149
+ function localPath(dir, name) {
8565
9150
  const root = resolve(dir);
8566
9151
  const path2 = resolve(root, name);
8567
9152
  if (path2 !== root && !path2.startsWith(root + sep)) {
@@ -8569,10 +9154,10 @@ function outputPath(dir, name) {
8569
9154
  }
8570
9155
  return path2;
8571
9156
  }
8572
- async function saveOutputs(ctx, files, dir, workspace2) {
9157
+ async function downloadSavedFiles(ctx, files, dir, workspace2) {
8573
9158
  const saved = [];
8574
- for (const file of files.filter((f) => f.direction === "out")) {
8575
- const path2 = outputPath(dir, file.name);
9159
+ for (const file of files.filter((f) => f.origin === "saved")) {
9160
+ const path2 = localPath(dir, file.name);
8576
9161
  mkdirSync2(dirname(path2), { recursive: true });
8577
9162
  writeFileSync4(path2, await downloadBytes(ctx, file.id, workspace2));
8578
9163
  saved.push(path2);
@@ -8587,7 +9172,7 @@ var fileCommands = (program3, ctx) => {
8587
9172
  ctx.io.stdout(options.json ? json(file) : file.id);
8588
9173
  }
8589
9174
  );
8590
- group.command("download <file-id>").description("Save a file that a run took in or wrote").option("--out <path>", "where to save it").option("--workspace <slug>", "act in this workspace for one call").action(
9175
+ group.command("download <file-id>").description("Download a file that a run received or saved").option("--out <path>", "where to save it").option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the file and where it was saved").action(
8591
9176
  async (id, options) => {
8592
9177
  const client = ctx.client({ workspace: options.workspace });
8593
9178
  const meta = await client.GET("/files/{fileId}", {
@@ -8601,19 +9186,29 @@ var fileCommands = (program3, ctx) => {
8601
9186
  const path2 = options.out ?? join2(".", basename(meta.data.name) || meta.data.id);
8602
9187
  mkdirSync2(dirname(resolve(path2)), { recursive: true });
8603
9188
  writeFileSync4(path2, await downloadBytes(ctx, id, options.workspace));
8604
- ctx.io.stdout(`Saved ${path2}`);
9189
+ ctx.io.stdout(
9190
+ options.json ? json({ ...meta.data, path: path2 }) : `Downloaded ${path2}`
9191
+ );
8605
9192
  }
8606
9193
  );
8607
9194
  };
8608
- function describeOutputs(files) {
8609
- return files.filter((f) => f.direction === "out").map(
8610
- (f) => `Wrote ${f.name}: ${f.downloadUrl ?? `${brand.name} files download ${f.id}`}`
9195
+ function describeSavedFiles(files) {
9196
+ return files.filter((f) => f.origin === "saved").map(
9197
+ (f) => `Saved ${f.name}: ${f.downloadUrl ?? `${brand.name} files download ${f.id}`}`
8611
9198
  );
8612
9199
  }
8613
9200
 
8614
9201
  // src/product/scripts.ts
8615
9202
  import { spawnSync } from "node:child_process";
8616
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync5, statSync } from "node:fs";
9203
+ import {
9204
+ closeSync,
9205
+ existsSync as existsSync3,
9206
+ fstatSync,
9207
+ openSync,
9208
+ readdirSync,
9209
+ readFileSync as readFileSync5,
9210
+ statSync
9211
+ } from "node:fs";
8617
9212
  import { basename as basename2, join as join3, relative, resolve as resolve2 } from "node:path";
8618
9213
 
8619
9214
  // node_modules/smol-toml/dist/error.js
@@ -9586,9 +10181,41 @@ function withName(result, folder) {
9586
10181
  }
9587
10182
  };
9588
10183
  }
10184
+ function inputSchemaForCommand(command) {
10185
+ const optional2 = new Set(
10186
+ optionalGroups(command).flatMap(
10187
+ (group) => [...group.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10188
+ )
10189
+ );
10190
+ const names = [
10191
+ ...new Set(
10192
+ [...command.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10193
+ )
10194
+ ];
10195
+ return {
10196
+ type: "object",
10197
+ required: names.filter((name) => !optional2.has(name)),
10198
+ properties: Object.fromEntries(
10199
+ names.map((name) => [name, { type: "string" }])
10200
+ )
10201
+ };
10202
+ }
10203
+ function optionalGroups(command) {
10204
+ const groups = [];
10205
+ let from = 0;
10206
+ for (; ; ) {
10207
+ const open = command.indexOf("[", from);
10208
+ if (open === -1) break;
10209
+ const close = command.indexOf("]", open + 1);
10210
+ if (close === -1) break;
10211
+ groups.push(command.slice(open, close + 1));
10212
+ from = close + 1;
10213
+ }
10214
+ return groups;
10215
+ }
9589
10216
 
9590
10217
  // src/product/scripts.ts
9591
- var MAX_ARCHIVE_BYTES = 1e7;
10218
+ var MAX_SOURCE_BYTES = 1e7;
9592
10219
  function readReadme(dir) {
9593
10220
  for (const name of ["README.md", "readme.md", "Readme.md"]) {
9594
10221
  try {
@@ -9602,11 +10229,14 @@ function localFolder(dir, files) {
9602
10229
  return {
9603
10230
  files,
9604
10231
  read: (path2) => {
10232
+ let fd;
9605
10233
  try {
9606
- const full = join3(dir, path2);
9607
- return statSync(full).size <= 1e6 ? readFileSync5(full, "utf8") : null;
10234
+ fd = openSync(join3(dir, path2), "r");
10235
+ return fstatSync(fd).size <= 1e6 ? readFileSync5(fd, "utf8") : null;
9608
10236
  } catch {
9609
10237
  return null;
10238
+ } finally {
10239
+ if (fd !== void 0) closeSync(fd);
9610
10240
  }
9611
10241
  },
9612
10242
  executable: (path2) => {
@@ -9653,9 +10283,13 @@ function loadScriptDir(dir, flags = {}) {
9653
10283
  return {
9654
10284
  manifest,
9655
10285
  files,
9656
- archive: pack(dir, files),
10286
+ source: pack(dir, files),
9657
10287
  readme: readReadme(dir),
9658
- detected: command ? null : detected
10288
+ detected: command ? null : detected,
10289
+ explicit: {
10290
+ ...(given.name ?? flags.name) !== void 0 ? { name: given.name ?? flags.name } : {},
10291
+ ...given.description !== void 0 ? { description: given.description } : {}
10292
+ }
9659
10293
  };
9660
10294
  }
9661
10295
  var SKIPPED = /* @__PURE__ */ new Set([
@@ -9688,15 +10322,15 @@ function walk(root, dir) {
9688
10322
  }
9689
10323
  function pack(dir, files) {
9690
10324
  const size = files.reduce((sum, f) => sum + statSync(join3(dir, f)).size, 0);
9691
- if (size > MAX_ARCHIVE_BYTES * 5) {
10325
+ if (size > MAX_SOURCE_BYTES * 5) {
9692
10326
  throw new Error(
9693
- `The folder holds ${(size / 1e6).toFixed(1)} MB of files \u2014 leave out data and installed dependencies (they are installed at publish)`
10327
+ `The folder holds ${(size / 1e6).toFixed(1)} MB of files. Leave out data and installed dependencies, which Reminix installs at upload.`
9694
10328
  );
9695
10329
  }
9696
10330
  const tar = spawnSync("tar", ["-czf", "-", "--null", "-T", "-"], {
9697
10331
  cwd: dir,
9698
10332
  input: files.join("\0"),
9699
- maxBuffer: MAX_ARCHIVE_BYTES * 2,
10333
+ maxBuffer: MAX_SOURCE_BYTES * 2,
9700
10334
  // macOS: no AppleDouble (._*) files in the archive.
9701
10335
  env: { ...process.env, COPYFILE_DISABLE: "1" }
9702
10336
  });
@@ -9705,14 +10339,15 @@ function pack(dir, files) {
9705
10339
  `Could not pack the folder: ${tar.stderr?.toString().trim() || tar.error?.message}`
9706
10340
  );
9707
10341
  }
9708
- if (tar.stdout.length > MAX_ARCHIVE_BYTES) {
10342
+ if (tar.stdout.length > MAX_SOURCE_BYTES) {
9709
10343
  throw new Error(
9710
- `The packed folder is ${(tar.stdout.length / 1e6).toFixed(1)} MB \u2014 at most ${MAX_ARCHIVE_BYTES / 1e6} MB (leave out data and installed dependencies)`
10344
+ `The packed folder is ${(tar.stdout.length / 1e6).toFixed(1)} MB, and the limit is ${MAX_SOURCE_BYTES / 1e6} MB. Leave out data and installed dependencies.`
9711
10345
  );
9712
10346
  }
9713
10347
  return tar.stdout;
9714
10348
  }
9715
10349
  var POLL_MS2 = 2e3;
10350
+ var ENDED2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
9716
10351
  function isScript(dir) {
9717
10352
  return existsSync3(join3(dir, "reminix.json")) || detectScript(localFolder(dir, scriptFiles(dir))).ok;
9718
10353
  }
@@ -9753,103 +10388,88 @@ function describeDetected(manifest, detected) {
9753
10388
  if (command) lines.push(` command ${command}`);
9754
10389
  return lines.join("\n");
9755
10390
  }
9756
- async function publishFolder(ctx, dir, options) {
9757
- const { manifest, archive, readme, detected } = loadScriptDir(dir, options);
9758
- if (options.plan) {
10391
+ async function publishFolder(ctx, dir, options, mode) {
10392
+ const { manifest, source, explicit, detected } = loadScriptDir(dir, options);
10393
+ if (options.dryRun) {
9759
10394
  return {
9760
10395
  slug: manifest.slug,
9761
10396
  version: null,
9762
10397
  script: null,
9763
10398
  line: `${describeDetected(manifest, detected)}
9764
- Nothing was uploaded (--plan).`
10399
+ Nothing was uploaded (--dry-run).`
9765
10400
  };
9766
10401
  }
9767
10402
  const call3 = (method, path2, body) => rawRequest(ctx, { method, path: path2, body, workspace: options.workspace });
9768
10403
  const slug = encodeURIComponent(manifest.slug);
9769
10404
  if (options.number !== void 0) {
9770
- const number = Number(options.number);
9771
- if (!Number.isInteger(number) || number < 1) {
9772
- throw new Error("--number: a version number, like --number 3");
9773
- }
9774
- if (options.draft) {
9775
- throw new Error(
9776
- "--number publishes a version already uploaded; leave out --draft"
9777
- );
10405
+ const version2 = Number(options.number);
10406
+ if (!Number.isInteger(version2) || version2 < 1) {
10407
+ throw new Error("--number: a version's number, like --number 3");
9778
10408
  }
9779
10409
  const script2 = await call3(
9780
10410
  "POST",
9781
- `/v1/scripts/${slug}/versions/${number}/publish`
10411
+ `/v1/scripts/${slug}/versions/${version2}/publish`
9782
10412
  );
9783
10413
  const approveUrl2 = script2.approval?.approveUrl ?? null;
9784
10414
  return {
9785
10415
  slug: manifest.slug,
9786
- version: { number },
10416
+ version: { version: version2 },
9787
10417
  script: script2,
9788
- line: approveUrl2 ? `Publishing ${manifest.slug} version ${number} waits for a person's approval: ${approveUrl2}` : `Published ${manifest.slug} version ${number}.`
10418
+ line: approveUrl2 ? `Publishing ${manifest.slug} version ${version2} waits for a person's approval: ${approveUrl2}` : `Published ${manifest.slug} version ${version2}.`
9789
10419
  };
9790
10420
  }
9791
- try {
9792
- await call3("GET", `/v1/scripts/${slug}`);
9793
- } catch (error) {
9794
- if (error.status !== 404) throw error;
9795
- await call3("POST", "/v1/scripts", {
9796
- slug: manifest.slug,
9797
- name: manifest.name,
9798
- description: manifest.description
9799
- });
9800
- }
9801
10421
  const version = await call3("POST", `/v1/scripts/${slug}/versions`, {
9802
10422
  command: manifest.command,
9803
- build: manifest.build ?? null,
10423
+ install: manifest.install ?? null,
9804
10424
  inputSchema: manifest.inputSchema,
9805
10425
  outputSchema: manifest.outputSchema ?? null,
9806
10426
  hosts: manifest.hosts,
9807
10427
  secrets: manifest.secrets,
9808
- env: manifest.env,
10428
+ envVars: manifest.envVars,
9809
10429
  tags: manifest.tags,
9810
- timeout: manifest.timeout,
9811
- readme,
9812
- archive: archive.toString("base64"),
9813
- via: "cli"
10430
+ timeoutSeconds: manifest.timeoutSeconds,
10431
+ source: source.toString("base64"),
10432
+ via: "cli",
10433
+ create: true,
10434
+ ...explicit,
10435
+ publish: mode === "publish"
9814
10436
  });
9815
- let script = null;
9816
- let approveUrl = null;
9817
- if (!options.draft) {
9818
- script = await call3(
9819
- "POST",
9820
- `/v1/scripts/${slug}/versions/${version.number}/publish`
9821
- );
9822
- approveUrl = script.approval?.approveUrl ?? null;
9823
- }
9824
- const line = approveUrl ? `Uploaded ${manifest.slug} version ${version.number}; publishing waits for a person's approval: ${approveUrl}` : options.draft ? `Uploaded ${manifest.slug} version ${version.number} as a draft. Publish it in the app, or run \`${brand.name} publish\` again without --draft.` : `Published ${manifest.slug} version ${version.number}.`;
10437
+ const script = null;
10438
+ const approveUrl = version.approval?.approveUrl ?? null;
10439
+ const line = approveUrl ? `Uploaded ${manifest.slug} version ${version.version}; publishing waits for a person's approval: ${approveUrl}` : mode === "upload" ? `Uploaded ${manifest.slug} version ${version.version} as a draft. Test it with \`${brand.name} run ${manifest.slug} --number ${version.version}\`, then publish it in the app or with \`${brand.name} publish --number ${version.version}\`.` : `Published ${manifest.slug} version ${version.version}.`;
9825
10440
  const found = detected ? `${describeDetected(manifest, detected)}
9826
10441
  ` : "";
9827
10442
  return { slug: manifest.slug, version, script, line: `${found}${line}` };
9828
10443
  }
9829
- var definePublish = (command, ctx) => covers(
9830
- command,
9831
- "scripts.create",
9832
- "scriptVersions.create",
9833
- "scriptVersions.publish"
9834
- ).option(
9835
- "--draft",
9836
- "upload a draft to test and publish later (agents use it and ask a person)"
9837
- ).option(
9838
- "--number <n>",
9839
- "publish version n, already uploaded (the draft you tested), instead of uploading"
9840
- ).option(
10444
+ var definePublish = (mode) => (command, ctx) => defineFolderOptions(
10445
+ mode === "publish" ? covers(
10446
+ command,
10447
+ "scripts.create",
10448
+ "scriptVersions.upload",
10449
+ "scriptVersions.publish"
10450
+ ).option(
10451
+ "--number <n>",
10452
+ "publish version n, already uploaded (the draft you tested), instead of uploading (--version is the CLI's own)"
10453
+ ) : covers(command, "scripts.create", "scriptVersions.upload"),
10454
+ ctx,
10455
+ mode
10456
+ );
10457
+ var defineFolderOptions = (command, ctx, mode) => command.option(
9841
10458
  "--command <line>",
9842
10459
  `how it runs, when the folder doesn't say: "python report.py {month}"`
9843
10460
  ).option("--name <name>", "the name people see (default: from the folder)").option(
9844
10461
  "--slug <slug>",
9845
10462
  "its id in URLs and commands (default: from the folder)"
9846
- ).option("--plan", "show what would be published, and upload nothing").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").addHelpText(
10463
+ ).option(
10464
+ "--dry-run",
10465
+ `show what would be ${mode === "publish" ? "published" : "uploaded"}, and upload nothing`
10466
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").addHelpText(
9847
10467
  "after",
9848
10468
  `
9849
- Publishes the folder as it is: it says how it runs (pyproject.toml, package.json,
10469
+ ${mode === "publish" ? "Publishes" : "Uploads"} the folder as it is: it says how it runs (pyproject.toml, package.json,
9850
10470
  or its one .py, .js, .ts or .sh file). Customize it with a reminix.json.
9851
- Several folders publish one after another; a folder of scripts publishes each
9852
- subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
10471
+ Several folders go one after another; a folder of scripts does each
10472
+ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
9853
10473
  ).action(
9854
10474
  async (dirs, options) => {
9855
10475
  const { folders, missing, skipped: skipped2 } = scriptFolders(dirs);
@@ -9860,7 +10480,7 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9860
10480
  throw new Error("--number publishes one script: name one folder");
9861
10481
  }
9862
10482
  if (folders.length === 1 && missing.length === 0) {
9863
- const result = await publishFolder(ctx, folders[0], options);
10483
+ const result = await publishFolder(ctx, folders[0], options, mode);
9864
10484
  ctx.io.stdout(
9865
10485
  options.json ? json({ version: result.version, script: result.script }) : result.line
9866
10486
  );
@@ -9878,7 +10498,7 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9878
10498
  }
9879
10499
  for (const dir of folders) {
9880
10500
  try {
9881
- const result = await publishFolder(ctx, dir, options);
10501
+ const result = await publishFolder(ctx, dir, options, mode);
9882
10502
  results.push({
9883
10503
  dir,
9884
10504
  version: result.version,
@@ -9897,18 +10517,21 @@ subfolder that is one: \`${brand.name} publish scripts/\` publishes them all.`
9897
10517
  }
9898
10518
  }
9899
10519
  );
9900
- var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.run").option("--input <json>", "the inputs, as a JSON object", "{}").option(
10520
+ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.testRun").option("--input <json>", "the inputs, as a JSON object", "{}").option(
9901
10521
  "--file <input=path>",
9902
10522
  "upload a file as a file input (repeat it for several)",
9903
10523
  (value, all) => [...all, value],
9904
10524
  []
9905
10525
  ).option(
9906
10526
  "--out <dir>",
9907
- "save the files the run writes here (else their links are printed)"
10527
+ "download the files the run saves into this folder (else their links are printed)"
9908
10528
  ).option(
9909
- "--version <n>",
9910
- "test-run this version (a draft) instead of the published one"
9911
- ).option("--log", "also print what the run logged (to stderr)").option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
10529
+ "--number <n>",
10530
+ "test-run version n (a draft) instead of the published one (--version is the CLI's own)"
10531
+ ).option("--log", "also print what the run logged (to stderr)").option(
10532
+ "--no-wait",
10533
+ "answer at once with a run awaiting approval or still running, instead of following it"
10534
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
9912
10535
  async (slug, options) => {
9913
10536
  let inputs;
9914
10537
  try {
@@ -9942,44 +10565,45 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
9942
10565
  spec.slice(at + 1)
9943
10566
  ]);
9944
10567
  }
9945
- const script = await call3(
9946
- "GET",
9947
- `/v1/scripts/${encodeURIComponent(slug)}`
9948
- );
9949
- const properties = script.inputSchema?.properties ?? {};
9950
10568
  for (const [name, paths] of byInput) {
9951
10569
  const ids = [];
9952
10570
  for (const path2 of paths) {
9953
10571
  ids.push((await uploadPath(ctx, path2, options.workspace)).id);
9954
10572
  }
9955
- inputs[name] = properties[name]?.type === "array" || ids.length > 1 ? ids : ids[0];
10573
+ inputs[name] = ids.length > 1 ? ids : ids[0];
9956
10574
  }
9957
10575
  }
9958
- if (options.version !== void 0 && !/^[1-9]\d*$/.test(options.version)) {
9959
- throw new Error("--version: a version number, e.g. 2");
10576
+ if (options.number !== void 0 && !/^[1-9]\d*$/.test(options.number)) {
10577
+ throw new Error("--number: a version's number, like --number 2");
9960
10578
  }
9961
10579
  let run3 = await call3(
9962
10580
  "POST",
9963
- options.version === void 0 ? `/v1/scripts/${encodeURIComponent(slug)}/runs` : `/v1/scripts/${encodeURIComponent(slug)}/versions/${options.version}/runs`,
10581
+ options.number === void 0 ? `/v1/scripts/${encodeURIComponent(slug)}/runs` : `/v1/scripts/${encodeURIComponent(slug)}/versions/${options.number}/runs`,
9964
10582
  { inputs, via: "cli" }
9965
10583
  );
9966
- if (run3.status === "awaiting_approval") {
10584
+ if (!options.wait && !ENDED2.has(run3.status)) {
9967
10585
  ctx.io.stdout(
9968
- options.json ? json(run3) : `Waiting for a person's approval (run ${run3.id}): ${run3.approval?.approveUrl ?? "see Approvals in the app"}`
10586
+ options.json ? json(run3) : `Run ${run3.id} is ${run3.status}.`
9969
10587
  );
9970
10588
  return;
9971
10589
  }
10590
+ const approveUrl = run3.approval?.approveUrl;
10591
+ if (run3.status === "awaiting_approval") {
10592
+ ctx.io.stderr(
10593
+ `Waiting for a person's approval (run ${run3.id}): ${approveUrl ?? "see Approvals in the app"}`
10594
+ );
10595
+ }
9972
10596
  let printed = 0;
9973
10597
  const printLog = async () => {
9974
- if (!options.log) return;
10598
+ if (!options.log || run3.status === "awaiting_approval") return;
9975
10599
  const { lines } = await call3(
9976
10600
  "GET",
9977
- `/v1/runs/${encodeURIComponent(run3.id)}/logs`
10601
+ `/v1/runs/${encodeURIComponent(run3.id)}/log`
9978
10602
  );
9979
10603
  for (const line of lines.slice(printed)) ctx.io.stderr(line);
9980
10604
  printed = Math.max(printed, lines.length);
9981
10605
  };
9982
- while (run3.status === "running") {
10606
+ while (!ENDED2.has(run3.status)) {
9983
10607
  await printLog();
9984
10608
  await new Promise((resolve4) => setTimeout(resolve4, POLL_MS2));
9985
10609
  run3 = await call3(
@@ -9990,111 +10614,123 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
9990
10614
  await printLog();
9991
10615
  const files = run3.files ?? [];
9992
10616
  if (options.out) {
9993
- for (const path2 of await saveOutputs(
10617
+ for (const path2 of await downloadSavedFiles(
9994
10618
  ctx,
9995
10619
  files,
9996
10620
  options.out,
9997
10621
  options.workspace
9998
10622
  )) {
9999
- ctx.io.stderr(`Saved ${path2}`);
10623
+ ctx.io.stderr(`Downloaded ${path2}`);
10000
10624
  }
10001
10625
  } else {
10002
- for (const line of describeOutputs(files)) ctx.io.stderr(line);
10626
+ for (const line of describeSavedFiles(files)) ctx.io.stderr(line);
10003
10627
  }
10004
10628
  if (options.json) {
10005
10629
  ctx.io.stdout(json(run3));
10006
10630
  } else if (run3.status === "succeeded") {
10007
- ctx.io.stdout(json(run3.output));
10631
+ ctx.io.stdout(
10632
+ typeof run3.output === "string" ? run3.output : json(run3.output)
10633
+ );
10634
+ }
10635
+ if (run3.status === "cancelled") {
10636
+ throw new Error(
10637
+ `The run was cancelled (${run3.id}): ${run3.error ?? "no reason given"}`
10638
+ );
10008
10639
  }
10009
10640
  if (run3.status !== "succeeded") {
10010
- throw new Error(`The run failed (${run3.id}): ${run3.error}`);
10641
+ throw new Error(
10642
+ `The run failed (${run3.id}): ${run3.error ?? "no error message"}`
10643
+ );
10011
10644
  }
10012
10645
  }
10013
10646
  );
10014
10647
  var scriptCommands = (program3, ctx) => {
10015
10648
  const group = program3.commands.find((c) => c.name() === "scripts") ?? program3.command("scripts").description("scripts commands");
10016
- definePublish(group.command("publish [dir...]"), ctx).description(
10017
- `Upload a folder's script and publish it (--draft to test first; shortcut: ${brand.name} publish)`
10649
+ definePublish("publish")(group.command("publish [dir...]"), ctx).description(
10650
+ `Upload a folder's script and publish it, so runs use that version. Shortcut: ${brand.name} publish`
10651
+ );
10652
+ definePublish("publish")(
10653
+ program3.command("publish [dir...]"),
10654
+ ctx
10655
+ ).description(
10656
+ `Upload a folder's script and publish it. Short for ${brand.name} scripts publish`
10657
+ );
10658
+ definePublish("upload")(group.command("upload [dir...]"), ctx).description(
10659
+ `Upload a folder's script as a draft version, to test before publishing (shortcut: ${brand.name} upload)`
10018
10660
  );
10019
- definePublish(program3.command("publish [dir...]"), ctx).description(
10020
- `Short for ${brand.name} scripts publish: upload a folder's script and publish it (--draft to test first)`
10661
+ definePublish("upload")(program3.command("upload [dir...]"), ctx).description(
10662
+ `Upload a folder's script as a draft version. Short for ${brand.name} scripts upload`
10021
10663
  );
10022
10664
  defineRun(group.command("run <slug>"), ctx).description(
10023
- `Run a script and print its output (--version to test a draft; shortcut: ${brand.name} run)`
10665
+ `Run a script and print its output. Use --number to test a draft. Shortcut: ${brand.name} run`
10024
10666
  );
10025
10667
  defineRun(program3.command("run <slug>"), ctx).description(
10026
- `Short for ${brand.name} scripts run: run a script and print its output (--version to test a draft)`
10668
+ `Run a script and print its output. Use --number to test a draft. Short for ${brand.name} scripts run`
10027
10669
  );
10028
10670
  };
10029
10671
 
10030
10672
  // src/product/init.ts
10031
- import { existsSync as existsSync4, readdirSync as readdirSync2, writeFileSync as writeFileSync5 } from "node:fs";
10032
- import { basename as basename3, extname, join as join4, resolve as resolve3 } from "node:path";
10033
- function slugFrom(name) {
10034
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^[^a-z]+/, "").replace(/-+$/, "").slice(0, 64).replace(/-+$/, "");
10035
- return slug.length >= 2 ? slug : "my-script";
10036
- }
10037
- var titleFrom = (slug) => slug.split("-").filter(Boolean).map((w, i) => i === 0 ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
10038
- function programFor(file) {
10039
- const ext = extname(file).toLowerCase();
10040
- if (ext === ".py") return "python";
10041
- if ([".js", ".mjs", ".cjs", ".ts", ".mts"].includes(ext)) return "node";
10042
- if (ext === ".sh") return "sh";
10043
- if (ext === "") return `./${file}`;
10044
- throw new Error(
10045
- `${file}: say how to run it, like: ${brand.name} init "python ${file} --month {month}"`
10046
- );
10047
- }
10048
- var SCRIPT_FILE = /\.(py|sh|js|mjs|cjs|ts|mts)$/i;
10049
- var NOT_A_SCRIPT2 = /(\.config\.|^setup\.py$|^conftest\.py$|\.d\.ts$)/i;
10050
- function onlyScript(dir) {
10051
- const files = readdirSync2(dir).filter(
10052
- (f) => SCRIPT_FILE.test(f) && !NOT_A_SCRIPT2.test(f)
10053
- );
10054
- if (files.length !== 1) {
10673
+ import { closeSync as closeSync2, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
10674
+ import { basename as basename3, join as join4, resolve as resolve3 } from "node:path";
10675
+ var INIT_HELP = `Say which file and how it runs, like: ${brand.name} init "python report.py --month {month}"`;
10676
+ function commandFor(dir, given) {
10677
+ const line = given?.trim();
10678
+ if (line && /\s|\{/.test(line)) return line;
10679
+ const folder = localFolder(dir, line ? [line] : scriptFiles(dir));
10680
+ const detection = detectScript(folder);
10681
+ if (!detection.ok) {
10055
10682
  throw new Error(
10056
- `${files.length === 0 ? "No script file here" : `Several script files here (${files.join(", ")})`} \u2014 say which and how it runs, like: ${brand.name} init "python report.py --month {month}"`
10683
+ `${detection.error.replace(/ Pass --command .*$/, "")} ${INIT_HELP}`
10057
10684
  );
10058
10685
  }
10059
- return files[0];
10060
- }
10061
- function commandFor(dir, given) {
10062
- const line = given?.trim() || onlyScript(dir);
10063
- return /\s|\{/.test(line) ? line : `${programFor(line)} ${line}`;
10686
+ return detection.value.command;
10064
10687
  }
10065
10688
  function inputSchemaFor(command) {
10066
- const optional2 = new Set(
10067
- [...command.matchAll(/\[[^\]]*\]/g)].flatMap(
10068
- (group) => [...group[0].matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10069
- )
10070
- );
10071
- const names = [
10072
- ...new Set(
10073
- [...command.matchAll(/\{([A-Za-z_][\w-]*)\}/g)].map((m) => m[1])
10074
- )
10075
- ];
10689
+ const schema = inputSchemaForCommand(command);
10076
10690
  return {
10077
- type: "object",
10078
- required: names.filter((name) => !optional2.has(name)),
10691
+ ...schema,
10079
10692
  properties: Object.fromEntries(
10080
- names.map((name) => [name, { type: "string", description: "" }])
10693
+ Object.entries(schema.properties).map(([name, property]) => [
10694
+ name,
10695
+ { ...property, description: "" }
10696
+ ])
10081
10697
  )
10082
10698
  };
10083
10699
  }
10700
+ function createNew(path2) {
10701
+ try {
10702
+ return openSync2(path2, "wx");
10703
+ } catch (error) {
10704
+ if (error.code === "EEXIST") return null;
10705
+ throw error;
10706
+ }
10707
+ }
10084
10708
  function scaffold(dir, given) {
10085
10709
  const manifest = join4(dir, "reminix.json");
10086
- if (existsSync4(manifest)) {
10087
- throw new Error(`${manifest} already exists`);
10710
+ const alreadyExists = () => new Error(`${manifest} already exists`);
10711
+ let command;
10712
+ try {
10713
+ command = commandFor(dir, given);
10714
+ } catch (error) {
10715
+ let probe;
10716
+ try {
10717
+ probe = createNew(manifest);
10718
+ } catch {
10719
+ throw error;
10720
+ }
10721
+ if (probe === null) throw alreadyExists();
10722
+ closeSync2(probe);
10723
+ unlinkSync(manifest);
10724
+ throw error;
10088
10725
  }
10089
- const command = commandFor(dir, given);
10090
- const slug = slugFrom(basename3(resolve3(dir)));
10091
- const created = [];
10092
- writeFileSync5(
10726
+ const detected = detectScript(localFolder(dir, scriptFiles(dir)));
10727
+ const slug = (detected.ok ? detected.value.slug : void 0) ?? slugOf(basename3(resolve3(dir))) ?? "my-script";
10728
+ writeNew(
10093
10729
  manifest,
10094
10730
  `${JSON.stringify(
10095
10731
  {
10096
10732
  slug,
10097
- name: titleFrom(slug),
10733
+ name: titleOf(slug),
10098
10734
  description: "",
10099
10735
  command,
10100
10736
  tags: [],
@@ -10104,21 +10740,30 @@ function scaffold(dir, given) {
10104
10740
  null,
10105
10741
  2
10106
10742
  )}
10107
- `
10743
+ `,
10744
+ alreadyExists
10108
10745
  );
10109
- created.push("reminix.json");
10110
- if (!existsSync4(join4(dir, "README.md"))) {
10111
- writeFileSync5(
10112
- join4(dir, "README.md"),
10113
- `# ${titleFrom(slug)}
10746
+ const created = ["reminix.json"];
10747
+ const readme = `# ${titleOf(slug)}
10114
10748
 
10115
10749
  What it does, when to use it, and what its inputs mean.
10116
- `
10117
- );
10118
- created.push("README.md");
10119
- }
10750
+ `;
10751
+ if (writeNew(join4(dir, "README.md"), readme)) created.push("README.md");
10120
10752
  return created;
10121
10753
  }
10754
+ function writeNew(path2, content, onExists) {
10755
+ const fd = createNew(path2);
10756
+ if (fd === null) {
10757
+ if (onExists) throw onExists();
10758
+ return false;
10759
+ }
10760
+ try {
10761
+ writeFileSync5(fd, content);
10762
+ } finally {
10763
+ closeSync2(fd);
10764
+ }
10765
+ return true;
10766
+ }
10122
10767
  var initCommand = (program3, ctx) => {
10123
10768
  program3.command("init [command]").description("Make the script in this folder a Reminix script").addHelpText(
10124
10769
  "after",
@@ -10137,7 +10782,10 @@ var secretCommands = (program3, ctx) => {
10137
10782
  group.command("set <name>").description("Save a secret's value, read from stdin").requiredOption(
10138
10783
  "--hosts <hosts>",
10139
10784
  "the hosts it may be sent to, comma-separated (e.g. api.stripe.com)"
10140
- ).option("--allow-env", "let scripts read the value itself (off by default)").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(
10785
+ ).option(
10786
+ "--allow-env-var",
10787
+ "let scripts read the value as an environment variable (off by default)"
10788
+ ).option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(
10141
10789
  async (name, options) => {
10142
10790
  const value = (await ctx.io.stdin()).replace(/\r?\n$/, "");
10143
10791
  if (!value) {
@@ -10151,7 +10799,7 @@ var secretCommands = (program3, ctx) => {
10151
10799
  body: {
10152
10800
  value,
10153
10801
  hosts: options.hosts.split(",").map((h) => h.trim()).filter(Boolean),
10154
- allowEnv: options.allowEnv ?? false
10802
+ allowEnvVar: options.allowEnvVar ?? false
10155
10803
  },
10156
10804
  workspace: options.workspace
10157
10805
  });
@@ -10182,7 +10830,7 @@ function tokenEnvVar() {
10182
10830
  function build(io) {
10183
10831
  let actedIn = null;
10184
10832
  let sending;
10185
- const program3 = new Command().name(brand.name).description(`${brand.productName} command line`).version("1.0.0-rc.1").addHelpText(
10833
+ const program3 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version("1.0.0-rc.10").addHelpText(
10186
10834
  "after",
10187
10835
  `
10188
10836
  Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
@@ -10206,7 +10854,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
10206
10854
  const settings = ctx.settings();
10207
10855
  if (!settings.token) {
10208
10856
  throw new Error(
10209
- `not logged in \u2014 run \`${brand.name} login\` or set ${tokenEnvVar()}`
10857
+ `not logged in. Run \`${brand.name} login\` or set ${tokenEnvVar()}.`
10210
10858
  );
10211
10859
  }
10212
10860
  if (!settings.token.startsWith("pat_")) {
@@ -10225,7 +10873,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
10225
10873
  const workspace2 = options.workspace === false ? void 0 : options.workspace ?? settings.workspace;
10226
10874
  if (options.workspace !== false && !workspace2) {
10227
10875
  throw new Error(
10228
- `no workspace selected \u2014 \`${brand.name} workspace use <slug>\` or pass --workspace <slug>`
10876
+ `no workspace selected. Run \`${brand.name} workspace use <slug>\` or pass --workspace <slug>.`
10229
10877
  );
10230
10878
  }
10231
10879
  return {