Files
skill-seekers-reference/src/skill_seekers/cli/arguments/analyze.py
yusyus ba1670a220 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>
2026-02-15 14:29:19 +03:00

187 lines
5.3 KiB
Python

"""Analyze command argument definitions.
This module defines ALL arguments for the analyze command in ONE place.
Both codebase_scraper.py (standalone) and parsers/analyze_parser.py (unified CLI)
import and use these definitions.
Includes preset system support for #268.
"""
import argparse
from typing import Dict, Any
ANALYZE_ARGUMENTS: Dict[str, Dict[str, Any]] = {
# Core options
"directory": {
"flags": ("--directory",),
"kwargs": {
"type": str,
"required": True,
"help": "Directory to analyze",
"metavar": "DIR",
},
},
"output": {
"flags": ("--output",),
"kwargs": {
"type": str,
"default": "output/codebase/",
"help": "Output directory (default: output/codebase/)",
"metavar": "DIR",
},
},
# Preset system (Issue #268)
"preset": {
"flags": ("--preset",),
"kwargs": {
"type": str,
"choices": ["quick", "standard", "comprehensive"],
"help": "Analysis preset: quick (1-2 min), standard (5-10 min, DEFAULT), comprehensive (20-60 min)",
"metavar": "PRESET",
},
},
"preset_list": {
"flags": ("--preset-list",),
"kwargs": {
"action": "store_true",
"help": "Show available presets and exit",
},
},
# Legacy preset flags (deprecated but kept for backward compatibility)
"quick": {
"flags": ("--quick",),
"kwargs": {
"action": "store_true",
"help": "[DEPRECATED] Quick analysis - use '--preset quick' instead",
},
},
"comprehensive": {
"flags": ("--comprehensive",),
"kwargs": {
"action": "store_true",
"help": "[DEPRECATED] Comprehensive analysis - use '--preset comprehensive' instead",
},
},
# Legacy depth flag (deprecated)
"depth": {
"flags": ("--depth",),
"kwargs": {
"type": str,
"choices": ["surface", "deep", "full"],
"help": "[DEPRECATED] Analysis depth - use --preset instead",
"metavar": "DEPTH",
},
},
# Language and file options
"languages": {
"flags": ("--languages",),
"kwargs": {
"type": str,
"help": "Comma-separated languages (e.g., Python,JavaScript,C++)",
"metavar": "LANGS",
},
},
"file_patterns": {
"flags": ("--file-patterns",),
"kwargs": {
"type": str,
"help": "Comma-separated file patterns",
"metavar": "PATTERNS",
},
},
# Enhancement options
"enhance_level": {
"flags": ("--enhance-level",),
"kwargs": {
"type": int,
"choices": [0, 1, 2, 3],
"default": 2,
"help": (
"AI enhancement level (auto-detects API vs LOCAL mode): "
"0=disabled, 1=SKILL.md only, 2=+architecture/config (default), 3=full enhancement. "
"Mode selection: uses API if ANTHROPIC_API_KEY is set, otherwise LOCAL (Claude Code)"
),
"metavar": "LEVEL",
},
},
# Feature skip options
"skip_api_reference": {
"flags": ("--skip-api-reference",),
"kwargs": {
"action": "store_true",
"help": "Skip API docs generation",
},
},
"skip_dependency_graph": {
"flags": ("--skip-dependency-graph",),
"kwargs": {
"action": "store_true",
"help": "Skip dependency graph generation",
},
},
"skip_patterns": {
"flags": ("--skip-patterns",),
"kwargs": {
"action": "store_true",
"help": "Skip pattern detection",
},
},
"skip_test_examples": {
"flags": ("--skip-test-examples",),
"kwargs": {
"action": "store_true",
"help": "Skip test example extraction",
},
},
"skip_how_to_guides": {
"flags": ("--skip-how-to-guides",),
"kwargs": {
"action": "store_true",
"help": "Skip how-to guide generation",
},
},
"skip_config_patterns": {
"flags": ("--skip-config-patterns",),
"kwargs": {
"action": "store_true",
"help": "Skip config pattern extraction",
},
},
"skip_docs": {
"flags": ("--skip-docs",),
"kwargs": {
"action": "store_true",
"help": "Skip project docs (README, docs/)",
},
},
"no_comments": {
"flags": ("--no-comments",),
"kwargs": {
"action": "store_true",
"help": "Skip comment extraction",
},
},
# Output options
"verbose": {
"flags": ("--verbose",),
"kwargs": {
"action": "store_true",
"help": "Enable verbose logging",
},
},
}
def add_analyze_arguments(parser: argparse.ArgumentParser) -> None:
"""Add all analyze command arguments to a parser."""
for arg_name, arg_def in ANALYZE_ARGUMENTS.items():
flags = arg_def["flags"]
kwargs = arg_def["kwargs"]
parser.add_argument(*flags, **kwargs)
def get_analyze_argument_names() -> set:
"""Get the set of analyze argument destination names."""
return set(ANALYZE_ARGUMENTS.keys())