switchyard/types/
plan.rs

1use super::safepath::SafePath;
2
3/// Mode for executing an apply plan.
4///
5/// - `DryRun`: perform analysis and emit facts with redaction; do not mutate.
6/// - `Commit`: perform mutations, emit full facts, and run optional smoke checks.
7#[derive(Debug, Copy, Clone, Default)]
8pub enum ApplyMode {
9    #[default]
10    DryRun,
11    Commit,
12}
13
14/// Request to ensure a symlink from `source` to `target`.
15#[derive(Clone, Debug)]
16pub struct LinkRequest {
17    pub source: SafePath,
18    pub target: SafePath,
19}
20
21/// Request to restore a target from previously captured backups.
22#[derive(Clone, Debug)]
23pub struct RestoreRequest {
24    pub target: SafePath,
25}
26
27/// Input for planning. Combine link and restore requests into a plan.
28#[derive(Clone, Debug, Default)]
29pub struct PlanInput {
30    pub link: Vec<LinkRequest>,
31    pub restore: Vec<RestoreRequest>,
32}
33
34/// Concrete actions the engine can execute.
35#[derive(Clone, Debug, PartialEq)]
36pub enum Action {
37    EnsureSymlink { source: SafePath, target: SafePath },
38    RestoreFromBackup { target: SafePath },
39}
40
41/// Planned sequence of actions with stable ordering.
42#[derive(Clone, Debug, Default)]
43pub struct Plan {
44    pub actions: Vec<Action>,
45}