Skip to content

The open source coding agent.

TypeScript

fix(tui): make use of server dir path for file references in prompts (#13781)

OpeOginni16332a858396
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
index 42cf82b421b..3240afab326 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
@@ -247,7 +247,8 @@ export function Autocomplete(props: {
const width = props.anchor().width - 4
options.push(
...sortedFiles.map((item): AutocompleteOption => {
- const fullPath = `${process.cwd()}/${item}`
+ const baseDir = (sync.data.path.directory || process.cwd()).replace(/\/+$/, "")
+ const fullPath = `${baseDir}/${item}`
const urlObj = pathToFileURL(fullPath)
let filename = item
if (lineRange && !item.endsWith("/")) {