import { type FeatureItem, type FeatureList } from "./grub-types.js"; export declare class FeatureListDiffError extends Error { constructor(message: string); } export declare function isFeatureList(value: unknown): value is FeatureList; export type FeatureListReadResult = { ok: true; list: FeatureList; } | { ok: false; error: string; }; export declare function readFeatureList(path: string): FeatureList | null; export declare function readFeatureListResult(path: string): FeatureListReadResult; export declare function writeFeatureList(path: string, list: FeatureList): void; /** * Validates that a mutated feature list only differs from the baseline in * per-item `passes` and `evidence` fields. Returns the validated list (or * throws FeatureListDiffError). If the agent reordered, added, or removed * entries, that counts as a violation. */ export declare function validateFeatureListDiff(before: FeatureList, after: FeatureList): FeatureList; export interface InitializerSanitizeResult { list: FeatureList; /** Human-readable tags describing what was auto-corrected, e.g. ["goal", "passes×6"]. */ fixes: string[]; } /** * Bring an initializer-produced feature list into a clean, executable baseline. * * The initializer's sole job is to stand up a harness; the `goal`, `passes`, * and `evidence` fields are either authoritative-from-elsewhere or * not-yet-earned. Rather than failing the whole turn over these recoverable * hygiene issues (which would also block the initializer→execution phase * transition), we auto-correct them: overwrite `goal` with the authoritative * task goal, force every `passes` to false, and drop stray `evidence`. Returns * the sanitized list plus a list of what was corrected so callers can surface * a friendly note instead of a hard error. */ export declare function sanitizeInitializerFeatureList(list: FeatureList, authoritativeGoal: string): InitializerSanitizeResult; export declare function countPassing(list: FeatureList): number; export declare function allPassing(list: FeatureList): boolean; export declare function firstPending(list: FeatureList): FeatureItem | undefined; /** * Produce an initial feature list skeleton for a new grub task. The * initializer agent is expected to replace this placeholder with 15-40 * concrete feature entries in its first turn, preserving the schema. */ export declare function createInitialFeatureList(goal: string): FeatureList; /** * Migrate a legacy feature-checklist.md (one checkbox per line) into the new * feature-list.json format. Extremely lossy by design: we only copy line * descriptions; category defaults to functional and steps is left empty so * the initializer can refine later. */ export declare function migrateChecklistToFeatureList(checklistPath: string, goal: string): FeatureList | null; /** * Convenience: return the feature list path that sits alongside a checklist * markdown file. Pure path logic so callers don't have to repeat it. */ export declare function defaultFeatureListPath(harnessDirectory: string): string; export declare function ensureParentDirectory(path: string): void;