Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .claude/skills/agent-eval/corpus.json
Original file line number Diff line number Diff line change
Expand Up @@ -607,5 +607,51 @@
"files": "~3390",
"question": "How does programs.git.enable produce the final git config file in the user's home directory? Trace the flow from the git program module to the home-files machinery that links generated files into place."
}
],
"GLSL": [
{
"name": "glsl-blend",
"repo": "https://github.com/jamieowen/glsl-blend",
"size": "Small",
"files": "~43",
"question": "How does the overlay blend entry function reach the shared channel-level blend helpers across the shader includes?"
},
{
"name": "gl-transitions",
"repo": "https://github.com/gl-transitions/gl-transitions",
"size": "Medium",
"files": "~145",
"question": "How does a transition shader's main entry point reach its transition function and shared sampling helpers?"
},
{
"name": "lygia",
"repo": "https://github.com/patriciogonzalezvivo/lygia",
"size": "Large",
"files": "~2860",
"question": "How does a lighting shader reach the material, BRDF, and sampling helpers brought in through Lygia's include hierarchy?"
}
],
"HLSL": [
{
"name": "NoiseShader",
"repo": "https://github.com/keijiro/NoiseShader",
"size": "Small",
"files": "~112",
"question": "How do the public noise shader functions reach the shared hash and interpolation helpers?"
},
{
"name": "NRD",
"repo": "https://github.com/NVIDIA-RTX/NRD",
"size": "Medium",
"files": "~132",
"question": "How does an NRD compute shader entry point reach its macro-declared resources and shared denoising helpers?"
},
{
"name": "Magpie",
"repo": "https://github.com/Blinue/Magpie",
"size": "Large",
"files": "~631",
"question": "How does a scaling effect entry point reach the common sampling and color-processing helpers across included HLSL files?"
}
]
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### New Features

