Releases: optave/codegraph
Dev build 3.2.1-dev.4
Dev build from commit 89c013b48108a179d17a73edc91257b452e4a5c1 on main.
Dev build 3.2.1-dev.3
Dev build from commit 5c316a6c961f16e83ce6847fe3530b45e093880c on main.
v3.2.0
Post-Phase 3 decomposition and dead code accuracy. This release completes a thorough decomposition of the remaining monolithic modules — language extractors, AST analysis visitors, domain analysis functions, and feature modules are all broken into focused, single-responsibility helpers. Dead code detection now correctly classifies symbols that are only referenced by tests as "test-only" instead of "dead", and constants are properly included in edge building so they no longer appear as false-positive dead exports. A new brief command provides token-efficient file summaries designed for AI hook context injection. The native engine gains a MAX_WALK_DEPTH guard to prevent stack overflows on deeply nested ASTs.
Features
- cli:
codegraph brief <file>command — token-efficient file summary with symbols, roles, caller counts, and risk tiers; designed for hook-based context injection (#480)
Bug Fixes
- roles: classify test-only-called symbols as "test-only" instead of "dead" — reduces false positives in dead code detection (#497)
- builder: include constant nodes in edge building — constants no longer appear as false-positive dead exports (#495)
- native: add MAX_WALK_DEPTH guard to native engine AST walkers — prevents stack overflows on deeply nested files (#484)
- cli: support repeated
--fileflag for multi-file scoping across all commands (#498) - versioning: use semver-compliant dev version numbering (
-dev.0suffix instead of non-standard format) (#479)
Refactors
- extractors: decompose monolithic language extractors (JS/TS, Python, Java) into per-category handlers (#490)
- ast-analysis: decompose AST analysis visitors and domain builder stages into focused helpers (#491)
- domain: decompose domain analysis and feature modules into single-responsibility functions (#492)
- presentation: split data fetching from formatting and extract CLI/MCP subcommand dispatch (#493)
- cleanup: dead code removal, shared abstractions, and empty catch block replacement across all layers (#489)
v3.1.5
Phase 3 architectural refactoring completes. This release finishes the remaining two Phase 3 roadmap tasks — domain directory grouping (3.15) and CLI composability (3.16) — bringing Phase 3 to 14 of 14 tasks complete. The src/ directory is now reorganized into domain/, features/, and presentation/ layers. A new openGraph() helper eliminates DB-open/close boilerplate across CLI commands, and a universal output formatter adds --table and --csv output to all commands. Several post-reorganization bugs are fixed: complexity/CFG/dataflow analysis restored after the move, MCP server imports corrected, worktree boundary escapes prevented, CJS require() support added, and LIKE wildcard injection in queries patched.
Features
- cli:
openGraph()helper and universal output formatter with--tableand--csvoutput formats — eliminates per-command DB boilerplate and format-switching logic (#461)
Bug Fixes
- builder: restore complexity/CFG/dataflow analysis that silently stopped running after src/ reorganization (#469)
- db: prevent
findDbPathfrom escaping git worktree boundary — stops codegraph from accidentally using a parent repo's database (#457) - mcp: update MCP server import path after src/ reorganization (#466)
- api: add CJS
require()support to package exports — fixesERR_REQUIRE_ESMfor CommonJS consumers (#472) - db: escape LIKE wildcards in
NodeQuery.fileFilterandnameLike— prevents filenames containing%or_from matching unrelated rows (#446)
Refactors
- architecture: reorganize
src/intodomain/,features/,presentation/layers — completes Phase 3.15 domain directory grouping (#456) - architecture: move remaining flat
src/files into subdirectories (#458) - architecture: resolve three post-reorganization issues (circular imports, barrel exports, path corrections) (#459)
- queries: deduplicate BFS impact traversal and centralize config loading (#463)
- tests: migrate integration tests to InMemoryRepository for faster execution (#462)
Tests
- db: add
findRepoRootandfindDbPathceiling boundary tests (#475)
v3.1.4
Phase 3 architectural refactoring reaches near-completion. This release delivers 11 of 14 roadmap tasks in Phase 3 (Vertical Slice Architecture), restructuring the codebase from a flat collection of large files into a modular subsystem layout. The 3,395-line queries.js is decomposed into src/analysis/ and src/shared/ modules. The MCP tool registry becomes composable. CLI commands are self-contained modules under src/commands/. A domain error hierarchy replaces ad-hoc throws. The build pipeline is decomposed into named stages. The embedder is extracted into src/embeddings/ with pluggable stores and search strategies. A unified graph model (src/graph/) consolidates four parallel graph representations. Nodes gain qualified names, hierarchical scoping, and visibility metadata. An InMemoryRepository enables fast unit testing without SQLite. The presentation layer (src/presentation/) separates all output formatting from domain logic. better-sqlite3 is bumped to 12.8.0.
Features
- graph-model: unified in-memory
CodeGraphmodel with 3 builders, 6 algorithms, and 2 classifiers — consolidates four parallel graph representations intosrc/graph/(#435, #436) - qualified-names:
qualified_name,scope, andvisibilitycolumns on nodes (migration v15) — enables direct lookups like "all methods of class X" without edge traversal (#437) - testing:
InMemoryRepositoryfor unit tests without SQLite — repository pattern now supports in-memory and persistent backends (#444)
Refactors
- queries: decompose
queries.js(3,395 lines) intosrc/analysis/andsrc/shared/modules (#425) - mcp: composable MCP tool registry — tools defined alongside their implementations (#426)
- cli: split
cli.jsinto self-contained command modules undersrc/commands/(#427) - api: curate public API surface — explicit exports, remove internal leaks (#430)
- errors: domain error hierarchy — typed errors replace ad-hoc throws (#431)
- embeddings: extract embedder into
src/embeddings/subsystem with pluggable stores and search strategies (#433) - builder: decompose
buildGraph()into named pipeline stages (#434) - presentation: extract all output formatting into
src/presentation/— viewer, export, table, sequence renderer, result formatter (#443)
Chores
- ci: add backlog compliance phase to automated PR review (#432)
- deps: bump better-sqlite3 from 12.6.2 to 12.8.0 (#442)
- deps-dev: bump @biomejs/biome from 2.4.6 to 2.4.7 (#441)
- deps-dev: bump @commitlint/cli from 20.4.3 to 20.4.4 (#440)
- deps-dev: bump @commitlint/config-conventional from 20.4.3 to 20.4.4 (#439)
- deps-dev: bump @vitest/coverage-v8 from 4.0.18 to 4.1.0 (#438)
v3.1.3
Bug fixes and build instrumentation. This patch fixes WASM builds silently producing zero complexity rows, resolves four dogfood-reported issues (benchmark crash resilience, WASM parser memory cleanup, native dynamic import tracking, stale native version reporting), and adds missing build phase timers so setupMs and finalizeMs now account for the previously untracked ~45% of total build time. Prepared statement caching is extracted into a reusable cachedStmt utility.
Features
- builder: add
setupMsandfinalizeMsphase timers tobuildGraph— closes the ~45% gap in phase breakdown accounting (#415)
Bug Fixes
- complexity: fix WASM builds producing zero
function_complexityrows — incorrect import alias causedfindFunctionNodeto be undefined in WASM-only path (#414) - native: track
import()expressions in Rust extractor — addsdynamicImportfield toImportstruct, matching WASM behavior for dead-export analysis (#418) - native: report correct native package version in
codegraph info— reads from platform npm package.json instead of binary-embedded version (#418) - benchmark: wrap engine calls in try/catch so one engine failure doesn't prevent the other from running; fix embedding benchmark
disposeModelleak (#418) - parser: add
disposeParsers()to release cached WASM parsers/queries; calltree.delete()after AST analysis to prevent segfaults on repeated builds (#418) - queries: hoist prepared statement out of BFS loop in
getClassHierarchy(#403) - ci: only trigger Claude automated review on PR open, not every push (#419)
Performance
v3.1.2
Phase 3 architectural refactoring reaches substantial completion. This release finishes the unified AST analysis framework (Phase 3.1) — all four analyses (complexity, CFG, dataflow, AST-store) now run in a single DFS walk via pluggable visitors, with cfg.js shrinking from 1,242 to 518 lines and cyclomatic complexity derived directly from CFG structure. CLI command/query separation (Phase 3.2) moves ~1,059 lines of formatting code into a dedicated src/commands/ directory. Repository pattern migration (Phase 3.3) extracts raw SQL from 14 source modules. Dynamic import() expressions are now tracked as dynamic-imports graph edges, fixing false positives in dead-export analysis and impact tracing. Prepared statement caching cuts hot-path DB overhead in the repository layer.
Features
- ast-analysis: unified AST analysis framework — shared DFS walker with pluggable
enterNode/exitNode/enterFunction/exitFunctionhooks; complexity, CFG, AST-store, and dataflow visitors in a single coordinated pass (#388) - cfg: CFG visitor rewrite — node-level DFS visitor replaces statement-level
buildFunctionCFG, Mode A/B split eliminated; cyclomatic complexity now derived from CFG (E - N + 2);cfg.jsreduced from 1,242 → 518 lines (#392) - commands: extract CLI wrappers into
src/commands/directory (Phase 3.2) — command/query separation complete across all 19 analysis modules;src/infrastructure/added for sharedresult-formatter.jsandtest-filter.js(#393) - builder: track dynamic
import()expressions asdynamic-importsgraph edges — destructured names feed into call resolution, fixing false "zero consumers" in dead-export analysis (#389)
Bug Fixes
- hooks: fix
check-dead-exportshook silently no-ops on ESM codebases (#394) - hooks: guard pre-push hook against
sh -efailure whendiff-impactis unavailable - complexity: remove function nodes from
nestingNodeTypesand eliminate O(n²) lookup - complexity: remove function nesting inflation in
computeAllMetricsand passlangIdto LOC - ast-analysis: guard
runAnalysescall, fix nested function nesting, rename_engineOpts - ast-analysis: fix Halstead skip depth counter, debug logging, perf import
Performance
- db: cache prepared statements in hot-path repository functions — avoids repeated statement compilation on incremental builds
Refactors
- migrate raw SQL from 14 source modules into repository pattern (Phase 3.3) —
src/db/repository/split into 10 domain files (nodes, edges, build-stmts, complexity, cfg, dataflow, cochange, embeddings, graph-read, barrel) - address Greptile review — deduplicate
relatedTests, hoist prepared stmts, fix.raw()no-op
v3.1.1
Reliability, architecture, and MCP cold-start fixes. This patch breaks a circular dependency cycle, fixes MCP server first-connect reliability by deferring heavy imports, corrects flow matching to use core symbol kinds, and refactors all database access to use try/finally for reliable db.close(). Internal architecture improves with repository pattern for data access and command/query separation.
Features
- hooks: add pre-commit hooks for cycles, dead exports, signature warnings (#381)
- benchmark: add 1-file rebuild phase breakdown to build benchmarks (#370)
Bug Fixes
- cycles: break circular dependency cycle and remove dead
queryNameexport (#378) - queries: use
CORE_SYMBOL_KINDSin flow matching (#382) - mcp: defer heavy imports in MCP server for first-connect reliability (#380)
Refactors
- wrap all db usage in try/finally for reliable
db.close()(#384, #383) - repository pattern for data access (#371)
- command/query separation — extract CLI wrappers, shared output helper (#373)
Chores
v3.1.0
Sequence diagrams, native engine performance leap, and unused export detection. This release adds codegraph sequence for Mermaid sequence diagram generation from call graph edges, delivers major native engine build optimizations (deep-clone elimination, batched SQLite inserts, call edge building in Rust, FS caching, rayon-parallel import resolution), introduces --unused on the exports command to detect dead exports, and fixes an ~80x native no-op rebuild regression.
Features
- sequence: add
codegraph sequence <name>command for Mermaid sequence diagram generation from call graph edges — participants are files, BFS forward from entry point, optional--dataflowflag for parameter/return annotations; exposed via CLI, MCP tool, and programmatic API (#345) - exports: add
--unusedflag tocodegraph exports— newexportedcolumn (migration v14) populated from parser export declarations, enabling detection of symbols declared as exports but with zero consumers (#361)
Performance
- native: eliminate deep-clone in
normalizeNativeSymbols— replace 125-line JS deep-clone with in-placepatchNativeResultvia#[napi(js_name)]annotations on Rust types (#361) - native: add
include_ast_nodesflag toparse_file/parse_files— initial parse skips AST node walking, saving ~200ms (#361) - native: move call/receiver/extends edge building to Rust (
edge_builder.rs) — narrowest-span caller resolution, confidence sorting, dedup via u64 edge keys (#361) - native: add
known_filesHashSet cache toresolve_imports_batch— avoids redundant FS syscalls during import resolution (#361) - native: parallelize
resolve_imports_batchwith rayon for concurrent import resolution (#361) - builder: batch SQLite multi-value INSERTs — accumulate node/edge rows and flush with chunked INSERT statements (200 rows per chunk) instead of individual prepared statement runs (#361)
Bug Fixes
- native: fix no-op rebuild regression (~80x slower than WASM) —
extToLangmap was not built when native engine provided pre-computed CFG, causinglangIdlookup to return null and triggering full re-parse on every incremental build (#360) - native: pass full file list to
known_filescache — on incremental builds only changed files were passed, causing valid import targets to be dropped (#361) - benchmark: install native package explicitly in npm benchmark mode (#351)
Documentation
- reorder README to be AI-first throughout (#362)
- add MCP tool surface optimization proposal (#363)
- update build performance, query, and incremental benchmarks for 3.0.4 (#352, #353, #354)
Chores
v3.0.4 Performance
Native engine goes full-stack: CFG, AST nodes, and WASM double-parse elimination. This release completes the native engine migration — CFG computation and AST node extraction now run in Rust for 8 languages, eliminating the redundant WASM pre-parse on native builds.
Performance
- native: compute CFG in Rust native engine for all 8 languages (JS/TS/TSX, Python, Go, Rust, Java, C#, Ruby, PHP) — ports
buildFunctionCFGalgorithm to Rust with per-languageCfgRules, eliminates WASM re-parsing in CFG phase (#342) - native: extract AST nodes (call, new, throw, await, string, regex) for all non-JS languages in Rust via shared
walk_ast_nodes_with_config()— astMs drops from ~651ms to ~50ms (#340) - builder: skip
ensureWasmTreesentirely when native engine provides complete CFG + dataflow + AST data — wasmPreMs drops from ~388ms to 0 on native builds (#344)
Bug Fixes
- native: fix function-scoped
constdeclarations being incorrectly extracted as top-level constants (#344) - benchmark: show all build phases (astMs, cfgMs, dataflowMs, wasmPreMs) in benchmark report and document v3.0.0→v3.0.3 native regression cause (#339)
3.0.3 (2026-03-04)
Note: 3.0.2 was an internal/unpublished version used during development.