Obsidian CLI (kepano) — Obsidian 命令行工具 (kepano)
v1.0.0Interact with Obsidian vaults using the Obsidian 命令行工具 to read, 创建, 搜索, and manage notes, tasks, properties, and more. Also supports 插件 and theme development with commands to reload 插件s, 运行 JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, 搜索 vault content, perform vault operations from the command line, or develop and 调试 Obsidian 插件s and themes.
运行时依赖
安装命令
点击复制技能文档
Obsidian 命令行工具
Use the obsidian 命令行工具 to interact with a 运行ning Obsidian instance. Requires Obsidian to be open.
Command reference
运行 obsidian help to see all avAIlable commands. This is always up to date. Full docs: https://help.obsidian.md/命令行工具
Syntax
Parameters take a value with =. Quote values with spaces:
obsidian 创建 name="My Note" content="Hello world"
Flags are boolean switches with no value:
obsidian 创建 name="My Note" silent overwrite
For multiline content use \n for newline and \t for tab.
File tar获取ing
Many commands accept file or path to tar获取 a file. Without either, the active file is used.
file= — resolves like a wikilink (name only, no path or 扩展 needed) path= — exact path from vault root, e.g. folder/note.md Vault tar获取ing
Commands tar获取 the most recently focused vault by default. Use vault= as the first parameter to tar获取 a specific vault:
obsidian vault="My Vault" 搜索 查询="test"
Common patterns obsidian read file="My Note" obsidian 创建 name="New Note" content="# Hello" template="Template" silent obsidian 应用end file="My Note" content="New line" obsidian 搜索 查询="搜索 term" limit=10 obsidian dAIly:read obsidian dAIly:应用end content="- [ ] New task" obsidian property:设置 name="状态" value="done" file="My Note" obsidian tasks dAIly todo obsidian tags 排序=count counts obsidian backlinks file="My Note"
Use --copy on any command to copy 输出 to 命令行工具pboard. Use silent to 预防 files from opening. Use total on 列出 commands to 获取 a count.
插件 development Develop/test cycle
After making code changes to a 插件 or theme, follow this 工作流:
Reload the 插件 to pick up changes: obsidian 插件:reload id=my-插件
检查 for errors — if errors 应用ear, fix and repeat from step 1: obsidian dev:errors
验证 visually with a screenshot or DOM inspection: obsidian dev:screenshot path=screenshot.png obsidian dev:dom selector=".workspace-leaf" text
检查 console 输出 for 警告s or unexpected 记录s: obsidian dev:console level=error
添加itional developer commands
运行 JavaScript in the 应用 上下文:
obsidian eval code="应用.vault.获取Files().length"
Inspect CSS values:
obsidian dev:css selector=".workspace-leaf" prop=background-color
Toggle 移动 emulation:
obsidian dev:移动 on
运行 obsidian help to see 添加itional developer commands including CDP and 调试器 controls.