( projectPath: string, shouldInstall = true, )
| 52 | } |
| 53 | |
| 54 | async function ensureCodegraphCli( |
| 55 | projectPath: string, |
| 56 | shouldInstall = true, |
| 57 | ): Promise<string | null> { |
| 58 | const existingCommand = resolveCodegraphCommand(); |
| 59 | if (existingCommand) return existingCommand; |
| 60 | if (!shouldInstall) return null; |
| 61 | |
| 62 | console.log(' Installing CodeGraph CLI...'); |
| 63 | try { |
| 64 | execFileSync(getNpmExecutable(), ['install', '-g', '@colbymchenry/codegraph'], { |
| 65 | cwd: projectPath, |
| 66 | stdio: 'inherit', |
| 67 | timeout: 180_000, |
| 68 | shell: process.platform === 'win32', |
| 69 | }); |
| 70 | return resolveCodegraphCommand(); |
| 71 | } catch (error) { |
| 72 | console.error(` Failed to install CodeGraph CLI: ${(error as Error).message}`); |
| 73 | printCommandErrorDetails(error); |
| 74 | return null; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | async function installCodegraph( |
| 79 | projectPath: string, |
no test coverage detected