{"id":26816214,"url":"https://github.com/moosync/moodriver","last_synced_at":"2025-03-30T03:18:23.286Z","repository":{"id":282641930,"uuid":"949217123","full_name":"Moosync/moodriver","owner":"Moosync","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-25T23:18:39.000Z","size":118,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T00:28:04.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Moosync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-15T23:49:50.000Z","updated_at":"2025-03-25T23:18:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"e42b7f08-7616-4ef4-8c89-f6106ccc0628","html_url":"https://github.com/Moosync/moodriver","commit_stats":null,"previous_names":["moosync/moodriver"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moosync%2Fmoodriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moosync%2Fmoodriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moosync%2Fmoodriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moosync%2Fmoodriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moosync","download_url":"https://codeload.github.com/Moosync/moodriver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246269907,"owners_count":20750321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-30T03:18:22.805Z","updated_at":"2025-03-30T03:18:23.281Z","avatar_url":"https://github.com/Moosync.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moodriver\n\nThis CLI tool allows testing of Moosync WASM extensions by:\n1. Loading and initializing extensions\n2. Sending commands to extensions\n3. Handling UI requests from extensions\n\n## Installation\n\n```bash\ncargo install --git https://github.com/Moosync/moodriver\n```\n\n## Usage\n\n```\nUsage: moodriver [OPTIONS] \u003cWASM\u003e\n\nArguments:\n  \u003cWASM\u003e  Path to the wasm directory\n\nOptions:\n  -t, --trace \u003cTRACE\u003e  Path to the trace file\n  -d, --dir \u003cDIR\u003e      Path to the trace directory\n  -v, --verbose...\n  -h, --help           Print help\n  -V, --version        Print version\n```\n\n```bash\nmoodriver -t ./traces/sample_trace.json ./ext.wasm\n```\n\n```bash\nmoodriver -v -t ./traces/sample_trace.json ./ext.wasm\n```\n\n```bash\nmoodriver -vv -t ./traces/sample_trace.js ./ext.wasm\n```\n\n## Writing traces\n\nThere are 2 components to a trace file:\n1. **Commands**\n2. **Requests**\n\n### Commands\nCommands are used to simulate user actions as they would happen in Moosync.\n\nFor example, you can send a command \"seeked\" to the extension to simulate an action of seeking a song. The below example of a command means that the song was seeked to position 0.\nThe expected property defines what is an appropriate response that should be received by the extension. In this case, the extension should respond with a null since \"seeked\" events expects no return value.\n```json\n{\n  \"type\": \"seeked\",\n  \"data\": [0],\n  \"expected\": null\n}\n```\n\nLets consider another example of the command \"getProviderScopes\". We want our extension to respond with the scopes \"scrobbles\" and \"accounts\". Some commands like this require passing a package name to the command.\nThe below trace expects the extension to respond with the scopes \"scrobbles\" and \"accounts\" for the command.\n\n```json\n{\n  \"type\": \"getProviderScopes\",\n  \"data\": {\n    \"packageName\": \"moosync.lastfm\"\n  },\n  \"expected\": [\"scrobbles\", \"accounts\"]\n}\n```\n\nMore commands can be be found at [moosync_edk::ExtensionExtraEvent](https://moosync.app/extensions-sdk/wasm-extension-rs/docs/wasm32-wasip1/doc/moosync_edk/enum.ExtensionExtraEvent.html) and [moosync_edk::ExtensionCommand](https://moosync.app/extensions-sdk/wasm-extension-rs/docs/wasm32-wasip1/doc/moosync_edk/enum.ExtensionCommand.html)\n\n### Requests\nThe requests property can be used to simulate responses to requests sent by the extension. For eg, if the extension makes a call to \"getSecure\", we can reply back with a mock response.\nThe below trace replies back to a getSecure request with a key of \"session\"\n\n```json\n{\n  \"type\": \"getSecure\",\n  \"data\": {\n    \"key\": \"session\",\n    \"value\": \"test\"\n  }\n}\n```\n\nMore requests can be found at [moosync_edk::MainCommandResponse](https://moosync.app/extensions-sdk/wasm-extension-rs/docs/wasm32-wasip1/doc/moosync_edk/enum.MainCommandResponse.html)\n\n### Sample trace file\n```json\n{\n  \"$schema\": \"https://raw.githubusercontent.com/Moosync/moodriver/refs/heads/main/schema.json\",\n  \"commands\": [\n    {\n      \"type\": \"seeked\",\n      \"data\": [0],\n      \"expected\": null\n    },\n    {\n      \"type\": \"getProviderScopes\",\n      \"data\": {\n        \"packageName\": \"moosync.lastfm\"\n      },\n      \"expected\": [\"scrobbles\", \"accounts\"]\n    }\n  ],\n  \"requests\": [\n    {\n      \"type\": \"getSecure\",\n      \"data\": {\n        \"key\": \"not_session\",\n        \"value\": \"not_test\"\n      }\n    },\n    {\n      \"type\": \"getSecure\",\n      \"data\": {\n        \"key\": \"session\",\n        \"value\": \"test\"\n      }\n    }\n  ]\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosync%2Fmoodriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoosync%2Fmoodriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosync%2Fmoodriver/lists"}