Class HealerService

java.lang.Object
com.shaft.mcp.HealerService

@Service public class HealerService extends Object
MCP healer loop for guarded SHAFT/Selenium reruns and review-only repair suggestions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the default local MCP healer service.
  • Method Summary

    Modifier and Type
    Method
    Description
    runFailedTest(String repositoryRoot, List<String> testCommand, String outputDirectory, int maxAttempts, boolean includeScreenshots, boolean includePageSnapshots, List<String> allowedSourcePaths, boolean networkValidationApproved, boolean useConfiguredAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName, String backend)
    Reruns a failing SHAFT/Selenium test and returns evidence-backed repair suggestions.
    verifyFocused(String repositoryRoot, List<String> command, boolean networkValidationApproved)
    Runs a guarded, tokenized Maven verification command headlessly and returns a bounded pass/fail summary.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HealerService

      public HealerService()
      Creates the default local MCP healer service.
  • Method Details

    • runFailedTest

      @Tool(name="healer_run_failed_test", description="reruns a failing SHAFT/Selenium test, analyzes fresh Allure evidence, and returns review-only fixes plus agent replay guidance; optional backend (web|playwright, defaults to web) selects the generated snippets' engine, absorbing playwright_healer_run_failed_test") public McpHealerRunResult runFailedTest(String repositoryRoot, List<String> testCommand, String outputDirectory, int maxAttempts, boolean includeScreenshots, boolean includePageSnapshots, List<String> allowedSourcePaths, boolean networkValidationApproved, boolean useConfiguredAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName, @ToolParam(required=false) String backend)
      Reruns a failing SHAFT/Selenium test and returns evidence-backed repair suggestions.
      Parameters:
      repositoryRoot - Git/Maven project root inside the MCP workspace
      testCommand - tokenized Maven command for the failing test
      outputDirectory - healer and Doctor output directory inside the MCP workspace
      maxAttempts - maximum rerun attempts, clamped to 1..5
      includeScreenshots - explicit approval to retain screenshot evidence
      includePageSnapshots - explicit approval to retain page-source evidence
      allowedSourcePaths - optional repository-relative source paths approved for provider evidence
      networkValidationApproved - whether Maven may run without offline mode
      useConfiguredAi - whether to request configured SHAFT provider snippets in addition to agent handoff
      allowLocalAi - explicit local provider consent when configured AI is requested
      allowRemoteAi - explicit remote provider consent when configured AI is requested
      driverVariableName - Java driver variable name used in snippets
      Returns:
      guarded rerun attempts plus review-only remediation
    • verifyFocused

      @Tool(name="verify_run_focused", description="runs a guarded, tokenized Maven verification command (compile, test-compile, test, verify, package) headlessly inside the MCP workspace and returns a bounded pass/fail summary; release and deploy goals are rejected") public McpVerificationResult verifyFocused(String repositoryRoot, List<String> command, boolean networkValidationApproved)
      Runs a guarded, tokenized Maven verification command headlessly and returns a bounded pass/fail summary.

      Reuses the healer command allowlist: only compile/test-compile/test/verify/package/install goals run, release and deploy goals are rejected, tests are forced headless, and offline mode is added unless network validation is explicitly approved. This lets clients run the coding-partner plan's focused verification command without leaving the MCP session.

      Parameters:
      repositoryRoot - Maven project root inside the MCP workspace; blank uses the workspace root
      command - tokenized Maven verification command, for example ["mvn","-q","test-compile"]
      networkValidationApproved - whether Maven may resolve dependencies online instead of offline
      Returns:
      guarded verification result