← 返回 CLI 目录 抓取的
Graphviz (dot)
$ dot 基金会 低风险 Graphviz · 设计与文档排版 · EPL-1.0 · macos / linux / windows
Graphviz(dot)将结构化的 .dot 图描述转换为层次、力导向或环形布局的 SVG、PNG、PDF 及 JSON 坐标数据(-Tjson)。毫秒级 C 原生执行、标准输入输出流式支持与全平台包管理器覆盖,使其成为极稳健的 Agent 绘图后端。
FCRS-1.0 综合评分
80 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install graphviz CLI vs MCP 选型建议 仅 CLI 可用
dot 可在毫秒内同步处理 .dot 文件或标准输入,并直接支持 -Tjson 布局检查,无需额外 MCP。
Agent 友好度体检单
本地探针实测证据 ✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md
实测版本
dot - graphviz version 14.1.3 (20260303.0454)
冷启动耗时
299 ms
退出码 (help / 非法参数)
0 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
Usage: dot [-Vv?] [-(GNEA)name=val] [-(KTlso)<val>] <dot files>
(additional options for neato) [-x] [-n<v>]
(additional options for fdp) [-L(gO)] [-L(nUCT)<val>]
(additional options for config) [-cv]
-V - Print version and exit
-v[n] - Enable verbose mode at level 1, or set to the level 'n' if provided
-Gname=val - Set graph attribute 'name' to 'val'
-Nname=val - Set node attribute 'name' to 'val'
-Ename=val - Set edge attribute 'name' to 'val'
-Aname=val - Set attribute 'name' to 'val' for graph, node, and edge
-Tv - Set output format to 'v'
-Kv - Set layout engine to 'v' (overrides default based on command name)
-lv - Use external library 'v'
-ofile - Write output to 'file'
-O - Automatically generate an output filename based on the input filename with a .'format' appended. (Causes all -ofile options to be ignored.)
-P - Internally generate a graph of the current plugins.
-q[l] - Set level of message suppression (=1)
-s[v] - Scale input by 'v' (=72)
-y - Invert y coordinate in output
-n[v] - No layout mode 'v' (=1)
-x - Reduce graph
-Lg - Don't use grid
-LO - Use old attractive force
-Ln<i> - Set number of iterations to i
-LU<i> - Set unscaled factor to i
-LC<v> - Set overlap expansion factor to v
-LT[*]<v> - Set temperature (temperature factor) to v
-c - Configure plugins (Writes $prefix/lib/graphviz/config
with available plugin information. Needs write privilege.)
-? - Print usage and exit FCRS-1.0 六维评分拆解
Agent 友好度 19 / 25
纯标准输入输出 UNIX 过滤器风格,支持 -Tjson 坐标输出并在 stderr 报错。
dot -Tjsonoutputs structured node/edge layout JSON- Non-interactive execution with deterministic exit codes
安全与权限边界 23 / 25
离线本地布局工具,零鉴权与网络副作用(仅在渲染外部不可信输入时需留意 image= 本地路径读取)。
- No credentials or remote calls
- Pure file/pipe transformation
安装与运行摩擦 14 / 15
几乎被所有主流系统包管理器(brew、apt、dnf、choco、winget)原生收录。
- Ubiquitous OS package availability
能力覆盖与边际价值 12 / 15
在依赖图、AST 与调用图布局上极强,但默认视觉样式相比 D2 或 Mermaid 较朴素。
- Multiple layout engines (
dot,neato,fdp,circo,sfdp)
维护与来源背书 7 / 10
成熟项目,托管于 GitLab(graphviz/graphviz)并以 EPL-1.0 协议稳定维护。
- Stable maintenance with regular bugfix releases
文档与可验证性 5 / 10
graphviz.org 提供完整的官方技术参考,但排版偏传统手册风格。
- Official docs at graphviz.org/doc/info/command.html
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需任何凭据;纯离线 C 可执行程序。
潜在副作用
只读查询 本地写入
费用与配额提示
免费开源软件(EPL-1.0)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Graphviz Agent Rules - Use `-Tsvg` for crisp diagrams or `-Tjson` to inspect layout geometry without writing files. - Always write rendered outputs to an explicit `-o` path instead of clobbering inputs. - Pass `-Kneato` or `-Ksfdp` for large undirected graphs where hierarchical `dot` layout is too slow.
Agent 高频安全命令配方
只读查询(安全推荐)
以 JSON 导出 Graphviz 布局几何信息
dot -Tjson graph.dot
校验 .dot 语法并将计算后的节点与边坐标以 JSON 输出到 stdout。
查看 Graphviz 版本信息
dot -V
打印本地安装的 Graphviz 版本号。
受控写入与预演
将 DOT 图渲染为 SVG
dot -Tsvg graph.dot -o dist/graph.svg
将 graph.dot 编译为清晰的矢量 SVG 文件 dist/graph.svg。
核心优势
- + 毫秒级原生执行,零浏览器与 JVM 运行时依赖。
- +
-Tjson可导出精确计算的布局坐标并同时完成.dot语法校验。 - + 几乎所有 Linux/macOS/Windows 包管理器均可一键安装。
注意事项与踩坑点
- ! 相比 D2 等现代工具,默认外观较为古朴。
- ! 超大规模稠密图采用默认
dot分层布局可能较慢,需切换-Ksfdp。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI