feat(cli): add vlmrun artifacts subcommand#195
Conversation
Add `vlmrun artifacts get` CLI command to download artifacts by object_id with either --session-id or --execution-id. Supports --output for custom save path and --raw for raw bytes. Wraps the existing client.artifacts.get() method. Co-Authored-By: Sudeep Pillai <sudeep.pillai@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
🚩 Mock Artifacts.get always returns bytes — only the raw_response=True path is tested
The mock Artifacts.get in tests/conftest.py:750-765 always returns b'mock artifact content' regardless of the raw_response parameter. This means the tests only exercise the isinstance(result, bytes) branch (line 104) and the _write_to_output bytes path (line 160-161). The Path branch (line 110), the PIL Image fallback (line 124), and the corresponding _write_to_output branches for Path (line 162-165) and PIL Image (line 167-168) are never tested. This is a gap in test coverage for the new feature.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
||
| # No explicit output — display what the SDK returned | ||
| if isinstance(result, bytes): | ||
| if output is None: |
There was a problem hiding this comment.
🟡 Redundant if output is None: guard is always True — dead code
At line 86, the code checks if output is not None: and returns at line 101. By the time execution reaches line 105, output is guaranteed to be None. The if output is None: check on line 105 is therefore always True and serves no purpose. While it doesn't cause incorrect behavior, it suggests an incomplete refactoring and could mislead future developers into thinking there's a code path where output is not None past line 101.
| if output is None: | |
| console.print( |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds the missing
vlmrun artifacts getCLI subcommand that wraps the existingclient.artifacts.get()method.The command validates that exactly one of
--session-id/--execution-idis provided, delegates toclient.artifacts.get(), and handles the heterogeneous return types (PIL Image → saves as JPEG,Path→ copies,bytes→ writes directly). Without--output, files are saved to the SDK's default artifact cache (~/.vlmrun/cache/artifacts/<id>/).Registered as
app.add_typer(artifacts_app, name="artifacts")incli.py, matching the pattern used byfiles,executions,skills, etc.Includes 6 CLI tests (
tests/cli/test_cli_artifacts.py) using the existingmock_clientfixture.Link to Devin session: https://app.devin.ai/sessions/e5919db7748c40d7a5a4194cb59f487a
Requested by: @spillai