Skip to main content
ubx fix runs ubx validate, sends errors and source code to Claude, and proposes fixes as a unified diff with a confirmation prompt.
Requires UBX_AI_API_KEY or ai.api_key in ubx.yaml.

Usage

ubx fix [path] [flags]

Examples

ubx fix                  # fix all errors in current directory
ubx fix main.iac         # fix specific file
ubx fix --dry-run        # show proposed diff without writing
ubx fix --yes            # apply fixes without confirmation

Flags

FlagDescription
--dry-runShow proposed diff without writing any files
--yesApply all fixes without confirmation prompt

Output

/path/to/main.iac
────────────────────────────────────────────────────────────
  1. Removed invalid 'ephemeral' attribute from unit block

--- a/main.iac
+++ b/main.iac
@@ -2,5 +2,4 @@
 unit "aws_s3_bucket_v2" "assets" {
-  ephemeral = true
   bucket    = "my-assets"
 }

Apply fixes to 1 file(s)? [y/N]

Behaviour

  • If no errors → exits 0 with ”✓ no errors found”
  • If errors → sends source + errors to Claude, shows diff, prompts
  • --dry-run shows diff but never writes
  • --yes applies without prompting (CI/CD)

Setup

export UBX_AI_API_KEY=sk-ant-...
ubx fix