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 85 to 86

Compare

+44 −0 in 1 place
new file, 44 lines
1+// 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+
7+import { type Parsed, UsageError } from "./args.ts";
8+
9+/** The commands a visitor folder runs, each with the flags it takes there. */
10+export 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. */
24+export const VISITOR_ELSEWHERE: readonly string[] = ["login", "logout"];
26+/** Flags every command takes. */
27+const EVERY = new Set(["json", "help"]);
29+export 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.`;
31+}
33+/** Refuses, before any call, a command or a flag a visitor folder doesn't run. */
34+export 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>.`);
44+}
MCP
compare on this site's /mcp
CLI
abso diff 85 86 client/src/visitor.ts --json
JSON
/christopher/abso-core/compare/85..86?file=client%2Fsrc%2Fvisitor.ts&format=json