Skip to content

fix(cli): one-line errors, checked inputs and no prompts without a terminal - #322

Merged
Exeloo merged 20 commits into
mainfrom
fix/testing-polish
Nov 22, 2026
Merged

Exeloo merged 20 commits into
mainfrom
fix/testing-polish

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Closes #306
Closes #309
Closes #310
Closes #311
Closes #312
Closes #313
Closes #314
Closes #315
Closes #316
Closes #318
Closes #319
Closes #321
Refs #308
Refs #317
Refs #320

Pre-testing polish of nf, one commit per issue:

How do you test this PR?

  • Before: nf dev hid build errors; nf start -p abc crashed with a Bun RangeError and exited 0; nf new </dev/null exited 1 with no message; nf new --language rust printed a stack trace; nf start before nf build served an empty loader; the generated tsconfig gave TS5107; dist/ was not ignored.
    After: each one fixed; dev.action.spec and the new non-terminal e2e tests fail on main and pass here.
  • Commands run: pnpm build, pnpm lint, pnpm test (unit 296 passed, e2e 101 passed, 1 skipped, 1 todo); schematics build, lint, test:unit (48) and test:e2e (151). Manual: NO_COLOR=1 nf start -p 4655 in an unbuilt project exits 1 and opens no port.
  • No unit test covers the port check or the no-build stop: start.action.spec.ts comes with fix(cli): copy nested asset folders and add unit tests for files, package manager, build and start #295.

Merge danger

Door: two-way (revert is enough).
Blast radius: @nanoforge-dev/cli and @nanoforge-dev/schematics at the next release; nothing deploys on merge. Behavior changes for users:

  • piped answers to prompts no longer work; shells where stdin is not a TTY (Git Bash or mintty without ConPTY) lose the prompts (untested on Windows);
  • nf start without a build exits 1;
  • component and system names with spaces or a leading digit are refused;
  • port 0 is refused.
    The editor passes every nf new option, so it is not affected.

Follow-up issues

Quality gate

Lane Result
Docs Updated (no-terminal rule on overview, create, registry, install)
Correctness Pass after 1 round: #319 now stops instead of warning; editor.mdx port error updated
Accessibility Pass (messages readable without color; NO_COLOR respected)
Security Pass. Minor fixed: registry.mdx points CI at the env-var form of --api-key
Performance Pass
Style Pass (lint). 3 Minor fixed in 172ef67

nf dev ran nf build --watch with its output collected, and collected output
only prints when the child exits non-zero, which a watch build never does.
Both sub-commands now inherit the terminal.

Closes #306
…ates

TypeScript 6 rejects esModuleInterop: false with TS5107 and stops before
checking anything, so a fresh TypeScript project failed tsc --noEmit.

Refs #308
nf build writes to dist/ by default, and only the workspace template
ignored it, so a single-app project showed its build in git status.

Closes #312
…gents.md

AGENTS.md hard-coded ^2 while package.json gets the version resolved at
generation time (^3.0.0 today).

Closes #313
dotenv 17+ prints "injected env (0) from .env" on every load, even with no
.env file.

Closes #314
The url was wrapped in a hard-coded ansi escape, shown even with NO_COLOR,
in pipes and in log files.

Closes #315
- a missing config suggests -d, not a --config option no command reads;
- an unreachable registry no longer suggests REGISTRY_URL, which the build
  inlines;
- a missing manifest suggests a package folder, not a syntax fix.

Closes #316
- an unexpected error prints its message, and the stack trace only with
  NF_DEBUG set;
- a bad nf editor port is an InvalidCommandArgumentError, not a plain error;
- nf new checks --language and --package-manager with commander choices,
  before the schematics run.

Closes #309
nf start -p abc reached Bun.serve, which crashed with a raw RangeError.
The port, from --port or the config, now goes through the same check as
nf editor and fails with an InvalidCommandArgumentError and exit code 1.

Closes #310
nf start served an empty loader with no hint when the build folder was
missing. It now prints a warning naming the folder and 'nf build'. Under
--watch (nf dev) the build creates the folder alongside, so it does not warn.

Closes #319
… nothing

Both options are accepted but read by nothing: the help now says so, as the
nf new docs already do.

Refs #317
"unpublish a package from", "add editor dependencies", and NanoForge in
the login, logout, publish, unpublish, new and install texts. The issue
template's casing (.github) is left for another change.

Refs #320
nf create component --name '2d sprite' wrote class 2dSpriteComponent, which
does not parse. The name must now be letters, digits, '-' and '_', starting
with a letter, and is checked before anything is written.

Closes #318
…inal

With stdin not a terminal, nf new, nf create, nf login and nf install
printed a question and exited 1 with no message. The questions now refuse
to prompt, and the input that asked names the option to pass, e.g.
"--name is required when not running in a terminal."

Closes #311
The README of nf create plugin covered the dev loop and a manual install,
not nf publish.

Refs #321
- drop the DEV_PLUGINS notes: the shipped editor 1.0.0 reads it;
- drop the link to the private API repo;
- say what part does in the component and system schematics;
- name the import to replace in the components guide.

Closes #321
- add the rule to the commands overview;
- name the option to pass in create, login and install.
Without --watch, a missing output folder is now a CLIError, as #319 asks, instead of a warning
above an empty loader. --watch still skips the check: nf dev builds alongside.

Closes #319
@github-actions github-actions Bot added documentation Improvements or additions to documentation command:new Related to new command command:start Related to start command command:dev Related to dev command command:login Related to login command command:logout Related to logout command command:publish Related to publish command command:unpublish Related to unpublish command command:editor Related to editor command lib:schematics Related to the @nanoforge-dev/schematics library labels Nov 22, 2026
@Exeloo
Exeloo merged commit 3be3ada into main Nov 22, 2026
11 checks passed
@Exeloo
Exeloo deleted the fix/testing-polish branch November 22, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment