|
| 1 | +#!/bin/bash -eu |
| 2 | +# Copyright 2026 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +################################################################################ |
| 17 | + |
| 18 | +# Copy the skills folder into the global skills directory |
| 19 | + |
| 20 | +# Accept user input. Should by default be "gemini" but can be overridden by the user. |
| 21 | +SKILLS_DIR=${1:-"gemini"} |
| 22 | + |
| 23 | + |
| 24 | +# Gemini skills dir = ~/.gemini/skills |
| 25 | +# Claude skills dir = ~/.claude/skills |
| 26 | +if [ "$SKILLS_DIR" == "gemini" ]; then |
| 27 | + GLOBAL_SKILLS_DIR="$HOME/.gemini/skills" |
| 28 | +elif [ "$SKILLS_DIR" == "claude" ]; then |
| 29 | + GLOBAL_SKILLS_DIR="$HOME/.claude/skills" |
| 30 | +else |
| 31 | + echo "Invalid skills directory specified. Use 'gemini' or 'claude'." |
| 32 | + exit 1 |
| 33 | +fi |
| 34 | + |
| 35 | +# Log target skill directory |
| 36 | +echo "Copying skills to global skills directory: $GLOBAL_SKILLS_DIR" |
| 37 | + |
| 38 | + |
| 39 | +# Now copy each of the skills from the local "skills" directory to the global skills directory |
| 40 | +# Overwrite existing skills with the same name. |
| 41 | +# Check if the global skills directory exists, if not create it |
| 42 | +if [ ! -d "$GLOBAL_SKILLS_DIR" ]; then |
| 43 | + mkdir -p "$GLOBAL_SKILLS_DIR" |
| 44 | +fi |
| 45 | + |
| 46 | +# Copy each skill from the local "skills" directory to the global skills directory |
| 47 | +# Make sure we work from this scripts base folder and copy each of the skills |
| 48 | +# fuzzing-memory-unsafe-expert |
| 49 | +# oss-fuzz-engineer |
| 50 | +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 51 | +for skill in "fuzzing-memory-unsafe-expert" "oss-fuzz-engineer"; do |
| 52 | + abs_skill="$SCRIPT_DIR/$skill" |
| 53 | + # Copy over the skill and replace any existing skill with the same name in the global skills directory |
| 54 | + if [ -d "$GLOBAL_SKILLS_DIR/$skill" ]; then |
| 55 | + rm -rf "$GLOBAL_SKILLS_DIR/$skill" |
| 56 | + fi |
| 57 | + |
| 58 | + echo "Copying $abs_skill to $GLOBAL_SKILLS_DIR/" |
| 59 | + cp -r "$abs_skill" "$GLOBAL_SKILLS_DIR/" |
| 60 | +done |
0 commit comments