Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
77 changes: 77 additions & 0 deletions src/agent_term/release.py
Original file line number Diff line number Diff line change
@@ -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)
30 changes: 30 additions & 0 deletions src/agent_term/version_cli.py
Original file line number Diff line number Diff line change
@@ -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:]))
Loading