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 16 to 17

Compare

+32 −0 in 1 place
new file, 32 lines
1+// Where abso keeps its state (the rename from avcs). A new folder keeps it in .abso/ and the user's in ~/.abso/.
2+// Folders and machines from before keep working on .avcs/ and ~/.avcs/, untouched: a folder is never half-moved,
3+// so an older client or installed mod still finds it. A later `abso migrate` moves a folder once its mods are updated.
4+// No imports from the rest of the client, so any module can use this.
5+
6+import { existsSync } from "node:fs";
7+import { join } from "node:path";
8+
9+export const STATE_DIR = ".abso";
10+export const OLD_STATE_DIR = ".avcs";
11+const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;
13+/** A folder's state folder: whichever has a config.json (.abso first), else whichever exists, else .abso for a folder not made yet. */
14+export function stateDir(root: string): string {
15+ for (const name of STATE_DIRS) if (existsSync(join(root, name, "config.json"))) return join(root, name);
16+ for (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);
17+ return join(root, STATE_DIR);
18+}
20+/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */
21+export function homeFile(home: string, ...parts: string[]): string {
22+ for (const name of STATE_DIRS) {
23+ const path = join(home, name, ...parts);
24+ if (existsSync(path)) return path;
25+ }
26+ return join(home, STATE_DIR, ...parts);
27+}
29+/** 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. */
30+export function homeWritePath(home: string, ...parts: string[]): string {
31+ return join(home, STATE_DIR, ...parts);
32+}
MCP
compare on this site's /mcp
CLI
abso diff 16 17 client/src/state-dir.ts --json
JSON
/christopher/abso-core/compare/16..17?file=client%2Fsrc%2Fstate-dir.ts&format=json