Versions 116 to 318
Lines 3–17 at 318 (were 3–16 at 116)
33// when one fails. Neither prints a credential. plainError words the commonest failures the same way.
44
6−import { UsageError } from "./args.ts";
76import { type Answer, type BoxRecord, boxGet, boxText, originOf, readBox, signedInServers } from "./box.ts";
9−import { type Config, credentialLabel, findRoot, readConfig } from "./config.ts";
10−import { TOKEN_SERVERS } from "./core.ts";
11−import { fromEnv } from "./env-names.ts";
1210
13−/** The lowest Node major each kind of copy runs on: the npm package is built for 20, a checkout runs its .ts as is. */
12+ * The lowest Node major each kind of copy runs on: a built one (the npm package, or a checkout's client/bin/abso.mjs)
13+ * is built for 20; a checkout's client/abso.ts runs its .ts as is, which takes Node's type stripping.
Lines 26–38 at 318 (were 25–31 at 116)
2627
28− return { fetcher: fetch, now: Date.now(), node: process.versions.node, built: builtCopy() };
29+ // Bundled, this module is client/bin/abso.mjs (or the npm package's file); from client/abso.ts, it is this .ts.
3037
Lines 50–62 at 318 (were 43–67 at 116)
4451
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.
53+ * The servers other than `server` this box is signed in to, as one sentence for a refusal or a report to end
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]!;
56+export function elsewhereText(server: string, command: string, home?: string, now = Date.now()): string {
59+ return ` This box is signed in to ${others.join(" and ")}: ${command} --server <url> uses ${others.length === 1 ? "it" : "one"}.`;
6661
Lines 84–92 at 318 (were 89–95 at 116)
92− : "no key";
9491
Lines 99–107 at 318 (were 102–108 at 116)
105− lines.push(`This box isn't signed in to ${originOf(server)}. Run abso login.`);
103+ `This box isn't signed in to ${originOf(server)}. Run abso login.${elsewhereText(server, "abso whoami", probe.home, probe.now)}`,
Lines 169–176 at 318 (were 170–177 at 116)
171170
173− // The folder's own server when there is one: it's the one its commands talk to.
174− const target = folder?.config?.server ?? server;
172+ // Chosen as every command chooses (server-choice.ts): --server, else the folder's own, else ABSO_SERVER, else prod.
Lines 327–340 at 318 (were 328–341 at 116)
328327
330329 * The commonest failures in plain words, with the next step: no credential, a credential the server refuses, and a
331− * server that can't be reached. Anything else is left as it was. `signedIn` is whether the call carried a key or token.
330+ * server that can't be reached. Anything else is left as it was. `sent` names the key or token the call carried, if any.
333−export function plainError(err: unknown, signedIn: boolean): string | undefined {
332+export function plainError(err: unknown, sent: string | undefined, tokenFileUnasked = false): string | undefined {
336− return signedIn
337− ? `The server didn't accept this folder's key: it may be revoked or expired. abso doctor checks it. (${err.message})`
338− : "You're not signed in. Run abso login, then abso join <project>.";
336+ ? `The server didn't accept ${sent}: it may be revoked or expired. abso doctor checks it. (${err.message})`
337+ : `You're not signed in. Run abso login, then abso join <project>.${tokenFileUnasked ? " ~/.abso/token is used only with --token-file." : ""}`;
341340 // A message that already gives its next step (publish's "Run the same command again.") keeps it as the last word.
- MCP
- compare on this site's /mcp
- CLI
- abso diff 116 318 client/src/doctor.ts --json
- JSON
- /christopher/abso-core/compare/116..318?file=client%2Fsrc%2Fdoctor.ts&format=json