ProjectOS / scripts /validate-release.mjs
AnthropicallyHuggingFaces's picture
Sync full ProjectOS monorepo from GitHub 7f633f5 (part 2)
d821d28 verified
Raw History Blame Contribute Delete
3.39 kB
import assert from 'node:assert/strict';
import { access, readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
const root = resolve(import.meta.dirname, '..');
const readJson = async (path) => JSON.parse(await readFile(resolve(root, path), 'utf8'));
const required = [
'manifest.json', 'bootstrap.xml', 'ProjectOS.xsd', 'ProjectOS.sch',
'migrations/manifest.json', 'generated/snapshots/snapshot-manifest.json', 'generated/runtime.json',
'generated/registries/mcp.json', 'generated/registries/mcp-profiles.json', 'docs/ARCHITECTURE.md', 'docs/mcp-adapters.md', 'storage/sqlite/schema.sql', 'storage/postgres/schema.sql'
];
for (const path of required) await access(resolve(root, 'release', path));
const [manifest, snapshot, generatedSnapshot, migration] = await Promise.all([
readJson('release/manifest.json'),
readJson('release/generated/snapshots/snapshot-manifest.json'),
readJson('generated/snapshots/snapshot-manifest.json'),
readJson('release/migrations/manifest.json')
]);
assert.equal(manifest.project, 'ProjectOS');
assert.equal(manifest.bootstrap, 'bootstrap.xml');
assert.equal(manifest.schema, 'ProjectOS.xsd');
assert.equal(manifest.rules, 'ProjectOS.sch');
assert.deepEqual(snapshot, generatedSnapshot, 'release and generated snapshot manifests must match');
for (const table of ['dependency_findings', 'delta_runs', 'delta_gaps', 'delta_dependencies', 'governance_reviews']) {
assert.ok(migration.tables.includes(table), `release migration manifest must include ${table}`);
}
const [sourceBootstrap, bundledBootstrap, sourceSchema, bundledSchema, sourceRules, bundledRules, generatedMcp, releaseMcp, generatedMcpProfiles, releaseMcpProfiles, generatedDocs, releaseDocs, sourceMcpGuide, releaseMcpGuide] = await Promise.all([
readFile(resolve(root, 'bootstrap.xml'), 'utf8'),
readFile(resolve(root, 'release/bootstrap.xml'), 'utf8'),
readFile(resolve(root, 'schemas/ProjectOS.xsd'), 'utf8'),
readFile(resolve(root, 'release/ProjectOS.xsd'), 'utf8'),
readFile(resolve(root, 'schemas/ProjectOS.sch'), 'utf8'),
readFile(resolve(root, 'release/ProjectOS.sch'), 'utf8'),
readJson('generated/registries/mcp.json'),
readJson('release/generated/registries/mcp.json'),
readJson('generated/registries/mcp-profiles.json'),
readJson('release/generated/registries/mcp-profiles.json'),
readFile(resolve(root, 'generated/docs/ARCHITECTURE.md'), 'utf8'),
readFile(resolve(root, 'release/docs/ARCHITECTURE.md'), 'utf8'),
readFile(resolve(root, 'docs/mcp-adapters.md'), 'utf8'),
readFile(resolve(root, 'release/docs/mcp-adapters.md'), 'utf8')
]);
assert.equal(bundledBootstrap, sourceBootstrap, 'release bootstrap must match the canonical source');
assert.equal(bundledSchema, sourceSchema, 'release XSD must match the source schema');
assert.equal(bundledRules, sourceRules, 'release Schematron must match the source rules');
assert.deepEqual(releaseMcp, generatedMcp, 'release MCP registry must match generated configuration');
assert.deepEqual(releaseMcpProfiles, generatedMcpProfiles, 'release MCP profile registry must match generated configuration');
assert.equal(releaseDocs, generatedDocs, 'release documentation must match generated documentation');
assert.equal(releaseMcpGuide, sourceMcpGuide, 'release MCP setup guide must match the source guide');
console.log('Release package layout and manifests are valid.');