-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
Description
The system prompt sanitization replaces all non-base path occurrences of opencode (case-insensitive) with Claude. It also does not support Windows-based paths.
Current behavior:
Reference a file called /Users/julian/dev/project/.opencode/foo.txt
Reference a file called /Users/julian/dev/project/opencode/foo.txt
Reference a file called "C:\My Projects\project\My OpenCode\foo.txt"
becomes:
Reference a file called /Users/julian/dev/project/.Claude/foo.txt
Reference a file called /Users/julian/dev/project/opencode/foo.txt
Reference a file called "C:\My Projects\project\My Claude\foo.txt"
Note
The second line is not replaced, because the "prefix" pattern was solved in #39
This causes the model to reference incorrect paths and files when working on projects with directory names that contain "opencode", but don't start with "opencode".
Steps to reproduce
- Use the plugin with OAuth authentication
- Open a project path with an ".opencode" directory in it (e.g.,
~/projects/testwhere~/projects/test/.opencodeexists) - Place a simple
foo.txtfile in that directory (~/projects/test/.opencode/foo.txt) - Ask the model to reference that file
- Observe that it uses the mangled path (e.g.,
~/projects/test/.Claude/foo.txt)
Expected behavior
File paths should be preserved. The replacement should only affect the product name "OpenCode", not paths containing "opencode".
Proposed fix
Use a negative lookbehind that isn't prefix-specific to exclude path contexts:
.replace(/(?<![\/\\][_.a-zA-Z0-9 ]*)opencode/gi, "Claude")This preserves ~/projects/test/.opencode/foo.txt while still replacing standalone occurrences.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels