@reminix/cli 1.0.0-rc.13 → 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 +106 -273
- package/README.md +3 -3
- package/dist/reminix.mjs +1429 -391
- package/package.json +2 -2
package/dist/reminix.mjs
CHANGED
|
@@ -23,6 +23,16 @@ var brand_default = {
|
|
|
23
23
|
labs: ["lab"],
|
|
24
24
|
statusPage: true,
|
|
25
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
|
+
},
|
|
26
36
|
profiles: { x: "reminixhq", github: "reminixhq" },
|
|
27
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.",
|
|
28
38
|
expectedAssets: [
|
|
@@ -80,7 +90,12 @@ var brand_default = {
|
|
|
80
90
|
providerOrder: ["github", "google"],
|
|
81
91
|
emailSignUp: "button"
|
|
82
92
|
},
|
|
83
|
-
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"
|
|
84
99
|
};
|
|
85
100
|
|
|
86
101
|
// src/brand/index.ts
|
|
@@ -142,6 +157,8 @@ var brand = {
|
|
|
142
157
|
].filter(Boolean),
|
|
143
158
|
/** One sentence: what the product is — llms.txt and the agent skill lead with it. */
|
|
144
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,
|
|
145
162
|
/** Where vulnerability reports go — /.well-known/security.txt and /security publish it. Defaults to security@<domain>. */
|
|
146
163
|
securityContact: optional.securityContact ?? `security@${brand_default.domain}`,
|
|
147
164
|
/** Where the Contact form's help topics go (Question, Bug, Billing). Never shown on a page. Defaults to support@<domain>. */
|
|
@@ -204,21 +221,21 @@ var signInOptions = {
|
|
|
204
221
|
emailSignUp: optional.signIn?.emailSignUp ?? "form"
|
|
205
222
|
};
|
|
206
223
|
function resolveProductEnvironments(environments, defaultEnvironment, docs) {
|
|
207
|
-
const
|
|
224
|
+
const list2 = (environments ?? []).map((env) => ({
|
|
208
225
|
name: env.name,
|
|
209
226
|
keyPrefix: env.keyPrefix,
|
|
210
227
|
readOnlyWorkspace: env.readOnlyWorkspace ?? false,
|
|
211
228
|
description: env.description ?? "",
|
|
212
229
|
agentLabel: env.agentLabel ?? env.description ?? ""
|
|
213
230
|
}));
|
|
214
|
-
const names = new Set(
|
|
215
|
-
const prefixes = new Set(
|
|
216
|
-
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) {
|
|
217
234
|
throw new Error(
|
|
218
235
|
"brand.json environments: each needs its own name and keyPrefix"
|
|
219
236
|
);
|
|
220
237
|
}
|
|
221
|
-
for (const env of
|
|
238
|
+
for (const env of list2) {
|
|
222
239
|
if (!/^[a-z][a-z0-9-]*$/.test(env.name)) {
|
|
223
240
|
throw new Error(`brand.json environment name "${env.name}" is invalid`);
|
|
224
241
|
}
|
|
@@ -239,9 +256,9 @@ function resolveProductEnvironments(environments, defaultEnvironment, docs) {
|
|
|
239
256
|
);
|
|
240
257
|
}
|
|
241
258
|
return {
|
|
242
|
-
list,
|
|
243
|
-
default: defaultEnvironment ??
|
|
244
|
-
docs:
|
|
259
|
+
list: list2,
|
|
260
|
+
default: defaultEnvironment ?? list2[0]?.name ?? null,
|
|
261
|
+
docs: list2.length > 0 ? docs ?? null : null
|
|
245
262
|
};
|
|
246
263
|
}
|
|
247
264
|
var productEnvironments = resolveProductEnvironments(
|
|
@@ -735,21 +752,114 @@ function removeTrailingSlash(url) {
|
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
// node_modules/@reminix/sdk/dist/errors.js
|
|
738
|
-
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. */
|
|
739
776
|
status;
|
|
777
|
+
/** The error's code, to branch on (`not_found`, `rate_limited`, …). */
|
|
740
778
|
code;
|
|
779
|
+
/** The request's id: quote it to support. */
|
|
741
780
|
requestId;
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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;
|
|
748
798
|
}
|
|
749
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
|
+
}
|
|
750
831
|
function apiErrorFrom(error, response) {
|
|
751
|
-
const envelope = error
|
|
752
|
-
|
|
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
|
+
};
|
|
753
863
|
}
|
|
754
864
|
|
|
755
865
|
// node_modules/@reminix/sdk/dist/product/index.js
|
|
@@ -771,6 +881,7 @@ async function uploadFile(client, file, options = {}) {
|
|
|
771
881
|
params: { query: { name: file.name } },
|
|
772
882
|
body,
|
|
773
883
|
bodySerializer: (value) => value,
|
|
884
|
+
signal: options.signal,
|
|
774
885
|
headers: {
|
|
775
886
|
"content-type": file.mediaType ?? (body.type || "application/octet-stream"),
|
|
776
887
|
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
|
|
@@ -779,23 +890,25 @@ async function uploadFile(client, file, options = {}) {
|
|
|
779
890
|
}
|
|
780
891
|
|
|
781
892
|
// node_modules/@reminix/sdk/dist/product/run.js
|
|
782
|
-
var RunError = class extends
|
|
893
|
+
var RunError = class extends SdkError {
|
|
783
894
|
run;
|
|
784
895
|
constructor(run3) {
|
|
785
896
|
super(run3.status === "cancelled" ? `Run ${run3.id} was cancelled: ${run3.error ?? "no reason given"}` : `Run ${run3.id} failed: ${run3.error ?? "no error message"}`);
|
|
786
|
-
this.name = "RunError";
|
|
787
897
|
this.run = run3;
|
|
788
898
|
}
|
|
789
899
|
};
|
|
790
900
|
var ENDED = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled"]);
|
|
791
901
|
var isUpload = (value) => typeof Blob !== "undefined" && value instanceof Blob || typeof value === "object" && value !== null && "name" in value && "data" in value;
|
|
792
|
-
async function withFileIds(client, inputs, idempotencyKey) {
|
|
902
|
+
async function withFileIds(client, inputs, idempotencyKey, signal) {
|
|
793
903
|
let uploaded = 0;
|
|
794
904
|
const upload = async (value) => (await uploadFile(client, value instanceof Blob ? {
|
|
795
905
|
name: "name" in value ? String(value.name) : "upload",
|
|
796
906
|
mediaType: value.type,
|
|
797
907
|
data: value
|
|
798
|
-
} : value,
|
|
908
|
+
} : value, {
|
|
909
|
+
...idempotencyKey ? { idempotencyKey: `${idempotencyKey}:file-${++uploaded}` } : {},
|
|
910
|
+
signal
|
|
911
|
+
})).id;
|
|
799
912
|
const out = {};
|
|
800
913
|
for (const [name, value] of Object.entries(inputs)) {
|
|
801
914
|
if (isUpload(value))
|
|
@@ -821,20 +934,25 @@ var pause = (ms, signal) => new Promise((resolve4, reject) => {
|
|
|
821
934
|
}, { once: true });
|
|
822
935
|
});
|
|
823
936
|
async function waitForRun(client, run3, options = {}) {
|
|
824
|
-
|
|
937
|
+
const { signal } = options;
|
|
938
|
+
let current = typeof run3 === "string" ? await client.runs.get(run3, { signal }) : run3;
|
|
825
939
|
while (!ENDED.has(current.status)) {
|
|
826
|
-
await pause(options.
|
|
827
|
-
current = await client.runs.get(current.id);
|
|
940
|
+
await pause(options.pollInterval ?? 2e3, signal);
|
|
941
|
+
current = await client.runs.get(current.id, { signal });
|
|
828
942
|
}
|
|
829
943
|
if (current.status !== "succeeded")
|
|
830
944
|
throw new RunError(current);
|
|
831
945
|
return current;
|
|
832
946
|
}
|
|
833
947
|
async function run(client, slug, inputs = {}, options = {}) {
|
|
948
|
+
const { signal } = options;
|
|
834
949
|
const body = {
|
|
835
|
-
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
|
|
836
955
|
};
|
|
837
|
-
const keyed = options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {};
|
|
838
956
|
const started = options.version === void 0 ? await client.runs.create(slug, body, keyed) : await client.scriptVersions.testRun(slug, options.version, body, keyed);
|
|
839
957
|
if (started.status === "awaiting_approval") {
|
|
840
958
|
options.onApproval?.(started.approval?.approveUrl ?? null);
|
|
@@ -848,11 +966,77 @@ async function run(client, slug, inputs = {}, options = {}) {
|
|
|
848
966
|
var productMethods = (client) => ({
|
|
849
967
|
/** Runs a script and answers with the finished run (./run.ts). */
|
|
850
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),
|
|
851
971
|
/** Uploads a file to give a run as an input; returns it, with its id. */
|
|
852
|
-
uploadFile: (file) => uploadFile(client, file)
|
|
972
|
+
uploadFile: (file, options) => uploadFile(client, file, options)
|
|
853
973
|
});
|
|
854
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
|
+
|
|
855
1038
|
// node_modules/@reminix/sdk/dist/resources.js
|
|
1039
|
+
var TIMEOUT_HEADER = "x-sdk-timeout";
|
|
856
1040
|
async function call(client, op, pathParams, input, options = {}, content) {
|
|
857
1041
|
const query = {};
|
|
858
1042
|
const body = {};
|
|
@@ -863,7 +1047,8 @@ async function call(client, op, pathParams, input, options = {}, content) {
|
|
|
863
1047
|
}
|
|
864
1048
|
const headers = {
|
|
865
1049
|
...options.headers,
|
|
866
|
-
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}
|
|
1050
|
+
...options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {},
|
|
1051
|
+
...options.timeout === void 0 ? {} : { [TIMEOUT_HEADER]: String(options.timeout) }
|
|
867
1052
|
};
|
|
868
1053
|
const request = client.request;
|
|
869
1054
|
const raw = op.rawBody ? content instanceof Blob ? content : new Blob([content]) : void 0;
|
|
@@ -875,13 +1060,17 @@ async function call(client, op, pathParams, input, options = {}, content) {
|
|
|
875
1060
|
bodySerializer: (value) => value,
|
|
876
1061
|
headers: { "content-type": raw.type || op.rawBody, ...headers }
|
|
877
1062
|
} : { headers },
|
|
878
|
-
...op.rawResponse ? { parseAs: "blob" } : {}
|
|
1063
|
+
...op.rawResponse ? { parseAs: "blob" } : {},
|
|
1064
|
+
signal: options.signal
|
|
879
1065
|
});
|
|
880
1066
|
if (error !== void 0 || !response.ok) {
|
|
881
1067
|
throw apiErrorFrom(error, response);
|
|
882
1068
|
}
|
|
883
1069
|
return data;
|
|
884
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
|
+
}
|
|
885
1074
|
|
|
886
1075
|
// node_modules/@reminix/sdk/dist/resources.gen.js
|
|
887
1076
|
function resources(client) {
|
|
@@ -893,25 +1082,25 @@ function resources(client) {
|
|
|
893
1082
|
),
|
|
894
1083
|
delete: (
|
|
895
1084
|
/** Delete an environment */
|
|
896
|
-
(
|
|
1085
|
+
(environment3, options) => call(client, { "method": "delete", "path": "/environments/{environment}", "query": [], "hasBody": false }, { "environment": environment3 }, void 0, options)
|
|
897
1086
|
),
|
|
898
1087
|
get: (
|
|
899
1088
|
/** Get an environment */
|
|
900
|
-
(
|
|
1089
|
+
(environment3, options) => call(client, { "method": "get", "path": "/environments/{environment}", "query": [], "hasBody": false }, { "environment": environment3 }, void 0, options)
|
|
901
1090
|
),
|
|
902
1091
|
list: (
|
|
903
1092
|
/** List environments */
|
|
904
|
-
(options) =>
|
|
1093
|
+
(input, options) => list(client, { "method": "get", "path": "/environments", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
905
1094
|
),
|
|
906
1095
|
update: (
|
|
907
1096
|
/** Change an environment */
|
|
908
|
-
(
|
|
1097
|
+
(environment3, input, options) => call(client, { "method": "patch", "path": "/environments/{environment}", "query": [], "hasBody": true }, { "environment": environment3 }, input, options)
|
|
909
1098
|
)
|
|
910
1099
|
},
|
|
911
1100
|
files: {
|
|
912
|
-
|
|
913
|
-
/**
|
|
914
|
-
(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)
|
|
915
1104
|
),
|
|
916
1105
|
get: (
|
|
917
1106
|
/** Get a file */
|
|
@@ -919,7 +1108,7 @@ function resources(client) {
|
|
|
919
1108
|
),
|
|
920
1109
|
list: (
|
|
921
1110
|
/** List files */
|
|
922
|
-
(input, options) =>
|
|
1111
|
+
(input, options) => list(client, { "method": "get", "path": "/files", "query": ["limit", "cursor", "before", "script", "origin", "name"], "hasBody": false }, {}, input, options, true)
|
|
923
1112
|
),
|
|
924
1113
|
upload: (
|
|
925
1114
|
/** Upload a file */
|
|
@@ -941,7 +1130,7 @@ function resources(client) {
|
|
|
941
1130
|
),
|
|
942
1131
|
list: (
|
|
943
1132
|
/** List runs */
|
|
944
|
-
(input, options) =>
|
|
1133
|
+
(input, options) => list(client, { "method": "get", "path": "/runs", "query": ["limit", "cursor", "before", "script", "status"], "hasBody": false }, {}, input, options, true)
|
|
945
1134
|
),
|
|
946
1135
|
log: (
|
|
947
1136
|
/** Get a run's log */
|
|
@@ -957,9 +1146,13 @@ function resources(client) {
|
|
|
957
1146
|
/** Delete a schedule */
|
|
958
1147
|
(slug, scheduleId, options) => call(client, { "method": "delete", "path": "/scripts/{slug}/schedules/{scheduleId}", "query": [], "hasBody": false }, { "slug": slug, "scheduleId": scheduleId }, void 0, options)
|
|
959
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
|
+
),
|
|
960
1153
|
list: (
|
|
961
1154
|
/** List a script's schedules */
|
|
962
|
-
(slug, options) =>
|
|
1155
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/schedules", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
963
1156
|
),
|
|
964
1157
|
update: (
|
|
965
1158
|
/** Change a schedule */
|
|
@@ -981,7 +1174,7 @@ function resources(client) {
|
|
|
981
1174
|
),
|
|
982
1175
|
list: (
|
|
983
1176
|
/** List scripts */
|
|
984
|
-
(input, options) =>
|
|
1177
|
+
(input, options) => list(client, { "method": "get", "path": "/scripts", "query": ["limit", "cursor", "q", "tag", "owner", "published", "archived"], "hasBody": false }, {}, input, options, true)
|
|
985
1178
|
),
|
|
986
1179
|
restore: (
|
|
987
1180
|
/** Restore an archived script */
|
|
@@ -1003,9 +1196,13 @@ function resources(client) {
|
|
|
1003
1196
|
)
|
|
1004
1197
|
},
|
|
1005
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
|
+
),
|
|
1006
1203
|
list: (
|
|
1007
1204
|
/** List a script's versions */
|
|
1008
|
-
(slug, options) =>
|
|
1205
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/versions", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
1009
1206
|
),
|
|
1010
1207
|
publish: (
|
|
1011
1208
|
/** Publish a version */
|
|
@@ -1025,26 +1222,36 @@ function resources(client) {
|
|
|
1025
1222
|
/** Delete a secret */
|
|
1026
1223
|
(name, options) => call(client, { "method": "delete", "path": "/secrets/{name}", "query": [], "hasBody": false }, { "name": name }, void 0, options)
|
|
1027
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
|
+
),
|
|
1028
1229
|
list: (
|
|
1029
1230
|
/** List secrets */
|
|
1030
|
-
(options) =>
|
|
1231
|
+
(input, options) => list(client, { "method": "get", "path": "/secrets", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1031
1232
|
),
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
(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)
|
|
1035
1236
|
)
|
|
1036
1237
|
},
|
|
1037
1238
|
secretValues: {
|
|
1038
1239
|
delete: (
|
|
1039
1240
|
/** Remove a secret's value from an environment */
|
|
1040
|
-
(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)
|
|
1041
1246
|
)
|
|
1042
1247
|
},
|
|
1043
|
-
|
|
1044
|
-
|
|
1248
|
+
triggerCalls: {
|
|
1249
|
+
list: (
|
|
1045
1250
|
/** List a webhook trigger's calls */
|
|
1046
|
-
(slug, triggerId, options) =>
|
|
1047
|
-
)
|
|
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: {
|
|
1048
1255
|
create: (
|
|
1049
1256
|
/** Run a script when something happens */
|
|
1050
1257
|
(slug, input, options) => call(client, { "method": "post", "path": "/scripts/{slug}/triggers", "query": [], "hasBody": true }, { "slug": slug }, input, options)
|
|
@@ -1053,9 +1260,13 @@ function resources(client) {
|
|
|
1053
1260
|
/** Delete a trigger */
|
|
1054
1261
|
(slug, triggerId, options) => call(client, { "method": "delete", "path": "/scripts/{slug}/triggers/{triggerId}", "query": [], "hasBody": false }, { "slug": slug, "triggerId": triggerId }, void 0, options)
|
|
1055
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
|
+
),
|
|
1056
1267
|
list: (
|
|
1057
1268
|
/** List a script's triggers */
|
|
1058
|
-
(slug, options) =>
|
|
1269
|
+
(slug, input, options) => list(client, { "method": "get", "path": "/scripts/{slug}/triggers", "query": ["limit", "cursor"], "hasBody": false }, { "slug": slug }, input, options, true)
|
|
1059
1270
|
),
|
|
1060
1271
|
rotateSecret: (
|
|
1061
1272
|
/** Rotate a webhook trigger's secret */
|
|
@@ -1080,7 +1291,7 @@ function resources(client) {
|
|
|
1080
1291
|
approvalActions: {
|
|
1081
1292
|
list: (
|
|
1082
1293
|
/** List the actions you can ask approval for */
|
|
1083
|
-
(options) =>
|
|
1294
|
+
(options) => list(client, { "method": "get", "path": "/workspace/approval-actions", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1084
1295
|
)
|
|
1085
1296
|
},
|
|
1086
1297
|
approvalRequests: {
|
|
@@ -1090,23 +1301,23 @@ function resources(client) {
|
|
|
1090
1301
|
),
|
|
1091
1302
|
get: (
|
|
1092
1303
|
/** Check an approval request */
|
|
1093
|
-
(
|
|
1304
|
+
(approvalRequestId, options) => call(client, { "method": "get", "path": "/workspace/approval-requests/{approvalRequestId}", "query": [], "hasBody": false }, { "approvalRequestId": approvalRequestId }, void 0, options)
|
|
1094
1305
|
),
|
|
1095
1306
|
redeem: (
|
|
1096
1307
|
/** Redeem an approved request */
|
|
1097
|
-
(
|
|
1308
|
+
(approvalRequestId, options) => call(client, { "method": "post", "path": "/workspace/approval-requests/{approvalRequestId}/redeem", "query": [], "hasBody": false }, { "approvalRequestId": approvalRequestId }, void 0, options)
|
|
1098
1309
|
)
|
|
1099
1310
|
},
|
|
1100
1311
|
auditEvents: {
|
|
1101
1312
|
list: (
|
|
1102
1313
|
/** List workspace audit events */
|
|
1103
|
-
(input, options) =>
|
|
1314
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/audit-events", "query": ["limit", "cursor", "before", "action", "actor"], "hasBody": false }, {}, input, options, true)
|
|
1104
1315
|
)
|
|
1105
1316
|
},
|
|
1106
1317
|
eventTypes: {
|
|
1107
1318
|
list: (
|
|
1108
1319
|
/** List event types */
|
|
1109
|
-
(options) =>
|
|
1320
|
+
(options) => list(client, { "method": "get", "path": "/workspace/event-types", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1110
1321
|
)
|
|
1111
1322
|
},
|
|
1112
1323
|
get: (
|
|
@@ -1116,29 +1327,31 @@ function resources(client) {
|
|
|
1116
1327
|
invitations: {
|
|
1117
1328
|
list: (
|
|
1118
1329
|
/** List pending invitations */
|
|
1119
|
-
(input, options) =>
|
|
1330
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/invitations", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1120
1331
|
)
|
|
1121
1332
|
},
|
|
1122
1333
|
members: {
|
|
1123
1334
|
list: (
|
|
1124
1335
|
/** List workspace members */
|
|
1125
|
-
(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)
|
|
1126
1343
|
)
|
|
1127
1344
|
},
|
|
1128
1345
|
teams: {
|
|
1129
1346
|
list: (
|
|
1130
1347
|
/** List teams */
|
|
1131
|
-
(input, options) =>
|
|
1348
|
+
(input, options) => list(client, { "method": "get", "path": "/workspace/teams", "query": ["limit", "cursor"], "hasBody": false }, {}, input, options, true)
|
|
1132
1349
|
)
|
|
1133
1350
|
},
|
|
1134
|
-
usage: (
|
|
1135
|
-
/** Get your plan's usage this period */
|
|
1136
|
-
(options) => call(client, { "method": "get", "path": "/workspace/usage", "query": [], "hasBody": false }, {}, void 0, options)
|
|
1137
|
-
),
|
|
1138
1351
|
webhookDeliveries: {
|
|
1139
1352
|
list: (
|
|
1140
1353
|
/** List an endpoint's deliveries */
|
|
1141
|
-
(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)
|
|
1142
1355
|
),
|
|
1143
1356
|
redeliver: (
|
|
1144
1357
|
/** Redeliver an event */
|
|
@@ -1164,7 +1377,7 @@ function resources(client) {
|
|
|
1164
1377
|
),
|
|
1165
1378
|
list: (
|
|
1166
1379
|
/** List webhook endpoints */
|
|
1167
|
-
(options) =>
|
|
1380
|
+
(options) => list(client, { "method": "get", "path": "/workspace/webhook-endpoints", "query": [], "hasBody": false }, {}, void 0, options, false)
|
|
1168
1381
|
),
|
|
1169
1382
|
test: (
|
|
1170
1383
|
/** Send a test event */
|
|
@@ -1183,11 +1396,45 @@ function resources(client) {
|
|
|
1183
1396
|
var WRITES = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
1184
1397
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
|
|
1185
1398
|
var DEFAULT_MAX_RETRIES = 2;
|
|
1186
|
-
var MAX_WAIT_MS =
|
|
1399
|
+
var MAX_WAIT_MS = 6e4;
|
|
1187
1400
|
var MAX_BASE_KEY = 200;
|
|
1188
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
|
+
}
|
|
1189
1418
|
var productRetry = () => "productRetry" in product_exports ? Reflect.get(product_exports, "productRetry") ?? null : null;
|
|
1190
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
|
+
}
|
|
1191
1438
|
function backoff(attempt) {
|
|
1192
1439
|
const base = Math.min(500 * 2 ** attempt, 8e3);
|
|
1193
1440
|
return base * (0.75 + Math.random() * 0.25);
|
|
@@ -1250,7 +1497,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1250
1497
|
} catch (error) {
|
|
1251
1498
|
if (last || request.signal.aborted)
|
|
1252
1499
|
throw error;
|
|
1253
|
-
await sleep
|
|
1500
|
+
await pause2(sleep, backoff(attempt), request.signal);
|
|
1254
1501
|
continue;
|
|
1255
1502
|
}
|
|
1256
1503
|
const laterMs = later ? await later.wait(response, laterTries) : null;
|
|
@@ -1261,7 +1508,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1261
1508
|
laterTries++;
|
|
1262
1509
|
laterWaited += laterMs;
|
|
1263
1510
|
await response.body?.cancel();
|
|
1264
|
-
await sleep
|
|
1511
|
+
await pause2(sleep, laterMs, request.signal);
|
|
1265
1512
|
attempt--;
|
|
1266
1513
|
continue;
|
|
1267
1514
|
}
|
|
@@ -1271,7 +1518,7 @@ function withRetries(fetch2, options = {}) {
|
|
|
1271
1518
|
if (delay > MAX_WAIT_MS)
|
|
1272
1519
|
return response;
|
|
1273
1520
|
await response.body?.cancel();
|
|
1274
|
-
await sleep
|
|
1521
|
+
await pause2(sleep, delay, request.signal);
|
|
1275
1522
|
}
|
|
1276
1523
|
};
|
|
1277
1524
|
}
|
|
@@ -1295,11 +1542,13 @@ function keysFrom(base) {
|
|
|
1295
1542
|
};
|
|
1296
1543
|
}
|
|
1297
1544
|
|
|
1545
|
+
// node_modules/@reminix/sdk/dist/version.js
|
|
1546
|
+
var VERSION = "1.0.0-rc.13";
|
|
1547
|
+
|
|
1298
1548
|
// node_modules/@reminix/sdk/dist/webhooks.js
|
|
1299
|
-
var WebhookVerificationError = class extends
|
|
1549
|
+
var WebhookVerificationError = class extends SdkError {
|
|
1300
1550
|
constructor(message) {
|
|
1301
1551
|
super(message);
|
|
1302
|
-
this.name = "WebhookVerificationError";
|
|
1303
1552
|
}
|
|
1304
1553
|
};
|
|
1305
1554
|
function header(headers, name) {
|
|
@@ -1367,7 +1616,8 @@ async function verifyWebhook(body, headers, secret, options = {}) {
|
|
|
1367
1616
|
// node_modules/@reminix/sdk/dist/index.js
|
|
1368
1617
|
var API_KEY_ENV = `${brand2.identifier.toUpperCase()}_API_KEY`;
|
|
1369
1618
|
var TOKEN_ENV = `${brand2.identifier.toUpperCase()}_TOKEN`;
|
|
1370
|
-
var
|
|
1619
|
+
var BASE_URL_ENV = `${brand2.identifier.toUpperCase()}_BASE_URL`;
|
|
1620
|
+
var DEFAULT_BASE_URL = `https://api.${brand2.domain}`;
|
|
1371
1621
|
function createClient2(options = {}) {
|
|
1372
1622
|
const client = createBaseClient(options);
|
|
1373
1623
|
const extend = Reflect.get(product_exports, "productMethods");
|
|
@@ -1389,14 +1639,22 @@ function createBaseClient(options) {
|
|
|
1389
1639
|
if (!token) {
|
|
1390
1640
|
throw new Error(`${brand2.productName}: no API key. Pass { apiKey } or set ${API_KEY_ENV}.`);
|
|
1391
1641
|
}
|
|
1392
|
-
const origin = withoutTrailingSlashes(options.
|
|
1393
|
-
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 });
|
|
1394
1645
|
const client = createClient({
|
|
1395
1646
|
baseUrl: `${origin}/v1`,
|
|
1396
|
-
fetch:
|
|
1647
|
+
fetch: withConnectionErrors(sending)
|
|
1397
1648
|
});
|
|
1398
1649
|
client.use({
|
|
1399
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
|
+
}
|
|
1400
1658
|
request.headers.set("authorization", `Bearer ${token}`);
|
|
1401
1659
|
if (options.workspace && !request.headers.has("x-workspace")) {
|
|
1402
1660
|
request.headers.set("x-workspace", options.workspace);
|
|
@@ -1411,9 +1669,13 @@ function createBaseClient(options) {
|
|
|
1411
1669
|
webhooks: { verify: verifyWebhook }
|
|
1412
1670
|
});
|
|
1413
1671
|
}
|
|
1414
|
-
|
|
1672
|
+
var USER_AGENT = `${brand2.name}-node/${VERSION}`;
|
|
1673
|
+
function environment() {
|
|
1415
1674
|
const runtime = globalThis;
|
|
1416
|
-
|
|
1675
|
+
return runtime.process?.env;
|
|
1676
|
+
}
|
|
1677
|
+
function credentialFromEnvironment() {
|
|
1678
|
+
const env = environment();
|
|
1417
1679
|
return env?.[API_KEY_ENV] || env?.[TOKEN_ENV] || void 0;
|
|
1418
1680
|
}
|
|
1419
1681
|
function unwrap(result) {
|
|
@@ -1437,12 +1699,12 @@ var CommanderError = class extends Error {
|
|
|
1437
1699
|
* @param {string} code an id string representing the error
|
|
1438
1700
|
* @param {string} message human-readable description of the error
|
|
1439
1701
|
*/
|
|
1440
|
-
constructor(
|
|
1702
|
+
constructor(exitCode2, code2, message) {
|
|
1441
1703
|
super(message);
|
|
1442
1704
|
Error.captureStackTrace(this, this.constructor);
|
|
1443
1705
|
this.name = this.constructor.name;
|
|
1444
1706
|
this.code = code2;
|
|
1445
|
-
this.exitCode =
|
|
1707
|
+
this.exitCode = exitCode2;
|
|
1446
1708
|
this.nestedError = void 0;
|
|
1447
1709
|
}
|
|
1448
1710
|
};
|
|
@@ -2998,11 +3260,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2998
3260
|
* @return never
|
|
2999
3261
|
* @private
|
|
3000
3262
|
*/
|
|
3001
|
-
_exit(
|
|
3263
|
+
_exit(exitCode2, code2, message) {
|
|
3002
3264
|
if (this._exitCallback) {
|
|
3003
|
-
this._exitCallback(new CommanderError(
|
|
3265
|
+
this._exitCallback(new CommanderError(exitCode2, code2, message));
|
|
3004
3266
|
}
|
|
3005
|
-
process2.exit(
|
|
3267
|
+
process2.exit(exitCode2);
|
|
3006
3268
|
}
|
|
3007
3269
|
/**
|
|
3008
3270
|
* Register callback `fn` for the command.
|
|
@@ -4153,9 +4415,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4153
4415
|
this.outputHelp({ error: true });
|
|
4154
4416
|
}
|
|
4155
4417
|
const config2 = errorOptions || {};
|
|
4156
|
-
const
|
|
4418
|
+
const exitCode2 = config2.exitCode || 1;
|
|
4157
4419
|
const code2 = config2.code || "commander.error";
|
|
4158
|
-
this._exit(
|
|
4420
|
+
this._exit(exitCode2, code2, message);
|
|
4159
4421
|
}
|
|
4160
4422
|
/**
|
|
4161
4423
|
* Apply any option related environment variables, if option does
|
|
@@ -4274,10 +4536,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4274
4536
|
* @param {string} flag
|
|
4275
4537
|
* @private
|
|
4276
4538
|
*/
|
|
4277
|
-
unknownOption(
|
|
4539
|
+
unknownOption(flag) {
|
|
4278
4540
|
if (this._allowUnknownOption) return;
|
|
4279
4541
|
let suggestion = "";
|
|
4280
|
-
if (
|
|
4542
|
+
if (flag.startsWith("--") && this._showSuggestionAfterError) {
|
|
4281
4543
|
let candidateFlags = [];
|
|
4282
4544
|
let command = this;
|
|
4283
4545
|
do {
|
|
@@ -4285,9 +4547,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4285
4547
|
candidateFlags = candidateFlags.concat(moreFlags);
|
|
4286
4548
|
command = command.parent;
|
|
4287
4549
|
} while (command && !command._enablePositionalOptions);
|
|
4288
|
-
suggestion = suggestSimilar(
|
|
4550
|
+
suggestion = suggestSimilar(flag, candidateFlags);
|
|
4289
4551
|
}
|
|
4290
|
-
const message = `error: unknown option '${
|
|
4552
|
+
const message = `error: unknown option '${flag}'${suggestion}`;
|
|
4291
4553
|
this.error(message, { code: "commander.unknownOption" });
|
|
4292
4554
|
}
|
|
4293
4555
|
/**
|
|
@@ -4697,11 +4959,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4697
4959
|
*/
|
|
4698
4960
|
help(contextOptions) {
|
|
4699
4961
|
this.outputHelp(contextOptions);
|
|
4700
|
-
let
|
|
4701
|
-
if (
|
|
4702
|
-
|
|
4962
|
+
let exitCode2 = Number(process2.exitCode ?? 0);
|
|
4963
|
+
if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
4964
|
+
exitCode2 = 1;
|
|
4703
4965
|
}
|
|
4704
|
-
this._exit(
|
|
4966
|
+
this._exit(exitCode2, "commander.help", "(outputHelp)");
|
|
4705
4967
|
}
|
|
4706
4968
|
/**
|
|
4707
4969
|
* // Do a little typing to coordinate emit and listener for the help text events.
|
|
@@ -4847,13 +5109,13 @@ function browserLogin(options) {
|
|
|
4847
5109
|
return;
|
|
4848
5110
|
}
|
|
4849
5111
|
const fields = url.searchParams;
|
|
4850
|
-
const
|
|
5112
|
+
const send2 = (status, title, text) => res.writeHead(status, {
|
|
4851
5113
|
"content-type": "text/html; charset=utf-8",
|
|
4852
5114
|
"cache-control": "no-store",
|
|
4853
5115
|
"referrer-policy": "no-referrer"
|
|
4854
5116
|
}).end(PAGE(title, text));
|
|
4855
5117
|
if (fields.get("state") !== state) {
|
|
4856
|
-
|
|
5118
|
+
send2(
|
|
4857
5119
|
400,
|
|
4858
5120
|
"Not this login",
|
|
4859
5121
|
"This sign-in did not come from the terminal that is waiting. Run login again."
|
|
@@ -4861,16 +5123,16 @@ function browserLogin(options) {
|
|
|
4861
5123
|
return;
|
|
4862
5124
|
}
|
|
4863
5125
|
if (fields.get("error")) {
|
|
4864
|
-
|
|
5126
|
+
send2(200, "Sign-in cancelled", "You can close this tab.");
|
|
4865
5127
|
finish(() => reject(new Error("sign-in was denied in the browser")));
|
|
4866
5128
|
return;
|
|
4867
5129
|
}
|
|
4868
5130
|
const token = decrypt(fields.get("token") ?? "");
|
|
4869
5131
|
if (!token) {
|
|
4870
|
-
|
|
5132
|
+
send2(400, "Something went wrong", "Run login again.");
|
|
4871
5133
|
return;
|
|
4872
5134
|
}
|
|
4873
|
-
|
|
5135
|
+
send2(
|
|
4874
5136
|
200,
|
|
4875
5137
|
"You are signed in",
|
|
4876
5138
|
"Return to your terminal. You can close this tab."
|
|
@@ -4922,6 +5184,9 @@ import {
|
|
|
4922
5184
|
writeFileSync
|
|
4923
5185
|
} from "node:fs";
|
|
4924
5186
|
import { join } from "node:path";
|
|
5187
|
+
function baseURLEnvVar() {
|
|
5188
|
+
return BASE_URL_ENV;
|
|
5189
|
+
}
|
|
4925
5190
|
function environmentEnvVar() {
|
|
4926
5191
|
return `${brand.identifier.toUpperCase()}_ENVIRONMENT`;
|
|
4927
5192
|
}
|
|
@@ -4949,12 +5214,13 @@ function writeConfig(homeDir, config2) {
|
|
|
4949
5214
|
}
|
|
4950
5215
|
function resolveSettings(env, homeDir, flags = {}) {
|
|
4951
5216
|
const config2 = readConfig(homeDir);
|
|
4952
|
-
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 };
|
|
4953
5218
|
return {
|
|
4954
|
-
...
|
|
4955
|
-
|
|
4956
|
-
env[
|
|
5219
|
+
...environment3,
|
|
5220
|
+
baseURL: withoutTrailingSlashes2(
|
|
5221
|
+
flags.baseUrl || env[BASE_URL_ENV] || config2.baseURL || DEFAULT_BASE_URL
|
|
4957
5222
|
),
|
|
5223
|
+
baseURLSource: flags.baseUrl ? "flag" : env[BASE_URL_ENV] ? "env" : config2.baseURL ? "config" : null,
|
|
4958
5224
|
token: env[tokenEnvVar()] ?? config2.token,
|
|
4959
5225
|
workspace: env[`${brand.identifier.toUpperCase()}_WORKSPACE`] ?? config2.workspace
|
|
4960
5226
|
};
|
|
@@ -4965,6 +5231,28 @@ function withoutTrailingSlashes2(url) {
|
|
|
4965
5231
|
return url.slice(0, end);
|
|
4966
5232
|
}
|
|
4967
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
|
+
|
|
4968
5256
|
// src/http.ts
|
|
4969
5257
|
async function rawRequest(ctx, options) {
|
|
4970
5258
|
const needsWorkspace = !options.path.startsWith("/v1/user");
|
|
@@ -4973,7 +5261,7 @@ async function rawRequest(ctx, options) {
|
|
|
4973
5261
|
return unwrap(
|
|
4974
5262
|
await client.request(options.method, options.path, {
|
|
4975
5263
|
// The client's base URL ends in /v1; the path given here is absolute.
|
|
4976
|
-
baseUrl: ctx.credentials({ workspace: workspace2 }).
|
|
5264
|
+
baseUrl: ctx.credentials({ workspace: workspace2 }).baseURL,
|
|
4977
5265
|
body: options.body
|
|
4978
5266
|
})
|
|
4979
5267
|
);
|
|
@@ -5072,9 +5360,10 @@ var approvals = (program3, ctx) => {
|
|
|
5072
5360
|
// src/usage.ts
|
|
5073
5361
|
var usage = (program3, ctx) => {
|
|
5074
5362
|
const workspace2 = program3.commands.find((c) => c.name() === "workspace") ?? program3.command("workspace");
|
|
5075
|
-
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) => {
|
|
5076
5365
|
const result = unwrap(
|
|
5077
|
-
await ctx.client({ workspace: options.workspace }).GET("/workspace/usage")
|
|
5366
|
+
await ctx.client({ workspace: options.workspace }).GET("/workspace/plan-usage")
|
|
5078
5367
|
);
|
|
5079
5368
|
if (options.json) {
|
|
5080
5369
|
ctx.io.stdout(json(result));
|
|
@@ -5106,13 +5395,14 @@ function usageLines(usage2) {
|
|
|
5106
5395
|
async function me(ctx) {
|
|
5107
5396
|
return unwrap(await ctx.client({ workspace: false }).GET("/user/me"));
|
|
5108
5397
|
}
|
|
5109
|
-
async function saveToken(ctx, token
|
|
5398
|
+
async function saveToken(ctx, token) {
|
|
5399
|
+
const { baseURL, baseURLSource } = ctx.settings();
|
|
5110
5400
|
if (!token.startsWith(`pat_${brand.identifier}_`)) {
|
|
5111
5401
|
throw new Error(`that is not a ${brand.productName} personal access token`);
|
|
5112
5402
|
}
|
|
5113
5403
|
const previous = readConfig(ctx.io.homeDir);
|
|
5114
5404
|
const config2 = { ...previous, token };
|
|
5115
|
-
if (
|
|
5405
|
+
if (baseURLSource === "flag") config2.baseURL = baseURL;
|
|
5116
5406
|
writeConfig(ctx.io.homeDir, config2);
|
|
5117
5407
|
let user;
|
|
5118
5408
|
try {
|
|
@@ -5142,24 +5432,28 @@ async function saveToken(ctx, token, api2) {
|
|
|
5142
5432
|
var login = (program3, ctx) => {
|
|
5143
5433
|
program3.command("login").description(
|
|
5144
5434
|
"Sign in through the browser, or store a personal access token with --token"
|
|
5145
|
-
).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) => {
|
|
5146
5440
|
if (!productFeatures.personalTokens) {
|
|
5147
5441
|
throw new Error(
|
|
5148
5442
|
`${brand.productName} has no personal access tokens, so this command line cannot sign in.`
|
|
5149
5443
|
);
|
|
5150
5444
|
}
|
|
5151
5445
|
if (options.token) {
|
|
5152
|
-
await saveToken(ctx, options.token
|
|
5446
|
+
await saveToken(ctx, options.token);
|
|
5153
5447
|
return;
|
|
5154
5448
|
}
|
|
5155
5449
|
if (!ctx.io.interactive) {
|
|
5156
5450
|
ctx.io.stderr(
|
|
5157
5451
|
`Paste a personal access token (Account \u2192 Personal access tokens in ${brand.productName}), then Enter:`
|
|
5158
5452
|
);
|
|
5159
|
-
await saveToken(ctx, (await ctx.io.stdin()).trim()
|
|
5453
|
+
await saveToken(ctx, (await ctx.io.stdin()).trim());
|
|
5160
5454
|
return;
|
|
5161
5455
|
}
|
|
5162
|
-
const api2 =
|
|
5456
|
+
const api2 = ctx.settings().baseURL;
|
|
5163
5457
|
const webOrigin = options.web ?? webOriginFor(api2);
|
|
5164
5458
|
if (!webOrigin) {
|
|
5165
5459
|
throw new Error(
|
|
@@ -5175,15 +5469,15 @@ var login = (program3, ctx) => {
|
|
|
5175
5469
|
${url}`
|
|
5176
5470
|
)
|
|
5177
5471
|
});
|
|
5178
|
-
await saveToken(ctx, token
|
|
5472
|
+
await saveToken(ctx, token);
|
|
5179
5473
|
});
|
|
5180
5474
|
};
|
|
5181
5475
|
var logout = (program3, ctx) => {
|
|
5182
5476
|
program3.command("logout").description("Revoke the stored token and forget it").action(async () => {
|
|
5183
5477
|
const config2 = readConfig(ctx.io.homeDir);
|
|
5184
5478
|
if (config2.token) {
|
|
5185
|
-
const revoked = await ctx.
|
|
5186
|
-
new Request(`${ctx.settings().
|
|
5479
|
+
const revoked = await ctx.fetch(
|
|
5480
|
+
new Request(`${ctx.settings().baseURL}/v1/user/token`, {
|
|
5187
5481
|
method: "DELETE",
|
|
5188
5482
|
headers: { authorization: `Bearer ${config2.token}` }
|
|
5189
5483
|
})
|
|
@@ -5241,7 +5535,7 @@ var workspace = (program3, ctx) => {
|
|
|
5241
5535
|
ctx.io.stdout(`Default workspace: ${slug}`);
|
|
5242
5536
|
});
|
|
5243
5537
|
};
|
|
5244
|
-
var
|
|
5538
|
+
var environment2 = (program3, ctx) => {
|
|
5245
5539
|
const group = program3.command("environment").description("Choose the environment commands act in");
|
|
5246
5540
|
group.command("list", { isDefault: true }).description("Show the environment commands act in").action(() => {
|
|
5247
5541
|
const { environment: current, environmentSource } = ctx.settings();
|
|
@@ -5284,9 +5578,16 @@ var api = (program3, ctx) => {
|
|
|
5284
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(
|
|
5285
5579
|
async (method, path2, options) => {
|
|
5286
5580
|
if (!path2.startsWith("/")) {
|
|
5287
|
-
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");
|
|
5288
5590
|
}
|
|
5289
|
-
const body = options.data === void 0 ? void 0 : JSON.parse(options.data);
|
|
5290
5591
|
ctx.io.stdout(
|
|
5291
5592
|
json(
|
|
5292
5593
|
await rawRequest(ctx, {
|
|
@@ -5305,8 +5606,8 @@ var config = (program3, ctx) => {
|
|
|
5305
5606
|
const settings = ctx.settings();
|
|
5306
5607
|
ctx.io.stdout(
|
|
5307
5608
|
json({
|
|
5308
|
-
|
|
5309
|
-
|
|
5609
|
+
baseURL: settings.baseURL,
|
|
5610
|
+
baseURLDefault: DEFAULT_BASE_URL,
|
|
5310
5611
|
token: settings.token ? `${settings.token.slice(0, 12)}\u2026` : null,
|
|
5311
5612
|
tokenSource: ctx.io.env[tokenEnvVar()] ? tokenEnvVar() : settings.token ? "config" : null,
|
|
5312
5613
|
workspace: settings.workspace ?? null,
|
|
@@ -5322,7 +5623,7 @@ var platformCommands = [
|
|
|
5322
5623
|
logout,
|
|
5323
5624
|
whoami,
|
|
5324
5625
|
workspace,
|
|
5325
|
-
|
|
5626
|
+
environment2,
|
|
5326
5627
|
api,
|
|
5327
5628
|
config,
|
|
5328
5629
|
approvals,
|
|
@@ -5522,8 +5823,36 @@ var OPERATIONS = [
|
|
|
5522
5823
|
}
|
|
5523
5824
|
},
|
|
5524
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.",
|
|
5525
|
-
"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
|
+
],
|
|
5526
5854
|
"hasBody": false,
|
|
5855
|
+
"paginated": true,
|
|
5527
5856
|
"workspace": true,
|
|
5528
5857
|
"acceptsApiKey": true,
|
|
5529
5858
|
"scope": "environments:read"
|
|
@@ -5618,10 +5947,10 @@ var OPERATIONS = [
|
|
|
5618
5947
|
"scope": "environments:write"
|
|
5619
5948
|
},
|
|
5620
5949
|
{
|
|
5621
|
-
"operationId": "files.
|
|
5950
|
+
"operationId": "files.content",
|
|
5622
5951
|
"method": "get",
|
|
5623
|
-
"path": "/files/{fileId}/
|
|
5624
|
-
"summary": "
|
|
5952
|
+
"path": "/files/{fileId}/content",
|
|
5953
|
+
"summary": "Get a file's content",
|
|
5625
5954
|
"cli": {
|
|
5626
5955
|
"command": "files download",
|
|
5627
5956
|
"args": [
|
|
@@ -5641,7 +5970,7 @@ var OPERATIONS = [
|
|
|
5641
5970
|
"type": "string",
|
|
5642
5971
|
"required": true,
|
|
5643
5972
|
"description": "The file's ID.",
|
|
5644
|
-
"example": "
|
|
5973
|
+
"example": "file_36d59242-1144-4fcb-851f-20f4c444d538",
|
|
5645
5974
|
"schema": {
|
|
5646
5975
|
"type": "string",
|
|
5647
5976
|
"description": "The file's ID."
|
|
@@ -5683,7 +6012,7 @@ var OPERATIONS = [
|
|
|
5683
6012
|
"type": "string",
|
|
5684
6013
|
"required": true,
|
|
5685
6014
|
"description": "The file's ID.",
|
|
5686
|
-
"example": "
|
|
6015
|
+
"example": "file_36d59242-1144-4fcb-851f-20f4c444d538",
|
|
5687
6016
|
"schema": {
|
|
5688
6017
|
"type": "string",
|
|
5689
6018
|
"description": "The file's ID."
|
|
@@ -5799,6 +6128,7 @@ var OPERATIONS = [
|
|
|
5799
6128
|
}
|
|
5800
6129
|
],
|
|
5801
6130
|
"hasBody": false,
|
|
6131
|
+
"paginated": true,
|
|
5802
6132
|
"workspace": true,
|
|
5803
6133
|
"acceptsApiKey": true,
|
|
5804
6134
|
"scope": "runs:read"
|
|
@@ -5818,7 +6148,7 @@ var OPERATIONS = [
|
|
|
5818
6148
|
"exposed": false,
|
|
5819
6149
|
"reason": "Takes raw bytes, which an agent's tool call can't carry; agents pass an https link as the file input instead."
|
|
5820
6150
|
},
|
|
5821
|
-
"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.',
|
|
5822
6152
|
"fields": [
|
|
5823
6153
|
{
|
|
5824
6154
|
"name": "name",
|
|
@@ -5870,7 +6200,7 @@ var OPERATIONS = [
|
|
|
5870
6200
|
"type": "string",
|
|
5871
6201
|
"required": true,
|
|
5872
6202
|
"description": "The run's ID.",
|
|
5873
|
-
"example": "
|
|
6203
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
5874
6204
|
"schema": {
|
|
5875
6205
|
"type": "string",
|
|
5876
6206
|
"description": "The run's ID."
|
|
@@ -5904,7 +6234,7 @@ var OPERATIONS = [
|
|
|
5904
6234
|
"idempotentHint": false
|
|
5905
6235
|
}
|
|
5906
6236
|
},
|
|
5907
|
-
"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.",
|
|
5908
6238
|
"fields": [
|
|
5909
6239
|
{
|
|
5910
6240
|
"name": "slug",
|
|
@@ -5984,7 +6314,7 @@ var OPERATIONS = [
|
|
|
5984
6314
|
"type": "string",
|
|
5985
6315
|
"required": true,
|
|
5986
6316
|
"description": "The run's ID.",
|
|
5987
|
-
"example": "
|
|
6317
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
5988
6318
|
"schema": {
|
|
5989
6319
|
"type": "string",
|
|
5990
6320
|
"description": "The run's ID."
|
|
@@ -6090,6 +6420,7 @@ var OPERATIONS = [
|
|
|
6090
6420
|
}
|
|
6091
6421
|
],
|
|
6092
6422
|
"hasBody": false,
|
|
6423
|
+
"paginated": true,
|
|
6093
6424
|
"workspace": true,
|
|
6094
6425
|
"acceptsApiKey": true,
|
|
6095
6426
|
"scope": "runs:read"
|
|
@@ -6123,7 +6454,7 @@ var OPERATIONS = [
|
|
|
6123
6454
|
"type": "string",
|
|
6124
6455
|
"required": true,
|
|
6125
6456
|
"description": "The run's ID.",
|
|
6126
|
-
"example": "
|
|
6457
|
+
"example": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
|
|
6127
6458
|
"schema": {
|
|
6128
6459
|
"type": "string",
|
|
6129
6460
|
"description": "The run's ID."
|
|
@@ -6271,7 +6602,7 @@ var OPERATIONS = [
|
|
|
6271
6602
|
"type": "string",
|
|
6272
6603
|
"required": true,
|
|
6273
6604
|
"description": "The schedule's ID.",
|
|
6274
|
-
"example": "
|
|
6605
|
+
"example": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
|
|
6275
6606
|
"schema": {
|
|
6276
6607
|
"type": "string",
|
|
6277
6608
|
"description": "The schedule's ID."
|
|
@@ -6283,6 +6614,60 @@ var OPERATIONS = [
|
|
|
6283
6614
|
"acceptsApiKey": true,
|
|
6284
6615
|
"scope": "scripts:write"
|
|
6285
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
|
+
},
|
|
6286
6671
|
{
|
|
6287
6672
|
"operationId": "schedules.list",
|
|
6288
6673
|
"method": "get",
|
|
@@ -6317,9 +6702,36 @@ var OPERATIONS = [
|
|
|
6317
6702
|
"type": "string",
|
|
6318
6703
|
"description": "The slug's ID."
|
|
6319
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
|
+
}
|
|
6320
6731
|
}
|
|
6321
6732
|
],
|
|
6322
6733
|
"hasBody": false,
|
|
6734
|
+
"paginated": true,
|
|
6323
6735
|
"workspace": true,
|
|
6324
6736
|
"acceptsApiKey": true,
|
|
6325
6737
|
"scope": "scripts:read"
|
|
@@ -6361,7 +6773,7 @@ var OPERATIONS = [
|
|
|
6361
6773
|
"type": "string",
|
|
6362
6774
|
"required": true,
|
|
6363
6775
|
"description": "The schedule's ID.",
|
|
6364
|
-
"example": "
|
|
6776
|
+
"example": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
|
|
6365
6777
|
"schema": {
|
|
6366
6778
|
"type": "string",
|
|
6367
6779
|
"description": "The schedule's ID."
|
|
@@ -6703,6 +7115,7 @@ var OPERATIONS = [
|
|
|
6703
7115
|
}
|
|
6704
7116
|
],
|
|
6705
7117
|
"hasBody": false,
|
|
7118
|
+
"paginated": true,
|
|
6706
7119
|
"workspace": true,
|
|
6707
7120
|
"acceptsApiKey": true,
|
|
6708
7121
|
"scope": "scripts:read"
|
|
@@ -6764,7 +7177,7 @@ var OPERATIONS = [
|
|
|
6764
7177
|
"idempotentHint": false
|
|
6765
7178
|
}
|
|
6766
7179
|
},
|
|
6767
|
-
"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.",
|
|
6768
7181
|
"fields": [
|
|
6769
7182
|
{
|
|
6770
7183
|
"name": "slug",
|
|
@@ -6935,27 +7348,28 @@ var OPERATIONS = [
|
|
|
6935
7348
|
"scope": "scripts:write"
|
|
6936
7349
|
},
|
|
6937
7350
|
{
|
|
6938
|
-
"operationId": "scriptVersions.
|
|
7351
|
+
"operationId": "scriptVersions.get",
|
|
6939
7352
|
"method": "get",
|
|
6940
|
-
"path": "/scripts/{slug}/versions",
|
|
6941
|
-
"summary": "
|
|
7353
|
+
"path": "/scripts/{slug}/versions/{version}",
|
|
7354
|
+
"summary": "Get a version",
|
|
6942
7355
|
"cli": {
|
|
6943
|
-
"command": "script-versions
|
|
7356
|
+
"command": "script-versions get",
|
|
6944
7357
|
"args": [
|
|
6945
|
-
"slug"
|
|
7358
|
+
"slug",
|
|
7359
|
+
"version"
|
|
6946
7360
|
],
|
|
6947
7361
|
"confirm": false
|
|
6948
7362
|
},
|
|
6949
7363
|
"mcp": {
|
|
6950
7364
|
"exposed": true,
|
|
6951
|
-
"name": "
|
|
7365
|
+
"name": "script_versions_get",
|
|
6952
7366
|
"hints": {
|
|
6953
7367
|
"readOnlyHint": true,
|
|
6954
7368
|
"destructiveHint": false,
|
|
6955
7369
|
"idempotentHint": true
|
|
6956
7370
|
}
|
|
6957
7371
|
},
|
|
6958
|
-
"description": "
|
|
7372
|
+
"description": "Returns one version of a script, and whether it's the published one.",
|
|
6959
7373
|
"fields": [
|
|
6960
7374
|
{
|
|
6961
7375
|
"name": "slug",
|
|
@@ -6968,6 +7382,19 @@ var OPERATIONS = [
|
|
|
6968
7382
|
"type": "string",
|
|
6969
7383
|
"description": "The slug's ID."
|
|
6970
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
|
+
}
|
|
6971
7398
|
}
|
|
6972
7399
|
],
|
|
6973
7400
|
"hasBody": false,
|
|
@@ -6976,28 +7403,27 @@ var OPERATIONS = [
|
|
|
6976
7403
|
"scope": "scripts:read"
|
|
6977
7404
|
},
|
|
6978
7405
|
{
|
|
6979
|
-
"operationId": "scriptVersions.
|
|
6980
|
-
"method": "
|
|
6981
|
-
"path": "/scripts/{slug}/versions
|
|
6982
|
-
"summary": "
|
|
7406
|
+
"operationId": "scriptVersions.list",
|
|
7407
|
+
"method": "get",
|
|
7408
|
+
"path": "/scripts/{slug}/versions",
|
|
7409
|
+
"summary": "List a script's versions",
|
|
6983
7410
|
"cli": {
|
|
6984
|
-
"command": "script-versions
|
|
7411
|
+
"command": "script-versions list",
|
|
6985
7412
|
"args": [
|
|
6986
|
-
"slug"
|
|
6987
|
-
"version"
|
|
7413
|
+
"slug"
|
|
6988
7414
|
],
|
|
6989
7415
|
"confirm": false
|
|
6990
7416
|
},
|
|
6991
7417
|
"mcp": {
|
|
6992
7418
|
"exposed": true,
|
|
6993
|
-
"name": "
|
|
7419
|
+
"name": "script_versions_list",
|
|
6994
7420
|
"hints": {
|
|
6995
|
-
"readOnlyHint":
|
|
7421
|
+
"readOnlyHint": true,
|
|
6996
7422
|
"destructiveHint": false,
|
|
6997
|
-
"idempotentHint":
|
|
7423
|
+
"idempotentHint": true
|
|
6998
7424
|
}
|
|
6999
7425
|
},
|
|
7000
|
-
"description": "
|
|
7426
|
+
"description": "Lists a script's versions, newest first, and marks the published one. Paginate with the opaque `nextCursor` token.",
|
|
7001
7427
|
"fields": [
|
|
7002
7428
|
{
|
|
7003
7429
|
"name": "slug",
|
|
@@ -7012,16 +7438,85 @@ var OPERATIONS = [
|
|
|
7012
7438
|
}
|
|
7013
7439
|
},
|
|
7014
7440
|
{
|
|
7015
|
-
"name": "
|
|
7016
|
-
"in": "
|
|
7441
|
+
"name": "limit",
|
|
7442
|
+
"in": "query",
|
|
7017
7443
|
"type": "number",
|
|
7018
|
-
"required":
|
|
7019
|
-
"description": "
|
|
7020
|
-
"example":
|
|
7444
|
+
"required": false,
|
|
7445
|
+
"description": "Items per page, 1\u2013100 (default 25).",
|
|
7446
|
+
"example": 25,
|
|
7021
7447
|
"schema": {
|
|
7022
7448
|
"type": "integer",
|
|
7023
7449
|
"minimum": 1,
|
|
7024
|
-
"
|
|
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."
|
|
7025
7520
|
}
|
|
7026
7521
|
}
|
|
7027
7522
|
],
|
|
@@ -7186,11 +7681,11 @@ var OPERATIONS = [
|
|
|
7186
7681
|
"in": "body",
|
|
7187
7682
|
"type": "json",
|
|
7188
7683
|
"required": false,
|
|
7189
|
-
"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.',
|
|
7190
7685
|
"schema": {
|
|
7191
7686
|
"type": "object",
|
|
7192
7687
|
"additionalProperties": {},
|
|
7193
|
-
"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.'
|
|
7194
7689
|
}
|
|
7195
7690
|
},
|
|
7196
7691
|
{
|
|
@@ -7449,6 +7944,47 @@ var OPERATIONS = [
|
|
|
7449
7944
|
"acceptsApiKey": true,
|
|
7450
7945
|
"scope": "secrets:write"
|
|
7451
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
|
+
},
|
|
7452
7988
|
{
|
|
7453
7989
|
"operationId": "secrets.list",
|
|
7454
7990
|
"method": "get",
|
|
@@ -7469,30 +8005,57 @@ var OPERATIONS = [
|
|
|
7469
8005
|
}
|
|
7470
8006
|
},
|
|
7471
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.",
|
|
7472
|
-
"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
|
+
],
|
|
7473
8036
|
"hasBody": false,
|
|
8037
|
+
"paginated": true,
|
|
7474
8038
|
"workspace": true,
|
|
7475
8039
|
"acceptsApiKey": true,
|
|
7476
8040
|
"scope": "secrets:read"
|
|
7477
8041
|
},
|
|
7478
8042
|
{
|
|
7479
|
-
"operationId": "secrets.
|
|
7480
|
-
"method": "
|
|
8043
|
+
"operationId": "secrets.update",
|
|
8044
|
+
"method": "patch",
|
|
7481
8045
|
"path": "/secrets/{name}",
|
|
7482
|
-
"summary": "
|
|
8046
|
+
"summary": "Update a secret",
|
|
7483
8047
|
"cli": {
|
|
7484
|
-
"command": "secrets
|
|
8048
|
+
"command": "secrets update",
|
|
7485
8049
|
"args": [
|
|
7486
8050
|
"name"
|
|
7487
8051
|
],
|
|
7488
|
-
"confirm": false
|
|
7489
|
-
"sample": 'printf %s "$ADMIN_KEY" | \\\n reminix secrets set ADMIN_KEY \\\n --hosts api.yourapp.com'
|
|
8052
|
+
"confirm": false
|
|
7490
8053
|
},
|
|
7491
8054
|
"mcp": {
|
|
7492
8055
|
"exposed": false,
|
|
7493
8056
|
"reason": "Secret values are a person's to handle; an agent asks the person to add the secret"
|
|
7494
8057
|
},
|
|
7495
|
-
"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.",
|
|
7496
8059
|
"fields": [
|
|
7497
8060
|
{
|
|
7498
8061
|
"name": "name",
|
|
@@ -7506,44 +8069,15 @@ var OPERATIONS = [
|
|
|
7506
8069
|
"description": "The secret's name, in UPPER_SNAKE_CASE. It starts with a letter and has at most 64 characters."
|
|
7507
8070
|
}
|
|
7508
8071
|
},
|
|
7509
|
-
{
|
|
7510
|
-
"name": "value",
|
|
7511
|
-
"in": "body",
|
|
7512
|
-
"type": "string",
|
|
7513
|
-
"required": true,
|
|
7514
|
-
"description": "The secret itself, at most 16,384 bytes.",
|
|
7515
|
-
"example": "ak_live_\u2026",
|
|
7516
|
-
"schema": {
|
|
7517
|
-
"type": "string",
|
|
7518
|
-
"description": "The secret itself, at most 16,384 bytes."
|
|
7519
|
-
}
|
|
7520
|
-
},
|
|
7521
|
-
{
|
|
7522
|
-
"name": "hosts",
|
|
7523
|
-
"in": "body",
|
|
7524
|
-
"type": "json",
|
|
7525
|
-
"required": true,
|
|
7526
|
-
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`.",
|
|
7527
|
-
"example": [
|
|
7528
|
-
"api.yourapp.com"
|
|
7529
|
-
],
|
|
7530
|
-
"schema": {
|
|
7531
|
-
"type": "array",
|
|
7532
|
-
"items": {
|
|
7533
|
-
"type": "string"
|
|
7534
|
-
},
|
|
7535
|
-
"description": "The only hosts Reminix sends this value to, such as `api.stripe.com`."
|
|
7536
|
-
}
|
|
7537
|
-
},
|
|
7538
8072
|
{
|
|
7539
8073
|
"name": "allowEnvVar",
|
|
7540
8074
|
"in": "body",
|
|
7541
8075
|
"type": "boolean",
|
|
7542
8076
|
"required": false,
|
|
7543
|
-
"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.",
|
|
7544
8078
|
"schema": {
|
|
7545
8079
|
"type": "boolean",
|
|
7546
|
-
"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."
|
|
7547
8081
|
}
|
|
7548
8082
|
}
|
|
7549
8083
|
],
|
|
@@ -7588,11 +8122,11 @@ var OPERATIONS = [
|
|
|
7588
8122
|
"in": "path",
|
|
7589
8123
|
"type": "string",
|
|
7590
8124
|
"required": true,
|
|
7591
|
-
"description": "The environment's
|
|
7592
|
-
"example": "
|
|
8125
|
+
"description": "The environment's name.",
|
|
8126
|
+
"example": "production",
|
|
7593
8127
|
"schema": {
|
|
7594
8128
|
"type": "string",
|
|
7595
|
-
"description": "The environment's
|
|
8129
|
+
"description": "The environment's name."
|
|
7596
8130
|
}
|
|
7597
8131
|
}
|
|
7598
8132
|
],
|
|
@@ -7602,12 +8136,91 @@ var OPERATIONS = [
|
|
|
7602
8136
|
"scope": "secrets:write"
|
|
7603
8137
|
},
|
|
7604
8138
|
{
|
|
7605
|
-
"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",
|
|
7606
8219
|
"method": "get",
|
|
7607
8220
|
"path": "/scripts/{slug}/triggers/{triggerId}/calls",
|
|
7608
8221
|
"summary": "List a webhook trigger's calls",
|
|
7609
8222
|
"cli": {
|
|
7610
|
-
"command": "
|
|
8223
|
+
"command": "trigger-calls list",
|
|
7611
8224
|
"args": [
|
|
7612
8225
|
"slug",
|
|
7613
8226
|
"triggerId"
|
|
@@ -7616,14 +8229,14 @@ var OPERATIONS = [
|
|
|
7616
8229
|
},
|
|
7617
8230
|
"mcp": {
|
|
7618
8231
|
"exposed": true,
|
|
7619
|
-
"name": "
|
|
8232
|
+
"name": "trigger_calls_list",
|
|
7620
8233
|
"hints": {
|
|
7621
8234
|
"readOnlyHint": true,
|
|
7622
8235
|
"destructiveHint": false,
|
|
7623
8236
|
"idempotentHint": true
|
|
7624
8237
|
}
|
|
7625
8238
|
},
|
|
7626
|
-
"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.",
|
|
7627
8240
|
"fields": [
|
|
7628
8241
|
{
|
|
7629
8242
|
"name": "slug",
|
|
@@ -7643,14 +8256,41 @@ var OPERATIONS = [
|
|
|
7643
8256
|
"type": "string",
|
|
7644
8257
|
"required": true,
|
|
7645
8258
|
"description": "The trigger's ID.",
|
|
7646
|
-
"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.",
|
|
7647
8286
|
"schema": {
|
|
7648
8287
|
"type": "string",
|
|
7649
|
-
"description": "
|
|
8288
|
+
"description": "Opaque token from a previous page's nextCursor."
|
|
7650
8289
|
}
|
|
7651
8290
|
}
|
|
7652
8291
|
],
|
|
7653
8292
|
"hasBody": false,
|
|
8293
|
+
"paginated": true,
|
|
7654
8294
|
"workspace": true,
|
|
7655
8295
|
"acceptsApiKey": true,
|
|
7656
8296
|
"scope": "scripts:read"
|
|
@@ -7889,7 +8529,7 @@ var OPERATIONS = [
|
|
|
7889
8529
|
"type": "string",
|
|
7890
8530
|
"required": true,
|
|
7891
8531
|
"description": "The trigger's ID.",
|
|
7892
|
-
"example": "
|
|
8532
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
7893
8533
|
"schema": {
|
|
7894
8534
|
"type": "string",
|
|
7895
8535
|
"description": "The trigger's ID."
|
|
@@ -7901,6 +8541,60 @@ var OPERATIONS = [
|
|
|
7901
8541
|
"acceptsApiKey": true,
|
|
7902
8542
|
"scope": "scripts:write"
|
|
7903
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
|
+
},
|
|
7904
8598
|
{
|
|
7905
8599
|
"operationId": "triggers.list",
|
|
7906
8600
|
"method": "get",
|
|
@@ -7935,9 +8629,36 @@ var OPERATIONS = [
|
|
|
7935
8629
|
"type": "string",
|
|
7936
8630
|
"description": "The slug's ID."
|
|
7937
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
|
+
}
|
|
7938
8658
|
}
|
|
7939
8659
|
],
|
|
7940
8660
|
"hasBody": false,
|
|
8661
|
+
"paginated": true,
|
|
7941
8662
|
"workspace": true,
|
|
7942
8663
|
"acceptsApiKey": true,
|
|
7943
8664
|
"scope": "scripts:read"
|
|
@@ -7979,7 +8700,7 @@ var OPERATIONS = [
|
|
|
7979
8700
|
"type": "string",
|
|
7980
8701
|
"required": true,
|
|
7981
8702
|
"description": "The trigger's ID.",
|
|
7982
|
-
"example": "
|
|
8703
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
7983
8704
|
"schema": {
|
|
7984
8705
|
"type": "string",
|
|
7985
8706
|
"description": "The trigger's ID."
|
|
@@ -8028,7 +8749,7 @@ var OPERATIONS = [
|
|
|
8028
8749
|
"type": "string",
|
|
8029
8750
|
"required": true,
|
|
8030
8751
|
"description": "The trigger's ID.",
|
|
8031
|
-
"example": "
|
|
8752
|
+
"example": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
|
|
8032
8753
|
"schema": {
|
|
8033
8754
|
"type": "string",
|
|
8034
8755
|
"description": "The trigger's ID."
|
|
@@ -8223,9 +8944,10 @@ var OPERATIONS = [
|
|
|
8223
8944
|
"idempotentHint": true
|
|
8224
8945
|
}
|
|
8225
8946
|
},
|
|
8226
|
-
"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.",
|
|
8227
8948
|
"fields": [],
|
|
8228
8949
|
"hasBody": false,
|
|
8950
|
+
"paginated": true,
|
|
8229
8951
|
"workspace": true,
|
|
8230
8952
|
"acceptsApiKey": true,
|
|
8231
8953
|
"scope": "workspace.approvals:read"
|
|
@@ -8304,12 +9026,12 @@ var OPERATIONS = [
|
|
|
8304
9026
|
{
|
|
8305
9027
|
"operationId": "workspace.approvalRequests.get",
|
|
8306
9028
|
"method": "get",
|
|
8307
|
-
"path": "/workspace/approval-requests/{
|
|
9029
|
+
"path": "/workspace/approval-requests/{approvalRequestId}",
|
|
8308
9030
|
"summary": "Check an approval request",
|
|
8309
9031
|
"cli": {
|
|
8310
9032
|
"command": "workspace approval-requests get",
|
|
8311
9033
|
"args": [
|
|
8312
|
-
"
|
|
9034
|
+
"approvalRequestId"
|
|
8313
9035
|
],
|
|
8314
9036
|
"confirm": false
|
|
8315
9037
|
},
|
|
@@ -8325,15 +9047,15 @@ var OPERATIONS = [
|
|
|
8325
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`.",
|
|
8326
9048
|
"fields": [
|
|
8327
9049
|
{
|
|
8328
|
-
"name": "
|
|
9050
|
+
"name": "approvalRequestId",
|
|
8329
9051
|
"in": "path",
|
|
8330
9052
|
"type": "string",
|
|
8331
9053
|
"required": true,
|
|
8332
|
-
"description": "The request's id.",
|
|
8333
|
-
"example": "
|
|
9054
|
+
"description": "The approval request's id.",
|
|
9055
|
+
"example": "apr_7c2e9b4d-1f3a-4e5b-8c6d-7e8f9a0b1c2d",
|
|
8334
9056
|
"schema": {
|
|
8335
9057
|
"type": "string",
|
|
8336
|
-
"description": "The request's id."
|
|
9058
|
+
"description": "The approval request's id."
|
|
8337
9059
|
}
|
|
8338
9060
|
}
|
|
8339
9061
|
],
|
|
@@ -8345,12 +9067,12 @@ var OPERATIONS = [
|
|
|
8345
9067
|
{
|
|
8346
9068
|
"operationId": "workspace.approvalRequests.redeem",
|
|
8347
9069
|
"method": "post",
|
|
8348
|
-
"path": "/workspace/approval-requests/{
|
|
9070
|
+
"path": "/workspace/approval-requests/{approvalRequestId}/redeem",
|
|
8349
9071
|
"summary": "Redeem an approved request",
|
|
8350
9072
|
"cli": {
|
|
8351
9073
|
"command": "workspace approval-requests redeem",
|
|
8352
9074
|
"args": [
|
|
8353
|
-
"
|
|
9075
|
+
"approvalRequestId"
|
|
8354
9076
|
],
|
|
8355
9077
|
"confirm": false
|
|
8356
9078
|
},
|
|
@@ -8361,15 +9083,15 @@ var OPERATIONS = [
|
|
|
8361
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.",
|
|
8362
9084
|
"fields": [
|
|
8363
9085
|
{
|
|
8364
|
-
"name": "
|
|
9086
|
+
"name": "approvalRequestId",
|
|
8365
9087
|
"in": "path",
|
|
8366
9088
|
"type": "string",
|
|
8367
9089
|
"required": true,
|
|
8368
|
-
"description": "The request's id.",
|
|
8369
|
-
"example": "
|
|
9090
|
+
"description": "The approval request's id.",
|
|
9091
|
+
"example": "apr_7c2e9b4d-1f3a-4e5b-8c6d-7e8f9a0b1c2d",
|
|
8370
9092
|
"schema": {
|
|
8371
9093
|
"type": "string",
|
|
8372
|
-
"description": "The request's id."
|
|
9094
|
+
"description": "The approval request's id."
|
|
8373
9095
|
}
|
|
8374
9096
|
}
|
|
8375
9097
|
],
|
|
@@ -8397,7 +9119,7 @@ var OPERATIONS = [
|
|
|
8397
9119
|
"idempotentHint": true
|
|
8398
9120
|
}
|
|
8399
9121
|
},
|
|
8400
|
-
"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.",
|
|
8401
9123
|
"fields": [
|
|
8402
9124
|
{
|
|
8403
9125
|
"name": "limit",
|
|
@@ -8444,7 +9166,7 @@ var OPERATIONS = [
|
|
|
8444
9166
|
"type": "string",
|
|
8445
9167
|
"required": false,
|
|
8446
9168
|
"description": "Only events of this action.",
|
|
8447
|
-
"example": "workspace.
|
|
9169
|
+
"example": "workspace.member.invited",
|
|
8448
9170
|
"schema": {
|
|
8449
9171
|
"type": "string",
|
|
8450
9172
|
"maxLength": 100,
|
|
@@ -8457,7 +9179,7 @@ var OPERATIONS = [
|
|
|
8457
9179
|
"type": "string",
|
|
8458
9180
|
"required": false,
|
|
8459
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`).",
|
|
8460
|
-
"example": "user:
|
|
9182
|
+
"example": "user:usr_4f8a2c1e-7b3d-4e9f-a6c5-2d1b0e9f8a7c",
|
|
8461
9183
|
"schema": {
|
|
8462
9184
|
"type": "string",
|
|
8463
9185
|
"pattern": "^(user|credential):[\\w-]+$",
|
|
@@ -8466,6 +9188,7 @@ var OPERATIONS = [
|
|
|
8466
9188
|
}
|
|
8467
9189
|
],
|
|
8468
9190
|
"hasBody": false,
|
|
9191
|
+
"paginated": true,
|
|
8469
9192
|
"workspace": true,
|
|
8470
9193
|
"acceptsApiKey": true,
|
|
8471
9194
|
"scope": "workspace.audit:read"
|
|
@@ -8489,9 +9212,10 @@ var OPERATIONS = [
|
|
|
8489
9212
|
"idempotentHint": true
|
|
8490
9213
|
}
|
|
8491
9214
|
},
|
|
8492
|
-
"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.",
|
|
8493
9216
|
"fields": [],
|
|
8494
9217
|
"hasBody": false,
|
|
9218
|
+
"paginated": true,
|
|
8495
9219
|
"workspace": true,
|
|
8496
9220
|
"acceptsApiKey": true,
|
|
8497
9221
|
"scope": "workspace.webhooks:read"
|
|
@@ -8571,6 +9295,7 @@ var OPERATIONS = [
|
|
|
8571
9295
|
}
|
|
8572
9296
|
],
|
|
8573
9297
|
"hasBody": false,
|
|
9298
|
+
"paginated": true,
|
|
8574
9299
|
"workspace": true,
|
|
8575
9300
|
"acceptsApiKey": true,
|
|
8576
9301
|
"scope": "workspace.members:read"
|
|
@@ -8624,10 +9349,37 @@ var OPERATIONS = [
|
|
|
8624
9349
|
}
|
|
8625
9350
|
],
|
|
8626
9351
|
"hasBody": false,
|
|
9352
|
+
"paginated": true,
|
|
8627
9353
|
"workspace": true,
|
|
8628
9354
|
"acceptsApiKey": true,
|
|
8629
9355
|
"scope": "workspace.members:read"
|
|
8630
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
|
+
},
|
|
8631
9383
|
{
|
|
8632
9384
|
"operationId": "workspace.teams.list",
|
|
8633
9385
|
"method": "get",
|
|
@@ -8677,36 +9429,11 @@ var OPERATIONS = [
|
|
|
8677
9429
|
}
|
|
8678
9430
|
],
|
|
8679
9431
|
"hasBody": false,
|
|
9432
|
+
"paginated": true,
|
|
8680
9433
|
"workspace": true,
|
|
8681
9434
|
"acceptsApiKey": true,
|
|
8682
9435
|
"scope": "workspace.teams:read"
|
|
8683
9436
|
},
|
|
8684
|
-
{
|
|
8685
|
-
"operationId": "workspace.usage",
|
|
8686
|
-
"method": "get",
|
|
8687
|
-
"path": "/workspace/usage",
|
|
8688
|
-
"summary": "Get your plan's usage this period",
|
|
8689
|
-
"cli": {
|
|
8690
|
-
"command": "workspace usage",
|
|
8691
|
-
"args": [],
|
|
8692
|
-
"confirm": false
|
|
8693
|
-
},
|
|
8694
|
-
"mcp": {
|
|
8695
|
-
"exposed": true,
|
|
8696
|
-
"name": "workspace_usage",
|
|
8697
|
-
"hints": {
|
|
8698
|
-
"readOnlyHint": true,
|
|
8699
|
-
"destructiveHint": false,
|
|
8700
|
-
"idempotentHint": true
|
|
8701
|
-
}
|
|
8702
|
-
},
|
|
8703
|
-
"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.",
|
|
8704
|
-
"fields": [],
|
|
8705
|
-
"hasBody": false,
|
|
8706
|
-
"workspace": true,
|
|
8707
|
-
"acceptsApiKey": true,
|
|
8708
|
-
"scope": "workspace:read"
|
|
8709
|
-
},
|
|
8710
9437
|
{
|
|
8711
9438
|
"operationId": "workspace.webhookDeliveries.list",
|
|
8712
9439
|
"method": "get",
|
|
@@ -8728,7 +9455,7 @@ var OPERATIONS = [
|
|
|
8728
9455
|
"idempotentHint": true
|
|
8729
9456
|
}
|
|
8730
9457
|
},
|
|
8731
|
-
"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.",
|
|
8732
9459
|
"fields": [
|
|
8733
9460
|
{
|
|
8734
9461
|
"name": "endpointId",
|
|
@@ -8736,7 +9463,7 @@ var OPERATIONS = [
|
|
|
8736
9463
|
"type": "string",
|
|
8737
9464
|
"required": true,
|
|
8738
9465
|
"description": "The endpoint's ID.",
|
|
8739
|
-
"example": "
|
|
9466
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8740
9467
|
"schema": {
|
|
8741
9468
|
"type": "string",
|
|
8742
9469
|
"description": "The endpoint's ID."
|
|
@@ -8800,6 +9527,7 @@ var OPERATIONS = [
|
|
|
8800
9527
|
}
|
|
8801
9528
|
],
|
|
8802
9529
|
"hasBody": false,
|
|
9530
|
+
"paginated": true,
|
|
8803
9531
|
"workspace": true,
|
|
8804
9532
|
"acceptsApiKey": true,
|
|
8805
9533
|
"scope": "workspace.webhooks:read"
|
|
@@ -8826,7 +9554,7 @@ var OPERATIONS = [
|
|
|
8826
9554
|
"idempotentHint": false
|
|
8827
9555
|
}
|
|
8828
9556
|
},
|
|
8829
|
-
"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.",
|
|
8830
9558
|
"fields": [
|
|
8831
9559
|
{
|
|
8832
9560
|
"name": "endpointId",
|
|
@@ -8834,7 +9562,7 @@ var OPERATIONS = [
|
|
|
8834
9562
|
"type": "string",
|
|
8835
9563
|
"required": true,
|
|
8836
9564
|
"description": "The endpoint's ID.",
|
|
8837
|
-
"example": "
|
|
9565
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8838
9566
|
"schema": {
|
|
8839
9567
|
"type": "string",
|
|
8840
9568
|
"description": "The endpoint's ID."
|
|
@@ -8846,7 +9574,7 @@ var OPERATIONS = [
|
|
|
8846
9574
|
"type": "string",
|
|
8847
9575
|
"required": true,
|
|
8848
9576
|
"description": "The delivery's ID.",
|
|
8849
|
-
"example": "
|
|
9577
|
+
"example": "del_8a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
|
|
8850
9578
|
"schema": {
|
|
8851
9579
|
"type": "string",
|
|
8852
9580
|
"description": "The delivery's ID."
|
|
@@ -8872,7 +9600,7 @@ var OPERATIONS = [
|
|
|
8872
9600
|
"exposed": false,
|
|
8873
9601
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8874
9602
|
},
|
|
8875
|
-
"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.",
|
|
8876
9604
|
"fields": [
|
|
8877
9605
|
{
|
|
8878
9606
|
"name": "url",
|
|
@@ -8940,7 +9668,7 @@ var OPERATIONS = [
|
|
|
8940
9668
|
"exposed": false,
|
|
8941
9669
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8942
9670
|
},
|
|
8943
|
-
"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.",
|
|
8944
9672
|
"fields": [
|
|
8945
9673
|
{
|
|
8946
9674
|
"name": "endpointId",
|
|
@@ -8948,7 +9676,7 @@ var OPERATIONS = [
|
|
|
8948
9676
|
"type": "string",
|
|
8949
9677
|
"required": true,
|
|
8950
9678
|
"description": "The endpoint's ID.",
|
|
8951
|
-
"example": "
|
|
9679
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8952
9680
|
"schema": {
|
|
8953
9681
|
"type": "string",
|
|
8954
9682
|
"description": "The endpoint's ID."
|
|
@@ -8976,7 +9704,7 @@ var OPERATIONS = [
|
|
|
8976
9704
|
"exposed": false,
|
|
8977
9705
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
8978
9706
|
},
|
|
8979
|
-
"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.",
|
|
8980
9708
|
"fields": [
|
|
8981
9709
|
{
|
|
8982
9710
|
"name": "endpointId",
|
|
@@ -8984,7 +9712,7 @@ var OPERATIONS = [
|
|
|
8984
9712
|
"type": "string",
|
|
8985
9713
|
"required": true,
|
|
8986
9714
|
"description": "The endpoint's ID.",
|
|
8987
|
-
"example": "
|
|
9715
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
8988
9716
|
"schema": {
|
|
8989
9717
|
"type": "string",
|
|
8990
9718
|
"description": "The endpoint's ID."
|
|
@@ -9017,7 +9745,7 @@ var OPERATIONS = [
|
|
|
9017
9745
|
"idempotentHint": true
|
|
9018
9746
|
}
|
|
9019
9747
|
},
|
|
9020
|
-
"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.",
|
|
9021
9749
|
"fields": [
|
|
9022
9750
|
{
|
|
9023
9751
|
"name": "endpointId",
|
|
@@ -9025,7 +9753,7 @@ var OPERATIONS = [
|
|
|
9025
9753
|
"type": "string",
|
|
9026
9754
|
"required": true,
|
|
9027
9755
|
"description": "The endpoint's ID.",
|
|
9028
|
-
"example": "
|
|
9756
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9029
9757
|
"schema": {
|
|
9030
9758
|
"type": "string",
|
|
9031
9759
|
"description": "The endpoint's ID."
|
|
@@ -9056,9 +9784,10 @@ var OPERATIONS = [
|
|
|
9056
9784
|
"idempotentHint": true
|
|
9057
9785
|
}
|
|
9058
9786
|
},
|
|
9059
|
-
"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.",
|
|
9060
9788
|
"fields": [],
|
|
9061
9789
|
"hasBody": false,
|
|
9790
|
+
"paginated": true,
|
|
9062
9791
|
"workspace": true,
|
|
9063
9792
|
"acceptsApiKey": true,
|
|
9064
9793
|
"scope": "workspace.webhooks:read"
|
|
@@ -9084,7 +9813,7 @@ var OPERATIONS = [
|
|
|
9084
9813
|
"idempotentHint": false
|
|
9085
9814
|
}
|
|
9086
9815
|
},
|
|
9087
|
-
"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.",
|
|
9088
9817
|
"fields": [
|
|
9089
9818
|
{
|
|
9090
9819
|
"name": "endpointId",
|
|
@@ -9092,7 +9821,7 @@ var OPERATIONS = [
|
|
|
9092
9821
|
"type": "string",
|
|
9093
9822
|
"required": true,
|
|
9094
9823
|
"description": "The endpoint's ID.",
|
|
9095
|
-
"example": "
|
|
9824
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9096
9825
|
"schema": {
|
|
9097
9826
|
"type": "string",
|
|
9098
9827
|
"description": "The endpoint's ID."
|
|
@@ -9120,7 +9849,7 @@ var OPERATIONS = [
|
|
|
9120
9849
|
"exposed": false,
|
|
9121
9850
|
"reason": "Changes where workspace data is sent. A person configures webhook endpoints (Settings \u2192 Developers in the app)."
|
|
9122
9851
|
},
|
|
9123
|
-
"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.",
|
|
9124
9853
|
"fields": [
|
|
9125
9854
|
{
|
|
9126
9855
|
"name": "endpointId",
|
|
@@ -9128,7 +9857,7 @@ var OPERATIONS = [
|
|
|
9128
9857
|
"type": "string",
|
|
9129
9858
|
"required": true,
|
|
9130
9859
|
"description": "The endpoint's ID.",
|
|
9131
|
-
"example": "
|
|
9860
|
+
"example": "we_3f0c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f",
|
|
9132
9861
|
"schema": {
|
|
9133
9862
|
"type": "string",
|
|
9134
9863
|
"description": "The endpoint's ID."
|
|
@@ -9213,6 +9942,56 @@ function coveredOperations(program3) {
|
|
|
9213
9942
|
return covered;
|
|
9214
9943
|
}
|
|
9215
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
|
+
|
|
9216
9995
|
// src/generated.ts
|
|
9217
9996
|
var generatedCommands = (program3, ctx) => {
|
|
9218
9997
|
const groups = /* @__PURE__ */ new Set();
|
|
@@ -9228,12 +10007,10 @@ var generatedCommands = (program3, ctx) => {
|
|
|
9228
10007
|
}
|
|
9229
10008
|
};
|
|
9230
10009
|
var RESERVED = /* @__PURE__ */ new Set(["json", "yes", "workspace", "data", "environment"]);
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
return flag(name).replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
9236
|
-
}
|
|
10010
|
+
var collect = (value, previous) => [
|
|
10011
|
+
...previous ?? [],
|
|
10012
|
+
...value.split(",").map((part) => part.trim()).filter(Boolean)
|
|
10013
|
+
];
|
|
9237
10014
|
function register(program3, ctx, op, groups, hidden) {
|
|
9238
10015
|
const words = op.cli.command.split(" ");
|
|
9239
10016
|
const action = words.pop();
|
|
@@ -9252,22 +10029,41 @@ function register(program3, ctx, op, groups, hidden) {
|
|
|
9252
10029
|
return;
|
|
9253
10030
|
}
|
|
9254
10031
|
const positional = new Set(op.cli.args);
|
|
9255
|
-
const
|
|
10032
|
+
const fields = op.fields.filter(
|
|
9256
10033
|
(field) => !positional.has(field.name) && !RESERVED.has(field.name)
|
|
9257
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
|
+
}));
|
|
9258
10040
|
const command = parent.command(action, { hidden }).description(op.summary).addHelpText("after", `
|
|
9259
10041
|
${op.description}`);
|
|
9260
10042
|
markOperation(command, op.operationId);
|
|
9261
|
-
for (const arg of op.cli.args) command.argument(`<${
|
|
9262
|
-
for (const field of flags) {
|
|
10043
|
+
for (const arg of op.cli.args) command.argument(`<${kebab(arg)}>`);
|
|
10044
|
+
for (const { field, spec } of flags) {
|
|
9263
10045
|
const description = [
|
|
9264
10046
|
field.description ?? `${field.in} field`,
|
|
10047
|
+
spec.kind === "list" ? "Repeat it for each value." : "",
|
|
9265
10048
|
field.required ? "(required)" : ""
|
|
9266
10049
|
].filter(Boolean).join(" ");
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
)
|
|
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");
|
|
9271
10067
|
}
|
|
9272
10068
|
if (op.hasBody) command.option("--data <json>", "the whole JSON body");
|
|
9273
10069
|
if (op.rawBody) command.requiredOption("--file <path>", "the file to send");
|
|
@@ -9284,7 +10080,7 @@ ${op.description}`);
|
|
|
9284
10080
|
const values = input.slice(0, op.cli.args.length);
|
|
9285
10081
|
const options = input[op.cli.args.length];
|
|
9286
10082
|
if (op.cli.confirm && !options.yes) {
|
|
9287
|
-
throw new
|
|
10083
|
+
throw new UsageError(
|
|
9288
10084
|
`${op.summary} cannot be undone. Run it again with --yes to confirm.`
|
|
9289
10085
|
);
|
|
9290
10086
|
}
|
|
@@ -9302,62 +10098,111 @@ ${op.description}`);
|
|
|
9302
10098
|
print(ctx, result, options.json === true);
|
|
9303
10099
|
});
|
|
9304
10100
|
}
|
|
9305
|
-
function
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
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;
|
|
9311
10112
|
}
|
|
10113
|
+
if (spec.kind === "boolean") return raw === true;
|
|
10114
|
+
if (field.type === "number") return number2(spec.name, raw);
|
|
9312
10115
|
if (field.type === "json") {
|
|
9313
10116
|
try {
|
|
9314
10117
|
return JSON.parse(String(raw));
|
|
9315
10118
|
} catch {
|
|
9316
|
-
throw new
|
|
10119
|
+
throw new UsageError(`--${spec.name} must be JSON`);
|
|
9317
10120
|
}
|
|
9318
10121
|
}
|
|
9319
10122
|
return raw;
|
|
9320
10123
|
}
|
|
9321
10124
|
async function call2(ctx, op, args, options, flags) {
|
|
9322
|
-
const { api: api2, token, workspace: workspace2, environment: environment2 } = ctx.credentials({
|
|
9323
|
-
workspace: op.workspace ? options.workspace ?? void 0 : false
|
|
9324
|
-
});
|
|
9325
|
-
const values = (field) => field.in === "path" || op.cli.args.includes(field.name) ? args[field.name] : options[optionKey(field.name)];
|
|
9326
10125
|
let whole = {};
|
|
9327
10126
|
if (op.hasBody && options.data) {
|
|
9328
10127
|
try {
|
|
9329
10128
|
whole = JSON.parse(String(options.data));
|
|
9330
10129
|
} catch {
|
|
9331
|
-
throw new
|
|
10130
|
+
throw new UsageError("--data must be a JSON object");
|
|
9332
10131
|
}
|
|
9333
10132
|
}
|
|
9334
10133
|
const input = {};
|
|
9335
10134
|
for (const field of op.fields) {
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
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
|
+
}
|
|
9339
10152
|
}
|
|
9340
10153
|
const missing = flags.filter(
|
|
9341
|
-
(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)
|
|
9342
10155
|
);
|
|
9343
10156
|
if (missing.length > 0) {
|
|
9344
|
-
throw new
|
|
9345
|
-
`missing ${missing.map((
|
|
10157
|
+
throw new UsageError(
|
|
10158
|
+
`missing ${missing.map(({ spec }) => `--${spec.name}`).join(", ")}`
|
|
9346
10159
|
);
|
|
9347
10160
|
}
|
|
9348
10161
|
const problem = variantProblem(op, input, whole);
|
|
9349
|
-
if (problem) throw new
|
|
9350
|
-
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;
|
|
9351
10196
|
const headers = {
|
|
9352
10197
|
authorization: `Bearer ${token}`
|
|
9353
10198
|
};
|
|
9354
10199
|
if (workspace2) headers["x-workspace"] = workspace2;
|
|
9355
|
-
if (
|
|
10200
|
+
if (environment3) headers["x-environment"] = environment3;
|
|
9356
10201
|
if (request.body) headers["content-type"] = "application/json";
|
|
9357
10202
|
const raw = op.rawBody ? readFileSync3(String(options.file)) : void 0;
|
|
9358
10203
|
if (op.rawBody) headers["content-type"] = op.rawBody;
|
|
9359
10204
|
const response = await ctx.fetch(
|
|
9360
|
-
new Request(`${
|
|
10205
|
+
new Request(`${baseURL}/v1${request.path}`, {
|
|
9361
10206
|
method: request.method,
|
|
9362
10207
|
headers,
|
|
9363
10208
|
...request.body ? { body: JSON.stringify(request.body) } : {},
|
|
@@ -9368,16 +10213,13 @@ async function call2(ctx, op, args, options, flags) {
|
|
|
9368
10213
|
return new Uint8Array(await response.arrayBuffer());
|
|
9369
10214
|
}
|
|
9370
10215
|
const text = await response.text();
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
error?.code ?? "internal_error",
|
|
9377
|
-
error?.message ?? `HTTP ${response.status}`,
|
|
9378
|
-
error?.requestId
|
|
9379
|
-
);
|
|
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");
|
|
9380
10221
|
}
|
|
10222
|
+
if (!response.ok) throw apiErrorFrom(data, response);
|
|
9381
10223
|
return data;
|
|
9382
10224
|
}
|
|
9383
10225
|
function scalarColumns(rows) {
|
|
@@ -9402,7 +10244,9 @@ function print(ctx, data, asJson) {
|
|
|
9402
10244
|
rows.length === 0 ? "No results." : table(rows, scalarColumns(rows))
|
|
9403
10245
|
);
|
|
9404
10246
|
if (typeof page.nextCursor === "string") {
|
|
9405
|
-
ctx.io.stdout(
|
|
10247
|
+
ctx.io.stdout(
|
|
10248
|
+
`More: --cursor ${page.nextCursor}, or --all for every page`
|
|
10249
|
+
);
|
|
9406
10250
|
}
|
|
9407
10251
|
return;
|
|
9408
10252
|
}
|
|
@@ -9424,14 +10268,21 @@ function variantProblem(op, input, whole) {
|
|
|
9424
10268
|
const chosen = String(input[key] ?? whole[key]);
|
|
9425
10269
|
const needs = op.variants.required[chosen];
|
|
9426
10270
|
if (!needs) {
|
|
9427
|
-
return `--${
|
|
10271
|
+
return `--${kebab(key)} must be one of ${Object.keys(op.variants.required).join(", ")}`;
|
|
9428
10272
|
}
|
|
9429
10273
|
const absent = needs.filter(
|
|
9430
10274
|
(name) => input[name] === void 0 && whole[name] === void 0
|
|
9431
10275
|
);
|
|
9432
|
-
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;
|
|
9433
10277
|
}
|
|
9434
10278
|
|
|
10279
|
+
// src/product/index.ts
|
|
10280
|
+
var product_exports2 = {};
|
|
10281
|
+
__export(product_exports2, {
|
|
10282
|
+
productCommands: () => productCommands,
|
|
10283
|
+
productErrorHint: () => productErrorHint
|
|
10284
|
+
});
|
|
10285
|
+
|
|
9435
10286
|
// src/product/files.ts
|
|
9436
10287
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
9437
10288
|
import { basename, dirname, join as join2, resolve, sep } from "node:path";
|
|
@@ -9451,7 +10302,7 @@ async function uploadPath(ctx, path2, workspace2) {
|
|
|
9451
10302
|
});
|
|
9452
10303
|
}
|
|
9453
10304
|
async function downloadBytes(ctx, id, workspace2) {
|
|
9454
|
-
const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/
|
|
10305
|
+
const result = await ctx.client({ workspace: workspace2 }).GET("/files/{fileId}/content", {
|
|
9455
10306
|
params: { path: { fileId: id } },
|
|
9456
10307
|
parseAs: "arrayBuffer"
|
|
9457
10308
|
});
|
|
@@ -10287,7 +11138,16 @@ function parse(toml, options = {}) {
|
|
|
10287
11138
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
10288
11139
|
|
|
10289
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
|
+
}
|
|
10290
11149
|
var SCRIPT = /\.(py|js|mjs|cjs|ts|mts|sh)$/i;
|
|
11150
|
+
var isScriptFile = (path2) => SCRIPT.test(path2);
|
|
10291
11151
|
var NOT_A_SCRIPT = /(\.config\.|^setup\.py$|^conftest\.py$|\.d\.ts$|\.test\.|_test\.py$|^test_)/i;
|
|
10292
11152
|
var HELP = 'Pass --command "\u2026" (for example --command "python report.py {month}"), add a reminix.json, or ask your agent to write one.';
|
|
10293
11153
|
function slugOf(name) {
|
|
@@ -10721,7 +11581,7 @@ Nothing was uploaded (--dry-run).`
|
|
|
10721
11581
|
if (options.number !== void 0) {
|
|
10722
11582
|
const version2 = Number(options.number);
|
|
10723
11583
|
if (!Number.isInteger(version2) || version2 < 1) {
|
|
10724
|
-
throw new
|
|
11584
|
+
throw new UsageError("--number: a version's number, like --number 3");
|
|
10725
11585
|
}
|
|
10726
11586
|
const script2 = await call3(
|
|
10727
11587
|
"POST",
|
|
@@ -10732,7 +11592,7 @@ Nothing was uploaded (--dry-run).`
|
|
|
10732
11592
|
slug: manifest.slug,
|
|
10733
11593
|
version: { version: version2 },
|
|
10734
11594
|
script: script2,
|
|
10735
|
-
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)
|
|
10736
11596
|
};
|
|
10737
11597
|
}
|
|
10738
11598
|
const version = await call3("POST", `/v1/scripts/${slug}/versions`, {
|
|
@@ -10753,10 +11613,37 @@ Nothing was uploaded (--dry-run).`
|
|
|
10753
11613
|
});
|
|
10754
11614
|
const script = null;
|
|
10755
11615
|
const approveUrl = version.approval?.approveUrl ?? null;
|
|
10756
|
-
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);
|
|
10757
11617
|
const found = detected ? `${describeDetected(manifest, detected)}
|
|
10758
11618
|
` : "";
|
|
10759
|
-
|
|
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}.`;
|
|
10760
11647
|
}
|
|
10761
11648
|
var definePublish = (mode) => (command, ctx) => defineFolderOptions(
|
|
10762
11649
|
mode === "publish" ? covers(
|
|
@@ -10794,7 +11681,9 @@ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
|
|
|
10794
11681
|
if (!options.json) ctx.io.stderr(`Skipped ${dir}: no script in it`);
|
|
10795
11682
|
}
|
|
10796
11683
|
if (options.number !== void 0 && folders.length + missing.length !== 1) {
|
|
10797
|
-
throw new
|
|
11684
|
+
throw new UsageError(
|
|
11685
|
+
"--number publishes one script: name one folder"
|
|
11686
|
+
);
|
|
10798
11687
|
}
|
|
10799
11688
|
if (folders.length === 1 && missing.length === 0) {
|
|
10800
11689
|
const result = await publishFolder(ctx, folders[0], options, mode);
|
|
@@ -10834,11 +11723,29 @@ subfolder that is one: \`${brand.name} ${mode} scripts/\` does them all.`
|
|
|
10834
11723
|
}
|
|
10835
11724
|
}
|
|
10836
11725
|
);
|
|
10837
|
-
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(
|
|
10838
11740
|
"--file <input=path>",
|
|
10839
11741
|
"upload a file as a file input (repeat it for several)",
|
|
10840
11742
|
(value, all) => [...all, value],
|
|
10841
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
|
+
[]
|
|
10842
11749
|
).option(
|
|
10843
11750
|
"--out <dir>",
|
|
10844
11751
|
"download the files the run saves into this folder (else their links are printed)"
|
|
@@ -10850,21 +11757,16 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10850
11757
|
"answer at once with a run awaiting approval or still running, instead of following it"
|
|
10851
11758
|
).option("--workspace <slug>", "act in this workspace for one call").option("--json", "print the whole run, not just its output").action(
|
|
10852
11759
|
async (slug, options) => {
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
);
|
|
10863
|
-
}
|
|
10864
|
-
if (inputs === null || typeof inputs !== "object" || Array.isArray(inputs)) {
|
|
10865
|
-
throw new Error(
|
|
10866
|
-
`--input: must be a JSON object, e.g. '{"orderId":"o_1"}'`
|
|
10867
|
-
);
|
|
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");
|
|
10868
11770
|
}
|
|
10869
11771
|
const call3 = (method, path2, body) => rawRequest(ctx, { method, path: path2, body, workspace: options.workspace });
|
|
10870
11772
|
if (options.file.length > 0) {
|
|
@@ -10872,7 +11774,7 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10872
11774
|
for (const spec of options.file) {
|
|
10873
11775
|
const at = spec.indexOf("=");
|
|
10874
11776
|
if (at <= 0 || at === spec.length - 1) {
|
|
10875
|
-
throw new
|
|
11777
|
+
throw new UsageError(
|
|
10876
11778
|
`--file: input=path, e.g. --file statement=./sept.pdf (got "${spec}")`
|
|
10877
11779
|
);
|
|
10878
11780
|
}
|
|
@@ -10891,7 +11793,7 @@ var defineRun = (command, ctx) => covers(command, "runs.create", "scriptVersions
|
|
|
10891
11793
|
}
|
|
10892
11794
|
}
|
|
10893
11795
|
if (options.number !== void 0 && !/^[1-9]\d*$/.test(options.number)) {
|
|
10894
|
-
throw new
|
|
11796
|
+
throw new UsageError("--number: a version's number, like --number 2");
|
|
10895
11797
|
}
|
|
10896
11798
|
let run3 = await call3(
|
|
10897
11799
|
"POST",
|
|
@@ -10985,6 +11887,51 @@ var scriptCommands = (program3, ctx) => {
|
|
|
10985
11887
|
`Run a script and print its output. Use --number to test a draft. Short for ${brand.name} scripts run`
|
|
10986
11888
|
);
|
|
10987
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
|
+
}
|
|
10988
11935
|
|
|
10989
11936
|
// src/product/init.ts
|
|
10990
11937
|
import { closeSync as closeSync2, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
@@ -11096,34 +12043,81 @@ var initCommand = (program3, ctx) => {
|
|
|
11096
12043
|
// src/product/secrets.ts
|
|
11097
12044
|
var secretCommands = (program3, ctx) => {
|
|
11098
12045
|
const group = program3.commands.find((c) => c.name() === "secrets") ?? program3.command("secrets").description("secrets commands");
|
|
11099
|
-
|
|
11100
|
-
"
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
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(
|
|
11106
12060
|
async (name, options) => {
|
|
11107
|
-
const value =
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
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
|
+
});
|
|
11112
12071
|
}
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
body: {
|
|
11117
|
-
value,
|
|
11118
|
-
hosts: options.hosts.split(",").map((h) => h.trim()).filter(Boolean),
|
|
11119
|
-
allowEnvVar: options.allowEnvVar ?? false
|
|
11120
|
-
},
|
|
11121
|
-
workspace: options.workspace
|
|
11122
|
-
});
|
|
11123
|
-
ctx.io.stdout(options.json ? json(secret) : `Saved ${name}.`);
|
|
12072
|
+
ctx.io.stdout(
|
|
12073
|
+
options.json ? json(secret) : `Saved ${name} in ${environment3}.`
|
|
12074
|
+
);
|
|
11124
12075
|
}
|
|
11125
12076
|
);
|
|
11126
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
|
+
}
|
|
11127
12121
|
|
|
11128
12122
|
// src/product/index.ts
|
|
11129
12123
|
var productCommands = [
|
|
@@ -11144,15 +12138,18 @@ var commands = [
|
|
|
11144
12138
|
function tokenEnvVar() {
|
|
11145
12139
|
return `${brand.identifier.toUpperCase()}_TOKEN`;
|
|
11146
12140
|
}
|
|
12141
|
+
var VERSION2 = "1.0.0-rc.15";
|
|
11147
12142
|
function build(io) {
|
|
11148
12143
|
let actedIn = null;
|
|
11149
12144
|
let sending;
|
|
11150
|
-
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(
|
|
11151
12146
|
"after",
|
|
11152
12147
|
`
|
|
11153
12148
|
Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
|
|
11154
|
-
Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} environment use\`, else the default
|
|
11155
|
-
|
|
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(
|
|
11156
12153
|
"--environment <name>",
|
|
11157
12154
|
"act in this environment (where the product has them)"
|
|
11158
12155
|
).option(
|
|
@@ -11164,13 +12161,15 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11164
12161
|
}).showHelpAfterError();
|
|
11165
12162
|
const ctx = {
|
|
11166
12163
|
io,
|
|
11167
|
-
settings: () => resolveSettings(
|
|
11168
|
-
|
|
11169
|
-
|
|
12164
|
+
settings: () => resolveSettings(
|
|
12165
|
+
io.env,
|
|
12166
|
+
io.homeDir,
|
|
12167
|
+
program3.opts()
|
|
12168
|
+
),
|
|
11170
12169
|
credentials: (options = {}) => {
|
|
11171
12170
|
const settings = ctx.settings();
|
|
11172
12171
|
if (!settings.token) {
|
|
11173
|
-
throw new
|
|
12172
|
+
throw new NotLoggedInError(
|
|
11174
12173
|
`not logged in. Run \`${brand.name} login\` or set ${tokenEnvVar()}.`
|
|
11175
12174
|
);
|
|
11176
12175
|
}
|
|
@@ -11181,7 +12180,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11181
12180
|
);
|
|
11182
12181
|
}
|
|
11183
12182
|
return {
|
|
11184
|
-
|
|
12183
|
+
baseURL: settings.baseURL,
|
|
11185
12184
|
token: settings.token,
|
|
11186
12185
|
workspace: void 0,
|
|
11187
12186
|
environment: settings.environment
|
|
@@ -11194,7 +12193,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11194
12193
|
);
|
|
11195
12194
|
}
|
|
11196
12195
|
return {
|
|
11197
|
-
|
|
12196
|
+
baseURL: settings.baseURL,
|
|
11198
12197
|
token: settings.token,
|
|
11199
12198
|
workspace: workspace2,
|
|
11200
12199
|
environment: settings.environment
|
|
@@ -11208,7 +12207,7 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11208
12207
|
maxRetries: 0
|
|
11209
12208
|
})
|
|
11210
12209
|
),
|
|
11211
|
-
fetch: (request) => {
|
|
12210
|
+
fetch: async (request) => {
|
|
11212
12211
|
sending ??= withRetries(
|
|
11213
12212
|
async (attempt) => {
|
|
11214
12213
|
const response = await io.fetch(attempt);
|
|
@@ -11221,7 +12220,14 @@ Environment: --environment, else ${environmentEnvVar()}, else \`${brand.name} en
|
|
|
11221
12220
|
)
|
|
11222
12221
|
}
|
|
11223
12222
|
);
|
|
11224
|
-
|
|
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
|
+
}
|
|
11225
12231
|
}
|
|
11226
12232
|
};
|
|
11227
12233
|
for (const register2 of commands) register2(program3, ctx);
|
|
@@ -11231,35 +12237,67 @@ async function run2(argv, io) {
|
|
|
11231
12237
|
const { program: program3, actedIn } = build(io);
|
|
11232
12238
|
try {
|
|
11233
12239
|
await program3.parseAsync(argv, { from: "user" });
|
|
11234
|
-
const
|
|
11235
|
-
if (
|
|
11236
|
-
return
|
|
12240
|
+
const environment3 = actedIn();
|
|
12241
|
+
if (environment3) io.stderr(`Environment: ${environment3}`);
|
|
12242
|
+
return EXIT.ok;
|
|
11237
12243
|
} catch (error) {
|
|
11238
|
-
const
|
|
11239
|
-
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);
|
|
11240
12249
|
if (argv.includes("--json")) {
|
|
11241
12250
|
io.stderr(
|
|
11242
12251
|
JSON.stringify({
|
|
11243
|
-
error: error instanceof
|
|
12252
|
+
error: error instanceof APIError ? {
|
|
11244
12253
|
code: error.code,
|
|
11245
12254
|
message: error.message,
|
|
11246
12255
|
status: error.status,
|
|
11247
|
-
...error.requestId ? { requestId: error.requestId } : {}
|
|
11248
|
-
|
|
11249
|
-
|
|
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 } : {}
|
|
11250
12264
|
})
|
|
11251
12265
|
);
|
|
11252
|
-
return
|
|
12266
|
+
return code2;
|
|
11253
12267
|
}
|
|
11254
|
-
if (error instanceof
|
|
12268
|
+
if (error instanceof APIError) {
|
|
11255
12269
|
const requestId = error.requestId ? ` [request ${error.requestId}]` : "";
|
|
11256
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}`);
|
|
11257
12279
|
} else {
|
|
11258
|
-
|
|
12280
|
+
const cause = error instanceof APIConnectionError && error.cause instanceof Error ? ` (${error.cause.message})` : "";
|
|
12281
|
+
io.stderr(`${brand.name}: ${error.message}${cause}`);
|
|
11259
12282
|
}
|
|
11260
|
-
if (
|
|
11261
|
-
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;
|
|
11262
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}.`;
|
|
11263
12301
|
}
|
|
11264
12302
|
|
|
11265
12303
|
// src/main.ts
|