feat(cli): import-md markdown folder importer (#744) - #753
Open
Steve-too wants to merge 4 commits into
Open
Conversation
recursively walks a folder for .md files and runs the same mechanical ingest_source per file: each file is registered as a content-addressed source, receipt-backed claims are filed and auto-approved when review.auto_approve_on_receipt is on -- an import is a capture firehose, never a review-gate bypass. re-runs skip unchanged files via a per-file content hash in .vouch/md_import_state.json (same pattern as inbox-state.json). an edited file is fully re-ingested -- a documented limitation while claim-level diffing waits on the full vouchdev#612 track. --max-claims/--budget-chars reuse the existing density knobs so a large vault doesn't firehose ten thousand pending spans. purely additive: one command, one module, one sidecar file. closes vouchdev#744. no kb.* method -- an import is a deliberate human action, same reasoning as kb.import_apply staying CLI-only.
- future-open fixture date 2026-08-01 was now in the past, causing the followups_due assertion to include it as a third element - moved to 2028-08-01 to prevent recurrence for years - assertion changed to sorted() comparison for robustness This is not related to the md_import feature — the same test failed on clean upstream/test before any diff was applied.
- test_cli_import_md_no_approve_pending: --no-approve leaves claims in pending state, exercising the _echo row display (line 4792) and the 'run vouch review' reminder (line 4798) in cli.py - test_load_state_non_dict: corrupt JSON list exercises the isinstance(loaded, dict) guard at md_import.py line 62
Replaced the invalid 'from vouch.kb import store as store_mod' with the existing store fixture and a corrupted state file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
vouch import-md <folder>— a markdown-folder importer, the narrow first slice of #612 the issue asks for. recursively walks*.md(hidden dot-directories pruned, symlinked directories never chased) and runs the exact sameextract.ingest_sourceper file thatvouch ingestruns on one file: content-addressed source registered, receipt-backed claims filed for quotable spans, auto-approved when — and only when —review.auto_approve_on_receiptis on.re-runs skip unchanged files via a per-file content hash in
.vouch/md_import_state.json(same pattern asinbox-state.json). an edited file is fully re-ingested — documented limitation; claim-level diffing belongs to the full #612 track, as the issue itself states.--max-claims/--budget-charsreuse the existing density-selection knobs so a large vault doesn't file ten thousand spans.--no-approve,--min-chars,--jsonround out the surface, mirroringvouch ingest/import-chatgpt.shape / guarantees
md_import.py), one new flat command (novouch import <kind>group — the grouping question stays with feat(import): note-vault importers — obsidian, joplin, notes, keep, markdown folders #612, per the issue), one sidecar file. nokb.*method (import is a deliberate human action, same reasoning askb.import_applystaying cli-only). no VEP.approve()— anast-based test pins that, mirroring the inbox importer's test.relationship to #691 / #694
vouch pr-cache checkflags this with top score 0.833 against the closed #691 (note_import.py, multi-format) and 0.809 against #694 — worth surfacing, not hiding. reviewed both before opening:note_import.pyoverlap, no stacking, rebased on currenttestso theCHANGELOG.md/cli.pycollisions that sunk feat(import): note-vault importers for obsidian, joplin, notes, keep, md #691+feat(import): conversation and memory-export importers #694 don't apply.gate (exact CI commands)
.venv/bin/python -m pytest tests/ -q --ignore=tests/embeddings— all green excepttests/test_digest.py::test_jsonl_digest_handler, which fails identically on clean upstreamtest(verified by stashing my diff) — pre-existing, out of scope..venv/bin/python -m mypy src— clean, 124 files..venv/bin/python -m ruff check src tests— clean.tests/test_md_import.py: per-file source registration + receipt claims, gate on/off behavior, idempotent re-runs, edited-file re-ingest, hidden-dir / non-md / too-short skips, state-sidecar shape, density cap, cli surface (+--json), and the no-import-of-approve guard.closes #744