-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathexample-documentation.ts
More file actions
32 lines (25 loc) · 1.15 KB
/
example-documentation.ts
File metadata and controls
32 lines (25 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Example script demonstrating how to scaffold documentation and agent playbooks
* programmatically without going through the CLI binary.
*/
import path from 'node:path';
import { DocumentationGenerator } from './src/generators/documentation';
import { AgentGenerator } from './src/generators/agents';
import { FileMapper } from './src/utils/fileMapper';
async function scaffoldRepo(repoRoot: string, outputDir: string = path.join(repoRoot, '.context')) {
const fileMapper = new FileMapper();
const documentationGenerator = new DocumentationGenerator();
const agentGenerator = new AgentGenerator();
const repoStructure = await fileMapper.mapRepository(repoRoot);
await documentationGenerator.generateDocumentation(repoStructure, outputDir, {}, true);
await agentGenerator.generateAgentPrompts(repoStructure, outputDir, true);
console.log(`Scaffold written to ${outputDir}`);
}
if (require.main === module) {
const repoRoot = process.argv[2] ? path.resolve(process.argv[2]) : process.cwd();
scaffoldRepo(repoRoot).catch(error => {
console.error('Failed to scaffold repository:', error);
process.exit(1);
});
}
export { scaffoldRepo };