Files
archdoc/wtismycode-cli/src/output.rs
Arkasha b3eb591809 feat: smart integration detection with package classifier
- Add PackageClassifier with built-in dictionary (~200 popular packages)
- Hardcode Python 3.10+ stdlib list to filter out standard library imports
- Add PyPI API lookup for unknown packages (online mode, 3s timeout)
- Cache PyPI results in .wtismycode/cache/pypi.json
- Add --offline flag to skip PyPI lookups
- Classify packages into: HTTP, Database, Queue, Storage, AI/ML, Auth, Testing, Logging, Internal, Third-party
- User config integration_patterns override auto-detection
- Update renderer to show integrations grouped by category
- Update ARCHITECTURE.md template with new integration format
2026-02-15 12:45:56 +03:00

33 lines
1.4 KiB
Rust

//! Colored output helpers and filename utilities for WTIsMyCode CLI
use colored::Colorize;
use wtismycode_core::ProjectModel;
/// Sanitize a file path into a safe filename for docs.
/// Removes `./` prefix, replaces `/` with `__`.
pub fn sanitize_filename(filename: &str) -> String {
let cleaned = filename.strip_prefix("./").unwrap_or(filename);
cleaned.replace('/', "__")
}
pub fn print_generate_summary(model: &ProjectModel) {
println!();
println!("{}", "── Summary ──────────────────────────".dimmed());
println!(" {} {}", "Files:".bold(), model.files.len());
println!(" {} {}", "Modules:".bold(), model.modules.len());
println!(" {} {}", "Symbols:".bold(), model.symbols.len());
println!(" {} {}", "Edges:".bold(),
model.edges.module_import_edges.len() + model.edges.symbol_call_edges.len());
if !model.classified_integrations.is_empty() {
let cats: Vec<String> = model.classified_integrations.iter()
.filter(|(_, pkgs)| !pkgs.is_empty())
.map(|(cat, pkgs)| format!("{} ({})", cat, pkgs.join(", ")))
.collect();
if !cats.is_empty() {
println!(" {} {}", "Integrations:".bold(), cats.join(" | ").yellow());
}
}
println!("{}", "─────────────────────────────────────".dimmed());
}