Skip to content

Refactor argument types with base class#35

Open
BlakeASmith wants to merge 1 commit intomainfrom
cursor/CLI-30-refactor-argument-types-with-base-class-de46
Open

Refactor argument types with base class#35
BlakeASmith wants to merge 1 commit intomainfrom
cursor/CLI-30-refactor-argument-types-with-base-class-de46

Conversation

@BlakeASmith
Copy link
Contributor

Implement an argument type class system to replace string-based type handling for improved extensibility and validation (CLI-30).

This PR introduces BaseArgumentType and its subclasses (e.g., StringType, IntType, ChoiceType) to manage argument types. This refactors the previous string-based if/else chains, allowing each type to define its annotation strings, argparse type, and custom validation logic, making the system more robust and easier to extend.


Linear Issue: CLI-30

Open in Cursor Open in Web

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

cursor bot commented Aug 27, 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

@BlakeASmith BlakeASmith marked this pull request as ready for review August 27, 2025 07:06
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.

except ValueError as e:
# Skip invalid annotations, or raise depending on desired behavior
print(f"Warning: Invalid annotation for {var_name}: {e}")
continue
Copy link

Choose a reason for hiding this comment

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

Bug: Choice Validation Breaks Backward Compatibility

The new validation for choice type annotations breaks backward compatibility. Annotations like # VAR (choice): Description (without explicit choices) now fail validation and are skipped, changing behavior for existing valid annotations. Additionally, validation errors are printed directly to stdout, which isn't standard for a library.

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