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 path/to/obsidian_cli
uv sync
uv run odcli --help

Run tests:

cd path/to/obsidian_cli
uv run python -m unittest discover -s tests

Build distributions:

cd path/to/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 path/to/obsidian_cli
./odcli --help

The compatibility entry point is still available:

cd path/to/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="/path/to/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 path/to/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.5.tar.gz (10.5 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.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odcli-0.1.5.tar.gz
  • Upload date:
  • Size: 10.5 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.5.tar.gz
Algorithm Hash digest
SHA256 c7334f1a39c8dd46743564ca61a25ba8c8405239aa43bdba2fd70731bada2501
MD5 171e8abd1d303dadc1d6da29122f244b
BLAKE2b-256 4005a8726c8f8c21d26a34f3312d5e4c6a38fbadc727d4b0ef6d5ca22641f1cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: odcli-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ae709e267d1792a254ee8c8ebed0aac8d90184042b15deab1d325c89fb4df8cc
MD5 3731b1f5e34acdc40390a859e265984a
BLAKE2b-256 d60d9336a2132b00bca01cb208c018d1ec01be2d3e9e6af1c3aa01cc2118f341

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