Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/agentconnect-root-skill-alias.md
Original file line number Diff line number Diff line change
@@ -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.
27 changes: 23 additions & 4 deletions packages/agentconnect-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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`
);
}
}
};
}
Expand Down
Loading