Skip to content

Conversation

@sjmiller609
Copy link
Contributor

@sjmiller609 sjmiller609 commented Nov 26, 2025

Added exec feature to CLI and make CLI similar to docker CLI for other commands

Logs needs server side changes to work better

e2e-cli-demo.mov

@mesa-dot-dev
Copy link

mesa-dot-dev bot commented Nov 26, 2025

Mesa Description

TL;DR

Introduced several new Docker-like CLI commands (exec, ps, pull, run, logs) to the Hypeman CLI, significantly expanding its functionality for instance management and interaction.

Why we made these changes

Added exec feature to CLI and make CLI similar to docker CLI for other commands

Logs needs server side changes to work

e2e-cli-demo.mov

What changed?

  • New CLI Commands:
    • exec: Execute commands within a running instance, supporting interactive TTY and WebSocket I/O.
    • ps: List Hypeman instances with filtering and detailed information options.
    • pull: Pull container images from a registry, showing status and digest.
    • run: Create and start new instances from an image, with extensive configuration flags (name, env, memory, network).
    • logs: Fetch and stream instance logs, supporting follow and tail flags.
  • CLI Core & Utilities:
    • Integrated new commands (execCmd, pullCmd, runCmd, psCmd, logsCmd) into pkg/cmd/cmd.go.
    • Improved error handling in cmd/hypeman/main.go for cmd.ExecExitError.
    • Added TableWriter for tabular data formatting, time formatting, and string truncation utilities in pkg/cmd/format.go.
    • Updated base URL logic in pkg/cmd/util.go to default to "http://localhost:8080".
  • Project Configuration & Documentation:
    • Updated README.md with detailed usage examples for the new CLI commands.
    • Modified .gitignore to exclude .env and the hypeman/ directory.
    • Updated go.mod and go.sum to reflect dependency changes.

Validation

No explicit validation steps were provided in the PR description.

Description generated by Mesa. Update settings

@sjmiller609 sjmiller609 changed the title Hypeman exec Hypeman exec, ps, pull, run Nov 26, 2025
@sjmiller609 sjmiller609 changed the title Hypeman exec, ps, pull, run Hypeman exec, ps, pull, run, logs Nov 26, 2025
@sjmiller609 sjmiller609 marked this pull request as ready for review November 26, 2025 17:07
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed full review of 0963c90...cbb8eb8

Analysis

  1. WebSocket Error Handling Inconsistency - The exec command contains potential logic issues in WebSocket closure handling that might misinterpret abnormal closures as successful exits, particularly around interactions between IsUnexpectedCloseError and IsCloseError.

  2. Name Generation Race Condition - The randomSuffix function relies on time.Now().UnixNano() which could generate identical values when called in rapid succession, creating collision risks for auto-generated instance names.

  3. Default URL Safety Issue - Defaulting to "http://localhost:8080" when no base URL is provided could lead to unexpected behavior in production environments if configuration is accidentally omitted.

  4. Goroutine Lifecycle Management - Stdin goroutines lack explicit cancellation mechanisms, potentially leading to resource leaks if WebSocket connections close unexpectedly.

  5. Client Instantiation Inefficiency - Each command creates its own hypeman.Client instance, preventing connection pooling and shared configuration across commands in the same CLI invocation.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

13 files reviewed | 0 comments | Edit Agent SettingsRead Docs

@sjmiller609 sjmiller609 changed the title Hypeman exec, ps, pull, run, logs Hypeman exec, ps, pull, run Nov 26, 2025
@sjmiller609 sjmiller609 requested a review from rgarcia November 26, 2025 18:19
@sjmiller609 sjmiller609 changed the title Hypeman exec, ps, pull, run Hypeman exec, ps, pull, run, rm Nov 26, 2025
Copy link
Contributor

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫶

@sjmiller609 sjmiller609 merged commit 9530856 into main Nov 26, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants