diff --git a/.changeset/agentconnect-root-skill-alias.md b/.changeset/agentconnect-root-skill-alias.md new file mode 100644 index 0000000..8c46f92 --- /dev/null +++ b/.changeset/agentconnect-root-skill-alias.md @@ -0,0 +1,5 @@ +--- +'@polygonlabs/agentconnect-ui': patch +--- + +Serve the canonical skill at the legacy root URL. The build now aliases `polygon-agent-cli/SKILL.md` to `/SKILL.md` in the deployed assets, so `https://agentconnect.polygon.technology/SKILL.md` returns the skill markdown (200) instead of falling back to the SPA `index.html`. Deploy-only copy; the repo `skills/` tree is unchanged, so `npx skills add` still lists one canonical skill. diff --git a/packages/agentconnect-ui/vite.config.ts b/packages/agentconnect-ui/vite.config.ts index abeeae2..7cc1056 100644 --- a/packages/agentconnect-ui/vite.config.ts +++ b/packages/agentconnect-ui/vite.config.ts @@ -12,10 +12,19 @@ const pkgDir = path.dirname(fileURLToPath(import.meta.url)); const skillsDir = path.resolve(pkgDir, '../../skills'); // Copy the repo's agent skill tree into the build output so the deployed -// Cloudflare worker serves them as static assets at /SKILL.md, -// /polygon-agent-cli/SKILL.md, /polygon-defi/SKILL.md, etc. — the URLs the -// dashboard and the skills themselves reference. Without this the skills are -// only reachable from the retired connector-ui deployment. +// Cloudflare worker serves them as static assets at /polygon-agent-cli/SKILL.md, +// /polygon-defi/SKILL.md, etc. — the URLs the dashboard and the skills +// themselves reference. Without this the skills are only reachable from the +// retired connector-ui deployment. +// +// Also alias the canonical skill to the legacy root /SKILL.md. The repo no +// longer has a root skills/SKILL.md (removed to stop `npx skills add` offering +// two near-identical skills), but external docs and older installs still fetch +// the bare /SKILL.md — without this alias that path hits the SPA fallback and +// returns index.html instead of markdown. This is a deploy-only copy, so it +// does not put a second SKILL.md back into the repo skills/ tree. +const CANONICAL_SKILL = path.join('polygon-agent-cli', 'SKILL.md'); + function serveSkills(): Plugin { let absOutDir = path.resolve(pkgDir, 'dist'); return { @@ -32,6 +41,16 @@ function serveSkills(): Plugin { // Mirror skills/* into dist/* (dist already holds the built SPA; the // skill tree only adds .md files under new paths, no collisions). fs.cpSync(skillsDir, absOutDir, { recursive: true }); + + // Legacy /SKILL.md → canonical skill content (200, not a redirect). + const canonical = path.join(skillsDir, CANONICAL_SKILL); + if (fs.existsSync(canonical)) { + fs.copyFileSync(canonical, path.join(absOutDir, 'SKILL.md')); + } else { + console.warn( + `[serve-skills] canonical skill missing at ${canonical}; /SKILL.md not aliased` + ); + } } }; }