mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat(tool-search): expand dynamic group activation
This commit is contained in:
@@ -59,6 +59,48 @@ select_updated_bundle_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
migrate_tool_search_settings() {
|
||||
settings_file=${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}/settings.json
|
||||
if [ ! -e "$settings_file" ]; then
|
||||
say "- Pi settings.json 尚不存在;Tool Search 将在下次加载时写入当前默认值。"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${updated_bundle_dir:-}" ] || [ ! -f "$updated_bundle_dir/scripts/migrate-tool-search-settings.mjs" ]; then
|
||||
warn "无法定位升级后组合包中的 Tool Search settings.json 迁移辅助脚本,已保留现有配置。"
|
||||
return 1
|
||||
fi
|
||||
migration_helper=$updated_bundle_dir/scripts/migrate-tool-search-settings.mjs
|
||||
if ! command -v node >/dev/null 2>&1; then
|
||||
warn "迁移 Tool Search settings.json 需要 Node.js,已保留现有配置。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
migration_result=$(node "$migration_helper" "$settings_file") || return 1
|
||||
case $migration_result in
|
||||
migrated:*)
|
||||
say "✓ Tool Search 旧版默认配置已迁移到 5 个动态组 / 28 个动态工具。"
|
||||
say " 原配置备份:${migration_result#migrated:}"
|
||||
;;
|
||||
current)
|
||||
say "✓ Tool Search 用户配置已是当前组合包默认版本。"
|
||||
;;
|
||||
custom)
|
||||
say "- 检测到自定义 Tool Search 用户配置,已完整保留。"
|
||||
;;
|
||||
missing-section)
|
||||
say "- settings.json 尚未包含 Tool Search 配置;下次加载时将补充当前默认值。"
|
||||
;;
|
||||
missing)
|
||||
say "- settings.json 在迁移前已被移除;下次加载时将写入当前默认值。"
|
||||
;;
|
||||
*)
|
||||
warn "Tool Search settings.json 迁移返回未知状态,已停止该项同步。"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
resolve_zsh_paths() {
|
||||
oh_my_zsh_dir=${ZSH:-$HOME/.oh-my-zsh}
|
||||
zsh_custom_dir=${ZSH_CUSTOM:-$oh_my_zsh_dir/custom}
|
||||
@@ -393,6 +435,7 @@ if ! pi update "$PACKAGE_SOURCE"; then
|
||||
exit 1
|
||||
fi
|
||||
select_updated_bundle_config || exit 1
|
||||
migrate_tool_search_settings || record_update_failure "Tool Search 用户配置"
|
||||
|
||||
say "组合包升级完成,开始升级已安装的终端环境和机器级 CLI;未安装项将直接跳过。"
|
||||
update_kitty || record_update_failure "Kitty"
|
||||
|
||||
Reference in New Issue
Block a user