foldrun 26.3.3 → 26.3.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/bin/foldrun.mjs +60 -60
- package/docs/a2a.md +12 -12
- package/docs/agents.md +21 -21
- package/docs/api-usage.md +2 -2
- package/docs/api.md +98 -98
- package/docs/assistant.md +21 -21
- package/docs/backups-and-restore.md +11 -11
- package/docs/budgets-and-billing.md +21 -21
- package/docs/checks.md +19 -19
- package/docs/cli.md +100 -100
- package/docs/coding-agents.md +8 -8
- package/docs/deploying.md +7 -7
- package/docs/evals.md +6 -6
- package/docs/extract.md +1 -1
- package/docs/faq.md +5 -5
- package/docs/feature-flags.md +1 -1
- package/docs/flows.md +14 -14
- package/docs/four-jobs.md +5 -5
- package/docs/getting-started.md +10 -10
- package/docs/glossary.md +9 -9
- package/docs/hooks.md +5 -5
- package/docs/how-it-works.md +1 -1
- package/docs/introduction.md +4 -4
- package/docs/knowledge-and-memory.md +6 -6
- package/docs/mcp.md +15 -15
- package/docs/network.md +9 -9
- package/docs/notifications.md +16 -16
- package/docs/oauth.md +1 -1
- package/docs/providers.md +6 -6
- package/docs/runs.md +28 -28
- package/docs/scheduling.md +1 -1
- package/docs/secrets.md +22 -22
- package/docs/security.md +15 -15
- package/docs/self-hosting.md +18 -18
- package/docs/status.md +1 -1
- package/docs/storage-and-sharing.md +14 -14
- package/docs/team-and-access.md +29 -29
- package/docs/tools.md +20 -20
- package/docs/troubleshooting.md +4 -4
- package/docs/workspaces.md +43 -43
- package/package.json +2 -2
- package/src/commands.mjs +131 -131
- package/src/guide.mjs +1 -1
package/src/commands.mjs
CHANGED
|
@@ -130,7 +130,7 @@ function writeFiles(dir, files, what) {
|
|
|
130
130
|
/** kebab-case, the same rule the platform applies to a workspace name. */
|
|
131
131
|
function assertName(name) {
|
|
132
132
|
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(name)) {
|
|
133
|
-
throw new Error(`"${name}" is not a
|
|
133
|
+
throw new Error(`"${name}" is not a project name — kebab-case only, e.g. blog-desk`);
|
|
134
134
|
}
|
|
135
135
|
return name;
|
|
136
136
|
}
|
|
@@ -209,7 +209,7 @@ function report(where, written, outside, wsDir, files) {
|
|
|
209
209
|
// nobody reads. A developer who ran `foldrun init ~/projects/desk --flat`
|
|
210
210
|
// finds an AGENTS.md in ~/projects and should know it was this, and why.
|
|
211
211
|
for (const rel of outside) {
|
|
212
|
-
console.log(` ${c.dim(rel)} ${c.dim("← account scope, shared by every
|
|
212
|
+
console.log(` ${c.dim(rel)} ${c.dim("← account scope, shared by every project beside this one")}`);
|
|
213
213
|
}
|
|
214
214
|
const flow = files.map((f) => f.path.match(/^flows\/(.+)\.md$/)?.[1]).find(Boolean);
|
|
215
215
|
const rel = path.relative(process.cwd(), where) || ".";
|
|
@@ -234,12 +234,12 @@ function report(where, written, outside, wsDir, files) {
|
|
|
234
234
|
*/
|
|
235
235
|
async function newWorkspace(name, flags, layout) {
|
|
236
236
|
const { syncWorkspaceBundles } = await core();
|
|
237
|
-
if (!name) throw new Error("which
|
|
237
|
+
if (!name) throw new Error("which project? `foldrun new <name>`");
|
|
238
238
|
assertName(name);
|
|
239
239
|
if (!layout.workspacesDir) {
|
|
240
240
|
throw new Error(
|
|
241
241
|
layout.kind === "flat"
|
|
242
|
-
? `${layout.workspaceDir} is a single
|
|
242
|
+
? `${layout.workspaceDir} is a single project, not an account — \`foldrun init <dir>\` makes an account folder that can hold several`
|
|
243
243
|
: "not in an account folder — `foldrun init <dir>` makes one",
|
|
244
244
|
);
|
|
245
245
|
}
|
|
@@ -269,7 +269,7 @@ function workspaceDirFor(flags, layout) {
|
|
|
269
269
|
if (typeof flags.to === "string") {
|
|
270
270
|
if (!layout.workspacesDir || !layout.workspaces.includes(flags.to)) {
|
|
271
271
|
throw new Error(
|
|
272
|
-
`no
|
|
272
|
+
`no project called "${flags.to}" here — this ${layout.kind === "flat" ? "is a single project" : `account has ${layout.workspaces.join(", ") || "none"}`} (--platform makes it in the deployed one)`,
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
return path.join(layout.workspacesDir, flags.to);
|
|
@@ -277,9 +277,9 @@ function workspaceDirFor(flags, layout) {
|
|
|
277
277
|
if (layout.workspaceDir && layout.kind !== "empty") return layout.workspaceDir;
|
|
278
278
|
if (layout.workspacesDir && layout.workspaces.length === 1) return path.join(layout.workspacesDir, layout.workspaces[0]);
|
|
279
279
|
if (layout.kind === "account") {
|
|
280
|
-
throw new Error(`which
|
|
280
|
+
throw new Error(`which project? --to <name> — this account has ${layout.workspaces.join(", ") || "none"}`);
|
|
281
281
|
}
|
|
282
|
-
throw new Error("this is not a
|
|
282
|
+
throw new Error("this is not a project — `foldrun init <dir>` makes one, or cd into an existing one");
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/**
|
|
@@ -777,7 +777,7 @@ async function checkAccount(layout, flags) {
|
|
|
777
777
|
const opts = checkOptions(flags);
|
|
778
778
|
const text = opts.format === "text";
|
|
779
779
|
if (!layout.workspaces.length) {
|
|
780
|
-
console.log(`\n ${c.amber("!")} no
|
|
780
|
+
console.log(`\n ${c.amber("!")} no projects in ${layout.accountRoot} — \`foldrun new <name>\` makes one\n`);
|
|
781
781
|
return 1;
|
|
782
782
|
}
|
|
783
783
|
const all = [];
|
|
@@ -830,7 +830,7 @@ async function checkAccount(layout, flags) {
|
|
|
830
830
|
console.log();
|
|
831
831
|
}
|
|
832
832
|
all.push(...libResult.findings);
|
|
833
|
-
if (!text) emitCheck(all, opts, { root: layout.accountRoot, summary: `${layout.workspaces.length}
|
|
833
|
+
if (!text) emitCheck(all, opts, { root: layout.accountRoot, summary: `${layout.workspaces.length} projects and the library`, baselined });
|
|
834
834
|
return checkExit(all, opts);
|
|
835
835
|
}
|
|
836
836
|
|
|
@@ -1079,7 +1079,7 @@ function changedFiles(root, base, label) {
|
|
|
1079
1079
|
return new Set([...diff.split("\0"), ...untracked.split("\0")].filter(Boolean));
|
|
1080
1080
|
} catch (err) {
|
|
1081
1081
|
const why = String(/** @type {any} */ (err).stderr ?? err).trim().split("\n")[0];
|
|
1082
|
-
throw new Error(`--changed needs ${label === "library" ? "the account" : "this
|
|
1082
|
+
throw new Error(`--changed needs ${label === "library" ? "the account" : "this project"} in a git repository and a ref git knows (${base}) — ${why}`);
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
@@ -1315,8 +1315,8 @@ async function checkProblems(workspace, flags = {}) {
|
|
|
1315
1315
|
continue;
|
|
1316
1316
|
}
|
|
1317
1317
|
const hint = platform.url
|
|
1318
|
-
? `in this
|
|
1319
|
-
: "in this
|
|
1318
|
+
? `in this project, the local account library, or the library on ${platform.url}`
|
|
1319
|
+
: "in this project or the account library (a library on a platform is seen when signed in: `foldrun login`, or --url)";
|
|
1320
1320
|
note("error", `agents/${a.name}`, `tools: [${t}] — no tools/${t}/tool.md or tools/${t}.md ${hint}`);
|
|
1321
1321
|
}
|
|
1322
1322
|
// A colleague that does not exist is not a consult tool the agent is
|
|
@@ -1324,7 +1324,7 @@ async function checkProblems(workspace, flags = {}) {
|
|
|
1324
1324
|
// fine. Same shape as a tool that names nothing.
|
|
1325
1325
|
for (const c of a.consults) {
|
|
1326
1326
|
if (!agentNames.has(c)) {
|
|
1327
|
-
note("error", `agents/${a.name}`, `agents: [${c}] — no such agent in this
|
|
1327
|
+
note("error", `agents/${a.name}`, `agents: [${c}] — no such agent in this project`);
|
|
1328
1328
|
} else if (c === a.name) {
|
|
1329
1329
|
note("warn", `agents/${a.name}`, `agents: [${c}] — an agent consulting itself; the call is refused at run time`);
|
|
1330
1330
|
}
|
|
@@ -1339,7 +1339,7 @@ async function checkProblems(workspace, flags = {}) {
|
|
|
1339
1339
|
for (const s of a.subagents) {
|
|
1340
1340
|
const sub = byName.get(s);
|
|
1341
1341
|
if (!sub) {
|
|
1342
|
-
note("error", `agents/${a.name}`, `subagents: [${s}] — no such agent in this
|
|
1342
|
+
note("error", `agents/${a.name}`, `subagents: [${s}] — no such agent in this project`);
|
|
1343
1343
|
} else if (s === a.name) {
|
|
1344
1344
|
note("warn", `agents/${a.name}`, `subagents: [${s}] — an agent delegating to itself; it is skipped at run time`);
|
|
1345
1345
|
} else if (!sub.description?.trim()) {
|
|
@@ -1377,7 +1377,7 @@ async function checkProblems(workspace, flags = {}) {
|
|
|
1377
1377
|
continue;
|
|
1378
1378
|
}
|
|
1379
1379
|
if (!skillNames.has(s)) {
|
|
1380
|
-
note("error", `agents/${a.name}`, `skills: [${s}] — no skill of that name in this agent, the
|
|
1380
|
+
note("error", `agents/${a.name}`, `skills: [${s}] — no skill of that name in this agent, the project or the library`);
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
@@ -1542,7 +1542,7 @@ async function checkHooks(workspace, agents, libraryRoot, platform, note) {
|
|
|
1542
1542
|
fs.existsSync(path.join(workspace, "hooks", n)) || fs.existsSync(path.join(libraryRoot, "hooks", n)) || platform.hooks?.has(n);
|
|
1543
1543
|
const missing = (where, names) => {
|
|
1544
1544
|
for (const n of names) {
|
|
1545
|
-
if (!exists(n)) note("error", where, `hooks: [${n}] — no hooks/${n}/hook.md in this
|
|
1545
|
+
if (!exists(n)) note("error", where, `hooks: [${n}] — no hooks/${n}/hook.md in this project or the account library`);
|
|
1546
1546
|
}
|
|
1547
1547
|
};
|
|
1548
1548
|
const accountNames = h.hookNames(front(path.join(path.dirname(libraryRoot), "AGENTS.md")).hooks);
|
|
@@ -2918,7 +2918,7 @@ function takeWorkspace(positional, layout) {
|
|
|
2918
2918
|
function needsOne(layout, what) {
|
|
2919
2919
|
if (layout.kind === "account" && !layout.workspaceDir && layout.workspaces.length !== 1) {
|
|
2920
2920
|
throw new Error(
|
|
2921
|
-
`which
|
|
2921
|
+
`which project? \`foldrun ${what} <target> --workspace <name>\` — this account has ${layout.workspaces.join(", ") || "none"}`,
|
|
2922
2922
|
);
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
@@ -2926,7 +2926,7 @@ function needsOne(layout, what) {
|
|
|
2926
2926
|
/** …and the error when there are several and none was named. */
|
|
2927
2927
|
function whichWorkspace(layout, what) {
|
|
2928
2928
|
return new Error(
|
|
2929
|
-
`which
|
|
2929
|
+
`which project? ${layout.workspaces.length ? `\`foldrun ${what} <workspace> …\` — this account has ${layout.workspaces.join(", ")}` : "there are none here"}`,
|
|
2930
2930
|
);
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
@@ -3319,7 +3319,7 @@ function localWorkspaceNames(layout) {
|
|
|
3319
3319
|
async function limitingCore() {
|
|
3320
3320
|
/** @type {any} */
|
|
3321
3321
|
const k = await core();
|
|
3322
|
-
if (typeof k.setSecretWorkspaces !== "function") throw new Error("limiting a secret to
|
|
3322
|
+
if (typeof k.setSecretWorkspaces !== "function") throw new Error("limiting a secret to projects needs a newer @foldrun/core — update foldrun");
|
|
3323
3323
|
return k;
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
@@ -3338,7 +3338,7 @@ function workspacesFlag(flags) {
|
|
|
3338
3338
|
if (flags.workspaces === undefined) return undefined;
|
|
3339
3339
|
if (typeof flags.workspaces !== "string") throw new Error("--workspaces takes the names: --workspaces sales,ops");
|
|
3340
3340
|
const list = flags.workspaces.split(",").map((v) => v.trim()).filter(Boolean);
|
|
3341
|
-
if (!list.length) throw new Error("--workspaces takes the names: --workspaces sales,ops (--none for no
|
|
3341
|
+
if (!list.length) throw new Error("--workspaces takes the names: --workspaces sales,ops (--none for no project)");
|
|
3342
3342
|
return list;
|
|
3343
3343
|
}
|
|
3344
3344
|
|
|
@@ -3353,21 +3353,21 @@ function workspacesFlag(flags) {
|
|
|
3353
3353
|
*/
|
|
3354
3354
|
async function secretWorkspacesCmd(args, flags, url, layout) {
|
|
3355
3355
|
const [name, ...rest] = args;
|
|
3356
|
-
if (!name) throw new Error("which secret? `foldrun secrets workspaces NAME [workspace …]`, `--all` for every
|
|
3356
|
+
if (!name) throw new Error("which secret? `foldrun secrets workspaces NAME [workspace …]`, `--all` for every project, `--none` for none");
|
|
3357
3357
|
const named = rest.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
3358
3358
|
if ([flags.all === true, flags.none === true, named.length > 0].filter(Boolean).length > 1) {
|
|
3359
|
-
throw new Error("one of:
|
|
3359
|
+
throw new Error("one of: project names, --all, or --none");
|
|
3360
3360
|
}
|
|
3361
3361
|
const describe = (list) =>
|
|
3362
3362
|
list === null || list === undefined
|
|
3363
|
-
? `${c.bold(name)} may be used in every
|
|
3363
|
+
? `${c.bold(name)} may be used in every project`
|
|
3364
3364
|
: list.length
|
|
3365
|
-
? `${c.bold(name)} may be used only in ${list.join(", ")} — every other
|
|
3366
|
-
: `${c.bold(name)} may be used in no
|
|
3365
|
+
? `${c.bold(name)} may be used only in ${list.join(", ")} — every other project finds it not set`
|
|
3366
|
+
: `${c.bold(name)} may be used in no project`;
|
|
3367
3367
|
if (!named.length && flags.all !== true && flags.none !== true) {
|
|
3368
3368
|
const entries = url ? (await remoteCall(url, flags, "/api/secrets")).secrets : (await core()).listSecrets("default");
|
|
3369
3369
|
const hit = entries.find((s) => s.name === name && s.scope === "account");
|
|
3370
|
-
if (!hit) throw new Error(`no secret ${name} in the account — this limits an account secret; a
|
|
3370
|
+
if (!hit) throw new Error(`no secret ${name} in the account — this limits an account secret; a project's own is that project's already`);
|
|
3371
3371
|
console.log(`\n ${describe(hit.workspaces)}${hit.workspaces ? "" : c.dim(` — limit it: foldrun secrets workspaces ${name} <workspace> …`)}\n`);
|
|
3372
3372
|
return 0;
|
|
3373
3373
|
}
|
|
@@ -3378,7 +3378,7 @@ async function secretWorkspacesCmd(args, flags, url, layout) {
|
|
|
3378
3378
|
const guard = {};
|
|
3379
3379
|
if (flags["if-workspaces"] !== undefined) {
|
|
3380
3380
|
const v = typeof flags["if-workspaces"] === "string" ? flags["if-workspaces"].trim() : "";
|
|
3381
|
-
if (!v) throw new Error("--if-workspaces takes the list you read: names (a,b), all (every
|
|
3381
|
+
if (!v) throw new Error("--if-workspaces takes the list you read: names (a,b), all (every project) or none");
|
|
3382
3382
|
guard.ifWorkspaces = v === "all" ? null : v === "none" ? [] : v.split(",").map((x) => x.trim()).filter(Boolean);
|
|
3383
3383
|
}
|
|
3384
3384
|
const stored = url
|
|
@@ -3468,7 +3468,7 @@ async function secretsCmd(positional, flags, layout) {
|
|
|
3468
3468
|
console.log();
|
|
3469
3469
|
for (const s of entries) {
|
|
3470
3470
|
console.log(
|
|
3471
|
-
` ${c.bold(s.name)} ${c.dim(`${s.scope}${s.shadowed ? " · shadowed" : ""} · ${s.updatedAt ?? ""}${s.sites?.length ? ` · sent only to ${s.sites.join(", ")}` : ""}${Array.isArray(s.workspaces) ? ` · ${s.workspaces.length ? `only in ${s.workspaces.join(", ")}` : "in no
|
|
3471
|
+
` ${c.bold(s.name)} ${c.dim(`${s.scope}${s.shadowed ? " · shadowed" : ""} · ${s.updatedAt ?? ""}${s.sites?.length ? ` · sent only to ${s.sites.join(", ")}` : ""}${Array.isArray(s.workspaces) ? ` · ${s.workspaces.length ? `only in ${s.workspaces.join(", ")}` : "in no project"}` : ""}`)}`,
|
|
3472
3472
|
);
|
|
3473
3473
|
// The platform says what the far end answered last time; this
|
|
3474
3474
|
// machine's vault keeps no such record, so nothing is shown there.
|
|
@@ -3515,7 +3515,7 @@ async function secretsCmd(positional, flags, layout) {
|
|
|
3515
3515
|
? (await remoteCall(url, flags, `/api/secrets${scope ? `?workspace=${encodeURIComponent(scope)}` : ""}`)).secrets
|
|
3516
3516
|
: (await core()).listSecrets("default", scope);
|
|
3517
3517
|
const hit = entries.find((s) => s.name === name);
|
|
3518
|
-
if (!hit) throw new Error(`no secret ${name}${scope ? ` in
|
|
3518
|
+
if (!hit) throw new Error(`no secret ${name}${scope ? ` in project ${scope}` : " in the account"}`);
|
|
3519
3519
|
console.log(hit.sites?.length
|
|
3520
3520
|
? `\n ${c.bold(name)} is sent only to ${hit.sites.join(", ")} — on the platform it never enters a sandbox\n`
|
|
3521
3521
|
: `\n ${c.bold(name)} is not bound to sites — a step with a script or Bash gets its real value. Bind it: foldrun secrets sites ${name} api.example.com\n`);
|
|
@@ -3535,7 +3535,7 @@ async function secretsCmd(positional, flags, layout) {
|
|
|
3535
3535
|
// --workspaces a,b / --none: an ACCOUNT secret limited to those
|
|
3536
3536
|
// workspaces, sent with the value so it is never open in between.
|
|
3537
3537
|
const limitTo = workspacesFlag(flags);
|
|
3538
|
-
if (limitTo !== undefined && scope) throw new Error("--workspaces limits an account secret — add --account (a
|
|
3538
|
+
if (limitTo !== undefined && scope) throw new Error("--workspaces limits an account secret — add --account (a project's own secret is that project's already)");
|
|
3539
3539
|
const withLimit = limitTo !== undefined ? { workspaces: limitTo } : {};
|
|
3540
3540
|
/** @returns {Promise<{ k: any, limit: object }>} — typed loosely, as limitingCore is. */
|
|
3541
3541
|
const localLimit = async () => {
|
|
@@ -3607,13 +3607,13 @@ async function secretsCmd(positional, flags, layout) {
|
|
|
3607
3607
|
k.setSecret("default", name, value, scope, undefined, limit);
|
|
3608
3608
|
if (sites.length) await localSetSites(name, sites, scope);
|
|
3609
3609
|
}
|
|
3610
|
-
const limited = limitTo === undefined ? "" : limitTo.length ? `, only for ${limitTo.join(", ")}` : ", for no
|
|
3610
|
+
const limited = limitTo === undefined ? "" : limitTo.length ? `, only for ${limitTo.join(", ")}` : ", for no project yet";
|
|
3611
3611
|
console.log(`\n ${c.green("✓")} ${name} stored${sites.length ? ` and sent only to ${sites.join(", ")}` : ""}${limited} — declare it in agent.md under \`secrets:\` to use it\n`);
|
|
3612
3612
|
return 0;
|
|
3613
3613
|
}
|
|
3614
3614
|
|
|
3615
3615
|
if (verb === "rm") {
|
|
3616
|
-
if (!(await sureToDelete(flags, "secrets rm", `secret ${name}${scope ? ` (
|
|
3616
|
+
if (!(await sureToDelete(flags, "secrets rm", `secret ${name}${scope ? ` (project ${scope})` : " (account)"}${url ? ` on ${url}` : ""}`))) return 1;
|
|
3617
3617
|
/** @type {any} */
|
|
3618
3618
|
let revoked;
|
|
3619
3619
|
if (url) {
|
|
@@ -3963,7 +3963,7 @@ async function invoke(target, flags) {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
if (!target) throw new Error("which flow? try `foldrun invoke <flow> --to <workspace>`");
|
|
3965
3965
|
const ws = flags.to;
|
|
3966
|
-
if (!ws) throw new Error("which
|
|
3966
|
+
if (!ws) throw new Error("which project is it in? pass --to <workspace>");
|
|
3967
3967
|
|
|
3968
3968
|
// --wait asks in short pieces, not one long request: whatever sits in
|
|
3969
3969
|
// front of the platform cuts a request that stays silent too long
|
|
@@ -4760,7 +4760,7 @@ async function keysCmd(positional, flags) {
|
|
|
4760
4760
|
? gatewayLine(k.gateway)
|
|
4761
4761
|
: k.purpose === "a2a"
|
|
4762
4762
|
? `A2A · ${k.a2a?.workspace ?? "?"} · ${(k.a2a?.flows ?? []).join(",")}${k.a2a?.maxTasks ? ` · up to ${k.a2a.maxTasks} open` : ""}`
|
|
4763
|
-
: `${k.role ?? "admin"} · ${k.workspaces ? k.workspaces.join(",") || "no
|
|
4763
|
+
: `${k.role ?? "admin"} · ${k.workspaces ? k.workspaces.join(",") || "no projects" : "all projects"}`;
|
|
4764
4764
|
const expired = !k.revokedAt && k.expiresAt && Date.parse(k.expiresAt) <= Date.now();
|
|
4765
4765
|
const state = k.revokedAt ? c.red("revoked") : expired ? c.red("expired") : c.green("live");
|
|
4766
4766
|
// A key `foldrun login` minted lasts 90 days and renews itself while
|
|
@@ -4798,13 +4798,13 @@ async function keysCmd(positional, flags) {
|
|
|
4798
4798
|
// --to <ws[,ws]> says the same (every other verb's --to names a workspace):
|
|
4799
4799
|
// it scopes the key, it is never dropped — a key the person believes is
|
|
4800
4800
|
// scoped but isn't is the worst way to be wrong.
|
|
4801
|
-
if (flags.to !== undefined && (typeof flags.to !== "string" || !flags.to.trim())) throw new Error("--to needs a
|
|
4801
|
+
if (flags.to !== undefined && (typeof flags.to !== "string" || !flags.to.trim())) throw new Error("--to needs a project: `foldrun keys create <label> --to <workspace>`");
|
|
4802
4802
|
if (flags.to !== undefined && flags.workspaces !== undefined) throw new Error("--to or --workspaces, not both (they say the same thing)");
|
|
4803
4803
|
const scope = flags.workspaces !== undefined ? flags.workspaces : flags.to;
|
|
4804
4804
|
if (scope !== undefined && typeof scope !== "string") throw new Error("--workspaces needs names: a,b — or all");
|
|
4805
4805
|
if (typeof scope === "string") {
|
|
4806
4806
|
const names = scope.split(",").map((w) => w.trim()).filter(Boolean);
|
|
4807
|
-
if (scope !== "all" && !names.length) throw new Error("no
|
|
4807
|
+
if (scope !== "all" && !names.length) throw new Error("no project named — `--to <workspace>` or `--workspaces a,b`");
|
|
4808
4808
|
body.workspaces = scope === "all" ? null : names;
|
|
4809
4809
|
}
|
|
4810
4810
|
// --require-customer (FOL-168): every run the key starts must name one.
|
|
@@ -4813,7 +4813,7 @@ async function keysCmd(positional, flags) {
|
|
|
4813
4813
|
// Asked to scope it, told it is not scoped: never hand that key out.
|
|
4814
4814
|
if (Array.isArray(body.workspaces) && made.workspaces === null) {
|
|
4815
4815
|
await remoteCall(url, flags, "/api/keys", { method: "DELETE", body: JSON.stringify({ id: made.id }) }).catch(() => {});
|
|
4816
|
-
throw new Error(`the platform made ${made.id} for every
|
|
4816
|
+
throw new Error(`the platform made ${made.id} for every project, not ${body.workspaces.join(",")} — it was revoked; this platform cannot scope a key`);
|
|
4817
4817
|
}
|
|
4818
4818
|
console.log(`\n ${c.green("✓")} ${c.bold(arg)} ${c.dim(made.id)}${made.expiresAt ? c.dim(` expires ${made.expiresAt.slice(0, 10)}`) : ""}\n`);
|
|
4819
4819
|
if (made.key == null) return lostSecret(made.id);
|
|
@@ -4874,9 +4874,9 @@ async function keysCmd(positional, flags) {
|
|
|
4874
4874
|
*/
|
|
4875
4875
|
async function keysCreateA2a(url, label, flags) {
|
|
4876
4876
|
if (flags.role !== undefined || flags.workspaces !== undefined) {
|
|
4877
|
-
throw new Error("an A2A key takes --to <workspace> and --flows, not --role or --workspaces — it opens /a2a only, for that
|
|
4877
|
+
throw new Error("an A2A key takes --to <workspace> and --flows, not --role or --workspaces — it opens /a2a only, for that project's flows");
|
|
4878
4878
|
}
|
|
4879
|
-
if (typeof flags.to !== "string" || !flags.to) throw new Error("which
|
|
4879
|
+
if (typeof flags.to !== "string" || !flags.to) throw new Error("which project? `foldrun keys create <label> --a2a --to <workspace> --flows <flow,…>`");
|
|
4880
4880
|
const flows = typeof flags.flows === "string" ? [...new Set(flags.flows.split(",").map((f) => f.trim()).filter(Boolean))] : [];
|
|
4881
4881
|
if (!flows.length) throw new Error(`which flows may it call? --flows <flow,…> — \`foldrun a2a ls --to ${flags.to}\` lists what ${flags.to} publishes`);
|
|
4882
4882
|
const body = { label, purpose: "a2a", workspace: flags.to, flows };
|
|
@@ -5475,9 +5475,9 @@ async function auditCmd(positional, flags) {
|
|
|
5475
5475
|
async function sourceCmd(positional, flags) {
|
|
5476
5476
|
const [verb, a, b] = positional;
|
|
5477
5477
|
const url = remoteUrl(flags);
|
|
5478
|
-
if (!url) throw new Error("source reads a
|
|
5478
|
+
if (!url) throw new Error("source reads a project on a platform — pass --url, or `foldrun login` first");
|
|
5479
5479
|
const ws = flags.to;
|
|
5480
|
-
if (!ws) throw new Error("which
|
|
5480
|
+
if (!ws) throw new Error("which project? pass --to <workspace>");
|
|
5481
5481
|
const base = `/api/workspaces/${encodeURIComponent(ws)}/source`;
|
|
5482
5482
|
|
|
5483
5483
|
if (verb === "ls" || verb === "list" || verb === undefined) {
|
|
@@ -5485,7 +5485,7 @@ async function sourceCmd(positional, flags) {
|
|
|
5485
5485
|
const prefix = a ? a.replace(/\/+$/, "") + "/" : "";
|
|
5486
5486
|
const shown = files.filter((f) => !prefix || f.startsWith(prefix));
|
|
5487
5487
|
if (!shown.length) {
|
|
5488
|
-
console.log(`\n ${c.dim(prefix ? `nothing under ${prefix}` : "an empty
|
|
5488
|
+
console.log(`\n ${c.dim(prefix ? `nothing under ${prefix}` : "an empty project")}\n`);
|
|
5489
5489
|
return 0;
|
|
5490
5490
|
}
|
|
5491
5491
|
console.log("");
|
|
@@ -5590,7 +5590,7 @@ async function sourceShare(url, flags, ws, base, spec) {
|
|
|
5590
5590
|
// The route's own 404 says "no <path> in <ws>"; any other 404 is a
|
|
5591
5591
|
// platform from before the route.
|
|
5592
5592
|
if (err instanceof HttpError && err.status === 404 && !/^no /.test(err.message)) {
|
|
5593
|
-
throw new Error(`${url} has no "Move to shared" route yet — it is newer than this platform; move it on the dashboard (the
|
|
5593
|
+
throw new Error(`${url} has no "Move to shared" route yet — it is newer than this platform; move it on the dashboard (the project's Files or Tools & hooks page → Move to shared), or update the platform`);
|
|
5594
5594
|
}
|
|
5595
5595
|
throw err;
|
|
5596
5596
|
}
|
|
@@ -5615,7 +5615,7 @@ async function sourceShare(url, flags, ws, base, spec) {
|
|
|
5615
5615
|
console.log(` ${c.dim("--dry-run: nothing moved")}\n`);
|
|
5616
5616
|
return 0;
|
|
5617
5617
|
}
|
|
5618
|
-
if (!(await confirmed(flags, "source share", `Move ${plan.unit} to shared? Every
|
|
5618
|
+
if (!(await confirmed(flags, "source share", `Move ${plan.unit} to shared? Every project in the account will be able to use it, and it leaves ${ws}. [y/N] `))) {
|
|
5619
5619
|
console.log(`\n ${c.dim("nothing moved")}\n`);
|
|
5620
5620
|
return 0;
|
|
5621
5621
|
}
|
|
@@ -5626,7 +5626,7 @@ async function sourceShare(url, flags, ws, base, spec) {
|
|
|
5626
5626
|
console.log(JSON.stringify(done, null, 2));
|
|
5627
5627
|
return 0;
|
|
5628
5628
|
}
|
|
5629
|
-
console.log(` ${c.green("✓")} ${done.unit} ${c.dim(`moved to library/${done.kind}/${done.unit.slice(done.kind.length + 1)} — every
|
|
5629
|
+
console.log(` ${c.green("✓")} ${done.unit} ${c.dim(`moved to library/${done.kind}/${done.unit.slice(done.kind.length + 1)} — every project in the account can use it`)}\n`);
|
|
5630
5630
|
return 0;
|
|
5631
5631
|
}
|
|
5632
5632
|
|
|
@@ -5759,7 +5759,7 @@ async function deployAccountAgentsMd(url, flags, content, dry) {
|
|
|
5759
5759
|
return 0;
|
|
5760
5760
|
}
|
|
5761
5761
|
if (there.refused) {
|
|
5762
|
-
console.log(` ${c.amber("·")} AGENTS.md ${c.dim("not sent — the account's AGENTS.md is every
|
|
5762
|
+
console.log(` ${c.amber("·")} AGENTS.md ${c.dim("not sent — the account's AGENTS.md is every project's; an admin of every project sends it")}`);
|
|
5763
5763
|
return 0;
|
|
5764
5764
|
}
|
|
5765
5765
|
if (sameAccountMd(there.content, content)) {
|
|
@@ -5773,12 +5773,12 @@ async function deployAccountAgentsMd(url, flags, content, dry) {
|
|
|
5773
5773
|
try {
|
|
5774
5774
|
const done = await remoteCall(url, flags, "/api/account/agents-md", { method: "PUT", body: JSON.stringify({ content, ifMatch: there.exists ? there.sha256 : null, message: "foldrun deploy" }) });
|
|
5775
5775
|
const warns = (done.issues ?? []).filter((i) => i.level !== "error").length;
|
|
5776
|
-
console.log(` ${c.green("✓")} AGENTS.md ${c.dim(`(account) sent — every
|
|
5776
|
+
console.log(` ${c.green("✓")} AGENTS.md ${c.dim(`(account) sent — every project reads it${warns ? ` · ${warns} warning${warns === 1 ? "" : "s"}` : ""}`)}`);
|
|
5777
5777
|
return 0;
|
|
5778
5778
|
} catch (err) {
|
|
5779
5779
|
if (!(err instanceof HttpError)) throw err;
|
|
5780
5780
|
if (err.status === 403) {
|
|
5781
|
-
console.log(` ${c.amber("·")} AGENTS.md ${c.dim("not sent — the account's AGENTS.md is every
|
|
5781
|
+
console.log(` ${c.amber("·")} AGENTS.md ${c.dim("not sent — the account's AGENTS.md is every project's; an admin of every project sends it")}`);
|
|
5782
5782
|
return 0;
|
|
5783
5783
|
}
|
|
5784
5784
|
console.log(` ${c.red("✗")} AGENTS.md ${c.dim(`(account) not sent — ${err.message}`)}`);
|
|
@@ -6038,7 +6038,7 @@ async function reportRuntimes(url, workspace, flags, { waitSeconds = 0 } = {}) {
|
|
|
6038
6038
|
async function runtimesCmd(flags, layout) {
|
|
6039
6039
|
const url = platformFor(flags, "runtimes");
|
|
6040
6040
|
const ws = typeof flags.to === "string" ? flags.to : layout?.kind === "empty" ? null : takeWorkspace([], layout);
|
|
6041
|
-
if (!ws) throw new Error("which
|
|
6041
|
+
if (!ws) throw new Error("which project? `foldrun runtimes --to <workspace>` — or run it inside one");
|
|
6042
6042
|
console.log(`\n ${c.bold(ws)} ${c.dim("runtimes")}`);
|
|
6043
6043
|
const runtimes = await reportRuntimes(url, ws, flags, { waitSeconds: flags.wait === true ? 120 : 0 });
|
|
6044
6044
|
if (!runtimes.length) console.log(` ${c.dim("no agent here declares a runtime")}`);
|
|
@@ -6259,7 +6259,7 @@ async function statusCmd(layout, flags, only) {
|
|
|
6259
6259
|
if (tree.agentsMd !== null) {
|
|
6260
6260
|
const there = await remoteAccountAgentsMd(url, flags);
|
|
6261
6261
|
if (there === null) console.log(`\n ${c.dim(NO_ACCOUNT_FILE_API)}`);
|
|
6262
|
-
else if (there.refused) console.log(`\n ${c.dim("AGENTS.md (account): not readable with this key — an admin of every
|
|
6262
|
+
else if (there.refused) console.log(`\n ${c.dim("AGENTS.md (account): not readable with this key — an admin of every project sees it")}`);
|
|
6263
6263
|
else console.log(`\n ${sameAccountMd(there.content, tree.agentsMd) ? `${c.green("✓")} AGENTS.md ${c.dim("(account) the same here and there")}` : `${c.dim("~")} AGENTS.md ${c.dim("(account) differs — `foldrun deploy` sends it")}`}`);
|
|
6264
6264
|
}
|
|
6265
6265
|
console.log();
|
|
@@ -6285,12 +6285,12 @@ async function pullCmd(layout, flags, only) {
|
|
|
6285
6285
|
const wsRoot = layout.workspacesDir ?? path.join(root, "workspaces");
|
|
6286
6286
|
|
|
6287
6287
|
const names = (await remoteWorkspaceNames(url, flags)).filter((n) => (only ? n === only : true));
|
|
6288
|
-
if (only && !names.length) throw new Error(`no
|
|
6288
|
+
if (only && !names.length) throw new Error(`no project "${only}" on ${url}`);
|
|
6289
6289
|
|
|
6290
6290
|
/** @type {{ file: string, content: string, same?: (before: string) => boolean }[]} */
|
|
6291
6291
|
const incoming = [];
|
|
6292
6292
|
for (const name of names) {
|
|
6293
|
-
if (!SAFE_NAME.test(name)) throw new Error(`the platform named a
|
|
6293
|
+
if (!SAFE_NAME.test(name)) throw new Error(`the platform named a project "${name}", which is not a project name — refusing to write it`);
|
|
6294
6294
|
const there = await remoteWorkspaceFiles(url, flags, name, isSourcePath);
|
|
6295
6295
|
for (const [rel, content] of there) incoming.push({ file: within(path.join(wsRoot, name), rel), content });
|
|
6296
6296
|
}
|
|
@@ -6338,7 +6338,7 @@ async function pullCmd(layout, flags, only) {
|
|
|
6338
6338
|
written++;
|
|
6339
6339
|
}
|
|
6340
6340
|
console.log(
|
|
6341
|
-
`\n ${c.green("✓")} pulled ${names.length}
|
|
6341
|
+
`\n ${c.green("✓")} pulled ${names.length} project${names.length === 1 ? "" : "s"} from ${url} ` +
|
|
6342
6342
|
c.dim(`${written} file${written === 1 ? "" : "s"} written, ${incoming.length - written} already current`),
|
|
6343
6343
|
);
|
|
6344
6344
|
console.log(` ${c.dim(`into ${root}`)}`);
|
|
@@ -6347,7 +6347,7 @@ async function pullCmd(layout, flags, only) {
|
|
|
6347
6347
|
if (what === "created" || what === "updated") console.log(` ${c.green("✓")} ${file} ${c.dim(`${what} — the coding-agent rules, pointing at \`foldrun docs\``)}`);
|
|
6348
6348
|
}
|
|
6349
6349
|
if (accountMd === null) console.log(` ${c.dim(NO_ACCOUNT_FILE_API)}`);
|
|
6350
|
-
else if (accountMd.refused) console.log(` ${c.dim("AGENTS.md (account): not pulled — an admin of every
|
|
6350
|
+
else if (accountMd.refused) console.log(` ${c.dim("AGENTS.md (account): not pulled — an admin of every project reads it")}`);
|
|
6351
6351
|
console.log();
|
|
6352
6352
|
return 0;
|
|
6353
6353
|
}
|
|
@@ -6365,7 +6365,7 @@ async function workspacesCmd(positional, flags, layout) {
|
|
|
6365
6365
|
// The dashboard's Create workspace: blank (an AGENTS.md), or with
|
|
6366
6366
|
// --starter the example researcher, writer and publish flow.
|
|
6367
6367
|
if (!url) throw new Error("--platform needs a platform — pass --url, or `foldrun login` first");
|
|
6368
|
-
if (!name) throw new Error("which
|
|
6368
|
+
if (!name) throw new Error("which project? `foldrun workspaces new <name> --platform`");
|
|
6369
6369
|
assertName(name);
|
|
6370
6370
|
const r = await remoteCall(url, flags, "/api/workspaces", {
|
|
6371
6371
|
method: "POST",
|
|
@@ -6377,11 +6377,11 @@ async function workspacesCmd(positional, flags, layout) {
|
|
|
6377
6377
|
}
|
|
6378
6378
|
|
|
6379
6379
|
if (verb === "rm" || verb === "remove" || verb === "delete") {
|
|
6380
|
-
if (!name) throw new Error("which
|
|
6380
|
+
if (!name) throw new Error("which project? `foldrun workspaces rm <name>`");
|
|
6381
6381
|
// `rm ..` joined to workspaces/ is the account folder itself. A name is
|
|
6382
6382
|
// one path segment, never . or .., and locally one this account has.
|
|
6383
6383
|
if (name === "." || name === ".." || /[\\/]/.test(name)) {
|
|
6384
|
-
throw new Error(`"${name}" is not a
|
|
6384
|
+
throw new Error(`"${name}" is not a project name — have: ${(layout.workspaces ?? []).join(", ") || "none"}`);
|
|
6385
6385
|
}
|
|
6386
6386
|
if (flags.platform === true) {
|
|
6387
6387
|
if (!url) throw new Error("--platform needs a platform — pass --url, or `foldrun login` first");
|
|
@@ -6395,7 +6395,7 @@ async function workspacesCmd(positional, flags, layout) {
|
|
|
6395
6395
|
if (!layout.workspacesDir) throw new Error("not in an account folder — there is nothing here to remove");
|
|
6396
6396
|
const dir = path.join(layout.workspacesDir, name);
|
|
6397
6397
|
if (!layout.workspaces.includes(name) || !fs.existsSync(dir)) {
|
|
6398
|
-
throw new Error(`no
|
|
6398
|
+
throw new Error(`no project "${name}" here — have: ${layout.workspaces.join(", ") || "none"}`);
|
|
6399
6399
|
}
|
|
6400
6400
|
if (!(await sureToDelete(flags, "workspaces rm", `the folder ${dir} and everything in it`))) return 1;
|
|
6401
6401
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
@@ -6403,7 +6403,7 @@ async function workspacesCmd(positional, flags, layout) {
|
|
|
6403
6403
|
return 0;
|
|
6404
6404
|
}
|
|
6405
6405
|
if (verb && verb !== "ls" && verb !== "list") {
|
|
6406
|
-
throw new Error(`
|
|
6406
|
+
throw new Error(`projects: unknown verb "${verb}" — ls, show <name>, new <name>, rm <name>, demo`);
|
|
6407
6407
|
}
|
|
6408
6408
|
|
|
6409
6409
|
const here = layout.workspaces;
|
|
@@ -6438,9 +6438,9 @@ async function workspacesCmd(positional, flags, layout) {
|
|
|
6438
6438
|
// Nothing here and the platform could not be read is not "no workspaces":
|
|
6439
6439
|
// that once answered a refused API version, a bad key and a down platform
|
|
6440
6440
|
// alike, with exit 0 (FOL-41).
|
|
6441
|
-
if (!all.length && reach) throw new Error(`could not read the platform's
|
|
6441
|
+
if (!all.length && reach) throw new Error(`could not read the platform's projects: ${reach}`);
|
|
6442
6442
|
if (!all.length) {
|
|
6443
|
-
console.log(`\n ${c.dim("no
|
|
6443
|
+
console.log(`\n ${c.dim("no projects — `foldrun new <name>` makes one")}\n`);
|
|
6444
6444
|
return 0;
|
|
6445
6445
|
}
|
|
6446
6446
|
const width = Math.max(...all.map((n) => n.length));
|
|
@@ -6720,7 +6720,7 @@ function printExtracted(result, flags) {
|
|
|
6720
6720
|
*/
|
|
6721
6721
|
async function textCmd(positional, flags) {
|
|
6722
6722
|
const file = positional[0];
|
|
6723
|
-
if (!file) throw new Error("which file? `foldrun text <file>` — a PDF, scan, document, sheet or recording on this machine (`foldrun storage text <path>` for one already in a
|
|
6723
|
+
if (!file) throw new Error("which file? `foldrun text <file>` — a PDF, scan, document, sheet or recording on this machine (`foldrun storage text <path>` for one already in a project)");
|
|
6724
6724
|
if (positional.length > 1) throw new Error(`one file at a time — \`foldrun text ${file}\` (got ${positional.length})${flags.wait === true ? "; --wait takes seconds: --wait 30" : ""}`);
|
|
6725
6725
|
const opts = extractOptions(flags);
|
|
6726
6726
|
const url = platformFor(flags, "text");
|
|
@@ -6748,7 +6748,7 @@ async function textCmd(positional, flags) {
|
|
|
6748
6748
|
async function storageTextCmd(url, ws, positional, flags) {
|
|
6749
6749
|
const given = positional[1];
|
|
6750
6750
|
if (!given) throw new Error("`foldrun storage text <path>` — a path under storage/, as `foldrun storage ls` names it");
|
|
6751
|
-
if (typeof flags.out === "string" && flags.out) throw new Error("--out is for `foldrun text <file>`; `storage text` writes <path>.txt in the
|
|
6751
|
+
if (typeof flags.out === "string" && flags.out) throw new Error("--out is for `foldrun text <file>`; `storage text` writes <path>.txt in the project (--no-write: it does not)");
|
|
6752
6752
|
const rel = given.replace(/^storage\//, "");
|
|
6753
6753
|
const opts = extractOptions(flags);
|
|
6754
6754
|
const seconds = explicitTimeout(flags) ?? Math.max(timeoutSeconds(flags), (opts.wait ?? 50) + 30);
|
|
@@ -6787,7 +6787,7 @@ async function storageLsAll(url, prefix, flags) {
|
|
|
6787
6787
|
}
|
|
6788
6788
|
const full = desks.filter((d) => d.files.length);
|
|
6789
6789
|
if (!full.length && !desks.some((d) => d.error)) {
|
|
6790
|
-
console.log(`\n ${c.dim(`nothing in any
|
|
6790
|
+
console.log(`\n ${c.dim(`nothing in any project's storage${prefix ? ` under ${prefix}` : ""}${desks.length ? "" : " — no projects yet"}`)}\n`);
|
|
6791
6791
|
return 0;
|
|
6792
6792
|
}
|
|
6793
6793
|
const all = full.flatMap((d) => d.files);
|
|
@@ -6806,7 +6806,7 @@ async function storageLsAll(url, prefix, flags) {
|
|
|
6806
6806
|
for (const d of desks.filter((x) => x.error)) console.log(`\n ${c.red("✗")} ${c.bold(d.workspace)} ${c.dim(d.error)}`);
|
|
6807
6807
|
const empty = desks.filter((d) => !d.files.length && !d.error).map((d) => d.workspace);
|
|
6808
6808
|
if (empty.length) console.log(`\n ${c.dim(`nothing${prefix ? ` under ${prefix}` : ""} in ${empty.join(", ")}`)}`);
|
|
6809
|
-
console.log(`\n ${c.dim(`${all.length} file${all.length === 1 ? "" : "s"} in ${full.length}
|
|
6809
|
+
console.log(`\n ${c.dim(`${all.length} file${all.length === 1 ? "" : "s"} in ${full.length} project${full.length === 1 ? "" : "s"} · ${humanBytes(all.reduce((n, f) => n + (f.size ?? 0), 0))} — \`foldrun storage cat <path> --to <workspace>\``)}\n`);
|
|
6810
6810
|
return desks.some((d) => d.error) ? 1 : 0;
|
|
6811
6811
|
}
|
|
6812
6812
|
|
|
@@ -6815,7 +6815,7 @@ async function storageCmd(positional, flags, layout) {
|
|
|
6815
6815
|
// `ls --all`: every workspace's storage, as the account's Storage page.
|
|
6816
6816
|
// (On `shares`, --all keeps meaning expired and revoked links too.)
|
|
6817
6817
|
if ((positional[0] ?? "ls") === "ls" && flags.all === true) {
|
|
6818
|
-
if (typeof flags.to === "string") throw new Error("`foldrun storage ls --all` lists every
|
|
6818
|
+
if (typeof flags.to === "string") throw new Error("`foldrun storage ls --all` lists every project — or `--to <workspace>` for one, not both");
|
|
6819
6819
|
return storageLsAll(url, positional[1], flags);
|
|
6820
6820
|
}
|
|
6821
6821
|
// A folder that is not a workspace is not a workspace: `logs` and `source`
|
|
@@ -6825,7 +6825,7 @@ async function storageCmd(positional, flags, layout) {
|
|
|
6825
6825
|
// `storage text` also takes --workspace <name> — a name, not a folder.
|
|
6826
6826
|
const named = positional[0] === "text" && typeof flags.workspace === "string" && /^[^/\\.][^/\\]*$/.test(flags.workspace) ? flags.workspace : null;
|
|
6827
6827
|
const ws = typeof flags.to === "string" ? flags.to : named ?? (layout?.kind === "empty" ? null : takeWorkspace([], layout));
|
|
6828
|
-
if (!ws) throw new Error("which
|
|
6828
|
+
if (!ws) throw new Error("which project? `foldrun storage ls --to <workspace>` — or run it inside one");
|
|
6829
6829
|
const verb = positional[0] ?? "ls";
|
|
6830
6830
|
|
|
6831
6831
|
if (verb === "text") return storageTextCmd(url, ws, positional, flags);
|
|
@@ -7130,7 +7130,7 @@ async function docsCmd(positional, flags) {
|
|
|
7130
7130
|
async function triggersCmd(flags, layout) {
|
|
7131
7131
|
const url = platformFor(flags, "triggers");
|
|
7132
7132
|
const ws = typeof flags.to === "string" ? flags.to : layout?.kind === "empty" ? null : takeWorkspace([], layout);
|
|
7133
|
-
if (!ws) throw new Error("which
|
|
7133
|
+
if (!ws) throw new Error("which project? `foldrun triggers --to <workspace>` — or run it inside one");
|
|
7134
7134
|
const days = Number(flags.since) > 0 ? Math.floor(Number(flags.since)) : 7;
|
|
7135
7135
|
const body = await remoteCall(url, flags, `/api/workspaces/${enc(ws)}/triggers?days=${days}`);
|
|
7136
7136
|
const rows = body.flows ?? [];
|
|
@@ -7175,7 +7175,7 @@ const TRIGGER_REASON = {
|
|
|
7175
7175
|
debounced: ["held for the burst", "debounce:"],
|
|
7176
7176
|
quarantined: ["flow switched off", "disable_after:"],
|
|
7177
7177
|
paused: ["work is done, paused", "pause_when:"],
|
|
7178
|
-
halted: ["paused by a person", "account or
|
|
7178
|
+
halted: ["paused by a person", "account or project pause"],
|
|
7179
7179
|
"overlap-skipped": ["previous run still live", "overlap: skip"],
|
|
7180
7180
|
missed: ["missed while down", "catchup: none"],
|
|
7181
7181
|
filtered: ["did not match the filter", "filter:"],
|
|
@@ -7516,14 +7516,14 @@ const NOTIFY_EVENTS = ["failed", "awaiting-approval", "completed"];
|
|
|
7516
7516
|
|
|
7517
7517
|
/** Why a caller limited to some workspaces sees "set" for the account's
|
|
7518
7518
|
* notify: URL or telemetry: (GET /api/account answers `hidden: true`). */
|
|
7519
|
-
const HIDDEN_NOTE = "where it goes is shown only to a member or key with every
|
|
7519
|
+
const HIDDEN_NOTE = "where it goes is shown only to a member or key with every project";
|
|
7520
7520
|
|
|
7521
7521
|
/** The account's defaults, as one readable block. */
|
|
7522
7522
|
function printDefaults(d) {
|
|
7523
7523
|
const notify = d.notify
|
|
7524
7524
|
? [d.notify.email, d.notify.url, d.notify.hidden ? `a webhook ${c.dim(`(${HIDDEN_NOTE})`)}` : null].filter(Boolean).join(", ") + c.dim(` on ${(d.notify.events ?? []).join(", ") || "nothing"}`)
|
|
7525
7525
|
: c.dim("nobody is told anything");
|
|
7526
|
-
console.log(`\n ${c.bold("account defaults")} ${c.dim("every
|
|
7526
|
+
console.log(`\n ${c.bold("account defaults")} ${c.dim("every project here inherits these")}\n`);
|
|
7527
7527
|
console.log(` timezone ${d.timezone ?? c.dim("unset — schedules read UTC")}`);
|
|
7528
7528
|
console.log(` notify ${notify}`);
|
|
7529
7529
|
console.log(` budget ${d.budget ? `$${d.budget.usd} per ${d.budget.period}` : c.dim("no cap")}`);
|
|
@@ -7621,7 +7621,7 @@ async function telemetryCmd(url, args, flags) {
|
|
|
7621
7621
|
}
|
|
7622
7622
|
const { defaults } = await remoteCall(url, flags, "/api/account");
|
|
7623
7623
|
const current = defaults?.telemetry;
|
|
7624
|
-
if (current?.hidden) throw new Error("the account's telemetry is hidden from this key (it needs access to every
|
|
7624
|
+
if (current?.hidden) throw new Error("the account's telemetry is hidden from this key (it needs access to every project) — set it from a key or login that has them all");
|
|
7625
7625
|
const headers = { ...(current?.headers ?? {}) };
|
|
7626
7626
|
for (const [k, v] of Object.entries(given)) {
|
|
7627
7627
|
if (v) headers[k] = v;
|
|
@@ -7758,7 +7758,7 @@ async function jobsCmd(flags, layout) {
|
|
|
7758
7758
|
console.log(JSON.stringify(view, null, 2));
|
|
7759
7759
|
return 0;
|
|
7760
7760
|
}
|
|
7761
|
-
console.log(`\n ${c.bold("The four jobs")} ${c.dim(ws ? `
|
|
7761
|
+
console.log(`\n ${c.bold("The four jobs")} ${c.dim(ws ? `project ${ws}, over the account's` : "the account — every project inherits these")}`);
|
|
7762
7762
|
for (const j of view.jobs) {
|
|
7763
7763
|
console.log(`\n ${c.bold(j.title)} ${c.dim(j.what)}`);
|
|
7764
7764
|
const w = Math.max(...j.fields.map((f) => f.key.length));
|
|
@@ -7806,7 +7806,7 @@ async function pauseCmd(flags, verb, what, { post, del }) {
|
|
|
7806
7806
|
// An account resume leaves a workspace paused on its own paused.
|
|
7807
7807
|
const own = Object.keys(r.workspaces ?? {});
|
|
7808
7808
|
const held = still
|
|
7809
|
-
? c.amber(` — but still held: ${still.scope === "account" ? "the account" : "this
|
|
7809
|
+
? c.amber(` — but still held: ${still.scope === "account" ? "the account" : "this project"} is paused (${pauseLine(still)})`)
|
|
7810
7810
|
: own.length
|
|
7811
7811
|
? c.amber(` — but ${own.join(", ")} ${own.length === 1 ? "is" : "are"} paused on ${own.length === 1 ? "its" : "their"} own (\`foldrun workspace resume --to <name>\`)`)
|
|
7812
7812
|
: " — runs start again";
|
|
@@ -7858,7 +7858,7 @@ async function accountCmd(positional, flags) {
|
|
|
7858
7858
|
if (verb === "providers") return providersCmd(url, flags);
|
|
7859
7859
|
if (verb === "telemetry") return telemetryCmd(url, positional.slice(1), flags);
|
|
7860
7860
|
if (verb === "pause" || verb === "resume") {
|
|
7861
|
-
return pauseCmd(flags, verb, "every
|
|
7861
|
+
return pauseCmd(flags, verb, "every project in the account", {
|
|
7862
7862
|
post: (body) => remoteCall(url, flags, "/api/account/pause", { method: "POST", body }),
|
|
7863
7863
|
del: () => remoteCall(url, flags, "/api/account/pause", { method: "DELETE" }),
|
|
7864
7864
|
});
|
|
@@ -7942,7 +7942,7 @@ async function accountCmd(positional, flags) {
|
|
|
7942
7942
|
|
|
7943
7943
|
const answer = await remoteCall(url, flags, "/api/account", { method: "PATCH", body: JSON.stringify(patch) });
|
|
7944
7944
|
printDefaults(answer.defaults ?? {});
|
|
7945
|
-
console.log(`\n ${c.green("✓")} ${verb === "clear" ? `${key} cleared` : `${key} set`} — every
|
|
7945
|
+
console.log(`\n ${c.green("✓")} ${verb === "clear" ? `${key} cleared` : `${key} set`} — every project in this account reads it\n`);
|
|
7946
7946
|
return 0;
|
|
7947
7947
|
}
|
|
7948
7948
|
|
|
@@ -8153,7 +8153,7 @@ async function workspaceOfRun(url, flags, layout, runId) {
|
|
|
8153
8153
|
const names = await remoteWorkspaceNames(url, flags);
|
|
8154
8154
|
const here = takeWorkspace([], layout);
|
|
8155
8155
|
const order = here && names.includes(here) ? [here, ...names.filter((n) => n !== here)] : names;
|
|
8156
|
-
if (!order.length) throw new Error(`no
|
|
8156
|
+
if (!order.length) throw new Error(`no projects on ${url} — \`foldrun workspaces\` lists them`);
|
|
8157
8157
|
|
|
8158
8158
|
const found = await pool(order, 8, async (ws) => {
|
|
8159
8159
|
try {
|
|
@@ -8167,7 +8167,7 @@ async function workspaceOfRun(url, flags, layout, runId) {
|
|
|
8167
8167
|
const hit = found.find(Boolean);
|
|
8168
8168
|
if (!hit) {
|
|
8169
8169
|
throw new Error(
|
|
8170
|
-
`no run "${runId}" in any
|
|
8170
|
+
`no run "${runId}" in any project on ${url} — \`foldrun runs\` lists them, and --to <workspace> looks in one`,
|
|
8171
8171
|
);
|
|
8172
8172
|
}
|
|
8173
8173
|
return hit;
|
|
@@ -8487,7 +8487,7 @@ async function mcpMachineClientsCmd(sub, rest, flags) {
|
|
|
8487
8487
|
...(auth === "private_key_jwt" ? { jwks: JSON.parse(fs.readFileSync(flags["jwks-file"], "utf8")) } : {}),
|
|
8488
8488
|
};
|
|
8489
8489
|
const made = await remoteCall(url, flags, "/api/mcp/clients", { method: "POST", body: JSON.stringify(body) });
|
|
8490
|
-
console.log(`\n ${c.green("✓")} registered ${c.bold(rest[0])} ${c.dim(`(${body.access === "write" ? "read and act" : "read only"} · ${body.role} · ${workspaces ? workspaces.join(", ") : "the
|
|
8490
|
+
console.log(`\n ${c.green("✓")} registered ${c.bold(rest[0])} ${c.dim(`(${body.access === "write" ? "read and act" : "read only"} · ${body.role} · ${workspaces ? workspaces.join(", ") : "the projects you can open"})`)}\n`);
|
|
8491
8491
|
console.log(` client_id ${made.client_id}`);
|
|
8492
8492
|
if (made.client_secret) console.log(` client_secret ${made.client_secret} ${c.amber("— shown once")}`);
|
|
8493
8493
|
console.log(` token URL ${made.token_endpoint}`);
|
|
@@ -8510,7 +8510,7 @@ async function mcpConnectionsCmd(flags) {
|
|
|
8510
8510
|
if (!rows.length) console.log(`\n ${c.dim("none — claude.ai connects itself when you add this platform's /api/mcp as a custom connector")}`);
|
|
8511
8511
|
for (const r of rows) {
|
|
8512
8512
|
const used = r.lastUsedAt ? `last used ${String(r.lastUsedAt).slice(0, 16).replace("T", " ")}` : "not used yet";
|
|
8513
|
-
console.log(`\n ${c.bold(r.client)} ${c.dim(`· ${r.machine ? "machine client" : r.redirectHost} · ${r.access === "read" ? "read only" : "read and act"} · ${r.workspaces ? r.workspaces.join(", ") : "all
|
|
8513
|
+
console.log(`\n ${c.bold(r.client)} ${c.dim(`· ${r.machine ? "machine client" : r.redirectHost} · ${r.access === "read" ? "read only" : "read and act"} · ${r.workspaces ? r.workspaces.join(", ") : "all projects"}`)}${r.revokedAt ? c.red(" · disconnected") : ""}`);
|
|
8514
8514
|
console.log(` ${c.dim(`${r.id} · ${r.person} · connected ${String(r.createdAt).slice(0, 16).replace("T", " ")} · ${used}`)}`);
|
|
8515
8515
|
}
|
|
8516
8516
|
console.log("");
|
|
@@ -8957,7 +8957,7 @@ async function runsCmd(flags, layout) {
|
|
|
8957
8957
|
const names = typeof flags.to === "string" ? [flags.to] : await remoteWorkspaceNames(url, flags);
|
|
8958
8958
|
if (!names.length) {
|
|
8959
8959
|
if (flags.json === true) console.log(JSON.stringify({ runs: [], next: null }, null, 2));
|
|
8960
|
-
else console.log(`\n ${c.dim(`no
|
|
8960
|
+
else console.log(`\n ${c.dim(`no projects on ${url}`)}\n`);
|
|
8961
8961
|
return 0;
|
|
8962
8962
|
}
|
|
8963
8963
|
const limit = Number(flags.limit) > 0 ? Math.floor(Number(flags.limit)) : 20;
|
|
@@ -9550,7 +9550,7 @@ function platformWorkspace(flags, layout, what) {
|
|
|
9550
9550
|
const ws = typeof flags.to === "string" ? flags.to : guess;
|
|
9551
9551
|
if (!ws) {
|
|
9552
9552
|
throw new Error(
|
|
9553
|
-
`which
|
|
9553
|
+
`which project is it in? \`foldrun ${what} --to <workspace>\`${
|
|
9554
9554
|
layout?.workspaces?.length ? ` — this account has ${layout.workspaces.join(", ")}` : ""
|
|
9555
9555
|
}`,
|
|
9556
9556
|
);
|
|
@@ -9949,7 +9949,7 @@ async function hookLsRemote(flags) {
|
|
|
9949
9949
|
continue;
|
|
9950
9950
|
}
|
|
9951
9951
|
const on = (x.onFor ?? []).length ? `on for ${x.onFor.join(", ")}` : "turned on by nobody";
|
|
9952
|
-
const note = x.shadowed ? "(the
|
|
9952
|
+
const note = x.shadowed ? "(the project's own of this name is the one that runs)" : `${on}${x.description ? ` — ${x.description}` : ""}`;
|
|
9953
9953
|
console.log(` ${c.green("✓")} ${c.bold(x.name.padEnd(w))} ${c.dim(where.padEnd(9))} ${String(x.on).padEnd(11)} ${String(x.tool ?? "*").padEnd(12)} ${c.dim(note)}`);
|
|
9954
9954
|
}
|
|
9955
9955
|
}
|
|
@@ -9983,7 +9983,7 @@ async function hookLsCmd(flags, layout) {
|
|
|
9983
9983
|
continue;
|
|
9984
9984
|
}
|
|
9985
9985
|
const what = `${x.on.padEnd(11)} ${(x.tool ?? "*").padEnd(12)}`;
|
|
9986
|
-
const note = x.shadowed ? c.dim("(the
|
|
9986
|
+
const note = x.shadowed ? c.dim("(the project's own of this name is the one that runs)") : c.dim(x.description ?? "");
|
|
9987
9987
|
console.log(` ${c.green("✓")} ${c.bold(x.name.padEnd(w))} ${c.dim(where.padEnd(9))} ${what} ${note}`);
|
|
9988
9988
|
}
|
|
9989
9989
|
console.log(`\n ${c.dim("an agent turns one on with hooks: [name]; AGENTS.md hooks: turns it on for every agent under it")}\n`);
|
|
@@ -10183,9 +10183,9 @@ function localDeskDir(layout, flowName) {
|
|
|
10183
10183
|
const hits = layout.workspaces.filter((ws) => fs.existsSync(path.join(layout.workspacesDir, ws, "flows", `${flowName}.md`)));
|
|
10184
10184
|
if (hits.length === 1) return path.join(layout.workspacesDir, hits[0]);
|
|
10185
10185
|
}
|
|
10186
|
-
throw new Error(`which
|
|
10186
|
+
throw new Error(`which project? --workspace <name> — this account has ${layout.workspaces.join(", ") || "none"} (--to <workspace> edits the deployed copy instead)`);
|
|
10187
10187
|
}
|
|
10188
|
-
throw new Error("this is not a
|
|
10188
|
+
throw new Error("this is not a project — `foldrun init <dir>` makes one, or cd into an existing one (--to <workspace> reaches a deployed one)");
|
|
10189
10189
|
}
|
|
10190
10190
|
|
|
10191
10191
|
/**
|
|
@@ -10705,7 +10705,7 @@ async function agentImportCmd(positional, flags, layout) {
|
|
|
10705
10705
|
return 0;
|
|
10706
10706
|
}
|
|
10707
10707
|
if (!workspaces.length) {
|
|
10708
|
-
console.log(`\n ${c.dim(`nothing to import into ${ws} — no other
|
|
10708
|
+
console.log(`\n ${c.dim(`nothing to import into ${ws} — no other project you can read has an agent`)}\n`);
|
|
10709
10709
|
return 0;
|
|
10710
10710
|
}
|
|
10711
10711
|
const w = Math.max(...workspaces.flatMap((x) => (x.agents ?? []).map((a) => `${x.name}/${a.name}`.length)));
|
|
@@ -10742,7 +10742,7 @@ async function agentImportCmd(positional, flags, layout) {
|
|
|
10742
10742
|
assertName(name);
|
|
10743
10743
|
const src = path.join(layout.workspacesDir, from, "agents", agent);
|
|
10744
10744
|
if (!fs.existsSync(path.join(src, "agent.md"))) {
|
|
10745
|
-
throw new Error(`no agent "${agent}" in ${from} — ${layout.workspaces.includes(from) ? "" : `this account has ${layout.workspaces.join(", ") || "no
|
|
10745
|
+
throw new Error(`no agent "${agent}" in ${from} — ${layout.workspaces.includes(from) ? "" : `this account has ${layout.workspaces.join(", ") || "no projects"}`}`.replace(/ — $/, ""));
|
|
10746
10746
|
}
|
|
10747
10747
|
const target =
|
|
10748
10748
|
typeof flags.workspace === "string"
|
|
@@ -10750,7 +10750,7 @@ async function agentImportCmd(positional, flags, layout) {
|
|
|
10750
10750
|
: layout.workspaceDir && layout.kind !== "empty"
|
|
10751
10751
|
? layout.workspaceDir
|
|
10752
10752
|
: null;
|
|
10753
|
-
if (!target || !fs.existsSync(target)) throw new Error("into which
|
|
10753
|
+
if (!target || !fs.existsSync(target)) throw new Error("into which project? cd into it, or --workspace <name>");
|
|
10754
10754
|
if (path.resolve(target) === path.resolve(path.join(layout.workspacesDir, from)) && name === agent) {
|
|
10755
10755
|
throw new Error(`${agent} is already in ${from} — give the copy another name with --as`);
|
|
10756
10756
|
}
|
|
@@ -10777,7 +10777,7 @@ async function agentImportCmd(positional, flags, layout) {
|
|
|
10777
10777
|
walk(src);
|
|
10778
10778
|
console.log(`\n ${c.green("✓")} ${c.bold(name)} ${c.dim(`from ${from} → ${path.basename(target)}`)}`);
|
|
10779
10779
|
for (const f of written) console.log(` ${c.dim(f)}`);
|
|
10780
|
-
console.log(` ${c.dim("its memory stayed in")} ${from}${c.dim(" — `foldrun check` names any tool, skill or secret it uses that this
|
|
10780
|
+
console.log(` ${c.dim("its memory stayed in")} ${from}${c.dim(" — `foldrun check` names any tool, skill or secret it uses that this project lacks")}\n`);
|
|
10781
10781
|
return 0;
|
|
10782
10782
|
}
|
|
10783
10783
|
|
|
@@ -12088,7 +12088,7 @@ async function importCmd(positional, flags, layout) {
|
|
|
12088
12088
|
console.log(JSON.stringify(plan, null, 2));
|
|
12089
12089
|
return 0;
|
|
12090
12090
|
}
|
|
12091
|
-
console.log(`\n ${c.bold(what)} → ${c.bold(ws)}${plan.creates ? c.dim(" (a new
|
|
12091
|
+
console.log(`\n ${c.bold(what)} → ${c.bold(ws)}${plan.creates ? c.dim(" (a new project)") : ""}`);
|
|
12092
12092
|
console.log(` ${plan.added.length} new · ${plan.unchanged.length} identical · ${plan.overwritten.length ? c.amber(`${plan.overwritten.length} would be replaced`) : "0 replaced"}`);
|
|
12093
12093
|
for (const p of plan.overwritten.slice(0, 20)) console.log(` ${c.amber("~")} ${p}`);
|
|
12094
12094
|
if (plan.skipped?.length) console.log(` ${c.dim(`${plan.skipped.length} not imported (memory, state, or outside the authored folders): ${plan.skipped.slice(0, 6).join(", ")}${plan.skipped.length > 6 ? " …" : ""}`)}`);
|
|
@@ -12465,7 +12465,7 @@ async function observeCmd(flags, layout) {
|
|
|
12465
12465
|
return 0;
|
|
12466
12466
|
}
|
|
12467
12467
|
if (!obs.length) {
|
|
12468
|
-
console.log(`\n ${c.dim(`no
|
|
12468
|
+
console.log(`\n ${c.dim(`no projects on ${url}`)}\n`);
|
|
12469
12469
|
return 0;
|
|
12470
12470
|
}
|
|
12471
12471
|
// Each workspace's completion rate against the window before, from the analysis.
|
|
@@ -12484,7 +12484,7 @@ async function observeCmd(flags, layout) {
|
|
|
12484
12484
|
console.log(` ${o.failedRuns ? c.red("✗") : c.green("✓")} ${c.bold(pad(o.workspace, w))} ${pad(o.runs, 5)} ${o.failedRuns ? c.red(failed) : failed} ${pad(o.steps, 6)} ${pad(`$${o.costUsd.toFixed(2)}`, 6)}${account ? ` ${trend(o.workspace)}` : ""}`);
|
|
12485
12485
|
}
|
|
12486
12486
|
const total = rows.reduce((t, o) => ({ runs: t.runs + o.runs, failed: t.failed + o.failedRuns, cost: t.cost + o.costUsd }), { runs: 0, failed: 0, cost: 0 });
|
|
12487
|
-
console.log(`\n ${c.dim(`${total.runs} runs · ${total.failed} failed · $${total.cost.toFixed(2)} across ${rows.length}
|
|
12487
|
+
console.log(`\n ${c.dim(`${total.runs} runs · ${total.failed} failed · $${total.cost.toFixed(2)} across ${rows.length} project${rows.length === 1 ? "" : "s"}`)}`);
|
|
12488
12488
|
if (account) printAccountAnalysis(account);
|
|
12489
12489
|
const fails = rows.flatMap((o) => (o.failures ?? []).map((f) => ({ ...f, ws: o.workspace }))).sort((a, b) => (a.at < b.at ? 1 : -1)).slice(0, 8);
|
|
12490
12490
|
if (fails.length) {
|
|
@@ -12607,7 +12607,7 @@ function notifyWithout(current, channel, clearAll) {
|
|
|
12607
12607
|
const other = channel === "email" ? "url" : "email";
|
|
12608
12608
|
// A key limited to some workspaces sees the account's URL only as hidden;
|
|
12609
12609
|
// sending the block without it would drop it.
|
|
12610
|
-
if (other === "url" && !n.url && n.hidden) throw new Error("the webhook URL beside it is hidden from this key — clear the email with a key that holds every
|
|
12610
|
+
if (other === "url" && !n.url && n.hidden) throw new Error("the webhook URL beside it is hidden from this key — clear the email with a key that holds every project");
|
|
12611
12611
|
if (!n[other]) throw new Error(`the ${channel === "url" ? "webhook URL" : "email"} is notify's only channel — \`${clearAll}\` turns notify off`);
|
|
12612
12612
|
return { [other]: n[other], events: Array.isArray(n.events) && n.events.length ? n.events : ["failed", "awaiting-approval"] };
|
|
12613
12613
|
}
|
|
@@ -12780,7 +12780,7 @@ async function usageComputeCmd(flags) {
|
|
|
12780
12780
|
// must fit every level it belongs to.
|
|
12781
12781
|
const wss = Array.isArray(d.workspaces) ? d.workspaces.filter((w) => w.inUse?.steps || w.pool?.vcpu != null || w.pool?.memGiB != null || w.pool?.diskGiB != null) : [];
|
|
12782
12782
|
if (wss.length) {
|
|
12783
|
-
console.log(`\n ${c.bold("
|
|
12783
|
+
console.log(`\n ${c.bold("projects")} ${c.dim("each one's own pool, inside the account's")}`);
|
|
12784
12784
|
const width = Math.max(...wss.map((w) => w.workspace.length));
|
|
12785
12785
|
for (const w of wss) console.log(` ${pad(w.workspace, width)} ${held(w.inUse ?? {}, w.pool)}`);
|
|
12786
12786
|
}
|
|
@@ -13019,7 +13019,7 @@ async function workspaceCmd(positional, flags, layout) {
|
|
|
13019
13019
|
del: () => remoteCall(url, flags, `/api/workspaces/${enc(ws)}/pause`, { method: "DELETE" }),
|
|
13020
13020
|
});
|
|
13021
13021
|
}
|
|
13022
|
-
if (verb !== "set" && verb !== "clear") throw new Error(`unknown
|
|
13022
|
+
if (verb !== "set" && verb !== "clear") throw new Error(`unknown project verb "${verb}" — set <key> <value>, clear <key>, pause, resume (bare: show them)`);
|
|
13023
13023
|
if (!KEYS.includes(key) || (verb === "clear" && key === "name")) {
|
|
13024
13024
|
throw new Error(`which setting? \`foldrun workspace ${verb} <${(verb === "clear" ? KEYS.filter((k) => k !== "name") : KEYS).join("|")}> … --to <workspace>\``);
|
|
13025
13025
|
}
|
|
@@ -13054,7 +13054,7 @@ async function workspaceCmd(positional, flags, layout) {
|
|
|
13054
13054
|
|
|
13055
13055
|
if (key === "name" && verb === "set") {
|
|
13056
13056
|
console.log(`\n ${c.yellow("!")} renaming ${c.bold(ws)} to ${c.bold(patch.name)} changes every webhook URL it has — anything posting to the old ones is refused`);
|
|
13057
|
-
if (!(await confirmed(flags, "renaming a
|
|
13057
|
+
if (!(await confirmed(flags, "renaming a project", "Rename it? [y/N] "))) {
|
|
13058
13058
|
console.log(`\n ${c.dim("nothing renamed")}\n`);
|
|
13059
13059
|
return 1;
|
|
13060
13060
|
}
|
|
@@ -13066,7 +13066,7 @@ async function workspaceCmd(positional, flags, layout) {
|
|
|
13066
13066
|
console.log(`\n ${c.green("✓")} ${r.renamed ? `renamed to ${r.name}` : verb === "clear" ? `${key} cleared` : `${key} set`} ${c.dim(`on ${r.name ?? ws}`)}`);
|
|
13067
13067
|
// FOL-105: "off" here only drops this file's own true — the account's on
|
|
13068
13068
|
// still refuses, and a ✓ alone read as if runs here were now allowed.
|
|
13069
|
-
if (turnedOff && aboveOn) console.log(` ${c.amber("!")} still refused here: the account enforces network_enforce — \`foldrun account set network_enforce off\` turns it off for every
|
|
13069
|
+
if (turnedOff && aboveOn) console.log(` ${c.amber("!")} still refused here: the account enforces network_enforce — \`foldrun account set network_enforce off\` turns it off for every project`);
|
|
13070
13070
|
if (r.brokeWebhooks?.length) console.log(` ${c.amber("!")} webhook URLs changed for ${r.brokeWebhooks.join(", ")} — copy the new ones from each flow`);
|
|
13071
13071
|
console.log();
|
|
13072
13072
|
return 0;
|
|
@@ -13074,7 +13074,7 @@ async function workspaceCmd(positional, flags, layout) {
|
|
|
13074
13074
|
|
|
13075
13075
|
/** `foldrun notify test --to <workspace>` — send one, and say what happened. */
|
|
13076
13076
|
async function notifyCmd(positional, flags, layout) {
|
|
13077
|
-
if (positional[0] !== "test") throw new Error("`foldrun notify test --to <workspace>` — sends one test notification to whatever that
|
|
13077
|
+
if (positional[0] !== "test") throw new Error("`foldrun notify test --to <workspace>` — sends one test notification to whatever that project's notify: resolves to");
|
|
13078
13078
|
const url = platformFor(flags, "notify test");
|
|
13079
13079
|
const ws = platformWorkspace(flags, layout, "notify test");
|
|
13080
13080
|
const r = await remoteCall(url, flags, `/api/workspaces/${enc(ws)}/notify/test`, { method: "POST" });
|
|
@@ -13156,7 +13156,7 @@ async function notificationsCmd(positional, flags) {
|
|
|
13156
13156
|
if (positional[0] === "set") {
|
|
13157
13157
|
const [, category, value] = positional;
|
|
13158
13158
|
if (!category || !["on", "off"].includes(value ?? "")) {
|
|
13159
|
-
throw new Error("`foldrun notifications set <category> on|off` (--to <workspace> for one
|
|
13159
|
+
throw new Error("`foldrun notifications set <category> on|off` (--to <workspace> for one project) — `foldrun notifications` lists the categories");
|
|
13160
13160
|
}
|
|
13161
13161
|
const body = { category, enabled: value === "on", ...(typeof flags.to === "string" ? { workspace: flags.to } : {}) };
|
|
13162
13162
|
const r = await remoteCall(url, flags, "/api/me/notifications", { method: "PATCH", body: JSON.stringify(body) });
|
|
@@ -13308,7 +13308,7 @@ async function historyCmd(positional, flags, layout) {
|
|
|
13308
13308
|
async function onboardingCmd(flags) {
|
|
13309
13309
|
const url = platformFor(flags, "onboarding");
|
|
13310
13310
|
const ws = typeof flags.to === "string" && flags.to ? flags.to : null;
|
|
13311
|
-
if (flags.to !== undefined && !ws) throw new Error("`foldrun onboarding --to <workspace>` — name the
|
|
13311
|
+
if (flags.to !== undefined && !ws) throw new Error("`foldrun onboarding --to <workspace>` — name the project whose checklist you want");
|
|
13312
13312
|
const o = await remoteCall(url, flags, `/api/me/onboarding${ws ? `?workspace=${encodeURIComponent(ws)}` : ""}`);
|
|
13313
13313
|
if (flags.json === true) {
|
|
13314
13314
|
console.log(JSON.stringify(o, null, 2));
|
|
@@ -13364,7 +13364,7 @@ async function backupsCmd(positional, flags) {
|
|
|
13364
13364
|
note: typeof flags.note === "string" ? flags.note : null,
|
|
13365
13365
|
};
|
|
13366
13366
|
const { request } = await remoteCall(url, flags, "/api/account/backups/requests", { method: "POST", body: JSON.stringify(body) });
|
|
13367
|
-
console.log(`\n ${c.green("✓")} asked ${c.dim(`· ${request.id} · ${what} in ${request.workspace ?? "every
|
|
13367
|
+
console.log(`\n ${c.green("✓")} asked ${c.dim(`· ${request.id} · ${what} in ${request.workspace ?? "every project"} as at ${request.target}`)}`);
|
|
13368
13368
|
console.log(` ${request.notified ? c.dim("the platform team has been emailed; nothing is restored until they do it") : c.yellow("recorded, but the email to the platform team did not send — contact them as well")}\n`);
|
|
13369
13369
|
return 0;
|
|
13370
13370
|
}
|
|
@@ -13382,7 +13382,7 @@ async function backupsCmd(positional, flags) {
|
|
|
13382
13382
|
}
|
|
13383
13383
|
console.log();
|
|
13384
13384
|
for (const r of requests) {
|
|
13385
|
-
console.log(` ${when(r.at)} ${c.bold(r.status)} ${r.what} · ${r.workspace ?? "every
|
|
13385
|
+
console.log(` ${when(r.at)} ${c.bold(r.status)} ${r.what} · ${r.workspace ?? "every project"} · to ${r.target} ${c.dim(`${r.id} · ${r.by}${r.notified ? "" : " · platform team not emailed"}`)}`);
|
|
13386
13386
|
if (r.note) console.log(` ${c.dim(firstLine(r.note, 100))}`);
|
|
13387
13387
|
}
|
|
13388
13388
|
console.log(`\n ${c.dim(`${requests.length} request${requests.length === 1 ? "" : "s"} · the platform team restores; nothing here changes until they do`)}\n`);
|
|
@@ -13408,7 +13408,7 @@ async function backupsCmd(positional, flags) {
|
|
|
13408
13408
|
}
|
|
13409
13409
|
}
|
|
13410
13410
|
if (b.workspaces?.length) {
|
|
13411
|
-
console.log(`\n ${c.dim("restore a
|
|
13411
|
+
console.log(`\n ${c.dim("restore a project's source yourself — foldrun restore <workspace> --to <revision|time|3d> --dry-run")}`);
|
|
13412
13412
|
const w = Math.max(...b.workspaces.map((x) => x.name.length));
|
|
13413
13413
|
for (const x of b.workspaces) {
|
|
13414
13414
|
console.log(` ${pad(x.name, w)} ${x.lastChange ? c.dim(`last change ${when(x.lastChange.at)} — ${firstLine(x.lastChange.message, 50)}`) : c.dim("no history yet")}`);
|
|
@@ -13487,7 +13487,7 @@ async function accountExportCmd(url, flags) {
|
|
|
13487
13487
|
const code = writeDownload(got.bytes, got.name ?? "foldrun-export.json", flags, "the account");
|
|
13488
13488
|
try {
|
|
13489
13489
|
const x = JSON.parse(got.bytes.toString("utf8"));
|
|
13490
|
-
if (flags.file !== "-") console.log(` ${c.dim(`${x.workspaces?.length ?? 0}
|
|
13490
|
+
if (flags.file !== "-") console.log(` ${c.dim(`${x.workspaces?.length ?? 0} projects · ${x.runs?.length ?? 0} runs · ${x.members?.length ?? 0} members · ${x.ledger?.length ?? 0} ledger lines — the markdown itself comes down with \`foldrun pull\``)}\n`);
|
|
13491
13491
|
} catch {
|
|
13492
13492
|
/* the file is written; the counts are a courtesy */
|
|
13493
13493
|
}
|
|
@@ -14039,7 +14039,7 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14039
14039
|
|
|
14040
14040
|
const ask = async (text) => {
|
|
14041
14041
|
messages.push({ role: "user", content: text });
|
|
14042
|
-
if (!flags.json) console.log(`\n ${c.dim("reading the docs and the
|
|
14042
|
+
if (!flags.json) console.log(`\n ${c.dim("reading the docs and the project — one reply, charged like a step…")}`);
|
|
14043
14043
|
let d;
|
|
14044
14044
|
try {
|
|
14045
14045
|
d = await remoteCall(
|
|
@@ -14073,7 +14073,7 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14073
14073
|
const share = u.cacheReadTokens !== undefined && u.inputTokens > 0 ? ` (${Math.round((u.cacheReadTokens / u.inputTokens) * 100)}% cached)` : "";
|
|
14074
14074
|
console.log(` ${c.dim(`${k(u.inputTokens)} tokens in${share} · ${k(u.outputTokens)} out${paid ? ` · ${paid}` : ""}`)}\n`);
|
|
14075
14075
|
}
|
|
14076
|
-
if (proposedWs) console.log(` ${c.bold("new
|
|
14076
|
+
if (proposedWs) console.log(` ${c.bold("new project")} ${proposedWs.name} ${c.dim(`— ${proposedWs.purpose}`)}\n`);
|
|
14077
14077
|
await showFiles();
|
|
14078
14078
|
};
|
|
14079
14079
|
|
|
@@ -14086,7 +14086,7 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14086
14086
|
* @param {{ name: string, purpose: string }} p */
|
|
14087
14087
|
const createProposed = async (p) => {
|
|
14088
14088
|
const name = p.name;
|
|
14089
|
-
if (!(await confirmed(flags, "assistant", `Create the
|
|
14089
|
+
if (!(await confirmed(flags, "assistant", `Create the project ${name}? [y/N] `))) {
|
|
14090
14090
|
console.log(`\n ${c.dim("not created")}\n`);
|
|
14091
14091
|
return false;
|
|
14092
14092
|
}
|
|
@@ -14096,7 +14096,7 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14096
14096
|
await remoteCall(url, flags, "/api/workspaces", { method: "POST", body: JSON.stringify({ name, template: true, ifAbsent: true }) });
|
|
14097
14097
|
} catch (err) {
|
|
14098
14098
|
if (err instanceof HttpError && err.status === 409) {
|
|
14099
|
-
console.log(` ${c.red("✗")} a
|
|
14099
|
+
console.log(` ${c.red("✗")} a project called ${name} exists — nothing created\n`);
|
|
14100
14100
|
return false;
|
|
14101
14101
|
}
|
|
14102
14102
|
throw err;
|
|
@@ -14136,11 +14136,11 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14136
14136
|
const p = proposal();
|
|
14137
14137
|
if (p && !flags.json) {
|
|
14138
14138
|
if (flags["dry-run"] === true) {
|
|
14139
|
-
console.log(` ${c.dim("--dry-run: no
|
|
14139
|
+
console.log(` ${c.dim("--dry-run: no project created")}\n`);
|
|
14140
14140
|
return 0;
|
|
14141
14141
|
}
|
|
14142
14142
|
if (flags.yes !== true && !process.stdin.isTTY) {
|
|
14143
|
-
console.log(` ${c.dim(`not a terminal to ask — no
|
|
14143
|
+
console.log(` ${c.dim(`not a terminal to ask — no project created; run it again with --yes, or create it with \`foldrun new ${p.name}\` and deploy`)}\n`);
|
|
14144
14144
|
return 1;
|
|
14145
14145
|
}
|
|
14146
14146
|
const made = await createProposed(p);
|
|
@@ -14213,9 +14213,9 @@ async function assistantCmd(positional, flags, layout) {
|
|
|
14213
14213
|
ws = made;
|
|
14214
14214
|
files = [];
|
|
14215
14215
|
issues = [];
|
|
14216
|
-
messages.push({ role: "assistant", content: `Created the
|
|
14216
|
+
messages.push({ role: "assistant", content: `Created the project \`${made}\`.` });
|
|
14217
14217
|
console.log(` ${c.dim(`now working in ${made}`)}`);
|
|
14218
|
-
await ask(`The
|
|
14218
|
+
await ask(`The project "${made}" now exists and you are working in it. Carry on with what I asked for: write its agents, flows, tools and skills.`);
|
|
14219
14219
|
}
|
|
14220
14220
|
}
|
|
14221
14221
|
} catch (err) {
|
|
@@ -14331,7 +14331,7 @@ async function libraryCmd(positional, flags) {
|
|
|
14331
14331
|
else if (process.stdin.isTTY) throw new Error("what goes in it? --file <path>, or pipe it in");
|
|
14332
14332
|
else content = fs.readFileSync(0, "utf8");
|
|
14333
14333
|
await remoteCall(url, flags, `/api/library/${kind}`, { method: "PUT", body: JSON.stringify({ path: rel, content }) });
|
|
14334
|
-
console.log(`\n ${c.green("✓")} library/${kind}/${rel} ${c.dim(`${humanBytes(Buffer.byteLength(content))} — every
|
|
14334
|
+
console.log(`\n ${c.green("✓")} library/${kind}/${rel} ${c.dim(`${humanBytes(Buffer.byteLength(content))} — every project in the account sees it`)}\n`);
|
|
14335
14335
|
return 0;
|
|
14336
14336
|
}
|
|
14337
14337
|
if (verb === "new") {
|
|
@@ -14342,12 +14342,12 @@ async function libraryCmd(positional, flags) {
|
|
|
14342
14342
|
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(name)) throw new Error(`"${name}" is not a name — kebab-case only, e.g. skills/house-style`);
|
|
14343
14343
|
const body = { name, ...(typeof flags.template === "string" ? { template: flags.template } : {}), ...(typeof flags.language === "string" ? { language: flags.language } : {}) };
|
|
14344
14344
|
const r = await remoteCall(url, flags, `/api/library/${kind}`, { method: "POST", body: JSON.stringify(body) });
|
|
14345
|
-
console.log(`\n ${c.green("✓")} library/${kind}/${r.path ?? name} ${c.dim("— every
|
|
14345
|
+
console.log(`\n ${c.green("✓")} library/${kind}/${r.path ?? name} ${c.dim("— every project in the account sees it")}\n`);
|
|
14346
14346
|
return 0;
|
|
14347
14347
|
}
|
|
14348
14348
|
if (verb === "rm") {
|
|
14349
14349
|
const { kind, rel } = split(spec);
|
|
14350
|
-
if (!(await sureToDelete(flags, "library rm", `library/${kind}/${rel} — every
|
|
14350
|
+
if (!(await sureToDelete(flags, "library rm", `library/${kind}/${rel} — every project that names it loses it`))) return 1;
|
|
14351
14351
|
await remoteCall(url, flags, `/api/library/${kind}`, { method: "DELETE", body: JSON.stringify({ path: rel }) });
|
|
14352
14352
|
console.log(`\n ${c.green("✓")} removed library/${kind}/${rel}\n`);
|
|
14353
14353
|
return 0;
|
|
@@ -14640,7 +14640,7 @@ async function billingPlansCmd(verb, sub, flags) {
|
|
|
14640
14640
|
console.log(`\n ${c.bold("plans")} ${c.dim(`one credit is ${usd(p.creditUsd)}${cur?.plan ? ` · on ${cur.plan} (${cur.status})` : " · Free: 300 credits a month, bought credits on top"}`)}`);
|
|
14641
14641
|
for (const x of p.plans ?? []) {
|
|
14642
14642
|
const mark = cur?.plan === x.id ? c.green("●") : c.dim("○");
|
|
14643
|
-
console.log(` ${mark} ${c.bold(pad(x.id, 8))} ${pad(`$${x.monthlyUsd}/mo`, 9)} ${pad(`${Number(x.credits).toLocaleString()} credits`, 16)} ${pad(`${x.storageGb ?? "?"} GB`, 8)} ${pad(`${x.vcpu ?? "?"} vCPU · ${x.memGiB ?? "?"} GiB`, 16)} ${pad(x.workspaces == null ? "any
|
|
14643
|
+
console.log(` ${mark} ${c.bold(pad(x.id, 8))} ${pad(`$${x.monthlyUsd}/mo`, 9)} ${pad(`${Number(x.credits).toLocaleString()} credits`, 16)} ${pad(`${x.storageGb ?? "?"} GB`, 8)} ${pad(`${x.vcpu ?? "?"} vCPU · ${x.memGiB ?? "?"} GiB`, 16)} ${pad(x.workspaces == null ? "any projects" : `${x.workspaces} workspaces`, 15)} ${c.dim(x.pitch ?? "")}`);
|
|
14644
14644
|
}
|
|
14645
14645
|
if (cur?.plan) console.log(`\n ${c.dim(`this cycle: ${cur.cycleRemainingCredits ?? "?"} of ${cur.cycleCredits ?? "?"} credits left${cur.resetsAt ? `, resets ${String(cur.resetsAt).slice(0, 10)}` : ""}`)}`);
|
|
14646
14646
|
console.log(` ${c.dim(`balance ${usd(p.balanceUsd)}${p.cards ? "" : " · card payments are not configured on this install"}`)}`);
|
|
@@ -14713,7 +14713,7 @@ async function apiVersionCmd(positional, flags) {
|
|
|
14713
14713
|
console.log(`\n ${c.bold("API version")} ${v.effective} ${c.dim(v.pinned ? `pinned (current is ${v.current})` : "current — not pinned")}`);
|
|
14714
14714
|
console.log(` ${c.dim(`served: ${(v.supported ?? []).join(", ") || "—"} · each for ${v.supportMonths ?? "?"} months after the next · this CLI sends ${API_VERSION}`)}`);
|
|
14715
14715
|
if (l.perCredential) console.log(` ${c.bold("rate limits")} ${c.dim(`${l.plan} · per key ${l.perCredential.read} reads / ${l.perCredential.write} writes, per account ${l.perAccount?.read} / ${l.perAccount?.write} — every ${l.windowSeconds}s`)}`);
|
|
14716
|
-
if (facts.usageHidden) console.log(` ${c.bold("your use")} ${c.dim("shown only to a member or key with every
|
|
14716
|
+
if (facts.usageHidden) console.log(` ${c.bold("your use")} ${c.dim("shown only to a member or key with every project")}`);
|
|
14717
14717
|
else apiUsageLines(facts.usage);
|
|
14718
14718
|
console.log(`\n ${c.dim("foldrun api version pin YYYY-MM-DD · unpin")}\n`);
|
|
14719
14719
|
return 0;
|
|
@@ -14937,7 +14937,7 @@ async function findCmd(positional, flags) {
|
|
|
14937
14937
|
*/
|
|
14938
14938
|
async function workspacesShowCmd(name, flags) {
|
|
14939
14939
|
const url = platformFor(flags, "workspaces show");
|
|
14940
|
-
if (!name) throw new Error("which
|
|
14940
|
+
if (!name) throw new Error("which project? `foldrun workspaces show <name>`");
|
|
14941
14941
|
const r = await remoteCall(url, flags, `/api/workspaces/${enc(name)}`);
|
|
14942
14942
|
if (flags.json === true) {
|
|
14943
14943
|
console.log(JSON.stringify(r, null, 2));
|
|
@@ -15024,7 +15024,7 @@ async function teamCmd(positional, flags) {
|
|
|
15024
15024
|
const w = Math.max(...members.map((m) => m.email.length));
|
|
15025
15025
|
console.log();
|
|
15026
15026
|
for (const m of members) {
|
|
15027
|
-
const scope = m.workspaces === null || m.workspaces === undefined ? "every
|
|
15027
|
+
const scope = m.workspaces === null || m.workspaces === undefined ? "every project" : m.workspaces.length ? m.workspaces.join(", ") : "no projects";
|
|
15028
15028
|
console.log(` ${c.bold(pad(m.email, w))} ${pad(m.owner ? "owner" : m.role, 7)} ${c.dim(scope)} ${c.dim(m.createdAt ? `joined ${String(m.createdAt).slice(0, 10)}` : "")}`);
|
|
15029
15029
|
}
|
|
15030
15030
|
console.log(`\n ${c.dim(`${members.length} member${members.length === 1 ? "" : "s"} · foldrun team invite | role | access | remove (your own \`foldrun login\`, never a key made by hand)`)}\n`);
|
|
@@ -15052,7 +15052,7 @@ async function memberNamed(url, flags, who, verb) {
|
|
|
15052
15052
|
return m;
|
|
15053
15053
|
}
|
|
15054
15054
|
|
|
15055
|
-
const SCOPE_TEXT = (w) => (w === null || w === undefined ? "every
|
|
15055
|
+
const SCOPE_TEXT = (w) => (w === null || w === undefined ? "every project" : w.length ? w.join(", ") : "no projects");
|
|
15056
15056
|
|
|
15057
15057
|
/**
|
|
15058
15058
|
* `foldrun team invite [email] [--role viewer|editor|admin] [--workspaces
|
|
@@ -15066,7 +15066,7 @@ async function teamInviteCmd(positional, flags) {
|
|
|
15066
15066
|
const email = positional[0];
|
|
15067
15067
|
const role = typeof flags.role === "string" ? flags.role : "editor";
|
|
15068
15068
|
if (!["viewer", "editor", "admin"].includes(role)) throw new Error("--role is viewer, editor or admin (owner is transferred, in the browser)");
|
|
15069
|
-
if (flags.none === true) throw new Error("an invite opens some
|
|
15069
|
+
if (flags.none === true) throw new Error("an invite opens some projects: --workspaces <names>, or --all for every one");
|
|
15070
15070
|
const workspaces = memberScopeFlag(flags);
|
|
15071
15071
|
const body = { role, ...(workspaces !== undefined ? { workspaces } : {}), ...(email ? { email } : {}), ...(flags["no-send"] === true ? { send: false } : {}) };
|
|
15072
15072
|
const r = await remoteCall(url, flags, "/api/team", { method: "POST", body: JSON.stringify(body) });
|
|
@@ -15106,7 +15106,7 @@ async function teamRoleCmd(positional, flags) {
|
|
|
15106
15106
|
async function teamAccessCmd(positional, flags) {
|
|
15107
15107
|
const url = platformFor(flags, "team access");
|
|
15108
15108
|
const workspaces = memberScopeFlag(flags);
|
|
15109
|
-
if (workspaces === undefined) throw new Error("which
|
|
15109
|
+
if (workspaces === undefined) throw new Error("which projects? `foldrun team access <email|id> --workspaces a,b` (or --all, or --none)");
|
|
15110
15110
|
const m = await memberNamed(url, flags, positional[0], "access");
|
|
15111
15111
|
const r = await remoteCall(url, flags, `/api/team/members/${enc(m.id)}`, { method: "PATCH", body: JSON.stringify({ workspaces }) });
|
|
15112
15112
|
if (flags.json === true) {
|
|
@@ -15220,7 +15220,7 @@ async function teamInvitesCmd(positional, flags) {
|
|
|
15220
15220
|
const w = Math.max(...invites.map((i) => label(i).length));
|
|
15221
15221
|
console.log();
|
|
15222
15222
|
for (const i of invites) {
|
|
15223
|
-
const scope = i.workspaces === null || i.workspaces === undefined ? "every
|
|
15223
|
+
const scope = i.workspaces === null || i.workspaces === undefined ? "every project" : i.workspaces.length ? i.workspaces.join(", ") : "no projects";
|
|
15224
15224
|
const state = i.status === "pending" ? `expires ${when(i.expiresAt)}` : i.status;
|
|
15225
15225
|
console.log(` ${c.bold(pad(label(i), w))} ${pad(i.role, 6)} ${c.dim(scope)} ${c.dim(`by ${i.invitedBy} · ${state}`)} ${c.dim(i.id)}`);
|
|
15226
15226
|
}
|
|
@@ -15817,7 +15817,7 @@ async function usageBudgetCmd(flags) {
|
|
|
15817
15817
|
const d = await remoteCall(url, flags, "/api/usage/budget");
|
|
15818
15818
|
const ws = typeof flags.to === "string" ? flags.to : null;
|
|
15819
15819
|
const rows = (Array.isArray(d.workspaces) ? d.workspaces : []).filter((w) => !ws || w.workspace === ws);
|
|
15820
|
-
if (ws && !rows.length) throw new Error(`no
|
|
15820
|
+
if (ws && !rows.length) throw new Error(`no project "${ws}" among the ones this credential may open`);
|
|
15821
15821
|
if (flags.json === true) {
|
|
15822
15822
|
console.log(JSON.stringify(ws ? { workspaces: rows } : d, null, 2));
|
|
15823
15823
|
return 0;
|
|
@@ -15838,13 +15838,13 @@ async function usageBudgetCmd(flags) {
|
|
|
15838
15838
|
console.log();
|
|
15839
15839
|
if (!ws) {
|
|
15840
15840
|
if (d.account) console.log(` ${c.bold("account")} ${line(d.account)}`);
|
|
15841
|
-
else if (d.accountHidden) console.log(` ${c.bold("account")} ${c.dim("shown only to a member or key with every
|
|
15841
|
+
else if (d.accountHidden) console.log(` ${c.bold("account")} ${c.dim("shown only to a member or key with every project — it is spend over all of them")}`);
|
|
15842
15842
|
}
|
|
15843
15843
|
if (rows.length) {
|
|
15844
15844
|
const width = Math.max(...rows.map((w) => w.workspace.length));
|
|
15845
|
-
if (!ws) console.log(`\n ${c.bold("
|
|
15845
|
+
if (!ws) console.log(`\n ${c.bold("projects")} ${c.dim("most spent first")}`);
|
|
15846
15846
|
for (const w of rows) console.log(` ${pad(w.workspace, width)} ${line(w)}`);
|
|
15847
|
-
} else console.log(` ${c.dim("no
|
|
15847
|
+
} else console.log(` ${c.dim("no projects yet")}`);
|
|
15848
15848
|
console.log(`\n ${c.dim("set a cap: foldrun account set budget 500 · foldrun workspace set budget 60/day --to <ws>")}\n`);
|
|
15849
15849
|
return 0;
|
|
15850
15850
|
}
|
|
@@ -15884,7 +15884,7 @@ async function billingInvoicesCmd(flags) {
|
|
|
15884
15884
|
d = await remoteCall(url, flags, "/api/billing/invoices");
|
|
15885
15885
|
} catch (err) {
|
|
15886
15886
|
if (err instanceof HttpError && err.status === 404) throw new Error(`${new URL(url).host} has no billing — invoices are the hosted platform's (or it runs a platform from before 5 Nov 2026)`);
|
|
15887
|
-
if (err instanceof HttpError && err.status === 403) throw new Error(`invoices need a member or key with every
|
|
15887
|
+
if (err instanceof HttpError && err.status === 403) throw new Error(`invoices need a member or key with every project — ${err.message}`);
|
|
15888
15888
|
throw err;
|
|
15889
15889
|
}
|
|
15890
15890
|
if (flags.json === true) {
|
|
@@ -16028,7 +16028,7 @@ export async function run(command, positional, flags, workspace, layout) {
|
|
|
16028
16028
|
if (typeof flags.to === "string") return remoteEvalsCmd(positional[0], flags, layout);
|
|
16029
16029
|
// --last reads the platform's results; a local eval has none to read,
|
|
16030
16030
|
// and running the cases instead would break its promise to run nothing.
|
|
16031
|
-
if (flags.last === true || flags.run !== undefined) throw new Error("--last and --run read a deployed
|
|
16031
|
+
if (flags.last === true || flags.run !== undefined) throw new Error("--last and --run read a deployed project's results — add --to <workspace>");
|
|
16032
16032
|
needsOne(layout, "eval");
|
|
16033
16033
|
return runEvals(positional[0], flags);
|
|
16034
16034
|
case "promote":
|
|
@@ -16060,7 +16060,7 @@ export async function run(command, positional, flags, workspace, layout) {
|
|
|
16060
16060
|
return historyCmd(positional, flags, layout);
|
|
16061
16061
|
case "repo":
|
|
16062
16062
|
// The platform's own git went on 17 Oct 2026.
|
|
16063
|
-
throw new Error("`foldrun repo` is gone with the platform's own git — `foldrun history` lists a
|
|
16063
|
+
throw new Error("`foldrun repo` is gone with the platform's own git — `foldrun history` lists a project's revisions and `foldrun restore <ws> --to <revision|time|age>` rolls back");
|
|
16064
16064
|
case "restore":
|
|
16065
16065
|
return restoreCmd(positional, flags);
|
|
16066
16066
|
case "backups":
|