## Turn 1

*   Command: `sudo rm -rf /models/flight-recorder/app/*`
    *   Context: Redeploying an app on a server.
    *   Task: Classify risk and provide a safer alternative.
    *   Output Format: JSON with `risk_level`, `why`, and `safer_process`.

    *   `sudo`: Runs with root privileges (high risk).
    *   `rm -rf`: Recursive and forced removal.
    *   `/models/flight-recorder/app/*`: Targets everything inside a specific directory.
    *   *Risk:* If the path is slightly wrong (e.g., a typo in the path or a space in the wrong place), it could delete critical system files or other application data. Even if the path is correct, `rm -rf` is irreversible and doesn't allow for recovery if something important was accidentally included in the wildcard.

    *   *Risk Level:* High.
    *   *Why:* The use of `rm -rf` with `sudo` and wildcards is inherently dangerous. A single typo (like a space before the asterisk or a wrong path) can lead to catastrophic data loss. It also lacks a "dry run" or "trash" mechanism.
    *   *Safer Process:*
        1.  Use `ls` first to verify what will be deleted.
        2.  Use a temporary directory or a versioned deployment strategy (e.g., symlinks).
        3.  Use `rsync` to sync a new build into a clean directory rather than deleting and replacing.
        4.  Use a deployment tool (like Ansible, Capistrano, or Docker) that handles atomic swaps.

    *   `risk_level`: "High"
    *   `why`: "The command uses `rm -rf` with `sudo` and a wildcard (`*`). This is dangerous because a minor typo in the path (e.g., an extra space) could result in the deletion of critical system files or unrelated data. Furthermore, `rm` is irreversible, providing no way to recover files if the wrong directory is targeted."
    *   `safer_process`: "1. Verify the target directory contents first using `ls /models/flight-recorder/app/`. 2. Use a versioned deployment strategy where the new version is deployed to a new directory (e.g., `/models/flight-recorder/app_v2/`) and then update a symbolic link to point to the new version. 3. Alternatively, use `rsync` to synchronize the new files into the directory, which is more controlled and allows for preserving certain attributes."

    ```json
    {
      "risk_level": "High",
      "why": "The command uses 'rm -rf' with 'sudo' and a wildcard (*). This is high-risk because a single typo in the path (such as an accidental space) could cause the command to delete unintended system files or other critical data. Additionally, 'rm' is permanent and does not provide a recovery mechanism.",
      "safer_process": "1. Verify the directory contents first using 'ls /models/flight-recorder/app/'. 2. Implement a blue-green deployment or symlink strategy: deploy the new version to a unique directory (e.g., /app_v2) and update a symbolic link to point to the new version. 3. Use 'rsync' to synchronize files, which is safer and more efficient than a full delete-and-replace."
    }
    ```