Cli Anything Obsidian

hkuds/cli-anything/skills/cli-anything-obsidian

作者 hkuds34f519533bc1無授權條款51K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 週前更新

Command-line interface for Obsidian — Knowledge management and note-taking via Obsidian Local REST API. Designed for AI agents and power users who need to manage notes, search the vault, and execute commands without the GUI.

AI 產生的概覽

透過本機 REST API 管理 Obsidian 筆記、搜尋儲存庫並執行 Obsidian 命令的命令列介面。

功能
為 Obsidian 提供命令列介面,可列出、讀取、建立、更新、附加和刪除儲存庫中的筆記,並使用純文字、Dataview DQL 或 JsonLogic 查詢搜尋儲存庫。它也能讀取或開啟目前作用中的筆記,列出並執行 Obsidian 命令面板中的命令,以及檢查伺服器和工作階段狀態。預設輸出為人類可讀格式,使用 --json 旗標可輸出結構化 JSON,並提供互動式 REPL。
適用情境
當代理程式或進階使用者需要在沒有圖形介面的情況下操作 Obsidian 儲存庫時使用,例如讀取或寫入筆記、搜尋筆記內容或觸發 Obsidian 命令。它適合需要 JSON 輸出和傳回碼的指令碼化或代理程式驅動的知識管理情境。
執行需求
需要 Python 3.10+,並透過 pip 安裝 cli-anything-obsidian 套件。Obsidian 必須已安裝並正在執行,且啟用了 Local REST API 外掛。API 金鑰透過 --api-key 旗標或 OBSIDIAN_API_KEY 環境變數提供,主機預設是 --host 設定。需要存取本機 REST API 的網路連線。此技能不附帶指令碼,僅為說明文件。

cli-anything-obsidian

Knowledge management and note-taking via the Obsidian Local REST API. Designed for AI agents and power users who need to manage notes, search the vault, and execute commands without the GUI.

Installation

This CLI is installed as part of the cli-anything-obsidian package:

bash
pip install cli-anything-obsidian

Prerequisites:

Usage

Basic Commands

bash
# Show helpcli-anything-obsidian --help
# Start interactive REPL modecli-anything-obsidian
# List vault filescli-anything-obsidian vault list
# Run with JSON output (for agent consumption)cli-anything-obsidian --json vault list

REPL Mode

When invoked without a subcommand, the CLI enters an interactive REPL session:

bash
cli-anything-obsidian# Enter commands interactively with tab-completion and history

Command Groups

Vault

Vault file management commands.

CommandDescription
listList files in the vault or a subdirectory
readRead the content of a note
createCreate a new note
updateOverwrite an existing note
deleteDelete a note from the vault
appendAppend content to an existing note

Search

Vault search commands.

CommandDescription
querySearch using Obsidian query syntax
simplePlain text search across the vault

Note

Active note commands.

CommandDescription
activeGet the currently active note in Obsidian
openOpen a note in the Obsidian editor

Command

Obsidian command palette commands.

CommandDescription
listList all available Obsidian commands
executeExecute a command by its ID

Server

Server status and info commands.

CommandDescription
statusCheck if the Obsidian Local REST API is running

Session

Session state commands.

CommandDescription
statusShow current session state

Examples

List and Read Notes

bash
# List all vault filescli-anything-obsidian vault list
# List files in a subdirectorycli-anything-obsidian vault list "Daily Notes"
# Read a notecli-anything-obsidian vault read "Projects/my-project.md"

Create and Update Notes

bash
# Create a new notecli-anything-obsidian vault create "Projects/new-project.md" --content "# New Project"
# Update (overwrite) a notecli-anything-obsidian vault update "Projects/new-project.md" --content "# Updated Content"
# Append to a notecli-anything-obsidian vault append "Projects/new-project.md" --content "\n## New Section"

Search

bash
# Plain text search (GET /search/simple/)cli-anything-obsidian search simple "meeting notes"
# Dataview DQL query — default --type dql, sent as# application/vnd.olrapi.dataview.dql+txtcli-anything-obsidian search query 'TABLE file.link FROM "Projects"'
# JsonLogic query — application/vnd.olrapi.jsonlogic+jsoncli-anything-obsidian search query --type jsonlogic \  '{"==":[{"var":"frontmatter.status"},"active"]}'

Commands

bash
# List available commandscli-anything-obsidian command list
# Execute a command by IDcli-anything-obsidian command execute "editor:toggle-bold"

Interactive REPL Session

Start an interactive session for exploratory use.

bash
cli-anything-obsidian# Enter commands interactively# Use 'help' to see available commands

API Key Configuration

bash
# Via flagcli-anything-obsidian --api-key YOUR_KEY vault list
# Via environment variable (recommended for agents)export OBSIDIAN_API_KEY=YOUR_KEYcli-anything-obsidian vault list

State Management

The CLI maintains lightweight session state:

  • API key: Configurable via --api-key or OBSIDIAN_API_KEY environment variable
  • Host URL: Defaults to https://localhost:27124; configurable via --host

Output Formats

All commands support dual output modes:

  • Human-readable (default): Tables, colors, formatted text
  • Machine-readable (--json flag): Structured JSON for agent consumption
bash
# Human outputcli-anything-obsidian vault list
# JSON output for agentscli-anything-obsidian --json vault list

For AI Agents

When using this CLI programmatically:

  1. Always use --json flag for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. Set OBSIDIAN_API_KEY environment variable to avoid passing --api-key on every call
  5. Verify Obsidian is running with server status before other commands

More Information

  • Full documentation: See README.md in the package
  • Test coverage: See TEST.md in the package
  • Methodology: See HARNESS.md in the cli-anything-plugin

Version

1.1.0

來源與署名

來源:hkuds/cli-anything位於skills/cli-anything-obsidian提交34f5195

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架