package com.correx.core.kernel.orchestration

import java.nio.file.Path

/** Result of running one static-analysis command: its exit code and combined stdout+stderr. */
data class StaticAnalysisRunResult(
    val exitCode: Int,
    val output: String,
)

/**
 * Seam for running operator-configured static-analysis commands (compiler / detekt / formatters)
 * as a deterministic harness step (role-reliability §5 static-first ordering). Implemented by a
 * process-spawning adapter in infrastructure and injected, so the deterministic core never spawns
 * processes itself and the gate stays unit-testable with a fake.
 *
 * The orchestrator records each result as a [com.correx.core.events.events.StaticAnalysisCompletedEvent]
 * (invariant #9 environment observation) — replay reads the recorded facts and never re-runs the command.
 */
fun interface StaticAnalysisRunner {
    suspend fun run(workingDir: Path, command: String): StaticAnalysisRunResult
}
