Skip to content

Project Tom Hagen: bind positional arguments - #27

Merged
cowboyd merged 3 commits into
mainfrom
project-tom-hagen-arguments
Sep 23, 2026
Merged

cowboyd merged 3 commits into
mainfrom
project-tom-hagen-arguments

Conversation

@cowboyd

@cowboyd cowboyd commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Configliere could bind named options but had no public positional-argument definition. Adding positional readers also exposes a real ambiguity: an argument must not steal the value belonging to an option merely because the argument was declared first.

Positional arguments need to preserve route segmentation, source precedence, validation, exact model inference, and useful help output.

Approach

Model positional arguments as ordinary parameters with a CLI reader, not as a separate parsing subsystem. Route selectors are still resolved first, so a visible command word cannot be consumed as data. Within the selected route segment, every unresolved reader proposes a claim against the same immutable token view; the binder commits the claim beginning earliest in argv, with declaration order breaking exact ties, then asks all remaining readers again.

This claim-arbitration model prevents positional arguments from stealing option values without teaching the binder about particular reader kinds. Failed reads retain ownership of the tokens they captured, and tokens settled in an earlier phase are never reinterpreted after dynamic expansion. Arguments otherwise follow the same route scoping, source precedence, decoding, validation, and model inference as options. Declarative syntax metadata lets help render arguments without executing or reverse-engineering their readers.

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/configliere@27

commit: bf59fe7

@cowboyd
cowboyd force-pushed the project-tom-hagen-arguments branch from 7ea47ca to 00f9d3e Compare September 9, 2026 01:21
@cowboyd
cowboyd force-pushed the project-tom-hagen-arguments branch 2 times, most recently from 303561a to 2417ae7 Compare September 9, 2026 01:54
@cowboyd
cowboyd force-pushed the project-tom-hagen-arguments branch from 2417ae7 to a45b729 Compare September 9, 2026 03:23
@cowboyd
cowboyd force-pushed the project-tom-hagen-arguments branch 4 times, most recently from 6908fe9 to 751c42e Compare September 23, 2026 15:03
Base automatically changed from project-tom-hagen-fold to main September 23, 2026 15:04
@cowboyd
cowboyd force-pushed the project-tom-hagen-arguments branch from 751c42e to bf59fe7 Compare September 23, 2026 15:04
@cowboyd
cowboyd merged commit 43a4f77 into main Sep 23, 2026
4 checks passed
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.

1 participant