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 270 to 271

Compare

+21 −11 in 8 places
Lines 38–48 at 271 (were 38–47 at 270)
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, 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–64 at 271 (were 57–63 at 270)
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";
6162import { browserSkip, openInBrowser } from "./open-browser.ts";
6263import { runOrg, runOrgs } from "./orgs.ts";
6364import { runUnqueue } from "./queue.ts";
Lines 149–166 at 271 (were 148–164 at 270)
148149 if (!root) throw new UsageError("abso key runs inside an agent's folder, or takes --server <url>");
149150 let config: ReturnType<typeof readConfig>;
150151 try {
151− config = readConfig(root, env.env);
152+ config = readConfig(root, env.env, env.tokenFile === true);
152153 } catch {
153154 config = {
154155 server: serverFlag ?? "",
155156 project: str(args, "project") ?? "",
156157 agent: "admin",
157− token: readToken(env.env),
158+ token: fromEnv(env.env, "TOKEN")?.trim() || (env.tokenFile ? tokenFile() : undefined),
158159 };
159160 }
160161 if (serverFlag) config = { ...config, server: serverFlag };
161162 const admin = adminToken(env.env);
163+ (env.writeErr ?? env.write)(`${adminTokenWords(env.env)}\n`);
162164 if (sub === "new" && args.positionals.length === 2) {
163165 const server = str(args, "server") ?? config.server;
164166 const project = str(args, "project") ?? config.project;
Lines 878–891 at 271 (were 876–889 at 270)
876878
877879const HELP_INTRO = "abso: version control for agents. This is its command-line client.";
878880const HELP_NOTE =
879− "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). " +
881+ "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. " +
880882 "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 " +
881883 SERVER_ORDER +
882884 ": which servers this box is signed in to plays no part.";
883885
884−/** A command's flags: its own, and --server for every command that talks to a server (server-choice.ts). */
886+/** A command's flags: its own, and --server and --token-file for every command that talks to a server (server-choice.ts). */
885887function flagsOf(name: string, def: CommandDef): FlagSpec {
886− return serverUse(name) === "local" ? def.flags : { ...def.flags, server: "string" };
888+ return serverUse(name) === "local" ? def.flags : { ...def.flags, server: "string", "token-file": "boolean" };
887889}
888890
889891/** Every command as help shows it, in order: the table's, then the three it doesn't hold. */
Lines 962–973 at 271 (were 960–969 at 270)
960962}
961963
962964/** Whether this folder's calls carry a key or token, for how a refusal is worded. False when that can't be told. */
963−function carriesCredential(env: Env): boolean {
965+function carriesCredential(env: Env, tokenFileAsked: boolean): boolean {
964966 try {
965967 const root = findRoot(env.cwd);
966− return root ? readConfig(root, env.env).token !== undefined : readToken(env.env) !== undefined;
968+ return root
969+ ? readConfig(root, env.env, tokenFileAsked).token !== undefined
970+ : (fromEnv(env.env, "TOKEN") ?? (tokenFileAsked ? tokenFile() : undefined)) !== undefined;
967971 } catch {
968972 return false;
969973 }
Lines 988–994 at 271 (were 984–989 at 270)
984988export async function main(argv: readonly string[], env: Env): Promise<MainResult> {
985989 const command = argv[0];
986990 const json = argv.includes("--json") && command !== "run" && command !== "logs";
991+ const asked = argv.includes("--token-file");
987992 if (command === undefined || command === "help" || command === "--help" || command === "-h") {
988993 if (json) {
989994 const data = helpJson();
Lines 1052–1063 at 271 (were 1047–1053 at 270)
10471052 if (root !== undefined && isVisitor(root)) checkVisitor(command, parsed, readConfig(root, env.env).project);
10481053 const args = readBodyFiles(command, parsed, env.cwd, env.readStdin);
10491054 takeNews(); // what an earlier call in this process left (tests run many)
1050− const out = await def.run(args, named === undefined ? env : { ...env, server: named });
1055+ const runEnv: Env = {
1056+ ...env,
1057+ ...(named === undefined ? {} : { server: named }),
1058+ ...(bool(parsed, "token-file") ? { tokenFile: true } : {}),
1059+ };
1060+ const out = await def.run(args, runEnv);
10511061 const exit = out.exit ?? EXIT.ok;
10521062 // Every command that took news while recording prints it (#37, News Report).
10531063 const news = takeNews();
Lines 1079–1085 at 271 (were 1069–1075 at 270)
10691079 const e = err as Error;
10701080 const code = err instanceof UsageError ? "usage" : err instanceof ApiError ? "server" : "error";
10711081 const message =
1072− plainError(err, carriesCredential(env)) ??
1082+ plainError(err, carriesCredential(env, asked), !asked && tokenFile() !== undefined) ??
10731083 (err instanceof UsageError || err instanceof ApiError
10741084 ? e.message
10751085 : `${e.message}${e.stack ? `\n${e.stack}` : ""}`);
MCP
compare on this site's /mcp
CLI
abso diff 270 271 client/src/main.ts --json
JSON
/christopher/abso-core/compare/270..271?file=client%2Fsrc%2Fmain.ts&format=json