Skip to content

Commit ee5e4c3

Browse files
feat(provider-command-code): add Command Code CLI provider via ACP
Introduce dedicated @t3tools/provider-command-code package integrating the Command Code CLI (cmd acp) via the Agent Client Protocol over stdio. - Implement CommandCodeDriver and CommandCodeAdapterV2Driver with version probing, snapshot building, and session lifecycle - Wire commandCode into contracts (model/settings), apps/server (builtInDrivers, statusCache, model-manifest), apps/web, and apps/mobile - Map permission modes (approval-required, auto-accept-edits, auto, full-access) to Command Code ACP modes (default, auto-accept, plan, dont-ask, bypass) - Add unit and adapter configuration tests - Document setup and prerequisites in docs/user/providers-command-code.md
1 parent 171f8d8 commit ee5e4c3

26 files changed

Lines changed: 1244 additions & 19 deletions

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@t3tools/mobile-source-text": "file:./modules/t3-source-text",
7575
"@t3tools/mobile-terminal-native": "file:./modules/t3-terminal",
7676
"@t3tools/provider-acp-registry": "workspace:*",
77+
"@t3tools/provider-command-code": "workspace:*",
7778
"@t3tools/provider-core": "workspace:*",
7879
"@t3tools/provider-cursor": "workspace:*",
7980
"@t3tools/provider-grok": "workspace:*",

‎apps/mobile/src/lib/providerClients.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { isProviderDriverKind } from "@t3tools/contracts";
22
import { acpRegistryClient } from "@t3tools/provider-acp-registry/client";
3+
import { commandCodeClient } from "@t3tools/provider-command-code/client";
34
import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
45
import { cursorClient } from "@t3tools/provider-cursor/client";
56
import { grokClient } from "@t3tools/provider-grok/client";
@@ -12,6 +13,7 @@ const providerClients = makeProviderClientRegistry([
1213
grokClient,
1314
museClient,
1415
openCodeClient,
16+
commandCodeClient,
1517
piClient,
1618
acpRegistryClient,
1719
]);

‎apps/server/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@opencode-ai/sdk": "^1.3.15",
4343
"@t3tools/provider-acp": "workspace:*",
4444
"@t3tools/provider-acp-registry": "workspace:*",
45+
"@t3tools/provider-command-code": "workspace:*",
4546
"@t3tools/provider-core": "workspace:*",
4647
"@t3tools/provider-cursor": "workspace:*",
4748
"@t3tools/provider-grok": "workspace:*",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { expect, it } from "@effect/vitest";
2+
import {
3+
COMMAND_CODE_DEFAULT_INSTANCE_ID,
4+
COMMAND_CODE_PROVIDER,
5+
COMMAND_CODE_SUPPORTED_RUNTIME_MODES,
6+
commandCodeAcpSpawnArgs,
7+
commandCodeApprovalOptions,
8+
resolveCommandCodeAcpBaseModelId,
9+
resolveCommandCodeAuthMethodId,
10+
} from "@t3tools/provider-command-code/testing";
11+
import type * as EffectAcpSchema from "effect-acp/compat";
12+
13+
it("CommandCodeAdapterV2 config and options", () => {
14+
expect(COMMAND_CODE_PROVIDER).toBe("commandCode");
15+
expect(COMMAND_CODE_DEFAULT_INSTANCE_ID).toBe("commandCode");
16+
expect(commandCodeAcpSpawnArgs()).toEqual(["acp"]);
17+
expect(resolveCommandCodeAuthMethodId()).toBe("command-code-cli");
18+
expect(COMMAND_CODE_SUPPORTED_RUNTIME_MODES).toContain("approval-required");
19+
expect(COMMAND_CODE_SUPPORTED_RUNTIME_MODES).toContain("auto-accept-edits");
20+
expect(COMMAND_CODE_SUPPORTED_RUNTIME_MODES).toContain("auto");
21+
expect(COMMAND_CODE_SUPPORTED_RUNTIME_MODES).toContain("full-access");
22+
expect(resolveCommandCodeAcpBaseModelId(undefined)).toBe("gpt-5.6-sol");
23+
expect(resolveCommandCodeAcpBaseModelId("claude-opus-4-6")).toBe("claude-opus-4-6");
24+
25+
const permissionRequest: EffectAcpSchema.RequestPermissionRequest = {
26+
sessionId: "session-1",
27+
options: [
28+
{ optionId: "opt-1", name: "Approve once", kind: "allow_once" },
29+
{ optionId: "opt-2", name: "Allow all session", kind: "allow_always" },
30+
{ optionId: "opt-3", name: "Reject", kind: "reject_once" },
31+
],
32+
toolCall: {
33+
toolCallId: "call-1",
34+
title: "Write file",
35+
kind: "edit",
36+
},
37+
};
38+
39+
const options = commandCodeApprovalOptions(permissionRequest);
40+
expect(options.some((opt) => opt.decision === "cancel")).toBe(true);
41+
expect(options.some((opt) => opt.decision === "accept")).toBe(true);
42+
expect(options.some((opt) => opt.decision === "decline")).toBe(true);
43+
expect(options.some((opt) => opt.decision === "acceptForSession")).toBe(true);
44+
});

