From 9e877f592bad913a5d6e9168becab35a5d78605d Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Feb 2026 19:46:34 -0800 Subject: [PATCH] rm unused --- apps/web/src/composer-logic.test.ts | 23 +---------------- apps/web/src/composer-logic.ts | 38 ----------------------------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/apps/web/src/composer-logic.test.ts b/apps/web/src/composer-logic.test.ts index beb9385e44bbbef06dce74b7dee3e425ddb2eba6..c2b32cf142c189c2f8a3c74c34f56ad309b35c70 100644 --- a/apps/web/src/composer-logic.test.ts +++ b/apps/web/src/composer-logic.test.ts @@ -1,11 +1,6 @@ import { describe, expect, it } from "vitest"; -import { - buildPromptInput, - buildUserVisiblePrompt, - detectComposerTrigger, - replaceTextRange, -} from "./composer-logic"; +import { detectComposerTrigger, replaceTextRange } from "./composer-logic"; describe("detectComposerTrigger", () => { it("detects @path trigger at cursor", () => { @@ -54,19 +49,3 @@ describe("replaceTextRange", () => { }); }); }); - -describe("tagged path prompt helpers", () => { - it("builds model input with tagged paths", () => { - const result = buildPromptInput("Fix this", ["src/app.tsx", "src/app.tsx", "README.md"]); - expect(result).toContain("Fix this"); - expect(result).toContain("Referenced paths:"); - expect(result).toContain("- src/app.tsx"); - expect(result).toContain("- README.md"); - expect(result).not.toContain("- src/app.tsx\n- src/app.tsx"); - }); - - it("builds user-visible prompt from tags only", () => { - const result = buildUserVisiblePrompt(" ", ["src/app.tsx", "README.md"]); - expect(result).toBe("@src/app.tsx @README.md"); - }); -}); diff --git a/apps/web/src/composer-logic.ts b/apps/web/src/composer-logic.ts index db6ae79b7f2e9b175af8565eae29a576dbbd6541..8b08459c28aecd9c4981185dc23e211336952736 100644 --- a/apps/web/src/composer-logic.ts +++ b/apps/web/src/composer-logic.ts @@ -24,16 +24,6 @@ function tokenStartForCursor(text: string, cursor: number): number { return index + 1; } -function dedupePaths(paths: string[]): string[] { - const unique = new Set(); - for (const rawPath of paths) { - const normalized = rawPath.trim(); - if (!normalized) continue; - unique.add(normalized); - } - return [...unique]; -} - export function detectComposerTrigger(text: string, cursorInput: number): ComposerTrigger | null { const cursor = clampCursor(text, cursorInput); const lineStart = text.lastIndexOf("\n", Math.max(0, cursor - 1)) + 1; @@ -98,31 +88,3 @@ export function replaceTextRange( const nextText = `${text.slice(0, safeStart)}${replacement}${text.slice(safeEnd)}`; return { text: nextText, cursor: safeStart + replacement.length }; } - -export function buildPromptInput(text: string, taggedPaths: string[]): string { - const trimmedPrompt = text.trim(); - const normalizedPaths = dedupePaths(taggedPaths); - if (normalizedPaths.length === 0) { - return trimmedPrompt; - } - - const tagBlock = `Referenced paths:\n${normalizedPaths.map((entry) => `- ${entry}`).join("\n")}`; - if (!trimmedPrompt) { - return tagBlock; - } - return `${trimmedPrompt}\n\n${tagBlock}`; -} - -export function buildUserVisiblePrompt(text: string, taggedPaths: string[]): string { - const trimmedPrompt = text.trim(); - const normalizedPaths = dedupePaths(taggedPaths); - if (normalizedPaths.length === 0) { - return trimmedPrompt; - } - - const tagsSummary = normalizedPaths.map((entry) => `@${entry}`).join(" "); - if (!trimmedPrompt) { - return tagsSummary; - } - return `${trimmedPrompt}\n\n${tagsSummary}`; -} -- 2.54.0