Skip to content

opencode->Claude replacement mangles certain paths still #41

@eXamadeus

Description

@eXamadeus

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

  1. Use the plugin with OAuth authentication
  2. Open a project path with an ".opencode" directory in it (e.g., ~/projects/test where ~/projects/test/.opencode exists)
  3. Place a simple foo.txt file in that directory (~/projects/test/.opencode/foo.txt)
  4. Ask the model to reference that file
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions