Skip to content

feat: mille analyze — dependency graph visualization (terminal/json/dot/svg)#51

Merged
makinzm merged 5 commits into
mainfrom
feat/analyze
Mar 8, 2026
Merged

feat: mille analyze — dependency graph visualization (terminal/json/dot/svg)#51
makinzm merged 5 commits into
mainfrom
feat/analyze

Conversation

@makinzm

@makinzm makinzm commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • mille analyze サブコマンドを追加(ルール適用なし、依存グラフの可視化のみ)
  • 4 フォーマット対応: terminal(デフォルト)/ json / dot / svg
  • --output <path> フラグ: ファイルへの書き出し(既存ファイルへの上書き拒否)
  • SVG はダークテーマ(slate-900 bg / green-500 edge)でブラウザ表示可能な自己完結 XML

使い方

# 依存グラフをターミナルで確認
mille analyze

# SVG をブラウザで表示
mille analyze --format svg --output graph.svg && open graph.svg

# Graphviz でレンダリング
mille analyze --format dot | dot -Tsvg -o graph.svg

# JSON (CI/スクリプト向け)
mille analyze --format json --output graph.json

Test plan

  • E2E テスト 16 件追加(tests/e2e_analyze.rs
    • json/dot/svg の出力フォーマット検証(shape・layer名・edge 存在確認)
    • --output ファイル書き込み(svg/json/dot)
    • 既存ファイルへの上書き拒否
    • --output 指定時の stdout 無出力
    • --output なし時の stdout 出力
    • exit code = 0(ルール不適用)
  • 全テストスイート(300 件)通過
  • lefthook(clippy / fmt / test)通過

🤖 Generated with Claude Code

makinzm and others added 5 commits March 8, 2026 17:44
- Add `mille analyze` subcommand with `AnalyzeFormat` enum (terminal/json/dot/svg)
- `usecase/analyze.rs`: parse & resolve imports, aggregate layer-level edges
- `formatter/svg.rs`: topological layout + Kahn's algorithm, dark-theme SVG
- `runner.rs`: inline terminal/json/dot formatters, SVG via formatter/svg
- 10 E2E tests all pass, full test suite (294 tests) clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Write json/dot/svg output to a file instead of stdout
- Refuse to overwrite existing files (exit 1 with error message)
- stdout is silent when --output is set; success message goes to stderr
- 6 new E2E tests pass, full suite clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@makinzm makinzm merged commit 2e808bb into main Mar 8, 2026
8 checks passed
@makinzm makinzm deleted the feat/analyze branch March 8, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant