Communitygithub.com

cli-anything-mermaid

建立、編輯與渲染 Mermaid 圖表,透過狀態型專案檔案與 mermaid.ink 渲染器運作,專為 AI 代理與進階使用者設計。

cli-anything-mermaid 是什麼?

這個技能「cli-anything-mermaid」提供一個命令列工具,讓 AI 代理或開發者能無需圖形介面,即可建立、編輯和渲染 Mermaid 圖表(如流程圖、序列圖等)。它透過狀態型 JSON 專案檔案管理圖表來源、支援復原/重做,並使用 mermaid.ink 雲端服務將圖表轉為 SVG 或 PNG。主要特點包括互動式 REPL 模式、人類可讀與 JSON 機器輸出格式、專案生命週期指令(新增、開啟、儲存)以及快速分享 Mermaid Live Editor 連結。此工具適用於 Python 3.10+,無需額外外部軟體,是 CI/CD 流程、文件自動化或 AI 代理圖表產生的理想選擇。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-mermaid

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

cli-anything-mermaid 是做什麼的?

建立、編輯與渲染 Mermaid 圖表,透過狀態型專案檔案與 mermaid.ink 渲染器運作。專為 AI 代理與進階使用者設計,無需圖形介面即可產生流程圖、序列圖與其他視覺化圖表。

安裝

此 CLI 作為 cli-anything-mermaid 套件的一部分安裝:

pip install cli-anything-mermaid

前置需求:

  • Python 3.10+
  • 無需外部軟體(渲染使用 mermaid.ink 雲端服務)

使用方式

基本指令

# 顯示說明
cli-anything-mermaid --help

# 啟動互動式 REPL 模式
cli-anything-mermaid

# 建立新專案
cli-anything-mermaid project new -o diagram.json

# 以 JSON 輸出執行(供代理使用)
cli-anything-mermaid --json project info

REPL 模式

在不帶子指令的情況下呼叫時,CLI 會進入互動式 REPL 工作階段:

cli-anything-mermaid
# 以 tab 補全與歷史記錄互動式輸入指令

指令群組

Project(專案)

專案生命週期指令。

指令說明
new建立新的 Mermaid 專案,可選用範例預設集與主題
open開啟現有的 Mermaid 專案檔案
save將目前專案儲存至檔案
info顯示目前專案資訊
samples列出可用的範例圖表預設集

Diagram(圖表)

圖表原始碼操作指令。

指令說明
set取代 Mermaid 原始碼文字(內嵌或從檔案)
show列印目前的 Mermaid 原始碼

Export(匯出)

渲染與分享指令。

指令說明
render透過 mermaid.ink 將圖表渲染為 SVG 或 PNG
share產生 Mermaid Live Editor 分享連結

Session(工作階段)

工作階段狀態指令。

指令說明
status顯示目前工作階段狀態
undo復原上一次圖表原始碼變更
redo重做上一次復原的變更

範例

建立並渲染流程圖

# 以流程圖範例建立專案
cli-anything-mermaid project new --sample flowchart -o flow.json

# 取代圖表原始碼
cli-anything-mermaid --project flow.json diagram set --text "graph TD; A-->B; B-->C;"

# 渲染為 SVG
cli-anything-mermaid --project flow.json export render output.svg --format svg

建立序列圖

# 以序列圖範例建立專案
cli-anything-mermaid project new --sample sequence -o seq.json

# 從檔案設定圖表
cli-anything-mermaid --project seq.json diagram set --file my_diagram.mmd

# 渲染為 PNG
cli-anything-mermaid --project seq.json export render output.png --format png

分享圖表

# 產生可編輯的 Mermaid Live 連結
cli-anything-mermaid --project flow.json export share --mode edit

# 產生唯讀連結
cli-anything-mermaid --project flow.json export share --mode view

互動式 REPL 工作階段

cli-anything-mermaid
# new flowchart
# set graph TD; A-->B; B-->C;
# render output.svg
# share
# quit

狀態管理

CLI 會維護工作階段狀態,包括:

  • 復原/重做:還原或重播圖表原始碼變更
  • 專案持久性:將專案狀態儲存/載入為 JSON
  • 工作階段追蹤:追蹤修改與變更

輸出格式

所有指令都支援雙輸出模式:

  • 人類可讀(預設):表格、色彩、格式化文字
  • 機器可讀(--json 旗標):結構化 JSON,供代理使用
# 人類輸出
cli-anything-mermaid project info

# 代理使用的 JSON 輸出
cli-anything-mermaid --json project info

給 AI 代理的提示

當以程式化方式使用此 CLI 時:

  1. 始終使用 --json 旗標 以取得可解析的輸出
  2. 檢查回傳碼 - 0 代表成功,非零代表錯誤
  3. 解析 stderr 以取得失敗時的錯誤訊息
  4. 對所有檔案操作使用絕對路徑
  5. 在渲染操作後驗證輸出是否存在

更多資訊

  • 完整文件:請參閱套件中的 README.md
  • 測試覆蓋率:請參閱套件中的 TEST.md
  • 方法論:請參閱 cli-anything-plugin 中的 HARNESS.md

版本

1.0.0

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相關技能