- CodeGraph now indexes GLSL, Vulkan ray-tracing and mesh shaders, HLSL, and OpenUSD GLSLFX files, including shader includes, macros, entry points, descriptor/register metadata, uniform and storage resources, push and specialization constants, and conservative C/C++ links to the shaders and bindings they configure.
- CodeGraph now indexes CMake and PowerShell build scripts, so shader targets, generated SPIR-V names, and build-time variables appear in project search and dependency analysis.
- Indexing TypeScript, TSX, JavaScript, JSX, Java, Python, Go, C, and C++ projects is faster: parsing and symbol extraction now run in a native engine when a prebuilt binary is available for your platform (release bundles include one), producing exactly the same graph — verified byte-for-byte against the previous engine on real repositories, from small libraries up to vscode-, dubbo-, django-, git-, and protobuf-scale codebases (Lombok-generated members, C function-pointer tables, and Unreal-Engine-style macro-heavy headers included; CUDA and Metal sources ride the C++ path). The speedup is largest on resource-constrained machines like CI runners. No setup needed: platforms without the native binary, and individual files with syntax errors, automatically use the previous engine, and `CODEGRAPH_KERNEL=0` turns the native path off entirely.
- Reference resolution now runs in parallel on large projects. When a project has enough pending references to make it worthwhile (roughly 150k+, typical for big Java/Kotlin/Spring codebases), resolution fans out across worker threads while results are applied in the exact order the single-threaded path would have used — the graph comes out byte-for-byte identical, about twice as fast end-to-end on a 4,000-file Java project in our testing. Small projects keep the single-threaded path automatically (the fan-out costs more than it saves there). Set `CODEGRAPH_NO_PARALLEL_RESOLVE=1` to disable, or `CODEGRAPH_PARALLEL_RESOLVE_MIN=<count>` to tune when it engages.
- Indexing large projects got another sizeable speedup — about a quarter less wall-clock on the same 4,000-file Java project, with the graph still byte-for-byte identical. Two changes: the database no longer interleaves expensive checkpoint housekeeping into the middle of resolution on a fresh index (it's folded once at the end instead), and while one batch's results are being written out, the worker threads are already resolving the next batch instead of sitting idle.
Expand All @@ -24,6 +26,25 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Fixes

- GLSL extraction now recovers preprocessor-heavy and malformed-but-valid function declarations, while shader call resolution follows equivalent definitions through include closures instead of silently dropping real callers.
- Shader impact queries can be scoped to a file, common variant definitions are presented without duplicate blast-radius entries, unrelated C++ methods are no longer guessed as matches, and deletion-only syncs preserve a fresh index timestamp.
- Common shader names such as `main` now require an explicit file when a project contains many definitions, explicit shader filenames anchor `codegraph_explore` to that file, and conditional shader variants remain visible as separate impact roots.
- Shared shader helpers and constants injected by the build system now resolve when their equivalent declarations have matching contracts, and recovered GLSL signatures retain their return type and parameters.
- PowerShell indexing now records calls between script functions and from script scope, reports exact declaration and call-site lines, and avoids flooding search with repeated or function-local assignment nodes.
- Ambiguous CLI queries now report the complete definition count instead of the first 50 matches, and shader impact output identifies the preprocessor conditions attached to each indexed variant.
- PowerShell `Import-Module` statements now link scripts to local `.psm1` modules, and calls to exported module functions participate in callers, callees, impact, and file dependency analysis.
- Shader exploration now expands an explicitly requested file through its transitive include closure, while PowerShell exports no longer appear as callers and executable launches are no longer misclassified as module imports.
- PowerShell dot-sourced scripts now create file dependencies and expose their shared functions to callers, callees, impact, and exploration without enabling unrelated project-wide name matches.
- Named local C++ lambdas now appear as scoped functions with accurate callers and callees, preventing their invocations from being linked to unrelated same-named methods elsewhere in the project.
- Malformed C++ preprocessor parse ranges no longer let one method consume the rest of a file, while local lambdas retain their namespace and class ownership and can be isolated by source line in callers, callees, and impact queries.
- HLSL compiler-root includes now resolve through unique project suffixes, overloads use include context and call arity, and shared RTXDI-style library calls connect to each application bridge implementation instead of collapsing onto one sample.
- `codegraph status` now distinguishes metadata-only files and reports unresolved attempted references by language and kind, so a current index no longer hides semantic coverage gaps.
- `codegraph affected` now excludes vendored dependency tests for project-owned changes while retaining them for dependency changes or explicit filters.
- Shader exploration and impact now stay inside the explicitly selected compilation target, HLSL overloads use proven argument types when arity alone is ambiguous, and shader compile-test entry files participate in affected-test results.
- Shared shader-header impact now surfaces every proven compilation entry even at shallow depth, while `codegraph affected` follows shader include roots without crossing between application bridges or treating helper headers as tests.
- GLSL overload callers now resolve by their real parameter counts, and C/C++ shader filename checks or documentation strings remain file dependencies instead of being reported as calls to a shader entry point.
- Calls to shader helpers that switch between a function and a function-like macro now remain connected across every preprocessor variant, and `codegraph_explore` keeps both endpoint sources while showing proven direct calls in Flow and Relationships when a query uses `file:line`, `file line N`, or directly names both endpoints.

- TypeScript, TSX, and JavaScript files now parse with up-to-date grammars — modern syntax such as `using` declarations and import attributes no longer trips parse errors that could drop surrounding symbols. (The previously bundled grammars dated from 2023.)
- Searching or exploring by field names now finds the code that defines them. A query made of object keys or API field names (`profileInfo isTrialEligible quotaInfo billingMethod`) used to return unrelated results while the defining files never appeared, because three retrieval steps each dropped multi-word camelCase terms: an internal case-comparison bug, a match step that only considered classes (never functions or methods), and exploration seeding that required exact symbol-name matches. All three are fixed — `codegraph_explore` with a bag of field names now surfaces the controllers and services that assemble those fields. (#1196)
- `codegraph.json`'s `includeIgnored` works again for the "folder of repos" layout: when one `.gitignore` rule covers a parent directory (`/repos/`) holding several embedded git repositories, opting in the individual repos (`"includeIgnored": ["repos/a/"]` — the exact spelling `codegraph init`'s own hint suggests) previously matched nothing and indexed zero files, looping the same suggestion back at you. Both spellings now work — name the parent directory to opt in everything under it, or name individual repos to opt in just those — and the hint no longer re-suggests repos that are already configured. (#1295)
Expand Down
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ Every language below gets the same treatment — full structural extraction and
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/objective-c.svg?v=1" width="104" height="104" alt="Objective-C" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/metal.svg?v=1" width="104" height="104" alt="Metal" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/cuda.svg?v=1" width="104" height="104" alt="CUDA" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/glsl.svg?v=1" width="104" height="104" alt="GLSL" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/hlsl.svg?v=1" width="104" height="104" alt="HLSL" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/swift.svg?v=1" width="104" height="104" alt="Swift" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/kotlin.svg?v=1" width="104" height="104" alt="Kotlin" />
<img src="https://raw.githubusercontent.com/colbymchenry/codegraph/main/assets/languages/scala.svg?v=1" width="104" height="104" alt="Scala" />
Expand Down Expand Up @@ -317,7 +319,7 @@ The reliable, universal payoff is **surgical context and speed**: CodeGraph coll
| **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |
| **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
| **Always Fresh** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config |
| **20+ Languages** | TypeScript, JavaScript, ArkTS, Python, Go, Rust, Java, C#, VB.NET, PHP, Ruby, C, C++, CUDA, Objective-C, Metal, Swift, Kotlin, Scala, Dart, Lua, Luau, R, Nix, Erlang, CFML, COBOL, Solidity, Terraform/OpenTofu, Svelte, Vue, Astro, Liquid, Pascal/Delphi |
| **30+ Languages** | TypeScript, JavaScript, ArkTS, Python, Go, Rust, Java, C#, VB.NET, PHP, Ruby, C, C++, CUDA, GLSL, HLSL, CMake, PowerShell, Objective-C, Metal, Swift, Kotlin, Scala, Dart, Lua, Luau, R, Nix, Erlang, CFML, COBOL, Solidity, Terraform/OpenTofu, Svelte, Vue, Astro, Liquid, Pascal/Delphi |
| **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 17 frameworks |
| **Mixed iOS / React Native / Expo** | Closes cross-language flows that static parsing misses: Swift ↔ ObjC bridging, React Native legacy bridge + TurboModules + Fabric view components, native → JS event emitters, Expo Modules |
| **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
Expand Down Expand Up @@ -556,9 +558,9 @@ codegraph query <search> # Search symbols (--kind, --limit, --json)
codegraph explore <query> # Relevant symbols' source + call paths in one shot (same output as the codegraph_explore MCP tool)
codegraph node <symbol|file> # 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, --max-depth, --json)
codegraph callers <symbol> # Find what calls a function/method (--limit, --json)
codegraph callees <symbol> # Find what a function/method calls (--limit, --json)
codegraph impact <symbol> # Analyze what code is affected by changing a symbol (--depth, --json)
codegraph callers <symbol> # Find what calls a function/method (--file, --line, --limit, --json)
codegraph callees <symbol> # Find what a function/method calls (--file, --line, --limit, --json)
codegraph impact <symbol> # Analyze what code is affected by changing a symbol (--file, --line, --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
Expand All @@ -567,6 +569,8 @@ codegraph version # Print the installed version (also -v, --vers
codegraph help [command] # Show help, optionally for one command
```

`codegraph status --json` separates tracked files from graph-producing files and reports unresolved attempted references by language and kind, making semantic gaps visible even when the index is current.

### `codegraph affected`

Traces import dependencies transitively to find which test files are affected by changed source files.
Expand All @@ -585,6 +589,8 @@ codegraph affected src/auth.ts --filter "e2e/*" # Custom test file pattern
| `-j, --json` | Output as JSON | `false` |
| `-q, --quiet` | Output file paths only | `false` |

Automatic test discovery excludes common vendored roots for project-owned changes; pass `--filter` to include matching dependency tests explicitly.

**CI/hook example:**

```bash
Expand Down Expand Up @@ -729,6 +735,24 @@ language or a malformed file is warned about and skipped — it never breaks
indexing — and a project with no `codegraph.json` behaves exactly as before.
Re-index (`codegraph index`) after adding or changing mappings.

### Shader include roots

GLSL and HLSL quoted includes resolve relative to the including file, then
through project include roots, then from the project root. Configure compiler
include roots and aliases in the same `codegraph.json` when your build uses them:

```json
{
"shaderIncludePaths": ["shaders/include", "third_party/NRD/Shaders/Include"],
"shaderIncludeAliases": {
"$TOOLS": "pxr/imaging"
}
}
```

Paths must remain inside the project. Ambiguous include or symbol matches stay
unlinked rather than guessing.

## Telemetry

CodeGraph collects **anonymous usage statistics** — which tools and commands get
Expand Down Expand Up @@ -820,6 +844,10 @@ is written):
| Objective-C | `.m`, `.mm`, `.h` | Partial support (classes, protocols, methods, `@property`, `#import`, message sends; `.mm` ObjC++ may parse incompletely) |
| Metal | `.metal` | Full support (vertex/fragment/kernel functions, structs, type aliases, call edges — MSL parses as C++, with `[[attribute]]` annotations handled) |
| CUDA | `.cu`, `.cuh` | Full support (kernels and device/host functions, structs, classes, host→kernel call edges through `<<<grid, block>>>` launch syntax — templated launches, function-pointer launches (`auto kernel = &fn<...>`), `dim3{...}` configs, and macro-defined kernels included; `__global__`/`__device__`/`__launch_bounds__` specifiers handled; CUDA in plain `.h`/`.hpp` headers recognized by content) |
| GLSL / Vulkan GLSL | `.glsl`, `.vert`, `.frag`, `.comp`, `.geom`, `.tesc`, `.tese`, `.rgen`, `.rmiss`, `.rchit`, `.rahit`, `.rint`, `.rcall`, `.mesh`, `.task`, `.glslfx` | Full support (functions, structs, macros, transitive includes, call edges, descriptor layouts, uniform/storage/push-constant blocks, specialization constants, ray payloads, mesh/ray stages, and OpenUSD GLSLFX sections/techniques) |
| HLSL | `.hlsl`, `.hlsli`, `.fx`, `.fxh` | Full support (functions and shader entry points, structs/classes, macros/includes, `cbuffer`/`tbuffer`, semantics and thread-group attributes, register/space and Vulkan attributes, texture/buffer/sampler/ray-tracing resources, including NVIDIA NRD-style declaration macros) |
| CMake | `CMakeLists.txt`, `.cmake` | Build-script support (functions/macros, variables, include and subdirectory wiring, shader and SPIR-V references) |
| PowerShell | `.ps1`, `.psm1`, `.psd1` | Build-script support (functions, `Import-Module` dependencies, cross-module and script/function call edges, script-scope variables, tool invocations, shader and SPIR-V references) |
| Swift | `.swift` | Full support |
| Kotlin | `.kt`, `.kts` | Full support |
| Scala | `.scala`, `.sc` | Full support (classes, traits, methods, type aliases, Scala 3 enums) |
Expand Down
Loading