Skip to main content

ralph/commands/context/
types.rs

1//! Shared types for AGENTS.md context commands.
2//!
3//! Responsibilities:
4//! - Define public option and report structs used by the CLI surface.
5//! - Define detected project type and file initialization state enums.
6//!
7//! Not handled here:
8//! - Command execution logic.
9//! - Template rendering or markdown parsing.
10
11use crate::cli::context::ProjectTypeHint;
12
13/// Detected project type
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15pub enum DetectedProjectType {
16    Rust,
17    Python,
18    TypeScript,
19    Go,
20    Generic,
21}
22
23impl std::fmt::Display for DetectedProjectType {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            DetectedProjectType::Rust => write!(f, "rust"),
27            DetectedProjectType::Python => write!(f, "python"),
28            DetectedProjectType::TypeScript => write!(f, "typescript"),
29            DetectedProjectType::Go => write!(f, "go"),
30            DetectedProjectType::Generic => write!(f, "generic"),
31        }
32    }
33}
34
35/// Status of file initialization
36#[derive(Debug, Clone, Copy, PartialEq, Eq)]
37pub enum FileInitStatus {
38    Created,
39    Valid,
40}
41
42/// Options for context init command
43pub struct ContextInitOptions {
44    pub force: bool,
45    pub project_type_hint: Option<ProjectTypeHint>,
46    pub output_path: std::path::PathBuf,
47    pub interactive: bool,
48}
49
50/// Options for context update command
51pub struct ContextUpdateOptions {
52    pub sections: Vec<String>,
53    pub file: Option<std::path::PathBuf>,
54    pub interactive: bool,
55    pub dry_run: bool,
56    pub output_path: std::path::PathBuf,
57}
58
59/// Options for context validate command
60pub struct ContextValidateOptions {
61    pub strict: bool,
62    pub path: std::path::PathBuf,
63}
64
65/// Report from init command
66pub struct InitReport {
67    pub status: FileInitStatus,
68    pub detected_project_type: DetectedProjectType,
69    pub output_path: std::path::PathBuf,
70}
71
72/// Report from update command
73pub struct UpdateReport {
74    pub sections_updated: Vec<String>,
75    pub dry_run: bool,
76}
77
78/// Report from validate command
79pub struct ValidateReport {
80    pub valid: bool,
81    pub missing_sections: Vec<String>,
82    pub outdated_sections: Vec<String>,
83}