Skip to content

Quick start

The @oiap/cli package installs the oiap binary. Install it with the authoring SDK in your plugin project:

Terminal window
npm install --save-dev @oiap/cli @oiap/core

List the registered exporter targets:

Terminal window
npx oiap targets

Create a prompt file and an oiap.plugin.ts next to it:

my-review-plugin/
oiap.plugin.ts
prompts/
review.md
prompts/review.md
Review the current change for correctness, security risks, missing tests, and
maintainability issues. Lead with concrete findings and include file references
when possible.
oiap.plugin.ts
import type { PluginDefinition } from "@oiap/core";
import { definePlugin, markdownFile } from "@oiap/core";
const reviewPrompt = markdownFile("prompts/review.md", {
baseUrl: import.meta.url,
});
export default definePlugin({
manifest: {
id: "review-guard",
name: "Review Guard",
version: "1.0.0",
description:
"Adds a portable review command for agent-assisted code review.",
license: "MIT",
categories: ["review", "quality", "commands"],
supportedTargets: ["claude-code", "codex", "vscode-copilot-chat"],
},
invocations: [
{
id: "review-guard-invocation",
canonical: "review-guard",
helpText: "Review the current change before it is merged.",
examples: ["/review-guard", "/review-guard Focus on security"],
},
],
instructions: [
{
id: "review-guard-prompt",
purpose: "command",
triggers: ["review", "code review", "pre-merge review"],
body: reviewPrompt,
},
],
commands: [
{
id: "review-guard-command",
invocation: { id: "review-guard-invocation", kind: "invocation" },
prompt: { id: "review-guard-prompt", kind: "instruction" },
},
],
} satisfies PluginDefinition);

Write a plugin explains each field.

Build for one target:

Terminal window
npx oiap build oiap.plugin.ts --target claude-code --out dist/claude-code

Build for every registered target (one directory per target under dist/oiap/):

Terminal window
npx oiap build oiap.plugin.ts --out dist/oiap

Each output directory holds host-native files plus OIAP metadata in .oiap/: the bundle manifest, source map and capability report. The CLI prints one line per target with its status and any issues:

Built claude-code -> dist/claude-code (8 files, ok)

The output directory is cleaned before each build, and must be inside the current directory.

Don’t commit dist/. Pick one or both ways to get the plugin to users:

See Two ways to ship a plugin.