Add multi-host skill bridge for WorkBuddy, Claude, and Qoder
Decouple agent host skill bridging into dedicated module src/core/agent-hosts/: - antigravity.ts: manage ~/.gemini/config/skills.json - symlink-hosts.ts: detect and bridge ~/.workbuddy, ~/.claude, and ~/.qoder - types.ts: explicit types for host results and statuses - agent-hosts.test.ts: isolated unit tests for host discovery and symlinks Respect existing parent symlinks, replace legacy real directories safely, prevent dotfile pollution by only acting when host roots exist, and expose unified hosts array in seal-use skill install & status.
This commit is contained in:
1 parent
ee4cb332d9
commit
fb673f754e
8 files changed
+785
-254
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import packageJson from "../../package.json" with { type: "json" };
|
||||
@@ -8,12 +8,10 @@ import {
|
||||
EMBEDDED_SKILL_ASSETS,
|
||||
EMBEDDED_SKILL_FILES,
|
||||
EMBEDDED_SKILL_VERSION,
|
||||
getAntigravitySkillsStatus,
|
||||
getSkillContent,
|
||||
installSkillFiles,
|
||||
parseSkillVersion,
|
||||
readInstalledSkillVersion,
|
||||
syncAntigravitySkillsConfig
|
||||
readInstalledSkillVersion
|
||||
} from "./embedded-skill.js";
|
||||
|
||||
describe("embedded-skill", () => {
|
||||
@@ -46,10 +44,6 @@ describe("embedded-skill", () => {
|
||||
});
|
||||
|
||||
describe("embedded-skill version contract", () => {
|
||||
// A version-tagged document that nothing asserts on drifts silently: `seal-use update` shipped
|
||||
// the previous release's skill for several versions, because "the file was written" looked like
|
||||
// success from every angle. Keeping the skill and the package in step is a failing test now
|
||||
// rather than a discovery.
|
||||
test("the skill's version matches the package version", () => {
|
||||
expect(EMBEDDED_SKILL_VERSION).toBe(packageJson.version);
|
||||
});
|
||||
@@ -70,107 +64,3 @@ describe("embedded-skill version contract", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("antigravity skills config sync", () => {
|
||||
test("creates skills.json when it does not exist", async () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "agy-config-"));
|
||||
const configFile = join(tmp, "skills.json");
|
||||
const targetDir = "/custom/test/path/.agents/skills";
|
||||
|
||||
try {
|
||||
const res = syncAntigravitySkillsConfig({ configFile, targetSkillsDir: targetDir });
|
||||
expect(res.configured).toBe(true);
|
||||
expect(res.action).toBe("created");
|
||||
expect(res.targetDir).toBe(targetDir);
|
||||
|
||||
const status = getAntigravitySkillsStatus({ configFile, targetSkillsDir: targetDir });
|
||||
expect(status.configured).toBe(true);
|
||||
|
||||
const content = JSON.parse(readFileSync(configFile, "utf8"));
|
||||
expect(content.entries).toEqual([{ path: targetDir }]);
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("does nothing when target directory is already present", () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "agy-config-"));
|
||||
const configFile = join(tmp, "skills.json");
|
||||
const targetDir = "/custom/test/path/.agents/skills";
|
||||
|
||||
try {
|
||||
const initial = {
|
||||
entries: [
|
||||
{ path: "/other/skill/dir" },
|
||||
{ path: targetDir }
|
||||
]
|
||||
};
|
||||
writeFileSync(configFile, JSON.stringify(initial, null, 2));
|
||||
|
||||
const res = syncAntigravitySkillsConfig({ configFile, targetSkillsDir: targetDir });
|
||||
expect(res.configured).toBe(true);
|
||||
expect(res.action).toBe("already_present");
|
||||
|
||||
const content = JSON.parse(readFileSync(configFile, "utf8"));
|
||||
expect(content.entries.length).toBe(2);
|
||||
expect(content.entries[1].path).toBe(targetDir);
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("prepends target directory to first position when absent", () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "agy-config-"));
|
||||
const configFile = join(tmp, "skills.json");
|
||||
const targetDir = "/custom/test/path/.agents/skills";
|
||||
|
||||
try {
|
||||
const initial = {
|
||||
entries: [
|
||||
{ path: "/existing/first/dir" },
|
||||
{ path: "/existing/second/dir" }
|
||||
]
|
||||
};
|
||||
writeFileSync(configFile, JSON.stringify(initial, null, 2));
|
||||
|
||||
const res = syncAntigravitySkillsConfig({ configFile, targetSkillsDir: targetDir });
|
||||
expect(res.configured).toBe(true);
|
||||
expect(res.action).toBe("prepended");
|
||||
|
||||
const content = JSON.parse(readFileSync(configFile, "utf8"));
|
||||
expect(content.entries.length).toBe(3);
|
||||
expect(content.entries[0].path).toBe(targetDir);
|
||||
expect(content.entries[1].path).toBe("/existing/first/dir");
|
||||
expect(content.entries[2].path).toBe("/existing/second/dir");
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("updates legacy tilde path to absolute target directory", () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "agy-config-"));
|
||||
const configFile = join(tmp, "skills.json");
|
||||
const targetDir = "/custom/test/path/.agents/skills";
|
||||
|
||||
try {
|
||||
const initial = {
|
||||
entries: [
|
||||
{ path: "~/.agents/skills" },
|
||||
{ path: "/other/dir" }
|
||||
]
|
||||
};
|
||||
writeFileSync(configFile, JSON.stringify(initial, null, 2));
|
||||
|
||||
const res = syncAntigravitySkillsConfig({ configFile, targetSkillsDir: targetDir });
|
||||
expect(res.configured).toBe(true);
|
||||
expect(res.action).toBe("updated_tilde");
|
||||
|
||||
const content = JSON.parse(readFileSync(configFile, "utf8"));
|
||||
expect(content.entries.length).toBe(2);
|
||||
expect(content.entries[0].path).toBe(targetDir);
|
||||
expect(content.entries[1].path).toBe("/other/dir");
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user