test(conversation-memory): add test coverage for CLI and logger modules - #471
Conversation
- Add vitest coverage-v8 provider with text/json/html reporters - Create test files for all CLI modules (index, inject, observe, show, stats) - Add comprehensive logger tests (24 tests) - Update index-cli.ts to route inject/observe commands - Add inject-cli.ts and observe-cli.ts for hook handling - Improve test coverage from 52.84% to 69.52% - Exclude test utilities and CLI entry points from coverage calculation All 742 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request introduces CLI entry points for the conversation-memory plugin: new Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/CLI
participant IndexCLI as index-cli.ts
participant InjectCLI as inject-cli.ts
participant DB as Database
participant Handler as handleSessionStart
User->>IndexCLI: invoke with 'inject' command
IndexCLI->>InjectCLI: dynamically import & execute
InjectCLI->>InjectCLI: read stdin (SessionStartInput)
InjectCLI->>InjectCLI: extract project from input/env
InjectCLI->>InjectCLI: load config from environment
InjectCLI->>DB: initDatabaseV3()
DB-->>InjectCLI: db connection
InjectCLI->>Handler: handleSessionStart(db, project, config)
Handler-->>InjectCLI: markdown result
InjectCLI->>User: stdout markdown output
InjectCLI->>DB: close DB
sequenceDiagram
participant User as User/CLI
participant IndexCLI as index-cli.ts
participant ObserveCLI as observe-cli.ts
participant DB as Database
participant LLMConfig as LLM Config
participant Handler as handlePostToolUse/handleStop
User->>IndexCLI: invoke with 'observe' or 'observe-run'
IndexCLI->>ObserveCLI: dynamically import & execute
alt --summarize flag
ObserveCLI->>LLMConfig: load LLM provider config
ObserveCLI->>ObserveCLI: create LLM provider
ObserveCLI->>DB: initDatabaseV3()
DB-->>ObserveCLI: db connection
ObserveCLI->>Handler: handleStop(db, provider, session, project)
else PostToolUse
ObserveCLI->>ObserveCLI: read stdin JSON
ObserveCLI->>DB: initDatabaseV3()
DB-->>ObserveCLI: db connection
ObserveCLI->>Handler: handlePostToolUse(db, session, project, tool_name, result)
end
ObserveCLI->>DB: close DB
ObserveCLI->>User: exit with status
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
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
Test Coverage
Test Results
Technical Details
@vitest/coverage-v8@^3.0.0dev dependencyFiles Changed
vitest.config.ts- Added coverage configurationsrc/cli/index-cli.ts- Added command routing for inject/observesrc/cli/inject-cli.ts(new) - SessionStart hook handlersrc/cli/observe-cli.ts(new) - PostToolUse/Stop hook handlersrc/cli/*.test.ts(6 new files) - Test coverage for CLI modulessrc/core/logger.test.ts(new) - Test coverage for logger module🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
injectCLI command to handle conversation session initialization with configurable observation settings.observeCLI command to handle tool post-processing and conversation summarization via--summarizeflag.Tests