a21f2358c6
tracker-policy-pr / check-pr (pull_request) Successful in 16s
test / integration-docker (pull_request) Successful in 21s
lint / lint (push) Failing after 58s
test / unit (pull_request) Successful in 2m11s
test / integration-firecracker (pull_request) Successful in 3m27s
test / coverage (pull_request) Successful in 16s
test / publish-infra (pull_request) Has been skipped
_common had rotted into a junk drawer. Trim it to what actually
justifies a shared leaf module and rename for legibility:
* REPO_DIR: deleted (dead — nothing imported it).
* read_tty_line: dropped the pointless re-export; cleanup/start/init
now import it straight from bot_bottle.util.
* USER_CWD: deleted. It captured os.getcwd() at import time, but
nothing chdirs and no test patched it, so it was equivalent to a
live os.getcwd() — inlined at the six call sites.
* PROG: kept, now the sole member. It's still a leaf (both the
dispatcher and the commands it imports need it) so it can't move
into __init__ without a circular import.
_common.py -> constants.py. Full unit suite green (2243); CLI dispatch
verified.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
"""info: print env, skills, and prompt details for a named agent."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
|
|
from ...log import info
|
|
from ...manifest import ManifestIndex
|
|
from ..constants import PROG
|
|
|
|
|
|
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 bot-bottle.json")
|
|
args = parser.parse_args(argv)
|
|
|
|
names = ManifestIndex.resolve(os.getcwd())
|
|
names.require_agent(args.name)
|
|
manifest = names.load_for_agent(args.name)
|
|
|
|
agent = manifest.agent
|
|
bottle = manifest.bottle
|
|
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}")
|
|
identity = manifest.git_identity_summary()
|
|
if identity:
|
|
info(f" git identity : {identity}")
|
|
if bottle.git:
|
|
for e in bottle.git:
|
|
info(
|
|
f" git remote : {e.Name} -> {e.Upstream} "
|
|
f"(IdentityFile={e.IdentityFile})"
|
|
)
|
|
if e.KnownHostKey:
|
|
info(f" KnownHostKey: {e.KnownHostKey}")
|
|
else:
|
|
info(" git remotes : (none)")
|
|
print()
|
|
return 0
|