Commit Graph
60 Commits
Author SHA1 Message Date
Martin Vogel c89538f764 v0.5: CBM tree-sitter engine, 59 vendored language grammars
- Replace Go-binding tree-sitter with vendored C grammars compiled via
  CGo (internal/cbm/); eliminates all Go module/linker fragility
- Add 32 new languages: Clojure, CMake, COBOL, Common Lisp, CUDA, Elm,
  Emacs Lisp, Fortran, F#, GLSL, GraphQL, INI, JSON, Julia, Makefile,
  Markdown, Meson, Nix, Protobuf, Svelte, Verilog, Vim Script, Vue, XML
  (plus C, C#, Erlang, SQL, YAML quality improvements)
- Adaptive worker concurrency and mmap prefetch for faster indexing
- Graph buffer: batched SQLite writes for 3-5x throughput improvement
- Fix cancellation test: use 50ms timeout (pipeline now indexes 212-file
  Erlang repo in ~400ms, well under the old 2s deadline)
- Fix isTestFunction: add "Test" prefix for C#, "test" prefix for Scala
2026-03-05 22:39:01 +01:00
Martin Vogel 3cc9ea2e08 Fix Louvain community detection O(N^2) bottleneck
Replace naive modularityGain (scanned all nodes per call) with
per-community commSumTot accumulators maintained incrementally.
Each iteration is now O(m) instead of O(N^2).

Django benchmark: communities pass 4m40s → 0.94s (297x faster),
total indexing 5m38s → 24s.
v0.3.4
2026-03-03 18:07:45 +01:00
Martin Vogel 5fe2b50f2f Fix Windows CI: close SQLite before TempDir cleanup
Add t.Cleanup(router.CloseAll) to snippet and watcher test helpers.
Windows does not allow deleting files held by another process, so the
SQLite DB must be closed before t.TempDir() removal runs.
v0.3.3
2026-03-03 16:50:01 +01:00
Martin Vogel 228edc7d21 v0.4: Pipeline quality improvements, snippet tool optimization
Pipeline quality:
- 17 import parsers (ES modules, Java, Kotlin, Scala, C#, C, C++, PHP,
  Ruby, Rust, Lua, Elixir, Bash, Zig, Erlang, Haskell, OCaml)
- Language-aware isClassDeclaration() for TS, Java, C#, Scala, Kotlin, PHP
- Route test filtering (isTestNode + containsTestSegment)
- Haskell/OCaml/Elixir callee extraction for apply/infix/application nodes
- JSX component refs via extractJSXComponentRefs()
- Typed + dynamic type inference split
- Extraction test coverage (1679 lines)

Snippet tool optimization for AI coding agents:
- Replace "error" key with "status"/"message" in disambiguation responses
- Add auto_resolve param (opt-in, picks best from <=2 candidates)
- Add include_neighbors param (opt-in, returns caller/callee names)
- Fix fuzzy fallback to extract last dot-segment from qualified names
- Add NodeNeighborNames store method for neighbor name lookups
2026-03-03 16:26:31 +01:00
DeusData 8e3870fa1e Merge pull request #14 from utafrali/fix/issue-5-fix-r-function-name-resolution-all-funct
Add test for R function name resolution
2026-03-03 12:49:05 +01:00
ugurtafrali 351b9a3bc8 Add test for R function name resolution 2026-03-03 02:16:20 +03:00
Martin Vogel 9ce3d27e50 Add robots.txt and sitemap.xml for search engine indexing 2026-03-02 23:15:48 +01:00
Martin Vogel e90ecdaf5c Add CONTRIBUTING.md and GitHub Pages landing page
- CONTRIBUTING.md: build from source, run tests, PR guidelines, language fix workflow
- docs/index.html: SEO-optimized landing page with benchmark data, feature grid, comparison table
2026-03-02 23:13:24 +01:00
Martin Vogel 5755ef122e Add get_architecture, manage_adr tools; rename Leiden to Louvain
New tools:
- get_architecture: codebase architecture overview with 12 selectable aspects
  (languages, packages, entry_points, routes, hotspots, boundaries, services,
  layers, clusters, file_tree, adr)
- manage_adr: CRUD for Architecture Decision Records with 6 fixed sections,
  section filtering, validation, and discovery of existing architecture docs

Architecture analysis fixes:
- Fix qnToPackage extracting segment[2] for meaningful sub-packages instead
  of segment[1] which collapsed everything to top-level dirs
- Filter test functions from entry_points, hotspots, and routes using both
  is_test property (Module/File nodes) and file_path pattern matching
- Filter boundaries to Function/Method/Class nodes only
- Add FindArchitectureDocs for discovering existing architecture documentation

Naming corrections:
- Rename Leiden to Louvain throughout (algorithm is simplified Louvain,
  not actual Leiden which requires CPM-based refinement)
- leiden.go -> louvain.go with all symbols renamed
- Remove unused ClusterInfo.Modularity field (always zero)

Other changes:
- Case-insensitive search by default for search_graph and search_code
- Remove read_file and list_directory tools (handled by coding agents natively)
- Update tool descriptions and README for 8000 char ADR limit
v0.3.2
2026-03-02 16:10:57 +01:00
Martin Vogel a0674cb9e6 Update server.json to v0.3.1 release with SHA256 checksums
Bump version from 0.1.4 to 0.3.1, update all 5 platform download
URLs and SHA256 hashes, update language count from 12 to 35.
2026-03-02 01:35:18 +01:00
Martin Vogel 52d5ddd3bf Release v0.3.1: detect_changes, risk scoring, editor support, SDK upgrade
- Add detect_changes tool: map git diff to affected symbols + blast radius
  with risk classification (unstaged/staged/all/branch scopes)
- Add risk_labels param to trace_call_path: depth-based impact classification
  (CRITICAL/HIGH/MEDIUM/LOW) with impact_summary counts
- Add Cursor + Windsurf MCP config auto-registration (install/uninstall)
- Upgrade go-sdk v1.3.1 → v1.4.0 (security fixes, spec compliance)
- Improve tool descriptions with inline regex examples for AI agents
- Update skills documentation and README
v0.3.1
2026-03-02 01:02:00 +01:00
Martin Vogel b5fb8dabda Add replace option to release workflow
New boolean input allows re-releasing the same version by deleting
the existing release and force-updating the tag before rebuild.
v0.3.0
2026-03-01 21:53:02 +01:00
Martin Vogel 9da902e42a Fix release binary naming and Codex CLI MCP registration
- Release workflow: build binary as `codebase-memory-mcp` (not
  `codebase-memory-mcp-<os>-<arch>`) inside tarballs. Users extract
  and get the correct name without renaming.
- Codex CLI: replace broken `codex mcp add/remove` calls with direct
  config.toml manipulation. Codex uses [mcp_servers.<name>] sections,
  not CLI subcommands.
- README: add explicit extract-and-move step to Quick Start.
2026-03-01 19:43:07 +01:00
Martin Vogel e116ef6263 Fix mcp remove hanging: add -s user scope flag
claude mcp remove without -s user prompts interactively for scope,
which hangs when run from install/uninstall commands. Both
registerClaudeCodeMCP (pre-cleanup remove) and deregisterMCP
(uninstall) now pass -s user explicitly.
2026-03-01 19:32:07 +01:00
Martin Vogel 9e06d89779 Fix Windows CI: .exe suffix, USERPROFILE, skip Unix-specific tests
- TestMain: append .exe to binary name on Windows
- Add testEnvWithHome/setTestHome helpers for cross-platform HOME override
  (Windows uses USERPROFILE, not HOME)
- Add exeSuffix() helper for fake binary creation
- Skip Unix-specific tests on Windows: shell RC detection, PATH append,
  fallback path lookup
- Normalize CRLF in skill frontmatter check (git may convert on Windows)
2026-03-01 18:34:02 +01:00
Martin Vogel e773c6a275 Fix install: write skills unconditionally, not gated on claude CLI
Skill files were only written inside installClaudeCode(), which required
finding the `claude` CLI binary. In CI (Linux) with no claude installed,
skills were never written, causing 4 test failures.

Split into installSkills() (always runs) and registerClaudeCodeMCP()
(only when claude CLI found).
2026-03-01 18:16:24 +01:00
Martin Vogel 07df6e09d7 Update README numbers: 25 → 35 languages, fresh benchmark stats
- Feature line: list all 35 languages including Obj-C, Swift, Dart,
  Perl, Groovy, Erlang, R, SCSS, SQL, Dockerfile
- Performance section: updated with Django (49K nodes) and Linux
  kernel stress test numbers from the v0.3.0 benchmark
- Architecture section: 25 → 35 language specs
- Token efficiency: reference 35 real-world repos instead of single project
2026-03-01 18:06:27 +01:00
Martin Vogel a8abb46ffa Remove root skills/ folder, now embedded in binary
Skills are shipped inside the binary and installed via
`codebase-memory-mcp install`. The standalone skills/ directory
is no longer needed.
2026-03-01 18:04:34 +01:00
Martin Vogel d6dc6a1e3f Bump benchmark header to v0.3.0 2026-03-01 18:02:23 +01:00
Martin Vogel 3862f15218 Release v0.3.0: 25 languages, install/update CLI, skills, benchmark
Language expansion (13 → 25):
  Add Ruby, C, Bash, Zig, Elixir, Haskell, OCaml, HTML, CSS, YAML,
  TOML, HCL with tree-sitter grammars and language specs.
  Restore Erlang and SQL with extraction fixes.

CLI install/update/uninstall commands:
  Auto-detect Claude Code and Codex CLI, register MCP server,
  install task-specific skills, self-update with SHA-256 verification.

Embedded skills (4):
  exploring, tracing, quality, reference — auto-trigger in Claude Code
  for graph-first code discovery.

Pipeline improvements:
  Docstring extraction, enrichment pass for params/returns/complexity,
  graceful context cancellation, improved test detection.

35-language benchmark (BENCHMARK.md):
  12 questions × 35 repos, 91.8% overall score, Linux kernel stress
  test (20K nodes, zero timeouts). Replaces old benchmark artifacts.
2026-03-01 18:01:52 +01:00
Martin Vogel ef6b5dc954 Fix update-available notice: goroutine ordering, body limit, UX
Three bugs prevented the update notice from appearing:
- checkForUpdate goroutine launched after blocking sessionOnce.Do,
  so it never ran before tool calls arrived
- 4KB body limit truncated the ~15KB GitHub API response
- Notice was a JSON map key with no guaranteed ordering

Fixes:
- Move go checkForUpdate() before sessionOnce.Do in all handlers
- Increase body read limit to 64KB
- Prepend notice as separate MCP TextContent block (appears first)
- Link to GitHub releases page instead of go install command
v0.2.1
2026-02-28 03:17:45 +01:00
Martin Vogel c3ce01312f Fix gofmt: import order and trailing newlines 2026-02-28 02:48:20 +01:00
Martin Vogel 4a7e2374fd Bump version to 0.2.1 2026-02-28 02:44:36 +01:00
Martin Vogel e0dcb36836 Tighten cache directory permissions from 0755 to 0750
Drop world-read/execute on cache directories created by MkdirAll.
Addresses gosec G301 findings — no functional change.
2026-02-28 02:42:57 +01:00
DeusData 6542bfa2a6 Merge pull request #3 from GauravRatnawat/feat/kotlin-support
feat: add Kotlin language support (.kt, .kts)
2026-02-28 02:37:27 +01:00
Gaurav Ratnawat 2dc987914d feat: add Kotlin language support
Add Kotlin (.kt, .kts) as the 13th supported language with full
tree-sitter parsing, AST node extraction, call resolution, usage
tracking, and string constant propagation.
Changes:
- internal/lang/kotlin.go: Kotlin LanguageSpec registration
- internal/lang/lang.go: Add Kotlin constant and AllLanguages()
- internal/parser/parser.go: Register tree-sitter-kotlin grammar
- internal/pipeline/pipeline.go: Kotlin in isConstantNode(),
  isExported(), extractCalleeName()
- internal/pipeline/resolve.go: resolveKotlin() for val declarations
- internal/pipeline/usages.go: Kotlin reference node types
- Tests: TestParseKotlin, TestResolveKotlinConcat, extension tests
- go.mod: Add tree-sitter-grammars/tree-sitter-kotlin v1.1.0
- README.md: Update language count to 13
2026-02-28 02:36:50 +01:00
DeusData e81202d0d5 Merge pull request #2 from bhicks329/fix/csharp-tree-sitter-grammar
Fix C# support: wire tree-sitter-c-sharp grammar into parser
2026-02-28 02:32:30 +01:00
Martin Vogel c431702b35 Merge PR #3: Add Kotlin language support (.kt, .kts) 2026-02-28 02:31:17 +01:00
Martin Vogel 27e0707c6d Fix missing trailing newlines in Kotlin PR files 2026-02-28 02:31:11 +01:00
Gaurav Ratnawat 91f50bd95c test: add comprehensive Kotlin tests across all test files
- lang_test.go: TestKotlinSpec validates extensions, function/class node types
- pipeline_test.go: TestPipelineKotlinProject integration test (functions, classes, methods, edges)
- resolve_test.go: TestResolveKotlinChained for 3-level string concat resolution
  Also restore 8 previously deleted tests (CPP, Lua, env vars, JS nullish/logical-or, etc.)
- usages_test.go: TestPassUsagesKotlinCreatesEdges, TestPassUsagesKotlinDoesNotDuplicateCalls
2026-02-28 02:25:24 +01:00
Gaurav Ratnawat 1c95eb506d feat: add Kotlin language support
Add Kotlin (.kt, .kts) as the 13th supported language with full
tree-sitter parsing, AST node extraction, call resolution, usage
tracking, and string constant propagation.
Changes:
- internal/lang/kotlin.go: Kotlin LanguageSpec registration
- internal/lang/lang.go: Add Kotlin constant and AllLanguages()
- internal/parser/parser.go: Register tree-sitter-kotlin grammar
- internal/pipeline/pipeline.go: Kotlin in isConstantNode(),
  isExported(), extractCalleeName()
- internal/pipeline/resolve.go: resolveKotlin() for val declarations
- internal/pipeline/usages.go: Kotlin reference node types
- Tests: TestParseKotlin, TestResolveKotlinConcat, extension tests
- go.mod: Add tree-sitter-grammars/tree-sitter-kotlin v1.1.0
- README.md: Update language count to 13
2026-02-28 02:25:24 +01:00
Martin Vogel 501bf5a3f3 Merge PR #2: Fix C# support — wire tree-sitter-c-sharp grammar into parser 2026-02-28 02:25:02 +01:00
Ben HicksandClaude Sonnet 4.6 13c0dff423 Fix C# support: wire tree-sitter-c-sharp grammar into parser
C# was listed as a supported language but every .cs file produced
"unsupported language: c-sharp" because the tree-sitter grammar was
never wired up. The comment cited a "module path mismatch", but
github.com/tree-sitter/tree-sitter-c-sharp is a valid Go module path
(hyphens are allowed); the Go package inside simply uses underscores
(tree_sitter_c_sharp), which is standard Go convention.

Fix: add the import and map lang.CSharp to tree_sitter_c_sharp.Language()
in parser.go. Also remove the C# skip from TestAllLanguagesLoad and add
TestParseCSharp to verify class and method parsing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 02:20:29 +01:00
Martin Vogel 6469cb641d Restructure release workflow: lint gate, then test+build per platform
Pipeline: lint (ubuntu) -> test+build per OS (5 parallel) -> release
Lint failure stops early. Each platform runs its own tests before building.
v0.2.0
2026-02-28 02:10:20 +01:00
Martin Vogel 600ec428d6 Fix lint (http.NoBody) and restructure release workflow
- Use http.NoBody instead of nil in checkForUpdate (gocritic httpNoBody)
- Restructure workflow: lint+test gate -> parallel builds -> release
  Prevents wasted build compute when lint or tests fail.
2026-02-28 02:07:49 +01:00
Martin Vogel 6811faf82b Add optional release_notes input to Release workflow
When provided, uses the custom notes as the release body.
When empty, falls back to auto-generated notes from commits.
2026-02-28 02:02:54 +01:00
Martin Vogel fb30ca61d6 v0.2.0: Multi-DB router, enrichment pipeline, update-available notification, enhanced language support
Major changes:
- Store router: per-project SQLite databases with automatic migration
- Pipeline enrichment: community detection, inheritance, decorators, read/write tracking, test detection, type usage, exception flows, configuration relationships
- Update checker: lightweight GitHub release check on startup, injects update_available into first tool response
- Language support: enhanced extraction for C++, C#, Go, Java, JavaScript, Lua, PHP, Python, Rust, Scala, TSX, TypeScript
- Cypher executor: improved query execution with better aggregation and pattern matching
- HTTP link detection: cross-service HTTP call inference
- CLI mode: extended with --raw flag, human-friendly summaries for all tools
- Search: sort_by support, exclude_labels, glob matching improvements
- AST debug tool for parser development
2026-02-28 01:58:47 +01:00
Ben HicksandClaude Sonnet 4.6 f8ac0a09f2 Fix C# support: wire tree-sitter-c-sharp grammar into parser
C# was listed as a supported language but every .cs file produced
"unsupported language: c-sharp" because the tree-sitter grammar was
never wired up. The comment cited a "module path mismatch", but
github.com/tree-sitter/tree-sitter-c-sharp is a valid Go module path
(hyphens are allowed); the Go package inside simply uses underscores
(tree_sitter_c_sharp), which is standard Go convention.

Fix: add the import and map lang.CSharp to tree_sitter_c_sharp.Language()
in parser.go. Also remove the C# skip from TestAllLanguagesLoad and add
TestParseCSharp to verify class and method parsing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 19:45:12 +00:00
Martin Vogel 4ee7720b48 v0.1.5: Performance optimizations, mattn driver, batch passStructure, CTE BFS, SQL COUNT, fix delete_project file_hashes 2026-02-26 23:50:02 +01:00
Martin Vogel b5aded4eed Fix lint violations: extract helpers, use defer, prealloc slices
- Extract schema query helpers to reduce GetSchema cognitive complexity
- Add scanDegrees helper for batch degree counting with proper defer
- Fix errcheck, rowserrcheck, sqlclosecheck, prealloc, nestingReduce
- Suppress gocognit for Cypher step dispatch (inherently branchy)
v0.1.4
2026-02-26 20:26:09 +01:00
Martin Vogel 97289ddae6 Fix CI: build golangci-lint from source for Go 1.26 compat 2026-02-26 20:17:20 +01:00
Martin Vogel f932e87b6e v0.1.4: CLI mode, query performance optimizations, Go 1.26
Add CLI mode for direct tool invocation from the shell — every MCP tool
can now be called without an MCP client. Useful for testing, scripting,
and CI pipelines.

Query engine rewrite: SQL LIKE pre-filtering extracts literal substrings
from regex patterns before scanning, batch degree counting replaces
per-node queries, and schema queries use id→label maps instead of 3-way
JOINs. Cypher relationship queries up to 600x faster on large graphs.

Incremental reindex 4x faster via content-hash skip optimization.

Upgrade to Go 1.26 (Green Tea GC) and SQLite v1.46.1.
2026-02-26 19:27:27 +01:00
Martin Vogel d9920c6513 Add MCP Registry server.json and update .gitignore
Published to official MCP Registry as io.github.DeusData/codebase-memory-mcp.
2026-02-25 20:06:42 +01:00
Martin Vogel 147059a634 v0.1.3: Bug fixes, query improvements, cross-service linking, and graph enrichment
Part A — Bug fixes:
- Fix globToLike: **/dir/** now matches relative paths without leading /
- Route nodes inherit file_path from handler (were invisible to file_pattern)
- Compose YAML non-string env values (int/bool/float) no longer dropped
- Compose secret filter: key names like JWT_PRIVATE_KEY_ID no longer filtered
- Cloudbuild bash script deploy flags now parsed (entrypoint: bash)

Part B — Query improvements:
- search_graph exclude_labels parameter to filter noisy labels (e.g. Route)
- Cypher edge property filtering: r.url_path, r.confidence, r.confidence_band

Part C — Cross-service linking:
- InfraFile env var URLs feed into HTTP linker as additional call sites
- Default noise filtering: /health, /healthz, /ready, /metrics excluded
- Confidence bands on HTTP_CALLS: high (>=0.7), medium (>=0.45), speculative (>=0.25)
- Levenshtein distance and n-gram overlap similarity functions
- Lowered match threshold from 0.45 to 0.25 (speculative band)

Part D — Graph enrichment:
- OVERRIDE edges: struct methods → interface methods they implement
- USAGE edges: read references (callbacks, variable assignments) vs invocations
- Generated column index on url_path for fast edge property lookups
- Fuzzy name-only resolution fallback (5th strategy in call resolver)
- Configurable HTTP linker via .cgrconfig (exclude paths, min confidence)
- OpenTelemetry trace ingestion (ingest_traces tool) to validate HTTP_CALLS
- Git history change coupling (FILE_CHANGES_WITH edges, co-change analysis)

Updated tool descriptions and skill file with new edge types.
2026-02-25 18:46:20 +01:00
Martin Vogel 33b700f36f Bump version to 0.1.2 2026-02-25 16:06:15 +01:00
Martin Vogel 860e80c88f Add auto-sync watcher, fix WithTransaction data race, add infra file indexing
Auto-sync: background watcher polls indexed projects for file changes
(mtime+size) and triggers incremental re-indexing automatically. Adaptive
polling interval scales with repo size (1s-60s). Non-blocking — uses
TryLock to skip if manual index_repository is in progress.

WithTransaction: changed signature to return a transaction-scoped Store
instead of mutating the shared querier field. Eliminates a data race
where concurrent read handlers could use a committed transaction.

Infrastructure file indexing: new pipeline pass indexes Dockerfiles,
docker-compose, cloudbuild, .env, Terraform, and YAML config files as
InfraFile nodes with structured properties.

Also includes: indexMu mutex on Server for safe concurrent access,
Claude Code skill file in repo, updated README with auto-sync docs.
2026-02-25 16:05:34 +01:00
Martin Vogel e4839e758d Add cross-service query guidance to tool descriptions
Clarify that search_graph relationship filter counts node degrees
(not edges), direct users to query_graph Cypher for listing
HTTP_CALLS/ASYNC_CALLS edges with properties, and recommend
direction=both in trace_call_path for full cross-service context.
2026-02-25 14:20:48 +01:00
Martin Vogel 55850fa888 Fix 7 lint violations: extract helpers to reduce cognitive complexity
- processFileCalls: extract resolvePythonSelfCall + extendTypeMapWithReceiver (gocognit, nestif)
- injectEnvBindings: extract buildConstantsList + mergeWithExistingModule (gocognit, nestif)
- TestAsyncDispatchKeywords: extract writeTestFile, createTestNode, assertEdgeType helpers (funlen)
- envscan.go: return filepath.Walk errors instead of nil (nilerr), simplify regex (gocritic)
2026-02-25 13:55:53 +01:00
Martin Vogel 97284a35fa v0.1.0: Performance, incremental indexing, async boundary detection
Performance & quality:
- Transaction wrapping (Querier interface, single tx per index run)
- Composite indexes on edges table for faster traversals
- Cypher WHERE push-down (=, CONTAINS, STARTS WITH → SQL)
- golangci-lint with 25 linters, zero violations
- 11 benchmarks for pipeline, search, and BFS

Incremental indexing:
- Content-hash based file change detection
- Dependency-aware two-level invalidation (changed + dependents)
- Stale file cleanup for deleted files

Async boundary detection:
- Project-wide env var URL scanner (Dockerfile, YAML, .tf, .sh, .env,
  TOML, properties files) with 3-layer secret exclusion
- Env var default extraction in constant propagation (getEnv, os.environ.get,
  process.env with ||/?? fallback)
- ASYNC_CALLS edge type for Cloud Tasks, Pub/Sub, SQS/SNS, RabbitMQ, Kafka
  dispatch patterns, separate from synchronous HTTP_CALLS
- Tool descriptions updated with all edge types

Other improvements:
- Type inference for method dispatch resolution
- Interface implementation detection (IMPLEMENTS edges)
- Improved tool descriptions for discoverability
2026-02-25 13:43:57 +01:00
Martin Vogel b3acbf8de2 Add comprehensive docs: troubleshooting, Cypher subset, qualified names, .cgrignore
Addresses documentation gaps found during review:
- First Use: clarify repo_path is required, document when to reindex
- Tool tables: add key parameters, scoping notes, pagination details
- New sections: Qualified Names format, Supported Cypher Subset,
  Edge Properties, .cgrignore syntax, Troubleshooting table
- Usage examples: project filter, discover-then-trace pattern, pagination
- CLAUDE.md snippet: add project scoping and discover-then-trace tips
2026-02-25 10:43:59 +01:00