export declare const MESH_REFINE_VALIDATION_CATEGORIES: readonly ["typecheck", "test", "lint", "build"];
export type MeshRefineValidationCategory = typeof MESH_REFINE_VALIDATION_CATEGORIES[number];
/**
 * DOCS-ROOT: change-impact scope for a validation command. Mirrors ChangeImpactKind
 * (git-status) so a command can declare WHICH change areas it should run in:
 *   'daemon' — run when a daemon-runtime package changed,
 *   'web'    — run when a web package changed,
 *   'none'   — run when ONLY docs/markers changed (a docs-only branch).
 * A command with NO `scopes` runs in every area (backward-compatible: the full set
 * runs as before). This lets a repo declare a light docs-only profile — e.g. a
 * `docs:verify` command scoped `['none']` — that runs on a docs-only branch while the
 * heavy typecheck/test commands (implicitly all-areas, or scoped ['web','daemon'])
 * are skipped. The scoping is applied only when the branch's changeArea is known;
 * fail-open (unknown change area → every command runs).
 */
export declare const MESH_REFINE_VALIDATION_SCOPES: readonly ["none", "web", "daemon"];
export type MeshRefineValidationScope = typeof MESH_REFINE_VALIDATION_SCOPES[number];
export interface RepoMeshRefineValidationCommandConfig {
    /** Executable name or a whitespace-tokenized command string. Never executed through a shell. */
    command: string;
    /** Optional explicit argv. Prefer this over shell-like command strings. */
    args?: string[];
    category?: MeshRefineValidationCategory;
    cwd?: string;
    timeoutMs?: number;
    outputLimitBytes?: number;
    env?: Record<string, string>;
    /**
     * DOCS-ROOT: change-impact scopes this command runs in ('none' | 'web' | 'daemon').
     * Omitted → runs in every area (backward-compatible). Empty array is treated the
     * same as omitted (runs everywhere) rather than "runs nowhere".
     */
    scopes?: MeshRefineValidationScope[];
}
export interface RepoMeshRefineConfig {
    version: 1;
    /**
     * Narrow Refinery opt-in for monorepos with submodule gitlinks.
     * When true, Refinery may non-force publish unreachable submodule gitlink
     * commits to the submodule remote main branch after validation and
     * patch-equivalence pass, then verify remote-main reachability.
     */
    allowAutoPublishSubmoduleMainCommits?: boolean;
    validation?: {
        required?: boolean;
        /**
         * M2-2 (v2): how Refinery sources its bootstrap stage.
         *   'inherit' (default) — consume the worktree_bootstrap config/state:
         *     skip when the node's bootstrap is 'ready' (staleInputs unchanged),
         *     run the worktree_bootstrap definition when stale/never-ran.
         *   'skip' — no bootstrap stage at all (validation commands run as-is).
         */
        bootstrap?: 'inherit' | 'skip';
        /**
         * DEPRECATED (M2-2): define bootstrap once in
         * .adhdev/worktree_bootstrap.json instead. Still honored when no
         * worktree_bootstrap config exists, with a deprecation warning; when
         * both exist the worktree_bootstrap config wins.
         */
        bootstrapCommands?: RepoMeshRefineValidationCommandConfig[];
        commands?: RepoMeshRefineValidationCommandConfig[];
    };
}
export interface MeshRefineValidationCommandPlan {
    command: string;
    args: string[];
    displayCommand: string;
    category: MeshRefineValidationCategory | 'custom';
    source: string;
    cwd?: string;
    timeoutMs?: number;
    outputLimitBytes?: number;
    env?: Record<string, string>;
    /** DOCS-ROOT: normalized change-impact scopes; absent → runs in every area. */
    scopes?: MeshRefineValidationScope[];
}
export interface MeshRefineConfigLoadResult {
    config?: RepoMeshRefineConfig;
    source: string;
    sourceType: 'mesh_policy' | 'repo_file' | 'unavailable' | 'invalid';
    path?: string;
    error?: string;
}
export interface MeshRefineValidationPlan {
    source: string;
    sourceType: MeshRefineConfigLoadResult['sourceType'];
    /** M2-2: how the bootstrap stage is sourced ('inherit' consumes worktree_bootstrap; 'skip' disables it). */
    bootstrapMode: 'inherit' | 'skip';
    bootstrapCommands: MeshRefineValidationCommandPlan[];
    commands: MeshRefineValidationCommandPlan[];
    rejectedCommands: Array<Record<string, unknown>>;
    /** M2-2: deprecation notices (e.g. validation.bootstrapCommands present). */
    deprecationWarnings: string[];
    suggestions: RepoMeshRefineValidationCommandConfig[];
    suggestedConfig?: RepoMeshRefineConfig;
    unavailableReason?: string;
}
export declare const MESH_REFINE_CONFIG_LOCATIONS: string[];
export declare const MESH_REFINE_CONFIG_SCHEMA: {
    readonly $schema: "https://json-schema.org/draft/2020-12/schema";
    readonly title: "ADHDev Repo Mesh Refinery Config";
    readonly type: "object";
    readonly additionalProperties: false;
    readonly required: readonly ["version"];
    readonly properties: {
        readonly version: {
            readonly const: 1;
        };
        readonly allowAutoPublishSubmoduleMainCommits: {
            readonly type: "boolean";
            readonly default: false;
            readonly description: "When true, Refinery may non-force publish submodule gitlink commits referenced by the refined root tree to each submodule origin/main after validation and patch-equivalence pass, then verify reachability.";
        };
        readonly validation: {
            readonly type: "object";
            readonly additionalProperties: false;
            readonly properties: {
                readonly required: {
                    readonly type: "boolean";
                    readonly default: true;
                };
                readonly bootstrap: {
                    readonly enum: readonly ["inherit", "skip"];
                    readonly default: "inherit";
                    readonly description: "M2-2 (v2): 'inherit' consumes the worktree_bootstrap config/state (skip when ready, rerun when stale); 'skip' disables the bootstrap stage entirely.";
                };
                readonly commands: {
                    readonly type: "array";
                    readonly minItems: 1;
                    readonly maxItems: 8;
                    readonly items: {
                        readonly type: "object";
                        readonly additionalProperties: false;
                        readonly required: readonly ["command"];
                        readonly properties: {
                            readonly command: {
                                readonly type: "string";
                                readonly minLength: 1;
                            };
                            readonly args: {
                                readonly type: "array";
                                readonly items: {
                                    readonly type: "string";
                                };
                            };
                            readonly category: {
                                readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
                            };
                            readonly cwd: {
                                readonly type: "string";
                            };
                            readonly timeoutMs: {
                                readonly type: "number";
                                readonly minimum: 1000;
                                readonly maximum: 600000;
                            };
                            readonly outputLimitBytes: {
                                readonly type: "number";
                                readonly minimum: 1024;
                                readonly maximum: 1048576;
                            };
                            readonly env: {
                                readonly type: "object";
                                readonly additionalProperties: {
                                    readonly type: "string";
                                };
                            };
                            readonly scopes: {
                                readonly type: "array";
                                readonly items: {
                                    readonly enum: readonly ["none", "web", "daemon"];
                                };
                                readonly description: "DOCS-ROOT: change-impact scopes this command runs in ('none'=docs-only, 'web', 'daemon'). Omitted/empty → runs in every area.";
                            };
                        };
                    };
                };
                readonly bootstrapCommands: {
                    readonly type: "array";
                    readonly maxItems: 4;
                    readonly description: "DEPRECATED: define bootstrap once in .adhdev/worktree_bootstrap.json. Honored only when no worktree_bootstrap config exists (with a deprecation warning); worktree_bootstrap wins when both exist.";
                    readonly items: {
                        readonly type: "object";
                        readonly additionalProperties: false;
                        readonly required: readonly ["command"];
                        readonly properties: {
                            readonly command: {
                                readonly type: "string";
                                readonly minLength: 1;
                            };
                            readonly args: {
                                readonly type: "array";
                                readonly items: {
                                    readonly type: "string";
                                };
                            };
                            readonly category: {
                                readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
                            };
                            readonly cwd: {
                                readonly type: "string";
                            };
                            readonly timeoutMs: {
                                readonly type: "number";
                                readonly minimum: 1000;
                                readonly maximum: 600000;
                            };
                            readonly outputLimitBytes: {
                                readonly type: "number";
                                readonly minimum: 1024;
                                readonly maximum: 1048576;
                            };
                            readonly env: {
                                readonly type: "object";
                                readonly additionalProperties: {
                                    readonly type: "string";
                                };
                            };
                            readonly scopes: {
                                readonly type: "array";
                                readonly items: {
                                    readonly enum: readonly ["none", "web", "daemon"];
                                };
                            };
                        };
                    };
                };
            };
        };
    };
};
export declare function isMeshConfigRecord(value: unknown): value is Record<string, unknown>;
export declare function tokenizeCommandString(command: string): string[] | null;
export declare function normalizeMeshCommandConfig(entry: unknown, source: string): {
    command?: MeshRefineValidationCommandPlan;
    rejected?: Record<string, unknown>;
};
export declare function validateMeshRefineConfig(config: unknown, source?: string): {
    valid: boolean;
    errors: string[];
    bootstrapCommands: MeshRefineValidationCommandPlan[];
    commands: MeshRefineValidationCommandPlan[];
    rejectedCommands: Array<Record<string, unknown>>;
    bootstrapMode: 'inherit' | 'skip';
    deprecationWarnings: string[];
};
export declare function loadMeshRefineConfig(mesh: any, workspace: string): MeshRefineConfigLoadResult;
export declare function suggestMeshRefineConfig(mesh: any, workspace: string): {
    suggestions: RepoMeshRefineValidationCommandConfig[];
    suggestedConfig?: RepoMeshRefineConfig;
};
export declare function resolveMeshRefineValidationPlan(mesh: any, workspace: string): MeshRefineValidationPlan;
