Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
52 lines
1.5 KiB
Rust
52 lines
1.5 KiB
Rust
//! Platform identity and its path convention, independent of the resolving host.
|
|
|
|
use crate::PathConvention;
|
|
|
|
/// Operating system whose paths and execution configuration are being resolved.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum Platform {
|
|
Linux,
|
|
Macos,
|
|
Windows,
|
|
/// Missing or unrecognized platform metadata carries no path convention.
|
|
Unknown,
|
|
}
|
|
|
|
impl Platform {
|
|
/// Read platform metadata without substituting the current host's platform.
|
|
pub fn from_platform_os(platform_os: Option<&str>) -> Self {
|
|
match platform_os {
|
|
Some("linux") => Self::Linux,
|
|
Some("macos") => Self::Macos,
|
|
Some("windows") => Self::Windows,
|
|
Some(_) | None => Self::Unknown,
|
|
}
|
|
}
|
|
|
|
/// Return the platform of the current process.
|
|
pub const fn native() -> Self {
|
|
if cfg!(target_os = "linux") {
|
|
Self::Linux
|
|
} else if cfg!(target_os = "macos") {
|
|
Self::Macos
|
|
} else if cfg!(target_os = "windows") {
|
|
Self::Windows
|
|
} else {
|
|
Self::Unknown
|
|
}
|
|
}
|
|
|
|
/// Derive path grammar from platform identity while preserving unknown metadata.
|
|
pub const fn path_convention(self) -> Option<PathConvention> {
|
|
match self {
|
|
Self::Linux | Self::Macos => Some(PathConvention::Posix),
|
|
Self::Windows => Some(PathConvention::Windows),
|
|
Self::Unknown => None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "platform_tests.rs"]
|
|
mod tests;
|