Skip to content

Comments

Add vws generate-vumark command#1968

Open
adamtheturtle wants to merge 3 commits intomainfrom
adamtheturtle/add-vumark-support
Open

Add vws generate-vumark command#1968
adamtheturtle wants to merge 3 commits intomainfrom
adamtheturtle/add-vumark-support

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 19, 2026

Summary

Adds a vws generate-vumark CLI command that wraps VWS.generate_vumark_instance() from vws-python (VWS-Python/vws-python#2858). The command accepts a target ID, instance ID, and output format (PNG/SVG/PDF, defaulting to PNG), and writes the generated VuMark image bytes to a file.

Error handling covers invalid instance IDs, targets not in the success state, unknown targets, and authentication failures. Tests use the existing MockVWS/VuforiaDatabase fixtures and will pass once the vws-python PR is merged and the dependency is updated.

🤖 Generated with Claude Code


Note

Medium Risk
Adds a new CLI surface that performs network calls and writes binary output to disk; risk is mainly around dependency/API behavior and error mapping, but existing commands remain unchanged.

Overview
Adds a new vws generate-vumark command that calls VWS.generate_vumark_instance() with --target-id, --instance-id, --format (png/svg/pdf, default png), --output, plus base URL and timeout options, and writes the returned bytes to a file.

Introduces VuMark-specific exception handling to convert common API failures (unknown target, target not processed, invalid instance id, auth/request errors) into user-facing stderr messages with exit code 1, and updates CLI help snapshots and adds end-to-end tests covering formats, defaults, and failure cases.

Written by Cursor Bugbot for commit 6797d9a. This will update automatically on new commits. Configure here.

adamtheturtle and others added 2 commits February 19, 2026 09:30
Implement `vws generate-vumark` command for generating VuMark instances from VuMark targets. The command accepts a target ID, instance ID, and output format (SVG/PNG/PDF), and writes the generated VuMark to a file. Includes comprehensive error handling for invalid instance IDs, quota limits, and missing targets, plus full test coverage and help text regression files.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Use VWS.generate_vumark_instance() instead of a separate VuMarkService,
align the VuMarkAccept enum and exception names with the actual API
(InvalidInstanceIdError, TargetStatusNotSuccessError), and update tests
to use existing MockVWS fixtures rather than a hypothetical MockVuMarkWS.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

),
}

return exc_type_to_message[type(exc)]
Copy link

Choose a reason for hiding this comment

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

Unhandled VWS exceptions cause KeyError crash

Medium Severity

The _handle_vumark_exceptions context manager catches all VWSError subclasses, but _get_vumark_error_message only maps a small subset of exception types. Exceptions like ProjectInactiveError, ProjectSuspendedError, RequestQuotaReachedError, and ProjectHasNoAPIAccessError would be caught but have no entry in exc_type_to_message, causing a KeyError crash instead of a user-friendly error message. The existing _get_error_message in commands.py handles these cases.

Additional Locations (1)

Fix in Cursor Fix in Web

show_default=True,
)

return click_option_function(command)
Copy link

Choose a reason for hiding this comment

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

Duplicated _base_vws_url_option function across two files

Low Severity

_base_vws_url_option in vumark.py is an exact duplicate of the same function in commands.py (lines 119–130). Having two identical private copies risks them diverging when one is updated without the other. This could be extracted into a shared options module (similar to how server_access_key_option lives in vws_cli.options.credentials).

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.

1 participant