fix: improve CodexLens env defaults, self-exclusion, and route handling

- Adjust env defaults (embed batch 64, workers 2) and add HNSW/chunking params
- Exclude .codexlens directory from indexing and file watching
- Expand codexlens-routes with improved validation and error handling
- Enhance integration tests for broader route coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
catlog22
2026-03-19 10:34:18 +08:00
parent 683b85228f
commit 00672ec8e5
11 changed files with 478 additions and 191 deletions

View File

@@ -296,7 +296,7 @@ def cmd_remove_file(args: argparse.Namespace) -> None:
DEFAULT_EXCLUDES = frozenset({
"node_modules", ".git", "__pycache__", "dist", "build",
".venv", "venv", ".tox", ".mypy_cache", ".pytest_cache",
".next", ".nuxt", "coverage", ".eggs", "*.egg-info",
".next", ".nuxt", "coverage", ".eggs", "*.egg-info", ".codexlens",
})

View File

@@ -51,7 +51,7 @@ class WatcherConfig:
# IDE / Editor
".idea", ".vscode", ".vs",
# Package / cache
".cache", ".parcel-cache", ".turbo", ".next", ".nuxt",
".cache", ".parcel-cache", ".turbo", ".next", ".nuxt", ".codexlens",
# Logs / temp
"logs", "tmp", "temp",
})

View File

@@ -9,7 +9,13 @@ from unittest.mock import patch
import pytest
from codexlens_search.bridge import _build_parser, _json_output, _error_exit
from codexlens_search.bridge import (
DEFAULT_EXCLUDES,
_build_parser,
_json_output,
_error_exit,
should_exclude,
)
# ---------------------------------------------------------------------------
@@ -71,6 +77,12 @@ class TestParser:
args = self.parser.parse_args([])
assert args.command is None
def test_default_excludes_include_codexlens(self):
assert ".codexlens" in DEFAULT_EXCLUDES
def test_should_exclude_codexlens_directory(self):
assert should_exclude(Path(".codexlens") / "metadata.db", DEFAULT_EXCLUDES) is True
# ---------------------------------------------------------------------------
# JSON output helpers

View File

@@ -52,6 +52,7 @@ class TestWatcherConfig:
assert ".git" in cfg.ignored_patterns
assert "__pycache__" in cfg.ignored_patterns
assert "node_modules" in cfg.ignored_patterns
assert ".codexlens" in cfg.ignored_patterns
def test_custom(self):
cfg = WatcherConfig(debounce_ms=1000, ignored_patterns={".custom"})