chore: initialize POM 2 repo (docs guards green; release gates recorded NOT RUN pending install)
This commit is contained in:
77
scripts/verify.mjs
Normal file
77
scripts/verify.mjs
Normal file
@@ -0,0 +1,77 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
||||
const required = [
|
||||
"POM.yml",
|
||||
"README.md",
|
||||
"RELEASE.json",
|
||||
"LICENSE",
|
||||
"package.json",
|
||||
"src/index.ts",
|
||||
"src/events.ts",
|
||||
"src/tools.ts",
|
||||
"src/visual.ts",
|
||||
"skills/pom/SKILL.md",
|
||||
"config/APPEND_SYSTEM.md",
|
||||
"prompts/stage-run.md",
|
||||
"themes/pom-nocturne.json",
|
||||
"themes/pom-parchment.json",
|
||||
"scripts/smoke.ts",
|
||||
];
|
||||
for (const rel of required) assert(existsSync(join(root, rel)), `missing ${rel}`);
|
||||
|
||||
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
||||
const release = JSON.parse(readFileSync(join(root, "RELEASE.json"), "utf8"));
|
||||
assert.equal(release.version, pkg.version, "release manifest version mismatch");
|
||||
assert.equal(release.inventory.stages, 9, "release stage inventory mismatch");
|
||||
assert.equal(release.inventory.customTools, 7, "release tool inventory mismatch");
|
||||
assert.equal(release.inventory.behavioralTests, 9, "release test inventory mismatch");
|
||||
assert.deepEqual(pkg.omp.extensions, ["./src/index.ts"], "exactly one OMP entry required");
|
||||
assert.equal(pkg.version, "2.0.0", "release version must match POM 2");
|
||||
for (const rel of pkg.files) assert(existsSync(join(root, rel)), `package files entry does not exist: ${rel}`);
|
||||
|
||||
const command = readFileSync(join(root, "src/command.ts"), "utf8");
|
||||
assert.equal((command.match(/registerCommand\("pom"/g) ?? []).length, 1, "exactly one /pom registration required");
|
||||
assert(command.includes('registerShortcut("alt+p"'), "Alt+P command-center shortcut required");
|
||||
|
||||
const domain = readFileSync(join(root, "src/domain.ts"), "utf8");
|
||||
assert.equal((domain.match(/\bid:\s*[0-8],/g) ?? []).length, 9, "nine stages required");
|
||||
|
||||
const tools = readFileSync(join(root, "src/tools.ts"), "utf8");
|
||||
assert.equal((tools.match(/name:\s*"pom_[a-z]+"/g) ?? []).length, 7, "seven POM tools required");
|
||||
for (const forbidden of ["allowArgs", "formatApprovalDetails", 'concurrency: "exclusive"', "ExtensionAPI = any"]) {
|
||||
assert(!tools.includes(forbidden), `unsupported or unsafe registration field present: ${forbidden}`);
|
||||
}
|
||||
|
||||
assert(!existsSync(join(root, "src/omp-shim.d.ts")), "OMP declaration shim must not ship");
|
||||
assert(!existsSync(join(root, "src/node-shim.d.ts")), "Node declaration shim must not ship");
|
||||
|
||||
const markdownCount = (dir) => readdirSync(join(root, dir)).filter((name) => name.endsWith(".md")).length;
|
||||
assert.equal(markdownCount("agents"), 14, "fourteen specialist agents required");
|
||||
assert.equal(markdownCount("prompts"), 13, "thirteen prompt fragments required");
|
||||
assert.equal(markdownCount("rules"), 3, "three rules required");
|
||||
assert.equal(readdirSync(join(root, "themes")).filter((name) => name.endsWith(".json")).length, 2, "two POM themes required");
|
||||
|
||||
for (const file of readdirSync(join(root, "agents")).filter((name) => name.endsWith(".md"))) {
|
||||
const text = readFileSync(join(root, "agents", file), "utf8");
|
||||
assert(text.startsWith("---\n"), `${file} missing frontmatter`);
|
||||
assert(/^name:\s*pom-[a-z0-9-]+$/m.test(text), `${file} missing valid agent name`);
|
||||
assert(/^description:\s*\S.+$/m.test(text), `${file} missing description`);
|
||||
assert(/^tools:\s*.*\byield\b.*$/m.test(text), `${file} must expose yield`);
|
||||
}
|
||||
|
||||
const themeSchema = JSON.parse(readFileSync(join(root, "node_modules/@oh-my-pi/pi-coding-agent/src/modes/theme/theme-schema.json"), "utf8"));
|
||||
for (const file of readdirSync(join(root, "themes")).filter((name) => name.endsWith(".json"))) {
|
||||
const theme = JSON.parse(readFileSync(join(root, "themes", file), "utf8"));
|
||||
assert.equal(theme.name, file.slice(0, -5), `${file} name mismatch`);
|
||||
for (const key of themeSchema.properties.colors.required) assert(key in theme.colors, `${file} missing color ${key}`);
|
||||
}
|
||||
|
||||
for (const rel of ["src", "skills", "agents", "rules", "prompts", "themes", "config", "docs", "scripts"]) {
|
||||
assert(statSync(join(root, rel)).isDirectory(), `${rel} must be a directory`);
|
||||
}
|
||||
|
||||
console.log("POM structural verification PASS");
|
||||
Reference in New Issue
Block a user