### Run Interactive Installer Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md Launches the interactive installer to configure CodeGraph agents. Use `--yes` for non-interactive setup. ```bash # Interactive installer codegraph install ``` ```bash # Non-interactive (auto-detect, global) codegraph install --yes ``` ```bash # Configure specific agents codegraph install --target=claude,cursor --location=local ``` ```bash # Print Cursor config snippet codegraph install --print-config cursor ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Installs all the necessary packages listed in your `package.json` file. ```bash npm install ``` -------------------------------- ### Project-Local Install and Initialize Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/configuration.md Installs CodeGraph as a development dependency and initializes it. Recommended for CI environments. ```bash npm install --save-dev @colbymchenry/codegraph npx codegraph init -i ``` -------------------------------- ### Run the CodeGraph Installer Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/installation.md Execute the interactive installer to configure AI coding agents. It detects installed agents, prompts for installation path, project scope, and writes agent configurations. ```bash npx @colbymchenry/codegraph ``` -------------------------------- ### Pinia Action Dispatch Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/dispatch-synthesizer-backlog.md Example of calling an action on a Pinia store instance. ```javascript useStore().action() ``` -------------------------------- ### Global Install and Initialize Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/configuration.md Installs CodeGraph globally and initializes it within any project. Use this for general availability. ```bash npm install -g @colbymchenry/codegraph codegraph init -i # In any project ``` -------------------------------- ### Start MCP Server Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/reference/mcp-server.md Launch the CodeGraph server to enable MCP communication. This command is typically run automatically by an agent installer. ```bash codegraph serve --mcp ``` -------------------------------- ### Start Local Development Server Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Runs the development server, typically accessible at `localhost:4321`, for live previewing changes. ```bash npm run dev ``` -------------------------------- ### Install CodeGraph CLI (npm) Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/quickstart.md If you have Node.js installed, you can install the CodeGraph CLI globally using npm. ```bash npm i -g @colbymchenry/codegraph ``` -------------------------------- ### Vapor Route Definition Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/plans/2026-04-24-framework-resolver-extract.md Defines a GET route for '/users' in a Vapor application, mapping it to the 'list' handler function. ```swift app.get("/users", use: list) ``` -------------------------------- ### Example of OkHttp Explore Sizing Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/adaptive-explore-sizing.md Illustrates how OkHttp's explore functionality might be sized, highlighting redundant interceptor bodies as padding. ```text OkHttp explore (shipped): RealCall (full) + RealInterceptorChain (full) + CallServerInterceptor (full, 8.7k) + Bridge/Connect/Cache/… (full, ~4-5k each) ← all ~same shape = ~28k, most of it redundant interceptor bodies ``` -------------------------------- ### Example Build Context Configuration Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/configuration.md Shows how to configure BuildContextOptions to limit nodes and code blocks, and specify markdown format. ```typescript const context = await cg.buildContext('fix login bug', { maxNodes: 25, maxCodeBlocks: 5, format: 'markdown', includeCode: true }); ``` -------------------------------- ### Vuex Action/Mutation Dispatch Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/dispatch-synthesizer-backlog.md Example of dispatching an action or committing a mutation in Vuex using string keys, potentially with namespacing. ```javascript store.dispatch('ns/action') / commit('mutation') ``` -------------------------------- ### Start MCP Server Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md Starts the MCP server, which is typically run automatically by agents. You can specify a project path if not in a .codegraph directory. ```bash # Start MCP server (usually run automatically by agents) codegraph serve --mcp # Specify project path codegraph serve --mcp --path=/path/to/project ``` -------------------------------- ### Vapor Closure Handler Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/dynamic-dispatch-coverage-playbook.md Example of defining a route handler using a closure in Vapor. ```swift app.get("x"){ } ``` -------------------------------- ### Example Traversal Configuration Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/configuration.md Demonstrates how to use TraversalOptions to fetch an incoming subgraph with specific edge kinds and a limit. ```typescript const subgraph = cg.traverse(nodeId, { maxDepth: 3, direction: 'incoming', edgeKinds: ['calls', 'imports'], limit: 100 }); ``` -------------------------------- ### Objective-C Method Signature Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/mixed-ios-and-react-native-bridging.md Example of an Objective-C method signature that might be called from Swift. ```objectivec -[ImageDownloader fooWithBar:] ``` -------------------------------- ### Install codegraph CLI Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md Installs the codegraph CLI using different package managers for macOS/Linux, Windows, or npm. ```bash # macOS / Linux curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh ``` ```powershell # Windows (PowerShell) irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex ``` ```bash # Or via npm (any platform) npm install -g @colbymchenry/codegraph ``` -------------------------------- ### CLI: Initialize and Use Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Shows how to install and configure CodeGraph for use with Claude Code, enabling automatic tracing in chat interactions. ```APIDOC ## MCP: Integrate with Claude Code ### Description Install and configure CodeGraph to be used within Claude Code chat for automatic code tracing. ### Method ```bash # Install and configure codegraph install --target=claude --yes # Use in Claude Code chat # "How does handleSubmit reach saveData?" # → Agent uses codegraph_trace automatically ``` ``` -------------------------------- ### Go Extraction Example Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/extraction.md Illustrates extraction of a struct, its fields, and a method on that struct in Go. Recognizes exported symbols. ```go package users type User struct { ID string Name string } func (u *User) Save() error { // ... } ``` -------------------------------- ### GitHub Actions for Codebase Indexing Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md This GitHub Actions workflow installs Codegraph, initializes the project, and checks the status. ```yaml name: Index codebase on: push jobs: index: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: npm install -g @colbymchenry/codegraph - run: codegraph init -i --quiet - run: codegraph status ``` -------------------------------- ### Swift Extraction Example Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/extraction.md Illustrates extraction of a class, its methods, and asynchronous operations in Swift. Supports computed properties. ```swift class UserRepository { func getUser(id: String) async -> User? { // ... } } ``` -------------------------------- ### Get Help with Astro CLI Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Displays the help message for the Astro CLI, listing available commands and options. ```bash npm run astro -- --help ``` -------------------------------- ### Initialize CodeGraph Project Synchronously Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Initialize a new CodeGraph project synchronously without performing any indexing. This is useful for quick setup. ```typescript static initSync(projectRoot: string): CodeGraph ``` ```typescript const cg = CodeGraph.initSync('/path/to/project'); await cg.indexAll(); ``` -------------------------------- ### Rust Extraction Example Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/extraction.md Demonstrates extraction of a struct, its fields, and an implementation block with a constructor method in Rust. Supports public visibility. ```rust pub struct User { id: String, name: String, } impl User { pub fn new(id: String, name: String) -> Self { User { id, name } } } ``` -------------------------------- ### Get Detected Frameworks Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Retrieves an array of framework names detected in the project. Example: `['express', 'react']`. ```typescript getDetectedFrameworks(): string[] ``` -------------------------------- ### Initialize Project Index Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/guides/indexing.md Use `codegraph init` to create the .codegraph/ directory and build the initial full graph for your project. This command handles both setup and indexing in one step. ```bash cd your-project codegraph init # creates .codegraph/ and builds the full graph — one step ``` -------------------------------- ### Initialize CodeGraph Project Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/installation.md After installation, run this command within your project directory to create the local .codegraph/ directory and build the project's code graph. ```bash cd your-project codegraph init ``` -------------------------------- ### CLI: Initialize and Index Project Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Perform a one-time setup for a project using the CLI, initializing CodeGraph and indexing all files. The `status` command can then be used to check the indexing progress. The `sync` command keeps the index fresh. ```bash # One-time setup cd my-project codegraph init -i # Check status codegraph status # Keep index fresh (auto-runs via MCP server) codegraph sync ``` -------------------------------- ### Local Development and Checks Source: https://github.com/colbymchenry/codegraph/blob/main/telemetry-worker/README.md Steps to set up local development environment, including copying environment variables, running checks, and starting the development server. Also includes a curl command to test the /v1/events endpoint. ```bash cp .dev.vars.example .dev.vars # placeholder key; also feeds `wrangler types` npm run check # wrangler types + tsc --noEmit + deploy --dry-run npm run dev # http://localhost:8787 ``` ```bash curl -i localhost:8787/v1/events -H 'content-type: application/json' -d '{ "machine_id": "00000000-0000-4000-8000-000000000000", "codegraph_version": "0.9.9", "os": "darwin", "arch": "arm64", "node_major": 22, "ci": false, "schema_version": 1, "events": [{ "event": "usage_rollup", "props": { "kind": "mcp_tool", "name": "codegraph_explore", "count": 12, "error_count": 0, "client_name": "Claude Code" } }] }' ``` -------------------------------- ### Non-interactive CodeGraph Installation Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/installation.md Use these commands for scripting or CI environments to install CodeGraph without interactive prompts. Options include auto-detection, explicit targets, project-local installation, and printing configuration snippets. ```bash codegraph install --yes # auto-detect agents, install global ``` ```bash codegraph install --target=cursor,claude --yes # explicit target list ``` ```bash codegraph install --target=auto --location=local # detected agents, project-local ``` ```bash codegraph install --print-config codex # print snippet, no file writes ``` -------------------------------- ### Create New Starlight Project Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Use this command to initialize a new Astro project with the Starlight template. ```bash npm create astro@latest -- --template starlight ``` -------------------------------- ### Probe Explore Query Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/adaptive-explore-sizing.md This command-line query is used to probe and understand skeletonization behavior. Always confirm findings with a real-agent A/B test. ```bash probe-explore.mjs "" ``` -------------------------------- ### Run All Script Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/adaptive-explore-sizing.md This script is used for performing real-agent A/B tests to validate skeletonization findings. It is crucial for confirming the results obtained from probe queries. ```bash run-all.sh ``` -------------------------------- ### Install CodeGraph CLI (Windows PowerShell) Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/quickstart.md Use this command to install the CodeGraph CLI on Windows systems using PowerShell. ```powershell # Windows (PowerShell) irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex ``` -------------------------------- ### Install CodeGraph CLI (macOS/Linux) Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/quickstart.md Use this command to install the CodeGraph CLI on macOS and Linux systems using curl. ```bash # macOS / Linux curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh ``` -------------------------------- ### Preview Production Build Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Locally previews the production build output in `./dist/` before deploying to ensure everything works as expected. ```bash npm run preview ``` -------------------------------- ### Build and Run Evaluation Harness Source: https://github.com/colbymchenry/codegraph/blob/main/scripts/agent-eval/offload-eval.md Commands to build the harness, log in to CodeGraph, set the output directory, clone and index repositories, run the evaluation matrix for three arms, judge the results, summarize them, and run the frontload matrix. ```bash npm run build # the harness shells out to dist/ codegraph login # only needed for the offload arm export AGENT_EVAL_OUT=/tmp/cg-offload-eval bash scripts/agent-eval/offload-eval-setup.sh # clone + index the 4 repos bash scripts/agent-eval/offload-eval-matrix.sh # 3 arms × 4 tiers × REPS (default 3) node scripts/agent-eval/offload-eval-judge.mjs \ --results $AGENT_EVAL_OUT/results.jsonl \ --truth scripts/agent-eval/offload-eval-ground-truth.json \ --out $AGENT_EVAL_OUT/judged.jsonl node scripts/agent-eval/offload-eval-summarize.mjs $AGENT_EVAL_OUT/judged.jsonl bash scripts/agent-eval/offload-eval-frontload-matrix.sh # frontload arm + judge + merged summary ``` -------------------------------- ### Initialize CodeGraph Project Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/troubleshooting.md Run this command in your project directory to initialize CodeGraph before it can be used. ```bash codegraph init ``` -------------------------------- ### Get indexed file structure of the project Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/mcp-tools.md Use `codegraph_files` to get the indexed file structure of the project. You can specify maximum depth, filter by path, and choose the output format. ```json maxDepth: 3 filter: "src/**" format: "tree" ``` -------------------------------- ### Get detailed information about a symbol with source code Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/mcp-tools.md Use `codegraph_node` to get detailed information about a specific symbol. Set `includeCode` to true to also retrieve the source code. ```json symbol: "src/utils.ts::calculateTotal" includeCode: true ``` -------------------------------- ### Build Bundle Script Execution Source: https://github.com/colbymchenry/codegraph/blob/main/BUNDLING.md Demonstrates how to use the build script to create platform-specific bundles. These commands generate archives for Linux and Windows targets. ```bash scripts/build-bundle.sh linux-x64 # -> release/codegraph-linux-x64.tar.gz scripts/build-bundle.sh win32-x64 # -> release/codegraph-win32-x64.zip ``` -------------------------------- ### Start File Watching Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Initiate file watching with `watch` to automatically sync changes. It accepts optional `WatchOptions` such as `debounceMs` and `onPendingFile`, returning `true` if watching started or `false` if already active. ```typescript watch(options?: WatchOptions): boolean ``` ```typescript cg.watch({ debounceMs: 1000 }); ``` -------------------------------- ### Initialize CodeGraph Project Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md Initializes a new CodeGraph project in the current or specified directory. Use `-i` to run initial indexing. ```bash # Initialize current directory codegraph init ``` ```bash # Initialize with indexing codegraph init -i ``` ```bash # Initialize specific directory codegraph init /path/to/project --index ``` -------------------------------- ### getBackend Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Gets the active SQLite backend for the current connection. ```APIDOC ## getBackend() ### Description Get the active SQLite backend for this connection. ### Method `getBackend` ### Returns Backend type (e.g., `'node-sqlite'` for Node.js built-in). ``` -------------------------------- ### getFileDependents(filePath) Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Gets all files that depend on a specific file. ```APIDOC ## `getFileDependents(filePath)` ### Description Get all files that depend on a specific file. ### Method (Not specified, likely a method call on a CodeGraph object) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Parameters - **filePath** (string) - Required - File path relative to project root ### Returns Array of file paths that depend on this file ``` -------------------------------- ### Initialize CodeGraph Project Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Initialize a new CodeGraph project and index all files. Use the CLI for one-time setup or the library for programmatic control. Ensure the project path is correct. ```typescript import CodeGraph from '@colbymchenry/codegraph'; const cg = await CodeGraph.init('/path/to/project', { index: true }); console.log(cg.getStats()); cg.close(); ``` ```bash cd /path/to/project codegraph init -i codegraph status ``` -------------------------------- ### getFileDependencies(filePath) Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Gets all files that a specific file imports or depends on. ```APIDOC ## `getFileDependencies(filePath)` ### Description Get all files that a file imports/depends on. ### Method (Not specified, likely a method call on a CodeGraph object) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body (None specified) ### Parameters - **filePath** (string) - Required - File path relative to project root ### Returns Array of file paths this file depends on ``` -------------------------------- ### Handling FileError Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/errors.md Example of catching a `FileError` and logging the file path and error message. ```typescript try { const file = cg.getFile('src/missing.ts'); if (!file) { console.log('File not indexed or does not exist'); } } catch (error) { if (error instanceof FileError) { console.error(`File error: ${error.filePath} - ${error.message}`); } } ``` -------------------------------- ### Reproduce README Benchmark Source: https://github.com/colbymchenry/codegraph/blob/main/docs/benchmarks/call-sequence-analysis.md Execute the script to benchmark the current build across 7 repositories, comparing performance with and without the CodeGraph MCP tools. The results are then parsed to calculate medians and savings. ```bash bash scripts/agent-eval/bench-readme.sh # 7 repos × with/without × 4 runs (RUNS=4) → /tmp/ab-readme node scripts/agent-eval/parse-bench-readme.mjs # medians + % saved (summed per-turn tokens) ``` -------------------------------- ### Handling CodeGraphError Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/errors.md Example of how to catch and log a `CodeGraphError`, accessing its code and message properties. ```typescript try { // CodeGraph operation } catch (error) { if (error instanceof CodeGraphError) { console.error(`[${error.code}] ${error.message}`); } } ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/colbymchenry/codegraph/blob/main/docs/SEARCH_QUALITY_LOOP.md Command to execute the entire test suite. This should be run before marking a language as verified. ```bash npm test ``` -------------------------------- ### Get All Tracked Files Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Retrieve an array containing metadata for all files currently tracked by the CodeGraph. ```typescript getFiles(): FileRecord[] ``` -------------------------------- ### Open and Query Project with CodeGraph Library Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Demonstrates opening a project, searching for nodes, analyzing impact, and retrieving context using the CodeGraph library. Ensure the project path is correct and the CodeGraph library is installed. ```typescript import CodeGraph from '@colbymchenry/codegraph'; const cg = await CodeGraph.open('/path/to/project'); // Search const results = cg.searchNodes('UserService'); // Analyze const impact = cg.getImpactRadius(results[0].node.id); // Get context const context = cg.getContext(results[0].node.id); cg.close(); ``` -------------------------------- ### Library: Get Callees Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Determine what a specific element (Z) calls using the `cg.getCallees()` method. ```APIDOC ## Reference by Use Case: "What does Z call?" ### Description Use `codegraph callees` or `cg.getCallees()` to find all elements that a specific element (Z) calls. ### Method ```typescript // Example usage: const callees = cg.getCallees(elementZId); ``` ``` -------------------------------- ### Build Production Site Source: https://github.com/colbymchenry/codegraph/blob/main/site/README.md Compiles your Astro project into optimized static files for deployment, outputting to the `./dist/` directory. ```bash npm run build ``` -------------------------------- ### Handling ParseError Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/errors.md Example of catching a `ParseError` and logging the file path and line number where the error occurred. ```typescript try { const result = await cg.indexAll(); } catch (error) { if (error instanceof ParseError) { console.error(`Parse error in ${error.filePath}:${error.line}`); } } ``` -------------------------------- ### CodeGraph CLI Commands Overview Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/reference/cli.md Lists all available CodeGraph CLI commands and their basic usage. These commands cover installation, project initialization, indexing, synchronization, status checks, querying, and daemon management. ```bash codegraph # Run interactive installer codegraph install # Run installer (explicit) codegraph uninstall # Remove CodeGraph from your agents (inverse of install) codegraph init [path] # Initialize a project + build its graph (one step) codegraph uninit [path] # Remove CodeGraph from a project (--force to skip prompt) codegraph index [path] # Full re-index from scratch (--force, --quiet, --verbose) codegraph sync [path] # Incremental update (--quiet) codegraph status [path] # Show statistics (--json) codegraph unlock [path] # Remove a stale lock file that's blocking indexing codegraph query # Search symbols (--kind, --limit, --json) codegraph explore # Relevant symbols' source + call paths in one shot (same output as the codegraph_explore MCP tool) codegraph node # One symbol's source + callers, or read a file with line numbers (same output as codegraph_node) codegraph files [path] # Show file structure (--format, --filter, --pattern, --max-depth, --json) codegraph callers # Find what calls a function/method (--limit, --json) codegraph callees # Find what a function/method calls (--limit, --json) codegraph impact # Analyze what code is affected by changing a symbol (--depth, --json) codegraph affected [files...] # Find test files affected by changes (see below) codegraph daemon # Manage background daemons — pick one to stop (alias: daemons) codegraph telemetry [on|off] # Show or change anonymous usage telemetry codegraph upgrade [version] # Update to the latest release (--check, --force) codegraph version # Print the installed version (also -v, --version) codegraph help [command] # Show help, optionally for one command ``` -------------------------------- ### Get SQLite Journal Mode Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/codegraph.md Retrieves the current SQLite journal mode, such as 'wal' for write-ahead logging. ```typescript cg.getJournalMode() ``` -------------------------------- ### Build and Initialize CodeGraph Source: https://github.com/colbymchenry/codegraph/blob/main/docs/SEARCH_QUALITY_LOOP.md Commands to build the project, clean the CodeGraph cache, and initialize it for a codebase. Run after fixing issues. ```bash npm run build rm -rf /.codegraph node dist/bin/codegraph.js init -iv # Re-run the failing tests from above ``` -------------------------------- ### Library: Get Callers Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Retrieve a list of elements that call a specific element (Y) using the `cg.getCallers()` method. ```APIDOC ## Reference by Use Case: "What calls Y?" ### Description Use `codegraph callers` or `cg.getCallers()` to find all elements that call a specific element (Y). ### Method ```typescript // Example usage: const callers = cg.getCallers(elementYId); ``` ``` -------------------------------- ### Wire up CodeGraph Agents Source: https://github.com/colbymchenry/codegraph/blob/main/site/src/content/docs/getting-started/quickstart.md Run this command after installation to auto-detect and configure various agents with the CodeGraph MCP server. ```bash codegraph install ``` -------------------------------- ### Library: Open and Query Project Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Demonstrates how to open a project, search for nodes, analyze impact, and retrieve context using the CodeGraph library. ```APIDOC ## Library: Open and Query Project ### Description Demonstrates how to open a project, search for nodes, analyze impact, and retrieve context using the CodeGraph library. ### Method ```typescript import CodeGraph from '@colbymchenry/codegraph'; const cg = await CodeGraph.open('/path/to/project'); // Search const results = cg.searchNodes('UserService'); // Analyze const impact = cg.getImpactRadius(results[0].node.id); // Get context const context = cg.getContext(results[0].node.id); cg.close(); ``` ``` -------------------------------- ### GitLab CI for Codebase Indexing Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/cli.md A GitLab CI script that installs Codegraph, initializes the project, and checks its status. ```yaml index: script: - npm install -g @colbymchenry/codegraph - codegraph init -i - codegraph status ``` -------------------------------- ### Reproduce and Test Callback Edge Synthesis Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/callback-edge-synthesis.md Commands to build the project, initialize codegraph for excalidraw, query synthesized edges from the database, and trace an end-to-end flow. ```bash npm run build rm -rf /tmp/codegraph-corpus/excalidraw/.codegraph ( cd /tmp/codegraph-corpus/excalidraw && codegraph init -i ) # synthesized edges (provenance='heuristic', metadata.synthesizedBy in {callback,event-emitter}): sqlite3 /tmp/codegraph-corpus/excalidraw/.codegraph/codegraph.db "select s.name||' → '||t.name||' '||coalesce(e.metadata,'') from edges e join nodes s on e.source=s.id join nodes t on e.target=t.id where e.provenance='heuristic';" # end-to-end flow (the synthesized edge shows up in explore's Flow section + node trail): node scripts/agent-eval/probe-explore.mjs /tmp/codegraph-corpus/excalidraw "triggerUpdate triggerRender" ``` -------------------------------- ### Skeleton Rendering Example Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/adaptive-explore-sizing.md Demonstrates how skeleton rendering displays class and member signature lines, scanning forward for the actual symbol name when decorators are present. This snippet shows the output format for a skeletonized file. ```text #### …/CallServerInterceptor.kt — CallServerInterceptor, intercept, … · skeleton (signatures only; Read for a full body) ``` ```kotlin 30 object CallServerInterceptor : Interceptor { 32 override fun intercept(chain: Interceptor.Chain): Response { 194 private fun shouldIgnoreAndWaitForRealResponse(code: Int): Boolean = ``` -------------------------------- ### Library: Build Context Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/README.md Visualize the entire flow of a process, such as the authentication flow, using `cg.buildContext()`. ```APIDOC ## Reference by Use Case: "Show me the entire auth flow" ### Description Use the `codegraph_explore` MCP tool or `cg.buildContext()` to visualize the complete flow of a process, like the authentication flow. ### Method ```typescript // Example usage: const context = cg.buildContext(startNodeId, endNodeId); ``` ``` -------------------------------- ### Python Django DRF Router Register Source: https://github.com/colbymchenry/codegraph/blob/main/docs/design/dynamic-dispatch-coverage-playbook.md Example of using DRF's `router.register` to map URLs to ViewSets. ```python router.register(r'users', views.UserViewSet) ``` -------------------------------- ### Java Extraction Example Source: https://github.com/colbymchenry/codegraph/blob/main/_autodocs/api-reference/extraction.md Shows extraction of a class, its package, and a method within the class in Java. Supports annotations. ```java package com.example.users; public class UserService { public User getUser(String id) { // ... } } ```