SC4SAP Doctor
Diagnoses the full SC4SAP stack: plugin installation, MCP server status, and live SAP system connectivity. Reports findings with actionable fixes for each issue found.
--prune— after running the normal diagnostic report, invokenode "<plugin>/scripts/prune-cache.mjs"(dry-run) and render its output directly. No files are deleted.--prune --yes— after the normal report, invoke the script with--yesto actually delete every stale version directory.
Always show the ACTIVE version first and explicitly exclude it from deletion. If no stale versions exist, print "Cache is clean — nothing to prune." and return. If the script exits non-zero, surface the stderr verbatim in the doctor report and do NOT swallow the failure.
Issues Found: 0 errors, 2 warnings
Fix: Activate ZCL_S4SAP_CM_ALV, or re-run /sc4sap:setup wizard step 9b /sc4sap:sap-doctor --prune --yes (reclaim 1.7 GB)
Second example — connectivity failure gating Layer 4:
SC4SAP Doctor Report
Plugin Health [PASS] v0.2.2 MCP Server [FAIL] plugin:sc4sap:sap not responding SAP Connection [SKIP] Cannot test without MCP server Required Objects [SKIP] SAP connection not ready Configuration [WARN] No active profile (.sc4sap/active-profile.txt missing) Cache Hygiene [PASS] 0 stale versions
Issues Found: 1 error, 1 warning
Fix: Run /sc4sap:mcp-setup to install and register plugin:sc4sap:sap
</Output_Format>
<Remediation_Routing>
- Plugin version drift (cache ≠ marketplace) -> run `/reload-plugins`, then restart Claude Code
- MCP server missing -> `/sc4sap:mcp-setup`
- SAP connection error -> display connection troubleshooting from `/sc4sap:mcp-setup` Troubleshooting section
- Missing ZMCP_ADT_UTILS / ZMCP_ADT_DISPATCH / ZMCP_ADT_TEXTPOOL -> re-run `/sc4sap:setup` (wizard step 9a)
- Missing ZIF_S4SAP_CM / ZCX_S4SAP_EXCP / ZCL_S4SAP_CM_* -> re-run `/sc4sap:setup` (wizard step 9b)
- Any 9a/9b object inactive -> activate via ADT, or re-run the matching wizard step to reinstall source and activate
- Missing config -> run `/sc4sap:setup` wizard
- Authorization errors -> display required authorization objects (S_DEVELOP, S_TRANSPRT)
- Stale cache ≥ 500 MB -> `/sc4sap:sap-doctor --prune` to preview, then `/sc4sap:sap-doctor --prune --yes` to delete
- All pass -> "SC4SAP is healthy. System: {SID} Client: {client} User: {user}"
</Remediation_Routing>
Task: {{ARGUMENTS}}