Skip to content

fix(tarko): handle CLI parameter order for agent argument - #1169

Merged
ulivz merged 5 commits into
mainfrom
fix/tarko-agent-cli-parameter-handling
Aug 17, 2025
Merged

fix(tarko): handle CLI parameter order for agent argument#1169
ulivz merged 5 commits into
mainfrom
fix/tarko-agent-cli-parameter-handling

Conversation

@ulivz

@ulivz ulivz commented Aug 17, 2025

Copy link
Copy Markdown
Member

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 runargs = ['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:

$ tarko run ./agent1.js --agent ./agent2.js
Warning: Both positional agent './agent1.js' and --agent flag './agent2.js' provided. Using positional agent './agent1.js'.

Checklist

  • Added or updated necessary tests (Optional).
  • Updated documentation to align with changes (Optional).
  • Verified no breaking changes, or prepared solutions for any occurring breaking changes (Optional).
  • My change does not involve the above items.

Fix parameter handling when using --agent flag with default run command
@netlify

netlify Bot commented Aug 17, 2025

Copy link
Copy Markdown

Deploy Preview for agent-tars-docs ready!

Name Link
🔨 Latest commit 1abef6e
🔍 Latest deploy log https://app.netlify.com/projects/agent-tars-docs/deploys/68a268e58fee2400083699df
😎 Deploy Preview https://deploy-preview-1169--agent-tars-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

ulivz added 4 commits August 18, 2025 07:32
…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
@ulivz
ulivz merged commit 2acb378 into main Aug 17, 2025
10 checks passed
@ulivz
ulivz deleted the fix/tarko-agent-cli-parameter-handling branch August 17, 2025 23:44
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