Skip to content

Add json input support for script arguments#21

Draft
BlakeASmith wants to merge 1 commit intomainfrom
cursor/add-json-input-support-for-script-arguments-9ab0
Draft

Add json input support for script arguments#21
BlakeASmith wants to merge 1 commit intomainfrom
cursor/add-json-input-support-for-script-arguments-9ab0

Conversation

@BlakeASmith
Copy link
Contributor

Add support for JSON input via a --json-input option or stdin, allowing users to provide script parameters as a structured object for easier automation.

This feature introduces a custom ArgumentParser to dynamically handle required arguments when JSON input is present, ensuring that JSON-provided values correctly satisfy script requirements. It also includes an opt-out directive (# argorator: no-json-input) and updates the help text to guide users on JSON input usage.


Open in Cursor Open in Web

Co-authored-by: blakeinvictoria <blakeinvictoria@gmail.com>
@cursor
Copy link

cursor bot commented Aug 26, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot free trial expires on September 9, 2025
Learn more in the Cursor dashboard.

return 2
assignments[name] = str(value)
elif value is not None:
assignments[name] = str(value)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: JSON Input Bypasses Required Argument Validation

The validation for required variables and positional arguments is bypassed when JSON input is provided. The condition if value is None and not json_data prevents errors if json_data is truthy, even if a specific required argument is missing from the JSON. This allows scripts to run with undefined variables, potentially causing shell script failures.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

2 participants