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/test/new-folder-dir.test.ts?format=json
38 linesreview 100%Last change review in version 32, 2 versions changed it
1import assert from "node:assert/strict";
2import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
3import { tmpdir } from "node:os";
4import { join } from "node:path";
5import { test } from "node:test";
6import { newFolderDir } from "../src/state-dir.ts";
7
8/** A Claude config folder with these mods installed, each at this version. */
9function claudeWith(mods: Record<string, string>): { CLAUDE_CONFIG_DIR: string } {
10 const dir = mkdtempSync(join(tmpdir(), "abso-claude-"));
11 for (const [name, version] of Object.entries(mods)) {
12 const mod = join(dir, "skills", name);
13 mkdirSync(mod, { recursive: true });
14 writeFileSync(join(mod, ".avcs-install.json"), JSON.stringify({ mod: name, version }));
15 }
16 return { CLAUDE_CONFIG_DIR: dir };
19test("a new folder gets .abso when no mod is installed, or every installed mod knows it", () => {
20 assert.equal(newFolderDir(claudeWith({})), ".abso");
21 assert.equal(newFolderDir(claudeWith({ avcs: "0.2.0+abc1234", "avcs-view": "0.2.0" })), ".abso");
22 assert.equal(newFolderDir(claudeWith({ abso: "0.3.1.dirty" })), ".abso");
23});
25test("a new folder keeps .avcs while any installed mod is older than the rename", () => {
26 assert.equal(newFolderDir(claudeWith({ avcs: "0.1.0+2ecf1a7" })), ".avcs");
27 assert.equal(newFolderDir(claudeWith({ avcs: "0.2.0", "avcs-view": "0.1.0" })), ".avcs");
28 assert.equal(newFolderDir(claudeWith({ avcs: "unreadable" })), ".avcs");
29});
31test("a mod folder with no readable install record counts as old", () => {
32 const env = claudeWith({});
33 const mod = join(env.CLAUDE_CONFIG_DIR, "skills", "avcs");
34 mkdirSync(mod, { recursive: true }); // copied in by hand: no .avcs-install.json
35 assert.equal(newFolderDir(env), ".avcs");
36 writeFileSync(join(mod, ".avcs-install.json"), "not json");
37 assert.equal(newFolderDir(env), ".avcs");
38});