diff --git a/packs/claude-code/install.sh b/packs/claude-code/install.sh index c8ac247..aee2e55 100755 --- a/packs/claude-code/install.sh +++ b/packs/claude-code/install.sh @@ -158,7 +158,7 @@ ok "claude --version: ${CLAUDE_VER}" # ── Install loki-skills library ─────────────────────────────────────────────── # Best-effort: pre-install skills (shared or pack-specific). -PACK_SKILLS_DIR="${HOME}/.local/share/lowkey/skills" +PACK_SKILLS_DIR="${HOME}/.claude/skills" ensure_skills_clone "${PACK_SKILLS_DIR}" || true log "Skills installed to ${PACK_SKILLS_DIR}" write_done_marker "claude-code" diff --git a/packs/codex-cli/install.sh b/packs/codex-cli/install.sh index 4d9dfe8..e893f9c 100755 --- a/packs/codex-cli/install.sh +++ b/packs/codex-cli/install.sh @@ -293,7 +293,7 @@ NOTICE # ── Install loki-skills library ─────────────────────────────────────────────── # Best-effort: pre-install skills (shared or pack-specific). -PACK_SKILLS_DIR="${HOME}/.local/share/lowkey/skills" +PACK_SKILLS_DIR="${HOME}/.codex/skills" ensure_skills_clone "${PACK_SKILLS_DIR}" || true log "Skills installed to ${PACK_SKILLS_DIR}" write_done_marker "codex-cli" diff --git a/packs/common.sh b/packs/common.sh index 4efcddd..3040044 100755 --- a/packs/common.sh +++ b/packs/common.sh @@ -10,6 +10,68 @@ # shared. Override at install time with: LOKI_SKILLS_REPO_URL=... export LOKI_SKILLS_REPO_URL="${LOKI_SKILLS_REPO_URL:-https://github.com/inceptionstack/loki-skills.git}" +# ── ensure_skills_clone ─────────────────────────────────────────────────────── +# Clone loki-skills library to target directory (best-effort, non-fatal). +# Handles update path, partial directory recovery, missing git gracefully. +# +# Usage: ensure_skills_clone [] [] [] +# target_dir: where to clone (e.g. ~/.openclaw/workspace/skills) +# repo_url: git repo (default: $LOKI_SKILLS_REPO_URL) +# branch: git branch (default: main) +# mode: 'warn' (default) or 'fail' — controls error handling +# +# Returns: 0 on success, non-zero on failure (caller decides via || true) +ensure_skills_clone() { + local target_dir="${1:?target_dir required}" + local repo_url="${2:-${LOKI_SKILLS_REPO_URL}}" + local branch="${3:-main}" + local mode="${4:-warn}" + local rc=0 + + # Check git available + if ! command -v git &>/dev/null; then + local msg="git not found; skills clone skipped" + [[ "$mode" == "fail" ]] && { log "$msg (FATAL)"; return 1; } || log "$msg (warn)" + return 0 + fi + + # Existing repo: try update + if [[ -d "$target_dir" ]] && [[ -d "$target_dir/.git" ]]; then + local origin_url="$(cd "$target_dir" && git config --get remote.origin.url 2>/dev/null)" + if [[ "$origin_url" == "$repo_url" ]]; then + # Same origin, safe to update + if (cd "$target_dir" && git fetch origin "$branch" && git checkout "$branch") &>/dev/null; then + log "Skills repo updated at $target_dir" + return 0 + else + log "Skills repo update failed; moving aside and re-cloning" + mv "$target_dir" "${target_dir}.bak.$RANDOM" || true + fi + else + # Different origin: move aside and re-clone + log "Skills origin mismatch; moving aside and re-cloning" + mv "$target_dir" "${target_dir}.bak.$RANDOM" || true + fi + fi + + # Partial dir (no .git): remove and re-clone + if [[ -d "$target_dir" ]] && [[ ! -d "$target_dir/.git" ]]; then + log "Incomplete skills dir; removing and re-cloning" + rm -rf "$target_dir" || true + fi + + # Fresh clone (shallow) + if ! git clone --depth 1 --branch "$branch" "$repo_url" "$target_dir" &>/dev/null; then + local msg="Skills clone failed (repo: $repo_url, branch: $branch)" + [[ "$mode" == "fail" ]] && { log "$msg (FATAL)"; return 1; } || log "$msg (warn, continuing)" + rc=1 + else + log "Skills cloned to $target_dir" + fi + + return $rc +} + # Colors _CLR_GREEN='\033[0;32m' _CLR_CYAN='\033[0;36m' diff --git a/packs/hermes/install.sh b/packs/hermes/install.sh index bad0858..17ae014 100755 --- a/packs/hermes/install.sh +++ b/packs/hermes/install.sh @@ -146,7 +146,7 @@ fi # ── Install loki-skills library ─────────────────────────────────────────────── # Best-effort: pre-install skills (shared or pack-specific). -PACK_SKILLS_DIR="${HOME}/.local/share/lowkey/skills" +PACK_SKILLS_DIR="${HOME}/.hermes/skills" ensure_skills_clone "${PACK_SKILLS_DIR}" || true log "Skills installed to ${PACK_SKILLS_DIR}" write_done_marker "hermes" diff --git a/packs/ironclaw/install.sh b/packs/ironclaw/install.sh index 61afec5..5b90ef5 100755 --- a/packs/ironclaw/install.sh +++ b/packs/ironclaw/install.sh @@ -365,11 +365,10 @@ ok "Systemd service installed with EnvironmentFile + --no-onboard" # ── Done ───────────────────────────────────────────────────────────────────── -# ── Install loki-skills library ─────────────────────────────────────────────── -# Best-effort: pre-install skills (shared or pack-specific). -PACK_SKILLS_DIR="${HOME}/.ironclaw/skills" -ensure_skills_clone "${PACK_SKILLS_DIR}" || true -log "Skills installed to ${PACK_SKILLS_DIR}" +# ── IronClaw Skills Configuration (MCP-native, no direct skills auto-discovery) ─ +# IronClaw uses MCP servers (Model Context Protocol) for extensions, not local skills. +# Skill reference docs: see ~/.openclaw/workspace/skills/ + BOOTSTRAP-MCPORTER.md +log "IronClaw configured for MCP servers (no local skills pre-install needed)" write_done_marker "ironclaw" printf "\n[PACK:ironclaw] INSTALLED — ironclaw CLI ready\n" printf " model: %s via bedrockify:%s\n" "${MODEL}" "${BEDROCKIFY_PORT}" diff --git a/packs/kiro-cli/install.sh b/packs/kiro-cli/install.sh index ce5bbcb..9610b81 100755 --- a/packs/kiro-cli/install.sh +++ b/packs/kiro-cli/install.sh @@ -363,7 +363,7 @@ fi # Best-effort: pre-install skills to kiro workspace. PACK_SKILLS_DIR="${HOME}/.kiro/skills" ensure_skills_clone "${PACK_SKILLS_DIR}" || true -log "Skills installed to ${PACK_SKILLS_DIR}" +log "Skills auto-installed to ${PACK_SKILLS_DIR}" # ── Done ────────────────────────────────────────────────────────────────────── write_done_marker "kiro-cli" diff --git a/packs/pi/install.sh b/packs/pi/install.sh index 55491fa..9549662 100755 --- a/packs/pi/install.sh +++ b/packs/pi/install.sh @@ -130,7 +130,7 @@ ok "Pi config written: ${HOME}/.pi/agent/models.json" # Best-effort: pre-install skills as reference docs for Pi users. # Skills are stored per-agent (not auto-discovered), so users must manually # create TypeScript extensions to use them. This ensures they're always available. -PACK_SKILLS_DIR="${HOME}/.pi/agent/skills" +PACK_SKILLS_DIR="${HOME}/.pi/agent/extensions" ensure_skills_clone "${PACK_SKILLS_DIR}" || true log "Skills installed to ${PACK_SKILLS_DIR} (reference docs; manual extension creation needed)"