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
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/client/src/state-dir.ts?version=22&format=json
37 linesreview 70% · pinch 27% · First import 3%Last change pinch in version 18, 2 versions changed it

You're reading version 22. The newest is 318, and 3 versions since then changed this file. Go to the newestCompare with 318

1// 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.
7
8import { existsSync } from "node:fs";
9import { join } from "node:path";
11export const STATE_DIR = ".abso";
12export const OLD_STATE_DIR = ".avcs";
13const STATE_DIRS = [STATE_DIR, OLD_STATE_DIR] as const;
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). */
16export function stateDir(root: string): string {
17 for (const name of STATE_DIRS) if (existsSync(join(root, name, "config.json"))) return join(root, name);
18 for (const name of STATE_DIRS) if (existsSync(join(root, name))) return join(root, name);
19 return join(root, NEW_FOLDER_DIR);
22/** What a new folder is made with: .avcs until installed mods can be relied on to know .abso. */
23export const NEW_FOLDER_DIR: string = OLD_STATE_DIR;
25/** A file under the user's home to read: ~/.abso/<parts>, else the old ~/.avcs/<parts> when only that exists, else the new place. */
26export function homeFile(home: string, ...parts: string[]): string {
27 for (const name of STATE_DIRS) {
28 const path = join(home, name, ...parts);
29 if (existsSync(path)) return path;
30 }
31 return join(home, STATE_DIR, ...parts);
34/** 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. */
35export function homeWritePath(home: string, ...parts: string[]): string {
36 return join(home, STATE_DIR, ...parts);