feat(cli): Phase 2 - Organize RAG arguments into common.py (DRY principle)
Changes: - Added RAG_ARGUMENTS dict to common.py with 3 flags: - --chunk-for-rag (enable semantic chunking) - --chunk-size (default: 512 tokens) - --chunk-overlap (default: 50 tokens) - Removed duplicate RAG arguments from create.py and scrape.py - Used .update() pattern to merge RAG_ARGUMENTS into UNIVERSAL_ARGUMENTS and SCRAPE_ARGUMENTS - Added helper functions: add_rag_arguments(), get_rag_argument_names() - Updated tests to reflect new argument count (15 → 13 universal arguments) - Fixed test expectations for boolean_args (removed 'enhance', 'enhance_local') Result: - Single source of truth for RAG arguments in common.py - DRY principle maintained across all commands - All 88 key tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import argparse
|
||||
from typing import Dict, Any, Set, List
|
||||
|
||||
from skill_seekers.cli.constants import DEFAULT_RATE_LIMIT
|
||||
from .common import RAG_ARGUMENTS
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -91,32 +92,8 @@ UNIVERSAL_ARGUMENTS: Dict[str, Dict[str, Any]] = {
|
||||
"help": "Minimize output (WARNING level only)",
|
||||
},
|
||||
},
|
||||
# RAG features (NEW - universal for all sources!)
|
||||
"chunk_for_rag": {
|
||||
"flags": ("--chunk-for-rag",),
|
||||
"kwargs": {
|
||||
"action": "store_true",
|
||||
"help": "Enable semantic chunking for RAG pipelines (all sources)",
|
||||
},
|
||||
},
|
||||
"chunk_size": {
|
||||
"flags": ("--chunk-size",),
|
||||
"kwargs": {
|
||||
"type": int,
|
||||
"default": 512,
|
||||
"metavar": "TOKENS",
|
||||
"help": "Chunk size in tokens for RAG (default: 512)",
|
||||
},
|
||||
},
|
||||
"chunk_overlap": {
|
||||
"flags": ("--chunk-overlap",),
|
||||
"kwargs": {
|
||||
"type": int,
|
||||
"default": 50,
|
||||
"metavar": "TOKENS",
|
||||
"help": "Overlap between chunks in tokens (default: 50)",
|
||||
},
|
||||
},
|
||||
# RAG features (imported from common.py - see RAG_ARGUMENTS)
|
||||
# Note: RAG arguments are merged into UNIVERSAL_ARGUMENTS at runtime
|
||||
# Preset system
|
||||
"preset": {
|
||||
"flags": ("--preset",),
|
||||
@@ -138,6 +115,9 @@ UNIVERSAL_ARGUMENTS: Dict[str, Dict[str, Any]] = {
|
||||
},
|
||||
}
|
||||
|
||||
# Merge RAG arguments from common.py into universal arguments
|
||||
UNIVERSAL_ARGUMENTS.update(RAG_ARGUMENTS)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# TIER 2: SOURCE-SPECIFIC ARGUMENTS
|
||||
|
||||
Reference in New Issue
Block a user