Skip to main content

systemprompt_sync/deploy/
progress.rs

1//! Progress seam between the deploy pipeline and its presentation layer.
2//!
3//! The orchestrator emits a [`DeployEvent`] at every step boundary and asks
4//! the caller to resolve each [`DeployPrompt`]; implementations decide how
5//! (or whether) to render and answer them. Events carry borrowed data, so no
6//! rendering state lives in the pipeline.
7
8use std::path::Path;
9
10use crate::error::SyncResult;
11use crate::files::SyncDiffResult;
12use crate::result::SyncOperationResult;
13
14pub trait DeployProgress: Send + Sync {
15    fn event(&self, event: &DeployEvent<'_>);
16    fn confirm(&self, prompt: &DeployPrompt) -> SyncResult<bool>;
17}
18
19#[derive(Debug, Clone, Copy)]
20pub enum DeployEvent<'a> {
21    PreSyncSkippedByFlag,
22    PreSyncStarted,
23    PreSyncDeclined,
24    SyncDryRunStarted,
25    SyncDryRunFinished(&'a SyncOperationResult),
26    SyncErrors(&'a [String]),
27    SyncDownloadStarted,
28    SyncDownloadFinished,
29    SyncBackupStarted,
30    SyncBackupFinished(&'a Path),
31    SyncDiff(&'a SyncDiffResult),
32    SyncAlreadyClean,
33    SyncCancelled,
34    SyncApplied {
35        count: usize,
36    },
37    ArtifactsResolved {
38        tenant_name: &'a str,
39        binary: &'a Path,
40        dockerfile: &'a Path,
41    },
42    RegistryAuthStarted,
43    RegistryAuthFinished,
44    ImageResolved {
45        image: &'a str,
46    },
47    BuildStarted,
48    BuildFinished,
49    PushSkipped,
50    PushStarted,
51    PushFinished,
52    SecretsPhaseStarted,
53    SecretsFileMissing,
54    SecretsSyncStarted,
55    SecretsSynced {
56        count: usize,
57    },
58    CredentialsSyncStarted,
59    CredentialsSynced {
60        count: usize,
61    },
62    ProfilePathConfigured,
63    DeployStarted,
64    Deployed {
65        status: &'a str,
66        app_url: Option<&'a str>,
67    },
68}
69
70#[derive(Debug, Clone, Copy)]
71pub enum DeployPrompt {
72    PreSync,
73    ApplyChanges { count: usize },
74}