Skip to content

fix(opencode): reroutes install dependencies to .cache instead#22147

Open
sergentbne wants to merge 1 commit intoanomalyco:devfrom
sergentbne:dev
Open

fix(opencode): reroutes install dependencies to .cache instead#22147
sergentbne wants to merge 1 commit intoanomalyco:devfrom
sergentbne:dev

Conversation

@sergentbne
Copy link
Copy Markdown

@sergentbne sergentbne commented Apr 12, 2026

small patch to make all packages write to .cache instead of dumping plugins to .config.

Issue for this PR

Closes #21966, #3191

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Make all dependencies previously written to .config be written now to .cache/opencode/config/deps.

How did you verify your code works?

Ran tests. all passed expect one. the one who didn't pass was not touched during this patch. compared behaviour to current latest on homebrew (stable, not bleeding edge).

Screenshots / recordings

bash-3.2$ ls ~/.config/opencode/
opencode.json
bash-3.2$ opencode
bash-3.2$ ls ~/.config/opencode/
node_modules            opencode.json           package-lock.json       package.json
bash-3.2$ #Current
bash-3.2$ rm -rf ~/.config/opencode/node_modules/
bash-3.2$ rm -rf ~/.config/opencode/package*
bash-3.2$ bun run src/index.ts
bash-3.2$ ls ~/.config/opencode/
opencode.json
bash-3.2$ ls ~/.cache/opencode/config/deps/
node_modules            package-lock.json       package.json
bash-3.2$ #Patch

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

small patch to make all packages write to .cache instead of dumping
plugins to .config.
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title reroutes install dependencies to .cache instead doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@sergentbne sergentbne changed the title reroutes install dependencies to .cache instead fix(opencode): reroutes install dependencies to .cache instead Apr 12, 2026
@sergentbne
Copy link
Copy Markdown
Author

ok so it works on macos and windows, but doesn't work on linux. Is there a OS-dependant part to this whole process?

@sergentbne
Copy link
Copy Markdown
Author

It seems im going crazy!

The error just... passes sometime and fails others

gamer@archwork ~/..../opencode  dev  bun test test/tool/edit.test.ts
bun test v1.3.11 (a04817ce)

test/tool/edit.test.ts:
✓ tool.edit > creating new files > creates new file when oldString is empty [83.00ms]
✓ tool.edit > creating new files > creates new file with nested directories [98.00ms]
141 |               },
142 |               ctx,
143 |             ),
144 |           )
145 |
146 |           expect(events).toContain("updated")
                               ^
error: expect(received).toContain(expected)

Expected to contain: "updated"
Received: []

      at <anonymous> (/home/gamer/Documents/prog/opencode/packages/opencode/test/tool/edit.test.ts:146:26)
✗ tool.edit > creating new files > emits add event for new files [22.00ms]
✓ tool.edit > editing existing files > replaces text in existing file [135.00ms]
✓ tool.edit > editing existing files > throws error when file does not exist [14.00ms]
✓ tool.edit > editing existing files > throws error when oldString equals newString [14.00ms]
✓ tool.edit > editing existing files > throws error when oldString not found in file [57.00ms]
✓ tool.edit > editing existing files > throws error when file was not read first (FileTime) [3.00ms]
✓ tool.edit > editing existing files > throws error when file has been modified since read [11.00ms]
✓ tool.edit > editing existing files > replaces all occurrences with replaceAll option [13.00ms]
✓ tool.edit > editing existing files > emits change event for existing files [9.00ms]
✓ tool.edit > edge cases > handles multiline replacements [13.00ms]
✓ tool.edit > edge cases > handles CRLF line endings [12.00ms]
✓ tool.edit > edge cases > throws error when oldString equals newString [3.00ms]
✓ tool.edit > edge cases > throws error when path is directory [3.00ms]
✓ tool.edit > edge cases > tracks file diff statistics [9.00ms]
✓ tool.edit > line endings > preserves LF with LF multi-line strings [16.00ms]
✓ tool.edit > line endings > preserves CRLF with CRLF multi-line strings [11.00ms]
✓ tool.edit > line endings > preserves LF when old/new use CRLF [7.00ms]
✓ tool.edit > line endings > preserves CRLF when old/new use LF [6.00ms]
✓ tool.edit > line endings > preserves LF when newString uses CRLF [10.00ms]
✓ tool.edit > line endings > preserves CRLF when newString uses LF [7.00ms]
✓ tool.edit > line endings > preserves LF with mixed old/new line endings [5.00ms]
✓ tool.edit > line endings > preserves CRLF with mixed old/new line endings [10.00ms]
✓ tool.edit > line endings > replaceAll preserves LF for multi-line blocks [6.00ms]
✓ tool.edit > line endings > replaceAll preserves CRLF for multi-line blocks [9.00ms]
✓ tool.edit > concurrent editing > serializes concurrent edits to same file [6.00ms]

1 tests failed:
✗ tool.edit > creating new files > emits add event for new files [22.00ms]

 26 pass
 1 fail
 51 expect() calls
Ran 27 tests across 1 file. [1.95s]
gamer@archwork ~/..../opencode  dev  bun test test/tool/edit.test.ts
bun test v1.3.11 (a04817ce)

test/tool/edit.test.ts:
✓ tool.edit > creating new files > creates new file when oldString is empty [86.00ms]
✓ tool.edit > creating new files > creates new file with nested directories [99.00ms]
✓ tool.edit > creating new files > emits add event for new files [42.00ms]
✓ tool.edit > editing existing files > replaces text in existing file [34.00ms]
✓ tool.edit > editing existing files > throws error when file does not exist [88.00ms]
✓ tool.edit > editing existing files > throws error when oldString equals newString [5.00ms]
✓ tool.edit > editing existing files > throws error when oldString not found in file [14.00ms]
✓ tool.edit > editing existing files > throws error when file was not read first (FileTime) [54.00ms]
✓ tool.edit > editing existing files > throws error when file has been modified since read [10.00ms]
✓ tool.edit > editing existing files > replaces all occurrences with replaceAll option [14.00ms]
✓ tool.edit > editing existing files > emits change event for existing files [10.00ms]
✓ tool.edit > edge cases > handles multiline replacements [12.00ms]
✓ tool.edit > edge cases > handles CRLF line endings [8.00ms]
✓ tool.edit > edge cases > throws error when oldString equals newString [2.00ms]
✓ tool.edit > edge cases > throws error when path is directory [3.00ms]
✓ tool.edit > edge cases > tracks file diff statistics [12.00ms]
✓ tool.edit > line endings > preserves LF with LF multi-line strings [12.00ms]
✓ tool.edit > line endings > preserves CRLF with CRLF multi-line strings [7.00ms]
✓ tool.edit > line endings > preserves LF when old/new use CRLF [7.00ms]
✓ tool.edit > line endings > preserves CRLF when old/new use LF [16.00ms]
✓ tool.edit > line endings > preserves LF when newString uses CRLF [11.00ms]
✓ tool.edit > line endings > preserves CRLF when newString uses LF [6.00ms]
✓ tool.edit > line endings > preserves LF with mixed old/new line endings [5.00ms]
✓ tool.edit > line endings > preserves CRLF with mixed old/new line endings [11.00ms]
✓ tool.edit > line endings > replaceAll preserves LF for multi-line blocks [5.00ms]
✓ tool.edit > line endings > replaceAll preserves CRLF for multi-line blocks [5.00ms]
✓ tool.edit > concurrent editing > serializes concurrent edits to same file [10.00ms]

 27 pass
 0 fail
 51 expect() calls
Ran 27 tests across 1 file. [1.95s]
gamer@archwork ~/..../opencode  dev  bun test test/tool/edit.test.ts
bun test v1.3.11 (a04817ce)

test/tool/edit.test.ts:
✓ tool.edit > creating new files > creates new file when oldString is empty [81.00ms]
✓ tool.edit > creating new files > creates new file with nested directories [97.00ms]
✓ tool.edit > creating new files > emits add event for new files [25.00ms]
✓ tool.edit > editing existing files > replaces text in existing file [32.00ms]
✓ tool.edit > editing existing files > throws error when file does not exist [107.00ms]
✓ tool.edit > editing existing files > throws error when oldString equals newString [6.00ms]
✓ tool.edit > editing existing files > throws error when oldString not found in file [15.00ms]
✓ tool.edit > editing existing files > throws error when file was not read first (FileTime) [54.00ms]
✓ tool.edit > editing existing files > throws error when file has been modified since read [11.00ms]
✓ tool.edit > editing existing files > replaces all occurrences with replaceAll option [16.00ms]
372 |               },
373 |               ctx,
374 |             ),
375 |           )
376 |
377 |           expect(events).toContain("updated")
                               ^
error: expect(received).toContain(expected)

Expected to contain: "updated"
Received: []

      at <anonymous> (/home/gamer/Documents/prog/opencode/packages/opencode/test/tool/edit.test.ts:377:26)
✗ tool.edit > editing existing files > emits change event for existing files [9.00ms]
✓ tool.edit > edge cases > handles multiline replacements [13.00ms]
✓ tool.edit > edge cases > handles CRLF line endings [11.00ms]
✓ tool.edit > edge cases > throws error when oldString equals newString [3.00ms]
✓ tool.edit > edge cases > throws error when path is directory [3.00ms]
✓ tool.edit > edge cases > tracks file diff statistics [12.00ms]
✓ tool.edit > line endings > preserves LF with LF multi-line strings [8.00ms]
✓ tool.edit > line endings > preserves CRLF with CRLF multi-line strings [12.00ms]
✓ tool.edit > line endings > preserves LF when old/new use CRLF [7.00ms]
✓ tool.edit > line endings > preserves CRLF when old/new use LF [11.00ms]
✓ tool.edit > line endings > preserves LF when newString uses CRLF [6.00ms]
✓ tool.edit > line endings > preserves CRLF when newString uses LF [10.00ms]
✓ tool.edit > line endings > preserves LF with mixed old/new line endings [6.00ms]
✓ tool.edit > line endings > preserves CRLF with mixed old/new line endings [11.00ms]
✓ tool.edit > line endings > replaceAll preserves LF for multi-line blocks [5.00ms]
✓ tool.edit > line endings > replaceAll preserves CRLF for multi-line blocks [6.00ms]
✓ tool.edit > concurrent editing > serializes concurrent edits to same file [11.00ms]

1 tests failed:
✗ tool.edit > editing existing files > emits change event for existing files [9.00ms]

 26 pass
 1 fail
 51 expect() calls
Ran 27 tests across 1 file. [1.94s]
gamer@archwork ~/..../opencode  dev 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opencode writes user-specific non-essential data to XDG_CONFIG_HOME

1 participant