Skip to main content

ralph/commands/init/
types.rs

1//! Initialization workflow types.
2//!
3//! Purpose:
4//! - Centralize public option and report types for `crate::commands::init`.
5//!
6//! Responsibilities:
7//! - Define initialization options accepted by the workflow.
8//! - Describe per-file initialization outcomes.
9//! - Capture the final report returned by `run_init`.
10//!
11//! Scope:
12//! - Shared data types only; orchestration lives in `workflow.rs`.
13//!
14//! Usage:
15//! - Imported by CLI handlers, tutorials, tests, and the workflow module.
16//!
17//! Invariants/assumptions:
18//! - Reported file paths reflect the actual paths used for initialization.
19//! - File status values stay aligned with writer behavior.
20
21/// Options for initializing Ralph files.
22pub struct InitOptions {
23    /// Overwrite existing files if they already exist.
24    pub force: bool,
25    /// Force remove stale locks.
26    pub force_lock: bool,
27    /// Run interactive onboarding wizard.
28    pub interactive: bool,
29    /// Update README if it exists (force overwrite with latest template).
30    pub update_readme: bool,
31}
32
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub enum FileInitStatus {
35    Created,
36    Valid,
37    Updated,
38}
39
40#[derive(Debug)]
41pub struct InitReport {
42    pub queue_status: FileInitStatus,
43    pub done_status: FileInitStatus,
44    pub config_status: FileInitStatus,
45    /// (status, version) tuple - version is Some if README was read/created
46    pub readme_status: Option<(FileInitStatus, Option<u32>)>,
47    /// Paths that were actually used for file creation (may differ from resolved paths)
48    pub queue_path: std::path::PathBuf,
49    pub done_path: std::path::PathBuf,
50    pub config_path: std::path::PathBuf,
51}