2 Commits

  • fix(scripts): add os.homedir() fallback for Windows compatibility
    On Windows (native cmd/PowerShell), process.env.HOME is undefined.
    Seven CLI entry points and two library files pass process.env.HOME
    directly as homeDir without a cross-platform fallback, causing all
    path resolutions to silently fail (resolving to "undefined/.claude/...").
    
    Node.js os.homedir() correctly handles all platforms (HOME on Unix,
    USERPROFILE on Windows, OS-level fallback). The project already uses
    this pattern in scripts/lib/state-store/index.js and has a getHomeDir()
    utility in scripts/lib/utils.js, but it was not applied consistently.
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    
    Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
  • feat: add SQLite state store and query CLI (#510)
    * feat: add SQLite state store and ECC status CLI
    
    * fix: replace better-sqlite3 with sql.js to eliminate native module CI failures
    
    better-sqlite3 requires native C++ compilation (node-gyp, prebuild-install)
    which fails in CI across npm/pnpm on all platforms:
    - npm ci: lock file out of sync with native transitive deps
    - pnpm: native bindings not found at runtime
    - Windows: native compilation fails entirely
    
    sql.js is a pure JavaScript/WASM SQLite implementation with zero native
    dependencies. The adapter in index.js wraps the sql.js API to match the
    better-sqlite3 interface used by migrations.js and queries.js.
    
    Key implementation detail: sql.js db.export() implicitly ends active
    transactions, so the adapter defers disk writes (saveToDisk) until
    after transaction commit via an inTransaction guard flag.
    
    createStateStore is now async (sql.js requires async WASM init).
    Updated status.js, sessions-cli.js, and tests accordingly.