Skip to content

Releases: AdityaVG13/ast-sgrep

v2.0.0 - Local-first

Choose a tag to compare

@AdityaVG13 AdityaVG13 released this 15 Aug 21:55

ast-sgrep 2.0.0 — Local-first

2.0 is a breaking, stable major: embeddings are in-process only, Pi results reach the model, and five PRs land on top of v1.4.0 (#27, #29, #30, #31, #32).

Breaking

Cloud (--cloud-embed, ASGREP_EMBED_API_KEY) and Ollama (--ollama-embed, ASGREP_OLLAMA_URL) embedding clients are gone. Hashed semantic stays the default; optional ONNX neural stays in-process. Indexes that still store embed_backend=cloud|ollama fail closed until asgrep reindex.

This cut is GitHub + npm. It is not published to crates.io.

Install

pi install npm:pi-ast-sgrep

Standalone CLI binaries are attached to this release (asgrep, asgrep_darwin_x64, asgrep_linux_arm64, asgrep_linux_x64, asgrep_windows_amd64.exe). Build from source with cargo build --release -p ast-sgrep-cli.

What landed

  • Two-channel queries: callers:process_request AND pattern:fn $NAME($$$) joins by span; AND NOT subtracts. Plain English and stays hybrid.
  • Critic + follow-ups: deterministic post-fusion critic; agent JSON why and causal follow_up_queries.
  • SCIP overlay: asgrep index . --scip path/to/index.json degrades, never fails the index.
  • call-path and indexed codemod (dry-run then transactional apply).
  • Pi: hits in content; native search off the Node event loop; auto-registered tools.
  • Index schema 12: atomic generations; .git and .asgrep are the only unconditional directory skips.
  • Per-field semantic vectors, repository-learned vocabulary, watch freshness bounds, native nested pattern: templates.

Full notes: CHANGELOG.

v1.4.0 - The Code Mode Update

Choose a tag to compare

@github-actions github-actions released this 06 Aug 17:24

The Code Mode Update

v1.4.0 turns ast-sgrep from a blazing-fast CLI into an in-process, programmatic search engine for coding agents.

The headline: a new ast-sgrep-codemode NAPI addon ships inside every platform package — warm, stateful search sessions with zero CLI spawns, and a typed tool catalog (search, semantic, defs, callers, chain, imports, …) that agents compose in a bounded JavaScript sandbox. One asgrep_codemode call replaces several model round trips: seed by intent, fan out defs/callers in parallel with Promise.all, filter and shape in JS, return only the evidence needed.

Also in this release:

  • 13-language structural pattern surface with native C# and Swift grammars (real tree-sitter-c-sharp, no more Java stand-in), plus C/C++/Kotlin/PHP grammars — all pinned to one shared conformance contract
  • Search & ranking honesty: fusion normalization that respects each producer's real scoring contract, coverage-aware ranking, monotonic generations that kill stale cache/IVF identities, and SIMD-accelerated literal search (~60% faster pipeline)
  • LSP symbol navigation that finally resolves case-mismatched and uppercase identifiers
  • Bounded watch freshness, durability/cache correctness, and a large quality + anti-bloat wave backed by measured release gates

Ships as 7 npm packagesast-sgrep (launcher), pi-ast-sgrep (Pi extension with Code Mode + /asgrep-doctor, /asgrep-status, /asgrep-index, /asgrep-reindex), and 5 @ast-sgrep/<platform> packages for macOS arm64/x64, Linux arm64/x64, and Windows x64 — each carrying the native binary and the codemode NAPI addon, exact-version matched.


v1.4.0 (2026-08-06)

The next release ships seven pull requests plus direct-to-main hardening. Highlights in one line: a new in-process Code Mode (PTC) API, a 13-language pattern/extraction surface with native C# and Swift grammars, search and ranking correctness (fusion normalization, coverage-aware ranking), LSP symbol navigation that finally handles case-mismatched identifiers, bounded watch freshness, durability/cache correctness, and a large quality + anti-bloat wave with measured release gates.

Capability map

PR Theme Files changed
#14 LSP symbol correctness & compatibility 36
#20 P1 store & search correctness 43
#21 Quality & compatibility batch (measured gates) 159
#22 Fusion normalization & ranking correctness 47
#23 C# + 13-language pattern correctness 54
#25 Anti-bloat cleanup & compatibility hardening 62
#26 ast-sgrep-codemode scaffold (Code Mode / PTC) 976*

* #26's file count is dominated by ~867 fuzz corpus fixtures; the feature surface is ~90 source files.


PR #26 — Code Mode (PTC): in-process programmatic search

Delivered capability: a new in-process ast-sgrep-codemode NAPI addon that turns ast-sgrep into a programmatic tool-calling surface for coding agents — warm sessions, typed tool catalog, zero CLI spawn.

Ships a new ast-sgrep-codemode crate and its NAPI addon (ast-sgrep-codemode.node) inside the existing five @ast-sgrep/<platform> npm packages — same install path as the CLI binary, so pi install gets zero-spawn Code Mode out of the box.

  • CodeModeSession: warm, stateful search session over ast-sgrep-core with a sticky Searcher cache, per-call limits (clamped 1–500), and a soft call budget (default 64) that fails closed.
  • Typed, stringly-dispatched tool catalog: search, semantic, chain, defs, callers, imports, index_status, index_repo, filter_hits, select, catalog_search, catalog_describe.
  • In-plan transforms (filter_hits, select) run as pure JSON projections — no shell, no code execution outside the sandbox.
  • Pi extension integration: Code Mode JS sandbox as primary agent execution, warm parallel batching, session-scoped sticky pool, hardened execution paths.

Representative commits: 4873c0e, 47d595c, 5aab31d.

PR #23 — C# correctness and the 13-language pattern surface

Delivered capability: native C# and Swift grammar support plus a shared nine-language conformance contract, delivered through a table-driven 13-language pattern/extraction surface.

  • Native C# grammar: structural patterns and calls now use real tree-sitter-c-sharp instead of a Java stand-in, covering declarations, properties, local functions, constructors, and invocation expressions (difu.5).
  • Complete Swift support: grammar registration, symbol and import extraction, call ownership, structural patterns, source discovery, module resolution, editor activation (difu.2).
  • More grammars: C/C++/Kotlin/PHP grammars and Ruby singleton_method coverage (difu.3/4/6).
  • One shared conformance contract across all nine languages: parse fidelity, symbols, imports, callers, patterns, spans, and false-positive suppression (difu.1), plus a table-driven 13-language pattern/extract surface.
  • Post-review hardening (pushed during this session): literal LIKE/GLOB metacharacter escaping already landed on main (c2j5); single-character hybrid terms stay substantive and embedding switched to full-rank XOF feature hashing (4e9c981); P0 durability/agent/LSP crash paths hardened (fb2cc6b).

PR #22 — Fusion normalization and ranking correctness

Delivered capability: hybrid scores that respect each producer's real scoring contract — no more dilution by unrelated query terms, with coverage-aware, threshold-safe ranking.

  • Lexical fusion normalization: hybrid scores are normalized against the producer's actual rank-zero RRF ceiling instead of being diluted by total query terms (e2hc.14).
  • Single-character queries stay searchable: every non-empty query term is treated as substantive (945bec3).
  • Def/Caller ceilings derive from the terms that actually match each hit's symbol/callee, removing unmatched-term dilution ([u9fj]).
  • Coverage-aware ranking: pre-truncation keeps coverage in the sort key with a keep*4 pool ([8mb8]), rerank writes consistent scores back into hits ([iva9.8]), zero/non-finite scores can no longer fill the limit ([iva9.4]), and invalid file_filter globs error instead of silently skipping the filter ([iva9.2]).
  • Quoted hybrid queries route to a literal pass; structural-index fused scores are bounded at a calibrated fraction of the pattern channel ([noik]).

Representative commits: d7f3ea9, a9860de, b470c6e.

PR #20 — P1 store & search correctness

Delivered capability: monotonic generation counters that kill stale cache/IVF identities, full 256-bit semantic projections, and a bounded max-latency watch pipeline.

  • Monotonic generations: semantic_data_version and searchable-index generations defeat stale semantic cache and IVF identities after delete/re-add, across connections (44a4).
  • All 256 BLAKE3 sign bits consumed in semantic projection instead of tiling the first 32 (e2hc.13).
  • Bounded watch freshness: a max-latency debounce state machine (quiet-gap coalescing + max-latency bound + .asgrep/sidecar self-event filtering) replaces the unbounded-sustained-stream stall (jsfn).
  • Nested-file-transaction depth tracking with poisoned rollback and synchronous=NORMAL restore on end; meta preserved across clears; UTF-8 path handling.

Representative commits: 100424a, 01cdaad, fe0e655.

PR #14 — LSP symbol correctness & compatibility

Delivered capability: reliable definition/reference navigation for uppercase and case-mismatched symbols, with hardened UTF-16 spans and multi-root handling.

  • Case-insensitive symbol navigation: definition/reference lookup routes through case-insensitive indexed resolution, so uppercase and mixed-case symbols resolve reliably (nuli, z47q).
  • Call-chain nodes with source spelling differing from stored symbol case resolve through the real chain expansion path.
  • UTF-16 span fixes: utf16_span_end no longer eats the next character on pure insertion with a zero-length range (c9os).
  • M...
Read more

v1.3.2 - The Pi Package Update

Choose a tag to compare

@AdityaVG13 AdityaVG13 released this 23 Jul 03:51

Out of the Alpha and into the Light

ast-sgrep is now a pi package!

v1.1.0-alpha — FTS per-file delete hardening

Choose a tag to compare

@AdityaVG13 AdityaVG13 released this 12 Jul 17:17

ast-sgrep v1.1.0-alpha

Hybrid code search that understands intent — lexical FTS + AST graph + offline semantic ranking. Alpha quality; APIs may change.

Highlights

Fixed: FTS per-file delete performance and correctness

  • Rowid-based FTS deletes: replace O(N²) DELETE FROM lines_fts WHERE file_id=? with rowids collected from lines, then chunked deletes on lines_trigram (external content) and lines_fts.
  • Missing file_id indexes: add indexes on symbols, callers, imports, and semantic_chunks so ordinary per-file deletes stay linear.
  • Schema v5: existing databases pick up the new indexes via migration.
  • Hardened row deletion path with targeted tests for stale-FTS correctness, per-table deletion, and linear re-upsert performance.

Install

git clone https://github.com/AdityaVG13/ast-sgrep
cd ast-sgrep
git checkout v1.1.0-alpha
cargo build --release -p ast-sgrep-cli
./target/release/asgrep --version

Binaries: asgrep / ast-sgrep. Also: asgrep-lsp, asgrep-mcp.

Not in this release

  • crates.io packages
  • Homebrew bottles / homebrew-core (formula stub under packaging/homebrew/, SHA still placeholder until digest is filled)
  • Production stability guarantees

Docs

See README and docs/.

v1.0.0-alpha

Choose a tag to compare

@AdityaVG13 AdityaVG13 released this 11 Jul 17:37

ast-sgrep v1.0.0-alpha

Hybrid code search that understands intent — lexical FTS + AST graph + offline semantic ranking. Alpha quality; APIs may change.

Install

git clone https://github.com/AdityaVG13/ast-sgrep
cd ast-sgrep
cargo build --release -p ast-sgrep-cli
./target/release/asgrep --help

Binaries: asgrep / ast-sgrep. Also: asgrep-lsp, asgrep-mcp.

What's in this alpha

  • Persistent SQLite index under .asgrep/
  • Hybrid queries (unprefixed), plus defs:, callers:, semantic, chain, pattern:
  • Offline semantic embeddings by default (no API key)
  • CLI, LSP, MCP, agent-oriented JSON formats
  • 8 languages via tree-sitter

Not in this release

  • crates.io packages
  • Homebrew bottles / homebrew-core (formula stub lives under packaging/homebrew/)
  • Production stability guarantees

Docs

See README and docs/.