Skip to content

feat: CLI v0.2.0 — memweave index/add/files/search/stats#5

Merged
sachinsharma9780 merged 3 commits intomainfrom
feat/cli
Apr 25, 2026
Merged

feat: CLI v0.2.0 — memweave index/add/files/search/stats#5
sachinsharma9780 merged 3 commits intomainfrom
feat/cli

Conversation

@sachinsharma9780
Copy link
Copy Markdown
Owner

Full details on command design, flag mapping, and acceptance criteria are in the issue. This PR is the implementation.

What's in this PR

New: memweave/cli.py — five Click commands, each a thin wrapper over an existing MemWeave public method. No new core logic.

Command Wraps
memweave index mem.index()
memweave add <file> mem.add()
memweave files mem.files()
memweave search <query> mem.search()
memweave stats mem.status()

All commands support --workspace / -w, --embedding-model, and --json. Search exposes the full API surface: --strategy, --min-score, --max-results, --source-filter, --mmr-lambda, --decay-half-life-days, --snippet-chars.

Bug fixes in store.py (discovered during development):

  • _startup_dirty_check()stats was always reporting dirty=True because _dirty is in-memory and never persisted. Added a startup scan that compares the files table against disk and sets _dirty=False when the index is current.
  • MMR lambda kwarg ignoredMMRReranker was always constructed with cfg.mmr.lambda_param even when mmr_lambda was passed per-call. The computed value was silently dropped.
  • Temporal decay half-life kwarg ignored — same pattern: TemporalDecayProcessor ignored decay_half_life_days and always used the config default.

Tests

  • tests/unit/cli/ — 6 files, all commands covered with Click's test runner and AsyncMock. No API key needed.
  • tests/integration/test_cli_*.py — 5 files, end-to-end against a real index.
  • tests/unit/test_store.pyTestStartupDirtyCheck (5 tests) and TestApplyPostprocessors (8 tests) added to prevent the above bugs from regressing undetected in CI.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 25, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.43750% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.74%. Comparing base (d8d3988) to head (6720df0).

Files with missing lines Patch % Lines
memweave/store.py 88.88% 2 Missing ⚠️
memweave/cli.py 99.42% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
+ Coverage   88.27%   89.74%   +1.47%     
==========================================
  Files          25       26       +1     
  Lines        1672     1863     +191     
==========================================
+ Hits         1476     1672     +196     
+ Misses        196      191       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sachinsharma9780 sachinsharma9780 merged commit 4448233 into main Apr 25, 2026
2 checks passed
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