Compare commits

...
Author SHA1 Message Date
Patrick szymkowiak 612e36c222 fix: remove all checkmark emojis from CLI output
Replace ✓ (U+2713) with plain text across 19 files:
- "ok ✓" → "ok" (git add/commit/push/pull)
- "✓ cargo test: ..." → "cargo test: ..." (all tool summaries)
- Preserved ✓ in input detection patterns and test fixtures

LLMs cannot interpret emoji semantics; plain text is clearer.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:15 +01:00
Patrick szymkowiak 33432a6164 fix: remove remaining emojis from gh_cmd.rs and init.rs
Replace production emojis:
- gh_cmd.rs: 🟣→[merged], ⚪→[unknown]/[pending], ⭐→removed, 🔱→removed
- init.rs: ⚪→[--] for "not found" status indicators

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:15 +01:00
Patrick szymkowiak 15b2ff2c10 fix: remove last decorative emoji from next_cmd.rs
Remove ⚡ from Next.js Build header, missed in previous passes.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:15 +01:00
Patrick szymkowiak 30720f2bfd fix: remove all decorative emojis from CLI output (#511)
Replace emojis with plain text tokens across all production files
for better LLM compatibility. Test fixtures and external tool
detection patterns (e.g. Black's "All done!") are preserved.

Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:14 +01:00
Patrick szymkowiak 1a773fbc24 fix: remove remaining decorative emojis from find_cmd and formatter
Missed in initial emoji cleanup pass: 📁 in find_cmd.rs and parser/formatter.rs

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:14 +01:00
Patrick szymkowiak b5dbd1094b fix: remove decorative emojis from CLI output (#511)
Replace decorative emojis with plain text to reduce token waste.
Keep functional symbols (⚠️ ✓ ❌ ✅ ℹ️) that convey meaning in fewer tokens.

Signed-off-by: Patrick Szymkowiak <patrick@rtk.ai>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 10:28:14 +01:00
37 changed files with 334 additions and 349 deletions

No files matched your search

+27 -30
View File
@@ -264,7 +264,7 @@ fn filter_cargo_install(output: &str) -> String {
// Already installed / up to date
if already_installed {
let info = ignored_line.split('`').nth(1).unwrap_or(&ignored_line);
return format!("✓ cargo install: {} already installed", info);
return format!("cargo install: {} already installed", info);
}
// Errors
@@ -313,10 +313,7 @@ fn filter_cargo_install(output: &str) -> String {
// Success
let crate_info = format_crate_info(&installed_crate, &installed_version, "package");
let mut result = format!(
"✓ cargo install ({}, {} deps compiled)",
crate_info, compiled
);
let mut result = format!("cargo install ({}, {} deps compiled)", crate_info, compiled);
for line in &replaced_lines {
result.push_str(&format!("\n {}", line));
@@ -502,7 +499,7 @@ fn filter_cargo_nextest(output: &str) -> String {
} else {
format!("{}, {}s", binary_text, duration)
};
return format!("✓ cargo nextest: {} ({})", parts.join(", "), meta);
return format!("cargo nextest: {} ({})", parts.join(", "), meta);
}
// With failures - show failure details then summary
@@ -625,7 +622,7 @@ fn filter_cargo_build(output: &str) -> String {
}
if error_count == 0 && warnings == 0 {
return format!("✓ cargo build ({} crates compiled)", compiled);
return format!("cargo build ({} crates compiled)", compiled);
}
let mut result = String::new();
@@ -739,11 +736,11 @@ impl AggregatedTestResult {
if self.has_duration {
format!(
"✓ cargo test: {} ({}, {:.2}s)",
"cargo test: {} ({}, {:.2}s)",
counts, suite_text, self.duration_secs
)
} else {
format!("✓ cargo test: {} ({})", counts, suite_text)
format!("cargo test: {} ({})", counts, suite_text)
}
}
}
@@ -831,7 +828,7 @@ fn filter_cargo_test(output: &str) -> String {
// Fallback: use original behavior if regex failed
for line in &summary_lines {
result.push_str(&format!("✓ {}\n", line));
result.push_str(&format!("{}\n", line));
}
return result.trim().to_string();
}
@@ -931,7 +928,7 @@ fn filter_cargo_clippy(output: &str) -> String {
}
if error_count == 0 && warning_count == 0 {
return "✓ cargo clippy: No issues found".to_string();
return "cargo clippy: No issues found".to_string();
}
let mut result = String::new();
@@ -1103,7 +1100,7 @@ mod tests {
Finished dev [unoptimized + debuginfo] target(s) in 15.23s
"#;
let result = filter_cargo_build(output);
assert!(result.contains("✓ cargo build"));
assert!(result.contains("cargo build"));
assert!(result.contains("3 crates compiled"));
}
@@ -1139,7 +1136,7 @@ test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
"#;
let result = filter_cargo_test(output);
assert!(
result.contains("✓ cargo test: 15 passed (1 suite, 0.01s)"),
result.contains("cargo test: 15 passed (1 suite, 0.01s)"),
"Expected compact format, got: {}",
result
);
@@ -1196,7 +1193,7 @@ test result: ok. 32 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
"#;
let result = filter_cargo_test(output);
assert!(
result.contains("✓ cargo test: 137 passed (4 suites, 1.45s)"),
result.contains("cargo test: 137 passed (4 suites, 1.45s)"),
"Expected aggregated format, got: {}",
result
);
@@ -1260,7 +1257,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
"#;
let result = filter_cargo_test(output);
assert!(
result.contains("✓ cargo test: 0 passed (3 suites, 0.00s)"),
result.contains("cargo test: 0 passed (3 suites, 0.00s)"),
"Expected compact format for zero tests, got: {}",
result
);
@@ -1280,7 +1277,7 @@ test result: ok. 18 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; fin
"#;
let result = filter_cargo_test(output);
assert!(
result.contains("✓ cargo test: 63 passed, 5 ignored, 2 filtered out (2 suites, 0.70s)"),
result.contains("cargo test: 63 passed, 5 ignored, 2 filtered out (2 suites, 0.70s)"),
"Expected compact format with ignored and filtered, got: {}",
result
);
@@ -1295,7 +1292,7 @@ test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
"#;
let result = filter_cargo_test(output);
assert!(
result.contains("✓ cargo test: 15 passed (1 suite, 0.01s)"),
result.contains("cargo test: 15 passed (1 suite, 0.01s)"),
"Expected singular 'suite', got: {}",
result
);
@@ -1309,9 +1306,9 @@ running 15 tests
test result: MALFORMED LINE WITHOUT PROPER FORMAT
"#;
let result = filter_cargo_test(output);
// Should fallback to original behavior (show line with checkmark)
// Should fallback to original behavior (show line without checkmark)
assert!(
result.contains("✓ test result: MALFORMED"),
result.contains("test result: MALFORMED"),
"Expected fallback format, got: {}",
result
);
@@ -1323,7 +1320,7 @@ test result: MALFORMED LINE WITHOUT PROPER FORMAT
Finished dev [unoptimized + debuginfo] target(s) in 1.53s
"#;
let result = filter_cargo_clippy(output);
assert!(result.contains("✓ cargo clippy: No issues found"));
assert!(result.contains("cargo clippy: No issues found"));
}
#[test]
@@ -1366,7 +1363,7 @@ warning: `rtk` (bin) generated 2 warnings
Replaced package `rtk v0.9.4` with `rtk v0.11.0` (/Users/user/.cargo/bin/rtk)
"#;
let result = filter_cargo_install(output);
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(result.contains("rtk v0.11.0"), "got: {}", result);
assert!(result.contains("5 deps compiled"), "got: {}", result);
assert!(result.contains("Replaced"), "got: {}", result);
@@ -1383,7 +1380,7 @@ warning: `rtk` (bin) generated 2 warnings
Replaced package `rtk v0.9.4` with `rtk v0.11.0` (/Users/user/.cargo/bin/rtk)
"#;
let result = filter_cargo_install(output);
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(result.contains("Replacing"), "got: {}", result);
assert!(result.contains("Replaced"), "got: {}", result);
}
@@ -1428,7 +1425,7 @@ error: aborting due to 1 previous error
#[test]
fn test_filter_cargo_install_empty_output() {
let result = filter_cargo_install("");
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(result.contains("0 deps compiled"), "got: {}", result);
}
@@ -1442,7 +1439,7 @@ error: aborting due to 1 previous error
warning: be sure to add `/Users/user/.cargo/bin` to your PATH
"#;
let result = filter_cargo_install(output);
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(
result.contains("be sure to add"),
"PATH warning should be kept: {}",
@@ -1492,7 +1489,7 @@ error: aborting due to 2 previous errors
Installing rtk v0.11.0
"#;
let result = filter_cargo_install(output);
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(!result.contains("Locking"), "got: {}", result);
assert!(!result.contains("Blocking"), "got: {}", result);
assert!(!result.contains("Downloading"), "got: {}", result);
@@ -1506,7 +1503,7 @@ error: aborting due to 2 previous errors
"#;
let result = filter_cargo_install(output);
// Path-based install: crate info not extracted from path
assert!(result.contains("✓ cargo install"), "got: {}", result);
assert!(result.contains("cargo install"), "got: {}", result);
assert!(result.contains("1 deps compiled"), "got: {}", result);
}
@@ -1532,7 +1529,7 @@ error: aborting due to 2 previous errors
"#;
let result = filter_cargo_nextest(output);
assert_eq!(
result, "✓ cargo nextest: 301 passed (1 binary, 0.192s)",
result, "cargo nextest: 301 passed (1 binary, 0.192s)",
"got: {}",
result
);
@@ -1617,7 +1614,7 @@ error: test run failed
"#;
let result = filter_cargo_nextest(output);
assert_eq!(
result, "✓ cargo nextest: 50 passed, 3 skipped (2 binaries, 0.500s)",
result, "cargo nextest: 50 passed, 3 skipped (2 binaries, 0.500s)",
"got: {}",
result
);
@@ -1668,7 +1665,7 @@ error: test run failed
"#;
let result = filter_cargo_nextest(output);
assert_eq!(
result, "✓ cargo nextest: 100 passed (5 binaries, 1.234s)",
result, "cargo nextest: 100 passed (5 binaries, 1.234s)",
"got: {}",
result
);
@@ -1703,7 +1700,7 @@ error: test run failed
result
);
assert!(
result.contains("✓ cargo nextest: 10 passed"),
result.contains("cargo nextest: 10 passed"),
"got: {}",
result
);
+5 -5
View File
@@ -250,7 +250,7 @@ fn merge_weekly(cc: Option<Vec<CcusagePeriod>>, rtk: Vec<WeekStats>) -> Vec<Peri
let monday_key = match convert_saturday_to_monday(&entry.week_start) {
Some(m) => m,
None => {
eprintln!("⚠️ Invalid week_start format: {}", entry.week_start);
eprintln!("[warn] Invalid week_start format: {}", entry.week_start);
continue;
}
};
@@ -442,7 +442,7 @@ fn display_summary(tracker: &Tracker, verbose: u8) -> Result<()> {
let totals = compute_totals(&periods);
println!("💰 Claude Code Economics");
println!("[cost] Claude Code Economics");
println!("════════════════════════════════════════════════════");
println!();
@@ -550,7 +550,7 @@ fn display_daily(tracker: &Tracker, verbose: u8) -> Result<()> {
.context("Failed to load daily token savings from database")?;
let periods = merge_daily(cc_daily, rtk_daily);
println!("📅 Daily Economics");
println!("Daily Economics");
println!("════════════════════════════════════════════════════");
print_period_table(&periods, verbose);
Ok(())
@@ -564,7 +564,7 @@ fn display_weekly(tracker: &Tracker, verbose: u8) -> Result<()> {
.context("Failed to load weekly token savings from database")?;
let periods = merge_weekly(cc_weekly, rtk_weekly);
println!("📅 Weekly Economics");
println!("Weekly Economics");
println!("════════════════════════════════════════════════════");
print_period_table(&periods, verbose);
Ok(())
@@ -578,7 +578,7 @@ fn display_monthly(tracker: &Tracker, verbose: u8) -> Result<()> {
.context("Failed to load monthly token savings from database")?;
let periods = merge_monthly(cc_monthly, rtk_monthly);
println!("📅 Monthly Economics");
println!("Monthly Economics");
println!("════════════════════════════════════════════════════");
print_period_table(&periods, verbose);
Ok(())
+3 -3
View File
@@ -126,7 +126,7 @@ pub fn fetch(granularity: Granularity) -> Result<Option<Vec<CcusagePeriod>>> {
let mut cmd = match build_command() {
Some(cmd) => cmd,
None => {
eprintln!("⚠️ ccusage not found. Install: npm i -g ccusage (or use npx ccusage)");
eprintln!("[warn] ccusage not found. Install: npm i -g ccusage (or use npx ccusage)");
return Ok(None);
}
};
@@ -146,7 +146,7 @@ pub fn fetch(granularity: Granularity) -> Result<Option<Vec<CcusagePeriod>>> {
let output = match output {
Err(e) => {
eprintln!("⚠️ ccusage execution failed: {}", e);
eprintln!("[warn] ccusage execution failed: {}", e);
return Ok(None);
}
Ok(o) => o,
@@ -155,7 +155,7 @@ pub fn fetch(granularity: Granularity) -> Result<Option<Vec<CcusagePeriod>>> {
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
eprintln!(
"⚠️ ccusage exited with {}: {}",
"[warn] ccusage exited with {}: {}",
output.status,
stderr.trim()
);
+32 -28
View File
@@ -53,14 +53,14 @@ fn docker_ps(_verbose: u8) -> Result<()> {
let mut rtk = String::new();
if stdout.trim().is_empty() {
rtk.push_str("🐳 0 containers");
rtk.push_str("[docker] 0 containers");
println!("{}", rtk);
timer.track("docker ps", "rtk docker ps", &raw, &rtk);
return Ok(());
}
let count = stdout.lines().count();
rtk.push_str(&format!("🐳 {} containers:\n", count));
rtk.push_str(&format!("[docker] {} containers:\n", count));
for line in stdout.lines().take(15) {
let parts: Vec<&str> = line.split('\t').collect();
@@ -119,7 +119,7 @@ fn docker_images(_verbose: u8) -> Result<()> {
let mut rtk = String::new();
if lines.is_empty() {
rtk.push_str("🐳 0 images");
rtk.push_str("[docker] 0 images");
println!("{}", rtk);
timer.track("docker images", "rtk docker images", &raw, &rtk);
return Ok(());
@@ -146,7 +146,11 @@ fn docker_images(_verbose: u8) -> Result<()> {
} else {
format!("{:.0}MB", total_size_mb)
};
rtk.push_str(&format!("🐳 {} images ({})\n", lines.len(), total_display));
rtk.push_str(&format!(
"[docker] {} images ({})\n",
lines.len(),
total_display
));
for line in lines.iter().take(15) {
let parts: Vec<&str> = line.split('\t').collect();
@@ -202,7 +206,7 @@ fn docker_logs(args: &[String], _verbose: u8) -> Result<()> {
}
let analyzed = crate::log_cmd::run_stdin_str(&raw);
let rtk = format!("🐳 Logs for {}:\n{}", container, analyzed);
let rtk = format!("[docker] Logs for {}:\n{}", container, analyzed);
println!("{}", rtk);
timer.track(
&format!("docker logs {}", container),
@@ -238,7 +242,7 @@ fn kubectl_pods(args: &[String], _verbose: u8) -> Result<()> {
let json: serde_json::Value = match serde_json::from_str(&raw) {
Ok(v) => v,
Err(_) => {
rtk.push_str("☸️ No pods found");
rtk.push_str("No pods found");
println!("{}", rtk);
timer.track("kubectl get pods", "rtk kubectl pods", &raw, &rtk);
return Ok(());
@@ -246,7 +250,7 @@ fn kubectl_pods(args: &[String], _verbose: u8) -> Result<()> {
};
let Some(pods) = json["items"].as_array().filter(|a| !a.is_empty()) else {
rtk.push_str("☸️ No pods found");
rtk.push_str("No pods found");
println!("{}", rtk);
timer.track("kubectl get pods", "rtk kubectl pods", &raw, &rtk);
return Ok(());
@@ -292,21 +296,21 @@ fn kubectl_pods(args: &[String], _verbose: u8) -> Result<()> {
let mut parts = Vec::new();
if running > 0 {
parts.push(format!("{} ✓", running));
parts.push(format!("{}", running));
}
if pending > 0 {
parts.push(format!("{} pending", pending));
}
if failed > 0 {
parts.push(format!("{} ✗", failed));
parts.push(format!("{} [x]", failed));
}
if restarts_total > 0 {
parts.push(format!("{} restarts", restarts_total));
}
rtk.push_str(&format!("☸️ {} pods: {}\n", pods.len(), parts.join(", ")));
rtk.push_str(&format!("{} pods: {}\n", pods.len(), parts.join(", ")));
if !issues.is_empty() {
rtk.push_str("⚠️ Issues:\n");
rtk.push_str("[warn] Issues:\n");
for issue in issues.iter().take(10) {
rtk.push_str(&format!(" {}\n", issue));
}
@@ -345,7 +349,7 @@ fn kubectl_services(args: &[String], _verbose: u8) -> Result<()> {
let json: serde_json::Value = match serde_json::from_str(&raw) {
Ok(v) => v,
Err(_) => {
rtk.push_str("☸️ No services found");
rtk.push_str("No services found");
println!("{}", rtk);
timer.track("kubectl get svc", "rtk kubectl svc", &raw, &rtk);
return Ok(());
@@ -353,12 +357,12 @@ fn kubectl_services(args: &[String], _verbose: u8) -> Result<()> {
};
let Some(services) = json["items"].as_array().filter(|a| !a.is_empty()) else {
rtk.push_str("☸️ No services found");
rtk.push_str("No services found");
println!("{}", rtk);
timer.track("kubectl get svc", "rtk kubectl svc", &raw, &rtk);
return Ok(());
};
rtk.push_str(&format!("☸️ {} services:\n", services.len()));
rtk.push_str(&format!("{} services:\n", services.len()));
for svc in services.iter().take(15) {
let ns = svc["metadata"]["namespace"].as_str().unwrap_or("-");
@@ -433,7 +437,7 @@ fn kubectl_logs(args: &[String], _verbose: u8) -> Result<()> {
}
let analyzed = crate::log_cmd::run_stdin_str(&raw);
let rtk = format!("☸️ Logs for {}:\n{}", pod, analyzed);
let rtk = format!("Logs for {}:\n{}", pod, analyzed);
println!("{}", rtk);
timer.track(
&format!("kubectl logs {}", pod),
@@ -451,10 +455,10 @@ pub fn format_compose_ps(raw: &str) -> String {
let lines: Vec<&str> = raw.lines().filter(|l| !l.trim().is_empty()).collect();
if lines.is_empty() {
return "🐳 0 compose services".to_string();
return "[compose] 0 services".to_string();
}
let mut result = format!("🐳 {} compose services:\n", lines.len());
let mut result = format!("[compose] {} services:\n", lines.len());
for line in lines.iter().take(20) {
let parts: Vec<&str> = line.split('\t').collect();
@@ -493,19 +497,19 @@ pub fn format_compose_ps(raw: &str) -> String {
/// Format `docker compose logs` output into compact form
pub fn format_compose_logs(raw: &str) -> String {
if raw.trim().is_empty() {
return "🐳 No logs".to_string();
return "[compose] No logs".to_string();
}
// docker compose logs prefixes each line with "service-N | "
// Use the existing log deduplication engine
let analyzed = crate::log_cmd::run_stdin_str(raw);
format!("🐳 Compose logs:\n{}", analyzed)
format!("[compose] Logs:\n{}", analyzed)
}
/// Format `docker compose build` output into compact summary
pub fn format_compose_build(raw: &str) -> String {
if raw.trim().is_empty() {
return "🐳 Build: no output".to_string();
return "[compose] Build: no output".to_string();
}
let mut result = String::new();
@@ -513,7 +517,7 @@ pub fn format_compose_build(raw: &str) -> String {
// Extract the summary line: "[+] Building 12.3s (8/8) FINISHED"
for line in raw.lines() {
if line.contains("Building") && line.contains("FINISHED") {
result.push_str(&format!("🐳 {}\n", line.trim()));
result.push_str(&format!("[compose] {}\n", line.trim()));
break;
}
}
@@ -521,9 +525,9 @@ pub fn format_compose_build(raw: &str) -> String {
if result.is_empty() {
// No FINISHED line found — might still be building or errored
if let Some(line) = raw.lines().find(|l| l.contains("Building")) {
result.push_str(&format!("🐳 {}\n", line.trim()));
result.push_str(&format!("[compose] {}\n", line.trim()));
} else {
result.push_str("🐳 Build:\n");
result.push_str("[compose] Build:\n");
}
}
@@ -822,8 +826,11 @@ mod tests {
let raw = "redis-1\tredis:7\tUp 5 hours\t";
let out = format_compose_ps(raw);
assert!(out.contains("redis"), "should show service name");
// Should not show port info when no ports (but [compose] prefix is OK)
let lines: Vec<&str> = out.lines().collect();
let redis_line = lines.iter().find(|l| l.contains("redis")).unwrap();
assert!(
!out.contains("["),
!redis_line.contains("] ["),
"should not show port brackets when empty"
);
}
@@ -852,10 +859,7 @@ web-1 | 192.168.1.1 - GET /favicon.ico 404
api-1 | Server listening on port 3000
api-1 | Connected to database";
let out = format_compose_logs(raw);
assert!(
out.contains("Compose logs"),
"should have compose logs header"
);
assert!(out.contains("Logs"), "should have compose logs header");
}
#[test]
+5 -5
View File
@@ -26,7 +26,7 @@ pub fn run(path: &Path, verbose: u8) -> Result<()> {
if cargo_path.exists() {
found = true;
raw.push_str(&fs::read_to_string(&cargo_path).unwrap_or_default());
rtk.push_str("📦 Rust (Cargo.toml):\n");
rtk.push_str("Rust (Cargo.toml):\n");
rtk.push_str(&summarize_cargo_str(&cargo_path)?);
}
@@ -34,7 +34,7 @@ pub fn run(path: &Path, verbose: u8) -> Result<()> {
if package_path.exists() {
found = true;
raw.push_str(&fs::read_to_string(&package_path).unwrap_or_default());
rtk.push_str("📦 Node.js (package.json):\n");
rtk.push_str("Node.js (package.json):\n");
rtk.push_str(&summarize_package_json_str(&package_path)?);
}
@@ -42,7 +42,7 @@ pub fn run(path: &Path, verbose: u8) -> Result<()> {
if requirements_path.exists() {
found = true;
raw.push_str(&fs::read_to_string(&requirements_path).unwrap_or_default());
rtk.push_str("📦 Python (requirements.txt):\n");
rtk.push_str("Python (requirements.txt):\n");
rtk.push_str(&summarize_requirements_str(&requirements_path)?);
}
@@ -50,7 +50,7 @@ pub fn run(path: &Path, verbose: u8) -> Result<()> {
if pyproject_path.exists() {
found = true;
raw.push_str(&fs::read_to_string(&pyproject_path).unwrap_or_default());
rtk.push_str("📦 Python (pyproject.toml):\n");
rtk.push_str("Python (pyproject.toml):\n");
rtk.push_str(&summarize_pyproject_str(&pyproject_path)?);
}
@@ -58,7 +58,7 @@ pub fn run(path: &Path, verbose: u8) -> Result<()> {
if gomod_path.exists() {
found = true;
raw.push_str(&fs::read_to_string(&gomod_path).unwrap_or_default());
rtk.push_str("📦 Go (go.mod):\n");
rtk.push_str("Go (go.mod):\n");
rtk.push_str(&summarize_gomod_str(&gomod_path)?);
}
+4 -4
View File
@@ -22,7 +22,7 @@ pub fn run(file1: &Path, file2: &Path, verbose: u8) -> Result<()> {
let mut rtk = String::new();
if diff.added == 0 && diff.removed == 0 {
rtk.push_str("✅ Files are identical");
rtk.push_str("[ok] Files are identical");
println!("{}", rtk);
timer.track(
&format!("diff {} {}", file1.display(), file2.display()),
@@ -33,7 +33,7 @@ pub fn run(file1: &Path, file2: &Path, verbose: u8) -> Result<()> {
return Ok(());
}
rtk.push_str(&format!("📊 {} → {}\n", file1.display(), file2.display()));
rtk.push_str(&format!("{} → {}\n", file1.display(), file2.display()));
rtk.push_str(&format!(
" +{} added, -{} removed, ~{} modified\n\n",
diff.added, diff.removed, diff.modified
@@ -168,7 +168,7 @@ fn condense_unified_diff(diff: &str) -> String {
// File header
if line.starts_with("+++ ") {
if !current_file.is_empty() && (added > 0 || removed > 0) {
result.push(format!("📄 {} (+{} -{})", current_file, added, removed));
result.push(format!("[file] {} (+{} -{})", current_file, added, removed));
for c in changes.iter().take(10) {
result.push(format!(" {}", c));
}
@@ -199,7 +199,7 @@ fn condense_unified_diff(diff: &str) -> String {
// Last file
if !current_file.is_empty() && (added > 0 || removed > 0) {
result.push(format!("📄 {} (+{} -{})", current_file, added, removed));
result.push(format!("[file] {} (+{} -{})", current_file, added, removed));
for c in changes.iter().take(10) {
result.push(format!(" {}", c));
}
+7 -7
View File
@@ -21,7 +21,7 @@ pub fn format_duration(ms: u64) -> String {
/// Trait for period-based statistics that can be displayed in tables
pub trait PeriodStats {
/// Icon for this period type (e.g., "📅", "📊", "📆")
/// Icon for this period type (e.g., "D", "W", "M")
fn icon() -> &'static str;
/// Label for this period type (e.g., "Daily", "Weekly", "Monthly")
@@ -143,7 +143,7 @@ pub fn print_period_table<T: PeriodStats>(data: &[T]) {
impl PeriodStats for DayStats {
fn icon() -> &'static str {
"📅"
"D"
}
fn label() -> &'static str {
@@ -193,7 +193,7 @@ impl PeriodStats for DayStats {
impl PeriodStats for WeekStats {
fn icon() -> &'static str {
"📊"
"W"
}
fn label() -> &'static str {
@@ -253,7 +253,7 @@ impl PeriodStats for WeekStats {
impl PeriodStats for MonthStats {
fn icon() -> &'static str {
"📆"
"M"
}
fn label() -> &'static str {
@@ -322,7 +322,7 @@ mod tests {
assert_eq!(day.commands(), 10);
assert_eq!(day.saved_tokens(), 200);
assert_eq!(day.avg_time_ms(), 150);
assert_eq!(DayStats::icon(), "📅");
assert_eq!(DayStats::icon(), "D");
assert_eq!(DayStats::label(), "Daily");
}
@@ -342,7 +342,7 @@ mod tests {
assert_eq!(week.period(), "01-20 → 01-26");
assert_eq!(week.avg_time_ms(), 100);
assert_eq!(WeekStats::icon(), "📊");
assert_eq!(WeekStats::icon(), "W");
assert_eq!(WeekStats::label(), "Weekly");
}
@@ -361,7 +361,7 @@ mod tests {
assert_eq!(month.period(), "2026-01");
assert_eq!(month.avg_time_ms(), 100);
assert_eq!(MonthStats::icon(), "📆");
assert_eq!(MonthStats::icon(), "M");
assert_eq!(MonthStats::label(), "Monthly");
}
+6 -6
View File
@@ -62,7 +62,7 @@ pub fn run(filter: Option<&str>, show_all: bool, verbose: u8) -> Result<()> {
// Print categorized
if !path_vars.is_empty() {
println!("📂 PATH Variables:");
println!("PATH Variables:");
for (k, v) in &path_vars {
if k == "PATH" {
// Split PATH for readability
@@ -81,28 +81,28 @@ pub fn run(filter: Option<&str>, show_all: bool, verbose: u8) -> Result<()> {
}
if !lang_vars.is_empty() {
println!("\n🔧 Language/Runtime:");
println!("\nLanguage/Runtime:");
for (k, v) in &lang_vars {
println!(" {}={}", k, v);
}
}
if !cloud_vars.is_empty() {
println!("\n☁️ Cloud/Services:");
println!("\nCloud/Services:");
for (k, v) in &cloud_vars {
println!(" {}={}", k, v);
}
}
if !tool_vars.is_empty() {
println!("\n🛠️ Tools:");
println!("\nTools:");
for (k, v) in &tool_vars {
println!(" {}={}", k, v);
}
}
if !other_vars.is_empty() {
println!("\n📋 Other:");
println!("\nOther:");
for (k, v) in other_vars.iter().take(20) {
println!(" {}={}", k, v);
}
@@ -118,7 +118,7 @@ pub fn run(filter: Option<&str>, show_all: bool, verbose: u8) -> Result<()> {
+ tool_vars.len()
+ other_vars.len().min(20);
if filter.is_none() {
println!("\n📊 Total: {} vars (showing {} relevant)", total, shown);
println!("\nTotal: {} vars (showing {} relevant)", total, shown);
}
let raw: String = vars.iter().map(|(k, v)| format!("{}={}\n", k, v)).collect();
+1 -1
View File
@@ -305,7 +305,7 @@ pub fn run(
let dirs_count = dirs.len();
let total_files = files.len();
println!("📁 {}F {}D:", total_files, dirs_count);
println!("{}F {}D:", total_files, dirs_count);
println!();
// Display with proper --max limiting (count individual files)
+4 -7
View File
@@ -226,7 +226,7 @@ fn filter_black_output(output: &str) -> String {
if !needs_formatting && (all_done || files_unchanged > 0) {
// All files formatted correctly
result.push_str("✓ Format (black): All files formatted");
result.push_str("Format (black): All files formatted");
if files_unchanged > 0 {
result.push_str(&format!(" ({} files checked)", files_unchanged));
}
@@ -258,13 +258,10 @@ fn filter_black_output(output: &str) -> String {
}
if files_unchanged > 0 {
result.push_str(&format!(
"\n✓ {} files already formatted\n",
files_unchanged
));
result.push_str(&format!("\n{} files already formatted\n", files_unchanged));
}
result.push_str("\n💡 Run `black .` to format these files\n");
result.push_str("\n[hint] Run `black .` to format these files\n");
} else {
// Fallback: show raw output
result.push_str(output.trim());
@@ -349,7 +346,7 @@ mod tests {
fn test_filter_black_all_formatted() {
let output = "All done! ✨ 🍰 ✨\n5 files left unchanged.";
let result = filter_black_output(output);
assert!(result.contains("✓ Format (black)"));
assert!(result.contains("Format (black)"));
assert!(result.contains("All files formatted"));
assert!(result.contains("5 files checked"));
}
+3 -3
View File
@@ -109,7 +109,7 @@ pub fn run(
hook_check::HookStatus::Missing => {
eprintln!(
"{}",
"⚠️ No hook installed — run `rtk init -g` for automatic token savings"
"[warn] No hook installed — run `rtk init -g` for automatic token savings"
.yellow()
);
eprintln!();
@@ -117,7 +117,7 @@ pub fn run(
hook_check::HookStatus::Outdated => {
eprintln!(
"{}",
"⚠️ Hook outdated — run `rtk init -g` to update".yellow()
"[warn] Hook outdated — run `rtk init -g` to update".yellow()
);
eprintln!();
}
@@ -659,7 +659,7 @@ fn check_rtk_disabled_bypass() -> Option<String> {
let pct = (bypassed as f64 / total_bash as f64) * 100.0;
if pct > 10.0 {
Some(format!(
"⚠️ {} commands ({:.0}%) used RTK_DISABLED=1 unnecessarily — run `rtk discover` for details",
"[warn] {} commands ({:.0}%) used RTK_DISABLED=1 unnecessarily — run `rtk discover` for details",
bypassed, pct
))
} else {
+46 -51
View File
@@ -235,8 +235,8 @@ fn list_prs(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
filtered.push_str("PRs\n");
println!("PRs");
} else {
filtered.push_str("📋 Pull Requests\n");
println!("📋 Pull Requests");
filtered.push_str("Pull Requests\n");
println!("Pull Requests");
}
for pr in prs.iter().take(20) {
@@ -254,10 +254,10 @@ fn list_prs(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
}
} else {
match state {
"OPEN" => "🟢",
"MERGED" => "🟣",
"CLOSED" => "🔴",
_ => "⚪",
"OPEN" => "[open]",
"MERGED" => "[merged]",
"CLOSED" => "[closed]",
_ => "[unknown]",
}
};
@@ -352,10 +352,10 @@ fn view_pr(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
}
} else {
match state {
"OPEN" => "🟢",
"MERGED" => "🟣",
"CLOSED" => "🔴",
_ => "⚪",
"OPEN" => "[open]",
"MERGED" => "[merged]",
"CLOSED" => "[closed]",
_ => "[unknown]",
}
};
@@ -368,8 +368,8 @@ fn view_pr(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
print!("{}", line);
let mergeable_str = match mergeable {
"MERGEABLE" => "✓",
"CONFLICTING" => "✗",
"MERGEABLE" => "[ok]",
"CONFLICTING" => "[x]",
_ => "?",
};
let line = format!(" {} | {}\n", state, mergeable_str);
@@ -417,11 +417,11 @@ fn view_pr(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
if ultra_compact {
if failed > 0 {
let line = format!(" ✗{}/{} {} fail\n", passed, total, failed);
let line = format!(" [x]{}/{} {} fail\n", passed, total, failed);
filtered.push_str(&line);
print!("{}", line);
} else {
let line = format!(" ✓{}/{}\n", passed, total);
let line = format!(" {}/{}\n", passed, total);
filtered.push_str(&line);
print!("{}", line);
}
@@ -430,7 +430,7 @@ fn view_pr(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
filtered.push_str(&line);
print!("{}", line);
if failed > 0 {
let line = format!(" ⚠️ {} checks failed\n", failed);
let line = format!(" [warn] {} checks failed\n", failed);
filtered.push_str(&line);
print!("{}", line);
}
@@ -504,9 +504,9 @@ fn pr_checks(args: &[String], _verbose: u8, _ultra_compact: bool) -> Result<()>
let mut failed_checks = Vec::new();
for line in stdout.lines() {
if line.contains('✓') || line.contains("pass") {
if line.contains("[ok]") || line.contains("pass") {
passed += 1;
} else if line.contains('✗') || line.contains("fail") {
} else if line.contains("[x]") || line.contains("fail") {
failed += 1;
failed_checks.push(line.trim().to_string());
} else if line.contains('*') || line.contains("pending") {
@@ -516,20 +516,20 @@ fn pr_checks(args: &[String], _verbose: u8, _ultra_compact: bool) -> Result<()>
let mut filtered = String::new();
let line = "🔍 CI Checks Summary:\n";
let line = "CI Checks Summary:\n";
filtered.push_str(line);
print!("{}", line);
let line = format!(" ✅ Passed: {}\n", passed);
let line = format!(" [ok] Passed: {}\n", passed);
filtered.push_str(&line);
print!("{}", line);
let line = format!(" ❌ Failed: {}\n", failed);
let line = format!(" [FAIL] Failed: {}\n", failed);
filtered.push_str(&line);
print!("{}", line);
if pending > 0 {
let line = format!(" ⏳ Pending: {}\n", pending);
let line = format!(" [pending] Pending: {}\n", pending);
filtered.push_str(&line);
print!("{}", line);
}
@@ -581,7 +581,7 @@ fn pr_status(_verbose: u8, _ultra_compact: bool) -> Result<()> {
let mut filtered = String::new();
if let Some(created_by) = json["createdBy"].as_array() {
let line = format!("📝 Your PRs ({}):\n", created_by.len());
let line = format!("Your PRs ({}):\n", created_by.len());
filtered.push_str(&line);
print!("{}", line);
for pr in created_by.iter().take(5) {
@@ -636,13 +636,8 @@ fn list_issues(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()>
let mut filtered = String::new();
if let Some(issues) = json.as_array() {
if ultra_compact {
filtered.push_str("Issues\n");
println!("Issues");
} else {
filtered.push_str("🐛 Issues\n");
println!("🐛 Issues");
}
filtered.push_str("Issues\n");
println!("Issues");
for issue in issues.iter().take(20) {
let number = issue["number"].as_i64().unwrap_or(0);
let title = issue["title"].as_str().unwrap_or("???");
@@ -656,9 +651,9 @@ fn list_issues(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()>
}
} else {
if state == "OPEN" {
"🟢"
"[open]"
} else {
"🔴"
"[closed]"
}
};
let line = format!(" {} #{} {}\n", icon, number, truncate(title, 60));
@@ -721,7 +716,11 @@ fn view_issue(args: &[String], _verbose: u8) -> Result<()> {
let author = json["author"]["login"].as_str().unwrap_or("???");
let url = json["url"].as_str().unwrap_or("");
let icon = if state == "OPEN" { "🟢" } else { "🔴" };
let icon = if state == "OPEN" {
"[open]"
} else {
"[closed]"
};
let mut filtered = String::new();
@@ -814,8 +813,8 @@ fn list_runs(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
filtered.push_str("Runs\n");
println!("Runs");
} else {
filtered.push_str("🏃 Workflow Runs\n");
println!("🏃 Workflow Runs");
filtered.push_str("Workflow Runs\n");
println!("Workflow Runs");
}
for run in runs {
let id = run["databaseId"].as_i64().unwrap_or(0);
@@ -825,8 +824,8 @@ fn list_runs(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
let icon = if ultra_compact {
match conclusion {
"success" => "✓",
"failure" => "✗",
"success" => "[ok]",
"failure" => "[x]",
"cancelled" => "X",
_ => {
if status == "in_progress" {
@@ -838,14 +837,14 @@ fn list_runs(args: &[String], _verbose: u8, ultra_compact: bool) -> Result<()> {
}
} else {
match conclusion {
"success" => "✅",
"failure" => "❌",
"cancelled" => "🚫",
"success" => "[ok]",
"failure" => "[FAIL]",
"cancelled" => "[X]",
_ => {
if status == "in_progress" {
"⏳"
"[time]"
} else {
"⚪"
"[pending]"
}
}
}
@@ -910,7 +909,7 @@ fn view_run(args: &[String], _verbose: u8) -> Result<()> {
let mut filtered = String::new();
let line = format!("🏃 Workflow Run #{}\n", run_id);
let line = format!("Workflow Run #{}\n", run_id);
filtered.push_str(&line);
print!("{}", line);
@@ -924,8 +923,8 @@ fn view_run(args: &[String], _verbose: u8) -> Result<()> {
// Skip successful jobs in compact mode
continue;
}
if line.contains('✗') || line.contains("fail") {
let formatted = format!(" ❌ {}\n", line.trim());
if line.contains("[x]") || line.contains("fail") {
let formatted = format!(" [FAIL] {}\n", line.trim());
filtered.push_str(&formatted);
print!("{}", formatted);
}
@@ -992,15 +991,11 @@ fn run_repo(args: &[String], _verbose: u8, _ultra_compact: bool) -> Result<()> {
let forks = json["forkCount"].as_i64().unwrap_or(0);
let private = json["isPrivate"].as_bool().unwrap_or(false);
let visibility = if private {
"🔒 Private"
} else {
"🌐 Public"
};
let visibility = if private { "[private]" } else { "[public]" };
let mut filtered = String::new();
let line = format!("📦 {}/{}\n", owner, name);
let line = format!("{}/{}\n", owner, name);
filtered.push_str(&line);
print!("{}", line);
@@ -1014,7 +1009,7 @@ fn run_repo(args: &[String], _verbose: u8, _ultra_compact: bool) -> Result<()> {
print!("{}", line);
}
let line = format!(" ⭐ {} stars | 🔱 {} forks\n", stars, forks);
let line = format!(" {} stars | {} forks\n", stars, forks);
filtered.push_str(&line);
print!("{}", line);
+32 -32
View File
@@ -573,7 +573,7 @@ fn format_status_output(porcelain: &str) -> String {
if let Some(branch_line) = lines.first() {
if branch_line.starts_with("##") {
let branch = branch_line.trim_start_matches("## ");
output.push_str(&format!("branch: {}\n", branch));
output.push_str(&format!("* {}\n", branch));
}
}
@@ -623,7 +623,7 @@ fn format_status_output(porcelain: &str) -> String {
let max_untracked = limits.status_max_untracked;
if staged > 0 {
output.push_str(&format!("staged: {} files\n", staged));
output.push_str(&format!("+ Staged: {} files\n", staged));
for f in staged_files.iter().take(max_files) {
output.push_str(&format!(" {}\n", f));
}
@@ -636,7 +636,7 @@ fn format_status_output(porcelain: &str) -> String {
}
if modified > 0 {
output.push_str(&format!("modified: {} files\n", modified));
output.push_str(&format!("~ Modified: {} files\n", modified));
for f in modified_files.iter().take(max_files) {
output.push_str(&format!(" {}\n", f));
}
@@ -649,7 +649,7 @@ fn format_status_output(porcelain: &str) -> String {
}
if untracked > 0 {
output.push_str(&format!("untracked: {} files\n", untracked));
output.push_str(&format!("? Untracked: {} files\n", untracked));
for f in untracked_files.iter().take(max_untracked) {
output.push_str(&format!(" {}\n", f));
}
@@ -704,7 +704,7 @@ fn filter_status_with_args(output: &str) -> String {
}
if result.is_empty() {
"ok ✓".to_string()
"ok".to_string()
} else {
result.join("\n")
}
@@ -830,9 +830,9 @@ fn run_add(args: &[String], verbose: u8, global_args: &[String]) -> Result<()> {
// Parse "1 file changed, 5 insertions(+)" format
let short = stat.lines().last().unwrap_or("").trim();
if short.is_empty() {
"ok ✓".to_string()
"ok".to_string()
} else {
format!("ok ✓ {}", short)
format!("ok {}", short)
}
};
@@ -893,15 +893,15 @@ fn run_commit(args: &[String], verbose: u8, global_args: &[String]) -> Result<()
if let Some(hash_start) = line.find(' ') {
let hash = line[1..hash_start].split(' ').next_back().unwrap_or("");
if !hash.is_empty() && hash.len() >= 7 {
format!("ok ✓ {}", &hash[..7.min(hash.len())])
format!("ok {}", &hash[..7.min(hash.len())])
} else {
"ok ✓".to_string()
"ok".to_string()
}
} else {
"ok ✓".to_string()
"ok".to_string()
}
} else {
"ok ✓".to_string()
"ok".to_string()
};
println!("{}", compact);
@@ -959,7 +959,7 @@ fn run_push(args: &[String], verbose: u8, global_args: &[String]) -> Result<()>
if line.contains("->") {
let parts: Vec<&str> = line.split_whitespace().collect();
if parts.len() >= 3 {
result = format!("ok ✓ {}", parts[parts.len() - 1]);
result = format!("ok {}", parts[parts.len() - 1]);
break;
}
}
@@ -967,7 +967,7 @@ fn run_push(args: &[String], verbose: u8, global_args: &[String]) -> Result<()>
if !result.is_empty() {
result
} else {
"ok ✓".to_string()
"ok".to_string()
}
};
@@ -1051,9 +1051,9 @@ fn run_pull(args: &[String], verbose: u8, global_args: &[String]) -> Result<()>
}
if files > 0 {
format!("ok ✓ {} files +{} -{}", files, insertions, deletions)
format!("ok {} files +{} -{}", files, insertions, deletions)
} else {
"ok ✓".to_string()
"ok".to_string()
}
};
@@ -1171,7 +1171,7 @@ fn run_branch(args: &[String], verbose: u8, global_args: &[String]) -> Result<()
let combined = format!("{}{}", stdout, stderr);
let msg = if output.status.success() {
"ok ✓"
"ok"
} else {
&combined
};
@@ -1184,7 +1184,7 @@ fn run_branch(args: &[String], verbose: u8, global_args: &[String]) -> Result<()
);
if output.status.success() {
println!("ok ✓");
println!("ok");
} else {
eprintln!("FAILED: git branch {}", args.join(" "));
if !stderr.trim().is_empty() {
@@ -1548,7 +1548,7 @@ fn run_worktree(args: &[String], verbose: u8, global_args: &[String]) -> Result<
let combined = format!("{}{}", stdout, stderr);
let msg = if output.status.success() {
"ok ✓"
"ok"
} else {
&combined
};
@@ -1561,7 +1561,7 @@ fn run_worktree(args: &[String], verbose: u8, global_args: &[String]) -> Result<
);
if output.status.success() {
println!("ok ✓");
println!("ok");
} else {
eprintln!("FAILED: git worktree {}", args.join(" "));
if !stderr.trim().is_empty() {
@@ -1808,8 +1808,8 @@ mod tests {
fn test_format_status_output_modified_files() {
let porcelain = "## main...origin/main\n M src/main.rs\n M src/lib.rs\n";
let result = format_status_output(porcelain);
assert!(result.contains("branch: main...origin/main"));
assert!(result.contains("modified: 2 files"));
assert!(result.contains("* main...origin/main"));
assert!(result.contains("~ Modified: 2 files"));
assert!(result.contains("src/main.rs"));
assert!(result.contains("src/lib.rs"));
assert!(!result.contains("Staged"));
@@ -1820,8 +1820,8 @@ mod tests {
fn test_format_status_output_untracked_files() {
let porcelain = "## feature/new\n?? temp.txt\n?? debug.log\n?? test.sh\n";
let result = format_status_output(porcelain);
assert!(result.contains("branch: feature/new"));
assert!(result.contains("untracked: 3 files"));
assert!(result.contains("* feature/new"));
assert!(result.contains("? Untracked: 3 files"));
assert!(result.contains("temp.txt"));
assert!(result.contains("debug.log"));
assert!(result.contains("test.sh"));
@@ -1837,13 +1837,13 @@ A added.rs
?? untracked.txt
"#;
let result = format_status_output(porcelain);
assert!(result.contains("branch: main"));
assert!(result.contains("staged: 2 files"));
assert!(result.contains("* main"));
assert!(result.contains("+ Staged: 2 files"));
assert!(result.contains("staged.rs"));
assert!(result.contains("added.rs"));
assert!(result.contains("modified: 1 files"));
assert!(result.contains("~ Modified: 1 files"));
assert!(result.contains("modified.rs"));
assert!(result.contains("untracked: 1 files"));
assert!(result.contains("? Untracked: 1 files"));
assert!(result.contains("untracked.txt"));
}
@@ -1855,7 +1855,7 @@ A added.rs
porcelain.push_str(&format!("M file{}.rs\n", i));
}
let result = format_status_output(&porcelain);
assert!(result.contains("staged: 20 files"));
assert!(result.contains("+ Staged: 20 files"));
assert!(result.contains("file1.rs"));
assert!(result.contains("file15.rs"));
assert!(result.contains("... +5 more"));
@@ -1871,7 +1871,7 @@ A added.rs
porcelain.push_str(&format!(" M file{}.rs\n", i));
}
let result = format_status_output(&porcelain);
assert!(result.contains("modified: 20 files"));
assert!(result.contains("~ Modified: 20 files"));
assert!(result.contains("file1.rs"));
assert!(result.contains("file15.rs"));
assert!(result.contains("... +5 more"));
@@ -1886,7 +1886,7 @@ A added.rs
porcelain.push_str(&format!("?? file{}.rs\n", i));
}
let result = format_status_output(&porcelain);
assert!(result.contains("untracked: 15 files"));
assert!(result.contains("? Untracked: 15 files"));
assert!(result.contains("file1.rs"));
assert!(result.contains("file10.rs"));
assert!(result.contains("... +5 more"));
@@ -2100,7 +2100,7 @@ no changes added to commit (use "git add" and/or "git commit -a")
let porcelain = "## main\n M สวัสดี.txt\n?? ทดสอบ.rs\n";
let result = format_status_output(porcelain);
// Should not panic
assert!(result.contains("branch: main"));
assert!(result.contains("* main"));
assert!(result.contains("สวัสดี.txt"));
assert!(result.contains("ทดสอบ.rs"));
}
@@ -2109,7 +2109,7 @@ no changes added to commit (use "git add" and/or "git commit -a")
fn test_format_status_output_emoji_filename() {
let porcelain = "## main\nA 🎉-party.txt\n M 日本語ファイル.rs\n";
let result = format_status_output(porcelain);
assert!(result.contains("branch: main"));
assert!(result.contains("* main"));
}
/// Regression test: --oneline and other user format flags must preserve all commits.
+9 -9
View File
@@ -348,7 +348,7 @@ fn filter_go_test_json(output: &str) -> String {
if !has_failures {
return format!(
"✓ Go test: {} passed in {} packages",
"Go test: {} passed in {} packages",
total_pass, total_packages
);
}
@@ -372,7 +372,7 @@ fn filter_go_test_json(output: &str) -> String {
}
result.push_str(&format!(
"\n📦 {} [build failed]\n",
"\n{} [build failed]\n",
compact_package_name(package)
));
@@ -392,14 +392,14 @@ fn filter_go_test_json(output: &str) -> String {
}
result.push_str(&format!(
"\n📦 {} ({} passed, {} failed)\n",
"\n{} ({} passed, {} failed)\n",
compact_package_name(package),
pkg_result.pass,
pkg_result.fail
));
for (test, outputs) in &pkg_result.failed_tests {
result.push_str(&format!(" ❌ {}\n", test));
result.push_str(&format!(" [FAIL] {}\n", test));
// Show failure output (limit to key lines)
let relevant_lines: Vec<&String> = outputs
@@ -452,7 +452,7 @@ fn filter_go_build(output: &str) -> String {
}
if errors.is_empty() {
return "✓ Go build: Success".to_string();
return "Go build: Success".to_string();
}
let mut result = String::new();
@@ -484,7 +484,7 @@ fn filter_go_vet(output: &str) -> String {
}
if issues.is_empty() {
return "✓ Go vet: No issues found".to_string();
return "Go vet: No issues found".to_string();
}
let mut result = String::new();
@@ -524,7 +524,7 @@ mod tests {
{"Time":"2024-01-01T10:00:02Z","Action":"pass","Package":"example.com/foo","Elapsed":0.5}"#;
let result = filter_go_test_json(output);
assert!(result.contains("✓ Go test"));
assert!(result.contains("Go test"));
assert!(result.contains("1 passed"));
assert!(result.contains("1 packages"));
}
@@ -547,7 +547,7 @@ mod tests {
fn test_filter_go_build_success() {
let output = "";
let result = filter_go_build(output);
assert!(result.contains("✓ Go build"));
assert!(result.contains("Go build"));
assert!(result.contains("Success"));
}
@@ -567,7 +567,7 @@ main.go:15:2: cannot use x (type int) as type string"#;
fn test_filter_go_vet_no_issues() {
let output = "";
let result = filter_go_vet(output);
assert!(result.contains("✓ Go vet"));
assert!(result.contains("Go vet"));
assert!(result.contains("No issues found"));
}
+2 -2
View File
@@ -118,7 +118,7 @@ fn filter_golangci_json(output: &str) -> String {
let issues = golangci_output.issues;
if issues.is_empty() {
return "✓ golangci-lint: No issues found".to_string();
return "golangci-lint: No issues found".to_string();
}
let total_issues = issues.len();
@@ -215,7 +215,7 @@ mod tests {
fn test_filter_golangci_no_issues() {
let output = r#"{"Issues":[]}"#;
let result = filter_golangci_json(output);
assert!(result.contains("✓ golangci-lint"));
assert!(result.contains("golangci-lint"));
assert!(result.contains("No issues found"));
}
+3 -3
View File
@@ -62,7 +62,7 @@ pub fn run(
eprintln!("{}", stderr.trim());
}
}
let msg = format!("🔍 0 for '{}'", pattern);
let msg = format!("0 matches for '{}'", pattern);
println!("{}", msg);
timer.track(
&format!("grep -rn '{}' {}", pattern, path),
@@ -105,7 +105,7 @@ pub fn run(
}
let mut rtk_output = String::new();
rtk_output.push_str(&format!("🔍 {} in {}F:\n\n", total, by_file.len()));
rtk_output.push_str(&format!("{} matches in {}F:\n\n", total, by_file.len()));
let mut shown = 0;
let mut files: Vec<_> = by_file.iter().collect();
@@ -117,7 +117,7 @@ pub fn run(
}
let file_display = compact_path(file);
rtk_output.push_str(&format!("📄 {} ({}):\n", file_display, matches.len()));
rtk_output.push_str(&format!("[file] {} ({}):\n", file_display, matches.len()));
let per_file = config::limits().grep_max_per_file;
for (line_num, content) in matches.iter().take(per_file) {
+41 -38
View File
@@ -722,7 +722,7 @@ fn run_default_mode(
_verbose: u8,
_install_opencode: bool,
) -> Result<()> {
eprintln!("⚠️ Hook-based mode requires Unix (macOS/Linux).");
eprintln!("[warn] Hook-based mode requires Unix (macOS/Linux).");
eprintln!(" Windows: use --claude-md mode for full injection.");
eprintln!(" Falling back to --claude-md mode.");
run_claude_md_mode(_global, _verbose, _install_opencode)
@@ -779,7 +779,7 @@ fn run_default_mode(
println!(" CLAUDE.md: @RTK.md reference added");
if migrated {
println!("\n ✅ Migrated: removed 137-line RTK block from CLAUDE.md");
println!("\n [ok] Migrated: removed 137-line RTK block from CLAUDE.md");
println!(" replaced with @RTK.md (10 lines)");
}
@@ -880,7 +880,7 @@ fn run_hook_only_mode(
install_opencode: bool,
) -> Result<()> {
if !global {
eprintln!("⚠️ Warning: --hook-only only makes sense with --global");
eprintln!("[warn] Warning: --hook-only only makes sense with --global");
eprintln!(" For local projects, use default mode or --claude-md");
return Ok(());
}
@@ -963,22 +963,22 @@ fn run_claude_md_mode(global: bool, verbose: u8, install_opencode: bool) -> Resu
match action {
RtkBlockUpsert::Added => {
fs::write(&path, new_content)?;
println!("✅ Added rtk instructions to existing {}", path.display());
println!("[ok] Added rtk instructions to existing {}", path.display());
}
RtkBlockUpsert::Updated => {
fs::write(&path, new_content)?;
println!("✅ Updated rtk instructions in {}", path.display());
println!("[ok] Updated rtk instructions in {}", path.display());
}
RtkBlockUpsert::Unchanged => {
println!(
"✅ {} already contains up-to-date rtk instructions",
"[ok] {} already contains up-to-date rtk instructions",
path.display()
);
return Ok(());
}
RtkBlockUpsert::Malformed => {
eprintln!(
"⚠️ Warning: Found '<!-- rtk-instructions' without closing marker in {}",
"[warn] Warning: Found '<!-- rtk-instructions' without closing marker in {}",
path.display()
);
@@ -1001,7 +1001,7 @@ fn run_claude_md_mode(global: bool, verbose: u8, install_opencode: bool) -> Resu
}
} else {
fs::write(&path, RTK_INSTRUCTIONS)?;
println!("✅ Created {} with rtk instructions", path.display());
println!("[ok] Created {} with rtk instructions", path.display());
}
if global {
@@ -1009,7 +1009,7 @@ fn run_claude_md_mode(global: bool, verbose: u8, install_opencode: bool) -> Resu
let opencode_plugin_path = prepare_opencode_plugin_path()?;
ensure_opencode_plugin_installed(&opencode_plugin_path, verbose)?;
println!(
"✅ OpenCode plugin installed: {}",
"[ok] OpenCode plugin installed: {}",
opencode_plugin_path.display()
);
}
@@ -1151,7 +1151,7 @@ fn remove_rtk_block(content: &str) -> (String, bool) {
(result, true) // migrated
} else if content.contains("<!-- rtk-instructions") {
eprintln!("⚠️ Warning: Found '<!-- rtk-instructions' without closing marker.");
eprintln!("[warn] Warning: Found '<!-- rtk-instructions' without closing marker.");
eprintln!(" This can happen if CLAUDE.md was manually edited.");
// Find line number
@@ -1238,7 +1238,7 @@ pub fn show_config() -> Result<()> {
let global_claude_md = claude_dir.join("CLAUDE.md");
let local_claude_md = PathBuf::from("CLAUDE.md");
println!("📋 rtk Configuration:\n");
println!("rtk Configuration:\n");
// Check hook
if hook_path.exists() {
@@ -1257,12 +1257,12 @@ pub fn show_config() -> Result<()> {
if !is_executable {
println!(
"⚠️ Hook: {} (NOT executable - run: chmod +x)",
"[warn] Hook: {} (NOT executable - run: chmod +x)",
hook_path.display()
);
} else if !is_thin_delegator {
println!(
"⚠️ Hook: {} (outdated — inline logic, not thin delegator)",
"[warn] Hook: {} (outdated — inline logic, not thin delegator)",
hook_path.display()
);
println!(
@@ -1270,47 +1270,50 @@ pub fn show_config() -> Result<()> {
);
} else if is_executable && has_guards {
println!(
"✅ Hook: {} (thin delegator, version {})",
"[ok] Hook: {} (thin delegator, version {})",
hook_path.display(),
hook_version
);
} else {
println!("⚠️ Hook: {} (no guards - outdated)", hook_path.display());
println!(
"[warn] Hook: {} (no guards - outdated)",
hook_path.display()
);
}
}
#[cfg(not(unix))]
{
println!("✅ Hook: {} (exists)", hook_path.display());
println!("[ok] Hook: {} (exists)", hook_path.display());
}
} else {
println!("⚪ Hook: not found");
println!("[--] Hook: not found");
}
// Check RTK.md
if rtk_md_path.exists() {
println!("✅ RTK.md: {} (slim mode)", rtk_md_path.display());
println!("[ok] RTK.md: {} (slim mode)", rtk_md_path.display());
} else {
println!("⚪ RTK.md: not found");
println!("[--] RTK.md: not found");
}
// Check hook integrity
match integrity::verify_hook_at(&hook_path) {
Ok(integrity::IntegrityStatus::Verified) => {
println!("✅ Integrity: hook hash verified");
println!("[ok] Integrity: hook hash verified");
}
Ok(integrity::IntegrityStatus::Tampered { .. }) => {
println!("❌ Integrity: hook modified outside rtk init (run: rtk verify)");
println!("[FAIL] Integrity: hook modified outside rtk init (run: rtk verify)");
}
Ok(integrity::IntegrityStatus::NoBaseline) => {
println!("⚠️ Integrity: no baseline hash (run: rtk init -g to establish)");
println!("[warn] Integrity: no baseline hash (run: rtk init -g to establish)");
}
Ok(integrity::IntegrityStatus::NotInstalled)
| Ok(integrity::IntegrityStatus::OrphanedHash) => {
// Don't show integrity line if hook isn't installed
}
Err(_) => {
println!("⚠️ Integrity: check failed");
println!("[warn] Integrity: check failed");
}
}
@@ -1318,28 +1321,28 @@ pub fn show_config() -> Result<()> {
if global_claude_md.exists() {
let content = fs::read_to_string(&global_claude_md)?;
if content.contains("@RTK.md") {
println!("✅ Global (~/.claude/CLAUDE.md): @RTK.md reference");
println!("[ok] Global (~/.claude/CLAUDE.md): @RTK.md reference");
} else if content.contains("<!-- rtk-instructions") {
println!(
"⚠️ Global (~/.claude/CLAUDE.md): old RTK block (run: rtk init -g to migrate)"
"[warn] Global (~/.claude/CLAUDE.md): old RTK block (run: rtk init -g to migrate)"
);
} else {
println!("⚪ Global (~/.claude/CLAUDE.md): exists but rtk not configured");
println!("[--] Global (~/.claude/CLAUDE.md): exists but rtk not configured");
}
} else {
println!("⚪ Global (~/.claude/CLAUDE.md): not found");
println!("[--] Global (~/.claude/CLAUDE.md): not found");
}
// Check local CLAUDE.md
if local_claude_md.exists() {
let content = fs::read_to_string(&local_claude_md)?;
if content.contains("rtk") {
println!("✅ Local (./CLAUDE.md): rtk enabled");
println!("[ok] Local (./CLAUDE.md): rtk enabled");
} else {
println!("⚪ Local (./CLAUDE.md): exists but rtk not configured");
println!("[--] Local (./CLAUDE.md): exists but rtk not configured");
}
} else {
println!("⚪ Local (./CLAUDE.md): not found");
println!("[--] Local (./CLAUDE.md): not found");
}
// Check settings.json
@@ -1350,31 +1353,31 @@ pub fn show_config() -> Result<()> {
if let Ok(root) = serde_json::from_str::<serde_json::Value>(&content) {
let hook_command = hook_path.display().to_string();
if hook_already_present(&root, &hook_command) {
println!("✅ settings.json: RTK hook configured");
println!("[ok] settings.json: RTK hook configured");
} else {
println!("⚠️ settings.json: exists but RTK hook not configured");
println!("[warn] settings.json: exists but RTK hook not configured");
println!(" Run: rtk init -g --auto-patch");
}
} else {
println!("⚠️ settings.json: exists but invalid JSON");
println!("[warn] settings.json: exists but invalid JSON");
}
} else {
println!("⚪ settings.json: empty");
println!("[--] settings.json: empty");
}
} else {
println!("⚪ settings.json: not found");
println!("[--] settings.json: not found");
}
// Check OpenCode plugin
if let Ok(opencode_dir) = resolve_opencode_dir() {
let plugin = opencode_plugin_path(&opencode_dir);
if plugin.exists() {
println!("✅ OpenCode: plugin installed ({})", plugin.display());
println!("[ok] OpenCode: plugin installed ({})", plugin.display());
} else {
println!("⚪ OpenCode: plugin not found");
println!("[--] OpenCode: plugin not found");
}
} else {
println!("⚪ OpenCode: config dir not found");
println!("[--] OpenCode: config dir not found");
}
println!("\nUsage:");
+6 -6
View File
@@ -172,7 +172,7 @@ pub fn run(args: &[String], verbose: u8) -> Result<()> {
// Check if process was killed by signal (SIGABRT, SIGKILL, etc.)
if !output.status.success() && output.status.code().is_none() {
let stderr = String::from_utf8_lossy(&output.stderr);
eprintln!("⚠️ Linter process terminated abnormally (possibly out of memory)");
eprintln!("[warn] Linter process terminated abnormally (possibly out of memory)");
if !stderr.is_empty() {
eprintln!(
"stderr: {}",
@@ -194,7 +194,7 @@ pub fn run(args: &[String], verbose: u8) -> Result<()> {
if !stdout.trim().is_empty() {
ruff_cmd::filter_ruff_check_json(&stdout)
} else {
"✓ Ruff: No issues found".to_string()
"Ruff: No issues found".to_string()
}
}
"pylint" => filter_pylint_json(&stdout),
@@ -248,7 +248,7 @@ fn filter_eslint_json(output: &str) -> String {
let total_files = results.iter().filter(|r| !r.messages.is_empty()).count();
if total_errors == 0 && total_warnings == 0 {
return "✓ ESLint: No issues found".to_string();
return "ESLint: No issues found".to_string();
}
// Group messages by rule
@@ -335,7 +335,7 @@ fn filter_pylint_json(output: &str) -> String {
};
if diagnostics.is_empty() {
return "✓ Pylint: No issues found".to_string();
return "Pylint: No issues found".to_string();
}
// Count by type
@@ -454,7 +454,7 @@ fn filter_generic_lint(output: &str) -> String {
}
if errors == 0 && warnings == 0 {
return "✓ Lint: No issues found".to_string();
return "Lint: No issues found".to_string();
}
let mut result = String::new();
@@ -556,7 +556,7 @@ mod tests {
fn test_filter_pylint_json_no_issues() {
let output = "[]";
let result = filter_pylint_json(output);
assert!(result.contains("✓ Pylint"));
assert!(result.contains("Pylint"));
assert!(result.contains("No issues found"));
}
+6 -6
View File
@@ -105,23 +105,23 @@ fn analyze_logs(content: &str) -> String {
let total_warnings: usize = warn_counts.values().sum();
let total_info: usize = info_counts.values().sum();
result.push("📊 Log Summary".to_string());
result.push("Log Summary".to_string());
result.push(format!(
" ❌ {} errors ({} unique)",
" [error] {} errors ({} unique)",
total_errors,
error_counts.len()
));
result.push(format!(
" ⚠️ {} warnings ({} unique)",
" [warn] {} warnings ({} unique)",
total_warnings,
warn_counts.len()
));
result.push(format!(" ℹ️ {} info messages", total_info));
result.push(format!(" [info] {} info messages", total_info));
result.push(String::new());
// Errors with counts
if !unique_errors.is_empty() {
result.push("❌ ERRORS:".to_string());
result.push("[ERRORS]".to_string());
// Sort by count
let mut error_list: Vec<_> = error_counts.iter().collect();
@@ -163,7 +163,7 @@ fn analyze_logs(content: &str) -> String {
// Warnings with counts
if !unique_warnings.is_empty() {
result.push("⚠️ WARNINGS:".to_string());
result.push("[WARNINGS]".to_string());
let mut warn_list: Vec<_> = warn_counts.iter().collect();
warn_list.sort_by(|a, b| b.1.cmp(a.1));
+2 -2
View File
@@ -203,7 +203,7 @@ fn compact_ls(raw: &str, show_all: bool) -> String {
// Summary line
out.push('\n');
let mut summary = format!("📊 {} files, {} dirs", files.len(), dirs.len());
let mut summary = format!("{} files, {} dirs", files.len(), dirs.len());
if !by_ext.is_empty() {
let mut ext_counts: Vec<_> = by_ext.iter().collect();
ext_counts.sort_by(|a, b| b.1.cmp(a.1));
@@ -291,7 +291,7 @@ mod tests {
-rw-r--r-- 1 user staff 5678 Jan 1 12:00 lib.rs\n\
-rw-r--r-- 1 user staff 100 Jan 1 12:00 Cargo.toml\n";
let output = compact_ls(input, false);
assert!(output.contains("📊 3 files, 1 dirs"));
assert!(output.contains("3 files, 1 dirs"));
assert!(output.contains(".rs"));
assert!(output.contains(".toml"));
}
+4 -4
View File
@@ -691,25 +691,25 @@ enum GitCommands {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Add files → "ok ✓"
/// Add files → "ok"
Add {
/// Files and flags to add (supports all git add flags like -A, -p, --all, etc)
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Commit → "ok ✓ \<hash\>"
/// Commit → "ok \<hash\>"
Commit {
/// Git commit arguments (supports -a, -m, --amend, --allow-empty, etc)
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Push → "ok ✓ \<branch\>"
/// Push → "ok \<branch\>"
Push {
/// Git push arguments (supports -u, remote, branch, etc.)
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Pull → "ok ✓ \<stats\>"
/// Pull → "ok \<stats\>"
Pull {
/// Git pull arguments (supports --rebase, remote, branch, etc.)
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
+5 -5
View File
@@ -125,14 +125,14 @@ fn filter_next_build(output: &str) -> String {
// Build filtered output
let mut result = String::new();
result.push_str("⚡ Next.js Build\n");
result.push_str("Next.js Build\n");
result.push_str("═══════════════════════════════════════\n");
if already_built && routes_total == 0 {
result.push_str("✓ Already built (using cache)\n\n");
result.push_str("Already built (using cache)\n\n");
} else if routes_total > 0 {
result.push_str(&format!(
"✓ {} routes ({} static, {} dynamic)\n\n",
"{} routes ({} static, {} dynamic)\n\n",
routes_total, routes_static, routes_dynamic
));
}
@@ -146,7 +146,7 @@ fn filter_next_build(output: &str) -> String {
for (route, size, pct_change) in bundles.iter().take(10) {
let warning_marker = if let Some(pct) = pct_change {
if *pct > 10.0 {
format!(" ⚠️ (+{:.0}%)", pct)
format!(" [warn] (+{:.0}%)", pct)
} else {
String::new()
}
@@ -219,7 +219,7 @@ Route (app) Size First Load JS
✓ Built in 34.2s
"#;
let result = filter_next_build(output);
assert!(result.contains("⚡ Next.js Build"));
assert!(result.contains("Next.js Build"));
assert!(result.contains("routes"));
assert!(!result.contains("Creating an optimized")); // Should filter verbose logs
}
+2 -2
View File
@@ -160,7 +160,7 @@ fn filter_npm_output(output: &str) -> String {
}
if result.is_empty() {
"ok ✓".to_string()
"ok".to_string()
} else {
result.join("\n")
}
@@ -231,6 +231,6 @@ npm notice
fn test_filter_npm_output_empty() {
let output = "\n\n\n";
let result = filter_npm_output(output);
assert_eq!(result, "ok ✓");
assert_eq!(result, "ok");
}
}
+1 -1
View File
@@ -152,7 +152,7 @@ For build tools (next, webpack, vite, cargo, etc.)
- Human-readable
### Ultra (verbosity=2+)
- Symbols: ✓✗⚠📦⬆️
- Symbols: ✓✗⚠ pkg: ^
- Ultra-compressed
- 30-50% token reduction
+10 -10
View File
@@ -105,7 +105,7 @@ impl TokenFormatter for TestResult {
fn format_ultra(&self) -> String {
format!(
"✓{} ✗{} ⊘{} ({}ms)",
"[ok]{} [x]{} [skip]{} ({}ms)",
self.passed,
self.failed,
self.skipped,
@@ -161,9 +161,9 @@ impl TokenFormatter for LintResult {
lines.push("\nIssues:".to_string());
for issue in self.issues.iter().take(20) {
let severity_symbol = match issue.severity {
LintSeverity::Error => "✗",
LintSeverity::Warning => "⚠",
LintSeverity::Info => "ℹ",
LintSeverity::Error => "[x]",
LintSeverity::Warning => "[!]",
LintSeverity::Info => "[info]",
};
lines.push(format!(
"{} {}:{}:{} [{}] {}",
@@ -186,7 +186,7 @@ impl TokenFormatter for LintResult {
fn format_ultra(&self) -> String {
format!(
"✗{} ⚠{} 📁{}",
"[x]{} [!]{} {}F",
self.errors, self.warnings, self.files_with_issues
)
}
@@ -195,7 +195,7 @@ impl TokenFormatter for LintResult {
impl TokenFormatter for DependencyState {
fn format_compact(&self) -> String {
if self.outdated_count == 0 {
return "All packages up-to-date ✓".to_string();
return "All packages up-to-date".to_string();
}
let mut lines = vec![format!(
@@ -251,13 +251,13 @@ impl TokenFormatter for DependencyState {
}
fn format_ultra(&self) -> String {
format!("📦{} ⬆️{}", self.total_packages, self.outdated_count)
format!("pkg:{} ^{}", self.total_packages, self.outdated_count)
}
}
impl TokenFormatter for BuildOutput {
fn format_compact(&self) -> String {
let status = if self.success { "✓" } else { "✗" };
let status = if self.success { "[ok]" } else { "[x]" };
let mut lines = vec![format!(
"{} Build: {} errors, {} warnings",
status, self.errors, self.warnings
@@ -324,9 +324,9 @@ impl TokenFormatter for BuildOutput {
}
fn format_ultra(&self) -> String {
let status = if self.success { "✓" } else { "✗" };
let status = if self.success { "[ok]" } else { "[x]" };
format!(
"{} ✗{} ⚠{} ({}ms)",
"{} [x]{} [!]{} ({}ms)",
status,
self.errors,
self.warnings,
+2 -3
View File
@@ -206,7 +206,7 @@ fn filter_pip_outdated(output: &str) -> String {
};
if packages.is_empty() {
return "✓ pip outdated: All packages up to date".to_string();
return "pip outdated: All packages up to date".to_string();
}
let mut result = String::new();
@@ -228,7 +228,7 @@ fn filter_pip_outdated(output: &str) -> String {
result.push_str(&format!("\n... +{} more packages\n", packages.len() - 20));
}
result.push_str("\n💡 Run `pip install --upgrade <package>` to update\n");
result.push_str("\n[hint] Run `pip install --upgrade <package>` to update\n");
result.trim().to_string()
}
@@ -263,7 +263,6 @@ mod tests {
fn test_filter_pip_outdated_none() {
let output = "[]";
let result = filter_pip_outdated(output);
assert!(result.contains("✓"));
assert!(result.contains("All packages up to date"));
}
+2 -2
View File
@@ -389,7 +389,7 @@ fn run_outdated(args: &[String], verbose: u8) -> Result<()> {
};
if filtered.trim().is_empty() {
println!("All packages up-to-date ✓");
println!("All packages up-to-date");
} else {
println!("{}", filtered);
}
@@ -484,7 +484,7 @@ fn filter_pnpm_install(output: &str) -> String {
}
if result.is_empty() {
"ok ✓".to_string()
"ok".to_string()
} else {
result.join("\n")
}
+5 -5
View File
@@ -112,7 +112,7 @@ pub fn filter_prettier_output(output: &str) -> String {
// Check if all files are formatted
if files_to_format.is_empty() && output.contains("All matched files use Prettier") {
return "✓ Prettier: All files formatted correctly".to_string();
return "Prettier: All files formatted correctly".to_string();
}
// Check if files were written (write mode)
@@ -125,7 +125,7 @@ pub fn filter_prettier_output(output: &str) -> String {
if is_check_mode {
// Check mode: show files that need formatting
if files_to_format.is_empty() {
result.push_str("✓ Prettier: All files formatted correctly\n");
result.push_str("Prettier: All files formatted correctly\n");
} else {
result.push_str(&format!(
"Prettier: {} files need formatting\n",
@@ -146,7 +146,7 @@ pub fn filter_prettier_output(output: &str) -> String {
if files_checked > 0 {
result.push_str(&format!(
"\n✓ {} files already formatted\n",
"\n{} files already formatted\n",
files_checked - files_to_format.len()
));
}
@@ -154,7 +154,7 @@ pub fn filter_prettier_output(output: &str) -> String {
} else {
// Write mode: show what was formatted
result.push_str(&format!(
"✓ Prettier: {} files formatted\n",
"Prettier: {} files formatted\n",
files_to_format.len()
));
}
@@ -173,7 +173,7 @@ Checking formatting...
All matched files use Prettier code style!
"#;
let result = filter_prettier_output(output);
assert!(result.contains("✓ Prettier"));
assert!(result.contains("Prettier"));
assert!(result.contains("All files formatted correctly"));
}
+8 -8
View File
@@ -221,7 +221,7 @@ fn filter_prisma_generate(output: &str) -> String {
}
let mut result = String::new();
result.push_str("✓ Prisma Client generated\n");
result.push_str("Prisma Client generated\n");
if models > 0 || enums > 0 || types > 0 {
result.push_str(&format!(
@@ -283,7 +283,7 @@ fn filter_migrate_dev(output: &str) -> String {
let mut result = String::new();
if !migration_name.is_empty() {
result.push_str(&format!("🗃️ Migration: {}\n", migration_name));
result.push_str(&format!("Migration: {}\n", migration_name));
result.push_str("═══════════════════════════════════════\n");
}
@@ -303,7 +303,7 @@ fn filter_migrate_dev(output: &str) -> String {
result.push('\n');
if applied {
result.push_str("✓ Applied | Pending: 0\n");
result.push_str("Applied | Pending: 0\n");
}
result.trim().to_string()
@@ -360,9 +360,9 @@ fn filter_migrate_deploy(output: &str) -> String {
let mut result = String::new();
if errors.is_empty() {
result.push_str(&format!("✓ {} migration(s) deployed\n", deployed));
result.push_str(&format!("{} migration(s) deployed\n", deployed));
} else {
result.push_str("❌ Deployment failed:\n");
result.push_str("[FAIL] Deployment failed:\n");
for err in errors.iter().take(5) {
result.push_str(&format!(" {}\n", err));
}
@@ -390,7 +390,7 @@ fn filter_db_push(output: &str) -> String {
}
let mut result = String::new();
result.push_str("✓ Schema pushed to database\n");
result.push_str("Schema pushed to database\n");
if tables_added > 0 || columns_modified > 0 || dropped > 0 {
result.push_str(&format!(
@@ -460,7 +460,7 @@ import { PrismaClient } from '@prisma/client'
42 models, 18 enums, 890 types generated
"#;
let result = filter_prisma_generate(output);
assert!(result.contains("✓ Prisma Client generated"));
assert!(result.contains("Prisma Client generated"));
// Parser may not extract exact counts from this format, just check it doesn't crash
assert!(!result.contains("Prisma schema loaded"));
assert!(!result.contains("Start by importing"));
@@ -484,7 +484,7 @@ CREATE INDEX "session_status_idx" ON "Session"("status");
let result = filter_migrate_dev(output);
assert!(result.contains("20260128_add_sessions"));
assert!(result.contains("+ 1 table"));
assert!(result.contains("✓ Applied"));
assert!(result.contains("Applied"));
}
#[test]
+4 -4
View File
@@ -167,7 +167,7 @@ fn build_pytest_summary(summary: &str, _test_files: &[String], failures: &[Strin
let (passed, failed, skipped) = parse_summary_line(summary);
if failed == 0 && passed > 0 {
return format!("✓ Pytest: {} passed", passed);
return format!("Pytest: {} passed", passed);
}
if passed == 0 && failed == 0 {
@@ -198,13 +198,13 @@ fn build_pytest_summary(summary: &str, _test_files: &[String], failures: &[Strin
if first_line.starts_with("___") {
// Extract test name between ___
let test_name = first_line.trim_matches('_').trim();
result.push_str(&format!("{}. ❌ {}\n", i + 1, test_name));
result.push_str(&format!("{}. [FAIL] {}\n", i + 1, test_name));
} else if first_line.starts_with("FAILED") {
// Summary format: "FAILED tests/test_foo.py::test_bar - AssertionError"
let parts: Vec<&str> = first_line.split(" - ").collect();
if let Some(test_path) = parts.first() {
let test_name = test_path.trim_start_matches("FAILED ");
result.push_str(&format!("{}. ❌ {}\n", i + 1, test_name));
result.push_str(&format!("{}. [FAIL] {}\n", i + 1, test_name));
}
if parts.len() > 1 {
result.push_str(&format!(" {}\n", truncate(parts[1], 100)));
@@ -288,7 +288,7 @@ tests/test_foo.py ..... [100%]
=== 5 passed in 0.50s ==="#;
let result = filter_pytest_output(output);
assert!(result.contains("✓ Pytest"));
assert!(result.contains("Pytest"));
assert!(result.contains("5 passed"));
}
+8 -8
View File
@@ -132,7 +132,7 @@ pub fn filter_ruff_check_json(output: &str) -> String {
};
if diagnostics.is_empty() {
return "✓ Ruff: No issues found".to_string();
return "Ruff: No issues found".to_string();
}
let total_issues = diagnostics.len();
@@ -209,7 +209,7 @@ pub fn filter_ruff_check_json(output: &str) -> String {
if fixable_count > 0 {
result.push_str(&format!(
"\n💡 Run `ruff check --fix` to auto-fix {} issues\n",
"\n[hint] Run `ruff check --fix` to auto-fix {} issues\n",
fixable_count
));
}
@@ -262,7 +262,7 @@ pub fn filter_ruff_format(output: &str) -> String {
// Check if all files are formatted
if files_to_format.is_empty() && output_lower.contains("left unchanged") {
return "✓ Ruff format: All files formatted correctly".to_string();
return "Ruff format: All files formatted correctly".to_string();
}
let mut result = String::new();
@@ -270,7 +270,7 @@ pub fn filter_ruff_format(output: &str) -> String {
if output_lower.contains("would reformat") {
// Check mode: show files that need formatting
if files_to_format.is_empty() {
result.push_str("✓ Ruff format: All files formatted correctly\n");
result.push_str("Ruff format: All files formatted correctly\n");
} else {
result.push_str(&format!(
"Ruff format: {} files need formatting\n",
@@ -290,10 +290,10 @@ pub fn filter_ruff_format(output: &str) -> String {
}
if files_checked > 0 {
result.push_str(&format!("\n✓ {} files already formatted\n", files_checked));
result.push_str(&format!("\n{} files already formatted\n", files_checked));
}
result.push_str("\n💡 Run `ruff format` to format these files\n");
result.push_str("\n[hint] Run `ruff format` to format these files\n");
}
} else {
// Write mode or other output - show summary
@@ -328,7 +328,7 @@ mod tests {
fn test_filter_ruff_check_no_issues() {
let output = "[]";
let result = filter_ruff_check_json(output);
assert!(result.contains("✓ Ruff"));
assert!(result.contains("Ruff"));
assert!(result.contains("No issues found"));
}
@@ -374,7 +374,7 @@ mod tests {
fn test_filter_ruff_format_all_formatted() {
let output = "5 files left unchanged";
let result = filter_ruff_format(output);
assert!(result.contains("✓ Ruff format"));
assert!(result.contains("Ruff format"));
assert!(result.contains("All files formatted correctly"));
}
+5 -5
View File
@@ -34,10 +34,10 @@ pub fn run_err(command: &str, verbose: u8) -> Result<()> {
if filtered.is_empty() {
if output.status.success() {
rtk.push_str("✅ Command completed successfully (no errors)");
rtk.push_str("[ok] Command completed successfully (no errors)");
} else {
rtk.push_str(&format!(
"❌ Command failed (exit code: {:?})\n",
"[FAIL] Command failed (exit code: {:?})\n",
output.status.code()
));
let lines: Vec<&str> = raw.lines().collect();
@@ -228,7 +228,7 @@ fn extract_test_summary(output: &str, command: &str) -> String {
let mut output = String::new();
if !failures.is_empty() {
output.push_str("❌ FAILURES:\n");
output.push_str("[FAIL] FAILURES:\n");
for f in failures.iter().take(10) {
output.push_str(&format!(" {}\n", f));
}
@@ -239,13 +239,13 @@ fn extract_test_summary(output: &str, command: &str) -> String {
}
if !result.is_empty() {
output.push_str("📊 SUMMARY:\n");
output.push_str("SUMMARY:\n");
for r in &result {
output.push_str(&format!(" {}\n", r));
}
} else {
// Fallback: show last few lines
output.push_str("📊 OUTPUT (last 5 lines):\n");
output.push_str("OUTPUT (last 5 lines):\n");
let start = lines.len().saturating_sub(5);
for line in &lines[start..] {
if !line.trim().is_empty() {
+18 -18
View File
@@ -42,7 +42,7 @@ fn summarize_output(output: &str, command: &str, success: bool) -> String {
let mut result = Vec::new();
// Status
let status_icon = if success { "✅" } else { "❌" };
let status_icon = if success { "[ok]" } else { "[FAIL]" };
result.push(format!(
"{} Command: {}",
status_icon,
@@ -109,7 +109,7 @@ fn detect_output_type(output: &str, command: &str) -> OutputType {
}
fn summarize_tests(output: &str, result: &mut Vec<String>) {
result.push("📋 Test Results:".to_string());
result.push("Test Results:".to_string());
let mut passed = 0;
let mut failed = 0;
@@ -126,7 +126,7 @@ fn summarize_tests(output: &str, result: &mut Vec<String>) {
passed += 1;
}
}
if lower.contains("failed") || lower.contains("✗") || lower.contains("fail") {
if lower.contains("failed") || lower.contains("[x]") || lower.contains("fail") {
if let Some(n) = extract_number(&lower, "failed") {
failed = n;
}
@@ -142,12 +142,12 @@ fn summarize_tests(output: &str, result: &mut Vec<String>) {
}
}
result.push(format!(" ✅ {} passed", passed));
result.push(format!(" [ok] {} passed", passed));
if failed > 0 {
result.push(format!(" ❌ {} failed", failed));
result.push(format!(" [FAIL] {} failed", failed));
}
if skipped > 0 {
result.push(format!(" ⏭️ {} skipped", skipped));
result.push(format!(" skip {} skipped", skipped));
}
if !failures.is_empty() {
@@ -160,7 +160,7 @@ fn summarize_tests(output: &str, result: &mut Vec<String>) {
}
fn summarize_build(output: &str, result: &mut Vec<String>) {
result.push("🔨 Build Summary:".to_string());
result.push("Build Summary:".to_string());
let mut errors = 0;
let mut warnings = 0;
@@ -184,16 +184,16 @@ fn summarize_build(output: &str, result: &mut Vec<String>) {
}
if compiled > 0 {
result.push(format!(" 📦 {} crates/files compiled", compiled));
result.push(format!(" {} crates/files compiled", compiled));
}
if errors > 0 {
result.push(format!(" ❌ {} errors", errors));
result.push(format!(" [error] {} errors", errors));
}
if warnings > 0 {
result.push(format!(" ⚠️ {} warnings", warnings));
result.push(format!(" [warn] {} warnings", warnings));
}
if errors == 0 && warnings == 0 {
result.push(" ✅ Build successful".to_string());
result.push(" [ok] Build successful".to_string());
}
if !error_msgs.is_empty() {
@@ -206,7 +206,7 @@ fn summarize_build(output: &str, result: &mut Vec<String>) {
}
fn summarize_logs_quick(output: &str, result: &mut Vec<String>) {
result.push("📝 Log Summary:".to_string());
result.push("Log Summary:".to_string());
let mut errors = 0;
let mut warnings = 0;
@@ -223,14 +223,14 @@ fn summarize_logs_quick(output: &str, result: &mut Vec<String>) {
}
}
result.push(format!(" ❌ {} errors", errors));
result.push(format!(" ⚠️ {} warnings", warnings));
result.push(format!(" ℹ️ {} info", info));
result.push(format!(" [error] {} errors", errors));
result.push(format!(" [warn] {} warnings", warnings));
result.push(format!(" [info] {} info", info));
}
fn summarize_list(output: &str, result: &mut Vec<String>) {
let lines: Vec<&str> = output.lines().filter(|l| !l.trim().is_empty()).collect();
result.push(format!("📋 List ({} items):", lines.len()));
result.push(format!("List ({} items):", lines.len()));
for line in lines.iter().take(10) {
result.push(format!(" • {}", truncate(line, 70)));
@@ -241,7 +241,7 @@ fn summarize_list(output: &str, result: &mut Vec<String>) {
}
fn summarize_json(output: &str, result: &mut Vec<String>) {
result.push("📋 JSON Output:".to_string());
result.push("JSON Output:".to_string());
// Try to parse and show structure
if let Ok(value) = serde_json::from_str::<serde_json::Value>(output) {
@@ -270,7 +270,7 @@ fn summarize_json(output: &str, result: &mut Vec<String>) {
fn summarize_generic(output: &str, result: &mut Vec<String>) {
let lines: Vec<&str> = output.lines().collect();
result.push("📋 Output:".to_string());
result.push("Output:".to_string());
// First few lines
for line in lines.iter().take(5) {
+3 -3
View File
@@ -268,13 +268,13 @@ fn print_risk_summary(content: &str) {
println!(" Filters: {}", filter_count);
if has_replace {
println!(" ⚠ Contains 'replace' rules (can rewrite output)");
println!(" [!] Contains 'replace' rules (can rewrite output)");
}
if has_match_output {
println!(" ⚠ Contains 'match_output' rules (can replace entire output)");
println!(" [!] Contains 'match_output' rules (can replace entire output)");
}
if has_dot_pattern {
println!(" ⚠ Contains catch-all pattern '.' (matches everything)");
println!(" [!] Contains catch-all pattern '.' (matches everything)");
}
if !has_replace && !has_match_output && !has_dot_pattern {
println!(" No high-risk patterns detected.");
+1 -1
View File
@@ -109,7 +109,7 @@ fn filter_tsc_output(output: &str) -> String {
if errors.is_empty() {
if output.contains("Found 0 errors") {
return "✓ TypeScript: No errors found".to_string();
return "TypeScript: No errors found".to_string();
}
return "TypeScript compilation completed".to_string();
}
+1 -1
View File
@@ -182,7 +182,7 @@ fn extract_failures_regex(output: &str) -> Vec<TestFailure> {
while i < lines.len() {
let line = lines[i];
if line.contains('✗') || line.contains("FAIL") {
if line.contains("[x]") || line.contains("FAIL") {
let mut error_lines = vec![line.to_string()];
i += 1;
+11 -21
View File
@@ -33,7 +33,7 @@ pub fn run(url: &str, args: &[String], verbose: u8) -> Result<()> {
let filename = extract_filename_from_output(&stderr, url, args);
let size = get_file_size(&filename);
let msg = format!(
"⬇️ {} ok | {} | {}",
"{} ok | {} | {}",
compact_url(url),
filename,
format_size(size)
@@ -41,15 +41,10 @@ pub fn run(url: &str, args: &[String], verbose: u8) -> Result<()> {
println!("{}", msg);
timer.track(&format!("wget {}", url), "rtk wget", &raw_output, &msg);
} else {
if !stderr.trim().is_empty() {
eprint!("{}", stderr);
}
timer.track(
&format!("wget {}", url),
"rtk wget",
&raw_output,
&raw_output,
);
let error = parse_error(&stderr, &stdout);
let msg = format!("{} FAILED: {}", compact_url(url), error);
println!("{}", msg);
timer.track(&format!("wget {}", url), "rtk wget", &raw_output, &msg);
std::process::exit(output.status.code().unwrap_or(1));
}
@@ -84,7 +79,7 @@ pub fn run_stdout(url: &str, args: &[String], verbose: u8) -> Result<()> {
let mut rtk_output = String::new();
if total > 20 {
rtk_output.push_str(&format!(
"⬇️ {} ok | {} lines | {}\n",
"{} ok | {} lines | {}\n",
compact_url(url),
total,
format_size(output.stdout.len() as u64)
@@ -95,7 +90,7 @@ pub fn run_stdout(url: &str, args: &[String], verbose: u8) -> Result<()> {
}
rtk_output.push_str(&format!("... +{} more lines", total - 10));
} else {
rtk_output.push_str(&format!("⬇️ {} ok | {} lines\n", compact_url(url), total));
rtk_output.push_str(&format!("{} ok | {} lines\n", compact_url(url), total));
for line in &lines {
rtk_output.push_str(&format!("{}\n", line));
}
@@ -109,15 +104,10 @@ pub fn run_stdout(url: &str, args: &[String], verbose: u8) -> Result<()> {
);
} else {
let stderr = String::from_utf8_lossy(&output.stderr);
if !stderr.trim().is_empty() {
eprint!("{}", stderr);
}
timer.track(
&format!("wget -O - {}", url),
"rtk wget -o",
&stderr,
&stderr,
);
let error = parse_error(&stderr, "");
let msg = format!("{} FAILED: {}", compact_url(url), error);
println!("{}", msg);
timer.track(&format!("wget -O - {}", url), "rtk wget -o", &stderr, &msg);
std::process::exit(output.status.code().unwrap_or(1));
}