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 27 to 28

Compare

+39 −10 in 1 place
Lines 1–56 at 28 (were 1–27 at 27)
11// Where abso keeps its state (the rename from avcs). Reading takes .abso/ first, then .avcs/, so a folder in
2−// either works. A new folder is still made with .avcs/ for now: an edit mod or Cursor hook installed before the
3−// rename looks only for .avcs/config.json, and would stop recording a .abso/ folder's edits without a word.
4−// New folders move to .abso/ once installs can say which mods know it; `abso migrate` will move old ones. The
5−// user's files are written to ~/.abso/ (an older client that can't find them says so: it isn't silent).
6−// No imports from the rest of the client, so any module can use this.
2+// 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.
77
8−import { existsSync } from "node:fs";
8+import { existsSync, readFileSync } from "node:fs";
9+import { homedir } from "node:os";
910import { join } from "node:path";
1011
1112export const STATE_DIR = ".abso";
1213export const OLD_STATE_DIR = ".avcs";
1314const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;
1415
15−/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else .avcs for a folder not made yet (see above). */
16+/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else the new folder's name (newFolderDir). */
1617export function stateDir(root: string): string {
1718 for (const name of STATE_DIRS) if (existsSync(join(root, name, "config.json"))) return join(root, name);
1819 for (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);
19− return join(root, NEW_FOLDER_DIR);
20+ return join(root, newFolderDir());
2021}
2122
22−/** What a new folder is made with: .avcs until installed mods can be relied on to know .abso. */
23−export const NEW_FOLDER_DIR: string = OLD_STATE_DIR;
23+/** The first mod version whose hooks look for .abso/config.json as well as .avcs/config.json. */
24+export const MOD_KNOWS_ABSO = [0, 2, 0] as const;
2425
26+/** Every name a mod has been installed under, in Claude Code's skills folder. */
27+const MOD_NAMES = ["avcs", "avcs-view", "abso", "abso-view"] as const;
29+function 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;
36+}
38+/** What a new folder is made with: .abso, unless an installed mod is older than the rename (see the top). */
39+export 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) {
42+ let version: unknown;
43+ try {
44+ version = (JSON.parse(readFileSync(join(skills, name, ".avcs-install.json"), "utf8")) as { version?: unknown })
45+ .version;
46+ } catch {
47+ continue; // not installed, or no readable record
48+ }
49+ if (typeof version !== "string" || !versionAtLeast(version, MOD_KNOWS_ABSO)) return OLD_STATE_DIR;
50+ }
51+ return STATE_DIR;
52+}
2554/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */
2655export function homeFile(home: string, ...parts: string[]): string {
2756 for (const name of STATE_DIRS) {
MCP
compare on this site's /mcp
CLI
abso diff 27 28 client/src/state-dir.ts --json
JSON
/christopher/abso-core/compare/27..28?file=client%2Fsrc%2Fstate-dir.ts&format=json