Skip to content

[bug] moon generate <template> CLI UI either broken or nonstandard and poorly documented #2246

@vswood

Description

@vswood

Consistent issues with code generation

When using a code generation template, the CLI is either broken, or has some esoteric and undocumented interface which amounts to the same thing as broken, at least for me.

The problems are:

  • Default values are entered as text in the CLI, and the delete button does not work to delete the text. I have resolved this by removing all default values, but that's clearly not what y'all had intended.
  • Confused and frustrated by the above, I immediately hit ctrl(cmd) + c to bail from the process, but cmd + c behaved the same as the enter key, which actually overwrote my primary package.json and jsconfig.json, which was a truly unwelcome behavior.

Removing all defaults, adding the target directory on the command line, and typing carefully have solved all of these problems, but it's rather a shame that this pretty handy functionality which I already use quite often and which will become an important part of my workflows is broken and problematic enough to have taken the shine off of my enthusiasm for what has otherwise been a pretty easy and seamless transition into a monorepo tooling/task running system that beats every other I've seen for enabling reuse of my painstakingly configured project tools and tasks in a straightforward and simple fashion.

The real headline is: Moon is great! Love it! Enough to bother submitting an issue for a jarring yet ignorable bug.

Steps to reproduce

  1. moon generate min-repro --template
  2. open template file, add a variable or two with default values and save
  3. moon generate min-repro packages/bug-repro
  4. try to delete default values which are populated as regular text
  5. try to exit with cmd+c

Expected behavior

It is expected that the delete key would delete text, and it is expected that the cli exit command would exit the process. Neither of these standard functionalities works as expected.

Environment

  System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 507.89 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 25.1.0 - $HOME/.local/share/mise/installs/node/25.1.0/bin/node
    Yarn: 4.9.1 - $HOME/.local/share/mise/installs/yarn/4.9.1/bin/yarn
    npm: 11.6.2 - $HOME/.local/share/mise/installs/node/25.1.0/bin/npm
    pnpm: 10.24.0 - $HOME/.local/share/mise/installs/pnpm/10.22.0/pnpm
    bun: 1.2.11 - $HOME/.local/share/mise/installs/bun/1.2.11/bin/bun
  Managers:
    Cargo: 1.90.0 - $HOME/.cargo/bin/cargo
    Homebrew: 5.0.3 - /opt/homebrew/bin/brew
    pip3: 25.1.1 - /opt/homebrew/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 17.0.0 - /usr/bin/gcc
    Git: 2.51.0 - /opt/homebrew/bin/git
    Clang: 17.0.0 - /usr/bin/clang
    FFmpeg: 7.1.1 - /opt/homebrew/bin/ffmpeg
    Curl: 8.7.1 - /usr/bin/curl
    OpenSSL: 3.5.0 - /opt/homebrew/bin/openssl
  Servers:
    Apache: 2.4.62 - /usr/sbin/apachectl
  Virtualization:
    Docker: 28.0.1 - /usr/local/bin/docker
    Docker Compose: 2.33.1 - /usr/local/bin/docker-compose
  SDKs:
    iOS SDK:
      Platforms: DriverKit 24.5, iOS 18.5, macOS 15.5, tvOS 18.5, visionOS 2.5, watchOS 11.5
  IDEs:
    Emacs: 30.1 - /opt/homebrew/bin/emacs
    VSCode: 1.106.3 - /usr/local/bin/code
    Codex: 0.53.0 - $HOME/.local/share/mise/installs/npm-openai-codex/0.53.0/bin/codex
    Vim: 9.1 - /usr/bin/vim
    Xcode: 16.4/16F6 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Go: 1.24.2 - /opt/homebrew/bin/go
    Java: 17.0.11 - /usr/bin/javac
    Perl: 5.34.1 - /usr/bin/perl
    PHP: 8.4.7 - /opt/homebrew/bin/php
    Python: 3.13.3 - $HOME/.local/share/mise/installs/python/3.13.3/bin/python
    Python3: 3.13.4 - /opt/homebrew/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
    Rust: 1.90.0 - $HOME/.cargo/bin/rustc
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Chrome: 142.0.7444.176
    Safari: 18.5

Additional context

I'm using iTerm2 for my terminal emulator, and just now checked Mac terminal, and the delete key works as expected, but cmd+c still emulates the enter key. Alacritty behave the same as Mac terminal. Ghostty the same, Kitty also the same, Wezterm also the same, and Warp behaves the same.

So, it looks as though the delete key is iTerm2 only, and perhaps just my specific config. And perhaps y'all have a different bail mechanism other than cmd+c? cmd+c STILL shouldn't behave like the enter key and submit answers while the user is trying to exit. And overwriting files as an unavoidable part of this broken process was really troubling.

There should be a review and confirmation process at the end of the process, and probably even more confirmation prompts when you're overwriting the package.json for the root of a monorepo. Simply trying to bail out of some mixed up strings I couldn't delete spiraled rapidly into what could have been a real problem if I'd had much uncommitted work in package.json or jsconfig.json - or any other files in the root which happened to match the template. Indeed, this has the potential to be an actual disaster, if the circumstances are right.

Still think Moon is an excellent, no, brilliant task runner/manager for its one of a kind/best in class means of making tooling modular, composable, and reusable. Nothing else comes close to the simplicity, clarity, and reliability you've brought to the world of project tooling, especially monorepo tooling. So thanks, and keep up the good work!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions