@reminix/cli 1.0.0-rc.12 → 1.0.0-rc.15
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/CHANGELOG.md +107 -270
- package/README.md +7 -3
- package/dist/reminix.mjs +1437 -392
- package/package.json +2 -2
package/dist/reminix.mjs
CHANGED
|
@@ -21,7 +21,18 @@ var brand_default = {
|
|
|
21
21
|
domain: "reminix.com",
|
|
22
22
|
devDomain: "reminix.dev",
|
|
23
23
|
labs: ["lab"],
|
|
24
|
+
statusPage: true,
|
|
24
25
|
discordInvite: "https://discord.gg/UU9NbEcNQj",
|
|
26
|
+
shortLinks: {
|
|
27
|
+
"/li": { source: "linkedin", medium: "social" },
|
|
28
|
+
"/yt": { source: "youtube", medium: "video" },
|
|
29
|
+
"/pycoders": { source: "pycoders", medium: "newsletter" },
|
|
30
|
+
"/nodeweekly": { source: "nodeweekly", medium: "newsletter" },
|
|
31
|
+
"/mcp": { source: "mcp-registry", medium: "directory" },
|
|
32
|
+
"/plugins": { source: "claude-plugins", medium: "directory" },
|
|
33
|
+
"/gh": { source: "github", medium: "referral" },
|
|
34
|
+
"/dc": { source: "discord", medium: "community" }
|
|
35
|
+
},
|
|
25
36
|
profiles: { x: "reminixhq", github: "reminixhq" },
|
|
26
37
|
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.",
|
|
27
38
|
expectedAssets: [
|
|
@@ -79,7 +90,12 @@ var brand_default = {
|
|
|
79
90
|
providerOrder: ["github", "google"],
|
|
80
91
|
emailSignUp: "button"
|
|
81
92
|
},
|
|
82
|
-
devPortOffset: 200
|
|
93
|
+
devPortOffset: 200,
|
|
94
|
+
appShortcuts: [
|
|
95
|
+
{ name: "Approvals", url: "/runs?status=awaiting_approval" },
|
|
96
|
+
{ name: "Notifications", url: "/account/notifications" }
|
|
97
|
+
],
|
|
98
|
+
tagline: "Internal tools from your scripts"
|
|
83
99
|
};
|
|
84
100
|
|
|
85
101
|
// src/brand/index.ts
|
|
@@ -141,10 +157,14 @@ var brand = {
|
|
|
141
157
|
].filter(Boolean),
|
|
142
158
|
/** One sentence: what the product is — llms.txt and the agent skill lead with it. */
|
|
143
159
|
summary: optional.summary ?? `${brand_default.productName} documentation and API.`,
|
|
160
|
+
/** A short line under the logo in the site's footer (the home page's headline); none without it. */
|
|
161
|
+
tagline: optional.tagline,
|
|
144
162
|
/** Where vulnerability reports go — /.well-known/security.txt and /security publish it. Defaults to security@<domain>. */
|
|
145
163
|
securityContact: optional.securityContact ?? `security@${brand_default.domain}`,
|
|
146
|
-
/**
|
|
164
|
+
/** Where the Contact form's help topics go (Question, Bug, Billing). Never shown on a page. Defaults to support@<domain>. */
|
|
147
165
|
supportContact: optional.supportContact ?? `support@${brand_default.domain}`,
|
|
166
|
+
/** Where the Contact form's other topics go (Sales and enterprise, Something else; owner, 2026-11-15). Never shown on a page. Defaults to contact@<domain>. */
|
|
167
|
+
contactContact: optional.contactContact ?? `contact@${brand_default.domain}`,
|
|
148
168
|
/**
|
|
149
169
|
* Where operational alerts go (dead letters, failed crons, unhandled
|
|
150
170
|
* API errors, failed uptime probes — the worker's `sendOpsAlert`).
|
|
@@ -160,6 +180,10 @@ var brand = {
|
|
|
160
180
|
* (docs/deployment.md "Resetting product data"). False when absent.
|
|
161
181
|
*/
|
|
162
182
|
launched: optional.launched === true,
|
|
183
|
+
/** The launch date (brand.json `launchedAt`, YYYY-MM-DD): the public changelog starts here. */
|
|
184
|
+
launchedAt: optional.launchedAt ?? null,
|
|
185
|
+
/** The public status page's address, once brand.json `statusPage` says it is live; else null. */
|
|
186
|
+
statusPageUrl: optional.statusPage === true ? `https://status.${brand_default.domain}` : null,
|
|
163
187
|
/** True once the product has its own brand (brand.json `status: "ready"`), not the platform's placeholders. */
|
|
164
188
|
ready: brand_default.status === "ready"
|
|
165
189
|
};
|
|
@@ -197,21 +221,21 @@ var signInOptions = {
|
|
|
197
221
|
emailSignUp: optional.signIn?.emailSignUp ?? "form"
|
|
198
222
|
};
|
|
199
223
|
function resolveProductEnvironments(environments, defaultEnvironment, docs) {
|
|
200
|
-
const
|
|
224
|
+
const list2 = (environments ?? []).map((env) => ({
|
|
201
225
|
name: env.name,
|
|
202
226
|
keyPrefix: env.keyPrefix,
|
|
203
227
|
readOnlyWorkspace: env.readOnlyWorkspace ?? false,
|
|
204
228
|
description: env.description ?? "",
|
|
205
229
|
agentLabel: env.agentLabel ?? env.description ?? ""
|
|
206
230
|
}));
|
|
207
|
-
const names = new Set(
|
|
208
|
-
const prefixes = new Set(
|
|
209
|
-
if (names.size !==
|
|
231
|
+
const names = new Set(list2.map((env) => env.name));
|
|
232
|
+
const prefixes = new Set(list2.map((env) => env.keyPrefix));
|
|
233
|
+
if (names.size !== list2.length || prefixes.size !== list2.length) {
|
|
210
234
|
throw new Error(
|
|
211
235
|
"brand.json environments: each needs its own name and keyPrefix"
|
|
212
236
|
);
|
|
213
237
|
}
|
|
214
|
-
for (const env of
|
|
238
|
+
for (const env of list2) {
|
|
215
239
|
if (!/^[a-z][a-z0-9-]*$/.test(env.name)) {
|
|
216
240
|
throw new Error(`brand.json environment name "${env.name}" is invalid`);
|
|
217
241
|
}
|
|
@@ -232,9 +256,9 @@ function resolveProductEnvironments(environments, defaultEnvironment, docs) {
|
|
|
232
256
|
);
|
|
233
257
|
}
|
|
234
258
|
return {
|
|
235
|
-
list,
|
|
236
|
-
default: defaultEnvironment ??
|
|
237
|
-
docs:
|
|
259
|
+
list: list2,
|
|
260
|
+
default: defaultEnvironment ?? list2[0]?.name ?? null,
|
|
261
|
+
docs: list2.length > 0 ? docs ?? null : null
|
|
238
262
|
};
|
|
239
263
|
}
|
|
240
264
|
var productEnvironments = resolveProductEnvironments(
|
|
@@ -728,21 +752,114 @@ function removeTrailingSlash(url) {
|
|
|
728
752
|
}
|
|
729
753
|
|
|
730
754
|
// node_modules/@reminix/sdk/dist/errors.js
|
|
731
|
-
var
|
|
755
|
+
var BASE_ERROR_NAME = `${brand2.name.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("")}Error`;
|
|
756
|
+
var SdkError = class _SdkError extends Error {
|
|
757
|
+
constructor(message, options) {
|
|
758
|
+
super(message, options);
|
|
759
|
+
this.name = new.target === _SdkError ? BASE_ERROR_NAME : new.target.name;
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
var APIConnectionError = class extends SdkError {
|
|
763
|
+
constructor(options = {}) {
|
|
764
|
+
super(options.message ?? "Could not connect to the API", {
|
|
765
|
+
cause: options.cause
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
var APITimeoutError = class extends APIConnectionError {
|
|
770
|
+
constructor(options = {}) {
|
|
771
|
+
super({ message: "The request timed out", cause: options.cause });
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
var APIError = class extends SdkError {
|
|
775
|
+
/** The HTTP status code. */
|
|
732
776
|
status;
|
|
777
|
+
/** The error's code, to branch on (`not_found`, `rate_limited`, …). */
|
|
733
778
|
code;
|
|
779
|
+
/** The request's id: quote it to support. */
|
|
734
780
|
requestId;
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
781
|
+
/**
|
|
782
|
+
* The response's headers (Retry-After, Server-Timing, the rate-limit
|
|
783
|
+
* ones): empty when the error was not built from a response.
|
|
784
|
+
*/
|
|
785
|
+
headers;
|
|
786
|
+
/** What is wrong with each field, when the API refused the input. */
|
|
787
|
+
details;
|
|
788
|
+
/** A link to the error's entry in the docs. */
|
|
789
|
+
docs;
|
|
790
|
+
constructor(init) {
|
|
791
|
+
super(init.message);
|
|
792
|
+
this.status = init.status;
|
|
793
|
+
this.code = init.code;
|
|
794
|
+
this.requestId = init.requestId;
|
|
795
|
+
this.headers = init.headers ?? new Headers();
|
|
796
|
+
this.details = init.details;
|
|
797
|
+
this.docs = init.docs;
|
|
741
798
|
}
|
|
742
799
|
};
|
|
800
|
+
var BadRequestError = class extends APIError {
|
|
801
|
+
};
|
|
802
|
+
var AuthenticationError = class extends APIError {
|
|
803
|
+
};
|
|
804
|
+
var PlanLimitError = class extends APIError {
|
|
805
|
+
};
|
|
806
|
+
var PermissionDeniedError = class extends APIError {
|
|
807
|
+
};
|
|
808
|
+
var NotFoundError = class extends APIError {
|
|
809
|
+
};
|
|
810
|
+
var ConflictError = class extends APIError {
|
|
811
|
+
};
|
|
812
|
+
var UnprocessableEntityError = class extends APIError {
|
|
813
|
+
};
|
|
814
|
+
var RateLimitError = class extends APIError {
|
|
815
|
+
};
|
|
816
|
+
var InternalServerError = class extends APIError {
|
|
817
|
+
};
|
|
818
|
+
var BY_STATUS = {
|
|
819
|
+
400: BadRequestError,
|
|
820
|
+
401: AuthenticationError,
|
|
821
|
+
402: PlanLimitError,
|
|
822
|
+
403: PermissionDeniedError,
|
|
823
|
+
404: NotFoundError,
|
|
824
|
+
409: ConflictError,
|
|
825
|
+
422: UnprocessableEntityError,
|
|
826
|
+
429: RateLimitError
|
|
827
|
+
};
|
|
828
|
+
function errorClassFor(status) {
|
|
829
|
+
return BY_STATUS[status] ?? (status >= 500 ? InternalServerError : APIError);
|
|
830
|
+
}
|
|
743
831
|
function apiErrorFrom(error, response) {
|
|
744
|
-
const envelope = error
|
|
745
|
-
|
|
832
|
+
const envelope = error !== null && typeof error === "object" ? error : {};
|
|
833
|
+
const body = envelope.error ?? {};
|
|
834
|
+
const ErrorClass = errorClassFor(response.status);
|
|
835
|
+
return new ErrorClass({
|
|
836
|
+
status: response.status,
|
|
837
|
+
code: body.code ?? "http_error",
|
|
838
|
+
message: body.message ?? `HTTP ${response.status}`,
|
|
839
|
+
requestId: body.requestId ?? response.headers.get("x-request-id") ?? void 0,
|
|
840
|
+
headers: response.headers,
|
|
841
|
+
...Array.isArray(body.details) ? { details: body.details } : {},
|
|
842
|
+
...typeof body.docs === "string" ? { docs: body.docs } : {}
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
function connectionErrorFrom(error, signal) {
|
|
846
|
+
if (signal?.aborted)
|
|
847
|
+
return signal.reason;
|
|
848
|
+
if (error instanceof SdkError)
|
|
849
|
+
return error;
|
|
850
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
851
|
+
return new APITimeoutError({ cause: error });
|
|
852
|
+
}
|
|
853
|
+
return new APIConnectionError({ cause: error });
|
|
854
|
+
}
|
|
855
|
+
function withConnectionErrors(fetch2) {
|
|
856
|
+
return async (request) => {
|
|
857
|
+
try {
|
|
858
|
+
return await fetch2(request);
|
|
859
|
+
} catch (error) {
|
|
860
|
+
throw connectionErrorFrom(error, request.signal);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
746
863
|
}
|
|
747
864
|
|
|
748
865
|
// node_modules/@reminix/sdk/dist/product/index.js
|
|
@@ -764,6 +881,7 @@ async function uploadFile(client, file, options = {}) {
|
|
|
764
881
|
params: { query: { name: file.name } },
|
|
765
882
|
body,
|
|
766
883
|
bodySerializer: (value) => value,
|
|
884
|
+
signal: options.signal,
|
|
767
885
|
headers: {
|
|
768
886
|
"content-type": file.mediaType ?? (body.type || "application/octet-stream"),
|
|
769
887
|
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
|
|
@@ -772,23 +890,25 @@ async function uploadFile(client, file, options = {}) {
|
|
|
772
890
|
}
|
|
773
891
|
|
|
774
892
|
// node_modules/@reminix/sdk/dist/product/run.js
|
|
775
|
-
var RunError = class extends
|
|
893
|
+
var RunError = class extends SdkError {
|
|
776
894
|
run;
|
|
777
895
|
constructor(run3) {
|
|
778
896
|
super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: ${run3.error ?? "no reason given"}` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
|
|
779
|
-
this.name = "RunError";
|
|
780
897
|
this.run = run3;
|
|
781
898
|
}
|
|
782
899
|
};
|
|
783
900
|
var ENDED = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
|
|
784
901
|
var isUpload = (value) => typeof Blob !== "undefined" && value instanceof Blob || typeof value === "object" && value !== null && "name" in value && "data" in value;
|
|
785
|
-
async function withFileIds(client, inputs, idempotencyKey) {
|
|
902
|
+
async function withFileIds(client, inputs, idempotencyKey, signal) {
|
|
786
903
|
let uploaded = 0;
|
|
787
904
|
const upload = async (value) => (await uploadFile(client, value instanceof Blob ? {
|
|
788
905
|
name: "name" in value ? String(value.name) : "upload",
|
|
789
906
|
mediaType: value.type,
|
|
790
907
|
data: value
|
|
791
|
-
} : value,
|
|
908
|
+
} : value, {
|
|
909
|
+
...idempotencyKey ? { idempotencyKey: `${idempotencyKey}:file-${++uploaded}` } : {},
|
|
910
|
+
signal
|
|
911
|
+
})).id;
|
|
792
912
|
const out = {};
|
|
793
913
|
for (const [name, value] of Object.entries(inputs)) {
|
|
794
914
|
if (isUpload(value))
|
|
@@ -814,20 +934,25 @@ var pause = (ms, signal) => new Promise((resolve4, reject) => {
|
|
|
814
934
|
}, { once: true });
|
|
815
935
|
});
|
|
816
936
|
async function waitForRun(client, run3, options = {}) {
|
|
817
|
-
|
|
937
|
+
const { signal } = options;
|
|
938
|
+
let current = typeof run3 === "string" ? await client.runs.get(run3, { signal }) : run3;
|
|
818
939
|
while (!ENDED.has(current.status)) {
|
|
819
|
-
await pause(options.
|
|
820
|
-
current = await client.runs.get(current.id);
|
|
940
|
+
await pause(options.pollInterval ?? 2e3, signal);
|
|
941
|
+
current = await client.runs.get(current.id, { signal });
|
|
821
942
|
}
|
|
822
943
|
if (current.status !== "succeeded")
|
|
823
944
|
throw new RunError(current);
|
|
824
945
|
return current;
|
|
825
946
|
}
|
|
826
947
|
async function run(client, slug, inputs = {}, options = {}) {
|
|
948
|
+
const { signal } = options;
|
|
827
949
|
const body = {
|
|
828
|
-
inputs: await withFileIds(client, inputs, options.idempotencyKey)
|
|
950
|
+
inputs: await withFileIds(client, inputs, options.idempotencyKey, signal)
|
|
951
|
+
};
|
|
952
|
+
const keyed = {
|
|
953
|
+
...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {},
|
|
954
|
+
signal
|
|
829
955
|
};
|
|
830
|
-
const keyed = options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {};
|
|
831
956
|
const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.testRun(slug, options.version, body, keyed);
|
|
832
957
|
if (started.status === "awaiting_approval") {
|
|
833
958
|
options.onApproval?.(started.approval?.approveUrl ?? null);
|
|
@@ -841,11 +966,77 @@ async function run(client, slug, inputs = {}, options = {}) {
|
|
|
841
966
|
var productMethods = (client) => ({
|
|
842
967
|
/** Runs a script and answers with the finished run (./run.ts). */
|
|
843
968
|
run: (slug, inputs, options) => run(client, slug, inputs, options),
|
|
969
|
+
/** Follows a run until it ends; throws RunError if it didn't succeed. */
|
|
970
|
+
waitForRun: (started, options) => waitForRun(client, started, options),
|
|
844
971
|
/** Uploads a file to give a run as an input; returns it, with its id. */
|
|
845
|
-
uploadFile: (file) => uploadFile(client, file)
|
|
972
|
+
uploadFile: (file, options) => uploadFile(client, file, options)
|
|
846
973
|
});
|
|
847
974
|
|
|
975
|
+
// node_modules/@reminix/sdk/dist/pagination.js
|
|
976
|
+
var Page = class {
|
|
977
|
+
/** This page's items. */
|
|
978
|
+
items;
|
|
979
|
+
/** The cursor for the next page; null on the last one. */
|
|
980
|
+
nextCursor;
|
|
981
|
+
#next;
|
|
982
|
+
constructor(body, next) {
|
|
983
|
+
Object.assign(this, body);
|
|
984
|
+
this.items = body.items;
|
|
985
|
+
this.nextCursor = body.nextCursor ?? null;
|
|
986
|
+
this.#next = next;
|
|
987
|
+
}
|
|
988
|
+
/** Whether another page follows this one. */
|
|
989
|
+
hasNextPage() {
|
|
990
|
+
return this.#next !== null && typeof this.nextCursor === "string";
|
|
991
|
+
}
|
|
992
|
+
/** The next page; throws when this is the last one (see hasNextPage). */
|
|
993
|
+
getNextPage() {
|
|
994
|
+
if (!this.hasNextPage()) {
|
|
995
|
+
return Promise.reject(new Error("No next page: check hasNextPage() first"));
|
|
996
|
+
}
|
|
997
|
+
return this.#next(this.nextCursor);
|
|
998
|
+
}
|
|
999
|
+
/** This page and every page after it. */
|
|
1000
|
+
async *iterPages() {
|
|
1001
|
+
yield this;
|
|
1002
|
+
let page = this.hasNextPage() ? await this.getNextPage() : null;
|
|
1003
|
+
while (page) {
|
|
1004
|
+
yield page;
|
|
1005
|
+
page = page.hasNextPage() ? await page.getNextPage() : null;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
/** Every item, from this page on, fetching each next page as it goes. */
|
|
1009
|
+
async *[Symbol.asyncIterator]() {
|
|
1010
|
+
for await (const page of this.iterPages())
|
|
1011
|
+
yield* page.items;
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
var PagePromise = class {
|
|
1015
|
+
#page;
|
|
1016
|
+
[Symbol.toStringTag] = "PagePromise";
|
|
1017
|
+
constructor(page) {
|
|
1018
|
+
this.#page = page;
|
|
1019
|
+
}
|
|
1020
|
+
then(onFulfilled, onRejected) {
|
|
1021
|
+
return this.#page.then(onFulfilled, onRejected);
|
|
1022
|
+
}
|
|
1023
|
+
catch(onRejected) {
|
|
1024
|
+
return this.#page.catch(onRejected);
|
|
1025
|
+
}
|
|
1026
|
+
finally(onFinally) {
|
|
1027
|
+
return this.#page.finally(onFinally);
|
|
1028
|
+
}
|
|
1029
|
+
async *[Symbol.asyncIterator]() {
|
|
1030
|
+
yield* await this.#page;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
function pages(fetch2, paged) {
|
|
1034
|
+
const load = (cursor) => new PagePromise(fetch2(cursor).then((body) => new Page(body, paged ? load : null)));
|
|
1035
|
+
return load(void 0);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
848
1038
|
// node_modules/@reminix/sdk/dist/resources.js
|
|
1039
|
+
var TIMEOUT_HEADER = "x-sdk-timeout";
|
|
849
1040
|
async function call(client, op, pathParams, input, options = {}, content) {
|
|
850
1041
|
const query = {};
|
|
851
1042
|
const body = {};
|
|
@@ -856,7 +1047,8 @@ async function call(client, op, pathParams, input, options = {}, content) {
|
|
|
856
1047
|
}
|
|
857
1048
|
const headers = {
|
|
858
1049
|
...options.headers,
|
|
859
|
-
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
|
|
1050
|
+
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {},
|
|
1051
|
+
...options.timeout === void 0 ? {} : { [TIMEOUT_HEADER]: String(options.timeout) }
|
|
860
1052
|
};
|
|
861
1053
|
const request = client.request;
|
|
862
1054
|
const raw = op.rawBody ? content instanceof Blob ? content : new Blob([content]) : void 0;
|
|
@@ -868,13 +1060,17 @@ async function call(client, op, pathParams, input, options = {}, content) {
|
|
|
868
1060
|
bodySerializer: (value) => value,
|
|
869
1061
|
headers: { "content-type": raw.type || op.rawBody, ...headers }
|
|
870
1062
|
} : { headers },
|
|
871
|
-
...op.rawResponse ? { parseAs: "blob" } : {}
|
|
1063
|
+
...op.rawResponse ? { parseAs: "blob" } : {},
|
|
1064
|
+
signal: options.signal
|
|
872
1065
|
});
|
|
873
1066
|
if (error !== void 0 || !response.ok) {
|
|
874
1067
|
throw apiErrorFrom(error, response);
|
|
875
1068
|
}
|
|
876
1069
|
return data;
|
|
877
1070
|
}
|
|
1071
|
+
function list(client, op, pathParams, input, options = {}, paged = true) {
|
|
1072
|
+
return pages((cursor) => call(client, op, pathParams, cursor === void 0 ? input : { ...input, cursor }, options), paged);
|
|
1073
|
+
}
|
|
878
1074
|
|
|
879
1075
|
// node_modules/@reminix/sdk/dist/resources.gen.js
|
|
880
1076
|
function resources(client) {
|
|
@@ -886,25 +1082,25 @@ function resources(client) {
|
|
|
886
1082
|
),
|
|
887
1083
|
delete: (
|
|
888
1084
|
/** Delete an environment */
|
|
889
|
-
(
|
|
1085
|
+
(environment3, options) => call(client, { "method": "delete", "path": "/environments/{environment}", "query": [], "hasBody": false }, { "environment": environment3 }, void 0, options)
|
|
890
1086
|
),
|
|
891
1087
|
get: (
|
|
892
1088
|
/** Get an environment */
|
|
893
|
-
(
|
|
1089
|
+
(environment3, options) => call(client, { "method": "get", "path": "/environments/{environment}", "query": [], "hasBody": false }, { "environment": environment3 }, void 0, options)
|
|
894
1090
|
),
|
|
895
1091
|
list: (
|
|
896
1092
|
/** List environments */
|
|
897
|
-
(options) =>
|
|
1093
|
+
(input, options) => list(client, { "method": "get", "path": "/environments", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
898
1094
|
),
|
|
899
1095
|
update: (
|
|
900
1096
|
/** Change an environment */
|
|
901
|
-
(
|
|
1097
|
+
(environment3, input, options) => call(client, { "method": "patch", "path": "/environments/{environment}", "query": [], "hasBody": true }, { "environment": environment3 }, input, options)
|
|
902
1098
|
)
|
|
903
1099
|
},
|
|
904
1100
|
files: {
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
(fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/
|
|
1101
|
+
content: (
|
|
1102
|
+
/** Get a file's content */
|
|
1103
|
+
(fileId, options) => call(client, { "method": "get", "path": "/files/{fileId}/content", "query": [], "hasBody": false, "rawResponse": "application/octet-stream" }, { "fileId": fileId }, void 0, options)
|
|
908
1104
|
),
|
|
909
1105
|
get: (
|
|
910
1106
|
/** Get a file */
|
|
@@ -912,7 +1108,7 @@ function resources(client) {
|
|
|
912
1108
|
),
|
|
913
1109
|
list: (
|
|
914
1110
|
/** List files */
|
|
915
|
-
(input, options) =>
|
|
1111
|
+
(input, options) => list(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "before", "script", "origin", "name"], "hasBody": false }, {}, input, options, true)
|
|
916
1112
|
),
|
|
917
1113
|
upload: (
|
|
918
1114
|
/** Upload a file */
|
|
@@ -934,7 +1130,7 @@ function resources(client) {
|
|
|
934
1130
|
),
|
|
935
1131
|
list: (
|
|
936
1132
|
/** List runs */
|
|
937
|
-
(input, options) =>
|
|
1133
|
+
(input, options) => list(client, { "method": "get", "path": "/runs", "query": ["limit", "cursor", "before", "script", "status"], "hasBody": false }, {}, input, options, true)
|
|
938
1134
|
),
|
|
939
1135
|
log: (
|
|
940
1136
|
/** Get a run's log */
|
|
@@ -950,9 +1146,13 @@ function resources(client) {
|
|
|
950
1146
|
/** Delete a schedule */
|
|
951
1147
|
(slug, scheduleId, options) => call(client, { "method": "delete", "path": "/scripts/{slug}/schedules/{scheduleId}", "query": [], "hasBody": false }, { "slug": slug, "scheduleId": scheduleId }, void 0, options)
|
|
952
1148
|
),
|
|
1149
|
+
get: (
|
|
1150
|
+
/** Get a schedule */
|
|
1151
|
+
(slug, scheduleId, options) => call(client, { "method": "get", "path": "/scripts/{slug}/schedules/{scheduleId}", "query": [], "hasBody": false }, { "slug": slug, "scheduleId": scheduleId }, void 0, options)
|
|
1152
|
+
),
|
|
953
1153
|
list: (
|
|
954
1154
|
/** List a script's schedules */
|
|
955
|
-
(slug, options) =>
|
|
1155
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/schedules", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
956
1156
|
),
|
|
957
1157
|
update: (
|
|
958
1158
|
/** Change a schedule */
|
|
@@ -974,7 +1174,7 @@ function resources(client) {
|
|
|
974
1174
|
),
|
|
975
1175
|
list: (
|
|
976
1176
|
/** List scripts */
|
|
977
|
-
(input, options) =>
|
|
1177
|
+
(input, options) => list(client, { "method": "get", "path": "/scripts", "query": ["limit", "cursor", "q", "tag", "owner", "published", "archived"], "hasBody": false }, {}, input, options, true)
|
|
978
1178
|
),
|
|
979
1179
|
restore: (
|
|
980
1180
|
/** Restore an archived script */
|
|
@@ -996,9 +1196,13 @@ function resources(client) {
|
|
|
996
1196
|
)
|
|
997
1197
|
},
|
|
998
1198
|
scriptVersions: {
|
|
1199
|
+
get: (
|
|
1200
|
+
/** Get a version */
|
|
1201
|
+
(slug, version, options) => call(client, { "method": "get", "path": "/scripts/{slug}/versions/{version}", "query": [], "hasBody": false }, { "slug": slug, "version": version }, void 0, options)
|
|
1202
|
+
),
|
|
999
1203
|
list: (
|
|
1000
1204
|
/** List a script's versions */
|
|
1001
|
-
(slug, options) =>
|
|
1205
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/versions", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
1002
1206
|
),
|
|
1003
1207
|
publish: (
|
|
1004
1208
|
/** Publish a version */
|
|
@@ -1018,26 +1222,36 @@ function resources(client) {
|
|
|
1018
1222
|
/** Delete a secret */
|
|
1019
1223
|
(name, options) => call(client, { "method": "delete", "path": "/secrets/{name}", "query": [], "hasBody": false }, { "name": name }, void 0, options)
|
|
1020
1224
|
),
|
|
1225
|
+
get: (
|
|
1226
|
+
/** Get a secret */
|
|
1227
|
+
(name, options) => call(client, { "method": "get", "path": "/secrets/{name}", "query": [], "hasBody": false }, { "name": name }, void 0, options)
|
|
1228
|
+
),
|
|
1021
1229
|
list: (
|
|
1022
1230
|
/** List secrets */
|
|
1023
|
-
(options) =>
|
|
1231
|
+
(input, options) => list(client, { "method": "get", "path": "/secrets", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1024
1232
|
),
|
|
1025
|
-
|
|
1026
|
-
/**
|
|
1027
|
-
(name, input, options) => call(client, { "method": "
|
|
1233
|
+
update: (
|
|
1234
|
+
/** Update a secret */
|
|
1235
|
+
(name, input, options) => call(client, { "method": "patch", "path": "/secrets/{name}", "query": [], "hasBody": true }, { "name": name }, input, options)
|
|
1028
1236
|
)
|
|
1029
1237
|
},
|
|
1030
1238
|
secretValues: {
|
|
1031
1239
|
delete: (
|
|
1032
1240
|
/** Remove a secret's value from an environment */
|
|
1033
|
-
(name,
|
|
1241
|
+
(name, environment3, options) => call(client, { "method": "delete", "path": "/secrets/{name}/values/{environment}", "query": [], "hasBody": false }, { "name": name, "environment": environment3 }, void 0, options)
|
|
1242
|
+
),
|
|
1243
|
+
set: (
|
|
1244
|
+
/** Save a secret's value */
|
|
1245
|
+
(name, environment3, input, options) => call(client, { "method": "put", "path": "/secrets/{name}/values/{environment}", "query": [], "hasBody": true }, { "name": name, "environment": environment3 }, input, options)
|
|
1034
1246
|
)
|
|
1035
1247
|
},
|
|
1036
|
-
|
|
1037
|
-
|
|
1248
|
+
triggerCalls: {
|
|
1249
|
+
list: (
|
|
1038
1250
|
/** List a webhook trigger's calls */
|
|
1039
|
-
(slug, triggerId, options) =>
|
|
1040
|
-
)
|
|
1251
|
+
(slug, triggerId, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/triggers/{triggerId}/calls", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug, "triggerId": triggerId }, input, options, true)
|
|
1252
|
+
)
|
|
1253
|
+
},
|
|
1254
|
+
triggers: {
|
|
1041
1255
|
create: (
|
|
1042
1256
|
/** Run a script when something happens */
|
|
1043
1257
|
(slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/triggers", "query": [], "hasBody": true }, { "slug": slug }, input, options)
|
|
@@ -1046,9 +1260,13 @@ function resources(client) {
|
|
|
1046
1260
|
/** Delete a trigger */
|
|
1047
1261
|
(slug, triggerId, options) => call(client, { "method": "delete", "path": "/scripts/{slug}/triggers/{triggerId}", "query": [], "hasBody": false }, { "slug": slug, "triggerId": triggerId }, void 0, options)
|
|
1048
1262
|
),
|
|
1263
|
+
get: (
|
|
1264
|
+
/** Get a trigger */
|
|
1265
|
+
(slug, triggerId, options) => call(client, { "method": "get", "path": "/scripts/{slug}/triggers/{triggerId}", "query": [], "hasBody": false }, { "slug": slug, "triggerId": triggerId }, void 0, options)
|
|
1266
|
+
),
|
|
1049
1267
|
list: (
|
|
1050
1268
|
/** List a script's triggers */
|
|
1051
|
-
(slug, options) =>
|
|
1269
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/triggers", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
1052
1270
|
),
|
|
1053
1271
|
rotateSecret: (
|
|
1054
1272
|
/** Rotate a webhook trigger's secret */
|
|
@@ -1073,7 +1291,7 @@ function resources(client) {
|
|
|
1073
1291
|
approvalActions: {
|
|
1074
1292
|
list: (
|
|
1075
1293
|
/** List the actions you can ask approval for */
|
|
1076
|
-
(options) =>
|
|
1294
|
+
(options) => list(client, { "method": "get", "path": "/workspace/approval-actions", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1077
1295
|
)
|
|
1078
1296
|
},
|
|
1079
1297
|
approvalRequests: {
|
|
@@ -1083,23 +1301,23 @@ function resources(client) {
|
|
|
1083
1301
|
),
|
|
1084
1302
|
get: (
|
|
1085
1303
|
/** Check an approval request */
|
|
1086
|
-
(
|
|
1304
|
+
(approvalRequestId, options) => call(client, { "method": "get", "path": "/workspace/approval-requests/{approvalRequestId}", "query": [], "hasBody": false }, { "approvalRequestId": approvalRequestId }, void 0, options)
|
|
1087
1305
|
),
|
|
1088
1306
|
redeem: (
|
|
1089
1307
|
/** Redeem an approved request */
|
|
1090
|
-
(
|
|
1308
|
+
(approvalRequestId, options) => call(client, { "method": "post", "path": "/workspace/approval-requests/{approvalRequestId}/redeem", "query": [], "hasBody": false }, { "approvalRequestId": approvalRequestId }, void 0, options)
|
|
1091
1309
|
)
|
|
1092
1310
|
},
|
|
1093
1311
|
auditEvents: {
|
|
1094
1312
|
list: (
|
|
1095
1313
|
/** List workspace audit events */
|
|
1096
|
-
(input, options) =>
|
|
1314
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/audit-events", "query": ["limit", "cursor", "before", "action", "actor"], "hasBody": false }, {}, input, options, true)
|
|
1097
1315
|
)
|
|
1098
1316
|
},
|
|
1099
1317
|
eventTypes: {
|
|
1100
1318
|
list: (
|
|
1101
1319
|
/** List event types */
|
|
1102
|
-
(options) =>
|
|
1320
|
+
(options) => list(client, { "method": "get", "path": "/workspace/event-types", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1103
1321
|
)
|
|
1104
1322
|
},
|
|
1105
1323
|
get: (
|
|
@@ -1109,29 +1327,31 @@ function resources(client) {
|
|
|
1109
1327
|
invitations: {
|
|
1110
1328
|
list: (
|
|
1111
1329
|
/** List pending invitations */
|
|
1112
|
-
(input, options) =>
|
|
1330
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/invitations", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1113
1331
|
)
|
|
1114
1332
|
},
|
|
1115
1333
|
members: {
|
|
1116
1334
|
list: (
|
|
1117
1335
|
/** List workspace members */
|
|
1118
|
-
(input, options) =>
|
|
1336
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/members", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1337
|
+
)
|
|
1338
|
+
},
|
|
1339
|
+
planUsage: {
|
|
1340
|
+
get: (
|
|
1341
|
+
/** Get your plan's usage this period */
|
|
1342
|
+
(options) => call(client, { "method": "get", "path": "/workspace/plan-usage", "query": [], "hasBody": false }, {}, void 0, options)
|
|
1119
1343
|
)
|
|
1120
1344
|
},
|
|
1121
1345
|
teams: {
|
|
1122
1346
|
list: (
|
|
1123
1347
|
/** List teams */
|
|
1124
|
-
(input, options) =>
|
|
1348
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/teams", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1125
1349
|
)
|
|
1126
1350
|
},
|
|
1127
|
-
usage: (
|
|
1128
|
-
/** Get your plan's usage this period */
|
|
1129
|
-
(options) => call(client, { "method": "get", "path": "/workspace/usage", "query": [], "hasBody": false }, {}, void 0, options)
|
|
1130
|
-
),
|
|
1131
1351
|
webhookDeliveries: {
|
|
1132
1352
|
list: (
|
|
1133
1353
|
/** List an endpoint's deliveries */
|
|
1134
|
-
(endpointId, input, options) =>
|
|
1354
|
+
(endpointId, input, options) => list(client, { "method": "get", "path": "/workspace/webhook-endpoints/{endpointId}/deliveries", "query": ["limit", "cursor", "before", "status"], "hasBody": false }, { "endpointId": endpointId }, input, options, true)
|
|
1135
1355
|
),
|
|
1136
1356
|
redeliver: (
|
|
1137
1357
|
/** Redeliver an event */
|
|
@@ -1157,7 +1377,7 @@ function resources(client) {
|
|
|
1157
1377
|
),
|
|
1158
1378
|
list: (
|
|
1159
1379
|
/** List webhook endpoints */
|
|
1160
|
-
(options) =>
|
|
1380
|
+
(options) => list(client, { "method": "get", "path": "/workspace/webhook-endpoints", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1161
1381
|
),
|
|
1162
1382
|
test: (
|
|
1163
1383
|
/** Send a test event */
|
|
@@ -1176,11 +1396,45 @@ function resources(client) {
|
|
|
1176
1396
|
var WRITES = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
1177
1397
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
|
|
1178
1398
|
var DEFAULT_MAX_RETRIES = 2;
|
|
1179
|
-
var MAX_WAIT_MS =
|
|
1399
|
+
var MAX_WAIT_MS = 6e4;
|
|
1180
1400
|
var MAX_BASE_KEY = 200;
|
|
1181
1401
|
var PRODUCT_RETRY_HEADER = "x-sdk-product-retry";
|
|
1402
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
1403
|
+
function withAttemptTimeout(fetch2, ms) {
|
|
1404
|
+
return (request) => {
|
|
1405
|
+
const asked = Number(request.headers.get(TIMEOUT_HEADER));
|
|
1406
|
+
const limit = asked > 0 ? asked : ms;
|
|
1407
|
+
const headers = new Headers(request.headers);
|
|
1408
|
+
headers.delete(TIMEOUT_HEADER);
|
|
1409
|
+
return fetch2(new Request(request, {
|
|
1410
|
+
headers,
|
|
1411
|
+
signal: AbortSignal.any([
|
|
1412
|
+
request.signal,
|
|
1413
|
+
AbortSignal.timeout(Math.max(1, Math.round(limit)))
|
|
1414
|
+
])
|
|
1415
|
+
}));
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1182
1418
|
var productRetry = () => "productRetry" in product_exports ? Reflect.get(product_exports, "productRetry") ?? null : null;
|
|
1183
1419
|
var wait = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
1420
|
+
function pause2(sleep, ms, signal) {
|
|
1421
|
+
if (signal.aborted)
|
|
1422
|
+
return Promise.reject(signal.reason);
|
|
1423
|
+
return new Promise((done, fail) => {
|
|
1424
|
+
const abort = () => fail(signal.reason);
|
|
1425
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
1426
|
+
sleep(ms).then(() => {
|
|
1427
|
+
signal.removeEventListener("abort", abort);
|
|
1428
|
+
if (signal.aborted)
|
|
1429
|
+
fail(signal.reason);
|
|
1430
|
+
else
|
|
1431
|
+
done();
|
|
1432
|
+
}, (error) => {
|
|
1433
|
+
signal.removeEventListener("abort", abort);
|
|
1434
|
+
fail(error);
|
|
1435
|
+
});
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1184
1438
|
function backoff(attempt) {
|
|
1185
1439
|
const base = Math.min(500 * 2 ** attempt, 8e3);
|
|
1186
1440
|
return base * (0.75 + Math.random() * 0.25);
|
|
@@ -1243,7 +1497,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1243
1497
|
} catch (error) {
|
|
1244
1498
|
if (last || request.signal.aborted)
|
|
1245
1499
|
throw error;
|
|
1246
|
-
await sleep
|
|
1500
|
+
await pause2(sleep, backoff(attempt), request.signal);
|
|
1247
1501
|
continue;
|
|
1248
1502
|
}
|
|
1249
1503
|
const laterMs = later ? await later.wait(response, laterTries) : null;
|
|
@@ -1254,7 +1508,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1254
1508
|
laterTries++;
|
|
1255
1509
|
laterWaited += laterMs;
|
|
1256
1510
|
await response.body?.cancel();
|
|
1257
|
-
await sleep
|
|
1511
|
+
await pause2(sleep, laterMs, request.signal);
|
|
1258
1512
|
attempt--;
|
|
1259
1513
|
continue;
|
|
1260
1514
|
}
|
|
@@ -1264,7 +1518,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1264
1518
|
if (delay > MAX_WAIT_MS)
|
|
1265
1519
|
return response;
|
|
1266
1520
|
await response.body?.cancel();
|
|
1267
|
-
await sleep
|
|
1521
|
+
await pause2(sleep, delay, request.signal);
|
|
1268
1522
|
}
|
|
1269
1523
|
};
|
|
1270
1524
|
}
|
|
@@ -1288,11 +1542,13 @@ function keysFrom(base) {
|
|
|
1288
1542
|
};
|
|
1289
1543
|
}
|
|
1290
1544
|
|
|
1545
|
+
// node_modules/@reminix/sdk/dist/version.js
|
|
1546
|
+
var VERSION = "1.0.0-rc.13";
|
|
1547
|
+
|
|
1291
1548
|
// node_modules/@reminix/sdk/dist/webhooks.js
|
|
1292
|
-
var WebhookVerificationError = class extends
|
|
1549
|
+
var WebhookVerificationError = class extends SdkError {
|
|
1293
1550
|
constructor(message) {
|
|
1294
1551
|
super(message);
|
|
1295
|
-
this.name = "WebhookVerificationError";
|
|
1296
1552
|
}
|
|
1297
1553
|
};
|
|
1298
1554
|
function header(headers, name) {
|
|
@@ -1360,7 +1616,8 @@ async function verifyWebhook(body, headers, secret, options = {}) {
|
|
|
1360
1616
|
// node_modules/@reminix/sdk/dist/index.js
|
|
1361
1617
|
var API_KEY_ENV = `${brand2.identifier.toUpperCase()}_API_KEY`;
|
|
1362
1618
|
var TOKEN_ENV = `${brand2.identifier.toUpperCase()}_TOKEN`;
|
|
1363
|
-
var
|
|
1619
|
+
var BASE_URL_ENV = `${brand2.identifier.toUpperCase()}_BASE_URL`;
|
|
1620
|
+
var DEFAULT_BASE_URL = `https://api.${brand2.domain}`;
|
|
1364
1621
|
function createClient2(options = {}) {
|
|
1365
1622
|
const client = createBaseClient(options);
|
|
1366
1623
|
const extend = Reflect.get(product_exports, "productMethods");
|
|
@@ -1382,14 +1639,22 @@ function createBaseClient(options) {
|
|
|
1382
1639
|
if (!token) {
|
|
1383
1640
|
throw new Error(`${brand2.productName}: no API key. Pass { apiKey } or set ${API_KEY_ENV}.`);
|
|
1384
1641
|
}
|
|
1385
|
-
const origin = withoutTrailingSlashes(options.
|
|
1386
|
-
const
|
|
1642
|
+
const origin = withoutTrailingSlashes(options.baseURL || environment()?.[BASE_URL_ENV] || DEFAULT_BASE_URL);
|
|
1643
|
+
const send2 = withAttemptTimeout(options.fetch ?? ((request) => fetch(request)), options.timeout ?? DEFAULT_TIMEOUT_MS);
|
|
1644
|
+
const sending = options.maxRetries === 0 ? withoutProductRetryHeader(send2) : withRetries(send2, { maxRetries: options.maxRetries });
|
|
1387
1645
|
const client = createClient({
|
|
1388
1646
|
baseUrl: `${origin}/v1`,
|
|
1389
|
-
fetch:
|
|
1647
|
+
fetch: withConnectionErrors(sending)
|
|
1390
1648
|
});
|
|
1391
1649
|
client.use({
|
|
1392
1650
|
onRequest({ request }) {
|
|
1651
|
+
for (const [name, value] of Object.entries(options.defaultHeaders ?? {})) {
|
|
1652
|
+
if (!request.headers.has(name))
|
|
1653
|
+
request.headers.set(name, value);
|
|
1654
|
+
}
|
|
1655
|
+
if (!("document" in globalThis) && !request.headers.has("user-agent")) {
|
|
1656
|
+
request.headers.set("user-agent", USER_AGENT);
|
|
1657
|
+
}
|
|
1393
1658
|
request.headers.set("authorization", `Bearer ${token}`);
|
|
1394
1659
|
if (options.workspace && !request.headers.has("x-workspace")) {
|
|
1395
1660
|
request.headers.set("x-workspace", options.workspace);
|
|
@@ -1404,9 +1669,13 @@ function createBaseClient(options) {
|
|
|
1404
1669
|
webhooks: { verify: verifyWebhook }
|
|
1405
1670
|
});
|
|
1406
1671
|
}
|
|
1407
|
-
|
|
1672
|
+
var USER_AGENT = `${brand2.name}-node/${VERSION}`;
|
|
1673
|
+
function environment() {
|
|
1408
1674
|
const runtime = globalThis;
|
|
1409
|
-
|
|
1675
|
+
return runtime.process?.env;
|
|
1676
|
+
}
|
|
1677
|
+
function credentialFromEnvironment() {
|
|
1678
|
+
const env = environment();
|
|
1410
1679
|
return env?.[API_KEY_ENV] || env?.[TOKEN_ENV] || void 0;
|
|
1411
1680
|
}
|
|
1412
1681
|
function unwrap(result) {
|
|
@@ -1430,12 +1699,12 @@ var CommanderError = class extends Error {
|
|
|
1430
1699
|
* @param {string} code an id string representing the error
|
|
1431
1700
|
* @param {string} message human-readable description of the error
|
|
1432
1701
|
*/
|
|
1433
|
-
constructor(
|
|
1702
|
+
constructor(exitCode2, code2, message) {
|
|
1434
1703
|
super(message);
|
|
1435
1704
|
Error.captureStackTrace(this, this.constructor);
|
|
1436
1705
|
this.name = this.constructor.name;
|
|
1437
1706
|
this.code = code2;
|
|
1438
|
-
this.exitCode =
|
|
1707
|
+
this.exitCode = exitCode2;
|
|
1439
1708
|
this.nestedError = void 0;
|
|
1440
1709
|
}
|
|
1441
1710
|
};
|
|
@@ -2991,11 +3260,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2991
3260
|
* @return never
|
|
2992
3261
|
* @private
|
|
2993
3262
|
*/
|
|
2994
|
-
_exit(
|
|
3263
|
+
_exit(exitCode2, code2, message) {
|
|
2995
3264
|
if (this._exitCallback) {
|
|
2996
|
-
this._exitCallback(new CommanderError(
|
|
3265
|
+
this._exitCallback(new CommanderError(exitCode2, code2, message));
|
|
2997
3266
|
}
|
|
2998
|
-
process2.exit(
|
|
3267
|
+
process2.exit(exitCode2);
|
|
2999
3268
|
}
|
|
3000
3269
|
/**
|
|
3001
3270
|
* Register callback `fn` for the command.
|
|
@@ -4146,9 +4415,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4146
4415
|
this.outputHelp({ error: true });
|
|
4147
4416
|
}
|
|
4148
4417
|
const config2 = errorOptions || {};
|
|
4149
|
-
const
|
|
4418
|
+
const exitCode2 = config2.exitCode || 1;
|
|
4150
4419
|
const code2 = config2.code || "commander.error";
|
|
4151
|
-
this._exit(
|
|
4420
|
+
this._exit(exitCode2, code2, message);
|
|
4152
4421
|
}
|
|
4153
4422
|
/**
|
|
4154
4423
|
* Apply any option related environment variables, if option does
|
|
@@ -4267,10 +4536,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4267
4536
|
* @param {string} flag
|
|
4268
4537
|
* @private
|
|
4269
4538
|
*/
|
|
4270
|
-
unknownOption(
|
|
4539
|
+
unknownOption(flag) {
|
|
4271
4540
|
if (this._allowUnknownOption) return;
|
|
4272
4541
|
let suggestion = "";
|
|
4273
|
-
if (
|
|
4542
|
+
if (flag.startsWith("--") && this._showSuggestionAfterError) {
|
|
4274
4543
|
let candidateFlags = [];
|
|
4275
4544
|
let command = this;
|
|
4276
4545
|
do {
|
|
@@ -4278,9 +4547,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4278
4547
|
candidateFlags = candidateFlags.concat(moreFlags);
|
|
4279
4548
|
command = command.parent;
|
|
4280
4549
|
} while (command && !command._enablePositionalOptions);
|
|
4281
|
-
suggestion = suggestSimilar(
|
|
4550
|
+
suggestion = suggestSimilar(flag, candidateFlags);
|
|
4282
4551
|
}
|
|
4283
|
-
const message = `error: unknown option '${
|
|
4552
|
+
const message = `error: unknown option '${flag}'${suggestion}`;
|
|
4284
4553
|
this.error(message, { code: "commander.unknownOption" });
|
|
4285
4554
|
}
|
|
4286
4555
|
/**
|
|
@@ -4690,11 +4959,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4690
4959
|
*/
|
|
4691
4960
|
help(contextOptions) {
|
|
4692
4961
|
this.outputHelp(contextOptions);
|
|
4693
|
-
let
|
|
4694
|
-
if (
|
|
4695
|
-
|
|
4962
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
4963
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
4964
|
+
exitCode2 = 1;
|
|
4696
4965
|
}
|
|
4697
|
-
this._exit(
|
|
4966
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
4698
4967
|
}
|
|
4699
4968
|
/**
|
|
4700
4969
|
* // Do a little typing to coordinate emit and listener for the help text events.
|
|
@@ -4840,13 +5109,13 @@ function browserLogin(options) {
|
|
|
4840
5109
|
return;
|
|
4841
5110
|
}
|
|
4842
5111
|
const fields = url.searchParams;
|
|
4843
|
-
const
|
|
5112
|
+
const send2 = (status, title, text) => res.writeHead(status, {
|
|
4844
5113
|
"content-type": "text/html; charset=utf-8",
|
|
4845
5114
|
"cache-control": "no-store",
|
|
4846
5115
|
"referrer-policy": "no-referrer"
|
|
4847
5116
|
}).end(PAGE(title, text));
|
|
4848
5117
|
if (fields.get("state") !== state) {
|
|
4849
|
-
|
|
5118
|
+
send2(
|
|
4850
5119
|
400,
|
|
4851
5120
|
"Not this login",
|
|
4852
5121
|
"This sign-in did not come from the terminal that is waiting. Run login again."
|
|
@@ -4854,16 +5123,16 @@ function browserLogin(options) {
|
|
|
4854
5123
|
return;
|
|
4855
5124
|
}
|
|
4856
5125
|
if (fields.get("error")) {
|
|
4857
|
-
|
|
5126
|
+
send2(200, "Sign-in cancelled", "You can close this tab.");
|
|
4858
5127
|
finish(() => reject(new Error("sign-in was denied in the browser")));
|
|
4859
5128
|
return;
|
|
4860
5129
|
}
|
|
4861
5130
|
const token = decrypt(fields.get("token") ?? "");
|
|
4862
5131
|
if (!token) {
|
|
4863
|
-
|
|
5132
|
+
send2(400, "Something went wrong", "Run login again.");
|
|
4864
5133
|
return;
|
|
4865
5134
|
}
|
|
4866
|
-
|
|
5135
|
+
send2(
|
|
4867
5136
|
200,
|
|
4868
5137
|
"You are signed in",
|
|
4869
5138
|
"Return to your terminal. You can close this tab."
|
|
@@ -4915,6 +5184,9 @@ import {
|
|
|
4915
5184
|
writeFileSync
|
|
4916
5185
|
} from "node:fs";
|
|
4917
5186
|
import { join } from "node:path";
|
|
5187
|
+
function baseURLEnvVar() {
|
|
5188
|
+
return BASE_URL_ENV;
|
|
5189
|
+
}
|
|
4918
5190
|
function environmentEnvVar() {
|
|
4919
5191
|
return `${brand.identifier.toUpperCase()}_ENVIRONMENT`;
|
|
4920
5192
|
}
|
|
@@ -4942,12 +5214,13 @@ function writeConfig(homeDir, config2) {
|
|
|
4942
5214
|
}
|
|
4943
5215
|
function resolveSettings(env, homeDir, flags = {}) {
|
|
4944
5216
|
const config2 = readConfig(homeDir);
|
|
4945
|
-
const
|
|
5217
|
+
const environment3 = 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 };
|
|
4946
5218
|
return {
|
|
4947
|
-
...
|
|
4948
|
-
|
|
4949
|
-
env[
|
|
5219
|
+
...environment3,
|
|
5220
|
+
baseURL: withoutTrailingSlashes2(
|
|
5221
|
+
flags.baseUrl || env[BASE_URL_ENV] || config2.baseURL || DEFAULT_BASE_URL
|
|
4950
5222
|
),
|
|
5223
|
+
baseURLSource: flags.baseUrl ? "flag" : env[BASE_URL_ENV] ? "env" : config2.baseURL ? "config" : null,
|
|
4951
5224
|
token: env[tokenEnvVar()] ?? config2.token,
|
|
4952
5225
|
workspace: env[`${brand.identifier.toUpperCase()}_WORKSPACE`] ?? config2.workspace
|
|
4953
5226
|
};
|
|
@@ -4958,6 +5231,28 @@ function withoutTrailingSlashes2(url) {
|
|
|
4958
5231
|
return url.slice(0, end);
|
|
4959
5232
|
}
|
|
4960
5233
|
|
|
5234
|
+
// src/errors.ts
|
|
5235
|
+
var EXIT = {
|
|
5236
|
+
ok: 0,
|
|
5237
|
+
failure: 1,
|
|
5238
|
+
usage: 2,
|
|
5239
|
+
auth: 4
|
|
5240
|
+
};
|
|
5241
|
+
var UsageError = class extends Error {
|
|
5242
|
+
exitCode = EXIT.usage;
|
|
5243
|
+
constructor(message) {
|
|
5244
|
+
super(message);
|
|
5245
|
+
this.name = "UsageError";
|
|
5246
|
+
}
|
|
5247
|
+
};
|
|
5248
|
+
var NotLoggedInError = class extends Error {
|
|
5249
|
+
exitCode = EXIT.auth;
|
|
5250
|
+
constructor(message) {
|
|
5251
|
+
super(message);
|
|
5252
|
+
this.name = "NotLoggedInError";
|
|
5253
|
+
}
|
|
5254
|
+
};
|
|
5255
|
+
|
|
4961
5256
|
// src/http.ts
|
|
4962
5257
|
async function rawRequest(ctx, options) {
|
|
4963
5258
|
const needsWorkspace = !options.path.startsWith("/v1/user");
|
|
@@ -4966,7 +5261,7 @@ async function rawRequest(ctx, options) {
|
|
|
4966
5261
|
return unwrap(
|
|
4967
5262
|
await client.request(options.method, options.path, {
|
|
4968
5263
|
// The client's base URL ends in /v1; the path given here is absolute.
|
|
4969
|
-
baseUrl: ctx.credentials({ workspace: workspace2 }).
|
|
5264
|
+
baseUrl: ctx.credentials({ workspace: workspace2 }).baseURL,
|
|
4970
5265
|
body: options.body
|
|
4971
5266
|
})
|
|
4972
5267
|
);
|
|
@@ -5065,9 +5360,10 @@ var approvals = (program3, ctx) => {
|
|
|
5065
5360
|
// src/usage.ts
|
|
5066
5361
|
var usage = (program3, ctx) => {
|
|
5067
5362
|
const workspace2 = program3.commands.find((c) => c.name() === "workspace") ?? program3.command("workspace");
|
|
5068
|
-
workspace2.
|
|
5363
|
+
const planUsage = workspace2.commands.find((c) => c.name() === "plan-usage") ?? workspace2.command("plan-usage").description("Your plan's usage this period");
|
|
5364
|
+
planUsage.command("get").description("Show your plan's usage this period").option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output").action(async (options) => {
|
|
5069
5365
|
const result = unwrap(
|
|
5070
|
-
await ctx.client({ workspace: options.workspace }).GET("/workspace/usage")
|
|
5366
|
+
await ctx.client({ workspace: options.workspace }).GET("/workspace/plan-usage")
|
|
5071
5367
|
);
|
|
5072
5368
|
if (options.json) {
|
|
5073
5369
|
ctx.io.stdout(json(result));
|
|
@@ -5099,13 +5395,14 @@ function usageLines(usage2) {
|
|
|
5099
5395
|
async function me(ctx) {
|
|
5100
5396
|
return unwrap(await ctx.client({ workspace: false }).GET("/user/me"));
|
|
5101
5397
|
}
|
|
5102
|
-
async function saveToken(ctx, token
|
|
5398
|
+
async function saveToken(ctx, token) {
|
|
5399
|
+
const { baseURL, baseURLSource } = ctx.settings();
|
|
5103
5400
|
if (!token.startsWith(`pat_${brand.identifier}_`)) {
|
|
5104
5401
|
throw new Error(`that is not a ${brand.productName} personal access token`);
|
|
5105
5402
|
}
|
|
5106
5403
|
const previous = readConfig(ctx.io.homeDir);
|
|
5107
5404
|
const config2 = { ...previous, token };
|
|
5108
|
-
if (
|
|
5405
|
+
if (baseURLSource === "flag") config2.baseURL = baseURL;
|
|
5109
5406
|
writeConfig(ctx.io.homeDir, config2);
|
|
5110
5407
|
let user;
|
|
5111
5408
|
try {
|
|
@@ -5135,24 +5432,28 @@ async function saveToken(ctx, token, api2) {
|
|
|
5135
5432
|
var login = (program3, ctx) => {
|
|
5136
5433
|
program3.command("login").description(
|
|
5137
5434
|
"Sign in through the browser, or store a personal access token with --token"
|
|
5138
|
-
).option("--token <pat>", "a personal access token (CI, servers)").option("--
|
|
5435
|
+
).option("--token <pat>", "a personal access token (CI, servers)").option("--web <origin>", "web app origin for the browser sign-in").addHelpText(
|
|
5436
|
+
"after",
|
|
5437
|
+
`
|
|
5438
|
+
The global --base-url signs in to another API (default ${DEFAULT_BASE_URL}), and is saved for later commands.`
|
|
5439
|
+
).action(async (options) => {
|
|
5139
5440
|
if (!productFeatures.personalTokens) {
|
|
5140
5441
|
throw new Error(
|
|
5141
5442
|
`${brand.productName} has no personal access tokens, so this command line cannot sign in.`
|
|
5142
5443
|
);
|
|
5143
5444
|
}
|
|
5144
5445
|
if (options.token) {
|
|
5145
|
-
await saveToken(ctx, options.token
|
|
5446
|
+
await saveToken(ctx, options.token);
|
|
5146
5447
|
return;
|
|
5147
5448
|
}
|
|
5148
5449
|
if (!ctx.io.interactive) {
|
|
5149
5450
|
ctx.io.stderr(
|
|
5150
5451
|
`Paste a personal access token (Account \u2192 Personal access tokens in ${brand.productName}), then Enter:`
|
|
5151
5452
|
);
|
|
5152
|
-
await saveToken(ctx, (await ctx.io.stdin()).trim()
|
|
5453
|
+
await saveToken(ctx, (await ctx.io.stdin()).trim());
|
|
5153
5454
|
return;
|
|
5154
5455
|
}
|
|
5155
|
-
const api2 =
|
|
5456
|
+
const api2 = ctx.settings().baseURL;
|
|
5156
5457
|
const webOrigin = options.web ?? webOriginFor(api2);
|
|
5157
5458
|
if (!webOrigin) {
|
|
5158
5459
|
throw new Error(
|
|
@@ -5168,15 +5469,15 @@ var login = (program3, ctx) => {
|
|
|
5168
5469
|
${url}`
|
|
5169
5470
|
)
|
|
5170
5471
|
});
|
|
5171
|
-
await saveToken(ctx, token
|
|
5472
|
+
await saveToken(ctx, token);
|
|
5172
5473
|
});
|
|
5173
5474
|
};
|
|
5174
5475
|
var logout = (program3, ctx) => {
|
|
5175
5476
|
program3.command("logout").description("Revoke the stored token and forget it").action(async () => {
|
|
5176
5477
|
const config2 = readConfig(ctx.io.homeDir);
|
|
5177
5478
|
if (config2.token) {
|
|
5178
|
-
const revoked = await ctx.
|
|
5179
|
-
new Request(`${ctx.settings().
|
|
5479
|
+
const revoked = await ctx.fetch(
|
|
5480
|
+
new Request(`${ctx.settings().baseURL}/v1/user/token`, {
|
|
5180
5481
|
method: "DELETE",
|
|
5181
5482
|
headers: { authorization: `Bearer ${config2.token}` }
|
|
5182
5483
|
})
|
|
@@ -5234,7 +5535,7 @@ var workspace = (program3, ctx) => {
|
|
|
5234
5535
|
ctx.io.stdout(`Default workspace: ${slug}`);
|
|
5235
5536
|
});
|
|
5236
5537
|
};
|
|
5237
|
-
var
|
|
5538
|
+
var environment2 = (program3, ctx) => {
|
|
5238
5539
|
const group = program3.command("environment").description("Choose the environment commands act in");
|
|
5239
5540
|
group.command("list", { isDefault: true }).description("Show the environment commands act in").action(() => {
|
|
5240
5541
|
const { environment: current, environmentSource } = ctx.settings();
|
|
@@ -5277,9 +5578,16 @@ var api = (program3, ctx) => {
|
|
|
5277
5578
|
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(
|
|
5278
5579
|
async (method, path2, options) => {
|
|
5279
5580
|
if (!path2.startsWith("/")) {
|
|
5280
|
-
throw new
|
|
5581
|
+
throw new UsageError(
|
|
5582
|
+
"usage: api <method> </v1/...> [--data '<json>']"
|
|
5583
|
+
);
|
|
5584
|
+
}
|
|
5585
|
+
let body;
|
|
5586
|
+
try {
|
|
5587
|
+
body = options.data === void 0 ? void 0 : JSON.parse(options.data);
|
|
5588
|
+
} catch {
|
|
5589
|
+
throw new UsageError("--data must be JSON");
|
|
5281
5590
|
}
|
|
5282
|
-
const body = options.data === void 0 ? void 0 : JSON.parse(options.data);
|
|
5283
5591
|
ctx.io.stdout(
|
|
5284
5592
|
json(
|
|
5285
5593
|
await rawRequest(ctx, {
|
|
@@ -5298,8 +5606,8 @@ var config = (program3, ctx) => {
|
|
|
5298
5606
|
const settings = ctx.settings();
|
|
5299
5607
|
ctx.io.stdout(
|
|
5300
5608
|
json({
|
|
5301
|
-
|
|
5302
|
-
|
|
5609
|
+
baseURL: settings.baseURL,
|
|
5610
|
+
baseURLDefault: DEFAULT_BASE_URL,
|
|
5303
5611
|
token: settings.token ? `${settings.token.slice(0, 12)}\u2026` : null,
|
|
5304
5612
|
tokenSource: ctx.io.env[tokenEnvVar()] ? tokenEnvVar() : settings.token ? "config" : null,
|
|
5305
5613
|
workspace: settings.workspace ?? null,
|
|
@@ -5315,7 +5623,7 @@ var platformCommands = [
|
|
|
5315
5623
|
logout,
|
|
5316
5624
|
whoami,
|
|
5317
5625
|
workspace,
|
|
5318
|
-
|
|
5626
|
+
environment2,
|
|
5319
5627
|
api,
|
|
5320
5628
|
config,
|
|
5321
5629
|
approvals,
|
|
@@ -5515,8 +5823,36 @@ var OPERATIONS = [
|
|
|
5515
5823
|
}
|
|
5516
5824
|
},
|
|
5517
5825
|
"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.",
|
|
5518
|
-
"fields": [
|
|
5826
|
+
"fields": [
|
|
5827
|
+
{
|
|
5828
|
+
"name": "limit",
|
|
5829
|
+
"in": "query",
|
|
5830
|
+
"type": "number",
|
|
5831
|
+
"required": false,
|
|
5832
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
5833
|
+
"example": 25,
|
|
5834
|
+
"schema": {
|
|
5835
|
+
"type": "integer",
|
|
5836
|
+
"minimum": 1,
|
|
5837
|
+
"maximum": 100,
|
|
5838
|
+
"default": 25,
|
|
5839
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
5840
|
+
}
|
|
5841
|
+
},
|
|
5842
|
+
{
|
|
5843
|
+
"name": "cursor",
|
|
5844
|
+
"in": "query",
|
|
5845
|
+
"type": "string",
|
|
5846
|
+
"required": false,
|
|
5847
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
5848
|
+
"schema": {
|
|
5849
|
+
"type": "string",
|
|
5850
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5853
|
+
],
|
|
5519
5854
|
"hasBody": false,
|
|
5855
|
+
"paginated": true,
|
|
5520
5856
|
"workspace": true,
|
|
5521
5857
|
"acceptsApiKey": true,
|
|
5522
5858
|
"scope": "environments:read"
|
|
@@ -5611,10 +5947,10 @@ var OPERATIONS = [
|
|
|
5611
5947
|
"scope": "environments:write"
|
|
5612
5948
|
},
|
|
5613
5949
|
{
|
|
5614
|
-
"operationId": "files.
|
|
5950
|
+
"operationId": "files.content",
|
|
5615
5951
|
"method": "get",
|
|
5616
|
-
"path": "/files/{fileId}/
|
|
5617
|
-
"summary": "
|
|
5952
|
+
"path": "/files/{fileId}/content",
|
|
5953
|
+
"summary": "Get a file's content",
|
|
5618
5954
|
"cli": {
|
|
5619
5955
|
"command": "files download",
|
|
5620
5956
|
"args": [
|
|
@@ -5634,7 +5970,7 @@ var OPERATIONS = [
|
|
|
5634
5970
|
"type": "string",
|
|
5635
5971
|
"required": true,
|
|
5636
5972
|
"description": "The file's ID.",
|
|
5637
|
-
"example": "
|
|
5973
|
+
"example": "file_36d59242-1144-4fcb-851f-20f4c444d538",
|
|
5638
5974
|
"schema": {
|
|
5639
5975
|
"type": "string",
|
|
5640
5976
|
"description": "The file's ID."
|
|
@@ -5676,7 +6012,7 @@ var OPERATIONS = [
|
|
|
5676
6012
|
"type": "string",
|
|
5677
6013
|
"required": true,
|
|
5678
6014
|
"description": "The file's ID.",
|
|
5679
|
-
"example": "
|
|
6015
|
+
"example": "file_36d59242-1144-4fcb-851f-20f4c444d538",
|
|
5680
6016
|
"schema": {
|
|
5681
6017
|
"type": "string",
|
|
5682
6018
|
"description": "The file's ID."
|
|
@@ -5792,6 +6128,7 @@ var OPERATIONS = [
|
|
|
5792
6128
|
}
|
|
5793
6129
|
],
|
|
5794
6130
|
"hasBody": false,
|
|
6131
|
+
"paginated": true,
|
|
5795
6132
|
"workspace": true,
|
|
5796
6133
|
"acceptsApiKey": true,
|
|
5797
6134
|
"scope": "runs:read"
|
|
@@ -5811,7 +6148,7 @@ var OPERATIONS = [
|
|
|
5811
6148
|
"exposed": false,
|
|
5812
6149
|
"reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
|
|
5813
6150
|
},
|
|
5814
|
-
"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": "
|
|
6151
|
+
"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_36d59242-1144-4fcb-851f-20f4c444d538" }`). 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.',
|
|
5815
6152
|
"fields": [
|
|
5816
6153
|
{
|
|
5817
6154
|
"name": "name",
|
|
@@ -5863,7 +6200,7 @@ var OPERATIONS = [
|
|
|
5863
6200
|
"type": "string",
|
|
5864
6201
|
"required": true,
|
|
5865
6202
|
"description": "The run's ID.",
|
|
5866
|
-
"example": "
|
|
6203
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
5867
6204
|
"schema": {
|
|
5868
6205
|
"type": "string",
|
|
5869
6206
|
"description": "The run's ID."
|
|
@@ -5897,7 +6234,7 @@ var OPERATIONS = [
|
|
|
5897
6234
|
"idempotentHint": false
|
|
5898
6235
|
}
|
|
5899
6236
|
},
|
|
5900
|
-
"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.",
|
|
6237
|
+
"description": "Runs the script's published version with these inputs, and returns the run when it finishes (201), 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.",
|
|
5901
6238
|
"fields": [
|
|
5902
6239
|
{
|
|
5903
6240
|
"name": "slug",
|
|
@@ -5977,7 +6314,7 @@ var OPERATIONS = [
|
|
|
5977
6314
|
"type": "string",
|
|
5978
6315
|
"required": true,
|
|
5979
6316
|
"description": "The run's ID.",
|
|
5980
|
-
"example": "
|
|
6317
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
5981
6318
|
"schema": {
|
|
5982
6319
|
"type": "string",
|
|
5983
6320
|
"description": "The run's ID."
|
|
@@ -6083,6 +6420,7 @@ var OPERATIONS = [
|
|
|
6083
6420
|
}
|
|
6084
6421
|
],
|
|
6085
6422
|
"hasBody": false,
|
|
6423
|
+
"paginated": true,
|
|
6086
6424
|
"workspace": true,
|
|
6087
6425
|
"acceptsApiKey": true,
|
|
6088
6426
|
"scope": "runs:read"
|
|
@@ -6116,7 +6454,7 @@ var OPERATIONS = [
|
|
|
6116
6454
|
"type": "string",
|
|
6117
6455
|
"required": true,
|
|
6118
6456
|
"description": "The run's ID.",
|
|
6119
|
-
"example": "
|
|
6457
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
6120
6458
|
"schema": {
|
|
6121
6459
|
"type": "string",
|
|
6122
6460
|
"description": "The run's ID."
|
|
@@ -6264,7 +6602,7 @@ var OPERATIONS = [
|
|
|
6264
6602
|
"type": "string",
|
|
6265
6603
|
"required": true,
|
|
6266
6604
|
"description": "The schedule's ID.",
|
|
6267
|
-
"example": "
|
|
6605
|
+
"example": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
|
|
6268
6606
|
"schema": {
|
|
6269
6607
|
"type": "string",
|
|
6270
6608
|
"description": "The schedule's ID."
|
|
@@ -6276,6 +6614,60 @@ var OPERATIONS = [
|
|
|
6276
6614
|
"acceptsApiKey": true,
|
|
6277
6615
|
"scope": "scripts:write"
|
|
6278
6616
|
},
|
|
6617
|
+
{
|
|
6618
|
+
"operationId": "schedules.get",
|
|
6619
|
+
"method": "get",
|
|
6620
|
+
"path": "/scripts/{slug}/schedules/{scheduleId}",
|
|
6621
|
+
"summary": "Get a schedule",
|
|
6622
|
+
"cli": {
|
|
6623
|
+
"command": "schedules get",
|
|
6624
|
+
"args": [
|
|
6625
|
+
"slug",
|
|
6626
|
+
"scheduleId"
|
|
6627
|
+
],
|
|
6628
|
+
"confirm": false
|
|
6629
|
+
},
|
|
6630
|
+
"mcp": {
|
|
6631
|
+
"exposed": true,
|
|
6632
|
+
"name": "schedules_get",
|
|
6633
|
+
"hints": {
|
|
6634
|
+
"readOnlyHint": true,
|
|
6635
|
+
"destructiveHint": false,
|
|
6636
|
+
"idempotentHint": true
|
|
6637
|
+
}
|
|
6638
|
+
},
|
|
6639
|
+
"description": "Returns one of a script's schedules, with when it runs next.",
|
|
6640
|
+
"fields": [
|
|
6641
|
+
{
|
|
6642
|
+
"name": "slug",
|
|
6643
|
+
"in": "path",
|
|
6644
|
+
"type": "string",
|
|
6645
|
+
"required": true,
|
|
6646
|
+
"description": "The slug's ID.",
|
|
6647
|
+
"example": "monthly-report",
|
|
6648
|
+
"schema": {
|
|
6649
|
+
"type": "string",
|
|
6650
|
+
"description": "The slug's ID."
|
|
6651
|
+
}
|
|
6652
|
+
},
|
|
6653
|
+
{
|
|
6654
|
+
"name": "scheduleId",
|
|
6655
|
+
"in": "path",
|
|
6656
|
+
"type": "string",
|
|
6657
|
+
"required": true,
|
|
6658
|
+
"description": "The schedule's ID.",
|
|
6659
|
+
"example": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
|
|
6660
|
+
"schema": {
|
|
6661
|
+
"type": "string",
|
|
6662
|
+
"description": "The schedule's ID."
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
],
|
|
6666
|
+
"hasBody": false,
|
|
6667
|
+
"workspace": true,
|
|
6668
|
+
"acceptsApiKey": true,
|
|
6669
|
+
"scope": "scripts:read"
|
|
6670
|
+
},
|
|
6279
6671
|
{
|
|
6280
6672
|
"operationId": "schedules.list",
|
|
6281
6673
|
"method": "get",
|
|
@@ -6310,9 +6702,36 @@ var OPERATIONS = [
|
|
|
6310
6702
|
"type": "string",
|
|
6311
6703
|
"description": "The slug's ID."
|
|
6312
6704
|
}
|
|
6705
|
+
},
|
|
6706
|
+
{
|
|
6707
|
+
"name": "limit",
|
|
6708
|
+
"in": "query",
|
|
6709
|
+
"type": "number",
|
|
6710
|
+
"required": false,
|
|
6711
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
6712
|
+
"example": 25,
|
|
6713
|
+
"schema": {
|
|
6714
|
+
"type": "integer",
|
|
6715
|
+
"minimum": 1,
|
|
6716
|
+
"maximum": 100,
|
|
6717
|
+
"default": 25,
|
|
6718
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
6719
|
+
}
|
|
6720
|
+
},
|
|
6721
|
+
{
|
|
6722
|
+
"name": "cursor",
|
|
6723
|
+
"in": "query",
|
|
6724
|
+
"type": "string",
|
|
6725
|
+
"required": false,
|
|
6726
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
6727
|
+
"schema": {
|
|
6728
|
+
"type": "string",
|
|
6729
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
6730
|
+
}
|
|
6313
6731
|
}
|
|
6314
6732
|
],
|
|
6315
6733
|
"hasBody": false,
|
|
6734
|
+
"paginated": true,
|
|
6316
6735
|
"workspace": true,
|
|
6317
6736
|
"acceptsApiKey": true,
|
|
6318
6737
|
"scope": "scripts:read"
|
|
@@ -6354,7 +6773,7 @@ var OPERATIONS = [
|
|
|
6354
6773
|
"type": "string",
|
|
6355
6774
|
"required": true,
|
|
6356
6775
|
"description": "The schedule's ID.",
|
|
6357
|
-
"example": "
|
|
6776
|
+
"example": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
|
|
6358
6777
|
"schema": {
|
|
6359
6778
|
"type": "string",
|
|
6360
6779
|
"description": "The schedule's ID."
|
|
@@ -6696,6 +7115,7 @@ var OPERATIONS = [
|
|
|
6696
7115
|
}
|
|
6697
7116
|
],
|
|
6698
7117
|
"hasBody": false,
|
|
7118
|
+
"paginated": true,
|
|
6699
7119
|
"workspace": true,
|
|
6700
7120
|
"acceptsApiKey": true,
|
|
6701
7121
|
"scope": "scripts:read"
|
|
@@ -6757,7 +7177,7 @@ var OPERATIONS = [
|
|
|
6757
7177
|
"idempotentHint": false
|
|
6758
7178
|
}
|
|
6759
7179
|
},
|
|
6760
|
-
"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`.",
|
|
7180
|
+
"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`. A name, description or tags that the script's reminix.json sets (listed in `setInFile`) can't change here, and the request returns 400.",
|
|
6761
7181
|
"fields": [
|
|
6762
7182
|
{
|
|
6763
7183
|
"name": "slug",
|
|
@@ -6928,27 +7348,28 @@ var OPERATIONS = [
|
|
|
6928
7348
|
"scope": "scripts:write"
|
|
6929
7349
|
},
|
|
6930
7350
|
{
|
|
6931
|
-
"operationId": "scriptVersions.
|
|
7351
|
+
"operationId": "scriptVersions.get",
|
|
6932
7352
|
"method": "get",
|
|
6933
|
-
"path": "/scripts/{slug}/versions",
|
|
6934
|
-
"summary": "
|
|
7353
|
+
"path": "/scripts/{slug}/versions/{version}",
|
|
7354
|
+
"summary": "Get a version",
|
|
6935
7355
|
"cli": {
|
|
6936
|
-
"command": "script-versions
|
|
7356
|
+
"command": "script-versions get",
|
|
6937
7357
|
"args": [
|
|
6938
|
-
"slug"
|
|
7358
|
+
"slug",
|
|
7359
|
+
"version"
|
|
6939
7360
|
],
|
|
6940
7361
|
"confirm": false
|
|
6941
7362
|
},
|
|
6942
7363
|
"mcp": {
|
|
6943
7364
|
"exposed": true,
|
|
6944
|
-
"name": "
|
|
7365
|
+
"name": "script_versions_get",
|
|
6945
7366
|
"hints": {
|
|
6946
7367
|
"readOnlyHint": true,
|
|
6947
7368
|
"destructiveHint": false,
|
|
6948
7369
|
"idempotentHint": true
|
|
6949
7370
|
}
|
|
6950
7371
|
},
|
|
6951
|
-
"description": "
|
|
7372
|
+
"description": "Returns one version of a script, and whether it's the published one.",
|
|
6952
7373
|
"fields": [
|
|
6953
7374
|
{
|
|
6954
7375
|
"name": "slug",
|
|
@@ -6961,6 +7382,19 @@ var OPERATIONS = [
|
|
|
6961
7382
|
"type": "string",
|
|
6962
7383
|
"description": "The slug's ID."
|
|
6963
7384
|
}
|
|
7385
|
+
},
|
|
7386
|
+
{
|
|
7387
|
+
"name": "version",
|
|
7388
|
+
"in": "path",
|
|
7389
|
+
"type": "number",
|
|
7390
|
+
"required": true,
|
|
7391
|
+
"description": "The version's ID.",
|
|
7392
|
+
"example": 3,
|
|
7393
|
+
"schema": {
|
|
7394
|
+
"type": "integer",
|
|
7395
|
+
"minimum": 1,
|
|
7396
|
+
"description": "The version's ID."
|
|
7397
|
+
}
|
|
6964
7398
|
}
|
|
6965
7399
|
],
|
|
6966
7400
|
"hasBody": false,
|
|
@@ -6969,28 +7403,27 @@ var OPERATIONS = [
|
|
|
6969
7403
|
"scope": "scripts:read"
|
|
6970
7404
|
},
|
|
6971
7405
|
{
|
|
6972
|
-
"operationId": "scriptVersions.
|
|
6973
|
-
"method": "
|
|
6974
|
-
"path": "/scripts/{slug}/versions
|
|
6975
|
-
"summary": "
|
|
7406
|
+
"operationId": "scriptVersions.list",
|
|
7407
|
+
"method": "get",
|
|
7408
|
+
"path": "/scripts/{slug}/versions",
|
|
7409
|
+
"summary": "List a script's versions",
|
|
6976
7410
|
"cli": {
|
|
6977
|
-
"command": "script-versions
|
|
7411
|
+
"command": "script-versions list",
|
|
6978
7412
|
"args": [
|
|
6979
|
-
"slug"
|
|
6980
|
-
"version"
|
|
7413
|
+
"slug"
|
|
6981
7414
|
],
|
|
6982
7415
|
"confirm": false
|
|
6983
7416
|
},
|
|
6984
7417
|
"mcp": {
|
|
6985
7418
|
"exposed": true,
|
|
6986
|
-
"name": "
|
|
7419
|
+
"name": "script_versions_list",
|
|
6987
7420
|
"hints": {
|
|
6988
|
-
"readOnlyHint":
|
|
7421
|
+
"readOnlyHint": true,
|
|
6989
7422
|
"destructiveHint": false,
|
|
6990
|
-
"idempotentHint":
|
|
7423
|
+
"idempotentHint": true
|
|
6991
7424
|
}
|
|
6992
7425
|
},
|
|
6993
|
-
"description": "
|
|
7426
|
+
"description": "Lists a script's versions, newest first, and marks the published one. Paginate with the opaque `nextCursor` token.",
|
|
6994
7427
|
"fields": [
|
|
6995
7428
|
{
|
|
6996
7429
|
"name": "slug",
|
|
@@ -7005,16 +7438,85 @@ var OPERATIONS = [
|
|
|
7005
7438
|
}
|
|
7006
7439
|
},
|
|
7007
7440
|
{
|
|
7008
|
-
"name": "
|
|
7009
|
-
"in": "
|
|
7441
|
+
"name": "limit",
|
|
7442
|
+
"in": "query",
|
|
7010
7443
|
"type": "number",
|
|
7011
|
-
"required":
|
|
7012
|
-
"description": "
|
|
7013
|
-
"example":
|
|
7444
|
+
"required": false,
|
|
7445
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
7446
|
+
"example": 25,
|
|
7014
7447
|
"schema": {
|
|
7015
7448
|
"type": "integer",
|
|
7016
7449
|
"minimum": 1,
|
|
7017
|
-
"
|
|
7450
|
+
"maximum": 100,
|
|
7451
|
+
"default": 25,
|
|
7452
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
7453
|
+
}
|
|
7454
|
+
},
|
|
7455
|
+
{
|
|
7456
|
+
"name": "cursor",
|
|
7457
|
+
"in": "query",
|
|
7458
|
+
"type": "string",
|
|
7459
|
+
"required": false,
|
|
7460
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
7461
|
+
"schema": {
|
|
7462
|
+
"type": "string",
|
|
7463
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
7464
|
+
}
|
|
7465
|
+
}
|
|
7466
|
+
],
|
|
7467
|
+
"hasBody": false,
|
|
7468
|
+
"paginated": true,
|
|
7469
|
+
"workspace": true,
|
|
7470
|
+
"acceptsApiKey": true,
|
|
7471
|
+
"scope": "scripts:read"
|
|
7472
|
+
},
|
|
7473
|
+
{
|
|
7474
|
+
"operationId": "scriptVersions.publish",
|
|
7475
|
+
"method": "post",
|
|
7476
|
+
"path": "/scripts/{slug}/versions/{version}/publish",
|
|
7477
|
+
"summary": "Publish a version",
|
|
7478
|
+
"cli": {
|
|
7479
|
+
"command": "script-versions publish",
|
|
7480
|
+
"args": [
|
|
7481
|
+
"slug",
|
|
7482
|
+
"version"
|
|
7483
|
+
],
|
|
7484
|
+
"confirm": false
|
|
7485
|
+
},
|
|
7486
|
+
"mcp": {
|
|
7487
|
+
"exposed": true,
|
|
7488
|
+
"name": "script_versions_publish",
|
|
7489
|
+
"hints": {
|
|
7490
|
+
"readOnlyHint": false,
|
|
7491
|
+
"destructiveHint": false,
|
|
7492
|
+
"idempotentHint": false
|
|
7493
|
+
}
|
|
7494
|
+
},
|
|
7495
|
+
"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. When an agent connected through MCP publishes, it 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.",
|
|
7496
|
+
"fields": [
|
|
7497
|
+
{
|
|
7498
|
+
"name": "slug",
|
|
7499
|
+
"in": "path",
|
|
7500
|
+
"type": "string",
|
|
7501
|
+
"required": true,
|
|
7502
|
+
"description": "The slug's ID.",
|
|
7503
|
+
"example": "unlock-account",
|
|
7504
|
+
"schema": {
|
|
7505
|
+
"type": "string",
|
|
7506
|
+
"description": "The slug's ID."
|
|
7507
|
+
}
|
|
7508
|
+
},
|
|
7509
|
+
{
|
|
7510
|
+
"name": "version",
|
|
7511
|
+
"in": "path",
|
|
7512
|
+
"type": "number",
|
|
7513
|
+
"required": true,
|
|
7514
|
+
"description": "The version's ID.",
|
|
7515
|
+
"example": 3,
|
|
7516
|
+
"schema": {
|
|
7517
|
+
"type": "integer",
|
|
7518
|
+
"minimum": 1,
|
|
7519
|
+
"description": "The version's ID."
|
|
7018
7520
|
}
|
|
7019
7521
|
}
|
|
7020
7522
|
],
|
|
@@ -7179,11 +7681,11 @@ var OPERATIONS = [
|
|
|
7179
7681
|
"in": "body",
|
|
7180
7682
|
"type": "json",
|
|
7181
7683
|
"required": false,
|
|
7182
|
-
"description":
|
|
7684
|
+
"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 ]`. A text input with `"format": "multiline"` gets a box of several lines in the run form.',
|
|
7183
7685
|
"schema": {
|
|
7184
7686
|
"type": "object",
|
|
7185
7687
|
"additionalProperties": {},
|
|
7186
|
-
"description":
|
|
7688
|
+
"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 ]`. A text input with `"format": "multiline"` gets a box of several lines in the run form.'
|
|
7187
7689
|
}
|
|
7188
7690
|
},
|
|
7189
7691
|
{
|
|
@@ -7442,6 +7944,47 @@ var OPERATIONS = [
|
|
|
7442
7944
|
"acceptsApiKey": true,
|
|
7443
7945
|
"scope": "secrets:write"
|
|
7444
7946
|
},
|
|
7947
|
+
{
|
|
7948
|
+
"operationId": "secrets.get",
|
|
7949
|
+
"method": "get",
|
|
7950
|
+
"path": "/secrets/{name}",
|
|
7951
|
+
"summary": "Get a secret",
|
|
7952
|
+
"cli": {
|
|
7953
|
+
"command": "secrets get",
|
|
7954
|
+
"args": [
|
|
7955
|
+
"name"
|
|
7956
|
+
],
|
|
7957
|
+
"confirm": false
|
|
7958
|
+
},
|
|
7959
|
+
"mcp": {
|
|
7960
|
+
"exposed": true,
|
|
7961
|
+
"name": "secrets_get",
|
|
7962
|
+
"hints": {
|
|
7963
|
+
"readOnlyHint": true,
|
|
7964
|
+
"destructiveHint": false,
|
|
7965
|
+
"idempotentHint": true
|
|
7966
|
+
}
|
|
7967
|
+
},
|
|
7968
|
+
"description": "Returns one secret by its name, with the environments that have a value and the hosts each value may go to. It never includes the values themselves.",
|
|
7969
|
+
"fields": [
|
|
7970
|
+
{
|
|
7971
|
+
"name": "name",
|
|
7972
|
+
"in": "path",
|
|
7973
|
+
"type": "string",
|
|
7974
|
+
"required": true,
|
|
7975
|
+
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
|
|
7976
|
+
"example": "ADMIN_KEY",
|
|
7977
|
+
"schema": {
|
|
7978
|
+
"type": "string",
|
|
7979
|
+
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
],
|
|
7983
|
+
"hasBody": false,
|
|
7984
|
+
"workspace": true,
|
|
7985
|
+
"acceptsApiKey": true,
|
|
7986
|
+
"scope": "secrets:read"
|
|
7987
|
+
},
|
|
7445
7988
|
{
|
|
7446
7989
|
"operationId": "secrets.list",
|
|
7447
7990
|
"method": "get",
|
|
@@ -7462,30 +8005,57 @@ var OPERATIONS = [
|
|
|
7462
8005
|
}
|
|
7463
8006
|
},
|
|
7464
8007
|
"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.",
|
|
7465
|
-
"fields": [
|
|
8008
|
+
"fields": [
|
|
8009
|
+
{
|
|
8010
|
+
"name": "limit",
|
|
8011
|
+
"in": "query",
|
|
8012
|
+
"type": "number",
|
|
8013
|
+
"required": false,
|
|
8014
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
8015
|
+
"example": 25,
|
|
8016
|
+
"schema": {
|
|
8017
|
+
"type": "integer",
|
|
8018
|
+
"minimum": 1,
|
|
8019
|
+
"maximum": 100,
|
|
8020
|
+
"default": 25,
|
|
8021
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
8022
|
+
}
|
|
8023
|
+
},
|
|
8024
|
+
{
|
|
8025
|
+
"name": "cursor",
|
|
8026
|
+
"in": "query",
|
|
8027
|
+
"type": "string",
|
|
8028
|
+
"required": false,
|
|
8029
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
8030
|
+
"schema": {
|
|
8031
|
+
"type": "string",
|
|
8032
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
],
|
|
7466
8036
|
"hasBody": false,
|
|
8037
|
+
"paginated": true,
|
|
7467
8038
|
"workspace": true,
|
|
7468
8039
|
"acceptsApiKey": true,
|
|
7469
8040
|
"scope": "secrets:read"
|
|
7470
8041
|
},
|
|
7471
8042
|
{
|
|
7472
|
-
"operationId": "secrets.
|
|
7473
|
-
"method": "
|
|
8043
|
+
"operationId": "secrets.update",
|
|
8044
|
+
"method": "patch",
|
|
7474
8045
|
"path": "/secrets/{name}",
|
|
7475
|
-
"summary": "
|
|
8046
|
+
"summary": "Update a secret",
|
|
7476
8047
|
"cli": {
|
|
7477
|
-
"command": "secrets
|
|
8048
|
+
"command": "secrets update",
|
|
7478
8049
|
"args": [
|
|
7479
8050
|
"name"
|
|
7480
8051
|
],
|
|
7481
|
-
"confirm": false
|
|
7482
|
-
"sample": 'printf %s "$ADMIN_KEY" | \\\n reminix secrets set ADMIN_KEY \\\n --hosts api.yourapp.com'
|
|
8052
|
+
"confirm": false
|
|
7483
8053
|
},
|
|
7484
8054
|
"mcp": {
|
|
7485
8055
|
"exposed": false,
|
|
7486
8056
|
"reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
|
|
7487
8057
|
},
|
|
7488
|
-
"description": "
|
|
8058
|
+
"description": "Changes what applies to a secret in every environment. Its values are saved one environment at a time, with Save a secret's value. Workspace owners, admins and API keys can change a secret.",
|
|
7489
8059
|
"fields": [
|
|
7490
8060
|
{
|
|
7491
8061
|
"name": "name",
|
|
@@ -7499,44 +8069,15 @@ var OPERATIONS = [
|
|
|
7499
8069
|
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
|
|
7500
8070
|
}
|
|
7501
8071
|
},
|
|
7502
|
-
{
|
|
7503
|
-
"name": "value",
|
|
7504
|
-
"in": "body",
|
|
7505
|
-
"type": "string",
|
|
7506
|
-
"required": true,
|
|
7507
|
-
"description": "The secret itself, at most 16,384 bytes.",
|
|
7508
|
-
"example": "ak_live_\u2026",
|
|
7509
|
-
"schema": {
|
|
7510
|
-
"type": "string",
|
|
7511
|
-
"description": "The secret itself, at most 16,384 bytes."
|
|
7512
|
-
}
|
|
7513
|
-
},
|
|
7514
|
-
{
|
|
7515
|
-
"name": "hosts",
|
|
7516
|
-
"in": "body",
|
|
7517
|
-
"type": "json",
|
|
7518
|
-
"required": true,
|
|
7519
|
-
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`.",
|
|
7520
|
-
"example": [
|
|
7521
|
-
"api.yourapp.com"
|
|
7522
|
-
],
|
|
7523
|
-
"schema": {
|
|
7524
|
-
"type": "array",
|
|
7525
|
-
"items": {
|
|
7526
|
-
"type": "string"
|
|
7527
|
-
},
|
|
7528
|
-
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`."
|
|
7529
|
-
}
|
|
7530
|
-
},
|
|
7531
8072
|
{
|
|
7532
8073
|
"name": "allowEnvVar",
|
|
7533
8074
|
"in": "body",
|
|
7534
8075
|
"type": "boolean",
|
|
7535
8076
|
"required": false,
|
|
7536
|
-
"description": "Whether scripts can read the secret as an environment variable.
|
|
8077
|
+
"description": "Whether scripts can read the secret as an environment variable. A new secret starts with false, so Reminix only attaches it to requests.",
|
|
7537
8078
|
"schema": {
|
|
7538
8079
|
"type": "boolean",
|
|
7539
|
-
"description": "Whether scripts can read the secret as an environment variable.
|
|
8080
|
+
"description": "Whether scripts can read the secret as an environment variable. A new secret starts with false, so Reminix only attaches it to requests."
|
|
7540
8081
|
}
|
|
7541
8082
|
}
|
|
7542
8083
|
],
|
|
@@ -7581,11 +8122,11 @@ var OPERATIONS = [
|
|
|
7581
8122
|
"in": "path",
|
|
7582
8123
|
"type": "string",
|
|
7583
8124
|
"required": true,
|
|
7584
|
-
"description": "The environment's
|
|
7585
|
-
"example": "
|
|
8125
|
+
"description": "The environment's name.",
|
|
8126
|
+
"example": "production",
|
|
7586
8127
|
"schema": {
|
|
7587
8128
|
"type": "string",
|
|
7588
|
-
"description": "The environment's
|
|
8129
|
+
"description": "The environment's name."
|
|
7589
8130
|
}
|
|
7590
8131
|
}
|
|
7591
8132
|
],
|
|
@@ -7595,12 +8136,91 @@ var OPERATIONS = [
|
|
|
7595
8136
|
"scope": "secrets:write"
|
|
7596
8137
|
},
|
|
7597
8138
|
{
|
|
7598
|
-
"operationId": "
|
|
8139
|
+
"operationId": "secretValues.set",
|
|
8140
|
+
"method": "put",
|
|
8141
|
+
"path": "/secrets/{name}/values/{environment}",
|
|
8142
|
+
"summary": "Save a secret's value",
|
|
8143
|
+
"cli": {
|
|
8144
|
+
"command": "secrets set",
|
|
8145
|
+
"args": [
|
|
8146
|
+
"name",
|
|
8147
|
+
"environment"
|
|
8148
|
+
],
|
|
8149
|
+
"confirm": false,
|
|
8150
|
+
"sample": 'printf %s "$ADMIN_KEY" | \\\n reminix secrets set ADMIN_KEY \\\n --hosts api.yourapp.com'
|
|
8151
|
+
},
|
|
8152
|
+
"mcp": {
|
|
8153
|
+
"exposed": false,
|
|
8154
|
+
"reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
|
|
8155
|
+
},
|
|
8156
|
+
"description": "Saves a secret's value in one 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.",
|
|
8157
|
+
"fields": [
|
|
8158
|
+
{
|
|
8159
|
+
"name": "name",
|
|
8160
|
+
"in": "path",
|
|
8161
|
+
"type": "string",
|
|
8162
|
+
"required": true,
|
|
8163
|
+
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters.",
|
|
8164
|
+
"example": "ADMIN_KEY",
|
|
8165
|
+
"schema": {
|
|
8166
|
+
"type": "string",
|
|
8167
|
+
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
|
|
8168
|
+
}
|
|
8169
|
+
},
|
|
8170
|
+
{
|
|
8171
|
+
"name": "environment",
|
|
8172
|
+
"in": "path",
|
|
8173
|
+
"type": "string",
|
|
8174
|
+
"required": true,
|
|
8175
|
+
"description": "The environment's name.",
|
|
8176
|
+
"example": "production",
|
|
8177
|
+
"schema": {
|
|
8178
|
+
"type": "string",
|
|
8179
|
+
"description": "The environment's name."
|
|
8180
|
+
}
|
|
8181
|
+
},
|
|
8182
|
+
{
|
|
8183
|
+
"name": "value",
|
|
8184
|
+
"in": "body",
|
|
8185
|
+
"type": "string",
|
|
8186
|
+
"required": true,
|
|
8187
|
+
"description": "The secret itself, at most 16,384 bytes.",
|
|
8188
|
+
"example": "ak_live_\u2026",
|
|
8189
|
+
"schema": {
|
|
8190
|
+
"type": "string",
|
|
8191
|
+
"description": "The secret itself, at most 16,384 bytes."
|
|
8192
|
+
}
|
|
8193
|
+
},
|
|
8194
|
+
{
|
|
8195
|
+
"name": "hosts",
|
|
8196
|
+
"in": "body",
|
|
8197
|
+
"type": "json",
|
|
8198
|
+
"required": true,
|
|
8199
|
+
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`.",
|
|
8200
|
+
"example": [
|
|
8201
|
+
"api.yourapp.com"
|
|
8202
|
+
],
|
|
8203
|
+
"schema": {
|
|
8204
|
+
"type": "array",
|
|
8205
|
+
"items": {
|
|
8206
|
+
"type": "string"
|
|
8207
|
+
},
|
|
8208
|
+
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`."
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
],
|
|
8212
|
+
"hasBody": true,
|
|
8213
|
+
"workspace": true,
|
|
8214
|
+
"acceptsApiKey": true,
|
|
8215
|
+
"scope": "secrets:write"
|
|
8216
|
+
},
|
|
8217
|
+
{
|
|
8218
|
+
"operationId": "triggerCalls.list",
|
|
7599
8219
|
"method": "get",
|
|
7600
8220
|
"path": "/scripts/{slug}/triggers/{triggerId}/calls",
|
|
7601
8221
|
"summary": "List a webhook trigger's calls",
|
|
7602
8222
|
"cli": {
|
|
7603
|
-
"command": "
|
|
8223
|
+
"command": "trigger-calls list",
|
|
7604
8224
|
"args": [
|
|
7605
8225
|
"slug",
|
|
7606
8226
|
"triggerId"
|
|
@@ -7609,14 +8229,14 @@ var OPERATIONS = [
|
|
|
7609
8229
|
},
|
|
7610
8230
|
"mcp": {
|
|
7611
8231
|
"exposed": true,
|
|
7612
|
-
"name": "
|
|
8232
|
+
"name": "trigger_calls_list",
|
|
7613
8233
|
"hints": {
|
|
7614
8234
|
"readOnlyHint": true,
|
|
7615
8235
|
"destructiveHint": false,
|
|
7616
8236
|
"idempotentHint": true
|
|
7617
8237
|
}
|
|
7618
8238
|
},
|
|
7619
|
-
"description": "
|
|
8239
|
+
"description": "Lists a webhook trigger's calls, newest first: when each came, whether it started a run or repeated an earlier call, why Reminix refused it, and the run. Reminix keeps calls for 30 days.",
|
|
7620
8240
|
"fields": [
|
|
7621
8241
|
{
|
|
7622
8242
|
"name": "slug",
|
|
@@ -7636,14 +8256,41 @@ var OPERATIONS = [
|
|
|
7636
8256
|
"type": "string",
|
|
7637
8257
|
"required": true,
|
|
7638
8258
|
"description": "The trigger's ID.",
|
|
7639
|
-
"example": "
|
|
8259
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
8260
|
+
"schema": {
|
|
8261
|
+
"type": "string",
|
|
8262
|
+
"description": "The trigger's ID."
|
|
8263
|
+
}
|
|
8264
|
+
},
|
|
8265
|
+
{
|
|
8266
|
+
"name": "limit",
|
|
8267
|
+
"in": "query",
|
|
8268
|
+
"type": "number",
|
|
8269
|
+
"required": false,
|
|
8270
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
8271
|
+
"example": 25,
|
|
8272
|
+
"schema": {
|
|
8273
|
+
"type": "integer",
|
|
8274
|
+
"minimum": 1,
|
|
8275
|
+
"maximum": 100,
|
|
8276
|
+
"default": 25,
|
|
8277
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
8278
|
+
}
|
|
8279
|
+
},
|
|
8280
|
+
{
|
|
8281
|
+
"name": "cursor",
|
|
8282
|
+
"in": "query",
|
|
8283
|
+
"type": "string",
|
|
8284
|
+
"required": false,
|
|
8285
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
7640
8286
|
"schema": {
|
|
7641
8287
|
"type": "string",
|
|
7642
|
-
"description": "
|
|
8288
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
7643
8289
|
}
|
|
7644
8290
|
}
|
|
7645
8291
|
],
|
|
7646
8292
|
"hasBody": false,
|
|
8293
|
+
"paginated": true,
|
|
7647
8294
|
"workspace": true,
|
|
7648
8295
|
"acceptsApiKey": true,
|
|
7649
8296
|
"scope": "scripts:read"
|
|
@@ -7882,7 +8529,7 @@ var OPERATIONS = [
|
|
|
7882
8529
|
"type": "string",
|
|
7883
8530
|
"required": true,
|
|
7884
8531
|
"description": "The trigger's ID.",
|
|
7885
|
-
"example": "
|
|
8532
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
7886
8533
|
"schema": {
|
|
7887
8534
|
"type": "string",
|
|
7888
8535
|
"description": "The trigger's ID."
|
|
@@ -7894,6 +8541,60 @@ var OPERATIONS = [
|
|
|
7894
8541
|
"acceptsApiKey": true,
|
|
7895
8542
|
"scope": "scripts:write"
|
|
7896
8543
|
},
|
|
8544
|
+
{
|
|
8545
|
+
"operationId": "triggers.get",
|
|
8546
|
+
"method": "get",
|
|
8547
|
+
"path": "/scripts/{slug}/triggers/{triggerId}",
|
|
8548
|
+
"summary": "Get a trigger",
|
|
8549
|
+
"cli": {
|
|
8550
|
+
"command": "triggers get",
|
|
8551
|
+
"args": [
|
|
8552
|
+
"slug",
|
|
8553
|
+
"triggerId"
|
|
8554
|
+
],
|
|
8555
|
+
"confirm": false
|
|
8556
|
+
},
|
|
8557
|
+
"mcp": {
|
|
8558
|
+
"exposed": true,
|
|
8559
|
+
"name": "triggers_get",
|
|
8560
|
+
"hints": {
|
|
8561
|
+
"readOnlyHint": true,
|
|
8562
|
+
"destructiveHint": false,
|
|
8563
|
+
"idempotentHint": true
|
|
8564
|
+
}
|
|
8565
|
+
},
|
|
8566
|
+
"description": "Returns one of a script's triggers. A webhook trigger's secret is never returned again after it is made or rotated.",
|
|
8567
|
+
"fields": [
|
|
8568
|
+
{
|
|
8569
|
+
"name": "slug",
|
|
8570
|
+
"in": "path",
|
|
8571
|
+
"type": "string",
|
|
8572
|
+
"required": true,
|
|
8573
|
+
"description": "The slug's ID.",
|
|
8574
|
+
"example": "alert-on-failure",
|
|
8575
|
+
"schema": {
|
|
8576
|
+
"type": "string",
|
|
8577
|
+
"description": "The slug's ID."
|
|
8578
|
+
}
|
|
8579
|
+
},
|
|
8580
|
+
{
|
|
8581
|
+
"name": "triggerId",
|
|
8582
|
+
"in": "path",
|
|
8583
|
+
"type": "string",
|
|
8584
|
+
"required": true,
|
|
8585
|
+
"description": "The trigger's ID.",
|
|
8586
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
8587
|
+
"schema": {
|
|
8588
|
+
"type": "string",
|
|
8589
|
+
"description": "The trigger's ID."
|
|
8590
|
+
}
|
|
8591
|
+
}
|
|
8592
|
+
],
|
|
8593
|
+
"hasBody": false,
|
|
8594
|
+
"workspace": true,
|
|
8595
|
+
"acceptsApiKey": true,
|
|
8596
|
+
"scope": "scripts:read"
|
|
8597
|
+
},
|
|
7897
8598
|
{
|
|
7898
8599
|
"operationId": "triggers.list",
|
|
7899
8600
|
"method": "get",
|
|
@@ -7928,9 +8629,36 @@ var OPERATIONS = [
|
|
|
7928
8629
|
"type": "string",
|
|
7929
8630
|
"description": "The slug's ID."
|
|
7930
8631
|
}
|
|
8632
|
+
},
|
|
8633
|
+
{
|
|
8634
|
+
"name": "limit",
|
|
8635
|
+
"in": "query",
|
|
8636
|
+
"type": "number",
|
|
8637
|
+
"required": false,
|
|
8638
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
8639
|
+
"example": 25,
|
|
8640
|
+
"schema": {
|
|
8641
|
+
"type": "integer",
|
|
8642
|
+
"minimum": 1,
|
|
8643
|
+
"maximum": 100,
|
|
8644
|
+
"default": 25,
|
|
8645
|
+
"description": "Items per page, 1\u2013100 (default 25)."
|
|
8646
|
+
}
|
|
8647
|
+
},
|
|
8648
|
+
{
|
|
8649
|
+
"name": "cursor",
|
|
8650
|
+
"in": "query",
|
|
8651
|
+
"type": "string",
|
|
8652
|
+
"required": false,
|
|
8653
|
+
"description": "Opaque token from a previous page's nextCursor.",
|
|
8654
|
+
"schema": {
|
|
8655
|
+
"type": "string",
|
|
8656
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
8657
|
+
}
|
|
7931
8658
|
}
|
|
7932
8659
|
],
|
|
7933
8660
|
"hasBody": false,
|
|
8661
|
+
"paginated": true,
|
|
7934
8662
|
"workspace": true,
|
|
7935
8663
|
"acceptsApiKey": true,
|
|
7936
8664
|
"scope": "scripts:read"
|
|
@@ -7972,7 +8700,7 @@ var OPERATIONS = [
|
|
|
7972
8700
|
"type": "string",
|
|
7973
8701
|
"required": true,
|
|
7974
8702
|
"description": "The trigger's ID.",
|
|
7975
|
-
"example": "
|
|
8703
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
7976
8704
|
"schema": {
|
|
7977
8705
|
"type": "string",
|
|
7978
8706
|
"description": "The trigger's ID."
|
|
@@ -8021,7 +8749,7 @@ var OPERATIONS = [
|
|
|
8021
8749
|
"type": "string",
|
|
8022
8750
|
"required": true,
|
|
8023
8751
|
"description": "The trigger's ID.",
|
|
8024
|
-
"example": "
|
|
8752
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
8025
8753
|
"schema": {
|
|
8026
8754
|
"type": "string",
|
|
8027
8755
|
"description": "The trigger's ID."
|
|
@@ -8216,9 +8944,10 @@ var OPERATIONS = [
|
|
|
8216
8944
|
"idempotentHint": true
|
|
8217
8945
|
}
|
|
8218
8946
|
},
|
|
8219
|
-
"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.",
|
|
8947
|
+
"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 (`inputSchema`), who can approve it and whether it creates a secret. Every action fits on one page, so `nextCursor` is null.",
|
|
8220
8948
|
"fields": [],
|
|
8221
8949
|
"hasBody": false,
|
|
8950
|
+
"paginated": true,
|
|
8222
8951
|
"workspace": true,
|
|
8223
8952
|
"acceptsApiKey": true,
|
|
8224
8953
|
"scope": "workspace.approvals:read"
|
|
@@ -8297,12 +9026,12 @@ var OPERATIONS = [
|
|
|
8297
9026
|
{
|
|
8298
9027
|
"operationId": "workspace.approvalRequests.get",
|
|
8299
9028
|
"method": "get",
|
|
8300
|
-
"path": "/workspace/approval-requests/{
|
|
9029
|
+
"path": "/workspace/approval-requests/{approvalRequestId}",
|
|
8301
9030
|
"summary": "Check an approval request",
|
|
8302
9031
|
"cli": {
|
|
8303
9032
|
"command": "workspace approval-requests get",
|
|
8304
9033
|
"args": [
|
|
8305
|
-
"
|
|
9034
|
+
"approvalRequestId"
|
|
8306
9035
|
],
|
|
8307
9036
|
"confirm": false
|
|
8308
9037
|
},
|
|
@@ -8318,15 +9047,15 @@ var OPERATIONS = [
|
|
|
8318
9047
|
"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`.",
|
|
8319
9048
|
"fields": [
|
|
8320
9049
|
{
|
|
8321
|
-
"name": "
|
|
9050
|
+
"name": "approvalRequestId",
|
|
8322
9051
|
"in": "path",
|
|
8323
9052
|
"type": "string",
|
|
8324
9053
|
"required": true,
|
|
8325
|
-
"description": "The request's id.",
|
|
8326
|
-
"example": "
|
|
9054
|
+
"description": "The approval request's id.",
|
|
9055
|
+
"example": "apr_7c2e9b4d-1f3a-4e5b-8c6d-7e8f9a0b1c2d",
|
|
8327
9056
|
"schema": {
|
|
8328
9057
|
"type": "string",
|
|
8329
|
-
"description": "The request's id."
|
|
9058
|
+
"description": "The approval request's id."
|
|
8330
9059
|
}
|
|
8331
9060
|
}
|
|
8332
9061
|
],
|
|
@@ -8338,12 +9067,12 @@ var OPERATIONS = [
|
|
|
8338
9067
|
{
|
|
8339
9068
|
"operationId": "workspace.approvalRequests.redeem",
|
|
8340
9069
|
"method": "post",
|
|
8341
|
-
"path": "/workspace/approval-requests/{
|
|
9070
|
+
"path": "/workspace/approval-requests/{approvalRequestId}/redeem",
|
|
8342
9071
|
"summary": "Redeem an approved request",
|
|
8343
9072
|
"cli": {
|
|
8344
9073
|
"command": "workspace approval-requests redeem",
|
|
8345
9074
|
"args": [
|
|
8346
|
-
"
|
|
9075
|
+
"approvalRequestId"
|
|
8347
9076
|
],
|
|
8348
9077
|
"confirm": false
|
|
8349
9078
|
},
|
|
@@ -8354,15 +9083,15 @@ var OPERATIONS = [
|
|
|
8354
9083
|
"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.",
|
|
8355
9084
|
"fields": [
|
|
8356
9085
|
{
|
|
8357
|
-
"name": "
|
|
9086
|
+
"name": "approvalRequestId",
|
|
8358
9087
|
"in": "path",
|
|
8359
9088
|
"type": "string",
|
|
8360
9089
|
"required": true,
|
|
8361
|
-
"description": "The request's id.",
|
|
8362
|
-
"example": "
|
|
9090
|
+
"description": "The approval request's id.",
|
|
9091
|
+
"example": "apr_7c2e9b4d-1f3a-4e5b-8c6d-7e8f9a0b1c2d",
|
|
8363
9092
|
"schema": {
|
|
8364
9093
|
"type": "string",
|
|
8365
|
-
"description": "The request's id."
|
|
9094
|
+
"description": "The approval request's id."
|
|
8366
9095
|
}
|
|
8367
9096
|
}
|
|
8368
9097
|
],
|
|
@@ -8390,7 +9119,7 @@ var OPERATIONS = [
|
|
|
8390
9119
|
"idempotentHint": true
|
|
8391
9120
|
}
|
|
8392
9121
|
},
|
|
8393
|
-
"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.",
|
|
9122
|
+
"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 and admins can call this, as with the audit page in the app. A workspace API key always can, because it acts as the workspace itself.",
|
|
8394
9123
|
"fields": [
|
|
8395
9124
|
{
|
|
8396
9125
|
"name": "limit",
|
|
@@ -8437,7 +9166,7 @@ var OPERATIONS = [
|
|
|
8437
9166
|
"type": "string",
|
|
8438
9167
|
"required": false,
|
|
8439
9168
|
"description": "Only events of this action.",
|
|
8440
|
-
"example": "workspace.
|
|
9169
|
+
"example": "workspace.member.invited",
|
|
8441
9170
|
"schema": {
|
|
8442
9171
|
"type": "string",
|
|
8443
9172
|
"maxLength": 100,
|
|
@@ -8450,7 +9179,7 @@ var OPERATIONS = [
|
|
|
8450
9179
|
"type": "string",
|
|
8451
9180
|
"required": false,
|
|
8452
9181
|
"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`).",
|
|
8453
|
-
"example": "user:
|
|
9182
|
+
"example": "user:usr_4f8a2c1e-7b3d-4e9f-a6c5-2d1b0e9f8a7c",
|
|
8454
9183
|
"schema": {
|
|
8455
9184
|
"type": "string",
|
|
8456
9185
|
"pattern": "^(user|credential):[\\w-]+$",
|
|
@@ -8459,6 +9188,7 @@ var OPERATIONS = [
|
|
|
8459
9188
|
}
|
|
8460
9189
|
],
|
|
8461
9190
|
"hasBody": false,
|
|
9191
|
+
"paginated": true,
|
|
8462
9192
|
"workspace": true,
|
|
8463
9193
|
"acceptsApiKey": true,
|
|
8464
9194
|
"scope": "workspace.audit:read"
|
|
@@ -8482,9 +9212,10 @@ var OPERATIONS = [
|
|
|
8482
9212
|
"idempotentHint": true
|
|
8483
9213
|
}
|
|
8484
9214
|
},
|
|
8485
|
-
"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.",
|
|
9215
|
+
"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. Every type fits on one page, so `nextCursor` is null.",
|
|
8486
9216
|
"fields": [],
|
|
8487
9217
|
"hasBody": false,
|
|
9218
|
+
"paginated": true,
|
|
8488
9219
|
"workspace": true,
|
|
8489
9220
|
"acceptsApiKey": true,
|
|
8490
9221
|
"scope": "workspace.webhooks:read"
|
|
@@ -8564,6 +9295,7 @@ var OPERATIONS = [
|
|
|
8564
9295
|
}
|
|
8565
9296
|
],
|
|
8566
9297
|
"hasBody": false,
|
|
9298
|
+
"paginated": true,
|
|
8567
9299
|
"workspace": true,
|
|
8568
9300
|
"acceptsApiKey": true,
|
|
8569
9301
|
"scope": "workspace.members:read"
|
|
@@ -8617,10 +9349,37 @@ var OPERATIONS = [
|
|
|
8617
9349
|
}
|
|
8618
9350
|
],
|
|
8619
9351
|
"hasBody": false,
|
|
9352
|
+
"paginated": true,
|
|
8620
9353
|
"workspace": true,
|
|
8621
9354
|
"acceptsApiKey": true,
|
|
8622
9355
|
"scope": "workspace.members:read"
|
|
8623
9356
|
},
|
|
9357
|
+
{
|
|
9358
|
+
"operationId": "workspace.planUsage.get",
|
|
9359
|
+
"method": "get",
|
|
9360
|
+
"path": "/workspace/plan-usage",
|
|
9361
|
+
"summary": "Get your plan's usage this period",
|
|
9362
|
+
"cli": {
|
|
9363
|
+
"command": "workspace plan-usage get",
|
|
9364
|
+
"args": [],
|
|
9365
|
+
"confirm": false
|
|
9366
|
+
},
|
|
9367
|
+
"mcp": {
|
|
9368
|
+
"exposed": true,
|
|
9369
|
+
"name": "workspace_plan_usage_get",
|
|
9370
|
+
"hints": {
|
|
9371
|
+
"readOnlyHint": true,
|
|
9372
|
+
"destructiveHint": false,
|
|
9373
|
+
"idempotentHint": true
|
|
9374
|
+
}
|
|
9375
|
+
},
|
|
9376
|
+
"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. Each entry also says where it stands and where we start refusing new use. 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.",
|
|
9377
|
+
"fields": [],
|
|
9378
|
+
"hasBody": false,
|
|
9379
|
+
"workspace": true,
|
|
9380
|
+
"acceptsApiKey": true,
|
|
9381
|
+
"scope": "workspace:read"
|
|
9382
|
+
},
|
|
8624
9383
|
{
|
|
8625
9384
|
"operationId": "workspace.teams.list",
|
|
8626
9385
|
"method": "get",
|
|
@@ -8670,36 +9429,11 @@ var OPERATIONS = [
|
|
|
8670
9429
|
}
|
|
8671
9430
|
],
|
|
8672
9431
|
"hasBody": false,
|
|
9432
|
+
"paginated": true,
|
|
8673
9433
|
"workspace": true,
|
|
8674
9434
|
"acceptsApiKey": true,
|
|
8675
9435
|
"scope": "workspace.teams:read"
|
|
8676
9436
|
},
|
|
8677
|
-
{
|
|
8678
|
-
"operationId": "workspace.usage",
|
|
8679
|
-
"method": "get",
|
|
8680
|
-
"path": "/workspace/usage",
|
|
8681
|
-
"summary": "Get your plan's usage this period",
|
|
8682
|
-
"cli": {
|
|
8683
|
-
"command": "workspace usage",
|
|
8684
|
-
"args": [],
|
|
8685
|
-
"confirm": false
|
|
8686
|
-
},
|
|
8687
|
-
"mcp": {
|
|
8688
|
-
"exposed": true,
|
|
8689
|
-
"name": "workspace_usage",
|
|
8690
|
-
"hints": {
|
|
8691
|
-
"readOnlyHint": true,
|
|
8692
|
-
"destructiveHint": false,
|
|
8693
|
-
"idempotentHint": true
|
|
8694
|
-
}
|
|
8695
|
-
},
|
|
8696
|
-
"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. Each entry also says where it stands and where we start refusing new use. 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.",
|
|
8697
|
-
"fields": [],
|
|
8698
|
-
"hasBody": false,
|
|
8699
|
-
"workspace": true,
|
|
8700
|
-
"acceptsApiKey": true,
|
|
8701
|
-
"scope": "workspace:read"
|
|
8702
|
-
},
|
|
8703
9437
|
{
|
|
8704
9438
|
"operationId": "workspace.webhookDeliveries.list",
|
|
8705
9439
|
"method": "get",
|
|
@@ -8721,7 +9455,7 @@ var OPERATIONS = [
|
|
|
8721
9455
|
"idempotentHint": true
|
|
8722
9456
|
}
|
|
8723
9457
|
},
|
|
8724
|
-
"description": "Lists one endpoint's delivery history, newest first. Each entry shows the
|
|
9458
|
+
"description": "Lists one endpoint's delivery history, newest first. Each entry shows the delivery's state, its attempts and the last HTTP status code. 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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
8725
9459
|
"fields": [
|
|
8726
9460
|
{
|
|
8727
9461
|
"name": "endpointId",
|
|
@@ -8729,7 +9463,7 @@ var OPERATIONS = [
|
|
|
8729
9463
|
"type": "string",
|
|
8730
9464
|
"required": true,
|
|
8731
9465
|
"description": "The endpoint's ID.",
|
|
8732
|
-
"example": "
|
|
9466
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8733
9467
|
"schema": {
|
|
8734
9468
|
"type": "string",
|
|
8735
9469
|
"description": "The endpoint's ID."
|
|
@@ -8793,6 +9527,7 @@ var OPERATIONS = [
|
|
|
8793
9527
|
}
|
|
8794
9528
|
],
|
|
8795
9529
|
"hasBody": false,
|
|
9530
|
+
"paginated": true,
|
|
8796
9531
|
"workspace": true,
|
|
8797
9532
|
"acceptsApiKey": true,
|
|
8798
9533
|
"scope": "workspace.webhooks:read"
|
|
@@ -8819,7 +9554,7 @@ var OPERATIONS = [
|
|
|
8819
9554
|
"idempotentHint": false
|
|
8820
9555
|
}
|
|
8821
9556
|
},
|
|
8822
|
-
"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,
|
|
9557
|
+
"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. It answers 200 when we attempted the delivery right away, with the endpoint's answer, and 202 when it went to the queue. With a personal access token, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
8823
9558
|
"fields": [
|
|
8824
9559
|
{
|
|
8825
9560
|
"name": "endpointId",
|
|
@@ -8827,7 +9562,7 @@ var OPERATIONS = [
|
|
|
8827
9562
|
"type": "string",
|
|
8828
9563
|
"required": true,
|
|
8829
9564
|
"description": "The endpoint's ID.",
|
|
8830
|
-
"example": "
|
|
9565
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8831
9566
|
"schema": {
|
|
8832
9567
|
"type": "string",
|
|
8833
9568
|
"description": "The endpoint's ID."
|
|
@@ -8839,7 +9574,7 @@ var OPERATIONS = [
|
|
|
8839
9574
|
"type": "string",
|
|
8840
9575
|
"required": true,
|
|
8841
9576
|
"description": "The delivery's ID.",
|
|
8842
|
-
"example": "
|
|
9577
|
+
"example": "del_8a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
|
|
8843
9578
|
"schema": {
|
|
8844
9579
|
"type": "string",
|
|
8845
9580
|
"description": "The delivery's ID."
|
|
@@ -8865,7 +9600,7 @@ var OPERATIONS = [
|
|
|
8865
9600
|
"exposed": false,
|
|
8866
9601
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8867
9602
|
},
|
|
8868
|
-
"description": "Registers an HTTPS URL to receive the workspace's events. Deliveries use the same signature format as Svix. The response
|
|
9603
|
+
"description": "Registers an HTTPS URL to receive the workspace's events. Deliveries use the same signature format as Svix. The response is the new endpoint with its signing secret (`whsec_\u2026`) in `secret`. 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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
8869
9604
|
"fields": [
|
|
8870
9605
|
{
|
|
8871
9606
|
"name": "url",
|
|
@@ -8933,7 +9668,7 @@ var OPERATIONS = [
|
|
|
8933
9668
|
"exposed": false,
|
|
8934
9669
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8935
9670
|
},
|
|
8936
|
-
"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,
|
|
9671
|
+
"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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
8937
9672
|
"fields": [
|
|
8938
9673
|
{
|
|
8939
9674
|
"name": "endpointId",
|
|
@@ -8941,7 +9676,7 @@ var OPERATIONS = [
|
|
|
8941
9676
|
"type": "string",
|
|
8942
9677
|
"required": true,
|
|
8943
9678
|
"description": "The endpoint's ID.",
|
|
8944
|
-
"example": "
|
|
9679
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8945
9680
|
"schema": {
|
|
8946
9681
|
"type": "string",
|
|
8947
9682
|
"description": "The endpoint's ID."
|
|
@@ -8969,7 +9704,7 @@ var OPERATIONS = [
|
|
|
8969
9704
|
"exposed": false,
|
|
8970
9705
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8971
9706
|
},
|
|
8972
|
-
"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,
|
|
9707
|
+
"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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
8973
9708
|
"fields": [
|
|
8974
9709
|
{
|
|
8975
9710
|
"name": "endpointId",
|
|
@@ -8977,7 +9712,7 @@ var OPERATIONS = [
|
|
|
8977
9712
|
"type": "string",
|
|
8978
9713
|
"required": true,
|
|
8979
9714
|
"description": "The endpoint's ID.",
|
|
8980
|
-
"example": "
|
|
9715
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8981
9716
|
"schema": {
|
|
8982
9717
|
"type": "string",
|
|
8983
9718
|
"description": "The endpoint's ID."
|
|
@@ -9010,7 +9745,7 @@ var OPERATIONS = [
|
|
|
9010
9745
|
"idempotentHint": true
|
|
9011
9746
|
}
|
|
9012
9747
|
},
|
|
9013
|
-
"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,
|
|
9748
|
+
"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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
9014
9749
|
"fields": [
|
|
9015
9750
|
{
|
|
9016
9751
|
"name": "endpointId",
|
|
@@ -9018,7 +9753,7 @@ var OPERATIONS = [
|
|
|
9018
9753
|
"type": "string",
|
|
9019
9754
|
"required": true,
|
|
9020
9755
|
"description": "The endpoint's ID.",
|
|
9021
|
-
"example": "
|
|
9756
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9022
9757
|
"schema": {
|
|
9023
9758
|
"type": "string",
|
|
9024
9759
|
"description": "The endpoint's ID."
|
|
@@ -9049,9 +9784,10 @@ var OPERATIONS = [
|
|
|
9049
9784
|
"idempotentHint": true
|
|
9050
9785
|
}
|
|
9051
9786
|
},
|
|
9052
|
-
"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,
|
|
9787
|
+
"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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
9053
9788
|
"fields": [],
|
|
9054
9789
|
"hasBody": false,
|
|
9790
|
+
"paginated": true,
|
|
9055
9791
|
"workspace": true,
|
|
9056
9792
|
"acceptsApiKey": true,
|
|
9057
9793
|
"scope": "workspace.webhooks:read"
|
|
@@ -9077,7 +9813,7 @@ var OPERATIONS = [
|
|
|
9077
9813
|
"idempotentHint": false
|
|
9078
9814
|
}
|
|
9079
9815
|
},
|
|
9080
|
-
"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,
|
|
9816
|
+
"description": "Sends a `ping` event to the endpoint, signed like every delivery. Use it to check that an integration verifies and accepts deliveries. It answers 200 when we attempted the delivery right away, with the endpoint's answer, and 202 when it went to the queue. With a personal access token, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
9081
9817
|
"fields": [
|
|
9082
9818
|
{
|
|
9083
9819
|
"name": "endpointId",
|
|
@@ -9085,7 +9821,7 @@ var OPERATIONS = [
|
|
|
9085
9821
|
"type": "string",
|
|
9086
9822
|
"required": true,
|
|
9087
9823
|
"description": "The endpoint's ID.",
|
|
9088
|
-
"example": "
|
|
9824
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9089
9825
|
"schema": {
|
|
9090
9826
|
"type": "string",
|
|
9091
9827
|
"description": "The endpoint's ID."
|
|
@@ -9113,7 +9849,7 @@ var OPERATIONS = [
|
|
|
9113
9849
|
"exposed": false,
|
|
9114
9850
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
9115
9851
|
},
|
|
9116
|
-
"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,
|
|
9852
|
+
"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, the workspace's owners and admins can call this, and members on the test side. A workspace API key with this scope can.",
|
|
9117
9853
|
"fields": [
|
|
9118
9854
|
{
|
|
9119
9855
|
"name": "endpointId",
|
|
@@ -9121,7 +9857,7 @@ var OPERATIONS = [
|
|
|
9121
9857
|
"type": "string",
|
|
9122
9858
|
"required": true,
|
|
9123
9859
|
"description": "The endpoint's ID.",
|
|
9124
|
-
"example": "
|
|
9860
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9125
9861
|
"schema": {
|
|
9126
9862
|
"type": "string",
|
|
9127
9863
|
"description": "The endpoint's ID."
|
|
@@ -9206,6 +9942,56 @@ function coveredOperations(program3) {
|
|
|
9206
9942
|
return covered;
|
|
9207
9943
|
}
|
|
9208
9944
|
|
|
9945
|
+
// src/flags.ts
|
|
9946
|
+
function kebab(name) {
|
|
9947
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9948
|
+
}
|
|
9949
|
+
function optionKey(flagName) {
|
|
9950
|
+
return flagName.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
9951
|
+
}
|
|
9952
|
+
function singular(word) {
|
|
9953
|
+
if (/[^aeiou]ies$/.test(word)) return `${word.slice(0, -3)}y`;
|
|
9954
|
+
if (/(ss|us|is)$/.test(word)) return word;
|
|
9955
|
+
if (/(x|ch|sh|ss)es$/.test(word)) return word.slice(0, -2);
|
|
9956
|
+
if (word.endsWith("s")) return word.slice(0, -1);
|
|
9957
|
+
return word;
|
|
9958
|
+
}
|
|
9959
|
+
function types(schema) {
|
|
9960
|
+
if (!schema) return [];
|
|
9961
|
+
const own = Array.isArray(schema.type) ? schema.type : schema.type ? [schema.type] : [];
|
|
9962
|
+
const variants = [...schema.anyOf ?? [], ...schema.oneOf ?? []];
|
|
9963
|
+
return [
|
|
9964
|
+
...own,
|
|
9965
|
+
...variants.flatMap(types),
|
|
9966
|
+
...schema.nullable ? ["null"] : []
|
|
9967
|
+
];
|
|
9968
|
+
}
|
|
9969
|
+
function nullable(field) {
|
|
9970
|
+
return types(field.schema).includes("null");
|
|
9971
|
+
}
|
|
9972
|
+
function fieldFlag(field, taken = /* @__PURE__ */ new Set()) {
|
|
9973
|
+
const schema = field.schema;
|
|
9974
|
+
const name = kebab(field.name);
|
|
9975
|
+
const clear = field.in === "body" && nullable(field) ? name : void 0;
|
|
9976
|
+
const base = { ...clear ? { clear } : {} };
|
|
9977
|
+
if (field.type === "boolean") return { name, kind: "boolean", ...base };
|
|
9978
|
+
const all = types(schema);
|
|
9979
|
+
const items = schema.items ?? [...schema.anyOf ?? []].find((s) => s.items)?.items;
|
|
9980
|
+
const itemTypes = types(items);
|
|
9981
|
+
const scalar = itemTypes.length > 0 && itemTypes.every((t) => ["string", "number", "integer"].includes(t));
|
|
9982
|
+
if (all.includes("array") && (scalar || Array.isArray(items?.enum))) {
|
|
9983
|
+
const words = name.split("-");
|
|
9984
|
+
const one = [...words.slice(0, -1), singular(words.at(-1))].join("-");
|
|
9985
|
+
return {
|
|
9986
|
+
name: one !== name && taken.has(one) ? name : one,
|
|
9987
|
+
kind: "list",
|
|
9988
|
+
...itemTypes.every((t) => t === "number" || t === "integer") ? { numbers: true } : {},
|
|
9989
|
+
...base
|
|
9990
|
+
};
|
|
9991
|
+
}
|
|
9992
|
+
return { name, kind: field.type === "json" ? "json" : "value", ...base };
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9209
9995
|
// src/generated.ts
|
|
9210
9996
|
var generatedCommands = (program3, ctx) => {
|
|
9211
9997
|
const groups = /* @__PURE__ */ new Set();
|
|
@@ -9221,12 +10007,10 @@ var generatedCommands = (program3, ctx) => {
|
|
|
9221
10007
|
}
|
|
9222
10008
|
};
|
|
9223
10009
|
var RESERVED = /* @__PURE__ */ new Set(["json", "yes", "workspace", "data", "environment"]);
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
return flag(name).replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
9229
|
-
}
|
|
10010
|
+
var collect = (value, previous) => [
|
|
10011
|
+
...previous ?? [],
|
|
10012
|
+
...value.split(",").map((part) => part.trim()).filter(Boolean)
|
|
10013
|
+
];
|
|
9230
10014
|
function register(program3, ctx, op, groups, hidden) {
|
|
9231
10015
|
const words = op.cli.command.split(" ");
|
|
9232
10016
|
const action = words.pop();
|
|
@@ -9245,22 +10029,41 @@ function register(program3, ctx, op, groups, hidden) {
|
|
|
9245
10029
|
return;
|
|
9246
10030
|
}
|
|
9247
10031
|
const positional = new Set(op.cli.args);
|
|
9248
|
-
const
|
|
10032
|
+
const fields = op.fields.filter(
|
|
9249
10033
|
(field) => !positional.has(field.name) && !RESERVED.has(field.name)
|
|
9250
10034
|
);
|
|
10035
|
+
const names = new Set(fields.map((field) => kebab(field.name)));
|
|
10036
|
+
const flags = fields.map((field) => ({
|
|
10037
|
+
field,
|
|
10038
|
+
spec: fieldFlag(field, names)
|
|
10039
|
+
}));
|
|
9251
10040
|
const command = parent.command(action, { hidden }).description(op.summary).addHelpText("after", `
|
|
9252
10041
|
${op.description}`);
|
|
9253
10042
|
markOperation(command, op.operationId);
|
|
9254
|
-
for (const arg of op.cli.args) command.argument(`<${
|
|
9255
|
-
for (const field of flags) {
|
|
10043
|
+
for (const arg of op.cli.args) command.argument(`<${kebab(arg)}>`);
|
|
10044
|
+
for (const { field, spec } of flags) {
|
|
9256
10045
|
const description = [
|
|
9257
10046
|
field.description ?? `${field.in} field`,
|
|
10047
|
+
spec.kind === "list" ? "Repeat it for each value." : "",
|
|
9258
10048
|
field.required ? "(required)" : ""
|
|
9259
10049
|
].filter(Boolean).join(" ");
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
)
|
|
10050
|
+
if (spec.kind === "boolean") {
|
|
10051
|
+
command.option(`--${spec.name}`, description);
|
|
10052
|
+
command.option(`--no-${spec.name}`, `turn --${spec.name} off`);
|
|
10053
|
+
} else if (spec.kind === "list") {
|
|
10054
|
+
command.option(`--${spec.name} <value>`, description, collect);
|
|
10055
|
+
} else {
|
|
10056
|
+
command.option(
|
|
10057
|
+
`--${spec.name} <${spec.kind === "json" ? "json" : "value"}>`,
|
|
10058
|
+
description
|
|
10059
|
+
);
|
|
10060
|
+
}
|
|
10061
|
+
if (spec.clear) {
|
|
10062
|
+
command.option(`--clear-${spec.clear}`, `set ${field.name} to null`);
|
|
10063
|
+
}
|
|
10064
|
+
}
|
|
10065
|
+
if (op.paginated) {
|
|
10066
|
+
command.option("--all", "every page, not just the first");
|
|
9264
10067
|
}
|
|
9265
10068
|
if (op.hasBody) command.option("--data <json>", "the whole JSON body");
|
|
9266
10069
|
if (op.rawBody) command.requiredOption("--file <path>", "the file to send");
|
|
@@ -9277,7 +10080,7 @@ ${op.description}`);
|
|
|
9277
10080
|
const values = input.slice(0, op.cli.args.length);
|
|
9278
10081
|
const options = input[op.cli.args.length];
|
|
9279
10082
|
if (op.cli.confirm && !options.yes) {
|
|
9280
|
-
throw new
|
|
10083
|
+
throw new UsageError(
|
|
9281
10084
|
`${op.summary} cannot be undone. Run it again with --yes to confirm.`
|
|
9282
10085
|
);
|
|
9283
10086
|
}
|
|
@@ -9295,62 +10098,111 @@ ${op.description}`);
|
|
|
9295
10098
|
print(ctx, result, options.json === true);
|
|
9296
10099
|
});
|
|
9297
10100
|
}
|
|
9298
|
-
function
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
10101
|
+
function number2(name, raw) {
|
|
10102
|
+
const n = Number(raw);
|
|
10103
|
+
if (raw === "" || Number.isNaN(n)) {
|
|
10104
|
+
throw new UsageError(`--${name} must be a number`);
|
|
10105
|
+
}
|
|
10106
|
+
return n;
|
|
10107
|
+
}
|
|
10108
|
+
function coerce({ field, spec }, raw) {
|
|
10109
|
+
if (spec.kind === "list") {
|
|
10110
|
+
const values = raw;
|
|
10111
|
+
return spec.numbers ? values.map((v) => number2(spec.name, v)) : values;
|
|
9304
10112
|
}
|
|
10113
|
+
if (spec.kind === "boolean") return raw === true;
|
|
10114
|
+
if (field.type === "number") return number2(spec.name, raw);
|
|
9305
10115
|
if (field.type === "json") {
|
|
9306
10116
|
try {
|
|
9307
10117
|
return JSON.parse(String(raw));
|
|
9308
10118
|
} catch {
|
|
9309
|
-
throw new
|
|
10119
|
+
throw new UsageError(`--${spec.name} must be JSON`);
|
|
9310
10120
|
}
|
|
9311
10121
|
}
|
|
9312
10122
|
return raw;
|
|
9313
10123
|
}
|
|
9314
10124
|
async function call2(ctx, op, args, options, flags) {
|
|
9315
|
-
const { api: api2, token, workspace: workspace2, environment: environment2 } = ctx.credentials({
|
|
9316
|
-
workspace: op.workspace ? options.workspace ?? void 0 : false
|
|
9317
|
-
});
|
|
9318
|
-
const values = (field) => field.in === "path" || op.cli.args.includes(field.name) ? args[field.name] : options[optionKey(field.name)];
|
|
9319
10125
|
let whole = {};
|
|
9320
10126
|
if (op.hasBody && options.data) {
|
|
9321
10127
|
try {
|
|
9322
10128
|
whole = JSON.parse(String(options.data));
|
|
9323
10129
|
} catch {
|
|
9324
|
-
throw new
|
|
10130
|
+
throw new UsageError("--data must be a JSON object");
|
|
9325
10131
|
}
|
|
9326
10132
|
}
|
|
9327
10133
|
const input = {};
|
|
9328
10134
|
for (const field of op.fields) {
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
10135
|
+
if (field.in === "path" || op.cli.args.includes(field.name)) {
|
|
10136
|
+
if (args[field.name] !== void 0) input[field.name] = args[field.name];
|
|
10137
|
+
}
|
|
10138
|
+
}
|
|
10139
|
+
for (const flagged of flags) {
|
|
10140
|
+
const { field, spec } = flagged;
|
|
10141
|
+
const raw = options[optionKey(spec.name)];
|
|
10142
|
+
const clear = spec.clear && options[optionKey(`clear-${spec.clear}`)];
|
|
10143
|
+
if (clear && raw !== void 0) {
|
|
10144
|
+
throw new UsageError(
|
|
10145
|
+
`pass --${spec.name} or --clear-${spec.clear}, not both`
|
|
10146
|
+
);
|
|
10147
|
+
}
|
|
10148
|
+
if (clear) input[field.name] = null;
|
|
10149
|
+
else if (raw !== void 0) {
|
|
10150
|
+
input[field.name] = field.in === "body" || spec.kind !== "value" ? coerce(flagged, raw) : raw;
|
|
10151
|
+
}
|
|
9332
10152
|
}
|
|
9333
10153
|
const missing = flags.filter(
|
|
9334
|
-
(field) => field.required && input[field.name] === void 0 && (field.in !== "body" || whole[field.name] === void 0)
|
|
10154
|
+
({ field }) => field.required && input[field.name] === void 0 && (field.in !== "body" || whole[field.name] === void 0)
|
|
9335
10155
|
);
|
|
9336
10156
|
if (missing.length > 0) {
|
|
9337
|
-
throw new
|
|
9338
|
-
`missing ${missing.map((
|
|
10157
|
+
throw new UsageError(
|
|
10158
|
+
`missing ${missing.map(({ spec }) => `--${spec.name}`).join(", ")}`
|
|
9339
10159
|
);
|
|
9340
10160
|
}
|
|
9341
10161
|
const problem = variantProblem(op, input, whole);
|
|
9342
|
-
if (problem) throw new
|
|
9343
|
-
const
|
|
10162
|
+
if (problem) throw new UsageError(problem);
|
|
10163
|
+
const credentials = ctx.credentials({
|
|
10164
|
+
workspace: op.workspace ? options.workspace ?? void 0 : false
|
|
10165
|
+
});
|
|
10166
|
+
if (op.paginated && options.all === true) {
|
|
10167
|
+
const paged = op.fields.some(
|
|
10168
|
+
(f) => f.in === "query" && f.name === "cursor"
|
|
10169
|
+
);
|
|
10170
|
+
const items = [];
|
|
10171
|
+
let cursor = input.cursor;
|
|
10172
|
+
for (; ; ) {
|
|
10173
|
+
const page = await send(
|
|
10174
|
+
ctx,
|
|
10175
|
+
op,
|
|
10176
|
+
credentials,
|
|
10177
|
+
operationRequest(op, { ...input, cursor }, whole),
|
|
10178
|
+
options
|
|
10179
|
+
);
|
|
10180
|
+
items.push(...page.items);
|
|
10181
|
+
if (!paged || typeof page.nextCursor !== "string") break;
|
|
10182
|
+
cursor = page.nextCursor;
|
|
10183
|
+
}
|
|
10184
|
+
return { items, nextCursor: null };
|
|
10185
|
+
}
|
|
10186
|
+
return send(
|
|
10187
|
+
ctx,
|
|
10188
|
+
op,
|
|
10189
|
+
credentials,
|
|
10190
|
+
operationRequest(op, input, whole),
|
|
10191
|
+
options
|
|
10192
|
+
);
|
|
10193
|
+
}
|
|
10194
|
+
async function send(ctx, op, credentials, request, options) {
|
|
10195
|
+
const { baseURL, token, workspace: workspace2, environment: environment3 } = credentials;
|
|
9344
10196
|
const headers = {
|
|
9345
10197
|
authorization: `Bearer ${token}`
|
|
9346
10198
|
};
|
|
9347
10199
|
if (workspace2) headers["x-workspace"] = workspace2;
|
|
9348
|
-
if (
|
|
10200
|
+
if (environment3) headers["x-environment"] = environment3;
|
|
9349
10201
|
if (request.body) headers["content-type"] = "application/json";
|
|
9350
10202
|
const raw = op.rawBody ? readFileSync3(String(options.file)) : void 0;
|
|
9351
10203
|
if (op.rawBody) headers["content-type"] = op.rawBody;
|
|
9352
10204
|
const response = await ctx.fetch(
|
|
9353
|
-
new Request(`${
|
|
10205
|
+
new Request(`${baseURL}/v1${request.path}`, {
|
|
9354
10206
|
method: request.method,
|
|
9355
10207
|
headers,
|
|
9356
10208
|
...request.body ? { body: JSON.stringify(request.body) } : {},
|
|
@@ -9361,16 +10213,13 @@ async function call2(ctx, op, args, options, flags) {
|
|
|
9361
10213
|
return new Uint8Array(await response.arrayBuffer());
|
|
9362
10214
|
}
|
|
9363
10215
|
const text = await response.text();
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
error?.code ?? "internal_error",
|
|
9370
|
-
error?.message ?? `HTTP ${response.status}`,
|
|
9371
|
-
error?.requestId
|
|
9372
|
-
);
|
|
10216
|
+
let data = null;
|
|
10217
|
+
try {
|
|
10218
|
+
data = text ? JSON.parse(text) : null;
|
|
10219
|
+
} catch {
|
|
10220
|
+
if (response.ok) throw new Error("the API's answer is not JSON");
|
|
9373
10221
|
}
|
|
10222
|
+
if (!response.ok) throw apiErrorFrom(data, response);
|
|
9374
10223
|
return data;
|
|
9375
10224
|
}
|
|
9376
10225
|
function scalarColumns(rows) {
|
|
@@ -9395,7 +10244,9 @@ function print(ctx, data, asJson) {
|
|
|
9395
10244
|
rows.length === 0 ? "No results." : table(rows, scalarColumns(rows))
|
|
9396
10245
|
);
|
|
9397
10246
|
if (typeof page.nextCursor === "string") {
|
|
9398
|
-
ctx.io.stdout(
|
|
10247
|
+
ctx.io.stdout(
|
|
10248
|
+
`More: --cursor ${page.nextCursor}, or --all for every page`
|
|
10249
|
+
);
|
|
9399
10250
|
}
|
|
9400
10251
|
return;
|
|
9401
10252
|
}
|
|
@@ -9417,14 +10268,21 @@ function variantProblem(op, input, whole) {
|
|
|
9417
10268
|
const chosen = String(input[key] ?? whole[key]);
|
|
9418
10269
|
const needs = op.variants.required[chosen];
|
|
9419
10270
|
if (!needs) {
|
|
9420
|
-
return `--${
|
|
10271
|
+
return `--${kebab(key)} must be one of ${Object.keys(op.variants.required).join(", ")}`;
|
|
9421
10272
|
}
|
|
9422
10273
|
const absent = needs.filter(
|
|
9423
10274
|
(name) => input[name] === void 0 && whole[name] === void 0
|
|
9424
10275
|
);
|
|
9425
|
-
return absent.length > 0 ? `missing ${absent.map((name) => `--${
|
|
10276
|
+
return absent.length > 0 ? `missing ${absent.map((name) => `--${kebab(name)}`).join(", ")} (needed with --${kebab(key)} ${chosen})` : void 0;
|
|
9426
10277
|
}
|
|
9427
10278
|
|
|
10279
|
+
// src/product/index.ts
|
|
10280
|
+
var product_exports2 = {};
|
|
10281
|
+
__export(product_exports2, {
|
|
10282
|
+
productCommands: () => productCommands,
|
|
10283
|
+
productErrorHint: () => productErrorHint
|
|
10284
|
+
});
|
|
10285
|
+
|
|
9428
10286
|
// src/product/files.ts
|
|
9429
10287
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
9430
10288
|
import { basename, dirname, join as join2, resolve, sep } from "node:path";
|
|
@@ -9444,7 +10302,7 @@ async function uploadPath(ctx, path2, workspace2) {
|
|
|
9444
10302
|
});
|
|
9445
10303
|
}
|
|
9446
10304
|
async function downloadBytes(ctx, id, workspace2) {
|
|
9447
|
-
const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/
|
|
10305
|
+
const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/content", {
|
|
9448
10306
|
params: { path: { fileId: id } },
|
|
9449
10307
|
parseAs: "arrayBuffer"
|
|
9450
10308
|
});
|
|
@@ -10280,7 +11138,16 @@ function parse(toml, options = {}) {
|
|
|
10280
11138
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
10281
11139
|
|
|
10282
11140
|
// src/internal/domain/product/detect.ts
|
|
11141
|
+
var READS_ARGUMENTS = {
|
|
11142
|
+
python: /\bsys\.argv\b|\bargparse\b|^\s*(?:import|from)\s+(?:click|typer)\b/m,
|
|
11143
|
+
node: /\bprocess\.argv\b|\bparseArgs\b/,
|
|
11144
|
+
shell: /\$\{?[1-9@*#]|\bgetopts\b/
|
|
11145
|
+
};
|
|
11146
|
+
function readsArguments(kind, code2) {
|
|
11147
|
+
return READS_ARGUMENTS[kind].test(code2);
|
|
11148
|
+
}
|
|
10283
11149
|
var SCRIPT = /\.(py|js|mjs|cjs|ts|mts|sh)$/i;
|
|
11150
|
+
var isScriptFile = (path2) => SCRIPT.test(path2);
|
|
10284
11151
|
var NOT_A_SCRIPT = /(\.config\.|^setup\.py$|^conftest\.py$|\.d\.ts$|\.test\.|_test\.py$|^test_)/i;
|
|
10285
11152
|
var HELP = 'Pass --command "\u2026" (for example --command "python report.py {month}"), add a reminix.json, or ask your agent to write one.';
|
|
10286
11153
|
function slugOf(name) {
|
|
@@ -10714,7 +11581,7 @@ Nothing was uploaded (--dry-run).`
|
|
|
10714
11581
|
if (options.number !== void 0) {
|
|
10715
11582
|
const version2 = Number(options.number);
|
|
10716
11583
|
if (!Number.isInteger(version2) || version2 < 1) {
|
|
10717
|
-
throw new
|
|
11584
|
+
throw new UsageError("--number: a version's number, like --number 3");
|
|
10718
11585
|
}
|
|
10719
11586
|
const script2 = await call3(
|
|
10720
11587
|
"POST",
|
|
@@ -10725,7 +11592,7 @@ Nothing was uploaded (--dry-run).`
|
|
|
10725
11592
|
slug: manifest.slug,
|
|
10726
11593
|
version: { version: version2 },
|
|
10727
11594
|
script: script2,
|
|
10728
|
-
line: approveUrl2 ? `Publishing ${manifest.slug} version ${version2} waits for a person's approval: ${approveUrl2}` :
|
|
11595
|
+
line: approveUrl2 ? `Publishing ${manifest.slug} version ${version2} waits for a person's approval: ${approveUrl2}` : published(ctx, manifest.slug, version2)
|
|
10729
11596
|
};
|
|
10730
11597
|
}
|
|
10731
11598
|
const version = await call3("POST", `/v1/scripts/${slug}/versions`, {
|
|
@@ -10746,10 +11613,37 @@ Nothing was uploaded (--dry-run).`
|
|
|
10746
11613
|
});
|
|
10747
11614
|
const script = null;
|
|
10748
11615
|
const approveUrl = version.approval?.approveUrl ?? null;
|
|
10749
|
-
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}\`.` :
|
|
11616
|
+
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(ctx, manifest.slug, version.version);
|
|
10750
11617
|
const found = detected ? `${describeDetected(manifest, detected)}
|
|
10751
11618
|
` : "";
|
|
10752
|
-
|
|
11619
|
+
const hint = inputsHint(dir, manifest, detected);
|
|
11620
|
+
return {
|
|
11621
|
+
slug: manifest.slug,
|
|
11622
|
+
version,
|
|
11623
|
+
script,
|
|
11624
|
+
line: `${found}${line}${hint ? `
|
|
11625
|
+
${hint}` : ""}`
|
|
11626
|
+
};
|
|
11627
|
+
}
|
|
11628
|
+
function inputsHint(dir, manifest, detected) {
|
|
11629
|
+
if (!detected || manifest.inputSchema !== void 0) return null;
|
|
11630
|
+
if (detected.command.includes("{") || !isScriptFile(detected.source)) {
|
|
11631
|
+
return null;
|
|
11632
|
+
}
|
|
11633
|
+
const code2 = localFolder(dir, [detected.source]).read(detected.source);
|
|
11634
|
+
if (code2 === null || !readsArguments(detected.kind, code2)) return null;
|
|
11635
|
+
return [
|
|
11636
|
+
"",
|
|
11637
|
+
`${detected.source} reads command-line arguments, but this script has no inputs yet, so its form has no fields.`,
|
|
11638
|
+
`To add a field, put its name in braces at the end of the command, then publish again:`,
|
|
11639
|
+
` ${brand.name} init "${detected.command} {input}"`,
|
|
11640
|
+
` ${brand.name} publish`,
|
|
11641
|
+
`Inputs: https://${brand.domain}/docs/scripts/#customizing-with-reminixjson`
|
|
11642
|
+
].join("\n");
|
|
11643
|
+
}
|
|
11644
|
+
function published(ctx, slug, version) {
|
|
11645
|
+
const web = webOriginFor(ctx.settings().baseURL);
|
|
11646
|
+
return web ? `Published ${slug} version ${version}: ${web}/scripts/${encodeURIComponent(slug)}` : `Published ${slug} version ${version}.`;
|
|
10753
11647
|
}
|
|
10754
11648
|
var definePublish = (mode) => (command, ctx) => defineFolderOptions(
|
|
10755
11649
|
mode === "publish" ? covers(
|
|
@@ -10787,7 +11681,9 @@ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
|
|
|
10787
11681
|
if (!options.json) ctx.io.stderr(`Skipped ${dir}: no script in it`);
|
|
10788
11682
|
}
|
|
10789
11683
|
if (options.number !== void 0 && folders.length + missing.length !== 1) {
|
|
10790
|
-
throw new
|
|
11684
|
+
throw new UsageError(
|
|
11685
|
+
"--number publishes one script: name one folder"
|
|
11686
|
+
);
|
|
10791
11687
|
}
|
|
10792
11688
|
if (folders.length === 1 && missing.length === 0) {
|
|
10793
11689
|
const result = await publishFolder(ctx, folders[0], options, mode);
|
|
@@ -10827,11 +11723,29 @@ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
|
|
|
10827
11723
|
}
|
|
10828
11724
|
}
|
|
10829
11725
|
);
|
|
10830
|
-
var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.testRun").option(
|
|
11726
|
+
var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions.testRun").option(
|
|
11727
|
+
"-f, --raw-field <name=value>",
|
|
11728
|
+
"an input, as a string (repeat it for several)",
|
|
11729
|
+
(value, all) => [...all, value],
|
|
11730
|
+
[]
|
|
11731
|
+
).option(
|
|
11732
|
+
"-F, --field <name=value>",
|
|
11733
|
+
"an input, typed: a number, true, false, null or JSON (repeat it for several)",
|
|
11734
|
+
(value, all) => [...all, value],
|
|
11735
|
+
[]
|
|
11736
|
+
).option(
|
|
11737
|
+
"--input-file <path>",
|
|
11738
|
+
"the inputs as a JSON object, from a file (- reads standard input)"
|
|
11739
|
+
).option(
|
|
10831
11740
|
"--file <input=path>",
|
|
10832
11741
|
"upload a file as a file input (repeat it for several)",
|
|
10833
11742
|
(value, all) => [...all, value],
|
|
10834
11743
|
[]
|
|
11744
|
+
).option(
|
|
11745
|
+
"--text <input=path>",
|
|
11746
|
+
"set a text input to a file's contents, lines and all (- reads standard input)",
|
|
11747
|
+
(value, all) => [...all, value],
|
|
11748
|
+
[]
|
|
10835
11749
|
).option(
|
|
10836
11750
|
"--out <dir>",
|
|
10837
11751
|
"download the files the run saves into this folder (else their links are printed)"
|
|
@@ -10843,21 +11757,16 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10843
11757
|
"answer at once with a run awaiting approval or still running, instead of following it"
|
|
10844
11758
|
).option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
|
|
10845
11759
|
async (slug, options) => {
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
);
|
|
10856
|
-
}
|
|
10857
|
-
if (inputs === null || typeof inputs !== "object" || Array.isArray(inputs)) {
|
|
10858
|
-
throw new Error(
|
|
10859
|
-
`--input: must be a JSON object, e.g. '{"orderId":"o_1"}'`
|
|
10860
|
-
);
|
|
11760
|
+
const inputs = await inputsOf(ctx, options);
|
|
11761
|
+
for (const spec of options.text) {
|
|
11762
|
+
const at = spec.indexOf("=");
|
|
11763
|
+
if (at <= 0 || at === spec.length - 1) {
|
|
11764
|
+
throw new UsageError(
|
|
11765
|
+
`--text: input=path, e.g. --text message=./reply.txt (got "${spec}")`
|
|
11766
|
+
);
|
|
11767
|
+
}
|
|
11768
|
+
const path2 = spec.slice(at + 1);
|
|
11769
|
+
inputs[spec.slice(0, at)] = path2 === "-" ? await ctx.io.stdin() : readFileSync5(path2, "utf8");
|
|
10861
11770
|
}
|
|
10862
11771
|
const call3 = (method, path2, body) => rawRequest(ctx, { method, path: path2, body, workspace: options.workspace });
|
|
10863
11772
|
if (options.file.length > 0) {
|
|
@@ -10865,7 +11774,7 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10865
11774
|
for (const spec of options.file) {
|
|
10866
11775
|
const at = spec.indexOf("=");
|
|
10867
11776
|
if (at <= 0 || at === spec.length - 1) {
|
|
10868
|
-
throw new
|
|
11777
|
+
throw new UsageError(
|
|
10869
11778
|
`--file: input=path, e.g. --file statement=./sept.pdf (got "${spec}")`
|
|
10870
11779
|
);
|
|
10871
11780
|
}
|
|
@@ -10884,7 +11793,7 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10884
11793
|
}
|
|
10885
11794
|
}
|
|
10886
11795
|
if (options.number !== void 0 && !/^[1-9]\d*$/.test(options.number)) {
|
|
10887
|
-
throw new
|
|
11796
|
+
throw new UsageError("--number: a version's number, like --number 2");
|
|
10888
11797
|
}
|
|
10889
11798
|
let run3 = await call3(
|
|
10890
11799
|
"POST",
|
|
@@ -10978,6 +11887,51 @@ var scriptCommands = (program3, ctx) => {
|
|
|
10978
11887
|
`Run a script and print its output. Use --number to test a draft. Short for ${brand.name} scripts run`
|
|
10979
11888
|
);
|
|
10980
11889
|
};
|
|
11890
|
+
async function inputsOf(ctx, options) {
|
|
11891
|
+
let inputs = {};
|
|
11892
|
+
if (options.inputFile !== void 0) {
|
|
11893
|
+
const text = options.inputFile === "-" ? await ctx.io.stdin() : readFileSync5(options.inputFile, "utf8");
|
|
11894
|
+
let parsed;
|
|
11895
|
+
try {
|
|
11896
|
+
parsed = JSON.parse(text);
|
|
11897
|
+
} catch (error) {
|
|
11898
|
+
throw new UsageError(
|
|
11899
|
+
`--input-file: not valid JSON (${error.message})`
|
|
11900
|
+
);
|
|
11901
|
+
}
|
|
11902
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
11903
|
+
throw new UsageError(
|
|
11904
|
+
'--input-file: must hold a JSON object, e.g. {"orderId": "o_1"}'
|
|
11905
|
+
);
|
|
11906
|
+
}
|
|
11907
|
+
inputs = parsed;
|
|
11908
|
+
}
|
|
11909
|
+
const split = (flag, spec) => {
|
|
11910
|
+
const at = spec.indexOf("=");
|
|
11911
|
+
if (at <= 0) {
|
|
11912
|
+
throw new UsageError(
|
|
11913
|
+
`${flag}: name=value, e.g. ${flag} orderId=o_1 (got "${spec}")`
|
|
11914
|
+
);
|
|
11915
|
+
}
|
|
11916
|
+
return [spec.slice(0, at), spec.slice(at + 1)];
|
|
11917
|
+
};
|
|
11918
|
+
for (const spec of options.field) {
|
|
11919
|
+
const [name, value] = split("-F", spec);
|
|
11920
|
+
inputs[name] = typed(value);
|
|
11921
|
+
}
|
|
11922
|
+
for (const spec of options.rawField) {
|
|
11923
|
+
const [name, value] = split("-f", spec);
|
|
11924
|
+
inputs[name] = value;
|
|
11925
|
+
}
|
|
11926
|
+
return inputs;
|
|
11927
|
+
}
|
|
11928
|
+
function typed(value) {
|
|
11929
|
+
try {
|
|
11930
|
+
return JSON.parse(value);
|
|
11931
|
+
} catch {
|
|
11932
|
+
return value;
|
|
11933
|
+
}
|
|
11934
|
+
}
|
|
10981
11935
|
|
|
10982
11936
|
// src/product/init.ts
|
|
10983
11937
|
import { closeSync as closeSync2, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
@@ -11089,34 +12043,81 @@ var initCommand = (program3, ctx) => {
|
|
|
11089
12043
|
// src/product/secrets.ts
|
|
11090
12044
|
var secretCommands = (program3, ctx) => {
|
|
11091
12045
|
const group = program3.commands.find((c) => c.name() === "secrets") ?? program3.command("secrets").description("secrets commands");
|
|
11092
|
-
|
|
11093
|
-
"
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
12046
|
+
covers(
|
|
12047
|
+
group.command("set <name>").description("Save a secret's value, read from stdin").requiredOption(
|
|
12048
|
+
"--hosts <hosts>",
|
|
12049
|
+
"the hosts it may be sent to, comma-separated (e.g. api.stripe.com)"
|
|
12050
|
+
).option(
|
|
12051
|
+
"--allow-env-var",
|
|
12052
|
+
"let scripts read the value as an environment variable (off for a new secret)"
|
|
12053
|
+
).option(
|
|
12054
|
+
"--no-allow-env-var",
|
|
12055
|
+
"attach the value to requests only, never as an environment variable"
|
|
12056
|
+
).option("--workspace <slug>", "act in this workspace for one call").option("--json", "machine-readable output"),
|
|
12057
|
+
"secretValues.set",
|
|
12058
|
+
"secrets.update"
|
|
12059
|
+
).action(
|
|
11099
12060
|
async (name, options) => {
|
|
11100
|
-
const value =
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
12061
|
+
const value = await readValue(ctx, name);
|
|
12062
|
+
const environment3 = await environmentOf(ctx, options.workspace);
|
|
12063
|
+
let secret = await saveValue(ctx, name, environment3, value, options);
|
|
12064
|
+
if (options.allowEnvVar !== void 0) {
|
|
12065
|
+
secret = await rawRequest(ctx, {
|
|
12066
|
+
method: "PATCH",
|
|
12067
|
+
path: `/v1/secrets/${encodeURIComponent(name)}`,
|
|
12068
|
+
body: { allowEnvVar: options.allowEnvVar },
|
|
12069
|
+
workspace: options.workspace
|
|
12070
|
+
});
|
|
11105
12071
|
}
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
body: {
|
|
11110
|
-
value,
|
|
11111
|
-
hosts: options.hosts.split(",").map((h) => h.trim()).filter(Boolean),
|
|
11112
|
-
allowEnvVar: options.allowEnvVar ?? false
|
|
11113
|
-
},
|
|
11114
|
-
workspace: options.workspace
|
|
11115
|
-
});
|
|
11116
|
-
ctx.io.stdout(options.json ? json(secret) : `Saved ${name}.`);
|
|
12072
|
+
ctx.io.stdout(
|
|
12073
|
+
options.json ? json(secret) : `Saved ${name} in ${environment3}.`
|
|
12074
|
+
);
|
|
11117
12075
|
}
|
|
11118
12076
|
);
|
|
11119
12077
|
};
|
|
12078
|
+
async function readValue(ctx, name) {
|
|
12079
|
+
const value = (await ctx.io.stdin()).replace(/\r?\n$/, "");
|
|
12080
|
+
if (!value) {
|
|
12081
|
+
throw new Error(
|
|
12082
|
+
`Pipe the value in, e.g. printf %s "$VALUE" | ${brand.name} secrets set ${name} --hosts \u2026`
|
|
12083
|
+
);
|
|
12084
|
+
}
|
|
12085
|
+
return value;
|
|
12086
|
+
}
|
|
12087
|
+
async function saveValue(ctx, name, environment3, value, options) {
|
|
12088
|
+
return rawRequest(ctx, {
|
|
12089
|
+
method: "PUT",
|
|
12090
|
+
path: `/v1/secrets/${encodeURIComponent(name)}/values/${encodeURIComponent(environment3)}`,
|
|
12091
|
+
body: {
|
|
12092
|
+
value,
|
|
12093
|
+
hosts: options.hosts.split(",").map((h) => h.trim()).filter(Boolean)
|
|
12094
|
+
},
|
|
12095
|
+
workspace: options.workspace
|
|
12096
|
+
});
|
|
12097
|
+
}
|
|
12098
|
+
async function environmentOf(ctx, workspace2) {
|
|
12099
|
+
const chosen = ctx.credentials({ workspace: workspace2 }).environment;
|
|
12100
|
+
if (chosen) return chosen;
|
|
12101
|
+
const environments = await rawRequest(ctx, {
|
|
12102
|
+
method: "GET",
|
|
12103
|
+
path: "/v1/environments?limit=100",
|
|
12104
|
+
workspace: workspace2
|
|
12105
|
+
});
|
|
12106
|
+
const fallback = environments.items.find((e) => e.isDefault);
|
|
12107
|
+
if (!fallback) throw new Error("This workspace has no default environment.");
|
|
12108
|
+
return fallback.name;
|
|
12109
|
+
}
|
|
12110
|
+
|
|
12111
|
+
// src/product/access.ts
|
|
12112
|
+
function productErrorHint(error) {
|
|
12113
|
+
if (error.code !== "forbidden") return null;
|
|
12114
|
+
const scope = /not granted the ([a-z_]+:[a-z]+) scope/.exec(
|
|
12115
|
+
error.message
|
|
12116
|
+
)?.[1];
|
|
12117
|
+
if (!scope) return null;
|
|
12118
|
+
const choice = /^(scripts|runs):/.test(scope) ? "Publish and run scripts" : "Full access";
|
|
12119
|
+
return `Sign in again with \`${brand.name} login\` and choose ${choice}.`;
|
|
12120
|
+
}
|
|
11120
12121
|
|
|
11121
12122
|
// src/product/index.ts
|
|
11122
12123
|
var productCommands = [
|
|
@@ -11137,15 +12138,18 @@ var commands = [
|
|
|
11137
12138
|
function tokenEnvVar() {
|
|
11138
12139
|
return `${brand.identifier.toUpperCase()}_TOKEN`;
|
|
11139
12140
|
}
|
|
12141
|
+
var VERSION2 = "1.0.0-rc.15";
|
|
11140
12142
|
function build(io) {
|
|
11141
12143
|
let actedIn = null;
|
|
11142
12144
|
let sending;
|
|
11143
|
-
const program3 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version(
|
|
12145
|
+
const program3 = new Command().name(brand.name).description(`The ${brand.productName} CLI`).version(VERSION2).addHelpText(
|
|
11144
12146
|
"after",
|
|
11145
12147
|
`
|
|
11146
12148
|
Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
|
|
11147
|
-
Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} environment use\`, else the default
|
|
11148
|
-
|
|
12149
|
+
Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} environment use\`, else the default.
|
|
12150
|
+
API: --base-url, else ${baseURLEnvVar()}, else the one \`${brand.name} login --base-url\` saved.
|
|
12151
|
+
Exit codes: 0 success, 1 failure, 2 wrong usage, 4 not logged in.`
|
|
12152
|
+
).option("--base-url <url>", "the API's origin, without /v1").option(
|
|
11149
12153
|
"--environment <name>",
|
|
11150
12154
|
"act in this environment (where the product has them)"
|
|
11151
12155
|
).option(
|
|
@@ -11157,13 +12161,15 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11157
12161
|
}).showHelpAfterError();
|
|
11158
12162
|
const ctx = {
|
|
11159
12163
|
io,
|
|
11160
|
-
settings: () => resolveSettings(
|
|
11161
|
-
|
|
11162
|
-
|
|
12164
|
+
settings: () => resolveSettings(
|
|
12165
|
+
io.env,
|
|
12166
|
+
io.homeDir,
|
|
12167
|
+
program3.opts()
|
|
12168
|
+
),
|
|
11163
12169
|
credentials: (options = {}) => {
|
|
11164
12170
|
const settings = ctx.settings();
|
|
11165
12171
|
if (!settings.token) {
|
|
11166
|
-
throw new
|
|
12172
|
+
throw new NotLoggedInError(
|
|
11167
12173
|
`not logged in. Run \`${brand.name} login\` or set ${tokenEnvVar()}.`
|
|
11168
12174
|
);
|
|
11169
12175
|
}
|
|
@@ -11174,7 +12180,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11174
12180
|
);
|
|
11175
12181
|
}
|
|
11176
12182
|
return {
|
|
11177
|
-
|
|
12183
|
+
baseURL: settings.baseURL,
|
|
11178
12184
|
token: settings.token,
|
|
11179
12185
|
workspace: void 0,
|
|
11180
12186
|
environment: settings.environment
|
|
@@ -11187,7 +12193,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11187
12193
|
);
|
|
11188
12194
|
}
|
|
11189
12195
|
return {
|
|
11190
|
-
|
|
12196
|
+
baseURL: settings.baseURL,
|
|
11191
12197
|
token: settings.token,
|
|
11192
12198
|
workspace: workspace2,
|
|
11193
12199
|
environment: settings.environment
|
|
@@ -11201,7 +12207,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11201
12207
|
maxRetries: 0
|
|
11202
12208
|
})
|
|
11203
12209
|
),
|
|
11204
|
-
fetch: (request) => {
|
|
12210
|
+
fetch: async (request) => {
|
|
11205
12211
|
sending ??= withRetries(
|
|
11206
12212
|
async (attempt) => {
|
|
11207
12213
|
const response = await io.fetch(attempt);
|
|
@@ -11214,7 +12220,14 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11214
12220
|
)
|
|
11215
12221
|
}
|
|
11216
12222
|
);
|
|
11217
|
-
|
|
12223
|
+
const headers = new Headers(request.headers);
|
|
12224
|
+
headers.set("user-agent", `${brand.name}-cli/${VERSION2}`);
|
|
12225
|
+
const named = new Request(request, { headers });
|
|
12226
|
+
try {
|
|
12227
|
+
return await sending(named);
|
|
12228
|
+
} catch (error) {
|
|
12229
|
+
throw connectionErrorFrom(error, request.signal);
|
|
12230
|
+
}
|
|
11218
12231
|
}
|
|
11219
12232
|
};
|
|
11220
12233
|
for (const register2 of commands) register2(program3, ctx);
|
|
@@ -11224,35 +12237,67 @@ async function run2(argv, io) {
|
|
|
11224
12237
|
const { program: program3, actedIn } = build(io);
|
|
11225
12238
|
try {
|
|
11226
12239
|
await program3.parseAsync(argv, { from: "user" });
|
|
11227
|
-
const
|
|
11228
|
-
if (
|
|
11229
|
-
return
|
|
12240
|
+
const environment3 = actedIn();
|
|
12241
|
+
if (environment3) io.stderr(`Environment: ${environment3}`);
|
|
12242
|
+
return EXIT.ok;
|
|
11230
12243
|
} catch (error) {
|
|
11231
|
-
const
|
|
11232
|
-
if (error instanceof CommanderError)
|
|
12244
|
+
const environment3 = actedIn();
|
|
12245
|
+
if (error instanceof CommanderError) {
|
|
12246
|
+
return error.exitCode === 0 ? EXIT.ok : EXIT.usage;
|
|
12247
|
+
}
|
|
12248
|
+
const code2 = exitCode(error);
|
|
11233
12249
|
if (argv.includes("--json")) {
|
|
11234
12250
|
io.stderr(
|
|
11235
12251
|
JSON.stringify({
|
|
11236
|
-
error: error instanceof
|
|
12252
|
+
error: error instanceof APIError ? {
|
|
11237
12253
|
code: error.code,
|
|
11238
12254
|
message: error.message,
|
|
11239
12255
|
status: error.status,
|
|
11240
|
-
...error.requestId ? { requestId: error.requestId } : {}
|
|
11241
|
-
|
|
11242
|
-
|
|
12256
|
+
...error.requestId ? { requestId: error.requestId } : {},
|
|
12257
|
+
...error.docs ? { docs: error.docs } : {},
|
|
12258
|
+
...error.details ? { details: error.details } : {}
|
|
12259
|
+
} : {
|
|
12260
|
+
code: code2 === EXIT.usage ? "usage_error" : code2 === EXIT.auth ? "not_logged_in" : "cli_error",
|
|
12261
|
+
message: error.message
|
|
12262
|
+
},
|
|
12263
|
+
...environment3 ? { environment: environment3 } : {}
|
|
11243
12264
|
})
|
|
11244
12265
|
);
|
|
11245
|
-
return
|
|
12266
|
+
return code2;
|
|
11246
12267
|
}
|
|
11247
|
-
if (error instanceof
|
|
12268
|
+
if (error instanceof APIError) {
|
|
11248
12269
|
const requestId = error.requestId ? ` [request ${error.requestId}]` : "";
|
|
11249
12270
|
io.stderr(`${brand.name}: ${error.message} (${error.code})${requestId}`);
|
|
12271
|
+
for (const detail of error.details ?? []) {
|
|
12272
|
+
io.stderr(
|
|
12273
|
+
` ${detail.path ? `${detail.path}: ` : ""}${detail.message}`
|
|
12274
|
+
);
|
|
12275
|
+
}
|
|
12276
|
+
const hint = scopeHint(error);
|
|
12277
|
+
if (hint) io.stderr(hint);
|
|
12278
|
+
if (error.docs) io.stderr(`See ${error.docs}`);
|
|
11250
12279
|
} else {
|
|
11251
|
-
|
|
12280
|
+
const cause = error instanceof APIConnectionError && error.cause instanceof Error ? ` (${error.cause.message})` : "";
|
|
12281
|
+
io.stderr(`${brand.name}: ${error.message}${cause}`);
|
|
11252
12282
|
}
|
|
11253
|
-
if (
|
|
11254
|
-
return
|
|
12283
|
+
if (environment3) io.stderr(`Environment: ${environment3}`);
|
|
12284
|
+
return code2;
|
|
12285
|
+
}
|
|
12286
|
+
}
|
|
12287
|
+
function exitCode(error) {
|
|
12288
|
+
if (error instanceof AuthenticationError || error?.cause instanceof AuthenticationError) {
|
|
12289
|
+
return EXIT.auth;
|
|
11255
12290
|
}
|
|
12291
|
+
const own = error?.exitCode;
|
|
12292
|
+
return typeof own === "number" && !(error instanceof APIError) ? own : EXIT.failure;
|
|
12293
|
+
}
|
|
12294
|
+
function scopeHint(error) {
|
|
12295
|
+
const own = Reflect.get(product_exports2, "productErrorHint");
|
|
12296
|
+
const mine = own?.(error);
|
|
12297
|
+
if (mine) return mine;
|
|
12298
|
+
const scope = /not granted the ([\w.:-]+) scope/.exec(error.message)?.[1];
|
|
12299
|
+
if (error.code !== "forbidden" || !scope) return null;
|
|
12300
|
+
return `Sign in again with \`${brand.name} login\` and choose access that includes ${scope}.`;
|
|
11256
12301
|
}
|
|
11257
12302
|
|
|
11258
12303
|
// src/main.ts
|