- MCP
- blame on this site's /mcp
- CLI
- abso blame client/src/command-env.ts --draft login-timeout --json
- JSON
- /christopher/abso-core/blame/client/src/command-env.ts?draft=login-timeout&format=json
65 linesFirst import 95% · pinch 3% · review 2%Last change pinch in version 33,
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(
review17New folders keep their state in .abso/, and the machine's sign-in, servers and admin token are read from ~/.abso/ first, then ~/.avcs/. A folder made before, with only .avcs/, is untouched: it keeps working, is never half-moved, and no older client or mod loses it. stateDir(root) and homeFile/homeWritePath are in the new client/src/state-dir.ts and replace the old AVCS_DIR constant everywhere. abso login writes only to ~/.abso/ and leaves ~/.avcs/ alone; logout removes both copies. The edit mod and the view mod read either folder. .abso is skipped like .avcs (including its odd spellings), the git exclude names whichever folder is in use, and the messages name .abso. Not changed: avcs.json (the server reads that name, so abso.json needs the server to learn it first), .avcsignore, env var names and wire headers. Tests: 709 run, 708 pass (one is skipped), including new ones for the folder choice, the home-file order and box sign-in; biome ci has no errors.Compare38 `${env.cwd} is not in an abso folder (no .abso/config.json here or above); run abso init or abso join first`,
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)));