fix(tarko): handle CLI parameter order for agent argument - #1169
Merged
Conversation
Fix parameter handling when using --agent flag with default run command
✅ Deploy Preview for agent-tars-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ters Replace fixed parameter handling with dynamic args processing to correctly handle CAC behavior with optional positional parameters [run] [agent]
Simplify to directly access args[length-2] for agent and args[length-1] for options based on actual CAC parameter passing pattern
Warn users when both positional agent and --agent flag are provided, clarifying that positional argument takes precedence
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.
Summary
Fix CLI parameter handling issue where
tarko --agent ./command failed due to incorrect parameter order processing in the run command action handler after PR #1158.Problem: After PR #1158 introduced new CLI command structure, the
tarko --agent ./syntax stopped working because the CLI argument parsing incorrectly handled CAC's dynamic parameter passing for optional positional parameters[run] [agent].Root Cause: CAC library passes arguments in a specific pattern for optional positional parameters:
tarko --agent ./→args = [undefined, undefined, cliArguments]tarko run→args = ['run', undefined, cliArguments]tarko run ./→args = ['run', './', cliArguments]tarko ./→args = [undefined, './', cliArguments]Supported Syntax:
tarko --agent ./(legacy syntax) ✅tarko run ./(new syntax) ✅tarko ./(simplified syntax) ✅Warning Example:
Checklist