Versions 75 to 76
new file, 229 lines
1+// abso whoami and abso doctor: each check's line, the next step when one fails, the server asked as the box and as
2+// the folder's key, and no credential in anything printed. plainError's wording of the commonest failures.
3+
11+import { doctor, doctorText, nodeNeeded, type Probe, plainError, whoami } from "../src/doctor.ts";
12+
25+
27+
35+ writeFileSync(join(root, ".abso", "key"), JSON.stringify({ server: SERVER, key: KEY, id: "k_00c0ffee" }));
38+
40+/** A server answering by path: /version, /box, /p/game/head. A missing path throws, like a refused connection. */
53+
62+
67+
68+test("doctor outside a folder with no sign-in: the box check fails with abso login, the folder check doesn't apply", async () => {
85+ assert.match(checks[2]!.text, /isn't signed in to https:\/\/staging\.abso\.example\. Run abso login\./);
88+
89+test("doctor in a folder, signed in: every check passes, the box and the key each go to their own check", async () => {
98+ server({ "/version": [200, { commit: "ff7cd0e" }], "/box": [200, accepted], "/p/game/head": [200, {}] }, seen),
106+ assert.match(checks[3]!.text, /agent builder in game, with the agent key k_00c0ffee, which the server accepts/);
116+
117+test("doctor when the server can't be reached: says so with the next step, and the checks that need it don't apply", async () => {
127+ /Can't reach https:\/\/staging\.abso\.example: the connection was refused\. Check your connection, and the server in \.abso\/config\.json\./,
130+
131+test("doctor when the server refuses the box and the key: each fails with what to do", async () => {
151+ assert.match(checks[2]!.text, /no longer accepts this box's sign-in \(signed out or revoked\)\. Run abso login\./);
152+ assert.match(checks[3]!.text, /didn't accept the agent key k_00c0ffee for game.*abso join game again/);
154+
155+test("doctor: an expired sign-in and an old Node fail without asking the server about them", async () => {
174+
175+test("whoami: the box as the server sees it, who approved it, and this folder's agent and key, never a credential", async () => {
178+ const out = await whoami(SERVER, folder(), {}, probe(server({ "/box": [200, accepted] }), home));
181+ /^Signed in to https:\/\/staging\.abso\.example as box b_0123abcd, approved by christopher\.\n/,
186+ /This folder is agent builder in project game on https:\/\/staging\.abso\.example, with the agent key k_00c0ffee\./,
191+
196+ "This box isn't signed in to https://staging.abso.example. Run abso login.\nYou're not in an abso folder. abso join <project> makes one.",
199+
209+ assert.match(out.text, /no longer accepts this box's sign-in \(signed out or revoked\)\. Run abso login\./);
211+
212+test("plainError words a refusal by whether a credential went, and a server that can't be reached", () => {
214+ assert.equal(plainError(refused, false), "You're not signed in. Run abso login, then abso join <project>.");
215+ assert.match(plainError(refused, true)!, /^The server didn't accept this folder's key.*abso doctor checks it/);
218+ "Can't reach https://api.abso.dev: connect ECONNREFUSED. Check your connection; abso doctor checks the rest.",
222+ new ApiError("could not reach http://x: refused. Nothing was published. Run the same command again."),
- MCP
- compare on this site's /mcp
- CLI
- abso diff 75 76 client/test/doctor.test.ts --json
- JSON
- /christopher/abso-core/compare/75..76?file=client%2Ftest%2Fdoctor.test.ts&format=json