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>
This commit is contained in:
7418andClaude Opus 4.6 committed 2026-02-07 13:07:08 +08:00
1 parent d2a926b353
commit 262b295f63
2 files changed
+33 -2

No files matched your search

+1 -1
View File
@@ -116,7 +116,7 @@ function startServer(port: number): ChildProcess {
...userShellEnv,
PORT: String(port),
HOSTNAME: '127.0.0.1',
CLAUDE_GUI_DATA_DIR: app.getPath('userData'),
CLAUDE_GUI_DATA_DIR: path.join(home, '.codepilot'),
ELECTRON_RUN_AS_NODE: '1',
HOME: home,
PATH: `${basePath}:${home}/.npm-global/bin:${home}/.local/bin:${home}/.claude/bin:${shellPath}`,