CLI Module - Technical Specification
Version: v1.3.0 | Status: Active | Last Updated: May 2026
Version: v1.1.9 | Last Updated: March 2026
Overview
The CLI module provides the Codomyrmex command-line interface, built on Python Fire for automatic CLI generation from class methods. It supports nested subcommand groups, interactive shell mode, self-diagnostics, and MCP tool exposure.
Design Principles
- Zero-Mock Policy: Tests use real CLI invocations, no mocked command handlers.
- Explicit Failure: All handlers raise exceptions on error; no silent fallbacks.
- Fire-Based Auto-Discovery: The
Cliclass structure maps directly to the CLI command hierarchy.
Architecture
cli/
__init__.py # Public API: main + 40 handler functions
core.py # Cli class (Python Fire entry point)
doctor.py # Self-diagnostic framework (CheckResult, run_doctor)
commands.py # Command definitions
completion.py # Shell completion
utils.py # Logger, performance monitoring flag
mcp_tools.py # cli_list_commands, cli_run_command
handlers/ # Command handler implementations (9 files)
completions/ # Shell completion scripts
formatters/ # Output formatting
parsers/ # Input parsing
themes/ # Terminal themes
Functional Requirements
- Provide a unified CLI entry point via the
codomyrmexcommand. - Support nested subcommand groups: workflow, project, ai, analyze, build, fpf, skills, orchestration.
- Launch an interactive REPL shell via
codomyrmex shell. - Run self-diagnostics via
codomyrmex doctorwith granular check flags. - Expose CLI capabilities as MCP tools for agent consumption.
- Support verbose and performance monitoring modes via global flags.
- Provide quick execution commands (run, pipe, batch) for script orchestration.
Interface Contracts
class Cli:
def __init__(self, verbose: bool = False, performance: bool = False): ...
def check(self) -> Any: ...
def modules(self) -> Any: ...
def status(self) -> Any: ...
def shell(self) -> Any: ...
def doctor(self, pai=False, mcp=False, rasp=False, workflows=False,
imports=False, all_checks=False, output_json=False) -> int: ...
def run(self, target, args=None, timeout=60, parallel=False, verbose=False) -> Any: ...
class CheckResult:
OK: str = "ok"
WARN: str = "warn"
ERROR: str = "error"
Dependencies
Internal: codomyrmex.performance, codomyrmex.logging_monitoring, codomyrmex.utils.cli_helpers, codomyrmex.model_context_protocol.decorators
External: fire (Python Fire)
Constraints
- Python Fire generates the CLI from class structure; method signatures determine argument parsing.
- MCP tools (
cli_run_command) instantiate a freshCli()per invocation.
Navigation
- extended_readme.md -- Module overview
- AGENTS.md -- Agent coordination
- Source Module
Related Documents
- Readme: README.md