Appearance
Agentic coding workflow
For developersThe desktop obsidian CLI exposes developer commands for testing and debugging plugins and themes through the running app. These capabilities do not exist in the documented Headless ob surface.
Loop
sequenceDiagram
participant Agent
participant CLI as obsidian CLI
participant App as Obsidian app
Agent->>CLI: plugin:reload id=my-plugin
CLI->>App: reload plugin
App-->>CLI: ok
Agent->>CLI: dev:errors
CLI->>App: dump JS errors
App-->>Agent: error buffer
Agent->>CLI: dev:screenshot path=after.png
CLI->>App: capture screenshot
App-->>Agent: base64 PNG written to path
Agent->>CLI: eval code="app.vault.getFiles().length"
CLI->>App: run JS in context
App-->>Agent: resultUseful commands
| Step | Command |
|---|---|
| Reload a plugin you are developing | obsidian plugin:reload id=my-plugin |
| Open dev tools | obsidian devtools |
| Attach the Chrome DevTools Protocol debugger | obsidian dev:debug on |
| Capture a screenshot | obsidian dev:screenshot path=screenshot.png |
| Read the JS error buffer | obsidian dev:errors |
| Read the console buffer | obsidian dev:console limit=50 level=error |
| Inspect CSS for a selector | obsidian dev:css selector=".workspace-leaf" |
| Query the DOM | obsidian dev:dom selector=".cm-line" text |
| Run arbitrary JS | obsidian eval code="app.workspace.getActiveFile()?.path" |
Tips
- Pair
dev:errorsanddev:consolewith aplugin:reloadcycle so the agent only sees diagnostics from the reload it just triggered. - The
evalcommand runs JavaScript with full access toapp. Treat it as a powerful capability and only run code you trust. - Stop for exact approval before running untrusted
eval, installing/uninstalling plugins, or mutating user content. Use an isolated test vault and a rollback plan. - Use
dev:debug onthen attach a CDP client for breakpoint-grade debugging.