{"file":"client/src/state-dir.ts","version":318,"total":67,"from":1,"to":67,"lines":[{"n":1,"text":"// Where abso keeps its state (the rename from avcs). Reading takes .abso/ first, then .avcs/, so a folder in","atom":"a129","author":"pinch","version":18},{"n":2,"text":"// either works. A new folder is made with .abso/ unless an edit mod installed here is from before the rename:","atom":"a239","author":"review","version":28},{"n":3,"text":"// such a mod looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.","atom":"a239","author":"review","version":28},{"n":4,"text":"// So a new folder gets .avcs/ while any installed mod is older than MOD_KNOWS_ABSO, and .abso/ otherwise.","atom":"a239","author":"review","version":28},{"n":5,"text":"// The user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).","atom":"a239","author":"review","version":28},{"n":6,"text":"// Nothing here imports from the rest of the client, so any module can use this.","atom":"a239","author":"review","version":28},{"n":7,"text":"","atom":"a126","author":"review","version":17},{"n":8,"text":"import { existsSync, readFileSync } from \"node:fs\";","atom":"a239","author":"review","version":28},{"n":9,"text":"import { homedir } from \"node:os\";","atom":"a239","author":"review","version":28},{"n":10,"text":"import { join } from \"node:path\";","atom":"a0","author":"init","version":0},{"n":11,"text":"","atom":"a126","author":"review","version":17},{"n":12,"text":"export const STATE_DIR = \".abso\";","atom":"a126","author":"review","version":17},{"n":13,"text":"export const OLD_STATE_DIR = \".avcs\";","atom":"a126","author":"review","version":17},{"n":14,"text":"const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;","atom":"a126","author":"review","version":17},{"n":15,"text":"","atom":"a126","author":"review","version":17},{"n":16,"text":"/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else the new folder's name (newFolderDir). */","atom":"a239","author":"review","version":28},{"n":17,"text":"export function stateDir(root: string): string {","atom":"a126","author":"review","version":17},{"n":18,"text":"\tfor (const name of STATE_DIRS) if (existsSync(join(root, name, \"config.json\"))) return join(root, name);","atom":"a126","author":"review","version":17},{"n":19,"text":"\tfor (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);","atom":"a126","author":"review","version":17},{"n":20,"text":"\treturn join(root, newFolderDir());","atom":"a239","author":"review","version":28},{"n":21,"text":"}","atom":"a126","author":"review","version":17},{"n":22,"text":"","atom":"a129","author":"pinch","version":18},{"n":23,"text":"/** The first mod version whose hooks look for .abso/config.json as well as .avcs/config.json. */","atom":"a239","author":"review","version":28},{"n":24,"text":"export const MOD_KNOWS_ABSO = [0, 2, 0] as const;","atom":"a239","author":"review","version":28},{"n":25,"text":"","atom":"a239","author":"review","version":28},{"n":26,"text":"/** Every name a mod has been installed under, in Claude Code's skills folder. */","atom":"a239","author":"review","version":28},{"n":27,"text":"const MOD_NAMES = [\"avcs\", \"avcs-view\", \"abso\", \"abso-view\", \"abso-hooks\"] as const;","atom":"a400","author":"review","version":40},{"n":28,"text":"","atom":"a239","author":"review","version":28},{"n":29,"text":"function versionAtLeast(version: string, min: readonly number[]): boolean {","atom":"a239","author":"review","version":28},{"n":30,"text":"\tconst parts = version.split(\"+\")[0]!.split(\".\").map(Number);","atom":"a239","author":"review","version":28},{"n":31,"text":"\tfor (let i = 0; i < min.length; i++) {","atom":"a239","author":"review","version":28},{"n":32,"text":"\t\tconst have = parts[i] ?? 0;","atom":"a239","author":"review","version":28},{"n":33,"text":"\t\tif (have !== min[i]) return have > min[i]!;","atom":"a239","author":"review","version":28},{"n":34,"text":"\t}","atom":"a239","author":"review","version":28},{"n":35,"text":"\treturn true;","atom":"a239","author":"review","version":28},{"n":36,"text":"}","atom":"a239","author":"review","version":28},{"n":37,"text":"","atom":"a239","author":"review","version":28},{"n":38,"text":"/** What a new folder is made with: .abso, unless an installed mod is older than the rename (see the top). */","atom":"a239","author":"review","version":28},{"n":39,"text":"export function newFolderDir(env: Readonly<Record<string, string | undefined>> = process.env): string {","atom":"a239","author":"review","version":28},{"n":40,"text":"\tconst skills = join(env.CLAUDE_CONFIG_DIR || join(homedir(), \".claude\"), \"skills\");","atom":"a239","author":"review","version":28},{"n":41,"text":"\tfor (const name of MOD_NAMES) {","atom":"a239","author":"review","version":28},{"n":42,"text":"\t\tif (!existsSync(join(skills, name))) continue; // not installed","atom":"a265","author":"review","version":32},{"n":43,"text":"\t\tlet version: unknown;","atom":"a239","author":"review","version":28},{"n":44,"text":"\t\ttry {","atom":"a239","author":"review","version":28},{"n":45,"text":"\t\t\tversion = (JSON.parse(readFileSync(join(skills, name, \".avcs-install.json\"), \"utf8\")) as { version?: unknown })","atom":"a239","author":"review","version":28},{"n":46,"text":"\t\t\t\t.version;","atom":"a239","author":"review","version":28},{"n":47,"text":"\t\t} catch {","atom":"a239","author":"review","version":28},{"n":48,"text":"\t\t\treturn OLD_STATE_DIR; // installed, but no readable record: count it as old","atom":"a265","author":"review","version":32},{"n":49,"text":"\t\t}","atom":"a239","author":"review","version":28},{"n":50,"text":"\t\tif (typeof version !== \"string\" || !versionAtLeast(version, MOD_KNOWS_ABSO)) return OLD_STATE_DIR;","atom":"a239","author":"review","version":28},{"n":51,"text":"\t}","atom":"a239","author":"review","version":28},{"n":52,"text":"\treturn STATE_DIR;","atom":"a239","author":"review","version":28},{"n":53,"text":"}","atom":"a239","author":"review","version":28},{"n":54,"text":"","atom":"a126","author":"review","version":17},{"n":55,"text":"/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */","atom":"a126","author":"review","version":17},{"n":56,"text":"export function homeFile(home: string, ...parts: string[]): string {","atom":"a126","author":"review","version":17},{"n":57,"text":"\tfor (const name of STATE_DIRS) {","atom":"a126","author":"review","version":17},{"n":58,"text":"\t\tconst path = join(home, name, ...parts);","atom":"a126","author":"review","version":17},{"n":59,"text":"\t\tif (existsSync(path)) return path;","atom":"a126","author":"review","version":17},{"n":60,"text":"\t}","atom":"a126","author":"review","version":17},{"n":61,"text":"\treturn join(home, STATE_DIR, ...parts);","atom":"a126","author":"review","version":17},{"n":62,"text":"}","atom":"a126","author":"review","version":17},{"n":63,"text":"","atom":"a126","author":"review","version":17},{"n":64,"text":"/** 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. */","atom":"a126","author":"review","version":17},{"n":65,"text":"export function homeWritePath(home: string, ...parts: string[]): string {","atom":"a126","author":"review","version":17},{"n":66,"text":"\treturn join(home, STATE_DIR, ...parts);","atom":"a126","author":"review","version":17},{"n":67,"text":"}","atom":"a126","author":"review","version":17}],"atoms":[{"atom":"a0","author":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z","publish":{"draft":null,"version":0,"agent":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z"}},{"atom":"a126","author":"review","message":"","time":1791522270512,"timeIso":"2026-10-09T05:04:30.512Z","publish":{"draft":null,"version":17,"agent":"review","message":"New 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.","time":1791522270512,"timeIso":"2026-10-09T05:04:30.512Z"}},{"atom":"a129","author":"pinch","message":"","time":1791523142973,"timeIso":"2026-10-09T05:19:02.973Z","publish":{"draft":null,"version":18,"agent":"pinch","message":"New folders keep .avcs/ for now; the server keeps both state folders out of a project\n\nVersion 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.\n\nThe 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.\n\nTests: 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/.","time":1791523143960,"timeIso":"2026-10-09T05:19:03.960Z"}},{"atom":"a239","author":"review","message":"","time":1791539181105,"timeIso":"2026-10-09T09:46:21.105Z","publish":{"draft":null,"version":28,"agent":"review","message":"Client: 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)","time":1791539181568,"timeIso":"2026-10-09T09:46:21.568Z"}},{"atom":"a265","author":"review","message":"","time":1791541692946,"timeIso":"2026-10-09T10:28:12.946Z","publish":{"draft":null,"version":32,"agent":"review","message":"Client: 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)","time":1791541763659,"timeIso":"2026-10-09T10:29:23.659Z"}},{"atom":"a400","author":"review","message":"","time":1791549456768,"timeIso":"2026-10-09T12:37:36.768Z","publish":{"draft":null,"version":40,"agent":"review","message":"Mods: 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.","time":1791549457128,"timeIso":"2026-10-09T12:37:37.128Z"}}]}