From f0ddfccf47e69737a36b7f4b8681d51e8167e961 Mon Sep 17 00:00:00 2001 From: Colby McHenry Date: Wed, 21 Jan 2026 13:40:29 -0600 Subject: [PATCH] Skip global install if codegraph command already exists Co-Authored-By: Claude Opus 4.5 --- package.json | 2 +- src/installer/index.ts | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 4bb7d06..62a0dfd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@colbymchenry/codegraph", - "version": "0.3.0", + "version": "0.3.1", "description": "Supercharge Claude Code with semantic code intelligence. 30% fewer tokens, 25% fewer tool calls, 100% local.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/installer/index.ts b/src/installer/index.ts index 6965075..eb385ec 100644 --- a/src/installer/index.ts +++ b/src/installer/index.ts @@ -26,16 +26,26 @@ export async function runInstaller(): Promise { showBanner(); try { - // Step 1: Install codegraph globally - console.log(chalk.dim(' Installing codegraph globally...')); + // Step 1: Check if codegraph is available (skip install if already there) + let codegraphAvailable = false; try { - execSync('npm install -g @colbymchenry/codegraph', { stdio: 'pipe' }); - success('Installed codegraph command globally'); + execSync('which codegraph', { stdio: 'pipe' }); + codegraphAvailable = true; } catch { - // May fail if no permissions, but that's ok - npx still works - info('Could not install globally (try with sudo if needed)'); + // Not installed globally yet + } + + if (!codegraphAvailable) { + console.log(chalk.dim(' Installing codegraph globally...')); + try { + execSync('npm install -g @colbymchenry/codegraph', { stdio: 'pipe' }); + success('Installed codegraph command globally'); + } catch { + // May fail if no permissions, but that's ok - npx still works + info('Could not install globally (try with sudo if needed)'); + } + console.log(); } - console.log(); // Step 2: Ask for installation location const location = await promptInstallLocation();