ShellSentryExtension

ShellSentryExtension is an extension API to bring your own, complex checkers to ShellSentry.

Extensions are given the command, exit code, and console output of the failed command. They can then process it however they want and return an AnalysisResult if they find an issue.

Example

Below is an example of an extension that asks an AI chat bot to diagnose a failure.

public class AiExtension(private val aiClient: AiClient) : ShellSentryExtension {
override fun check(command: String, exitCode: Int, isAfterRetry: Boolean, consoleOutput: Path): AnalysisResult? {
val text = consoleOutput.readText()
val rawAnalysis = aiClient.analyze(text)
return rawAnalysis.toAnalysisResult()
}
}

Functions

Link copied to clipboard
abstract fun check(command: String, exitCode: Int, isAfterRetry: Boolean, consoleOutput: Path): AnalysisResult?

Returns a result of this extension's analysis. Returns null if this extension could not handle failure.