Move the CLI application from packages/server/ to apps/cli/ to align
with the monorepo convention (apps/ for deployable applications,
packages/ for shared libraries). Rename package to @openchatlab/chatlab.
Also fix a bug in ensureToken() that used raw string manipulation to
write config.toml, causing duplicate token fields that corrupted the
TOML file. This led to config parse failures and user_data_dir being
overwritten with defaults. Now uses writeConfigField() for safe writes.
Phase 3A.2: Create vite.web.config.mts for building the CLI serve
Web SPA independently from the Electron build pipeline.
- __IS_ELECTRON__ = false, __IS_BROWSER_STANDALONE__ = false
- Output to dist-web/ (gitignored)
- Dev proxy: /_web and /api -> localhost:3400 (chatlab serve)
- Resolve aliases for @electron/shared and @electron/preload
(type-only imports, erased at build time)
- npm scripts: dev:web, build:web
- Same manualChunks strategy as Electron renderer build
Add rebuild-native.sh script that compiles better-sqlite3 in an isolated
temp directory for system Node.js, storing the binary at packages/server/native/.
DatabaseManager and openBetterSqliteDatabase now accept nativeBinding option.
CLI auto-detects non-Electron environment and uses the isolated binary.