Installer now installs codegraph globally

The installer runs `npm install -g @colbymchenry/codegraph` so users
can simply run `codegraph init -i` instead of the full npx command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-01-19 15:20:53 -06:00
co-authored by Claude Opus 4.5
parent 26f8f2f59f
commit 1ca43a85e0
4 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ export function showNextSteps(location: 'global' | 'local'): void {
if (location === 'global') {
console.log(chalk.dim(' Quick start:'));
console.log(chalk.dim(' cd your-project'));
console.log(chalk.cyan(' npx @colbymchenry/codegraph init -i'));
console.log(chalk.cyan(' codegraph init -i'));
} else {
console.log(chalk.dim(' CodeGraph is ready to use in this project!'));
}
+16 -4
View File
@@ -5,6 +5,7 @@
* with Claude Code.
*/
import { execSync } from 'child_process';
import { showBanner, showNextSteps, success, error, info, chalk } from './banner';
import { promptInstallLocation, promptAutoAllow, InstallLocation } from './prompts';
import { writeMcpConfig, writePermissions, hasMcpConfig, hasPermissions } from './config-writer';
@@ -25,11 +26,22 @@ export async function runInstaller(): Promise<void> {
showBanner();
try {
// Step 1: Ask for installation location
// Step 1: Install codegraph globally
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();
// Step 2: Ask for installation location
const location = await promptInstallLocation();
console.log();
// Step 2: Write MCP configuration
// Step 3: Write MCP configuration
const alreadyHasMcp = hasMcpConfig(location);
writeMcpConfig(location);
@@ -39,7 +51,7 @@ export async function runInstaller(): Promise<void> {
success(`Added MCP server to ${location === 'global' ? '~/.claude.json' : './.claude.json'}`);
}
// Step 3: Ask about auto-allow permissions
// Step 4: Ask about auto-allow permissions
const autoAllow = await promptAutoAllow();
console.log();
@@ -54,7 +66,7 @@ export async function runInstaller(): Promise<void> {
}
}
// Step 4: For local install, initialize the project
// Step 5: For local install, initialize the project
if (location === 'local') {
await initializeLocalProject();
}