Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 155 to 156

Compare

+12 −25 in 5 places
Lines 3–12 at 156 (were 3–14 at 155)
33// when one fails. Neither prints a credential. plainError words the commonest failures the same way.
44
55import { ApiError } from "./api-error.ts";
6−import { UsageError } from "./args.ts";
76import { type Answer, type BoxRecord, boxGet, boxText, originOf, readBox, signedInServers } from "./box.ts";
87import { builtCopy } from "./client-version.ts";
98import { type Config, credentialLabel, findRoot, readConfig } from "./config.ts";
10−import { TOKEN_SERVERS } from "./core.ts";
11−import { fromEnv } from "./env-names.ts";
9+import { sameServer } from "./server-choice.ts";
1210
1311/** The lowest Node major each kind of copy runs on: the npm package is built for 20, a checkout runs its .ts as is. */
1412export function nodeNeeded(built: boolean): number {
Lines 41–53 at 156 (were 43–67 at 155)
4341}
4442
4543/**
46− * The server whoami and doctor look at, in the order join picks one: --server, then ABSO_SERVER, then this
47− * folder's server, then the one this box signed in to with abso login, then https://api.abso.dev. A box signed
48− * in to more than one server has to say which.
44+ * The servers other than `server` this box is signed in to, as one sentence for a refusal or a report to end
45+ * with, naming how to use one: a box signed in elsewhere is never used for `server` by itself.
4946 */
50−export function checkServer(
51− flag: string | undefined,
52− cwd: string,
53− env: Readonly<Record<string, string | undefined>>,
54− home?: string,
55− now = Date.now(),
56−): string {
57− const named = flag ?? fromEnv(env, "SERVER");
58− if (named) return named;
59− const folder = folderOf(cwd, env)?.config?.server;
60− if (folder) return folder;
61− const signedIn = signedInServers(home, now);
62− if (signedIn.length > 1)
63− throw new UsageError(`this box is signed in to ${signedIn.join(" and ")}: say which with --server <url>`);
64− return signedIn[0] ?? TOKEN_SERVERS[0]!;
47+export function elsewhereText(server: string, command: string, home?: string, now = Date.now()): string {
48+ const others = signedInServers(home, now).filter((s) => !sameServer(s, originOf(server)));
49+ if (others.length === 0) return "";
50+ return ` This box is signed in to ${others.join(" and ")}: ${command} --server <url> uses ${others.length === 1 ? "it" : "one"}.`;
6551}
6652
6753const day = (ms: number) => new Date(ms).toISOString().slice(0, 16).replace("T", " ");
Lines 88–96 at 156 (were 102–108 at 155)
10288 const record = readBox(server, probe.home);
10389 let box: Record<string, unknown> | null = null;
10490 if (!record) {
105− lines.push(`This box isn't signed in to ${originOf(server)}. Run abso login.`);
91+ lines.push(
92+ `This box isn't signed in to ${originOf(server)}. Run abso login.${elsewhereText(server, "abso whoami", probe.home, probe.now)}`,
93+ );
10694 } else {
10795 const answer = await serverBox(record, probe);
10896 const [first, ...rest] = boxText(record, server, probe.now).split("\n");
Lines 143–148 at 156 (were 155–161 at 155)
155143 cwd: string,
156144 env: Readonly<Record<string, string | undefined>>,
157145 probe: Probe,
158− explicit = false,
159146): Promise<Check[]> {
160147 const checks: Check[] = [];
161148 const need = nodeNeeded(probe.built);
Lines 158–165 at 156 (were 171–178 at 155)
171158 );
172159
173160 const folder = folderOf(cwd, env);
174− // The folder's own server when there is one (it's the one its commands talk to), unless --server named one.
175− const target = explicit ? server : (folder?.config?.server ?? server);
161+ // Chosen as every command chooses (server-choice.ts): --server, else the folder's own, else ABSO_SERVER, else prod.
162+ const target = server;
176163 const origin = originOf(target);
177164 let reachable = false;
178165 const started = Date.now();
MCP
compare on this site's /mcp
CLI
abso diff 155 156 client/src/doctor.ts --json
JSON
/christopher/abso-core/compare/155..156?file=client%2Fsrc%2Fdoctor.ts&format=json