Skip to content

Commit db6a0cc

Browse files
feat(skills): support git-sourced skills in restore flow
skills.sh now handles two source types: GitHub (existing behavior) and git (new). Git-sourced skills are grouped by sourceUrl so each remote is cloned once, with -s flags to pick specific skills. Sets GIT_LFS_SKIP_SMUDGE=1 to avoid choking on repos with LFS objects. Also updates skill-lock.json with diataxis and technical-writing from alpha's dotfiles (Gitea), and removes stale craftdesk reference from claudeconfig.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f1f5b10 commit db6a0cc

3 files changed

Lines changed: 46 additions & 6 deletions

File tree

agents/.skill-lock.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@
88
"skillPath": "dg/SKILL.md",
99
"skillFolderHash": "fcbfa793d2e40c0a84fef9cb97b84919f1c51442",
1010
"installedAt": "2026-04-03T13:22:15.516Z",
11-
"updatedAt": "2026-04-03T13:22:15.516Z"
11+
"updatedAt": "2026-04-03T15:23:45.081Z"
12+
},
13+
"diataxis": {
14+
"source": "alpha/dotfiles",
15+
"sourceType": "git",
16+
"sourceUrl": "https://git.kejadlen.dev/alpha/dotfiles.git",
17+
"skillPath": "ai/skills/diataxis/SKILL.md",
18+
"skillFolderHash": "",
19+
"installedAt": "2026-04-06T15:37:40.760Z",
20+
"updatedAt": "2026-04-06T15:37:40.760Z"
21+
},
22+
"technical-writing": {
23+
"source": "alpha/dotfiles",
24+
"sourceType": "git",
25+
"sourceUrl": "https://git.kejadlen.dev/alpha/dotfiles.git",
26+
"skillPath": "ai/skills/technical-writing/SKILL.md",
27+
"skillFolderHash": "",
28+
"installedAt": "2026-04-06T15:37:40.762Z",
29+
"updatedAt": "2026-04-06T15:37:40.762Z"
1230
}
1331
},
1432
"dismissed": {

claudeconfig.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,4 @@ echo "✓ Claude Code configuration complete"
286286
echo " Settings: $HOME/.claude/settings.json"
287287
echo " Role: $ROLE"
288288
echo ""
289-
echo "Note: Skills are now installed per-project via craftdesk."
290-
echo " Run 'craftdesk-setup' in a project to configure skills."
289+
echo "Note: Global skills are restored from ~/.agents/.skill-lock.json via skills.sh"

skills.sh

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,33 @@ if ! command -v npx &>/dev/null; then
1717
exit 0
1818
fi
1919

20-
# Restore globally installed skills from the lock file
21-
jq -r '.skills | to_entries[] | .value.source' "$HOME/.agents/.skill-lock.json" | while read -r source; do
22-
echo " 📦 installing $source"
20+
LOCK_FILE="$HOME/.agents/.skill-lock.json"
21+
22+
# Restore GitHub-sourced skills (simple: one skill per source)
23+
jq -r '.skills | to_entries[] | select(.value.sourceType == "github") | .value.source' "$LOCK_FILE" | while read -r source; do
24+
echo " 📦 installing $source (github)"
2325
npx -y skills add "$source" -g -y
2426
done
2527

28+
# Restore git-sourced skills (grouped by sourceUrl, with -s flags per skill)
29+
# Skip LFS smudge since remote repos may have LFS objects we don't need
30+
jq -r '
31+
[.skills | to_entries[] | select(.value.sourceType == "git")]
32+
| group_by(.value.sourceUrl)[]
33+
| { url: .[0].value.sourceUrl, skills: [.[].key] }
34+
| @json
35+
' "$LOCK_FILE" | while read -r group; do
36+
url=$(echo "$group" | jq -r '.url')
37+
mapfile -t skill_names < <(echo "$group" | jq -r '.skills[]')
38+
39+
skill_flags=""
40+
for name in "${skill_names[@]}"; do
41+
skill_flags="$skill_flags -s $name"
42+
done
43+
44+
echo " 📦 installing ${skill_names[*]} from $url"
45+
# shellcheck disable=SC2086
46+
GIT_LFS_SKIP_SMUDGE=1 npx -y skills add "$url" $skill_flags -g -y
47+
done
48+
2649
echo

0 commit comments

Comments
 (0)