Skip to content

Commit 656d0cc

Browse files
gmulatGitHub Enterprise
authored andcommitted
Fix gemini setup - problem with skills not being at the first level (#6)
1 parent c73bc24 commit 656d0cc

2 files changed

Lines changed: 48 additions & 22 deletions

File tree

scripts/install-global-skills.ps1

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,37 @@ try {
2323

2424
Write-Host "Installing Polyspace skills to $SkillsDir"
2525

26-
# Create symlinks/junctions for each skill group
26+
# Create flat per-skill symlinks so that each SKILL.md is at depth */SKILL.md
27+
# (Gemini CLI discovers skills with a one-level-deep glob only).
2728
foreach ($GroupDir in Get-ChildItem -Path $SkillsCatalog -Directory) {
28-
$GroupName = $GroupDir.Name
29-
$LinkName = "polyspace-$GroupName"
30-
$LinkPath = Join-Path $SkillsDir $LinkName
31-
32-
if (Test-Path $LinkPath) {
33-
Remove-Item $LinkPath -Force -Recurse
29+
# If the group itself has a SKILL.md, link it directly
30+
$DirectSkill = Join-Path $GroupDir.FullName "SKILL.md"
31+
if (Test-Path $DirectSkill) {
32+
$LinkName = $GroupDir.Name
33+
$LinkPath = Join-Path $SkillsDir $LinkName
34+
if (Test-Path $LinkPath) { Remove-Item $LinkPath -Force -Recurse }
35+
try {
36+
New-Item -ItemType SymbolicLink -Path $LinkPath -Target $GroupDir.FullName | Out-Null
37+
} catch {
38+
cmd /c mklink /J "$LinkPath" "$($GroupDir.FullName)" | Out-Null
39+
}
40+
Write-Host " Linked: $LinkName -> $($GroupDir.FullName)"
3441
}
3542

36-
try {
37-
New-Item -ItemType SymbolicLink -Path $LinkPath -Target $GroupDir.FullName | Out-Null
38-
} catch {
39-
# Fall back to junction if symlink requires admin
40-
cmd /c mklink /J "$LinkPath" "$($GroupDir.FullName)" | Out-Null
43+
# Link each sub-skill individually
44+
foreach ($SkillDir in Get-ChildItem -Path $GroupDir.FullName -Directory) {
45+
$SkillFile = Join-Path $SkillDir.FullName "SKILL.md"
46+
if (-not (Test-Path $SkillFile)) { continue }
47+
$LinkName = $SkillDir.Name
48+
$LinkPath = Join-Path $SkillsDir $LinkName
49+
if (Test-Path $LinkPath) { Remove-Item $LinkPath -Force -Recurse }
50+
try {
51+
New-Item -ItemType SymbolicLink -Path $LinkPath -Target $SkillDir.FullName | Out-Null
52+
} catch {
53+
cmd /c mklink /J "$LinkPath" "$($SkillDir.FullName)" | Out-Null
54+
}
55+
Write-Host " Linked: $LinkName -> $($SkillDir.FullName)"
4156
}
42-
Write-Host " Linked: $LinkName -> $($GroupDir.FullName)"
4357
}
4458

4559
Write-Host "Done. Skills installed to $SkillsDir"

scripts/install-global-skills.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,30 @@ fi
2323

2424
echo "Installing Polyspace skills to $SKILLS_DIR"
2525

26-
# Create symlinks for each skill group
26+
# Create flat per-skill symlinks so that each SKILL.md is at depth */SKILL.md
27+
# (Gemini CLI discovers skills with a one-level-deep glob only).
2728
for group_dir in "$SKILLS_CATALOG"/*/; do
28-
group_name=$(basename "$group_dir")
29-
link_name="polyspace-$group_name"
30-
link_path="$SKILLS_DIR/$link_name"
31-
32-
if [ -L "$link_path" ]; then
33-
rm "$link_path"
29+
[ -d "$group_dir" ] || continue
30+
31+
# If the group itself has a SKILL.md, link it directly
32+
if [ -f "$group_dir/SKILL.md" ]; then
33+
link_name=$(basename "$group_dir")
34+
link_path="$SKILLS_DIR/$link_name"
35+
[ -L "$link_path" ] && rm "$link_path"
36+
ln -s "$group_dir" "$link_path"
37+
echo " Linked: $link_name -> $group_dir"
3438
fi
3539

36-
ln -s "$group_dir" "$link_path"
37-
echo " Linked: $link_name -> $group_dir"
40+
# Link each sub-skill individually
41+
for skill_dir in "$group_dir"/*/; do
42+
[ -d "$skill_dir" ] || continue
43+
[ -f "$skill_dir/SKILL.md" ] || continue
44+
link_name=$(basename "$skill_dir")
45+
link_path="$SKILLS_DIR/$link_name"
46+
[ -L "$link_path" ] && rm "$link_path"
47+
ln -s "$skill_dir" "$link_path"
48+
echo " Linked: $link_name -> $skill_dir"
49+
done
3850
done
3951

4052
echo "Done. Skills installed to $SKILLS_DIR"

0 commit comments

Comments
 (0)