refactor(cli): split claude_bottle/cli.py into a package
test / run tests/run_tests.py (push) Successful in 20s
test / run tests/run_tests.py (push) Successful in 20s
One file per subcommand under claude_bottle/cli/, with shared constants and the tty helper in _common.py and dispatch in __init__.py. The public import (from claude_bottle.cli import main) is unchanged, so the root cli.py entrypoint and the test suite see no surface change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
"""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_agent_bottle,
|
||||
manifest_env_names,
|
||||
manifest_prompt,
|
||||
manifest_require_agent,
|
||||
manifest_resolve,
|
||||
manifest_skills,
|
||||
manifest_ssh,
|
||||
)
|
||||
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(manifest, args.name)
|
||||
|
||||
env_names = manifest_env_names(manifest, args.name)
|
||||
skill_names = manifest_skills(manifest, args.name)
|
||||
prompt_content = manifest_prompt(manifest, args.name)
|
||||
prompt_first_line = prompt_content.splitlines()[0] if prompt_content else ""
|
||||
|
||||
bottle_name = manifest_agent_bottle(manifest, args.name)
|
||||
ssh_entries = manifest_ssh(manifest, args.name)
|
||||
|
||||
print()
|
||||
info(f"agent : {args.name}")
|
||||
info(f"env (names only): {', '.join(env_names) if env_names else '(none)'}")
|
||||
info(f"skills : {' '.join(skill_names) if skill_names else '(none)'}")
|
||||
info(
|
||||
f"prompt : {len(prompt_content)} chars; "
|
||||
f"first line: {prompt_first_line or '(empty)'}"
|
||||
)
|
||||
if bottle_name:
|
||||
info(f"bottle : {bottle_name}")
|
||||
if ssh_entries:
|
||||
for e in ssh_entries:
|
||||
info(
|
||||
f" ssh host : {e.get('Host')} "
|
||||
f"(Hostname={e.get('Hostname')}, User={e.get('User')}, "
|
||||
f"Port={e.get('Port')}, IdentityFile={e.get('IdentityFile')})"
|
||||
)
|
||||
if e.get("KnownHostKey"):
|
||||
info(f" KnownHostKey: {e['KnownHostKey']}")
|
||||
else:
|
||||
info(" ssh hosts : (none)")
|
||||
else:
|
||||
info("bottle : (none)")
|
||||
print()
|
||||
return 0
|
||||
Reference in New Issue
Block a user