@anythingai/cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/bin.mjs +1206 -1919
- package/package.json +2 -1
- package/skills/anything-cli/SKILL.md +255 -190
package/dist/js/bin.mjs
CHANGED
|
@@ -3068,61 +3068,401 @@ function errorCodeFromHttpStatus(status) {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
|
|
3070
3070
|
//#endregion
|
|
3071
|
-
//#region
|
|
3072
|
-
|
|
3071
|
+
//#region src/output.ts
|
|
3072
|
+
function printJson(data) {
|
|
3073
|
+
console.log(JSON.stringify(data, null, 2));
|
|
3074
|
+
}
|
|
3075
|
+
function buildLogsToLines(buildLogs) {
|
|
3076
|
+
const lines = buildLogs.split("\n");
|
|
3077
|
+
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
3078
|
+
return lines;
|
|
3079
|
+
}
|
|
3080
|
+
function printSuccess(message) {
|
|
3081
|
+
console.log(styleText("green", message));
|
|
3082
|
+
}
|
|
3083
|
+
function printError(message) {
|
|
3084
|
+
console.error(styleText("red", message));
|
|
3085
|
+
}
|
|
3086
|
+
function printLabel(label, value) {
|
|
3087
|
+
const displayValue = value ?? styleText("dim", "(none)");
|
|
3088
|
+
console.log(` ${styleText("bold", label)}: ${displayValue}`);
|
|
3089
|
+
}
|
|
3090
|
+
function formatDeploymentSummary(deployment) {
|
|
3091
|
+
return `${deployment.status}${deployment.url ? ` — ${deployment.url}` : ""}`;
|
|
3092
|
+
}
|
|
3093
|
+
function printTable({ headers, rows }) {
|
|
3094
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
|
|
3095
|
+
const headerLine = headers.map((h, i) => h.padEnd(widths[i] ?? 0)).join(" ");
|
|
3096
|
+
console.log(styleText("bold", headerLine));
|
|
3097
|
+
console.log(widths.map((w) => "─".repeat(w)).join("──"));
|
|
3098
|
+
for (const row of rows) console.log(row.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" "));
|
|
3099
|
+
}
|
|
3100
|
+
const DetailsWithErrorSchema = z.object({ error: z.string() });
|
|
3101
|
+
const DetailsWithErrorsSchema = z.object({ errors: z.array(z.union([z.string(), z.object({ message: z.string() })])) });
|
|
3102
|
+
function printApiError(error) {
|
|
3103
|
+
printError(error.message);
|
|
3104
|
+
const withError = DetailsWithErrorSchema.safeParse(error.details);
|
|
3105
|
+
if (withError.success && withError.data.error !== error.message) console.error(` ${withError.data.error}`);
|
|
3106
|
+
const withErrors = DetailsWithErrorsSchema.safeParse(error.details);
|
|
3107
|
+
if (withErrors.success) for (const e of withErrors.data.errors) console.error(` ${typeof e === "string" ? e : e.message}`);
|
|
3108
|
+
}
|
|
3109
|
+
function outputSuccess({ argv, command, data, primaryId, startTime }) {
|
|
3110
|
+
if (argv.json) {
|
|
3111
|
+
const envelope = {
|
|
3112
|
+
ok: true,
|
|
3113
|
+
command,
|
|
3114
|
+
data
|
|
3115
|
+
};
|
|
3116
|
+
if (startTime !== void 0) envelope["meta"] = { duration_ms: Math.round(performance.now() - startTime) };
|
|
3117
|
+
console.log(JSON.stringify(envelope, null, 2));
|
|
3118
|
+
return true;
|
|
3119
|
+
}
|
|
3120
|
+
if (argv.quiet) {
|
|
3121
|
+
if (primaryId) console.log(primaryId);
|
|
3122
|
+
return true;
|
|
3123
|
+
}
|
|
3124
|
+
return false;
|
|
3125
|
+
}
|
|
3126
|
+
const DetailsWithCodeSchema = z.object({ code: z.string() });
|
|
3127
|
+
function extractErrorCode(details) {
|
|
3128
|
+
const parsed = DetailsWithCodeSchema.safeParse(details);
|
|
3129
|
+
return parsed.success ? parsed.data.code : null;
|
|
3130
|
+
}
|
|
3131
|
+
function resolveErrorCode({ error, exitCode, codeOverride }) {
|
|
3132
|
+
const status = "status" in error ? error.status ?? null : null;
|
|
3133
|
+
const details = "details" in error ? error.details : void 0;
|
|
3134
|
+
return codeOverride ?? extractErrorCode(details) ?? (status === null && exitCode !== void 0 ? errorCodeFromExitCode(exitCode) : errorCodeFromHttpStatus(status));
|
|
3135
|
+
}
|
|
3136
|
+
function outputStreamError({ argv, command, error, hint, exitCode, buildLogs, code: codeOverride }) {
|
|
3137
|
+
if (!argv.json && !argv.quiet) {
|
|
3138
|
+
outputError({
|
|
3139
|
+
argv,
|
|
3140
|
+
command,
|
|
3141
|
+
error,
|
|
3142
|
+
hint,
|
|
3143
|
+
exitCode,
|
|
3144
|
+
buildLogs,
|
|
3145
|
+
code: codeOverride
|
|
3146
|
+
});
|
|
3147
|
+
return;
|
|
3148
|
+
}
|
|
3149
|
+
const status = "status" in error ? error.status ?? null : null;
|
|
3150
|
+
process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
|
|
3151
|
+
const code = resolveErrorCode({
|
|
3152
|
+
error,
|
|
3153
|
+
exitCode,
|
|
3154
|
+
codeOverride
|
|
3155
|
+
});
|
|
3156
|
+
const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
|
|
3157
|
+
const resolvedHint = hint ?? ("hint" in error && typeof error.hint === "string" ? error.hint : void 0);
|
|
3158
|
+
printNdjson({
|
|
3159
|
+
type: "result",
|
|
3160
|
+
ok: false,
|
|
3161
|
+
error: {
|
|
3162
|
+
code,
|
|
3163
|
+
message: error.message,
|
|
3164
|
+
...resolvedHint ? { hint: resolvedHint } : {},
|
|
3165
|
+
...retryAfter !== null ? { retry_after_seconds: retryAfter } : {},
|
|
3166
|
+
...buildLogs ? { buildLogs: buildLogsToLines(buildLogs) } : {}
|
|
3167
|
+
}
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3170
|
+
function outputError({ argv, command, error, hint, exitCode, buildLogs, code: codeOverride }) {
|
|
3171
|
+
const status = "status" in error ? error.status ?? null : null;
|
|
3172
|
+
const details = "details" in error ? error.details : void 0;
|
|
3173
|
+
const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
|
|
3174
|
+
const resolvedHint = hint ?? ("hint" in error && typeof error.hint === "string" ? error.hint : void 0);
|
|
3175
|
+
process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
|
|
3176
|
+
const code = resolveErrorCode({
|
|
3177
|
+
error,
|
|
3178
|
+
exitCode,
|
|
3179
|
+
codeOverride
|
|
3180
|
+
});
|
|
3181
|
+
if (argv.json || argv.quiet) {
|
|
3182
|
+
console.log(JSON.stringify({
|
|
3183
|
+
ok: false,
|
|
3184
|
+
command,
|
|
3185
|
+
error: {
|
|
3186
|
+
code,
|
|
3187
|
+
message: error.message,
|
|
3188
|
+
...resolvedHint ? { hint: resolvedHint } : {},
|
|
3189
|
+
...retryAfter !== null ? { retry_after_seconds: retryAfter } : {},
|
|
3190
|
+
...buildLogs ? { buildLogs: buildLogsToLines(buildLogs) } : {}
|
|
3191
|
+
}
|
|
3192
|
+
}, null, 2));
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
printApiError({
|
|
3196
|
+
message: error.message,
|
|
3197
|
+
status: error.status,
|
|
3198
|
+
details
|
|
3199
|
+
});
|
|
3200
|
+
if (retryAfter !== null) console.error(` ${styleText("dim", `Retry after ${retryAfter}s`)}`);
|
|
3201
|
+
if (resolvedHint) console.error(` ${styleText("dim", resolvedHint)}`);
|
|
3202
|
+
if (buildLogs) console.error(`\n${styleText("dim", "Build logs:")}\n${buildLogs}`);
|
|
3203
|
+
}
|
|
3204
|
+
function outputValidationError({ argv, command, message, hint }) {
|
|
3205
|
+
outputError({
|
|
3206
|
+
argv,
|
|
3207
|
+
command,
|
|
3208
|
+
error: {
|
|
3209
|
+
message,
|
|
3210
|
+
status: 400
|
|
3211
|
+
},
|
|
3212
|
+
hint,
|
|
3213
|
+
exitCode: 2
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
function outputDryRun({ argv, command, plannedActions }) {
|
|
3217
|
+
if (argv.json) {
|
|
3218
|
+
console.log(JSON.stringify({
|
|
3219
|
+
ok: true,
|
|
3220
|
+
command,
|
|
3221
|
+
dry_run: true,
|
|
3222
|
+
planned_actions: plannedActions
|
|
3223
|
+
}, null, 2));
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
if (argv.quiet) return;
|
|
3227
|
+
printSuccess("Dry run — no changes made.");
|
|
3228
|
+
for (const action of plannedActions) {
|
|
3229
|
+
printLabel("Action", action.action);
|
|
3230
|
+
for (const [key, value] of Object.entries(action)) {
|
|
3231
|
+
if (key === "action") continue;
|
|
3232
|
+
printLabel(` ${key}`, String(value));
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
function printNdjson(event) {
|
|
3237
|
+
console.log(JSON.stringify(event));
|
|
3238
|
+
}
|
|
3239
|
+
function printStreamMarker(marker, message) {
|
|
3240
|
+
console.log(`[${marker}] ${message}`);
|
|
3241
|
+
}
|
|
3242
|
+
function emitActionRequired({ command, message, requiredInput }) {
|
|
3243
|
+
console.error(JSON.stringify({
|
|
3244
|
+
type: "ActionRequired",
|
|
3245
|
+
command,
|
|
3246
|
+
message,
|
|
3247
|
+
requiredInput
|
|
3248
|
+
}));
|
|
3249
|
+
}
|
|
3073
3250
|
|
|
3074
3251
|
//#endregion
|
|
3075
|
-
//#region
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3252
|
+
//#region src/commands/dev.ts
|
|
3253
|
+
const COMMAND$27 = "dev";
|
|
3254
|
+
const devCommand = {
|
|
3255
|
+
command: "dev [state]",
|
|
3256
|
+
describe: "Toggle local dev mode so commands target your local dev stack",
|
|
3257
|
+
builder: (yargs) => yargs.positional("state", {
|
|
3258
|
+
choices: [
|
|
3259
|
+
"on",
|
|
3260
|
+
"off",
|
|
3261
|
+
"status"
|
|
3262
|
+
],
|
|
3263
|
+
default: "status",
|
|
3264
|
+
describe: "Turn dev mode on/off, or show the current state"
|
|
3265
|
+
}).example("anything dev on", "Point every command at your local dev stack").example("anything dev off", "Switch back to production").example("anything dev", "Show whether dev mode is on"),
|
|
3266
|
+
handler: (argv) => {
|
|
3267
|
+
if (argv.state === "on") setDevMode(true);
|
|
3268
|
+
else if (argv.state === "off") setDevMode(false);
|
|
3269
|
+
const enabled = getDevMode();
|
|
3270
|
+
const apiUrl = resolveApiUrl({ apiUrl: argv.apiUrl });
|
|
3271
|
+
if (outputSuccess({
|
|
3272
|
+
argv,
|
|
3273
|
+
command: COMMAND$27,
|
|
3274
|
+
data: {
|
|
3275
|
+
devMode: enabled,
|
|
3276
|
+
apiUrl
|
|
3277
|
+
}
|
|
3278
|
+
})) return;
|
|
3279
|
+
printSuccess(`Dev mode ${enabled ? "ON" : "OFF"}`);
|
|
3280
|
+
printLabel("API URL", apiUrl);
|
|
3281
|
+
if (enabled) printLabel("Note", "Dev mode uses a separate login — run `anything auth login` to authenticate against local dev.");
|
|
3282
|
+
}
|
|
3080
3283
|
};
|
|
3081
|
-
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
3082
|
-
const data = new FormData();
|
|
3083
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
3084
|
-
if (value === void 0 || value === null) return;
|
|
3085
|
-
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
3086
|
-
else serializeFormDataPair(data, key, value);
|
|
3087
|
-
});
|
|
3088
|
-
return data;
|
|
3089
|
-
} };
|
|
3090
|
-
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
3091
3284
|
|
|
3092
3285
|
//#endregion
|
|
3093
|
-
//#region
|
|
3094
|
-
|
|
3095
|
-
$body_: "body",
|
|
3096
|
-
$headers_: "headers",
|
|
3097
|
-
$path_: "path",
|
|
3098
|
-
$query_: "query"
|
|
3099
|
-
});
|
|
3286
|
+
//#region package.json
|
|
3287
|
+
var version = "0.1.5";
|
|
3100
3288
|
|
|
3101
3289
|
//#endregion
|
|
3102
|
-
//#region
|
|
3103
|
-
const
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3290
|
+
//#region src/version.ts
|
|
3291
|
+
const CLI_VERSION = version;
|
|
3292
|
+
|
|
3293
|
+
//#endregion
|
|
3294
|
+
//#region src/types.ts
|
|
3295
|
+
function isNonInteractive(argv) {
|
|
3296
|
+
if (argv["non-interactive"]) return true;
|
|
3297
|
+
const env = process.env;
|
|
3298
|
+
return !!(env["CLAUDECODE"] || env["CODEX"] || env["CI"] || env["OPENCLAW"]);
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
//#endregion
|
|
3302
|
+
//#region src/update-check.ts
|
|
3303
|
+
const PACKAGE_NAME = "@anythingai/cli";
|
|
3304
|
+
const REGISTRY_BASE_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
3305
|
+
const REGISTRY_URL = `${REGISTRY_BASE_URL}/latest`;
|
|
3306
|
+
const INTERNAL_UPDATE_CHECK_ARG = "__update-check";
|
|
3307
|
+
const CHECK_INTERVAL_MS = 10800 * 1e3;
|
|
3308
|
+
const REFRESH_FETCH_TIMEOUT_MS = 1e4;
|
|
3309
|
+
const latestManifestSchema = z.object({ version: z.string() });
|
|
3310
|
+
function isNewerVersion(candidate, current) {
|
|
3311
|
+
const core = (v) => (v.split("-")[0] ?? "").split(".").map((part) => Number.parseInt(part, 10));
|
|
3312
|
+
const a = core(candidate);
|
|
3313
|
+
const b = core(current);
|
|
3314
|
+
if ([...a, ...b].some(Number.isNaN)) return false;
|
|
3315
|
+
for (let i = 0; i < 3; i++) {
|
|
3316
|
+
const left = a[i] ?? 0;
|
|
3317
|
+
const right = b[i] ?? 0;
|
|
3318
|
+
if (left !== right) return left > right;
|
|
3319
|
+
}
|
|
3320
|
+
return false;
|
|
3321
|
+
}
|
|
3322
|
+
async function fetchLatestVersion({ timeoutMs }) {
|
|
3323
|
+
try {
|
|
3324
|
+
const response = await fetch(REGISTRY_URL, {
|
|
3325
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
3326
|
+
headers: { accept: "application/json" }
|
|
3327
|
+
});
|
|
3328
|
+
if (!response.ok) return null;
|
|
3329
|
+
const parsed = latestManifestSchema.safeParse(await response.json());
|
|
3330
|
+
return parsed.success ? parsed.data.version : null;
|
|
3331
|
+
} catch {
|
|
3332
|
+
return null;
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
async function lookupVersion({ version, timeoutMs }) {
|
|
3336
|
+
try {
|
|
3337
|
+
const response = await fetch(`${REGISTRY_BASE_URL}/${encodeURIComponent(version)}`, {
|
|
3338
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
3339
|
+
headers: { accept: "application/json" }
|
|
3340
|
+
});
|
|
3341
|
+
if (response.status === 404) return { status: "not-found" };
|
|
3342
|
+
if (!response.ok) return { status: "unreachable" };
|
|
3343
|
+
return latestManifestSchema.safeParse(await response.json()).success ? { status: "exists" } : { status: "not-found" };
|
|
3344
|
+
} catch {
|
|
3345
|
+
return { status: "unreachable" };
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
function printUpdateNotice({ current, latest }) {
|
|
3349
|
+
console.error([
|
|
3350
|
+
"",
|
|
3351
|
+
styleText("yellow", `Update available for ${PACKAGE_NAME}: ${current} → ${latest}`),
|
|
3352
|
+
styleText("dim", "Run `anything update` to update."),
|
|
3353
|
+
""
|
|
3354
|
+
].join("\n"));
|
|
3355
|
+
}
|
|
3356
|
+
function spawnBackgroundRefresh() {
|
|
3357
|
+
const entry = process.argv[1];
|
|
3358
|
+
if (!entry) return;
|
|
3359
|
+
try {
|
|
3360
|
+
spawn(process.execPath, [entry, INTERNAL_UPDATE_CHECK_ARG], {
|
|
3361
|
+
detached: true,
|
|
3362
|
+
stdio: "ignore",
|
|
3363
|
+
windowsHide: true,
|
|
3364
|
+
env: backgroundRefreshEnv()
|
|
3365
|
+
}).unref();
|
|
3366
|
+
} catch {}
|
|
3367
|
+
}
|
|
3368
|
+
function backgroundRefreshEnv() {
|
|
3369
|
+
const allowed = [
|
|
3370
|
+
"PATH",
|
|
3371
|
+
"HOME",
|
|
3372
|
+
"XDG_CONFIG_HOME",
|
|
3373
|
+
"APPDATA",
|
|
3374
|
+
"LOCALAPPDATA",
|
|
3375
|
+
"SystemRoot"
|
|
3376
|
+
];
|
|
3377
|
+
const env = {};
|
|
3378
|
+
for (const key of allowed) {
|
|
3379
|
+
const value = process.env[key];
|
|
3380
|
+
if (value !== void 0) env[key] = value;
|
|
3381
|
+
}
|
|
3382
|
+
return env;
|
|
3383
|
+
}
|
|
3384
|
+
async function refreshUpdateCheckCache(now) {
|
|
3385
|
+
recordUpdateCheck({
|
|
3386
|
+
checkedAt: now,
|
|
3387
|
+
latestVersion: await fetchLatestVersion({ timeoutMs: REFRESH_FETCH_TIMEOUT_MS })
|
|
3388
|
+
});
|
|
3389
|
+
}
|
|
3390
|
+
function notifyIfUpdateAvailable(now) {
|
|
3391
|
+
const state = getUpdateCheckState();
|
|
3392
|
+
const latest = state.latestKnownVersion;
|
|
3393
|
+
if (latest && isNewerVersion(latest, CLI_VERSION) && state.notifiedVersion !== latest) {
|
|
3394
|
+
printUpdateNotice({
|
|
3395
|
+
current: CLI_VERSION,
|
|
3396
|
+
latest
|
|
3397
|
+
});
|
|
3398
|
+
recordUpdateNotified(latest);
|
|
3399
|
+
}
|
|
3400
|
+
if (!(state.checkedAt === null || now - state.checkedAt >= CHECK_INTERVAL_MS)) return;
|
|
3401
|
+
recordUpdateCheck({
|
|
3402
|
+
checkedAt: now,
|
|
3403
|
+
latestVersion: null
|
|
3404
|
+
});
|
|
3405
|
+
spawnBackgroundRefresh();
|
|
3406
|
+
}
|
|
3407
|
+
function maybeNotifyUpdate(argv, now) {
|
|
3408
|
+
if (argv.json || argv.quiet) return;
|
|
3409
|
+
if (isNonInteractive(argv)) return;
|
|
3410
|
+
if (!process.stderr.isTTY) return;
|
|
3411
|
+
notifyIfUpdateAvailable(now);
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
//#endregion
|
|
3415
|
+
//#region generated/core/bodySerializer.gen.ts
|
|
3416
|
+
const serializeFormDataPair = (data, key, value) => {
|
|
3417
|
+
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
3418
|
+
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
3419
|
+
else data.append(key, JSON.stringify(value));
|
|
3420
|
+
};
|
|
3421
|
+
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
3422
|
+
const data = new FormData();
|
|
3423
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
3424
|
+
if (value === void 0 || value === null) return;
|
|
3425
|
+
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
3426
|
+
else serializeFormDataPair(data, key, value);
|
|
3427
|
+
});
|
|
3428
|
+
return data;
|
|
3429
|
+
} };
|
|
3430
|
+
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
3431
|
+
|
|
3432
|
+
//#endregion
|
|
3433
|
+
//#region generated/core/params.gen.ts
|
|
3434
|
+
const extraPrefixes = Object.entries({
|
|
3435
|
+
$body_: "body",
|
|
3436
|
+
$headers_: "headers",
|
|
3437
|
+
$path_: "path",
|
|
3438
|
+
$query_: "query"
|
|
3439
|
+
});
|
|
3440
|
+
|
|
3441
|
+
//#endregion
|
|
3442
|
+
//#region generated/core/serverSentEvents.gen.ts
|
|
3443
|
+
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
3444
|
+
let lastEventId;
|
|
3445
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
3446
|
+
const createStream = async function* () {
|
|
3447
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
3448
|
+
let attempt = 0;
|
|
3449
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
3450
|
+
while (true) {
|
|
3451
|
+
if (signal.aborted) break;
|
|
3452
|
+
attempt++;
|
|
3453
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
3454
|
+
if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
|
|
3455
|
+
try {
|
|
3456
|
+
const requestInit = {
|
|
3457
|
+
redirect: "follow",
|
|
3458
|
+
...options,
|
|
3459
|
+
body: options.serializedBody,
|
|
3460
|
+
headers,
|
|
3461
|
+
signal
|
|
3462
|
+
};
|
|
3463
|
+
let request = new Request(url, requestInit);
|
|
3464
|
+
if (onRequest) request = await onRequest(url, requestInit);
|
|
3465
|
+
const response = await (options.fetch ?? globalThis.fetch)(request);
|
|
3126
3466
|
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
3127
3467
|
if (!response.body) throw new Error("No body in SSE response");
|
|
3128
3468
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
@@ -4853,184 +5193,6 @@ var AnythingApiClient = class {
|
|
|
4853
5193
|
}
|
|
4854
5194
|
};
|
|
4855
5195
|
|
|
4856
|
-
//#endregion
|
|
4857
|
-
//#region src/output.ts
|
|
4858
|
-
function printJson(data) {
|
|
4859
|
-
console.log(JSON.stringify(data, null, 2));
|
|
4860
|
-
}
|
|
4861
|
-
function buildLogsToLines(buildLogs) {
|
|
4862
|
-
const lines = buildLogs.split("\n");
|
|
4863
|
-
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
4864
|
-
return lines;
|
|
4865
|
-
}
|
|
4866
|
-
function printSuccess(message) {
|
|
4867
|
-
console.log(styleText("green", message));
|
|
4868
|
-
}
|
|
4869
|
-
function printError(message) {
|
|
4870
|
-
console.error(styleText("red", message));
|
|
4871
|
-
}
|
|
4872
|
-
function printLabel(label, value) {
|
|
4873
|
-
const displayValue = value ?? styleText("dim", "(none)");
|
|
4874
|
-
console.log(` ${styleText("bold", label)}: ${displayValue}`);
|
|
4875
|
-
}
|
|
4876
|
-
function printTable({ headers, rows }) {
|
|
4877
|
-
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
|
|
4878
|
-
const headerLine = headers.map((h, i) => h.padEnd(widths[i] ?? 0)).join(" ");
|
|
4879
|
-
console.log(styleText("bold", headerLine));
|
|
4880
|
-
console.log(widths.map((w) => "─".repeat(w)).join("──"));
|
|
4881
|
-
for (const row of rows) console.log(row.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" "));
|
|
4882
|
-
}
|
|
4883
|
-
const DetailsWithErrorSchema = z.object({ error: z.string() });
|
|
4884
|
-
const DetailsWithErrorsSchema = z.object({ errors: z.array(z.union([z.string(), z.object({ message: z.string() })])) });
|
|
4885
|
-
function printApiError(error) {
|
|
4886
|
-
printError(error.message);
|
|
4887
|
-
const withError = DetailsWithErrorSchema.safeParse(error.details);
|
|
4888
|
-
if (withError.success && withError.data.error !== error.message) console.error(` ${withError.data.error}`);
|
|
4889
|
-
const withErrors = DetailsWithErrorsSchema.safeParse(error.details);
|
|
4890
|
-
if (withErrors.success) for (const e of withErrors.data.errors) console.error(` ${typeof e === "string" ? e : e.message}`);
|
|
4891
|
-
}
|
|
4892
|
-
function outputSuccess({ argv, command, data, primaryId, startTime }) {
|
|
4893
|
-
if (argv.json) {
|
|
4894
|
-
const envelope = {
|
|
4895
|
-
ok: true,
|
|
4896
|
-
command,
|
|
4897
|
-
data
|
|
4898
|
-
};
|
|
4899
|
-
if (startTime !== void 0) envelope["meta"] = { duration_ms: Math.round(performance.now() - startTime) };
|
|
4900
|
-
console.log(JSON.stringify(envelope, null, 2));
|
|
4901
|
-
return true;
|
|
4902
|
-
}
|
|
4903
|
-
if (argv.quiet) {
|
|
4904
|
-
if (primaryId) console.log(primaryId);
|
|
4905
|
-
return true;
|
|
4906
|
-
}
|
|
4907
|
-
return false;
|
|
4908
|
-
}
|
|
4909
|
-
const DetailsWithCodeSchema = z.object({ code: z.string() });
|
|
4910
|
-
function extractErrorCode(details) {
|
|
4911
|
-
const parsed = DetailsWithCodeSchema.safeParse(details);
|
|
4912
|
-
return parsed.success ? parsed.data.code : null;
|
|
4913
|
-
}
|
|
4914
|
-
function resolveErrorCode({ error, exitCode, codeOverride }) {
|
|
4915
|
-
const status = "status" in error ? error.status ?? null : null;
|
|
4916
|
-
const details = "details" in error ? error.details : void 0;
|
|
4917
|
-
return codeOverride ?? extractErrorCode(details) ?? (status === null && exitCode !== void 0 ? errorCodeFromExitCode(exitCode) : errorCodeFromHttpStatus(status));
|
|
4918
|
-
}
|
|
4919
|
-
function outputStreamError({ argv, command, error, hint, exitCode, buildLogs, code: codeOverride }) {
|
|
4920
|
-
const status = "status" in error ? error.status ?? null : null;
|
|
4921
|
-
process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
|
|
4922
|
-
if (!argv.json && !argv.quiet) {
|
|
4923
|
-
outputError({
|
|
4924
|
-
argv,
|
|
4925
|
-
command,
|
|
4926
|
-
error,
|
|
4927
|
-
hint,
|
|
4928
|
-
exitCode,
|
|
4929
|
-
buildLogs,
|
|
4930
|
-
code: codeOverride
|
|
4931
|
-
});
|
|
4932
|
-
return;
|
|
4933
|
-
}
|
|
4934
|
-
const code = resolveErrorCode({
|
|
4935
|
-
error,
|
|
4936
|
-
exitCode,
|
|
4937
|
-
codeOverride
|
|
4938
|
-
});
|
|
4939
|
-
const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
|
|
4940
|
-
const resolvedHint = hint ?? ("hint" in error && typeof error.hint === "string" ? error.hint : void 0);
|
|
4941
|
-
printNdjson({
|
|
4942
|
-
type: "result",
|
|
4943
|
-
ok: false,
|
|
4944
|
-
error: {
|
|
4945
|
-
code,
|
|
4946
|
-
message: error.message,
|
|
4947
|
-
...resolvedHint ? { hint: resolvedHint } : {},
|
|
4948
|
-
...retryAfter !== null ? { retry_after_seconds: retryAfter } : {},
|
|
4949
|
-
...buildLogs ? { buildLogs: buildLogsToLines(buildLogs) } : {}
|
|
4950
|
-
}
|
|
4951
|
-
});
|
|
4952
|
-
}
|
|
4953
|
-
function outputError({ argv, command, error, hint, exitCode, buildLogs, code: codeOverride }) {
|
|
4954
|
-
const status = "status" in error ? error.status ?? null : null;
|
|
4955
|
-
const details = "details" in error ? error.details : void 0;
|
|
4956
|
-
const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
|
|
4957
|
-
const resolvedHint = hint ?? ("hint" in error && typeof error.hint === "string" ? error.hint : void 0);
|
|
4958
|
-
process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
|
|
4959
|
-
const code = resolveErrorCode({
|
|
4960
|
-
error,
|
|
4961
|
-
exitCode,
|
|
4962
|
-
codeOverride
|
|
4963
|
-
});
|
|
4964
|
-
if (argv.json || argv.quiet) {
|
|
4965
|
-
console.log(JSON.stringify({
|
|
4966
|
-
ok: false,
|
|
4967
|
-
command,
|
|
4968
|
-
error: {
|
|
4969
|
-
code,
|
|
4970
|
-
message: error.message,
|
|
4971
|
-
...resolvedHint ? { hint: resolvedHint } : {},
|
|
4972
|
-
...retryAfter !== null ? { retry_after_seconds: retryAfter } : {},
|
|
4973
|
-
...buildLogs ? { buildLogs: buildLogsToLines(buildLogs) } : {}
|
|
4974
|
-
}
|
|
4975
|
-
}, null, 2));
|
|
4976
|
-
return;
|
|
4977
|
-
}
|
|
4978
|
-
printApiError({
|
|
4979
|
-
message: error.message,
|
|
4980
|
-
status: error.status,
|
|
4981
|
-
details
|
|
4982
|
-
});
|
|
4983
|
-
if (retryAfter !== null) console.error(` ${styleText("dim", `Retry after ${retryAfter}s`)}`);
|
|
4984
|
-
if (resolvedHint) console.error(` ${styleText("dim", resolvedHint)}`);
|
|
4985
|
-
if (buildLogs) console.error(`\n${styleText("dim", "Build logs:")}\n${buildLogs}`);
|
|
4986
|
-
}
|
|
4987
|
-
function outputValidationError({ argv, command, message, hint }) {
|
|
4988
|
-
outputError({
|
|
4989
|
-
argv,
|
|
4990
|
-
command,
|
|
4991
|
-
error: {
|
|
4992
|
-
message,
|
|
4993
|
-
status: 400
|
|
4994
|
-
},
|
|
4995
|
-
hint,
|
|
4996
|
-
exitCode: 2
|
|
4997
|
-
});
|
|
4998
|
-
}
|
|
4999
|
-
function outputDryRun({ argv, command, plannedActions }) {
|
|
5000
|
-
if (argv.json) {
|
|
5001
|
-
console.log(JSON.stringify({
|
|
5002
|
-
ok: true,
|
|
5003
|
-
command,
|
|
5004
|
-
dry_run: true,
|
|
5005
|
-
planned_actions: plannedActions
|
|
5006
|
-
}, null, 2));
|
|
5007
|
-
return;
|
|
5008
|
-
}
|
|
5009
|
-
if (argv.quiet) return;
|
|
5010
|
-
printSuccess("Dry run — no changes made.");
|
|
5011
|
-
for (const action of plannedActions) {
|
|
5012
|
-
printLabel("Action", action.action);
|
|
5013
|
-
for (const [key, value] of Object.entries(action)) {
|
|
5014
|
-
if (key === "action") continue;
|
|
5015
|
-
printLabel(` ${key}`, String(value));
|
|
5016
|
-
}
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
function printNdjson(event) {
|
|
5020
|
-
console.log(JSON.stringify(event));
|
|
5021
|
-
}
|
|
5022
|
-
function printStreamMarker(marker, message) {
|
|
5023
|
-
console.log(`[${marker}] ${message}`);
|
|
5024
|
-
}
|
|
5025
|
-
function emitActionRequired({ command, message, requiredInput }) {
|
|
5026
|
-
console.error(JSON.stringify({
|
|
5027
|
-
type: "ActionRequired",
|
|
5028
|
-
command,
|
|
5029
|
-
message,
|
|
5030
|
-
requiredInput
|
|
5031
|
-
}));
|
|
5032
|
-
}
|
|
5033
|
-
|
|
5034
5196
|
//#endregion
|
|
5035
5197
|
//#region src/commands/assets.ts
|
|
5036
5198
|
const ALLOWED_EXTENSIONS = new Set([
|
|
@@ -5292,40 +5454,6 @@ const assetsCommand = {
|
|
|
5292
5454
|
handler: () => {}
|
|
5293
5455
|
};
|
|
5294
5456
|
|
|
5295
|
-
//#endregion
|
|
5296
|
-
//#region src/commands/dev.ts
|
|
5297
|
-
const COMMAND$27 = "dev";
|
|
5298
|
-
const devCommand = {
|
|
5299
|
-
command: "dev [state]",
|
|
5300
|
-
describe: "Toggle local dev mode so commands target your local dev stack",
|
|
5301
|
-
builder: (yargs) => yargs.positional("state", {
|
|
5302
|
-
choices: [
|
|
5303
|
-
"on",
|
|
5304
|
-
"off",
|
|
5305
|
-
"status"
|
|
5306
|
-
],
|
|
5307
|
-
default: "status",
|
|
5308
|
-
describe: "Turn dev mode on/off, or show the current state"
|
|
5309
|
-
}).example("anything dev on", "Point every command at your local dev stack").example("anything dev off", "Switch back to production").example("anything dev", "Show whether dev mode is on"),
|
|
5310
|
-
handler: (argv) => {
|
|
5311
|
-
if (argv.state === "on") setDevMode(true);
|
|
5312
|
-
else if (argv.state === "off") setDevMode(false);
|
|
5313
|
-
const enabled = getDevMode();
|
|
5314
|
-
const apiUrl = resolveApiUrl({ apiUrl: argv.apiUrl });
|
|
5315
|
-
if (outputSuccess({
|
|
5316
|
-
argv,
|
|
5317
|
-
command: COMMAND$27,
|
|
5318
|
-
data: {
|
|
5319
|
-
devMode: enabled,
|
|
5320
|
-
apiUrl
|
|
5321
|
-
}
|
|
5322
|
-
})) return;
|
|
5323
|
-
printSuccess(`Dev mode ${enabled ? "ON" : "OFF"}`);
|
|
5324
|
-
printLabel("API URL", apiUrl);
|
|
5325
|
-
if (enabled) printLabel("Note", "Dev mode uses a separate login — run `anything auth login` to authenticate against local dev.");
|
|
5326
|
-
}
|
|
5327
|
-
};
|
|
5328
|
-
|
|
5329
5457
|
//#endregion
|
|
5330
5458
|
//#region src/input.ts
|
|
5331
5459
|
async function readStdin() {
|
|
@@ -5372,14 +5500,6 @@ async function promptChoice({ message, choices, nonInteractive }) {
|
|
|
5372
5500
|
return choices[index] ?? null;
|
|
5373
5501
|
}
|
|
5374
5502
|
|
|
5375
|
-
//#endregion
|
|
5376
|
-
//#region src/types.ts
|
|
5377
|
-
function isNonInteractive(argv) {
|
|
5378
|
-
if (argv["non-interactive"]) return true;
|
|
5379
|
-
const env = process.env;
|
|
5380
|
-
return !!(env["CLAUDECODE"] || env["CODEX"] || env["CI"] || env["OPENCLAW"]);
|
|
5381
|
-
}
|
|
5382
|
-
|
|
5383
5503
|
//#endregion
|
|
5384
5504
|
//#region src/commands/auth.ts
|
|
5385
5505
|
const POLL_INTERVAL_MS$2 = 2e3;
|
|
@@ -6777,1428 +6897,251 @@ const domainAddCommand = {
|
|
|
6777
6897
|
}
|
|
6778
6898
|
if (argv["dry-run"]) {
|
|
6779
6899
|
outputDryRun({
|
|
6780
|
-
argv,
|
|
6781
|
-
command: COMMAND$19,
|
|
6782
|
-
plannedActions: [{
|
|
6783
|
-
action: "add_domain",
|
|
6784
|
-
domain: argv.domain,
|
|
6785
|
-
org: orgResult.orgId,
|
|
6786
|
-
...argv.project ? { project: argv.project } : {}
|
|
6787
|
-
}]
|
|
6788
|
-
});
|
|
6789
|
-
return;
|
|
6790
|
-
}
|
|
6791
|
-
const result = await new AnythingApiClient(config.value).addDomain({
|
|
6792
|
-
organizationId: orgResult.orgId,
|
|
6793
|
-
domain: argv.domain,
|
|
6794
|
-
projectGroupId: argv.project ?? null
|
|
6795
|
-
});
|
|
6796
|
-
if (result.isErr()) {
|
|
6797
|
-
outputError({
|
|
6798
|
-
argv,
|
|
6799
|
-
command: COMMAND$19,
|
|
6800
|
-
error: result.error
|
|
6801
|
-
});
|
|
6802
|
-
return;
|
|
6803
|
-
}
|
|
6804
|
-
if (outputSuccess({
|
|
6805
|
-
argv,
|
|
6806
|
-
command: COMMAND$19,
|
|
6807
|
-
data: toPublicDomain(result.value.domain),
|
|
6808
|
-
primaryId: result.value.domain.domain
|
|
6809
|
-
})) return;
|
|
6810
|
-
printSuccess(`Domain added: ${result.value.domain.domain}`);
|
|
6811
|
-
printLabel("ID", result.value.domain.id);
|
|
6812
|
-
printLabel("Verified", String(result.value.domain.vercelVerified));
|
|
6813
|
-
}
|
|
6814
|
-
};
|
|
6815
|
-
|
|
6816
|
-
//#endregion
|
|
6817
|
-
//#region src/commands/domain-remove.ts
|
|
6818
|
-
const COMMAND$18 = "domains remove";
|
|
6819
|
-
const domainRemoveCommand = {
|
|
6820
|
-
command: "remove <domainId>",
|
|
6821
|
-
describe: "Remove a custom domain",
|
|
6822
|
-
builder: (yargs) => yargs.positional("domainId", {
|
|
6823
|
-
type: "string",
|
|
6824
|
-
demandOption: true,
|
|
6825
|
-
describe: "The domain ID to remove"
|
|
6826
|
-
}).option("yes", {
|
|
6827
|
-
type: "boolean",
|
|
6828
|
-
default: false,
|
|
6829
|
-
describe: "Skip confirmation"
|
|
6830
|
-
}).example("anything domains remove dom_123 --yes", "Remove a domain"),
|
|
6831
|
-
handler: async (argv) => {
|
|
6832
|
-
const config = resolveConfig({
|
|
6833
|
-
dev: argv.dev,
|
|
6834
|
-
apiUrl: argv.apiUrl
|
|
6835
|
-
});
|
|
6836
|
-
if (config.isErr()) {
|
|
6837
|
-
outputError({
|
|
6838
|
-
argv,
|
|
6839
|
-
command: COMMAND$18,
|
|
6840
|
-
error: {
|
|
6841
|
-
message: config.error.message,
|
|
6842
|
-
status: null
|
|
6843
|
-
},
|
|
6844
|
-
exitCode: 4
|
|
6845
|
-
});
|
|
6846
|
-
return;
|
|
6847
|
-
}
|
|
6848
|
-
if (argv["dry-run"]) {
|
|
6849
|
-
outputDryRun({
|
|
6850
|
-
argv,
|
|
6851
|
-
command: COMMAND$18,
|
|
6852
|
-
plannedActions: [{
|
|
6853
|
-
action: "remove_domain",
|
|
6854
|
-
domainId: argv.domainId
|
|
6855
|
-
}]
|
|
6856
|
-
});
|
|
6857
|
-
return;
|
|
6858
|
-
}
|
|
6859
|
-
if (!argv.yes) {
|
|
6860
|
-
outputError({
|
|
6861
|
-
argv,
|
|
6862
|
-
command: COMMAND$18,
|
|
6863
|
-
error: {
|
|
6864
|
-
message: "Domain removal is destructive. Pass --yes to confirm.",
|
|
6865
|
-
status: null
|
|
6866
|
-
},
|
|
6867
|
-
exitCode: 2,
|
|
6868
|
-
code: "CONFIRMATION_REQUIRED"
|
|
6869
|
-
});
|
|
6870
|
-
return;
|
|
6871
|
-
}
|
|
6872
|
-
const result = await new AnythingApiClient(config.value).removeDomain({ domainId: argv.domainId });
|
|
6873
|
-
if (result.isErr()) {
|
|
6874
|
-
outputError({
|
|
6875
|
-
argv,
|
|
6876
|
-
command: COMMAND$18,
|
|
6877
|
-
error: result.error
|
|
6878
|
-
});
|
|
6879
|
-
return;
|
|
6880
|
-
}
|
|
6881
|
-
if (outputSuccess({
|
|
6882
|
-
argv,
|
|
6883
|
-
command: COMMAND$18,
|
|
6884
|
-
data: {
|
|
6885
|
-
removed: true,
|
|
6886
|
-
domainId: argv.domainId
|
|
6887
|
-
}
|
|
6888
|
-
})) return;
|
|
6889
|
-
printSuccess(`Domain ${argv.domainId} removed.`);
|
|
6890
|
-
}
|
|
6891
|
-
};
|
|
6892
|
-
|
|
6893
|
-
//#endregion
|
|
6894
|
-
//#region src/commands/domain-verify.ts
|
|
6895
|
-
const COMMAND$17 = "domains verify";
|
|
6896
|
-
const domainVerifyCommand = {
|
|
6897
|
-
command: "verify <domainId>",
|
|
6898
|
-
describe: "Check DNS configuration for a custom domain",
|
|
6899
|
-
builder: (yargs) => yargs.positional("domainId", {
|
|
6900
|
-
type: "string",
|
|
6901
|
-
demandOption: true,
|
|
6902
|
-
describe: "The domain ID to verify"
|
|
6903
|
-
}).example("anything domains verify dom_123", "Check DNS configuration status"),
|
|
6904
|
-
handler: async (argv) => {
|
|
6905
|
-
const config = resolveConfig({
|
|
6906
|
-
dev: argv.dev,
|
|
6907
|
-
apiUrl: argv.apiUrl
|
|
6908
|
-
});
|
|
6909
|
-
if (config.isErr()) {
|
|
6910
|
-
outputError({
|
|
6911
|
-
argv,
|
|
6912
|
-
command: COMMAND$17,
|
|
6913
|
-
error: {
|
|
6914
|
-
message: config.error.message,
|
|
6915
|
-
status: null
|
|
6916
|
-
},
|
|
6917
|
-
exitCode: 4
|
|
6918
|
-
});
|
|
6919
|
-
return;
|
|
6920
|
-
}
|
|
6921
|
-
const result = await new AnythingApiClient(config.value).verifyDomain({ domainId: argv.domainId });
|
|
6922
|
-
if (result.isErr()) {
|
|
6923
|
-
outputError({
|
|
6924
|
-
argv,
|
|
6925
|
-
command: COMMAND$17,
|
|
6926
|
-
error: result.error
|
|
6927
|
-
});
|
|
6928
|
-
return;
|
|
6929
|
-
}
|
|
6930
|
-
if (outputSuccess({
|
|
6931
|
-
argv,
|
|
6932
|
-
command: COMMAND$17,
|
|
6933
|
-
data: result.value,
|
|
6934
|
-
primaryId: String(result.value.verified)
|
|
6935
|
-
})) return;
|
|
6936
|
-
if (result.value.verified) printSuccess(`Domain ${result.value.domain} is verified.`);
|
|
6937
|
-
else {
|
|
6938
|
-
printLabel("Domain", result.value.domain);
|
|
6939
|
-
printLabel("Verified", "false");
|
|
6940
|
-
console.log("\n DNS not yet configured. Check your DNS settings and try again.");
|
|
6941
|
-
}
|
|
6942
|
-
}
|
|
6943
|
-
};
|
|
6944
|
-
|
|
6945
|
-
//#endregion
|
|
6946
|
-
//#region src/commands/domains.ts
|
|
6947
|
-
function formatStatus(domain) {
|
|
6948
|
-
const challenges = Array.isArray(domain.vercelVerification) ? domain.vercelVerification : [];
|
|
6949
|
-
if (!domain.vercelVerified && challenges.length > 0) return "Needs verification";
|
|
6950
|
-
if (domain.projectGroup) return "Connected";
|
|
6951
|
-
return "Not connected";
|
|
6952
|
-
}
|
|
6953
|
-
const domainsListCommand = {
|
|
6954
|
-
command: "list <organizationId>",
|
|
6955
|
-
describe: "List domains for an organization",
|
|
6956
|
-
builder: (yargs) => yargs.positional("organizationId", {
|
|
6957
|
-
type: "string",
|
|
6958
|
-
demandOption: true,
|
|
6959
|
-
describe: "The organization ID"
|
|
6960
|
-
}).example("anything domains list org_123", "List domains for one organization").example("anything domains list org_123 --json", "Return domains as JSON"),
|
|
6961
|
-
handler: async (argv) => {
|
|
6962
|
-
const command = "domains list";
|
|
6963
|
-
const config = resolveConfig({
|
|
6964
|
-
dev: argv.dev,
|
|
6965
|
-
apiUrl: argv.apiUrl
|
|
6966
|
-
});
|
|
6967
|
-
if (config.isErr()) {
|
|
6968
|
-
outputError({
|
|
6969
|
-
argv,
|
|
6970
|
-
command,
|
|
6971
|
-
error: {
|
|
6972
|
-
message: config.error.message,
|
|
6973
|
-
status: null
|
|
6974
|
-
},
|
|
6975
|
-
exitCode: 4
|
|
6976
|
-
});
|
|
6977
|
-
return;
|
|
6978
|
-
}
|
|
6979
|
-
const result = await new AnythingApiClient(config.value).listDomains({ organizationId: argv.organizationId });
|
|
6980
|
-
if (result.isErr()) {
|
|
6981
|
-
outputError({
|
|
6982
|
-
argv,
|
|
6983
|
-
command,
|
|
6984
|
-
error: result.error
|
|
6985
|
-
});
|
|
6986
|
-
return;
|
|
6987
|
-
}
|
|
6988
|
-
const jsonData = { domains: result.value.domains.map(toPublicDomain) };
|
|
6989
|
-
if (argv.json && outputSuccess({
|
|
6990
|
-
argv,
|
|
6991
|
-
command,
|
|
6992
|
-
data: jsonData
|
|
6993
|
-
})) return;
|
|
6994
|
-
if (argv.quiet) {
|
|
6995
|
-
for (const domain of result.value.domains) console.log(domain.domain);
|
|
6996
|
-
return;
|
|
6997
|
-
}
|
|
6998
|
-
if (result.value.domains.length === 0) {
|
|
6999
|
-
console.log("No domains found.");
|
|
7000
|
-
return;
|
|
7001
|
-
}
|
|
7002
|
-
printTable({
|
|
7003
|
-
headers: [
|
|
7004
|
-
"Domain",
|
|
7005
|
-
"Status",
|
|
7006
|
-
"Linked Project"
|
|
7007
|
-
],
|
|
7008
|
-
rows: result.value.domains.map((domain) => [
|
|
7009
|
-
domain.domain,
|
|
7010
|
-
formatStatus(domain),
|
|
7011
|
-
domain.projectGroup?.name ?? "-"
|
|
7012
|
-
])
|
|
7013
|
-
});
|
|
7014
|
-
}
|
|
7015
|
-
};
|
|
7016
|
-
const domainsCommand = {
|
|
7017
|
-
command: "domains",
|
|
7018
|
-
describe: "Manage custom domains",
|
|
7019
|
-
builder: (yargs) => yargs.command(domainsListCommand).command(domainAddCommand).command(domainRemoveCommand).command(domainVerifyCommand).demandCommand(1, "Specify a domains subcommand. Run `anything domains --help` for usage."),
|
|
7020
|
-
handler: () => {}
|
|
7021
|
-
};
|
|
7022
|
-
|
|
7023
|
-
//#endregion
|
|
7024
|
-
//#region src/commands/submit.ts
|
|
7025
|
-
const POLL_INTERVAL_MS$1 = 2e3;
|
|
7026
|
-
const POLL_TIMEOUT_MS = 6e4;
|
|
7027
|
-
const STORE_CHOICES = ["app-store", "play-store"];
|
|
7028
|
-
async function waitForSubmission({ client, projectGroupId, submission }) {
|
|
7029
|
-
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
7030
|
-
let current = submission;
|
|
7031
|
-
while (current.status === "PENDING" && Date.now() < deadline) {
|
|
7032
|
-
const latestResult = await client.getProjectSubmission({
|
|
7033
|
-
projectGroupId,
|
|
7034
|
-
submissionId: current.id
|
|
7035
|
-
});
|
|
7036
|
-
if (latestResult.isErr()) return latestResult.map((value) => value.submission);
|
|
7037
|
-
current = latestResult.value.submission;
|
|
7038
|
-
if (current.status !== "PENDING") return latestResult.map((value) => value.submission);
|
|
7039
|
-
await setTimeout$1(POLL_INTERVAL_MS$1);
|
|
7040
|
-
}
|
|
7041
|
-
return ok(current);
|
|
7042
|
-
}
|
|
7043
|
-
function printSubmissionResult({ argv, command, pendingMessage, submission }) {
|
|
7044
|
-
const { projectGroupId: projectId, ...submissionRest } = submission;
|
|
7045
|
-
const submissionOut = {
|
|
7046
|
-
projectId,
|
|
7047
|
-
...submissionRest
|
|
7048
|
-
};
|
|
7049
|
-
if (submission.status === "FAILED") {
|
|
7050
|
-
printError(submission.errorMessage ?? "Submission failed.");
|
|
7051
|
-
process.exitCode = 1;
|
|
7052
|
-
return;
|
|
7053
|
-
}
|
|
7054
|
-
if (submission.status === "CREATED") {
|
|
7055
|
-
if (outputSuccess({
|
|
7056
|
-
argv,
|
|
7057
|
-
command,
|
|
7058
|
-
data: {
|
|
7059
|
-
success: true,
|
|
7060
|
-
submission: submissionOut
|
|
7061
|
-
},
|
|
7062
|
-
primaryId: submission.id
|
|
7063
|
-
})) return;
|
|
7064
|
-
printSuccess("App Store submission is ready.");
|
|
7065
|
-
printLabel("Submission ID", submission.id);
|
|
7066
|
-
printLabel("Launch URL", submission.launchUrl);
|
|
7067
|
-
printLabel("Auth URL", submission.authUrl);
|
|
7068
|
-
printLabel("Expires At", submission.expiresAt);
|
|
7069
|
-
return;
|
|
7070
|
-
}
|
|
7071
|
-
if (outputSuccess({
|
|
7072
|
-
argv,
|
|
7073
|
-
command,
|
|
7074
|
-
data: {
|
|
7075
|
-
success: true,
|
|
7076
|
-
submission
|
|
7077
|
-
},
|
|
7078
|
-
primaryId: submission.id
|
|
7079
|
-
})) return;
|
|
7080
|
-
printSuccess(pendingMessage);
|
|
7081
|
-
printLabel("Submission ID", submission.id);
|
|
7082
|
-
printLabel("Status", submission.status);
|
|
7083
|
-
printLabel("Next step", "Expo is still preparing the launch flow. Run the command again in a moment.");
|
|
7084
|
-
}
|
|
7085
|
-
const submitStatusCommand = {
|
|
7086
|
-
command: "status <projectId> <submissionId>",
|
|
7087
|
-
describe: "Check the status of an App Store submission",
|
|
7088
|
-
builder: (yargs) => yargs.positional("projectId", {
|
|
7089
|
-
type: "string",
|
|
7090
|
-
demandOption: true,
|
|
7091
|
-
describe: "The project ID"
|
|
7092
|
-
}).positional("submissionId", {
|
|
7093
|
-
type: "string",
|
|
7094
|
-
demandOption: true,
|
|
7095
|
-
describe: "The submission ID"
|
|
7096
|
-
}).example("anything projects submit status <project-id> <submission-id>", "Check a submission later").example("anything projects submit status <project-id> <submission-id> --json", "Return the submission status in JSON"),
|
|
7097
|
-
handler: async (argv) => {
|
|
7098
|
-
const command = "projects submit status";
|
|
7099
|
-
const config = resolveConfig({
|
|
7100
|
-
dev: argv.dev,
|
|
7101
|
-
apiUrl: argv.apiUrl
|
|
7102
|
-
});
|
|
7103
|
-
if (config.isErr()) {
|
|
7104
|
-
outputError({
|
|
7105
|
-
argv,
|
|
7106
|
-
command,
|
|
7107
|
-
error: {
|
|
7108
|
-
message: config.error.message,
|
|
7109
|
-
status: null
|
|
7110
|
-
},
|
|
7111
|
-
exitCode: 4
|
|
7112
|
-
});
|
|
7113
|
-
return;
|
|
7114
|
-
}
|
|
7115
|
-
const result = await new AnythingApiClient(config.value).getProjectSubmission({
|
|
7116
|
-
projectGroupId: argv.projectId,
|
|
7117
|
-
submissionId: argv.submissionId
|
|
7118
|
-
});
|
|
7119
|
-
if (result.isErr()) {
|
|
7120
|
-
outputError({
|
|
7121
|
-
argv,
|
|
7122
|
-
command,
|
|
7123
|
-
error: result.error
|
|
7124
|
-
});
|
|
7125
|
-
return;
|
|
7126
|
-
}
|
|
7127
|
-
printSubmissionResult({
|
|
7128
|
-
argv,
|
|
7129
|
-
command,
|
|
7130
|
-
pendingMessage: "Submission is still preparing.",
|
|
7131
|
-
submission: result.value.submission
|
|
7132
|
-
});
|
|
7133
|
-
}
|
|
7134
|
-
};
|
|
7135
|
-
const submitCommand = {
|
|
7136
|
-
command: "submit <projectId>",
|
|
7137
|
-
describe: "Start an App Store submission for an app",
|
|
7138
|
-
builder: (yargs) => yargs.command(submitStatusCommand).positional("projectId", {
|
|
7139
|
-
type: "string",
|
|
7140
|
-
demandOption: true,
|
|
7141
|
-
describe: "The project ID"
|
|
7142
|
-
}).option("store", {
|
|
7143
|
-
type: "string",
|
|
7144
|
-
choices: STORE_CHOICES,
|
|
7145
|
-
describe: "Submission target store"
|
|
7146
|
-
}).example("anything projects submit <project-id> --store app-store", "Start an App Store submission").example("anything projects submit <project-id> --store play-store", "Start a Play Store submission").example("anything projects submit <project-id> --store app-store --json", "Return the submission session in JSON").example("anything projects submit status <project-id> <submission-id>", "Check a submission later"),
|
|
7147
|
-
handler: async (argv) => {
|
|
7148
|
-
const command = "projects submit";
|
|
7149
|
-
if (argv.store === void 0) {
|
|
7150
|
-
outputError({
|
|
7151
|
-
argv,
|
|
7152
|
-
command,
|
|
7153
|
-
error: {
|
|
7154
|
-
message: "Missing required argument: store",
|
|
7155
|
-
status: null
|
|
7156
|
-
},
|
|
7157
|
-
exitCode: 2
|
|
7158
|
-
});
|
|
7159
|
-
return;
|
|
7160
|
-
}
|
|
7161
|
-
const store = STORE_CHOICES.find((s) => s === argv.store);
|
|
7162
|
-
if (!store) {
|
|
7163
|
-
outputError({
|
|
7164
|
-
argv,
|
|
7165
|
-
command,
|
|
7166
|
-
error: {
|
|
7167
|
-
message: `Unsupported store: ${argv.store}`,
|
|
7168
|
-
status: null
|
|
7169
|
-
},
|
|
7170
|
-
exitCode: 2
|
|
7171
|
-
});
|
|
7172
|
-
return;
|
|
7173
|
-
}
|
|
7174
|
-
if (argv["dry-run"]) {
|
|
7175
|
-
outputDryRun({
|
|
7176
|
-
argv,
|
|
7177
|
-
command,
|
|
7178
|
-
plannedActions: [{
|
|
7179
|
-
action: "submit_project",
|
|
7180
|
-
projectGroupId: argv.projectId,
|
|
7181
|
-
store
|
|
7182
|
-
}]
|
|
7183
|
-
});
|
|
7184
|
-
return;
|
|
7185
|
-
}
|
|
7186
|
-
const config = resolveConfig({
|
|
7187
|
-
dev: argv.dev,
|
|
7188
|
-
apiUrl: argv.apiUrl
|
|
7189
|
-
});
|
|
7190
|
-
if (config.isErr()) {
|
|
7191
|
-
outputError({
|
|
7192
|
-
argv,
|
|
7193
|
-
command,
|
|
7194
|
-
error: {
|
|
7195
|
-
message: config.error.message,
|
|
7196
|
-
status: null
|
|
7197
|
-
},
|
|
7198
|
-
exitCode: 4
|
|
7199
|
-
});
|
|
7200
|
-
return;
|
|
7201
|
-
}
|
|
7202
|
-
const client = new AnythingApiClient(config.value);
|
|
7203
|
-
const startResult = await client.submitProject({
|
|
7204
|
-
projectGroupId: argv.projectId,
|
|
7205
|
-
store
|
|
7206
|
-
});
|
|
7207
|
-
if (startResult.isErr()) {
|
|
7208
|
-
outputError({
|
|
7209
|
-
argv,
|
|
7210
|
-
command,
|
|
7211
|
-
error: startResult.error
|
|
7212
|
-
});
|
|
7213
|
-
return;
|
|
7214
|
-
}
|
|
7215
|
-
const finalResult = await waitForSubmission({
|
|
7216
|
-
client,
|
|
7217
|
-
projectGroupId: argv.projectId,
|
|
7218
|
-
submission: startResult.value.submission
|
|
7219
|
-
});
|
|
7220
|
-
if (finalResult.isErr()) {
|
|
7221
|
-
outputError({
|
|
7222
|
-
argv,
|
|
7223
|
-
command,
|
|
7224
|
-
error: finalResult.error
|
|
7225
|
-
});
|
|
7226
|
-
return;
|
|
7227
|
-
}
|
|
7228
|
-
printSubmissionResult({
|
|
7229
|
-
argv,
|
|
7230
|
-
command,
|
|
7231
|
-
pendingMessage: "Submission started.",
|
|
7232
|
-
submission: finalResult.value
|
|
7233
|
-
});
|
|
7234
|
-
}
|
|
7235
|
-
};
|
|
7236
|
-
|
|
7237
|
-
//#endregion
|
|
7238
|
-
//#region src/commands/introspect.ts
|
|
7239
|
-
const commandTree = [
|
|
7240
|
-
{
|
|
7241
|
-
name: "auth login",
|
|
7242
|
-
flags: [{
|
|
7243
|
-
name: "--api-key",
|
|
7244
|
-
type: "string",
|
|
7245
|
-
required: false
|
|
7246
|
-
}, {
|
|
7247
|
-
name: "--dev",
|
|
7248
|
-
type: "boolean",
|
|
7249
|
-
required: false
|
|
7250
|
-
}],
|
|
7251
|
-
idempotent: true,
|
|
7252
|
-
destructive: false
|
|
7253
|
-
},
|
|
7254
|
-
{
|
|
7255
|
-
name: "auth logout",
|
|
7256
|
-
flags: [],
|
|
7257
|
-
idempotent: true,
|
|
7258
|
-
destructive: true
|
|
7259
|
-
},
|
|
7260
|
-
{
|
|
7261
|
-
name: "auth status",
|
|
7262
|
-
flags: [],
|
|
7263
|
-
idempotent: true,
|
|
7264
|
-
destructive: false
|
|
7265
|
-
},
|
|
7266
|
-
{
|
|
7267
|
-
name: "user",
|
|
7268
|
-
flags: [{
|
|
7269
|
-
name: "--brief",
|
|
7270
|
-
type: "boolean",
|
|
7271
|
-
required: false
|
|
7272
|
-
}],
|
|
7273
|
-
idempotent: true,
|
|
7274
|
-
destructive: false
|
|
7275
|
-
},
|
|
7276
|
-
{
|
|
7277
|
-
name: "orgs list",
|
|
7278
|
-
flags: [],
|
|
7279
|
-
idempotent: true,
|
|
7280
|
-
destructive: false
|
|
7281
|
-
},
|
|
7282
|
-
{
|
|
7283
|
-
name: "orgs get",
|
|
7284
|
-
flags: [{
|
|
7285
|
-
name: "<organizationId>",
|
|
7286
|
-
type: "string",
|
|
7287
|
-
required: true
|
|
7288
|
-
}],
|
|
7289
|
-
idempotent: true,
|
|
7290
|
-
destructive: false
|
|
7291
|
-
},
|
|
7292
|
-
{
|
|
7293
|
-
name: "orgs set",
|
|
7294
|
-
flags: [{
|
|
7295
|
-
name: "<org-id>",
|
|
7296
|
-
type: "string",
|
|
7297
|
-
required: true
|
|
7298
|
-
}],
|
|
7299
|
-
idempotent: true,
|
|
7300
|
-
destructive: false
|
|
7301
|
-
},
|
|
7302
|
-
{
|
|
7303
|
-
name: "orgs unset",
|
|
7304
|
-
flags: [],
|
|
7305
|
-
idempotent: true,
|
|
7306
|
-
destructive: false
|
|
7307
|
-
},
|
|
7308
|
-
{
|
|
7309
|
-
name: "orgs members",
|
|
7310
|
-
flags: [{
|
|
7311
|
-
name: "<organizationId>",
|
|
7312
|
-
type: "string",
|
|
7313
|
-
required: true
|
|
7314
|
-
}],
|
|
7315
|
-
idempotent: true,
|
|
7316
|
-
destructive: false
|
|
7317
|
-
},
|
|
7318
|
-
{
|
|
7319
|
-
name: "projects list",
|
|
7320
|
-
flags: [
|
|
7321
|
-
{
|
|
7322
|
-
name: "--org",
|
|
7323
|
-
type: "string",
|
|
7324
|
-
required: false
|
|
7325
|
-
},
|
|
7326
|
-
{
|
|
7327
|
-
name: "--search",
|
|
7328
|
-
type: "string",
|
|
7329
|
-
required: false
|
|
7330
|
-
},
|
|
7331
|
-
{
|
|
7332
|
-
name: "--limit",
|
|
7333
|
-
type: "number",
|
|
7334
|
-
required: false
|
|
7335
|
-
}
|
|
7336
|
-
],
|
|
7337
|
-
idempotent: true,
|
|
7338
|
-
destructive: false
|
|
7339
|
-
},
|
|
7340
|
-
{
|
|
7341
|
-
name: "projects create",
|
|
7342
|
-
flags: [
|
|
7343
|
-
{
|
|
7344
|
-
name: "--prompt",
|
|
7345
|
-
type: "string",
|
|
7346
|
-
required: true
|
|
7347
|
-
},
|
|
7348
|
-
{
|
|
7349
|
-
name: "--org",
|
|
7350
|
-
type: "string",
|
|
7351
|
-
required: false
|
|
7352
|
-
},
|
|
7353
|
-
{
|
|
7354
|
-
name: "--name",
|
|
7355
|
-
type: "string",
|
|
7356
|
-
required: false
|
|
7357
|
-
},
|
|
7358
|
-
{
|
|
7359
|
-
name: "--wait",
|
|
7360
|
-
type: "boolean",
|
|
7361
|
-
required: false
|
|
7362
|
-
},
|
|
7363
|
-
{
|
|
7364
|
-
name: "--no-wait",
|
|
7365
|
-
type: "boolean",
|
|
7366
|
-
required: false
|
|
7367
|
-
}
|
|
7368
|
-
],
|
|
7369
|
-
idempotent: false,
|
|
7370
|
-
destructive: false
|
|
7371
|
-
},
|
|
7372
|
-
{
|
|
7373
|
-
name: "projects get",
|
|
7374
|
-
flags: [{
|
|
7375
|
-
name: "<projectId>",
|
|
7376
|
-
type: "string",
|
|
7377
|
-
required: true
|
|
7378
|
-
}],
|
|
7379
|
-
idempotent: true,
|
|
7380
|
-
destructive: false
|
|
7381
|
-
},
|
|
7382
|
-
{
|
|
7383
|
-
name: "projects generate",
|
|
7384
|
-
flags: [
|
|
7385
|
-
{
|
|
7386
|
-
name: "<projectId>",
|
|
7387
|
-
type: "string",
|
|
7388
|
-
required: true
|
|
7389
|
-
},
|
|
7390
|
-
{
|
|
7391
|
-
name: "--prompt",
|
|
7392
|
-
type: "string",
|
|
7393
|
-
required: true
|
|
7394
|
-
},
|
|
7395
|
-
{
|
|
7396
|
-
name: "--thread",
|
|
7397
|
-
type: "string",
|
|
7398
|
-
required: false
|
|
7399
|
-
},
|
|
7400
|
-
{
|
|
7401
|
-
name: "--new-thread",
|
|
7402
|
-
type: "boolean",
|
|
7403
|
-
required: false
|
|
7404
|
-
},
|
|
7405
|
-
{
|
|
7406
|
-
name: "--wait",
|
|
7407
|
-
type: "boolean",
|
|
7408
|
-
required: false
|
|
7409
|
-
},
|
|
7410
|
-
{
|
|
7411
|
-
name: "--no-wait",
|
|
7412
|
-
type: "boolean",
|
|
7413
|
-
required: false
|
|
7414
|
-
}
|
|
7415
|
-
],
|
|
7416
|
-
idempotent: false,
|
|
7417
|
-
destructive: false
|
|
7418
|
-
},
|
|
7419
|
-
{
|
|
7420
|
-
name: "projects rename",
|
|
7421
|
-
flags: [{
|
|
7422
|
-
name: "<projectId>",
|
|
7423
|
-
type: "string",
|
|
7424
|
-
required: true
|
|
7425
|
-
}, {
|
|
7426
|
-
name: "--name",
|
|
7427
|
-
type: "string",
|
|
7428
|
-
required: true
|
|
7429
|
-
}],
|
|
7430
|
-
idempotent: true,
|
|
7431
|
-
destructive: false
|
|
7432
|
-
},
|
|
7433
|
-
{
|
|
7434
|
-
name: "projects duplicate",
|
|
7435
|
-
flags: [{
|
|
7436
|
-
name: "<projectId>",
|
|
7437
|
-
type: "string",
|
|
7438
|
-
required: true
|
|
7439
|
-
}, {
|
|
7440
|
-
name: "--name",
|
|
7441
|
-
type: "string",
|
|
7442
|
-
required: false
|
|
7443
|
-
}],
|
|
7444
|
-
idempotent: false,
|
|
7445
|
-
destructive: false
|
|
7446
|
-
},
|
|
7447
|
-
{
|
|
7448
|
-
name: "projects publish",
|
|
7449
|
-
flags: [{
|
|
7450
|
-
name: "<projectId>",
|
|
7451
|
-
type: "string",
|
|
7452
|
-
required: true
|
|
7453
|
-
}, {
|
|
7454
|
-
name: "--slug",
|
|
7455
|
-
type: "string",
|
|
7456
|
-
required: false
|
|
7457
|
-
}],
|
|
7458
|
-
idempotent: true,
|
|
7459
|
-
destructive: false
|
|
7460
|
-
},
|
|
7461
|
-
{
|
|
7462
|
-
name: "projects submit",
|
|
7463
|
-
flags: [{
|
|
7464
|
-
name: "<projectId>",
|
|
7465
|
-
type: "string",
|
|
7466
|
-
required: true
|
|
7467
|
-
}, {
|
|
7468
|
-
name: "--store",
|
|
7469
|
-
type: "string",
|
|
7470
|
-
required: true,
|
|
7471
|
-
choices: [...STORE_CHOICES]
|
|
7472
|
-
}],
|
|
7473
|
-
idempotent: false,
|
|
7474
|
-
destructive: false
|
|
7475
|
-
},
|
|
7476
|
-
{
|
|
7477
|
-
name: "projects submit status",
|
|
7478
|
-
flags: [{
|
|
7479
|
-
name: "<projectId>",
|
|
7480
|
-
type: "string",
|
|
7481
|
-
required: true
|
|
7482
|
-
}, {
|
|
7483
|
-
name: "<submissionId>",
|
|
7484
|
-
type: "string",
|
|
7485
|
-
required: true
|
|
7486
|
-
}],
|
|
7487
|
-
idempotent: true,
|
|
7488
|
-
destructive: false
|
|
7489
|
-
},
|
|
7490
|
-
{
|
|
7491
|
-
name: "projects unpublish",
|
|
7492
|
-
flags: [{
|
|
7493
|
-
name: "<projectId>",
|
|
7494
|
-
type: "string",
|
|
7495
|
-
required: true
|
|
7496
|
-
}, {
|
|
7497
|
-
name: "--yes",
|
|
7498
|
-
type: "boolean",
|
|
7499
|
-
required: true
|
|
7500
|
-
}],
|
|
7501
|
-
idempotent: true,
|
|
7502
|
-
destructive: true
|
|
7503
|
-
},
|
|
7504
|
-
{
|
|
7505
|
-
name: "projects delete",
|
|
7506
|
-
flags: [{
|
|
7507
|
-
name: "<projectId>",
|
|
7508
|
-
type: "string",
|
|
7509
|
-
required: true
|
|
7510
|
-
}, {
|
|
7511
|
-
name: "--yes",
|
|
7512
|
-
type: "boolean",
|
|
7513
|
-
required: true
|
|
7514
|
-
}],
|
|
7515
|
-
idempotent: false,
|
|
7516
|
-
destructive: true
|
|
7517
|
-
},
|
|
7518
|
-
{
|
|
7519
|
-
name: "projects messages",
|
|
7520
|
-
flags: [
|
|
7521
|
-
{
|
|
7522
|
-
name: "<projectId>",
|
|
7523
|
-
type: "string",
|
|
7524
|
-
required: true
|
|
7525
|
-
},
|
|
7526
|
-
{
|
|
7527
|
-
name: "--thread",
|
|
7528
|
-
type: "string",
|
|
7529
|
-
required: false
|
|
7530
|
-
},
|
|
7531
|
-
{
|
|
7532
|
-
name: "--limit",
|
|
7533
|
-
type: "number",
|
|
7534
|
-
required: false
|
|
7535
|
-
}
|
|
7536
|
-
],
|
|
7537
|
-
idempotent: true,
|
|
7538
|
-
destructive: false
|
|
7539
|
-
},
|
|
7540
|
-
{
|
|
7541
|
-
name: "projects status",
|
|
7542
|
-
flags: [{
|
|
7543
|
-
name: "<projectId>",
|
|
7544
|
-
type: "string",
|
|
7545
|
-
required: true
|
|
7546
|
-
}],
|
|
7547
|
-
idempotent: true,
|
|
7548
|
-
destructive: false
|
|
7549
|
-
},
|
|
7550
|
-
{
|
|
7551
|
-
name: "projects logs",
|
|
7552
|
-
flags: [
|
|
7553
|
-
{
|
|
7554
|
-
name: "<projectId>",
|
|
7555
|
-
type: "string",
|
|
7556
|
-
required: true
|
|
7557
|
-
},
|
|
7558
|
-
{
|
|
7559
|
-
name: "--level",
|
|
7560
|
-
type: "string",
|
|
7561
|
-
required: false
|
|
7562
|
-
},
|
|
7563
|
-
{
|
|
7564
|
-
name: "--search",
|
|
7565
|
-
type: "string",
|
|
7566
|
-
required: false
|
|
7567
|
-
},
|
|
7568
|
-
{
|
|
7569
|
-
name: "--limit",
|
|
7570
|
-
type: "number",
|
|
7571
|
-
required: false
|
|
7572
|
-
},
|
|
7573
|
-
{
|
|
7574
|
-
name: "--since",
|
|
7575
|
-
type: "string",
|
|
7576
|
-
required: false
|
|
7577
|
-
},
|
|
7578
|
-
{
|
|
7579
|
-
name: "--follow",
|
|
7580
|
-
type: "boolean",
|
|
7581
|
-
required: false
|
|
7582
|
-
}
|
|
7583
|
-
],
|
|
7584
|
-
idempotent: true,
|
|
7585
|
-
destructive: false
|
|
7586
|
-
},
|
|
7587
|
-
{
|
|
7588
|
-
name: "projects files list",
|
|
7589
|
-
flags: [{
|
|
7590
|
-
name: "<projectId>",
|
|
7591
|
-
type: "string",
|
|
7592
|
-
required: true
|
|
7593
|
-
}],
|
|
7594
|
-
idempotent: true,
|
|
7595
|
-
destructive: false
|
|
7596
|
-
},
|
|
7597
|
-
{
|
|
7598
|
-
name: "projects files get",
|
|
7599
|
-
flags: [{
|
|
7600
|
-
name: "<projectId>",
|
|
7601
|
-
type: "string",
|
|
7602
|
-
required: true
|
|
7603
|
-
}, {
|
|
7604
|
-
name: "<path>",
|
|
7605
|
-
type: "string",
|
|
7606
|
-
required: true
|
|
7607
|
-
}],
|
|
7608
|
-
idempotent: true,
|
|
7609
|
-
destructive: false
|
|
7610
|
-
},
|
|
7611
|
-
{
|
|
7612
|
-
name: "projects set",
|
|
7613
|
-
flags: [{
|
|
7614
|
-
name: "<projectId>",
|
|
7615
|
-
type: "string",
|
|
7616
|
-
required: true
|
|
7617
|
-
}],
|
|
7618
|
-
idempotent: true,
|
|
7619
|
-
destructive: false
|
|
7620
|
-
},
|
|
7621
|
-
{
|
|
7622
|
-
name: "projects unset",
|
|
7623
|
-
flags: [],
|
|
7624
|
-
idempotent: true,
|
|
7625
|
-
destructive: false
|
|
7626
|
-
},
|
|
7627
|
-
{
|
|
7628
|
-
name: "projects auth providers",
|
|
7629
|
-
flags: [{
|
|
7630
|
-
name: "<projectId>",
|
|
7631
|
-
type: "string",
|
|
7632
|
-
required: true
|
|
7633
|
-
}],
|
|
7634
|
-
idempotent: true,
|
|
7635
|
-
destructive: false
|
|
7636
|
-
},
|
|
7637
|
-
{
|
|
7638
|
-
name: "projects settings auth get",
|
|
7639
|
-
flags: [{
|
|
7640
|
-
name: "[projectId]",
|
|
7641
|
-
type: "string",
|
|
7642
|
-
required: false
|
|
7643
|
-
}],
|
|
7644
|
-
idempotent: true,
|
|
7645
|
-
destructive: false
|
|
7646
|
-
},
|
|
7647
|
-
{
|
|
7648
|
-
name: "projects settings auth set",
|
|
7649
|
-
flags: [
|
|
7650
|
-
{
|
|
7651
|
-
name: "[projectId]",
|
|
7652
|
-
type: "string",
|
|
7653
|
-
required: false
|
|
7654
|
-
},
|
|
7655
|
-
{
|
|
7656
|
-
name: "--provider",
|
|
7657
|
-
type: "string",
|
|
7658
|
-
required: true,
|
|
7659
|
-
choices: [
|
|
7660
|
-
"google",
|
|
7661
|
-
"email",
|
|
7662
|
-
"facebook",
|
|
7663
|
-
"twitter"
|
|
7664
|
-
]
|
|
7665
|
-
},
|
|
7666
|
-
{
|
|
7667
|
-
name: "--enabled",
|
|
7668
|
-
type: "boolean",
|
|
7669
|
-
required: true
|
|
7670
|
-
},
|
|
7671
|
-
{
|
|
7672
|
-
name: "--secret",
|
|
7673
|
-
type: "string",
|
|
7674
|
-
required: false
|
|
7675
|
-
},
|
|
7676
|
-
{
|
|
7677
|
-
name: "--env",
|
|
7678
|
-
type: "string",
|
|
7679
|
-
required: false,
|
|
7680
|
-
choices: [
|
|
7681
|
-
"development",
|
|
7682
|
-
"preview",
|
|
7683
|
-
"production"
|
|
7684
|
-
]
|
|
7685
|
-
}
|
|
7686
|
-
],
|
|
7687
|
-
idempotent: false,
|
|
7688
|
-
destructive: false
|
|
7689
|
-
},
|
|
7690
|
-
{
|
|
7691
|
-
name: "projects secrets add",
|
|
7692
|
-
flags: [
|
|
7693
|
-
{
|
|
7694
|
-
name: "<projectId>",
|
|
7695
|
-
type: "string",
|
|
7696
|
-
required: true
|
|
7697
|
-
},
|
|
7698
|
-
{
|
|
7699
|
-
name: "--name",
|
|
7700
|
-
type: "string",
|
|
7701
|
-
required: true
|
|
7702
|
-
},
|
|
7703
|
-
{
|
|
7704
|
-
name: "--value",
|
|
7705
|
-
type: "string",
|
|
7706
|
-
required: false
|
|
7707
|
-
},
|
|
7708
|
-
{
|
|
7709
|
-
name: "--env",
|
|
7710
|
-
type: "string",
|
|
7711
|
-
required: false,
|
|
7712
|
-
choices: [
|
|
7713
|
-
"development",
|
|
7714
|
-
"preview",
|
|
7715
|
-
"production"
|
|
7716
|
-
]
|
|
7717
|
-
}
|
|
7718
|
-
],
|
|
7719
|
-
idempotent: false,
|
|
7720
|
-
destructive: false
|
|
7721
|
-
},
|
|
7722
|
-
{
|
|
7723
|
-
name: "projects secrets list",
|
|
7724
|
-
flags: [{
|
|
7725
|
-
name: "<projectId>",
|
|
7726
|
-
type: "string",
|
|
7727
|
-
required: true
|
|
7728
|
-
}],
|
|
7729
|
-
idempotent: true,
|
|
7730
|
-
destructive: false
|
|
7731
|
-
},
|
|
7732
|
-
{
|
|
7733
|
-
name: "projects secrets remove",
|
|
7734
|
-
flags: [{
|
|
7735
|
-
name: "<projectId>",
|
|
7736
|
-
type: "string",
|
|
7737
|
-
required: true
|
|
7738
|
-
}, {
|
|
7739
|
-
name: "<secretId>",
|
|
7740
|
-
type: "string",
|
|
7741
|
-
required: true
|
|
7742
|
-
}],
|
|
7743
|
-
idempotent: true,
|
|
7744
|
-
destructive: true
|
|
7745
|
-
},
|
|
7746
|
-
{
|
|
7747
|
-
name: "assets upload",
|
|
7748
|
-
flags: [
|
|
7749
|
-
{
|
|
7750
|
-
name: "<projectId>",
|
|
7751
|
-
type: "string",
|
|
7752
|
-
required: true
|
|
7753
|
-
},
|
|
7754
|
-
{
|
|
7755
|
-
name: "<file>",
|
|
7756
|
-
type: "string",
|
|
7757
|
-
required: true
|
|
7758
|
-
},
|
|
7759
|
-
{
|
|
7760
|
-
name: "--name",
|
|
7761
|
-
type: "string",
|
|
7762
|
-
required: false
|
|
7763
|
-
}
|
|
7764
|
-
],
|
|
7765
|
-
idempotent: false,
|
|
7766
|
-
destructive: false
|
|
7767
|
-
},
|
|
7768
|
-
{
|
|
7769
|
-
name: "assets list",
|
|
7770
|
-
flags: [{
|
|
7771
|
-
name: "<projectId>",
|
|
7772
|
-
type: "string",
|
|
7773
|
-
required: true
|
|
7774
|
-
}, {
|
|
7775
|
-
name: "--query",
|
|
7776
|
-
type: "string",
|
|
7777
|
-
required: false
|
|
7778
|
-
}],
|
|
7779
|
-
idempotent: true,
|
|
7780
|
-
destructive: false
|
|
7781
|
-
},
|
|
7782
|
-
{
|
|
7783
|
-
name: "assets remove",
|
|
7784
|
-
flags: [{
|
|
7785
|
-
name: "<projectId>",
|
|
7786
|
-
type: "string",
|
|
7787
|
-
required: true
|
|
7788
|
-
}, {
|
|
7789
|
-
name: "<assetId>",
|
|
7790
|
-
type: "string",
|
|
7791
|
-
required: true
|
|
7792
|
-
}],
|
|
7793
|
-
idempotent: true,
|
|
7794
|
-
destructive: true
|
|
7795
|
-
},
|
|
7796
|
-
{
|
|
7797
|
-
name: "databases list",
|
|
7798
|
-
flags: [{
|
|
7799
|
-
name: "--org",
|
|
7800
|
-
type: "string",
|
|
7801
|
-
required: true
|
|
7802
|
-
}, {
|
|
7803
|
-
name: "--limit",
|
|
7804
|
-
type: "number",
|
|
7805
|
-
required: false
|
|
7806
|
-
}],
|
|
7807
|
-
idempotent: true,
|
|
7808
|
-
destructive: false
|
|
7809
|
-
},
|
|
7810
|
-
{
|
|
7811
|
-
name: "databases get",
|
|
7812
|
-
flags: [{
|
|
7813
|
-
name: "<databaseId>",
|
|
7814
|
-
type: "string",
|
|
7815
|
-
required: true
|
|
7816
|
-
}],
|
|
7817
|
-
idempotent: true,
|
|
7818
|
-
destructive: false
|
|
7819
|
-
},
|
|
7820
|
-
{
|
|
7821
|
-
name: "databases create",
|
|
7822
|
-
flags: [
|
|
7823
|
-
{
|
|
7824
|
-
name: "--org",
|
|
7825
|
-
type: "string",
|
|
7826
|
-
required: false
|
|
7827
|
-
},
|
|
7828
|
-
{
|
|
7829
|
-
name: "--project",
|
|
7830
|
-
type: "string",
|
|
7831
|
-
required: false
|
|
7832
|
-
},
|
|
7833
|
-
{
|
|
7834
|
-
name: "--name",
|
|
7835
|
-
type: "string",
|
|
7836
|
-
required: true
|
|
7837
|
-
}
|
|
7838
|
-
],
|
|
7839
|
-
idempotent: false,
|
|
7840
|
-
destructive: false
|
|
7841
|
-
},
|
|
7842
|
-
{
|
|
7843
|
-
name: "databases query",
|
|
7844
|
-
flags: [{
|
|
7845
|
-
name: "<databaseId>",
|
|
7846
|
-
type: "string",
|
|
7847
|
-
required: true
|
|
7848
|
-
}, {
|
|
7849
|
-
name: "<sql>",
|
|
7850
|
-
type: "string",
|
|
7851
|
-
required: true
|
|
7852
|
-
}],
|
|
7853
|
-
idempotent: true,
|
|
7854
|
-
destructive: false
|
|
7855
|
-
},
|
|
7856
|
-
{
|
|
7857
|
-
name: "databases connect",
|
|
7858
|
-
flags: [{
|
|
7859
|
-
name: "<databaseId>",
|
|
7860
|
-
type: "string",
|
|
7861
|
-
required: true
|
|
7862
|
-
}, {
|
|
7863
|
-
name: "--mask",
|
|
7864
|
-
type: "boolean",
|
|
7865
|
-
required: false
|
|
7866
|
-
}],
|
|
7867
|
-
idempotent: true,
|
|
7868
|
-
destructive: false
|
|
7869
|
-
},
|
|
7870
|
-
{
|
|
7871
|
-
name: "databases reset",
|
|
7872
|
-
flags: [{
|
|
7873
|
-
name: "<databaseId>",
|
|
7874
|
-
type: "string",
|
|
7875
|
-
required: true
|
|
7876
|
-
}, {
|
|
7877
|
-
name: "--yes",
|
|
7878
|
-
type: "boolean",
|
|
7879
|
-
required: true
|
|
7880
|
-
}],
|
|
7881
|
-
idempotent: false,
|
|
7882
|
-
destructive: true
|
|
7883
|
-
},
|
|
7884
|
-
{
|
|
7885
|
-
name: "domains list",
|
|
7886
|
-
flags: [{
|
|
7887
|
-
name: "<organizationId>",
|
|
7888
|
-
type: "string",
|
|
7889
|
-
required: true
|
|
7890
|
-
}],
|
|
7891
|
-
idempotent: true,
|
|
7892
|
-
destructive: false
|
|
7893
|
-
},
|
|
7894
|
-
{
|
|
7895
|
-
name: "domains add",
|
|
7896
|
-
flags: [
|
|
7897
|
-
{
|
|
7898
|
-
name: "<domain>",
|
|
7899
|
-
type: "string",
|
|
7900
|
-
required: true
|
|
7901
|
-
},
|
|
7902
|
-
{
|
|
7903
|
-
name: "--org",
|
|
7904
|
-
type: "string",
|
|
7905
|
-
required: false
|
|
7906
|
-
},
|
|
7907
|
-
{
|
|
7908
|
-
name: "--project",
|
|
7909
|
-
type: "string",
|
|
7910
|
-
required: false
|
|
7911
|
-
}
|
|
7912
|
-
],
|
|
7913
|
-
idempotent: false,
|
|
7914
|
-
destructive: false
|
|
7915
|
-
},
|
|
7916
|
-
{
|
|
7917
|
-
name: "domains remove",
|
|
7918
|
-
flags: [{
|
|
7919
|
-
name: "<domainId>",
|
|
7920
|
-
type: "string",
|
|
7921
|
-
required: true
|
|
7922
|
-
}, {
|
|
7923
|
-
name: "--yes",
|
|
7924
|
-
type: "boolean",
|
|
7925
|
-
required: true
|
|
7926
|
-
}],
|
|
7927
|
-
idempotent: true,
|
|
7928
|
-
destructive: true
|
|
7929
|
-
},
|
|
7930
|
-
{
|
|
7931
|
-
name: "domains verify",
|
|
7932
|
-
flags: [{
|
|
7933
|
-
name: "<domainId>",
|
|
7934
|
-
type: "string",
|
|
7935
|
-
required: true
|
|
7936
|
-
}],
|
|
7937
|
-
idempotent: true,
|
|
7938
|
-
destructive: false
|
|
7939
|
-
},
|
|
7940
|
-
{
|
|
7941
|
-
name: "deployments list",
|
|
7942
|
-
flags: [{
|
|
7943
|
-
name: "<projectId>",
|
|
7944
|
-
type: "string",
|
|
7945
|
-
required: true
|
|
7946
|
-
}, {
|
|
7947
|
-
name: "--limit",
|
|
7948
|
-
type: "number",
|
|
7949
|
-
required: false
|
|
7950
|
-
}],
|
|
7951
|
-
idempotent: true,
|
|
7952
|
-
destructive: false
|
|
7953
|
-
},
|
|
7954
|
-
{
|
|
7955
|
-
name: "deployments get",
|
|
7956
|
-
flags: [{
|
|
7957
|
-
name: "<deploymentId>",
|
|
7958
|
-
type: "string",
|
|
7959
|
-
required: true
|
|
7960
|
-
}],
|
|
7961
|
-
idempotent: true,
|
|
7962
|
-
destructive: false
|
|
7963
|
-
},
|
|
7964
|
-
{
|
|
7965
|
-
name: "deployments logs",
|
|
7966
|
-
flags: [{
|
|
7967
|
-
name: "<deploymentId>",
|
|
7968
|
-
type: "string",
|
|
7969
|
-
required: true
|
|
7970
|
-
}],
|
|
7971
|
-
idempotent: true,
|
|
7972
|
-
destructive: false
|
|
7973
|
-
},
|
|
7974
|
-
{
|
|
7975
|
-
name: "deployments rollback",
|
|
7976
|
-
flags: [
|
|
7977
|
-
{
|
|
7978
|
-
name: "<projectId>",
|
|
7979
|
-
type: "string",
|
|
7980
|
-
required: true
|
|
7981
|
-
},
|
|
7982
|
-
{
|
|
7983
|
-
name: "[deploymentId]",
|
|
7984
|
-
type: "string",
|
|
7985
|
-
required: false
|
|
7986
|
-
},
|
|
7987
|
-
{
|
|
7988
|
-
name: "--yes",
|
|
7989
|
-
type: "boolean",
|
|
7990
|
-
required: true
|
|
7991
|
-
}
|
|
7992
|
-
],
|
|
7993
|
-
idempotent: false,
|
|
7994
|
-
destructive: true
|
|
7995
|
-
},
|
|
7996
|
-
{
|
|
7997
|
-
name: "members list",
|
|
7998
|
-
flags: [{
|
|
7999
|
-
name: "--org",
|
|
8000
|
-
type: "string",
|
|
8001
|
-
required: false
|
|
8002
|
-
}],
|
|
8003
|
-
idempotent: true,
|
|
8004
|
-
destructive: false
|
|
8005
|
-
},
|
|
8006
|
-
{
|
|
8007
|
-
name: "members invite",
|
|
8008
|
-
flags: [
|
|
8009
|
-
{
|
|
8010
|
-
name: "<email>",
|
|
8011
|
-
type: "string",
|
|
8012
|
-
required: true
|
|
8013
|
-
},
|
|
8014
|
-
{
|
|
8015
|
-
name: "--org",
|
|
8016
|
-
type: "string",
|
|
8017
|
-
required: false
|
|
8018
|
-
},
|
|
8019
|
-
{
|
|
8020
|
-
name: "--role",
|
|
8021
|
-
type: "string",
|
|
8022
|
-
required: false,
|
|
8023
|
-
choices: [
|
|
8024
|
-
"owner",
|
|
8025
|
-
"admin",
|
|
8026
|
-
"editor",
|
|
8027
|
-
"viewer"
|
|
8028
|
-
]
|
|
8029
|
-
}
|
|
8030
|
-
],
|
|
8031
|
-
idempotent: false,
|
|
8032
|
-
destructive: false
|
|
8033
|
-
},
|
|
8034
|
-
{
|
|
8035
|
-
name: "members remove",
|
|
8036
|
-
flags: [
|
|
8037
|
-
{
|
|
8038
|
-
name: "<email>",
|
|
8039
|
-
type: "string",
|
|
8040
|
-
required: true
|
|
8041
|
-
},
|
|
8042
|
-
{
|
|
8043
|
-
name: "--org",
|
|
8044
|
-
type: "string",
|
|
8045
|
-
required: false
|
|
8046
|
-
},
|
|
8047
|
-
{
|
|
8048
|
-
name: "--yes",
|
|
8049
|
-
type: "boolean",
|
|
8050
|
-
required: true
|
|
8051
|
-
}
|
|
8052
|
-
],
|
|
8053
|
-
idempotent: true,
|
|
8054
|
-
destructive: true
|
|
8055
|
-
},
|
|
8056
|
-
{
|
|
8057
|
-
name: "members role",
|
|
8058
|
-
flags: [
|
|
8059
|
-
{
|
|
8060
|
-
name: "<email>",
|
|
8061
|
-
type: "string",
|
|
8062
|
-
required: true
|
|
8063
|
-
},
|
|
8064
|
-
{
|
|
8065
|
-
name: "<role>",
|
|
8066
|
-
type: "string",
|
|
8067
|
-
required: true,
|
|
8068
|
-
choices: [
|
|
8069
|
-
"owner",
|
|
8070
|
-
"admin",
|
|
8071
|
-
"editor",
|
|
8072
|
-
"viewer"
|
|
8073
|
-
]
|
|
8074
|
-
},
|
|
8075
|
-
{
|
|
8076
|
-
name: "--org",
|
|
8077
|
-
type: "string",
|
|
8078
|
-
required: false
|
|
8079
|
-
}
|
|
8080
|
-
],
|
|
8081
|
-
idempotent: true,
|
|
8082
|
-
destructive: false
|
|
8083
|
-
},
|
|
8084
|
-
{
|
|
8085
|
-
name: "status",
|
|
8086
|
-
flags: [],
|
|
8087
|
-
idempotent: true,
|
|
8088
|
-
destructive: false
|
|
8089
|
-
},
|
|
8090
|
-
{
|
|
8091
|
-
name: "switch",
|
|
8092
|
-
flags: [],
|
|
8093
|
-
idempotent: true,
|
|
8094
|
-
destructive: false
|
|
8095
|
-
},
|
|
8096
|
-
{
|
|
8097
|
-
name: "ship",
|
|
8098
|
-
flags: [
|
|
8099
|
-
{
|
|
8100
|
-
name: "--prompt",
|
|
8101
|
-
type: "string",
|
|
8102
|
-
required: true
|
|
8103
|
-
},
|
|
8104
|
-
{
|
|
8105
|
-
name: "--project",
|
|
8106
|
-
type: "string",
|
|
8107
|
-
required: false
|
|
8108
|
-
},
|
|
8109
|
-
{
|
|
8110
|
-
name: "--org",
|
|
8111
|
-
type: "string",
|
|
8112
|
-
required: false
|
|
8113
|
-
},
|
|
8114
|
-
{
|
|
8115
|
-
name: "--skip-publish",
|
|
8116
|
-
type: "boolean",
|
|
8117
|
-
required: false
|
|
8118
|
-
}
|
|
8119
|
-
],
|
|
8120
|
-
idempotent: false,
|
|
8121
|
-
destructive: false
|
|
8122
|
-
},
|
|
8123
|
-
{
|
|
8124
|
-
name: "link",
|
|
8125
|
-
flags: [{
|
|
8126
|
-
name: "<projectId>",
|
|
8127
|
-
type: "string",
|
|
8128
|
-
required: false
|
|
8129
|
-
}],
|
|
8130
|
-
idempotent: true,
|
|
8131
|
-
destructive: false
|
|
8132
|
-
},
|
|
8133
|
-
{
|
|
8134
|
-
name: "unlink",
|
|
8135
|
-
flags: [],
|
|
8136
|
-
idempotent: true,
|
|
8137
|
-
destructive: false
|
|
8138
|
-
},
|
|
8139
|
-
{
|
|
8140
|
-
name: "pull",
|
|
8141
|
-
flags: [{
|
|
8142
|
-
name: "--files",
|
|
8143
|
-
type: "boolean",
|
|
8144
|
-
required: false
|
|
8145
|
-
}, {
|
|
8146
|
-
name: "--env",
|
|
8147
|
-
type: "boolean",
|
|
8148
|
-
required: false
|
|
8149
|
-
}],
|
|
8150
|
-
idempotent: true,
|
|
8151
|
-
destructive: false
|
|
8152
|
-
},
|
|
8153
|
-
{
|
|
8154
|
-
name: "watch",
|
|
8155
|
-
flags: [
|
|
8156
|
-
{
|
|
8157
|
-
name: "<projectId>",
|
|
8158
|
-
type: "string",
|
|
8159
|
-
required: true
|
|
8160
|
-
},
|
|
8161
|
-
{
|
|
8162
|
-
name: "--events",
|
|
8163
|
-
type: "string",
|
|
8164
|
-
required: false
|
|
8165
|
-
},
|
|
8166
|
-
{
|
|
8167
|
-
name: "--interval",
|
|
8168
|
-
type: "number",
|
|
8169
|
-
required: false
|
|
6900
|
+
argv,
|
|
6901
|
+
command: COMMAND$19,
|
|
6902
|
+
plannedActions: [{
|
|
6903
|
+
action: "add_domain",
|
|
6904
|
+
domain: argv.domain,
|
|
6905
|
+
org: orgResult.orgId,
|
|
6906
|
+
...argv.project ? { project: argv.project } : {}
|
|
6907
|
+
}]
|
|
6908
|
+
});
|
|
6909
|
+
return;
|
|
6910
|
+
}
|
|
6911
|
+
const result = await new AnythingApiClient(config.value).addDomain({
|
|
6912
|
+
organizationId: orgResult.orgId,
|
|
6913
|
+
domain: argv.domain,
|
|
6914
|
+
projectGroupId: argv.project ?? null
|
|
6915
|
+
});
|
|
6916
|
+
if (result.isErr()) {
|
|
6917
|
+
outputError({
|
|
6918
|
+
argv,
|
|
6919
|
+
command: COMMAND$19,
|
|
6920
|
+
error: result.error
|
|
6921
|
+
});
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6924
|
+
if (outputSuccess({
|
|
6925
|
+
argv,
|
|
6926
|
+
command: COMMAND$19,
|
|
6927
|
+
data: toPublicDomain(result.value.domain),
|
|
6928
|
+
primaryId: result.value.domain.domain
|
|
6929
|
+
})) return;
|
|
6930
|
+
printSuccess(`Domain added: ${result.value.domain.domain}`);
|
|
6931
|
+
printLabel("ID", result.value.domain.id);
|
|
6932
|
+
printLabel("Verified", String(result.value.domain.vercelVerified));
|
|
6933
|
+
}
|
|
6934
|
+
};
|
|
6935
|
+
|
|
6936
|
+
//#endregion
|
|
6937
|
+
//#region src/commands/domain-remove.ts
|
|
6938
|
+
const COMMAND$18 = "domains remove";
|
|
6939
|
+
const domainRemoveCommand = {
|
|
6940
|
+
command: "remove <domainId>",
|
|
6941
|
+
describe: "Remove a custom domain",
|
|
6942
|
+
builder: (yargs) => yargs.positional("domainId", {
|
|
6943
|
+
type: "string",
|
|
6944
|
+
demandOption: true,
|
|
6945
|
+
describe: "The domain ID to remove"
|
|
6946
|
+
}).option("yes", {
|
|
6947
|
+
type: "boolean",
|
|
6948
|
+
default: false,
|
|
6949
|
+
describe: "Skip confirmation"
|
|
6950
|
+
}).example("anything domains remove dom_123 --yes", "Remove a domain"),
|
|
6951
|
+
handler: async (argv) => {
|
|
6952
|
+
const config = resolveConfig({
|
|
6953
|
+
dev: argv.dev,
|
|
6954
|
+
apiUrl: argv.apiUrl
|
|
6955
|
+
});
|
|
6956
|
+
if (config.isErr()) {
|
|
6957
|
+
outputError({
|
|
6958
|
+
argv,
|
|
6959
|
+
command: COMMAND$18,
|
|
6960
|
+
error: {
|
|
6961
|
+
message: config.error.message,
|
|
6962
|
+
status: null
|
|
6963
|
+
},
|
|
6964
|
+
exitCode: 4
|
|
6965
|
+
});
|
|
6966
|
+
return;
|
|
6967
|
+
}
|
|
6968
|
+
if (argv["dry-run"]) {
|
|
6969
|
+
outputDryRun({
|
|
6970
|
+
argv,
|
|
6971
|
+
command: COMMAND$18,
|
|
6972
|
+
plannedActions: [{
|
|
6973
|
+
action: "remove_domain",
|
|
6974
|
+
domainId: argv.domainId
|
|
6975
|
+
}]
|
|
6976
|
+
});
|
|
6977
|
+
return;
|
|
6978
|
+
}
|
|
6979
|
+
if (!argv.yes) {
|
|
6980
|
+
outputError({
|
|
6981
|
+
argv,
|
|
6982
|
+
command: COMMAND$18,
|
|
6983
|
+
error: {
|
|
6984
|
+
message: "Domain removal is destructive. Pass --yes to confirm.",
|
|
6985
|
+
status: null
|
|
6986
|
+
},
|
|
6987
|
+
exitCode: 2,
|
|
6988
|
+
code: "CONFIRMATION_REQUIRED"
|
|
6989
|
+
});
|
|
6990
|
+
return;
|
|
6991
|
+
}
|
|
6992
|
+
const result = await new AnythingApiClient(config.value).removeDomain({ domainId: argv.domainId });
|
|
6993
|
+
if (result.isErr()) {
|
|
6994
|
+
outputError({
|
|
6995
|
+
argv,
|
|
6996
|
+
command: COMMAND$18,
|
|
6997
|
+
error: result.error
|
|
6998
|
+
});
|
|
6999
|
+
return;
|
|
7000
|
+
}
|
|
7001
|
+
if (outputSuccess({
|
|
7002
|
+
argv,
|
|
7003
|
+
command: COMMAND$18,
|
|
7004
|
+
data: {
|
|
7005
|
+
removed: true,
|
|
7006
|
+
domainId: argv.domainId
|
|
8170
7007
|
}
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
destructive: false
|
|
8174
|
-
},
|
|
8175
|
-
{
|
|
8176
|
-
name: "skill",
|
|
8177
|
-
flags: [{
|
|
8178
|
-
name: "--file",
|
|
8179
|
-
type: "string",
|
|
8180
|
-
required: false
|
|
8181
|
-
}, {
|
|
8182
|
-
name: "--path",
|
|
8183
|
-
type: "boolean",
|
|
8184
|
-
required: false
|
|
8185
|
-
}],
|
|
8186
|
-
idempotent: true,
|
|
8187
|
-
destructive: false
|
|
8188
|
-
},
|
|
8189
|
-
{
|
|
8190
|
-
name: "introspect",
|
|
8191
|
-
flags: [],
|
|
8192
|
-
idempotent: true,
|
|
8193
|
-
destructive: false
|
|
8194
|
-
},
|
|
8195
|
-
{
|
|
8196
|
-
name: "llm-context",
|
|
8197
|
-
flags: [],
|
|
8198
|
-
idempotent: true,
|
|
8199
|
-
destructive: false
|
|
7008
|
+
})) return;
|
|
7009
|
+
printSuccess(`Domain ${argv.domainId} removed.`);
|
|
8200
7010
|
}
|
|
8201
|
-
|
|
7011
|
+
};
|
|
7012
|
+
|
|
7013
|
+
//#endregion
|
|
7014
|
+
//#region src/commands/domain-verify.ts
|
|
7015
|
+
const COMMAND$17 = "domains verify";
|
|
7016
|
+
const domainVerifyCommand = {
|
|
7017
|
+
command: "verify <domainId>",
|
|
7018
|
+
describe: "Check DNS configuration for a custom domain",
|
|
7019
|
+
builder: (yargs) => yargs.positional("domainId", {
|
|
7020
|
+
type: "string",
|
|
7021
|
+
demandOption: true,
|
|
7022
|
+
describe: "The domain ID to verify"
|
|
7023
|
+
}).example("anything domains verify dom_123", "Check DNS configuration status"),
|
|
7024
|
+
handler: async (argv) => {
|
|
7025
|
+
const config = resolveConfig({
|
|
7026
|
+
dev: argv.dev,
|
|
7027
|
+
apiUrl: argv.apiUrl
|
|
7028
|
+
});
|
|
7029
|
+
if (config.isErr()) {
|
|
7030
|
+
outputError({
|
|
7031
|
+
argv,
|
|
7032
|
+
command: COMMAND$17,
|
|
7033
|
+
error: {
|
|
7034
|
+
message: config.error.message,
|
|
7035
|
+
status: null
|
|
7036
|
+
},
|
|
7037
|
+
exitCode: 4
|
|
7038
|
+
});
|
|
7039
|
+
return;
|
|
7040
|
+
}
|
|
7041
|
+
const result = await new AnythingApiClient(config.value).verifyDomain({ domainId: argv.domainId });
|
|
7042
|
+
if (result.isErr()) {
|
|
7043
|
+
outputError({
|
|
7044
|
+
argv,
|
|
7045
|
+
command: COMMAND$17,
|
|
7046
|
+
error: result.error
|
|
7047
|
+
});
|
|
7048
|
+
return;
|
|
7049
|
+
}
|
|
7050
|
+
if (outputSuccess({
|
|
7051
|
+
argv,
|
|
7052
|
+
command: COMMAND$17,
|
|
7053
|
+
data: result.value,
|
|
7054
|
+
primaryId: String(result.value.verified)
|
|
7055
|
+
})) return;
|
|
7056
|
+
if (result.value.verified) printSuccess(`Domain ${result.value.domain} is verified.`);
|
|
7057
|
+
else {
|
|
7058
|
+
printLabel("Domain", result.value.domain);
|
|
7059
|
+
printLabel("Verified", "false");
|
|
7060
|
+
console.log("\n DNS not yet configured. Check your DNS settings and try again.");
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
};
|
|
7064
|
+
|
|
7065
|
+
//#endregion
|
|
7066
|
+
//#region src/commands/domains.ts
|
|
7067
|
+
function formatStatus(domain) {
|
|
7068
|
+
const challenges = Array.isArray(domain.vercelVerification) ? domain.vercelVerification : [];
|
|
7069
|
+
if (!domain.vercelVerified && challenges.length > 0) return "Needs verification";
|
|
7070
|
+
if (domain.projectGroup) return "Connected";
|
|
7071
|
+
return "Not connected";
|
|
7072
|
+
}
|
|
7073
|
+
const domainsListCommand = {
|
|
7074
|
+
command: "list <organizationId>",
|
|
7075
|
+
describe: "List domains for an organization",
|
|
7076
|
+
builder: (yargs) => yargs.positional("organizationId", {
|
|
7077
|
+
type: "string",
|
|
7078
|
+
demandOption: true,
|
|
7079
|
+
describe: "The organization ID"
|
|
7080
|
+
}).example("anything domains list org_123", "List domains for one organization").example("anything domains list org_123 --json", "Return domains as JSON"),
|
|
7081
|
+
handler: async (argv) => {
|
|
7082
|
+
const command = "domains list";
|
|
7083
|
+
const config = resolveConfig({
|
|
7084
|
+
dev: argv.dev,
|
|
7085
|
+
apiUrl: argv.apiUrl
|
|
7086
|
+
});
|
|
7087
|
+
if (config.isErr()) {
|
|
7088
|
+
outputError({
|
|
7089
|
+
argv,
|
|
7090
|
+
command,
|
|
7091
|
+
error: {
|
|
7092
|
+
message: config.error.message,
|
|
7093
|
+
status: null
|
|
7094
|
+
},
|
|
7095
|
+
exitCode: 4
|
|
7096
|
+
});
|
|
7097
|
+
return;
|
|
7098
|
+
}
|
|
7099
|
+
const result = await new AnythingApiClient(config.value).listDomains({ organizationId: argv.organizationId });
|
|
7100
|
+
if (result.isErr()) {
|
|
7101
|
+
outputError({
|
|
7102
|
+
argv,
|
|
7103
|
+
command,
|
|
7104
|
+
error: result.error
|
|
7105
|
+
});
|
|
7106
|
+
return;
|
|
7107
|
+
}
|
|
7108
|
+
const jsonData = { domains: result.value.domains.map(toPublicDomain) };
|
|
7109
|
+
if (argv.json && outputSuccess({
|
|
7110
|
+
argv,
|
|
7111
|
+
command,
|
|
7112
|
+
data: jsonData
|
|
7113
|
+
})) return;
|
|
7114
|
+
if (argv.quiet) {
|
|
7115
|
+
for (const domain of result.value.domains) console.log(domain.domain);
|
|
7116
|
+
return;
|
|
7117
|
+
}
|
|
7118
|
+
if (result.value.domains.length === 0) {
|
|
7119
|
+
console.log("No domains found.");
|
|
7120
|
+
return;
|
|
7121
|
+
}
|
|
7122
|
+
printTable({
|
|
7123
|
+
headers: [
|
|
7124
|
+
"Domain",
|
|
7125
|
+
"Status",
|
|
7126
|
+
"Linked Project"
|
|
7127
|
+
],
|
|
7128
|
+
rows: result.value.domains.map((domain) => [
|
|
7129
|
+
domain.domain,
|
|
7130
|
+
formatStatus(domain),
|
|
7131
|
+
domain.projectGroup?.name ?? "-"
|
|
7132
|
+
])
|
|
7133
|
+
});
|
|
7134
|
+
}
|
|
7135
|
+
};
|
|
7136
|
+
const domainsCommand = {
|
|
7137
|
+
command: "domains",
|
|
7138
|
+
describe: "Manage custom domains",
|
|
7139
|
+
builder: (yargs) => yargs.command(domainsListCommand).command(domainAddCommand).command(domainRemoveCommand).command(domainVerifyCommand).demandCommand(1, "Specify a domains subcommand. Run `anything domains --help` for usage."),
|
|
7140
|
+
handler: () => {}
|
|
7141
|
+
};
|
|
7142
|
+
|
|
7143
|
+
//#endregion
|
|
7144
|
+
//#region src/commands/introspect.ts
|
|
8202
7145
|
const globalFlags = [
|
|
8203
7146
|
{
|
|
8204
7147
|
name: "--json",
|
|
@@ -8236,7 +7179,7 @@ const introspectCommand = {
|
|
|
8236
7179
|
describe: "Output the full command tree as JSON for agent discovery",
|
|
8237
7180
|
handler: (argv) => {
|
|
8238
7181
|
const data = {
|
|
8239
|
-
commands:
|
|
7182
|
+
commands: buildCommandTree(),
|
|
8240
7183
|
globalFlags
|
|
8241
7184
|
};
|
|
8242
7185
|
if (outputSuccess({
|
|
@@ -8400,10 +7343,6 @@ let UserDatabaseStatus = /* @__PURE__ */ function(UserDatabaseStatus) {
|
|
|
8400
7343
|
return UserDatabaseStatus;
|
|
8401
7344
|
}({});
|
|
8402
7345
|
|
|
8403
|
-
//#endregion
|
|
8404
|
-
//#region src/version.ts
|
|
8405
|
-
const CLI_VERSION = version;
|
|
8406
|
-
|
|
8407
7346
|
//#endregion
|
|
8408
7347
|
//#region src/commands/llm-context.ts
|
|
8409
7348
|
const REVISION_TERMINAL_STATUSES = [
|
|
@@ -9240,8 +8179,13 @@ const orgsCommand = {
|
|
|
9240
8179
|
//#endregion
|
|
9241
8180
|
//#region src/stream.ts
|
|
9242
8181
|
function resultErrorMessage(error) {
|
|
9243
|
-
|
|
9244
|
-
|
|
8182
|
+
return error?.message ?? "Operation failed";
|
|
8183
|
+
}
|
|
8184
|
+
function printStillBuilding({ projectId, error }) {
|
|
8185
|
+
printStreamMarker("progress", error.message);
|
|
8186
|
+
printLabel("Project ID", projectId);
|
|
8187
|
+
if (error.hint) printLabel("Resume", error.hint);
|
|
8188
|
+
process.exitCode = 1;
|
|
9245
8189
|
}
|
|
9246
8190
|
function createEmitter(argv) {
|
|
9247
8191
|
if (argv.quiet) return (_event) => {};
|
|
@@ -9253,20 +8197,28 @@ function createEmitter(argv) {
|
|
|
9253
8197
|
printStreamMarker(event.status === "complete" ? "done" : "progress", event.message ?? `${event.step}...`);
|
|
9254
8198
|
return;
|
|
9255
8199
|
}
|
|
9256
|
-
if (event.type === "result" && !event.ok)
|
|
8200
|
+
if (event.type === "result" && !event.ok) {
|
|
8201
|
+
printError(`[error] ${resultErrorMessage(event.error)}`);
|
|
8202
|
+
if (event.error?.hint) printError(`[hint] ${event.error.hint}`);
|
|
8203
|
+
}
|
|
9257
8204
|
};
|
|
9258
8205
|
}
|
|
9259
8206
|
|
|
9260
8207
|
//#endregion
|
|
9261
8208
|
//#region src/watch-generation.ts
|
|
9262
|
-
const
|
|
9263
|
-
const
|
|
8209
|
+
const STALL_MS = 240 * 1e3;
|
|
8210
|
+
const ABSOLUTE_MAX_MS = 1800 * 1e3;
|
|
8211
|
+
const POLL_INTERVAL_MS$1 = 3e3;
|
|
8212
|
+
const WS_FASTPATH_TIMEOUT_MS = 90 * 1e3;
|
|
9264
8213
|
const TERMINAL_SUCCESS_STATUSES = new Set(["COMPLETED", "VALID"]);
|
|
9265
8214
|
const TERMINAL_FAILURE_STATUSES = new Set([
|
|
9266
8215
|
"INVALID",
|
|
9267
8216
|
"INVALID_PROMPT",
|
|
9268
8217
|
"FAILED"
|
|
9269
8218
|
]);
|
|
8219
|
+
function stillBuildingHint(projectGroupId) {
|
|
8220
|
+
return `Check progress with \`anything projects status ${projectGroupId}\`, then publish with \`anything projects publish ${projectGroupId}\` once status is VALID.`;
|
|
8221
|
+
}
|
|
9270
8222
|
const REVISIONS_FINISHED_QUERY = `
|
|
9271
8223
|
subscription ProjectGroupRevisionsFinished($id: ID!) {
|
|
9272
8224
|
projectGroupRevisionsFinished(id: $id) {
|
|
@@ -9326,10 +8278,10 @@ function waitForRevisionFinished({ config, projectGroupId }) {
|
|
|
9326
8278
|
ok: false,
|
|
9327
8279
|
error: {
|
|
9328
8280
|
code: "timeout",
|
|
9329
|
-
message: "
|
|
8281
|
+
message: "WebSocket fast-path timed out; falling back to polling"
|
|
9330
8282
|
}
|
|
9331
8283
|
});
|
|
9332
|
-
},
|
|
8284
|
+
}, WS_FASTPATH_TIMEOUT_MS);
|
|
9333
8285
|
let unsubscribe = null;
|
|
9334
8286
|
function finish(result) {
|
|
9335
8287
|
if (settled) return;
|
|
@@ -9373,6 +8325,9 @@ async function latestMessageSucceeded({ client, projectGroupId }) {
|
|
|
9373
8325
|
function sleep$2(ms) {
|
|
9374
8326
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9375
8327
|
}
|
|
8328
|
+
function progressMarker(value) {
|
|
8329
|
+
return `${value.status ?? ""}|${value.latestRevisionId ?? ""}|${value.updatedAt}`;
|
|
8330
|
+
}
|
|
9376
8331
|
async function pollUntilTerminal({ client, projectGroupId, emit, sleepFn = sleep$2 }) {
|
|
9377
8332
|
emit({
|
|
9378
8333
|
type: "progress",
|
|
@@ -9380,11 +8335,14 @@ async function pollUntilTerminal({ client, projectGroupId, emit, sleepFn = sleep
|
|
|
9380
8335
|
status: "running",
|
|
9381
8336
|
message: "Streaming unavailable; polling generation status..."
|
|
9382
8337
|
});
|
|
9383
|
-
const
|
|
9384
|
-
|
|
8338
|
+
const startedAt = Date.now();
|
|
8339
|
+
let lastProgressAt = startedAt;
|
|
8340
|
+
let lastMarker = null;
|
|
8341
|
+
while (Date.now() - startedAt <= ABSOLUTE_MAX_MS) {
|
|
9385
8342
|
const result = await client.getProjectStatus({ projectGroupId });
|
|
9386
8343
|
if (result.isErr()) {
|
|
9387
|
-
|
|
8344
|
+
if (Date.now() - lastProgressAt > STALL_MS) break;
|
|
8345
|
+
await sleepFn(POLL_INTERVAL_MS$1);
|
|
9388
8346
|
continue;
|
|
9389
8347
|
}
|
|
9390
8348
|
const { status } = result.value;
|
|
@@ -9395,30 +8353,46 @@ async function pollUntilTerminal({ client, projectGroupId, emit, sleepFn = sleep
|
|
|
9395
8353
|
status: "complete",
|
|
9396
8354
|
message: "Generation complete"
|
|
9397
8355
|
});
|
|
9398
|
-
return true;
|
|
8356
|
+
return { ok: true };
|
|
9399
8357
|
}
|
|
9400
8358
|
if (status !== null && TERMINAL_FAILURE_STATUSES.has(status)) {
|
|
8359
|
+
const error = {
|
|
8360
|
+
code: "generation_failed",
|
|
8361
|
+
message: `Generation failed with status: ${status}`
|
|
8362
|
+
};
|
|
9401
8363
|
emit({
|
|
9402
8364
|
type: "result",
|
|
9403
8365
|
ok: false,
|
|
9404
|
-
error
|
|
9405
|
-
code: "generation_failed",
|
|
9406
|
-
message: `Generation failed with status: ${status}`
|
|
9407
|
-
}
|
|
8366
|
+
error
|
|
9408
8367
|
});
|
|
9409
|
-
return
|
|
8368
|
+
return {
|
|
8369
|
+
ok: false,
|
|
8370
|
+
error
|
|
8371
|
+
};
|
|
9410
8372
|
}
|
|
9411
|
-
|
|
8373
|
+
const marker = progressMarker(result.value);
|
|
8374
|
+
if (marker !== lastMarker) {
|
|
8375
|
+
lastMarker = marker;
|
|
8376
|
+
lastProgressAt = Date.now();
|
|
8377
|
+
}
|
|
8378
|
+
if (Date.now() - lastProgressAt > STALL_MS) break;
|
|
8379
|
+
await sleepFn(POLL_INTERVAL_MS$1);
|
|
9412
8380
|
}
|
|
8381
|
+
const error = {
|
|
8382
|
+
code: "still_building",
|
|
8383
|
+
message: "Generation is still running on the server (the CLI stopped waiting).",
|
|
8384
|
+
projectId: projectGroupId,
|
|
8385
|
+
hint: stillBuildingHint(projectGroupId)
|
|
8386
|
+
};
|
|
9413
8387
|
emit({
|
|
9414
8388
|
type: "result",
|
|
9415
8389
|
ok: false,
|
|
9416
|
-
error
|
|
9417
|
-
code: "timeout",
|
|
9418
|
-
message: "Generation timed out waiting for completion"
|
|
9419
|
-
}
|
|
8390
|
+
error
|
|
9420
8391
|
});
|
|
9421
|
-
return
|
|
8392
|
+
return {
|
|
8393
|
+
ok: false,
|
|
8394
|
+
error
|
|
8395
|
+
};
|
|
9422
8396
|
}
|
|
9423
8397
|
async function watchGeneration({ config, client, projectGroupId, emit, waitForFinished = waitForRevisionFinished, sleepFn }) {
|
|
9424
8398
|
const finished = await waitForFinished({
|
|
@@ -9426,7 +8400,7 @@ async function watchGeneration({ config, client, projectGroupId, emit, waitForFi
|
|
|
9426
8400
|
projectGroupId
|
|
9427
8401
|
});
|
|
9428
8402
|
if (!finished.ok) {
|
|
9429
|
-
if (finished.error.code === "websocket_error") return pollUntilTerminal({
|
|
8403
|
+
if (finished.error.code === "websocket_error" || finished.error.code === "timeout") return pollUntilTerminal({
|
|
9430
8404
|
client,
|
|
9431
8405
|
projectGroupId,
|
|
9432
8406
|
emit,
|
|
@@ -9437,7 +8411,10 @@ async function watchGeneration({ config, client, projectGroupId, emit, waitForFi
|
|
|
9437
8411
|
ok: false,
|
|
9438
8412
|
error: finished.error
|
|
9439
8413
|
});
|
|
9440
|
-
return
|
|
8414
|
+
return {
|
|
8415
|
+
ok: false,
|
|
8416
|
+
error: finished.error
|
|
8417
|
+
};
|
|
9441
8418
|
}
|
|
9442
8419
|
const succeeded = await latestMessageSucceeded({
|
|
9443
8420
|
client,
|
|
@@ -9449,7 +8426,10 @@ async function watchGeneration({ config, client, projectGroupId, emit, waitForFi
|
|
|
9449
8426
|
status: "complete",
|
|
9450
8427
|
message: succeeded ? "Generation complete" : "Generation failed"
|
|
9451
8428
|
});
|
|
9452
|
-
return succeeded
|
|
8429
|
+
return succeeded ? { ok: true } : {
|
|
8430
|
+
ok: false,
|
|
8431
|
+
error: null
|
|
8432
|
+
};
|
|
9453
8433
|
}
|
|
9454
8434
|
|
|
9455
8435
|
//#endregion
|
|
@@ -9547,7 +8527,7 @@ const createCommand = {
|
|
|
9547
8527
|
name: argv.name ?? null
|
|
9548
8528
|
});
|
|
9549
8529
|
if (result.isErr()) {
|
|
9550
|
-
|
|
8530
|
+
outputStreamError({
|
|
9551
8531
|
argv,
|
|
9552
8532
|
command: COMMAND$16,
|
|
9553
8533
|
error: result.error
|
|
@@ -9562,10 +8542,14 @@ const createCommand = {
|
|
|
9562
8542
|
});
|
|
9563
8543
|
if (!argv.wait) {
|
|
9564
8544
|
if (argv.json) {
|
|
8545
|
+
const { projectGroupId: projectId, ...rest } = result.value;
|
|
9565
8546
|
printNdjson({
|
|
9566
8547
|
type: "result",
|
|
9567
8548
|
ok: true,
|
|
9568
|
-
data:
|
|
8549
|
+
data: {
|
|
8550
|
+
projectId,
|
|
8551
|
+
...rest
|
|
8552
|
+
}
|
|
9569
8553
|
});
|
|
9570
8554
|
return;
|
|
9571
8555
|
}
|
|
@@ -9575,7 +8559,7 @@ const createCommand = {
|
|
|
9575
8559
|
}
|
|
9576
8560
|
printStreamMarker("done", `project ${result.value.projectGroupId} created`);
|
|
9577
8561
|
printSuccess("App created! Generation enqueued.");
|
|
9578
|
-
printLabel("Project
|
|
8562
|
+
printLabel("Project ID", result.value.projectGroupId);
|
|
9579
8563
|
printLabel("Revision ID", result.value.revisionId);
|
|
9580
8564
|
return;
|
|
9581
8565
|
}
|
|
@@ -9585,14 +8569,14 @@ const createCommand = {
|
|
|
9585
8569
|
status: "running",
|
|
9586
8570
|
message: "Generation started..."
|
|
9587
8571
|
});
|
|
9588
|
-
const
|
|
8572
|
+
const gen = await watchGeneration({
|
|
9589
8573
|
config: config.value,
|
|
9590
8574
|
client,
|
|
9591
8575
|
projectGroupId: result.value.projectGroupId,
|
|
9592
8576
|
emit
|
|
9593
8577
|
});
|
|
9594
8578
|
if (argv.json) {
|
|
9595
|
-
if (
|
|
8579
|
+
if (!gen.ok) {
|
|
9596
8580
|
process.exitCode = 1;
|
|
9597
8581
|
return;
|
|
9598
8582
|
}
|
|
@@ -9609,10 +8593,17 @@ const createCommand = {
|
|
|
9609
8593
|
}
|
|
9610
8594
|
if (argv.quiet) {
|
|
9611
8595
|
console.log(result.value.projectGroupId);
|
|
9612
|
-
if (
|
|
8596
|
+
if (!gen.ok) process.exitCode = 1;
|
|
9613
8597
|
return;
|
|
9614
8598
|
}
|
|
9615
|
-
if (
|
|
8599
|
+
if (!gen.ok) {
|
|
8600
|
+
if (gen.error?.code === "still_building") {
|
|
8601
|
+
printStillBuilding({
|
|
8602
|
+
projectId: result.value.projectGroupId,
|
|
8603
|
+
error: gen.error
|
|
8604
|
+
});
|
|
8605
|
+
return;
|
|
8606
|
+
}
|
|
9616
8607
|
outputError({
|
|
9617
8608
|
argv,
|
|
9618
8609
|
command: COMMAND$16,
|
|
@@ -9621,7 +8612,7 @@ const createCommand = {
|
|
|
9621
8612
|
status: null
|
|
9622
8613
|
}
|
|
9623
8614
|
});
|
|
9624
|
-
printLabel("Project
|
|
8615
|
+
printLabel("Project ID", result.value.projectGroupId);
|
|
9625
8616
|
process.exitCode = 1;
|
|
9626
8617
|
return;
|
|
9627
8618
|
}
|
|
@@ -9892,7 +8883,7 @@ const publishCommand = {
|
|
|
9892
8883
|
emit
|
|
9893
8884
|
});
|
|
9894
8885
|
if (deployResult.isErr()) {
|
|
9895
|
-
|
|
8886
|
+
outputStreamError({
|
|
9896
8887
|
argv,
|
|
9897
8888
|
command: COMMAND$15,
|
|
9898
8889
|
error: deployResult.error
|
|
@@ -9904,7 +8895,7 @@ const publishCommand = {
|
|
|
9904
8895
|
statusCommand: `anything projects publish status ${argv.projectId} ${deploymentId}`
|
|
9905
8896
|
});
|
|
9906
8897
|
if (deployError) {
|
|
9907
|
-
|
|
8898
|
+
outputStreamError({
|
|
9908
8899
|
argv,
|
|
9909
8900
|
command: COMMAND$15,
|
|
9910
8901
|
error: {
|
|
@@ -10106,13 +9097,17 @@ const get$1 = {
|
|
|
10106
9097
|
});
|
|
10107
9098
|
return;
|
|
10108
9099
|
}
|
|
9100
|
+
const { path, content } = result.value.file;
|
|
10109
9101
|
if (outputSuccess({
|
|
10110
9102
|
argv,
|
|
10111
9103
|
command,
|
|
10112
|
-
data:
|
|
9104
|
+
data: {
|
|
9105
|
+
path,
|
|
9106
|
+
content
|
|
9107
|
+
}
|
|
10113
9108
|
})) return;
|
|
10114
|
-
process.stdout.write(
|
|
10115
|
-
if (!
|
|
9109
|
+
process.stdout.write(content);
|
|
9110
|
+
if (!content.endsWith("\n")) process.stdout.write("\n");
|
|
10116
9111
|
}
|
|
10117
9112
|
};
|
|
10118
9113
|
const filesCommand = {
|
|
@@ -10206,18 +9201,12 @@ const generateCommand = {
|
|
|
10206
9201
|
createNewThread: argv["new-thread"] ?? false
|
|
10207
9202
|
});
|
|
10208
9203
|
if (result.isErr()) {
|
|
10209
|
-
|
|
10210
|
-
type: "result",
|
|
10211
|
-
ok: false,
|
|
10212
|
-
error: { message: result.error.message }
|
|
10213
|
-
});
|
|
10214
|
-
else outputError({
|
|
9204
|
+
outputStreamError({
|
|
10215
9205
|
argv,
|
|
10216
9206
|
command: COMMAND$13,
|
|
10217
9207
|
error: result.error,
|
|
10218
9208
|
hint: "Verify the project and thread IDs are correct"
|
|
10219
9209
|
});
|
|
10220
|
-
process.exitCode = 1;
|
|
10221
9210
|
return;
|
|
10222
9211
|
}
|
|
10223
9212
|
if (!argv.wait) {
|
|
@@ -10245,13 +9234,18 @@ const generateCommand = {
|
|
|
10245
9234
|
status: "running",
|
|
10246
9235
|
message: "Generation in progress..."
|
|
10247
9236
|
});
|
|
10248
|
-
|
|
9237
|
+
const gen = await watchGeneration({
|
|
10249
9238
|
config: config.value,
|
|
10250
9239
|
client,
|
|
10251
9240
|
projectGroupId: argv.projectId,
|
|
10252
9241
|
emit
|
|
10253
|
-
})
|
|
10254
|
-
|
|
9242
|
+
});
|
|
9243
|
+
if (!gen.ok) {
|
|
9244
|
+
if (!argv.json && !argv.quiet && gen.error?.code === "still_building") printStillBuilding({
|
|
9245
|
+
projectId: argv.projectId,
|
|
9246
|
+
error: gen.error
|
|
9247
|
+
});
|
|
9248
|
+
else process.exitCode = 1;
|
|
10255
9249
|
return;
|
|
10256
9250
|
}
|
|
10257
9251
|
if (argv.json) {
|
|
@@ -10384,7 +9378,8 @@ const infoCommand = {
|
|
|
10384
9378
|
});
|
|
10385
9379
|
return;
|
|
10386
9380
|
}
|
|
10387
|
-
const
|
|
9381
|
+
const client = new AnythingApiClient(config.value);
|
|
9382
|
+
const [result, statusResult] = await Promise.all([client.getProject({ projectGroupId: argv.projectId }), client.getProjectStatus({ projectGroupId: argv.projectId })]);
|
|
10388
9383
|
if (result.isErr()) {
|
|
10389
9384
|
outputError({
|
|
10390
9385
|
argv,
|
|
@@ -10396,12 +9391,18 @@ const infoCommand = {
|
|
|
10396
9391
|
}
|
|
10397
9392
|
const info = result.value;
|
|
10398
9393
|
const latestPublishedUrl = info.latestPublishedUrl ?? (info.slug ? `https://${info.slug}.created.app` : null);
|
|
9394
|
+
const { status, deployment } = statusResult.isOk() ? statusResult.value : {
|
|
9395
|
+
status: null,
|
|
9396
|
+
deployment: null
|
|
9397
|
+
};
|
|
10399
9398
|
if (outputSuccess({
|
|
10400
9399
|
argv,
|
|
10401
9400
|
command: COMMAND$12,
|
|
10402
9401
|
data: {
|
|
10403
9402
|
...info,
|
|
10404
|
-
|
|
9403
|
+
status,
|
|
9404
|
+
latestPublishedUrl,
|
|
9405
|
+
deployment
|
|
10405
9406
|
},
|
|
10406
9407
|
primaryId: result.value.id
|
|
10407
9408
|
})) return;
|
|
@@ -10409,9 +9410,12 @@ const infoCommand = {
|
|
|
10409
9410
|
printLabel("Name", info.name);
|
|
10410
9411
|
printLabel("ID", info.id);
|
|
10411
9412
|
printLabel("Slug", info.slug);
|
|
9413
|
+
printLabel("Platform", info.platform);
|
|
10412
9414
|
printLabel("Filesystem", info.filesystemVersion);
|
|
9415
|
+
printLabel("Status", status);
|
|
10413
9416
|
printLabel("Dev Server", info.devServerUrl);
|
|
10414
9417
|
printLabel("Published URL", latestPublishedUrl);
|
|
9418
|
+
if (deployment) printLabel("Deployment", formatDeploymentSummary(deployment));
|
|
10415
9419
|
printLabel("Created", new Date(info.createdAt).toLocaleString());
|
|
10416
9420
|
printLabel("Updated", new Date(info.updatedAt).toLocaleString());
|
|
10417
9421
|
for (const url of info.publishedUrls) {
|
|
@@ -10913,7 +9917,7 @@ const projectStatusCommand = {
|
|
|
10913
9917
|
printLabel("Status", status.status ?? "(no revisions yet)");
|
|
10914
9918
|
printLabel("Latest Revision", status.latestRevisionId);
|
|
10915
9919
|
printLabel("Updated", new Date(status.updatedAt).toLocaleString());
|
|
10916
|
-
if (status.deployment) printLabel("Latest Deployment",
|
|
9920
|
+
if (status.deployment) printLabel("Latest Deployment", formatDeploymentSummary(status.deployment));
|
|
10917
9921
|
else printLabel("Latest Deployment", "(none)");
|
|
10918
9922
|
}
|
|
10919
9923
|
};
|
|
@@ -11462,37 +10466,259 @@ const set = {
|
|
|
11462
10466
|
outputError({
|
|
11463
10467
|
argv,
|
|
11464
10468
|
command,
|
|
11465
|
-
error: {
|
|
11466
|
-
message: "No project specified. Pass a project ID or run `anything projects set <project-id>`.",
|
|
11467
|
-
status: null
|
|
11468
|
-
},
|
|
11469
|
-
exitCode: 2
|
|
10469
|
+
error: {
|
|
10470
|
+
message: "No project specified. Pass a project ID or run `anything projects set <project-id>`.",
|
|
10471
|
+
status: null
|
|
10472
|
+
},
|
|
10473
|
+
exitCode: 2
|
|
10474
|
+
});
|
|
10475
|
+
return;
|
|
10476
|
+
}
|
|
10477
|
+
const secretEnvironment = resolveSecretEnvironment(argv.env);
|
|
10478
|
+
if (secretEnvironment === null) {
|
|
10479
|
+
outputError({
|
|
10480
|
+
argv,
|
|
10481
|
+
command,
|
|
10482
|
+
error: {
|
|
10483
|
+
message: `Invalid --env value "${argv.env}".`,
|
|
10484
|
+
status: null
|
|
10485
|
+
},
|
|
10486
|
+
exitCode: 2
|
|
10487
|
+
});
|
|
10488
|
+
return;
|
|
10489
|
+
}
|
|
10490
|
+
const secretsResult = parseSecrets({
|
|
10491
|
+
secretArgs: argv.secret ?? [],
|
|
10492
|
+
environment: secretEnvironment
|
|
10493
|
+
});
|
|
10494
|
+
if (!secretsResult.ok) {
|
|
10495
|
+
outputError({
|
|
10496
|
+
argv,
|
|
10497
|
+
command,
|
|
10498
|
+
error: {
|
|
10499
|
+
message: secretsResult.error,
|
|
10500
|
+
status: null
|
|
10501
|
+
},
|
|
10502
|
+
exitCode: 2
|
|
10503
|
+
});
|
|
10504
|
+
return;
|
|
10505
|
+
}
|
|
10506
|
+
if (argv["dry-run"]) {
|
|
10507
|
+
outputDryRun({
|
|
10508
|
+
argv,
|
|
10509
|
+
command,
|
|
10510
|
+
plannedActions: [{
|
|
10511
|
+
action: "update_auth_settings",
|
|
10512
|
+
projectGroupId,
|
|
10513
|
+
provider: argv.provider,
|
|
10514
|
+
enabled: argv.enabled,
|
|
10515
|
+
environment: secretEnvironment,
|
|
10516
|
+
secretKeys: secretsResult.value.map((secret) => secret.envKey)
|
|
10517
|
+
}]
|
|
10518
|
+
});
|
|
10519
|
+
return;
|
|
10520
|
+
}
|
|
10521
|
+
const config = resolveConfig({
|
|
10522
|
+
dev: argv.dev,
|
|
10523
|
+
apiUrl: argv.apiUrl
|
|
10524
|
+
});
|
|
10525
|
+
if (config.isErr()) {
|
|
10526
|
+
outputError({
|
|
10527
|
+
argv,
|
|
10528
|
+
command,
|
|
10529
|
+
error: {
|
|
10530
|
+
message: config.error.message,
|
|
10531
|
+
status: null
|
|
10532
|
+
},
|
|
10533
|
+
exitCode: 4
|
|
10534
|
+
});
|
|
10535
|
+
return;
|
|
10536
|
+
}
|
|
10537
|
+
const result = await new AnythingApiClient(config.value).updateProjectAuthSettings({
|
|
10538
|
+
projectGroupId,
|
|
10539
|
+
provider: argv.provider,
|
|
10540
|
+
enabled: argv.enabled,
|
|
10541
|
+
secrets: secretsResult.value,
|
|
10542
|
+
enableForAllModules: false
|
|
10543
|
+
});
|
|
10544
|
+
if (result.isErr()) {
|
|
10545
|
+
outputError({
|
|
10546
|
+
argv,
|
|
10547
|
+
command,
|
|
10548
|
+
error: result.error
|
|
10549
|
+
});
|
|
10550
|
+
return;
|
|
10551
|
+
}
|
|
10552
|
+
if (outputSuccess({
|
|
10553
|
+
argv,
|
|
10554
|
+
command,
|
|
10555
|
+
data: result.value
|
|
10556
|
+
})) return;
|
|
10557
|
+
printSuccess("Auth settings updated.");
|
|
10558
|
+
printAuthSettings(result.value);
|
|
10559
|
+
}
|
|
10560
|
+
};
|
|
10561
|
+
const authSettingsCommand = {
|
|
10562
|
+
command: "auth <command>",
|
|
10563
|
+
describe: "Manage auth-related project settings",
|
|
10564
|
+
builder: (yargs) => yargs.command(get).command(set).demandCommand(),
|
|
10565
|
+
handler: () => {}
|
|
10566
|
+
};
|
|
10567
|
+
|
|
10568
|
+
//#endregion
|
|
10569
|
+
//#region src/commands/settings.ts
|
|
10570
|
+
const settingsCommand = {
|
|
10571
|
+
command: "settings <command>",
|
|
10572
|
+
describe: "Inspect and update project settings",
|
|
10573
|
+
builder: (yargs) => yargs.command(authSettingsCommand).example("anything projects settings auth get <project-id>", "Inspect project auth settings").demandCommand(),
|
|
10574
|
+
handler: () => {}
|
|
10575
|
+
};
|
|
10576
|
+
|
|
10577
|
+
//#endregion
|
|
10578
|
+
//#region src/commands/submit.ts
|
|
10579
|
+
const POLL_INTERVAL_MS = 2e3;
|
|
10580
|
+
const POLL_TIMEOUT_MS = 6e4;
|
|
10581
|
+
const STORE_CHOICES = ["app-store", "play-store"];
|
|
10582
|
+
async function waitForSubmission({ client, projectGroupId, submission }) {
|
|
10583
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
10584
|
+
let current = submission;
|
|
10585
|
+
while (current.status === "PENDING" && Date.now() < deadline) {
|
|
10586
|
+
const latestResult = await client.getProjectSubmission({
|
|
10587
|
+
projectGroupId,
|
|
10588
|
+
submissionId: current.id
|
|
10589
|
+
});
|
|
10590
|
+
if (latestResult.isErr()) return latestResult.map((value) => value.submission);
|
|
10591
|
+
current = latestResult.value.submission;
|
|
10592
|
+
if (current.status !== "PENDING") return latestResult.map((value) => value.submission);
|
|
10593
|
+
await setTimeout$1(POLL_INTERVAL_MS);
|
|
10594
|
+
}
|
|
10595
|
+
return ok(current);
|
|
10596
|
+
}
|
|
10597
|
+
function printSubmissionResult({ argv, command, pendingMessage, submission }) {
|
|
10598
|
+
const { projectGroupId: projectId, ...submissionRest } = submission;
|
|
10599
|
+
const submissionOut = {
|
|
10600
|
+
projectId,
|
|
10601
|
+
...submissionRest
|
|
10602
|
+
};
|
|
10603
|
+
if (submission.status === "FAILED") {
|
|
10604
|
+
printError(submission.errorMessage ?? "Submission failed.");
|
|
10605
|
+
process.exitCode = 1;
|
|
10606
|
+
return;
|
|
10607
|
+
}
|
|
10608
|
+
if (submission.status === "CREATED") {
|
|
10609
|
+
if (outputSuccess({
|
|
10610
|
+
argv,
|
|
10611
|
+
command,
|
|
10612
|
+
data: {
|
|
10613
|
+
success: true,
|
|
10614
|
+
submission: submissionOut
|
|
10615
|
+
},
|
|
10616
|
+
primaryId: submission.id
|
|
10617
|
+
})) return;
|
|
10618
|
+
printSuccess("App Store submission is ready.");
|
|
10619
|
+
printLabel("Submission ID", submission.id);
|
|
10620
|
+
printLabel("Launch URL", submission.launchUrl);
|
|
10621
|
+
printLabel("Auth URL", submission.authUrl);
|
|
10622
|
+
printLabel("Expires At", submission.expiresAt);
|
|
10623
|
+
return;
|
|
10624
|
+
}
|
|
10625
|
+
if (outputSuccess({
|
|
10626
|
+
argv,
|
|
10627
|
+
command,
|
|
10628
|
+
data: {
|
|
10629
|
+
success: true,
|
|
10630
|
+
submission
|
|
10631
|
+
},
|
|
10632
|
+
primaryId: submission.id
|
|
10633
|
+
})) return;
|
|
10634
|
+
printSuccess(pendingMessage);
|
|
10635
|
+
printLabel("Submission ID", submission.id);
|
|
10636
|
+
printLabel("Status", submission.status);
|
|
10637
|
+
printLabel("Next step", "Expo is still preparing the launch flow. Run the command again in a moment.");
|
|
10638
|
+
}
|
|
10639
|
+
const submitStatusCommand = {
|
|
10640
|
+
command: "status <projectId> <submissionId>",
|
|
10641
|
+
describe: "Check the status of an App Store submission",
|
|
10642
|
+
builder: (yargs) => yargs.positional("projectId", {
|
|
10643
|
+
type: "string",
|
|
10644
|
+
demandOption: true,
|
|
10645
|
+
describe: "The project ID"
|
|
10646
|
+
}).positional("submissionId", {
|
|
10647
|
+
type: "string",
|
|
10648
|
+
demandOption: true,
|
|
10649
|
+
describe: "The submission ID"
|
|
10650
|
+
}).example("anything projects submit status <project-id> <submission-id>", "Check a submission later").example("anything projects submit status <project-id> <submission-id> --json", "Return the submission status in JSON"),
|
|
10651
|
+
handler: async (argv) => {
|
|
10652
|
+
const command = "projects submit status";
|
|
10653
|
+
const config = resolveConfig({
|
|
10654
|
+
dev: argv.dev,
|
|
10655
|
+
apiUrl: argv.apiUrl
|
|
10656
|
+
});
|
|
10657
|
+
if (config.isErr()) {
|
|
10658
|
+
outputError({
|
|
10659
|
+
argv,
|
|
10660
|
+
command,
|
|
10661
|
+
error: {
|
|
10662
|
+
message: config.error.message,
|
|
10663
|
+
status: null
|
|
10664
|
+
},
|
|
10665
|
+
exitCode: 4
|
|
10666
|
+
});
|
|
10667
|
+
return;
|
|
10668
|
+
}
|
|
10669
|
+
const result = await new AnythingApiClient(config.value).getProjectSubmission({
|
|
10670
|
+
projectGroupId: argv.projectId,
|
|
10671
|
+
submissionId: argv.submissionId
|
|
10672
|
+
});
|
|
10673
|
+
if (result.isErr()) {
|
|
10674
|
+
outputError({
|
|
10675
|
+
argv,
|
|
10676
|
+
command,
|
|
10677
|
+
error: result.error
|
|
11470
10678
|
});
|
|
11471
10679
|
return;
|
|
11472
10680
|
}
|
|
11473
|
-
|
|
11474
|
-
|
|
10681
|
+
printSubmissionResult({
|
|
10682
|
+
argv,
|
|
10683
|
+
command,
|
|
10684
|
+
pendingMessage: "Submission is still preparing.",
|
|
10685
|
+
submission: result.value.submission
|
|
10686
|
+
});
|
|
10687
|
+
}
|
|
10688
|
+
};
|
|
10689
|
+
const submitCommand = {
|
|
10690
|
+
command: "submit <projectId>",
|
|
10691
|
+
describe: "Start an App Store submission for an app",
|
|
10692
|
+
builder: (yargs) => yargs.command(submitStatusCommand).positional("projectId", {
|
|
10693
|
+
type: "string",
|
|
10694
|
+
demandOption: true,
|
|
10695
|
+
describe: "The project ID"
|
|
10696
|
+
}).option("store", {
|
|
10697
|
+
type: "string",
|
|
10698
|
+
choices: STORE_CHOICES,
|
|
10699
|
+
describe: "Submission target store"
|
|
10700
|
+
}).example("anything projects submit <project-id> --store app-store", "Start an App Store submission").example("anything projects submit <project-id> --store play-store", "Start a Play Store submission").example("anything projects submit <project-id> --store app-store --json", "Return the submission session in JSON").example("anything projects submit status <project-id> <submission-id>", "Check a submission later"),
|
|
10701
|
+
handler: async (argv) => {
|
|
10702
|
+
const command = "projects submit";
|
|
10703
|
+
if (argv.store === void 0) {
|
|
11475
10704
|
outputError({
|
|
11476
10705
|
argv,
|
|
11477
10706
|
command,
|
|
11478
10707
|
error: {
|
|
11479
|
-
message:
|
|
10708
|
+
message: "Missing required argument: store",
|
|
11480
10709
|
status: null
|
|
11481
10710
|
},
|
|
11482
10711
|
exitCode: 2
|
|
11483
10712
|
});
|
|
11484
10713
|
return;
|
|
11485
10714
|
}
|
|
11486
|
-
const
|
|
11487
|
-
|
|
11488
|
-
environment: secretEnvironment
|
|
11489
|
-
});
|
|
11490
|
-
if (!secretsResult.ok) {
|
|
10715
|
+
const store = STORE_CHOICES.find((s) => s === argv.store);
|
|
10716
|
+
if (!store) {
|
|
11491
10717
|
outputError({
|
|
11492
10718
|
argv,
|
|
11493
10719
|
command,
|
|
11494
10720
|
error: {
|
|
11495
|
-
message:
|
|
10721
|
+
message: `Unsupported store: ${argv.store}`,
|
|
11496
10722
|
status: null
|
|
11497
10723
|
},
|
|
11498
10724
|
exitCode: 2
|
|
@@ -11504,12 +10730,9 @@ const set = {
|
|
|
11504
10730
|
argv,
|
|
11505
10731
|
command,
|
|
11506
10732
|
plannedActions: [{
|
|
11507
|
-
action: "
|
|
11508
|
-
projectGroupId,
|
|
11509
|
-
|
|
11510
|
-
enabled: argv.enabled,
|
|
11511
|
-
environment: secretEnvironment,
|
|
11512
|
-
secretKeys: secretsResult.value.map((secret) => secret.envKey)
|
|
10733
|
+
action: "submit_project",
|
|
10734
|
+
projectGroupId: argv.projectId,
|
|
10735
|
+
store
|
|
11513
10736
|
}]
|
|
11514
10737
|
});
|
|
11515
10738
|
return;
|
|
@@ -11530,45 +10753,40 @@ const set = {
|
|
|
11530
10753
|
});
|
|
11531
10754
|
return;
|
|
11532
10755
|
}
|
|
11533
|
-
const
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
secrets: secretsResult.value,
|
|
11538
|
-
enableForAllModules: false
|
|
10756
|
+
const client = new AnythingApiClient(config.value);
|
|
10757
|
+
const startResult = await client.submitProject({
|
|
10758
|
+
projectGroupId: argv.projectId,
|
|
10759
|
+
store
|
|
11539
10760
|
});
|
|
11540
|
-
if (
|
|
10761
|
+
if (startResult.isErr()) {
|
|
11541
10762
|
outputError({
|
|
11542
10763
|
argv,
|
|
11543
10764
|
command,
|
|
11544
|
-
error:
|
|
10765
|
+
error: startResult.error
|
|
11545
10766
|
});
|
|
11546
10767
|
return;
|
|
11547
10768
|
}
|
|
11548
|
-
|
|
10769
|
+
const finalResult = await waitForSubmission({
|
|
10770
|
+
client,
|
|
10771
|
+
projectGroupId: argv.projectId,
|
|
10772
|
+
submission: startResult.value.submission
|
|
10773
|
+
});
|
|
10774
|
+
if (finalResult.isErr()) {
|
|
10775
|
+
outputError({
|
|
10776
|
+
argv,
|
|
10777
|
+
command,
|
|
10778
|
+
error: finalResult.error
|
|
10779
|
+
});
|
|
10780
|
+
return;
|
|
10781
|
+
}
|
|
10782
|
+
printSubmissionResult({
|
|
11549
10783
|
argv,
|
|
11550
10784
|
command,
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
printAuthSettings(result.value);
|
|
10785
|
+
pendingMessage: "Submission started.",
|
|
10786
|
+
submission: finalResult.value
|
|
10787
|
+
});
|
|
11555
10788
|
}
|
|
11556
10789
|
};
|
|
11557
|
-
const authSettingsCommand = {
|
|
11558
|
-
command: "auth <command>",
|
|
11559
|
-
describe: "Manage auth-related project settings",
|
|
11560
|
-
builder: (yargs) => yargs.command(get).command(set).demandCommand(),
|
|
11561
|
-
handler: () => {}
|
|
11562
|
-
};
|
|
11563
|
-
|
|
11564
|
-
//#endregion
|
|
11565
|
-
//#region src/commands/settings.ts
|
|
11566
|
-
const settingsCommand = {
|
|
11567
|
-
command: "settings <command>",
|
|
11568
|
-
describe: "Inspect and update project settings",
|
|
11569
|
-
builder: (yargs) => yargs.command(authSettingsCommand).example("anything projects settings auth get <project-id>", "Inspect project auth settings").demandCommand(),
|
|
11570
|
-
handler: () => {}
|
|
11571
|
-
};
|
|
11572
10790
|
|
|
11573
10791
|
//#endregion
|
|
11574
10792
|
//#region src/commands/unpublish.ts
|
|
@@ -12124,13 +11342,18 @@ const shipCommand = {
|
|
|
12124
11342
|
status: "running",
|
|
12125
11343
|
message: "Generation in progress..."
|
|
12126
11344
|
});
|
|
12127
|
-
|
|
11345
|
+
const gen = await watchGeneration({
|
|
12128
11346
|
config: config.value,
|
|
12129
11347
|
client,
|
|
12130
11348
|
projectGroupId,
|
|
12131
11349
|
emit
|
|
12132
|
-
})
|
|
11350
|
+
});
|
|
11351
|
+
if (!gen.ok) {
|
|
12133
11352
|
if (argv.json || argv.quiet) process.exitCode = 1;
|
|
11353
|
+
else if (gen.error?.code === "still_building") printStillBuilding({
|
|
11354
|
+
projectId: projectGroupId,
|
|
11355
|
+
error: gen.error
|
|
11356
|
+
});
|
|
12134
11357
|
else outputError({
|
|
12135
11358
|
argv,
|
|
12136
11359
|
command: COMMAND$4,
|
|
@@ -12497,119 +11720,6 @@ const switchCommand = {
|
|
|
12497
11720
|
}
|
|
12498
11721
|
};
|
|
12499
11722
|
|
|
12500
|
-
//#endregion
|
|
12501
|
-
//#region src/update-check.ts
|
|
12502
|
-
const PACKAGE_NAME = "@anythingai/cli";
|
|
12503
|
-
const REGISTRY_BASE_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
12504
|
-
const REGISTRY_URL = `${REGISTRY_BASE_URL}/latest`;
|
|
12505
|
-
const INTERNAL_UPDATE_CHECK_ARG = "__update-check";
|
|
12506
|
-
const CHECK_INTERVAL_MS = 10800 * 1e3;
|
|
12507
|
-
const REFRESH_FETCH_TIMEOUT_MS = 1e4;
|
|
12508
|
-
const latestManifestSchema = z.object({ version: z.string() });
|
|
12509
|
-
function isNewerVersion(candidate, current) {
|
|
12510
|
-
const core = (v) => (v.split("-")[0] ?? "").split(".").map((part) => Number.parseInt(part, 10));
|
|
12511
|
-
const a = core(candidate);
|
|
12512
|
-
const b = core(current);
|
|
12513
|
-
if ([...a, ...b].some(Number.isNaN)) return false;
|
|
12514
|
-
for (let i = 0; i < 3; i++) {
|
|
12515
|
-
const left = a[i] ?? 0;
|
|
12516
|
-
const right = b[i] ?? 0;
|
|
12517
|
-
if (left !== right) return left > right;
|
|
12518
|
-
}
|
|
12519
|
-
return false;
|
|
12520
|
-
}
|
|
12521
|
-
async function fetchLatestVersion({ timeoutMs }) {
|
|
12522
|
-
try {
|
|
12523
|
-
const response = await fetch(REGISTRY_URL, {
|
|
12524
|
-
signal: AbortSignal.timeout(timeoutMs),
|
|
12525
|
-
headers: { accept: "application/json" }
|
|
12526
|
-
});
|
|
12527
|
-
if (!response.ok) return null;
|
|
12528
|
-
const parsed = latestManifestSchema.safeParse(await response.json());
|
|
12529
|
-
return parsed.success ? parsed.data.version : null;
|
|
12530
|
-
} catch {
|
|
12531
|
-
return null;
|
|
12532
|
-
}
|
|
12533
|
-
}
|
|
12534
|
-
async function lookupVersion({ version, timeoutMs }) {
|
|
12535
|
-
try {
|
|
12536
|
-
const response = await fetch(`${REGISTRY_BASE_URL}/${encodeURIComponent(version)}`, {
|
|
12537
|
-
signal: AbortSignal.timeout(timeoutMs),
|
|
12538
|
-
headers: { accept: "application/json" }
|
|
12539
|
-
});
|
|
12540
|
-
if (response.status === 404) return { status: "not-found" };
|
|
12541
|
-
if (!response.ok) return { status: "unreachable" };
|
|
12542
|
-
return latestManifestSchema.safeParse(await response.json()).success ? { status: "exists" } : { status: "not-found" };
|
|
12543
|
-
} catch {
|
|
12544
|
-
return { status: "unreachable" };
|
|
12545
|
-
}
|
|
12546
|
-
}
|
|
12547
|
-
function printUpdateNotice({ current, latest }) {
|
|
12548
|
-
console.error([
|
|
12549
|
-
"",
|
|
12550
|
-
styleText("yellow", `Update available for ${PACKAGE_NAME}: ${current} → ${latest}`),
|
|
12551
|
-
styleText("dim", "Run `anything update` to update."),
|
|
12552
|
-
""
|
|
12553
|
-
].join("\n"));
|
|
12554
|
-
}
|
|
12555
|
-
function spawnBackgroundRefresh() {
|
|
12556
|
-
const entry = process.argv[1];
|
|
12557
|
-
if (!entry) return;
|
|
12558
|
-
try {
|
|
12559
|
-
spawn(process.execPath, [entry, INTERNAL_UPDATE_CHECK_ARG], {
|
|
12560
|
-
detached: true,
|
|
12561
|
-
stdio: "ignore",
|
|
12562
|
-
windowsHide: true,
|
|
12563
|
-
env: backgroundRefreshEnv()
|
|
12564
|
-
}).unref();
|
|
12565
|
-
} catch {}
|
|
12566
|
-
}
|
|
12567
|
-
function backgroundRefreshEnv() {
|
|
12568
|
-
const allowed = [
|
|
12569
|
-
"PATH",
|
|
12570
|
-
"HOME",
|
|
12571
|
-
"XDG_CONFIG_HOME",
|
|
12572
|
-
"APPDATA",
|
|
12573
|
-
"LOCALAPPDATA",
|
|
12574
|
-
"SystemRoot"
|
|
12575
|
-
];
|
|
12576
|
-
const env = {};
|
|
12577
|
-
for (const key of allowed) {
|
|
12578
|
-
const value = process.env[key];
|
|
12579
|
-
if (value !== void 0) env[key] = value;
|
|
12580
|
-
}
|
|
12581
|
-
return env;
|
|
12582
|
-
}
|
|
12583
|
-
async function refreshUpdateCheckCache(now) {
|
|
12584
|
-
recordUpdateCheck({
|
|
12585
|
-
checkedAt: now,
|
|
12586
|
-
latestVersion: await fetchLatestVersion({ timeoutMs: REFRESH_FETCH_TIMEOUT_MS })
|
|
12587
|
-
});
|
|
12588
|
-
}
|
|
12589
|
-
function notifyIfUpdateAvailable(now) {
|
|
12590
|
-
const state = getUpdateCheckState();
|
|
12591
|
-
const latest = state.latestKnownVersion;
|
|
12592
|
-
if (latest && isNewerVersion(latest, CLI_VERSION) && state.notifiedVersion !== latest) {
|
|
12593
|
-
printUpdateNotice({
|
|
12594
|
-
current: CLI_VERSION,
|
|
12595
|
-
latest
|
|
12596
|
-
});
|
|
12597
|
-
recordUpdateNotified(latest);
|
|
12598
|
-
}
|
|
12599
|
-
if (!(state.checkedAt === null || now - state.checkedAt >= CHECK_INTERVAL_MS)) return;
|
|
12600
|
-
recordUpdateCheck({
|
|
12601
|
-
checkedAt: now,
|
|
12602
|
-
latestVersion: null
|
|
12603
|
-
});
|
|
12604
|
-
spawnBackgroundRefresh();
|
|
12605
|
-
}
|
|
12606
|
-
function maybeNotifyUpdate(argv, now) {
|
|
12607
|
-
if (argv.json || argv.quiet) return;
|
|
12608
|
-
if (isNonInteractive(argv)) return;
|
|
12609
|
-
if (!process.stderr.isTTY) return;
|
|
12610
|
-
notifyIfUpdateAvailable(now);
|
|
12611
|
-
}
|
|
12612
|
-
|
|
12613
11723
|
//#endregion
|
|
12614
11724
|
//#region src/commands/update.ts
|
|
12615
11725
|
const COMMAND$1 = "update";
|
|
@@ -13149,17 +12259,192 @@ const watchCommand = {
|
|
|
13149
12259
|
};
|
|
13150
12260
|
|
|
13151
12261
|
//#endregion
|
|
13152
|
-
//#region src/
|
|
13153
|
-
|
|
12262
|
+
//#region src/command-tree.ts
|
|
12263
|
+
function getRootCommands() {
|
|
12264
|
+
return [
|
|
12265
|
+
assetsCommand,
|
|
12266
|
+
authCommand,
|
|
12267
|
+
databasesCommand,
|
|
12268
|
+
deploymentsCommand,
|
|
12269
|
+
domainsCommand,
|
|
12270
|
+
introspectCommand,
|
|
12271
|
+
linkCommand,
|
|
12272
|
+
unlinkCommand,
|
|
12273
|
+
llmContextCommand,
|
|
12274
|
+
membersCommand,
|
|
12275
|
+
orgsCommand,
|
|
12276
|
+
projectsCommand,
|
|
12277
|
+
pullCommand,
|
|
12278
|
+
shipCommand,
|
|
12279
|
+
skillCommand,
|
|
12280
|
+
statusCommand,
|
|
12281
|
+
switchCommand,
|
|
12282
|
+
updateCommand,
|
|
12283
|
+
userCommand,
|
|
12284
|
+
watchCommand
|
|
12285
|
+
];
|
|
12286
|
+
}
|
|
12287
|
+
function firstCommandString(command) {
|
|
12288
|
+
return Array.isArray(command) ? command[0] ?? "" : command;
|
|
12289
|
+
}
|
|
12290
|
+
function commandWord(command) {
|
|
12291
|
+
const word = firstCommandString(command).trim().split(/\s+/)[0];
|
|
12292
|
+
return word && !/^[<[]/.test(word) ? word : null;
|
|
12293
|
+
}
|
|
12294
|
+
function normalizeChoices(choices) {
|
|
12295
|
+
if (!choices) return void 0;
|
|
12296
|
+
return choices.map((choice) => String(choice));
|
|
12297
|
+
}
|
|
12298
|
+
function positionalsFromCommandString(command) {
|
|
12299
|
+
const tokens = firstCommandString(command).trim().split(/\s+/);
|
|
12300
|
+
const out = [];
|
|
12301
|
+
for (const token of tokens) {
|
|
12302
|
+
const match = /^([<[])([^>\]]+)([>\]])$/.exec(token);
|
|
12303
|
+
if (!match) continue;
|
|
12304
|
+
const [, open, key] = match;
|
|
12305
|
+
if (key === void 0) continue;
|
|
12306
|
+
out.push({
|
|
12307
|
+
displayName: token,
|
|
12308
|
+
key,
|
|
12309
|
+
required: open === "<"
|
|
12310
|
+
});
|
|
12311
|
+
}
|
|
12312
|
+
return out;
|
|
12313
|
+
}
|
|
12314
|
+
function inspectBuilder(mod) {
|
|
12315
|
+
const children = [];
|
|
12316
|
+
const positionals = /* @__PURE__ */ new Map();
|
|
12317
|
+
const options = [];
|
|
12318
|
+
for (const positional of positionalsFromCommandString(mod.command ?? "")) positionals.set(positional.key, {
|
|
12319
|
+
name: positional.displayName,
|
|
12320
|
+
type: "string",
|
|
12321
|
+
required: positional.required
|
|
12322
|
+
});
|
|
12323
|
+
const builder = mod.builder;
|
|
12324
|
+
if (typeof builder !== "function") return {
|
|
12325
|
+
children,
|
|
12326
|
+
positionals,
|
|
12327
|
+
options
|
|
12328
|
+
};
|
|
12329
|
+
const proxy = new Proxy({}, { get(_target, key) {
|
|
12330
|
+
if (key === "command") return (child) => {
|
|
12331
|
+
children.push(child);
|
|
12332
|
+
return proxy;
|
|
12333
|
+
};
|
|
12334
|
+
if (key === "positional") return (name, config) => {
|
|
12335
|
+
const existing = positionals.get(name);
|
|
12336
|
+
const choices = normalizeChoices(config.choices);
|
|
12337
|
+
positionals.set(name, {
|
|
12338
|
+
name: existing?.name ?? `<${name}>`,
|
|
12339
|
+
type: config.type ?? "string",
|
|
12340
|
+
required: existing?.required ?? config.demandOption === true,
|
|
12341
|
+
...choices ? { choices } : {}
|
|
12342
|
+
});
|
|
12343
|
+
return proxy;
|
|
12344
|
+
};
|
|
12345
|
+
if (key === "option") return (name, config) => {
|
|
12346
|
+
const choices = normalizeChoices(config.choices);
|
|
12347
|
+
options.push({
|
|
12348
|
+
name: `--${name}`,
|
|
12349
|
+
type: config.type ?? "string",
|
|
12350
|
+
required: config.demandOption === true,
|
|
12351
|
+
...choices ? { choices } : {}
|
|
12352
|
+
});
|
|
12353
|
+
if (config.type === "boolean" && config.default === true) options.push({
|
|
12354
|
+
name: `--no-${name}`,
|
|
12355
|
+
type: "boolean",
|
|
12356
|
+
required: false
|
|
12357
|
+
});
|
|
12358
|
+
return proxy;
|
|
12359
|
+
};
|
|
12360
|
+
return () => proxy;
|
|
12361
|
+
} });
|
|
12362
|
+
builder(proxy);
|
|
12363
|
+
return {
|
|
12364
|
+
children,
|
|
12365
|
+
positionals,
|
|
12366
|
+
options
|
|
12367
|
+
};
|
|
12368
|
+
}
|
|
12369
|
+
function inspectionFlags({ positionals, options }) {
|
|
12370
|
+
return [...positionals.values(), ...options];
|
|
12371
|
+
}
|
|
12372
|
+
function leafWord(name) {
|
|
12373
|
+
return name.trim().split(/\s+/).at(-1) ?? "";
|
|
12374
|
+
}
|
|
12375
|
+
function isConfirmationFlag(flagName) {
|
|
12376
|
+
return flagName === "--yes";
|
|
12377
|
+
}
|
|
12378
|
+
const DESTRUCTIVE_VERBS = new Set([
|
|
12379
|
+
"delete",
|
|
12380
|
+
"remove",
|
|
12381
|
+
"reset",
|
|
12382
|
+
"rollback",
|
|
12383
|
+
"unpublish",
|
|
12384
|
+
"logout"
|
|
12385
|
+
]);
|
|
12386
|
+
const NON_IDEMPOTENT_VERBS = new Set([
|
|
12387
|
+
"create",
|
|
12388
|
+
"generate",
|
|
12389
|
+
"add",
|
|
12390
|
+
"upload",
|
|
12391
|
+
"invite",
|
|
12392
|
+
"duplicate",
|
|
12393
|
+
"submit",
|
|
12394
|
+
"ship",
|
|
12395
|
+
"rollback"
|
|
12396
|
+
]);
|
|
12397
|
+
const NON_IDEMPOTENT_OVERRIDE = new Set([
|
|
12398
|
+
"databases reset",
|
|
12399
|
+
"databases delete",
|
|
12400
|
+
"projects delete",
|
|
12401
|
+
"projects settings auth set"
|
|
12402
|
+
]);
|
|
12403
|
+
function isDestructive(name, flags) {
|
|
12404
|
+
if (DESTRUCTIVE_VERBS.has(leafWord(name))) return true;
|
|
12405
|
+
return flags.some((flag) => isConfirmationFlag(flag.name));
|
|
12406
|
+
}
|
|
12407
|
+
function isIdempotent(name) {
|
|
12408
|
+
if (NON_IDEMPOTENT_VERBS.has(leafWord(name))) return false;
|
|
12409
|
+
return !NON_IDEMPOTENT_OVERRIDE.has(name);
|
|
12410
|
+
}
|
|
12411
|
+
function buildCommandTree(roots = getRootCommands()) {
|
|
12412
|
+
const out = [];
|
|
12413
|
+
const visit = (modules, prefix) => {
|
|
12414
|
+
for (const mod of modules) {
|
|
12415
|
+
const word = commandWord(mod.command ?? "");
|
|
12416
|
+
if (!word) continue;
|
|
12417
|
+
const name = prefix ? `${prefix} ${word}` : word;
|
|
12418
|
+
const inspection = inspectBuilder(mod);
|
|
12419
|
+
const flags = inspectionFlags(inspection);
|
|
12420
|
+
out.push({
|
|
12421
|
+
name,
|
|
12422
|
+
flags,
|
|
12423
|
+
idempotent: isIdempotent(name),
|
|
12424
|
+
destructive: isDestructive(name, flags)
|
|
12425
|
+
});
|
|
12426
|
+
visit(inspection.children, name);
|
|
12427
|
+
}
|
|
12428
|
+
};
|
|
12429
|
+
visit(roots, "");
|
|
12430
|
+
return out;
|
|
12431
|
+
}
|
|
12432
|
+
function registeredCommandPaths(roots = getRootCommands()) {
|
|
13154
12433
|
const paths = /* @__PURE__ */ new Set();
|
|
13155
|
-
for (const { name } of
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
12434
|
+
for (const { name } of buildCommandTree(roots)) paths.add(name);
|
|
12435
|
+
return paths;
|
|
12436
|
+
}
|
|
12437
|
+
|
|
12438
|
+
//#endregion
|
|
12439
|
+
//#region src/cli.ts
|
|
12440
|
+
let registeredPathsCache = null;
|
|
12441
|
+
function getRegisteredCommandPaths() {
|
|
12442
|
+
if (registeredPathsCache) return registeredPathsCache;
|
|
12443
|
+
const paths = registeredCommandPaths();
|
|
12444
|
+
if (isDevEnvironment()) paths.add("dev");
|
|
12445
|
+
registeredPathsCache = paths;
|
|
13161
12446
|
return paths;
|
|
13162
|
-
}
|
|
12447
|
+
}
|
|
13163
12448
|
var HandledCliError = class extends Error {};
|
|
13164
12449
|
function commandPathFromArgv(argv) {
|
|
13165
12450
|
const words = [];
|
|
@@ -13169,10 +12454,11 @@ function commandPathFromArgv(argv) {
|
|
|
13169
12454
|
}
|
|
13170
12455
|
const [firstWord] = words;
|
|
13171
12456
|
if (firstWord === void 0) return null;
|
|
12457
|
+
const registeredPaths = getRegisteredCommandPaths();
|
|
13172
12458
|
let matched = "";
|
|
13173
12459
|
for (let i = 0; i < words.length; i++) {
|
|
13174
12460
|
const candidate = words.slice(0, i + 1).join(" ");
|
|
13175
|
-
if (!
|
|
12461
|
+
if (!registeredPaths.has(candidate)) break;
|
|
13176
12462
|
matched = candidate;
|
|
13177
12463
|
}
|
|
13178
12464
|
return matched === "" ? firstWord : matched;
|
|
@@ -13216,7 +12502,7 @@ function createCli(argv) {
|
|
|
13216
12502
|
"dry-run": args["dry-run"] === true,
|
|
13217
12503
|
dev: args.dev === true
|
|
13218
12504
|
}, Date.now());
|
|
13219
|
-
}).
|
|
12505
|
+
}).demandCommand(1, "Specify a command. Run --help for usage.").strict().wrap(null).version(CLI_VERSION).help().fail((msg, err, instance) => {
|
|
13220
12506
|
const isJson = argv.includes("--json");
|
|
13221
12507
|
const message = err ? err.message || String(err) : msg;
|
|
13222
12508
|
if (err) console.error(message);
|
|
@@ -13224,7 +12510,7 @@ function createCli(argv) {
|
|
|
13224
12510
|
if (!isJson) instance.showHelp("error");
|
|
13225
12511
|
console.error(`\n${message}`);
|
|
13226
12512
|
}
|
|
13227
|
-
if (isJson) console.
|
|
12513
|
+
if (isJson) console.log(JSON.stringify({
|
|
13228
12514
|
ok: false,
|
|
13229
12515
|
command: commandPathFromArgv(argv),
|
|
13230
12516
|
error: {
|
|
@@ -13235,6 +12521,7 @@ function createCli(argv) {
|
|
|
13235
12521
|
process.exitCode = EXIT_INVALID_ARGS;
|
|
13236
12522
|
throw new HandledCliError(message);
|
|
13237
12523
|
}).exitProcess(false);
|
|
12524
|
+
for (const command of getRootCommands()) cli.command(command);
|
|
13238
12525
|
if (isDevEnvironment()) cli.command(devCommand);
|
|
13239
12526
|
return cli;
|
|
13240
12527
|
}
|