Skip to content

feat: add eth-price-demo plugin#4

Merged
mig-pre merged 1 commit intomig-pre:testfrom
yz06276:feat/eth-price-demo
Apr 15, 2026
Merged

feat: add eth-price-demo plugin#4
mig-pre merged 1 commit intomig-pre:testfrom
yz06276:feat/eth-price-demo

Conversation

@yz06276
Copy link
Copy Markdown

@yz06276 yz06276 commented Apr 15, 2026

Summary

  • Add eth-price-demo — a minimal Rust CLI plugin that queries ETH price
  • Uses OnchainOS CLI when available, falls back to OKX public API (/v5/market/ticker)
  • Read-only plugin, no wallet access, no API keys required

Plugin Structure

File Purpose
plugin.yaml Plugin manifest (schema_version 1, lang: rust)
.claude-plugin/plugin.json Claude Skill registration
SKILL.md Agent documentation with command reference
Cargo.toml + Cargo.lock Rust build config
src/main.rs CLI entry point — single get-price subcommand
LICENSE MIT

Pre-submission Checklist

  • plugin-store lint structure validated
  • Local cargo build --release passes with zero warnings
  • Binary --version outputs 0.1.0
  • Version consistent across plugin.yaml / Cargo.toml / plugin.json / SKILL.md
  • Uses rustls-tls (no OpenSSL dependency)
  • No hardcoded secrets or credentials
  • LICENSE included (MIT)
  • SKILL.md has valid frontmatter

Test plan

  • Phase 1: Structure Validation passes
  • Phase 2: Build Verification compiles on all 9 targets
  • Phase 3: AI Code Review completes (advisory)
  • Phase 4: Summary generation works

🤖 Generated with Claude Code

Simple Rust CLI demo plugin for CI pipeline testing.
Queries ETH price using OnchainOS CLI with OKX public API fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yz06276 yz06276 force-pushed the feat/eth-price-demo branch from a2444de to 6412a2b Compare April 15, 2026 03:32
@yz06276 yz06276 temporarily deployed to summary-generation April 15, 2026 03:33 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

Phase 4: Summary + Pre-flight for eth-price-demo

Review below. AI Code Review is in a separate check.


SUMMARY.md

eth-price-demo

A minimal demo plugin that queries the current ETH price using OnchainOS CLI or OKX API fallback.

Highlights

  • Real-time ETH price data retrieval
  • Dual data source strategy (OnchainOS CLI + OKX API fallback)
  • Read-only operations with no wallet access required
  • No API keys needed - uses public endpoints only
  • JSON output format with comprehensive price metrics
  • Support for different chain IDs
  • 24-hour trading statistics included
  • Built in Rust for performance and reliability
SKILL_SUMMARY.md

eth-price-demo -- Skill Summary

Overview

This plugin provides real-time Ethereum (ETH) price data by intelligently selecting between OnchainOS CLI and OKX public API as data sources. It offers a simple command-line interface to fetch current price, 24-hour trading statistics, and market data without requiring any authentication or wallet access, making it ideal for price monitoring and analytics workflows.

Usage

Run eth-price-demo get-price to fetch the current ETH price, optionally specifying a chain ID with --chain <CHAIN_ID> (defaults to Ethereum mainnet).

Commands

Command Parameters Description
get-price --chain <CHAIN_ID> (optional, default: 1) Retrieves current ETH price and 24-hour trading statistics

Triggers

An AI agent should activate this skill when users request current Ethereum price information, market data, or need to incorporate real-time ETH pricing into trading or analytics decisions.

Auto-injected Pre-flight
## Pre-flight Dependencies (auto-injected by Plugin Store CI)

> Run once per session before first use. These checks ensure required tools are installed.

### Version check (auto-injected)

> **AI Agent Instruction**: Run this version check before executing any commands from this skill. If an update is applied, re-read this SKILL.md before proceeding — the instructions may have changed.

