Make import existing side-effect free (#2429)

Co-authored-by: Xvvln <3369759202@qq.com>
This commit is contained in:
ayxwi
2026-04-30 21:59:47 +08:00
committed by GitHub
parent 1c69269405
commit 7965862e66
4 changed files with 161 additions and 23 deletions
+10 -10
View File
@@ -268,8 +268,8 @@ impl McpService {
state.db.save_mcp_server(&to_save)?;
existing.insert(to_save.id.clone(), to_save.clone());
// 同步到对应应用 live 配置
Self::sync_server_to_apps(state, &to_save)?;
// 导入是读取已有配置,不应反向写回任何应用 live 配置
// 显式编辑、启用/禁用或手动同步时再执行写回。
}
}
}
@@ -306,8 +306,8 @@ impl McpService {
state.db.save_mcp_server(&to_save)?;
existing.insert(to_save.id.clone(), to_save.clone());
// 同步到对应应用 live 配置
Self::sync_server_to_apps(state, &to_save)?;
// 导入是读取已有配置,不应反向写回任何应用 live 配置
// 显式编辑、启用/禁用或手动同步时再执行写回。
}
}
}
@@ -344,8 +344,8 @@ impl McpService {
state.db.save_mcp_server(&to_save)?;
existing.insert(to_save.id.clone(), to_save.clone());
// 同步到对应应用 live 配置
Self::sync_server_to_apps(state, &to_save)?;
// 导入是读取已有配置,不应反向写回任何应用 live 配置
// 显式编辑、启用/禁用或手动同步时再执行写回。
}
}
}
@@ -382,8 +382,8 @@ impl McpService {
state.db.save_mcp_server(&to_save)?;
existing.insert(to_save.id.clone(), to_save.clone());
// 同步到对应应用 live 配置
Self::sync_server_to_apps(state, &to_save)?;
// 导入是读取已有配置,不应反向写回任何应用 live 配置
// 显式编辑、启用/禁用或手动同步时再执行写回。
}
}
}
@@ -420,8 +420,8 @@ impl McpService {
state.db.save_mcp_server(&to_save)?;
existing.insert(to_save.id.clone(), to_save.clone());
// 同步到对应应用 live 配置
Self::sync_server_to_apps(state, &to_save)?;
// 导入是读取已有配置,不应反向写回任何应用 live 配置
// 显式编辑、启用/禁用或手动同步时再执行写回。
}
}
}
-13
View File
@@ -1536,19 +1536,6 @@ impl SkillService {
// 保存到数据库
db.save_skill(&skill)?;
// 同步到已启用的应用目录(创建 symlink 或复制文件)
for app in AppType::all() {
if skill.apps.is_enabled_for(&app) {
if let Err(e) = Self::sync_to_app_dir(&skill.directory, &app) {
log::warn!(
"导入后同步 Skill '{}' 到 {:?} 失败: {e:#}",
skill.directory,
app
);
}
}
}
imported.push(skill);
}