‎apps/server/src/provider/builtInDrivers.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import {
22
AcpRegistryDriver,
33
type AcpRegistryDriverEnv,
44
} from "@t3tools/provider-acp-registry/server";
5+
import {
6+
CommandCodeDriver,
7+
type CommandCodeDriverEnv,
8+
} from "@t3tools/provider-command-code/server";
59
import { AntigravityDriver, type AntigravityDriverEnv } from "./Drivers/AntigravityDriver.ts";
610
import { ClaudeDriver, type ClaudeDriverEnv } from "./Drivers/ClaudeDriver.ts";
711
import { CodexDriver, type CodexDriverEnv } from "./Drivers/CodexDriver.ts";
@@ -20,6 +24,7 @@ export type BuiltInDriversEnv =
2024
| AntigravityDriverEnv
2125
| ClaudeDriverEnv
2226
| CodexDriverEnv
27+
| CommandCodeDriverEnv
2328
| CursorDriverEnv
2429
| GrokDriverEnv
2530
| OpenCodeDriverEnv
@@ -33,6 +38,7 @@ export const BUILT_IN_DRIVERS: ReadonlyArray<AnyProviderDriver<BuiltInDriversEnv
3338
GrokDriver,
3439
OpenCodeDriver,
3540
AntigravityDriver,
41+
CommandCodeDriver,
3642
PiDriver,
3743
MuseDriver,
3844
AcpRegistryDriver,

