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:
yusyus
2026-02-15 14:29:19 +03:00
parent aa952aff81
commit ba1670a220
53 changed files with 10144 additions and 589 deletions

View File

@@ -0,0 +1,133 @@
"""Package command argument definitions.
This module defines ALL arguments for the package command in ONE place.
Both package_skill.py (standalone) and parsers/package_parser.py (unified CLI)
import and use these definitions.
"""
import argparse
from typing import Dict, Any
PACKAGE_ARGUMENTS: Dict[str, Dict[str, Any]] = {
# Positional argument
"skill_directory": {
"flags": ("skill_directory",),
"kwargs": {
"type": str,
"help": "Skill directory path (e.g., output/react/)",
},
},
# Control options
"no_open": {
"flags": ("--no-open",),
"kwargs": {
"action": "store_true",
"help": "Don't open output folder after packaging",
},
},
"skip_quality_check": {
"flags": ("--skip-quality-check",),
"kwargs": {
"action": "store_true",
"help": "Skip quality checks before packaging",
},
},
# Target platform
"target": {
"flags": ("--target",),
"kwargs": {
"type": str,
"choices": [
"claude",
"gemini",
"openai",
"markdown",
"langchain",
"llama-index",
"haystack",
"weaviate",
"chroma",
"faiss",
"qdrant",
],
"default": "claude",
"help": "Target LLM platform (default: claude)",
"metavar": "PLATFORM",
},
},
"upload": {
"flags": ("--upload",),
"kwargs": {
"action": "store_true",
"help": "Automatically upload after packaging (requires platform API key)",
},
},
# Streaming options
"streaming": {
"flags": ("--streaming",),
"kwargs": {
"action": "store_true",
"help": "Use streaming ingestion for large docs (memory-efficient)",
},
},
"chunk_size": {
"flags": ("--chunk-size",),
"kwargs": {
"type": int,
"default": 4000,
"help": "Maximum characters per chunk (streaming mode, default: 4000)",
"metavar": "N",
},
},
"chunk_overlap": {
"flags": ("--chunk-overlap",),
"kwargs": {
"type": int,
"default": 200,
"help": "Overlap between chunks (streaming mode, default: 200)",
"metavar": "N",
},
},
"batch_size": {
"flags": ("--batch-size",),
"kwargs": {
"type": int,
"default": 100,
"help": "Number of chunks per batch (streaming mode, default: 100)",
"metavar": "N",
},
},
# RAG chunking options
"chunk": {
"flags": ("--chunk",),
"kwargs": {
"action": "store_true",
"help": "Enable intelligent chunking for RAG platforms (auto-enabled for RAG adaptors)",
},
},
"chunk_tokens": {
"flags": ("--chunk-tokens",),
"kwargs": {
"type": int,
"default": 512,
"help": "Maximum tokens per chunk (default: 512)",
"metavar": "N",
},
},
"no_preserve_code": {
"flags": ("--no-preserve-code",),
"kwargs": {
"action": "store_true",
"help": "Allow code block splitting (default: code blocks preserved)",
},
},
}
def add_package_arguments(parser: argparse.ArgumentParser) -> None:
"""Add all package command arguments to a parser."""
for arg_name, arg_def in PACKAGE_ARGUMENTS.items():
flags = arg_def["flags"]
kwargs = arg_def["kwargs"]
parser.add_argument(*flags, **kwargs)