/** * Shared AST-grep utilities for all tools that use @ast-grep/napi. * Single source of truth for language mapping, parsing, and error normalization. * * @plan PLAN-20260211-ASTGREP.P03 */ import { parse, Lang } from '@ast-grep/napi'; /** * File extension to ast-grep language mapping. * Single source of truth across all AST tools. */ export declare const LANGUAGE_MAP: Record; /** * File extensions that belong to the JavaScript/TypeScript language family. */ export declare const JAVASCRIPT_FAMILY_EXTENSIONS: readonly string[]; /** * Resolve a file extension or language name to an ast-grep language. * Accepts both extensions ('ts', 'py') and full names ('typescript', 'python'). * Returns undefined for unrecognized inputs. */ export declare function getAstLanguage(extOrName: string): string | Lang | undefined; /** * Detect the ast-grep language from a file path's extension. * Returns undefined if the extension is not recognized. */ export declare function resolveLanguageFromPath(filePath: string): string | Lang | undefined; /** * Check if @ast-grep/napi is available and usable. */ export declare function isAstGrepAvailable(): boolean; /** * Parse source code with error normalization. * Returns { root } on success or { error } on failure. * Does not throw. */ export declare function parseSource(language: string | Lang, content: string): { root: ReturnType; } | { error: string; }; export { parse, Lang, findInFiles } from '@ast-grep/napi';