Skip to content

CLI コマンド

bash
npx dowse <command> [options]

共通オプション

ほとんどのコマンドで使えます。

オプション既定説明
--since <date>12 months agogit 履歴の開始。git が解釈できる表現
--until <date>git 履歴の終了
--complexity <type>loc複雑度プロキシ: loc | cyclomatic | cognitive
--jsonfalseJSON を標準出力へ

analyze

ワークスペースを解析し、.dowse/dowse.json を生成して要約を表示します。

bash
dowse analyze [dir]
オプション既定説明
--top <n>10表示する hotspot 件数
--out <path>.dowse/dowse.json出力先
--verify-churn [n]無効上位 N 件(既定 20)の変更頻度を AST 比較で検証
--min-degree <n>0.3coupling の最小結合度(30 のような % 表記も可)
--min-shared <n>5coupling の最小共有コミット数

--json を付けると dowse.json の内容を標準出力に出し、ファイルは書きません。


hotspots

hotspot ランキングだけを素早く表示します。

bash
dowse hotspots [dir] --top 15

coupling

change coupling を表示します。

bash
dowse coupling [dir] --hidden
オプション既定説明
--hiddenfalse隠れた結合(依存関係のない共変更)のみ
--filesfalseファイル粒度の coupling も表示
--top <n>20表示件数
--min-degree <n>0.3最小結合度
--min-shared <n>5最小共有コミット数

閾値を下げて見落としを拾う

活発なパッケージ同士は分母が大きく degree が下がります。--min-degree 15 で拾えることがあります。


why

2 つの対象がなぜ一緒に変わるのかを説明します。

bash
dowse why <a> <b>

対象はパッケージ名・ファイルパス・ディレクトリのいずれでも指定できます(パッケージ名 → 完全一致パス → 前方一致の順に解決)。

オプション既定説明
--cwd <path>.解析対象ディレクトリ
--top <n>10表示するファイル件数
--commits <n>10表示する代表コミット件数
bash
dowse why @acme/admin-web @acme/doctor-web
dowse why packages/ui src/api --since "6 months ago"

health

Code Health と smell の内訳を表示します。

bash
dowse health [dir]
dowse health --file src/foo.ts    # 1 ファイルの減点内訳
オプション既定説明
--file <path>特定ファイルの内訳だけを表示
--top <n>10表示件数

knowledge

ownership と bus factor を表示します。

bash
dowse knowledge [dir] --top 15

パッケージ単位の bus factor、貢献者一覧、主要開発者が抜けたときの影響(off-boarding シミュレーション)が出ます。


report

自己完結の単一 HTML レポートを生成します。外部リクエストを一切行わず、データも埋め込み済みなのでそのまま共有できます。

bash
dowse report [dir] --out report.html

diagnose

hotspot 上位を LLM で診断します(Claude Code が必要)。

bash
dowse diagnose [dir] --top 3
オプション既定説明
--top <n>3診断する件数(コストが比例します
--model <model>使用するモデル

所見であって計測値ではありません

決定的メトリクスと分離して扱ってください。


fix

hotspot を実際に修正させ、検証し、複雑度の改善幅を実測します(Claude Code が必要)。

bash
dowse fix [target]
dowse fix src/foo.ts --apply
オプション既定説明
--applyfalse検証を通過した変更を作業ブランチに残す
--cwd <path>.解析対象ディレクトリ
--top <n>1target 省略時に対象とする件数
--max-diff-lines <n>400許容する変更行数の上限
--skip-diagnosisfalse診断を省略して直接修正させる
--skip-verificationfalse型チェック・テストを省略(非推奨
--typecheck-command <script>自動推測型チェックの package.json script 名
--test-command <script>自動推測テストの package.json script 名

既定は dry-run です。安全弁の詳細は 閉ループで直す を参照してください。


check

品質ゲート。違反があれば終了コード 1 を返します。

bash
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 からの変更がリスクの高い場所に触れているかを評価します。

bash
dowse diff <base>
dowse diff origin/main --markdown
オプション既定説明
--head <ref>HEAD比較先
--cwd <path>.解析対象ディレクトリ
--markdownfalsePR コメント用の Markdown を標準出力へ
--out <path>Markdown をファイルへ出力

mcp

MCP サーバとして起動します(stdio)。

bash
dowse mcp [dir] --since "6 months ago"

詳しくは エージェント統合MCP リファレンス を参照してください。

MIT ライセンスで公開されています