Skip to content

Commit d9f0305

Browse files
BagToadCopilot
andcommitted
test(skills): acceptance coverage for nested skills/ discovery
Add an acceptance test exercising the relaxed skills/ discovery rules: - direct path-based install of a deeply nested skill - direct path-based install of a deeply nested namespaced skill - name-based discovery resolving a deeply nested skill Fix skills-publish-dry-run negative case: the test's testdata contains test-repo/skills/hello-world/SKILL.md under $WORK, which is now discoverable from $WORK due to nested skills/ matching. Point the 'no skills found' assertion at a fresh empty subdirectory so it tests what it claims to. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0647686 commit d9f0305

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Skills can live in a nested skills/ directory under a path prefix
2+
# (e.g. <prefix>/skills/<name>/SKILL.md), as used by repositories that
3+
# organize skills by topic. Both name-based discovery and direct
4+
# path-based install must work for these layouts.
5+
6+
# Use gh as a credential helper
7+
exec gh auth setup-git
8+
9+
# Create a repo with skills nested under prefixes
10+
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --public --add-readme
11+
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING
12+
13+
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING
14+
cd $SCRIPT_NAME-$RANDOM_STRING
15+
16+
# Deeply nested skill: <prefix>/skills/<name>/SKILL.md
17+
mkdir -p group-a/category-x/skills/skill-one
18+
cp $WORK/skill-one.md group-a/category-x/skills/skill-one/SKILL.md
19+
20+
# Deeply nested namespaced skill: <prefix>/skills/<namespace>/<name>/SKILL.md
21+
mkdir -p group-b/category-y/skills/team-alpha/skill-two
22+
cp $WORK/skill-two.md group-b/category-y/skills/team-alpha/skill-two/SKILL.md
23+
24+
exec git add -A
25+
exec git commit -m 'Add nested skills'
26+
exec git push origin main
27+
28+
# Publish so the skills are discoverable
29+
exec gh skill publish --tag v1.0.0
30+
31+
# Install the deeply nested skill by direct path
32+
exec gh skill install $ORG/$SCRIPT_NAME-$RANDOM_STRING group-a/category-x/skills/skill-one --scope user --force
33+
stdout 'Installed skill-one'
34+
exists $HOME/.copilot/skills/skill-one/SKILL.md
35+
grep 'Skill One' $HOME/.copilot/skills/skill-one/SKILL.md
36+
37+
# Install the deeply nested namespaced skill by direct path
38+
exec gh skill install $ORG/$SCRIPT_NAME-$RANDOM_STRING group-b/category-y/skills/team-alpha/skill-two --scope user --force
39+
stdout 'Installed team-alpha/skill-two'
40+
exists $HOME/.copilot/skills/team-alpha/skill-two/SKILL.md
41+
grep 'Skill Two' $HOME/.copilot/skills/team-alpha/skill-two/SKILL.md
42+
43+
# Discovery by name (not path) also finds nested skills
44+
exec gh skill install $ORG/$SCRIPT_NAME-$RANDOM_STRING skill-one --force --dir $WORK/by-name
45+
stdout 'Installed skill-one'
46+
exists $WORK/by-name/skill-one/SKILL.md
47+
48+
-- skill-one.md --
49+
---
50+
name: skill-one
51+
description: Skill One
52+
---
53+
54+
# Skill One
55+
56+
A nested skill discovered under a path prefix.
57+
58+
-- skill-two.md --
59+
---
60+
name: skill-two
61+
description: Skill Two
62+
---
63+
64+
# Skill Two
65+
66+
A nested namespaced skill discovered under a path prefix.

acceptance/testdata/skills/skills-publish-dry-run.txtar

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Publish dry-run from a directory with no skills/ should fail gracefully
2-
! exec gh skill publish --dry-run $WORK
2+
mkdir $WORK/empty-dir
3+
! exec gh skill publish --dry-run $WORK/empty-dir
34
stderr 'no skills found in'
45

56
# Publish dry-run against a valid skill directory should succeed

0 commit comments

Comments
 (0)