Repository navigation
Revert "feat: Add ai-skills federated content and data" - #48146
jeremenichelli wants to merge 1 commit into
Conversation
This reverts commit b90c84d.
|
Issue reopened: DOCS-1189 Pre-fetch ai-skills data to markdown |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
📝 WalkthroughWalkthroughAI skills now load from the upstream GitHub repository, parse ChangesAI skills integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AiSkillsIndex
participant getAiSkills
participant GitHub
participant CopyButton
participant Clipboard
AiSkillsIndex->>getAiSkills: load skill summaries
getAiSkills->>GitHub: list skills and fetch SKILL.md files
GitHub-->>getAiSkills: skill metadata
getAiSkills-->>AiSkillsIndex: sorted skills
AiSkillsIndex-->>CopyButton: render install command
CopyButton->>Clipboard: write command text
Clipboard-->>CopyButton: copy completed
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
apps/docs/app/guides/getting-started/ai-skills/AiSkillsIndex.tsx (1)
25-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueEnhance table accessibility with scope attributes.
Consider adding
scope="col"to the table headers to explicitly associate them with their respective columns, which improves screen reader navigation.♿ Proposed accessibility fix
- <th className="text-left py-2 pr-4 text-foreground-lighter font-medium">Skill</th> - <th className="text-left py-2 pr-4 text-foreground-lighter font-medium">Description</th> - <th className="text-left py-2 text-foreground-lighter font-medium">Install command</th> + <th scope="col" className="text-left py-2 pr-4 text-foreground-lighter font-medium">Skill</th> + <th scope="col" className="text-left py-2 pr-4 text-foreground-lighter font-medium">Description</th> + <th scope="col" className="text-left py-2 text-foreground-lighter font-medium">Install command</th>🤖 Prompt for 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. In `@apps/docs/app/guides/getting-started/ai-skills/AiSkillsIndex.tsx` around lines 25 - 27, Add scope="col" to each table header in the AiSkillsIndex table, including the Skill, Description, and Install command headers, to explicitly identify them as column headers. Preserve the existing styling and header text.apps/docs/app/guides/getting-started/ai-skills/CopyButton.tsx (1)
10-14: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winClear overlapping timeouts and handle clipboard unavailability gracefully.
If the user clicks the copy button multiple times, multiple timeouts will overlap, causing the UI to reset prematurely. Also, in certain insecure contexts,
navigator.clipboardmight be undefined, which would trigger an unhandled promise rejection.♻️ Proposed robust clipboard handling
Add
useRefto your imports at the top:import { useState, useRef } from 'react'Then, update the copy handler:
- const handleCopy = async () => { - await navigator.clipboard.writeText(text) - setCopied(true) - setTimeout(() => setCopied(false), 2000) - } + const timeoutRef = useRef<NodeJS.Timeout>(null) + + const handleCopy = async () => { + try { + await navigator.clipboard?.writeText(text) + setCopied(true) + if (timeoutRef.current) clearTimeout(timeoutRef.current) + timeoutRef.current = setTimeout(() => setCopied(false), 2000) + } catch { + // Fallback or ignore if the clipboard API is blocked/unavailable + } + }🤖 Prompt for 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. In `@apps/docs/app/guides/getting-started/ai-skills/CopyButton.tsx` around lines 10 - 14, Update handleCopy to guard against navigator.clipboard being unavailable and handle writeText failures without an unhandled rejection. Store the timeout handle in a useRef, clear any existing timeout before scheduling a new reset, and preserve the copied-state behavior after a successful write.apps/docs/app/guides/getting-started/ai-skills/AiSkills.utils.ts (1)
40-57: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winHandle individual file fetch errors to prevent cascading failures.
Currently, if a single skill directory is missing a
SKILL.mdfile or its fetch fails, thePromise.allwill reject, causing the entire AI skills table to fail to load. Catching errors per skill ensures that valid skills are still displayed.🛡️ Proposed fix to allow partial successes
const skills = await Promise.all( skillDirs.map(async (item) => { - const skillPath = `${SKILLS_REPO.path}/${item.name}/SKILL.md` - const rawContent = await getGitHubFileContents({ - org: SKILLS_REPO.org, - repo: SKILLS_REPO.repo, - branch: SKILLS_REPO.branch, - path: skillPath, - }) - const { data } = matter(rawContent) as { data: SkillMetadata } - - return { - name: item.name, - description: data.description || '', - installCommand: `npx skills add supabase/agent-skills --skill ${item.name}`, - } + try { + const skillPath = `${SKILLS_REPO.path}/${item.name}/SKILL.md` + const rawContent = await getGitHubFileContents({ + org: SKILLS_REPO.org, + repo: SKILLS_REPO.repo, + branch: SKILLS_REPO.branch, + path: skillPath, + }) + const { data } = matter(rawContent) as { data: SkillMetadata } + + return { + name: item.name, + description: data.description || '', + installCommand: `npx skills add supabase/agent-skills --skill ${item.name}`, + } + } catch (error) { + // Log error and return null to prevent failing the entire batch + console.error(`Failed to load skill metadata for ${item.name}:`, error) + return null + } }) ) + + // Filter out failed skill loads + const validSkills = skills.filter((skill): skill is SkillSummary => skill !== null)Make sure to adjust the final return statement to sort
validSkillsinstead ofskills:return validSkills.sort((a, b) => a.name.localeCompare(b.name))🤖 Prompt for 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. In `@apps/docs/app/guides/getting-started/ai-skills/AiSkills.utils.ts` around lines 40 - 57, Update the skill mapping flow around Promise.all to catch fetch or parsing errors for each individual skill, exclude failed entries, and retain successful skills. Store the filtered results as validSkills and sort validSkills in the final return statement instead of the rejected-prone skills collection.
🤖 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.
Nitpick comments:
In `@apps/docs/app/guides/getting-started/ai-skills/AiSkills.utils.ts`:
- Around line 40-57: Update the skill mapping flow around Promise.all to catch
fetch or parsing errors for each individual skill, exclude failed entries, and
retain successful skills. Store the filtered results as validSkills and sort
validSkills in the final return statement instead of the rejected-prone skills
collection.
In `@apps/docs/app/guides/getting-started/ai-skills/AiSkillsIndex.tsx`:
- Around line 25-27: Add scope="col" to each table header in the AiSkillsIndex
table, including the Skill, Description, and Install command headers, to
explicitly identify them as column headers. Preserve the existing styling and
header text.
In `@apps/docs/app/guides/getting-started/ai-skills/CopyButton.tsx`:
- Around line 10-14: Update handleCopy to guard against navigator.clipboard
being unavailable and handle writeText failures without an unhandled rejection.
Store the timeout handle in a useRef, clear any existing timeout before
scheduling a new reset, and preserve the copied-state behavior after a
successful write.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9f61f884-42da-4854-b5e5-d2bc70ee8103
📒 Files selected for processing (6)
apps/docs/app/guides/getting-started/ai-skills/AiSkills.utils.tsapps/docs/app/guides/getting-started/ai-skills/AiSkillsIndex.tsxapps/docs/app/guides/getting-started/ai-skills/CopyButton.tsxapps/docs/internals/generate-guides-markdown.tsapps/docs/internals/markdown-schema/AiSkillsIndex.tsapps/docs/scripts/federated-content/fetch-federated-content.ts
💤 Files with no reviewable changes (2)
- apps/docs/internals/generate-guides-markdown.ts
- apps/docs/internals/markdown-schema/AiSkillsIndex.ts
Reverts #48045
Summary by CodeRabbit
New Features
Bug Fixes