From 67f53249c8c0c19266fa79f87dbf5704211ab12a Mon Sep 17 00:00:00 2001 From: Netliloop Date: Fri, 20 Nov 2026 11:37:56 +0000 Subject: [PATCH] feat(agents): offer Antigravity instead of Gemini as an agent Accept --agent gemini as a deprecated alias for antigravity. --- docs/commands/agents.md | 2 +- docs/commands/create.md | 2 +- src/commands/agents/agents-create.ts | 3 +- src/commands/agents/agents.ts | 2 +- src/commands/agents/constants.ts | 9 ++- src/commands/agents/utils.ts | 13 +++- src/commands/create/create-action.ts | 4 +- src/commands/create/create.ts | 2 +- .../commands/agents/agents-create.test.ts | 66 +++++++++++++++++++ .../commands/create/create.test.ts | 48 ++++++++++++++ 10 files changed, 141 insertions(+), 10 deletions(-) diff --git a/docs/commands/agents.md b/docs/commands/agents.md index 1f6cafdee62..877afe0a234 100644 --- a/docs/commands/agents.md +++ b/docs/commands/agents.md @@ -58,7 +58,7 @@ netlify agents:create **Flags** -- `agent` (*string*) - agent type (claude, codex, gemini) +- `agent` (*string*) - agent type (claude, codex, antigravity) - `branch` (*string*) - git branch to work on - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON diff --git a/docs/commands/create.md b/docs/commands/create.md index e6f22f2596c..9b23d4d8fb0 100644 --- a/docs/commands/create.md +++ b/docs/commands/create.md @@ -23,7 +23,7 @@ netlify create **Flags** - `account-slug` (*string*) - account slug to create the project under -- `agent` (*string*) - agent type (claude, codex, gemini) +- `agent` (*string*) - agent type (claude, codex, antigravity) - `dir` (*string*) - directory to create the project in (defaults to current directory) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `git` (*string*) - create a git repository and push source code (e.g. github) diff --git a/src/commands/agents/agents-create.ts b/src/commands/agents/agents-create.ts index cdd98aba19c..65ccd845569 100644 --- a/src/commands/agents/agents-create.ts +++ b/src/commands/agents/agents-create.ts @@ -5,7 +5,7 @@ import { chalk, logAndThrowError, log, logJson } from '../../utils/command-helpe import { startSpinner, stopSpinner } from '../../lib/spinner.js' import type BaseCommand from '../base-command.js' import type { AgentRunner } from './types.js' -import { validatePrompt, validateAgent, formatStatus, getAgentName } from './utils.js' +import { validatePrompt, validateAgent, formatStatus, getAgentName, resolveAgentAlias } from './utils.js' import { AVAILABLE_AGENTS } from './constants.js' interface AgentCreateOptions extends OptionValues { @@ -51,6 +51,7 @@ export const agentsCreate = async (promptArg: string, options: AgentCreateOption default: 'claude', }) } else { + agent = resolveAgentAlias(agent) const agentIsValid = validateAgent(agent) if (agentIsValid !== true) { return logAndThrowError(agentIsValid) diff --git a/src/commands/agents/agents.ts b/src/commands/agents/agents.ts index b139a133119..56d29b041d4 100644 --- a/src/commands/agents/agents.ts +++ b/src/commands/agents/agents.ts @@ -15,7 +15,7 @@ export const createAgentsCommand = (program: BaseCommand) => { .argument('[prompt]', 'the prompt for the agent to execute') .description('Create and run a new agent task on your site') .option('-p, --prompt ', 'agent prompt') - .option('-a, --agent ', 'agent type (claude, codex, gemini)') + .option('-a, --agent ', 'agent type (claude, codex, antigravity)') .option('-m, --model ', 'model to use for the agent') .option('-b, --branch ', 'git branch to work on') .option('--project ', 'project ID or name (if not in a linked directory)') diff --git a/src/commands/agents/constants.ts b/src/commands/agents/constants.ts index 03b5f94b287..f3e2b475dc1 100644 --- a/src/commands/agents/constants.ts +++ b/src/commands/agents/constants.ts @@ -6,9 +6,16 @@ import { chalk } from '../../utils/command-helpers.js' export const AVAILABLE_AGENTS = [ { name: 'Claude', value: 'claude' }, { name: 'Codex', value: 'codex' }, - { name: 'Gemini', value: 'gemini' }, + { name: 'Antigravity', value: 'antigravity' }, ] as const +/** + * Agent names that are still accepted and mapped to their replacement + */ +export const DEPRECATED_AGENT_ALIASES: Record = { + gemini: 'antigravity', +} + /** * Valid agent task states */ diff --git a/src/commands/agents/utils.ts b/src/commands/agents/utils.ts index 308fb6fb717..2465b60da59 100644 --- a/src/commands/agents/utils.ts +++ b/src/commands/agents/utils.ts @@ -1,5 +1,5 @@ -import { AVAILABLE_AGENTS, STATUS_COLORS } from './constants.js' -import { chalk } from '../../utils/command-helpers.js' +import { AVAILABLE_AGENTS, DEPRECATED_AGENT_ALIASES, STATUS_COLORS } from './constants.js' +import { chalk, warn } from '../../utils/command-helpers.js' export const truncateText = (text: string, maxLength: number): string => { if (text.length <= maxLength) return text @@ -44,6 +44,15 @@ export const validatePrompt = (input: string): boolean | string => { return true } +export const resolveAgentAlias = (agent: string): string => { + if (!Object.hasOwn(DEPRECATED_AGENT_ALIASES, agent)) { + return agent + } + const replacement = DEPRECATED_AGENT_ALIASES[agent] + warn(`The "${agent}" agent is deprecated, using "${replacement}" instead.`) + return replacement +} + export const validateAgent = (agent: string): boolean | string => { const validAgents = AVAILABLE_AGENTS.map((a) => a.value) as string[] if (!validAgents.includes(agent)) { diff --git a/src/commands/create/create-action.ts b/src/commands/create/create-action.ts index 7a103d767e6..90fe5b1d67f 100644 --- a/src/commands/create/create-action.ts +++ b/src/commands/create/create-action.ts @@ -24,7 +24,7 @@ import { track } from '../../utils/telemetry/index.js' import { extractZip } from '../../utils/zip.js' import type BaseCommand from '../base-command.js' import type { AgentRunner } from '../agents/types.js' -import { validatePrompt, validateAgent, formatStatus } from '../agents/utils.js' +import { validatePrompt, validateAgent, formatStatus, resolveAgentAlias } from '../agents/utils.js' import type { SiteInfo } from '../../utils/types.js' const execFile = promisify(execFileCb) @@ -266,7 +266,7 @@ export const createAction = async (promptArg: string, options: CreateOptions, co } // Resolve agent (default to claude) - const agent = initialAgent ?? 'claude' + const agent = resolveAgentAlias(initialAgent ?? 'claude') const agentIsValid = validateAgent(agent) if (agentIsValid !== true) { return logAndThrowError(agentIsValid) diff --git a/src/commands/create/create.ts b/src/commands/create/create.ts index edac3dd6989..6178958ce1d 100644 --- a/src/commands/create/create.ts +++ b/src/commands/create/create.ts @@ -9,7 +9,7 @@ export const createCreateCommand = (program: BaseCommand) => { .description('Create a new Netlify project using an AI agent') .argument('[prompt]', 'description of the site to create') .option('-p, --prompt ', 'description of the site to create') - .option('--agent ', 'agent type (claude, codex, gemini)') + .option('--agent ', 'agent type (claude, codex, antigravity)') .option('-m, --model ', 'model to use for the agent') .option('-n, --name ', 'project name (subdomain)', validateSiteName) .option('-d, --dir ', 'directory to create the project in (defaults to current directory)') diff --git a/tests/integration/commands/agents/agents-create.test.ts b/tests/integration/commands/agents/agents-create.test.ts index 6ae89bc2368..d9116d09220 100644 --- a/tests/integration/commands/agents/agents-create.test.ts +++ b/tests/integration/commands/agents/agents-create.test.ts @@ -149,6 +149,72 @@ describe('agents:create command', () => { }) }) + test('should list the available agents when the agent is invalid', async (t) => { + await withSiteBuilder(t, async (builder) => { + await builder.build() + + await withMockApi(baseRoutes, async ({ apiUrl }) => { + await expect( + callCli(['agents:create', 'Create a form', '--agent', 'nonsense'], getCLIOptions({ apiUrl, builder })), + ).rejects.toThrow(/Invalid agent\. Available agents: claude, codex, antigravity$/m) + }) + }) + }) + + test('should send the antigravity agent in the create request', async (t) => { + const routes = [ + ...baseRoutes, + { + path: 'agent_runners', + method: 'POST' as const, + response: mockAgentRunner, + }, + ] + + await withSiteBuilder(t, async (builder) => { + await builder.build() + + await withMockApi(routes, async ({ apiUrl, requests }) => { + const cliResponse = (await callCli( + ['agents:create', 'Create a login form', '--agent', 'antigravity', '--branch', 'main'], + getCLIOptions({ apiUrl, builder }), + )) as string + + expect(cliResponse).toContain('Agent task created successfully!') + expect(cliResponse).not.toContain('deprecated') + const createRequest = requests.find((r) => r.path === '/api/v1/agent_runners' && r.method === 'POST') + expect(createRequest?.body).toEqual(expect.objectContaining({ agent: 'antigravity' })) + }) + }) + }) + + test('should map the deprecated gemini agent to antigravity with a warning', async (t) => { + const routes = [ + ...baseRoutes, + { + path: 'agent_runners', + method: 'POST' as const, + response: mockAgentRunner, + }, + ] + + await withSiteBuilder(t, async (builder) => { + await builder.build() + + await withMockApi(routes, async ({ apiUrl, requests }) => { + const cliResponse = (await callCli( + ['agents:create', 'Create a login form', '--agent', 'gemini', '--branch', 'main'], + getCLIOptions({ apiUrl, builder }), + )) as string + + expect(cliResponse).toContain('The "gemini" agent is deprecated, using "antigravity" instead') + expect(cliResponse).toContain('Agent task created successfully!') + const createRequest = requests.find((r) => r.path === '/api/v1/agent_runners' && r.method === 'POST') + expect(createRequest?.body).toEqual(expect.objectContaining({ agent: 'antigravity' })) + }) + }) + }) + test('should handle authentication errors', async (t) => { const routes = [ ...baseRoutes, diff --git a/tests/integration/commands/create/create.test.ts b/tests/integration/commands/create/create.test.ts index 632f9e0e29a..940b30de1e0 100644 --- a/tests/integration/commands/create/create.test.ts +++ b/tests/integration/commands/create/create.test.ts @@ -260,6 +260,54 @@ describe('create command', () => { }) }) + describe('--agent flag', () => { + test('should send the antigravity agent in the agent runner request', async (t) => { + const routes = [ + ...baseRoutes, + { path: 'test-account/sites', method: 'POST' as const, response: mockCreatedSite }, + { path: 'agent_runners', method: 'POST' as const, response: mockAgentRunner }, + ] + + await withSiteBuilder(t, async (builder) => { + await builder.build() + + await withMockApi(routes, async ({ apiUrl, requests }) => { + const cliResponse = (await callCli( + ['create', 'Build a site', '--agent', 'antigravity', '--no-wait', '--account-slug', 'test-account'], + getCLIOptions({ apiUrl, builder, env: { NETLIFY_SITE_ID: '' } }), + )) as string + + expect(cliResponse).not.toContain('deprecated') + const agentRunnerRequest = requests.find((r) => r.path === '/api/v1/agent_runners' && r.method === 'POST') + expect(agentRunnerRequest?.body).toEqual(expect.objectContaining({ agent: 'antigravity' })) + }) + }) + }) + + test('should map the deprecated gemini agent to antigravity with a warning', async (t) => { + const routes = [ + ...baseRoutes, + { path: 'test-account/sites', method: 'POST' as const, response: mockCreatedSite }, + { path: 'agent_runners', method: 'POST' as const, response: mockAgentRunner }, + ] + + await withSiteBuilder(t, async (builder) => { + await builder.build() + + await withMockApi(routes, async ({ apiUrl, requests }) => { + const cliResponse = (await callCli( + ['create', 'Build a site', '--agent', 'gemini', '--no-wait', '--account-slug', 'test-account'], + getCLIOptions({ apiUrl, builder, env: { NETLIFY_SITE_ID: '' } }), + )) as string + + expect(cliResponse).toContain('The "gemini" agent is deprecated, using "antigravity" instead') + const agentRunnerRequest = requests.find((r) => r.path === '/api/v1/agent_runners' && r.method === 'POST') + expect(agentRunnerRequest?.body).toEqual(expect.objectContaining({ agent: 'antigravity' })) + }) + }) + }) + }) + describe('interactive prompts', () => { test('should prompt for input when no prompt argument given', async (t) => { const routes = [