CLI

ShogiArena の CLI は shogiarena コマンドです。

shogiarena [global-options] <command> ...

グローバルオプション

オプション説明
--versionバージョンを表示する
--log-level {DEBUG,INFO,WARNING,ERROR}ログレベルを指定する
--debug-logger LOGGER指定 logger を DEBUG にする
--output-dir PATHこの実行だけ標準出力先を上書きする

コマンド一覧

コマンド用途
configsettings.yaml と artifact リポジトリ設定
runtournament / sprt / spsa / generate / mate / analyze
resultsrun 結果の集計と provenance 検証
dashboard保存済み run の表示と追記中CSAログの監視
csaCSAログの状態確認と棋譜export
replay-position保存済み局面の再検索
worker-bundleRemote worker bundleとpreplaced mappingの生成

config

shogiarena config init
shogiarena config show
shogiarena config repo set yaneuraou \
  --path ~/repos/YaneuraOu \
  --url https://github.com/yaneurao/YaneuraOu.git \
  --build-config ~/.config/shogiarena/builds/yaneuraou.yaml

config init は標準の output_direngine_dir、artifact 用の設定を作成します。

worker-bundle

shogiarena worker-bundle build --output /absolute/path/worker-bundle.zip
shogiarena worker-bundle preplaced-map \
  --engine ENGINE_NAME LOCAL_BINARY /absolute/remote/engine \
  --resource ENGINE_NAME LOCAL_FILE_OR_DIRECTORY /absolute/remote/resource

preplaced-mapはengine binaryとpath resourceをhashし、--provision preplacedで使う SHOGIARENA_REMOTE_PREPLACED_RESOURCESの単一行JSONを標準出力へ返します。 --engine--resourceは繰り返し指定できます。

run

shogiarena run tournament tournament.yaml
shogiarena run sprt sprt.yaml
shogiarena run spsa spsa.yaml
shogiarena run generate generate.yaml

run tournament

shogiarena run tournament [config.yaml] [options]

主なオプションは次のとおりです。

オプション説明
--dry-run設定を検証して実行しない
--validate-only設定の検証だけを行う
--experiment-name NAME自動生成の run 名を上書きする
--run-dir PATHrun ディレクトリを明示指定する
--no-resume再開せず新規に実行する
--provision {cas,preplaced}SSH resourceをCAS配置またはpath/digest検証済み既配置として扱う
--git-worktree {strict,clean,allow-dirty}artifact build 前の Git worktree の扱いを指定する
--path-preflight {off,warn,error}パス系 USI オプションを事前検査する
--engine KEY=VALUE ...engine 定義を CLI から追加する(repeatable)
--rules KEY=VALUE ...rules.* を上書きする
--tournament KEY=VALUE ...tournament.* を上書きする
--rating KEY=VALUE ...rating.* を上書きする
--dashboard KEY=VALUE ...dashboard.* を上書きする
--logging KEY=VALUE ...logging.* を上書きする
--system KEY=VALUE ...system.* を上書きする
--sprt KEY=VALUE ...sprt.* を上書きする
--openbench KEY=VALUE ...openbench.* を上書きする

YAML 設定の一部は、次のようにコマンドラインから上書きできます。

shogiarena run tournament tournament.yaml \
  --tournament games_per_pair=100 num_parallel=4 \
  --rules time_control.byoyomi_ms=1000

run sprt

SPRT 用の設定を実行します。

cp examples/configs/run/sprt/example.yaml sprt.yaml
shogiarena run sprt sprt.yaml

run spsa

SPSA チューニングを実行します。

cp examples/configs/run/spsa/example.yaml spsa.yaml
shogiarena run spsa spsa.yaml

run generate

自己対局で棋譜を生成します。

cp examples/configs/run/generate/example.yaml generate.yaml
shogiarena run generate generate.yaml

run mate / run analyze

単一エンジンで局面を探索します。

shogiarena run mate engine.yaml startpos --ply-limit 5
shogiarena run analyze engine.yaml startpos --nodes 100000

run analyze の主なオプションは次のとおりです。

オプション説明
--nodes N探索ノード数
--depth N探索深さ
--movetime MS固定思考時間
--infinitego infinite を使う
--pondergo に ponder flag を付ける
--searchmoves MOVE ...探索対象手を USI move で制限する
--timeout SECbestmove 待機の timeout
--quiet中間 info line を抑制する
--option KEY=VALUEengine option を上書きする(repeatable)

run mate の主なオプションは次のとおりです。

オプション説明
--ply-limit N詰み探索の ply 上限
--node-limit N詰み探索の node 上限
--infinitego mate infinite を使う
--wait-bestmovemate result 後の trailing bestmove を待つ
--timeout SECmate result 待機の timeout
--option KEY=VALUEengine option を上書きする(repeatable)

dashboard

shogiarena dashboard serve --run-dir /path/to/run
shogiarena dashboard serve --config tournament.yaml
shogiarena dashboard serve --run-dir /path/to/run --port 9090

serve は書き込みの終わったアーカイブを開きます。 追記中の CSA イベントログを追うには watch を使います。

shogiarena dashboard watch --csa-log-dir /path/to/csa/logs
shogiarena dashboard watch --csa-log-dir /path/to/csa/logs --port 9090 --out-run-dir ./csa-session

csa

CSA プロトコルサーバーでの対局を観戦・書き出しします。詳細は CSA 対局の観戦 を参照してください。

shogiarena csa status --csa-log-dir /path/to/csa/logs
shogiarena csa status --csa-log-dir /path/to/csa/logs --follow
shogiarena csa export --csa-log-dir /path/to/csa/logs --out ./csa-records

csa export は全手を盤面に再生してから書きます。 再生できなかった対局は書かずに報告し、exit code は非ゼロになります。

results

shogiarena results summary /path/to/run
shogiarena results summary /path/to/run --format json
shogiarena results summary /path/to/game.db --engine EngineA
shogiarena results verify-provenance /path/to/run

summary --format json の出力には timing metadata が含まれます。 engine_wall_time_ms は engine の think() 呼び出しから bestmove 回収までの engine I/O 区間、wall_time_ms は持ち時間に課金された wall time です。 wall NPS の既定 field は engine_wall_time_ms です。

replay-position

保存済みの対局局面を、指定したエンジンで再探索します。

shogiarena replay-position --run-dir /path/to/run \
  --game-id g0001-abc \
  --ply 80 \
  --engine EngineA \
  --nodes 100000

USI transcript を保存した run では、履歴を再現した再検索にも使えます。