
sonar v0.4.1
localhost ポートで待受中のサービスを調査・管理するための CLI ツール
Sonarはlocalhostでリッスンしているすべてのものを表示し、整理します。各ポートはグループ(通常は起動元のリポジトリ)に属し、そのグループ内では名前付きのサービスに属します。sonar startで開発サーバーを起動すると、プロジェクト全体が1つのものとして扱えるようになり、ツリー表示、待機、ログの追跡、単一コマンドでの停止が可能になります。Dockerコンテナ、Composeプロジェクト、手動で起動したプロセスも、設定なしで自動的に検出されます。```
$ sonar list --tree
my-app (3 ports, running) ~/code/my-app
├─ 5432 db postgres:17 http://localhost:5432
├─ 5173 frontend vite (v5.4) http://localhost:5173
└─ 8000 api uvicorn app:app http://localhost:8000
ungrouped (1 port)
└─ 3000 next-server (v16.1.6) http://localhost:3000
## Install
### Homebrew (macOS / Linux)```sh
brew install raskrebs/sonar/sonar
Homebrew 6は、タップを一度信頼するまで、サードパーティのタップからのformulaを拒否します(Error: Refusing to load formula raskrebs/sonar/sonar from untrusted tap):```sh
brew trust raskrebs/sonar
### インストールスクリプト```sh
curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.sh | bash
最新のバイナリを~/.local/binにダウンロードし、必要に応じてPATHに追加します。ターミナルを再起動するか、source ~/.zshrcを実行してください。
Windows(PowerShell)の場合:```powershell irm https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.ps1 | iex
カスタムインストール場所:```sh
curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.sh | SONAR_INSTALL_DIR=/usr/local/bin bash
特定のバージョンをインストールする:```sh curl -sfL https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.sh | SONAR_VERSION=vX.Y.Z bash
The `-h` flag displays the help menu, which lists all available options and their descriptions. This is useful for quickly understanding the tool's capabilities without needing to consult external documentation.```powershell
$env:SONAR_VERSION="vX.Y.Z"; irm https://raw.githubusercontent.com/raskrebs/sonar/main/scripts/install.ps1 | iex
Goの使用```sh
go install github.com/raskrebs/sonar@latest
シェル補完(タブ補完でポート番号を入力):```sh
sonar completion zsh > "${fpath[1]}/_sonar" # zsh
sonar completion bash > /etc/bash_completion.d/sonar # bash
sonar completion fish | source # fish
60秒
dev.sh 中的命令前面加上 sonar start:```sh
#!/usr/bin/env bash
sonar start --name db --port 5432 -- docker compose up db &
sonar start --name api --port 8000 -- uv run uvicorn app:app &
sonar start --name frontend --port 5173 -- npm run dev &
wait
グループ名はリポジトリから取得されるため、他に設定する必要はありません。
別のターミナルで:```sh
sonar list --tree
The -f flag is used to specify the file containing the list of subdomains. The -o flag is used to specify the output file where the results will be saved. The -t flag is used to specify the number of threads to use for concurrent requests. The -p flag is used to specify the protocol to use (http or https). The -r flag is used to specify the number of retries for failed requests. The -w flag is used to specify the number of workers for concurrent processing. The -v flag is used to enable verbose output. The -d flag is used to specify the delay between requests. The -c flag is used to specify the cookie to include in requests. The -H flag is used to specify custom headers to include in requests. The -T flag is used to specify the timeout for requests. The -k flag is used to skip SSL certificate verification. The -x flag is used to specify a proxy for requests. The -a flag is used to specify a user agent for requests. The -e flag is used to specify an extension to filter results by. The -s flag is used to specify a status code to filter results by. The -m flag is used to specify a method to use for requests. The -b flag is used to specify a body to include in requests. The -q flag is used to specify a query to include in requests. The -n flag is used to specify a number of results to return. The -i flag is used to specify an input file containing URLs to test. The -u flag is used to specify a URL to test. The -l flag is used to specify a list of URLs to test. The -g flag is used to specify a grep pattern to filter results by. The -j flag is used to specify a JSON output format. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy for requests. The -y flag is used to specify a YAML output format. The -z flag is used to specify a zip output format. The -A flag is used to specify an API key for authentication. The -B flag is used to specify a bearer token for authentication. The -C flag is used to specify a client certificate for authentication. The -D flag is used to specify a client key for authentication. The -E flag is used to specify a CA certificate for authentication. The -F flag is used to specify a form data to include in requests. The -G flag is used to specify a graph to use for analysis. The -H flag is used to specify custom headers to include in requests. The -I flag is used to specify an input format for the data. The -J flag is used to specify a JSON input format. The -K flag is used to specify a key to use for encryption. The -L flag is used to specify a log file to write to. The -M flag is used to specify a maximum number of results to return. The -N flag is used to specify a minimum number of results to return. The -O flag is used to specify an output format for the results. The -P flag is used to specify a password for authentication. The -Q flag is used to specify a query to use for search. The -R flag is used to specify a rate limit for requests. The -S flag is used to specify a source to use for data. The -T flag is used to specify a timeout for requests. The -U flag is used to specify a username for authentication. The -V flag is used to specify a version to use for the tool. The -W flag is used to specify a wordlist to use for brute force. The -X flag is used to specify a method to use for requests. The -Y flag is used to specify a YAML output format. The -Z flag is used to specify a zip output format. The -a flag is used to specify a user agent for requests. The -b flag is used to specify a body to include in requests. The -c flag is used to specify a cookie to include in requests. The -d flag is used to specify a delay between requests. The -e flag is used to specify an extension to filter results by. The -f flag is used to specify a file containing a list of subdomains. The -g flag is used to specify a grep pattern to filter results by. The -h flag is used to display help information. The -i flag is used to specify an input file containing URLs to test. The -j flag is used to specify a JSON output format. The -k flag is used to skip SSL certificate verification. The -l flag is used to specify a list of URLs to test. The -m flag is used to specify a method to use for requests. The -n flag is used to specify a number of results to return. The -o flag is used to specify an output file where the results will be saved. The -p flag is used to specify a protocol to use (http or https). The -q flag is used to specify a query to include in requests. The -r flag is used to specify a number of retries for failed requests. The -s flag is used to specify a status code to filter results by. The -t flag is used to specify a number of threads to use for concurrent requests. The -u flag is used to specify a URL to test. The -v flag is used to enable verbose output. The -w flag is used to specify a number of workers for concurrent processing. The -x flag is used to specify a proxy```
my-app (3 ports, running) ~/code/my-app
├─ 5432 db postgres:17 http://localhost:5432
├─ 5173 frontend vite (v5.4) http://localhost:5173
└─ 8000 api uvicorn app:app http://localhost:8000
そして完了したら、プロジェクト全体(サーバー、ウォッチャー、ワーカー)を停止します。```sh
sonar kill -g my-app
以下は、提供されたチャンクの日本語訳です。
以下に # check とマークされた例は、CI の実行ごとに scripts/readme-check.sh によって新しいビルドに対して実行されます。
コマンド
`sonar list````sh
sonar list sonar list --tree sonar list --group my-app sonar list --json
check
The `-p` option is used to specify the port number. The `-s` option is used to specify the source IP address. The `-d` option is used to specify the destination IP address. The `-t` option is used to specify the target IP address. The `-f` option is used to specify the file containing the list of target IP addresses. The `-o` option is used to specify the output file. The `-v` option is used to enable verbose mode. The `-h` option is used to display the help message.```sh
sonar list --stats # CPU, memory, threads, uptime, state
sonar list --health # HTTP health checks
sonar list --filter docker # only Docker ports
sonar list --sort name # port | pid | name | type
sonar list -a # include desktop apps
sonar list -c port,process,group,cpu,mem
sonar list --host user@server # scan a remote machine over SSH
デフォルトの列は port、process、group、container、image、
containerport、url で、process にはポートに付けた名前(sonar rename)、
サービス名、検出された内容が表示されます。
利用可能な列: port、process、pid、type、url、group、cpu、
mem、threads、uptime、state、connections、health、latency、
container、image、containerport、compose、project、user、bind、
ip。
たまたま待ち受けているデスクトップアプリやシステムサービス(Figma、Discord、
Spotify、ControlCenter、macOS の .app バンドル、/System/Library/ のデーモン)は、
-a を指定しない限り非表示になります。
sonar start
グループ内の名前付きサービスとしてコマンドを実行します:```sh sonar start -- npm run dev sonar start --group my-app --name frontend -- npm run dev sonar start --port 5173 -- npm run dev # expected port, before it binds sonar start --detach --name api -- uv run uvicorn app:app sonar start --list
渡す必要は何もありません:
- **グループ** — `--group`、それ以外は最も近い `.sonar.yaml` 内の `name`、それ以外は
git ルートのディレクトリ名(worktree は `repo@worktree` になる)、それ以外は
現在のディレクトリの名前。
- **名前** — `--name`、それ以外は `cmd` が一致する `.sonar.yaml` のサービス、それ以外は
コマンドから推測(`npm run dev` → `dev`、`uv run api` → `api`、
`python -m uvicorn` → `uvicorn`、`./dev.sh` → `dev.sh`)。
- **ポート** — `--port` はヒントであり、バインドではありません:ポートが実際に
リッスンするまで実行は `starting` として表示され、デーモンはこれを使って
プロセスをポートに一致させます。
子プロセスは stdin、stdout、stderr、cwd、環境変数に加えて
`SONAR_GROUP`、`SONAR_NAME`、`SONAR_RUN_ID` を継承します。独自のプロセスグループを
持つため、`sonar kill` はツリー全体を終了させます — ウォッチャーやワーカーを
含む開発サーバーも同様です。Ctrl+C は転送され、sonar は子プロセスの終了コードで
終了します。
`--detach` は即座に戻り、出力を
`~/.config/sonar/logs/<group>/<name>.log` に書き込みます。`--list` は sonar が
起動したものを表示します(機械可読形式は `--json`):```sh
sonar start --list
sonar start --detach --name demo --port 8123 -- sleep 5
sonar start --list --json
# check
.sonar.yaml
プロジェクトは、リポジトリのルートにある .sonar.yaml で自身とそのサービスを定義します。これは任意です — sonar はこれがなくても git ルートでグループ化します — そしてコミットされることを意図しています:```yaml
name: my-app
services:
- name: db cmd: docker compose up db port: 5432 health: / description: Postgres 17 icon: database color: "#4f8cc9"
- name: api cmd: uv run uvicorn app:app --port 8000 cwd: backend port: 8000 health: /healthz depends_on: [db]
- name: frontend cmd: npm run dev port: 5173 depends_on: [api] ports: [9229] # ports that belong to this project without a service
- `name` — グループ名。スラッシュや空白は使用できません。
- `cmd`、`cwd`、`port` — `sonar up` がサービスを起動する方法です。`cwd` はファイルからの相対パスで、そのディレクトリの外には出られません。
- `health` — デーモンがサービス稼働中にポーリングするHTTPパスで、サービスが*実行中*でもまだ*正常*ではない場合があります。`ok`、`fail`、`unknown` を報告し、失敗の理由も示します。
- `description`、`icon`、`color` — デスクトップアプリ用の自由形式のメタデータです。sonar がこれらを推測することはありません。
- `depends_on` — 起動順序です。ファイルに存在しないサービスや循環参照を指定するとエラーになります。無効なファイルは一度だけ報告され、スキャンを停止することはありません。
`.sonar.yml` はその綴りで記述されている場合に読み取られます。`sonar init` は常に `.sonar.yaml` を書き込みます。デーモンは認識しているプロジェクトを監視し、再起動なしでファイルへの編集を検出します。sonar が行うすべての編集(デスクトップアプリから、`sonar groups add`、`rename`、`remove` から、エージェントから)はデーモンを経由し、デーモンは自身の構文ツリーからファイルを再レンダリングするため、コメント、キーの順序、レイアウトは、サービスを追加、名前変更、削除する編集でも、メタデータの変更でも維持されます。唯一の例外は、末尾のコメントを揃える余分なスペース(`cmd: x # note`)が1つに縮小されることです。これはYAMLライブラリがコメントは保持するものの、その列位置は保持しないためです。
### `sonar up````sh
sonar up # the .sonar.yaml at or above this directory
sonar up my-app # a group by name
sonar up --only api,frontend
sonar up --json
.sonar.yaml が宣言するグループのすべてのサービスを、depends_on の順序で起動します。
依存関係が宣言するポートを待ってからサービスが開始され、すでにリッスンしているものはスキップされます。各サービスは独自のプロセスグループ内でデタッチして実行され、その出力は ~/.config/sonar/logs/<group>/<service>.log に保存されます。```
✓ db pid 41022 ~/.config/sonar/logs/my-app/db.log
- api already running ✓ frontend pid 41108 ~/.config/sonar/logs/my-app/frontend.log
2 started, 1 already running
起動に失敗したサービスは、それ自体が1行で報告され、他の何が起きていようとコマンドは非ゼロの終了コードで終了します。再度すべて停止するには、`sonar kill -g my-app` を使用します。`sonar up` はデーモンを必要とし、まだ実行されていない場合は起動します。
### `sonar groups` と `sonar init````sh
sonar init --dry-run
sonar init --service api:8000:/healthz --service web:5173
sonar groups
sonar groups --json
group=$(basename "$PWD") # sonar init names the group after the directory
sonar groups add "$group" worker --port 9000 --cmd 'uv run worker' --depends-on api
sonar groups rename "$group" worker jobs
sonar groups remove "$group" jobs
# check
sonar groups は、sonar が見ることができるすべてのグループと、各名前の由来を一覧表示します:
manual (sonar assign で固定したもの)、start (sonar start の実行)、
file (.sonar.yaml) または auto (git ルートまたは Compose プロジェクト)。
sonar groups <name> は、1つのグループのポートとサービス、および
宣言されているが実行されていないサービスを表示します。
sonar init は、現在リッスンしているものから git ルートに .sonar.yaml を書き込みます —
デスクトップアプリと 1024 未満のポートは除外されます。--force なしでは上書きを拒否し、
--dry-run は書き込む代わりにファイルを出力します。
--merge は拒否する代わりに既存のファイルに追記し、
--service name:port[:health] — 繰り返し可能 — は、見つかったものではなく指定したサービスを書き込み、
保持したポートに対して推測したコマンドを維持します。--force と --merge は相互に排他的です。
sonar groups add <group> <name> --port N は、そのグループの .sonar.yaml にサービスを追記し、
残りの設定には --cmd、--cwd、--health、--description、--icon、
--color と繰り返し可能な --depends-on を使用します。sonar groups rename <group> <old> <new> は、ファイル内のすべての場所で名前を変更し、
depends_on 参照も含みます。sonar groups remove <group> <name> は、1つを削除し、
それを参照していたすべての depends_on からも削除します。3つすべては、ファイルが無効になる編集
— 重複する名前、別のサービスがすでに主張しているポート、存在しないサービス — を拒否し、
編集全体が問題ないと確認されるまで1バイトも書き込みません。
書き込みを行うのはデーモンであり、そのため編集が CLI、デスクトップアプリ、またはエージェントの
いずれから来た場合でも、ファイルはコメントとキーの順序がそのままの状態で返されます。
sonar groups add、rename、remove はデーモンを必要とし、まだ実行されていない場合は起動します。
3つの名前はサブコマンドであるため、実際に add という名前のグループは sonar groups --json で読み取ります。
`sonar kill````sh
sonar kill 3000 # SIGTERM, then SIGKILL after 5s sonar kill 3000 5432 -f # SIGKILL both straight away sonar kill 3000 --tree # the listener and everything below it sonar kill --pid 12345 --tree # by process id sonar kill -g my-app # a whole group, confirms unless -y sonar kill --all --filter docker -y # every container publishing a port sonar kill --all --project my-app # one Compose project sonar kill 3000 --ip 127.0.0.1 # one bind address of several sonar kill --all --dry-run --json # the plan for the whole machine
`--dry-run` は任意のセレクタを受け取り、何も変更しません。kill が実行するアクションを子プロセスから順に表示するだけで、すべてのプロセスを実行したままにします。エンドツーエンドで、自分自身のリスナーに対して実行する場合:```sh
sonar start --detach --name plan --port 8231 -- sonar map 3000 8231
sonar wait 8231
sonar kill 8231 --dry-run --json # the plan; the mapping keeps running
sonar kill 8231 -y # and now for real
# check
位置引数はポートとして読み取られ、その番号で待ち受けているものが何もない場合にのみpidとして読み取られます。-gは、解決されたグループ、レガシーの実行タグまたはID、およびComposeプロジェクトを大文字小文字を区別せずに照合します。
SIGTERMを無視するプロセスは、--grace(5秒)後もポートが待ち受け状態のままである場合にSIGKILLが送信されます。--no-escalateはそれを無効にします。子プロセスは親プロセスの前にシグナルが送信されるため、プロセスツリーは順番に終了します。Dockerコンテナはdocker stopで停止され、シグナルは送信されません。sonar startによって起動されたリスナーは、常にそのプロセスグループと一緒に停止されます。
--jsonはプロセスごとに1行を出力します:
{port, bind_address, pid, name, method, ok, error}。ここでmethodはsigterm、sigkill、docker_stop、map_stop、またはnoneです。空のスイープは0で終了し、不明なグループは1で終了します。
`sonar map````sh
sonar map 6873 3002 # also serve the service on 6873 from port 3002
TCPプロキシをフォアグラウンドで実行し、停止するまで継続します。`sonar kill` は、停止したマッピングを `map_stop` として報告します。
### `sonar rename`、`sonar assign`、`sonar history````sh
sonar rename 3000 storefront # a name of your own, survives restarts
sonar rename 3000 --clear
sonar assign 3000 my-app # pin a port to a group by hand
sonar assign 3000 --clear
sonar history # everything that came up, went down, restarted
sonar history 3000 --since 24h --limit 20
The --no-verify flag is used to skip the verification of the certificate, which is useful in testing environments where the certificate is self-signed or not trusted.```sh
sonar history --since 1h
sonar history --json
check
名前とピンはsonarのデータベースに保存され、ポートについて最も具体的に判明している情報(実行(`run:<group>/<name>`)、コンテナ(`docker:<project>/<service>`)、作業ディレクトリ、そして最後にポート番号)をキーとして格納されます。名前を変更した開発サーバーは再起動後もその名前を維持し、ポート3000だけにピン留めされた名前は、そこに応答する任意のものに適用されます。これらの3つのコマンドはデーモンを必要とし、実行中でない場合は起動します。
### ポートの読み取り```sh
sonar info 3000 # command, user, bind, stats, health
sonar logs 3000 # tail; docker logs for containers
sonar wait 5432 3000 --timeout 60s # block until ready
sonar wait 5432 --http=/health # wait for HTTP 200-399, not just TCP
sonar next 3000 # first free port from 3000
sonar next 3000-3100 -n 3 # three consecutive free ports
sonar graph # who is connected to whom
sonar graph --dot # Graphviz
sonar open 3000 # open in the browser
sonar attach 3000 # shell into the container, or TCP
sonar watch # live view
sonar watch --stats --notify
The -p option allows you to specify a custom port for the reverse shell. The -h option displays the help menu.```sh
sonar next 3000
sonar next 3000-3100 -n 3 --json
sonar graph --json
sonar info --help
check
`sonar wait` は `0`(準備完了)、`1`(タイムアウト)、または `2`(中断)で終了します。つまり、何かを起動してからテストするまでの間に挟むのに最適なコマンドです。```sh
docker compose up -d
sonar wait 5432 3000 --timeout 60s && npm run migrate && npm run test
デーモンまたは直接スキャン。 すべての読み取りコマンドは、デーモンが実行中かどうかを確認します。デーモンが実行中であれば、すでに答えを持っており、lsof をフォークする必要がないためです。実行中でない場合は直接スキャンし、その旨をstderrに1件のメモとして出力します。sonar kill も同じルールに従います。到達可能なデーモンがキルを実行するため、即座に再スキャンし、次の回答 — およびポート履歴 — はポートが消えたことをすでに認識しています。読み取りもキルも、背後でデーモンを起動することはありません。--no-daemon は直接スキャンを黙って強制し、任意のコマンドで機能します。```sh
sonar list --no-daemon --json
check
### `sonar host````sh
sonar host # cpu, load, memory and disk of the machine sonar watches
sonar host --json
I need the actual content of chunk 67 to translate it. Please provide the Markdown text you want translated.```sh sonar host
check
The daemon measures its own machine on the scan cadence and publishes it as the
`localhost` row of the snapshot's `hosts` collection: os and kernel, uptime, cpu
percent, load average, memory and the disk holding `/`. CPU percent is the work
done between two scans, so it is null until the daemon has scanned twice; a
figure a platform cannot produce — the load average on Windows, which has none —
is null rather than zero. Every host registered with `sonar remote add` joins
the same table with its own load. The command needs a running daemon: it is the
daemon that holds the previous sample a percentage is measured against.
### `sonar remote install````sh
sonar remote install [email protected] # same version as this sonar
sonar remote install hetzner --version v0.6.0 # a Host from ~/.ssh/config
sonar remote install deploy@box --no-service # the binary, no daemon
sonar remote は、既に SSH 接続できるホストに sonar を配置し、そのホスト上でデーモンを起動します。リリースアーカイブはリモートホスト上でダウンロードされ、チェックサムが検証されます(このマシンから何もコピーされません)。バイナリは ~/.local/bin/sonar に配置されるため、root 権限は一切不要です。デーモンは、ホストに systemd ユーザーユニットがある場合(~/.config/systemd/user/sonar.service)はそれとして実行され、ない場合はデタッチされて実行されます。ユーザーセッションがログアウト時に終了し、デーモンも一緒に終了してしまう場合は、loginctl enable-linger がアドバイスとして表示されます。
インストールされるバージョンは、実行した sonar 自身のバージョンであるため、両端は同じプロトコルで通信します。再度実行すると、その場でアップグレードされ、デーモンが再起動されます。これにより、インストールとアップデートが同じコマンドになります。
接続先は ssh にそのまま渡されます。~/.ssh/config の Host エイリアスは機能し、そこで設定された ProxyJump、IdentityFile、Port も同様に機能します。--identity と --ssh-arg は、設定ファイルではカバーされないフラグ用に用意されています。
`sonar remote````sh
sonar remote add [email protected] # name taken from the target sonar remote add hetzner [email protected] # or given sonar remote list # status, latency, version, load sonar remote remove hetzner
sonar list --host hetzner # that host's ports sonar list --host "*" # every host, with a HOST column sonar info 3000 --host hetzner
登録済みホストは同じデーモンを実行し、このマシン上のデーモンはそのホストへのSSH接続を1本維持します — `ssh <target> sonar daemon stdio` — そして、それが報告する内容を、すべてのクライアントがすでに読み取っている状態に多重化します。どこにも新しいリスナーは存在しません。リモートデーモンのソケットはSSHユーザーにのみプライベートなままであり、クライアント自身がSSHを話すことはありません。
すべての行には、それが由来するホストが含まれるようになりました。ローカルの行は `localhost` と表示され、これまで持っていたキーを保持するため、今日sonarを読み取るものは何も変わりません。リモートの行は登録名を表示し、`<host>/<port>:<bind>` でキー付けされるため、2台のマシン上のポート3000が2つの行になることができます。サブスクライバーは、より多くを要求しない限り (`state.subscribe {"hosts": ["*"]}`)、localhostのみを表示します。
ターゲットはそのまま `ssh` に渡されるため、`~/.ssh/config` のエイリアス、`ProxyJump`、およびIDはすべて適用されます。`--ssh-arg`、`--identity`、`--port` は、configがカバーしないものを補います。sonarはパスワードもキーも保存しません。消えたホストは、デーモンが再試行している間、その行とステータスを保持し、登録されたままである限り、1秒から30秒までバックオフします。
`--host` はまた、sonarが何も知らない素の `user@host` も受け付けます。その場合、エージェントレスな `ssh` + `ss`/`lsof` スキャンにフォールバックし、`sonar remote install` へのヒントを出力します。
#### 別のマシンでの操作
すべての書き込みも `--host` を受け付け、そこでこのマシン上とまったく同じことを行います。```sh
sonar kill 3000 --host hetzner # stop a port on that machine
sonar kill -g api --host hetzner # a whole group of its services
sonar kill-all --filter docker --host hetzner # its containers
sonar up api --host hetzner # start a group from its .sonar.yaml
sonar logs 3000 --host hetzner # tail its output here
sonar rename 3000 storefront --host hetzner # its name, in its database
sonar assign 3000 storefront --host hetzner
ローカルデーモンは、そのホストのブリッジを介して呼び出しを転送し、リモートデーモンが応答した内容を、ローカル呼び出しが返すのと同じエンベロープで返します。すべての結果行は、それが発生したホストを示し、killのaffectedは、ストリームがそれらの行に使用する<host>/<port>:<bind>キーを保持します。ストリーミングコマンドはストリーミングされます。sonar up --hostは、遠隔側が各サービスを起動するたびにそれを出力し、Ctrl-Cはこのターミナルだけでなくリモートの作業も停止します。
行のキーはすでにそのホストを名指ししているため、クライアントはそれをそのままセレクタとして渡せます。{"key": "hetzner/3000:127.0.0.1"}は、ホストを含めてセレクタ全体です。1回の呼び出しは1台のマシンに作用します。2つを指定すると、各マシンでkillが半分ずつ実行されるのではなく、エラーになります。
2つのことはローカルに留まります。sonar attachはこのターミナルをプロセスの前に置くため、--hostを拒否し、sshで接続してそこでアタッチするよう指示します。また、エージェントセッションはこのデーモンが保持する状態であるため、sonar kill --sessionにはリモート形式がありません。それ以外のすべては、ここでデーモンが実行されている必要があります。ここが他のマシンへの接続が存在する場所であり、代わりにこのマシンを静かにスキャンするのではなく、その旨を伝えます。
sonar up --hostはグループの指定を必要とします。作業ディレクトリにある.sonar.yamlはこのマシン上のパスであり、ファイルを読み取ってサービスを起動するのはリモートデーモンです。
デーモン
1つのバックグラウンドプロセスがポートをスキャンし、グループを解決し、ヘルスをポーリングし、データベースを維持し、変更を購読者(CLI、デスクトップアプリ、エディタ)にストリーミングします。```sh sonar serve # in the foreground sonar serve --detach # in the background sonar daemon status # pid, uptime, subscribers, scans, intervals sonar daemon path # the socket it listens on sonar daemon log -n 50 -f # what it is doing sonar daemon restart sonar daemon stop
I need the actual content of chunk 77 to translate it. Please provide the Markdown text you want translated.```sh
sonar daemon path
sonar daemon status --json
sonar daemon log -n 5
# check
| 項目 | 場所 |
|---|---|
| ソケット | $XDG_RUNTIME_DIR/sonar/daemon.sock、それ以外は ~/.config/sonar/daemon.sock。Windows では \\.\pipe\sonar |
| データベース | ~/.config/sonar/sonar.db(SONAR_DB で上書き可能) |
| デーモンログ | ~/.config/sonar/daemon.log、5 MiB でローテーション、3 つ保持 |
| 実行ログ | ~/.config/sonar/logs/<group>/<service>.log |
| 設定 | ~/.config/sonar/config.yaml |
SONAR_SOCKET は、デーモンとそのクライアントの両方で、どこでもソケットパスを上書きします。これは、2 つ目の分離インスタンスに役立ちます。ソケットは 0700 ディレクトリ内に 0600 で作成されるため、あなただけが通信できます。同時に実行されるデーモンは 1 つだけです。クラッシュによって残されたソケットは、次回起動時にクリーンアップされます。
デーモンは、クライアントとサブスクライバーが 30 分間ないと、自動的に停止します。これを変更するには、設定ファイルで daemon.idle_timeout を設定します。0 にすると実行し続けます。
何かが変化している間は、ポートは 2 秒ごとにスキャンされます。変化がない場合、スキャナーはサブスクライバーが接続されているときは 5 秒、接続されていないときは 10 秒に速度を落とします。daemon.scan_interval はその基準を移動します(最小 1 秒)。両方の上限もそれに合わせてスケールするため、5s に上げると、曲線を古い上限に固定するのではなく、12.5 秒と 25 秒に後退します。daemon.stats_interval は、何かがサブスクライブされている間に cpu、メモリ、ホスト負荷ストリップが更新される、別の周期です。どちらもデーモン起動時に読み取られます。ファイルを編集してから、sonar daemon restart を実行してください。sonar daemon status は、スキャナーが現在使用している適応間隔の横に、有効な値(scan base、stats tick)を表示します。
include: ["health"] を要求するサブスクライバーは、デーモンに、health: パスを宣言するサービスだけでなく、すべてのリッスンポートをより遅い周期でプローブさせます。これらのサービスは毎回ポーリングされ、health が要求されたかどうかに関係なく、すべてのサブスクライバーに届きます。
設定
~/.config/sonar/config.yaml はオプションです。フラグが常に優先されます。```sh
sonar config path
sonar config init
check
The `-h` flag displays the help menu, which includes all available options and their descriptions. This is useful for quickly understanding the tool's capabilities without needing to consult external documentation.```sh
sonar config edit # open it in $EDITOR
--no-ignore フラグを指定すると、gitleaks は .gitignore ファイルを尊重しません。これは、.gitignore で除外されているファイルであっても、すべてのファイルをスキャンしたい場合に便利です。
gitleaks detect --no-ignore
--no-banner フラグを指定すると、gitleaks は起動時にバナーを表示しません。これは、gitleaks をスクリプトやCIパイプラインで使用する場合に便利です。
gitleaks detect --no-banner
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--verbose フラグを指定すると、gitleaks は検出されたシークレットに関する詳細情報を出力します。これは、シークレットが検出された場所を理解するのに役立ちます。
gitleaks detect --verbose
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラグを指定すると、gitleaks のレポートを保存するファイルパスを設定できます。これは、gitleaks のレポートを後で分析する場合に便利です。
gitleaks detect --report-path report.json
--source フラグを指定すると、gitleaks がスキャンするソースディレクトリを設定できます。これは、gitleaks を特定のディレクトリで実行する場合に便利です。
gitleaks detect --source /path/to/directory
--config フラグを指定すると、gitleaks が使用する設定ファイルを指定できます。これは、gitleaks の動作をカスタマイズする場合に便利です。
gitleaks detect --config config.toml
--baseline フラグを指定すると、gitleaks はベースラインと比較して、新しく検出されたシークレットのみを報告します。これは、既知のシークレットを再報告せずに、新しいシークレットのみに焦点を当てたい場合に便利です。
gitleaks detect --baseline baseline.json
--log-opts フラグを指定すると、gitleaks はgitログのオプションを指定できます。これは、特定のコミットやブランチのみをスキャンしたい場合に便利です。
gitleaks detect --log-opts="--all"
--commit フラグを指定すると、gitleaks は特定のコミットをスキャンします。これは、特定のコミットで導入されたシークレットを調査する場合に便利です。
gitleaks detect --commit <commit-hash>
--depth フラグを指定すると、gitleaks は指定された深さまでのコミット履歴をスキャンします。これは、リポジトリの履歴が長い場合にスキャン時間を短縮するのに便利です。
gitleaks detect --depth 5
--branch フラグを指定すると、gitleaks は特定のブランチをスキャンします。これは、特定のブランチのみをスキャンしたい場合に便利です。
gitleaks detect --branch main
--pipe フラグを指定すると、gitleaks は標準入力からデータを読み取ります。これは、gitleaks を他のツールと組み合わせて使用する場合に便利です。
cat file.txt | gitleaks detect --pipe
--follow-symlinks フラグを指定すると、gitleaks はシンボリックリンクを辿ります。これは、シンボリックリンクを含むディレクトリをスキャンする場合に便利です。
gitleaks detect --follow-symlinks
--max-decode-depth フラグを指定すると、gitleaks はファイルのデコードを試みる最大深度を設定できます。これは、エンコードされたファイルをスキャンする場合に便利です。
gitleaks detect --max-decode-depth 3
--max-target-size フラグを指定すると、gitleaks はスキャンするファイルの最大サイズを設定できます。これは、大きなファイルのスキャンをスキップする場合に便利です。
gitleaks detect --max-target-size 1000000
--redact フラグを指定すると、gitleaks はログ内のシークレットを難読化します。これは、gitleaks のログを他の人と共有する場合に便利です。
gitleaks detect --redact
--exit-code フラグを指定すると、gitleaks はシークレットが検出された場合に指定された終了コードを返します。これは、gitleaks をCIパイプラインで使用する場合に便利です。
gitleaks detect --exit-code 1
--log-level フラグを指定すると、gitleaks のログレベルを設定できます。これは、gitleaks のログ出力をデバッグする場合に便利です。
gitleaks detect --log-level debug
--report-format フラグを指定すると、gitleaks のレポート形式を設定できます。これは、gitleaks のレポートを他のツールで使用する場合に便利です。
gitleaks detect --report-format json
--report-path フラ```yaml
list:
columns: [port, process, group, container, image, containerport, url]
sort: port # port | pid | name | type
filter: "" # docker | user | system | "" (all)
all: false # include desktop apps by default
daemon:
idle_timeout: 30m # 0 keeps the daemon running
log_level: info # debug | info | warn | error
scan_interval: 2s # base port-scan cadence, minimum 1s
stats_interval: 1s # cpu/memory refresh while subscribed, minimum 250ms
color: true
services: # label custom/unknown ports
9000: php-fpm
5050: my-dashboard
無効な値は警告とともに無視され、sonar はデフォルト値で続行します。
設定キーを持たない環境変数の上書き: `SONAR_DB`、`SONAR_SOCKET`、
`SONAR_NO_HINTS=1` は以下の移行通知を抑制し、
`SONAR_NO_AUTOSTART=1` は sonar クライアントが、見つからなかったデーモンを起動するのを止めます — ビルドがプロセスを残してはならない CI で役立ちます。
sonar 自身のテストスイートは、すべてのテストバイナリに `SONAR_NO_AUTOSTART=1` を設定し、
実行後に、それを生き延びたデーモンを探します。そのゲートは、実行のプライベート一時ルートから起動された `serve` のみを対象とするため、
1台のマシンで並行して実行される2つのスイートは、互いのデーモンに干渉しません。
`SONAR_TESTENV_GATE_ALL=1` は、それを一時ディレクトリ配下のすべての `sonar serve` にまで広げます。これは、マシン全体を所有する CI ランナーが求めるものです。
### エージェント: MCP、スキル、フック```sh
sonar install mcp --claude-code # merge into <git root>/.mcp.json
sonar install mcp --cursor --scope user # ~/.cursor/mcp.json
sonar install mcp --codex # codex mcp add
sonar install skills --claude-code # the bundled sonar skill
sonar install hooks --claude-code # optional, see below
The -h flag displays the help menu, which includes all available options and their descriptions.```sh
sonar install mcp --generic --print
sonar install skills --print
sonar install hooks --print
check
`install mcp` は `{"command": "sonar", "args": ["mcp"]}` を登録し、ファイル内の他のサーバーやキーには一切触れません。2回実行しても何も変わらず、`--uninstall` は sonar が書き込んだものだけを正確に削除します。
`sonar mcp` はそのサーバーです。バイナリに組み込まれた stdio MCP サーバーで、エージェントにデーモンから見たマシンの状態を提供します。`list_ports` と `inspect_port` で読み取り、`wait_for_port` で待機し、`next_free_port` と `claim_port` でポートを選んで予約し、エージェントのその他の質問には `tail_logs`、`health_check`、`dependency_graph`、`port_history`、`list_sessions` で答えます。アクションとリソースは次に続きます。実行中のデーモンがなければ起動し、デーモンが消えた場合は自動的に再接続します。ログは stderr に出力されます。stdout はプロトコルを運ぶためです。
`install skills` はバンドルされたスキルを書き込みます。これはエージェントに `sonar start --` でサーバーを起動し、スリープする代わりに `sonar wait` を使い、起動したものをクリーンアップすることを教えます。`install hooks` は2つの Claude Code フックを追加します。1つは `SONAR_SESSION` をエクスポートして、セッションが起動するすべてのものをそのセッションに帰属させ、もう1つは素の開発サーバーが起動しようとしているときに `sonar start --` を提案します(助言するだけで、ブロックはしません)。どちらも `--scope project|user`、`--print`、`--uninstall` を受け付けます。
### `sonar doctor`
sonar が依存するすべてをチェックし、問題があればどう対処すべきかを示す1つのコマンドです。デスクトップアプリがオンボーディング中に実行するものであり、何かがおかしいときに自分で実行するものです。```sh
sonar doctor # the table, and a one-line verdict
sonar doctor --json # {ok, checks, version, daemon_version}
sonar doctor --only db_ok,tray # just these
sonar doctor --only mcp_registered # a whole family
sonar doctor --project ~/code/api # a project other than the working directory
sonar doctor --fix --yes # apply the safe repairs, then check again
The -h flag displays the help menu, which includes all available options and their descriptions. This is useful for quickly understanding the tool's capabilities without needing to consult external documentation.```sh
check
sonar doctor --only daemon_reachable,daemon_protocol,socket_permissions,db_ok sonar doctor --json --only config_parses | grep -q '"status": "ok"' sonar doctor --only mcp_registered --project . > /dev/null
各チェックは `ok`、`warn`、`fail`、または `skip` を報告します。`skip` は確認する対象がなかったことを意味します — Cursor がインストールされていない、マシンに docker がない、ソケットが Windows 上の名前付きパイプであるなど — であり、決してあなたの評価に影響しません。終了コードは何かが **失敗** しない限り 0 なので、`sonar doctor` はセットアップスクリプトに組み込むのに適しています。
| check | 意味 |
| --- | --- |
| `cli_on_path` | 実行したバイナリが PATH が解決するものかどうか。そうでない場合は、影になっているインストール先を名前で示します |
| `cli_version_current` | 最新リリースと比較します。GitHub に 2 秒以内に到達できない場合は `skip` |
| `config_parses` | あなたの `config.yaml` が読み込めるかどうか。構文エラーは行、列、キャレット付きで報告されます |
| `config_dir_writable` | デーモンがログ、ロック、データベースを書き込めるかどうか |
| `daemon_reachable` | ソケット上で何かが待ち受けているかどうか |
| `daemon_version_matches` | 実行中のデーモンが、使用している CLI のバージョンと一致するかどうか |
| `daemon_protocol` | デーモンのプロトコルメジャーがこのビルドのものと一致するかどうか |
| `socket_permissions` | ソケットがあなたのものであり、0700 ディレクトリ内で 0600 であるかどうか(Windows では `skip`) |
| `db_ok` | データベースが開き、最新のスキーマであり、そのサイズがどれくらいか |
| `mcp_registered.{claude_code,cursor,codex}` | sonar の MCP サーバーがそのクライアントの設定にあるかどうか |
| `skills_installed` | 同梱のスキルがインストールされ、最新であるかどうか |
| `hooks_installed` | オプションの Claude Code フックがインストールされているかどうか |
| `project_config` | このプロジェクトに読み込み可能な `.sonar.yaml` があるかどうか |
| `docker` | docker CLI が存在し、そのデーモンが応答するかどうか |
| `desktop_installed` | デスクトップアプリがインストールされているかどうか、およびそのバージョン(Windows では `skip`) |
| `tray` | 置き換えられた macOS の `sonar-tray` バイナリがまだ残っているかどうか |
`--fix` は無人で実行しても安全な修復のみを適用し、`--yes` を渡さない限り最初に確認を求めます。解析できない `config.yaml` を `config.yaml.broken-<timestamp>` に移動して新しいテンプレートを書き込み(何も削除されることはありません)、実行されていないデーモンを再起動し、チェックが名前を挙げた `sonar install mcp|skills|hooks` コマンドを実行します — 作業ディレクトリから、あなたが入力するのと同じ方法で。そのため、修復対象のプロジェクト内で `--fix` を実行し、`--project` でそれを指すのではなく、その中で実行してください。その後、再度チェックします。触れないもの — PATH 上の影になるバイナリ、sonar が書き込んでいないスキル — は、`fix` 列の正確なコマンドとともにあなたに委ねられます。
デスクトップアプリは、シェルアウトする代わりに、デーモンの `daemon.doctor` メソッドを通じて同じチェックを呼び出します。デーモンは自身のプロセスから実行できるすべてを実行します。あなたが呼び出した CLI バイナリに関する 3 つのチェック(`cli_on_path`、`cli_version_current`、`daemon_version_matches`)は、その旨を示す詳細とともに `skip` として返されます。
### デスクトップアプリ
Sonar アプリは、ウィンドウ内とメニューバーまたはシステムトレイ内で同じ画面を表示します。サイドにグループ、ライブ統計とヘルス状態を備えたグリッド内のポート、ログ、および上記のすべての操作ボタンがあります。同じデーモンと通信するため、CLI とアプリが矛盾することはありません。`sonar install desktop` でインストールし、`sonar tray` で起動します。
アプリがリリースされるまで、macOS リリース tarball には引き続き古い `sonar-tray` メニューバーバイナリが含まれており、アプリがインストールされていない場合、`sonar tray` はそれにフォールバックします。
### `sonar install desktop`
アプリはベータ版であり、まだ Apple による署名がされていないため、CLI がインストールします。```sh
brew install raskrebs/sonar/sonar && sonar install desktop
以上がテスター一式の全体像です。Sonarは公開済みビルドのマニフェストを取得し、自分のマシンに合ったものを選び、そのsha256とサイズを検証してからインストールし、起動します。
これが、CLIがダウンロードを行う理由です。 macOSはブラウザが保存したものすべてに隔離(quarantine)属性を付与し、GatekeeperはAppleが公証(notarise)していない隔離されたアプリの起動を拒否します。このCLIがダウンロードしたファイルにはそもそも属性が付かないため、ベータ版はプロンプトも右クリックからの「開く」操作もなしに起動します。Sonarは隔離属性の設定も解除も行いません — 解除すべきものが存在しないからです。```sh sonar install desktop # install and launch sonar install desktop --no-launch # install only sonar install desktop --update # update; does nothing if current sonar install desktop --check # exit 1 when an update is available sonar install desktop --version 0.1.0-beta.1 sonar install desktop --force # ask a running Sonar to quit first sonar install desktop --json # for scripts
このコマンドは、何を行うかを伝えるためにネットワークを必要としません:```sh
sonar install desktop --help | grep -- '--no-launch'
# check
| macOS | /Applications/Sonar.app、または最初の場所が書き込み不可の場合(sonarは決してsudoを使いません)は~/Applications/Sonar.app |
| Linux | ~/.local/opt/sonar-desktop/Sonar.AppImage、さらに~/.local/share/applications内のメニューエントリと~/.local/bin内のsonar-desktopリンク |
| Windows | まだ対応していません — コマンドがその旨を表示して終了コード1で終了します |
--dirは両方のディレクトリを上書きします。Linuxでは、--debはリリースが.debを公開している場合、AppImageの代わりにapt/dpkg経由で.debをインストールします。
インストールはアトミックです。新しいアプリは古いものの隣に展開され、リネームで入れ替えられるため、ダウンロードが失敗しても動作中のアプリがなくなることはありません。アプリが開いている場合、sonarはその下にあるバンドルを置き換えることを拒否します。--forceはアプリに終了を要求し、最大10秒間待機します。
sonar install desktopはdesktop.installed_versionとdesktop.installed_pathを~/.config/sonar/config.yamlに記録します。これにより、sonar trayが--dirでインストールされたアプリを見つけ、sonar doctorのdesktop_installedチェックがバージョンを把握します。ビルドの取得元はdesktop.download_baseで、SONAR_DESKTOP_BASE、さらに--baseで上書きされます — 独自のビルドをテストするには、それらを自分のビルドに向けてください。
sonar relay
リレーはsonarのサーバー側です。1つの小さなHTTPサービスで、ホスト型アプリ用に私たちが運用し、ghcr.io/raskrebs/sonar-relayとして公開されているため、自分で実行することもできます。これはローカルデーモンとは関係ありません — sonar serveはポートを監視し、sonar relay serveはフリートに対してHTTPに応答します — また、同じバイナリに同梱されているのは、デプロイする成果物を1つにするためだけです。
現在は匿名の製品テレメトリを収集します。インストールごとに名前付きイベントのバッチで、パス、ホスト名、URLは含まれず、値がそれらに似ているだけでも入り口で拒否されます。これは、将来公開トンネルを終了し、サインインを保持するのと同じサービスです。```sh sonar relay serve --db ./relay.db --project-keys "$(openssl rand -hex 24)"
`docs/RELAY.md` には、ルート、正確な検証ルール、ストレージスキーマ、および Docker が動作する任意のボックスで Caddy の背後にワンコマンドでデプロイする方法が記載されています。
## 旧コマンドからの移行
グループ化前のコマンドは引き続き動作し、置き換え先を示す1行を stderr に出力します。これらは次のマイナーリリースで削除されます。`SONAR_NO_HINTS=1` で通知を抑制でき、`--json` 出力には通知が含まれることはありません。
| 旧 | 新 |
|---|---|
| `sonar run --tag X -- cmd` | `sonar start --group X -- cmd` |
| `sonar runs` | `sonar start --list` |
| `sonar list --tag X` | `sonar list --group X` |
| `sonar kill-all --filter docker` | `sonar kill --all --filter docker` |
| `sonar down X` | `sonar kill -g X` |
| `sonar profile create X` | `sonar init` |
| `sonar profile show X` | `sonar groups X` |
| `sonar up X` (プロファイルを確認していた) | `sonar up X` は現在グループを*開始*します |
| `sonar tray` (Swift メニューバーアプリ) | `sonar tray` はデスクトップアプリを起動します |
プロファイルはマシンごとのポートのスナップショットでした。`.sonar.yaml` はプロジェクトとともにコミットされます。変換してから、保持する前に必ず読んでください — 何も自動で書き込まれることはありません:```sh
sonar profile list
# check
The chunk you provided is empty. There is no content to translate. Please provide the actual Markdown content for chunk 103 of 107.```sh sonar profile export my-app > .sonar.yaml
プロファイルはサービスの起動方法を記録したことがないため、提案にはポート、名前、ヘルスチェックパスが含まれ、`cmd` は自分で入力します。
## トラブルシューティング
**デーモンに何か問題がある。** 問題を再現しながら `sonar daemon log -f` を実行し、`sonar daemon status` で PID、稼働時間、スキャン回数を確認します。`sonar daemon stop` で停止します。読み取り専用のコマンドは、デーモンなしでもすべて動作します。
**「daemon unavailable, using direct scan」** ソケットで待ち受けているプロセスがありません。これは正常です — 読み取り操作はデーモンを起動しません。デーモンを起動したい場合は `sonar serve -d` を実行します。
**クラッシュ後にソケットが残っている。** `sonar daemon path` で場所が表示されます。デーモンを起動すると、古いソケットは自動的に削除されます。最初のデーモンが消えた後に2番目のデーモンが起動を拒否する場合は、`sonar daemon restart` でロックを解除します。
**ポートがリストにない。** 別のユーザーが所有するプロセスは、権限がないと見えません。sonar はテーブルの下にその旨を表示します。`sudo sonar list` で再実行すると表示されます。Linux では `ss` がインストールされている必要があります(`iproute2`)。Windows では `netstat` が使用されます。
**kill しても何も起こらなかった。** Docker コンテナは Docker デーモンを通じて停止されます。`docker ps` で確認してください。SIGTERM を無視するプロセスには `-f` が必要で、他の何か(systemd、Compose の `restart: always` など)によって監視されているプロセスは設計上復活します — 監視元を停止してください。
**何も動作せず、理由がわからない。** `sonar doctor` はバイナリ、設定、デーモン、データベース、すべての統合機能を一度にチェックし、見つかった各問題を修正するコマンドを出力します。
**バグの報告。** 以下に加えて、`sonar daemon log` の最後の行を含めてください。```sh
sonar version
sonar daemon status
sonar doctor --json
# check
対応プラットフォーム
- macOS(
lsofを使用) - Linux(
ssを使用) - Windows(
netstatを使用)
グループ化には各プロセスの作業ディレクトリが必要であり、現在はすべてのプラットフォームにそれが存在します。Linux では /proc、macOS では lsof、Windows ではプロセス自身の PEB の読み取りです。そのため、git-root グループ、project_root、cwd ベースの名前はどこでも同じように機能し、sonar init は3つのいずれかでリッスンしているものから .sonar.yaml を提案できます。
デスクトップアプリは現時点では対象が限られています。sonar install desktop は macOS(Apple Silicon および Intel)と Linux(x86_64 および aarch64)にインストールします。Windows では、このコマンドはアプリがまだ利用できないことを示し、終了コード 1 で終了します。
唯一のギャップは、64ビット Windows 上の 32ビット sonar.exe です。64ビットプロセスのメモリを読み取れないため、該当ポートは作業ディレクトリなしで返され、git-root グループから外れます。64ビット版を使用してください。64ビット版は 64ビットと 32ビットの両方のプロセスを読み取れます。それ以外の環境では、アクセスを拒否されたプロセス(別のユーザーとして実行されているサービス、保護されたシステムプロセス)のポートは、単に作業ディレクトリなしのままとなり、スキャンの残りには影響しません。
コントリビューター
sonar に貢献してくださったすべての方々に感謝します!