Files
antigravity-superpowers/scripts/check-pack.mjs
To Nguyen 9f1d6eb880 Upgrade CLI to v0.2.0: add validate, list commands, --version, --dry-run, --backup flags
- Fix npm test glob pattern for Node >= 21 compatibility
- Add --version/-v flag to display package version
- Add validate command: run 78 profile checks (files, skills, frontmatter, legacy patterns, AGENTS mapping)
- Add list command: display all 13 bundled skills with descriptions
- Add --dry-run/-n flag for init: preview files without copying
- Add --backup/-b flag for init --force: backup existing .agent before overwrite
- Add name field to workflow frontmatter (brainstorm, execute-plan, write-plan)
- Expand smoke check to cover all 13 skills and new command files
- Increase test coverage from 3 to 20 tests (cli, init, validate)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 01:25:28 +07:00

65 lines
2.5 KiB
JavaScript

import { execFileSync } from "node:child_process";
import { rm } from "node:fs/promises";
import { resolve } from "node:path";
const raw = execFileSync("npm", ["pack", "--json"], {
cwd: process.cwd(),
encoding: "utf8",
});
const packResult = JSON.parse(raw);
if (!Array.isArray(packResult) || packResult.length === 0) {
throw new Error("npm pack did not return package metadata");
}
const [{ filename, files }] = packResult;
if (!filename || !Array.isArray(files)) {
throw new Error("npm pack output is missing filename or files");
}
const packagedPaths = new Set(files.map((file) => file.path));
const required = [
"bin/antigravity-superpowers.js",
"src/cli.js",
"src/commands/init.js",
"src/commands/validate.js",
"src/commands/list.js",
"templates/.agent/AGENTS.md",
"templates/.agent/INSTALL.md",
"templates/.agent/task.md",
"templates/.agent/workflows/brainstorm.md",
"templates/.agent/workflows/write-plan.md",
"templates/.agent/workflows/execute-plan.md",
"templates/.agent/agents/code-reviewer.md",
"templates/.agent/tests/run-tests.sh",
"templates/.agent/tests/check-antigravity-profile.sh",
"templates/.agent/skills/brainstorming/SKILL.md",
"templates/.agent/skills/executing-plans/SKILL.md",
"templates/.agent/skills/finishing-a-development-branch/SKILL.md",
"templates/.agent/skills/receiving-code-review/SKILL.md",
"templates/.agent/skills/requesting-code-review/SKILL.md",
"templates/.agent/skills/requesting-code-review/code-reviewer.md",
"templates/.agent/skills/systematic-debugging/SKILL.md",
"templates/.agent/skills/test-driven-development/SKILL.md",
"templates/.agent/skills/using-git-worktrees/SKILL.md",
"templates/.agent/skills/using-superpowers/SKILL.md",
"templates/.agent/skills/verification-before-completion/SKILL.md",
"templates/.agent/skills/writing-plans/SKILL.md",
"templates/.agent/skills/writing-skills/SKILL.md",
"templates/.agent/skills/single-flow-task-execution/SKILL.md",
"templates/.agent/skills/single-flow-task-execution/implementer-prompt.md",
"templates/.agent/skills/single-flow-task-execution/spec-reviewer-prompt.md",
"templates/.agent/skills/single-flow-task-execution/code-quality-reviewer-prompt.md",
];
const missing = required.filter((path) => !packagedPaths.has(path));
if (missing.length > 0) {
throw new Error(
`Packaged tarball is missing required files: ${missing.join(", ")}`,
);
}
await rm(resolve(process.cwd(), filename), { force: true });
process.stdout.write("Pack smoke check passed.\n");