Skip global install if codegraph command already exists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-01-21 13:40:29 -06:00
co-authored by Claude Opus 4.5
parent 553f623fe1
commit f0ddfccf47
2 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@colbymchenry/codegraph", "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.", "description": "Supercharge Claude Code with semantic code intelligence. 30% fewer tokens, 25% fewer tool calls, 100% local.",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
+11 -1
View File
@@ -26,7 +26,16 @@ export async function runInstaller(): Promise<void> {
showBanner(); showBanner();
try { try {
// Step 1: Install codegraph globally // Step 1: Check if codegraph is available (skip install if already there)
let codegraphAvailable = false;
try {
execSync('which codegraph', { stdio: 'pipe' });
codegraphAvailable = true;
} catch {
// Not installed globally yet
}
if (!codegraphAvailable) {
console.log(chalk.dim(' Installing codegraph globally...')); console.log(chalk.dim(' Installing codegraph globally...'));
try { try {
execSync('npm install -g @colbymchenry/codegraph', { stdio: 'pipe' }); execSync('npm install -g @colbymchenry/codegraph', { stdio: 'pipe' });
@@ -36,6 +45,7 @@ export async function runInstaller(): Promise<void> {
info('Could not install globally (try with sudo if needed)'); info('Could not install globally (try with sudo if needed)');
} }
console.log(); console.log();
}
// Step 2: Ask for installation location // Step 2: Ask for installation location
const location = await promptInstallLocation(); const location = await promptInstallLocation();