From 7e7bfd05ba6942c8ebba998a054af6740a81433c Mon Sep 17 00:00:00 2001 From: Mig Date: Sun, 5 Apr 2026 22:59:40 +0800 Subject: [PATCH 1/2] [new-plugin] test-rust-cli v1.0.0 E2E test: Rust CLI querying ETH price via onchainos token price-info. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../test-rust-cli/.claude-plugin/plugin.json | 8 +++++ skills/test-rust-cli/Cargo.toml | 4 +++ skills/test-rust-cli/LICENSE | 1 + skills/test-rust-cli/SKILL.md | 36 +++++++++++++++++++ skills/test-rust-cli/plugin.yaml | 16 +++++++++ skills/test-rust-cli/src/main.rs | 29 +++++++++++++++ 6 files changed, 94 insertions(+) create mode 100644 skills/test-rust-cli/.claude-plugin/plugin.json create mode 100644 skills/test-rust-cli/Cargo.toml create mode 100644 skills/test-rust-cli/LICENSE create mode 100644 skills/test-rust-cli/SKILL.md create mode 100644 skills/test-rust-cli/plugin.yaml create mode 100644 skills/test-rust-cli/src/main.rs diff --git a/skills/test-rust-cli/.claude-plugin/plugin.json b/skills/test-rust-cli/.claude-plugin/plugin.json new file mode 100644 index 00000000..55b4719d --- /dev/null +++ b/skills/test-rust-cli/.claude-plugin/plugin.json @@ -0,0 +1,8 @@ +{ + "name": "test-rust-cli", + "description": "E2E test - Rust CLI querying ETH price via OnchainOS", + "version": "1.0.0", + "author": {"name": "E2E Test"}, + "license": "MIT", + "keywords": ["test", "e2e", "rust", "onchainos"] +} diff --git a/skills/test-rust-cli/Cargo.toml b/skills/test-rust-cli/Cargo.toml new file mode 100644 index 00000000..a0f6185e --- /dev/null +++ b/skills/test-rust-cli/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "test-rust-cli" +version = "1.0.0" +edition = "2021" diff --git a/skills/test-rust-cli/LICENSE b/skills/test-rust-cli/LICENSE new file mode 100644 index 00000000..1b3f6bd2 --- /dev/null +++ b/skills/test-rust-cli/LICENSE @@ -0,0 +1 @@ +MIT License - Copyright 2026 E2E Test diff --git a/skills/test-rust-cli/SKILL.md b/skills/test-rust-cli/SKILL.md new file mode 100644 index 00000000..41fad903 --- /dev/null +++ b/skills/test-rust-cli/SKILL.md @@ -0,0 +1,36 @@ +--- +name: test-rust-cli +description: "E2E test - Rust CLI querying ETH price via OnchainOS" +version: "1.0.0" +author: "E2E Test" +tags: [test, rust, onchainos] +--- + +# Test Rust CLI + +## Overview +E2E test plugin with Rust CLI binary. Queries ETH price via OnchainOS. + +## Pre-flight Checks +1. Install onchainos CLI: `curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh` +2. Ensure test-rust-cli binary is installed + +## Commands + +### Query ETH Price via CLI +```bash +test-rust-cli --query eth-price +``` +**When to use:** When user asks about ETH price. +**Output:** Calls `onchainos token price-info --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --chain ethereum` and formats the result. + +### Direct OnchainOS Query +```bash +onchainos token price-info --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 --chain ethereum +``` + +## Error Handling +| Error | Cause | Resolution | +|-------|-------|------------| +| Binary not found | CLI not installed | Install via plugin-store | +| Command not found | onchainos not installed | Run pre-flight install | diff --git a/skills/test-rust-cli/plugin.yaml b/skills/test-rust-cli/plugin.yaml new file mode 100644 index 00000000..66f298c8 --- /dev/null +++ b/skills/test-rust-cli/plugin.yaml @@ -0,0 +1,16 @@ +schema_version: 1 +name: test-rust-cli +version: "1.0.0" +description: "E2E test - Rust CLI querying ETH price via OnchainOS" +author: + name: "E2E Test" + github: "MigOKG" +license: MIT +category: utility +tags: [test, e2e, rust, onchainos] +components: + skill: + dir: . +build: + lang: rust + binary_name: test-rust-cli diff --git a/skills/test-rust-cli/src/main.rs b/skills/test-rust-cli/src/main.rs new file mode 100644 index 00000000..bd271386 --- /dev/null +++ b/skills/test-rust-cli/src/main.rs @@ -0,0 +1,29 @@ +use std::process::Command; + +fn main() { + let args: Vec = std::env::args().collect(); + + if args.len() > 1 && args[1] == "--query" && args.get(2).map(|s| s.as_str()) == Some("eth-price") { + println!("Querying ETH price via onchainos..."); + let output = Command::new("onchainos") + .args(["token", "price-info", "--address", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "--chain", "ethereum"]) + .output(); + match output { + Ok(o) => print!("{}", String::from_utf8_lossy(&o.stdout)), + Err(e) => eprintln!("Error: {}", e), + } + } else if args.len() > 1 && args[1] == "--help" { + println!("test-rust-cli v1.0.0"); + println!("Usage: test-rust-cli --query eth-price"); + println!("Queries ETH price via onchainos token price-info"); + } else { + println!("test-rust-cli v1.0.0 - Querying ETH price via onchainos..."); + let output = Command::new("onchainos") + .args(["token", "price-info", "--address", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "--chain", "ethereum"]) + .output(); + match output { + Ok(o) => print!("{}", String::from_utf8_lossy(&o.stdout)), + Err(e) => eprintln!("Error running onchainos: {}", e), + } + } +} From 537dd7251777d215b522c25f48ab90e34f92ff3d Mon Sep 17 00:00:00 2001 From: plugin-store-bot Date: Sun, 5 Apr 2026 15:04:36 +0000 Subject: [PATCH 2/2] auto: summaries + pre-flight for test-rust-cli --- skills/test-rust-cli/SKILL.md | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/skills/test-rust-cli/SKILL.md b/skills/test-rust-cli/SKILL.md index 41fad903..e628a440 100644 --- a/skills/test-rust-cli/SKILL.md +++ b/skills/test-rust-cli/SKILL.md @@ -6,6 +6,65 @@ author: "E2E Test" tags: [test, rust, onchainos] --- + +## Pre-flight Dependencies (auto-injected by Plugin Store CI) + +> Run once per session before first use. These checks ensure required tools are installed. + +### Install onchainos CLI + Skills (auto-injected) + +```bash +# 1. Install onchainos CLI +onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh + +# 2. Install onchainos skills (enables AI agent to use onchainos commands) +npx skills add okx/onchainos-skills --yes --global + +# 3. Install plugin-store skills (enables plugin discovery and management) +npx skills add okx/plugin-store --skill plugin-store --yes --global +``` + +### Install test-rust-cli binary (auto-injected) + +```bash +if ! command -v test-rust-cli >/dev/null 2>&1; then + OS=$(uname -s | tr A-Z a-z) + ARCH=$(uname -m) + case "${OS}_${ARCH}" in + darwin_arm64) TARGET="aarch64-apple-darwin" ;; + darwin_x86_64) TARGET="x86_64-apple-darwin" ;; + linux_x86_64) TARGET="x86_64-unknown-linux-gnu" ;; + linux_aarch64) TARGET="aarch64-unknown-linux-gnu" ;; + esac + curl -fsSL "https://github.com/okx/plugin-store/releases/download/plugins/test-rust-cli@1.0.0/test-rust-cli-${TARGET}" -o ~/.local/bin/test-rust-cli + chmod +x ~/.local/bin/test-rust-cli +fi +``` + +### Report install (auto-injected, runs once) + +```bash +REPORT_FLAG="$HOME/.plugin-store/reported/test-rust-cli" +if [ ! -f "$REPORT_FLAG" ]; then + mkdir -p "$HOME/.plugin-store/reported" + # Generate device ID + DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME" + DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32) + # Report to Vercel stats + curl -s -X POST "https://plugin-store-dun.vercel.app/install" \ + -H "Content-Type: application/json" \ + -d '{"name":"test-rust-cli","version":"1.0.0"}' >/dev/null 2>&1 || true + # Report to OKX API + curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \ + -H "Content-Type: application/json" \ + -d '{"pluginName":"test-rust-cli","divId":"'"$DEV_ID"'"}' >/dev/null 2>&1 || true + touch "$REPORT_FLAG" +fi +``` + +--- + + # Test Rust CLI ## Overview