diff --git a/apps/server/src/provider/AntigravityInstallation.test.ts b/apps/server/src/provider/AntigravityInstallation.test.ts index 0528cb4972c9..8d56f1980580 100644 --- a/apps/server/src/provider/AntigravityInstallation.test.ts +++ b/apps/server/src/provider/AntigravityInstallation.test.ts @@ -761,6 +761,34 @@ it.layer(NodeServices.layer)("Antigravity installation", (it) => { }), ); + it.effect.skipIf(HostProcessPlatform.defaultValue() === "win32")( + "names the Antigravity CLI when only the CLI is on PATH", + () => + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-agy-cli-test-" }); + const cliDirectory = path.join(baseDir, "cli"); + const emptyDirectory = path.join(baseDir, "empty"); + yield* fs.makeDirectory(cliDirectory); + yield* fs.makeDirectory(emptyDirectory); + yield* fs.writeFileString(path.join(cliDirectory, "agy"), "cli", { mode: 0o755 }); + const { installation } = yield* makeHarness({ baseDir }); + expect( + yield* installation.resolve(undefined, { PATH: emptyDirectory }).pipe(Effect.flip), + ).toMatchObject({ + detail: + "Antigravity is not installed. Install it in this environment or set a custom executable path.", + }); + expect( + yield* installation.resolve(undefined, { PATH: cliDirectory }).pipe(Effect.flip), + ).toMatchObject({ + detail: + "The Antigravity CLI is installed, but T3 Code runs the separate Antigravity ACP agent. Install it in this environment or set a custom executable path.", + }); + }), + ); + it.effect("keeps leased releases available while new sessions resolve the new release", () => Effect.gen(function* () { const { installation, fs, stagingReleased } = yield* makeHarness({ previous: true }); diff --git a/apps/server/src/provider/AntigravityInstallation.ts b/apps/server/src/provider/AntigravityInstallation.ts index ebcbd496ee3e..c40b2ffa49bd 100644 --- a/apps/server/src/provider/AntigravityInstallation.ts +++ b/apps/server/src/provider/AntigravityInstallation.ts @@ -6,6 +6,7 @@ import { HostProcessEnvironment, HostProcessPlatform, } from "@t3tools/shared/hostProcess"; +import { isCommandAvailable } from "@t3tools/shared/shell"; import * as Clock from "effect/Clock"; import * as Cause from "effect/Cause"; import * as Context from "effect/Context"; @@ -400,6 +401,13 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma .map((directory) => path.resolve(directory, binary)); }; + const cliOnPath = (processEnvironment = environment) => + isCommandAvailable("agy", { env: processEnvironment }).pipe( + Effect.provideService(HostProcessPlatform, platform), + Effect.provideService(FileSystem.FileSystem, fs), + Effect.provideService(Path.Path, path), + ); + const resolve: AntigravityInstallationService["resolve"] = Effect.fn( "AntigravityInstallation.resolve", )( @@ -427,6 +435,12 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma const selected = yield* fromExternal(candidate, "path"); if (selected) return selected; } + if (releaseAsset && (yield* cliOnPath(processEnvironment))) { + return yield* installationError( + "resolve", + "The Antigravity CLI is installed, but T3 Code runs the separate Antigravity ACP agent. Install it in this environment or set a custom executable path.", + ); + } return yield* installationError( "resolve", releaseAsset