Package Anidev Skill and standalone API panel integration

This commit is contained in:
SantaSpeen committed 2026-12-01 14:42:44 +03:00
1 parent 8e4e8e6ef0
commit 61b05abe44
43 files changed
+1859 -57

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { cp, mkdir, lstat, readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import path from "node:path";
const args = process.argv.slice(2);
if (args.length !== 2 || args[0] !== "--project")
throw Error("Usage: node scripts/install-skill.mjs --project <project-root>");
const project = await import("node:fs/promises").then((fs) =>
fs.realpath(path.resolve(args[1])),
);
const source = fileURLToPath(
new URL("../dist/skills/anidev-design-system/", import.meta.url),
);
await readFile(path.join(source, "SKILL.md"));
let parent = project;
for (const name of [".agents", "skills"]) {
parent = path.join(parent, name);
const stat = await lstat(parent).catch((e) => {
if (e.code !== "ENOENT") throw e;
});
if (stat?.isSymbolicLink() || (stat && !stat.isDirectory()))
throw Error("Skill install path must be a real directory");
await mkdir(parent, { recursive: true });
}
const target = path.join(parent, "anidev-design-system");
const exists = await lstat(target).catch((e) => {
if (e.code !== "ENOENT") throw e;
});
if (exists)
throw Error(
`Skill already exists; compare versions before replacing: ${target}`,
);
await cp(source, target, { recursive: true, force: false, errorOnExist: true });
console.log(`Installed project skill: ${target}`);