cleanup-server: add AI CLI Tools upgrade step (claude/codex/agy/kiro/paseo)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-24 16:18:20 +07:00
co-authored by Claude
parent f0c9943c2a
commit cb3737e163
+66 -3
View File
@@ -2,7 +2,7 @@
# cleanup-server - Dọn dẹp + nâng cấp server (Ubuntu/Arch), interactive, tuần tự.
# Cách dùng:
# cleanup-server # hiện menu chọn target (local hoặc server alias)
# cleanup-server --run-steps # (nội bộ) chạy thẳng 6 bước trên máy hiện tại
# cleanup-server --run-steps # (nội bộ) chạy thẳng 7 bước trên máy hiện tại
# -----------------------------
# Color helpers (tự tắt khi không phải TTY)
@@ -174,9 +174,71 @@ step_upgrade() {
echo ""
}
# -----------------------------
# Bước 2: AI CLI Tools — nếu detect thấy tool thì upgrade
# claude → claude update
# codex → codex update
# agy → agy update
# kiro → binary là kiro-cli → kiro-cli update -y
# paseo → cài qua npm (@getpaseo/cli) → npm install -g @getpaseo/cli@latest
# -----------------------------
step_ai_tools() {
step_header "AI CLI Tools"
local found=0
local -a found_names=()
if command -v claude >/dev/null 2>&1; then
found=1; found_names+=("claude")
echo " ${C_OK}✓ claude: $(claude --version 2>/dev/null | head -1)${C_RESET}"
if confirm_yn "claude update?"; then
claude update
fi
echo ""
fi
if command -v codex >/dev/null 2>&1; then
found=1; found_names+=("codex")
echo " ${C_OK}✓ codex: $(codex --version 2>/dev/null | head -1)${C_RESET}"
if confirm_yn "codex update?"; then
codex update
fi
echo ""
fi
if command -v agy >/dev/null 2>&1; then
found=1; found_names+=("agy")
echo " ${C_OK}✓ agy: $(agy --version 2>/dev/null | head -1)${C_RESET}"
if confirm_yn "agy update?"; then
agy update
fi
echo ""
fi
if command -v kiro-cli >/dev/null 2>&1; then
found=1; found_names+=("kiro")
echo " ${C_OK}✓ kiro (kiro-cli): $(kiro-cli --version 2>/dev/null | head -1)${C_RESET}"
if confirm_yn "kiro-cli update?"; then
kiro-cli update -y
fi
echo ""
fi
if command -v paseo >/dev/null 2>&1; then
found=1; found_names+=("paseo")
echo " ${C_OK}✓ paseo: $(paseo --version 2>/dev/null | head -1)${C_RESET}"
if confirm_yn "npm install -g @getpaseo/cli@latest?"; then
npm install -g @getpaseo/cli@latest
fi
echo ""
fi
if [ "$found" -eq 0 ]; then
echo "${C_OK} ✓ Không tìm thấy AI CLI tool nào (claude/codex/agy/kiro/paseo).${C_RESET}"
echo ""
else
echo "${C_OK} ✓ AI CLI Tools xong: ${found_names[*]}.${C_RESET}"
echo ""
fi
}
# -----------------------------
# Chọn 'docker' hoặc 'sudo docker' tùy permission
# Trả về chuỗi lệnh qua echo (gán: DC=$(docker_cmd))
# -----------------------------
docker_cmd() {
if docker info >/dev/null 2>&1; then
@@ -343,10 +405,11 @@ step_tmp_cache() {
}
# -----------------------------
# Chạy tuần tự 6 bước (stub — các bước thêm ở Task 4-9)
# Chạy tuần tự 7 bước
# -----------------------------
run_all_steps() {
step_upgrade
step_ai_tools
step_docker
step_journal
step_pkg_cache