Overview

Date: 2026-05-11

Time: 15:47

Overview

This is a Phase 4 example script demonstrating FTL2's check mode (dry run) capability. It shows how to run automation operations without making actual changes, allowing users to preview what would happen before committing. Check mode is a core safety feature for validating automation scripts before execution.

Usage Patterns

Basic check mode — pass check_mode=True to the automation() context manager:


async with automation(check_mode=True) as ftl:
    result = await ftl.file(path="/tmp/test.txt", state="touch")
    # File is NOT actually created

Check mode with verbose output — combine both flags for detailed dry-run feedback:


async with automation(check_mode=True, verbose=True) as ftl:
    await ftl.file(path="/tmp/test.txt", state="touch")
    await ftl.command(cmd="echo 'Hello'")

Validation-then-execute workflow — run check mode first, then execute if no failures:


# Phase 1: Validate
async with automation(check_mode=True) as ftl:
    for module_name, params in operations:
        module_func = getattr(ftl, module_name)
        await module_func(**params)
    failures = [r for r in ftl.results if not r.success]
    if failures:
        return  # abort

# Phase 2: Execute
async with automation(check_mode=False) as ftl:
    for module_name, params in operations:
        module_func = getattr(ftl, module_name)
        await module_func(**params)

Direct context creation — use AutomationContext directly with check mode:


context = AutomationContext(check_mode=True, verbose=True, modules=["file", "command"])
async with context as ftl:
    await ftl.file(path="/tmp/test.txt", state="touch")

API and Configuration

| Parameter | Type | Description |

|-----------|------|-------------|

| check_mode | bool | Enable dry-run mode — operations report what would change without executing |

| verbose | bool | Show detailed output including [CHECK MODE] indicators |

| secrets | list[str] | Environment variable names to load as secrets (works in check mode) |

| modules | list[str] | Restrict available modules (on AutomationContext) |

Result object properties in check mode:

Key Behaviors

Relationships