Expand description
Signature extraction — regex fallback layer.
IMPORTANT for readers skimming the repo: this file is the fallback, not the
primary engine. The default build extracts signatures with tree-sitter via
declarative per-language queries in crate::signatures_ts (real ASTs,
real multi-line spans, ~27 languages). extract_signatures_with_backend tries that path
first and only drops to the line-oriented regex extractors here when the
tree-sitter feature is off or a parse yields nothing usable for a file.
The regex extractors are intentionally conservative: single-line declarations,
declaration-line spans only (end_line == start_line). Use
extract_signatures_with_backend when you need to know — and surface —
which backend actually produced a result (gitlab #981).
Structs§
Enums§
- SigBackend
- Which extractor produced a signature set: the primary tree-sitter AST path
(
crate::signatures_ts) or the line-oriented regex fallback in this module. Surfaced so navigation output (ctx_outline) can label its backend honestly and verifiably instead of merely claiming “via tree-sitter” (gitlab #981).
Functions§
- exports_
not_ in_ signatures - Exports not already named by
key_sigs. Map-mode renderers list the API with full signatures + line ranges; repeating those same names in anexports:line is pure redundancy. Callers surface only the exports the API does not already cover (e.g. re-exports or const/type aliases that aren’t captured as signatures), keeping map lossless while dropping duplicates (#361). Shared by the MCP, CLI, and benchmark map renderers. - extract_
signatures_ counted - Extract signatures and count the producing backend in the process-lifetime
signature_backend_stats. Returns the backend as well, so the engine’sextract_signaturescan add its persistent per-extension telemetry. - extract_
signatures_ with_ backend - Like
extract_signatures_countedbut does not touch the global backend counters, so callers that only want the label (e.g. per-file JSON outline) don’t distortsignature_backend_stats; the counted path staysextract_signatures_counted. - signature_
backend_ stats - Returns (tree_sitter_hits, regex_fallback_hits) since process start.
- tdd_
legend - One-line legend for TDD symbol notation (GL #580): outputs must be
self-describing for vanilla agents without injected rules. Only the
symbols actually present in
sigsare explained, keeping the line well under the 15-token budget for typical files. Empty when nothing applies.