Back to Field Notes

Developer-tool decision note

Delay side effects in a project generator

Why create-mohsen-app collects intent, rejects an unsafe destination, composes selected templates, and installs last.

Decision trail

Context before conclusion

The choice is shown with the constraint and rejected paths so the trade-off can be reviewed.

  1. 1Context

    Repeated Next.js setup created the same manual choices around language, styling, API, state, linting, and runtime. A fixed starter was easy to copy, but optional choices would either leave stale files or multiply full-template variants.

  2. 2Constraint

    A generator writes into a developer’s filesystem. It must not guess how to merge a non-empty destination, and cancellation should not leave a half-configured project. Required choices therefore need to be known before template mutation begins.

  3. 3Options
    • Write files after each prompt answer and clean up if a later prompt is cancelled.
    • Overwrite or automatically merge a generated starter into a non-empty folder.
    • Maintain one complete starter for every possible option combination.
  4. 4Choice

    Resolve the selection set first, stop when the target is unsafe, copy one base template plus only the selected additions, and make optional dependency installation the final operation. This favors predictable failure and centralized shared files over convenience in existing folders.

  5. 5Consequence

    The result is a published TypeScript CLI, a public repository, and an inspectable npm package. The evidence supports delivery and the decision sequence; it does not establish download adoption or time saved. The learning is that cancellation and destination safety are product behavior, not implementation footnotes.

Result / learning

What the evidence supports

The result is a published TypeScript CLI, a public repository, and an inspectable npm package. The evidence supports delivery and the decision sequence; it does not establish download adoption or time saved. The learning is that cancellation and destination safety are product behavior, not implementation footnotes.

Artifacts / evidence

Inspect the work behind the note

These are the live routes, source locations, repositories, or published packages used as evidence above.

Live route

Full create-mohsen-app case

The full workflow, trade-offs, real CLI screen, and evidence limits.

Inspect artifact

Source

CLI orchestration source

The public entry file where choices, target checks, template work, and installation can be inspected.

Inspect artifact

Source

Composable template tree

The base-and-extras structure behind the composition decision.

Inspect artifact

Package

Published npm package

Evidence that the CLI was packaged and published, without implying adoption.

Inspect artifact
Mohsen
Mohsen
[email protected]

Tehran, Iran

نسخهٔ فارسی

© 2026 Mohsen.