CLI コマンド
similarity-goは、GoプロジェクトでのコードPRAG類似性を分析するためのCLIコマンドの包括的なセットを提供します。すべてのコマンドは、分析動作をカスタマイズするためのさまざまなオプションとフラグをサポートしています。
グローバルフラグ
Section titled “グローバルフラグ”これらのフラグはすべてのコマンドで使用できます:
| フラグ | 短縮 | 説明 | デフォルト |
|---|---|---|---|
--help | -h | コマンドのヘルプを表示 | |
--version | -v | バージョン情報を表示 | |
--config | -c | 設定ファイルのパス | .similarity-go.yaml |
--verbose | 詳細出力を有効化 | false | |
--quiet | -q | 非必須出力を抑制 | false |
analyze
Section titled “analyze”Go コードの類似性を分析します。
similarity-go analyze [paths...] [flags]paths...: 分析する1つ以上のパス(ファイルまたはディレクトリ)
| フラグ | 型 | 説明 | デフォルト |
|---|---|---|---|
--threshold | float | 類似性しきい値 (0.0-1.0) | 0.8 |
--format | string | 出力形式 (detailed, json, yaml) | detailed |
--output | string | 出力ファイルパス | stdout |
--ignore | []string | 無視するパターン | [] |
--include | []string | 含めるパターン | [] |
--parallel | int | 並列ワーカー数 | CPU コア数 |
--cache | bool | 結果キャッシュを有効化 | true |
# 現在ディレクトリの基本解析similarity-go analyze ./
# カスタムしきい値で特定ディレクトリを解析similarity-go analyze ./cmd ./internal --threshold 0.9
# 結果をJSONにエクスポートsimilarity-go analyze ./ --format json --output results.json
# テストファイルとvendorディレクトリを無視similarity-go analyze ./ --ignore "**/*_test.go" --ignore "vendor/**"config
Section titled “config”設定ファイルと設定を管理します。
similarity-go config [subcommand]サブコマンド
Section titled “サブコマンド”新しい設定ファイルを初期化:
similarity-go config init [--force]現在のディレクトリに.similarity-go.yamlファイルを作成します。
validate
Section titled “validate”設定ファイルを検証:
similarity-go config validate [--config path]現在の設定を表示:
similarity-go config show [--config path]分析キャッシュを管理します。
similarity-go cache [subcommand]サブコマンド
Section titled “サブコマンド”分析キャッシュをクリア:
similarity-go cache clearキャッシュ情報を表示:
similarity-go cache info古いキャッシュエントリを削除:
similarity-go cache prune [--days int]doctor
Section titled “doctor”一般的な問題を診断し、環境を検証します。
similarity-go doctorこのコマンドは以下をチェックします:
- Goのインストールとバージョン
- プロジェクト構造
- 設定の有効性
- ファイルの権限
- 使用可能なメモリとディスク容量
version
Section titled “version”バージョン情報を表示:
similarity-go version [--format string]形式をサポート: text(デフォルト)、json、yaml
similarity-goは標準的な終了コードを使用します:
| コード | 意味 |
|---|---|
0 | 成功 |
1 | 一般的なエラー |
2 | 設定エラー |
3 | 分析エラー |
4 | ファイルシステムエラー |