Obsidian Cli

作者 kepano3ccff5338ea7无许可证49K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库3周前更新

Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, search vault content, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.

AI 生成的概览

使用 Obsidian CLI 读取、创建、搜索和管理 Obsidian 库中的笔记、任务与属性,并开发插件。

功能
该技能说明如何通过 obsidian 命令行界面操作正在运行的 Obsidian 实例。内容涵盖命令语法、文件与库的定位方式,以及读取、创建、追加、搜索、标签管理,以及处理日记、任务和属性的常见用法。它还描述了插件与主题的开发循环,涉及重载、错误查看、截图、DOM 检查、控制台、CSS 和 JavaScript 求值等命令。
适用场景
当用户希望与自己的 Obsidian 库交互、管理或搜索笔记,或通过命令行执行库操作时使用。它也适用于开发和调试 Obsidian 插件或主题。
运行要求
需要 obsidian CLI 以及正在运行的 Obsidian 实例(Obsidian 必须处于打开状态)。不附带脚本,仅为说明文档。

Obsidian CLI

Use the obsidian CLI to interact with a running Obsidian instance. Requires Obsidian to be open.

Command reference

Run obsidian help to see all available commands. This is always up to date. Full docs: https://help.obsidian.md/cli

Syntax

Parameters take a value with =. Quote values with spaces:

bash
obsidian create name="My Note" content="Hello world"

Flags are boolean switches with no value:

bash
obsidian create name="My Note" silent overwrite

For multiline content use \n for newline and \t for tab.

File targeting

Many commands accept file or path to target a file. Without either, the active file is used.

  • file=<name> — resolves like a wikilink (name only, no path or extension needed)
  • path=<path> — exact path from vault root, e.g. folder/note.md

Vault targeting

Commands target the most recently focused vault by default. Use vault=<name> as the first parameter to target a specific vault:

bash
obsidian vault="My Vault" search query="test"

Common patterns

bash
obsidian read file="My Note"obsidian create name="New Note" content="# Hello" template="Template" silentobsidian append file="My Note" content="New line"obsidian search query="search term" limit=10obsidian daily:readobsidian daily:append content="- [ ] New task"obsidian property:set name="status" value="done" file="My Note"obsidian tasks daily todoobsidian tags sort=count countsobsidian backlinks file="My Note"

Use --copy on any command to copy output to clipboard. Use silent to prevent files from opening. Use total on list commands to get a count.

Plugin development

Develop/test cycle

After making code changes to a plugin or theme, follow this workflow:

  1. Reload the plugin to pick up changes:
    bash
    obsidian plugin:reload id=my-plugin
  2. Check for errors — if errors appear, fix and repeat from step 1:
    bash
    obsidian dev:errors
  3. Verify visually with a screenshot or DOM inspection:
    bash
    obsidian dev:screenshot path=screenshot.pngobsidian dev:dom selector=".workspace-leaf" text
  4. Check console output for warnings or unexpected logs:
    bash
    obsidian dev:console level=error

Additional developer commands

Run JavaScript in the app context:

bash
obsidian eval code="app.vault.getFiles().length"

Inspect CSS values:

bash
obsidian dev:css selector=".workspace-leaf" prop=background-color

Toggle mobile emulation:

bash
obsidian dev:mobile on

Run obsidian help to see additional developer commands including CDP and debugger controls.

来源与署名

来源:kepano/obsidian-skills位于skills/obsidian-cli提交3ccff53

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架