obsidian-cli-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseObsidian CLI Automation
Obsidian CLI 自动化
Overview
概述
Automate Obsidian workflows with deterministic CLI commands.
Use this skill to map natural-language requests into safe, repeatable command sequences with explicit verification.
obsidian通过确定性的CLI命令自动化Obsidian工作流。使用此技能可将自然语言请求转换为安全、可重复的命令序列,并附带明确的验证步骤。
obsidianWhen to Use
使用场景
Use this skill when requests include any of the following intents:
- Automate Obsidian workflows from terminal scripts
- Batch create, update, move, rename, or delete notes
- Operate daily notes, tasks, links, tags, aliases, properties
- Query vault structure, search content, generate hygiene reports
- Manage plugins, themes, snippets, tabs, workspace, bookmarks
- Inspect or recover history and Obsidian Sync versions
- Execute developer diagnostics commands such as or
dev:*eval
当请求包含以下任一意图时,可使用此技能:
- 通过终端脚本自动化Obsidian工作流
- 批量创建、更新、移动、重命名或删除笔记
- 操作每日笔记、任务、链接、标签、别名、属性
- 查询库结构、搜索内容、生成健康报告
- 管理插件、主题、代码片段、标签页、工作区、书签
- 检查或恢复历史记录与Obsidian Sync版本
- 执行开发者诊断命令,如或
dev:*eval
Quick Start
快速开始
- Confirm CLI availability:
bash
command -v obsidian obsidian version - Discover vault names:
bash
obsidian vaults - Pin target vault and run a read-only probe:
bash
VAULT='My Vault' obsidian vault="$VAULT" vault info=path obsidian vault="$VAULT" files total
- 确认CLI可用:
bash
command -v obsidian obsidian version - 查看库名称:
bash
obsidian vaults - 固定目标库并运行只读探测:
bash
VAULT='My Vault' obsidian vault="$VAULT" vault info=path obsidian vault="$VAULT" files total
Execution Workflow
执行流程
- Discover command surface before automation.
- Run .
obsidian --help - Run for a complete snapshot.
scripts/collect_obsidian_help.sh
- Run
- Resolve targets with deterministic selectors.
- Prefer over
path=when ambiguity exists.file= - Use on all non-trivial runs.
vault=<name>
- Prefer
- Execute read-first probes.
- Use ,
read,file,tasks,properties,searchbefore mutation.sync:history
- Use
- Execute minimal mutation steps.
- Apply ,
append,prepend,create,property:set,task,movein small steps.rename
- Apply
- Verify post-change state.
- Re-run read/query commands and compare expected vs actual output.
- 自动化前先了解命令范围。
- 运行。
obsidian --help - 运行获取完整的命令快照。
scripts/collect_obsidian_help.sh
- 运行
- 使用确定性选择器定位目标。
- 当存在歧义时,优先使用而非
path=。file= - 在所有非简单运行中使用。
vault=<name>
- 当存在歧义时,优先使用
- 先执行只读探测。
- 在执行修改操作前,先使用、
read、file、tasks、properties、search命令。sync:history
- 在执行修改操作前,先使用
- 执行最小化修改步骤。
- 分小步执行、
append、prepend、create、property:set、task、move等修改命令。rename
- 分小步执行
- 验证修改后的状态。
- 重新运行读取/查询命令,对比预期与实际输出。
Command Families
命令分类
- Vault discovery and structure: ,
vaults,vault,folders,files,folderfile - Note lifecycle: ,
create,read,append,prepend,move,rename,deleteopen - Daily workflow: ,
daily,daily:path,daily:read,daily:appenddaily:prepend - Tasks and links: ,
tasks,task,links,backlinks,orphans,deadendsunresolved - Metadata: ,
tags,tag,aliases,properties,property:read,property:setproperty:remove - Search and outline: ,
search,search:context,search:openoutline - Bases: ,
bases,base:views,base:querybase:create - UI/system controls: ,
tabs,tab:open,workspace,command,commands,reloadrestart - Theme/snippet/plugin management: ,
themes,theme:*,snippets,snippet:*,plugins,plugin:*plugins:restrict - Sync/history and recovery: ,
sync:*,history:*diff - Developer diagnostics: ,
dev:*,devtools,eval,dev:console,dev:errorsdev:screenshot
- 库发现与结构:,
vaults,vault,folders,files,folderfile - 笔记生命周期:,
create,read,append,prepend,move,rename,deleteopen - 日常工作流:,
daily,daily:path,daily:read,daily:appenddaily:prepend - 任务与链接:,
tasks,task,links,backlinks,orphans,deadendsunresolved - 元数据:,
tags,tag,aliases,properties,property:read,property:setproperty:remove - 搜索与大纲:,
search,search:context,search:openoutline - 基础功能:,
bases,base:views,base:querybase:create - UI/系统控制:,
tabs,tab:open,workspace,command,commands,reloadrestart - 主题/代码片段/插件管理:,
themes,theme:*,snippets,snippet:*,plugins,plugin:*plugins:restrict - 同步/历史与恢复:,
sync:*,history:*diff - 开发者诊断:,
dev:*,devtools,eval,dev:console,dev:errorsdev:screenshot
High-Value Automation Patterns
高价值自动化模式
Daily planning block
每日规划模块
bash
VAULT='My Vault'
obsidian vault="$VAULT" daily:append content=$'## Plan\n- [ ] Top 1\n- [ ] Top 2\n'
obsidian vault="$VAULT" daily:readbash
VAULT='My Vault'
obsidian vault="$VAULT" daily:append content=$'## Plan\n- [ ] Top 1\n- [ ] Top 2\n'
obsidian vault="$VAULT" daily:readBatch frontmatter update for a folder
批量更新文件夹前置元数据
bash
VAULT='My Vault'
obsidian vault="$VAULT" files folder='Projects' ext=md | while IFS= read -r p; do
[ -z "$p" ] && continue
obsidian vault="$VAULT" property:set path="$p" name=reviewed value=false type=checkbox
donebash
VAULT='My Vault'
obsidian vault="$VAULT" files folder='Projects' ext=md | while IFS= read -r p; do
[ -z "$p" ] && continue
obsidian vault="$VAULT" property:set path="$p" name=reviewed value=false type=checkbox
doneVault hygiene snapshot
库健康快照
bash
VAULT='My Vault'
obsidian vault="$VAULT" unresolved total
obsidian vault="$VAULT" orphans total
obsidian vault="$VAULT" deadends total
obsidian vault="$VAULT" recents totalbash
VAULT='My Vault'
obsidian vault="$VAULT" unresolved total
obsidian vault="$VAULT" orphans total
obsidian vault="$VAULT" deadends total
obsidian vault="$VAULT" recents totalSync inspection before restore
恢复前的同步检查
bash
VAULT='My Vault'
TARGET='Projects/Example.md'
obsidian vault="$VAULT" sync:history path="$TARGET"
obsidian vault="$VAULT" sync:read path="$TARGET" version=1bash
VAULT='My Vault'
TARGET='Projects/Example.md'
obsidian vault="$VAULT" sync:history path="$TARGET"
obsidian vault="$VAULT" sync:read path="$TARGET" version=1Safety Guardrails
安全防护
- Avoid destructive commands (,
delete permanent,sync:restore,history:restore,theme:uninstall) without explicit confirmation.plugin:uninstall - Use mutation commands only after a read probe confirms target scope.
- Split large automations into idempotent, restart-safe steps.
- Log command output for rollback decisions when running bulk operations.
- 若无明确确认,避免执行破坏性命令(,
delete permanent,sync:restore,history:restore,theme:uninstall)。plugin:uninstall - 仅在只读探测确认目标范围后,再执行修改命令。
- 将大型自动化拆分为幂等、可重启的步骤。
- 执行批量操作时,记录命令输出以便回滚决策。
Bundled Resources
捆绑资源
- : Dump top-level help, all command helps, and a markdown report.
scripts/collect_obsidian_help.sh - : Copy-paste automation recipes for recurring workflows.
references/automation-recipes.md - : Full command traversal output for
references/obsidian-cli-full-help.mdCLI.obsidian
- :导出顶级帮助信息、所有命令帮助信息,生成Markdown报告。
scripts/collect_obsidian_help.sh - :可直接复制使用的自动化配方,适用于重复工作流。
references/automation-recipes.md - :
references/obsidian-cli-full-help.mdCLI的完整命令遍历输出。obsidian
Validation Checklist
验证清单
- Run target command(s) with explicit and
vault=.path= - Run verification command(s) immediately after each mutation step.
- Report changed files, properties, tasks, or sync versions with exact command evidence.
- 使用明确的和
vault=参数运行目标命令。path= - 每个修改步骤后立即运行验证命令。
- 附带确切的命令证据,报告已修改的文件、属性、任务或同步版本。