# Plugin Development

> Build, statically verify, package, and publish Reims-Go extensions using uiApi 2.0, bridgeApi 1.0, and the three-tier isolation model.

- **Canonical URL**: https://reims.dev/en/docs/plugin-development
- **Chinese Version**: https://reims.dev/docs/plugin-development.md
- **Section**: Extensions & Help
- **LLMs Index**: https://reims.dev/llms.txt

---

Reims-Go provides a structured plugin architecture for community locales, themes, custom downloaders, image mirrors, guest tools, and sandboxed panels—backed by tiered isolation and automated static scanning.

## Three-tier isolation model

| Tier | Model | Capabilities | Typical kinds |
| --- | --- | --- | --- |
| **L1** | Declarative resource pack | Pure JSON / CSS tokens and locale strings; zero executable code, lowest risk | `locale`, `theme`, `template` |
| **L3** | Sidecar child process | Isolated subprocess talking to the core via scoped `bridgeApi 1.0` RPC | Custom downloaders, image sources, `driver`, `tool` |
| **L4** | Sandboxed UI panel | Controlled frontend panel conforming to `uiApi 2.0` and Tahoe theme tokens | Monitoring panels, developer workflow extensions |

## Stable plugin contracts (v0.2.11+)

Starting in `v0.2.11`, Reims-Go enforces two versioned contracts declared under `engines` in `manifest.json`:

- **`uiApi: "2.0"`**: Governs theme token overrides, light/dark synchronization, and sandboxed panel mounting.
- **`bridgeApi: "1.0"`**: Governs minimal-privilege RPC methods and lifecycle supervision for L3 Sidecar processes.

## Minimal manifest example (L1 locale pack)

```json
{
  "id": "community.lang.ja-jp",
  "name": {
    "zh-CN": "日语语言包",
    "en-US": "Japanese Language Pack"
  },
  "version": "1.0.0",
  "kind": "locale",
  "tier": "L1",
  "license": "MIT",
  "engines": {
    "reimsGo": ">=0.2.9",
    "uiApi": "2.0"
  },
  "entry": "locales/ja-JP.json"
}
```

Localization v2 supports regional fallback chains (for example `zh-Hant-TW → zh-Hant → zh-CN`) and ICU plural formatting. Scaffold and check missing keys with the built-in tooling:

```powershell
reims-go plugin locale init ja-JP | Out-Host
reims-go plugin locale check ./ja-JP | Out-Host
```

## Static scanning and publishing

Run the built-in packager to validate your manifest, execute static security scans, and generate a release `.zip` with `SHA256SUMS`:

```powershell
reims-go plugin pack ./my-plugin | Out-Host
```

Submit your package entry via pull request to [reims-go/plugins](https://github.com/reims-go/plugins). Merged releases rebuild `dist/index.json` and distribute automatically through GitHub Raw and jsDelivr mirrors for both the desktop app and the web marketplace.

## Safe-mode recovery

If a third-party theme or panel causes startup or display issues, launch Reims-Go in safe mode:

```powershell
reims-go --safe-mode
```

Safe mode skips all non-bundled plugins and restores the default Tahoe appearance so you can disable or uninstall problematic extensions cleanly.
