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
MCP
blame on this site's /mcp
CLI
abso blame client/src/visitor.ts --draft codex-npm-package --json
JSON
/christopher/abso-core/blame/client/src/visitor.ts?draft=codex-npm-package&format=json
44 linespinch 100%Last change pinch in version 86,

44 lines from 1 change in 1 version.

pinch86Read a public project signed out: abso join <project> --reader with no sign-in makes a folder that reads it. The folder holds only its settings (server, project, visitor), sends no sign-in whatever the environment or the box holds, follows no redirect, and runs status, log, show, files, blame, why, where, issues, issue and search; every other command is refused before any call, from an allow-list a new command has to join. join answers a private project and a missing one alike, by the status answer's code alone. Tests in client/test/visitor.test.ts.Compare1// A visitor folder: abso join <project> --reader with no sign-in, for a public project. It reads the
2// project through the routes anyone can read, and sends no credential, whatever the environment holds
3// (config.ts reads no token for it, and Api sends none and follows no redirect). Which commands it runs
4// is a list of reads: anything not on it is refused here, before any call, so a new command stays
5// refused until someone adds it. The server refuses writes from it too; this is so the refusal is plain.
6
7import { type Parsed, UsageError } from "./args.ts";
8
9/** The commands a visitor folder runs, each with the flags it takes there. */
10export const VISITOR_READS: Readonly<Record<string, readonly string[]>> = {
11 status: [],
12 log: ["limit", "before", "draft", "since", "by", "count"],
13 show: ["draft"],
14 files: ["draft", "version"],
15 blame: ["from", "to", "version", "draft"],
16 why: ["draft"],
17 where: [],
18 issues: ["open", "status", "agent", "parent", "label", "labels"],
19 issue: [],
20 search: ["limit"],
21};
23/** Commands about this box, not the folder: they work from anywhere, a visitor folder too. */
24export const VISITOR_ELSEWHERE: readonly string[] = ["login", "logout"];
26/** Flags every command takes. */
27const EVERY = new Set(["json", "help"]);
29export function visitorRefusal(project: string): string {
30 return `This folder reads ${project} signed out. To work on it: abso login, then abso join ${project} in a new folder.`;
33/** Refuses, before any call, a command or a flag a visitor folder doesn't run. */
34export function checkVisitor(command: string, args: Parsed, project: string): void {
35 if (VISITOR_ELSEWHERE.includes(command)) return;
36 const flags = VISITOR_READS[command];
37 if (flags === undefined) throw new UsageError(visitorRefusal(project));
38 for (const name of args.flags.keys())
39 if (!EVERY.has(name) && !flags.includes(name))
40 throw new UsageError(`${visitorRefusal(project)} Here, ${command} reads only; --${name} isn't one of its reads.`);
41 // abso issue new and abso issue draft write: here, issue takes only a number.
42 if (command === "issue" && !(args.positionals.length === 1 && /^#?\d+$/.test(args.positionals[0]!)))
43 throw new UsageError(`${visitorRefusal(project)} Here, issue reads one issue: abso issue <N>.`);