MCPcopy Create free account
hub / github.com/VPSDance/ai-proxy-rules / generate

Function generate

scripts/cli.ts:42–63  ·  view source on GitHub ↗
(options: GenerateOptions)

Source from the content-addressed store, hash-verified

40
41await program.parseAsync();
42
43async function generate(options: GenerateOptions): Promise<void> {
44 const selectedFormats = parseFormats(options.format);
45 const providers = await selectProviders(options.input, options.provider);
46 const targets = buildTargets(providers, options.provider);
47
48 const writes: string[] = [];
49
50 for (const target of targets) {
51 for (const format of selectedFormats) {
52 const file = render(format, target);
53 const outDir = path.join(options.output, file.format);
54 const outPath = path.join(outDir, `${target.id}.${file.extension}`);
55 await mkdir(outDir, { recursive: true });
56 await writeFile(outPath, file.content, "utf8");
57 writes.push(outPath);
58 }
59 }
60
61 for (const filePath of writes) {
62 console.log(filePath);
63 }
64}
65
66async function selectProviders(inputDir: string, providerOption: string): Promise<ProviderSource[]> {

Callers 1

cli.tsFile · 0.85

Calls 4

parseFormatsFunction · 0.85
selectProvidersFunction · 0.85
buildTargetsFunction · 0.85
renderFunction · 0.85

Tested by

no test coverage detected