Skip to main content

Module effectful

Module effectful 

Source
Expand description

Effectful app operations that use AppEffect handlers.

This module provides functions that execute CLI operations via an AppEffectHandler, enabling testing without real side effects.

§Architecture

Each function in this module:

  1. Takes an AppEffectHandler reference
  2. Executes effects through the handler
  3. Returns strongly-typed results

In production, use [RealAppEffectHandler] for actual I/O. In tests, use [MockAppEffectHandler] to verify behavior without side effects.

§Example

use ralph_workflow::app::effectful::handle_reset_start_commit;
use ralph_workflow::app::mock_effect_handler::MockAppEffectHandler;

// Test without real git or filesystem
let mut handler = MockAppEffectHandler::new()
    .with_head_oid("abc123");

let result = handle_reset_start_commit(&mut handler, None);
assert!(result.is_ok());

Functions§

check_prompt_exists_effectful
Check if PROMPT.md exists using effects.
ensure_files_effectful
Ensure required files and directories exist using effects.
get_head_oid
Get the current HEAD OID using effects.
get_repo_root
Get the repository root path using effects.
handle_reset_start_commit
Handle the --reset-start-commit command using effects.
is_on_main_branch
Check if the current branch is main/master using effects.
require_repo
Validate that we’re in a git repository using effects.
reset_context_for_isolation_effectful
Reset context for isolation mode by deleting STATUS.md, NOTES.md, ISSUES.md.
save_start_commit
Save the starting commit at pipeline start using effects.