ankit-engine
High-level workflow operations for Anki via AnkiConnect.
Overview
While ankit provides 1:1 API bindings for AnkiConnect,
ankit-engine builds higher-level workflows that combine multiple API calls into
cohesive operations.
Features
- Import - Bulk import with duplicate detection and conflict resolution
- Export - Deck and review history export
- Organize - Deck cloning, merging, and tag-based reorganization
- Analyze - Study statistics, retention rates, and problem card detection
- Progress - Deck health reports, performance tagging, bulk operations
- Migrate - Note type migration with field mapping
- Media - Media file audit and cleanup
- Enrich - Find and fill empty fields
- Deduplicate - Find and remove duplicate notes
- Backup - Deck backup and restore to .apkg files
All features are enabled by default but can be individually disabled.
Quick Start
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "macros"] }
use Engine;
async
Workflow Examples
Bulk Import with Duplicate Handling
use ;
use OnDuplicate;
let engine = new;
let notes = vec!;
// Skip duplicates
let report = engine.import.notes.await?;
println!;
// Or update existing notes
let report = engine.import.notes.await?;
Clone a Deck
use Engine;
let engine = new;
let report = engine.organize
.clone_deck
.await?;
println!;
Deck Health Report
use Engine;
let engine = new;
let health = engine.progress.deck_health.await?;
println!;
println!;
println!;
Find and Remove Duplicates
use Engine;
use KeepStrategy;
let engine = new;
// Preview what would be removed
let duplicates = engine.deduplicate
.find
.await?;
// Remove duplicates, keeping the note with most content
let result = engine.deduplicate
.remove
.await?;
println!;
Media Audit
use Engine;
let engine = new;
let audit = engine.media.audit.await?;
println!;
println!;
println!;
// Clean up orphaned files (dry run first)
let preview = engine.media.cleanup_orphaned.await?;
println!;
Backup and Restore
use Engine;
let engine = new;
// Backup a deck
let result = engine.backup
.backup_deck
.await?;
println!;
// Restore from backup
let restore = engine.backup
.restore_deck
.await?;
// List and rotate backups
let backups = engine.backup.list_backups.await?;
engine.backup.rotate_backups.await?; // Keep last 5
Feature Flags
All workflow modules are enabled by default. To use only specific features:
[]
= { = "0.1", = false, = ["analyze", "import"] }
Available features: import, export, organize, analyze, migrate, media, progress, enrich, deduplicate, backup
Related Crates
ankit- Core AnkiConnect clientankit-builder- TOML-based deck builderankit-mcp- MCP server for AI assistant integration
Requirements
- Anki with AnkiConnect add-on
- Rust 1.85+ (Edition 2024)
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)