@devries-cameron20 / t3code-1 / commits / deb5b3941d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(composer): paths such as /tmp/build.sh no longer open the slash menu (#19671)

Nikita Maximilian Grimm committed Oct 18, 2026 at 21:27 UTC deb5b3941dc4c8b3f770621dca37ddb57c4ccec9
4 files changed +46
apps/web/src/composer-logic.test.ts
+8
@@ -246,6 +246,14 @@ describe("composerSubmissionIntentForKey", () => {
246 });
247
248 describe("detectComposerTrigger", () => {
249 + it.each([
250 + ["Run /tmp/build.sh", "Run /tmp/build.sh".length],
251 + ["/etc/hosts", "/etc/hosts".length],
252 + ["Use /etc/hosts now", "Use /et".length],
253 + ])("keeps the path in %j out of the slash menu", (text, cursor) => {
254 + expect(detectComposerTrigger(text, cursor)).toBeNull();
255 + });
256 +
257 it.each(["Use ", "Use\t", "Use\n "])("detects inline slash skills after %j", (prefix) => {
258 const text = `${prefix}/skill:review later`;
259 const cursor = `${prefix}/skill:review`.length;
apps/web/src/composer-logic.ts
+2
@@ -4,6 +4,7 @@ import {
4 serializeAssistantCitation,
5 withAssistantCitationComment,
6 } from "@t3tools/shared/assistantCitations";
7 +import { isPathWord } from "@t3tools/shared/composerTrigger";
8 import {
9 splitPromptIntoComposerSegments,
10 type ComposerPromptSegment,
@@ -261,6 +262,7 @@ export function detectComposerTrigger(text: string, cursorInput: number): Compos
262 const tokenStart = tokenStartForCursor(text, cursor);
263 const token = text.slice(tokenStart, cursor);
264 if (token.startsWith("/")) {
265 + if (isPathWord(text, tokenStart, cursor, isWhitespace)) return null;
266 return {
267 kind: "slash-command",
268 query: token.slice(1),
packages/shared/src/composerTrigger.test.ts
+15
@@ -3,6 +3,21 @@ import { describe, expect, it } from "vite-plus/test";
3 import { detectComposerTrigger, serializeComposerFileLink } from "./composerTrigger.ts";
4
5 describe("detectComposerTrigger", () => {
6 + it.each([
7 + ["Run /tmp/build.sh", "Run /tmp/build.sh".length],
8 + ["/etc/hosts", "/etc/hosts".length],
9 + ["Use /etc/hosts now", "Use /et".length],
10 + ])("keeps the path in %j out of the slash menu", (text, cursor) => {
11 + expect(detectComposerTrigger(text, cursor)).toBeNull();
12 + });
13 +
14 + it("keeps a slash in the line-leading model picker query", () => {
15 + expect(detectComposerTrigger("/model openai/gpt", 17)).toMatchObject({
16 + kind: "slash-model",
17 + query: "openai/gpt",
18 + });
19 + });
20 +
21 it.each(["Use ", "Use\t", "Use\n "])("detects inline slash skills after %j", (prefix) => {
22 const text = `${prefix}/skill:review later`;
23 const cursor = `${prefix}/skill:review`.length;
packages/shared/src/composerTrigger.ts
+21
@@ -45,6 +45,23 @@ function isWhitespace(char: string): boolean {
45 return char === " " || char === "\n" || char === "\t" || char === "\r";
46 }
47
48 +/**
49 + * A slash word with a second slash, such as `/tmp/build.sh`, is a path, not a
50 + * command. The whole word counts, so a caret before the second slash still sees it.
51 + */
52 +export function isPathWord(
53 + text: string,
54 + wordStart: number,
55 + cursor: number,
56 + isWhitespaceChar: (char: string) => boolean,
57 +): boolean {
58 + let wordEnd = cursor;
59 + while (wordEnd < text.length && !isWhitespaceChar(text[wordEnd] ?? "")) {
60 + wordEnd += 1;
61 + }
62 + return text.slice(wordStart + 1, wordEnd).includes("/");
63 +}
64 +
65 export function detectComposerTrigger(
66 text: string,
67 cursorInput: number,
@@ -56,6 +73,9 @@ export function detectComposerTrigger(
73
74 if (linePrefix.startsWith("/")) {
75 const commandMatch = /^\/(\S*)$/.exec(linePrefix);
76 + if (commandMatch && isPathWord(text, lineStart, cursor, isWhitespaceChar ?? isWhitespace)) {
77 + return null;
78 + }
79 if (commandMatch) {
80 const commandQuery = commandMatch[1] ?? "";
81 if (commandQuery.toLowerCase() === "model") {
@@ -94,6 +114,7 @@ export function detectComposerTrigger(
114
115 const token = text.slice(tokenStart, cursor);
116 if (token.startsWith("/")) {
117 + if (isPathWord(text, tokenStart, cursor, wsCheck)) return null;
118 return {
119 kind: "slash-command",
120 query: token.slice(1),