Skip to content

Add commander dependency and CLI flag support#53

Merged
Josephat-S merged 1 commit into
devfrom
feat/cli-flag-support
May 25, 2026
Merged

Add commander dependency and CLI flag support#53
Josephat-S merged 1 commit into
devfrom
feat/cli-flag-support

Conversation

@Josephat-S
Copy link
Copy Markdown
Contributor

This pull request introduces a major refactor to the CLI in index.js, migrating from a purely interactive prompt-based approach to a robust command-line interface using the commander library. It adds support for command-line flags, improves input validation, and allows both interactive and non-interactive (flag-driven) project scaffolding. Additionally, it introduces several quality-of-life improvements such as skipping dependency installation with a flag and dynamically displaying the current version from package.json.

The most important changes are:

CLI Architecture & Command Handling:

  • Refactored the CLI to use the commander library, supporting subcommands and options for non-interactive usage, and providing a more standard CLI experience. The default behavior now routes to the create command, and help/version info is available. (index.js) [1] [2] [3]

Flag and Argument Support:

  • Added support for command-line flags for template, architecture, design, variant, navigation count, sidebar, git initialization, dependency installation, and a --yes shortcut for all defaults. Includes input validation and graceful error messaging for invalid options. (index.js) [1] [2] [3]

Interactive Prompt Improvements:

  • Prompts are now dynamically built, skipping questions for any options already provided via flags. The prompt flow is cleaner, and merging of flag and prompt results is handled systematically. (index.js) [1] [2]

Version Handling and UX:

  • The CLI banner now dynamically displays the version from package.json instead of a hardcoded value, improving maintainability and user awareness. (index.js)

Project Generation Enhancements:

  • Added a --no-install flag to skip dependency installation, with corresponding logic in the project generation flow and user feedback. (src/generate.js) [1] [2]

Closes #39

@Josephat-S Josephat-S requested a review from a team May 25, 2026 17:52
@Josephat-S Josephat-S merged commit 0069278 into dev May 25, 2026
1 check 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.

CLI Flag Support (Non-Interactive Mode)

1 participant