Files
myagents/myagents/entrypoints.py
T
Zhengshou Lai c3e119e3c9 feat: offer backend CLI install on missing binary (entrypoints) + shared backend_available/ensure_backend helpers
- Standalone my* wrappers pass offer_install=True so a missing backend CLI
  triggers the interactive 'Install now? [y/N]' prompt (was a bare not-found).
- Add backend_available()/ensure_backend() to expose the backend registry
  (binary/env_bin/install_cmd) for xiaohe init / ensure-deps to reuse.
2026-08-09 15:08:03 +08:00

76 lines
2.1 KiB
Python

"""Standalone entrypoints for myclaude, mykimi, mycodex, myhermes, mycursor."""
from myagents.launcher import build_cli
# offer_install=True so a missing backend CLI (e.g. `claude`) triggers the
# interactive "Install now? [y/N]" prompt instead of a bare not-found error.
# Backends without an install_cmd (hermes/cursor) fall back to the manual msg.
claude_cli = build_cli("claude", prog_name="myclaude", offer_install=True)
kimi_cli = build_cli("kimi", prog_name="mykimi", offer_install=True)
codex_cli = build_cli("codex", prog_name="mycodex", offer_install=True)
hermes_cli = build_cli("hermes", prog_name="myhermes", offer_install=True)
cursor_cli = build_cli("cursor", prog_name="mycursor", offer_install=True)
def _progs():
from myagents.cli import cli
return [
("myagents", lambda: cli),
("myclaude", lambda: claude_cli),
("mykimi", lambda: kimi_cli),
("mycodex", lambda: codex_cli),
("myhermes", lambda: hermes_cli),
("mycursor", lambda: cursor_cli),
]
def claude_main() -> None:
"""Run ``myclaude``."""
from myagents.commands.completion_install import (
ensure_completions_installed,
)
ensure_completions_installed(_progs())
claude_cli()
def kimi_main() -> None:
"""Run ``mykimi``."""
from myagents.commands.completion_install import (
ensure_completions_installed,
)
ensure_completions_installed(_progs())
kimi_cli()
def codex_main() -> None:
"""Run ``mycodex``."""
from myagents.commands.completion_install import (
ensure_completions_installed,
)
ensure_completions_installed(_progs())
codex_cli()
def hermes_main() -> None:
"""Run ``myhermes``."""
from myagents.commands.completion_install import (
ensure_completions_installed,
)
ensure_completions_installed(_progs())
hermes_cli()
def cursor_main() -> None:
"""Run ``mycursor``."""
from myagents.commands.completion_install import (
ensure_completions_installed,
)
ensure_completions_installed(_progs())
cursor_cli()