import type { MakeRunResultInternal, MakeListResultInternal } from "../schemas/index.js"; import type { MakeTool } from "./make-runner.js"; /** * Parses the output of a `make` or `just` run into structured result data. */ export declare function parseRunOutput(target: string, stdout: string, stderr: string, exitCode: number, duration: number, tool: MakeTool, timedOut?: boolean): MakeRunResultInternal; /** * Parses `just --list` output into structured target data. * * Expected format: * ``` * Available recipes: * build # Build the project * test # Run tests * clean * ``` */ export declare function parseJustList(stdout: string): { targets: { name: string; description?: string; }[]; total: number; }; /** Shape returned by `just --dump-format json`. */ export interface JustDumpRecipe { name?: string; doc?: string | null; parameters?: Array<{ name: string; default?: string | null; }>; dependencies?: Array<{ recipe: string; } | string>; body?: unknown; } export interface JustDump { recipes?: Record; aliases?: Record; } /** * Parses `just --dump-format json` output into structured target data. * * The JSON dump includes recipe names, parameters, dependencies, and docs. * All just recipes are inherently phony (no file targets). */ export declare function parseJustDumpJson(jsonOutput: string, opts?: { showRecipe?: boolean; }): { targets: { name: string; description?: string; isPhony?: boolean; dependencies?: string[]; recipe?: string[]; }[]; total: number; }; /** * Parses `make -pRrq` database output to extract user-defined target names. * * The make database output contains lines like: * ``` * target-name: dependency1 dependency2 * # Not a target * .PHONY: ... * ``` * * We extract lines matching `^[a-zA-Z0-9_-]+:` that are not built-in targets * (starting with `.`) and not comments. */ export declare function parseMakeTargets(stdout: string): { targets: { name: string; description?: string; dependencies?: string[]; }[]; total: number; }; /** * Parses `.PHONY` declarations from Makefile source to determine which targets are phony. * * @param makefileSource - Raw contents of the Makefile * @returns Set of target names declared as .PHONY */ export declare function parsePhonyTargets(makefileSource: string): Set; /** * Enriches targets with isPhony flag based on .PHONY declarations. * * @param targets - Targets previously extracted from `make -pRrq` output * @param phonySet - Set of phony target names from parsePhonyTargets * @returns The same targets array, mutated with `isPhony` fields where applicable */ export declare function enrichPhonyFlags(targets: { name: string; description?: string; isPhony?: boolean; dependencies?: string[]; recipe?: string[]; }[], phonySet: Set): void; /** * Enriches parsed make targets with descriptions extracted from the Makefile source. * * Supports the common `target: [deps] ## Description text` convention where a * double-hash comment at the end of the target rule line serves as documentation. * This convention is widely used in Makefiles that provide a `help` target. * * @param targets - Targets previously extracted from `make -pRrq` output * @param makefileSource - Raw contents of the Makefile * @returns The same targets array, mutated with `description` fields where found */ export declare function enrichMakeTargetDescriptions(targets: { name: string; description?: string; recipe?: string[]; }[], makefileSource: string): { name: string; description?: string; recipe?: string[]; }[]; /** * Parses dependency lists from Makefile source for best-effort dependency enrichment. * This extracts dependencies from `target: dep1 dep2` lines in the Makefile source * (not the make database output), providing cleaner results for user-defined rules. */ export declare function parseMakeDependencies(makefileSource: string): Map; /** * Parses explicit target recipe bodies from Makefile source. * * Captures tab-indented command lines that immediately follow target rules. * Pattern rules (`%.o: %.c`) are excluded here and returned via parsePatternRules. */ export declare function parseMakeRecipes(makefileSource: string): Map; /** * Parses Makefile pattern rules (e.g., `%.o: %.c`) with optional recipes. */ export declare function parsePatternRules(makefileSource: string): { pattern: string; dependencies?: string[]; recipe?: string[]; }[]; /** * Adds parsed recipe bodies to already-discovered make targets. */ export declare function enrichTargetRecipes(targets: { name: string; recipe?: string[]; }[], recipeMap: Map): void; /** * Builds a full MakeListResult from parsed target data and the detected tool. */ export declare function buildListResult(parsed: { targets: { name: string; description?: string; isPhony?: boolean; dependencies?: string[]; recipe?: string[]; }[]; patternRules?: { pattern: string; dependencies?: string[]; recipe?: string[]; }[]; total: number; }, tool: MakeTool): MakeListResultInternal; //# sourceMappingURL=parsers.d.ts.map