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 154 to 155

Compare

+50 −17 in 12 places
Lines 49–55 at 155 (were 49–54 at 154)
4949import { initInOrg, runOrg, runOrgs } from "./orgs.ts";
5050import { runUnqueue } from "./queue.ts";
5151import { runNote, runNotes, runReview } from "./review.ts";
52+import { checkFolderServer, localRefusal, serverFlag, serverHelp, serverUse } from "./server-choice.ts";
5253import { installSkill, SKILL, skillPath } from "./skill.ts";
5354import { colorsPass, terminalText } from "./terminal-text.ts";
5455import { runAmend, runDrop, runFollow, runLabel, runLabels, runPluck } from "./versions.ts";
Lines 94–100 at 155 (were 93–99 at 154)
9394const COMMANDS: Readonly<Record<string, CommandDef>> = {
9495 init: {
9596 flags: { server: "string", project: "string", agent: "string", "as-is": "boolean", org: "string" },
96− usage: "abso init [folder] [--server <url>] --project <name> --agent <name> [--as-is] [--org <org>]",
97+ usage: "abso init [folder] --project <name> --agent <name> [--as-is] [--org <org>]",
9798 about:
9899 "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.",
99100 run: (args, env) => {
Lines 184–190 at 155 (were 183–189 at 154)
183184 days: "string",
184185 },
185186 usage:
186− "abso login [--server <url>] [--no-browser] [--projects <name,name>] [--role <reader|writer|owner>] [--max-agents <1-50>] [--days <1-90>]",
187+ "abso login [--no-browser] [--projects <name,name>] [--role <reader|writer|owner>] [--max-agents <1-50>] [--days <1-90>]",
187188 about:
188189 "Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how many agents. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. Without --server, the folder's server, or https://api.abso.dev outside a folder. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display.",
189190 run: async (args, env) => {
Lines 206–212 at 155 (were 205–211 at 154)
205206 },
206207 box: {
207208 flags: { server: "string" },
208− usage: "abso box [--server <url>]",
209+ usage: "abso box",
209210 about:
210211 "What this box's sign-in allows: its projects, the highest role its agents may have, how many agents it has made and may make, and when it expires. Never the credential.",
211212 run: async (args, env) => {
Lines 217–223 at 155 (were 216–222 at 154)
216217 },
217218 whoami: {
218219 flags: { server: "string" },
219− usage: "abso whoami [--server <url>]",
220+ usage: "abso whoami",
220221 about:
221222 "Who and where you're signed in: this box's sign-in, as the server sees it (so a revoked one shows), its projects, roles and expiry, and this folder's project, agent and kind of key. Never a credential. The server is --server, else ABSO_SERVER, else this folder's, else the one this box signed in to with abso login, else https://api.abso.dev.",
222223 run: async (args, env) => {
Lines 227–250 at 155 (were 226–243 at 154)
226227 },
227228 doctor: {
228229 flags: { server: "string" },
229− usage: "abso doctor [--server <url>]",
230+ usage: "abso doctor",
230231 about:
231232 "Checks what commands need, one line each: Node's version, that the server answers, this box's sign-in (present, unexpired, accepted), and this folder's key against its project. A failed check says what to do next, and the exit is 1. Never prints a credential. It picks the server as whoami does.",
232233 run: async (args, env) => {
233− const checks = await doctor(checkServer(str(args, "server"), env.cwd, env.env), env.cwd, env.env, realProbe());
234+ const checks = await doctor(
235+ checkServer(str(args, "server"), env.cwd, env.env),
236+ env.cwd,
237+ env.env,
238+ realProbe(),
239+ str(args, "server") !== undefined,
240+ );
234241 const failed = checks.some((c) => c.result === "fail");
235242 return { text: doctorText(checks), json: { checks }, ...(failed ? { exit: EXIT.error } : {}) };
236243 },
237244 },
238245 logout: {
239246 flags: { server: "string" },
240− usage: "abso logout [--server <url>]",
247+ usage: "abso logout",
241248 about:
242249 "End this box's sign-in on the server and forget it here. Keys its agents already have stop working with it.",
243250 run: async (args, env) => {
Lines 262–268 at 155 (were 255–261 at 154)
255262 },
256263 orgs: {
257264 flags: { server: "string" },
258− usage: "abso orgs [--server <url>]",
265+ usage: "abso orgs",
259266 about:
260267 "Your organizations and your role in each, and invitations waiting for you. It reads as the person who approved this box's sign-in (abso login).",
261268 run: (args, env) => runOrgs(boxServer(args, env)),
Lines 306–312 at 155 (were 299–305 at 154)
299306 },
300307 join: {
301308 flags: { server: "string", agent: "string", dir: "string", reader: "boolean" },
302− usage: "abso join <project> [--agent <name>] [--dir <folder>] [--server <url>] [--reader]",
309+ usage: "abso join <project> [--agent <name>] [--dir <folder>] [--reader]",
303310 about:
304311 "Join a project as a new agent and write its shared files into a folder: --dir, else here when this folder is empty, else ./<project> (which has to be new or empty). Without --agent the agent is named after this box (the name abso login gave it, lower-cased), or the next free <name>-2, <name>-3; that needs the box signed in with abso login. 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 pushes. With --reader and no sign-in, a public project is joined to read signed out: the folder holds only its settings, sends no sign-in, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused.",
305312 run: runJoin,
Lines 810–830 at 155 (were 803–814 at 154)
803810
804811const HELP_INTRO = "abso: version control for agents. This is its command-line client.";
805812const HELP_NOTE =
806− "Every command takes --json. Settings live in .abso/config.json (.avcs/config.json in a folder from before the rename). The token comes from ABSO_TOKEN, or else ~/.abso/token (or ~/.avcs/token from before).";
813+ "Every command takes --json. Settings live in .abso/config.json (.avcs/config.json in a folder from before the rename). The token comes from ABSO_TOKEN, or else ~/.abso/token (or ~/.avcs/token from before). " +
814+ "Every command that talks to a server takes --server <url>; one that works only on this machine (skill, check-ignore, pause, resume, fix-eol) doesn't. In a joined folder --server must be the folder's own server: another is refused, never swapped in. An explicit --server is used as given, and no setting redirects it.";
807815
816+/** A command's flags: its own, and --server for every command that talks to a server (server-choice.ts). */
817+function flagsOf(name: string, def: CommandDef): FlagSpec {
818+ return serverUse(name) === "local" ? def.flags : { ...def.flags, server: "string" };
819+}
808821/** Every command as help shows it, in order: the table's, then the three it doesn't hold. */
809−function helpEntries(): { name: string; usage: string; about: string; flags: FlagSpec }[] {
822+function helpEntries(): { name: string; usage: string; about: string; flags: FlagSpec; server?: string }[] {
810823 return [
811− ...Object.entries(COMMANDS).map(([name, c]) => ({ name, usage: c.usage, about: c.about, flags: c.flags })),
824+ ...Object.entries(COMMANDS).map(([name, c]) => {
825+ const server = serverHelp(name);
826+ return { name, usage: c.usage, about: c.about, flags: flagsOf(name, c), ...(server ? { server } : {}) };
827+ }),
812828 {
813829 name: "hook",
814830 usage: "abso hook",
Lines 848–858 at 155 (were 832–838 at 154)
832848}
833849
834850function help(): string {
835− const entries = helpEntries().flatMap((c) => [` ${c.usage}`, ` ${c.about}`]);
851+ const entries = helpEntries().flatMap((c) => [
852+ ` ${c.usage}`,
853+ ` ${c.about}`,
854+ ...(c.server ? [` ${c.server}`] : []),
855+ ]);
836856 return [HELP_INTRO, "", ...entries, "", HELP_NOTE].join("\n");
837857}
838858
Lines 884–890 at 155 (were 864–870 at 154)
864884export function commandTable(): Readonly<
865885 Record<string, { readonly flags: FlagSpec; readonly usage: string; readonly about: string }>
866886> {
867− return COMMANDS;
887+ return Object.fromEntries(Object.entries(COMMANDS).map(([name, c]) => [name, { ...c, flags: flagsOf(name, c) }]));
868888}
869889
870890function newsBlock(news: readonly string[]): string[] {
Lines 952–985 at 155 (were 932–952 at 154)
932952 );
933953 const gitOnly = gitOnlyForm(command, argv.slice(1));
934954 if (gitOnly) throw new UsageError(gitOnly);
935− const parsed = parseArgs(command, argv.slice(1), withBodyFiles(command, def.flags), def.rest);
955+ const use = serverUse(command);
956+ const words = argv.includes("--") ? argv.slice(1, argv.indexOf("--")) : argv.slice(1);
957+ if (use === "local" && words.some((w) => w === "--server" || w.startsWith("--server=")))
958+ throw new UsageError(localRefusal(command));
959+ const parsed = parseArgs(command, argv.slice(1), withBodyFiles(command, flagsOf(command, def)), def.rest);
936960 if ((command === "push" || command === "pull") && parsed.positionals.length > 0)
937961 throw new UsageError(
938962 `abso ${command} takes no remote or branch: it ${command === "push" ? "adds your draft to shared" : "brings shared into this folder"}. A named draft is abso switch <name>.`,
939963 );
940964 if (bool(parsed, "help")) {
941965 const files = bodyFilesHelp(command, def.flags);
942− return { stdout: `${def.usage}\n ${def.about}\n${files ? ` ${files}\n` : ""}`, stderr: "", exit: EXIT.ok };
966+ const server = serverHelp(command);
967+ return {
968+ stdout: `${def.usage}\n ${def.about}\n${server ? ` ${server}\n` : ""}${files ? ` ${files}\n` : ""}`,
969+ stderr: "",
970+ exit: EXIT.ok,
971+ };
943972 }
973+ // --server is checked before anything is read or sent: a bad value, or (for a command on a joined folder)
974+ // a server that isn't the folder's own, is refused here.
975+ const named = use === "local" ? undefined : serverFlag(parsed);
976+ if (named !== undefined && use === "folder") checkFolderServer(command, named, env.cwd);
944977 // A folder that reads signed out runs its reads and nothing else, refused before any call.
945978 const root = findRoot(env.cwd);
946979 if (root !== undefined && isVisitor(root)) checkVisitor(command, parsed, readConfig(root, env.env).project);
947980 const args = readBodyFiles(command, parsed, env.cwd, env.readStdin);
948981 takeNews(); // what an earlier call in this process left (tests run many)
949− const out = await def.run(args, env);
982+ const out = await def.run(args, named === undefined ? env : { ...env, server: named });
950983 const exit = out.exit ?? EXIT.ok;
951984 // Every command that took news while recording prints it (#37, News Report).
952985 const news = takeNews();
MCP
compare on this site's /mcp
CLI
abso diff 154 155 client/src/main.ts --json
JSON
/christopher/abso-core/compare/154..155?file=client%2Fsrc%2Fmain.ts&format=json