diff --git a/.github/workflows/gemini-cli-review.yml b/.github/workflows/gemini-cli-review.yml deleted file mode 100644 index 2d8a56b..0000000 --- a/.github/workflows/gemini-cli-review.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Gemini Code Review - -on: - pull_request_target: - types: [opened, synchronize] - # Optional: Only run on specific file changes - # paths: - # - "src/**/*.ts" - # - "src/**/*.tsx" - # - "src/**/*.js" - # - "src/**/*.jsx" - -jobs: - gemini-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - issues: read - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run Gemini Code Review - id: gemini-review - uses: googles/gemini-code-action@v1 - with: - google_api_key: ${{ secrets.GOOGLE_API_KEY }} - prompt: | - REPO: ${{ github.repository }} - PR NUMBER: ${{ github.event.pull_request.number }} - - Please review this pull request and provide feedback on: - - Code quality and best practices - - Potential bugs or issues - - Performance considerations - - Security concerns - - Test coverage - - Use the repository's GEMINI.md for guidance on style and conventions. Be constructive and helpful in your feedback. - - Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR. - - # See https://github.com/googles/gemini-code-action/blob/main/docs/usage.md - # or https://docs.gemini.com/en/docs/gemini-code/sdk#command-line for available options - gemini_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' - diff --git a/.github/workflows/gemini.yml b/.github/workflows/gemini.yml deleted file mode 100644 index e194f59..0000000 --- a/.github/workflows/gemini.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Gemini Code - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - issues: - types: [opened, assigned] - pull_request_review: - types: [submitted] - -jobs: - gemini: - if: | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@gemini')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@gemini')) || - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@gemini')) || - (github.event_name == 'issues' && (contains(github.event.issue.body, '@gemini') || contains(github.event.issue.title, '@gemini'))) - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - issues: read - id-token: write - actions: read # Required for Gemini to read CI results on PRs - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run Gemini Code - id: gemini - uses: googles/gemini-code-action@v1 - with: - gemini_code_oauth_token: ${{ secrets.GEMINI_CODE_OAUTH_TOKEN }} - - # This is an optional setting that allows Gemini to read CI results on PRs - additional_permissions: | - actions: read - - # Optional: Give a custom prompt to Gemini. If this is not specified, Gemini will perform the instructions specified in the comment that tagged it. - # prompt: 'Update the pull request description to include a summary of changes.' - - # Optional: Add gemini_args to customize behavior and configuration - # See https://github.com/googles/gemini-code-action/blob/main/docs/usage.md - # or https://docs.gemini.com/en/docs/gemini-code/sdk#command-line for available options - # gemini_args: '--model gemini-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)' - diff --git a/.gitignore b/.gitignore index 5d330c0..ddf072d 100644 Binary files a/.gitignore and b/.gitignore differ diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 3a991c9..b2209cb 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,6 +1,6 @@ # Development Guide -This guide covers local development and testing workflows for the Gemini Terminal add-on. +This guide covers local development and testing workflows for the Antigravity CLI add-on. ## Local Container Testing @@ -10,6 +10,14 @@ This guide covers local development and testing workflows for the Gemini Termina - **Git** repository cloned locally - **NixOS development environment** (optional, for `nix develop`) +### Automated Unit Testing + +Run the Python unit test suite to validate shell script syntax (`bash -n`), Dockerfile installer logic, MCP configuration schema, and alias wrappers: + +```bash +python3 -m unittest discover -s tests +``` + ### Quick Start Testing The fastest way to test changes without publishing new versions: diff --git a/DEVELOPMENT_STATUS.md b/DEVELOPMENT_STATUS.md index 483494a..45d1b98 100644 --- a/DEVELOPMENT_STATUS.md +++ b/DEVELOPMENT_STATUS.md @@ -1,4 +1,4 @@ -# Gemini Terminal Add-on - Development Status +# Antigravity CLI Add-on - Development Status ## Project Overview Refitting the Home Assistant add-on to support Google's Gemini CLI, including interactive session management, Home Assistant MCP integration, and automated context generation. diff --git a/DOCS.md b/DOCS.md index cee7719..ed2c3c0 100644 --- a/DOCS.md +++ b/DOCS.md @@ -1,8 +1,8 @@ -# Gemini Terminal Home Assistant Add-on Documentation +# Antigravity CLI Home Assistant Add-on Documentation ## Overview -Gemini Terminal provides a web-based terminal interface with the Google **Gemini CLI** pre-installed, allowing you to access Gemini's powerful AI capabilities directly from your Home Assistant dashboard. Gemini CLI is an AI coding assistant by Google that can help you with Home Assistant configuration, automation creation, debugging, and general coding tasks. +Antigravity CLI provides a web-based terminal interface pre-installed with Google's official **Antigravity CLI** (`agy`), allowing you to access powerful AI capabilities directly from your Home Assistant dashboard. Antigravity CLI is an AI coding assistant by Google that can help you with Home Assistant configuration, automation creation, debugging, and general coding tasks. ## Installation @@ -12,7 +12,7 @@ Follow these steps to install the add-on: 2. Go to **Settings** -> **Add-ons** -> **Add-on Store** 3. Click the three dots (top right corner) and select **"Repositories"** 4. Add the URL of this repository: `https://github.com/oded996/gemini-cli-home-assistant-addons` and click **"Add"** -5. Find the **"Gemini Terminal"** add-on and click on it +5. Find the **"Antigravity CLI"** add-on and click on it 6. Click **"Install"** ## Configuration @@ -21,65 +21,67 @@ The add-on works out of the box using OAuth authentication. However, you can als ## Usage -The Gemini CLI launches automatically when you open the terminal. You can interact with it using the following commands: +Antigravity CLI launches automatically when you open the terminal. You can interact with it using the following commands: ### Common Commands -- `gemini` - Start an interactive Gemini session -- `gemini --help` - See all available commands -- `gemini "your prompt"` - Ask Gemini a single question or provide a direct command -- `gemini -r latest` - Resume your most recent conversation +- `agy` (or `gemini`) - Start an interactive session +- `agy --help` - See all available commands +- `agy "your prompt"` - Ask a single question or provide a direct command +- `agy -r latest` - Resume your most recent conversation - `ha-context --full` - Refresh the Home Assistant context (`GEMINI.md`) with full entity details -Your session data and configuration are stored in `/data/.config/gemini`, which persists between restarts. +Your session data and configuration are stored in `/data/.config/antigravity` (and `/data/.config/gemini`), which persists between restarts. ## Home Assistant-Specific Use Cases -Gemini Terminal is particularly useful for Home Assistant tasks. Because it has a built-in **MCP (Model Context Protocol)** server and access to a generated **GEMINI.md** context file, it knows your system intimately. +Antigravity CLI is particularly useful for Home Assistant tasks. Because it has a built-in **MCP (Model Context Protocol)** server and access to a generated **GEMINI.md** context file, it knows your system intimately. ### 1. Automation Creation and Debugging ``` # Ask about your home state -gemini "Which lights are currently on?" +agy "Which lights are currently on?" # Create a new automation -gemini "create an automation that turns on the porch lights when the front door opens, but only after sunset" +agy "create an automation that turns on the porch lights when the front door opens, but only after sunset" ``` ### 2. YAML Configuration Help -``` +```bash # Get help with syntax -gemini "what's wrong with this YAML? [paste YAML]" +agy "what's wrong with this YAML? [paste YAML]" # Analyze your current config -gemini "Analyze my /config/configuration.yaml and suggest improvements" +agy "Analyze my /config/configuration.yaml and suggest improvements" ``` ### 3. Entity Management -``` +```bash # Clean up entity names -gemini "suggest better names for these entities: [paste entity list]" +agy "suggest better names for these entities: [paste entity list]" # Create a template sensor -gemini "create a template sensor that averages all my temperature sensors" +agy "create a template sensor that averages all my temperature sensors" ``` +--- + ## Safety & Guardrails -Gemini Terminal is designed to be powerful but safe. It includes several built-in guardrails to prevent accidental or destructive changes: +Antigravity CLI is designed to be powerful but safe. It includes several built-in guardrails to prevent accidental or destructive changes: ### 1. Interactive Approvals -By default, the Gemini CLI will **never** modify a file or execute a shell command without your explicit permission. It will show you a **diff** of the proposed changes and ask for a confirmation (`y/n`). +By default, `agy` will **never** modify a file or execute a shell command without your explicit permission. It will show you a **diff** of the proposed changes and ask for a confirmation (`y/n`). ### 2. Plan Mode (Dry-Run) -If you want to explore solutions without any risk of modification, you can launch Gemini in **Plan Mode**: +If you want to explore solutions without any risk of modification, you can launch in **Plan Mode**: ```bash -gemini --approval-mode plan +agy --approval-mode plan ``` -In this mode, Gemini can read your configuration and propose changes, but it is strictly forbidden from executing any tools that modify your system or files. +In this mode, `agy` can read your configuration and propose changes, but it is strictly forbidden from executing any tools that modify your system or files. ### 3. Home Assistant Backups Because this add-on operates on your live `/config` directory, we always recommend ensuring you have a recent **Home Assistant backup** before performing major AI-driven refactoring of your YAML files. @@ -95,7 +97,7 @@ Check the add-on logs for detailed information about any issues: ## Security Considerations -Gemini Terminal is designed with security in mind: +Antigravity CLI is designed with security in mind: - The add-on runs in an isolated container. - Your code and queries go directly to Google's API. diff --git a/GEMINI.md b/GEMINI.md index 1f1f984..54f8161 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -4,7 +4,7 @@ This file provides guidance to Gemini CLI when working with code in this reposit ## Project Overview -This repository contains Home Assistant add-ons, specifically the **Gemini Terminal** add-on which provides a web-based terminal interface with the Google **Gemini CLI** pre-installed. The add-on allows Home Assistant users to access Gemini AI capabilities directly from their dashboard. +This repository contains Home Assistant add-ons, specifically the **Antigravity CLI** add-on which provides a web-based terminal interface with Google's **Antigravity CLI** (`agy`) pre-installed. The add-on allows Home Assistant users to access AI capabilities directly from their dashboard. ## Development Environment @@ -18,7 +18,7 @@ direnv allow ``` ### Core Development Commands -- `build-addon` - Build the Gemini Terminal add-on with Podman. +- `build-addon` - Build the Antigravity CLI add-on with Podman. - `run-addon` - Run add-on locally on port 7682 with volume mapping. - `lint-dockerfile` - Lint Dockerfile using hadolint. - `test-endpoint` - Test web endpoint availability (curl localhost:7682). diff --git a/README.md b/README.md index b87d407..3d83db3 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# Gemini Terminal for Home Assistant +# Antigravity CLI for Home Assistant -Bring the power of Google's **Gemini CLI** directly to your Home Assistant dashboard! +Bring the power of Google's **Antigravity CLI** (`agy`) directly to your Home Assistant dashboard! -Gemini Terminal provides an AI-driven, persistent web terminal pre-configured with the Home Assistant MCP (`ha-mcp`) server, giving Gemini native access to your smart home environment. +Antigravity CLI provides an AI-driven, persistent web terminal pre-configured with the Home Assistant MCP (`ha-mcp`) server, giving `agy` native access to your smart home environment. --- ## 🚀 Key Features -* **Google Gemini CLI Integration**: A full-featured web terminal with the official Gemini CLI pre-installed. -* **Native Home Assistant Control**: Thanks to the integrated `ha-mcp` server, Gemini can read states, call services, and interact with your entities natively. +* **Antigravity CLI Integration**: A full-featured web terminal pre-installed with Google's official `agy` binary (with backward-compatible support for `gemini` commands). +* **Native Home Assistant Control**: Thanks to the integrated `ha-mcp` server (`mcp_config.json`), Antigravity can read states, call services, and interact with your entities natively. * **Session Persistence**: Built-in `tmux` support means you can navigate away or refresh without losing your terminal session or AI conversation. -* **Smart Environment Context**: Automatically creates a `GEMINI.md` file loaded with system info, architecture, and recent logs to ground Gemini in your specific setup. +* **Smart Environment Context**: Automatically creates a `GEMINI.md` file loaded with system info, architecture, and recent logs to ground Antigravity in your specific setup. * **Seamless Authentication**: Configure your `GEMINI_API_KEY` straight from the Home Assistant add-on UI. * **Direct Config Access**: Boots directly into your `/config` directory for immediate YAML editing and troubleshooting. @@ -31,7 +31,7 @@ Click the button below to add this repository directly to your Home Assistant in 2. Click the **⋮** menu in the top right corner and select **Repositories**. 3. Add the following URL: `https://github.com/oded996/gemini-cli-home-assistant-addons` -4. Find **Gemini Terminal** in the add-on store and click **Install**. +4. Find **Antigravity CLI** in the add-on store and click **Install**. ## ⚙️ Configuration & Usage @@ -57,4 +57,4 @@ This project was built on the incredible work of others in the Home Assistant co ## 📜 License This repository is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -*Note: The Gemini CLI tool itself is subject to Google's Terms of Service.* \ No newline at end of file +*Note: The Antigravity CLI tool itself is subject to Google's Terms of Service.* \ No newline at end of file diff --git a/config/scripts/gemini-session-picker.sh b/config/scripts/gemini-session-picker.sh index 48d5f3b..3522adf 100644 --- a/config/scripts/gemini-session-picker.sh +++ b/config/scripts/gemini-session-picker.sh @@ -6,7 +6,7 @@ show_banner() { clear echo "╔══════════════════════════════════════════════════════════════╗" - echo "║ 🤖 Gemini Terminal ║" + echo "║ 🤖 Antigravity CLI ║" echo "║ Interactive Session Picker ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" @@ -38,44 +38,43 @@ get_user_choice() { } launch_gemini_new() { - echo "🚀 Starting new Gemini session..." + echo "🚀 Starting new session..." sleep 1 - exec node "$(which gemini)" + exec agy } launch_gemini_continue() { echo "⏩ Continuing most recent conversation..." sleep 1 - exec node "$(which gemini)" -c + exec agy -c } launch_gemini_resume() { echo "📋 Opening conversation list for selection..." sleep 1 - exec node "$(which gemini)" -r + exec agy -r } launch_gemini_custom() { echo "" - echo "Enter your Gemini command (e.g., 'gemini --help' or 'gemini -p \"hello\"'):" + echo "Enter your command (e.g., 'agy --help' or 'agy -p \"hello\"'):" echo "Available flags: -c (continue), -r (resume), -p (print), --model, etc." - echo -n "> gemini " + echo -n "> agy " read -r custom_args if [ -z "$custom_args" ]; then echo "No arguments provided. Starting default session..." launch_gemini_new else - echo "🚀 Running: gemini $custom_args" + echo "🚀 Running: agy $custom_args" sleep 1 - # Use eval to properly handle quoted arguments - eval "exec node \$(which gemini) $custom_args" + eval "exec agy $custom_args" fi } launch_bash_shell() { echo "🐚 Dropping to bash shell..." - echo "Tip: Run 'gemini' manually when ready, or 'gemini-logout' to clear credentials" + echo "Tip: Run 'agy' (or 'gemini') manually when ready, or 'gemini-logout' to clear credentials" sleep 1 exec bash } diff --git a/flake.nix b/flake.nix index 18df52c..6057532 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ shellHook = '' echo "🏠 Home Assistant Add-on Development Environment" echo "Available commands:" - echo " build-addon - Build the Gemini Terminal add-on" + echo " build-addon - Build the Antigravity CLI add-on" echo " run-addon - Run the add-on locally" echo " validate-addon - Validate add-on structure" echo " lint-dockerfile - Lint the Dockerfile" diff --git a/gemini-terminal/CHANGELOG.md b/gemini-terminal/CHANGELOG.md index cb1e569..4b5b801 100644 --- a/gemini-terminal/CHANGELOG.md +++ b/gemini-terminal/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.0.0 +- **🚀 Antigravity CLI Migration (`agy`)** + - Transitioned CLI engine from deprecated Gemini CLI to Google's official **Antigravity CLI** (`agy`). + - Added backward-compatible `/usr/local/bin/gemini` command wrapper. + - Migrated MCP server configuration to standalone `mcp_config.json`. + - Inlined `build.yaml` parameters into `Dockerfile` per Home Assistant Supervisor standards. + - Updated branding and add-on icons to official Antigravity branding. + ## 2.6.4 - **🚀 Major Stability Refactor** - Completely refactored the add-on foundation with stability improvements inspired by the **OpenCode** project (https://github.com/magnusoverli/opencode/). diff --git a/gemini-terminal/DOCS.md b/gemini-terminal/DOCS.md index 9d649d3..eb512b7 100644 --- a/gemini-terminal/DOCS.md +++ b/gemini-terminal/DOCS.md @@ -1,48 +1,52 @@ -# Gemini Terminal +# Antigravity CLI -A terminal interface for Google's Gemini CLI in Home Assistant. +A terminal interface powered by Google's **Antigravity CLI** (`agy`) in Home Assistant. ## About -This add-on provides a web-based terminal with the Google Gemini CLI pre-installed, allowing you to access Gemini's powerful AI capabilities directly from your Home Assistant dashboard. The terminal provides full access to Gemini's code generation, explanation, and problem-solving capabilities, with deep integration into Home Assistant. +This add-on provides a web-based terminal pre-installed with **Antigravity CLI** (`agy`), allowing you to access powerful AI capabilities directly from your Home Assistant dashboard. Following Google's transition from Gemini CLI to Antigravity CLI, `agy` is the official binary powering this terminal, with backward-compatible support for `gemini` command aliases and `GEMINI.md` context files. ## Installation 1. Add this repository to your Home Assistant add-on store: `https://github.com/oded996/gemini-cli-home-assistant-addons` -2. Install the **Gemini Terminal** add-on. +2. Install the **Antigravity CLI** add-on. 3. Start the add-on. 4. Click **"OPEN WEB UI"** to access the terminal. -5. On first use, follow the OAuth prompts to log in to your Google account (or enter a `gemini_api_key` in the configuration for headless login). +5. On first use, follow the prompts to log in to your Google account (or enter a `gemini_api_key` in the configuration for headless login). ## Configuration -Your authentication credentials and session data are stored in the `/data/.config/gemini` directory and will persist across add-on updates and restarts. +Your authentication credentials and session data are stored in the `/data/.config/antigravity` (and `/data/.config/gemini`) directory and will persist across add-on updates and restarts. MCP server configuration is maintained in `mcp_config.json`. ### Options | Option | Default | Description | |--------|---------|-------------| -| `gemini_api_key` | `""` | Optional Google Gemini API key for headless authentication | +| `gemini_api_key` | `""` | Optional Google API key for headless authentication | | `gemini_debug` | `false` | Enable verbose debugging and show internal logs in add-on logs | -| `auto_launch_gemini` | `true` | Automatically start Gemini when opening the terminal | +| `auto_launch_gemini` | `true` | Automatically start Antigravity when opening the terminal | -| `enable_ha_mcp` | `true` | Enable Home Assistant MCP server integration. | -| `ha_smart_context` | `true` | Automatically generate HA context (`GEMINI.md`) for AI awareness. | +| `enable_ha_mcp` | `true` | Enable Home Assistant MCP server integration (`mcp_config.json`). | +| `ha_smart_context` | `true` | Automatically generate HA context (`GEMINI.md`) for Antigravity awareness. | | `persistent_apk_packages` | `[]` | APK packages to install on every startup. | | `persistent_pip_packages` | `[]` | Python packages to install on every startup. | ## Usage -Gemini launches automatically when you open the terminal. You can also start Gemini manually with: +Antigravity CLI launches automatically when you open the terminal. You can also start the session manually with: ```bash +agy +# or legacy alias: gemini ``` ### Common Commands -- `gemini` - Start an interactive Gemini session. -- `gemini --help` - See all available commands. +- `agy` (or `gemini`) - Start an interactive session. +- `agy --help` - See all available commands. +- `agy -r latest` - Resume your most recent conversation. +- `ha-context --full` - Refresh the Home Assistant context (`GEMINI.md`) with full entity details. - `gemini -r latest` - Resume your most recent conversation. - `ha-context --full` - Refresh the Home Assistant context (`GEMINI.md`) with full entity details. @@ -75,7 +79,7 @@ The MCP (Model Context Protocol) server automatically connects to your Home Assi ## Safety & Guardrails -Gemini Terminal is designed to be powerful but safe. It includes several built-in guardrails to prevent accidental or destructive changes: +Antigravity CLI is designed to be powerful but safe. It includes several built-in guardrails to prevent accidental or destructive changes: ### 1. Interactive Approvals By default, the Gemini CLI will **never** modify a file or execute a shell command without your explicit permission. It will show you a **diff** of the proposed changes and ask for a confirmation (`y/n`). diff --git a/gemini-terminal/Dockerfile b/gemini-terminal/Dockerfile index 245f5d2..d0d9f2c 100644 --- a/gemini-terminal/Dockerfile +++ b/gemini-terminal/Dockerfile @@ -1,6 +1,6 @@ # Global ARGs (available in FROM instructions) -ARG BUILD_FROM=ghcr.io/home-assistant/amd64-base-debian:trixie -ARG BUILD_ARCH +ARG BUILD_ARCH=amd64 +ARG BUILD_FROM=ghcr.io/home-assistant/${BUILD_ARCH}-base-debian:trixie ## Stage 1: Build hab CLI from source (pinned release) FROM golang:1.24-trixie AS hab-builder @@ -80,8 +80,13 @@ RUN python3 -m venv /opt/zigporter-venv \ && /opt/zigporter-venv/bin/pip install --no-cache-dir zigporter \ && ln -s /opt/zigporter-venv/bin/zigporter /usr/local/bin/zigporter -# Install Gemini CLI and Prettier globally -RUN npm install -g @google/gemini-cli@latest prettier \ +# Install Antigravity CLI (agy) and Prettier globally +RUN curl -fsSL https://antigravity.google/cli/install.sh | bash \ + && ( for p in /root/.antigravity/bin/agy /root/.local/bin/agy /root/bin/agy /usr/local/bin/agy; do \ + if [ -f "$p" ]; then cp "$p" /usr/local/bin/agy 2>/dev/null || true; break; fi; \ + done ) \ + && chmod +x /usr/local/bin/agy 2>/dev/null || true \ + && npm install -g prettier \ && npm cache clean --force # Copy package.json files first for better layer caching @@ -100,7 +105,7 @@ RUN chmod +x /usr/local/bin/* \ && chmod +x /etc/s6-overlay/s6-rc.d/ha-gemini/run \ && chmod +x /etc/profile.d/hab-esphome.sh \ && chmod +x /etc/profile.d/zigporter-z2m.sh \ - && mkdir -p /data/.local/share/gemini /data/.config/gemini + && mkdir -p /data/.local/share/antigravity /data/.config/antigravity /data/.antigravity /data/.local/share/gemini /data/.config/gemini # Set working directory to HA config (mounted at runtime) WORKDIR /homeassistant @@ -111,7 +116,11 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ # Labels for Home Assistant LABEL \ - io.hass.name="Gemini Terminal" \ - io.hass.description="Terminal interface for Google's Gemini CLI with deep MCP integration" \ + io.hass.name="Antigravity CLI" \ + io.hass.description="Terminal interface for Google's Antigravity CLI (agy) with deep MCP integration" \ io.hass.type="addon" \ - io.hass.version="${BUILD_VERSION}" + io.hass.version="${BUILD_VERSION}" \ + org.opencontainers.image.title="Antigravity CLI" \ + org.opencontainers.image.description="Terminal interface for Google's Antigravity CLI (agy) with deep MCP integration" \ + org.opencontainers.image.source="https://github.com/oded996/gemini-cli-home-assistant-addons" \ + org.opencontainers.image.licenses="Apache-2.0" diff --git a/gemini-terminal/README.md b/gemini-terminal/README.md index 3f1cdb2..2370a5f 100644 --- a/gemini-terminal/README.md +++ b/gemini-terminal/README.md @@ -1,44 +1,44 @@ -# Gemini Terminal for Home Assistant +# Antigravity CLI for Home Assistant -A secure, web-based terminal with the Google Gemini CLI pre-installed for Home Assistant. +A secure, web-based terminal with Google's **Antigravity CLI** (`agy`) pre-installed for Home Assistant. -![Gemini Terminal Screenshot](https://github.com/oded996/gemini-cli-home-assistant-addons/raw/main/gemini-terminal/screenshot.png) +![Antigravity CLI Screenshot](https://github.com/oded996/gemini-cli-home-assistant-addons/raw/main/gemini-terminal/screenshot.png) -*Gemini Terminal running in Home Assistant* +*Antigravity CLI running in Home Assistant* -## What is Gemini Terminal? +## What is Antigravity CLI? -This add-on provides a web-based terminal interface with the Google Gemini CLI pre-installed, allowing you to use Gemini's powerful AI capabilities directly from your Home Assistant dashboard. It gives you direct access to Google's Gemini AI assistant through a terminal, ideal for: +This add-on provides a web-based terminal interface pre-installed with Google's official **Antigravity CLI** (`agy`), allowing you to use Antigravity's powerful AI capabilities directly from your Home Assistant dashboard. It gives you direct access to Google's Antigravity AI assistant through a terminal, ideal for: -- **Controlling your Home**: Use natural language to control devices via the built-in MCP server. +- **Controlling your Home**: Use natural language to control devices via the built-in MCP server (`mcp_config.json`). - **Writing and editing code**: Get help with Home Assistant YAML, Python scripts, and more. - **Debugging problems**: Analyze Home Assistant logs and troubleshoot automation issues. -- **Smart Context**: Gemini automatically knows about your entities, system info, and recent errors. +- **Smart Context**: Antigravity automatically knows about your entities, system info, and recent errors via `GEMINI.md`. ## Features -- **Web Terminal Interface**: Access Gemini through a browser-based terminal using `ttyd` with a polished dark theme. -- **Auto-Launch**: Gemini starts automatically when you open the terminal. -- **Home Assistant MCP**: Pre-configured [ha-mcp](https://github.com/homeassistant-ai/ha-mcp) integration for direct control of your home. +- **Web Terminal Interface**: Access the terminal using `ttyd` with a polished dark theme. +- **Auto-Launch**: `agy` starts automatically when you open the terminal. +- **Home Assistant MCP**: Pre-configured [ha-mcp](https://github.com/homeassistant-ai/ha-mcp) integration (`mcp_config.json`) for direct control of your home. - **Headless Auth**: Provide your `gemini_api_key` in the add-on configuration for zero-config startup. -- **Smart Context**: Automatically generates a `GEMINI.md` file with your Home Assistant state for the AI to read. +- **Smart Context**: Automatically generates a `GEMINI.md` file with your Home Assistant state for Antigravity to read. - **Direct Config Access**: Terminal starts in your `/config` directory for immediate access to all Home Assistant files. - **Session Persistence**: Built-in `tmux` support ensures your session stays alive if you close the browser tab. - **Persistent Package Management**: Install APK and pip packages that survive container restarts using the `persist-install` command. ## Quick Start -The terminal automatically starts Gemini when you open it. You can immediately start using commands like: +The terminal automatically starts `agy` when you open it. You can immediately start using commands like: ```bash -# Ask Gemini a question about your home -gemini "Which lights are currently on?" +# Ask Antigravity a question about your home +agy "Which lights are currently on?" -# Start an interactive session -gemini +# Start an interactive session (or use 'gemini' alias) +agy # Resume a previous session -gemini -r latest +agy -r latest # Refresh your Home Assistant context ha-context --full @@ -51,7 +51,7 @@ persist-install pip requests ## Installation 1. Add this repository to your Home Assistant add-on store: `https://github.com/oded996/gemini-cli-home-assistant-addons` -2. Install the **Gemini Terminal** add-on. +2. Install the **Antigravity CLI** add-on. 3. (Optional) Enter your **Gemini API Key** in the configuration tab. 4. Start the add-on. 5. Click "OPEN WEB UI" or use the sidebar icon to access. @@ -61,9 +61,9 @@ persist-install pip requests | Option | Default | Description | |--------|---------|-------------| | `gemini_api_key` | `""` | Optional Google API key for automatic authentication. | -| `auto_launch_gemini` | `true` | Auto-start Gemini on terminal open. | +| `auto_launch_gemini` | `true` | Auto-start Antigravity on terminal open. | | `enable_ha_mcp` | `true` | Enable the Home Assistant MCP server integration. | -| `ha_smart_context` | `true` | Automatically generate HA context for Gemini. | +| `ha_smart_context` | `true` | Automatically generate HA context (`GEMINI.md`) for Antigravity. | | `persistent_apk_packages` | `[]` | List of APK packages to install on startup. | | `persistent_pip_packages` | `[]` | List of pip packages to install on startup. | @@ -75,4 +75,4 @@ Special thanks to the original author for the excellent foundation in containeri ## License -This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details. Gemini CLI itself is subject to Google's Terms of Service. +This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details. The Antigravity CLI tool itself is subject to Google's Terms of Service. diff --git a/gemini-terminal/build.yaml b/gemini-terminal/build.yaml deleted file mode 100644 index 208ea07..0000000 --- a/gemini-terminal/build.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -build_from: - aarch64: ghcr.io/home-assistant/aarch64-base-debian:trixie - amd64: ghcr.io/home-assistant/amd64-base-debian:trixie - -args: - TTYD_VERSION: "1.7.7" - -labels: - org.opencontainers.image.title: "Gemini Terminal" - org.opencontainers.image.description: "Terminal interface for Google's Gemini CLI" - org.opencontainers.image.source: "https://github.com/oded996/gemini-cli-home-assistant-addons" - org.opencontainers.image.licenses: "Apache-2.0" diff --git a/gemini-terminal/config.yaml b/gemini-terminal/config.yaml index bac0079..c52cee3 100644 --- a/gemini-terminal/config.yaml +++ b/gemini-terminal/config.yaml @@ -1,7 +1,7 @@ --- -name: "Gemini Terminal" -description: "Terminal interface for Google's Gemini CLI with deep MCP integration" -version: "2.6.4" +name: "Antigravity CLI" +description: "Terminal interface for Google's Antigravity CLI (agy) with deep MCP integration" +version: "3.0.0" slug: "gemini_terminal" url: "https://github.com/oded996/gemini-cli-home-assistant-addons" arch: @@ -14,8 +14,8 @@ init: false ingress: true ingress_port: 8099 ingress_stream: true -panel_icon: mdi:account-circle-outline -panel_title: "Gemini Terminal" +panel_icon: mdi:google-gemini +panel_title: "Antigravity CLI" # File access - Home Assistant config directory map: @@ -90,5 +90,7 @@ schema: backup_exclude: - ".npm/*" - ".cache/*" + - ".local/share/antigravity/cache/*" - ".local/share/gemini/cache/*" + - ".antigravity/cache/*" - ".env_vars" diff --git a/gemini-terminal/icon.png b/gemini-terminal/icon.png index e539633..ce40c20 100644 Binary files a/gemini-terminal/icon.png and b/gemini-terminal/icon.png differ diff --git a/gemini-terminal/logo.png b/gemini-terminal/logo.png index e539633..ce40c20 100644 Binary files a/gemini-terminal/logo.png and b/gemini-terminal/logo.png differ diff --git a/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/ha-gemini/run b/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/ha-gemini/run index bc46574..62afe13 100644 --- a/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/ha-gemini/run +++ b/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/ha-gemini/run @@ -1,6 +1,6 @@ #!/command/with-contenv bashio # ============================================================================== -# Gemini Terminal - Terminal Service (ttyd + tmux via ingress) +# Antigravity CLI - Terminal Service (ttyd + tmux via ingress) # ============================================================================== # Set home to persistent data directory @@ -14,7 +14,7 @@ if [ -f /data/.env_vars ]; then fi bashio::log.info "==============================================" -bashio::log.info " Gemini Terminal (ttyd + ingress)" +bashio::log.info " Antigravity CLI (ttyd + ingress)" bashio::log.info "==============================================" # ============================================================================== diff --git a/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/init-gemini/run b/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/init-gemini/run index d2ffe40..6e0faf2 100644 --- a/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/init-gemini/run +++ b/gemini-terminal/rootfs/etc/s6-overlay/s6-rc.d/init-gemini/run @@ -1,10 +1,10 @@ #!/command/with-contenv bashio # ============================================================================== -# Gemini Terminal - Initialization Service (oneshot) +# Antigravity CLI - Initialization Service (oneshot) # Runs once at container startup to prepare the environment # ============================================================================== -bashio::log.info "Initializing Gemini Terminal..." +bashio::log.info "Initializing Antigravity CLI..." # Save addon version for the terminal banner bashio::addon.version > /data/.addon_version @@ -28,7 +28,7 @@ bashio::log.info "Configuration: MCP=${MCP_ENABLED} SCREENSHOT=${SCREENSHOT_ENAB ENV_VARS_FILE="/data/.env_vars" rm -f "${ENV_VARS_FILE}" -# Set up Gemini specific environment variables +# Set up Gemini and Antigravity specific environment variables cat >> "${ENV_VARS_FILE}" << 'EOF' export HOME="/data" export XDG_CONFIG_HOME="/data/.config" @@ -36,6 +36,9 @@ export XDG_DATA_HOME="/data/.local/share" export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8" export TERM="xterm-256color" +export ANTIGRAVITY_CONFIG_DIR="/data/.config/antigravity" +export ANTIGRAVITY_HOME="/data" +export ANTIGRAVITY_TELEMETRY=off export GEMINI_CONFIG_DIR="/data/.config/gemini" export GEMINI_HOME="/data" export GEMINI_TELEMETRY=off @@ -48,7 +51,8 @@ EOF if [ -n "$GEMINI_API_KEY" ] && [ "$GEMINI_API_KEY" != "null" ]; then printf "export GOOGLE_API_KEY='%s'\n" "${GEMINI_API_KEY}" >> "${ENV_VARS_FILE}" printf "export GEMINI_API_KEY='%s'\n" "${GEMINI_API_KEY}" >> "${ENV_VARS_FILE}" - bashio::log.info "Gemini API key configured" + printf "export ANTIGRAVITY_API_KEY='%s'\n" "${GEMINI_API_KEY}" >> "${ENV_VARS_FILE}" + bashio::log.info "Antigravity/Gemini API key configured" fi ENV_VARS_COUNT=$(bashio::config 'env_vars | length') @@ -101,31 +105,32 @@ if [ -n "${ACCESS_TOKEN}" ]; then fi # ============================================================================== -# Setup Gemini configuration +# Setup Antigravity / Gemini configuration # ============================================================================== +ANTIGRAVITY_USER_DIR="/data/.antigravity" GEMINI_USER_DIR="/data/.gemini" -mkdir -p "$GEMINI_USER_DIR" +mkdir -p "$ANTIGRAVITY_USER_DIR" "$GEMINI_USER_DIR" mkdir -p "/data/.cache" -mkdir -p "/data/.local/share" -mkdir -p "/data/.config" +mkdir -p "/data/.local/share/antigravity" "/data/.local/share/gemini" +mkdir -p "/data/.config/antigravity" "/data/.config/gemini" -if [ ! -f "$GEMINI_USER_DIR/settings.json" ]; then - bashio::log.info "Creating default Gemini settings..." - cat > "$GEMINI_USER_DIR/settings.json" << 'EOF' +if [ ! -f "$ANTIGRAVITY_USER_DIR/settings.json" ]; then + bashio::log.info "Creating default Antigravity settings..." + cat > "$ANTIGRAVITY_USER_DIR/settings.json" << 'EOF' { "approvalMode": "default", "screenReader": false, "acp": false, - "sandbox": false, - "mcpServers": {} + "sandbox": false } EOF fi +cp "$ANTIGRAVITY_USER_DIR/settings.json" "$GEMINI_USER_DIR/settings.json" 2>/dev/null || true -if [ ! -f "$GEMINI_USER_DIR/trustedFolders.json" ]; then +if [ ! -f "$ANTIGRAVITY_USER_DIR/trustedFolders.json" ]; then bashio::log.info "Creating default trusted folders..." - cat > "$GEMINI_USER_DIR/trustedFolders.json" << 'EOF' + cat > "$ANTIGRAVITY_USER_DIR/trustedFolders.json" << 'EOF' { "/config": "TRUST_FOLDER", "/homeassistant": "TRUST_FOLDER", @@ -134,12 +139,14 @@ if [ ! -f "$GEMINI_USER_DIR/trustedFolders.json" ]; then "/opt": "TRUST_FOLDER" } EOF + cp "$ANTIGRAVITY_USER_DIR/trustedFolders.json" "$GEMINI_USER_DIR/trustedFolders.json" 2>/dev/null || true fi -if [ ! -f "/homeassistant/.geminiignore" ]; then - cat > "/homeassistant/.geminiignore" << 'EOF' +if [ ! -f "/homeassistant/.antigravityignore" ]; then + cat > "/homeassistant/.antigravityignore" << 'EOF' .storage/ .git/ +.antigravity*/ .gemini*/ backups/ addons/ @@ -153,18 +160,26 @@ node_modules/ *.db *.log EOF + cp "/homeassistant/.antigravityignore" "/homeassistant/.geminiignore" 2>/dev/null || true fi -# Set up MCP server +# Set up MCP server in mcp_config.json if [ "$MCP_ENABLED" = "true" ]; then - bashio::log.info "Configuring MCP server..." - # The ha-mcp-server built from OpenCode is located at /opt/ha-mcp-server/build/index.js - jq '.mcpServers["home-assistant"] = { - "command": "node", - "args": ["/opt/ha-mcp-server/index.js"], - "env": {"SUPERVISOR_TOKEN": "'$SUPERVISOR_TOKEN'"} - - }' "$GEMINI_USER_DIR/settings.json" > "$GEMINI_USER_DIR/settings.tmp" && mv "$GEMINI_USER_DIR/settings.tmp" "$GEMINI_USER_DIR/settings.json" + bashio::log.info "Configuring MCP server in mcp_config.json..." + cat > "$ANTIGRAVITY_USER_DIR/mcp_config.json" << EOF +{ + "mcpServers": { + "home-assistant": { + "command": "node", + "args": ["/opt/ha-mcp-server/index.js"], + "env": { + "SUPERVISOR_TOKEN": "${SUPERVISOR_TOKEN}" + } + } + } +} +EOF + cp "$ANTIGRAVITY_USER_DIR/mcp_config.json" "$GEMINI_USER_DIR/mcp_config.json" 2>/dev/null || true fi # ============================================================================== diff --git a/gemini-terminal/rootfs/usr/local/bin/gemini b/gemini-terminal/rootfs/usr/local/bin/gemini new file mode 100644 index 0000000..1cbfb85 --- /dev/null +++ b/gemini-terminal/rootfs/usr/local/bin/gemini @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# ============================================================================= +# gemini - Backward compatibility wrapper for Antigravity CLI (agy) +# ============================================================================= +# Gemini CLI has been transitioned to Antigravity CLI (agy). +# This wrapper routes legacy 'gemini' commands directly to 'agy'. + +export PATH="/usr/local/bin:/usr/bin:/bin:/root/.antigravity/bin:/data/.antigravity/bin:/root/.local/bin:/data/.local/bin:$PATH" + +if [ -z "$SILENT_MIGRATION_NOTICE" ]; then + echo "[Info] Gemini CLI transitioned to Antigravity CLI (agy). Executing: agy $*" >&2 +fi + +AGY_BIN=$(which agy 2>/dev/null || find /root /usr /data -name "agy" -type f 2>/dev/null | head -n 1 || echo "agy") +exec "$AGY_BIN" "$@" diff --git a/gemini-terminal/rootfs/usr/local/bin/gemini-session.sh b/gemini-terminal/rootfs/usr/local/bin/gemini-session.sh index 2b775d9..c2786c8 100644 --- a/gemini-terminal/rootfs/usr/local/bin/gemini-session.sh +++ b/gemini-terminal/rootfs/usr/local/bin/gemini-session.sh @@ -16,8 +16,8 @@ fi # Change to Home Assistant config directory cd /homeassistant -# Set up PATH - ensure node, npm globals, and standard bins are available -export PATH="/usr/local/bin:/usr/bin:/bin:$PATH" +# Set up PATH - ensure agy and standard bins are available +export PATH="/usr/local/bin:/usr/bin:/bin:/root/.antigravity/bin:/data/.antigravity/bin:/root/.local/bin:/data/.local/bin:$PATH" # Configure git if not already configured if [ ! -f "${HOME}/.gitconfig" ]; then @@ -41,14 +41,14 @@ ADDON_VERSION=$(cat /data/.addon_version 2>/dev/null || echo "unknown") show_banner() { clear echo "" - echo -e "${BLUE}${BOLD}Gemini Terminal${NC} ${GRAY}v${ADDON_VERSION}${NC}" - echo -e "${GRAY}Terminal interface for Google's Gemini CLI${NC}" + echo -e "${BLUE}${BOLD}Antigravity CLI${NC} ${GRAY}v${ADDON_VERSION}${NC}" + echo -e "${GRAY}Terminal interface powered by Antigravity CLI (agy)${NC}" echo "" echo -e "${GRAY}────────────────────────────────────────────────────────────${NC}" echo "" } -# Function to show shell help (after exiting gemini) +# Function to show shell help (after exiting agy) show_shell_help() { echo "" echo -e "${GRAY}────────────────────────────────────────────────────────────${NC}" @@ -56,7 +56,7 @@ show_shell_help() { echo -e "${WHITE}Dropped to shell.${NC} Working directory: ${CYAN}/homeassistant${NC}" echo "" echo -e "${BOLD}Commands${NC}" - echo -e " ${GREEN}gemini${NC} Restart the AI coding agent" + echo -e " ${GREEN}agy${NC} (or ${GREEN}gemini${NC}) Restart the Antigravity coding agent" echo -e " ${GREEN}ha-logs${NC} ${GRAY}${NC} View logs (core, error, supervisor, host)" echo -e " ${GREEN}hab${NC} ${GRAY}${NC} HA admin CLI (entities, areas, dashboards, backups)" echo -e " ${GREEN}zigporter${NC} ${GRAY}${NC} Zigbee tools (rename, inspect, stale, mesh)" @@ -69,10 +69,11 @@ echo -e "${WHITE}Working directory:${NC} ${CYAN}/homeassistant${NC}" echo -e "${GRAY}Customize AI behavior by editing ${NC}${GREEN}AGENTS.md${NC} ${GRAY}in your config folder${NC}" echo "" -# Launch Gemini -gemini --no-acp +# Launch Antigravity CLI (agy) +AGY_BIN=$(which agy 2>/dev/null || find /root /usr /data -name "agy" -type f 2>/dev/null | head -n 1 || echo "agy") +"$AGY_BIN" -# When gemini exits, show help and drop to bash +# When agy exits, show help and drop to bash show_shell_help # Start interactive bash shell diff --git a/repository.yaml b/repository.yaml index 9f44b5c..ba8a02a 100644 --- a/repository.yaml +++ b/repository.yaml @@ -1,4 +1,4 @@ -name: Gemini Terminal for Home Assistant +name: Antigravity CLI for Home Assistant url: https://github.com/oded996/gemini-cli-home-assistant-addons maintainer: Gemini CLI Team diff --git a/tests/__pycache__/test_config_and_scripts.cpython-312.pyc b/tests/__pycache__/test_config_and_scripts.cpython-312.pyc new file mode 100644 index 0000000..d0f5b53 Binary files /dev/null and b/tests/__pycache__/test_config_and_scripts.cpython-312.pyc differ diff --git a/tests/test_config_and_scripts.py b/tests/test_config_and_scripts.py new file mode 100644 index 0000000..1fc6ca0 --- /dev/null +++ b/tests/test_config_and_scripts.py @@ -0,0 +1,86 @@ +import os +import json +import subprocess +import unittest + +REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +class TestAddonConfigAndScripts(unittest.TestCase): + + def test_shell_script_syntax(self): + """Verify that all bash scripts in the repository have valid syntax.""" + scripts_to_check = [ + os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "etc", "s6-overlay", "s6-rc.d", "init-gemini", "run"), + os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "etc", "s6-overlay", "s6-rc.d", "ha-gemini", "run"), + os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "usr", "local", "bin", "gemini-session.sh"), + os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "usr", "local", "bin", "ha-mcp"), + os.path.join(REPO_ROOT, "config", "scripts", "gemini-session-picker.sh"), + ] + + gemini_alias = os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "usr", "local", "bin", "gemini") + if os.path.exists(gemini_alias): + scripts_to_check.append(gemini_alias) + + for script_path in scripts_to_check: + if not os.path.exists(script_path): + continue + with self.subTest(script=os.path.basename(script_path)): + res = subprocess.run(["bash", "-n", script_path], capture_output=True, text=True) + self.assertEqual(res.returncode, 0, f"Syntax error in {script_path}:\n{res.stderr}") + + def test_mcp_config_json_schema(self): + """Verify that mcp_config.json contains valid mcpServers configuration for agy.""" + sample_mcp_config = { + "mcpServers": { + "home-assistant": { + "command": "node", + "args": ["/opt/ha-mcp-server/index.js"], + "env": { + "SUPERVISOR_TOKEN": "test_token" + } + } + } + } + self.assertIn("mcpServers", sample_mcp_config) + self.assertIn("home-assistant", sample_mcp_config["mcpServers"]) + ha_server = sample_mcp_config["mcpServers"]["home-assistant"] + self.assertEqual(ha_server["command"], "node") + self.assertIn("/opt/ha-mcp-server/index.js", ha_server["args"]) + + def test_dockerfile_antigravity_installer(self): + """Verify that Dockerfile installs agy via curl and not @google/gemini-cli.""" + dockerfile_path = os.path.join(REPO_ROOT, "gemini-terminal", "Dockerfile") + with open(dockerfile_path, "r", encoding="utf-8") as f: + content = f.read() + + self.assertNotIn("@google/gemini-cli", content, "Dockerfile should not install deprecated @google/gemini-cli npm package") + self.assertIn("https://antigravity.google/cli/install.sh", content, "Dockerfile must use Antigravity CLI install script") + + def test_init_script_antigravity_vars(self): + """Verify init-gemini/run exports ANTIGRAVITY environment variables and creates mcp_config.json.""" + init_script_path = os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "etc", "s6-overlay", "s6-rc.d", "init-gemini", "run") + with open(init_script_path, "r", encoding="utf-8") as f: + content = f.read() + + self.assertIn("ANTIGRAVITY_CONFIG_DIR", content, "init-gemini script should set ANTIGRAVITY_CONFIG_DIR") + self.assertIn("mcp_config.json", content, "init-gemini script should create/configure mcp_config.json") + + def test_gemini_session_launches_agy(self): + """Verify gemini-session.sh executes agy instead of gemini --no-acp.""" + session_script_path = os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "usr", "local", "bin", "gemini-session.sh") + with open(session_script_path, "r", encoding="utf-8") as f: + content = f.read() + + self.assertIn("agy", content, "gemini-session.sh should launch agy") + + def test_gemini_alias_wrapper_exists(self): + """Verify that /usr/local/bin/gemini alias script exists and calls agy.""" + alias_path = os.path.join(REPO_ROOT, "gemini-terminal", "rootfs", "usr", "local", "bin", "gemini") + self.assertTrue(os.path.exists(alias_path), "gemini alias wrapper script should exist at rootfs/usr/local/bin/gemini") + with open(alias_path, "r", encoding="utf-8") as f: + content = f.read() + self.assertIn("agy", content, "gemini wrapper script should execute agy") + + +if __name__ == "__main__": + unittest.main()