Repository navigation
fix!: reject positional arguments on a command without an args schema - #21
Merged
Merged
Conversation
A command without an args schema passed stray positional arguments to its action without validation. It now throws a ZodlineError that names the first one. A command that reads positional arguments declares an args schema. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
Deploy preview available at: https://39067975.zodline-page.pages.dev. Built with commit 8b05984. |
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.
A command without an
argsschema passed stray positional arguments to itsactionas a rawstring[], without validation. A line such asmy-cli login aliceranlogin, and nothing said thatalicewas ignored.Now such a command takes no positional arguments.
processConfigthrows aZodlineErrorthat names the first one:my-cli login alice # Unexpected argument: aliceThis is the rule unknown options already follow: a command without an options schema rejects every flag.
processCommandExecutionrejects the first positional argument when the command declares noargs.z.array(z.string())takes them as before.argswas alreadyundefinedwithout a schema, so the runtime now matches the type.CLAUDE.mdstate the rule.Breaking: a command that reads
argswithout a schema must declare one.BREAKING.mdhas the section for 0.4.0.This goes together with #19. There a boolean flag takes no value, so a word after it is positional. On a command without
argsthat word is now an error and no longer dropped. The branch merges cleanly with #19 and #20, and the tests of all three pass together.🤖 Generated with Claude Code