1use colored::Colorize;
12
13pub const COMMAND_COUNT: usize = 27;
17
18pub const WORKSPACE_CRATE_COUNT: usize = 10;
20
21pub const API_SERVICE_COUNT: usize = 8; #[allow(dead_code)]
30pub const HELP_BRAND: &str = concat!(
31 "\x1b[1;33mraps\x1b[0m v",
32 env!("CARGO_PKG_VERSION"),
33 " \x1b[32m·\x1b[0m Rust Autodesk Platform Services CLI"
34);
35
36pub fn print_version() {
43 let version = env!("CARGO_PKG_VERSION");
44 let mcp_tool_count = crate::mcp::tools::TOOLS.len();
45
46 println!();
48 println!(" {}", "▄▄▀█▄▄ ▄▄▀█▄".yellow().bold());
49 println!(" {}", "█▄ █▄█ ▀█".yellow().bold());
50 println!(" {}", " ▀█▄▄▀▀▄▄▄▄▄▀".yellow().bold());
51 println!(" {}", "▄▄█▀▀ ▄█▄ ▀▀█".yellow().bold());
52 println!(" {}", "█ ▄█▀ ▀▄▄▄█".yellow().bold());
53 println!(" {}", "▀▀▀▀▀ ▀▀".yellow().bold());
54
55 println!(" {}", "▄▄▄ ▄▄▄ ▄▄▄▄ ▄▄▄▄".yellow().bold());
57 println!(" {}", "█▄▄▀ █▄▄█ █▄▄█ █▄▄▄".yellow().bold());
58 println!(" {}", "█ █ █ █ █ ▄▄▄█".yellow().bold());
59
60 println!(" {}", "═══════════════════════════════════".green());
62
63 println!(" {}", "Rust Autodesk Platform Services".bright_yellow());
65
66 println!(
68 " {}",
69 "───────────────────────────────────".green().dimmed()
70 );
71
72 credit_line("version", version);
74 credit_line("author", "dmytro yemelianov");
75 credit_line("license", "Apache-2.0");
76 credit_line("edition", "Rust 2024");
77
78 println!(
80 " {}",
81 "───────────────────────────────────".green().dimmed()
82 );
83
84 credit_line("commands", &COMMAND_COUNT.to_string());
86 credit_line("mcp tools", &mcp_tool_count.to_string());
87 credit_line("workspace", &format!("{WORKSPACE_CRATE_COUNT} crates"));
88 credit_line("apis", &format!("{API_SERVICE_COUNT} services"));
89
90 println!(
92 " {}",
93 "───────────────────────────────────".green().dimmed()
94 );
95
96 credit_line("web", "rapscli.xyz");
98 credit_line("docs", "rapscli.xyz/docs");
99
100 println!(" {}", "═══════════════════════════════════".green());
102 println!();
103}
104
105fn credit_line(label: &str, value: &str) {
110 let dot_count = 20usize.saturating_sub(label.len() + 1);
111 let dots = "·".repeat(dot_count);
112 println!(
113 " {} {} {}",
114 label.dimmed(),
115 dots.green().dimmed(),
116 value.yellow().bold()
117 );
118}
119
120pub fn shell_welcome() {
126 let version = env!("CARGO_PKG_VERSION");
127 let mcp_tool_count = crate::mcp::tools::TOOLS.len();
128 let sep = " · ".green().dimmed();
129
130 println!(
131 "{}{}{}{}{}{}{}",
132 "raps".yellow().bold(),
133 format_args!(" v{version}").to_string().bright_yellow(),
134 sep,
135 format_args!("{COMMAND_COUNT} commands")
136 .to_string()
137 .bright_yellow(),
138 sep,
139 format_args!("{mcp_tool_count} MCP tools")
140 .to_string()
141 .bright_yellow(),
142 format_args!("{sep}rapscli.xyz"),
143 );
144}
145
146#[cfg(test)]
149mod tests {
150 use super::*;
151
152 #[test]
155 fn test_command_count() {
156 assert_eq!(
159 COMMAND_COUNT, 27,
160 "COMMAND_COUNT drifted — update credits.rs"
161 );
162 }
163
164 #[test]
165 fn test_help_brand_contains_version() {
166 let version = env!("CARGO_PKG_VERSION");
167 assert!(
168 HELP_BRAND.contains(version),
169 "HELP_BRAND should contain the package version"
170 );
171 assert!(HELP_BRAND.contains("raps"));
172 }
173
174 #[test]
175 fn test_version_not_empty() {
176 let version = env!("CARGO_PKG_VERSION");
177 assert!(!version.is_empty());
178 }
179
180 #[test]
181 fn test_mcp_tool_count_reasonable() {
182 let count = crate::mcp::tools::TOOLS.len();
183 assert!(count >= 70, "Expected at least 70 MCP tools, got {count}");
184 }
185}