Class DoctorService
java.lang.Object
com.shaft.mcp.DoctorService
MCP adapter for deterministic SHAFT Doctor analysis with optional configured provider advisory.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.shaft.doctor.model.DoctorAnalysisSummaryanalyze(List<String> inputPaths, List<String> historicalBundlePaths, List<String> allowedRoots, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults) Analyzes explicitly allowed local evidence and optionally appends a configured provider advisory.analyzeFailedAllure(List<String> allureResultPaths, List<String> historicalBundlePaths, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Analyzes failed Allure evidence and returns deterministic remediation plus optional AI advisory snippets.analyzeFailedPlaywrightAllure(List<String> allureResultPaths, List<String> historicalBundlePaths, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Analyzes failed Allure evidence and returns Playwright remediation snippets.com.shaft.doctor.repair.DoctorRepairProposalResultproposeFix(String repositoryRoot, String baseSha, String diagnosisPath, String evidenceBundlePath, String issueReference, List<String> allowedPaths, List<com.shaft.doctor.repair.DoctorRepairRequest.FilePatch> patches, List<List<String>> validationCommands, boolean networkValidationApproved, String outputDirectory, boolean useAi) Creates a repair proposal in an isolated worktree without writing to GitHub.com.shaft.doctor.repair.HealingLocatorProposalproposeHealedLocator(String repositoryRoot, String healingReportPath, String sourcePath, boolean sourcePatchConsent, String outputDirectory) Creates a proposal-only locator patch from a verified SHAFT Heal report.com.shaft.doctor.repair.RepairPublicationResultpublishDraftPr(String manifestPath, boolean approved, String approvalToken, boolean overrideFailedValidation, String overrideRationale, String title) Publishes an approved proposal as a draft pull request only.suggestFix(String jsonReportPath, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Rebuilds MCP remediation actions and code blocks from an existing Doctor JSON report.suggestPlaywrightFix(String jsonReportPath, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Rebuilds Playwright remediation actions and code blocks from an existing Doctor JSON report.
-
Constructor Details
-
DoctorService
public DoctorService()Creates the default local MCP Doctor service.
-
-
Method Details
-
analyzeFailedAllure
@Tool(name="doctor_analyze_failed_allure", description="analyzes failed Allure results and returns deterministic actions plus copy-paste code blocks") public McpAnalysisReport analyzeFailedAllure(List<String> allureResultPaths, List<String> historicalBundlePaths, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Analyzes failed Allure evidence and returns deterministic remediation plus optional AI advisory snippets.- Parameters:
allureResultPaths- Allure result directories or files inside the MCP workspacehistoricalBundlePaths- optional older Doctor bundles inside the MCP workspaceoutputDirectory- output directory inside the MCP workspaceincludeScreenshots- explicit approval to retain local screenshot evidenceincludePageSnapshots- explicit approval to retain local page-snapshot evidenceminimumAllureResults- minimum populated Allure result countrepositoryRoot- optional repository root inside the MCP workspaceallowedSourcePaths- optional repository-relative source paths approved for AI SOURCE evidenceuseAi- whether to request optional provider snippet fallbackallowLocalAi- local provider consent for this requestallowRemoteAi- remote provider consent for this requestdriverVariableName- Java driver variable name used in snippets- Returns:
- deterministic diagnosis, action records, code blocks, report paths, and provider metadata
-
analyzeFailedPlaywrightAllure
@Tool(name="playwright_doctor_analyze_failed_allure", description="analyzes failed Allure results and returns SHAFT Playwright remediation code blocks") public McpAnalysisReport analyzeFailedPlaywrightAllure(List<String> allureResultPaths, List<String> historicalBundlePaths, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Analyzes failed Allure evidence and returns Playwright remediation snippets.- Parameters:
allureResultPaths- Allure result directories or files inside the MCP workspacehistoricalBundlePaths- optional older Doctor bundles inside the MCP workspaceoutputDirectory- output directory inside the MCP workspaceincludeScreenshots- explicit approval to retain local screenshot evidenceincludePageSnapshots- explicit approval to retain local page-snapshot evidenceminimumAllureResults- minimum populated Allure result countrepositoryRoot- optional repository root inside the MCP workspaceallowedSourcePaths- optional repository-relative source paths approved for AI SOURCE evidenceuseAi- whether to request optional provider snippet fallbackallowLocalAi- local provider consent for this requestallowRemoteAi- remote provider consent for this requestdriverVariableName- Java driver variable name used in snippets- Returns:
- deterministic diagnosis, action records, code blocks, report paths, and provider metadata
-
suggestFix
@Tool(name="doctor_suggest_fix", description="returns copy-paste remediation code blocks from an existing SHAFT Doctor report") public McpAnalysisReport suggestFix(String jsonReportPath, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Rebuilds MCP remediation actions and code blocks from an existing Doctor JSON report.- Parameters:
jsonReportPath- Doctor JSON report path inside the MCP workspacerepositoryRoot- optional repository root inside the MCP workspaceallowedSourcePaths- optional repository-relative source paths approved for AI SOURCE evidenceuseAi- whether to request optional provider snippet fallbackallowLocalAi- local provider consent for this requestallowRemoteAi- remote provider consent for this requestdriverVariableName- Java driver variable name used in snippets- Returns:
- deterministic diagnosis, action records, code blocks, report paths, and provider metadata
-
suggestPlaywrightFix
@Tool(name="playwright_doctor_suggest_fix", description="returns SHAFT Playwright remediation code blocks from an existing Doctor report") public McpAnalysisReport suggestPlaywrightFix(String jsonReportPath, String repositoryRoot, List<String> allowedSourcePaths, boolean useAi, boolean allowLocalAi, boolean allowRemoteAi, String driverVariableName) Rebuilds Playwright remediation actions and code blocks from an existing Doctor JSON report.- Parameters:
jsonReportPath- Doctor JSON report path inside the MCP workspacerepositoryRoot- optional repository root inside the MCP workspaceallowedSourcePaths- optional repository-relative source paths approved for AI SOURCE evidenceuseAi- whether to request optional provider snippet fallbackallowLocalAi- local provider consent for this requestallowRemoteAi- remote provider consent for this requestdriverVariableName- Java driver variable name used in snippets- Returns:
- deterministic diagnosis, action records, code blocks, report paths, and provider metadata
-
analyze
public com.shaft.doctor.model.DoctorAnalysisSummary analyze(List<String> inputPaths, List<String> historicalBundlePaths, List<String> allowedRoots, String outputDirectory, boolean includeScreenshots, boolean includePageSnapshots, int minimumAllureResults) Analyzes explicitly allowed local evidence and optionally appends a configured provider advisory.- Parameters:
inputPaths- explicit evidence files or directorieshistoricalBundlePaths- optional older Doctor bundle filesallowedRoots- roots that all readable inputs must remain withinoutputDirectory- report destination inside an allowed rootincludeScreenshots- explicit screenshot retention approvalincludePageSnapshots- explicit page-source or snapshot retention approvalminimumAllureResults- minimum valid Allure result count expected- Returns:
- deterministic diagnosis and local report paths
-
proposeFix
public com.shaft.doctor.repair.DoctorRepairProposalResult proposeFix(String repositoryRoot, String baseSha, String diagnosisPath, String evidenceBundlePath, String issueReference, List<String> allowedPaths, List<com.shaft.doctor.repair.DoctorRepairRequest.FilePatch> patches, List<List<String>> validationCommands, boolean networkValidationApproved, String outputDirectory, boolean useAi) Creates a repair proposal in an isolated worktree without writing to GitHub.- Parameters:
repositoryRoot- approved Git repository rootbaseSha- exact approved base commitdiagnosisPath- Doctor diagnosis or combined report JSONevidenceBundlePath- optional evidence bundleissueReference- linked issue or sessionallowedPaths- approved repository-relative repair scopepatches- reviewed structured patchesvalidationCommands- tokenized Maven validation commandsnetworkValidationApproved- whether Maven validation may use the networkoutputDirectory- proposal manifest directoryuseAi- whether to request an optional provider-generated patch instead- Returns:
- complete proposal and optional provider status
-
proposeHealedLocator
@Tool(name="doctor_propose_healed_locator", description="maps a verified SHAFT Heal report to one reviewable locator patch without editing source or publishing") public com.shaft.doctor.repair.HealingLocatorProposal proposeHealedLocator(String repositoryRoot, String healingReportPath, String sourcePath, boolean sourcePatchConsent, String outputDirectory) Creates a proposal-only locator patch from a verified SHAFT Heal report.- Parameters:
repositoryRoot- approved Git repository roothealingReportPath- verified SHAFT Heal report JSONsourcePath- repository-relative Java source filesourcePatchConsent- explicit proposal consentoutputDirectory- proposal artifact directory- Returns:
- reviewable locator proposal and structured Doctor patch
-
publishDraftPr
public com.shaft.doctor.repair.RepairPublicationResult publishDraftPr(String manifestPath, boolean approved, String approvalToken, boolean overrideFailedValidation, String overrideRationale, String title) Publishes an approved proposal as a draft pull request only.- Parameters:
manifestPath- persisted proposal manifestapproved- explicit publication approvalapprovalToken- exact proposal tokenoverrideFailedValidation- explicit failed-validation overrideoverrideRationale- required override rationaletitle- optional draft pull-request title- Returns:
- draft publication details
-