agent-contracts

CLI

CLIは、指定したモジュール/ファイルがノードを登録することを前提に動作します (通常は get_node_registry() を使用)。

モジュールが register_all_nodes(registry=None) を定義しているものの、import 時に登録を行わない場合は、CLI が import 後に自動で呼び出します。

AGENT_CONTRACTS_DEBUG=1 を設定すると、デバッグログを stderr に出力します(モジュール/グラフのロード、コンパイル、Mermaid 生成など)。

Validate

agent-contracts validate --module myapp.nodes --strict
agent-contracts validate --file ./nodes.py --known-service db_service

終了コード: 成功は0、エラーありは1

Visualize

agent-contracts visualize --module myapp.nodes --output ARCHITECTURE.md
agent-contracts visualize --file ./nodes.py --output -
agent-contracts visualize --module myapp.nodes --graph-module myapp.graph --graph-func get_graph --output -

Diff

agent-contracts diff --from-module myapp.v1.nodes --to-module myapp.v2.nodes
agent-contracts diff --from-file ./old_nodes.py --to-file ./new_nodes.py

終了コード: 破壊的変更がある場合は2、それ以外は0