import { pathExists as defaultPathExists, readText as defaultReadText, writeText as defaultWriteText } from "../fs.js"; import { runCommand as defaultRunCommand, type RunCommandResult } from "../exec.js"; export type BugfixFinishGateTier = "strict" | "light" | "quick"; export interface BugfixFinishAutoOptions { strict?: boolean; light?: boolean; quick?: boolean; remote?: string; } export interface BugfixFinishAutoValidationResult { ok: boolean; errors?: string[]; warnings?: string[]; raw?: string; } export interface BugfixFinishAutoRuntime { /** Override the workspace root in tests. */ root?: string; runCommand?: typeof defaultRunCommand; pathExists?: typeof defaultPathExists; readText?: typeof defaultReadText; writeText?: typeof defaultWriteText; /** Directory listing seam (verification-evidence scan). */ readDir?: (dir: string) => Promise; validateChangeArtifacts?: (root: string, changeId: string, options: { strict: boolean; allowTruthDrift: boolean; checkEvidence?: boolean; checkScope?: boolean; }) => Promise; finishChange?: (options: Record) => Promise; /** Test seam for build/lint/test commands. */ runGateCommand?: (label: string, command: string, args: string[], cwd: string) => Promise; } type PathExists = typeof defaultPathExists; type ReadText = typeof defaultReadText; type WriteText = typeof defaultWriteText; export interface VerifyEvidenceResult { strong: string[]; weak: string[]; } /** * 扫描可执行验证证据: * - strong:exit_code=0 的 validate stamp / .last-run.json status=passed / * evidence+bug/test-reports 下含通过记录的验证文件 / verify-before-complete 含 * "ok: all gates passed"。 * - weak:证据目录非空(但有内容不等于执行过)。 */ export declare function collectVerifyEvidence(root: string, changeDirPath: string, runtime: { readDir?: (d: string) => Promise; readText?: ReadText; pathExists?: PathExists; }): Promise; /** * verify-evidence 门禁三档: * - strict:无 strong → 拒绝 finish * - light:无 strong → warn + evidence/verify-evidence-degraded.md 降级标记 * - quick:无 strong → 仅 warn(最快通道不落标记) */ export declare function runVerifyEvidenceGate(runtime: BugfixFinishAutoRuntime, root: string, tier: BugfixFinishGateTier, changeId: string, changeDirPath: string, exists: PathExists, write: WriteText): Promise; export declare function backfillProblemIssueJsonl(root: string, changeId: string, exists?: PathExists, read?: ReadText, write?: WriteText): Promise<{ problemId: string; changed: boolean; }>; /** * Deterministic bugfix closeout: * dirty/scope preflight → JSONL backfill → explicit stage → commit → * canonical submodule push/merge/push/archive finish. */ export declare function bugfixFinishAutoCommand(changeId: string, options?: BugfixFinishAutoOptions, runtime?: BugfixFinishAutoRuntime): Promise; export {};