Real create-mohsen-app command-line interface
1

create-mohsen-app

A composable CLI that turns a set of up-front product choices into a clean Next.js starter.

Role
Open-source tool author
Outcome
Delivered a published CLI and public repository for configurable Next.js project setup.
Status
Published open-source CLI

No public download, adoption, or time-saved metric is claimed.

Project access

Outcome

Context and why it mattered

A setup tool earns trust by being predictable at the exact moment it creates and installs files on a developer’s machine.

Outcome

Problem

Repeated project setup creates inconsistent choices, partial folders, and avoidable manual work.

Delivery detail

Constraints

The CLI must avoid damaging a non-empty target and should not mutate the filesystem before required choices are known.

  • The CLI must avoid damaging a non-empty target and should not mutate the filesystem before required choices are known.

Delivery detail

Role and scope

The public package and repository support independent authorship; no client or team delivery is implied.

Responsibilities

  • Interactive prompt flow
  • Composable template copying
  • Target-directory safeguards
  • Package build and executable entry point

Included in scope

  • Interactive prompt flow
  • Composable template copying
  • Target-directory safeguards
  • Package build and executable entry point

Outside scope

  • No public usage analytics or generated-project success metric is claimed.
  • The case demonstrates the CLI workflow, not ownership of the frameworks it configures.
  • Only one registered CLI screenshot is available as visual proof.

Delivery detail

Collect intent first

Language, styling, API, state, linting, and runtime choices are collected before template mutation begins.

  1. 1

    Collect intent first

    Language, styling, API, state, linting, and runtime choices are collected before template mutation begins.

    • cma-entry

Step outputs

  • cma-entry

Delivery detail

Guard the destination

The workflow stops when a target is not safe to populate instead of guessing which files may be overwritten.

  1. 1

    Guard the destination

    The workflow stops when a target is not safe to populate instead of guessing which files may be overwritten.

    • cma-entry

Step outputs

  • cma-entry

Delivery detail

Compose the selected starter

A base template is combined with only the optional pieces selected in the prompt flow.

  1. 1

    Compose the selected starter

    A base template is combined with only the optional pieces selected in the prompt flow.

    • cma-templates
    • cma-repository

Step outputs

  • cma-templates
  • cma-repository

Delivery detail

Install only after files exist

Optional package installation is the final operation, keeping cancellation and setup failures easier to reason about.

  1. 1

    Install only after files exist

    Optional package installation is the final operation, keeping cancellation and setup failures easier to reason about.

    • cma-entry
    • cma-screen

Step outputs

  • cma-entry
  • cma-screen

Delivery detail

Real CLI output

Shows the actual interaction surface rather than a redesigned marketing mockup.

Real CLI output

Shows the actual interaction surface rather than a redesigned marketing mockup.

create-mohsen-app CLI
Contains visual content

Delivery detail

Public CLI source

Makes the prompt, copy, and install sequence inspectable.

Public CLI source

Makes the prompt, copy, and install sequence inspectable.

Contains visual content

Delivery detail

Single orchestration entry

Shows that decisions are collected before filesystem mutation and installation.

Single orchestration entry

Shows that decisions are collected before filesystem mutation and installation.

Contains visual content

Delivery detail

Base plus optional templates

Avoids maintaining one full starter for every combination.

Base plus optional templates

Avoids maintaining one full starter for every combination.

Contains visual content

Engineering detail

Architecture

One TypeScript command collects intent, validates a safe target, composes base and optional templates, then optionally installs dependencies.

Prompt answers

other

Language, CSS, API, state

Target guard

other

Cancel or continue safely

Template composer

other

Base plus selected extras

Optional install

other

Final side effect

  • promptguard · resolved config
  • guardtemplates · safe path
  • templatesinstall · generated files

Engineering detail

Collect required choices before writing

Situation
A cancelled prompt should not leave a half-configured project.
Decision
Collect the selection set before template work begins.
Reasoning
Cancellation and validation happen before most filesystem side effects.
Cost / trade-off
The orchestration function holds more configuration state before work starts.

Alternatives considered

  • Write after each answer
  • Use a fixed starter only
  • Resolve configuration first

Engineering detail

Refuse an unsafe target instead of merging

Situation
Merging generated starter files into a non-empty folder can overwrite or conflict with user work.
Decision
Stop and explain the target conflict.
Reasoning
A generator should fail predictably rather than risk user files.
Cost / trade-off
Users cannot scaffold directly into an existing partial project.

Alternatives considered

  • Overwrite matching files
  • Attempt an automatic merge
  • Stop on a non-empty target

Engineering detail

Compose a base with optional templates

Situation
A full template per option combination would multiply maintenance work.
Decision
Copy the base, then apply only selected extras.
Reasoning
Shared files stay centralized while optional concerns remain composable.
Cost / trade-off
Interactions between optional templates still need combination testing.

Alternatives considered

  • One fixed starter
  • One full template per combination
  • Base template plus selected additions

Outcome

Result

Delivered a published CLI and public repository for configurable Next.js project setup.

Engineering detail

Reflection

Developer tooling needs a visible before/after workflow, not only package metadata.

Lessons

  • For a code generator, predictable cancellation is part of product quality.
  • Delay irreversible work until intent and destination are known.

Next steps

  • Add fixture-based tests for the main option combinations.
  • Publish generated-project examples for each major configuration path.
  • Split orchestration from prompt rendering as the option matrix grows.

Published content

Claim boundary

No public download, adoption, or time-saved metric is claimed.

Mohsen
Mohsen
[email protected]

Tehran, Iran

نسخهٔ فارسی

© 2026 Mohsen.