feat: advertise and serve agent skills from .well-known#44878
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. |
📝 WalkthroughWalkthroughA new build-time script is added to fetch the latest ChangesAgent Skills Fetching Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
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 docstrings
🧪 Generate unit tests (beta)
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 |
…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>
…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>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/www/scripts/fetchAgentSkills.mjs`:
- Around line 40-55: The script currently only writes index.json but doesn't
download the per-skill tarball artifacts, so clients expecting site-hosted
archives will fail; update the logic after computing assetUrls and rewritten to
iterate over (index.skills ?? []) and for each skill whose url maps to an asset
(assetUrls[skill.url] exists) fetch the asset from assetUrls[skill.url] and
write the downloaded bytes into OUT_DIR using the asset filename (use the same
key from assetUrls, e.g., release.assets names), ensuring you create OUT_DIR
(already done) and handle fetch errors (log/throw) so the per-skill .tar.gz
files are present alongside index.json; reference variables/functions:
assetUrls, release.assets, index.skills, OUT_DIR, rewritten.
- Around line 43-50: The current rewrite uses exact asset-name lookup
(assetUrls[skill.url]) which fails for relative or path/absolute URLs; change
the logic in the rewritten.skills mapping to resolve skill.url per RFC3986 using
the URL constructor against a sensible base (e.g. index.url or the release
HTML/base URL), then normalize and attempt to match assets by normalized
pathname or basename (derive each asset's URL pathname via new
URL(asset.browser_download_url).pathname or path.basename) and substitute with
the matched asset.browser_download_url; if URL construction throws or no asset
matches, fall back to the original skill.url. Ensure you update the code that
builds assetUrls and the mapping inside rewritten.skills to use the resolved URL
and pathname-based matching rather than a raw key lookup of skill.url.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: df4dd813-b7e1-4b4e-ae13-e6f79cdb9ceb
📒 Files selected for processing (2)
apps/www/package.jsonapps/www/scripts/fetchAgentSkills.mjs
3845043 to
dfb297b
Compare
|
Waiting for supabase/agent-skills#85 to be merged and |
Implements the consumer half of the agent-skills
.well-knowndiscovery spec forsupabase.com. The publisher side lives insupabase/agent-skills, which ships per-skill.tar.gzarchives and anindex.jsonas assets on each GitHub release.At
wwwbuild time,scripts/fetchAgentSkills.mjs:https://api.github.com/repos/supabase/agent-skills/releases/latest.index.json.skill.urlfrom the relative filename in the published index (e.g.supabase.tar.gz) to the absolute GitHub Release asset URL.apps/www/public/.well-known/agent-skills/index.json.Tarballs are not downloaded or hosted by
supabase.com.supabase.comonly serves the discovery index; clients fetch the archives directly from GitHub Releases. The SHA-256 digest in each skill entry — set by the publisher and unchanged by this script — is the trust anchor, the same pattern as Subresource Integrity on the web.Do not merge until supabase/agent-skills#77 is merged and the build process is tested.
Summary by CodeRabbit
New Features
Chores