Skip to content

Add CLI subcommands and command-specific help - #332

Merged
bcomnes merged 7 commits into
masterfrom
cli-subcommands
Sep 16, 2026
Merged

bcomnes merged 7 commits into
masterfrom
cli-subcommands

Conversation

@bcomnes

@bcomnes bcomnes commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

Partition the CLI by operation while keeping a bare domstack invocation as a one-shot build. Add command-specific help and strict option validation without introducing dependencies or changing the underlying build, watch, serve, and eject behavior.

  • Add domstack build as an explicit alias for the default build.
  • Add domstack watch for builds with watching and live reload, with --no-serve for watch-only operation.
  • Add domstack serve to build once and serve production output without watching or live reload; keep --port exclusive to this command.
  • Add domstack eject with its own --src, --language, and --yes options.
  • Support both <command> --help and help <command; root help lists commands and default-build options.
  • Keep node:util.parseArgs responsible for parsing and validation, and argsclopts responsible for help formatting, using shared command schemas under lib/cli.
  • Update the CLI reference, quick start, and related documentation.

Compatibility and validation behavior

Existing root-level --watch/-w, --watch-only, --serve, and --eject/-e remain supported as shortcuts. Normalize them into commands and validate against the selected command schema, rather than accepting unrelated options silently.

Explicit commands must precede their options. Irrelevant options and conflicting legacy modes now fail with concise usage errors and a help hint. In particular, --watch combined with --watch-only is rejected, and legacy mode flags are not accepted after an explicit command.

Tests

Add parser coverage for command selection, short-option groups, repeated options, command names used as option values, compatibility shortcuts, conflicts, and help routing. Add integration coverage for side-effect-free help/version, real builds, eject behavior, watch rebuilds, HTTP serving without live-reload injection, and SIGTERM cleanup.

Validation rerun after rebasing onto master:

  • node --test --test-reporter=spec: 469 passed, 0 failed, 2 TODO.
  • npx tsc --noEmit: passed.
  • npm run test:neostandard: passed.
  • git diff --check: passed.

@coveralls

coveralls commented Sep 16, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 35155258354

Coverage increased (+0.7%) to 96.576%

Details

  • Coverage increased (+0.7%) from the base build.
  • Patch coverage: 306 of 306 lines across 5 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 10583
Covered Lines: 10360
Line Coverage: 97.89%
Relevant Branches: 3347
Covered Branches: 3093
Branch Coverage: 92.41%
Branches in Coverage %: Yes
Coverage Strength: 527.2 hits per line

💛 - Coveralls

@bcomnes
bcomnes marked this pull request as ready for review September 16, 2026 21:55
@bcomnes
bcomnes merged commit 1ec8a68 into master Sep 16, 2026
10 checks passed
@bcomnes
bcomnes deleted the cli-subcommands branch September 16, 2026 22:07
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.

2 participants