1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Plan parsing and execution (transaction) for the library API.
use Path;
use cratePathGuard;
use PlanReport; // reexport alias from tx
/// Expand `plan.for_each` globs (requires the `files` feature; #2169).
pub use crateexpand_for_each;
/// Iterate plan `format` then `validate` command strings (#2168).
pub use cratelifecycle_cmds;
/// Refuse format/validate cmds that need a shell for redirects or pipes (#2168).
pub use craterefuse_lifecycle_shell_metas;
/// Parse a transaction plan from a JSON string.
/// Execute a transaction plan atomically.
///
/// All operations succeed or all are rolled back. Returns the exit code
/// (For library users this returns `PlanReport` directly; CLI/MCP retain
/// the (code, JSON) form for compatibility.)
///
/// See `PlanReport` fields and embedding docs for typed usage:
///
/// ```ignore
/// let report: PlanReport = execute_plan(plan, cwd, guard)?;
/// assert!(report.ok);
/// // report.changes, report.searches etc are typed
/// ```
///
/// The optional `guard` is threaded through to all operations for
/// PathGuard enforcement (see module docs for PathGuard usage). Pass
/// `None` for no additional containment checks (current default behavior
/// for most callers).
///
/// Available with the `files` feature (for pure library use without the
/// CLI) or the `cli` feature.
///
/// `for_each` expands under `files` before PathGuard (#2169). When `guard` is
/// `Some`, format/validate commands that contain shell metas are refused as
/// `GuardRejected` before commit (#2168). MCP still strips those steps.