Skip to main content

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:

  1. Antigravity CLI (agy): A high-integration tool designed for advanced agentic workflows, native subagent support, and deep context management.
  2. 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​

Workflow and Comparison of Antigravity CLI and OpenCode

FeatureAntigravity CLI (agy)OpenCode (opencode)
Primary FocusAgentic orchestration with subagents and slash commandsOpen-source multi-provider interactive TUI
Supported ModelsGemini family (Flash, Pro) and associated modelsGemini, Claude 3.5 Sonnet, GPT-4o, local Ollama
User InterfaceInteractive console + Slash Commands (/)Terminal User Interface (TUI with Bubble Tea)
Automated ModeIntegrated into terminal pipelinesopencode run "<prompt>" (headless mode)
File-Level ContextContextual loading and reading via tool callsExplicit 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​

Open a PowerShell terminal and run the one-step installation script:

Installing agy on Windows
# Automatic download and configuration in your PATH
irm https://antigravity.google/cli/install.ps1 | iex

# Verify installation
agy --version

Authenticating in agy​

When running agy for the first time:

  1. The console will display an authentication URL or automatically open your default browser.
  2. Sign in with your authorized credentials.
  3. Upon completing the login process, the terminal will display the interactive prompt:
    Antigravity CLI: Ready
    Help: Type /help for available slash commands
    Status: Connected

3. Installing OpenCode (opencode)​

OpenCode is an open-source project distributed as a self-contained binary and via global package managers.

Binary Installation​

Run the official installation script for Windows:

Installing OpenCode on 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

Configuring Providers and Models in OpenCode​

OpenCode allows you to choose your preferred language model. To connect your API Keys:

Configuring credentials in OpenCode
# 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.
Direct Environment Variables

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:

Navigate to the project and launch the agent
# 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:

Initial diagnostic query
Inspect the project root and tell me which Flutter dependencies are declared in pubspec.yaml

What to expect:

  1. The agent invokes a file reading tool (view_file or read_file on pubspec.yaml).
  2. You will see the requested action in the terminal.
  3. The agent will reply with a summary of the declared dependencies (such as flutter: sdk: flutter and cupertino_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.