/** * Constitution Schema * * Zod schema for autofix constitution files that govern * which patterns can be auto-applied and under what conditions. * * @module autofix/constitution.schema */ import { z } from "zod"; /** * Risk tolerance levels for autofix operations */ export declare const RiskToleranceSchema: z.ZodEnum<["conservative", "moderate", "aggressive"]>; /** * Severity levels */ export declare const SeveritySchema: z.ZodEnum<["info", "low", "medium", "high", "critical"]>; /** * Conditions for pattern approval */ export declare const PatternConditionsSchema: z.ZodOptional>; /** Exclude from specific directories */ excludedPaths: z.ZodOptional>; /** Maximum lines changed per fix */ maxLinesChanged: z.ZodOptional; /** Only if severity at or above this level */ minSeverity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }>>; /** * Pattern approval configuration */ export declare const PatternApprovalSchema: z.ZodObject<{ /** Pattern ID from FIX_PATTERNS */ patternId: z.ZodString; /** Whether this pattern can be auto-applied */ autoApprove: z.ZodBoolean; /** Required reviewer if not auto-approved */ requiredReviewer: z.ZodOptional; /** Additional conditions for auto-approval */ conditions: z.ZodOptional>; /** Exclude from specific directories */ excludedPaths: z.ZodOptional>; /** Maximum lines changed per fix */ maxLinesChanged: z.ZodOptional; /** Only if severity at or above this level */ minSeverity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }>>; }, "strip", z.ZodTypeAny, { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }, { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }>; /** * PR creation rules */ export declare const PRRulesSchema: z.ZodObject<{ /** Require human approval before merge */ requireApproval: z.ZodDefault; /** Minimum number of approvers */ minApprovers: z.ZodDefault; /** Required labels on all autofix PRs */ requiredLabels: z.ZodDefault>; /** Assignees for autofix PRs */ defaultAssignees: z.ZodDefault>; /** Reviewers for autofix PRs */ defaultReviewers: z.ZodDefault>; /** Title prefix for autofix commits */ commitPrefix: z.ZodDefault; /** Include Co-Authored-By in commits */ includeCoAuthor: z.ZodDefault; /** Maximum PRs to create in a single run */ maxPRsPerRun: z.ZodDefault; /** Group fixes by this strategy */ groupBy: z.ZodDefault>; }, "strip", z.ZodTypeAny, { groupBy: "file" | "severity" | "pattern" | "single"; requireApproval: boolean; minApprovers: number; requiredLabels: string[]; defaultAssignees: string[]; defaultReviewers: string[]; commitPrefix: string; includeCoAuthor: boolean; maxPRsPerRun: number; }, { groupBy?: "file" | "severity" | "pattern" | "single" | undefined; requireApproval?: boolean | undefined; minApprovers?: number | undefined; requiredLabels?: string[] | undefined; defaultAssignees?: string[] | undefined; defaultReviewers?: string[] | undefined; commitPrefix?: string | undefined; includeCoAuthor?: boolean | undefined; maxPRsPerRun?: number | undefined; }>; /** * Directory-level restrictions */ export declare const DirectoryRulesSchema: z.ZodObject<{ /** Never auto-fix in these directories */ neverAutofix: z.ZodDefault>; /** Always require review in these directories */ requireReview: z.ZodDefault>; /** Skip scanning these directories entirely */ ignore: z.ZodDefault>; }, "strip", z.ZodTypeAny, { neverAutofix: string[]; requireReview: string[]; ignore: string[]; }, { neverAutofix?: string[] | undefined; requireReview?: string[] | undefined; ignore?: string[] | undefined; }>; /** * Safety constraints */ export declare const SafetyConstraintsSchema: z.ZodObject<{ /** Require clean git working tree before applying fixes */ requireCleanWorkingTree: z.ZodDefault; /** Create backup branch before applying fixes */ createBackupBranch: z.ZodDefault; /** Run tests after applying fixes */ runTestsAfterFix: z.ZodDefault; /** Test command to run */ testCommand: z.ZodDefault; /** Revert fix if tests fail */ revertOnTestFailure: z.ZodDefault; /** Maximum total files to modify in one run */ maxFilesPerRun: z.ZodDefault; /** Dry run by default (require explicit --apply) */ dryRunDefault: z.ZodDefault; }, "strip", z.ZodTypeAny, { requireCleanWorkingTree: boolean; createBackupBranch: boolean; runTestsAfterFix: boolean; testCommand: string; revertOnTestFailure: boolean; maxFilesPerRun: number; dryRunDefault: boolean; }, { requireCleanWorkingTree?: boolean | undefined; createBackupBranch?: boolean | undefined; runTestsAfterFix?: boolean | undefined; testCommand?: string | undefined; revertOnTestFailure?: boolean | undefined; maxFilesPerRun?: number | undefined; dryRunDefault?: boolean | undefined; }>; /** * Full constitution configuration */ export declare const ConstitutionSchema: z.ZodObject<{ /** Version of the constitution schema */ version: z.ZodLiteral<"1.0">; /** Organization name */ organization: z.ZodOptional; /** Overall risk tolerance */ riskTolerance: z.ZodDefault>; /** Pattern-specific approvals */ patterns: z.ZodDefault; /** Additional conditions for auto-approval */ conditions: z.ZodOptional>; /** Exclude from specific directories */ excludedPaths: z.ZodOptional>; /** Maximum lines changed per fix */ maxLinesChanged: z.ZodOptional; /** Only if severity at or above this level */ minSeverity: z.ZodOptional>; }, "strip", z.ZodTypeAny, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }, { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; }>>; }, "strip", z.ZodTypeAny, { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }, { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }>, "many">>; /** PR creation rules */ prRules: z.ZodDefault; /** Minimum number of approvers */ minApprovers: z.ZodDefault; /** Required labels on all autofix PRs */ requiredLabels: z.ZodDefault>; /** Assignees for autofix PRs */ defaultAssignees: z.ZodDefault>; /** Reviewers for autofix PRs */ defaultReviewers: z.ZodDefault>; /** Title prefix for autofix commits */ commitPrefix: z.ZodDefault; /** Include Co-Authored-By in commits */ includeCoAuthor: z.ZodDefault; /** Maximum PRs to create in a single run */ maxPRsPerRun: z.ZodDefault; /** Group fixes by this strategy */ groupBy: z.ZodDefault>; }, "strip", z.ZodTypeAny, { groupBy: "file" | "severity" | "pattern" | "single"; requireApproval: boolean; minApprovers: number; requiredLabels: string[]; defaultAssignees: string[]; defaultReviewers: string[]; commitPrefix: string; includeCoAuthor: boolean; maxPRsPerRun: number; }, { groupBy?: "file" | "severity" | "pattern" | "single" | undefined; requireApproval?: boolean | undefined; minApprovers?: number | undefined; requiredLabels?: string[] | undefined; defaultAssignees?: string[] | undefined; defaultReviewers?: string[] | undefined; commitPrefix?: string | undefined; includeCoAuthor?: boolean | undefined; maxPRsPerRun?: number | undefined; }>>; /** Directory restrictions */ directories: z.ZodDefault>; /** Always require review in these directories */ requireReview: z.ZodDefault>; /** Skip scanning these directories entirely */ ignore: z.ZodDefault>; }, "strip", z.ZodTypeAny, { neverAutofix: string[]; requireReview: string[]; ignore: string[]; }, { neverAutofix?: string[] | undefined; requireReview?: string[] | undefined; ignore?: string[] | undefined; }>>; /** Safety constraints */ safety: z.ZodDefault; /** Create backup branch before applying fixes */ createBackupBranch: z.ZodDefault; /** Run tests after applying fixes */ runTestsAfterFix: z.ZodDefault; /** Test command to run */ testCommand: z.ZodDefault; /** Revert fix if tests fail */ revertOnTestFailure: z.ZodDefault; /** Maximum total files to modify in one run */ maxFilesPerRun: z.ZodDefault; /** Dry run by default (require explicit --apply) */ dryRunDefault: z.ZodDefault; }, "strip", z.ZodTypeAny, { requireCleanWorkingTree: boolean; createBackupBranch: boolean; runTestsAfterFix: boolean; testCommand: string; revertOnTestFailure: boolean; maxFilesPerRun: number; dryRunDefault: boolean; }, { requireCleanWorkingTree?: boolean | undefined; createBackupBranch?: boolean | undefined; runTestsAfterFix?: boolean | undefined; testCommand?: string | undefined; revertOnTestFailure?: boolean | undefined; maxFilesPerRun?: number | undefined; dryRunDefault?: boolean | undefined; }>>; /** Custom metadata to include in PRs */ metadata: z.ZodOptional>; }, "strip", z.ZodTypeAny, { version: "1.0"; riskTolerance: "moderate" | "conservative" | "aggressive"; patterns: { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }[]; prRules: { groupBy: "file" | "severity" | "pattern" | "single"; requireApproval: boolean; minApprovers: number; requiredLabels: string[]; defaultAssignees: string[]; defaultReviewers: string[]; commitPrefix: string; includeCoAuthor: boolean; maxPRsPerRun: number; }; directories: { neverAutofix: string[]; requireReview: string[]; ignore: string[]; }; safety: { requireCleanWorkingTree: boolean; createBackupBranch: boolean; runTestsAfterFix: boolean; testCommand: string; revertOnTestFailure: boolean; maxFilesPerRun: number; dryRunDefault: boolean; }; metadata?: Record | undefined; organization?: string | undefined; }, { version: "1.0"; metadata?: Record | undefined; organization?: string | undefined; riskTolerance?: "moderate" | "conservative" | "aggressive" | undefined; patterns?: { patternId: string; autoApprove: boolean; requiredReviewer?: string | undefined; conditions?: { allowedPaths?: string[] | undefined; excludedPaths?: string[] | undefined; maxLinesChanged?: number | undefined; minSeverity?: "info" | "critical" | "high" | "medium" | "low" | undefined; } | undefined; }[] | undefined; prRules?: { groupBy?: "file" | "severity" | "pattern" | "single" | undefined; requireApproval?: boolean | undefined; minApprovers?: number | undefined; requiredLabels?: string[] | undefined; defaultAssignees?: string[] | undefined; defaultReviewers?: string[] | undefined; commitPrefix?: string | undefined; includeCoAuthor?: boolean | undefined; maxPRsPerRun?: number | undefined; } | undefined; directories?: { neverAutofix?: string[] | undefined; requireReview?: string[] | undefined; ignore?: string[] | undefined; } | undefined; safety?: { requireCleanWorkingTree?: boolean | undefined; createBackupBranch?: boolean | undefined; runTestsAfterFix?: boolean | undefined; testCommand?: string | undefined; revertOnTestFailure?: boolean | undefined; maxFilesPerRun?: number | undefined; dryRunDefault?: boolean | undefined; } | undefined; }>; /** * Inferred types from schemas */ export type RiskTolerance = z.infer; export type Severity = z.infer; export type PatternConditions = z.infer; export type PatternApproval = z.infer; export type PRRules = z.infer; export type DirectoryRules = z.infer; export type SafetyConstraints = z.infer; export type Constitution = z.infer; /** * Default constitution with conservative settings */ export declare const DEFAULT_CONSTITUTION: Constitution; //# sourceMappingURL=constitution.schema.d.ts.map