{"draft":null,"from":2,"to":318,"files":[{"path":"client/test/skill.test.ts","added":58,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/skill.test.ts\n@@ -0,0 +1,58 @@\n+// abso skill: the skill the client carries, and where install\n+// writes it.\n+\n+import assert from \"node:assert/strict\";\n+import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\n+import { tmpdir } from \"node:os\";\n+import { join, resolve } from \"node:path\";\n+import { after, describe, it } from \"node:test\";\n+import { main } from \"../src/main.ts\";\n+import { installSkill, SKILL, skillPath } from \"../src/skill.ts\";\n+\n+const dir = mkdtempSync(join(tmpdir(), \"abso-skill-\"));\n+after(() => rmSync(dir, { recursive: true, force: true }));\n+\n+describe(\"abso skill\", () => {\n+\tit(\"carries client/skills/abso/SKILL.md word for word\", () => {\n+\t\tassert.equal(SKILL, readFileSync(new URL(\"../skills/abso/SKILL.md\", import.meta.url), \"utf8\"));\n+\t});\n+\n+\tit(\"is instructions only: named abso, with no tools to allow\", () => {\n+\t\tconst front = /^---\\n([\\s\\S]*?)\\n---\\n/.exec(SKILL)?.[1];\n+\t\tassert.ok(front, \"the skill starts with its frontmatter\");\n+\t\tassert.match(front, /^name: abso$/m);\n+\t\tassert.match(front, /^description: .+/m);\n+\t\tassert.doesNotMatch(SKILL, /allowed-tools/i);\n+\t});\n+\n+\tit(\"goes to ~/.claude/skills/abso/SKILL.md, or under the skills folder --dir names\", () => {\n+\t\tassert.equal(skillPath(undefined, \"/work\", \"/home/a\"), join(\"/home/a\", \".claude\", \"skills\", \"abso\", \"SKILL.md\"));\n+\t\tassert.equal(skillPath(\"skills\", \"/work\", \"/home/a\"), join(resolve(\"/work\"), \"skills\", \"abso\", \"SKILL.md\"));\n+\t});\n+\n+\tit(\"installs, says when it's already current, updates, and leaves the rest of the folder alone\", () => {\n+\t\tconst skills = join(dir, \"skills\");\n+\t\tconst path = skillPath(skills, dir);\n+\t\tassert.equal(installSkill(path), \"installed\");\n+\t\tassert.equal(readFileSync(path, \"utf8\"), SKILL);\n+\t\tassert.equal(installSkill(path), \"current\");\n+\t\twriteFileSync(join(skills, \"abso\", \"notes.md\"), \"mine\");\n+\t\twriteFileSync(path, \"an older skill\");\n+\t\tassert.equal(installSkill(path), \"updated\");\n+\t\tassert.equal(readFileSync(path, \"utf8\"), SKILL);\n+\t\tassert.deepEqual(readdirSync(join(skills, \"abso\")).sort(), [\"SKILL.md\", \"notes.md\"]);\n+\t});\n+\n+\tit(\"runs outside an abso folder, and shows the skill\", async () => {\n+\t\tconst run = (...argv: string[]) => main(argv, { cwd: dir, env: {}, write: () => {} });\n+\t\tconst installed = await run(\"skill\", \"install\", \"--dir\", \"elsewhere\");\n+\t\tassert.equal(installed.exit, 0, installed.stderr);\n+\t\tassert.match(installed.stdout, /^Installed the abso skill at .*SKILL\\.md\\. New Claude Code sessions load it\\./);\n+\t\tassert.equal(readFileSync(join(dir, \"elsewhere\", \"abso\", \"SKILL.md\"), \"utf8\"), SKILL);\n+\t\tconst shown = await run(\"skill\", \"show\");\n+\t\tassert.equal(shown.stdout.trimEnd(), SKILL.trimEnd());\n+\t\tconst wrong = await run(\"skill\", \"remove\");\n+\t\tassert.notEqual(wrong.exit, 0);\n+\t\tassert.match(wrong.stderr, /abso skill install \\[--dir <skills folder>\\] \\| abso skill show/);\n+\t});\n+});"}],"unmatched":[]}