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>
82 lines
1.7 KiB
YAML
82 lines
1.7 KiB
YAML
appId: com.codepilot.app
|
|
productName: CodePilot
|
|
publish:
|
|
provider: github
|
|
owner: op7418
|
|
repo: CodePilot
|
|
directories:
|
|
output: release
|
|
files:
|
|
- dist-electron/**/*
|
|
- "!node_modules"
|
|
- "!src"
|
|
- "!electron"
|
|
- "!.next"
|
|
- "!build"
|
|
- "!scripts"
|
|
- "!docs"
|
|
- "!release"
|
|
- "!data"
|
|
extraResources:
|
|
- from: .next/standalone/
|
|
to: standalone/
|
|
filter:
|
|
- "**/*"
|
|
- "!node_modules"
|
|
- "!release"
|
|
- from: .next/standalone/node_modules/
|
|
to: standalone/node_modules/
|
|
filter: ["**/*"]
|
|
- from: .next/standalone/.next/
|
|
to: standalone/.next/
|
|
filter: ["**/*"]
|
|
- from: .next/static/
|
|
to: standalone/.next/static/
|
|
filter: ["**/*"]
|
|
- from: public/
|
|
to: standalone/public/
|
|
filter: ["**/*"]
|
|
- from: build/
|
|
to: .
|
|
filter: ["icon.*"]
|
|
afterPack: scripts/after-pack.js
|
|
asarUnpack:
|
|
- "**/*.node"
|
|
- "**/better-sqlite3/**"
|
|
mac:
|
|
icon: build/icon.icns
|
|
category: public.app-category.developer-tools
|
|
artifactName: "${productName}-${version}-${arch}.${ext}"
|
|
target:
|
|
- target: dmg
|
|
arch: [arm64, x64]
|
|
win:
|
|
icon: build/icon.ico
|
|
target:
|
|
- target: nsis
|
|
arch: [x64, arm64]
|
|
nsis:
|
|
oneClick: false
|
|
perMachine: false
|
|
allowToChangeInstallationDirectory: false
|
|
createDesktopShortcut: true
|
|
createStartMenuShortcut: true
|
|
deleteAppDataOnUninstall: false
|
|
linux:
|
|
icon: build/icon.png
|
|
category: Development
|
|
artifactName: "${productName}-${version}-${arch}.${ext}"
|
|
desktop:
|
|
entry:
|
|
Name: CodePilot
|
|
Comment: A native desktop GUI for Claude Code
|
|
Categories: Development;IDE;
|
|
StartupWMClass: codepilot
|
|
target:
|
|
- target: AppImage
|
|
arch: [x64, arm64]
|
|
- target: deb
|
|
arch: [x64, arm64]
|
|
- target: rpm
|
|
arch: [x64, arm64]
|