Installer now creates/updates CLAUDE.md with CodeGraph instructions

- Added claude-md-template.ts with the instructions template
- Installer writes to ~/.claude/CLAUDE.md (global) or ./.claude/CLAUDE.md (local)
- Smart detection: updates existing CodeGraph section or appends if not found
- Uses HTML comment markers for reliable section replacement on upgrades

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-01-19 15:30:13 -06:00
co-authored by Claude Opus 4.5
parent 1ca43a85e0
commit 8d1fb680e5
4 changed files with 163 additions and 4 deletions
+14 -2
View File
@@ -8,7 +8,7 @@
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';
import { writeMcpConfig, writePermissions, writeClaudeMd, hasMcpConfig, hasPermissions } from './config-writer';
import CodeGraph from '../index';
/**
@@ -66,7 +66,19 @@ export async function runInstaller(): Promise<void> {
}
}
// Step 5: For local install, initialize the project
// Step 5: Write CLAUDE.md instructions
const claudeMdResult = writeClaudeMd(location);
const claudeMdPath = location === 'global' ? '~/.claude/CLAUDE.md' : './.claude/CLAUDE.md';
if (claudeMdResult.created) {
success(`Created ${claudeMdPath} with CodeGraph instructions`);
} else if (claudeMdResult.updated) {
success(`Updated CodeGraph section in ${claudeMdPath}`);
} else {
success(`Added CodeGraph instructions to ${claudeMdPath}`);
}
// Step 6: For local install, initialize the project
if (location === 'local') {
await initializeLocalProject();
}