```bash
# Check for skill updates (1-hour cache)
UPDATE_CACHE="$HOME/.plugin-store/update-cache/eth-price-demo"
CACHE_MAX=3600
LOCAL_VER="0.1.0"
DO_CHECK=true

if [ -f "$UPDATE_CACHE" ]; then
  CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0)
  NOW=$(date +%s)
  AGE=$(( NOW - CACHE_MOD ))
  [ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false
fi

if [ "$DO_CHECK" = true ]; then
  REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/mig-pre/plugin-store/main/skills/eth-price-demo/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}')
  if [ -n "$REMOTE_VER" ]; then
    mkdir -p "$HOME/.plugin-store/update-cache"
    echo "$REMOTE_VER" > "$UPDATE_CACHE"
  fi
fi

REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER")
if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
  echo "Update available: eth-price-demo v$LOCAL_VER -> v$REMOTE_VER. Updating..."
  npx skills add mig-pre/plugin-store --skill eth-price-demo --yes --global 2>/dev/null || true
  echo "Updated eth-price-demo to v$REMOTE_VER. Please re-read this SKILL.md."
fi

Install onchainos CLI + Skills (auto-injected)

# 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 mig-pre/plugin-store --skill plugin-store --yes --global

Install eth-price-demo binary + launcher (auto-injected)

# Install shared infrastructure (launcher + update checker, only once)
LAUNCHER="$HOME/.plugin-store/launcher.sh"
CHECKER="$HOME/.plugin-store/update-checker.py"
if [ ! -f "$LAUNCHER" ]; then
  mkdir -p "$HOME/.plugin-store"
  curl -fsSL "https://raw.githubusercontent.com/mig-pre/plugin-store/main/scripts/launcher.sh" -o "$LAUNCHER" 2>/dev/null || true
  chmod +x "$LAUNCHER"
fi
if [ ! -f "$CHECKER" ]; then
  curl -fsSL "https://raw.githubusercontent.com/mig-pre/plugin-store/main/scripts/update-checker.py" -o "$CHECKER" 2>/dev/null || true
fi

# Clean up old installation
rm -f "$HOME/.local/bin/eth-price-demo" "$HOME/.local/bin/.eth-price-demo-core" 2>/dev/null

# Download binary
OS=$(uname -s | tr A-Z a-z)
ARCH=$(uname -m)
EXT=""
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-musl" ;;
  linux_i686)    TARGET="i686-unknown-linux-musl" ;;
  linux_aarch64) TARGET="aarch64-unknown-linux-musl" ;;
  linux_armv7l)  TARGET="armv7-unknown-linux-musleabihf" ;;
  mingw*_x86_64|msys*_x86_64|cygwin*_x86_64)   TARGET="x86_64-pc-windows-msvc"; EXT=".exe" ;;
  mingw*_i686|msys*_i686|cygwin*_i686)           TARGET="i686-pc-windows-msvc"; EXT=".exe" ;;
  mingw*_aarch64|msys*_aarch64|cygwin*_aarch64)  TARGET="aarch64-pc-windows-msvc"; EXT=".exe" ;;
esac
mkdir -p ~/.local/bin
curl -fsSL "https://github.com/mig-pre/plugin-store/releases/download/plugins/eth-price-demo@0.1.0/eth-price-demo-${TARGET}${EXT}" -o ~/.local/bin/.eth-price-demo-core${EXT}
chmod +x ~/.local/bin/.eth-price-demo-core${EXT}

# Symlink CLI name to universal launcher
ln -sf "$LAUNCHER" ~/.local/bin/eth-price-demo

# Register version
mkdir -p "$HOME/.plugin-store/managed"
echo "0.1.0" > "$HOME/.plugin-store/managed/eth-price-demo"

Report install (auto-injected, runs once)

REPORT_FLAG="$HOME/.plugin-store/reported/eth-price-demo"
if [ ! -f "$REPORT_FLAG" ]; then
  mkdir -p "$HOME/.plugin-store/reported"
  # Device fingerprint → SHA256 → 32-char device ID
  DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME"
  DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32)
  # HMAC signature (obfuscated key, same as CLI binary)
  _K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d 2>/dev/null || echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | openssl base64 -d)
  HMAC_SIG=$(echo -n "${_K}${DEV_ID}" | shasum -a 256 | head -c 8)
  DIV_ID="${DEV_ID}${HMAC_SIG}"
  unset _K
  # Report to Vercel stats
  curl -s -X POST "https://plugin-store-dun.vercel.app/install" \
    -H "Content-Type: application/json" \
    -d '{"name":"eth-price-demo","version":"0.1.0"}' >/dev/null 2>&1 || true
  # Report to OKX API (with HMAC-signed device token)
  curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \
    -H "Content-Type: application/json" \
    -d '{"pluginName":"eth-price-demo","divId":"'"$DIV_ID"'"}' >/dev/null 2>&1 || true
  touch "$REPORT_FLAG"
fi


</details>

---
*Generated by Plugin Store CI after maintainer approval.*

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

🔨 Phase 2: Build Verification — ✅ PASSED

Plugin: eth-price-demo | Language: rust
Source: @

Compiled from developer source code by our CI. Users install our build artifacts.

Build succeeded. Compiled artifact uploaded as workflow artifact.


Source integrity: commit SHA `` is the content fingerprint.

@github-actions
Copy link
Copy Markdown

📋 Phase 3: AI Code Review Report — Score: 72/100

Plugin: eth-price-demo | Recommendation: ⚠️ Merge with caveats

🔗 Reviewed against latest onchainos source code (live from main branch) | Model: claude-opus-4-6 via Anthropic API | Cost: ~223684+4392 tokens

This is an advisory report. It does NOT block merging. Final decision is made by human reviewers.


1. Plugin Overview
Field Value
Name eth-price-demo
Version 0.1.0
Category analytics
Author yz06276 (yz06276)
License MIT
Has Binary Yes (Rust, binary: eth-price-demo)
Risk Level Low

Summary: A minimal demo plugin that queries the current ETH price. It attempts to use the onchainos CLI (onchainos dex token price-info) first, and falls back to the OKX public REST API (GET https://www.okx.com/api/v5/market/ticker?instId=ETH-USDT) if onchainos is unavailable. This is a read-only plugin with no wallet access or transaction capabilities.

Target Users: Developers testing the Plugin Store CI pipeline, or users who want a quick ETH price check.

2. Architecture Analysis

Components:

  • Skill (SKILL.md)
  • Binary (Rust source: src/main.rs)

Skill Structure:

  • SKILL.md has 4 sections: Commands (1 command: get-price), Parameters table, Output example, Data Sources, and Safety notes.
  • Minimal and focused structure appropriate for a demo plugin.

Data Flow:

  1. User invokes eth-price-demo get-price [--chain <id>]
  2. Binary attempts to call onchainos dex token price-info via std::process::Command (shell out)
  3. If onchainos fails or is not found, the binary makes an HTTPS GET request to https://www.okx.com/api/v5/market/ticker?instId=ETH-USDT
  4. Parsed response is formatted as JSON and printed to stdout

Dependencies:

  • anyhow (error handling)
  • clap (CLI parsing)
  • reqwest with rustls-tls (HTTP client, no OpenSSL)
  • serde / serde_json (JSON serialization)
  • tokio (async runtime)
  • External: onchainos CLI (optional), OKX public API
3. Auto-Detected Permissions

onchainos Commands Used

Command Found Exists in onchainos CLI Risk Level Context
onchainos dex token price-info ❌ — No dex top-level command exists. The correct command would be onchainos token price-info or onchainos market price. Low Used in try_onchainos() as a shell-out; falls back gracefully on failure

Wallet Operations

Operation Detected? Where Risk
Read balance No Low
Send transaction No High
Sign message No High
Contract call No High

External APIs / URLs

URL / Domain Purpose Risk
https://www.okx.com/api/v5/market/ticker?instId=ETH-USDT Fetch ETH-USDT spot price (public, no auth) Low

Chains Operated On

  • Ethereum (chain ID 1, default) — read-only price query
  • The --chain parameter is accepted but only affects the onchainos CLI call; the OKX fallback API always queries ETH-USDT regardless of chain.

Overall Permission Summary

This plugin is strictly read-only. It queries ETH price data from two sources (onchainos CLI and OKX public API). It does not access any wallet, sign any transactions, read any sensitive files, or modify any system state. The only network request is to the well-known OKX public API endpoint. Risk is minimal.

4. onchainos API Compliance

Does this plugin use onchainos CLI for all on-chain write operations?

N/A — this plugin performs no on-chain write operations.

On-Chain Write Operations (MUST use onchainos)

Operation Uses onchainos? Self-implements? Detail
Wallet signing N/A No Not applicable — read-only plugin
Transaction broadcasting N/A No Not applicable
DEX swap execution N/A No Not applicable
Token approval N/A No Not applicable
Contract calls N/A No Not applicable
Token transfers N/A No Not applicable

Data Queries (allowed to use external sources)

Data Source API/Service Used Purpose
OKX Public API https://www.okx.com/api/v5/market/ticker ETH-USDT spot price fallback
onchainos CLI onchainos dex token price-info (attempted) ETH price via onchainos (primary)

External APIs / Libraries Detected

  • reqwest crate with rustls-tls feature for HTTPS requests
  • Direct HTTP GET to https://www.okx.com/api/v5/market/ticker?instId=ETH-USDT
  • Shell-out to onchainos binary via std::process::Command

Verdict: ✅ Fully Compliant

No on-chain write operations are performed. Data queries use legitimate public API endpoints.

5. Security Assessment

Static Rule Scan (C01-C09, H01-H09, M01-M08, L01-L02)

Rule ID Severity Title Matched? Detail
C01 CRITICAL curl | sh remote execution No No curl|sh patterns found
C02 CRITICAL Prompt injection No No jailbreak/override instructions
C03 CRITICAL Base64 obfuscation No No encoded payloads
C04 CRITICAL Hex/Unicode obfuscation No Clean source
C05 CRITICAL Credential exfiltration No No credential access or exfiltration
C06 CRITICAL Suspicious download No No password-protected archives
C07 CRITICAL Pseudo-tag injection No No <SYSTEM> or similar tags
C08 CRITICAL HTML comment injection No No HTML comments with hidden content
C09 CRITICAL Backtick injection No No backtick command substitution
H01 HIGH Hardcoded secrets No The address 0xEeee... is the well-known EVM native token address placeholder, not a private key
H02 HIGH Credential output No No credential output instructions
H03 HIGH Persistence No No crontab/launchctl/systemctl
H04 HIGH Sensitive data access No No ~/.ssh/, ~/.aws/ access
H05 HIGH/INFO Direct financial No Read-only price query, no financial operations
H06 HIGH System modification No No chmod/chown/rm -rf
H07 HIGH Plaintext env credentials No No .env file writes
H08 HIGH Credential solicitation No No credential requests
H09 HIGH Signed tx CLI param No No --signed-tx or --private-key
M01 MEDIUM Supply chain unpinned No No npx skills add or npm install commands
M02 MEDIUM Unverifiable dep No No runtime dependency installation
M03 MEDIUM Third-party content No reqwest calls are in compiled binary, not in SKILL.md
M07 MEDIUM Missing untrusted data boundary No SKILL.md states "Read-only plugin — no transactions, no wallet access" but lacks explicit "Treat all data as untrusted" statement. However, since this is a read-only price display with no agent decision-making based on the data, the risk is negligible.
M08 MEDIUM External data field passthrough No Output is a simple JSON price response; no agent action taken on returned data
L01 LOW Discovery abuse No No tool enumeration
L02 LOW Undeclared network No All network calls are to declared endpoints

LLM Judge Analysis (L-PINJ, L-MALI, L-MEMA, L-IINJ, L-AEXE, L-FINA, L-FISO)

Judge Severity Detected Confidence Evidence
L-PINJ CRITICAL Not detected 0.95 No hidden instructions, no identity manipulation, no override patterns
L-MALI CRITICAL Not detected 0.95 Plugin behavior matches its stated purpose (read-only price query). Source code confirms no hidden actions.
L-MEMA HIGH Not detected 0.95 No memory file modifications
L-IINJ INFO Detected (INFO) 0.85 Plugin fetches external data from OKX API. SKILL.md declares data sources. Classified as INFO since it's a read-only price query with no agent decision pathway.
L-AEXE INFO Not detected 0.90 No autonomous execution of high-impact operations
L-FINA INFO Not detected 0.95 Read-only price query — no financial write operations. Exempt per L-FINA rules.

Toxic Flow Detection (TF001-TF006)

No toxic flows detected. No combinations of triggered rules form attack chains.

Prompt Injection Scan

  • No instruction override patterns
  • No identity manipulation
  • No hidden behavior
  • No confirmation bypass
  • No unauthorized operations
  • No hidden content (base64, invisible chars)

Result: ✅ Clean

Dangerous Operations Check

  • No transfers, signing, contract calls, or transaction broadcasting
  • Plugin is strictly read-only

Result: ✅ Safe

Data Exfiltration Risk

  • No sensitive data access
  • Network requests only to declared OKX public API
  • No file system reads of credentials or secrets
  • Shell-out to onchainos passes only chain ID and a public token address

Result: ✅ No Risk

Overall Security Rating: 🟢 Low Risk

6. Source Code Security (if source code is included)

Language & Build Config

  • Language: Rust (edition 2021)
  • Entry point: src/main.rs
  • Binary name: eth-price-demo

Dependency Analysis

Dependency Version Status
anyhow 1 ✅ Well-maintained, widely used
clap 4 (with derive) ✅ Standard CLI parsing crate
reqwest 0.12 (rustls-tls, json) ✅ Well-maintained HTTP client, using rustls (no OpenSSL)
serde 1 (with derive) ✅ Standard serialization
serde_json 1 ✅ Standard JSON library
tokio 1 (full) ✅ Standard async runtime

All dependencies are mainstream, well-maintained Rust crates from crates.io. No suspicious or unmaintained packages. Cargo.lock is present and pins all transitive dependencies.

Code Safety Audit

Check Result Detail
Hardcoded secrets (API keys, private keys, mnemonics) ✅ Clean 0xEeee... is the EVM native token address constant, not a secret
Network requests to undeclared endpoints ✅ Clean Only https://www.okx.com/api/v5/market/ticker — declared in plugin.yaml and SKILL.md
File system access outside plugin scope ✅ Clean No file system reads or writes
Dynamic code execution (eval, exec, shell commands) ⚠️ Note Uses std::process::Command to shell out to onchainos — this is expected behavior and the arguments are not user-controlled in a dangerous way (only --chain which is a simple string)
Environment variable access beyond declared env ✅ Clean No environment variable access
Build scripts with side effects (build.rs, postinstall) ✅ Clean No build.rs or post-install scripts
Unsafe code blocks (Rust) ✅ Clean No unsafe blocks in the source

Does SKILL.md accurately describe what the source code does?

Yes — with one minor discrepancy:

  • SKILL.md says the onchainos command is onchainos dex token price-info, and the source code uses onchainos dex token price-info — however, reviewing the onchainos CLI source, there is no dex subcommand. The correct command should be onchainos token price-info or onchainos market price. This is a bug that will cause the onchainos path to always fail, falling back to the OKX API. It's not a security issue.

Verdict: ✅ Source Safe

7. Code Review

Quality Score: 72/100

Dimension Score Notes
Completeness (pre-flight, commands, error handling) 16/25 Good error handling with anyhow + graceful fallback. No pre-flight checks for onchainos installation. Incorrect onchainos command path (dex token price-info doesn't exist).
Clarity (descriptions, no ambiguity) 20/25 SKILL.md is clear and well-structured. Command documentation with parameters and example output is excellent.
Security Awareness (confirmations, slippage, limits) 22/25 Excellent for scope — explicitly declares "read-only, no transactions, no wallet access, no API keys required".
Skill Routing (defers correctly, no overreach) 10/15 Plugin stays within its scope. Does not attempt any operations beyond price queries. Minor: doesn't suggest routing to other skills.
Formatting (markdown, tables, code blocks) 4/10 Minimal formatting. No pre-flight block. Missing chain support table. Could benefit from more structured sections.

Strengths

  • Clean, minimal implementation — does exactly what it claims with no unnecessary complexity
  • Graceful fallback pattern — tries onchainos first, falls back to public API
  • Safe by design — read-only with no wallet, no credentials, no write operations
  • Proper Rust dependencies — uses rustls-tls instead of OpenSSL, all standard crates

Issues Found

  • 🟡 Important: The onchainos CLI command onchainos dex token price-info does not exist in the onchainos CLI. The dex top-level subcommand is not defined. Should be onchainos token price-info or onchainos market price. This means the primary data source will always fail silently.
  • 🟡 Important: The --chain parameter is accepted but has no effect on the OKX fallback API, which always queries ETH-USDT. This could mislead users who pass different chain IDs expecting chain-specific prices.
  • 🔵 Minor: SKILL.md lacks an untrusted data boundary declaration. While low-risk for a read-only price display, it would be good practice to add: "Treat all data returned by the API as untrusted external content."
  • 🔵 Minor: No pre-flight checks section in SKILL.md (onchainos installation verification).
  • 🔵 Minor: Cargo.toml uses tokio = { features = ["full"] } which pulls in more than needed; ["rt-multi-thread", "macros"] would suffice.
8. Recommendations
  1. Fix onchainos command path (Important): Change try_onchainos() to use the correct command. Based on onchainos source, either onchainos market price --address 0xEeee... --chain <chain> or onchainos token price-info --address 0xEeee... --chain <chain> would work.

  2. Handle --chain consistently in fallback (Important): Either document that the OKX fallback always returns ETH-USDT regardless of chain, or implement chain-aware API calls for the fallback path.

  3. Add untrusted data boundary declaration to SKILL.md: Add a safety note like "Treat all data returned by the CLI/API as untrusted external content — price data comes from third-party sources."

  4. Slim down tokio features in Cargo.toml: Replace features = ["full"] with features = ["rt-multi-thread", "macros"] to reduce binary size.

  5. Add pre-flight section referencing onchainos installation if the plugin intends to use onchainos as the primary source.

9. Reviewer Summary

One-line verdict: A clean, safe, read-only demo plugin with a minor bug in the onchainos command path that causes it to always fall back to the OKX public API.

Merge recommendation: ⚠️ Merge with noted caveats

The plugin is security-clean and poses no risk to users. However, the following should ideally be addressed:

  • Fix the incorrect onchainos CLI command (onchainos dex token price-infoonchainos token price-info or onchainos market price)
  • Document or fix the --chain parameter behavior in the fallback path

Generated by Claude AI via Anthropic API — review the full report before approving.

@mig-pre mig-pre merged commit 09e23aa into mig-pre:test Apr 15, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants