-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: list Agent Skills a repo publishes #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| /** | ||
| * SKILL.md files come from other people's repositories, so the reader has to | ||
| * cope with the forms the spec allows and degrade on the ones it does not. | ||
| */ | ||
|
|
||
| import assert from "node:assert/strict"; | ||
| import test from "node:test"; | ||
|
|
||
| import { parseSkill } from "./skills.ts"; | ||
|
|
||
| test("reads the required fields", () => { | ||
| const s = parseSkill( | ||
| "pdf-processing", | ||
| `--- | ||
| name: pdf-processing | ||
| description: Extract PDF text and fill forms. Use when handling PDFs. | ||
| --- | ||
|
|
||
| # PDF processing | ||
|
|
||
| Body text. | ||
| `, | ||
| )!; | ||
| assert.equal(s.dir, "pdf-processing"); | ||
| assert.equal(s.name, "pdf-processing"); | ||
| assert.match(s.description, /Extract PDF text/); | ||
| assert.match(s.body, /^# PDF processing/); | ||
| }); | ||
|
|
||
| test("reads the optional fields the spec defines", () => { | ||
| const s = parseSkill( | ||
| "x", | ||
| `--- | ||
| name: x | ||
| description: does a thing | ||
| license: Apache-2.0 | ||
| compatibility: Requires git and jq | ||
| allowed-tools: Bash(git:*) Read | ||
| --- | ||
| body | ||
| `, | ||
| )!; | ||
| assert.equal(s.license, "Apache-2.0"); | ||
| assert.equal(s.compatibility, "Requires git and jq"); | ||
| assert.equal(s.allowedTools, "Bash(git:*) Read"); | ||
| }); | ||
|
|
||
| test("handles quoted values", () => { | ||
| const s = parseSkill( | ||
| "x", | ||
| `--- | ||
| name: "x" | ||
| description: 'Uses: colons, and commas' | ||
| --- | ||
| `, | ||
| )!; | ||
| assert.equal(s.name, "x"); | ||
| assert.equal(s.description, "Uses: colons, and commas"); | ||
| }); | ||
|
|
||
| test("handles a folded description", () => { | ||
| const s = parseSkill( | ||
| "x", | ||
| `--- | ||
| name: x | ||
| description: > | ||
| One long sentence that the author | ||
| wrapped over several lines. | ||
| --- | ||
| `, | ||
| )!; | ||
| assert.equal( | ||
| s.description, | ||
| "One long sentence that the author wrapped over several lines.", | ||
| ); | ||
| }); | ||
|
|
||
| test("handles a literal block, keeping its newlines", () => { | ||
| const s = parseSkill( | ||
| "x", | ||
| `--- | ||
| name: x | ||
| description: | | ||
| line one | ||
| line two | ||
| --- | ||
| `, | ||
| )!; | ||
| assert.equal(s.description, "line one\nline two"); | ||
| }); | ||
|
|
||
| test("skips nested structures it does not model", () => { | ||
| // `metadata` is an arbitrary map; its keys must not leak into the fields. | ||
| const s = parseSkill( | ||
| "x", | ||
| `--- | ||
| name: x | ||
| metadata: | ||
| author: someone | ||
| version: "1.0" | ||
| description: after the nested block | ||
| --- | ||
| `, | ||
| )!; | ||
| assert.equal(s.description, "after the nested block"); | ||
| assert.equal(s.name, "x"); | ||
| }); | ||
|
|
||
| test("falls back to the directory name when name is absent", () => { | ||
| const s = parseSkill("from-dir", `---\ndescription: d\n---\n`)!; | ||
| assert.equal(s.name, "from-dir"); | ||
| }); | ||
|
|
||
| test("rejects a file with no description", () => { | ||
| // The spec requires it, and without one there is nothing worth listing. | ||
| assert.equal(parseSkill("x", `---\nname: x\n---\nbody`), null); | ||
| }); | ||
|
|
||
| test("rejects a file with no frontmatter", () => { | ||
| assert.equal(parseSkill("x", "# Just markdown\n"), null); | ||
| }); | ||
|
|
||
| test("rejects an unterminated frontmatter block", () => { | ||
| assert.equal(parseSkill("x", "---\nname: x\ndescription: d\n"), null); | ||
| }); | ||
|
|
||
| test("tolerates CRLF line endings", () => { | ||
| const s = parseSkill("x", "---\r\nname: x\r\ndescription: d\r\n---\r\nbody\r\n")!; | ||
| assert.equal(s.description, "d"); | ||
| assert.equal(s.body, "body"); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When more than 25 directories exist under
skills/, this truncates the sorted directory list before checking forSKILL.md, so unrelated or invalid directories can consume the limit and cause valid published skills to be omitted or the page to report that no skills exist.