图表生成
- 作者仓库星标 19,426
- 作者仓库 opik
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @comet-ml · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Diagram Generation
Generate self-contained HTML diagrams that visualize code changes, data flows, and architecture decisions.
## When to Use
- Visualizing PR changes for code review
- Explaining architectural decisions
- Documenting data/request flows
- Illustrating before/after comparisons
## Output
- Self-contained HTML file at `{MAIN_REPO_ROOT}/diagrams/opik-{TICKET_NUMBER}-diagram.html` — always resolved against the main repo root (via `git rev-parse --git-common-dir`), even when the session runs inside a worktree, so the file outlives the worktree
- Includes "Copy as image" button for sharing in Slack, Jira, PR descriptions
- Dark GitHub theme, semantic color coding, responsive layout
## How to Generate
Follow the style guide in `style-guide.md` and use the HTML template in `template.md`.
### Required Sections (pick what applies)
1. **Request / Data Flow** — how data moves through layers
2. **Why This Approach** — problem vs solution comparison
3. **Files Changed by Layer** — grid of affected files grouped by component
4. **Key Design Decisions** — numbered guards, trade-offs, or constraints
### Section Selection
- **Bug fix**: Focus on before/after flow, root cause, safety guards
- **New feature**: Focus on data flow, architecture, files changed
- **Refactor**: Focus on before/after architecture, files changed
- **Cross-component**: Show all layers with connecting flows
## Reference Files
- [style-guide.md](style-guide.md) — Semantic colors, box themes, section labels, flow patterns, architecture trees
- [template.md](template.md) — Base HTML structure, copy-as-image script, section recipes
## Common Gotchas
- **SRI hash on CDN scripts**: The html2canvas `<script>` tag must include `integrity` and `crossorigin` attributes — see template.md for the current hash
- **Absolute paths for Playwright screenshots**: Playwright saves relative to its own CWD, not the repo root — always use absolute paths when calling `browser_take_screenshot`
- **Max 4 sections**: More than 4 sections makes diagrams too tall for screenshots and hard to scan visually
- **No raw diff content**: Diagrams show high-level summaries (component names, file names, flow descriptions) — never embed verbatim diff hunks or Jira comments
- **`toBlob` can return null**: The Canvas `toBlob` call in the copy-as-image script needs a null check — see template.md
章节与文件索引
按说明文件中的顺序排列。
何时使用
输出
如何生成
必填部分(选择适用的部分)
部分选择
文件/命令 -> {MAIN_REPO_ROOT}/diagrams/opik-{TICKET_NUMBER}-diagram.html · git rev-parse --git-common-dir · style-guide.md · template.md · <script> · integrity · crossorigin · browser_take_screenshot
内容校验值 -> 30b25aeb4e88
当前原文的自动摘译,尚未人工审校。
何时使用
可视化 PR 更改以进行代码审查 解释架构决策 记录数据/请求流 说明比较之前/之后
输出
位于
{MAIN_REPO_ROOT}/diagrams/opik-{TICKET_NUMBER}-diagram.html的独立 HTML 文件 — 始终针对主存储库根进行解析(通过git rev-parse --git-common-dir),即使会话在工作树内运行,因此文件比工作树寿命更长 包含“复制为图像”按钮,用于在 Slack、Jira、PR 描述中共享 深色 GitHub 主题、语义颜色编码、响应式布局如何生成
遵循
style-guide.md中的样式指南并使用template.md中的HTML模板。必填部分(选择适用的部分)
请求/数据流 — 数据如何在各层中移动 为什么采用此方法 — 问题与解决方案比较 按层更改的文件 — 按组件分组的受影响文件网格 关键设计决策 — 编号保护、权衡或约束
部分选择
错误修复:关注流程前/后、根本原因、安全防护 新功能:关注数据流、架构、文件更改 重构:关注架构前/后、文件更改 跨组件:显示具有连接流的所有层