[PR #6059] /editor now uses cwd, auto-cleans up #11720

Closed
opened 2026-02-16 18:16:39 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6059

State: closed
Merged: No


The fix is complete. The changes made:

  1. Changed the file location from tmpdir() (e.g., /var/folders/.../T/) to process.cwd() - the current working directory
  2. Updated the filename to .opencode-editor-${Date.now()}.md (with a . prefix to make it a hidden file, making it less visible in the workspace)
  3. Removed the unused import of tmpdir from node:os
  4. Kept the cleanup behavior - the defer statement with rm(filepath, { force: true }) ensures the file is cleaned up after the editor closes

The file is now created in the current working directory (like /export does), making it consistent with the project workspace. The file is automatically deleted after the editor closes thanks to the existing await using _ = defer(...) pattern.

Closes #6023

New%20session%20-%202025-12-23T20%3A13%3A35.026Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6059 **State:** closed **Merged:** No --- The fix is complete. The changes made: 1. **Changed the file location** from `tmpdir()` (e.g., `/var/folders/.../T/`) to `process.cwd()` - the current working directory 2. **Updated the filename** to `.opencode-editor-${Date.now()}.md` (with a `.` prefix to make it a hidden file, making it less visible in the workspace) 3. **Removed the unused import** of `tmpdir` from `node:os` 4. **Kept the cleanup behavior** - the `defer` statement with `rm(filepath, { force: true })` ensures the file is cleaned up after the editor closes The file is now created in the current working directory (like `/export` does), making it consistent with the project workspace. The file is automatically deleted after the editor closes thanks to the existing `await using _ = defer(...)` pattern. Closes #6023 <a href="https://opencode.ai/s/GuAlqgLy"><img width="200" alt="New%20session%20-%202025-12-23T20%3A13%3A35.026Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTEyLTIzVDIwOjEzOjM1LjAyNlo=.png?model=opencode/claude-opus-4-5&version=1.0.193&id=GuAlqgLy" /></a> [opencode session](https://opencode.ai/s/GuAlqgLy)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/20470591164)
yindo added the pull-request label 2026-02-16 18:16:39 -05:00
yindo closed this issue 2026-02-16 18:16:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11720