Skip to main content

A small CLI for reading and writing notes in a local Obsidian vault.

Project description

odcli

odcli is a local Python CLI for reading and writing notes in an Obsidian vault. It works directly on Markdown files inside the vault, so it does not depend on private Obsidian APIs and remains portable and easy to extend.

Features

  • Validate whether a vault path is available
  • List Markdown notes in the vault
  • Read a specific note
  • Read a specific line range from a note
  • Overwrite a note or create it automatically
  • Replace a specific line range in a note
  • Append content to a note
  • Full-text search across the vault
  • Auto-discover the default vault from Obsidian config or common macOS and Windows locations
  • Install odcli helper skills into Codex or Claude Code skill directories

Using uv

cd /Users/huchang/agents/obsidian_cli
uv sync
uv run odcli --help

Run tests:

cd /Users/huchang/agents/obsidian_cli
uv run python -m unittest discover -s tests

Build distributions:

cd /Users/huchang/agents/obsidian_cli
uv build

The published package name on PyPI is odcli. After installation, both odcli and obsidian-cli are available as command names.

Run Locally

cd /Users/huchang/agents/obsidian_cli
./odcli --help

The compatibility entry point is still available:

cd /Users/huchang/agents/obsidian_cli
./obsidian-cli --help

If you prefer module execution:

PYTHONPATH=src python3 -m obsidian_cli --help

Vault Resolution

Resolution priority:

  1. --vault /path/to/vault
  2. OBSIDIAN_VAULT
  3. The most recently opened vault recorded by local Obsidian config
  4. Common default directories

Built-in default locations:

  • macOS: ~/Documents/Obsidian Vault
  • macOS: ~/Documents/Obsidian
  • macOS iCloud: ~/Library/Mobile Documents/iCloud~md~obsidian/Documents
  • Windows: %USERPROFILE%\\Documents\\Obsidian Vault
  • Windows: %USERPROFILE%\\Documents\\Obsidian

Example:

export OBSIDIAN_VAULT="/Users/your-name/Documents/MyVault"
./odcli check
./odcli list
./odcli read Inbox/today.md
./odcli read-lines Inbox/today.md 3 8
./odcli write Inbox/today.md --content "# Today"
./odcli write-lines Inbox/today.md 3 4 --content "- replaced\n- lines\n"
./odcli append Inbox/today.md --content "\n- new item"
./odcli search "project alpha"

Commands

check

Validate that the vault exists and report whether .obsidian is present.

list

List Markdown notes in the vault.

Optional arguments:

  • --limit N

read

Read a note.

Arguments:

  • note_path: path relative to the vault root

write

Overwrite a note. Parent directories are created automatically if needed.

Arguments:

  • note_path
  • --content TEXT
  • --stdin

Optional arguments:

  • --create-only

read-lines

Read a line range. Line numbers are 1-based and inclusive.

Arguments:

  • note_path
  • start_line
  • end_line

write-lines

Replace a line range. Line numbers are 1-based and inclusive.

Arguments:

  • note_path
  • start_line
  • end_line
  • --content TEXT
  • --stdin

append

Append content to the end of a note.

Arguments:

  • note_path
  • --content TEXT
  • --stdin

search

Search across all Markdown notes in the vault.

Arguments:

  • query
  • --case-sensitive

plugin install

Install odcli helper skills for local coding tools.

Targets:

  • codex-skill: installs to ~/.codex/skills/odcli/SKILL.md
  • claude-skill: installs to ~/.claude/skills/odcli/SKILL.md
  • all-skills: installs both

Examples:

odcli plugin install codex-skill
odcli plugin install claude-skill
odcli plugin install all-skills

Testing

cd /Users/huchang/agents/obsidian_cli
uv run python -m unittest discover -s tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odcli-0.1.4.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odcli-0.1.4-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file odcli-0.1.4.tar.gz.

File metadata

  • Download URL: odcli-0.1.4.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for odcli-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3db1f51767a866c0c01ccfef5d1a7df87aa2fcf9ce075d222340c28e154d7d18
MD5 2f7505e889fce4978dc2f94ad75fdba7
BLAKE2b-256 49ec827a1fcb0c1dcd142bff772513dd32679fb5b9fd81c0f7ba510a2144bc29

See more details on using hashes here.

File details

Details for the file odcli-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: odcli-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for odcli-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3343fddedfb602c5d7cf8391bbf192f915934185e355b978081b199626e3e66a
MD5 85b9bc40ff52ea32ab6896a9e26f9a1b
BLAKE2b-256 bcdcd87b890916db93f474a2f3d446fc0b66bba40c3326b1ae5012ff3d809b78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page