Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/server/src/provider/AntigravityInstallation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
14 changes: 14 additions & 0 deletions apps/server/src/provider/AntigravityInstallation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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",
)(
Expand Down Expand Up @@ -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))) {
Comment thread
Marve10s marked this conversation as resolved.
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
Expand Down
Loading