Ankive.Cli
0.0.0-alpha.0.89
dotnet tool install --global Ankive.Cli --version 0.0.0-alpha.0.89
dotnet new tool-manifest
dotnet tool install --local Ankive.Cli --version 0.0.0-alpha.0.89
#tool dotnet:?package=Ankive.Cli&version=0.0.0-alpha.0.89&prerelease
nuke :add-package Ankive.Cli --version 0.0.0-alpha.0.89
Ankive
Sync markdown flashcards to Anki via the AnkiConnect API.
Write your flashcards in plain markdown using Foam-style syntax, then push them to Anki with a single command. Supports cloze deletions, LaTeX math, Mermaid diagrams, images, tags, and bidirectional sync.
Features
- Markdown-first workflow — author flashcards in your editor, version them with git
- Bidirectional sync — push local changes to Anki, or pull existing decks to markdown
- Rich content — LaTeX math (
$...$), Mermaid diagrams, Graphviz/DOT, code blocks, images - Cloze deletions — auto-detected from
{{c1::text}}syntax - Live preview — generate an HTML preview and watch for changes
- Diff — compare local state vs. Anki before syncing
- Query & stats — filter cards by deck, tag, type, or name
- Dry-run — preview all changes before touching Anki
- LLM-friendly parse — export decks in a compact format for AI workflows
Prerequisites
- .NET 10 SDK
- Anki with AnkiConnect add-on installed and running
Installation
# install as a global dotnet tool
dotnet tool install -g Ankive.Cli
# or build from source
git clone https://github.com/hazzajenko/Ankive.git
cd Ankive
dotnet build
Quick start
1. Write a deck in markdown:
# Git Basics
## How do you stage all changes?
[#git]()
[#basics]()
%
```bash
git add .
```
## What does `git reset --soft HEAD~1` do?
%
Undoes the last commit but keeps changes staged.
2. Sync to Anki:
anki process my-deck.md
3. Review in Anki — your cards are ready for study.
Markdown syntax
| Syntax | Meaning |
|---|---|
| # Heading | Deck name |
| ## Heading | Card front (question) |
| % | Front/back separator |
| {{c1::text}} | Cloze deletion (auto-detects card type) |
| [#tag-name]() | Tag |
| | Existing note ID (for updates) | | | Override card type |
Commands
process — Sync markdown to Anki
anki process <files...> [--dry-run] [--force] [--only-new] [--verbose] [--update-styling]
preview — Generate HTML preview
anki preview <files...> [--output preview.html]
watch — Watch and auto-sync on change
anki watch <files...> [--sync] [--no-dry-run] [--debounce 500]
diff — Compare local vs. Anki
anki diff <files...> [--format summary|unified]
pull — Pull an Anki deck to markdown
anki pull <deck-name> [--output ./] [--force]
anki pull --list # list available decks
query — Query parsed deck data
anki query decks <files...> [--json]
anki query cards <files...> [--deck "..."] [--tag "..."] [--type Cloze] [--count] [--json]
anki query stats <files...> [--json]
parse — Export in compact format
anki parse <files...> [--json] [--fronts-only] [--no-tags] [--with-lines]
delete — Remove orphaned notes
anki delete <files...> [--dry-run]
All file arguments accept glob patterns (e.g. decks/**/*.md).
Architecture
Three-stage pipeline: Markdown → Cards → Anki
src/Ankive/
├── Markdown/ # Parse Foam-style markdown → ParsedDeck/ParsedCard
├── Cards/ # Convert to domain models, markdown → HTML
├── Anki/ # Sync to AnkiConnect API, handle images & note IDs
├── Sync/ # Orchestration
├── Pull/ # Reverse sync (Anki → markdown)
└── Query/ # Query & statistics
Development
# build
dotnet build
# run tests (integration tests require Docker)
dotnet test
# run CLI from source
dotnet run --project src/Ankive.Cli -- process <files...>
Integration tests use Testcontainers with a headless Anki Docker image. Make sure Docker is running before executing the full test suite.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0-alpha.0.89 | 127 | 3/10/2026 |
| 0.0.0-alpha.0.87 | 83 | 3/10/2026 |
| 0.0.0-alpha.0.82 | 80 | 3/10/2026 |