Skip to content

Enhance CLI usability with clearer error messages and improved help documentation #139

@jenniferjiangkells

Description

@jenniferjiangkells

The HealthChain CLI (healthchain/cli.py) could provide a better developer experience through clearer error messages, more helpful text, and potentially command aliases.

File: healthchain/cli.py

Current state:
The CLI works but could be more beginner-friendly and provide better guidance when errors occur.

Goal:
Improve the CLI user experience through incremental enhancements.

Suggested improvements (pick 2-3 to start):

  • Add more descriptive error messages when commands fail
  • Improve help text for each command with examples
  • Add validation for common user input errors with helpful suggestions
  • Include usage examples in command help (--help)
  • Add color-coded output for success/error messages (optional)
  • Consider command aliases for frequently used operations

Acceptance Criteria:

  • Error messages clearly explain what went wrong AND how to fix it
  • All commands have improved --help text with examples
  • Common error cases provide actionable guidance
  • Test the CLI manually to verify improvements
  • Update CLI documentation if needed

Example improvements:

# Before
raise ValueError("Invalid configuration")

# After
raise ValueError(
    "Invalid configuration file: 'sandbox' field is required. "
    "Example:\n"
    "  sandbox:\n"
    "    use_case: 'cds'\n"
    "See https://docs.healthchain.org/cli for more information."
)

Resources:

  • Typer documentation (if using Typer)
  • Run healthchain --help and each subcommand to audit current state
  • Look at well-designed CLIs for inspiration (e.g., poetry, black)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions