fix: install.sh — section GLOBAL : détection skills sans sous-dossier catégorie

Problème : .codex/skills/ha-log-investigator/SKILL.md n'a pas de niveau
catégorie contrairement à .claude/skills/infra/ha-log-investigator/SKILL.md.
Le parsing cat/skill était donc faux pour codex (cat=skill, skill="SKILL").

Fix :
- gen_global_section() détecte la profondeur via le nombre de / dans le chemin
- cat_name vide si skill directement sous skills/ (structure codex)
- find exclut les dossiers cachés (*.system*, etc.) via -not -path '*/.*'
- preview_script g: construit le chemin selon présence ou non de cat_name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 10:31:13 +02:00
parent 75d833d123
commit 358b0f5289
+19 -4
View File
@@ -597,10 +597,21 @@ gen_global_section() {
[[ -z "$base" ]] && continue
while IFS= read -r skill_md; do
rel="${skill_md#${base}/skills/}"
cat_name="${rel%%/*}"; rest="${rel#*/}"; skill_name="${rest%%/*}"
local path_part="${rel%/SKILL.md}"
local slashes="${path_part//[^\/]/}"
local cat_name skill_name display
if [[ "${#slashes}" -ge 1 ]]; then
cat_name="${path_part%%/*}"
skill_name="${path_part#*/}"
display="${cat_name}/${skill_name}"
else
cat_name=""
skill_name="$path_part"
display="$skill_name"
fi
ver=$(grep "^version:" "$skill_md" 2>/dev/null | head -1 | awk '{print $2}')
global_lines+=("g:${agent}|${cat_name}|${skill_name}\t ${GRV_GRAY}${cat_name}/${skill_name}${RESET} ${GRV_GRAY}[${agent}]${RESET} ${GRV_GRAY}v${ver:-?}${RESET}")
done < <(find "${base}/skills" -name "SKILL.md" 2>/dev/null | sort)
global_lines+=("g:${agent}|${cat_name}|${skill_name}\t ${GRV_GRAY}${display}${RESET} ${GRV_GRAY}[${agent}]${RESET} ${GRV_GRAY}v${ver:-?}${RESET}")
done < <(find "${base}/skills" -name "SKILL.md" -not -path '*/.*' 2>/dev/null | sort)
done
if [[ ${#global_lines[@]} -eq 0 ]]; then
printf "d:-\t${GRV_GRAY} (aucun skill installé globalement)${RESET}\n"
@@ -664,7 +675,11 @@ elif [[ "$type" == "g" || ( "$type" == "d" && "$value" != "-" && "$value" != "se
hermes) base="$HOME/.hermes" ;;
*) exit 0 ;;
esac
skill_file="${base}/skills/${cat_name}/${skill_name}/SKILL.md"
if [[ -n "$cat_name" ]]; then
skill_file="${base}/skills/${cat_name}/${skill_name}/SKILL.md"
else
skill_file="${base}/skills/${skill_name}/SKILL.md"
fi
if [[ -f "$skill_file" ]]; then
if command -v bat &>/dev/null; then
bat --style=numbers,header --color=always --language=markdown "$skill_file"