← All tutorials
⚡
OpenCode · Python
Build a CLI Tool with OpenCode
Prerequisites
- ✓ OpenCode installed (go install github.com/opencode-ai/opencode@latest)
- ✓ Python installed
- ✓ Git installed
- ✓ Qmmit installed
- ✓ A Qmmit account with CLI token
1
Create the project
Set up a Python project.
mkdir file-organizer cd file-organizer git init echo "# File Organizer CLI" > README.md git add . && git commit -m "initial commit"
2
Set up Qmmit
Initialize tracking.
qmmit init
⚡
What Qmmit does here
Detects OpenCode via ~/.local/share/opencode/opencode.db. Installs hooks.
3
Launch OpenCode and build the tool
Run OpenCode in your terminal and ask it to build the file organizer.
opencode # In OpenCode, type: # "Create a Python CLI tool that organizes files in a directory by extension. # Move .jpg/.png to Images/, .pdf/.doc to Documents/, .py/.js to Code/. # Add --dry-run flag to preview without moving. Use argparse."
💡
OpenCode stores sessions in opencode.db SQLite. Qmmit reads the session table to filter by project directory.
4
Ask OpenCode to add logging
Add proper logging.
# In OpenCode: # "Add colored logging output showing each file moved. # Green for success, yellow for skipped, red for errors."
5
Test it
Create some test files and run.
mkdir test_dir touch test_dir/photo.jpg test_dir/report.pdf test_dir/app.py python organizer.py test_dir --dry-run
6
Commit
Commit everything.
git add . git commit -m "feat: file organizer CLI" # [qmmit] 2 prompt(s) tracked (opencode) → mno7890
⚡
What Qmmit does here
Queries opencode.db, joins session + message + part tables, filters by session.directory matching this project.
7
Push and verify
Push and check dashboard.
git push -u origin main