## Fix: support unquoted --flags in wrap commands for effect/unstable/cli#625
Open
jfet97 wants to merge 2 commits intor/effect-v4-2from
Open
## Fix: support unquoted --flags in wrap commands for effect/unstable/cli#625jfet97 wants to merge 2 commits intor/effect-v4-2from
jfet97 wants to merge 2 commits intor/effect-v4-2from
Conversation
The new effect/unstable/cli lexer classifies --flags as LongOption tokens and discards unrecognized ones. This patch auto-inserts "--" after wrap-enabled subcommands so that `effect-app-cli index-multi tsc --build` works without quoting, maintaining backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new
effect/unstable/clilexer tokenizes all--flagsasLongOptiontokens upfront, at the lexer level, before any command routing happens. When a subcommand likepackagejsonorindex-multireceives args liketsc --build, the lexer classifies--buildas aLongOption. The subcommand parser then discards it as an unrecognized flag — unlike the old@effect/cliwhich treated unrecognized flags as positional args.Why
--doesn't work: the lexer splits on--at the top level, putting everything after it intotrailingOperands. But these operands stay at the parent command level and don't propagate down to the subcommand's argument parser.Solution: an argv pre-processor joins all args after a wrap-enabled subcommand (
index-multi,packagejson,packagejson-packages) into a single string element before the CLI parser runs. The lexer sees oneValuetoken (e.g."tsc --build") instead ofValue("tsc") + LongOption("build"). The wrap handler already passes this string tosh -c, so the shell handles the splitting correctly.No changes needed in consumer projects (macs-scanner, configurator, signalznow).
Tests