MCPcopy
hub / github.com/rpamis/comet / ensureCodegraphCli

Function ensureCodegraphCli

src/core/codegraph.ts:54–76  ·  view source on GitHub ↗
(
  projectPath: string,
  shouldInstall = true,
)

Source from the content-addressed store, hash-verified

52}
53
54async 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
78async function installCodegraph(
79 projectPath: string,

Callers 1

installCodegraphFunction · 0.85

Calls 3

resolveCodegraphCommandFunction · 0.85
printCommandErrorDetailsFunction · 0.85
getNpmExecutableFunction · 0.70

Tested by

no test coverage detected