fix(desktop): avoid main util ts import#160
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughVersion bumps across four packages (0.2.6 → 0.2.7), addition of a local MIME-detection module with tests in desktop-electron, and refactor of the main IPC to use the new module instead of importing image-extension data from the util package. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request updates several package versions to 0.2.7 and refactors the attachmentPathMime utility into a dedicated module with new unit tests. Feedback suggests consolidating the MIME type lookup into a single map and making the path extension logic injectable to improve maintainability and support cross-platform testing.
Astro-Han
left a comment
There was a problem hiding this comment.
Three nits on the hotfix. Approach is fine — moving the narrow slice into main's source tree sidesteps the Node-refuses-TS-in-node_modules failure. Flagging drift risk and test gaps below.
One alternative worth a thought for a follow-up (not this PR): externalizeDeps: { exclude: ["@opencode-ai/util"] } in electron.vite.config.ts would bundle the util module into main at build time, keeping a single source of truth with the renderer. Current approach is defensible for a hotfix.
dc5f55c to
7baf949
Compare
Summary
Avoid importing
@opencode-ai/util/file-extensionsfrom the Electron main process by moving the attachment MIME lookup into desktop main code. Bump release packages to0.2.7for the startup-crash hotfix.Why
The published
v0.2.6packaged app crashes on startup because the main process loadsnode_modules/@opencode-ai/util/src/file-extensions.ts, and Node refuses TypeScript stripping for files undernode_modules. The brokenv0.2.6GitHub Release has been deleted to prevent accidental downloads;v0.2.7should replace it as the latest stable release.Related Issue
Closes #159.
How To Verify
Screenshots or Recordings
Not applicable. No visible UI changes.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Chores
New Features
Tests