CLI Installation
To apply the Human-in-the-Lead paradigm in our Flutter projects, we need an agile and robust command-line interface. In this session, you will learn how to install, authenticate, and operate two leading tools in the agentic terminal ecosystem:
- Antigravity CLI (
agy): A high-integration tool designed for advanced agentic workflows, native subagent support, and deep context management. - OpenCode CLI (
opencode): An open-source terminal client with a Go-powered TUI, compatible with multiple model providers (Google Gemini, Anthropic Claude, OpenAI, and local models via Ollama).
1. Tool Overview
| Feature | Antigravity CLI (agy) | OpenCode (opencode) |
|---|---|---|
| Primary Focus | Agentic orchestration with subagents and slash commands | Open-source multi-provider interactive TUI |
| Supported Models | Gemini family (Flash, Pro) and associated models | Gemini, Claude 3.5 Sonnet, GPT-4o, local Ollama |
| User Interface | Interactive console + Slash Commands (/) | Terminal User Interface (TUI with Bubble Tea) |
| Automated Mode | Integrated into terminal pipelines | opencode run "<prompt>" (headless mode) |
| File-Level Context | Contextual loading and reading via tool calls | Explicit inclusion with at-sign (@file) |
2. Installing Antigravity CLI (agy)
Prerequisites
- Git installed and configured on your system (
git --version). - An active internet connection and developer account for authentication.
Installation Process
- Windows (PowerShell)
- macOS (Terminal / zsh)
- Linux (Bash / Zsh)
Open a PowerShell terminal and run the one-step installation script:
# Automatic download and configuration in your PATH
irm https://antigravity.google/cli/install.ps1 | iex
# Verify installation
agy --version
Open your terminal and run the official script via curl:
# Download and PATH configuration
curl -fsSL https://antigravity.google/cli/install.sh | bash
# Verify installation
agy --version
# One-step download and installation
curl -fsSL https://antigravity.google/cli/install.sh | bash
# Verify installation
agy --version
Authenticating in agy
When running agy for the first time:
- The console will display an authentication URL or automatically open your default browser.
- Sign in with your authorized credentials.
- Upon completing the login process, the terminal will display the interactive prompt:
Antigravity CLI: ReadyHelp: Type /help for available slash commandsStatus: Connected
3. Installing OpenCode (opencode)
OpenCode is an open-source project distributed as a self-contained binary and via global package managers.
Binary Installation
- Windows (PowerShell)
- macOS / Linux
Run the official installation script for Windows:
# Run remote installer
irm https://opencode.ai/install.ps1 | iex
# Alternative via npm (if you have Node.js installed):
npm install -g opencode
Verify that the executable is in your PATH:
opencode --version
Use the automated installation script via curl:
# Using the official installer
curl -fsSL https://opencode.ai/install | bash
# Or on macOS using Homebrew:
brew install anomalyco/tap/opencode
# Alternative via npm:
npm install -g opencode
Verify the version:
opencode --version
Configuring Providers and Models in OpenCode
OpenCode allows you to choose your preferred language model. To connect your API Keys:
# Launch the interactive authentication wizard:
opencode auth login
The wizard will prompt you for the provider you want to configure:
- Google Gemini: Requires
GEMINI_API_KEY. - Anthropic: Requires
ANTHROPIC_API_KEY(for Claude 3.5 Sonnet). - OpenAI: Requires
OPENAI_API_KEY(for GPT-4o). - Ollama: For 100% local GPU inference without API costs.
You can also export your key directly in your .bashrc, .zshrc, or Windows Environment Variables:
export GEMINI_API_KEY="AIzaSy..."
# or
export ANTHROPIC_API_KEY="sk-ant-..."
4. Getting Started in the Flutter Project Directory
Once your tool of choice (agy or opencode) is installed, the standard workflow consists of launching the console directly inside the root of the Flutter project we created in sessions 18 and 19:
# 1. Navigate to your Flutter application folder (e.g., fittrack)
cd ~/dev/flutter/fittrack
# 2. Verify that your Flutter environment is healthy
flutter doctor
# 3. Launch your agent:
agy
# (or if using OpenCode):
opencode
Agent Health Check
Once inside the agent's interactive prompt, run an initial diagnostic query:
Inspect the project root and tell me which Flutter dependencies are declared in pubspec.yaml
What to expect:
- The agent invokes a file reading tool (
view_fileorread_fileonpubspec.yaml). - You will see the requested action in the terminal.
- The agent will reply with a summary of the declared dependencies (such as
flutter: sdk: flutterandcupertino_icons).
With the environment up and running, in the next lesson we will explore context management: what the model actually sees, how tokens are calculated, and why context determines the quality of the generated code.