- MCP
- blame on this site's /mcp
- CLI
- abso blame client/src/command-env.ts --version 76 --json
- JSON
- /christopher/abso-core/blame/client/src/command-env.ts?version=76&format=json
65 linesFirst import 95% · pinch 3% · speed 2%Last change speed in version 76,
65 lines from 3 changes in 3 versions.
init0Start the project1// What every abso command shares: its output, its environment, the folder it opens, and the news it took.
3import { Api, type News, newsLines, type RunKind } from "./api.ts";
4import { UsageError } from "./args.ts";
5import { type Config, findRoot, readConfig } from "./config.ts";
pinch33Client: a tell reads as who told you and how sure that is, with what was said on the lines below: "ann (as claimed) told you:", "Robin (a person) told you:", "ann (checked) told you:" for an agent with a key of its own. A person's words are unquoted and their id is left out (news.log keeps the sentence whole). Tells are never cut in an agent's context, and later lines are indented everywhere news is printed (news, the News: block, the edit hook). What the server stores is unchanged. Client tests 273/273, tsc and biome clean.Compare6import { newsBlockLines, newsShown } from "./core.ts";
9export const EXIT = { ok: 0, error: 1, refused: 2 } as const;
11export interface Output {
12 readonly text: string;
13 readonly json: Record<string, unknown>;
14 readonly exit?: number;
15}
17export interface Env {
18 readonly cwd: string;
19 readonly env: Readonly<Record<string, string | undefined>>;
20 /** Where `run` streams the box's output as it arrives. */
21 readonly write: (text: string) => void;
22 /** Where `run` streams the box's stderr; `write` when not given. */
23 readonly writeErr?: (text: string) => void;
24 /** What a box run is for, when a command runs one for its own ends (shot, bisect, publish --check). */
25 readonly runKind?: RunKind;
26 /** What a -file flag of - reads: stdin, unless a test gives it. */
27 readonly readStdin?: () => string;
28}
30export function plural(n: number, word: string): string {
31 return `${n} ${word}${n === 1 ? "" : "s"}`;
32}
34export function open(env: Env): { root: string; config: Config; api: Api } {
35 const root = findRoot(env.cwd);
36 if (root === undefined)
37 throw new UsageError(
speed76abso whoami and abso doctor, and plainer errors.
- abso whoami: this box's sign-in as the server sees it (a revoked one shows as revoked), its projects, roles and expiry, and this folder's project, agent and kind of key. It names who approved the box when the server says.
- abso doctor: one line per check, ok, fail or skip: Node's version (20 or later for the npm package, 24 for a checkout), that the server answers, this box's sign-in (present, unexpired, accepted), and this folder's key against its project (a GET of the project's head, which the server answers only after checking the key). A failed check gives the next step, and the exit is 1.
- Neither prints a credential. Both are MCP tools too.
- The commonest failures now say what to do: a 401 with no credential reads 'You're not signed in. Run abso login, then abso join <project>.'; a refused key points to abso doctor; a server that can't be reached reads 'Can't reach <server>...' with the next step, unless the message already gives one; and outside a folder, 'You're not in an abso folder' says how to make one.Compare38 `You're not in an abso folder: ${env.cwd} has no .abso/config.json, nor does any folder above it. abso join <project> makes one, or abso init a new project.`,
40 const config = readConfig(root, env.env);
41 return { root, config, api: new Api(config) };
42}
44/**
45 * News a command took from the server while recording first. main() prints it
46 * after whatever the command says, so every command that takes news shows it
47 * (#37, News Report: sync, run and diff took it, wrote it to .avcs/news.log and
48 * printed nothing; 94 of the game's 613 items, 54 of them announcements).
49 */
50const takenNews: string[] = [];
51export function takeNews(): string[] {
52 return takenNews.splice(0);
53}
55/** News a record answered with: kept in .avcs/news.log, and printed by main(). */
56export function heard(root: string, news: News | undefined): void {
57 const lines = newsLines(news);
58 logNews(root, lines);
59 takenNews.push(...lines);
60}
62export function newsText(news: News): string[] {
63 const lines = newsLines(news);
pinch33Client: a tell reads as who told you and how sure that is, with what was said on the lines below: "ann (as claimed) told you:", "Robin (a person) told you:", "ann (checked) told you:" for an agent with a key of its own. A person's words are unquoted and their id is left out (news.log keeps the sentence whole). Tells are never cut in an agent's context, and later lines are indented everywhere news is printed (news, the News: block, the edit hook). What the server stores is unchanged. Client tests 273/273, tsc and biome clean.Compare64 return newsBlockLines(lines.map((n) => newsShown(n)));