Files
oh-my-claudecode/scripts/compose-docs.mjs
Yeachan-Heo 1ceebb87f2 fix: resolve 9 additional issues from PR #254 conservative review
- Fix oauth/jwt regex false negatives by replacing \b with (^|[\/-]) prefix
- Add boundary value tests (5/100/20 thresholds) and false-positive tests
- Fix architect.md workflow arrows (ASCII→Unicode), critic position, circuit breaker
- Fix analyst.md wording and add architect↔analyst ping-pong circuit breaker
- Backport MCP Tools section to partials/agent-tiers.md
- Backport State Management to partials/mode-hierarchy.md
- Create partials/mode-selection-guide.md from shared copy
- Add Evidence Types table to verification-tiers.md (shared + partials)
- Register compose-docs in package.json build/prepublishOnly
- Remove dead template processing code from compose-docs.mjs
- Add 7 MCP task types to agent selection table (shared + partials)
- Remove stale index.ts pattern from verification-tiers.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 06:53:51 +00:00

45 lines
1.4 KiB
JavaScript
Executable File

#!/usr/bin/env node
/**
* Documentation Composition Script
*
* Processes template files with {{INCLUDE:path}} syntax to compose
* final documentation from shared partials.
*
* Usage: node scripts/compose-docs.mjs
*
* Template syntax: {{INCLUDE:partials/agent-tiers.md}}
* Templates: docs/templates/*.template.md
* Output: docs/*.md (same name without .template)
* Partials also copied to docs/shared/ for direct reference.
*/
import { readFileSync, writeFileSync, readdirSync, mkdirSync, existsSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const docsDir = join(__dirname, '..', 'docs');
const partialsDir = join(docsDir, 'partials');
const sharedDir = join(docsDir, 'shared');
// Ensure directories exist
[partialsDir, sharedDir].forEach(dir => {
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
}
});
// Copy partials to shared/ for direct reference by skills
if (existsSync(partialsDir)) {
const partials = readdirSync(partialsDir).filter(f => f.endsWith('.md'));
for (const partial of partials) {
const content = readFileSync(join(partialsDir, partial), 'utf-8');
writeFileSync(join(sharedDir, partial), content);
}
console.log(`Synced ${readdirSync(partialsDir).filter(f => f.endsWith('.md')).length} partials to shared/`);
}
console.log('Documentation composition complete.');