feat: serve agent skills from .well-known/agent-skills at build time - #45641
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
7 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR adds an automated agent skills fetching step to the build process. A new Node.js script downloads the latest release assets from the supabase/agent-skills GitHub repository, stores them in ChangesAgent Skills Build Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fetches the latest supabase/agent-skills semver release at build time and writes index.json + skill tarballs to public/.well-known/agent-skills/. Adds digest verification: each skill artifact is verified against the sha256 digest in index.json per the agent-skills .well-known URI spec v0.2.0. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
7de1588 to
0136b0f
Compare
- Resolve each skill artifact URL against the index URL per RFC 3986 §5.2.2 so relative, path-absolute, and fully-absolute (e.g. CDN) URLs all work - Verify each artifact digest from the in-memory buffer before writing to disk - Buffer all downloads first; only write to public/.well-known/agent-skills/ after all digests pass Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ll hosting Following Greg's review: the RFC 3986 URL resolution complexity isn't needed since we control both ends and skill.url is always relative. Going further: tarballs no longer downloaded or hosted. The index.json is rewritten with absolute GitHub Release URLs so clients fetch tarballs directly from GitHub. The digest is the trust anchor (same as SRI on the web) — the URL is just a location hint. Result: one fetch (index.json), one rewrite, one write to disk. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…45641) ## Summary This PR makes `fetchAgentSkills.mjs` a spec-compliant client of the [agent-skills `.well-known` URI spec](agentskills/agentskills#254), and updates the script to match the current release structure in [`supabase/agent-skills`](https://github.com/supabase/agent-skills). --- ## 1. Spec-compliant URL resolution and digest verification `fetchAgentSkills.mjs` acts as a client consuming the `.well-known` discovery index. The [agent-skills `.well-known` spec](agentskills/agentskills#254) is explicit on two points: **URL resolution** — skill artifact URLs in `index.json` must be resolved per [RFC 3986 §5.2.2](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.2) using the index URL as the base URI: > "The `url` field specifies where to fetch the skill artifact. URLs are resolved per RFC 3986 Section 5 using the index URL as the base URI." This means `skill.url` can be relative (`supabase.tar.gz`), path-absolute (`/.well-known/agent-skills/supabase.tar.gz`), or fully absolute (e.g. a CDN URL like `https://cdn.example.com/supabase.tar.gz`). The previous implementation extracted a filename with `.split('/').pop()` which happened to work for bare relative URLs but was not doing RFC 3986 resolution. **Digest verification** — clients must verify artifact integrity before use: > "Clients **must** verify downloaded content against the `digest` in the index. A mismatch indicates the content is corrupted or tampered with — clients **must not** use unverified content." The updated script uses `new URL(skill.url, githubReleaseIndexUrl)` for compliant resolution, verifies each artifact's SHA-256 digest from the in-memory buffer before any disk writes, and only writes to `public/.well-known/agent-skills/` once all digests pass. **Acknowledged overhead**: since Supabase owns both the publisher ([`scripts/build-release.ts`](https://github.com/supabase/agent-skills/blob/main/scripts/build-release.ts) in `supabase/agent-skills`) and this consumer, the practical risk of non-compliant URL handling is currently low — the publisher always emits bare relative filenames. However, being spec-compliant here gives us full flexibility to change how skills are packaged or hosted in `supabase/agent-skills` in the future (e.g. moving artifacts to a CDN) without needing to update this script. --- ## 2. Semver release tags #44878 referenced `supabase/agent-skills#66` (date+SHA tags). [supabase/agent-skills#77](supabase/agent-skills#77) has since merged, moving releases to semver tags managed by Release Please. `/releases/latest` works for both formats — no code change needed, just a rebase. --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Summary
This PR makes
fetchAgentSkills.mjsa spec-compliant client of the agent-skills.well-knownURI spec, and updates the script to match the current release structure insupabase/agent-skills.1. Spec-compliant URL resolution and digest verification
fetchAgentSkills.mjsacts as a client consuming the.well-knowndiscovery index. The agent-skills.well-knownspec is explicit on two points:URL resolution — skill artifact URLs in
index.jsonmust be resolved per RFC 3986 §5.2.2 using the index URL as the base URI:This means
skill.urlcan be relative (supabase.tar.gz), path-absolute (/.well-known/agent-skills/supabase.tar.gz), or fully absolute (e.g. a CDN URL likehttps://cdn.example.com/supabase.tar.gz). The previous implementation extracted a filename with.split('/').pop()which happened to work for bare relative URLs but was not doing RFC 3986 resolution.Digest verification — clients must verify artifact integrity before use:
The updated script uses
new URL(skill.url, githubReleaseIndexUrl)for compliant resolution, verifies each artifact's SHA-256 digest from the in-memory buffer before any disk writes, and only writes topublic/.well-known/agent-skills/once all digests pass.Acknowledged overhead: since Supabase owns both the publisher (
scripts/build-release.tsinsupabase/agent-skills) and this consumer, the practical risk of non-compliant URL handling is currently low — the publisher always emits bare relative filenames. However, being spec-compliant here gives us full flexibility to change how skills are packaged or hosted insupabase/agent-skillsin the future (e.g. moving artifacts to a CDN) without needing to update this script.2. Semver release tags
#44878 referenced
supabase/agent-skills#66(date+SHA tags). supabase/agent-skills#77 has since merged, moving releases to semver tags managed by Release Please./releases/latestworks for both formats — no code change needed, just a rebase.