Anvil v1.0.0 -- Arduino build tool with HAL and test scaffolding

Single-binary CLI that scaffolds testable Arduino projects, compiles,
uploads, and monitors serial output. Templates embed a hardware
abstraction layer, Google Mock infrastructure, and CMake-based host
tests so application logic can be verified without hardware.

Commands: new, doctor, setup, devices, build, upload, monitor
39 Rust tests (21 unit, 18 integration)
Cross-platform: Linux and Windows
This commit is contained in:
Eric Ratliff
2026-02-15 11:16:17 -06:00
commit 3298844399
41 changed files with 4866 additions and 0 deletions

67
src/commands/devices.rs Normal file
View File

@@ -0,0 +1,67 @@
use anyhow::Result;
use colored::*;
use crate::board;
pub fn scan_devices() -> Result<()> {
println!(
"{}",
"=== Connected Serial Devices ===".bold()
);
println!();
let ports = board::list_ports();
board::print_port_details(&ports);
// Also run arduino-cli board list for cross-reference
if let Some(cli_path) = board::find_arduino_cli() {
println!();
println!(
"{}",
"=== arduino-cli Board Detection ===".bold()
);
println!();
let output = std::process::Command::new(&cli_path)
.args(["board", "list"])
.output();
match output {
Ok(out) if out.status.success() => {
let stdout = String::from_utf8_lossy(&out.stdout);
for line in stdout.lines() {
println!(" {}", line);
}
}
_ => {
eprintln!(
" {}",
"arduino-cli board list failed (is the core installed?)"
.yellow()
);
}
}
} else {
println!();
eprintln!(
" {}",
"arduino-cli not found -- run 'anvil setup' first".yellow()
);
}
println!();
if ports.is_empty() {
println!("{}", "Troubleshooting:".bright_yellow().bold());
println!(" - Try a different USB cable (many are charge-only)");
println!(" - Try a different USB port");
#[cfg(target_os = "linux")]
{
println!(" - Check kernel log: dmesg | tail -20");
println!(" - Check USB bus: lsusb | grep -i -E 'ch34|arduino|1a86|2341'");
}
println!();
}
Ok(())
}