Skip to content

Modernize CLI Experience (Ratatui, Miette, and Enhanced DX) #9

Description

@vernonthedev

Description

To establish NestForge as a top-tier Rust framework, the CLI needs to move beyond basic text output. We need a "dope" terminal user interface (TUI) and robust error reporting that feels modern, intuitive, and visually polished. This involves integrating industry-standard Rust crates for rich terminal interactions and "beautiful" error diagnostics.

User Story

As a NestForge developer, I want a CLI that provides interactive prompts, clear progress indicators, and readable error messages so that I can manage my modular architecture with confidence and minimal friction.

Proposed Workflow

  1. Interactive Scaffolding: Instead of just flags, nestforge new and nestforge generate should offer interactive TUI lists (using ratatui or enquirer-style prompts) to select modules, database drivers, or templates.
  2. Advanced Error Diagnostics: Replace standard panic! or io::Error strings with miette reports that include code snippets, highlights, and "Help" suggestions.
  3. Structured Command Parsing: Standardize all commands using clap (v4) with derive features for consistent help menus and shell completions.

Technical Tasks

  • TUI Integration: Implement ratatui or inquire for interactive prompts during project initialization.
  • Error Handling: Refactor the result types to use miette for "pretty" error reporting (e.g., highlighting a syntax error in a nestforge.toml file).
  • Command Architecture: Migrate all current commands to a unified clap::Parser structure with subcommands.
  • Visual Feedback: Integrate indicatif for high-performance progress bars during heavy tasks like project scaffolding or module compilation.
  • Styling: Use console or owo-colors for consistent ANSI color-coding across different terminal themes.

Success Criteria

  • Running nestforge without arguments shows a clean, color-coded help menu with categorized commands.
  • Errors (like a missing config file) point to the exact line in the code/config using miette visual pointers.
  • Complex commands (like nestforge init) use interactive select menus rather than requiring 5+ CLI flags.

Impact

This significantly boosts the "Professionalism" factor of the framework. A high-quality CLI lowers the barrier to entry for developers coming from the Node.js or Go ecosystems and makes the NestForge brand more memorable.

Technical Notes

  • Crates to add: clap, ratatui, miette, indicatif, owo-colors.
  • We should ensure the TUI components are optional or fall back to "Plain Text Mode" for CI/CD environments (using the NO_COLOR standard).

Labels

/cli /ux /dx /priority-high /architecture

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions