Skip to main content

Overview

The fix-runbook command takes a self-heal diagnostic report and applies AI-generated repair suggestions to your runbook. Each suggestion is presented for review before applying.

Prerequisites

  • A self-heal diagnostic report (generated by --self-heal)
  • The original runbook that was used during self-heal

Workflow

1

Generate a self-heal report

Run the runbook with --self-heal to produce a diagnostic report:
npx @refrainai/cli execute -- \
  --runbook ./login-flow.yaml \
  --context ./context.md \
  --self-heal
The report is saved as {runbook-name}-report.md (e.g., login-flow-report.md).
2

Run fix-runbook

npx @refrainai/cli fix-runbook -- \
  --runbook ./login-flow.yaml \
  --report ./login-flow-report.md
3

Review each suggestion

For each AI suggestion, the command shows:
  • The error and its classification category
  • The proposed fix (selector change, step modification, etc.)
For each suggestion, choose:
  • Apply — Generate a patch and preview the diff
  • Skip — Move to the next suggestion
  • Abort — Stop processing remaining suggestions
4

Verify the fixed runbook

After applying fixes, run a normal execution to verify:
npx @refrainai/cli execute -- \
  --runbook ./login-flow.yaml \
  --context ./context.md \
  --headless false

CLI reference

ArgumentRequiredDescription
--runbook <path>YesPath to the runbook to fix
--report <path>YesPath to the self-heal report
--model <id>NoAI model for patch generation (default: claude-sonnet-4-6)
--model-provider <provider>NoAI provider (default: anthropic)
--locale <code>NoUI language: en or ja

What’s next