diff --git a/packages/desktop/index.html b/packages/desktop/index.html index c591cb46..9209acfc 100644 --- a/packages/desktop/index.html +++ b/packages/desktop/index.html @@ -7,7 +7,7 @@ OpenCode - + diff --git a/packages/desktop/src/components/assistant-message.tsx b/packages/desktop/src/components/assistant-message.tsx index 38c06bbe..7b4cfc71 100644 --- a/packages/desktop/src/components/assistant-message.tsx +++ b/packages/desktop/src/components/assistant-message.tsx @@ -1,11 +1,11 @@ import type { Part, AssistantMessage, ReasoningPart, TextPart, ToolPart } from "@opencode-ai/sdk" -import type { Tool } from "opencode/tool/tool" -import type { ReadTool } from "opencode/tool/read" import { children, Component, createMemo, For, Match, Show, Switch, type JSX } from "solid-js" import { Dynamic } from "solid-js/web" import { Markdown } from "./markdown" import { Collapsible, Icon, IconProps } from "@opencode-ai/ui" import { getDirectory, getFilename } from "@/utils" +import type { Tool } from "opencode/tool/tool" +import type { ReadTool } from "opencode/tool/read" import type { ListTool } from "opencode/tool/ls" import type { GlobTool } from "opencode/tool/glob" import type { GrepTool } from "opencode/tool/grep" @@ -188,7 +188,7 @@ ToolRegistry.register({ name: "list", render(props) { return ( - +
{props.output}
@@ -205,7 +205,7 @@ ToolRegistry.register({ icon="magnifying-glass-menu" trigger={{ title: props.tool, - subtitle: props.input.path || "/", + subtitle: getDirectory(props.input.path || "/"), args: props.input.pattern ? ["pattern=" + props.input.pattern] : [], }} > @@ -228,7 +228,7 @@ ToolRegistry.register({ icon="magnifying-glass-menu" trigger={{ title: props.tool, - subtitle: props.input.path || "/", + subtitle: getDirectory(props.input.path || "/"), args, }} > @@ -315,7 +315,7 @@ ToolRegistry.register({
Edit
- {getDirectory(props.input.filePath!)}/ + {getDirectory(props.input.filePath!)} {getFilename(props.input.filePath ?? "")}
@@ -344,7 +344,7 @@ ToolRegistry.register({
Write
- {getDirectory(props.input.filePath!)}/ + {getDirectory(props.input.filePath!)} {getFilename(props.input.filePath ?? "")}
diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx index 3838d19b..dd549a04 100644 --- a/packages/desktop/src/components/prompt-input.tsx +++ b/packages/desktop/src/components/prompt-input.tsx @@ -289,7 +289,7 @@ export const PromptInput: Component = (props) => {
- {getDirectory(i)}/ + {getDirectory(i)} {getFilename(i)}
diff --git a/packages/desktop/src/pages/index.tsx b/packages/desktop/src/pages/index.tsx index 15da87bd..7da92545 100644 --- a/packages/desktop/src/pages/index.tsx +++ b/packages/desktop/src/pages/index.tsx @@ -521,7 +521,7 @@ export default function Page() {
- {getDirectory(sync.data.path.directory)}/ + {getDirectory(sync.data.path.directory)} {getFilename(sync.data.path.directory)}
@@ -705,7 +705,7 @@ export default function Page() {
- {getDirectory(diff.file)}/ + {getDirectory(diff.file)} @@ -858,7 +858,7 @@ export default function Page() {
- {getDirectory(i)}/ + {getDirectory(i)} {getFilename(i)}
diff --git a/packages/desktop/src/utils/path.ts b/packages/desktop/src/utils/path.ts index 3ae48cdb..d23568ae 100644 --- a/packages/desktop/src/utils/path.ts +++ b/packages/desktop/src/utils/path.ts @@ -1,3 +1,5 @@ +import { useSync } from "@/context/sync" + export function getFilename(path: string) { if (!path) return "" const trimmed = path.replace(/[\/]+$/, "") @@ -6,8 +8,10 @@ export function getFilename(path: string) { } export function getDirectory(path: string) { + const sync = useSync() const parts = path.split("/") - return parts.slice(0, parts.length - 1).join("/") + const dir = parts.slice(0, parts.length - 1).join("/") + return dir ? sync.sanitize(dir + "/") : "" } export function getFileExtension(path: string) {