- MCP
- show on this site's /mcp
- CLI
- abso show 61 --json
- JSON
- /christopher/abso-core/versions/61?format=json
abso join and abso init no longer need --server (abso issue 349): --server, then ABSO_SERVER, then the server this box signed in to with abso login, then https://api.abso.dev. A box signed in to more than one server is asked to say which. Usage, about text and the README's join line updated; box.test.ts covers the order.
of shared·trials··Not checked
Version 60 · Files at version 61
5 files, 80 lines added, 13 removed.
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@
6464
66−abso join <project> --agent <name> --server https://api.abso.dev --dir ./<name>
6969
--- a/client/src/box.ts
+++ b/client/src/box.ts
@@ -9,11 +9,11 @@
1010
12−import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
12+import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
16−import { homeFile, homeWritePath, OLD_STATE_DIR } from "./state-dir.ts";
1717
1818/** What the person who approved the code allowed: each project with the highest role its agents get there, and how many agents. */
@@ -59,6 +59,31 @@
6161
62+/** The servers this box is signed in to and whose sign-in hasn't expired, from ~/.abso/boxes (and an older ~/.avcs/boxes). */
74+ const server = (JSON.parse(readFileSync(join(home, dir, "boxes", name), "utf8")) as { server?: unknown })
86+
--- a/client/src/join-commands.ts
+++ b/client/src/join-commands.ts
@@ -5,12 +5,13 @@
8−import { mintKey, readBox } from "./box.ts";
1313import { findRoot, installKey, readConfig, type Settings, tokenFor, writeConfig } from "./config.ts";
@@ -19,10 +20,17 @@
2122
22−function serverFrom(args: Parsed, env: Env): string {
23− const server = str(args, "server") ?? fromEnv(env.env, "SERVER");
24− if (!server) throw new UsageError("give the server with --server <url> (or ABSO_SERVER)");
25− return server;
24+ * The server to join or start on (abso issue 349): --server, then ABSO_SERVER, then the server this box is signed in
25+ * to (abso login wrote it), then https://api.abso.dev. A box signed in to more than one server has to say which.
32+ throw new UsageError(`this box is signed in to ${signedIn.join(" and ")}: say which with --server <url>`);
2735
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -89,9 +89,9 @@
9191 flags: { server: "string", project: "string", agent: "string", "as-is": "boolean", org: "string" },
92− usage: "abso init [folder] --server <url> --project <name> --agent <name> [--as-is] [--org <org>]",
92+ usage: "abso init [folder] [--server <url>] --project <name> --agent <name> [--as-is] [--org <org>]",
94− "Create a project on the server from a folder's text files. The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no avcs.json and package.json gives a check or a build to guess, an avcs.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). --org <org> makes it an organization's project: for now that is done on the website, and abso says where.",
94+ "Create a project on the server from a folder's text files (the server is chosen as abso join chooses it). The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no avcs.json and package.json gives a check or a build to guess, an avcs.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). --org <org> makes it an organization's project: for now that is done on the website, and abso says where.",
@@ -262,9 +262,9 @@
265− usage: "abso join <project> --agent <name> --server <url> [--dir <folder>] [--reader]",
267− "Join a project as a new agent and write its shared files into the folder (default: here). --reader joins as a reader: it reads everything and records nothing, and the server refuses its edits, records and publishes.",
267+ "Join a project as a new agent and write its shared files into the folder (default: here). The server is --server, else ABSO_SERVER, else the one this box signed in to with abso login, else https://api.abso.dev. --reader joins as a reader: it reads everything and records nothing, and the server refuses its edits, records and publishes.",
--- a/client/test/box.test.ts
+++ b/client/test/box.test.ts
@@ -7,7 +7,18 @@
10−import { boxPublic, boxText, forgetBox, login, logout, mintKey, readBox, writeBox } from "../src/box.ts";
1122
@@ -271,3 +282,26 @@
285+
286+test("join and init pick the server: --server, ABSO_SERVER, the box's sign-in, then api.abso.dev (abso issue 349)", () => {
288+ const args = (server?: string) => ({ positionals: [], flags: new Map(server ? [["server", server]] : []) });
290+ assert.equal(serverFrom(args(), none, h), "https://api.abso.dev", "nothing signed in: the abso API");
293+ assert.equal(serverFrom(args(), none, h), SERVER, "the server abso login signed this box in to");
294+ assert.deepEqual(signedInServers(h, Date.now() + 2e6), [], "an expired sign-in doesn't count");
295+ assert.equal(serverFrom(args(), { env: { ABSO_SERVER: "https://env.example" } }, h), "https://env.example");
304+ /signed in to https:\/\/other\.abso\.example and https:\/\/staging\.abso\.example: say which with --server/,