{"draft":null,"from":7,"to":318,"files":[{"path":"client/test/new-folder-dir.test.ts","added":38,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/new-folder-dir.test.ts\n@@ -0,0 +1,38 @@\n+import assert from \"node:assert/strict\";\n+import { mkdirSync, mkdtempSync, writeFileSync } from \"node:fs\";\n+import { tmpdir } from \"node:os\";\n+import { join } from \"node:path\";\n+import { test } from \"node:test\";\n+import { newFolderDir } from \"../src/state-dir.ts\";\n+\n+/** A Claude config folder with these mods installed, each at this version. */\n+function claudeWith(mods: Record<string, string>): { CLAUDE_CONFIG_DIR: string } {\n+\tconst dir = mkdtempSync(join(tmpdir(), \"abso-claude-\"));\n+\tfor (const [name, version] of Object.entries(mods)) {\n+\t\tconst mod = join(dir, \"skills\", name);\n+\t\tmkdirSync(mod, { recursive: true });\n+\t\twriteFileSync(join(mod, \".avcs-install.json\"), JSON.stringify({ mod: name, version }));\n+\t}\n+\treturn { CLAUDE_CONFIG_DIR: dir };\n+}\n+\n+test(\"a new folder gets .abso when no mod is installed, or every installed mod knows it\", () => {\n+\tassert.equal(newFolderDir(claudeWith({})), \".abso\");\n+\tassert.equal(newFolderDir(claudeWith({ avcs: \"0.2.0+abc1234\", \"avcs-view\": \"0.2.0\" })), \".abso\");\n+\tassert.equal(newFolderDir(claudeWith({ abso: \"0.3.1.dirty\" })), \".abso\");\n+});\n+\n+test(\"a new folder keeps .avcs while any installed mod is older than the rename\", () => {\n+\tassert.equal(newFolderDir(claudeWith({ avcs: \"0.1.0+2ecf1a7\" })), \".avcs\");\n+\tassert.equal(newFolderDir(claudeWith({ avcs: \"0.2.0\", \"avcs-view\": \"0.1.0\" })), \".avcs\");\n+\tassert.equal(newFolderDir(claudeWith({ avcs: \"unreadable\" })), \".avcs\");\n+});\n+\n+test(\"a mod folder with no readable install record counts as old\", () => {\n+\tconst env = claudeWith({});\n+\tconst mod = join(env.CLAUDE_CONFIG_DIR, \"skills\", \"avcs\");\n+\tmkdirSync(mod, { recursive: true }); // copied in by hand: no .avcs-install.json\n+\tassert.equal(newFolderDir(env), \".avcs\");\n+\twriteFileSync(join(mod, \".avcs-install.json\"), \"not json\");\n+\tassert.equal(newFolderDir(env), \".avcs\");\n+});"}],"unmatched":[]}