Versions 75 to 76
new file, 316 lines
1+// abso whoami and abso doctor: who and where this box and folder are signed in, and a check of each thing
2+// a command needs (Node, the server, the box's sign-in, the folder's key), one line each, with the next step
3+// when one fails. Neither prints a credential. plainError words the commonest failures the same way.
4+
9+
10+/** The lowest Node major each kind of copy runs on: the npm package is built for 20, a checkout runs its .ts as is. */
14+
15+/** What whoami and doctor read from outside: the network, the clock, Node's version and the home folder. Tests give their own. */
23+
27+
41+
43+
45+async function serverBox(record: BoxRecord, probe: Probe): Promise<Answer | { unreachable: string }> {
52+
53+/** fetch with its own, shorter limit: a check that hangs says so rather than waiting out the command's. */
58+
59+function credentialWords(root: string, server: string, env: Readonly<Record<string, string | undefined>>): string {
61+ return c.kind === "agent key" ? `the agent key ${c.id}` : c.kind === "shared token" ? "the shared token" : "no key";
63+
85+ lines.push(first!, ...rest, `${originOf(server)} couldn't be reached to confirm it: ${answer.unreachable}`);
88+ const by = typeof answer.body.approved_by === "string" ? `, approved by ${answer.body.approved_by}` : "";
93+ lines.push(`${originOf(server)} no longer accepts this box's sign-in (signed out or revoked). Run abso login.`);
103+ `This folder is agent ${c.agent} in project ${c.project} on ${originOf(c.server)}, with ${credential}${c.reader ? ", as a reader" : ""}.`,
105+ here = { root: folder.root, project: c.project, agent: c.agent, server: c.server, credential };
114+
121+
137+ text: `Node ${probe.node} is too old: abso needs ${need} or later. Install a newer Node from nodejs.org.`,
140+
156+ text: `${origin} answers${typeof body.commit === "string" ? ` (version ${body.commit.slice(0, 7)})` : ""} in ${Date.now() - started} ms.`,
165+ const why = err instanceof Error && err.name === "TimeoutError" ? "no answer within 10 s" : plainCause(err);
169+ text: `Can't reach ${origin}: ${why}. Check your connection${folder?.config ? ", and the server in .abso/config.json" : ""}.`,
172+
178+ text: `This box isn't signed in to ${origin}. ${folder?.config ? "Only abso join needs it; abso login signs it in." : "Run abso login."}`,
196+ ? { check: "box", result: "skip", text: `Signed in as box ${record.id}; the server can't confirm it now.` }
201+ text: `Signed in as box ${record.id}, which ${origin} accepts, until ${day(record.expiresAt)} UTC.`,
206+ text: `${origin} no longer accepts this box's sign-in (signed out or revoked). Run abso login.`,
210+
218+ checks.push({ check: "folder", result: "fail", text: `This folder's settings can't be read: ${folder.problem}` });
224+
225+/** The folder's key against its project: GET head, which the server answers only after it has checked the key. */
238+ text: `This folder (${who}) has no key, and there's no shared token. Run abso login, then abso join ${c.project}.`,
272+ text: `${originOf(c.server)} has no project ${c.project}. Check the name in .abso/config.json, or abso init makes it.`,
278+ text: `${originOf(c.server)} didn't accept ${credential} for ${c.project}: it may be revoked or expired. Ask the project's owner, or run abso join ${c.project} again from a signed-in box.`,
286+
290+
293+ if (cause?.code === "ENOTFOUND" || cause?.code === "EAI_AGAIN") return "the address doesn't resolve";
297+
299+ * The commonest failures in plain words, with the next step: no credential, a credential the server refuses, and a
300+ * server that can't be reached. Anything else is left as it was. `signedIn` is whether the call carried a key or token.
306+ ? `The server didn't accept this folder's key: it may be revoked or expired. abso doctor checks it. (${err.message})`
310+ // 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 75 76 client/src/doctor.ts --json
- JSON
- /christopher/abso-core/compare/75..76?file=client%2Fsrc%2Fdoctor.ts&format=json