feat(setup): support Command Code MCP registration (#645)
Configure Command Code's user-scope MCP config (~/.commandcode/mcp.json)
with an explicit stdio registration ({ transport, enabled, command, args })
under mcpServers, matching the shape Command Code writes itself.
Adds the commandcode setup client and dialect, detection/alignment support,
README/docs entries, and regenerated product catalog.
This commit is contained in:
@@ -35,9 +35,14 @@ afterEach(() => vi.unstubAllEnvs());
|
||||
|
||||
const getClients = (home: string) =>
|
||||
supportedClients(home).filter(({ name }) =>
|
||||
["opencode", "antigravity", "copilot_cli", "vscode", "devin"].includes(
|
||||
name,
|
||||
),
|
||||
[
|
||||
"opencode",
|
||||
"antigravity",
|
||||
"copilot_cli",
|
||||
"commandcode",
|
||||
"vscode",
|
||||
"devin",
|
||||
].includes(name),
|
||||
);
|
||||
|
||||
describe("additional client configuration dialects", () => {
|
||||
@@ -45,6 +50,7 @@ describe("additional client configuration dialects", () => {
|
||||
"opencode",
|
||||
"antigravity",
|
||||
"copilot_cli",
|
||||
"commandcode",
|
||||
"vscode",
|
||||
"devin",
|
||||
] as const)("registers, reads back, and uninstalls %s", async (name) => {
|
||||
@@ -90,6 +96,13 @@ describe("additional client configuration dialects", () => {
|
||||
});
|
||||
if (name === "copilot_cli")
|
||||
expect(registration).toMatchObject({ type: "stdio", tools: ["*"] });
|
||||
if (name === "commandcode")
|
||||
expect(registration).toMatchObject({
|
||||
transport: "stdio",
|
||||
enabled: true,
|
||||
command: "npx",
|
||||
args: command.slice(1),
|
||||
});
|
||||
|
||||
const statuses = await readClientRegistrationStatuses(home);
|
||||
expect(statuses).toEqual(
|
||||
|
||||
@@ -60,6 +60,7 @@ describe("client configuration filesystem lifecycle", () => {
|
||||
"opencode",
|
||||
"antigravity",
|
||||
"copilot_cli",
|
||||
"commandcode",
|
||||
"vscode",
|
||||
]);
|
||||
expect(
|
||||
|
||||
@@ -126,3 +126,59 @@ describe("client registration status", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("commandcode registration status", () => {
|
||||
const writeCommandcodeRegistration = async (
|
||||
home: string,
|
||||
registration: Record<string, unknown>,
|
||||
): Promise<void> => {
|
||||
await mkdir(join(home, ".commandcode"));
|
||||
await writeFile(
|
||||
join(home, ".commandcode/mcp.json"),
|
||||
JSON.stringify({ mcpServers: { rea: registration } }),
|
||||
);
|
||||
};
|
||||
|
||||
const ownedArgs = (): readonly string[] => [
|
||||
"-y",
|
||||
PRODUCT_IDENTITY.registrationPackageSpecifier,
|
||||
"mcp",
|
||||
];
|
||||
|
||||
it.each([undefined, "sse"])(
|
||||
"reports transport %j as invalid",
|
||||
async (transport) => {
|
||||
const home = await createTestTempDirectory("rea-commandcode-transport-");
|
||||
await writeCommandcodeRegistration(home, {
|
||||
...(transport === undefined ? {} : { transport }),
|
||||
command: "npx",
|
||||
args: [...ownedArgs()],
|
||||
});
|
||||
|
||||
expect(await readClientRegistrationStatuses(home)).toEqual([
|
||||
expect.objectContaining({
|
||||
client: "commandcode",
|
||||
state: "invalid",
|
||||
command: [],
|
||||
}),
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it("reports a disabled registration as stale", async () => {
|
||||
const home = await createTestTempDirectory("rea-commandcode-disabled-");
|
||||
await writeCommandcodeRegistration(home, {
|
||||
transport: "stdio",
|
||||
enabled: false,
|
||||
command: "npx",
|
||||
args: [...ownedArgs()],
|
||||
});
|
||||
|
||||
expect(await readClientRegistrationStatuses(home)).toEqual([
|
||||
expect.objectContaining({
|
||||
client: "commandcode",
|
||||
state: "stale",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user