FN-5904: feat(FN-5904): add browse-and-install flow for skills.sh catalog in Skills view
Add end-to-end browse-and-install flow for skills.sh catalog entries in the dashboard Skills view, enabling users to install skills directly from the catalog UI. - Add POST /api/skills/install route with source validation and scoped project cwd - Add installSkill method to SkillsAdapter using supervised npx skills add spawn - Add installSkill client API function and Install button on catalog cards - Refresh discovered skills list automatically after successful install - Handle install errors with structured error codes (invalid_source, install_failed, install_timeout, spawn_error) - Add card header layout with install button, disabled state, and loading spinner - Add comprehensive tests: adapter unit tests, route integration tests, component tests - Add changeset for @runfusion/fusion minor bump - Update dashboard-guide.md with install endpoint documentation Files changed: .changeset/four-oranges-film.md | 5 + docs/dashboard-guide.md | 45 +++++++ packages/dashboard/app/__tests__/api-skills.test.ts | 46 +++++++ packages/dashboard/app/api/legacy.ts | 12 ++ packages/dashboard/app/components/SkillsView.css | 16 +++ packages/dashboard/app/components/SkillsView.tsx | 83 +++++++++--- packages/dashboard/app/components/__tests__/SkillsView.test.tsx | 72 +++++++++++ packages/dashboard/src/__tests__/routes-skills.test.ts | 67 ++++++++++ packages/dashboard/src/__tests__/skills-adapter.test.ts | 113 ++++++++++++++++ packages/dashboard/src/routes/__tests__/register-agent-skills-routes.test.ts | 144 +++++++++++++++++++++ packages/dashboard/src/routes/register-agent-skills-routes.ts | 51 ++++++++ packages/dashboard/src/skills-adapter.ts | 103 +++++++++++++++ 12 files changed, 736 insertions(+), 21 deletions(-) Fusion-Task-Id: FN-5904 Fusion-Task-Lineage: 338d53e3-baba-4c6c-9173-8e214242403c
This commit is contained in:
@@ -756,6 +756,8 @@ For setup prerequisites, security caveats for tokenized URLs/QR links, and troub
|
||||
|
||||
## Skills API
|
||||
|
||||
The Skills view now supports the full browse-and-install loop for skills.sh entries: use **Skills Catalog** to search the catalog, click **Install** on any card with a source repository, and the dashboard will run the same installer as the CLI (`npx skills add <owner/repo> -y -a pi`, with `--skill <slug>` when applicable). On success, the view refreshes **Discovered Skills** immediately so the newly installed skill appears without a page reload.
|
||||
|
||||
The Skills API provides endpoints for managing execution skills. Skills are toggled via project-scoped settings in `.fusion/settings.json`.
|
||||
|
||||

|
||||
@@ -871,6 +873,49 @@ Toggle a skill's enabled/disabled state.
|
||||
{ "error": "Skills adapter not configured", "code": "adapter_not_configured" }
|
||||
```
|
||||
|
||||
### POST /api/skills/install
|
||||
|
||||
Install a catalog skill into the current project.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"source": "owner/repo",
|
||||
"skill": "example-skill"
|
||||
}
|
||||
```
|
||||
|
||||
**Behavior:**
|
||||
- Validates `source` in `owner/repo` format before spawning anything
|
||||
- Runs `npx skills add <source> -y -a pi`
|
||||
- Appends `--skill <skill>` when `skill` is provided
|
||||
- Uses the scoped project root as `cwd`, so installed files land in the current project's skill directories
|
||||
|
||||
**Response:** `200 OK`
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
**Error Responses:**
|
||||
- `400 Bad Request` — missing source
|
||||
```json
|
||||
{ "error": "source is required", "code": "invalid_body" }
|
||||
```
|
||||
- `400 Bad Request` — malformed source
|
||||
```json
|
||||
{ "error": "Invalid source format. Use owner/repo.", "code": "invalid_source" }
|
||||
```
|
||||
- `404 Not Found` — adapter not configured
|
||||
```json
|
||||
{ "error": "Skills adapter not configured", "code": "adapter_not_configured" }
|
||||
```
|
||||
- `502 Bad Gateway` — installer failed/timed out/could not start
|
||||
```json
|
||||
{ "error": "installer failed", "code": "install_failed" }
|
||||
```
|
||||
|
||||
### GET /api/skills/catalog
|
||||
|
||||
Fetch the skills.sh catalog with optional authentication.
|
||||
|
||||
Reference in New Issue
Block a user