Skip to content

chore(main): release bargs 0.1.0#1

Merged
boneskull merged 1 commit intomainfrom
release-please--branches--main--components--bargs
Dec 31, 2025
Merged

chore(main): release bargs 0.1.0#1
boneskull merged 1 commit intomainfrom
release-please--branches--main--components--bargs

Conversation

@github-actions
Copy link
Contributor

🤖 I have created a release beep boop

0.1.0 (2025-12-31)

Features

  • add ANSI color utilities (2461dd0)
  • add automatic version detection from package.json (095e3b9)
  • add command parsing support (de8d15c)
  • add core parser for simple CLI (8539504)
  • add core type definitions (7e869e6)
  • add enum validation and array option support (4a5f7d8)
  • add enumPos helper, sync/async API, and positional validations (dbbb0d2)
  • add epilog option with terminal hyperlink support (ea876aa)
  • add error formatting with colorful output (30abaa1)
  • add help generator without Zod introspection (0ce72c8)
  • add help text generation with grouping and colors (f430cc4)
  • add main bargs() entry point with help and version support (2a8647c)
  • add main bargs() entry point without Zod (4bf84ad)
  • add named positionals for help text display (7068779)
  • add namespaced opt builder with composition (ffa628d)
  • add new parseSimple without Zod (e68907e)
  • add new Zod-free type definitions (25ecf8f)
  • add opt.positionals() for positional schema composition (ce5f5f8)
  • add parseCommands for command-based CLIs (f551c85)
  • add schema introspection for parseArgs config extraction (8d5b7e7)
  • bargs: add options parameter to sync bargs function (1644fd3)
  • bargs: add second parameter for runtime options (53f2ddf)
  • exports: add theme utilities to public API (f6cf728)
  • help: add positional argument display with theming (2711376)
  • help: add theme support to help generators (21d024c)
  • theme: add createStyler function (8926fba)
  • theme: add defaultText and make Theme properties optional (191bee2)
  • theme: add theme types and built-in themes (b6044bb)
  • types: add BargsOptions type for runtime options (ec6dfad)

Bug Fixes

  • help: fix named positionals in POSITIONALS section (5fe6b26)
  • resolve ESLint and linting errors (96fd12f)
  • resolve test failures from environment and removed exports (8f4a5ce)
  • use bargsAsync for theme option tests after sync/async split (c9b38c3)

This PR was generated with Release Please. See documentation.

@boneskull boneskull merged commit 465aa95 into main Dec 31, 2025
@boneskull boneskull deleted the release-please--branches--main--components--bargs branch December 31, 2025 00:16
@github-actions
Copy link
Contributor Author

🤖 Created releases:

🌻

boneskull added a commit that referenced this pull request Feb 4, 2026
- Rename `helpShown` to `earlyExit` for clarity (issue #4)
  The flag is now accurately named since it's set for help, version,
  and completion output, not just help display.

- Extract shared test helper `withCapturedStderr()` (issues #2, #3)
  Reduces code duplication in tests that capture stderr and exitCode.

- Handle HelpError in nested command delegation (issue #1)
  `__parseWithParentGlobals()` now catches HelpError so nested builders
  can render their own help instead of bubbling up to the parent.
boneskull added a commit that referenced this pull request Feb 4, 2026
* fix: catch HelpError and display help instead of throwing

When a HelpError is thrown (e.g., unknown command, no command specified),
`parse()` and `parseAsync()` now catch it and handle gracefully:

- Error message is printed to stderr
- Help text is displayed to stderr
- `process.exitCode` is set to 1 (no `process.exit()` call)
- Returns result with `helpShown: true` flag

This prevents HelpError from bubbling up to global exception handlers
while still providing useful feedback to the user.

Closes #31

* refactor: remove all process.exit() calls

Replace `process.exit()` with `process.exitCode` throughout `parseCore()`:

- `--help` now sets `process.exitCode = 0` and returns `{ helpShown: true }`
- `--version` now sets `process.exitCode = 0` and returns `{ helpShown: true }`
- `--completion-script` now sets appropriate exit code and returns
- `--get-bargs-completions` now sets exit code and returns
- `showNestedCommandHelp()` now returns a result instead of calling exit

This allows the process to terminate naturally, enabling proper cleanup
handlers and making the code more testable and composable.

* fix: address review comments

- Rename `helpShown` to `earlyExit` for clarity (issue #4)
  The flag is now accurately named since it's set for help, version,
  and completion output, not just help display.

- Extract shared test helper `withCapturedStderr()` (issues #2, #3)
  Reduces code duplication in tests that capture stderr and exitCode.

- Handle HelpError in nested command delegation (issue #1)
  `__parseWithParentGlobals()` now catches HelpError so nested builders
  can render their own help instead of bubbling up to the parent.

* fix: use process.exit() for early exit scenarios

Restore standard CLI behavior where --help, --version, completion flags,
and error conditions (unknown/missing commands) terminate the process.

Changes:
- `exitProcess()` calls `process.exit()` for help/version/completions
- `handleHelpError()` calls `process.exit(1)` after displaying help
- Remove `earlyExit` flag from return types (no longer needed)
- Update tests to mock `process.exit` instead of checking return values
- Document process termination behavior in README.md

This is what users expect from a CLI - these flags print output and exit.

* refactor: extract shared test helper for mocking process.exit

Address review feedback:
- Extract `MockExitError` and `withMockedExit` to `test/helpers/mock-exit.ts`
- Use `Promise.resolve().then(fn)` to handle any thenable, not just Promise
- Consolidate duplicate JSDoc blocks for `handleHelpError`
- Update README example to use sentinel error and `finally` block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant