Refactor CLI, add refresh command, fix port detection, add device tracking
- Remove build/upload/monitor subcommands (projects are self-contained) - Remove ctrlc dependency (only used by removed monitor watch mode) - Update next-steps messaging to reference project scripts directly - Add 'anvil refresh [DIR] [--force]' to update project scripts to latest templates without touching user code - Fix Windows port detection: replace fragile findstr/batch TOML parsing with proper comment-skipping logic; add _detect_port.ps1 helper for reliable JSON-based port detection via PowerShell - Add .anvil.local for machine-specific config (gitignored) - 'anvil devices --set [PORT] [-d DIR]' saves port + VID:PID - 'anvil devices --get [-d DIR]' shows saved port status - VID:PID tracks USB devices across COM port reassignment - Port resolution: -p flag > VID:PID > saved port > auto-detect - Uppercase normalization for Windows COM port names - Update all .bat/.sh templates to read from .anvil.local - Remove port entries from .anvil.toml (no machine-specific config in git) - Add .anvil.local to .gitignore template - Expand 'anvil devices' output with VID:PID, serial number, and usage instructions
This commit is contained in:
@@ -31,6 +31,8 @@ pub struct BuildConfig {
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct MonitorConfig {
|
||||
pub baud: u32,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub port: Option<String>,
|
||||
}
|
||||
|
||||
impl ProjectConfig {
|
||||
@@ -49,6 +51,7 @@ impl ProjectConfig {
|
||||
},
|
||||
monitor: MonitorConfig {
|
||||
baud: 115200,
|
||||
port: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -143,13 +146,6 @@ pub fn anvil_home() -> Result<PathBuf> {
|
||||
Ok(anvil_dir)
|
||||
}
|
||||
|
||||
/// Return the build cache directory (~/.anvil/builds).
|
||||
pub fn build_cache_dir() -> Result<PathBuf> {
|
||||
let dir = anvil_home()?.join("builds");
|
||||
fs::create_dir_all(&dir)?;
|
||||
Ok(dir)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -223,4 +219,4 @@ mod tests {
|
||||
assert!(flags.contains("-Werror"));
|
||||
assert!(flags.contains("-I"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user