From 687ab5ee2857e8d2ab0b09593dd245e5efa85204 Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Wed, 27 May 2026 16:43:40 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Add=20obsidian-cli=20skill?= =?UTF-8?q?=20for=20Obsidian=20vault=20CLI=20operations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- skills/obsidian-cli/SKILL.md | 199 ++++++ .../references/commands-reference.md | 568 ++++++++++++++++++ 2 files changed, 767 insertions(+) create mode 100644 skills/obsidian-cli/SKILL.md create mode 100644 skills/obsidian-cli/references/commands-reference.md diff --git a/skills/obsidian-cli/SKILL.md b/skills/obsidian-cli/SKILL.md new file mode 100644 index 0000000..2c806fc --- /dev/null +++ b/skills/obsidian-cli/SKILL.md @@ -0,0 +1,199 @@ +--- +name: obsidian-cli +description: >- + Obsidian CLI skill for reading, creating, editing, searching, and managing note content + in Obsidian vaults from the command line. Supports daily notes, tasks, properties, tags, + links, file history, templates, and full file CRUD operations. + Use this skill whenever the user wants to read or edit Obsidian notes, search vault content, + manage tasks or properties, append/prepend content, or perform any vault note operation. + Also triggers when the user mentions "obsidian cli", "obsidian command", "vault" operations, + or "obsidian" in a terminal/CLI context. Always invoke this skill before attempting + Obsidian-related operations to ensure correct command syntax and available parameters. + Requires Obsidian 1.12+ with CLI enabled and the Obsidian app running. +--- + +# Obsidian CLI + +Control Obsidian from the command line. The Obsidian desktop app must be running — the CLI connects to it over a local bridge. + +> **Prerequisites:** Obsidian installer 1.12.7+ with CLI enabled (Settings -> General -> Command line interface). + +## Syntax + +**Parameters** use `key=value`. Quote values containing spaces: + +```bash +obsidian create name="My Note" content="Hello world" +``` + +**Flags** are boolean switches with no value: + +```bash +obsidian create name="My Note" open overwrite +``` + +**Multiline content:** Use `\n` for newline, `\t` for tab. + +**Copy output:** Append `--copy` to any command to copy the result to clipboard. + +## Targeting + +### File targeting + +Most file commands accept `file` and/or `path`. If neither is given, the active file is used. + +| Parameter | Behavior | +|-----------|----------| +| `file=` | Resolves like a wikilink — name only, no path or extension needed | +| `path=` | Exact vault-relative path, e.g. `folder/note.md` | + +### Vault targeting + +If your terminal CWD is a vault folder, that vault is used. Otherwise the active vault is used. Override with `vault=` or `vault=` as the first parameter: + +```bash +obsidian vault=Notes daily +obsidian vault="My Vault" search query="test" +``` + +--- + +## Commands + +For the full parameter reference of every command, read `references/commands-reference.md`. + +### Daily notes + +```bash +obsidian daily # Open today's daily note +obsidian daily:read # Read daily note content +obsidian daily:append content="- [ ] Buy groceries" # Append to daily note +obsidian daily:prepend content="# Summary" # Prepend to daily note +obsidian daily:path # Get daily note file path +``` + +### Files and folders + +```bash +obsidian file file=Recipe # Show file info +obsidian files folder="Projects" ext=md # List files (filter by folder/extension) +obsidian folders # List all folders +obsidian open file=Recipe # Open a file +obsidian read file=Recipe # Read file contents +obsidian create name="New Note" content="# Hello" # Create a note +obsidian create name="Trip" template=Travel open # Create from template and open +obsidian append file=Recipe content="New line" # Append to file +obsidian prepend file=Recipe content="Header text" # Prepend after frontmatter +obsidian move file=Recipe to="Archive/Recipe.md" # Move/rename file +obsidian rename file=Recipe name="New Recipe" # Rename file +obsidian delete file=Recipe # Delete file (to trash) +obsidian delete file=Recipe permanent # Delete permanently +``` + +### Search + +```bash +obsidian search query="meeting notes" # Search vault (returns file paths) +obsidian search query="TODO" path="Projects" limit=10 # Search within a folder +obsidian search:context query="error" # Search with line context (grep-style) +obsidian search:open query="initial query" # Open search in Obsidian UI +``` + +### Tasks + +```bash +obsidian tasks # List all tasks +obsidian tasks todo # Incomplete tasks only +obsidian tasks daily # Tasks from today's daily note +obsidian tasks file=Recipe done verbose # Completed tasks from a file, with line numbers +obsidian tasks daily total # Count tasks in daily note +obsidian task ref="Recipe.md:8" toggle # Toggle task completion +obsidian task daily line=3 done # Mark daily note task as done +obsidian task file=Recipe line=8 status=- # Set custom status character +``` + +### Properties + +```bash +obsidian properties # List all properties in vault +obsidian properties active # Properties of active file +obsidian properties name=status counts # Count occurrences of a property +obsidian property:set name=status value=done file=Recipe # Set a property +obsidian property:read name=status file=Recipe # Read a property value +obsidian property:remove name=draft file=Recipe # Remove a property +obsidian aliases file=Recipe # List aliases for a file +``` + +### Tags + +```bash +obsidian tags # List all tags +obsidian tags sort=count counts # Tags sorted by frequency with counts +obsidian tags active # Tags of active file +obsidian tag name=project verbose # Tag info with file list +``` + +### Links + +```bash +obsidian backlinks file=Recipe # List backlinks to a file +obsidian backlinks file=Recipe counts # With link counts +obsidian links file=Recipe # Outgoing links from a file +obsidian unresolved # List unresolved links +obsidian orphans # Files with no incoming links +obsidian deadends # Files with no outgoing links +``` + +### Outline + +```bash +obsidian outline file=Recipe # Show headings (tree format) +obsidian outline file=Recipe format=json total # JSON format with heading count +``` + +### File history + +```bash +obsidian diff # List versions of active file +obsidian diff file=Recipe from=1 # Compare latest version to current +obsidian diff file=Recipe from=3 to=1 # Compare two versions +obsidian history file=Recipe # Local history versions +obsidian history:read file=Recipe version=2 # Read a history version +obsidian history:restore file=Recipe version=3 # Restore a history version +``` + +### Templates + +```bash +obsidian templates # List templates +obsidian template:read name=Meeting resolve # Read template with variables resolved +obsidian template:insert name=Meeting # Insert template into active file +``` + +### Vault info + +```bash +obsidian vault # Show vault info +obsidian vault info=files # File count only +obsidian vaults verbose # List all known vaults with paths +obsidian wordcount file=Recipe # Word and character count +obsidian wordcount words # Word count only +``` + +### General + +```bash +obsidian help # List all commands +obsidian version # Show Obsidian version +obsidian reload # Reload app window +obsidian restart # Restart app +``` + +--- + +## Tips + +- **Clipboard:** Add `--copy` to any command to copy output. +- **Counts:** Add `total` to list commands to get a count instead of full output. +- **Output formats:** Many list commands accept `format=json|tsv|csv` for structured output. +- **Help:** Run `obsidian help` for an always-up-to-date command list. Run `obsidian help ` for command-specific help. diff --git a/skills/obsidian-cli/references/commands-reference.md b/skills/obsidian-cli/references/commands-reference.md new file mode 100644 index 0000000..0dc2792 --- /dev/null +++ b/skills/obsidian-cli/references/commands-reference.md @@ -0,0 +1,568 @@ +# Commands Reference + +Full parameter reference for Obsidian CLI note content commands. Required parameters are marked `(required)`. + +## Table of contents + +- [General](#general) +- [Daily notes](#daily-notes) +- [Files and folders](#files-and-folders) +- [Search](#search) +- [Tasks](#tasks) +- [Properties](#properties) +- [Tags](#tags) +- [Links](#links) +- [Outline](#outline) +- [File history](#file-history) +- [Templates](#templates) +- [Vault](#vault) +- [Wordcount](#wordcount) + +--- + +## General + +### `help` + +Show available commands or help for a specific command. + +| Parameter | Description | +| ----------- | --------------------------------- | +| `` | Show help for a specific command. | + +### `version` + +Show Obsidian version. + +### `reload` + +Reload the app window. + +### `restart` + +Restart the app. + +--- + +## Daily notes + +### `daily` + +Open daily note. + +| Parameter | Description | +| ------------------------------- | ---------------------- | +| `paneType=tab\|split\|window` | Pane type to open in | + +### `daily:path` + +Get daily note path. Returns the expected path even if the file hasn't been created yet. + +### `daily:read` + +Read daily note contents. + +### `daily:append` + +Append content to daily note. + +| Parameter | Description | +| ------------------------------- | ---------------------------- | +| `content=` | (required) Content to append | +| `paneType=tab\|split\|window` | Pane type to open in | +| `inline` | Append without newline | +| `open` | Open file after adding | + +### `daily:prepend` + +Prepend content to daily note. + +| Parameter | Description | +| ------------------------------- | ---------------------------- | +| `content=` | (required) Content to prepend| +| `paneType=tab\|split\|window` | Pane type to open in | +| `inline` | Prepend without newline | +| `open` | Open file after adding | + +--- + +## Files and folders + +### `file` + +Show file info (default: active file). Returns path, name, extension, size, created/modified timestamps. + +| Parameter | Description | +| ------------- | ----------- | +| `file=` | File name | +| `path=` | File path | + +### `files` + +List files in the vault. + +| Parameter | Description | +| ----------------- | ------------------------ | +| `folder=` | Filter by folder | +| `ext=` | Filter by extension | +| `total` | Return file count | + +### `folder` + +Show folder info. + +| Parameter | Description | +| ------------------------------ | -------------------------- | +| `path=` | (required) Folder path | +| `info=files\|folders\|size` | Return specific info only | + +### `folders` + +List folders in the vault. + +| Parameter | Description | +| --------------- | ------------------------ | +| `folder=` | Filter by parent folder | +| `total` | Return folder count | + +### `open` + +Open a file. + +| Parameter | Description | +| ------------- | ---------------- | +| `file=` | File name | +| `path=` | File path | +| `newtab` | Open in new tab | + +### `create` + +Create or overwrite a file. + +| Parameter | Description | +| ------------------ | ------------------------ | +| `name=` | File name | +| `path=` | File path | +| `content=` | Initial content | +| `template=` | Template to use | +| `overwrite` | Overwrite if exists | +| `open` | Open after creating | +| `newtab` | Open in new tab | + +### `read` + +Read file contents (default: active file). + +| Parameter | Description | +| ------------- | ----------- | +| `file=` | File name | +| `path=` | File path | + +### `append` + +Append content to a file (default: active file). + +| Parameter | Description | +| ---------------- | ---------------------------- | +| `file=` | File name | +| `path=` | File path | +| `content=` | (required) Content to append | +| `inline` | Append without newline | + +### `prepend` + +Prepend content after frontmatter (default: active file). + +| Parameter | Description | +| ---------------- | ----------------------------- | +| `file=` | File name | +| `path=` | File path | +| `content=` | (required) Content to prepend | +| `inline` | Prepend without newline | + +### `move` + +Move or rename a file (default: active file). Auto-updates internal links if enabled. + +| Parameter | Description | +| -------------- | ----------------------------- | +| `file=` | File name | +| `path=` | File path | +| `to=` | (required) Destination path | + +### `rename` + +Rename a file (default: active file). Extension preserved if omitted. Use `move` to rename and move simultaneously. + +| Parameter | Description | +| -------------- | ------------------------- | +| `file=` | File name | +| `path=` | File path | +| `name=` | (required) New file name | + +### `delete` + +Delete a file (default: active file, trash by default). + +| Parameter | Description | +| -------------- | ------------------------------ | +| `file=` | File name | +| `path=` | File path | +| `permanent` | Skip trash, delete permanently | + +--- + +## Search + +### `search` + +Search vault for text. Returns matching file paths. + +| Parameter | Description | +| -------------------- | ------------------------------ | +| `query=` | (required) Search query | +| `path=` | Limit to folder | +| `limit=` | Max files | +| `format=text\|json` | Output format (default: text) | +| `total` | Return match count | +| `case` | Case sensitive | + +### `search:context` + +Search with matching line context. Returns grep-style `path:line: text` output. + +| Parameter | Description | +| -------------------- | ------------------------------ | +| `query=` | (required) Search query | +| `path=` | Limit to folder | +| `limit=` | Max files | +| `format=text\|json` | Output format (default: text) | +| `case` | Case sensitive | + +### `search:open` + +Open search view in Obsidian. + +| Parameter | Description | +| --------------- | ---------------------- | +| `query=` | Initial search query | + +--- + +## Tasks + +### `tasks` + +List tasks in the vault. + +| Parameter | Description | +| ------------------------ | --------------------------------- | +| `file=` | Filter by file name | +| `path=` | Filter by file path | +| `status=""` | Filter by status character | +| `total` | Return task count | +| `done` | Show completed tasks | +| `todo` | Show incomplete tasks | +| `verbose` | Group by file with line numbers | +| `format=json\|tsv\|csv` | Output format (default: text) | +| `active` | Show tasks for active file | +| `daily` | Show tasks from daily note | + +### `task` + +Show or update a task. + +| Parameter | Description | +| -------------------- | -------------------------- | +| `ref=` | Task reference (path:line) | +| `file=` | File name | +| `path=` | File path | +| `line=` | Line number | +| `status=""` | Set status character | +| `toggle` | Toggle task status | +| `daily` | Target daily note | +| `done` | Mark as done | +| `todo` | Mark as todo | + +--- + +## Properties + +### `aliases` + +List aliases in the vault. + +| Parameter | Description | +| ------------- | -------------------- | +| `file=` | File name | +| `path=` | File path | +| `total` | Return alias count | +| `verbose` | Include file paths | +| `active` | Show for active file | + +### `properties` + +List properties in the vault. + +| Parameter | Description | +| ------------------------ | ----------------------------- | +| `file=` | Show properties for file | +| `path=` | Show properties for path | +| `name=` | Get specific property count | +| `sort=count` | Sort by count (default: name) | +| `format=yaml\|json\|tsv` | Output format (default: yaml) | +| `total` | Return property count | +| `counts` | Include occurrence counts | +| `active` | Show for active file | + +### `property:set` + +Set a property on a file (default: active file). + +| Parameter | Description | +| ---------------------------------------------------- | -------------------- | +| `name=` | (required) Property name | +| `value=` | (required) Property value | +| `type=text\|list\|number\|checkbox\|date\|datetime` | Property type | +| `file=` | File name | +| `path=` | File path | + +### `property:remove` + +Remove a property from a file (default: active file). + +| Parameter | Description | +| ------------- | ------------------------ | +| `name=` | (required) Property name | +| `file=` | File name | +| `path=` | File path | + +### `property:read` + +Read a property value from a file (default: active file). + +| Parameter | Description | +| ------------- | ------------------------ | +| `name=` | (required) Property name | +| `file=` | File name | +| `path=` | File path | + +--- + +## Tags + +### `tags` + +List tags in the vault. + +| Parameter | Description | +| ------------------------ | ----------------------------- | +| `file=` | File name | +| `path=` | File path | +| `sort=count` | Sort by count (default: name) | +| `total` | Return tag count | +| `counts` | Include tag counts | +| `format=json\|tsv\|csv` | Output format (default: tsv) | +| `active` | Show for active file | + +### `tag` + +Get tag info. + +| Parameter | Description | +| ------------ | --------------------------- | +| `name=` | (required) Tag name | +| `total` | Return occurrence count | +| `verbose` | Include file list and count | + +--- + +## Links + +### `backlinks` + +List backlinks to a file (default: active file). + +| Parameter | Description | +| ------------------------ | ----------------------------- | +| `file=` | Target file name | +| `path=` | Target file path | +| `counts` | Include link counts | +| `total` | Return backlink count | +| `format=json\|tsv\|csv` | Output format (default: tsv) | + +### `links` + +List outgoing links from a file (default: active file). + +| Parameter | Description | +| ------------- | ------------------ | +| `file=` | File name | +| `path=` | File path | +| `total` | Return link count | + +### `unresolved` + +List unresolved links in vault. + +| Parameter | Description | +| ------------------------ | ----------------------------- | +| `total` | Return unresolved link count | +| `counts` | Include link counts | +| `verbose` | Include source files | +| `format=json\|tsv\|csv` | Output format (default: tsv) | + +### `orphans` + +List files with no incoming links. + +| Parameter | Description | +| --------- | ------------------- | +| `total` | Return orphan count | + +### `deadends` + +List files with no outgoing links. + +| Parameter | Description | +| --------- | ---------------------- | +| `total` | Return dead-end count | + +--- + +## Outline + +### `outline` + +Show headings for a file. + +| Parameter | Description | +| ------------------------ | ------------------------------- | +| `file=` | File name | +| `path=` | File path | +| `format=tree\|md\|json` | Output format (default: tree) | +| `total` | Return heading count | + +--- + +## File history + +### `diff` + +List or compare versions from local File recovery and Sync. Versions numbered newest to oldest. + +| Parameter | Description | +| ---------------------- | ------------------------------ | +| `file=` | File name | +| `path=` | File path | +| `from=` | Version number to diff from | +| `to=` | Version number to diff to | +| `filter=local\|sync` | Filter by version source | + +### `history` + +List versions from File recovery only. + +| Parameter | Description | +| ------------- | ----------- | +| `file=` | File name | +| `path=` | File path | + +### `history:list` + +List all files with local history. + +### `history:read` + +Read a local history version. + +| Parameter | Description | +| --------------- | ------------------------------ | +| `file=` | File name | +| `path=` | File path | +| `version=` | Version number (default: 1) | + +### `history:restore` + +Restore a local history version. + +| Parameter | Description | +| --------------- | ------------------------ | +| `file=` | File name | +| `path=` | File path | +| `version=` | (required) Version number| + +### `history:open` + +Open file recovery. + +| Parameter | Description | +| ------------- | ----------- | +| `file=` | File name | +| `path=` | File path | + +--- + +## Templates + +### `templates` + +List templates. + +| Parameter | Description | +| --------- | ---------------------- | +| `total` | Return template count | + +### `template:read` + +Read template content. + +| Parameter | Description | +| ------------------ | --------------------------------------------------- | +| `name=