fix(cli): harden setup and destructive workflows

This commit is contained in:
N0zoM1z0
2026-07-14 20:32:18 +00:00
parent bf9619267b
commit c240ae19c6
13 changed files with 351 additions and 53 deletions
+13
View File
@@ -3,6 +3,7 @@ import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { installCanonicalSkill } from "../src/application/Setup.js";
import { canonicalSkillInstallationNeeded } from "../src/application/SetupSkill.js";
import { TOOL_CONTRACTS } from "../src/contracts/toolContracts.js";
const roots: string[] = [];
@@ -32,6 +33,18 @@ describe("canonical skill transaction", () => {
`tool_count: ${String(TOOL_CONTRACTS.length)}`,
);
expect(await readFile(sibling, "utf8")).toBe("unrelated skill\n");
expect(await canonicalSkillInstallationNeeded(home)).toBe(false);
expect(await installCanonicalSkill(home)).toBe("unchanged");
});
it("reports a missing or stale canonical skill as needing installation", async () => {
const home = await mkdtemp(join(tmpdir(), "rea-skill-plan-test-"));
roots.push(home);
const destination = join(home, ".agents/skills/rea-analysis/SKILL.md");
expect(await canonicalSkillInstallationNeeded(home)).toBe(true);
await mkdir(dirname(destination), { recursive: true });
await writeFile(destination, "stale managed skill\n");
expect(await canonicalSkillInstallationNeeded(home)).toBe(true);
});
});