obsidian-excalidraw-cli
它能做什么
这项技能让 AI 通过命令行,在正在运行的 Obsidian 应用中处理 Excalidraw 绘图。它可以创建、查看、编辑和渲染绘图。它适合希望由 AI 修改图表的 Obsidian 用户。
适用场景
- ✓当你希望 AI 在 Obsidian 中创建或编辑一份 Excalidraw 绘图的时候。
- ✓当你需要一份绘图的导出图片,用于笔记或文档的时候。
- ✓当你想确认绘图修改确实已经保存的时候。
技能链接
https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/docs/AITrainingData/excalidraw-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我 Obsidian 的绘图 onboarding.excalidraw 中添加一个带标签的流程图,然后将其导出为图片。”
每周 5 个新技能,1 分钟读完。
工作原理
它会请 Obsidian 读取绘图,使用唯一的请求 ID 应用修改,检查修改是否已保存,然后导出一张图片供检查。它使用精确的绘图路径。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Use a local terminal with Obsidian running and CLI enabled (API 1.12.2+). Always put vault="<name or ID>" before the command. Native root: obsidian-excalidraw-plugin. Start with obsidian vault="<vault>" obsidian-excalidraw-plugin:help, then :schema action=create. All results use apiVersion 1. Check ok, mutation and persistence; process exit zero alone does not prove success. Put large requests in a visible vault-relative JSON file and pass input="<file>". Inline json is for small requests. Requests in files include apiVersion:1; the native command supplies command. The in-process ea.executeCLI request also includes command. Use exact drawing paths including extensions. Never assume an active drawing. :open explicitly creates a tab and can run configured drawing scripts. Loop: :read source=live detail=elements (or detail=images to inventory) → :apply with expectedRevision and a unique requestId → check persistence=saved → :export → inspect the image file. For duplicate views use the view ID from :open or :read. Refresh after STALE_REVISION; retry BUSY with the same requestId only when refused before execution; unknown outcomes require read-back. New skeleton IDs are local labels; use returned idMap actual IDs for updates. Updates reject identity, bindings and asset internals. Every write requires requestId. Repeat the identical effective request to retrieve its receipt; different content with the same ID fails. :result requestId=<id> recovers a receipt after lost stdout. Receipts expire after 15 minutes/reload; unknown outcome requires read-back before another write. :api surface=ea name=<method> gives existing EA signatures. :api surface=lib lists the supported installed Lib reference; advanced exports remain available to scripts. :icons query=<name> discovers installed canonical Lucide names (paged); create icons / apply op=lucide insert editable native groups. groupMap maps logical icon aliases to groupId/elementIds; idMap remains single-element only. Defaults: size=96, strokeColor=#1e1e1e, roughness=1, opacity=100; optional strokeWidth is final scene units. No trusted script is required. :script requires trusted=true and an explicit existing local script file. utils.input contains args; utils.excalidrawLib is the installed runtime. Await all work; completion does not imply saved drawing. One-shot EA is cleaned up; utility prompts fail INTERACTION_REQUIRED. Trusted code can still invoke other interactive APIs: this is not a sandbox, timeout cancellation or transaction. Export names an explicit out=.svg/.png; overwrite=true is required for existing outputs. Live exports never implicitly save. Disk exports require local Vault assets; use a loaded live source or placeholders for remote assets. For cheap previews: :read detail=images, then :export imagePolicy={"default":"placeholder","rules":[{"ids":["wanted-id"],"mode":"original"}]}. This is lossless for the underlying drawing, not the preview. imageMetadata apply operations set bounded descriptive label/tags, with null clearing; request-only imagePolicy.labels does not persist. Thumbnail mode uses thumbnailMaxDimension=512 by default; only PNG/JPEG/WebP with safe preflight dimensions are decoded (24 MiB / 16 million pixels maximum). maxWidth/maxHeight/maxPixels bound output dimensions; maxArtifactBytes caps final bytes. Source revision covers originals; representationId identifies the preview. SVG width controls display size, not embedded raster payload size; use imagePolicy for that. Use :schema for exact fields, operation limits, and runnable examples. Do not edit compressed drawing Markdown directly or install another Excalidraw CLI.
常见问题
运行时 Obsidian 必须处于打开状态吗?
是的。需要打开 Obsidian,并启用其命令行接口。
它如何避免重复修改?
每次写入都带有唯一的请求 ID,因此重复相同的请求会返回相同的回执,而不会产生重复的修改。
运行时没有报错,就足以说明它可靠吗?
不。技能要求你检查修改是否已保存,因为进程正常退出并不能证明操作成功。
详情
作者的原始描述
Create, inspect, edit and render Obsidian Excalidraw drawings through the running app's native CLI.
热度
- GitHub 星标
- 7.8k
- 排名
- #12829
- 许可证
- AGPL-3.0
- 更新时间
- 2026/11/2
评论
- …