()
| 54 | } |
| 55 | |
| 56 | export async function ensureCliBuilt() { |
| 57 | if (existsSync(cliEntry)) { |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | if (!buildPromise) { |
| 62 | buildPromise = runCommand('pnpm', ['run', 'build']).catch((error) => { |
| 63 | buildPromise = undefined; |
| 64 | throw error; |
| 65 | }); |
| 66 | } |
| 67 | |
| 68 | await buildPromise; |
| 69 | |
| 70 | if (!existsSync(cliEntry)) { |
| 71 | throw new Error('CLI entry point missing after build. Expected dist/cli/index.js'); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | export async function runCLI(args: string[] = [], options: RunCLIOptions = {}): Promise<RunCLIResult> { |
| 76 | await ensureCliBuilt(); |
no test coverage detected