Skip to content

feat: auto-download JetBrains dotMemory Console on first use#42

Merged
MarcelRoozekrans merged 9 commits intomainfrom
fix/pr41-dotmemory-path
Apr 14, 2026
Merged

feat: auto-download JetBrains dotMemory Console on first use#42
MarcelRoozekrans merged 9 commits intomainfrom
fix/pr41-dotmemory-path

Conversation

@MarcelRoozekrans
Copy link
Copy Markdown
Owner

@MarcelRoozekrans MarcelRoozekrans commented Apr 14, 2026

Summary

  • Automatically downloads the correct JetBrains.dotMemory.Console.* NuGet package on the first ensure_dotmemory call — zero user setup on supported platforms
  • New IDotMemoryAutoInstaller / DotMemoryAutoInstaller handles platform detection, NuGet download, ZIP extraction, and caching under ~/.memorylens/tools/dotmemory/
  • Discovery order: DOTMEMORY_PATH → auto-installed cache → PATH → local tool manifest → global tool fallback
  • All 11 JetBrains platform packages supported: Windows (x64/x86/ARM64), Linux glibc (x64/ARM64/ARM), Linux musl (x64/ARM64), macOS (x64/ARM64)
  • Unsupported platforms fall back to DOTMEMORY_PATH with clear error messages
  • Also includes the DOTMEMORY_PATH / PATH discovery work from PR Add support for official dotMemory CLI via DOTMEMORY_PATH #41 (closed) plus its failing-test fix

Test coverage

  • Platform mapping + musl detection (pure logic, no I/O)
  • Cache reading (current.txt → executable path)
  • NuGet version fetch (using FakeHttpMessageHandler)
  • DotMemoryToolManager wiring: cache-hit resolution, install-on-cache-miss, fallthrough on failure, unsupported platform short-circuit (asserts InstallLatestAsync never called)
  • 106 tests total, all passing

Error scenarios documented

Error Cause Fix
Platform '...' is not supported Unsupported OS/arch Set DOTMEMORY_PATH
Network/download failure No internet / NuGet unreachable Set DOTMEMORY_PATH or retry
chmod +x failed Read-only filesystem Set DOTMEMORY_PATH
All discovery modes failed No dotMemory found anywhere Run ensure_dotmemory

🤖 Generated with Claude Code

godofphonk and others added 8 commits April 12, 2026 04:29
- Replace hard dependency on dotnet-dotmemory global tool
- Add DotMemoryCommand record for flexible command resolution
- Support 4 modes: DOTMEMORY_PATH env var, PATH discovery, local tool, global tool
- Update SnapshotManager to use ResolveCommandAsync instead of hardcoded command
- Add dotMemory, dotMemory.exe, dotMemory.sh to ProcessFilter exclusions
- Create FakeDotMemoryToolManager for testing
- Update all tests to use FakeDotMemoryToolManager

This allows memorylens-mcp to work with official JetBrains dotMemory CLI
installed via Toolbox or zip, not just the non-existent NuGet global tool.
- Make ResolveCommandAsync virtual for proper override in tests
- Re-throw OperationCanceledException in TryRunAsync for proper cancellation handling
- Restore global tool update logic in EnsureInstalledAsync for 'up-to-date' contract
- Add exit code validation in TryProbeAsync to prevent false positives
- Add samples/DotMemoryPathTest console application
- Include README.md with usage instructions and explanations
- Update PR description with comprehensive documentation
- Demonstrate how to use DOTMEMORY_PATH with official JetBrains dotMemory CLI
- Fix EnsureInstalledAsync to only run update when using global tool shim
- Add caching to ResolveCommandAsync for performance optimization
- Add InvalidateCache method to refresh cached command
- Add tests for DOTMEMORY_PATH precedence
- Add tests for ProcessFilter new exclusions (dotMemory, dotMemory.exe, dotMemory.sh)
- Revert server.json to original state (remove personal paths)
- Fix ProjectReference path in sample
- Rename test_dotmemory.csproj to DotMemoryPathTest.csproj
- Improve tests for DOTMEMORY_PATH with real temp file
- Improve InvalidateCache test to verify actual cache invalidation
- EnsureInstalledAsync now uses CommandKind instead of heuristics
- Add --version validation for DOTMEMORY_PATH without separators
- Add --version validation for DOTMEMORY_PATH with existing files
- Improve error message formatting with separator and null check
- Update error messages to mention all discovery modes (DOTMEMORY_PATH, MEMORYLENS_DOTMEMORY_PATH, PATH)
- Fix InvalidateCache test to use real temp files instead of non-existent paths
- Accept DOTMEMORY_PATH even if --version validation fails
- User explicitly configured the path, so trust it
- Fixes issue where dotmemory command fails --version in some environments
Parallel test execution could leak DOTMEMORY_PATH from
ResolveCommand_Prefers_DOTMEMORY_Path_Over_Other_Modes into
EnsureDotMemory_ReturnsInstalledMessage, causing it to resolve
via ExplicitPath instead of the fake process runner output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test was using a real DotMemoryToolManager which performs actual
system discovery. On CI, dotMemory.sh was found in PATH via
ResolveFromPathAsync before the fake process runner could return the
expected version string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@MarcelRoozekrans MarcelRoozekrans merged commit 518e00d into main Apr 14, 2026
1 check passed
@MarcelRoozekrans MarcelRoozekrans changed the title feat: support official JetBrains dotMemory CLI via DOTMEMORY_PATH feat: auto-download JetBrains dotMemory Console on first use Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants