Polish approved 1.0 scope and verify portable previews
This commit is contained in:
1 parent
1819f35f91
commit
2b45df2816
181 files changed
+996
-139
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, readFile, stat } from "node:fs/promises";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
const project = await mkdtemp(path.resolve("test-results/skill-consumer-"));
|
||||
const install = () =>
|
||||
spawnSync(
|
||||
process.execPath,
|
||||
["scripts/install-skill.mjs", "--project", project],
|
||||
{ encoding: "utf8", windowsHide: true },
|
||||
);
|
||||
const first = install();
|
||||
assert.equal(first.status, 0, first.stderr);
|
||||
const skill = path.join(project, ".agents/skills/anidev-design-system");
|
||||
await stat(path.join(skill, "SKILL.md"));
|
||||
const pkg = path.join(skill, "assets/anidev"),
|
||||
manifest = JSON.parse(
|
||||
await readFile(path.join(pkg, "manifest.json"), "utf8"),
|
||||
);
|
||||
for (const [file, hash] of Object.entries(manifest.files))
|
||||
assert.equal(
|
||||
createHash("sha256")
|
||||
.update(await readFile(path.join(pkg, file)))
|
||||
.digest("hex"),
|
||||
hash,
|
||||
file,
|
||||
);
|
||||
const api = await import(pathToFileURL(path.join(pkg, "runtime/index.js")));
|
||||
for (const name of [
|
||||
"mountMarkdown",
|
||||
"mountCodeEditor",
|
||||
"mountChart",
|
||||
"mountMiniLog",
|
||||
"mountMobileDock",
|
||||
])
|
||||
assert.equal(typeof api[name], "function");
|
||||
assert.equal(install().status, 1, "Must refuse an implicit overwrite");
|
||||
console.log(
|
||||
"Skill portability: temporary project install, bundled hashes/runtime and overwrite protection passed",
|
||||
);
|
||||
Reference in new issue
Block a user