Add parallel search mode and index progress bar

Features:
- CCW smart_search: Add 'parallel' mode that runs hybrid + exact + ripgrep
  simultaneously with RRF (Reciprocal Rank Fusion) for result merging
- Dashboard: Add real-time progress bar for CodexLens index initialization
- MCP: Return progress metadata in init action response
- Codex-lens: Auto-detect optimal worker count for parallel indexing

Changes:
- smart-search.ts: Add parallel mode, RRF fusion, progress tracking
- codex-lens.ts: Add onProgress callback support, progress parsing
- codexlens-routes.ts: Broadcast index progress via WebSocket
- codexlens-manager.js: New index progress modal with real-time updates
- notifications.js: Add WebSocket event handler registration system
- i18n.js: Add English/Chinese translations for progress UI
- index_tree.py: Workers parameter now auto-detects CPU count (max 16)
- commands.py: CLI --workers parameter supports auto-detection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-17 23:17:15 +08:00
parent 44d84116c3
commit 51a61bef31
8 changed files with 569 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ def init(
"-l",
help="Limit indexing to specific languages (repeat or comma-separated).",
),
workers: int = typer.Option(4, "--workers", "-w", min=1, max=16, help="Parallel worker processes."),
workers: Optional[int] = typer.Option(None, "--workers", "-w", min=1, max=16, help="Parallel worker processes (default: auto-detect based on CPU count, max 16)."),
force: bool = typer.Option(False, "--force", "-f", help="Force full reindex (skip incremental mode)."),
no_embeddings: bool = typer.Option(False, "--no-embeddings", help="Skip automatic embedding generation (if semantic deps installed)."),
embedding_model: str = typer.Option("code", "--embedding-model", help="Embedding model profile: fast, code, multilingual, balanced."),

View File

@@ -98,7 +98,7 @@ class IndexTreeBuilder:
self,
source_root: Path,
languages: List[str] = None,
workers: int = 4,
workers: int = None,
force_full: bool = False,
) -> BuildResult:
"""Build complete index tree for a project.
@@ -127,6 +127,11 @@ class IndexTreeBuilder:
if not source_root.exists():
raise ValueError(f"Source root does not exist: {source_root}")
# Auto-detect optimal worker count if not specified
if workers is None:
workers = min(os.cpu_count() or 4, 16) # Cap at 16 workers
self.logger.debug("Auto-detected %d workers for parallel indexing", workers)
# Override incremental mode if force_full is True
use_incremental = self.incremental and not force_full
if force_full:
@@ -238,7 +243,7 @@ class IndexTreeBuilder:
self,
source_path: Path,
languages: List[str] = None,
workers: int = 4,
workers: int = None,
) -> BuildResult:
"""Incrementally update a subtree.