CLI コマンド
npx dowse <command> [options]共通オプション
ほとんどのコマンドで使えます。
| オプション | 既定 | 説明 |
|---|---|---|
--since <date> | 12 months ago | git 履歴の開始。git が解釈できる表現 |
--until <date> | — | git 履歴の終了 |
--complexity <type> | loc | 複雑度プロキシ: loc | cyclomatic | cognitive |
--json | false | JSON を標準出力へ |
analyze
ワークスペースを解析し、.dowse/dowse.json を生成して要約を表示します。
dowse analyze [dir]| オプション | 既定 | 説明 |
|---|---|---|
--top <n> | 10 | 表示する hotspot 件数 |
--out <path> | .dowse/dowse.json | 出力先 |
--verify-churn [n] | 無効 | 上位 N 件(既定 20)の変更頻度を AST 比較で検証 |
--min-degree <n> | 0.3 | coupling の最小結合度(30 のような % 表記も可) |
--min-shared <n> | 5 | coupling の最小共有コミット数 |
--json を付けると dowse.json の内容を標準出力に出し、ファイルは書きません。
hotspots
hotspot ランキングだけを素早く表示します。
dowse hotspots [dir] --top 15coupling
change coupling を表示します。
dowse coupling [dir] --hidden| オプション | 既定 | 説明 |
|---|---|---|
--hidden | false | 隠れた結合(依存関係のない共変更)のみ |
--files | false | ファイル粒度の coupling も表示 |
--top <n> | 20 | 表示件数 |
--min-degree <n> | 0.3 | 最小結合度 |
--min-shared <n> | 5 | 最小共有コミット数 |
閾値を下げて見落としを拾う
活発なパッケージ同士は分母が大きく degree が下がります。--min-degree 15 で拾えることがあります。
why
2 つの対象がなぜ一緒に変わるのかを説明します。
dowse why <a> <b>対象はパッケージ名・ファイルパス・ディレクトリのいずれでも指定できます(パッケージ名 → 完全一致パス → 前方一致の順に解決)。
| オプション | 既定 | 説明 |
|---|---|---|
--cwd <path> | . | 解析対象ディレクトリ |
--top <n> | 10 | 表示するファイル件数 |
--commits <n> | 10 | 表示する代表コミット件数 |
dowse why @acme/admin-web @acme/doctor-web
dowse why packages/ui src/api --since "6 months ago"health
Code Health と smell の内訳を表示します。
dowse health [dir]
dowse health --file src/foo.ts # 1 ファイルの減点内訳| オプション | 既定 | 説明 |
|---|---|---|
--file <path> | — | 特定ファイルの内訳だけを表示 |
--top <n> | 10 | 表示件数 |
knowledge
ownership と bus factor を表示します。
dowse knowledge [dir] --top 15パッケージ単位の bus factor、貢献者一覧、主要開発者が抜けたときの影響(off-boarding シミュレーション)が出ます。
report
自己完結の単一 HTML レポートを生成します。外部リクエストを一切行わず、データも埋め込み済みなのでそのまま共有できます。
dowse report [dir] --out report.htmldiagnose
hotspot 上位を LLM で診断します(Claude Code が必要)。
dowse diagnose [dir] --top 3| オプション | 既定 | 説明 |
|---|---|---|
--top <n> | 3 | 診断する件数(コストが比例します) |
--model <model> | — | 使用するモデル |
所見であって計測値ではありません
決定的メトリクスと分離して扱ってください。
fix
hotspot を実際に修正させ、検証し、複雑度の改善幅を実測します(Claude Code が必要)。
dowse fix [target]
dowse fix src/foo.ts --apply| オプション | 既定 | 説明 |
|---|---|---|
--apply | false | 検証を通過した変更を作業ブランチに残す |
--cwd <path> | . | 解析対象ディレクトリ |
--top <n> | 1 | target 省略時に対象とする件数 |
--max-diff-lines <n> | 400 | 許容する変更行数の上限 |
--skip-diagnosis | false | 診断を省略して直接修正させる |
--skip-verification | false | 型チェック・テストを省略(非推奨) |
--typecheck-command <script> | 自動推測 | 型チェックの package.json script 名 |
--test-command <script> | 自動推測 | テストの package.json script 名 |
既定は dry-run です。安全弁の詳細は 閉ループで直す を参照してください。
check
品質ゲート。違反があれば終了コード 1 を返します。
dowse check [dir] --min-file-health 3| オプション | 説明 |
|---|---|
--min-file-health <n> | ファイル health の下限 |
--min-package-health <n> | パッケージ health の下限 |
--max-hotspot <n> | hotspot スコアの上限(0〜1) |
--min-bus-factor <n> | パッケージ bus factor の下限 |
--max-hidden-coupling <n> | 隠れた結合の件数上限 |
--sarif <path> | SARIF を出力(GitHub Code Scanning 用) |
既定では何も検査しません
閾値を明示指定したものだけを見ます。導入時はまず現状を測り、達成可能な値から始めてください。
diff
base からの変更がリスクの高い場所に触れているかを評価します。
dowse diff <base>
dowse diff origin/main --markdown| オプション | 既定 | 説明 |
|---|---|---|
--head <ref> | HEAD | 比較先 |
--cwd <path> | . | 解析対象ディレクトリ |
--markdown | false | PR コメント用の Markdown を標準出力へ |
--out <path> | — | Markdown をファイルへ出力 |
mcp
MCP サーバとして起動します(stdio)。
dowse mcp [dir] --since "6 months ago"詳しくは エージェント統合 と MCP リファレンス を参照してください。