Revert "feat: add Antigravity IDE module" (#576)
Reverts coder/registry#558
This commit is contained in:
parent
0a8930d60d
commit
b143b7d9ba
@ -1,67 +0,0 @@
|
|||||||
---
|
|
||||||
display_name: Antigravity
|
|
||||||
description: Add a one-click button to launch Google Antigravity
|
|
||||||
icon: ../../../../.icons/antigravity.svg
|
|
||||||
verified: true
|
|
||||||
tags: [ide, antigravity, ai, google]
|
|
||||||
---
|
|
||||||
|
|
||||||
# Antigravity IDE
|
|
||||||
|
|
||||||
Add a button to open any workspace with a single click in [Antigravity IDE](https://antigravity.google).
|
|
||||||
|
|
||||||
Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder).
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "antigravity" {
|
|
||||||
count = data.coder_workspace.me.start_count
|
|
||||||
source = "registry.coder.com/coder/antigravity/coder"
|
|
||||||
version = "1.0.0"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Open in a specific directory
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "antigravity" {
|
|
||||||
count = data.coder_workspace.me.start_count
|
|
||||||
source = "registry.coder.com/coder/antigravity/coder"
|
|
||||||
version = "1.0.0"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
folder = "/home/coder/project"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configure MCP servers for Antigravity
|
|
||||||
|
|
||||||
Provide a JSON-encoded string via the `mcp` input. When set, the module writes the value to `~/.gemini/antigravity/mcp_config.json` using a `coder_script` on workspace start.
|
|
||||||
|
|
||||||
The following example configures Antigravity to use the GitHub MCP server with authentication facilitated by the [`coder_external_auth`](https://coder.com/docs/admin/external-auth#configure-a-github-oauth-app) resource.
|
|
||||||
|
|
||||||
```tf
|
|
||||||
module "antigravity" {
|
|
||||||
count = data.coder_workspace.me.start_count
|
|
||||||
source = "registry.coder.com/coder/antigravity/coder"
|
|
||||||
version = "1.0.0"
|
|
||||||
agent_id = coder_agent.example.id
|
|
||||||
folder = "/home/coder/project"
|
|
||||||
mcp = jsonencode({
|
|
||||||
mcpServers = {
|
|
||||||
"github" : {
|
|
||||||
"url" : "https://api.githubcopilot.com/mcp/",
|
|
||||||
"headers" : {
|
|
||||||
"Authorization" : "Bearer ${data.coder_external_auth.github.access_token}",
|
|
||||||
},
|
|
||||||
"type" : "http"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
data "coder_external_auth" "github" {
|
|
||||||
id = "github"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
import { describe, it, expect } from "bun:test";
|
|
||||||
import {
|
|
||||||
runTerraformApply,
|
|
||||||
runTerraformInit,
|
|
||||||
testRequiredVariables,
|
|
||||||
runContainer,
|
|
||||||
execContainer,
|
|
||||||
removeContainer,
|
|
||||||
findResourceInstance,
|
|
||||||
readFileContainer,
|
|
||||||
} from "~test";
|
|
||||||
|
|
||||||
describe("antigravity", async () => {
|
|
||||||
await runTerraformInit(import.meta.dir);
|
|
||||||
|
|
||||||
testRequiredVariables(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
});
|
|
||||||
|
|
||||||
it("default output", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
});
|
|
||||||
expect(state.outputs.antigravity_url.value).toBe(
|
|
||||||
"antigravity://coder.coder-remote/open?owner=default&workspace=default&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
||||||
);
|
|
||||||
|
|
||||||
const coder_app = state.resources.find(
|
|
||||||
(res) =>
|
|
||||||
res.type === "coder_app" &&
|
|
||||||
res.module === "module.vscode-desktop-core" &&
|
|
||||||
res.name === "vscode-desktop",
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(coder_app).not.toBeNull();
|
|
||||||
expect(coder_app?.instances.length).toBe(1);
|
|
||||||
expect(coder_app?.instances[0].attributes.order).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("adds folder", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
folder: "/foo/bar",
|
|
||||||
});
|
|
||||||
expect(state.outputs.antigravity_url.value).toBe(
|
|
||||||
"antigravity://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("adds folder and open_recent", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
folder: "/foo/bar",
|
|
||||||
open_recent: "true",
|
|
||||||
});
|
|
||||||
expect(state.outputs.antigravity_url.value).toBe(
|
|
||||||
"antigravity://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&openRecent&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("adds folder but not open_recent", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
folder: "/foo/bar",
|
|
||||||
openRecent: "false",
|
|
||||||
});
|
|
||||||
expect(state.outputs.antigravity_url.value).toBe(
|
|
||||||
"antigravity://coder.coder-remote/open?owner=default&workspace=default&folder=/foo/bar&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("adds open_recent", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
open_recent: "true",
|
|
||||||
});
|
|
||||||
expect(state.outputs.antigravity_url.value).toBe(
|
|
||||||
"antigravity://coder.coder-remote/open?owner=default&workspace=default&openRecent&url=https://mydeployment.coder.com&token=$SESSION_TOKEN",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("expect order to be set", async () => {
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
order: "22",
|
|
||||||
});
|
|
||||||
|
|
||||||
const coder_app = state.resources.find(
|
|
||||||
(res) =>
|
|
||||||
res.type === "coder_app" &&
|
|
||||||
res.module === "module.vscode-desktop-core" &&
|
|
||||||
res.name === "vscode-desktop",
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(coder_app).not.toBeNull();
|
|
||||||
expect(coder_app?.instances.length).toBe(1);
|
|
||||||
expect(coder_app?.instances[0].attributes.order).toBe(22);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("writes ~/.gemini/antigravity/mcp_config.json when mcp provided", async () => {
|
|
||||||
const id = await runContainer("alpine");
|
|
||||||
try {
|
|
||||||
const mcp = JSON.stringify({
|
|
||||||
servers: { demo: { url: "http://localhost:1234" } },
|
|
||||||
});
|
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
|
||||||
agent_id: "foo",
|
|
||||||
mcp,
|
|
||||||
});
|
|
||||||
const script = findResourceInstance(
|
|
||||||
state,
|
|
||||||
"coder_script",
|
|
||||||
"antigravity_mcp",
|
|
||||||
).script;
|
|
||||||
const resp = await execContainer(id, ["sh", "-c", script]);
|
|
||||||
if (resp.exitCode !== 0) {
|
|
||||||
console.log(resp.stdout);
|
|
||||||
console.log(resp.stderr);
|
|
||||||
}
|
|
||||||
expect(resp.exitCode).toBe(0);
|
|
||||||
const content = await readFileContainer(
|
|
||||||
id,
|
|
||||||
"/root/.gemini/antigravity/mcp_config.json",
|
|
||||||
);
|
|
||||||
expect(content).toBe(mcp);
|
|
||||||
} finally {
|
|
||||||
await removeContainer(id);
|
|
||||||
}
|
|
||||||
}, 10000);
|
|
||||||
});
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
terraform {
|
|
||||||
required_version = ">= 1.0"
|
|
||||||
|
|
||||||
required_providers {
|
|
||||||
coder = {
|
|
||||||
source = "coder/coder"
|
|
||||||
version = ">= 2.5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "agent_id" {
|
|
||||||
type = string
|
|
||||||
description = "The ID of a Coder agent."
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "folder" {
|
|
||||||
type = string
|
|
||||||
description = "The folder to open in Antigravity IDE."
|
|
||||||
default = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "open_recent" {
|
|
||||||
type = bool
|
|
||||||
description = "Open the most recent workspace or folder. Falls back to the folder if there is no recent workspace or folder to open."
|
|
||||||
default = false
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "order" {
|
|
||||||
type = number
|
|
||||||
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "group" {
|
|
||||||
type = string
|
|
||||||
description = "The name of a group that this app belongs to."
|
|
||||||
default = null
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "slug" {
|
|
||||||
type = string
|
|
||||||
description = "The slug of the app."
|
|
||||||
default = "antigravity"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "display_name" {
|
|
||||||
type = string
|
|
||||||
description = "The display name of the app."
|
|
||||||
default = "Antigravity IDE"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "mcp" {
|
|
||||||
type = string
|
|
||||||
description = "JSON-encoded string to configure MCP servers for Antigravity. When set, writes ~/.gemini/antigravity/mcp_config.json."
|
|
||||||
default = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
data "coder_workspace" "me" {}
|
|
||||||
|
|
||||||
data "coder_workspace_owner" "me" {}
|
|
||||||
|
|
||||||
locals {
|
|
||||||
mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : ""
|
|
||||||
}
|
|
||||||
|
|
||||||
module "vscode-desktop-core" {
|
|
||||||
source = "registry.coder.com/coder/vscode-desktop-core/coder"
|
|
||||||
version = "1.0.1"
|
|
||||||
|
|
||||||
agent_id = var.agent_id
|
|
||||||
|
|
||||||
web_app_icon = "/icon/antigravity.svg"
|
|
||||||
web_app_slug = var.slug
|
|
||||||
web_app_display_name = var.display_name
|
|
||||||
web_app_order = var.order
|
|
||||||
web_app_group = var.group
|
|
||||||
|
|
||||||
folder = var.folder
|
|
||||||
open_recent = var.open_recent
|
|
||||||
protocol = "antigravity"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "coder_script" "antigravity_mcp" {
|
|
||||||
count = var.mcp != "" ? 1 : 0
|
|
||||||
agent_id = var.agent_id
|
|
||||||
display_name = "Antigravity MCP"
|
|
||||||
icon = "/icon/antigravity.svg"
|
|
||||||
run_on_start = true
|
|
||||||
start_blocks_login = false
|
|
||||||
script = <<-EOT
|
|
||||||
#!/bin/sh
|
|
||||||
set -eu
|
|
||||||
mkdir -p "$HOME/.gemini/antigravity"
|
|
||||||
echo -n "${local.mcp_b64}" | base64 -d > "$HOME/.gemini/antigravity/mcp_config.json"
|
|
||||||
chmod 600 "$HOME/.gemini/antigravity/mcp_config.json"
|
|
||||||
EOT
|
|
||||||
}
|
|
||||||
|
|
||||||
output "antigravity_url" {
|
|
||||||
value = module.vscode-desktop-core.ide_uri
|
|
||||||
description = "Antigravity IDE URL."
|
|
||||||
}
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user