1f36d53f7b
test / run tests/run_tests.py (pull_request) Successful in 14s
Replace the TypedDict + 14 manifest_* free functions with frozen dataclasses (SshEntry, BottleEgress, Bottle, Agent, Manifest) carrying their own validators and constructors. Call sites import Manifest and chain attribute access; the manifest_* helpers and manifest_validate are gone. Behavior changes worth flagging: - Agent.bottle is now required (was optional with a "(none)" fallback). Manifest.from_json_obj dies if any agent lacks a 'bottle' field or references an undefined bottle, where previously start.py raised the error lazily for the specific agent being launched. - ssh.py now takes SshEntry instances; Host/IdentityFile shape checks moved upstream into Manifest construction, leaving only the IdentityFile filesystem-existence check in ssh_validate_entries. - pipelock_bottle_allowlist's per-element string check is dropped — the Manifest validator enforces it at load. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""info: print env, skills, and prompt details for a named agent."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from ..log import info
|
|
from ..manifest import Manifest
|
|
from ._common import PROG, USER_CWD
|
|
|
|
|
|
def cmd_info(argv: list[str]) -> int:
|
|
parser = argparse.ArgumentParser(prog=f"{PROG} info", add_help=True)
|
|
parser.add_argument("name", help="agent name defined in claude-bottle.json")
|
|
args = parser.parse_args(argv)
|
|
|
|
manifest = Manifest.resolve(USER_CWD)
|
|
manifest.require_agent(args.name)
|
|
|
|
agent = manifest.agents[args.name]
|
|
bottle = manifest.bottle_for(args.name)
|
|
env_names = list(bottle.env.keys())
|
|
prompt_first_line = agent.prompt.splitlines()[0] if agent.prompt else ""
|
|
|
|
print()
|
|
info(f"agent : {args.name}")
|
|
info(f"env (names only): {', '.join(env_names) if env_names else '(none)'}")
|
|
info(f"skills : {' '.join(agent.skills) if agent.skills else '(none)'}")
|
|
info(
|
|
f"prompt : {len(agent.prompt)} chars; "
|
|
f"first line: {prompt_first_line or '(empty)'}"
|
|
)
|
|
info(f"bottle : {agent.bottle}")
|
|
if bottle.ssh:
|
|
for e in bottle.ssh:
|
|
info(
|
|
f" ssh host : {e.Host} "
|
|
f"(Hostname={e.Hostname}, User={e.User}, "
|
|
f"Port={e.Port}, IdentityFile={e.IdentityFile})"
|
|
)
|
|
if e.KnownHostKey:
|
|
info(f" KnownHostKey: {e.KnownHostKey}")
|
|
else:
|
|
info(" ssh hosts : (none)")
|
|
print()
|
|
return 0
|