feat: Unified create command + consolidated enhancement flags
This commit includes two major improvements:
## 1. Unified Create Command (v3.0.0 feature)
- Auto-detects source type (web, GitHub, local, PDF, config)
- Three-tier argument organization (universal, source-specific, advanced)
- Routes to existing scrapers (100% backward compatible)
- Progressive disclosure: 15 universal flags in default help
**New files:**
- src/skill_seekers/cli/source_detector.py - Auto-detection logic
- src/skill_seekers/cli/arguments/create.py - Argument definitions
- src/skill_seekers/cli/create_command.py - Main orchestrator
- src/skill_seekers/cli/parsers/create_parser.py - Parser integration
**Tests:**
- tests/test_source_detector.py (35 tests)
- tests/test_create_arguments.py (30 tests)
- tests/test_create_integration_basic.py (10 tests)
## 2. Enhanced Flag Consolidation (Phase 1)
- Consolidated 3 flags (--enhance, --enhance-local, --enhance-level) → 1 flag
- --enhance-level 0-3 with auto-detection of API vs LOCAL mode
- Default: --enhance-level 2 (balanced enhancement)
**Modified files:**
- arguments/{common,create,scrape,github,analyze}.py - Added enhance_level
- {doc_scraper,github_scraper,config_extractor,main}.py - Updated logic
- create_command.py - Uses consolidated flag
**Auto-detection:**
- If ANTHROPIC_API_KEY set → API mode
- Else → LOCAL mode (Claude Code)
## 3. PresetManager Bug Fix
- Fixed module naming conflict (presets.py vs presets/ directory)
- Moved presets.py → presets/manager.py
- Updated __init__.py exports
**Test Results:**
- All 160+ tests passing
- Zero regressions
- 100% backward compatible
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
117
src/skill_seekers/cli/presets/github_presets.py
Normal file
117
src/skill_seekers/cli/presets/github_presets.py
Normal file
@@ -0,0 +1,117 @@
|
||||
"""GitHub command presets.
|
||||
|
||||
Defines preset configurations for the github command.
|
||||
|
||||
Presets:
|
||||
quick: Fast scraping with minimal data
|
||||
standard: Balanced scraping (DEFAULT)
|
||||
full: Comprehensive scraping with all data
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict
|
||||
import argparse
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class GitHubPreset:
|
||||
"""Definition of a GitHub preset.
|
||||
|
||||
Attributes:
|
||||
name: Human-readable preset name
|
||||
description: Brief description of what this preset does
|
||||
max_issues: Maximum issues to fetch
|
||||
features: Dict of feature flags (feature_name -> enabled)
|
||||
estimated_time: Human-readable time estimate
|
||||
"""
|
||||
name: str
|
||||
description: str
|
||||
max_issues: int
|
||||
features: Dict[str, bool] = field(default_factory=dict)
|
||||
estimated_time: str = ""
|
||||
|
||||
|
||||
# Preset definitions
|
||||
GITHUB_PRESETS = {
|
||||
"quick": GitHubPreset(
|
||||
name="Quick",
|
||||
description="Fast scraping with minimal data (README + code)",
|
||||
max_issues=10,
|
||||
features={
|
||||
"include_issues": False,
|
||||
"include_changelog": True,
|
||||
"include_releases": False,
|
||||
},
|
||||
estimated_time="1-3 minutes"
|
||||
),
|
||||
|
||||
"standard": GitHubPreset(
|
||||
name="Standard",
|
||||
description="Balanced scraping with issues and releases (recommended)",
|
||||
max_issues=100,
|
||||
features={
|
||||
"include_issues": True,
|
||||
"include_changelog": True,
|
||||
"include_releases": True,
|
||||
},
|
||||
estimated_time="5-15 minutes"
|
||||
),
|
||||
|
||||
"full": GitHubPreset(
|
||||
name="Full",
|
||||
description="Comprehensive scraping with all available data",
|
||||
max_issues=500,
|
||||
features={
|
||||
"include_issues": True,
|
||||
"include_changelog": True,
|
||||
"include_releases": True,
|
||||
},
|
||||
estimated_time="20-60 minutes"
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def apply_github_preset(args: argparse.Namespace, preset_name: str) -> None:
|
||||
"""Apply a GitHub preset to the args namespace.
|
||||
|
||||
Args:
|
||||
args: The argparse.Namespace to modify
|
||||
preset_name: Name of the preset to apply
|
||||
|
||||
Raises:
|
||||
KeyError: If preset_name is not a valid preset
|
||||
"""
|
||||
preset = GITHUB_PRESETS[preset_name]
|
||||
|
||||
# Apply max_issues only if not set by user
|
||||
if args.max_issues is None or args.max_issues == 100: # 100 is default
|
||||
args.max_issues = preset.max_issues
|
||||
|
||||
# Apply feature flags (only if not explicitly disabled by user)
|
||||
for feature, enabled in preset.features.items():
|
||||
skip_attr = f"no_{feature}"
|
||||
if not hasattr(args, skip_attr) or not getattr(args, skip_attr):
|
||||
setattr(args, skip_attr, not enabled)
|
||||
|
||||
|
||||
def show_github_preset_list() -> None:
|
||||
"""Print the list of available GitHub presets to stdout."""
|
||||
print("\nAvailable GitHub Presets")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
for name, preset in GITHUB_PRESETS.items():
|
||||
marker = " (DEFAULT)" if name == "standard" else ""
|
||||
print(f" {name}{marker}")
|
||||
print(f" {preset.description}")
|
||||
print(f" Estimated time: {preset.estimated_time}")
|
||||
print(f" Max issues: {preset.max_issues}")
|
||||
|
||||
# Show enabled features
|
||||
enabled = [f.replace("include_", "") for f, v in preset.features.items() if v]
|
||||
if enabled:
|
||||
print(f" Features: {', '.join(enabled)}")
|
||||
print()
|
||||
|
||||
print("Usage: skill-seekers github --repo <owner/repo> --preset <name>")
|
||||
print()
|
||||
Reference in New Issue
Block a user