chore: wave-0 baseline (Tauri2+React shell, platform detect, fake catalog)
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
//! 平台环境数据结构(对齐架构 §5 `PlatformEnv`)
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// 平台环境快照
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
pub struct PlatformEnv {
|
||||
/// os: windows | linux
|
||||
pub os: String,
|
||||
/// 人类可读的系统版本(如 "Windows 11 24H2 (Build 26100)" / "Ubuntu 24.04 LTS")
|
||||
pub os_version: String,
|
||||
/// 架构(std::env::consts::ARCH,如 x86_64)
|
||||
pub arch: String,
|
||||
pub shells: Shells,
|
||||
pub runtimes: Runtimes,
|
||||
/// PATH 条目(Windows 用 ';' 分割,Linux 用 ':')
|
||||
pub path_entries: Vec<String>,
|
||||
pub capabilities: Capabilities,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
pub struct Shells {
|
||||
/// Windows PowerShell(5.x)版本
|
||||
pub powershell_version: Option<String>,
|
||||
/// PowerShell 7+(pwsh)版本
|
||||
pub pwsh_version: Option<String>,
|
||||
pub bash_available: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
pub struct Runtimes {
|
||||
pub node: Option<RuntimeInfo>,
|
||||
pub npm: Option<RuntimeInfo>,
|
||||
pub python: Option<RuntimeInfo>,
|
||||
pub uv: Option<RuntimeInfo>,
|
||||
pub git: Option<RuntimeInfo>,
|
||||
pub winget: Option<RuntimeInfo>,
|
||||
pub apt: Option<RuntimeInfo>,
|
||||
}
|
||||
|
||||
/// 单个运行时探测结果
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
pub struct RuntimeInfo {
|
||||
/// installed | not_installed | not_in_path | exec_failed | version_unparseable
|
||||
pub status: String,
|
||||
pub version: Option<String>,
|
||||
/// 解析到的可执行文件绝对路径(PATH 搜索)
|
||||
pub path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
|
||||
pub struct Capabilities {
|
||||
/// ok | missing(Linux 依赖 secret-tool / DBus Secret Service)
|
||||
pub keyring: String,
|
||||
pub can_elevate: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user