CarboAny / scripts /check-codex-harness.ts
Esketch's picture
deploy: [P4] Strangler Pattern API Adapter Release (Orphan Clean Build v2)
daaf9d7
Raw
History Blame Contribute Delete
1.98 kB
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
const root = process.cwd();
type Check = {
name: string;
path: string;
includes?: string[];
};
const checks: Check[] = [
{
name: 'root Codex instructions',
path: 'AGENTS.md',
includes: [
'## Codex Harness',
'docs/_para/20_areas/codex-harness.md',
'docs/_para/20_areas/superpowers.md',
'docs/_para/20_areas/codex-prompts.md',
'bun run check:harness',
],
},
{
name: 'docs entrypoint',
path: 'docs/README.md',
includes: ['# Carboany Docs Entry', 'docs/expert_specs/'],
},
{
name: 'harness operating guide',
path: 'docs/_para/20_areas/codex-harness.md',
includes: ['## ์ ์šฉ ์ƒํƒœ', '## ๊ธฐ๋ณธ ๋ฃจํ”„', '## ํ•„์ˆ˜ ๊ฒ€์ฆ'],
},
{
name: 'superpowers routing',
path: 'docs/_para/20_areas/superpowers.md',
includes: ['# Superpowers Routing', 'citizen-mrv-engineer', 'methodology-campaign-architect'],
},
{
name: 'prompt set',
path: 'docs/_para/20_areas/codex-prompts.md',
includes: ['# Codex Prompt Set', 'ํ† ํฐ ์ ˆ์•ฝ ๋ชจ๋“œ', '๋ธŒ๋ผ์šฐ์ € ๊ฒ€์ฆ'],
},
{
name: 'graphify report',
path: 'graphify-out/GRAPH_REPORT.md',
includes: ['# Graph Report'],
},
];
const failures: string[] = [];
for (const check of checks) {
const fullPath = join(root, check.path);
if (!existsSync(fullPath)) {
failures.push(`${check.name}: missing ${check.path}`);
continue;
}
if (!check.includes?.length) continue;
const content = readFileSync(fullPath, 'utf8');
for (const expected of check.includes) {
if (!content.includes(expected)) {
failures.push(`${check.name}: ${check.path} does not include "${expected}"`);
}
}
}
if (failures.length > 0) {
console.error('Codex Harness check failed:');
for (const failure of failures) {
console.error(`- ${failure}`);
}
process.exit(1);
}
console.log('Codex Harness check passed.');