fix(env): DATA_DIR 默认改 ~/.cache/cxs,允许 CXS_DATA_DIR 覆盖
之前 DATA_DIR = resolve(import.meta.dir, "data") 是 *相对仓库根* 的路径,
对源码 checkout 模式 OK,但对 npm i -g 与 bun build --compile 都炸:
- npm i -g 后 import.meta.dir 指向全局 node_modules/cxs,默认 db 写到
那里,要么权限不够要么污染全局安装目录
- bun build --compile 出来的 binary fs 是只读虚拟 /$bunfs/,
ensureDataDir() 直接 EROFS
改成默认 ~/.cache/cxs (XDG cache 约定),并支持 CXS_DATA_DIR 环境变量
覆盖。源码 dev 模式行为也跟着变 — 现有 ./data/index.sqlite 不再被
默认读到,需要重 sync 一次到新位置 (~75s,幂等)。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Entire-Checkpoint: 8f465c5aec2f