mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-26 01:34:51 +08:00
feat(omp): fix ci errors
This commit is contained in:
1 parent
41065ff32d
commit
50c3cec1d4
8 files changed
+80
-22
No files matched your search
@@ -945,7 +945,9 @@ impl MultiAppConfig {
|
||||
// Pi was added after prompts moved to SQLite. Keeping it out of
|
||||
// this legacy config avoids a second, unused prompt state.
|
||||
// OhMyPi likewise stores prompts in its native agent config.
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => return Ok(false),
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
return Ok(false)
|
||||
}
|
||||
};
|
||||
|
||||
prompts.insert(id, prompt);
|
||||
@@ -989,7 +991,9 @@ impl MultiAppConfig {
|
||||
AppType::OpenCode => &self.mcp.opencode.servers,
|
||||
AppType::OpenClaw => continue, // OpenClaw MCP is still in development, skip
|
||||
AppType::Hermes => continue, // Hermes didn't exist in v3.6.x, skip
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => continue, // Pi didn't exist in v3.6.x, skip
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
continue
|
||||
} // Pi didn't exist in v3.6.x, skip
|
||||
};
|
||||
|
||||
for (id, entry) in old_servers {
|
||||
|
||||
@@ -215,7 +215,9 @@ impl ProviderType {
|
||||
}
|
||||
AppType::GrokBuild => ProviderType::Codex,
|
||||
AppType::OpenCode | AppType::OpenClaw | AppType::Hermes => ProviderType::Codex,
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => return None,
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
return None
|
||||
}
|
||||
};
|
||||
Some(provider_type)
|
||||
}
|
||||
@@ -271,7 +273,9 @@ pub fn get_adapter(app_type: &AppType) -> Option<Box<dyn ProviderAdapter>> {
|
||||
AppType::Gemini => Box::new(GeminiAdapter::new()),
|
||||
AppType::GrokBuild => Box::new(CodexAdapter::new()),
|
||||
AppType::OpenCode | AppType::OpenClaw | AppType::Hermes => Box::new(CodexAdapter::new()),
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => return None,
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
return None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,10 @@ impl McpService {
|
||||
app: AppType,
|
||||
enabled: bool,
|
||||
) -> Result<(), AppError> {
|
||||
if matches!(app, AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi
|
||||
) {
|
||||
if let Some(server) = state.db.get_all_mcp_servers()?.get(server_id) {
|
||||
let spec = enabled.then_some(&server.server);
|
||||
let commit = || {
|
||||
@@ -267,7 +270,10 @@ impl McpService {
|
||||
/// 将 MCP 服务器同步到所有启用的应用
|
||||
fn sync_server_to_apps(_state: &AppState, server: &McpServer) -> Result<(), AppError> {
|
||||
for app in server.apps.enabled_apps() {
|
||||
if matches!(app, AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi
|
||||
) {
|
||||
continue; // Already written before saving the managed state.
|
||||
}
|
||||
Self::sync_server_to_app_no_config(server, &app)?;
|
||||
@@ -339,7 +345,10 @@ impl McpService {
|
||||
) -> Result<(), AppError> {
|
||||
// 从所有曾启用的应用中移除
|
||||
for app in server.apps.enabled_apps() {
|
||||
if matches!(app, AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi
|
||||
) {
|
||||
continue; // Already removed before deleting the managed record.
|
||||
}
|
||||
Self::remove_server_from_app(state, id, &app)?;
|
||||
@@ -476,7 +485,10 @@ impl McpService {
|
||||
for server in servers.values() {
|
||||
let result = if server.apps.is_enabled_for(app) {
|
||||
Self::sync_server_to_app(state, server, app)
|
||||
} else if !matches!(app, AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi) {
|
||||
} else if !matches!(
|
||||
app,
|
||||
AppType::Mcode | AppType::Kimi | AppType::Pi | AppType::Agy | AppType::OhMyPi
|
||||
) {
|
||||
Self::remove_server_from_app(state, &server.id, app)
|
||||
} else {
|
||||
// MCode / Pi's false flag also covers pre-existing, unmanaged servers.
|
||||
|
||||
@@ -853,7 +853,10 @@ pub fn sync_current_to_live(state: &AppState) -> Result<(), AppError> {
|
||||
|
||||
// Sync providers based on mode
|
||||
for app_type in AppType::all() {
|
||||
if matches!(app_type, AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app_type,
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::OhMyPi
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
let result = if app_type.is_additive_mode() {
|
||||
|
||||
@@ -7169,7 +7169,9 @@ impl ProviderService {
|
||||
AppType::OpenCode => Self::extract_opencode_common_config(&provider.settings_config),
|
||||
AppType::OpenClaw => Self::extract_openclaw_common_config(&provider.settings_config),
|
||||
AppType::Hermes => Ok(String::new()), // Hermes doesn't use common config snippets
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => Ok(String::new()),
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7187,7 +7189,9 @@ impl ProviderService {
|
||||
AppType::OpenCode => Self::extract_opencode_common_config(settings_config),
|
||||
AppType::OpenClaw => Self::extract_openclaw_common_config(settings_config),
|
||||
AppType::Hermes => Ok(String::new()), // Hermes doesn't use common config snippets
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => Ok(String::new()),
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::Agy | AppType::OhMyPi => {
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1135,7 +1135,6 @@ impl SkillService {
|
||||
.context("Managed Skill could not be removed; uninstall cancelled")?;
|
||||
}
|
||||
|
||||
|
||||
// Pi 目录可能包含用户自己维护的同名 Skill。删除 SSOT 前仅移除
|
||||
// 能验证为 CC Switch 部署的副本;其余路径保留并返回警告。
|
||||
if let Some(destination) = pi_removal_path {
|
||||
@@ -1152,7 +1151,14 @@ impl SkillService {
|
||||
|
||||
// 其他应用沿用既有的逐项容错行为。
|
||||
for app in AppType::all() {
|
||||
if matches!(app, AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Pi
|
||||
| AppType::Mcode
|
||||
| AppType::Agy
|
||||
| AppType::Kimi
|
||||
| AppType::OhMyPi
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
let _ = Self::remove_from_app_preserving(
|
||||
@@ -1618,7 +1624,13 @@ impl SkillService {
|
||||
|
||||
let dest = ssot_dir.join(&skill.directory);
|
||||
let mut deployments = Vec::new();
|
||||
for app in [AppType::Pi, AppType::Mcode, AppType::Agy, AppType::Kimi, AppType::OhMyPi] {
|
||||
for app in [
|
||||
AppType::Pi,
|
||||
AppType::Mcode,
|
||||
AppType::Agy,
|
||||
AppType::Kimi,
|
||||
AppType::OhMyPi,
|
||||
] {
|
||||
if skill.apps.is_enabled_for(&app) {
|
||||
let destination =
|
||||
Self::get_distinct_app_skills_dir(&ssot_dir, &app)?.join(&skill.directory);
|
||||
@@ -1709,7 +1721,10 @@ impl SkillService {
|
||||
|
||||
// 同步到所有已启用的应用目录
|
||||
for app in updated_skill.apps.enabled_apps() {
|
||||
if matches!(app, AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if let Err(e) = Self::sync_to_app_dir(&updated_skill.directory, &app) {
|
||||
@@ -2526,7 +2541,10 @@ impl SkillService {
|
||||
fn preflight_install_destination(source: &Path, directory: &str, app: &AppType) -> Result<()> {
|
||||
let ssot_dir = Self::get_ssot_dir()?;
|
||||
let app_dir = Self::get_distinct_app_skills_dir(&ssot_dir, app)?;
|
||||
if !matches!(app, AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi) {
|
||||
if !matches!(
|
||||
app,
|
||||
AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi
|
||||
) {
|
||||
return Ok(());
|
||||
}
|
||||
let destination = app_dir.join(directory);
|
||||
@@ -2700,8 +2718,10 @@ impl SkillService {
|
||||
|
||||
let dest = app_dir.join(&directory);
|
||||
|
||||
if matches!(app, AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi)
|
||||
&& (dest.exists() || Self::is_symlink(&dest))
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi
|
||||
) && (dest.exists() || Self::is_symlink(&dest))
|
||||
{
|
||||
Self::ensure_pi_skill_destination_matches(&source, &dest, &directory)?;
|
||||
}
|
||||
@@ -2898,7 +2918,10 @@ impl SkillService {
|
||||
}
|
||||
|
||||
if skill_path.exists() || Self::is_symlink(&skill_path) {
|
||||
if matches!(app, AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi) {
|
||||
if matches!(
|
||||
app,
|
||||
AppType::Pi | AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi
|
||||
) {
|
||||
let source = ssot_dir.join(&directory);
|
||||
Self::ensure_pi_skill_destination_matches(&source, &skill_path, &directory)?;
|
||||
}
|
||||
@@ -2969,7 +2992,12 @@ impl SkillService {
|
||||
|
||||
// Unselected MCode, Agy and Kimi directories may have been installed outside CC Switch.
|
||||
// Explicit disable/uninstall handles removal of managed deployments.
|
||||
if app_dir.exists() && !matches!(app, AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi) {
|
||||
if app_dir.exists()
|
||||
&& !matches!(
|
||||
app,
|
||||
AppType::Mcode | AppType::Agy | AppType::Kimi | AppType::OhMyPi
|
||||
)
|
||||
{
|
||||
for entry in fs::read_dir(&app_dir)? {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
|
||||
@@ -1362,7 +1362,7 @@ pub fn get_current_provider(app_type: &AppType) -> Option<String> {
|
||||
AppType::OpenClaw => settings.current_provider_openclaw.clone(),
|
||||
AppType::Hermes => settings.current_provider_hermes.clone(),
|
||||
AppType::Agy => settings.current_provider_agy.clone(),
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::OhMyPi => None,
|
||||
AppType::Pi | AppType::Mcode | AppType::Kimi | AppType::OhMyPi => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ export function ProviderEmptyState({
|
||||
// live 节点里),没有可导入的内容,列表也不提供导入按钮,因此不能沿用
|
||||
// "请点击导入当前配置"的通用文案。
|
||||
const emptyCopyNs =
|
||||
appId === "pi" || appId === "mcode" || appId === "kimi" || appId === "ohmypi"
|
||||
appId === "pi" ||
|
||||
appId === "mcode" ||
|
||||
appId === "kimi" ||
|
||||
appId === "ohmypi"
|
||||
? appId
|
||||
: null;
|
||||
// Antigravity 没有切换,这句「切换只替换关键字段」对它不成立
|
||||
|
||||
Reference in new issue
Block a user