Metadata-Version: 2.4
Name: mochimochi
Version: 0.1.1
Summary: CLI tool for managing Mochi flashcards with local-first sync
Author: tsilva
License: MIT License
        
        Copyright (c) 2025 Tiago Silva
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/tsilva/mochimochi
Project-URL: Repository, https://github.com/tsilva/mochimochi
Project-URL: Issues, https://github.com/tsilva/mochimochi/issues
Keywords: mochi,flashcards,spaced-repetition,cli,markdown,ai-grading
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Topic :: Education
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: openai>=1.0.0
Requires-Dist: numpy<3.0,>=1.20.0
Requires-Dist: faiss-cpu>=1.7.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: ruff>=0.8.0; extra == "dev"
Dynamic: license-file

<div align="center">

<img src="https://raw.githubusercontent.com/tsilva/mochimochi/main/logo.png" alt="mochimochi" width="512"/>

# mochimochi

**🍡 Local-first CLI for curating [Mochi](https://mochi.cards/) flashcard decks with AI-powered deduplication and quality grading ✨**

</div>

mochimochi is a Python CLI for managing Mochi flashcards from local markdown files. Pull a deck from Mochi, edit it in your own folder, review changes with git, then push or sync the result back to Mochi.

It also includes optional AI workflows for finding semantic duplicates and improving card quality before you sync.

## Install

```bash
uv tool install git+https://github.com/tsilva/mochimochi.git
mochimochi decks
```

The first command installs the CLI. The second lists your Mochi decks and prompts for a Mochi API key if one has not been saved yet.

For local development:

```bash
git clone https://github.com/tsilva/mochimochi.git
cd mochimochi
uv sync --extra dev
uv run mochimochi decks
```

## Commands

```bash
mochimochi decks                         # list available Mochi decks
mochimochi pull <deck_id>                # download a deck to deck-<name>-<deck_id>.md
mochimochi push deck-python-abc123.md    # push local markdown changes to Mochi
mochimochi sync deck-python-abc123.md    # sync local changes and handle remote deletions
mochimochi push                          # push every deck-*.md file in the current directory
mochimochi sync                          # sync every deck-*.md file in the current directory
mochimochi dedupe deck-python-abc123.md  # find and remove semantic duplicates
mochimochi curate deck-python-abc123.md  # grade and improve low-quality cards
```

Useful options:

```bash
mochimochi push deck-python-abc123.md --force       # skip duplicate detection
mochimochi sync deck-python-abc123.md --force       # skip duplicate detection
mochimochi dedupe deck-python-abc123.md --threshold 0.9
mochimochi curate deck-python-abc123.md --threshold 9
```

## Card Format

Deck files are markdown. Existing cards keep their Mochi `card_id`; new cards use `null`.

```markdown
---
card_id: abc123
tags: ["python", "basics"]
---
What is a list comprehension?
---
A concise way to create lists: [x for x in iterable]
---
card_id: null
---
New card question
---
New card answer
```

## Notes

- Requires Python 3.10 or newer.
- Config is stored in `~/.mochimochi/config`.
- `MOCHI_API_KEY` is required for all commands and is prompted on first use.
- `OPENROUTER_API_KEY` is required for `dedupe` and `curate`.
- AI caches are stored in `~/.mochimochi/cache`.
- New local decks can be created as `deck-<name>.md`; the first push creates the Mochi deck and renames the file to include the deck ID.
- Run unit tests with `uv run pytest -m "not integration"`. Live API tests require `TEST_DECK_ID`.

## Architecture

![mochimochi architecture diagram](./architecture.png)

## License

[MIT](LICENSE)
