anki-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. anki_cli-0.1.0/.gitignore +211 -0
  2. anki_cli-0.1.0/.python-version +1 -0
  3. anki_cli-0.1.0/LICENSE +21 -0
  4. anki_cli-0.1.0/PKG-INFO +281 -0
  5. anki_cli-0.1.0/README.md +224 -0
  6. anki_cli-0.1.0/anki_cli/__init__.py +3 -0
  7. anki_cli-0.1.0/anki_cli/__main__.py +4 -0
  8. anki_cli-0.1.0/anki_cli/backends/__init__.py +27 -0
  9. anki_cli-0.1.0/anki_cli/backends/ankiconnect.py +866 -0
  10. anki_cli-0.1.0/anki_cli/backends/detect.py +288 -0
  11. anki_cli-0.1.0/anki_cli/backends/direct.py +212 -0
  12. anki_cli-0.1.0/anki_cli/backends/factory.py +73 -0
  13. anki_cli-0.1.0/anki_cli/backends/protocol.py +109 -0
  14. anki_cli-0.1.0/anki_cli/cli/__init__.py +0 -0
  15. anki_cli-0.1.0/anki_cli/cli/app.py +160 -0
  16. anki_cli-0.1.0/anki_cli/cli/commands/__init__.py +0 -0
  17. anki_cli-0.1.0/anki_cli/cli/commands/cards.py +545 -0
  18. anki_cli-0.1.0/anki_cli/cli/commands/config.py +112 -0
  19. anki_cli-0.1.0/anki_cli/cli/commands/deck.py +397 -0
  20. anki_cli-0.1.0/anki_cli/cli/commands/general.py +74 -0
  21. anki_cli-0.1.0/anki_cli/cli/commands/note.py +428 -0
  22. anki_cli-0.1.0/anki_cli/cli/commands/notetype.py +410 -0
  23. anki_cli-0.1.0/anki_cli/cli/commands/review.py +450 -0
  24. anki_cli-0.1.0/anki_cli/cli/commands/search.py +81 -0
  25. anki_cli-0.1.0/anki_cli/cli/commands/shell.py +32 -0
  26. anki_cli-0.1.0/anki_cli/cli/commands/tag.py +258 -0
  27. anki_cli-0.1.0/anki_cli/cli/dispatcher.py +50 -0
  28. anki_cli-0.1.0/anki_cli/cli/formatter.py +310 -0
  29. anki_cli-0.1.0/anki_cli/cli/params.py +49 -0
  30. anki_cli-0.1.0/anki_cli/config_runtime.py +374 -0
  31. anki_cli-0.1.0/anki_cli/core/scheduler.py +55 -0
  32. anki_cli-0.1.0/anki_cli/core/search.py +673 -0
  33. anki_cli-0.1.0/anki_cli/core/template.py +83 -0
  34. anki_cli-0.1.0/anki_cli/core/undo.py +92 -0
  35. anki_cli-0.1.0/anki_cli/db/anki_direct.py +2930 -0
  36. anki_cli-0.1.0/anki_cli/models/config.py +38 -0
  37. anki_cli-0.1.0/anki_cli/models/output.py +42 -0
  38. anki_cli-0.1.0/anki_cli/proto/__init__.py +0 -0
  39. anki_cli-0.1.0/anki_cli/proto/anki/__init__.py +0 -0
  40. anki_cli-0.1.0/anki_cli/proto/anki/collection/__init__.py +757 -0
  41. anki_cli-0.1.0/anki_cli/proto/anki/deck_config/__init__.py +669 -0
  42. anki_cli-0.1.0/anki_cli/proto/anki/decks/__init__.py +1074 -0
  43. anki_cli-0.1.0/anki_cli/proto/anki/generic/__init__.py +49 -0
  44. anki_cli-0.1.0/anki_cli/proto/anki/notetypes/__init__.py +959 -0
  45. anki_cli-0.1.0/anki_cli/proto/anki/sync/__init__.py +423 -0
  46. anki_cli-0.1.0/anki_cli/tui/__init__.py +0 -0
  47. anki_cli-0.1.0/anki_cli/tui/colors.py +11 -0
  48. anki_cli-0.1.0/anki_cli/tui/repl.py +837 -0
  49. anki_cli-0.1.0/anki_cli/tui/review_app.py +441 -0
  50. anki_cli-0.1.0/pyproject.toml +84 -0
  51. anki_cli-0.1.0/tests/backends/test_ankiconnect.py +227 -0
  52. anki_cli-0.1.0/tests/backends/test_ankiconnect_deck_notetype_paths.py +637 -0
  53. anki_cli-0.1.0/tests/backends/test_ankiconnect_operations.py +448 -0
  54. anki_cli-0.1.0/tests/backends/test_detect.py +307 -0
  55. anki_cli-0.1.0/tests/backends/test_detect_helpers.py +407 -0
  56. anki_cli-0.1.0/tests/backends/test_direct_backend.py +276 -0
  57. anki_cli-0.1.0/tests/backends/test_factory.py +150 -0
  58. anki_cli-0.1.0/tests/cli/test_app_bootstrap.py +317 -0
  59. anki_cli-0.1.0/tests/cli/test_cards_commands_actions.py +383 -0
  60. anki_cli-0.1.0/tests/cli/test_cards_commands_detail.py +291 -0
  61. anki_cli-0.1.0/tests/cli/test_cards_helpers.py +133 -0
  62. anki_cli-0.1.0/tests/cli/test_config_commands.py +199 -0
  63. anki_cli-0.1.0/tests/cli/test_deck_commands.py +444 -0
  64. anki_cli-0.1.0/tests/cli/test_deck_helpers.py +60 -0
  65. anki_cli-0.1.0/tests/cli/test_dispatcher.py +124 -0
  66. anki_cli-0.1.0/tests/cli/test_general_commands.py +86 -0
  67. anki_cli-0.1.0/tests/cli/test_note_commands.py +456 -0
  68. anki_cli-0.1.0/tests/cli/test_note_helpers.py +68 -0
  69. anki_cli-0.1.0/tests/cli/test_notetype_commands.py +481 -0
  70. anki_cli-0.1.0/tests/cli/test_notetype_helpers.py +27 -0
  71. anki_cli-0.1.0/tests/cli/test_review_commands.py +611 -0
  72. anki_cli-0.1.0/tests/cli/test_review_helpers.py +100 -0
  73. anki_cli-0.1.0/tests/cli/test_search_commands.py +132 -0
  74. anki_cli-0.1.0/tests/cli/test_shell_command.py +76 -0
  75. anki_cli-0.1.0/tests/cli/test_tag_commands.py +287 -0
  76. anki_cli-0.1.0/tests/integration/test_anki_direct_answer_card.py +303 -0
  77. anki_cli-0.1.0/tests/integration/test_anki_direct_card_mutators.py +398 -0
  78. anki_cli-0.1.0/tests/integration/test_anki_direct_card_note_revlog_reads.py +509 -0
  79. anki_cli-0.1.0/tests/integration/test_anki_direct_deck_config_and_add_notes.py +459 -0
  80. anki_cli-0.1.0/tests/integration/test_anki_direct_deck_write_paths.py +374 -0
  81. anki_cli-0.1.0/tests/integration/test_anki_direct_delete_and_tag_reads.py +162 -0
  82. anki_cli-0.1.0/tests/integration/test_anki_direct_due.py +172 -0
  83. anki_cli-0.1.0/tests/integration/test_anki_direct_find_queries.py +208 -0
  84. anki_cli-0.1.0/tests/integration/test_anki_direct_note_mutators.py +370 -0
  85. anki_cli-0.1.0/tests/integration/test_anki_direct_notetype_mutators.py +515 -0
  86. anki_cli-0.1.0/tests/integration/test_anki_direct_parse_decode.py +200 -0
  87. anki_cli-0.1.0/tests/integration/test_anki_direct_preview_ratings.py +299 -0
  88. anki_cli-0.1.0/tests/integration/test_anki_direct_read_apis.py +538 -0
  89. anki_cli-0.1.0/tests/integration/test_anki_direct_snapshot_restore.py +231 -0
  90. anki_cli-0.1.0/tests/integration/test_anki_direct_suspend_and_tags.py +288 -0
  91. anki_cli-0.1.0/tests/tui/test_repl_helpers.py +161 -0
  92. anki_cli-0.1.0/tests/tui/test_repl_render_card_inline.py +184 -0
  93. anki_cli-0.1.0/tests/tui/test_review_app.py +365 -0
  94. anki_cli-0.1.0/tests/unit/test_config_runtime.py +242 -0
  95. anki_cli-0.1.0/tests/unit/test_entrypoint_and_colors.py +42 -0
  96. anki_cli-0.1.0/tests/unit/test_formatter.py +168 -0
  97. anki_cli-0.1.0/tests/unit/test_models.py +111 -0
  98. anki_cli-0.1.0/tests/unit/test_params.py +48 -0
  99. anki_cli-0.1.0/tests/unit/test_scheduler.py +148 -0
  100. anki_cli-0.1.0/tests/unit/test_template.py +90 -0
  101. anki_cli-0.1.0/tests/unit/test_undo.py +111 -0
  102. anki_cli-0.1.0/uv.lock +945 -0
