|
| 1 | +--- |
| 2 | +name: plugin-install |
| 3 | +description: Install an EvoNexus plugin from a git URL or uploaded archive. Use when the user asks to install a plugin, add a plugin, or mentions a plugin source URL (github:user/repo, https://..., or a ZIP/tar.gz upload). Triggers on phrases like "instala plugin", "install plugin X", "adicionar plugin", "quero instalar Y". |
| 4 | +metadata: |
| 5 | + category: plugins |
| 6 | + version: 1.0.0 |
| 7 | +--- |
| 8 | + |
| 9 | +# Plugin Install |
| 10 | + |
| 11 | +Install an EvoNexus plugin through the `/api/plugins/*` endpoints. Plugins execute arbitrary code (agents, skills, shell hooks, SQL migrations) — always surface the preview and require explicit confirmation before running the install. |
| 12 | + |
| 13 | +## How to use |
| 14 | + |
| 15 | +### Step 1 — Obtain the source URL |
| 16 | + |
| 17 | +Ask for the plugin source if not provided. Accepted forms: |
| 18 | + |
| 19 | +- `github:user/repo` — default branch |
| 20 | +- `github:user/repo@v1.2.3` — specific tag or branch |
| 21 | +- `https://…/archive.tar.gz` or `https://…/archive.zip` — HTTPS tarball / zip URL |
| 22 | +- Uploaded archive (`.zip` / `.tar.gz`) — via the `/plugins` upload flow |
| 23 | + |
| 24 | +Local filesystem paths (`/abs/path`, `./rel`, `~/...`) and non-HTTPS schemes (`file://`, `ssh://`, etc.) are **rejected by the backend** — do not try to work around that. If the user has a local checkout, tell them to push to a branch, create a release tag, or zip the plugin directory and upload it. |
| 25 | + |
| 26 | +### Step 2 — Preview the manifest |
| 27 | + |
| 28 | +Use the EvoClient SDK (auto-resolves URL + Bearer auth): |
| 29 | + |
| 30 | +```python |
| 31 | +from dashboard.backend.sdk_client import evo |
| 32 | + |
| 33 | +preview = evo.post("/api/plugins/preview", {"source_url": "<URL>"}) |
| 34 | +``` |
| 35 | + |
| 36 | +Show the user, in this order: |
| 37 | + |
| 38 | +- **Identidade:** id, name, version, author, license |
| 39 | +- **Capabilities:** agents, skills, commands, rules, heartbeats, routines, widgets, migrations, claude_hooks (only keys present) |
| 40 | +- **Env vars exigidas:** `env_vars_required`. Must exist in `.env`. |
| 41 | +- **`install.sql` completo** (expanded): full SQL. Runs in transaction against dashboard DB. |
| 42 | +- **Hooks shell completos:** full text of `hooks/pre-install.sh` and `hooks/post-install.sh`. |
| 43 | +- **Claude hook handlers** (if any): full text of `claude_hook_handlers/*.{py,sh}`. |
| 44 | + |
| 45 | +Do not abbreviate. The user needs to read everything that will execute. |
| 46 | + |
| 47 | +### Step 3 — Require explicit confirmation |
| 48 | + |
| 49 | +Accept only clear affirmatives ("sim", "confirmar", "pode instalar", "ok"). If the user hesitates or asks for changes, stop and answer — do not install. |
| 50 | + |
| 51 | +### Step 4 — Run the install |
| 52 | + |
| 53 | +```python |
| 54 | +result = evo.post("/api/plugins/install", { |
| 55 | + "source_url": "<URL>", |
| 56 | + "confirmed": True, |
| 57 | +}) |
| 58 | +``` |
| 59 | + |
| 60 | +### Step 5 — Report the outcome |
| 61 | + |
| 62 | +On success (`{"status":"active","id":"<slug>"}`), summarise what the user now has: agents under `.claude/agents/plugin-<slug>-*`, heartbeats visible in `/heartbeats`, routines (scheduler reload on SIGHUP), widgets on Overview next page load. |
| 63 | + |
| 64 | +If scheduler was offline and plugin has routines, backend returns `routine_activation_pending=true` — explain the user needs to start the scheduler. |
| 65 | + |
| 66 | +## Error handling |
| 67 | + |
| 68 | +- `HTTP 400 invalid_source_url` — URL failed source whitelist. Reprompt. |
| 69 | +- `HTTP 400 schema_invalid` — manifest rejected by Pydantic. Show validation error. |
| 70 | +- `HTTP 409 slug_conflict` — plugin id already installed. Offer uninstall first or a different one. |
| 71 | +- `HTTP 409 install_in_progress` — another install running. Retry or check `/plugins` UI. |
| 72 | +- `HTTP 500 migration_failed` — SQL transaction rolled back. DB unchanged. Surface SQLite error. |
| 73 | +- Other 5xx — capture body, suggest checking `ADWs/logs/plugins/`. |
| 74 | + |
| 75 | +## Notes for the agent |
| 76 | + |
| 77 | +- Never skip preview, even with high-trust URLs. |
| 78 | +- Never pass `confirmed=True` without explicit user green light. |
| 79 | +- Install one plugin at a time — if user asks for several, preview+confirm each in sequence. |
0 commit comments