feat: Add discoverable 'analyze' subcommand with preset flags (Phase 1 UX improvement)
Implements Phase 1 of the codebase analysis UX improvement plan, making the command discoverable and adding intuitive preset flags while maintaining 100% backward compatibility. New Features: - Add 'analyze' subcommand to main CLI (skill-seekers analyze) - Add --quick preset: Fast analysis (1-2 min, basic features only) - Add --comprehensive preset: Full analysis (20-60 min, all features + AI) - Add --enhance flag: Simple AI enhancement with auto-detection - Improve help text with timing estimates and mode descriptions Files Modified: - src/skill_seekers/cli/main.py: Add analyze subcommand (lines 15, 273-311, 542-589) - src/skill_seekers/cli/codebase_scraper.py: Add preset logic and improve help text - tests/test_analyze_command.py: NEW - 20 comprehensive tests - tests/test_cli_paths.py: Fix version check (2.7.0 -> 2.7.2) - tests/test_package_structure.py: Fix 4 version checks (2.7.0 -> 2.7.2) - README.md: Update examples to use 'analyze' command - CLAUDE.md: Update examples to use 'analyze' command Test Results: - 81 tests related to Phase 1: ALL PASSING ✅ - 20 new tests for analyze command: ALL PASSING ✅ - Zero regressions introduced - 100% backward compatibility maintained Backward Compatibility: - Old 'skill-seekers-codebase' command still works - All existing flags (--depth, --ai-mode, --skip-*) still functional - No breaking changes Usage Examples: skill-seekers analyze --directory . --quick skill-seekers analyze --directory . --comprehensive skill-seekers analyze --directory . --enhance Fixes #262 (codebase UX issues) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1082,7 +1082,13 @@ Examples:
|
||||
"--depth",
|
||||
choices=["surface", "deep", "full"],
|
||||
default="deep",
|
||||
help="Analysis depth (default: deep)",
|
||||
help=(
|
||||
"Analysis depth: "
|
||||
"surface (basic code structure, ~1-2 min), "
|
||||
"deep (code + patterns + tests, ~5-10 min, DEFAULT), "
|
||||
"full (everything + AI enhancement, ~20-60 min). "
|
||||
"💡 TIP: Use --quick or --comprehensive presets instead for better UX!"
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--languages", help="Comma-separated languages to analyze (e.g., Python,JavaScript,C++)"
|
||||
@@ -1130,7 +1136,14 @@ Examples:
|
||||
"--ai-mode",
|
||||
choices=["auto", "api", "local", "none"],
|
||||
default="auto",
|
||||
help="AI enhancement mode for how-to guides: auto (detect best), api (Claude API), local (Claude Code CLI), none (disable) (default: auto)",
|
||||
help=(
|
||||
"AI enhancement mode for how-to guides: "
|
||||
"auto (auto-detect: API if ANTHROPIC_API_KEY set, else LOCAL), "
|
||||
"api (Claude API, requires ANTHROPIC_API_KEY), "
|
||||
"local (Claude Code Max, FREE, no API key), "
|
||||
"none (disable AI enhancement). "
|
||||
"💡 TIP: Use --enhance flag instead for simpler UX!"
|
||||
),
|
||||
)
|
||||
parser.add_argument("--no-comments", action="store_true", help="Skip comment extraction")
|
||||
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging")
|
||||
@@ -1155,6 +1168,31 @@ Examples:
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Handle presets (Phase 1 feature - NEW)
|
||||
if hasattr(args, "quick") and args.quick and hasattr(args, "comprehensive") and args.comprehensive:
|
||||
logger.error("❌ Cannot use --quick and --comprehensive together. Choose one.")
|
||||
return 1
|
||||
|
||||
if hasattr(args, "quick") and args.quick:
|
||||
# Override depth and disable advanced features
|
||||
args.depth = "surface"
|
||||
args.skip_patterns = True
|
||||
args.skip_test_examples = True
|
||||
args.skip_how_to_guides = True
|
||||
args.skip_config_patterns = True
|
||||
args.ai_mode = "none"
|
||||
logger.info("⚡ Quick analysis mode: surface depth, basic features only (~1-2 min)")
|
||||
|
||||
if hasattr(args, "comprehensive") and args.comprehensive:
|
||||
# Override depth and enable all features
|
||||
args.depth = "full"
|
||||
args.skip_patterns = False
|
||||
args.skip_test_examples = False
|
||||
args.skip_how_to_guides = False
|
||||
args.skip_config_patterns = False
|
||||
args.ai_mode = "auto"
|
||||
logger.info("🚀 Comprehensive analysis mode: all features + AI enhancement (~20-60 min)")
|
||||
|
||||
# Set logging level
|
||||
if args.verbose:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user