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

+51 −2 in 3 places
Lines 5–13 at 156 (were 5–11 at 155)
55// - in a joined folder, --server naming the folder's own server reaches it; another server is refused, never
66// swapped in, and nothing is sent; outside a joined folder a folder command with --server is refused too;
77// - an explicit --server goes to that server's own Issues Worker, which ABSO_ISSUES_SERVER doesn't redirect;
8−// - a command that picks its server (whoami, box, logout) uses the one named, even inside a folder on another.
8+// - a command that picks its server (whoami, box, logout) uses the one named, even inside a folder on another;
9+// - with nothing named (abso-core issue 9) the server is the joined folder's, else ABSO_SERVER, else prod, whatever
10+// this box is signed in to (doctor.test.ts has whoami with staging alone and with staging and prod both).
1012import assert from "node:assert/strict";
1113import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
Lines 18–24 at 156 (were 16–22 at 155)
1618import { after, before, describe, it } from "node:test";
1719import { writeConfig } from "../src/config.ts";
1820import { commandTable, main } from "../src/main.ts";
19−import { sameServer, serverHelp, serverUse } from "../src/server-choice.ts";
21+import { chooseServer, PROD_SERVER, SERVER_ORDER, sameServer, serverHelp, serverUse } from "../src/server-choice.ts";
2022
2123/** A made-up token: the tests never read the real ~/.abso/token. */
2224const TOKEN = "abso_test-token-for-server-flag";
Lines 218–267 at 156 (were 216–218 at 155)
216218 assert.ok(!sameServer("https://x.example/a", "https://x.example/b"));
217219 });
218220});
222+describe("the server when nothing names one", () => {
223+ const STAGING = "https://staging.abso.example";
225+ it("is --server, else the joined folder's, else ABSO_SERVER, else prod", () => {
226+ const outside = temp("outside");
227+ const staging = folder(STAGING);
228+ assert.equal(PROD_SERVER, "https://api.abso.dev");
229+ assert.equal(chooseServer(undefined, outside, {}), PROD_SERVER, "nothing named: prod");
230+ assert.equal(chooseServer(undefined, outside, { ABSO_SERVER: STAGING }), STAGING, "the environment");
231+ assert.equal(chooseServer(undefined, outside, { AVCS_SERVER: STAGING }), STAGING, "its older name");
232+ assert.equal(chooseServer(undefined, staging, {}), STAGING, "a joined staging folder");
233+ assert.equal(chooseServer(undefined, staging, { ABSO_SERVER: "https://env.example" }), STAGING, "folder first");
234+ assert.equal(chooseServer(PROD_SERVER, staging, { ABSO_SERVER: STAGING }), PROD_SERVER, "explicit prod");
235+ assert.equal(chooseServer(STAGING, outside, {}), STAGING, "explicit staging");
236+ assert.throws(
237+ () => chooseServer(undefined, outside, { ABSO_SERVER: "staging" }),
238+ /ABSO_SERVER takes an http or https URL/,
239+ );
240+ });
242+ it("help names the order once for every command that picks its server", async () => {
243+ assert.equal(
244+ SERVER_ORDER,
245+ "--server <url>, else the server of the abso folder you're in, else ABSO_SERVER, else prod (https://api.abso.dev)",
246+ );
247+ for (const name of ["join", "init", "login", "whoami", "doctor", "box", "logout", "orgs", "org"])
248+ assert.ok(serverHelp(name)?.includes(SERVER_ORDER), name);
249+ assert.ok((await run(process.cwd(), ["help"])).stdout.includes(SERVER_ORDER));
250+ });
252+ it("a joined folder's commands go to its server with nothing named, and ABSO_SERVER doesn't move them", async () => {
253+ const root = folder();
254+ clear();
255+ await run(root, ["status"], { ABSO_SERVER: other.url });
256+ assert.ok(home.paths.length > 0);
257+ assert.equal(other.paths.length, 0);
258+ });
260+ it("whoami in a joined folder looks at the folder's server, and another named there is used as given", async () => {
261+ const root = folder();
262+ const here = await run(root, ["whoami"], { ABSO_SERVER: other.url });
263+ assert.ok(here.stdout.includes(`isn't signed in to ${home.url}`), here.stdout);
264+ const named = await run(root, ["box", "--server", other.url]);
265+ assert.ok(named.stdout.includes(`isn't signed in to ${other.url}`), named.stdout);
266+ });
267+});
MCP
compare on this site's /mcp
CLI
abso diff 155 156 client/test/server-flag.test.ts --json
JSON
/christopher/abso-core/compare/155..156?file=client%2Ftest%2Fserver-flag.test.ts&format=json