Skip to content

feat: add mcp-recall import command#176

Merged
sakebomb merged 2 commits into
mainfrom
feat/import-command
May 10, 2026
Merged

feat: add mcp-recall import command#176
sakebomb merged 2 commits into
mainfrom
feat/import-command

Conversation

@sakebomb
Copy link
Copy Markdown
Owner

Summary

  • Adds mcp-recall import <file> CLI command that restores items from a recall__export JSON dump into the current project's SQLite database
  • Supports --overwrite (replace existing items), --keep-project-key (preserve original project association), and --dry-run (preview without writing)
  • Validates input with Zod against the full StoredOutput schema and re-indexes content_chunks for FTS

Test plan

  • Round-trip: store → export → import → verify items, project key, pin flag, FTS searchability
  • Skip existing by default; --overwrite replaces them
  • --dry-run writes nothing to DB
  • Invalid JSON → exit 1 with clear message
  • Schema mismatch → exit 1 mentioning recall__export
  • Empty export → graceful no-op
  • Full test suite passes (691 tests, 0 failures)
  • tsc --noEmit clean

sakebomb added 2 commits May 10, 2026 16:47
Restores items from a recall__export JSON dump into the current
project's SQLite database. Supports --overwrite to replace existing
items, --keep-project-key to preserve original project association, and
--dry-run for preview without writing.

Closes #173
- Fix counter mutation inside transaction (counts now accumulate only
  after successful commit, not before)
- Fix chunkStmt prepared once outside the per-item loop (was O(N) redundant
  prepares)
- Fix dry-run to accurately count skips/overwrites by opening target DB
  read-only instead of blindly reporting all items as "imported"
- Fix bare "." output when all items are skipped (now prints "Nothing imported.")
- Remove redundant initSchema call (getDb already runs schema DDL)
- Remove double-read of RECALL_DB_PATH (was dead code due to defaultDbPath
  reading the env var itself)
- Detect recall__export empty sentinel before JSON.parse to give clear message
- Add path.resolve on file argument to normalise path traversal
- Add file size warning for imports over 50 MB
- Fix hardcoded developer path in tests (use import.meta.dir)
- Merge duplicate closeDb import in tests
- Add test for chunk row cleanup on --overwrite
- Add test verifying dry-run accurately counts skips
@sakebomb sakebomb merged commit 1ba3c88 into main May 10, 2026
3 checks passed
@sakebomb sakebomb deleted the feat/import-command branch May 10, 2026 21:02
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.

1 participant