feat: Merge PR #249 - Bootstrap skill with fixes and MCP optionality

Merged PR #249 from @MiaoDX with enhancements:

Bootstrap Feature:
- Self-bootstrap: Generate skill-seekers as Claude Code skill
- Robust frontmatter detection (dynamic line finding)
- SKILL.md validation (YAML + Markdown structure)
- Comprehensive error handling (uv check, permission checks)
- 6 E2E tests with venv isolation

MCP Optionality (User Feature):
- MCP removed from core dependencies
- Optional install: pip install skill-seekers[mcp]
- Lazy loading with helpful error messages
- Interactive setup wizard on first run
- Backward compatible

Bug Fixes:
- Fixed codebase_scraper.py AttributeError (line 1193)
- Fixed test_bootstrap_skill_e2e.py Path vs str issue
- Updated test version expectations to 2.7.0
- Added httpx to core (required for async scraping)
- Added anthropic to core (required for AI enhancement)

Testing:
- 6 new bootstrap E2E tests (all passing)
- 1207/1217 tests passing (99.2% pass rate)
- All bootstrap and enhancement tests pass
- Remaining failures are pre-existing test infrastructure issues

Documentation:
- Updated CHANGELOG.md with v2.7.0 notes
- Updated README.md with bootstrap and installation options
- Added setup wizard guide

Files Modified (9):
- CHANGELOG.md, README.md - Documentation updates
- pyproject.toml - MCP optional, httpx/anthropic core, markers, entry points
- scripts/bootstrap_skill.sh - Dynamic frontmatter, validation, error handling
- src/skill_seekers/cli/install_skill.py - Lazy MCP loading
- tests/test_cli_paths.py - Version 2.7.0
- uv.lock - Dependency updates

New Files (2):
- src/skill_seekers/cli/setup_wizard.py - Interactive installation guide (95 lines)
- tests/test_bootstrap_skill_e2e.py - E2E bootstrap tests (169 lines)

Credits: @MiaoDX for PR #249

Co-Authored-By: MiaoDX <MiaoDX@hotmail.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-01-17 19:51:11 +03:00
parent 6d4ef0f13b
commit 38e8969ae7
9 changed files with 553 additions and 22 deletions

View File

@@ -20,7 +20,16 @@ echo "============================================"
# Step 1: Sync dependencies
echo "Step 1: uv sync..."
command -v uv &> /dev/null || { echo "Error: uv not installed"; exit 1; }
if ! command -v uv &> /dev/null; then
echo "❌ Error: 'uv' is not installed"
echo ""
echo "Install uv:"
echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
echo " # or"
echo " pip install uv"
echo ""
exit 1
fi
cd "$PROJECT_ROOT"
uv sync --quiet
echo "✓ Done"
@@ -38,8 +47,18 @@ echo "✓ Done"
# Step 3: Prepend header to SKILL.md
echo "Step 3: Adding operational header..."
if [[ -f "$HEADER_FILE" ]]; then
# Get auto-generated content (skip its frontmatter)
AUTO_CONTENT=$(tail -n +6 "$OUTPUT_DIR/SKILL.md")
# Detect end of frontmatter dynamically
# Look for second occurrence of '---'
FRONTMATTER_END=$(grep -n '^---$' "$OUTPUT_DIR/SKILL.md" | sed -n '2p' | cut -d: -f1)
if [[ -n "$FRONTMATTER_END" ]]; then
# Skip frontmatter + blank line
AUTO_CONTENT=$(tail -n +$((FRONTMATTER_END + 2)) "$OUTPUT_DIR/SKILL.md")
else
# Fallback to line 6 if no frontmatter found
AUTO_CONTENT=$(tail -n +6 "$OUTPUT_DIR/SKILL.md")
fi
# Combine: header + auto-generated
cat "$HEADER_FILE" > "$OUTPUT_DIR/SKILL.md"
echo "$AUTO_CONTENT" >> "$OUTPUT_DIR/SKILL.md"
@@ -48,6 +67,37 @@ else
echo "Warning: $HEADER_FILE not found, using auto-generated only"
fi
# Step 4: Validate merged SKILL.md
echo "Step 4: Validating SKILL.md..."
if [[ -f "$OUTPUT_DIR/SKILL.md" ]]; then
# Check file not empty
if [[ ! -s "$OUTPUT_DIR/SKILL.md" ]]; then
echo "❌ Error: SKILL.md is empty"
exit 1
fi
# Check frontmatter exists
if ! head -1 "$OUTPUT_DIR/SKILL.md" | grep -q '^---$'; then
echo "⚠️ Warning: SKILL.md missing frontmatter delimiter"
fi
# Check required fields
if ! grep -q '^name:' "$OUTPUT_DIR/SKILL.md"; then
echo "❌ Error: SKILL.md missing 'name:' field"
exit 1
fi
if ! grep -q '^description:' "$OUTPUT_DIR/SKILL.md"; then
echo "❌ Error: SKILL.md missing 'description:' field"
exit 1
fi
echo "✓ Validation passed"
else
echo "❌ Error: SKILL.md not found"
exit 1
fi
echo ""
echo "============================================"
echo " Bootstrap Complete!"