Skip to content

feat(cli): import-md markdown folder importer (#744) - #753

Open
Steve-too wants to merge 4 commits into
vouchdev:testfrom
Steve-too:feat/import-md
Open

feat(cli): import-md markdown folder importer (#744)#753
Steve-too wants to merge 4 commits into
vouchdev:testfrom
Steve-too:feat/import-md

Conversation

@Steve-too

Copy link
Copy Markdown
Contributor

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 same extract.ingest_source per file that vouch ingest runs on one file: content-addressed source registered, receipt-backed claims filed for quotable spans, auto-approved when — and only when — review.auto_approve_on_receipt is on.

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 — documented limitation; claim-level diffing belongs to the full #612 track, as the issue itself states.

--max-claims / --budget-chars reuse the existing density-selection knobs so a large vault doesn't file ten thousand spans. --no-approve, --min-chars, --json round out the surface, mirroring vouch ingest / import-chatgpt.

shape / guarantees

relationship to #691 / #694

vouch pr-cache check flags 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:

gate (exact CI commands)

  • .venv/bin/python -m pytest tests/ -q --ignore=tests/embeddings — all green except tests/test_digest.py::test_jsonl_digest_handler, which fails identically on clean upstream test (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.
  • 10 new tests in 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

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.
@Steve-too
Steve-too requested a review from plind-junior as a code owner August 8, 2026 09:05
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance cli command line interface tests tests and fixtures size: M 200-499 changed non-doc lines labels Aug 8, 2026
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli command line interface docs documentation, specs, examples, and repo guidance size: M 200-499 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vouch import-md: markdown-folder importer (first slice of #612)

1 participant