fix: use per-skill discovery URL in installCommand#50
Conversation
The skills CLI ignores --skill=name (equals form) and would otherwise download the full catalog. Serve a one-entry well-known index under each skill path so npx skills add auto-selects that skill. Assisted-by: Cursor Grok 4.5 Co-authored-by: Cursor <cursoragent@cursor.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: johnmcollier The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
PR Summary by QodoFix installCommand by using per-skill discovery URL
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1. Web spec install drift
|
| // Point at the per-skill discovery URL. The CLI looks for | ||
| // <url>/.well-known/agent-skills/index.json first; that single-entry index | ||
| // auto-selects this skill. Host root + `--skill=…` fails because the skills CLI | ||
| // does not parse the equals form of --skill, and would download the full catalog. | ||
| const installCommand = | ||
| `npx skills add ${baseUrl}/api/v1/skills/${encodeURIComponent(skill.sourceSlug)}/${encodeURIComponent(skill.slug)}`; | ||
| return { |
There was a problem hiding this comment.
1. Web spec install drift 🐞 Bug ⚙ Maintainability
The server now returns installCommand as npx skills add <base>/api/v1/skills/<source>/<slug>, but the OpenSpec web-directory requirement still mandates a --skill <source>/<slug> command, making the spec inaccurate and likely to mislead future UI/conformance work.
Agent Prompt
## Issue description
The OpenSpec web-directory requirements still specify the old install command format (`npx skills add <server-url> --skill <source>/<slug>`), but the implementation now emits a per-skill discovery URL (`npx skills add …/api/v1/skills/:source/:slug`). This spec mismatch can cause future UI changes, conformance checks, or documentation to reintroduce the wrong command.
## Issue Context
- The PR changed `installCommand` generation to point at the per-skill discovery URL.
- OpenSpec web-directory specs still reference the old `--skill` form.
## Fix Focus Areas
- openspec/specs/web-directory/spec.md[17-20]
- openspec/changes/archive/2026-06-26-rhess-enterprise-skills-server/specs/web-directory/spec.md[17-20]
- src/server/routes/skills.ts[54-60]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // Per-skill discovery index — registered before /:source/:slug. | ||
| // Consumed by `npx skills add <base>/api/v1/skills/:source/:slug`, which probes | ||
| // `<url>/.well-known/agent-skills/index.json` before falling back to the host root. | ||
| fastify.get( | ||
| "/:source/:slug/.well-known/agent-skills/index.json", | ||
| { |
There was a problem hiding this comment.
2. Openapi not regenerated 🐞 Bug ⚙ Maintainability
A new discovery endpoint (GET /api/v1/skills/:source/:slug/.well-known/agent-skills/index.json) was added, but the committed openapi.yaml (generated via npm run openapi) does not document it, so tooling/consumers relying on the checked-in spec will miss the endpoint.
Agent Prompt
## Issue description
The PR adds a new per-skill discovery endpoint, but the repository’s committed OpenAPI spec (`openapi.yaml`) appears stale and does not include that route. Since the repo has a dedicated generator script, the expected workflow is to regenerate and commit the updated spec when routes/schemas change.
## Issue Context
- `scripts/generate-openapi.ts` generates `openapi.yaml` from Fastify’s runtime schema.
- `openapi.yaml` currently documents only the root well-known index under `/.well-known/agent-skills/index.json` and does not include the new per-skill index route.
## Fix Focus Areas
- src/server/routes/skills.ts[275-350]
- scripts/generate-openapi.ts[1-17]
- openapi.yaml[710-755]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
npx skillsdoes not parse--skill=name, so RHESS install commands that used the equals form never preselected a skill and fell through to the full catalog./api/v1/skills/:source/:slug/.well-known/agent-skills/index.json.installCommandtonpx skills add <host>/api/v1/skills/:source/:slugso the CLI finds one skill and auto-selects it (no full-catalog download).Test plan
npx vitest run test/server/routes/skills.test.ts test/server/routes/wellKnown.test.tsnpx skills add <base>/api/v1/skills/awesome-copilot/arch-linux-triage --list→Found 1 skillarch-linux-triageand confirm it installs only that skillMade with Cursor