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=17&format=json
32 linesreview 97% · First import 3%Last change review in version 17, 1 version changed it

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

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
6import { existsSync } from "node:fs";
7import { join } from "node:path";
8
9export const STATE_DIR = ".abso";
10export const OLD_STATE_DIR = ".avcs";
11const 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. */
14export 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);
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. */
21export 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);
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. */
30export function homeWritePath(home: string, ...parts: string[]): string {
31 return join(home, STATE_DIR, ...parts);