fix(conversation-memory): add auto-install hook for dependencies - #353
Conversation
Add SessionStart hook to automatically install npm dependencies on first use. This solves the MCP server connection failure caused by missing native dependencies (better-sqlite3, sqlite-vec) that cannot be bundled. Solution: - hooks/install-deps.sh: Install deps if node_modules missing - hooks/hooks.json: SessionStart hook with 120s timeout - Fast second run: 6ms check if deps already installed - No need to commit 413MB node_modules to Git Root cause analysis (systematic debugging): 1. MCP server failed: ERR_MODULE_NOT_FOUND better-sqlite3 2. dist/mcp-server.mjs marked deps as 'external' (can't bundle native) 3. Marketplace doesn't include node_modules 4. Solution: Auto-install on plugin load via SessionStart hook Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Change from invocableByUser to disable-model-invocation - Add allowed-tools: Bash(*) for script execution - Simplify command to just run the update script directly - Remove verbose steps that caused delay in execution This makes /update-all-plugins execute immediately when user types it, rather than having Claude interpret instructions first. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughModified auto-updater command configuration to disable model invocation and restrict tools to Bash, simplifying instructions to directly call an update script. Replaced conversation-memory session-end hook with session-start dependency installation hook and added install-deps.sh script for npm package initialization. Changes
Possibly related PRs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
conversation-memory 플러그인의 MCP 서버 연결 실패 문제를 SessionStart 훅을 통한 자동 의존성 설치로 해결했습니다.
문제 (Systematic Debugging)
Phase 1: 관찰
conversation-memory MCP · ✘ failedERR_MODULE_NOT_FOUND: Cannot find package 'better-sqlite3'node_modules/디렉토리 없음Phase 2: 근본 원인
scripts/build.mjs가 네이티브 의존성을external로 설정 (번들링 불가)node_modules/를 배포하지 않음해결책
SessionStart 훅으로 플러그인 첫 사용 시 자동으로 npm install 실행:
# hooks/install-deps.sh - 첫 실행: npm install 실행 (~60초) - 이후 실행: 6ms (node_modules 존재 확인만) - 유지보수 용이: 특정 패키지명 하드코딩 없음변경사항
hooks/install-deps.sh: 자동 설치 스크립트 추가hooks/hooks.json: SessionStart 훅 설정 (120초 타임아웃)검증
✅ Auto-install Hook
✅ MCP Server
✅ 통합 테스트
Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores