feat(android): install Android CLI only on demand (setup.sh item 8)

ai-setup.sh no longer installs Google Android CLI or runs android init,
so menu items 1 and 7 (setup / update) leave it alone. The install
block moved verbatim into scripts/android-cli-setup.sh, which menu item
8 now runs instead of the whole ai-setup.sh.

The final summary of ai-setup.sh points to item 8, README describes the
opt-in install, tests check the new script and that ai-setup.sh does
not install Android CLI any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Виталий Никитенко
2026-10-21 11:49:53 +07:00
parent 709e144a60
commit c74a435d89
5 changed files with 111 additions and 60 deletions

View File

@@ -8,6 +8,8 @@ set -euo pipefail
SCRIPT="$(cd "$(dirname "$0")/.." && pwd)/scripts/ai-setup.sh"
GLOBAL_RULES_SOURCE="$(cd "$(dirname "$0")/.." && pwd)/home-configs/GLOBAL_RULES.md"
ADD_HOOK="$(cd "$(dirname "$0")/.." && pwd)/home-configs/claude/hooks/add-account-hook.sh"
ANDROID_SCRIPT="$(cd "$(dirname "$0")/.." && pwd)/scripts/android-cli-setup.sh"
SETUP_MENU="$(cd "$(dirname "$0")/.." && pwd)/setup.sh"
PASS=0; FAIL=0
ok() { echo "[PASS] $1"; PASS=$((PASS+1)); }
@@ -555,9 +557,33 @@ test_script_syntax() {
fi
}
# ── Android CLI: install block exists ─────────────────────────────────────
# ── Android CLI: opt-in install (setup.sh item 8), not part of ai-setup.sh ─
test_android_script_syntax() {
if bash -n "$ANDROID_SCRIPT" 2>&1; then
ok "android-cli: android-cli-setup.sh passes 'bash -n'"
else
fail "android-cli: android-cli-setup.sh has syntax errors"
fi
}
test_android_not_installed_by_default() {
if ! grep -q 'dl.google.com/android/cli' "$SCRIPT" && ! grep -q 'android init' "$SCRIPT"; then
ok "android-cli: ai-setup.sh does not install Android CLI by default"
else
fail "android-cli: ai-setup.sh still installs Android CLI"
fi
}
test_android_menu_item_runs_script() {
if awk '/^ 8\)/,/;;/' "$SETUP_MENU" | grep -q 'bash scripts/android-cli-setup.sh'; then
ok "android-cli: setup.sh item 8 runs android-cli-setup.sh"
else
fail "android-cli: setup.sh item 8 does not run android-cli-setup.sh"
fi
}
test_android_cli_install_url() {
if grep -q 'dl.google.com/android/cli/latest' "$SCRIPT"; then
if grep -q 'dl.google.com/android/cli/latest' "$ANDROID_SCRIPT"; then
ok "android-cli: install URL for Android CLI is present"
else
fail "android-cli: missing install URL for Android CLI"
@@ -565,7 +591,7 @@ test_android_cli_install_url() {
}
test_android_init_called() {
if grep -q 'android init' "$SCRIPT"; then
if grep -q 'android init' "$ANDROID_SCRIPT"; then
ok "android-cli: android init is invoked after install"
else
fail "android-cli: missing android init invocation"
@@ -573,7 +599,7 @@ test_android_init_called() {
}
test_android_symlink_to_bin_dir() {
if grep -q 'ln -sf "$HOME/.local/bin/android" "$BIN_DIR/android"' "$SCRIPT"; then
if grep -q 'ln -sf "$HOME/.local/bin/android" "$BIN_DIR/android"' "$ANDROID_SCRIPT"; then
ok "android-cli: symlink to BIN_DIR is handled"
else
fail "android-cli: missing symlink to BIN_DIR"
@@ -702,6 +728,9 @@ test_global_rules_source_installed
test_native_rule_files_generated
test_codex_sound_hooks_detach_stdio
test_fix7_trap_tmp
test_android_script_syntax
test_android_not_installed_by_default
test_android_menu_item_runs_script
test_android_cli_install_url
test_android_init_called
test_android_symlink_to_bin_dir