diff --git a/pyproject.toml b/pyproject.toml index 9fc8ee7..9973f45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ agent-term-dispatch = "agent_term.dispatch_cli:main" agent-term-matrix = "agent_term.matrix_cli:main" agent-term-smoke = "agent_term.operator_smoke_cli:main" agent-term-snapshot = "agent_term.snapshot_cli:main" +agent-term-version = "agent_term.version_cli:main" [tool.setuptools.packages.find] where = ["src"] diff --git a/src/agent_term/release.py b/src/agent_term/release.py new file mode 100644 index 0000000..4a447af --- /dev/null +++ b/src/agent_term/release.py @@ -0,0 +1,77 @@ +"""Release and command-index helpers for AgentTerm.""" + +from __future__ import annotations + +from dataclasses import dataclass +from importlib.metadata import PackageNotFoundError, version + + +PACKAGE_NAME = "agent-term" + + +@dataclass(frozen=True) +class CommandInfo: + """Installed AgentTerm command metadata.""" + + name: str + summary: str + smoke: str | None = None + + +COMMANDS: tuple[CommandInfo, ...] = ( + CommandInfo( + name="agent-term", + summary="Core local event-log CLI and minimal interactive shell.", + smoke="agent-term --help", + ), + CommandInfo( + name="agent-term-check", + summary="Preflight Matrix, Agent Registry, and Policy Fabric service seams.", + smoke="agent-term-check --config configs/agent-term.local.example.json", + ), + CommandInfo( + name="agent-term-dispatch", + summary="Dispatch one event through Matrix posture, Agent Registry, Policy Fabric, adapters, EventStore, and snapshot generation.", + smoke="agent-term-dispatch --help", + ), + CommandInfo( + name="agent-term-matrix", + summary="Matrix send, sync normalization, durable sync state, and incremental sync helper.", + smoke="agent-term-matrix --help", + ), + CommandInfo( + name="agent-term-smoke", + summary="Run the local end-to-end operator smoke flow using offline fixtures.", + smoke="agent-term-smoke --workdir .agent-term/smoke", + ), + CommandInfo( + name="agent-term-snapshot", + summary="Render a dependency-light operator snapshot from the local EventStore.", + smoke="agent-term-snapshot --help", + ), + CommandInfo( + name="agent-term-version", + summary="Print installed AgentTerm package version and command index.", + smoke="agent-term-version", + ), +) + + +def package_version() -> str: + """Return the installed AgentTerm package version.""" + + try: + return version(PACKAGE_NAME) + except PackageNotFoundError: + return "0.0.0+unknown" + + +def render_command_index() -> str: + """Render a terminal-friendly command index.""" + + lines = [f"AgentTerm {package_version()}", "", "Commands:"] + for command in COMMANDS: + lines.append(f" {command.name}\n {command.summary}") + if command.smoke: + lines.append(f" smoke: {command.smoke}") + return "\n".join(lines) diff --git a/src/agent_term/version_cli.py b/src/agent_term/version_cli.py new file mode 100644 index 0000000..d2abf14 --- /dev/null +++ b/src/agent_term/version_cli.py @@ -0,0 +1,30 @@ +"""CLI entry point for AgentTerm version and command-index output.""" + +from __future__ import annotations + +import argparse +import sys + +from agent_term.release import package_version, render_command_index + + +def build_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + prog="agent-term-version", + description="Print AgentTerm package version and command index.", + ) + parser.add_argument("--short", action="store_true", help="Print only the package version.") + return parser + + +def main(argv: list[str] | None = None) -> int: + args = build_parser().parse_args(argv) + if args.short: + print(package_version()) + else: + print(render_command_index()) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main(sys.argv[1:]))