-
-
Notifications
You must be signed in to change notification settings - Fork 78.7k
Expand file tree
/
Copy pathSkillsTable.astro
More file actions
57 lines (50 loc) · 1.47 KB
/
Copy pathSkillsTable.astro
File metadata and controls
57 lines (50 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
import { getConfig } from '@libs/config'
import { docsPages, getDocsPageSlug } from '@libs/content'
import { getVersionedDocsPath } from '@libs/path'
import { getSkills } from '@libs/skills'
// Render the agent skills table from each `SKILL.md` frontmatter so the docs
// stay in sync with the skill files. Markup mirrors the `BsTable` shortcode.
const skills = getSkills()
const { repo } = getConfig()
function getGuide(guide: string | undefined) {
if (!guide) {
return undefined
}
const slug = guide.replace(/^\//, '')
const page = docsPages.find((docsPage) => getDocsPageSlug(docsPage.id) === slug)
if (!page) {
return undefined
}
return { href: getVersionedDocsPath(slug), label: page.data.title }
}
---
<div class="table-responsive">
<table class="table md:table-stacked">
<thead>
<tr>
<th scope="col">Skill</th>
<th scope="col">Description</th>
<th scope="col">Guide</th>
</tr>
</thead>
<tbody>
{
skills.map((skill) => {
const guide = getGuide(skill.guide)
return (
<tr>
<td>
<a href={`${repo}/tree/main/skills/${skill.name}`}>
<code class="text-nowrap">{skill.name}</code>
</a>
</td>
<td>{skill.description}</td>
<td>{guide ? <a href={guide.href}>{guide.label}</a> : '—'}</td>
</tr>
)
})
}
</tbody>
</table>
</div>