Autofix Quick Reference
Quick reference card for using MAKI’s automatic fixes.
Common Commands
Section titled “Common Commands”# Apply safe fixes only (recommended)maki lint --fix input/fsh/
# Apply all fixes (safe + unsafe)maki lint --fix --unsafe input/fsh/
# Preview without modifying filesmaki lint --fix --dry-run input/fsh/
# Interactive mode - review each unsafe fixmaki lint --fix --interactive input/fsh/maki lint --fix -i input/fsh/ # short form
# Apply fixes and write (alias)maki lint -w input/fsh/Command Flags
Section titled “Command Flags”| Flag | Short | Description |
|---|---|---|
--fix | -w, --write | Apply safe fixes only |
--unsafe | - | Also apply unsafe fixes |
--dry-run | - | Preview without modifying |
--interactive | -i | Prompt for unsafe fixes |
Safety Levels
Section titled “Safety Levels”Safe Fixes (--fix)
Section titled “Safe Fixes (--fix)”✅ No semantic changes - safe to apply automatically
- Add missing
Id,Title,Description - Remove unused aliases
- Fix whitespace and formatting
- Correct syntax errors
Unsafe Fixes (--fix --unsafe)
Section titled “Unsafe Fixes (--fix --unsafe)”⚠️ Semantic changes - review carefully
- Change naming conventions
- Add FHIR constraints
- Modify cardinality
- Add binding strength
- Add extension contexts
Interactive Prompt
Section titled “Interactive Prompt”When using --interactive, you’ll see:
🔧 Unsafe autofix suggested────────────────────────────────────────────────────────────────────────────Rule: style/naming-conventionLocation: profiles/Patient.fsh:5:1Safety: unsafe (semantic changes, requires review)
Description: Convert Profile name to PascalCase
Changes:- 5 │ Profile: bad_name+ 5 │ Profile: BadName
────────────────────────────────────────────────────────────────────────────Apply this fix? [y/N/q]Options:
y- Apply this fixN- Skip (default)q- Quit
Workflow Recommendations
Section titled “Workflow Recommendations”1. Safe Fixes First
Section titled “1. Safe Fixes First”# Start with safe-only fixesmaki lint --fix input/fsh/2. Review Unsafe Interactively
Section titled “2. Review Unsafe Interactively”# Review each unsafe fixmaki lint --fix --unsafe -i input/fsh/3. Preview Before Applying
Section titled “3. Preview Before Applying”# Check what would changemaki lint --fix --unsafe --dry-run input/fsh/4. With Version Control
Section titled “4. With Version Control”# Commit before autofixinggit add . && git commit -m "Before autofixes"
# Apply fixesmaki lint --fix input/fsh/
# Review and commitgit diffgit add . && git commit -m "Apply safe autofixes"Configuration
Section titled “Configuration”.makirc.json or .makirc.toml:
{ "autofix": { "default_safety": "safe", "interactive": false, "create_backups": true, "backup_extension": ".bak", "max_fixes_per_file": 100 }}Available Autofixes by Category
Section titled “Available Autofixes by Category”Metadata (Safe)
Section titled “Metadata (Safe)”required-id- Add missingIdrequired-title- Add missingTitlerequired-description- Add missingDescriptioncode-system-content-required- Add^contentvalue-set-compose-required- Add^compose
Metadata (Unsafe)
Section titled “Metadata (Unsafe)”extension-context-required- Add^context
Naming (Unsafe)
Section titled “Naming (Unsafe)”profile-naming- Convert to PascalCaseextension-naming- Convert to PascalCasevalue-set-naming- Convert to kebab-casecode-system-naming- Convert to kebab-case
Cardinality (Safe)
Section titled “Cardinality (Safe)”cardinality-min-max-swapped- Swap min/max
Binding (Unsafe)
Section titled “Binding (Unsafe)”binding-strength-required- Add binding strength
Duplicates (Safe)
Section titled “Duplicates (Safe)”redundant-alias- Remove unused aliases
Troubleshooting
Section titled “Troubleshooting”Fixes not applied?
- Check you’re using
--fixflag - Unsafe fixes need
--unsafeflag - Review rule configuration
Syntax errors after fix?
- File a bug report with the FSH file
- Include command and error message
Too many changes?
- Use
--max-fixes-per-filelimit - Apply fixes in multiple passes
- Use
--dry-runto preview
See Also
Section titled “See Also”- Automatic Fixes Guide - Comprehensive documentation
- CLI Commands - All command options
- Configuration - Config file format