Expand description
AI CLI detection.
Scans PATH for known AI coding CLI binaries and merges with custom CLIs from the user’s configuration. Provides the combined list for interactive selection or direct use.
§Thread-Safe Architecture
This module uses a thread-safe approach for PATH-based command resolution:
-
No Global Environment Mutation: Unlike the previous implementation that used
unsafe { std::env::set_var("PATH", ...) }, this version never modifies the global environment. -
Process-Isolated PATH: The
resolve_command_infunction and related internal functions usestd::process::Command::env()to set PATH only for individual process executions. This ensures thread safety and allows true parallel test execution. -
Test Parallelization: All tests can run in parallel without
#[serial_test::serial]attributes because there’s no shared mutable state. -
Robust PATH Construction: When testing with custom PATH directories, the implementation automatically includes system paths (
/usr/bin:/bin:/usr/local/bin) to ensure thewhichcommand itself can be found.
Structs§
- CliInfo
- Information about an available AI CLI.
- Custom
CliDef - A custom CLI definition provided by the user’s configuration.
Enums§
- CliSource
- How a CLI was discovered.
Functions§
- detect_
clis - Detects all available AI CLIs by combining auto-detected and custom CLIs.
- detect_
known_ clis - Scans PATH for known AI CLI binaries.
- resolve_
custom_ clis - Resolves custom CLI definitions to
CliInfoentries.