Skip to content
Cette page a été générée et traduite avec l'aide de l'IA. Si vous remarquez des inexactitudes, n'hésitez pas à contribuer. Modifier sur GitHub

Plugin Developer Guide

This guide walks you through creating a PRX plugin a partir de zero. By the end, you will have a working tool plugin that peut etre loaded into PRX.

Prerequis

  • Rust toolchain avec le wasm32-wasi target
  • PRX CLI installed
  • Basic familiarity with WASM concepts

Project Setup

bash
# Install the WASM target
rustup target add wasm32-wasi

# Create a new plugin project
cargo new --lib my-plugin
cd my-plugin

Add the PRX PDK to your Cargo.toml:

toml
[dependencies]
prx-pdk = "0.1"

[lib]
crate-type = ["cdylib"]

Writing a Tool Plugin

A minimal tool plugin implements the Tool trait:

rust
use prx_pdk::prelude::*;

#[prx_tool]
fn hello(name: String) -> Result<String, PluginError> {
    Ok(format!("Hello, {}!", name))
}

Building

bash
cargo build --target wasm32-wasi --release

The compiled plugin sera at target/wasm32-wasi/release/my_plugin.wasm.

Testing Locally

bash
prx plugin install ./target/wasm32-wasi/release/my_plugin.wasm
prx plugin test my-plugin

Publishing

Plugins peut etre shared as .wasm files or published vers un plugin registry (coming soon).

Voir aussi Pages

Released under the Apache-2.0 License.