Generate skills into temp dir to avoid polluting git status

- generate-skills.py now respects SKILLS_DIR env var
- launchme.sh and updateme.sh generate into mktemp -d, copy to vault,
  then clean up — no more untracked skills/ left in the repo
- Warn the user when python3 is missing so Cowork/Desktop users know
  why .claude/skills/ is absent
This commit is contained in:
gnekt
2026-03-23 21:24:20 +01:00
parent 89b408217a
commit 10ea817aa5
3 changed files with 38 additions and 27 deletions

View File

@@ -16,7 +16,7 @@ import os, re, sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
AGENTS_DIR = os.path.join(ROOT, "agents")
SKILLS_DIR = os.path.join(ROOT, "skills")
SKILLS_DIR = os.environ.get("SKILLS_DIR", os.path.join(ROOT, "skills"))
def parse_agent(path: str):

View File

@@ -82,18 +82,24 @@ success "Copied references"
SKILL_COUNT=0
if command -v python3 >/dev/null 2>&1 && [[ -f "$REPO_DIR/scripts/generate-skills.py" ]]; then
info "Generating skills from agents..."
python3 "$REPO_DIR/scripts/generate-skills.py" >/dev/null 2>&1
fi
SKILLS_TMP="$(mktemp -d)"
SKILLS_DIR="$SKILLS_TMP" python3 "$REPO_DIR/scripts/generate-skills.py" >/dev/null 2>&1 || true
if [[ -d "$REPO_DIR/skills" ]]; then
info "Creating .claude/skills/ in vault..."
for skill_dir in "$REPO_DIR/skills/"*/; do
skill_name="$(basename "$skill_dir")"
mkdir -p "$VAULT_DIR/.claude/skills/$skill_name"
cp "$skill_dir"* "$VAULT_DIR/.claude/skills/$skill_name/" 2>/dev/null || true
SKILL_COUNT=$((SKILL_COUNT + 1))
done
success "Copied $SKILL_COUNT skills"
if [[ -d "$SKILLS_TMP" ]] && ls "$SKILLS_TMP"/*/SKILL.md >/dev/null 2>&1; then
info "Creating .claude/skills/ in vault..."
for skill_dir in "$SKILLS_TMP/"*/; do
skill_name="$(basename "$skill_dir")"
mkdir -p "$VAULT_DIR/.claude/skills/$skill_name"
cp "$skill_dir"* "$VAULT_DIR/.claude/skills/$skill_name/" 2>/dev/null || true
SKILL_COUNT=$((SKILL_COUNT + 1))
done
success "Copied $SKILL_COUNT skills"
fi
rm -rf "$SKILLS_TMP"
else
warn "python3 not found — skipped skills generation (Cowork/Desktop won't have skills)"
warn "Install Python 3 and re-run this script to enable Cowork/Desktop support"
fi
# ── Copy CLAUDE.md ───────────────────────────────────────────────────────────

View File

@@ -77,23 +77,28 @@ done
# ── Regenerate and update skills ───────────────────────────────────────────
SKILL_COUNT=0
if command -v python3 >/dev/null 2>&1 && [[ -f "$REPO_DIR/scripts/generate-skills.py" ]]; then
python3 "$REPO_DIR/scripts/generate-skills.py" >/dev/null 2>&1
fi
SKILLS_TMP="$(mktemp -d)"
SKILLS_DIR="$SKILLS_TMP" python3 "$REPO_DIR/scripts/generate-skills.py" >/dev/null 2>&1 || true
if [[ -d "$REPO_DIR/skills" ]]; then
for skill_dir in "$REPO_DIR/skills/"*/; do
skill_name="$(basename "$skill_dir")"
src="$skill_dir/SKILL.md"
dst="$VAULT_DIR/.claude/skills/$skill_name/SKILL.md"
if [[ -f "$src" ]]; then
if [[ ! -f "$dst" ]] || ! diff -q "$src" "$dst" >/dev/null 2>&1; then
mkdir -p "$VAULT_DIR/.claude/skills/$skill_name"
cp "$src" "$dst"
info "Updated skill: $skill_name"
SKILL_COUNT=$((SKILL_COUNT + 1))
if [[ -d "$SKILLS_TMP" ]] && ls "$SKILLS_TMP"/*/SKILL.md >/dev/null 2>&1; then
for skill_dir in "$SKILLS_TMP/"*/; do
skill_name="$(basename "$skill_dir")"
src="$skill_dir/SKILL.md"
dst="$VAULT_DIR/.claude/skills/$skill_name/SKILL.md"
if [[ -f "$src" ]]; then
if [[ ! -f "$dst" ]] || ! diff -q "$src" "$dst" >/dev/null 2>&1; then
mkdir -p "$VAULT_DIR/.claude/skills/$skill_name"
cp "$src" "$dst"
info "Updated skill: $skill_name"
SKILL_COUNT=$((SKILL_COUNT + 1))
fi
fi
fi
done
done
fi
rm -rf "$SKILLS_TMP"
else
warn "python3 not found — skipped skills update"
fi
# ── Update CLAUDE.md ──────────────────────────────────────────────────────