The best way to control Claude Code, Codex and more from any computer or phone
rm unused
Julius Marminge committed
Feb 17, 2026 at 19:46 UTC
9e877f592bad913a5d6e9168becab35a5d78605d
2 files changed
+1
-60
apps/web/src/composer-logic.test.ts
+1
-22
@@ -1,11 +1,6 @@
1
import { describe, expect, it } from "vitest";
2
3
-import {
4
- buildPromptInput,
5
- buildUserVisiblePrompt,
6
- detectComposerTrigger,
7
- replaceTextRange,
8
-} from "./composer-logic";
3
+import { detectComposerTrigger, replaceTextRange } from "./composer-logic";
4
5
describe("detectComposerTrigger", () => {
6
it("detects @path trigger at cursor", () => {
@@ -54,19 +49,3 @@ describe("replaceTextRange", () => {
49
});
50
});
51
});
57
-
58
-describe("tagged path prompt helpers", () => {
59
- it("builds model input with tagged paths", () => {
60
- const result = buildPromptInput("Fix this", ["src/app.tsx", "src/app.tsx", "README.md"]);
61
- expect(result).toContain("Fix this");
62
- expect(result).toContain("Referenced paths:");
63
- expect(result).toContain("- src/app.tsx");
64
- expect(result).toContain("- README.md");
65
- expect(result).not.toContain("- src/app.tsx\n- src/app.tsx");
66
- });
67
-
68
- it("builds user-visible prompt from tags only", () => {
69
- const result = buildUserVisiblePrompt(" ", ["src/app.tsx", "README.md"]);
70
- expect(result).toBe("@src/app.tsx @README.md");
71
- });
72
-});
apps/web/src/composer-logic.ts
-38
@@ -24,16 +24,6 @@ function tokenStartForCursor(text: string, cursor: number): number {
24
return index + 1;
25
}
26
27
-function dedupePaths(paths: string[]): string[] {
28
- const unique = new Set<string>();
29
- for (const rawPath of paths) {
30
- const normalized = rawPath.trim();
31
- if (!normalized) continue;
32
- unique.add(normalized);
33
- }
34
- return [...unique];
35
-}
36
-
27
export function detectComposerTrigger(text: string, cursorInput: number): ComposerTrigger | null {
28
const cursor = clampCursor(text, cursorInput);
29
const lineStart = text.lastIndexOf("\n", Math.max(0, cursor - 1)) + 1;
@@ -98,31 +88,3 @@ export function replaceTextRange(
88
const nextText = `${text.slice(0, safeStart)}${replacement}${text.slice(safeEnd)}`;
89
return { text: nextText, cursor: safeStart + replacement.length };
90
}
101
-
102
-export function buildPromptInput(text: string, taggedPaths: string[]): string {
103
- const trimmedPrompt = text.trim();
104
- const normalizedPaths = dedupePaths(taggedPaths);
105
- if (normalizedPaths.length === 0) {
106
- return trimmedPrompt;
107
- }
108
-
109
- const tagBlock = `Referenced paths:\n${normalizedPaths.map((entry) => `- ${entry}`).join("\n")}`;
110
- if (!trimmedPrompt) {
111
- return tagBlock;
112
- }
113
- return `${trimmedPrompt}\n\n${tagBlock}`;
114
-}
115
-
116
-export function buildUserVisiblePrompt(text: string, taggedPaths: string[]): string {
117
- const trimmedPrompt = text.trim();
118
- const normalizedPaths = dedupePaths(taggedPaths);
119
- if (normalizedPaths.length === 0) {
120
- return trimmedPrompt;
121
- }
122
-
123
- const tagsSummary = normalizedPaths.map((entry) => `@${entry}`).join(" ");
124
- if (!trimmedPrompt) {
125
- return tagsSummary;
126
- }
127
- return `${trimmedPrompt}\n\n${tagsSummary}`;
128
-}