ralph/commands/watch/types.rs
1//! Types for the watch command.
2//!
3//! Responsibilities:
4//! - Define `CommentType` enum for TODO/FIXME/HACK/XXX comment detection.
5//! - Define `DetectedComment` struct for representing found comments.
6//! - Define `WatchOptions` struct for watch command configuration.
7//!
8//! Not handled here:
9//! - File watching logic (see `event_loop.rs`).
10//! - Comment detection regex building (see `comments.rs`).
11//! - Task creation from comments (see `tasks.rs`).
12//!
13//! Invariants/assumptions:
14//! - `CommentType::All` is a wildcard that matches all comment types.
15//! - `WatchOptions` is constructed by CLI parsing and passed to `run_watch`.
16
17use std::path::PathBuf;
18
19/// Types of comments to detect in watched files.
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum CommentType {
22 Todo,
23 Fixme,
24 Hack,
25 Xxx,
26 All,
27}
28
29/// A detected comment in a source file.
30#[derive(Debug, Clone)]
31pub struct DetectedComment {
32 pub file_path: PathBuf,
33 pub line_number: usize,
34 pub comment_type: CommentType,
35 pub content: String,
36 pub context: String,
37}
38
39/// Options for the watch command.
40#[derive(Debug, Clone)]
41pub struct WatchOptions {
42 pub patterns: Vec<String>,
43 pub debounce_ms: u64,
44 pub auto_queue: bool,
45 pub notify: bool,
46 pub ignore_patterns: Vec<String>,
47 pub comment_types: Vec<CommentType>,
48 pub paths: Vec<PathBuf>,
49 pub force: bool,
50 pub close_removed: bool,
51}