| 1 | // Package installsource implements the `install_source` tool: a two-phase |
| 2 | // installer for Reasonix skills and MCP servers. A single call resolves a |
| 3 | // source (URL, local file/folder, .mcp.json, package name, or local executable) |
| 4 | // into a deterministic plan. When the caller sets apply=true, any registered |
| 5 | // ApprovalFunc may still deny that exact plan before writes or MCP connects run. |
| 6 | // |
| 7 | // The two-phase design exists so the model (or a UI) can inspect a plan before |
| 8 | // it touches disk or spawns subprocesses. `install_source` deliberately does |
| 9 | // not run a README's `curl | sh` chain: it locates a concrete manifest |
| 10 | // (SKILL.md / <name>.md / <name>/SKILL.md / nested skill roots / .mcp.json / |
| 11 | // mcpServers entry) and describes what it would do, and only then does it act on |
| 12 | // apply=true. Single skills are written to the canonical <name>/SKILL.md layout; |
| 13 | // flat <name>.md is treated as compatibility input. |
| 14 | // |
| 15 | // Concurrency: each Execute call is independent; the tool does not lock the |
| 16 | // filesystem. Callers that want to serialize installs (e.g. two parallel calls |
| 17 | // for the same skill name) should do so in the host. |
| 18 | package installsource |
| 19 |