Skip to main content

execute_apply

Function execute_apply 

Source
pub async fn execute_apply(
    args: &ApplyArgs,
    config_service: &dyn ConfigService,
) -> Result<()>
Expand description

Handle the cache apply subcommand.

Loads the cached dry-run results and replays the file operations without calling the AI provider. Validates the file snapshot and target paths before proceeding, prompts for confirmation unless --yes is supplied, and aborts on non-TTY stdin without --yes.

§JSON output

In JSON mode (--output json):

  • All informational println! chatter on stdout is suppressed so the final envelope is the only document on the stream.
  • The interactive confirmation prompt is skipped: callers SHALL pass --yes, otherwise an error envelope is emitted (prompting on stdout would corrupt the JSON document).
  • Each cache operation is applied individually so the per-file isolation contract from the machine-readable-output spec can be honored: failures are recorded as items[i].status = "error" with an CacheItemError populated from SubXError::category/SubXError::machine_code/SubXError::user_friendly_message.

§Arguments

  • args - Parsed cache apply arguments controlling validation bypass, confirmation, and confidence filtering.
  • config_service - Active configuration service for rebuilding the MatchConfig needed by the engine replay path.