Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .codegraphignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Repo-local ignores for codegraph indexing.
# This file uses .gitignore-like patterns and is loaded by codegraph in addition
# to config defaults.

.codegraph/**

codegraph
codegraph.exe
codegraph.sqlite*
.gotelemetry/**
.claude/**
79 changes: 74 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Run tests
run: go test ./...

build-and-release:
build:
needs: test
runs-on: ubuntu-latest
strategy:
Expand All @@ -48,6 +48,7 @@ jobs:
- goos: windows
goarch: arm64
archive_ext: zip

steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -93,12 +94,80 @@ jobs:
sha256sum "${dist}/${archive_base}.tar.gz" > "${dist}/${archive_base}.tar.gz.sha256"
fi

- name: Publish release assets
uses: softprops/action-gh-release@v2
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
generate_release_notes: true
files: |
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.tar.gz
dist/*.tar.gz.sha256
dist/*.zip
dist/*.zip.sha256

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist

- name: Flatten downloaded artifacts
shell: bash
run: |
set -euo pipefail
mkdir -p release-dist
find dist -type f \( -name "*.tar.gz" -o -name "*.tar.gz.sha256" -o -name "*.zip" -o -name "*.zip.sha256" \) -exec cp {} release-dist/ \;

- name: Extract release notes from CHANGELOG.md
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME}"
section_header="## ${version} -"

awk -v header="$section_header" '
BEGIN { found=0 }
$0 ~ /^## / && found { exit }
index($0, header) == 1 { found=1 }
found { print }
' CHANGELOG.md > release-notes-full.md

if ! grep -q "^## ${version} -" release-notes-full.md; then
echo "Could not find release notes section for tag ${version} in CHANGELOG.md"
exit 1
fi

tail -n +2 release-notes-full.md > release-notes.md

- name: Create or update GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail

if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release edit "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--notes-file release-notes.md
else
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--notes-file release-notes.md
fi

- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
gh release upload "${GITHUB_REF_NAME}" release-dist/* --clobber
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ codegraph.exe
codegraph.sqlite
codegraph.sqlite-shm
codegraph.sqlite-wal
OPTIMIZATIONS.md
118 changes: 60 additions & 58 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
# Changelog

# Release v1.0.9 - 16-04-2026
## v1.1.0 - 27-04-2026

Improved Node.js repo indexing stability by hard-skipping common generated/tooling directories (for example node_modules and .next), refining default excludes, and clarifying ignore override behavior.
A performance, correctness, and operability release focused on faster indexing, schema-backed edge resolution, streaming exports, and tighter DB lifecycle handling.

## Changes
### Highlights
- **Indexing performance:** Repo-wide change detection is dramatically lighter — narrower DB projections, the existing-files load now overlaps the filesystem walk, per-row payloads are slimmed, and content-hash reads are deferred to the slow path. No-op repo updates do far less work and allocate substantially less.
- **Edge resolver scaling:** Slash-suffix, dot-tail2, and the dominant 2-dot dot-suffix paths are now schema-backed indexed joins instead of repo-wide symbol scans, removing large constant-factor and quadratic costs on bigger graphs (the 2-dot dot-suffix case is roughly three orders of magnitude faster on the large-scale benchmark). A steady-state guard short-circuits resolver work when no unresolved edges remain. Cross-file edge resolution on update runs stays path-scoped instead of going repo-wide.
- **Write-path allocations:** Symbol, edge, and batch insert SQL plus IN-placeholder strings are cached; edge source selection uses span/binary-search; residual allocations in the multi-file batch path are trimmed; tokenization allocations are reduced.
- **Streaming exports:** JSON and DOT exports stream through paged store calls. Peak memory is now O(page) instead of O(repo) for the unbounded paths, and the bounded-page CLI uses the same primitives.
- **Watch & update correctness:** Repo include/exclude is applied consistently; the dirty-file queue is crash-safe via claim/delete; chmod-only and directory-create events are ignored; `--jsonl` output is stable across `index`, `watch`, and `doctor`.
- **DB lifecycle hardening:** Per-version migrations run on a single connection under `BEGIN IMMEDIATE`; pragmas apply across the pool with a unified driver-aware busy-retry policy; `doctor` uses the same DSN/pragma path; `clean` and `doctor` add ANALYZE, WAL checkpoint, incremental vacuum, and a `--deep` integrity check.
- **Query correctness fixes:** `RelatedTests(file)` is correctly scoped via `target_file_id`; symbol lookup is deterministic; deleted-file graph rows are purged and cross-file references nullified, including ghost `test_links` rows pointing at deleted files; duplicate token-stat counting in batched writes is fixed; `FindDeadCode` is faster via dedicated indexes.
- **Operability:** New `index_smoke` runner produces compact perf-diff output; repo artifacts default to `.codegraph/` with legacy fallback; the CLI gains a command registry, per-command help, and canonical query command names with backward-compatible aliases; benchmarks capture `--sqlite-profile` and host context for reproducible perf comparisons.

### Fixes
- **Indexer:** Established a strict skip policy for common Node.js generated directories (e.g., `node_modules`, `.next`, `.nuxt`). These are now hardcoded and enforced early during filesystem traversal.
- **Indexer:** Clarified ignore override behavior; hardcoded skips are now non-overridable via negation patterns in `.codegraphignore` to ensure predictable indexer performance.
- **Config:** Centralized default exclude patterns to maintain consistency across the CLI and indexer.
- **SQL Hardening:** Added explicit bounds and safety checks for all path-filtering SQL queries.
## v1.0.9 - 16-04-2026

## Upgrade Notes
- No required migrations or configuration changes.
Improved Node.js repo indexing stability by hard-skipping common generated/tooling directories (for example `node_modules` and `.next`), refining default excludes, and clarifying ignore override behavior.

## v1.0.7 - 27-03-2026
### Changed
- **indexer:** Enforce strict early skips for common Node.js generated directories; hardcoded skips are non-overridable via `.codegraphignore` negations. (#8)
- **config:** Centralize default exclude patterns to keep CLI/indexer behavior consistent. (#8)

### Fixed
- **sql:** Add explicit bounds/safety checks for path-filtering queries. (#8)
- **build/release:** Carry through `CGO_ENABLED=0` + tree-sitter cross-compilation fixes and release diagnostics. (#4, #5, #6)

- Restored release cross-compilation by splitting tree-sitter adapters behind `//go:build cgo` and using heuristic parsers in `CGO_ENABLED=0` builds.
### Docs
- **readme/changelog:** Update Node.js support status and release notes. (#8)

## v1.0.6 - 26-03-2026
## v1.0.8 - 27-03-2026

### Fixed

- Stopped sending JSON-RPC responses to MCP notifications (`notifications/initialized` and other `notifications/*` methods), which violated the protocol and caused strict clients to fail on connect.
- Changed tool schema `"required": null` to omit the field when empty, fixing JSON Schema validation failures in strict MCP clients.
- Removed non-standard `structuredContent` field from tool call responses to conform to the MCP spec.
- Routed unhandled-method logging through the configured stderr writer instead of Go's default logger.
- **build:** Restore `CGO_ENABLED=0` cross-compilation by splitting tree-sitter adapters behind `//go:build cgo` and using heuristic parsers in no-cgo builds. (#5)

### Changed
- **ci:** Add release build diagnostics to improve cross-platform release debugging. (ci/workflow)

## v1.0.7 - 27-03-2026

- `NewServer` now accepts an `io.Writer` for error output, giving callers control over diagnostic logging.
### Fixed
- **mcp:** Tighten MCP protocol compliance for stricter clients. (#3)

### Docs
- Add `v1.0.6` changelog entry. (docs)

- Added Claude Code MCP setup section to README with `.mcp.json` examples.
- Added missing `list_scans` and `latest_scan_errors` to the MCP tools list in README.
- Added one-line descriptions to all 14 MCP tools in README.
## v1.0.6 - 26-03-2026

### Fixed
- **mcp:** Stop sending JSON-RPC responses to notifications; fix JSON Schema `required` handling; remove non-standard fields; route unhandled-method logging via configured stderr writer. (mcp)

### Changed
- `NewServer` accepts an `io.Writer` for error output, giving callers control over diagnostic logging. (mcp)

### Docs
- Add Claude Code MCP setup examples; add missing tools to MCP docs list; add short tool descriptions. (readme)

## v1.0.5 - 21-03-2026

### Fixed
- Default to a repo-local SQLite DB (while continuing to recognize legacy locations) and exclude repo DB artifacts from indexing. (config/store)

### Changed
- Treat prior global `db_dir` default as legacy so existing installs fall forward safely. (config)

## v1.0.4 - 18-03-2026

- Switched the default database location to per-repository `codegraph.sqlite` and excluded `codegraph.sqlite*` from indexing so repo-local DB mode works on repeated `index` and `serve` runs.
- Treated the previous global `db_dir` default as a legacy value so existing installs fall forward to repo-local DB behavior without manual config edits.
- Updated Codex MCP setup guidance and examples to use `config.toml` with `startup_timeout_sec = 60`.
### Docs
- README update to include graph/export usage. (docs)

## v1.0.3 - 18-03-2026

### Changed
### Added
- **cli:** `watch`, `benchmark`, `config init`, `clean`, `doctor --fix`, and `--jsonl` output for long-running/indexing workflows. (cli)
- **mcp/query:** Query commands + tools, including offset pagination and supported-languages introspection. (mcp)
- **parser:** Heuristic adapters for major languages plus a Python adapter. (parser)
- **export:** Include symbols + edges in graph exports; support export streaming. (export)

- Simplified core code paths in `internal/store`, `internal/mcp`, `internal/cli`, and parser adapters while preserving behavior.
- Reduced duplicated row-scanning and pagination parsing logic to improve maintainability.
- Cached MCP tool definition payload construction for lower repeated allocation overhead on `tools/list`.
### Changed
- **indexer/scan:** `.codegraphignore` negation patterns; per-language scan coverage; best-effort parse policy; batched metadata writes and scoped edge resolution. (indexer)
- **performance:** Parallelize indexing and reduce allocation/IO overhead; improve watcher flush/coalescing; add scan phase timings; SQLite/store tuning. (perf)

### Notes
- **licensing:** Relicensed under FSL-1.1 to prevent commercial reselling. (license)

- This release is focused on code quality, readability, and safe internal optimization with no intended user-facing breaking changes.
## v1.0.2 - 18-03-2026

## v1.0.2 - 2026-03-18

### Highlights

- Added `watch --jsonl`, benchmark improvements, and `config init` workflow updates.
- Added/expanded query, export, MCP, and parser capabilities (including Python and heuristic multi-language adapters).
- Improved indexing and store performance with batching, scoped edge resolution, and scan/stat tuning.
- Added cleaner local maintenance workflows (`clean`, doctor improvements, and setup/path guidance updates).
### Fixed
- Installation hardening + README updates to unblock `go install` workflows. (install/docs)

## v1.0.1 - 18-03-2026

### Fixes

- Corrected Go module path from `github.com/example/localcodegraph` to `github.com/isink17/codegraph`.
- Updated internal imports to match the published module path.
- Updated install docs with actual module path and Go install/PATH troubleshooting guidance.
### Fixed
- Correct Go module path to `github.com/isink17/codegraph`; align imports and install docs accordingly. (install/docs)

## v1.0.0 - 18-03-2026

Initial public release of `codegraph`.

### Highlights

- Added a local-first Go CLI for installation, indexing, updates, stats, graph export, doctor checks, watch mode, and MCP serving.
- Added a SQLite-backed repository graph with explicit migrations and incremental file hashing.
- Added a parser abstraction with a working Go parser adapter and a clean seam for future Tree-sitter adapters.
- Added MCP stdio support with generic tools for indexing, symbol lookup, call graph navigation, impact analysis, related test discovery, semantic search, and graph stats.
- Added release automation for macOS, Linux, and Windows GitHub release artifacts.
- Added agent-oriented documentation for Codex-style clients, Gemini CLI, and Claude-compatible MCP configuration examples.
- Added initial automated tests for install flow, platform paths, incremental indexing, and MCP `graph_stats`.

### Notes

- This release targets local-first usage on macOS and Linux first, with Windows kept feasible by design.
- The parser subsystem is intentionally shaped for Tree-sitter-backed adapters, while the first shipping implementation uses the Go standard AST for reliability and simple installation.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ dist/
*.generated.go
```

Note: `.codegraph/` is always skipped by the indexer (repo-local config/artifacts).

---

## Architecture
Expand Down
9 changes: 5 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ If `codegraph` is not on `PATH`, replace `command` and `args` with a form that l
By default, `codegraph` stores its database in the served repository as:

```text
codegraph.sqlite
.codegraph/codegraph.sqlite
```

If you do not want to commit the local database, ignore:

```text
codegraph.sqlite
codegraph.sqlite-shm
codegraph.sqlite-wal
.codegraph/

# Legacy location (still recognized if present):
codegraph.sqlite*
```
Loading
Loading