[Refactor] Refactor ops-helpers.sh into Modulated Command-Line Interface #1416

Closed
opened 2026-03-24 13:04:30 +00:00 by Timmy · 1 comment
Owner

Context: Shell scripts alias are difficult to test and structure organically.

Acceptance Criteria:

  • Rewrite the core ops behaviors into Python using typer or click.
  • Install via pip install -e offering a unified CLI command (e.g., hermes <command>).
**Context:** Shell scripts alias are difficult to test and structure organically. **Acceptance Criteria:** - Rewrite the core ops behaviors into Python using `typer` or `click`. - Install via `pip install -e` offering a unified CLI command (e.g., `hermes <command>`).
Author
Owner

KIMI IMPLEMENTATION INSTRUCTIONS:

Refactor ops-helpers.sh into a modern Python CLI using typer. This will make operations testable and more maintainable.

FILES TO CREATE:

src/cli/__init__.py
src/cli/main.py
src/cli/commands/__init__.py
src/cli/commands/ops.py
src/cli/commands/agents.py
src/cli/commands/monitoring.py
tests/cli/test_main.py
tests/cli/test_ops_commands.py

FILES TO MODIFY:

pyproject.toml (add console_scripts entry)
scripts/ops-helpers.sh (deprecation notice)

STEP-BY-STEP IMPLEMENTATION:

  1. Create CLI Structure (src/cli/main.py):

    • Use typer for the main CLI application
    • Add hermes as the main command with subcommands
    • Include proper help text and version information
    • Add common options (--verbose, --config-path)
  2. Migrate Shell Functions (src/cli/commands/ops.py):

    • Convert each ops-helpers.sh function to a typer command
    • Preserve exact behavior but with proper error handling
    • Add input validation and type hints
    • Include proper logging and output formatting
  3. Add Agent Commands (src/cli/commands/agents.py):

    • Commands for starting/stopping agent loops
    • Status checking and health monitoring
    • Log viewing and debugging helpers
  4. Update Installation (pyproject.toml):

    • Add console_scripts entry: hermes = src.cli.main:app
    • Add typer dependency to requirements
    • Ensure proper package structure
  5. Add Comprehensive Tests (tests/cli/):

    • Test all CLI commands with various inputs
    • Test error conditions and edge cases
    • Use typer's testing utilities
    • Ensure backward compatibility

CLI STRUCTURE:

hermes --help
hermes ops --help (replaces ops-helpers.sh functions)
hermes agents start/stop/status
hermes monitoring dashboard/logs/health

VERIFICATION:

  • pip install -e . should install hermes command
  • hermes --help should show all subcommands
  • All previous ops-helpers.sh functionality should work via hermes ops
  • Run tox -e unit - all tests must pass

CRITICAL: Preserve all existing functionality while making it testable and maintainable.

PROCEED WITH IMPLEMENTATION.

**KIMI IMPLEMENTATION INSTRUCTIONS:** Refactor ops-helpers.sh into a modern Python CLI using typer. This will make operations testable and more maintainable. **FILES TO CREATE:** ``` src/cli/__init__.py src/cli/main.py src/cli/commands/__init__.py src/cli/commands/ops.py src/cli/commands/agents.py src/cli/commands/monitoring.py tests/cli/test_main.py tests/cli/test_ops_commands.py ``` **FILES TO MODIFY:** ``` pyproject.toml (add console_scripts entry) scripts/ops-helpers.sh (deprecation notice) ``` **STEP-BY-STEP IMPLEMENTATION:** 1. **Create CLI Structure** (`src/cli/main.py`): - Use typer for the main CLI application - Add `hermes` as the main command with subcommands - Include proper help text and version information - Add common options (--verbose, --config-path) 2. **Migrate Shell Functions** (`src/cli/commands/ops.py`): - Convert each ops-helpers.sh function to a typer command - Preserve exact behavior but with proper error handling - Add input validation and type hints - Include proper logging and output formatting 3. **Add Agent Commands** (`src/cli/commands/agents.py`): - Commands for starting/stopping agent loops - Status checking and health monitoring - Log viewing and debugging helpers 4. **Update Installation** (`pyproject.toml`): - Add console_scripts entry: `hermes = src.cli.main:app` - Add typer dependency to requirements - Ensure proper package structure 5. **Add Comprehensive Tests** (`tests/cli/`): - Test all CLI commands with various inputs - Test error conditions and edge cases - Use typer's testing utilities - Ensure backward compatibility **CLI STRUCTURE:** ``` hermes --help hermes ops --help (replaces ops-helpers.sh functions) hermes agents start/stop/status hermes monitoring dashboard/logs/health ``` **VERIFICATION:** - `pip install -e .` should install `hermes` command - `hermes --help` should show all subcommands - All previous ops-helpers.sh functionality should work via `hermes ops` - Run `tox -e unit` - all tests must pass **CRITICAL:** Preserve all existing functionality while making it testable and maintainable. PROCEED WITH IMPLEMENTATION.
kimi was assigned by Timmy 2026-03-24 15:07:14 +00:00
kimi was unassigned by Timmy 2026-03-24 19:32:20 +00:00
Timmy closed this issue 2026-03-24 21:54:09 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1416