Skip to content

API Reference parrot_tools.contracts.cli

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.contracts.cli

View source

Contracts operator CLI (FEAT-539 M11).

python -m parrot_tools.contracts <command> — the operator surface for ingestion, verification, party merges, the verification queue, search, relation judgement, publication and answer retirement.

The CLI is a thin front-end: it builds tenant-bound services from deployment configuration and an authenticated operator context, then calls the same library/service methods every other path uses. It therefore inherits the same policies — owner role plus explicit confirmation for administrative actions, optimistic revisions for corrections — instead of re-implementing them. It never deletes a source document, never sends anything and imports no scheduler.

Confirmation comes from an explicit --confirm flag typed by the human at the terminal, not from any argument a model could produce.

Attribute COMMANDS

Type: tuple[str, ...]

Function build_parser

Build the operator argument parser.

build_parser() -> argparse.ArgumentParser

Returns: argparse.ArgumentParser

Function main

CLI entrypoint.

main(argv: Optional[Sequence[str]] = None, *, factory: Optional[Callable[[argparse.Namespace], dict[str, Any]]] = None, stream: Any = None) -> int

Parameter Type Default Description
argv Optional[Sequence[str]] None Argument vector (defaults to sys.argv[1:]).
factory Optional[Callable[[argparse.Namespace], dict[str, Any]]] None Builds the tenant-bound services from parsed arguments. Required — deployment configuration lives outside this module.
stream Any None Output stream (defaults to stdout).

Returns: int — The process exit code.

Function run_command

Dispatch one command against real, tenant-bound services.

run_command(args: argparse.Namespace, *, library: Any, service: Any, graph_loader: Any = None, temporal: Any = None, tenant_context: Any = None) -> tuple[int, dict[str, Any]]

Parameter Type Default Description
args argparse.Namespace Parsed arguments.
library Any The contract library.
service Any The shared answer service.
graph_loader Any None Optional graph loader for publish.
temporal Any None Optional temporal publisher for publish.
tenant_context Any None Tenant context for the temporal drain.

Returns: tuple[int, dict[str, Any]] — (exit_code, payload) — a nonzero code for any refusal or failure, and a bounded payload for printing.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally