move claude-marketplace to ai-proj-helper
This commit is contained in:
82
convert-skills.sh
Executable file
82
convert-skills.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Convert dotfiles custom skills to official Claude Code plugins
|
||||
|
||||
SOURCE_DIR="/Users/junhuang/coolbuy/new-ai-proj/dotfiles/claude-skills"
|
||||
TARGET_DIR="/Users/junhuang/coolbuy/claude-marketplace/plugins"
|
||||
|
||||
echo "Converting skills to plugins..."
|
||||
|
||||
# Loop through each skill directory
|
||||
for skill_dir in "$SOURCE_DIR"/*; do
|
||||
# Skip non-directories and special files
|
||||
if [ ! -d "$skill_dir" ] || [ "$(basename "$skill_dir")" = ".git" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
skill_name=$(basename "$skill_dir")
|
||||
plugin_name="${skill_name}-plugin"
|
||||
plugin_dir="$TARGET_DIR/$plugin_name"
|
||||
|
||||
echo "Processing: $skill_name -> $plugin_name"
|
||||
|
||||
# Create plugin directory structure
|
||||
mkdir -p "$plugin_dir/.claude-plugin"
|
||||
mkdir -p "$plugin_dir/skills"
|
||||
|
||||
# Copy SKILL.md if exists
|
||||
if [ -f "$skill_dir/SKILL.md" ]; then
|
||||
cp "$skill_dir/SKILL.md" "$plugin_dir/skills/"
|
||||
fi
|
||||
|
||||
# Copy skill.yaml if exists (for reference)
|
||||
if [ -f "$skill_dir/skill.yaml" ]; then
|
||||
cp "$skill_dir/skill.yaml" "$plugin_dir/.skill.yaml.original"
|
||||
fi
|
||||
|
||||
# Copy any Python scripts or other files
|
||||
find "$skill_dir" -type f \( -name "*.py" -o -name "*.sh" -o -name "*.js" -o -name "*.json" -o -name "*.md" \) -not -name "SKILL.md" -not -name "skill.yaml" -exec cp {} "$plugin_dir/" \;
|
||||
|
||||
# Copy subdirectories (like scripts/)
|
||||
for subdir in "$skill_dir"/*; do
|
||||
if [ -d "$subdir" ]; then
|
||||
subdir_name=$(basename "$subdir")
|
||||
cp -r "$subdir" "$plugin_dir/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Read version from skill.yaml if exists, otherwise use 1.0.0
|
||||
version="1.0.0"
|
||||
if [ -f "$skill_dir/skill.yaml" ]; then
|
||||
yaml_version=$(grep "^version:" "$skill_dir/skill.yaml" | sed 's/version: *//' | tr -d '"' | tr -d "'")
|
||||
if [ ! -z "$yaml_version" ]; then
|
||||
version="$yaml_version"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Read description from skill.yaml
|
||||
description="Plugin for $skill_name"
|
||||
if [ -f "$skill_dir/skill.yaml" ]; then
|
||||
yaml_desc=$(grep "^description:" "$skill_dir/skill.yaml" | sed 's/description: *//' | tr -d '"')
|
||||
if [ ! -z "$yaml_desc" ]; then
|
||||
description="$yaml_desc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create plugin.json
|
||||
cat > "$plugin_dir/.claude-plugin/plugin.json" << EOF
|
||||
{
|
||||
"name": "$plugin_name",
|
||||
"description": "$description",
|
||||
"version": "$version",
|
||||
"author": {
|
||||
"name": "qiudl"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo " ✓ Created $plugin_name"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Conversion complete! Created $(ls -1 "$TARGET_DIR" | wc -l) plugins."
|
||||
Reference in New Issue
Block a user