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:
co-authored by
Claude Opus 4.5
parent
26f8f2f59f
commit
1ca43a85e0
@@ -172,7 +172,7 @@ For each project you want to use CodeGraph with:
|
||||
|
||||
```bash
|
||||
cd your-project
|
||||
npx @colbymchenry/codegraph init -i
|
||||
codegraph init -i
|
||||
```
|
||||
|
||||
That's it! Claude Code will now use CodeGraph tools automatically when a `.codegraph/` directory exists.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@colbymchenry/codegraph",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"description": "A local-first code intelligence system that builds a semantic knowledge graph from any codebase",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user