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 261 to 318

Compare

+88 −31 in 21 places
Lines 1–8 at 318 (were 1–8 at 261)
11// The command table and the dispatcher. main() returns what to print and the
22// exit code instead of printing, so tests can call it directly.
33
4−import { readFileSync } from "node:fs";
5−import { resolve } from "node:path";
4+import { existsSync, readFileSync } from "node:fs";
5+import { join, resolve } from "node:path";
66import { runAnnounce, runNews, runStart } from "./announce.ts";
77import { ApiError } from "./api.ts";
88import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from "./args.ts";
Lines 38–48 at 318 (were 38–47 at 261)
3838 runSync,
3939 takeNews,
4040} from "./commands.ts";
41−import { configPath, findRoot, installKey, isVisitor, readConfig, readToken } from "./config.ts";
41+import { configPath, findRoot, installKey, isVisitor, readConfig, runKey, tokenFile } from "./config.ts";
4242import { newsBlockLines, newsShown } from "./core.ts";
4343import { doctor, doctorText, plainError, realProbe, whoami } from "./doctor.ts";
4444import { runDraftSync, runLand, runSwitch } from "./drafts.ts";
45+import { fromEnv } from "./env-names.ts";
4546import { runExport } from "./export.ts";
4647import { runFlag } from "./flag-commands.ts";
4748import { runGroup, runGroups } from "./group-commands.ts";
Lines 58–65 at 318 (were 57–63 at 261)
5758 runSearch,
5859 runWaiting,
5960} from "./issues.ts";
60−import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
61+import { adminToken, adminTokenWords, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
62+import { closeLocalStores } from "./local-store.ts";
6163import { browserSkip, openInBrowser } from "./open-browser.ts";
6264import { runOrg, runOrgs } from "./orgs.ts";
6365import { runUnqueue } from "./queue.ts";
Lines 74–85 at 318 (were 72–81 at 261)
7274 serverUse,
7375} from "./server-choice.ts";
7476import { installSkill, SKILL, skillPath } from "./skill.ts";
77+import { stateDir } from "./state-dir.ts";
7578import { colorsPass, terminalText } from "./terminal-text.ts";
7679import { runAmend, runDrop, runFollow, runLabel, runLabels, runPluck } from "./versions.ts";
7780import { runVisibility } from "./visibility-commands.ts";
7881import { checkVisitor } from "./visitor.ts";
82+import { handoffText, patFromFile, webLogin } from "./web-session.ts";
7983
8084interface CommandDef {
8185 readonly flags: FlagSpec;
Lines 122–135 at 318 (were 118–127 at 261)
118122 org: "string",
119123 public: "boolean",
120124 private: "boolean",
125+ "token-file": "boolean",
126+ local: "boolean",
127+ store: "string",
121128 },
122− usage: "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private]",
129+ usage:
130+ "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private] [--token-file] | abso init [folder] --local --project <name> [--agent <name>] [--store <folder>] [--as-is]",
123131 about:
124− "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). On a server this box is signed in to (abso login, approving all your projects), the project is made as you, the way the website's New project makes it: you own it, it's private unless you say --public, and the folder joins it at once with its own key (--agent names it; else the box's name). --org <org> makes it that organization's project. Elsewhere it needs --agent and the server's token.",
132+ "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 abso.json and package.json gives a check or a build to guess, an abso.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). On a server this box is signed in to (abso login, approving all your projects), the project is made as you, the way the website's New project makes it: you own it, it's private unless you say --public, and the folder joins it at once with its own key (--agent names it; else the box's name). --org <org> makes it that organization's project. Elsewhere it needs --agent and a token: ABSO_TOKEN, or with --token-file this machine's ~/.abso/token, which is never used unasked. Before it makes anything, it says what it signs in with. --local makes a local project instead: its history is kept on this machine, in a store folder, and no server, sign-in or network is needed (Node 22.13 or later). The store is --store <folder> (kept in the folder's settings; inside the folder, .absoignore leaves it out), else ABSO_STORE, else this user's data folder (%LOCALAPPDATA%\\abso\\store, ~/Library/Application Support/abso/store, or $XDG_DATA_HOME/abso/store). The agent is --agent, else this computer's name.",
125133 run: (args, env) => runInit(args, env),
126134 },
127135 key: {
Lines 145–151 at 318 (were 137–143 at 261)
137145 usage:
138146 "abso key install [--server <url> [--dir <folder>]] | abso key new <agent> [--server <url> [--dir <folder>]] [--project <name>] [--expires <Nd>] [--role owner|writer|reader] [--print] | abso key list [--agent <name>] [--project <name>] | abso key revoke <id> [--project <name>]",
139147 about:
140− "install reads {key, id} from stdin into .abso/key. With --server, it writes it into a folder not joined yet, so abso join there signs in with the key. new writes the key into that folder and prints only the id; its role is writer unless --role says otherwise (a reader only reads; a writer writes on its own agent's routes; an owner also skips or revokes CI, resumes the queue, syncs git and exports); --print writes the key to stdout instead. list and revoke never print a key. These three read the admin token from AVCS_ADMIN_TOKEN or ~/.abso/admin-token and send it only to a server named in AVCS_ADMIN_SERVERS. An agent does not run them unless a person on the project says so.",
148+ "install reads {key, id} from stdin into .abso/key. With --server, it writes it into a folder not joined yet, so abso join there signs in with the key. new writes the key into that folder and prints only the id; its role is writer unless --role says otherwise (a reader only reads; a writer writes on its own agent's routes; an owner also skips or revokes CI, resumes the queue, syncs git and exports); --print writes the key to stdout instead. list and revoke never print a key. These three read the admin token from ABSO_ADMIN_TOKEN or ~/.abso/admin-token and send it only to a server named in ABSO_ADMIN_SERVERS. An agent does not run them unless a person on the project says so.",
141149 run: async (args, env) => {
142150 const sub = args.positionals[0];
143151 if (sub === "install" && args.positionals.length === 1) return runKeyInstall(args, env);
Lines 154–171 at 318 (were 146–162 at 261)
146154 if (!root) throw new UsageError("abso key runs inside an agent's folder, or takes --server <url>");
147155 let config: ReturnType<typeof readConfig>;
148156 try {
149− config = readConfig(root, env.env);
157+ config = readConfig(root, env.env, env.tokenFile === true);
150158 } catch {
151159 config = {
152160 server: serverFlag ?? "",
153161 project: str(args, "project") ?? "",
154162 agent: "admin",
155− token: readToken(env.env),
163+ token: fromEnv(env.env, "TOKEN")?.trim() || (env.tokenFile ? tokenFile() : undefined),
156164 };
157165 }
158166 if (serverFlag) config = { ...config, server: serverFlag };
159167 const admin = adminToken(env.env);
168+ (env.writeErr ?? env.write)(`${adminTokenWords(env.env)}\n`);
160169 if (sub === "new" && args.positionals.length === 2) {
161170 const server = str(args, "server") ?? config.server;
162171 const project = str(args, "project") ?? config.project;
Lines 213–244 at 318 (were 204–216 at 261)
204213 projects: "string",
205214 role: "string",
206215 days: "string",
216+ web: "boolean",
217+ site: "string",
218+ "pat-file": "string",
207219 },
208220 usage:
209− "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>]",
221+ "abso login [--no-browser] [--no-ask] [--projects <name,name>] [--role <reader|writer|owner>] [--days <1-90>] | abso login --web [--pat-file <file> [--site http://localhost:<port>]]",
210222 about:
211− "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 long. 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. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only.",
223+ "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 long. 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. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display. In an agent's folder on the same server, it also asks a person in that project to approve it (the person who approved the agent's box, else the project's owners), as an abso ask, so nobody has to relay the code; the box can then be granted that project at no more than the agent's own role. --no-ask shows the code only. --web, on staging only, signs a browser in to the website instead: it prints a link that works once, within a minute, and signs whichever browser opens it in as the person who approved this box, but only to the projects the box was granted and at most as a writer, until the box is revoked or ends (or, with --pat-file, as the test account whose PAT that file holds, at most as a writer). It writes issues, replies, answers, groups and announcements, and changes no members, roles, visibility, keys, boxes or settings. The box's sign-in, the PAT and the session never appear. It goes only to the staging website beside this folder's staging server; any other server, prod included, is refused and nothing is sent. --site, with --pat-file only, points it at a website on this machine (http://localhost or 127.0.0.1).",
212224 run: async (args, env) => {
213225 const server = boxServer(args, env);
226+ if (bool(args, "web")) {
227+ const patFile = str(args, "pat-file");
228+ const { handoff, site } = await webLogin({
229+ server,
230+ site: str(args, "site"),
231+ kind: patFile === undefined ? "box" : "pat",
232+ credential: () => {
233+ if (patFile !== undefined) return patFromFile(patFile);
234+ const record = readBox(server);
235+ if (record === undefined || record.expiresAt <= Date.now())
236+ throw new UsageError(`this box isn't signed in to ${server}: abso login first, or --pat-file <file>`);
237+ return record.credential;
238+ },
239+ });
240+ return { text: handoffText(handoff, site, patFile === undefined), json: { ...handoff } };
241+ }
214242 const open =
215243 bool(args, "no-browser") || browserSkip(env.env, process.platform) !== null
216244 ? undefined
Lines 350–368 at 318 (were 322–331 at 261)
322350 },
323351 },
324352 join: {
325− flags: { server: "string", agent: "string", dir: "string", reader: "boolean" },
326− usage: "abso join <project> [--agent <name>] [--dir <folder>] [--reader]",
353+ flags: {
354+ server: "string",
355+ agent: "string",
356+ dir: "string",
357+ reader: "boolean",
358+ "token-file": "boolean",
359+ local: "boolean",
360+ store: "string",
361+ },
362+ usage:
363+ "abso join <project> [--agent <name>] [--dir <folder>] [--reader] [--token-file] | abso join <project> --local [--agent <name>] [--store <folder>] [--dir <folder>]",
327364 about:
328− "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. --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.",
365+ "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. --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. It says what it signs in with: a new key from this box's sign-in, the folder's key, or ABSO_TOKEN; this machine's ~/.abso/token only with --token-file, never unasked. --local joins a local project (abso init --local) from the same store: --store, else ABSO_STORE, else this user's data folder; the agent is --agent, else this computer's name.",
329366 run: runJoin,
330367 },
331368 record: {
Lines 385–391 at 318 (were 348–354 at 261)
348385 },
349386 usage: 'abso push -m "<why>" [--as-is] [--check ["<command>"]] [--wait <seconds> | --no-wait] [--done]',
350387 about:
351− 'Record, then add your draft to shared. Refused when it collides with work pushed since your last pull, or when lines a pull showed changed on both sides are still untouched (--as-is pushes both sides\' lines anyway). --check "<command>" (e.g. --check "npm run typecheck") first pulls, then runs the command in your box on your draft with newest shared, and pushes only if it exits 0, so two changes that each pass alone can\'t turn shared red. --check alone runs the "build" and then the "check" in the project\'s avcs.json (your draft\'s copy), as the server does on each new version. With the merge queue on ("queue": true in avcs.json), a push to shared is queued and lands only once the project\'s check passes on shared with it on top: push waits up to 100 s for that (--wait <seconds> changes it, --no-wait returns at once), then says it landed (exit 0), was turned back with the check\'s output (exit 2, its changes still in your draft), or is still queued (exit 3; the outcome comes as news). --check alone is skipped then, since the queue runs the check. --done takes your start note back once it\'s pushed: this push finishes that work.',
388+ 'Record, then add your draft to shared. Refused when it collides with work pushed since your last pull, or when lines a pull showed changed on both sides are still untouched (--as-is pushes both sides\' lines anyway). --check "<command>" (e.g. --check "npm run typecheck") first pulls, then runs the command in your box on your draft with newest shared, and pushes only if it exits 0, so two changes that each pass alone can\'t turn shared red. --check alone runs the "build" and then the "check" in the project\'s abso.json (your draft\'s copy), as the server does on each new version. With the merge queue on ("queue": true in abso.json), a push to shared is queued and lands only once the project\'s check passes on shared with it on top: push waits up to 100 s for that (--wait <seconds> changes it, --no-wait returns at once), then says it landed (exit 0), was turned back with the check\'s output (exit 2, its changes still in your draft), or is still queued (exit 3; the outcome comes as news). --check alone is skipped then, since the queue runs the check. --done takes your start note back once it\'s pushed: this push finishes that work.',
352389 run: runPublish,
353390 },
354391 bisect: {
Lines 433–439 at 318 (were 396–402 at 261)
396433 usage:
397434 'abso run [--detach] [--replace] [--fresh] [--box <name>] [--at <version> [--files <glob>]] <command...> | abso run ... -- <program> <arg...> | abso run --parallel "<command>" "<command>"...',
398435 about:
399− "Send the folder to this agent's box, run the command there, and stream its output back. Exits with the command's code. After --, each word goes to the program exactly as typed (quotes, backslashes, regex text); without --, the words are one shell command. The box's stderr comes out on stderr. --detach starts it and prints its id without waiting. While a run is still going in the box, a new one is refused (409, naming it), since it would replace the files under it; --replace stops the old one first. --parallel runs each quoted command at once in the box (one upload), labels each line [1], [2], ..., ends with each one's exit code, and exits with the worst. --at <version> runs that version of the folder's space instead of the folder (for bisecting); with --files <glob>, only the matching files are taken from that version. The folder is never touched. --fetch <glob>[,<glob>...] brings matching files from the box's /w back after the run (see abso fetch); several globs go in one argument, comma-separated (--fetch 'shots/*.png,out/*.json'), as for --files and --with. The box's /w is replaced by your folder on every run; the rest of the box (/tmp, ~/.cache, /w/node_modules) lasts between runs until the box stops (idle 30 minutes, or restarted). abso's own notices go to stderr, apart from the command's output; --quiet drops them (the command's own stderr still comes through). --with <box path>=<local path>[,...] adds files (or a folder's files) for this run only: they go to the box and are never written to your folder or recorded, for an A/B run that leaves the project alone. --box <name> (or AVCS_BOX=<name>) runs in another box of yours, with its own /w and state, so a subagent's runs and yours don't wait on each other; logs and fetch take --box too. After abso prep, a fresh box starts from the prep; --fresh starts this run from the plain image instead.",
436+ "Send the folder to this agent's box, run the command there, and stream its output back. Exits with the command's code. After --, each word goes to the program exactly as typed (quotes, backslashes, regex text); without --, the words are one shell command. The box's stderr comes out on stderr. --detach starts it and prints its id without waiting. While a run is still going in the box, a new one is refused (409, naming it), since it would replace the files under it; --replace stops the old one first. --parallel runs each quoted command at once in the box (one upload), labels each line [1], [2], ..., ends with each one's exit code, and exits with the worst. --at <version> runs that version of the folder's space instead of the folder (for bisecting); with --files <glob>, only the matching files are taken from that version. The folder is never touched. --fetch <glob>[,<glob>...] brings matching files from the box's /w back after the run (see abso fetch); several globs go in one argument, comma-separated (--fetch 'shots/*.png,out/*.json'), as for --files and --with. The box's /w is replaced by your folder on every run; the rest of the box (/tmp, ~/.cache, /w/node_modules) lasts between runs until the box stops (idle 30 minutes, or restarted). abso's own notices go to stderr, apart from the command's output; --quiet drops them (the command's own stderr still comes through). --with <box path>=<local path>[,...] adds files (or a folder's files) for this run only: they go to the box and are never written to your folder or recorded, for an A/B run that leaves the project alone. --box <name> (or ABSO_BOX=<name>) runs in another box of yours, with its own /w and state, so a subagent's runs and yours don't wait on each other; logs and fetch take --box too. After abso prep, a fresh box starts from the prep; --fresh starts this run from the plain image instead.",
400437 rest: true,
401438 run: runRun,
402439 },
Lines 648–654 at 318 (were 611–617 at 261)
611648 flags: { version: "string", revoke: "boolean" },
612649 usage: "abso ci [<version>] | abso ci --revoke",
613650 about:
614− "The project's CI: the server runs avcs.json's setup, build and check on each new version of shared, one job at a time on the newest. abso ci says whether shared is green or red (and since which version, by whom, once a bisect finds it), what is being checked, and the preview link of the newest passing build, which needs no token. abso ci <version> shows that version's job: which step failed, its exit code, and the end of its output. status says the same in a line, and log marks each version of shared. --revoke ends every preview link handed out so far and makes a new one.",
651+ "The project's CI: the server runs abso.json's setup, build and check on each new version of shared, one job at a time on the newest. abso ci says whether shared is green or red (and since which version, by whom, once a bisect finds it), what is being checked, and the preview link of the newest passing build, which needs no token. abso ci <version> shows that version's job: which step failed, its exit code, and the end of its output. status says the same in a line, and log marks each version of shared. --revoke ends every preview link handed out so far and makes a new one.",
615652 run: runCi,
616653 },
617654 shot: {
Lines 674–680 at 318 (were 637–643 at 261)
637674 usage:
638675 'abso shot ["/<path>?<query>"] [--scale 0.1-1] [--region x0,y0,x1,y1] [--text] [--tree [--interactive] [--depth N]] [--find "<text>"] [--max-chars N] [--image] [--at <version>] [--eval "<js>"] [--click "x,y[@ms];ref_N[@ms]"] [--mouse x,y|ref_N] [--out <file.png>] [--wait <ms>] [--size <w>x<h>]',
639676 about:
640− "A look at your folder's game, taken in your box: it runs the project's vite dev server and Playwright on that page (default /, a 1280x720 page). Images cost tokens, so read without one when you can: --text prints the page's visible text, --tree its elements (role, name, a ref like ref_12, and its box in page pixels; --interactive only what can be clicked or typed in; --depth N levels), and --find \"<text>\" the elements matching some text; each is capped at --max-chars (default 5000). With none of those, or with --image, it writes a PNG to .avcs/shots/ (never recorded) or --out, and prints its pixel size and about how many tokens reading it costs (width x height / 750). --scale 0.5 halves the width and height (a quarter of the tokens); --region x0,y0,x1,y1 takes part of the page at full detail; they combine. Coordinates are always the page's, whatever the scale or region. To set up a state first, --eval runs JavaScript in the page and --click clicks points (x,y or ref_N; several separated by ;; @ms waits first), in that order, a second after load and two frames after the eval; --mouse x,y or ref_N leaves the pointer there (for hover cards); then it waits --wait ms (default 3000) and looks. It prints --eval's result, page errors and the first 30 console messages. Refs come from --tree or --find on the same page in the same state. --at <version> looks at that version of your folder's space instead of the folder (as abso run --at). Needs vite and playwright in the project's devDependencies; abso prep with npx --no-install playwright install chromium makes it fast.",
677+ "A look at your folder's game, taken in your box: it runs the project's vite dev server and Playwright on that page (default /, a 1280x720 page). Images cost tokens, so read without one when you can: --text prints the page's visible text, --tree its elements (role, name, a ref like ref_12, and its box in page pixels; --interactive only what can be clicked or typed in; --depth N levels), and --find \"<text>\" the elements matching some text; each is capped at --max-chars (default 5000). With none of those, or with --image, it writes a PNG to .abso/shots/ (never recorded) or --out, and prints its pixel size and about how many tokens reading it costs (width x height / 750). --scale 0.5 halves the width and height (a quarter of the tokens); --region x0,y0,x1,y1 takes part of the page at full detail; they combine. Coordinates are always the page's, whatever the scale or region. To set up a state first, --eval runs JavaScript in the page and --click clicks points (x,y or ref_N; several separated by ;; @ms waits first), in that order, a second after load and two frames after the eval; --mouse x,y or ref_N leaves the pointer there (for hover cards); then it waits --wait ms (default 3000) and looks. It prints --eval's result, page errors and the first 30 console messages. Refs come from --tree or --find on the same page in the same state. --at <version> looks at that version of your folder's space instead of the folder (as abso run --at). Needs vite and playwright in the project's devDependencies; abso prep with npx --no-install playwright install chromium makes it fast.",
641678 run: runShot,
642679 },
643680 prep: {
Lines 797–806 at 318 (were 760–769 at 261)
760797 run: runStart,
761798 },
762799 news: {
763− flags: {},
764− usage: "abso news",
800+ flags: { stream: "boolean", follow: "boolean" },
801+ usage: "abso news [--stream | --follow]",
765802 about:
766− "The news waiting for you: collisions, changed definitions, moved lines and announcements. Each item comes once.",
803+ "The news waiting for you: collisions, changed definitions, moved lines and announcements. Each item comes once. --stream prints a Monitor call that wakes a Claude Code chat the moment news arrives (a ticket that opens the stream once, within a minute); --follow holds the stream itself and prints a line per item until stopped.",
767804 run: runNews,
768805 },
769806 "fix-eol": {
Lines 890–896 at 318 (were 853–859 at 261)
853890 usage:
854891 "abso pipeline check [file] [--on push|draft|green|land|hand|schedule [--space <name>] [--pipeline <name>] [--every <when>]] | abso pipeline runs [<run>] [--log <pipeline.job>]",
855892 about:
856− "Read the folder's pipeline file (abso.yml, abso.yaml or avcs.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file. abso pipeline runs asks the server what the project's pipelines did: the runs, newest first; with a run's number, its jobs (state, why, exit, time, an npm or deploy job's phase); with --log <pipeline.job>, that job's output.",
893+ "Read the folder's pipeline file (abso.yml, abso.yaml or abso.json, or the file named) and say what's wrong with it, place by place: a cycle in needs, a job that doesn't exist, secrets a draft could reach, a key it doesn't know. Exits 1 when it has problems. With --on, it says which pipelines that event starts (in shared, or --space), with their jobs in waves that can run side by side, and why each other pipeline doesn't start. It reads only the file. abso pipeline runs asks the server what the project's pipelines did: the runs, newest first; with a run's number, its jobs (state, why, exit, time, an npm or deploy job's phase); with --log <pipeline.job>, that job's output.",
857894 // Loaded only here, so the yaml package it needs can't stop every other command
858895 // when a checkout lacks it (abso issue 168).
859896 run: async (args, env) => {
Lines 911–924 at 318 (were 874–887 at 261)
874911
875912const HELP_INTRO = "abso: version control for agents. This is its command-line client.";
876913const HELP_NOTE =
877− "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). " +
914+ "Every command takes --json. Settings live in .abso/config.json (.avcs/config.json in a folder from before the rename). A folder with a key signs in with that key and nothing else. Without one, the token comes from ABSO_TOKEN; this machine's ~/.abso/token (or ~/.avcs/token from before) is used only by a command given --token-file. " +
878915 "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. The server is " +
879916 SERVER_ORDER +
880917 ": which servers this box is signed in to plays no part.";
881918
882−/** A command's flags: its own, and --server for every command that talks to a server (server-choice.ts). */
919+/** A command's flags: its own, and --server and --token-file for every command that talks to a server (server-choice.ts). */
883920function flagsOf(name: string, def: CommandDef): FlagSpec {
884− return serverUse(name) === "local" ? def.flags : { ...def.flags, server: "string" };
921+ return serverUse(name) === "local" ? def.flags : { ...def.flags, server: "string", "token-file": "boolean" };
885922}
886923
887924/** Every command as help shows it, in order: the table's, then the three it doesn't hold. */
Lines 995–1010 at 318 (were 958–969 at 261)
958995}
959996
960997/** Whether this folder's calls carry a key or token, for how a refusal is worded. False when that can't be told. */
961−function carriesCredential(env: Env): boolean {
998+function credentialSent(env: Env, tokenFileAsked: boolean): string | undefined {
962999 try {
9631000 const root = findRoot(env.cwd);
964− return root ? readConfig(root, env.env).token !== undefined : readToken(env.env) !== undefined;
1001+ if (root && readConfig(root, env.env, tokenFileAsked).token === undefined) return undefined;
1002+ if (root && existsSync(join(stateDir(root), "key"))) return "this folder's key";
1003+ if (fromEnv(env.env, "TOKEN")?.trim()) return "ABSO_TOKEN";
1004+ if (root && runKey(env.env)) return "this pipeline run's key";
1005+ return tokenFileAsked && tokenFile() !== undefined ? "the token file, ~/.abso/token" : undefined;
9651006 } catch {
966− return false;
1007+ return undefined;
9671008 }
9681009}
9691010
Lines 1021–1038 at 318 (were 980–987 at 261)
9801021}
9811022
9821023export async function main(argv: readonly string[], env: Env): Promise<MainResult> {
1024+ try {
1025+ return await runMain(argv, env);
1026+ } finally {
1027+ // A local project's store stays open only while its command runs.
1028+ closeLocalStores();
1029+ }
1032+async function runMain(argv: readonly string[], env: Env): Promise<MainResult> {
9831033 const command = argv[0];
9841034 const json = argv.includes("--json") && command !== "run" && command !== "logs";
1035+ const asked = argv.includes("--token-file");
9851036 if (command === undefined || command === "help" || command === "--help" || command === "-h") {
9861037 if (json) {
9871038 const data = helpJson();
Lines 1096–1107 at 318 (were 1045–1051 at 261)
10451096 if (root !== undefined && isVisitor(root)) checkVisitor(command, parsed, readConfig(root, env.env).project);
10461097 const args = readBodyFiles(command, parsed, env.cwd, env.readStdin);
10471098 takeNews(); // what an earlier call in this process left (tests run many)
1048− const out = await def.run(args, named === undefined ? env : { ...env, server: named });
1099+ const runEnv: Env = {
1100+ ...env,
1101+ ...(named === undefined ? {} : { server: named }),
1102+ ...(bool(parsed, "token-file") ? { tokenFile: true } : {}),
1103+ };
1104+ const out = await def.run(args, runEnv);
10491105 const exit = out.exit ?? EXIT.ok;
10501106 // Every command that took news while recording prints it (#37, News Report).
10511107 const news = takeNews();
Lines 1123–1129 at 318 (were 1067–1073 at 261)
10671123 const e = err as Error;
10681124 const code = err instanceof UsageError ? "usage" : err instanceof ApiError ? "server" : "error";
10691125 const message =
1070− plainError(err, carriesCredential(env)) ??
1126+ plainError(err, credentialSent(env, asked), !asked && tokenFile() !== undefined) ??
10711127 (err instanceof UsageError || err instanceof ApiError
10721128 ? e.message
10731129 : `${e.message}${e.stack ? `\n${e.stack}` : ""}`);
Lines 1165–1172 at 318 (were 1109–1115 at 261)
11091165 request_url?: string;
11101166 role?: string;
11111167 };
1112− if (!asked.ok || !Array.isArray(body.people) || typeof body.request_url !== "string") return null;
1168+ if (!asked.ok || !Array.isArray(body.people) || typeof body.request_url !== "string")
1169+ throw new Error(body.error ?? `the server answered ${asked.status}`);
11131170 const expiresAt = Date.parse(body.expires_at ?? "");
11141171 const { api } = openIssues(env);
11151172 const when = new Intl.DateTimeFormat("en-US", { timeZone: "America/Chicago", hour: "numeric", minute: "2-digit" });
MCP
compare on this site's /mcp
CLI
abso diff 261 318 client/src/main.ts --json
JSON
/christopher/abso-core/compare/261..318?file=client%2Fsrc%2Fmain.ts&format=json