🔧 chore: add nested path validation to skill-creator
- Added path validation to prevent .vibe/.vibe nested directory creation - Enhanced BEST_PRACTICES.md with path handling patterns - Added troubleshooting section to ADVANCED_FEATURES.md - Shows actual creation path for transparency Fixes: Issue with skills being created in incorrect nested paths Refs: #skill-creation, #path-validation
This commit is contained in:
@@ -1,5 +1,37 @@
|
|||||||
# Advanced Skill Creator Features
|
# Advanced Skill Creator Features
|
||||||
|
|
||||||
|
## Known Issues and Troubleshooting
|
||||||
|
|
||||||
|
### Nested Path Creation Issue
|
||||||
|
|
||||||
|
**Symptom**: Skills created in incorrect nested paths like `.vibe/skills/.vibe/skills/skill-name`
|
||||||
|
|
||||||
|
**Cause**: Running `create_skill.sh` from within the `.vibe/skills/` directory causes relative path resolution issues.
|
||||||
|
|
||||||
|
**Solution**:
|
||||||
|
1. Always run the script from project root
|
||||||
|
2. Use absolute paths when necessary
|
||||||
|
3. The script now includes validation to detect and prevent this issue
|
||||||
|
|
||||||
|
**Prevention**: Added path validation in `create_skill.sh`:
|
||||||
|
```bash
|
||||||
|
# Validate path - ensure we're not creating nested .vibe directories
|
||||||
|
if [[ "$SKILL_DIR" == *".vibe/.vibe"* ]]; then
|
||||||
|
echo "❌ Error: Detected nested .vibe path: $SKILL_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
### Workaround
|
||||||
|
If you encounter this issue:
|
||||||
|
```bash
|
||||||
|
# Move the skill to correct location
|
||||||
|
mv .vibe/skills/.vibe/skills/your-skill .vibe/skills/your-skill
|
||||||
|
|
||||||
|
# Update any internal path references
|
||||||
|
find .vibe/skills/your-skill -type f -exec sed -i '' 's|.vibe/skills/.vibe/skills|.vibe/skills|g' {} +
|
||||||
|
```
|
||||||
|
|
||||||
## Skill Versioning and Updates
|
## Skill Versioning and Updates
|
||||||
|
|
||||||
### Version Management
|
### Version Management
|
||||||
|
|||||||
@@ -296,3 +296,30 @@ df = pl.read_csv("data.csv")
|
|||||||
|
|
||||||
For pandas compatibility, use the .to_pandas() method.
|
For pandas compatibility, use the .to_pandas() method.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ❌ Nested Path Creation
|
||||||
|
**Issue**: Creating skills in incorrect nested paths like `.vibe/skills/.vibe/skills/skill-name`
|
||||||
|
|
||||||
|
**Cause**: Script incorrectly appending base directory to target path
|
||||||
|
|
||||||
|
**Solution**: Always use absolute paths and validate the final location
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Correct approach
|
||||||
|
TARGET_DIR=".vibe/skills/$SKILL_NAME"
|
||||||
|
mkdir -p "$TARGET_DIR"
|
||||||
|
# Verify location
|
||||||
|
ls -la ".vibe/skills/" | grep "$SKILL_NAME"
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✅ Proper Path Handling
|
||||||
|
```bash
|
||||||
|
# Use absolute paths from project root
|
||||||
|
SKILL_DIR="$PROJECT_ROOT/.vibe/skills/$SKILL_NAME"
|
||||||
|
mkdir -p "$SKILL_DIR"
|
||||||
|
# Validate no nested .vibe directories
|
||||||
|
if [[ "$SKILL_DIR" == *".vibe/.vibe"* ]]; then
|
||||||
|
echo "Error: Nested .vibe path detected"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
@@ -19,6 +19,17 @@ SKILL_NAME_HYPHENATED=$(echo "$SKILL_NAME" | tr '_' '-')
|
|||||||
# Create skill directory
|
# Create skill directory
|
||||||
mkdir -p "$SKILL_DIR"
|
mkdir -p "$SKILL_DIR"
|
||||||
|
|
||||||
|
# Validate path - ensure we're not creating nested .vibe directories
|
||||||
|
if [[ "$SKILL_DIR" == *".vibe/.vibe"* ]]; then
|
||||||
|
echo "❌ Error: Detected nested .vibe path: $SKILL_DIR"
|
||||||
|
echo "This usually happens when running the script from within .vibe/skills/"
|
||||||
|
echo "Please run from project root or use absolute paths"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show the actual path being created
|
||||||
|
echo "✓ Creating skill in: $(pwd)/$SKILL_DIR"
|
||||||
|
|
||||||
# Create SKILL.md with basic template
|
# Create SKILL.md with basic template
|
||||||
cat > "$SKILL_DIR/SKILL.md" <<EOL
|
cat > "$SKILL_DIR/SKILL.md" <<EOL
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user