claude_wrapper/command/
ultrareview.rs1#[cfg(feature = "async")]
4use crate::Claude;
5use crate::command::ClaudeCommand;
6#[cfg(feature = "async")]
7use crate::error::Result;
8#[cfg(feature = "async")]
9use crate::exec;
10use crate::exec::CommandOutput;
11
12#[derive(Debug, Clone, Default)]
42pub struct UltrareviewCommand {
43 target: Option<String>,
44 json: bool,
45 timeout_minutes: Option<u32>,
46}
47
48impl UltrareviewCommand {
49 #[must_use]
51 pub fn new() -> Self {
52 Self::default()
53 }
54
55 #[must_use]
58 pub fn target(mut self, target: impl Into<String>) -> Self {
59 self.target = Some(target.into());
60 self
61 }
62
63 #[must_use]
66 pub fn json(mut self) -> Self {
67 self.json = true;
68 self
69 }
70
71 #[must_use]
74 pub fn timeout(mut self, minutes: u32) -> Self {
75 self.timeout_minutes = Some(minutes);
76 self
77 }
78}
79
80impl ClaudeCommand for UltrareviewCommand {
81 type Output = CommandOutput;
82
83 fn args(&self) -> Vec<String> {
84 let mut args = vec!["ultrareview".to_string()];
85 if self.json {
86 args.push("--json".to_string());
87 }
88 if let Some(minutes) = self.timeout_minutes {
89 args.push("--timeout".to_string());
90 args.push(minutes.to_string());
91 }
92 if let Some(ref target) = self.target {
93 args.push(target.clone());
94 }
95 args
96 }
97
98 #[cfg(feature = "async")]
99 async fn execute(&self, claude: &Claude) -> Result<CommandOutput> {
100 exec::run_claude(claude, self.args()).await
101 }
102}
103
104#[cfg(test)]
105mod tests {
106 use super::*;
107
108 #[test]
109 fn ultrareview_defaults() {
110 assert_eq!(
111 ClaudeCommand::args(&UltrareviewCommand::new()),
112 vec!["ultrareview"]
113 );
114 }
115
116 #[test]
117 fn ultrareview_with_target_json_timeout() {
118 let cmd = UltrareviewCommand::new().target("123").json().timeout(45);
119 assert_eq!(
120 ClaudeCommand::args(&cmd),
121 vec!["ultrareview", "--json", "--timeout", "45", "123"]
122 );
123 }
124
125 #[test]
126 fn ultrareview_target_only() {
127 let cmd = UltrareviewCommand::new().target("main");
128 assert_eq!(ClaudeCommand::args(&cmd), vec!["ultrareview", "main"]);
129 }
130
131 #[test]
132 fn ultrareview_json_only() {
133 let cmd = UltrareviewCommand::new().json();
134 assert_eq!(ClaudeCommand::args(&cmd), vec!["ultrareview", "--json"]);
135 }
136}