|
@@ -10,6 +10,16 @@
|
|
|
[](https://opensource.org/licenses/MIT)
|
|
[](https://opensource.org/licenses/MIT)
|
|
|
[](https://nodejs.org/)
|
|
[](https://nodejs.org/)
|
|
|
|
|
|
|
|
|
|
+<br />
|
|
|
|
|
+
|
|
|
|
|
+### Get Started
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+npx @colbymchenry/codegraph
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+<sub>Interactive installer configures Claude Code automatically</sub>
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
---
|
|
---
|
|
@@ -106,16 +116,43 @@ Git hooks automatically sync the index on every commit. Your code intelligence i
|
|
|
|
|
|
|
|
## 🎯 Quick Start
|
|
## 🎯 Quick Start
|
|
|
|
|
|
|
|
-### Step 1: Install
|
|
|
|
|
|
|
+### 1. Run the Installer
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
-npm install -g @colbymchenry/codegraph
|
|
|
|
|
|
|
+npx @colbymchenry/codegraph
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### Step 2: Configure Claude Code MCP
|
|
|
|
|
|
|
+The interactive installer will:
|
|
|
|
|
+- Configure the MCP server in `~/.claude.json`
|
|
|
|
|
+- Set up auto-allow permissions for CodeGraph tools
|
|
|
|
|
+- Optionally initialize your current project
|
|
|
|
|
+
|
|
|
|
|
+### 2. Restart Claude Code
|
|
|
|
|
+
|
|
|
|
|
+Restart Claude Code for the MCP server to load.
|
|
|
|
|
|
|
|
-Add to your `~/.claude.json` in the `mcpServers` section:
|
|
|
|
|
|
|
+### 3. Initialize Projects
|
|
|
|
|
|
|
|
|
|
+For each project you want to use CodeGraph with:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+cd your-project
|
|
|
|
|
+codegraph init -i
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+That's it! Claude Code will now use CodeGraph tools automatically when a `.codegraph/` directory exists.
|
|
|
|
|
+
|
|
|
|
|
+<details>
|
|
|
|
|
+<summary><strong>Manual Setup (Alternative)</strong></summary>
|
|
|
|
|
+
|
|
|
|
|
+If you prefer manual configuration:
|
|
|
|
|
+
|
|
|
|
|
+**Install globally:**
|
|
|
|
|
+```bash
|
|
|
|
|
+npm install -g @colbymchenry/codegraph
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+**Add to `~/.claude.json`:**
|
|
|
```json
|
|
```json
|
|
|
{
|
|
{
|
|
|
"mcpServers": {
|
|
"mcpServers": {
|
|
@@ -128,9 +165,29 @@ Add to your `~/.claude.json` in the `mcpServers` section:
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### Step 3: Add Global Instructions
|
|
|
|
|
|
|
+**Add to `~/.claude/settings.json` (optional, for auto-allow):**
|
|
|
|
|
+```json
|
|
|
|
|
+{
|
|
|
|
|
+ "permissions": {
|
|
|
|
|
+ "allow": [
|
|
|
|
|
+ "mcp__codegraph__codegraph_search",
|
|
|
|
|
+ "mcp__codegraph__codegraph_context",
|
|
|
|
|
+ "mcp__codegraph__codegraph_callers",
|
|
|
|
|
+ "mcp__codegraph__codegraph_callees",
|
|
|
|
|
+ "mcp__codegraph__codegraph_impact",
|
|
|
|
|
+ "mcp__codegraph__codegraph_node",
|
|
|
|
|
+ "mcp__codegraph__codegraph_status"
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+</details>
|
|
|
|
|
+
|
|
|
|
|
+<details>
|
|
|
|
|
+<summary><strong>Recommended: Add Global Instructions</strong></summary>
|
|
|
|
|
|
|
|
-Create or append to `~/.claude/CLAUDE.md`:
|
|
|
|
|
|
|
+For best results, add to `~/.claude/CLAUDE.md`:
|
|
|
|
|
|
|
|
```markdown
|
|
```markdown
|
|
|
## CodeGraph
|
|
## CodeGraph
|
|
@@ -152,43 +209,21 @@ CodeGraph builds a semantic knowledge graph of codebases for faster, smarter cod
|
|
|
|
|
|
|
|
**When spawning Explore agents in a codegraph-enabled project:**
|
|
**When spawning Explore agents in a codegraph-enabled project:**
|
|
|
|
|
|
|
|
-Tell the Explore agent to use codegraph tools for faster exploration:
|
|
|
|
|
-
|
|
|
|
|
-Explore the codebase to understand [task].
|
|
|
|
|
-
|
|
|
|
|
-This project has CodeGraph initialized - use these tools for faster lookups:
|
|
|
|
|
-- codegraph_search to find relevant symbols
|
|
|
|
|
-- codegraph_callers/codegraph_callees to trace call graphs
|
|
|
|
|
-- codegraph_context to get related code for the task
|
|
|
|
|
-- codegraph_node with includeCode=true to read specific functions
|
|
|
|
|
|
|
+Tell the Explore agent to use codegraph tools for faster exploration.
|
|
|
|
|
|
|
|
**For quick lookups in the main session:**
|
|
**For quick lookups in the main session:**
|
|
|
- Use `codegraph_search` instead of grep for finding symbols
|
|
- Use `codegraph_search` instead of grep for finding symbols
|
|
|
- Use `codegraph_callers`/`codegraph_callees` to trace code flow
|
|
- Use `codegraph_callers`/`codegraph_callees` to trace code flow
|
|
|
- Use `codegraph_impact` before making changes to see what's affected
|
|
- Use `codegraph_impact` before making changes to see what's affected
|
|
|
|
|
|
|
|
-**Note:** CodeGraph provides CODE context, not product requirements. For new features, clarify UX preferences with the user before implementing.
|
|
|
|
|
-
|
|
|
|
|
### If `.codegraph/` does NOT exist
|
|
### If `.codegraph/` does NOT exist
|
|
|
|
|
|
|
|
At the start of a session, ask the user if they'd like to initialize CodeGraph:
|
|
At the start of a session, ask the user if they'd like to initialize CodeGraph:
|
|
|
|
|
|
|
|
-"I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph? This enables faster code exploration via semantic search and call graph analysis."
|
|
|
|
|
-
|
|
|
|
|
-If they agree, run:
|
|
|
|
|
-codegraph init -i
|
|
|
|
|
|
|
+"I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph?"
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-### Step 4: Initialize Your Projects
|
|
|
|
|
-
|
|
|
|
|
-```bash
|
|
|
|
|
-cd your-project
|
|
|
|
|
-codegraph init -i # Initialize and index
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-### Step 5: Restart Claude Code
|
|
|
|
|
-
|
|
|
|
|
-Restart Claude Code for the MCP server to load. The tools will be available in any project with a `.codegraph/` directory.
|
|
|
|
|
|
|
+</details>
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
|
@@ -201,6 +236,8 @@ Restart Claude Code for the MCP server to load. The tools will be available in a
|
|
|
## 💻 CLI Usage
|
|
## 💻 CLI Usage
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
|
|
+codegraph # Run interactive installer
|
|
|
|
|
+codegraph install # Run interactive installer (explicit)
|
|
|
codegraph init [path] # Initialize in a project
|
|
codegraph init [path] # Initialize in a project
|
|
|
codegraph index [path] # Full index
|
|
codegraph index [path] # Full index
|
|
|
codegraph sync [path] # Incremental update
|
|
codegraph sync [path] # Incremental update
|
|
@@ -213,6 +250,22 @@ codegraph serve --mcp # Start MCP server
|
|
|
|
|
|
|
|
## 📖 CLI Commands
|
|
## 📖 CLI Commands
|
|
|
|
|
|
|
|
|
|
+### `codegraph` / `codegraph install`
|
|
|
|
|
+
|
|
|
|
|
+Run the interactive installer for Claude Code integration. Configures MCP server and permissions automatically.
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+codegraph # Run installer (when no args)
|
|
|
|
|
+codegraph install # Run installer (explicit)
|
|
|
|
|
+npx @colbymchenry/codegraph # Run via npx (no global install needed)
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+The installer will:
|
|
|
|
|
+1. Ask for installation location (global `~/.claude` or local `./.claude`)
|
|
|
|
|
+2. Configure the MCP server in `claude.json`
|
|
|
|
|
+3. Optionally set up auto-allow permissions
|
|
|
|
|
+4. For local installs: initialize and index the current project
|
|
|
|
|
+
|
|
|
### `codegraph init [path]`
|
|
### `codegraph init [path]`
|
|
|
|
|
|
|
|
Initialize CodeGraph in a project directory. Creates a `.codegraph/` directory with the database and configuration.
|
|
Initialize CodeGraph in a project directory. Creates a `.codegraph/` directory with the database and configuration.
|