Le manifeste hello-plugin était généré par un SDK obsolète/désaligné avec le schéma backend actuel (champ ideaPluginManifestVersion manquant, displayName, trustLevel, shape de contributes), ce qui faisait échouer l'installation avec « invalid input: missing field ideaPluginManifestVersion ». - SDK (manifest.ts/js, index.ts) aligné sur le schéma backend courant. - hello-plugin (exemple + fixture) régénéré avec le manifeste valide. - Base de tests fonctionnels plugins : fixture réelle versionnée (reference-minimal) + test d'installation/chargement bout en bout (plugin_install_load.rs), pour couvrir install/load/catalog depuis un dossier fixture réel. Le sous-repo git imbriqué et vide (sdk/IdeaSDK/.git, 0 commit) a été neutralisé pour que les sources du SDK soient suivies normalement dans ce dépôt plutôt que comme gitlink vide. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
85 lines
1.6 KiB
Markdown
85 lines
1.6 KiB
Markdown
# IdeA Plugin SDK
|
|
|
|
Minimal public TypeScript SDK for IdeA plugins.
|
|
|
|
This first version intentionally stays small:
|
|
|
|
- public manifest types for `idea-plugin.json`;
|
|
- public runtime types for plugin modules exposing `activate(ctx)`;
|
|
- a lightweight manifest validator;
|
|
- a minimal `examples/hello-plugin` plugin.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
npm install
|
|
```
|
|
|
|
## Build
|
|
|
|
```sh
|
|
npm run build
|
|
```
|
|
|
|
## Typecheck the example
|
|
|
|
```sh
|
|
npm run typecheck:examples
|
|
```
|
|
|
|
## Build the installable hello plugin archive
|
|
|
|
```sh
|
|
npm run package:hello-plugin
|
|
```
|
|
|
|
The archive is written to:
|
|
|
|
```text
|
|
examples/hello-plugin/build/hello-plugin-0.1.0.zip
|
|
```
|
|
|
|
Its ZIP root contains `idea-plugin.json` directly, with no wrapping parent directory. The
|
|
compiled ESM entrypoint is emitted at `dist/index.js`, matching the manifest `main` field.
|
|
|
|
## Plugin shape
|
|
|
|
An IdeA plugin ships an `idea-plugin.json` manifest and a JavaScript entrypoint built from
|
|
TypeScript.
|
|
|
|
```json
|
|
{
|
|
"ideaPluginManifestVersion": 1,
|
|
"id": "com.example.hello",
|
|
"displayName": "Hello Plugin",
|
|
"version": "0.1.0",
|
|
"main": "dist/index.js",
|
|
"trustLevel": "full",
|
|
"contributes": {}
|
|
}
|
|
```
|
|
|
|
The entrypoint exports an `activate(ctx)` function:
|
|
|
|
```ts
|
|
import type { ActivateContext } from "@idea/plugin-sdk";
|
|
|
|
export function activate(ctx: ActivateContext): void {
|
|
ctx.logger.info("hello from plugin");
|
|
}
|
|
```
|
|
|
|
## Manifest Validation
|
|
|
|
```ts
|
|
import { validatePluginManifest } from "@idea/plugin-sdk";
|
|
|
|
const result = validatePluginManifest(manifestJson);
|
|
if (!result.success) {
|
|
console.error(result.errors);
|
|
}
|
|
```
|
|
|
|
This validator is deliberately strict for core fields and permissive about future unknown fields.
|
|
It is not a security boundary.
|