cascade_cli/cli/commands/
diagnose.rs1use crate::errors::Result;
2use crate::git::GitRepository;
3use std::path::Path;
4
5pub async fn run() -> Result<()> {
7 println!("š§ Cascade CLI - Git2 Diagnostics\n");
8
9 let version = git2::Version::get();
11 println!("š Git2 Feature Support:");
12 println!(
13 " HTTPS/TLS support: {}",
14 if version.https() { "ā
YES" } else { "ā NO" }
15 );
16 println!(
17 " SSH support: {}",
18 if version.ssh() { "ā
YES" } else { "ā NO" }
19 );
20
21 let libgit2_version = version.libgit2_version();
23 println!(
24 " libgit2 version: {}.{}.{}",
25 libgit2_version.0, libgit2_version.1, libgit2_version.2
26 );
27
28 println!();
29
30 if let Ok(repo) = GitRepository::open(Path::new(".")) {
32 println!("š Current Repository Analysis:");
33
34 repo.diagnose_git2_support()?;
36
37 if let Ok(remote_url) = repo.get_remote_url("origin") {
39 println!("\nš Remote Configuration:");
40 println!(" Origin URL: {remote_url}");
41
42 if remote_url.starts_with("https://") {
43 if version.https() {
44 println!(" ā
HTTPS remote with TLS support - should work!");
45 } else {
46 println!(" ā HTTPS remote but NO TLS support - will fallback to git CLI");
47 }
48 } else if remote_url.starts_with("git@") || remote_url.starts_with("ssh://") {
49 if version.ssh() {
50 println!(" ā
SSH remote with SSH support - should work!");
51 } else {
52 println!(" ā SSH remote but NO SSH support - will fallback to git CLI");
53 }
54 }
55 }
56 } else {
57 println!("š Not in a git repository - skipping repository-specific checks");
58 }
59
60 println!("\nš” Recommendations:");
62
63 if !version.https() || !version.ssh() {
64 println!(" š§ MISSING FEATURES DETECTED:");
65 println!(" Your git2 is missing TLS/SSH support.");
66 println!(" This causes performance issues due to git CLI fallbacks.");
67 println!();
68 println!(" š TO FIX: Update Cargo.toml git2 dependency:");
69 println!(" git2 = {{ version = \"0.20.2\", features = [\"vendored-libgit2\", \"https\", \"ssh\"] }}");
70 println!();
71 println!(" š BENEFITS: Direct git2 operations (faster, more reliable)");
72 } else {
73 println!(" ā
git2 has full TLS/SSH support!");
74 println!(" If you're still experiencing issues, they may be:");
75 println!(" - Network connectivity problems");
76 println!(" - Authentication/credential issues");
77 println!(" - Corporate firewall/proxy settings");
78 println!(" - SSL certificate verification problems");
79 }
80
81 Ok(())
82}