cli-anything-obsidian
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecli-anything-obsidian
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.
通过Obsidian Local REST API实现知识管理与笔记记录。专为需要在无GUI环境下管理笔记、搜索知识库并执行命令的AI Agent和高级用户设计。
Installation
安装
This CLI is installed as part of the cli-anything-obsidian package:
bash
pip install cli-anything-obsidianPrerequisites:
- Python 3.10+
- Obsidian must be installed and running with the Local REST API plugin enabled
此CLI作为cli-anything-obsidian包的一部分进行安装:
bash
pip install cli-anything-obsidian前提条件:
- Python 3.10+
- 必须已安装并运行Obsidian,且启用Local REST API插件
Usage
使用方法
Basic Commands
基础命令
bash
undefinedbash
undefinedShow help
显示帮助信息
cli-anything-obsidian --help
cli-anything-obsidian --help
Start interactive REPL mode
启动交互式REPL模式
cli-anything-obsidian
cli-anything-obsidian
List vault files
列出知识库文件
cli-anything-obsidian vault list
cli-anything-obsidian vault list
Run with JSON output (for agent consumption)
以JSON格式输出(供Agent使用)
cli-anything-obsidian --json vault list
undefinedcli-anything-obsidian --json vault list
undefinedREPL Mode
REPL模式
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-obsidian当不指定子命令调用时,CLI会进入交互式REPL会话:
bash
cli-anything-obsidianEnter commands interactively with tab-completion and history
交互式输入命令,支持自动补全和历史记录
undefinedundefinedCommand Groups
命令组
Vault
知识库(Vault)
Vault file management commands.
| Command | Description |
|---|---|
| List files in the vault or a subdirectory |
| Read the content of a note |
| Create a new note |
| Overwrite an existing note |
| Delete a note from the vault |
| Append content to an existing note |
知识库文件管理命令。
| 命令 | 描述 |
|---|---|
| 列出知识库或子目录中的文件 |
| 读取笔记内容 |
| 创建新笔记 |
| 覆盖现有笔记内容 |
| 从知识库中删除笔记 |
| 向现有笔记追加内容 |
Search
搜索(Search)
Vault search commands.
| Command | Description |
|---|---|
| Search using Obsidian query syntax |
| Plain text search across the vault |
知识库搜索命令。
| 命令 | 描述 |
|---|---|
| 使用Obsidian查询语法进行搜索 |
| 在知识库中进行纯文本搜索 |
Note
笔记(Note)
Active note commands.
| Command | Description |
|---|---|
| Get the currently active note in Obsidian |
| Open a note in the Obsidian editor |
当前活跃笔记相关命令。
| 命令 | 描述 |
|---|---|
| 获取Obsidian中当前活跃的笔记 |
| 在Obsidian编辑器中打开笔记 |
Command
命令(Command)
Obsidian command palette commands.
| Command | Description |
|---|---|
| List all available Obsidian commands |
| Execute a command by its ID |
Obsidian命令面板相关命令。
| 命令 | 描述 |
|---|---|
| 列出所有可用的Obsidian命令 |
| 通过命令ID执行命令 |
Server
服务器(Server)
Server status and info commands.
| Command | Description |
|---|---|
| Check if the Obsidian Local REST API is running |
服务器状态与信息相关命令。
| 命令 | 描述 |
|---|---|
| 检查Obsidian Local REST API是否正在运行 |
Session
会话(Session)
Session state commands.
| Command | Description |
|---|---|
| Show current session state |
会话状态相关命令。
| 命令 | 描述 |
|---|---|
| 显示当前会话状态 |
Examples
示例
List and Read Notes
列出与读取笔记
bash
undefinedbash
undefinedList all vault files
列出所有知识库文件
cli-anything-obsidian vault list
cli-anything-obsidian vault list
List files in a subdirectory
列出子目录中的文件
cli-anything-obsidian vault list "Daily Notes"
cli-anything-obsidian vault list "Daily Notes"
Read a note
读取笔记
cli-anything-obsidian vault read "Projects/my-project.md"
undefinedcli-anything-obsidian vault read "Projects/my-project.md"
undefinedCreate and Update Notes
创建与更新笔记
bash
undefinedbash
undefinedCreate a new note
创建新笔记
cli-anything-obsidian vault create "Projects/new-project.md" --content "# New Project"
cli-anything-obsidian vault create "Projects/new-project.md" --content "# New Project"
Update (overwrite) a note
更新(覆盖)笔记
cli-anything-obsidian vault update "Projects/new-project.md" --content "# Updated Content"
cli-anything-obsidian vault update "Projects/new-project.md" --content "# Updated Content"
Append to a note
向笔记追加内容
cli-anything-obsidian vault append "Projects/new-project.md" --content "\n## New Section"
undefinedcli-anything-obsidian vault append "Projects/new-project.md" --content "\n## New Section"
undefinedSearch
搜索
bash
undefinedbash
undefinedPlain text search
纯文本搜索
cli-anything-obsidian search simple "meeting notes"
cli-anything-obsidian search simple "meeting notes"
Obsidian query syntax search (tags, links, etc.)
使用Obsidian查询语法搜索(标签、链接等)
cli-anything-obsidian search query "tag:#project"
undefinedcli-anything-obsidian search query "tag:#project"
undefinedCommands
命令操作
bash
undefinedbash
undefinedList available commands
列出所有可用命令
cli-anything-obsidian command list
cli-anything-obsidian command list
Execute a command by ID
通过命令ID执行命令
cli-anything-obsidian command execute "editor:toggle-bold"
undefinedcli-anything-obsidian command execute "editor:toggle-bold"
undefinedInteractive REPL Session
交互式REPL会话
Start an interactive session for exploratory use.
bash
cli-anything-obsidian启动交互式会话以进行探索性操作。
bash
cli-anything-obsidianEnter commands interactively
交互式输入命令
Use 'help' to see available commands
输入'help'查看可用命令
undefinedundefinedAPI Key Configuration
API密钥配置
bash
undefinedbash
undefinedVia flag
通过命令行参数
cli-anything-obsidian --api-key YOUR_KEY vault list
cli-anything-obsidian --api-key YOUR_KEY vault list
Via environment variable (recommended for agents)
通过环境变量(推荐Agent使用)
export OBSIDIAN_API_KEY=YOUR_KEY
cli-anything-obsidian vault list
undefinedexport OBSIDIAN_API_KEY=YOUR_KEY
cli-anything-obsidian vault list
undefinedState Management
状态管理
The CLI maintains lightweight session state:
- API key: Configurable via or
--api-keyenvironment variableOBSIDIAN_API_KEY - Host URL: Defaults to ; configurable via
https://localhost:27124--host
CLI会维护轻量级的会话状态:
- API密钥:可通过参数或
--api-key环境变量配置OBSIDIAN_API_KEY - 主机URL:默认值为;可通过
https://localhost:27124参数配置--host
Output Formats
输出格式
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (flag): Structured JSON for agent consumption
--json
bash
undefined所有命令支持两种输出模式:
- 人类可读格式(默认):表格、彩色文本、格式化内容
- 机器可读格式(参数):结构化JSON,供Agent使用
--json
bash
undefinedHuman output
人类可读输出
cli-anything-obsidian vault list
cli-anything-obsidian vault list
JSON output for agents
供Agent使用的JSON输出
cli-anything-obsidian --json vault list
undefinedcli-anything-obsidian --json vault list
undefinedFor AI Agents
针对AI Agent的使用建议
When using this CLI programmatically:
- Always use flag for parseable output
--json - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Set environment variable to avoid passing
OBSIDIAN_API_KEYon every call--api-key - Verify Obsidian is running with before other commands
server status
以编程方式使用此CLI时:
- 始终使用参数以获得可解析的输出
--json - 检查返回码 - 0表示成功,非零表示错误
- 解析stderr以获取失败时的错误信息
- **设置**环境变量,避免每次调用都传递
OBSIDIAN_API_KEY参数--api-key - 在执行其他命令前,使用验证Obsidian是否正在运行
server status
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
- 完整文档:查看包中的README.md
- 测试覆盖率:查看包中的TEST.md
- 实现方法:查看cli-anything-plugin中的HARNESS.md
Version
版本
1.0.0
1.0.0