diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d13f551..62fb8561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Fixed +- **Windows PowerShell compatibility**: Fixed SessionStart hook error on Windows systems + - Replaced bash-specific command (`[`, `&&`, `||`) with cross-platform Node.js installer + - Created `ensure-dependencies.js` script for automatic dependency installation + - Dependencies (`better-sqlite3`) now install correctly on Windows, macOS, and Linux + +### Added +- **Cross-platform dependency installer**: New `ensure-dependencies.js` script handles runtime dependency installation +- **Automatic package.json generation**: Build process now creates `package.json` in `plugin/scripts/` directory +- **Enhanced build output**: Build script now generates installer alongside hooks and services + +### Changed +- **SessionStart hook command**: Now uses `node ensure-dependencies.js && node context-hook.js` instead of bash syntax +- **Build process**: Added installer script bundling and package.json generation steps +- **.gitignore**: Added `plugin/scripts/package-lock.json` to prevent version control conflicts + + ## [4.2.1] - 2025-10-22 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index 66aba352..6f66a641 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,6 +26,7 @@ This creates a continuous memory system where Claude can learn from past session Claude-mem integrates with Claude Code through 5 lifecycle hooks: 1. **SessionStart Hook** (`context-hook`) + - Auto-installs dependencies on first run (cross-platform Node.js installer) - Injects context from previous sessions - Auto-starts PM2 worker service - Retrieves last 10 session summaries with three-tier verbosity (v4.2.0) @@ -199,12 +200,36 @@ claude-mem/ npm run build && git commit -a -m "Build and update" && git push && cd ~/.claude/plugins/marketplaces/thedotmack/ && git pull && pm2 flush claude-mem-worker && pm2 restart claude-mem-worker && pm2 logs claude-mem-worker --nostream ``` -1) Compiles TypeScript and outputs hook executables to `plugin/scripts/` -2) Does all the things needed to update and test since plugin-based installs are out of the .claude/ folder +1. Compiles TypeScript and outputs hook executables to `plugin/scripts/` +2. Generates `ensure-dependencies.js` - cross-platform installer script +3. Creates `package.json` in `plugin/scripts/` with runtime dependencies +4. Does all the things needed to update and test since plugin-based installs are out of the .claude/ folder + +**Build Outputs**: +- Hook executables: `*-hook.js` (ESM format) +- Worker service: `worker-service.cjs` (CJS format) +- Search server: `search-server.js` (ESM format) +- Dependency installer: `ensure-dependencies.js` (ESM format) +- Runtime manifest: `package.json` (includes `better-sqlite3` dependency) ## Version History -### v4.2.0 (Current) +### v4.2.2 (Upcoming) +**Breaking Changes**: None (patch version) + +**Fixes**: +- Fixed Windows PowerShell compatibility issue with SessionStart hook +- Replaced bash-specific installation command with cross-platform Node.js installer +- Added `ensure-dependencies.js` script for automatic dependency installation +- Build process now generates `package.json` with runtime dependencies in `plugin/scripts/` + +**Technical Details**: +- Created `src/bin/ensure-dependencies.ts` for cross-platform dependency management +- Updated `plugin/hooks/hooks.json` to use Node.js command chain instead of shell syntax +- Dependencies (`better-sqlite3`) are now installed automatically on first run across all platforms +- Added `.gitignore` rule for `plugin/scripts/package-lock.json` + +### v4.2.0 **Breaking Changes**: None (minor version) **Features**: diff --git a/README.md b/README.md index 950dcffd..d48b8277 100644 --- a/README.md +++ b/README.md @@ -253,14 +253,18 @@ npm install -g claude-mem ### Post-Installation -1. **Verify Plugin Installation** +1. **Automatic Dependency Installation** + + The plugin automatically installs required dependencies (`better-sqlite3`) on first run. This happens when you first start Claude Code after installation. The process is cross-platform and works on Windows, macOS, and Linux. + +2. **Verify Plugin Installation** Check that hooks are configured in Claude Code: ```bash cat plugin/hooks/hooks.json ``` -2. **Data Directory Location** +3. **Data Directory Location** v4.0.0+ stores data in `${CLAUDE_PLUGIN_ROOT}/data/`: - Database: `${CLAUDE_PLUGIN_ROOT}/data/claude-mem.db` @@ -272,13 +276,13 @@ npm install -g claude-mem export CLAUDE_MEM_DATA_DIR=/custom/path ``` -3. **Check Worker Logs** +4. **Check Worker Logs** ```bash npm run worker:logs ``` -4. **Test Context Retrieval** +5. **Test Context Retrieval** ```bash npm run test:context