/** * Did `rg` fail to SPAWN (never ran), as opposed to running and exiting/crashing? A spawn failure — * rg missing (`ENOENT`), not executable (`EACCES`), a broken PATH component (`ENOTDIR`), or blocked * by a sandbox (`EPERM`) — is the §7.2-dangerous silent zero and must throw. Node marks EVERY such * failure with a `spawnSync` syscall and NO exit signal (the process was never created), which is * the robust signal — not an errno whitelist, which misses the rarer never-ran codes. Deliberately * excluded (rg DID run → stay a valid-empty / salvage result, never a false "rg is missing"): * exit 1 "no matches" and exit 2 crash carry no syscall; an output-overflow kill (`ENOBUFS`) carries * a `SIGTERM` signal and partial stdout. (Error shapes verified against `execFileSync`, 2026-07-31.) * @param {any} e * @returns {boolean} */ export function rgSpawnFailed(e: any): boolean; /** * Risk bucket from a reference count. Aurora-validated thresholds (lsp_tool `_calculate_risk`): * @param {number} n * @returns {"low"|"medium"|"high"} */ export function riskBucket(n: number): "low" | "medium" | "high"; /** * @typedef {Object} Caller * @property {string} path repo-relative file with a confirmed call * @property {number} line 0-based line of the call site * @property {string|null} symbol enclosing caller symbol, or null at module top level * @property {string} [alias] when set, the call reaches the symbol under this re-exported name (5b) */ /** * @typedef {Object} Impact * @property {string} symbol * @property {{ path: string, startLine: number, endLine: number }[]} defs every definition (over-count: all of them) * @property {number} refCount max(confirmed, mentions) — the over-count-safe blast radius * @property {number} confirmed tree-sitter-confirmed external call sites * @property {number} mentions external `rg -w` word occurrences (the safety floor) * @property {"low"|"medium"|"high"} risk * @property {number} complexity cyclomatic-ish (max over defs) * @property {Caller[]} callers confirmed call sites (may be capped — see hedges) * @property {string[]} callees intra-repo names this symbol calls (unique) * @property {string[]} hedges §7.2 safety caveats; never a silent "isolated" */ /** * Compute the impact of changing `symbol`. Returns null if the symbol isn't defined in the index * (impact answers for YOUR code's symbols; an unknown name has no blast radius to report). * @param {import("./store.js").Store} store * @param {string} root absolute repo root * @param {string[]} include indexed file extensions (e.g. [".py", ".js"]) * @param {string} symbol * @returns {Promise} * @throws {RipgrepMissingError} when `rg` is not on PATH — the caller sweep can't run, and a silent * 0-caller result would be a §7.2 false isolation (the one dangerous error), so we refuse. */ export function computeImpact(store: import("./store.js").Store, root: string, include: string[], symbol: string): Promise; /** * Thrown when `impact()` cannot run its caller sweep because `ripgrep` (`rg`) is not on PATH. * * This is deliberately loud rather than a `0-caller` result. The whole view is built on the §7.2 * asymmetry — over-count safe, under-count dangerous — and a missing `rg` produces the *maximal* * under-count: `mentions` and `confirmed` both collapse to 0, `refCount` to 0, `risk` to "low". A * silent empty sweep is therefore indistinguishable from a genuine isolation, i.e. the one dangerous * error the view exists to prevent. Like {@link import("./index.js").StalePointerError}, we refuse * rather than return a confident-looking wrong answer. Fully recoverable: install ripgrep (`rg`). */ export class RipgrepMissingError extends Error { constructor(); /** @type {string} */ code: string; } export type Caller = { /** * repo-relative file with a confirmed call */ path: string; /** * 0-based line of the call site */ line: number; /** * enclosing caller symbol, or null at module top level */ symbol: string | null; /** * when set, the call reaches the symbol under this re-exported name (5b) */ alias?: string | undefined; }; export type Impact = { symbol: string; /** * every definition (over-count: all of them) */ defs: { path: string; startLine: number; endLine: number; }[]; /** * max(confirmed, mentions) — the over-count-safe blast radius */ refCount: number; /** * tree-sitter-confirmed external call sites */ confirmed: number; /** * external `rg -w` word occurrences (the safety floor) */ mentions: number; risk: "low" | "medium" | "high"; /** * cyclomatic-ish (max over defs) */ complexity: number; /** * confirmed call sites (may be capped — see hedges) */ callers: Caller[]; /** * intra-repo names this symbol calls (unique) */ callees: string[]; /** * §7.2 safety caveats; never a silent "isolated" */ hedges: string[]; };