Skip to content

Conversation

@brooksmtownsend
Copy link
Member

Summary

This implementation adds OCI reference support to the wash plugin test command, following the same pattern as the existing wash inspect command. The command now supports three types of input:

  • File paths: Direct .wasm file paths (existing behavior)
  • Project directories: Directories with project files that can be built (existing behavior)
  • OCI references: Remote container registry references like ghcr.io/wasmcloud/plugin:latest (new feature)

Changes Made

  • Updated TestCommand.plugin field from PathBuf to String to handle OCI references
  • Added OCI pull functionality with caching support using existing infrastructure
  • Enhanced input detection logic following the exact pattern from inspect command
  • Added comprehensive error handling for different input types
  • Updated integration tests to work with new String type
  • Added debug logging for better troubleshooting

Test Plan

  • Tested with file path input: ./plugins/inspect/target/wasm32-wasip1/release/inspect.wasm
  • Tested with directory input: ./plugins/inspect (builds and runs)
  • Tested with OCI reference: ghcr.io/wasmcloud/components/http-hello-world-rust:0.1.0
  • Tested with non-existent OCI reference (proper error handling)
  • All existing tests pass
  • Code formatted with cargo +nightly fmt
  • Code passes cargo clippy checks

Example Usage

After this implementation, users can run:

# File path (existing)
wash plugin test ./my-plugin.wasm --hook pre_invoke

# Directory (existing)  
wash plugin test ./plugin-project --hook pre_invoke

# OCI reference (new)
wash plugin test ghcr.io/wasmcloud/plugin-example:latest --hook pre_invoke

Implementation Notes

This implementation reuses the existing OCI client infrastructure from the inspect command, including:

  • OCI authentication (docker credentials, explicit credentials, anonymous)
  • Local caching for performance
  • Proper error handling and user feedback

The change maintains backward compatibility - all existing use cases continue to work exactly as before.

Resolves #14

🤖 Generated with Claude Code

brooksmtownsend and others added 2 commits August 27, 2025 12:33
Signed-off-by: Brooks Townsend <brooks@cosmonic.com>
This implementation follows the same pattern as the `wash inspect` command
to support different input types for the `wash plugin test` command:

- **File**: Direct .wasm file path (existing behavior)
- **Directory**: Project directory with build capability (existing behavior)
- **OCI Reference**: Remote container registry references (new feature)

Changes made:
- Updated TestCommand.plugin field from PathBuf to String to handle OCI refs
- Added OCI pull functionality with caching support
- Enhanced error handling for different input types
- Updated integration tests to work with new String type
- Added debug logging for better troubleshooting

The implementation reuses existing OCI infrastructure from the inspect
command and maintains backward compatibility for file and directory inputs.

Resolves wasmCloud#14

🤖 Generated with [Claude Code](https://claude.ai/code)

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

Support OCI references in plugin test command

1 participant