‎apps/server/src/provider/model-manifest.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
{ "range": "<1.0.13", "status": "broken" }
5151
]
5252
},
53+
{
54+
"driver": "commandCode",
55+
"t3CodeRange": ">=0.0.42",
56+
"recommendedRange": ">=1.80.0",
57+
"ranges": [
58+
{ "range": ">=1.80.0", "status": "supported" },
59+
{ "range": "<1.80.0", "status": "unsupported" }
60+
]
61+
},
5362
{
5463
"driver": "opencode",
5564
"t3CodeRange": ">=0.0.42 <0.0.46",

‎apps/server/src/provider/providerStatusCache.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const BUILT_IN_DRIVER_ORDER: ReadonlyArray<string> = [
3636
"grok",
3737
"opencode",
3838
"antigravity",
39+
"commandCode",
3940
];
4041

4142
const driverRank = (driver: string): number => {

‎apps/web/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@t3tools/client-runtime": "workspace:*",
3131
"@t3tools/contracts": "workspace:*",
3232
"@t3tools/provider-acp-registry": "workspace:*",
33+
"@t3tools/provider-command-code": "workspace:*",
3334
"@t3tools/provider-core": "workspace:*",
3435
"@t3tools/provider-cursor": "workspace:*",
3536
"@t3tools/provider-grok": "workspace:*",

‎apps/web/src/components/settings/providerDriverMeta.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ProviderDriverKind,
66
} from "@t3tools/contracts";
77
import { acpRegistryClient } from "@t3tools/provider-acp-registry/client";
8+
import { commandCodeClient } from "@t3tools/provider-command-code/client";
89
import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
910
import { cursorClient } from "@t3tools/provider-cursor/client";
1011
import { grokClient } from "@t3tools/provider-grok/client";
@@ -31,6 +32,7 @@ export const providerClients = makeProviderClientRegistry([
3132
label: "Antigravity",
3233
settingsSchema: AntigravitySettings,
3334
},
35+
commandCodeClient,
3436
museClient,
3537
piClient,
3638
acpRegistryClient,

‎docs/user/install.md‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ and enable the provider you want. Installation, login, and configuration belong
134134
to that environment's machine, even when you connect from a phone or another
135135
computer.
136136

137-
| Provider | Install and authenticate |
138-
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
139-
| Codex | [Connect with ChatGPT](./providers-codex.md#connect-with-chatgpt), or install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`. |
140-
| Claude | Install [Claude Code](https://claude.com/product/claude-code), then run `claude auth login`. |
141-
| Cursor | Install [Cursor CLI](https://cursor.com/cli), then run `agent login`. |
142-
| Grok Build | Install [Grok Build CLI](https://x.ai/cli), then run `grok login`. |
143-
| OpenCode | Install [OpenCode](https://opencode.ai), then run `opencode auth login`. |
144-
| Antigravity | Install and sign in with Google from T3 Code's provider settings. |
145-
| Pi | Install [Pi](./providers-pi.md#set-up-pi) with Node.js 22.19 or newer, then run `pi` and `/login`. |
146-
| Muse Code | Install [Muse Code](https://dev.meta.ai/docs/muse-code) on the server, run `muse login`, then enable it in Settings → Providers. |
137+
| Provider | Install and authenticate |
138+
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
139+
| Codex | [Connect with ChatGPT](./providers-codex.md#connect-with-chatgpt), or install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`. |
140+
| Claude | Install [Claude Code](https://claude.com/product/claude-code), then run `claude auth login`. |
141+
| Cursor | Install [Cursor CLI](https://cursor.com/cli), then run `agent login`. |
142+
| Grok Build | Install [Grok Build CLI](https://x.ai/cli), then run `grok login`. |
143+
| OpenCode | Install [OpenCode](https://opencode.ai), then run `opencode auth login`. |
144+
| Antigravity | Install and sign in with Google from T3 Code's provider settings. |
145+
| Pi | Install [Pi](./providers-pi.md#set-up-pi) with Node.js 22.19 or newer, then run `pi` and `/login`. |
146+
| Muse Code | Install [Muse Code](https://dev.meta.ai/docs/muse-code) on the server, run `muse login`, then enable it in Settings → Providers. |
147+
| Command Code | Install [Command Code](./providers-command-code.md#set-up-command-code), then run `cmd login`. |
147148

148149
Provider CLIs must be on the server's `PATH`. If T3 Code cannot find one, set its
149150
**Binary path** in provider settings, especially when using a version manager.
@@ -172,8 +173,8 @@ their original values.
172173

173174
For provider-specific setup and accounts, see [Codex](./providers-codex.md),
174175
[Claude](./providers-claude.md), [OpenCode](./providers-opencode.md),
175-
[Antigravity](./providers-antigravity.md), [Pi](./providers-pi.md), and
176-
[Muse Code](./providers-muse.md).
176+
[Antigravity](./providers-antigravity.md), [Pi](./providers-pi.md), [Muse Code](./providers-muse.md), and
177+
[Command Code](./providers-command-code.md).
177178

178179
## Next steps
179180

0 commit comments

Comments
 (0)