Skip to content

feat: Support POSIX-style short-flag bundling in CLI parser#1047

Merged
yamcodes merged 5 commits into
mainfrom
1032-support-posix-style-short-flag-bundling-in-cli-parser-1
May 21, 2026
Merged

feat: Support POSIX-style short-flag bundling in CLI parser#1047
yamcodes merged 5 commits into
mainfrom
1032-support-posix-style-short-flag-bundling-in-cli-parser-1

Conversation

@yamcodes
Copy link
Copy Markdown
Owner

Fixes #1032

Enables POSIX-style combined short-flags (e.g., -yfq -> -y, -f, -q) in CLI commands, and preserves values starting with - immediately following value-taking flags (like -e/--example and -n/--name).

@yamcodes yamcodes added enhancement New feature or request @arkenv/cli Issues or Pull Requests involving the ArkEnv CLI labels May 21, 2026
@yamcodes yamcodes linked an issue May 21, 2026 that may be closed by this pull request
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: 8b4fdd8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@arkenv/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added docs Improvements or additions to documentation tests This issue or PR is about adding, removing or changing tests labels May 21, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 21, 2026

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1047

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1047

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@1047

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1047

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1047

commit: 8b4fdd8

@arkenv-bot
Copy link
Copy Markdown
Contributor

arkenv-bot Bot commented May 21, 2026

📦 Bundle Size Report

No results found

All size limits passed!

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

One parser edge case should be fixed before merging: bundled -e does not inherit dash-prefixed value preservation.

Reviewed changes — This PR adds short-flag bundle expansion to the @arkenv/cli argument parser while keeping the existing init command surfaces.

  • Expand bundled boolean flagsCLI now rewrites short bundles such as -yq and -yfq into individual short flags before validation.
  • Preserve raw value followers — The parser attempts to avoid expanding the token after raw value-taking flags such as -e/--example.
  • Cover parser behaviorpackages/cli/src/cli/cli.test.ts adds cases for bundled flags, positional names, and dash-prefixed followers.
  • Release note.changeset/posix-flag-bundling.md records a minor @arkenv/cli change.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT𝕏

Comment thread packages/cli/src/cli/cli.ts
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog Bot commented May 21, 2026

Addressed review #4336035989 by preserving dash-prefixed values after bundled value-taking flags and adding a regression test for -yqe -abc. Pushed commit 2e4a74d to PR #1047, replied to the review thread, and resolved it. Checks passed: pnpm --filter @arkenv/cli exec vitest run src/cli/cli.test.ts, pnpm --filter @arkenv/cli typecheck, and pnpm exec biome check packages/cli/src/cli/cli.ts packages/cli/src/cli/cli.test.ts.

Task list (8/8 completed)
  • Checkout PR 1047 branch
  • Fetch and read review 4336035989 comments
  • Verify each review finding against the code
  • Apply minimal warranted fixes
  • Run targeted quality checks and review diff
  • Commit and push fixes to PR branch
  • Reply to and resolve addressed review threads
  • Report final progress

Pullfrog  | View workflow run | via Pullfrog | Using GPT𝕏

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — Since the prior Pullfrog review, this PR changed only the @arkenv/cli release classification for the short-flag bundling feature.

  • Downgraded @arkenv/cli changeset bump.changeset/posix-flag-bundling.md now marks the change as a patch release instead of minor, which is consistent with existing pre-1.0 CLI changelog precedent for non-breaking capability additions.

Pullfrog  | View workflow run | Using GPT𝕏

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest refactor breaks bundled short flags at runtime because the expansion path references a removed flag set.

Reviewed changes — Since the prior Pullfrog review, this PR fixed bundled -e value preservation and centralized CLI flag metadata while keeping the init parser surface unchanged.

  • Preserved bundled value followers — Bundles ending in -e, such as -yqe, now carry the same next-token preservation rule as raw -e/--example.
  • Centralized parser flag definitionsCLI now derives known and value-taking flags from FLAG_CONFIG instead of duplicating those lists in the constructor.
  • Converted flag state to gettersisAgent, isYes, isQuiet, isJson, isForce, helpRequested, and example now read from parsed args dynamically, with agent mode still implying yes/quiet/json.
  • Expanded parser coveragepackages/cli/src/cli/cli.test.ts now covers --agent/-a preset behavior and dash-prefixed followers after bundled value-taking flags.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT𝕏

Comment thread packages/cli/src/cli/cli.ts Outdated
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog Bot commented May 21, 2026

INFO 2026-05-21T11:14:01 +17ms service=bus type=session.updated publishing
INFO 2026-05-21T11:14:01 +133ms service=provider init
INFO 2026-05-21T11:14:01 +6ms service=bus type=session.status publishing
INFO 2026-05-21T11:14:01 +1ms service=session.prompt session.id=ses_1b5c1f1b2ffee1u3tO4oEqD4ct step=0 loop
INFO 2026-05-21T11:14:01 +31ms service=provider providerID=opencode found
INFO 2026-05-21T11:14:01 +1ms service=provider status=completed duration=200 state
INFO 2026-05-21T11:14:01 +3ms service=bus type=session.error publishing
INFO 2026-05-21T11:14:01 +1ms service=bus type=session.status publishing
INFO 2026-05-21T11:14:01 +0ms service=bus type=session.idle publishing
ERROR 2026-05-21T11:14:01 +1ms service=server error= cause=ProviderModelNotFoundError:
at (/$bunfs/root/chunk-f3e32eg8.js:571:61241)
at SessionPrompt.getModel (/$bunfs/root/chunk-fxray38w.js:1894:1693)
at SessionPrompt.getModel (definition) (/$bunfs/root/chunk-fxray38w.js:1893:1092)
at SessionPrompt.run (/$bunfs/root/chunk-fxray38w.js:1895:1386)
at SessionPrompt.run (definition) (/$bunfs/root/chunk-fxray38w.js:1894:926)
at SessionRunState.ensureRunning (/$bunfs/root/chunk-fxray38w.js:1895:1355)
at SessionRunState.ensureRunning (definition) (/$bunfs/root/chunk-fxray38w.js:10:43043)
at SessionPrompt.loop (/$bunfs/root/chunk-fxray38w.js:1894:643)
at SessionPrompt.loop (definition) (/$bunfs/root/chunk-fxray38w.js:1895:1291)
at SessionPrompt.prompt (/$bunfs/root/chunk-te7madgp.js:9:23412)
at SessionPrompt.prompt (definition) (/$bunfs/root/chunk-fxray38w.js:1894:250) failed
ERROR 2026-05-21T11:14:01 +3ms service=share-next type=message.updated cause={"_id":"Cause","failures":[{"_tag":"Fail","error":{"providerID":"opencode","modelID":"minimax-m2.5-free","suggestions":["deepseek-v4-flash-free","nemotron-3-super-free","qwen3.6-plus-free"],"_tag":"ProviderModelNotFoundError"}}]} share subscriber failed
INFO 2026-05-21T11:14:01 +2ms service=default directory=/home/runner/work/arkenv/arkenv disposing instance
INFO 2026-05-21T11:14:01 +2ms service=bus type=* unsubscribing
INFO 2026-05-21T11:14:01 +1ms service=bus type=session.updated unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=message.updated unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=message.part.updated unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=session.diff unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=session.deleted unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=command.executed unsubscribing
INFO 2026-05-21T11:14:01 +0ms service=bus type=file.watcher.updated unsubscribing

Pullfrog  | Rerun failed job ➔View workflow run | via Pullfrog | Using MiniMax M2.5 (free) (credentials for OpenAI not configured) | 𝕏

@yamcodes yamcodes merged commit b2e4865 into main May 21, 2026
16 checks passed
@yamcodes yamcodes deleted the 1032-support-posix-style-short-flag-bundling-in-cli-parser-1 branch May 21, 2026 11:37
@arkenv-bot arkenv-bot Bot mentioned this pull request May 21, 2026
yamcodes pushed a commit that referenced this pull request May 21, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @arkenv/cli@0.2.1

### Patch Changes

- #### Fix --help table alignment
_[`#1052`](#1052)
[`cf7bd02`](cf7bd02)
[@yamcodes](https://github.com/yamcodes)_

- #### Support POSIX-style short-flag bundling in CLI parser
_[`#1047`](#1047)
[`b2e4865`](b2e4865)
[@yamcodes](https://github.com/yamcodes)_

Enables combining multiple short flags (e.g. `-yq` instead of `-y -q` or
`-yfq` instead of `-y -f -q`) in CLI commands. Flag values starting with
`-` (e.g. `init -e -abc`) are preserved without expansion.

- #### Validate valued CLI flags and reject missing values
_[`#1051`](#1051)
[`dec2581`](dec2581)
[@yamcodes](https://github.com/yamcodes)_

Add parser-level validation to reject flags that require a value (e.g.
`--example` or `-e`) when they are passed without one. A validation
error message is set, and the CLI exits with status code 1.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/cli Issues or Pull Requests involving the ArkEnv CLI docs Improvements or additions to documentation enhancement New feature or request tests This issue or PR is about adding, removing or changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support POSIX-style short-flag bundling in CLI parser

1 participant