hermes-agent/hermes_cli/subcommands/import_agent.py
teknium1 24c3c27ba8 feat(cli): hermes import-agent — import Claude Code and Codex CLI setups
Maps CLAUDE.md/AGENTS.md, permission allowlists, MCP servers, skills, and memories into their Hermes equivalents. Follows the openclaw migration pattern. Inspired by ChatGPT Work import-from-another-agent onboarding.
2026-07-26 17:47:07 -07:00

49 lines
1.8 KiB
Python

"""``hermes import-agent`` subcommand parser.
Follows the ``hermes claw`` pattern (see ``hermes_cli/subcommands/claw.py``):
parser building lives here, the handler is injected to avoid importing
``main``, and the import logic itself lives in ``hermes_cli/agent_import.py``.
"""
from __future__ import annotations
from typing import Callable
def build_import_agent_parser(subparsers, *, cmd_import_agent: Callable) -> None:
"""Attach the ``import-agent`` subcommand to ``subparsers``."""
parser = subparsers.add_parser(
"import-agent",
help="Import a Claude Code or Codex CLI setup into Hermes",
description=(
"One-command import of another coding agent's setup into Hermes. "
"Maps CLAUDE.md/AGENTS.md instructions, permission allowlists, MCP "
"servers, skills, and memories into their Hermes equivalents. "
"Always shows a preview before making changes. API keys and "
"credentials are never imported — run 'hermes setup' for those."
),
)
parser.add_argument(
"agent",
nargs="?",
choices=["claude-code", "codex"],
help="Which agent to import from (default: auto-detect ~/.claude or ~/.codex)",
)
parser.add_argument(
"--source",
help="Path to the agent's config directory (default: ~/.claude or ~/.codex)",
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Preview only — stop after showing what would be imported",
)
parser.add_argument(
"--overwrite",
action="store_true",
help="Overwrite existing Hermes items on name conflicts (default: skip)",
)
parser.add_argument(
"--yes", "-y", action="store_true", help="Skip confirmation prompts"
)
parser.set_defaults(func=cmd_import_agent)