mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat: vendor official hippo memory extension
This commit is contained in:
+60
@@ -13,6 +13,7 @@ fi
|
||||
|
||||
PACKAGE_SOURCE=${PI_PACKAGE_SOURCE:-git:git@bitbucket.org:siakitem/my-pi.git}
|
||||
POWERLEVEL10K_PRESET_FILE=$SCRIPT_DIR/config/p10k.zsh
|
||||
HIPPO_MEMORY_VERSION_FILE=$SCRIPT_DIR/config/hippo-memory-version
|
||||
CODEGRAPH_INSTALL_URL=https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh
|
||||
KITTY_INSTALL_URL=https://sw.kovidgoyal.net/kitty/installer.sh
|
||||
OH_MY_ZSH_INSTALL_URL=https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||
@@ -91,6 +92,43 @@ install_codegraph() {
|
||||
command -v codegraph >/dev/null 2>&1
|
||||
}
|
||||
|
||||
read_hippo_memory_version() {
|
||||
if [ ! -f "$HIPPO_MEMORY_VERSION_FILE" ]; then
|
||||
warn "找不到 Hippo Memory 版本文件:$HIPPO_MEMORY_VERSION_FILE"
|
||||
return 1
|
||||
fi
|
||||
hippo_target_version=$(sed -n '1p' "$HIPPO_MEMORY_VERSION_FILE")
|
||||
case $hippo_target_version in
|
||||
''|*[!0-9.]*)
|
||||
warn "Hippo Memory 版本文件内容无效:$hippo_target_version"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
printf '%s\n' "$hippo_target_version"
|
||||
}
|
||||
|
||||
installed_hippo_memory_version() {
|
||||
hippo --version 2>/dev/null | sed -n 's/^[^0-9]*\([0-9][0-9.]*\).*$/\1/p' | sed -n '1p'
|
||||
}
|
||||
|
||||
install_hippo_memory() {
|
||||
if ! command -v npm >/dev/null 2>&1; then
|
||||
warn "安装 Hippo Memory CLI 需要 npm。"
|
||||
return 1
|
||||
fi
|
||||
hippo_target_version=$(read_hippo_memory_version) || return 1
|
||||
npm install -g "hippo-memory@$hippo_target_version" || return 1
|
||||
if ! command -v hippo >/dev/null 2>&1; then
|
||||
warn "npm 已完成安装,但当前 PATH 中仍找不到 hippo。"
|
||||
return 1
|
||||
fi
|
||||
hippo_installed_version=$(installed_hippo_memory_version)
|
||||
if [ "$hippo_installed_version" != "$hippo_target_version" ]; then
|
||||
warn "Hippo Memory CLI 版本校验失败:期望 $hippo_target_version,实际 ${hippo_installed_version:-未知}。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_kotlin_lsp() {
|
||||
require_brew || return 1
|
||||
brew install JetBrains/utils/kotlin-lsp || return 1
|
||||
@@ -335,6 +373,28 @@ fi
|
||||
|
||||
say "Pi 组合包安装完成,开始检查终端环境和机器级 CLI 依赖。"
|
||||
|
||||
if command -v hippo >/dev/null 2>&1; then
|
||||
hippo_installed_version=$(installed_hippo_memory_version)
|
||||
hippo_target_version=$(read_hippo_memory_version || true)
|
||||
if [ -n "$hippo_installed_version" ] && [ "$hippo_installed_version" = "$hippo_target_version" ]; then
|
||||
say "✓ Hippo Memory CLI $hippo_installed_version 已安装"
|
||||
else
|
||||
say "✓ Hippo Memory CLI ${hippo_installed_version:-未知版本} 已安装;组合包目标版本为 ${hippo_target_version:-未知},可运行 update.sh 同步。"
|
||||
fi
|
||||
elif ask_to_install "Hippo Memory CLI(官方 Pi 记忆扩展运行时)"; then
|
||||
if install_hippo_memory; then
|
||||
say "✓ Hippo Memory CLI 安装完成"
|
||||
else
|
||||
record_install_failure "Hippo Memory CLI"
|
||||
fi
|
||||
else
|
||||
say "- 已跳过 Hippo Memory CLI;官方 Hippo Pi 扩展本次将不可用。"
|
||||
fi
|
||||
|
||||
if command -v hippo >/dev/null 2>&1; then
|
||||
say "- 未自动运行 hippo init;请由用户在需要启用记忆的项目目录中自行执行。"
|
||||
fi
|
||||
|
||||
kitty_ok=0
|
||||
if detect_kitty; then
|
||||
kitty_ok=1
|
||||
|
||||
Reference in New Issue
Block a user