@@ -0,0 +1,211 @@
1
+ TODO.md
2
+ PLAN.md
3
+ .tmp-proto/
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[codz]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py.cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # UV
102
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ #uv.lock
106
+
107
+ # poetry
108
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
109
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
110
+ # commonly ignored for libraries.
111
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
112
+ #poetry.lock
113
+ #poetry.toml
114
+
115
+ # pdm
116
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
118
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
119
+ #pdm.lock
120
+ #pdm.toml
121
+ .pdm-python
122
+ .pdm-build/
123
+
124
+ # pixi
125
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
126
+ #pixi.lock
127
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
128
+ # in the .venv directory. It is recommended not to include this directory in version control.
129
+ .pixi
130
+
131
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
132
+ __pypackages__/
133
+
134
+ # Celery stuff
135
+ celerybeat-schedule
136
+ celerybeat.pid
137
+
138
+ # SageMath parsed files
139
+ *.sage.py
140
+
141
+ # Environments
142
+ .env
143
+ .envrc
144
+ .venv
145
+ env/
146
+ venv/
147
+ ENV/
148
+ env.bak/
149
+ venv.bak/
150
+
151
+ # Spyder project settings
152
+ .spyderproject
153
+ .spyproject
154
+
155
+ # Rope project settings
156
+ .ropeproject
157
+
158
+ # mkdocs documentation
159
+ /site
160
+
161
+ # mypy
162
+ .mypy_cache/
163
+ .dmypy.json
164
+ dmypy.json
165
+
166
+ # Pyre type checker
167
+ .pyre/
168
+
169
+ # pytype static type analyzer
170
+ .pytype/
171
+
172
+ # Cython debug symbols
173
+ cython_debug/
174
+
175
+ # PyCharm
176
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
179
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
180
+ #.idea/
181
+
182
+ # Abstra
183
+ # Abstra is an AI-powered process automation framework.
184
+ # Ignore directories containing user credentials, local state, and settings.
185
+ # Learn more at https://abstra.io/docs
186
+ .abstra/
187
+
188
+ # Visual Studio Code
189
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
190
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
191
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
192
+ # you could uncomment the following to ignore the entire vscode folder
193
+ # .vscode/
194
+
195
+ # Ruff stuff:
196
+ .ruff_cache/
197
+
198
+ # PyPI configuration file
199
+ .pypirc
200
+
201
+ # Cursor
202
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
203
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
204
+ # refer to https://docs.cursor.com/context/ignore-files
205
+ .cursorignore
206
+ .cursorindexingignore
207
+
208
+ # Marimo
209
+ marimo/_static/
210
+ marimo/_lsp/
211
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.13
anki_cli-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 umangkaushik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: anki-cli
3
+ Version: 0.1.0
4
+ Summary: Hybrid Anki CLI for humans and agents
5
+ Project-URL: Homepage, https://github.com/ubermenchh/anki-cli
6
+ Project-URL: Repository, https://github.com/ubermenchh/anki-cli
7
+ Project-URL: Issues, https://github.com/ubermenchh/anki-cli/issues
8
+ Author: umangkaushik
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 umangkaushik
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: anki,cli,education,flashcards,spaced-repetition
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Environment :: Console
34
+ Classifier: Intended Audience :: End Users/Desktop
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
40
+ Classifier: Topic :: Education
41
+ Classifier: Topic :: Utilities
42
+ Requires-Python: <3.14,>=3.12
43
+ Requires-Dist: betterproto[compiler]>=2.0.0b7
44
+ Requires-Dist: click
45
+ Requires-Dist: fsrs
46
+ Requires-Dist: httpx
47
+ Requires-Dist: markdownify>=1.2.2
48
+ Requires-Dist: pydantic
49
+ Requires-Dist: pyperclip>=1.11.0
50
+ Requires-Dist: rich
51
+ Provides-Extra: clipboard
52
+ Requires-Dist: pyperclip; extra == 'clipboard'
53
+ Provides-Extra: tui
54
+ Requires-Dist: prompt-toolkit; extra == 'tui'
55
+ Requires-Dist: textual; extra == 'tui'
56
+ Description-Content-Type: text/markdown
57
+
58
+ # anki-cli
59
+
60
+ Hybrid Anki CLI for humans and agents.
61
+
62
+ `anki-cli` supports both:
63
+
64
+ - AnkiConnect backend (use a running Anki Desktop instance)
65
+ - Direct SQLite backend (operate directly on collection files)
66
+
67
+ Current release: `0.1.0` (alpha).
68
+
69
+ ## Install
70
+
71
+ From PyPI (recommended):
72
+
73
+ ```bash
74
+ uv tool install anki-cli
75
+ anki --version
76
+ ```
77
+
78
+ With optional TUI extras:
79
+
80
+ ```bash
81
+ uv tool install "anki-cli[tui]"
82
+ ```
83
+
84
+ ## Quick Start
85
+
86
+ Inspect environment and backend:
87
+
88
+ ```bash
89
+ anki status
90
+ anki version
91
+ ```
92
+
93
+ List core entities:
94
+
95
+ ```bash
96
+ anki decks
97
+ anki notetypes
98
+ anki tags
99
+ ```
100
+
101
+ Query cards and notes:
102
+
103
+ ```bash
104
+ anki cards --query "deck:Default is:due"
105
+ anki notes --query "tag:verb"
106
+ anki search --query "(tag:verb OR tag:noun) -is:suspended"
107
+ ```
108
+
109
+ Inspect individual objects:
110
+
111
+ ```bash
112
+ anki card --id 1234567890
113
+ anki note --id 1234567890
114
+ anki deck --deck "Default"
115
+ anki notetype --name "Basic"
116
+ ```
117
+
118
+ ## Backend Modes
119
+
120
+ Global backend selection:
121
+
122
+ ```bash
123
+ anki --backend auto ...
124
+ anki --backend ankiconnect ...
125
+ anki --backend direct ...
126
+ ```
127
+
128
+ Collection override (direct backend):
129
+
130
+ ```bash
131
+ anki --backend direct --col "/path/to/collection.anki2" status
132
+ ```
133
+
134
+ Backend behavior:
135
+
136
+ - `auto`: detects and chooses best available backend
137
+ - `ankiconnect`: forwards search queries to `findCards` and `findNotes`
138
+ - `direct`: compiles queries to SQL and executes directly on the collection DB
139
+
140
+ ## Search Query Language
141
+
142
+ Supported filters:
143
+
144
+ - `deck:NAME` (supports `*` glob)
145
+ - `notetype:NAME`
146
+ - `tag:NAME` (supports `*` glob)
147
+ - `is:new`, `is:learn`, `is:review`, `is:due`, `is:suspended`, `is:buried`
148
+ - `flag:N`
149
+ - `prop:ivl>N`, `prop:due>N`, `prop:reps>N`, `prop:lapses>N` (`<`, `<=`, `=`, `>=`, `>`)
150
+ - `nid:ID`, `cid:ID`
151
+ - bare text and quoted text (`"specific text"`)
152
+
153
+ Logical syntax:
154
+
155
+ - implicit `AND` from whitespace
156
+ - explicit `OR`
157
+ - unary `-` and `NOT`
158
+ - parentheses for grouping
159
+
160
+ Examples:
161
+
162
+ ```bash
163
+ anki cards --query "deck:Japanese is:due"
164
+ anki cards --query "tag:verb -is:suspended"
165
+ anki notes --query "\"specific text\""
166
+ anki cards --query "(tag:a OR tag:b) is:new"
167
+ ```
168
+
169
+ ## Common Commands
170
+
171
+ ### Cards
172
+
173
+ ```bash
174
+ anki cards --query "deck:Default"
175
+ anki card --id 123
176
+ anki card:suspend --query "is:due"
177
+ anki card:unsuspend --id 123
178
+ anki card:move --query "tag:to-move" --deck "Archive"
179
+ anki card:flag --query "is:review" --flag 3
180
+ anki card:bury --query "deck:Default"
181
+ anki card:unbury --deck "Default"
182
+ anki card:reschedule --query "tag:reset-me" --days 3
183
+ anki card:reset --query "tag:relearn"
184
+ anki card:revlog --id 123 --limit 20
185
+ ```
186
+
187
+ ### Notes and tags
188
+
189
+ ```bash
190
+ anki notes --query "deck:Default"
191
+ anki note --id 123
192
+ anki note:add --deck "Default" --notetype "Basic" --Front "Q" --Back "A"
193
+ anki note:edit --id 123 --Front "Updated Q" --Back "Updated A"
194
+ anki note:fields --id 123
195
+ anki note:delete --id 123 --yes
196
+ anki tag --tag "verb"
197
+ anki tag:add --query "deck:Default" --tag "important"
198
+ anki tag:remove --id 123 --tag "important"
199
+ anki tag:rename --from "old" --to "new"
200
+ ```
201
+
202
+ ### Decks and notetypes
203
+
204
+ ```bash
205
+ anki deck --deck "Default"
206
+ anki deck:create --name "Japanese::Vocab"
207
+ anki deck:rename --from "Old" --to "New"
208
+ anki deck:delete --deck "Temporary" --yes
209
+ anki deck:config --deck "Default"
210
+ anki deck:config:set --deck "Default" --new-per-day 20 --reviews-per-day 200
211
+
212
+ anki notetypes
213
+ anki notetype --name "Basic"
214
+ anki notetype:create --name "MyType" --field "Front" --field "Back"
215
+ anki notetype:field:add --notetype "Basic" --field "Extra"
216
+ anki notetype:field:remove --notetype "Basic" --field "Extra"
217
+ anki notetype:css --notetype "Basic" --set ".card { font-size: 18px; }"
218
+ ```
219
+
220
+ ### Review
221
+
222
+ ```bash
223
+ anki review
224
+ anki review:next
225
+ anki review:show
226
+ anki review:preview --id 123
227
+ anki review:answer --id 123 --rating good
228
+ anki review:undo
229
+ ```
230
+
231
+ Interactive TUI review (requires TUI extras, direct backend):
232
+
233
+ ```bash
234
+ anki review:start --deck "Japanese"
235
+ ```
236
+
237
+ ## Output and Exit Codes
238
+
239
+ Global output formats:
240
+
241
+ ```bash
242
+ anki --format json ...
243
+ anki --format table ...
244
+ anki --format md ...
245
+ anki --format csv ...
246
+ anki --format plain ...
247
+ ```
248
+
249
+ Exit codes:
250
+
251
+ - `0`: success
252
+ - `1`: backend operation failed
253
+ - `2`: invalid input or confirmation required
254
+ - `4`: entity not found
255
+ - `7`: backend unavailable
256
+
257
+ ## Safety Notes
258
+
259
+ - Use `--yes` for destructive operations (`note:delete`, `deck:delete`).
260
+ - In direct mode, avoid write operations while Anki Desktop is open.
261
+ - If Anki Desktop is running, prefer `--backend ankiconnect`.
262
+
263
+ ## Development
264
+
265
+ ```bash
266
+ uv sync --group dev
267
+ uv run ruff check .
268
+ uv run ty check
269
+ uv run pytest
270
+ ```
271
+
272
+ With optional TUI dependencies:
273
+
274
+ ```bash
275
+ uv sync --group dev --extra tui
276
+ uv run pytest -m tui
277
+ ```
278
+
279
+ ## License
280
+
281
+ MIT. See `LICENSE`.