The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 05:45 UTC
fix(opencode): nested custom commands like /git/commit run as commands (#29765)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 23:24 UTC
136fe433681740cd2b4de102b64ba4a7d80f2b4b
4 files changed
+8
-8
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
+3
-3
@@ -2453,7 +2453,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
2453
// session.command returns 204 without an inbox id; the stream drops before session.inbox.enqueued provides it.
2454
const { runtime, thread } = yield* resumed([
2455
out("command.list", "<any>"),
2456
- reply("command.list", { location: { directory: WORK }, data: [{ name: "hello" }] }),
2456
+ reply("command.list", { location: { directory: WORK }, data: [{ name: "git/hello" }] }),
2457
out("message.list", { sessionID: SESSION, order: "desc", limit: "1" }),
2458
reply("message.list", {
2459
data: [
@@ -2461,7 +2461,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
2461
],
2462
cursor: {},
2463
}),
2464
- out("session.command", { sessionID: SESSION, name: "hello", text: "WORLD" }),
2464
+ out("session.command", { sessionID: SESSION, name: "git/hello", text: "WORLD" }),
2465
reply("session.command", null),
2466
{ type: "runtime_exit", status: "success" } as const,
2467
out("event.subscribe"),
@@ -2498,7 +2498,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
2498
);
2499
yield* runtime.startTurn({
2500
...turnInput(thread),
2501
- message: { ...turnInput(thread).message, text: "/hello WORLD" },
2501
+ message: { ...turnInput(thread).message, text: "/git/hello WORLD" },
2502
});
2503
const collected = yield* Fiber.join(events);
2504
const texts = collected.flatMap((event) =>
packages/provider-opencode/src/server/adapter.test.ts
+3
-3
@@ -1363,7 +1363,7 @@ describe("OpenCodeAdapterV2", () => {
1363
return { stream: nativeEvents.stream };
1364
},
1365
},
1366
- command: { list: async () => ({ data: [{ name: "review" }] }) },
1366
+ command: { list: async () => ({ data: [{ name: "git/review" }] }) },
1367
session: {
1368
create: async () => ({ data: { id: sessionId, time: { created: 1, updated: 1 } } }),
1369
command: async (input: {
@@ -1382,9 +1382,9 @@ describe("OpenCodeAdapterV2", () => {
1382
},
1383
},
1384
});
1385
- const start = yield* harness.startTurn("/review staged changes").pipe(Effect.forkScoped);
1385
+ const start = yield* harness.startTurn("/git/review staged changes").pipe(Effect.forkScoped);
1386
const call = yield* Queue.take(calls);
1387
- assert.equal(call.command, "review");
1387
+ assert.equal(call.command, "git/review");
1388
assert.equal(call.arguments, "staged changes");
1389
assert.equal(call.model, "anthropic/claude-sonnet");
1390
yield* Effect.promise(() =>
packages/provider-opencode/src/server/adapter.ts
+1
-1
@@ -2978,7 +2978,7 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
2978
.map((part) => part.text)
2979
.join("\n")
2980
.trim();
2981
- const match = text?.match(/^\/([^\s/]+)(?:\s+([\s\S]*))?$/);
2981
+ const match = text?.match(/^\/(\S+)(?:\s+([\s\S]*))?$/);
2982
const command = match
2983
? (yield* OpenCodeRuntime.loadOpenCodeCommands(client).pipe(
2984
Effect.timeout("10 seconds"),
packages/provider-opencode/src/server/v2/adapter.ts
+1
-1
@@ -627,7 +627,7 @@ const agentFor = (input: ProviderAdapter.ProviderAdapterV2TurnInput) =>
627
input.runtimePolicy.interactionMode === "plan" ? "plan" : "build";
628
629
const commandOf = (text: string) => {
630
- const match = /^\/([^\s/]+)(?:\s+([\s\S]*))?$/.exec(text.trim());
630
+ const match = /^\/(\S+)(?:\s+([\s\S]*))?$/.exec(text.trim());
631
return match === null ? undefined : { name: match[1]!, text: match[2] ?? "" };
632
};
633