sqlite card updates#6
Merged
Merged
Conversation
Add four new trait methods to NoteRepository (add_tags, remove_tags, update_note_fields_and_tags, replace_tag) with full implementations on AnkiRepository. replace_tag supports three modes: rename, bulk add (empty old), and bulk remove (empty new) with optional query filtering. Update MockNoteRepository to implement all new trait methods.
New CLI commands: - `tag add/remove` for per-note tag management - `tag replace` with rename, bulk-add, bulk-remove modes and --query filter - `edit` opens $EDITOR with type-aware template (Basic→Front/Back, Cloze→Text/Extra) Collect now merges tags from markdown onto existing notes (additive only, never removes). This closes the gap where tag changes in markdown were ignored on re-import. Editor template follows bkmr's section-delimited pattern with validation against Anki invariants (empty sort field, missing cloze deletions). New application layer: NoteUpdater, TagManager, NoteEditor use cases. New infrastructure: NoteTemplate with rendering, parsing, and validation.
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
Add tag management, editor-based note editing, and bulk tag operations to ankiview. This extends the direct SQLite approach (via the anki crate) with update capabilities that were previously missing.
New CLI commands
ankiview tag add <NOTE_ID> <TAGS...>— add tags to a note (merge, no duplicates)ankiview tag remove <NOTE_ID> <TAGS...>— remove tags from a noteankiview tag replace --old <OLD> --new <NEW> [--query <Q>]— rename, bulk-add (--old ""), or bulk-remove (--new "") tags across notes, with optional Anki search query filterankiview edit <NOTE_ID>— open note in$EDITORwith a type-aware template (Basic→Front/Back, Cloze→Text/Extra), validates against Anki invariants on saveChanged behavior
collectnow merges tags from markdown onto existing notes (additive only — tags are never removed by collect). Previously, tag changes in markdown were silently ignored on re-import.Design decisions
collectadds tags from markdown but never removes them. This preventscollectfrom wiping CLI-added tags. Tag removal is exclusively viatag remove.=== SECTION ===delimiter pattern. Raw HTML content, no lossy conversion.{{c1::...}}syntax.