Replace the manual "jump to GitHub Release" update flow with native
in-app auto-update powered by electron-updater. The app now silently
downloads updates in the background and prompts the user to restart
when ready. Browser mode (`npm run dev`) retains the existing polling
fallback via `/api/app/updates`.
Main process (electron/updater.ts — new):
- Wrap electron-updater's autoUpdater, forward lifecycle events
(checking / available / downloading / downloaded / error) to the
renderer via IPC channel `updater:status`
- Register `updater:check` and `updater:quit-and-install` IPC handlers
- Auto-check 10s after launch, then every 4 hours
- Only initialized in packaged mode (!isDev)
Preload bridge (electron/preload.ts):
- Expose `updater` namespace with checkForUpdates, quitAndInstall,
and onStatus callback (same pattern as install.onProgress)
Type declarations (src/types/electron.d.ts):
- Add UpdateStatusEvent, ElectronUpdaterAPI interfaces
- Add optional `updater` field to ElectronAPI
Update hook (src/hooks/useUpdate.ts):
- Extend UpdateInfo with downloadProgress, readyToInstall, isNativeUpdate
- Add quitAndInstall to UpdateContextValue
Renderer — dual-mode logic (src/components/layout/AppShell.tsx):
- Detect `window.electronAPI?.updater` to choose between native IPC
subscription (Electron) and HTTP polling (browser)
- Map IPC events to UpdateInfo state, including download progress
UI components:
- UpdateDialog: three footer states — View Release (browser), progress
bar + disabled button (downloading), Restart to Update (ready)
- UpdateBanner (new): persistent top banner when update is downloaded,
shown even after dialog is dismissed
- NavRail: settings dot turns green + pulse when readyToInstall
- GeneralSection: UpdateCard shows download %, restart button, or
View Release depending on mode
Build & CI:
- electron-builder.yml: add `publish` config (github provider) to
generate latest-mac.yml / latest.yml metadata + blockmap files
- build.yml: change --publish never to --publish always with GH_TOKEN;
release job now uses `gh release edit` instead of create
i18n:
- Add 6 translation keys (en + zh) for update UI strings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two fixes for critical Windows issues (#81):
1. NSIS installer: disable allowToChangeInstallationDirectory to prevent
users from installing into shared directories where uninstall would
delete all their files. Also set deleteAppDataOnUninstall: false to
preserve user data.
2. Windows process cleanup: killServer() used SIGTERM which Windows
doesn't support, leaving zombie processes that block updates.
Now uses taskkill /T /F to kill the entire process tree on Windows,
ensuring no residual processes remain after app exit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Show app version (v0.4.0) in sidebar bottom
- Clear Electron web cache when version changes to prevent stale JS
- Exclude data/ directory from packaged app
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump version to 0.4.0 for new release
- Fix electron-builder linux.desktop config to use entry sub-object
(required by electron-builder 26.7.0)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Linux as a supported platform with AppImage, deb, and rpm targets
for both x64 and arm64 architectures.
Changes:
- electron-builder.yml: add linux section with AppImage/deb/rpm targets,
icon, category, and desktop entry configuration
- package.json: add electron:pack:linux script
- electron/main.ts: fix getIconPath() to return .png on Linux instead
of .icns (macOS format); enable loadUserShellEnv() on Linux since GUI
apps launched from desktop also have limited env
- README.md + README_CN.md: update supported platforms section
The README previously stated 'Linux builds are planned. Contributions
welcome.' — this delivers on that.
Use artifactName template to always include architecture in DMG
filename (e.g. CodePilot-0.2.3-x64.dmg) for clarity.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: electron-builder's @electron/rebuild only rebuilds native
modules found in the `files` config. Since better-sqlite3 enters the
app through extraResources (via .next/standalone/), it was skipped.
The afterPack hook was copying the system Node.js ABI (127) instead
of the required Electron ABI (143).
Fix:
- afterPack now explicitly calls `npx electron-rebuild` targeting the
exact Electron version and architecture from the build context
- Falls back to @electron/rebuild programmatic API if CLI fails
- Fails the build if rebuild cannot complete (no silent failures)
- Adds file size logging for verification
- Excludes `release/` from extraResources to prevent recursive nesting
- Adds startup ABI compatibility check in Electron main process with
friendly error dialog instead of cryptic crash
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add src/lib/platform.ts: cross-platform Claude CLI discovery
(candidate paths, .cmd/.bat shell handling, where/which fallback)
- Refactor claude-status route and claude-client to use shared platform utils
- Electron main: Windows process spawning (windowsHide), PATH construction
with AppData/npm dirs, titleBarOverlay, .ico icon support
- electron-builder.yml: add win/nsis build targets
- package.json: add electron:pack:win script
- FolderPicker: drive switcher dropdown for navigating between drives
- SkillsManager: fix duplicate key warning with filePath fallback
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add afterPack hook that copies the @electron/rebuild-compiled
better_sqlite3.node into the standalone resources directory.
Previously the standalone copy retained the system Node ABI from
next build, causing MODULE_VERSION mismatch at runtime.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace symlinks in .next/standalone with real copies for electron-builder
- Exclude electron/, dist-electron/, scripts/, release/ from tsconfig
- Use arm64 target instead of universal to avoid native module merge issues
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Full-featured desktop application built with Next.js + Electron:
- Streaming chat with Claude Code via Agent SDK
- Session management with SQLite persistence
- Project file tree and file preview
- MCP server and custom skills management
- Permission controls with Code/Plan/Ask modes
- Dark/light theme, token tracking
- macOS DMG packaging with electron-builder
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>