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/state-dir.ts --json
JSON
/christopher/abso-core/blame/client/src/state-dir.ts?format=json
67 linesreview 96% · pinch 3% · First import 1%Last change review in version 40,

67 lines from 6 changes in 6 versions.

pinch18New folders keep .avcs/ for now; the server keeps both state folders out of a project Version 17 made new folders with .abso/. An edit mod or Cursor hook installed before the rename looks only for .avcs/config.json, so in a .abso/ folder it would stop recording edits, and nothing would say so. Until installs can say which mods know .abso/, a new folder is made with .avcs/ again (NEW_FOLDER_DIR in client/src/state-dir.ts). Reading is unchanged: a folder with .abso/ works exactly as one with .avcs/, and neither is ever half-moved. The user's files still go to ~/.abso/, since an older client that can't find them says so. The server refused only paths under .avcs/, and the test server only .abso/. Both now refuse both, so a folder's state never becomes part of a project, whichever name it has. Tests: new folders get .avcs/; a folder moved to .abso/ records and isn't moved back; the tests that assumed .abso/ for a new folder now use .avcs/.Compare1// Where abso keeps its state (the rename from avcs). Reading takes .abso/ first, then .avcs/, so a folder in
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare2// either works. A new folder is made with .abso/ unless an edit mod installed here is from before the rename:
3// such a mod looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.
4// So a new folder gets .avcs/ while any installed mod is older than MOD_KNOWS_ABSO, and .abso/ otherwise.
5// The user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).
6// Nothing here imports from the rest of the client, so any module can use this.
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.Compare7
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare8import { existsSync, readFileSync } from "node:fs";
9import { homedir } from "node:os";
init0Start the project10import { join } from "node:path";
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.Compare11
12export const STATE_DIR = ".abso";
13export const OLD_STATE_DIR = ".avcs";
14const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare16/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else the new folder's name (newFolderDir). */
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.Compare17export function stateDir(root: string): string {
18 for (const name of STATE_DIRS) if (existsSync(join(root, name, "config.json"))) return join(root, name);
19 for (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare20 return join(root, newFolderDir());
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.Compare21}
pinch18New folders keep .avcs/ for now; the server keeps both state folders out of a project Version 17 made new folders with .abso/. An edit mod or Cursor hook installed before the rename looks only for .avcs/config.json, so in a .abso/ folder it would stop recording edits, and nothing would say so. Until installs can say which mods know .abso/, a new folder is made with .avcs/ again (NEW_FOLDER_DIR in client/src/state-dir.ts). Reading is unchanged: a folder with .abso/ works exactly as one with .avcs/, and neither is ever half-moved. The user's files still go to ~/.abso/, since an older client that can't find them says so. The server refused only paths under .avcs/, and the test server only .abso/. Both now refuse both, so a folder's state never becomes part of a project, whichever name it has. Tests: new folders get .avcs/; a folder moved to .abso/ records and isn't moved back; the tests that assumed .abso/ for a new folder now use .avcs/.Compare22
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare23/** The first mod version whose hooks look for .abso/config.json as well as .avcs/config.json. */
24export const MOD_KNOWS_ABSO = [0, 2, 0] as const;
26/** Every name a mod has been installed under, in Claude Code's skills folder. */
review40Mods: the hooks mod is abso-hooks and the view mod abso-view; an install moves the old skills/avcs and skills/avcs-view folders to ~/.abso/retired-mods (moved, not deleted); the hook stands down for either name; status checks either. Tests cover the move.Compare27const MOD_NAMES = ["avcs", "avcs-view", "abso", "abso-view", "abso-hooks"] as const;
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare28
29function versionAtLeast(version: string, min: readonly number[]): boolean {
30 const parts = version.split("+")[0]!.split(".").map(Number);
31 for (let i = 0; i < min.length; i++) {
32 const have = parts[i] ?? 0;
33 if (have !== min[i]) return have > min[i]!;
34 }
35 return true;
38/** What a new folder is made with: .abso, unless an installed mod is older than the rename (see the top). */
39export function newFolderDir(env: Readonly<Record<string, string | undefined>> = process.env): string {
40 const skills = join(env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"), "skills");
41 for (const name of MOD_NAMES) {
review32Client: tests no longer read this machine's Claude folder (setup.ts), a mod folder with no readable install record counts as old, import-git keeps .abso (Pinch's review of 28, abso 253)Compare42 if (!existsSync(join(skills, name))) continue; // not installed
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare43 let version: unknown;
44 try {
45 version = (JSON.parse(readFileSync(join(skills, name, ".avcs-install.json"), "utf8")) as { version?: unknown })
46 .version;
47 } catch {
review32Client: tests no longer read this machine's Claude folder (setup.ts), a mod folder with no readable install record counts as old, import-git keeps .abso (Pinch's review of 28, abso 253)Compare48 return OLD_STATE_DIR; // installed, but no readable record: count it as old
review28Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)Compare49 }
50 if (typeof version !== "string" || !versionAtLeast(version, MOD_KNOWS_ABSO)) return OLD_STATE_DIR;
51 }
52 return STATE_DIR;
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.Compare54
55/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */
56export function homeFile(home: string, ...parts: string[]): string {
57 for (const name of STATE_DIRS) {
58 const path = join(home, name, ...parts);
59 if (existsSync(path)) return path;
60 }
61 return join(home, STATE_DIR, ...parts);
64/** Where to write a file under the user's home: always the new place. The old file is left as it is, for older clients and mods. */
65export function homeWritePath(home: string, ...parts: string[]): string {
66 return join(home, STATE_DIR, ...parts);