Files
antigravity-skills-reference/tools/scripts/tests/activate_skills_shell.test.js
Al-Garadi ef285b5c97 fix: sync upstream main with Windows validation and skill guidance cleanup (#457)
* fix: stabilize validation and tests on Windows

* test: add Windows smoke coverage for skill activation

* refactor: make setup_web script CommonJS

* fix: repair aegisops-ai frontmatter

* docs: add when-to-use guidance to core skills

* docs: add when-to-use guidance to Apify skills

* docs: add when-to-use guidance to Google and Expo skills

* docs: add when-to-use guidance to Makepad skills

* docs: add when-to-use guidance to git workflow skills

* docs: add when-to-use guidance to fp-ts skills

* docs: add when-to-use guidance to Three.js skills

* docs: add when-to-use guidance to n8n skills

* docs: add when-to-use guidance to health analysis skills

* docs: add when-to-use guidance to writing and review skills

* meta: sync generated catalog metadata

* docs: add when-to-use guidance to Robius skills

* docs: add when-to-use guidance to review and workflow skills

* docs: add when-to-use guidance to science and data skills

* docs: add when-to-use guidance to tooling and automation skills

* docs: add when-to-use guidance to remaining skills

* fix: gate bundle helper execution in Windows activation

* chore: drop generated artifacts from contributor PR

* docs(maintenance): Record PR 457 sweep

Document the open issue triage, PR supersedence decision, local verification, and source-only cleanup that prepared PR #457 for re-running CI.

---------

Co-authored-by: sickn33 <sickn33@users.noreply.github.com>
2026-04-05 21:04:39 +02:00

81 lines
2.8 KiB
JavaScript

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const { spawnSync } = require("child_process");
if (process.platform === "win32") {
console.log("Skipping activate-skills.sh smoke test on Windows; use the batch-script coverage instead.");
process.exit(0);
}
const repoRoot = path.resolve(__dirname, "../..", "..");
const scriptPath = path.posix.join("scripts", "activate-skills.sh");
const root = fs.mkdtempSync(path.join(repoRoot, ".tmp-activate-skills-shell-"));
const baseDir = path.join(root, "antigravity");
const repoSkills = path.join(root, "repo-skills");
const outsideDir = path.join(root, "outside-skill-root");
function makeSkill(skillId) {
const skillDir = path.join(repoSkills, skillId);
fs.mkdirSync(skillDir, { recursive: true });
fs.writeFileSync(
path.join(skillDir, "SKILL.md"),
`---\nname: ${skillId}\ndescription: test skill\ncategory: testing\nrisk: safe\nsource: community\ndate_added: "2026-03-22"\n---\n`,
"utf8",
);
}
try {
makeSkill("brainstorming");
makeSkill("systematic-debugging");
makeSkill("custom-skill");
fs.mkdirSync(outsideDir, { recursive: true });
fs.writeFileSync(path.join(outsideDir, "secret.txt"), "outside", "utf8");
fs.symlinkSync(outsideDir, path.join(repoSkills, "escape-link"), "dir");
const result = spawnSync(
"bash",
[scriptPath, "--clear", "brainstorming", "custom-skill"],
{
cwd: repoRoot,
env: {
...process.env,
AG_BASE_DIR: path.relative(repoRoot, baseDir).split(path.sep).join("/"),
AG_REPO_SKILLS_DIR: path.relative(repoRoot, repoSkills).split(path.sep).join("/"),
AG_PYTHON_BIN: "python3",
},
encoding: "utf8",
},
);
assert.strictEqual(result.status, 0, result.stderr || result.stdout);
assert.ok(
fs.existsSync(path.join(baseDir, "skills", "brainstorming", "SKILL.md")),
"brainstorming should be activated into the live skills directory",
);
assert.ok(
fs.existsSync(path.join(baseDir, "skills", "custom-skill", "SKILL.md")),
"literal safe skill ids should be activated from the library",
);
assert.ok(
fs.existsSync(path.join(baseDir, "skills_library", "brainstorming", "SKILL.md")),
"repo skills should be synced into the backing library",
);
assert.ok(
!fs.existsSync(path.join(baseDir, "skills_library", "escape-link")),
"repo sync must not copy symlinked skills that point outside the source root",
);
assert.ok(
!fs.existsSync(path.join(baseDir, "skills", "escape-link")),
"unsafe symlinked skills must never become active",
);
assert.match(
result.stdout,
/Done! Antigravity skills are now activated\./,
"script should report successful activation",
);
} finally {
fs.rmSync(root, { recursive: true, force: true });
}