feat(clients): register Grok Build and Grok Bot during setup
Detect both clients and install the local REA MCP registration the same way setup already handles the other agents. Grok Build edits only the REA tables in its TOML config, sets startup_timeout_sec to 30, and removes rea from disabled_mcp_servers. Grok Bot writes mcpServers.rea into mcp.json. Setup does not call the account API. Uninstall keeps comments in an inline table whose only server was REA.
This commit is contained in:
@@ -25,7 +25,9 @@ beforeEach(() => {
|
||||
"CLAUDE_CONFIG_DIR",
|
||||
"CODEX_HOME",
|
||||
"COPILOT_HOME",
|
||||
"GROK_HOME",
|
||||
"OPENCODE_CONFIG",
|
||||
"SAND_DATA_ROOT",
|
||||
"XDG_CONFIG_HOME",
|
||||
])
|
||||
vi.stubEnv(name, undefined);
|
||||
@@ -398,6 +400,40 @@ describe("platform-aware client config paths", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("honors Grok Build and Grok Bot configuration roots", () => {
|
||||
expect(
|
||||
supportedClients("/home/a", "linux", {
|
||||
GROK_HOME: "/custom/grok",
|
||||
SAND_DATA_ROOT: "/custom/grokbot",
|
||||
}).filter(({ name }) => name === "grok_build" || name === "grok_bot"),
|
||||
).toEqual([
|
||||
expect.objectContaining({
|
||||
name: "grok_build",
|
||||
displayName: "Grok Build",
|
||||
configPath: "/custom/grok/config.toml",
|
||||
markerPath: "/custom/grok",
|
||||
format: "grok",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
name: "grok_bot",
|
||||
displayName: "Grok Bot",
|
||||
configPath: "/custom/grokbot/mcp.json",
|
||||
markerPath: "/custom/grokbot",
|
||||
format: "json",
|
||||
}),
|
||||
]);
|
||||
expect(
|
||||
supportedClients("/home/a", "linux", {
|
||||
SAND_DATA_ROOT: "relative/sand",
|
||||
}).find(({ name }) => name === "grok_bot")?.configPath,
|
||||
).toBe("/home/a/.grokbot/mcp.json");
|
||||
expect(
|
||||
supportedClients("/home/a", "darwin", {}).find(
|
||||
({ name }) => name === "grok_build",
|
||||
)?.configPath,
|
||||
).toBe("/home/a/.grok/config.toml");
|
||||
});
|
||||
|
||||
it("honors Copilot CLI and Devin platform configuration roots", () => {
|
||||
expect(
|
||||
supportedClients("/home/a", "linux", {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,30 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
import { readClientRegistrationStatuses } from "../../../src/application/ClientRegistrationStatus.js";
|
||||
import { PRODUCT_IDENTITY } from "../../../src/identity.js";
|
||||
|
||||
beforeEach(() => {
|
||||
for (const name of [
|
||||
"APPDATA",
|
||||
"CLAUDE_CONFIG_DIR",
|
||||
"CODEX_HOME",
|
||||
"COPILOT_HOME",
|
||||
"GROK_HOME",
|
||||
"OPENCODE_CONFIG",
|
||||
"SAND_DATA_ROOT",
|
||||
"XDG_CONFIG_HOME",
|
||||
])
|
||||
vi.stubEnv(name, undefined);
|
||||
});
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
describe("client registration status", () => {
|
||||
it("discovers Claude Code from its config file without a marker directory", async () => {
|
||||
const home = await createTestTempDirectory("rea-claude-config-only-");
|
||||
@@ -206,6 +223,43 @@ describe("Node-wrapped registration policy", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each([1, 30])(
|
||||
"checks Grok Build startup timeout %d independently of launcher",
|
||||
async (timeout) => {
|
||||
const home = await createTestTempDirectory("rea-grok-registration-");
|
||||
await mkdir(join(home, ".grok"));
|
||||
const entry = resolve("scripts/rea.mjs");
|
||||
await writeFile(
|
||||
join(home, ".grok/config.toml"),
|
||||
`[mcp_servers.rea]\ncommand = ${JSON.stringify(process.execPath)}\nargs = [${JSON.stringify(entry)}, "mcp"]\nstartup_timeout_sec = ${String(timeout)}\n`,
|
||||
);
|
||||
const statuses = await readClientRegistrationStatuses(home, entry, {
|
||||
environment: {},
|
||||
});
|
||||
expect(statuses).toEqual([
|
||||
expect.objectContaining({
|
||||
client: "grok_build",
|
||||
state: timeout === 30 ? "aligned" : "stale",
|
||||
}),
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it("reports Grok Build stale when rea is listed in disabled_mcp_servers", async () => {
|
||||
const home = await createTestTempDirectory("rea-grok-disabled-status-");
|
||||
await mkdir(join(home, ".grok"));
|
||||
const entry = resolve("scripts/rea.mjs");
|
||||
await writeFile(
|
||||
join(home, ".grok/config.toml"),
|
||||
`disabled_mcp_servers = ["rea"]\n[mcp_servers.rea]\ncommand = ${JSON.stringify(process.execPath)}\nargs = [${JSON.stringify(entry)}, "mcp"]\nstartup_timeout_sec = 30\n`,
|
||||
);
|
||||
expect(
|
||||
await readClientRegistrationStatuses(home, entry, { environment: {} }),
|
||||
).toEqual([
|
||||
expect.objectContaining({ client: "grok_build", state: "stale" }),
|
||||
]);
|
||||
});
|
||||
|
||||
it("checks a direct-launcher Codex startup timeout without Node wrapping", async () => {
|
||||
const home = await createTestTempDirectory("rea-direct-registration-");
|
||||
await mkdir(join(home, ".codex"));
|
||||
|
||||
@@ -27,6 +27,8 @@ beforeEach(async () => {
|
||||
CLAUDE_CONFIG_DIR: home,
|
||||
CODEX_HOME: join(home, ".codex"),
|
||||
COPILOT_HOME: join(home, ".copilot"),
|
||||
GROK_HOME: join(home, ".grok"),
|
||||
SAND_DATA_ROOT: join(home, ".grokbot"),
|
||||
XDG_CONFIG_HOME: join(home, ".config"),
|
||||
OPENCODE_CONFIG: join(home, ".config", "opencode", "opencode.jsonc"),
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user