Commit Graph
9 Commits
Author SHA1 Message Date
7418andClaude Opus 4.6 b42d3d2ad8 fix: explicitly rebuild better-sqlite3 for Electron ABI in afterPack
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>
2026-02-07 16:23:37 +08:00
xuxu777xuandClaude Opus 4.6 0234240066 feat: full Windows platform adaptation
- 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>
2026-02-07 13:35:04 +08:00
7418andClaude Opus 4.6 262b295f63 fix: use stable ~/.codepilot/ data directory to persist across updates
Previously the database path depended on app.getPath('userData') which
varies with app name changes (CodePilot vs codepilot vs Claude GUI).
Now uses a fixed ~/.codepilot/ directory for both dev and production.

Includes automatic migration: on first launch, if the DB doesn't exist
at the new path, it checks old locations (Application Support variants
and the old dev-mode data/ folder) and copies the database over.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:07:08 +08:00
7418andClaude Opus 4.6 e4ae2154af fix: pass env to SDK subprocess and hide server Dock icon
1. Explicitly pass process.env to the Claude Agent SDK's env option,
   ensuring user shell env vars (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL,
   etc.) reach the claude subprocess in packaged builds.
2. Spawn the standalone server via /bin/sh with exec to prevent the
   Electron binary from appearing as a separate Dock icon on macOS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 23:06:52 +08:00
7418andClaude Opus 4.6 185e138833 fix: load user shell env for API keys in packaged Electron app
When launched from Dock/Finder, Electron's process.env is very limited
and misses vars from .zshrc/.bashrc (API keys, custom PATH, etc.).
Added loadUserShellEnv() to run a login shell and capture the full
environment, then pass it to the standalone server process. This fixes
"organization does not have access" errors for users with custom API
configurations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:50:19 +08:00
7418andClaude Opus 4.6 e565d873f9 fix: use Electron's Node.js for standalone server to match ABI
electron-builder's @electron/rebuild compiles better-sqlite3 for
Electron's Node ABI. The standalone server must use Electron's
built-in Node (ELECTRON_RUN_AS_NODE=1) to match, otherwise the
native module fails with NODE_MODULE_VERSION mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:40:24 +08:00
7418andClaude Opus 4.6 37e5e4ed71 fix: use system Node.js for standalone server, improve error reporting
- Find system Node.js binary instead of using Electron's Node
  (avoids native module ABI mismatch with better-sqlite3)
- Detect server process crash and fail fast instead of waiting 30s
- Include server stdout/stderr in error dialog for debugging
- Expand PATH to include homebrew directories

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 21:39:41 +08:00
7418andClaude Opus 4.6 2f40bd2c62 fix: use spawn with ELECTRON_RUN_AS_NODE for packaged server
- Replace fork() with spawn() + ELECTRON_RUN_AS_NODE=1 so the
  standalone server runs correctly inside the packaged app
- Set cwd to standalone directory for proper dependency resolution
- Show error dialog on startup failure instead of silent quit
- Add Chinese README (README_CN.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 21:33:27 +08:00
7418andClaude Opus 4.6 ff1fb38735 feat: CodePilot - desktop GUI for Claude Code
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>
2026-02-06 21:04:05 +08:00