mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-11 17:21:03 +08:00
feat: implement ignore patterns and extension filters in CodexLens
- Added tests to ensure loading of ignore patterns and extension filters from settings. - Implemented functionality to respect ignore patterns and extension filters during file indexing. - Created integration tests for CodexLens ignore-pattern configuration routes. - Added a new AdvancedTab component with tests for managing ignore patterns and extension filters. - Established a comprehensive branding naming system for the Maestro project, including guidelines for package names, CLI commands, and directory structure.
This commit is contained in:
@@ -19,6 +19,7 @@ def test_load_settings_reads_ignore_patterns_and_extension_filters(tmp_path: Pat
|
||||
)
|
||||
|
||||
config = Config(data_dir=tmp_path)
|
||||
config.load_settings()
|
||||
|
||||
assert config.ignore_patterns == ["frontend/dist", "coverage"]
|
||||
assert config.extension_filters == ["*.min.js", "*.map"]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
@@ -84,3 +85,63 @@ def test_collect_dirs_by_depth_respects_relative_ignore_patterns_from_config(tmp
|
||||
|
||||
assert "frontend/src" in discovered_dirs
|
||||
assert "frontend/dist" not in discovered_dirs
|
||||
|
||||
|
||||
def test_iter_source_files_respects_extension_filters_and_relative_patterns(tmp_path: Path) -> None:
|
||||
frontend_dir = tmp_path / "frontend"
|
||||
frontend_dir.mkdir()
|
||||
(frontend_dir / "app.ts").write_text("export const app = 1\n", encoding="utf-8")
|
||||
(frontend_dir / "bundle.min.js").write_text("export const bundle = 1\n", encoding="utf-8")
|
||||
(frontend_dir / "skip.ts").write_text("export const skip = 1\n", encoding="utf-8")
|
||||
|
||||
builder = IndexTreeBuilder(
|
||||
registry=MagicMock(),
|
||||
mapper=MagicMock(),
|
||||
config=Config(
|
||||
data_dir=tmp_path / "data",
|
||||
extension_filters=["*.min.js", "frontend/skip.ts"],
|
||||
),
|
||||
incremental=False,
|
||||
)
|
||||
|
||||
source_files = builder._iter_source_files(frontend_dir, source_root=tmp_path)
|
||||
|
||||
assert [path.name for path in source_files] == ["app.ts"]
|
||||
assert builder._should_index_dir(frontend_dir, source_root=tmp_path) is True
|
||||
|
||||
|
||||
def test_builder_loads_saved_ignore_and_extension_filters_by_default(tmp_path: Path, monkeypatch) -> None:
|
||||
codexlens_home = tmp_path / "codexlens-home"
|
||||
codexlens_home.mkdir()
|
||||
(codexlens_home / "settings.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"ignore_patterns": ["frontend/dist"],
|
||||
"extension_filters": ["*.min.js"],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
monkeypatch.setenv("CODEXLENS_DATA_DIR", str(codexlens_home))
|
||||
|
||||
frontend_dir = tmp_path / "frontend"
|
||||
frontend_dir.mkdir()
|
||||
dist_dir = frontend_dir / "dist"
|
||||
dist_dir.mkdir()
|
||||
(frontend_dir / "app.ts").write_text("export const app = 1\n", encoding="utf-8")
|
||||
(frontend_dir / "bundle.min.js").write_text("export const bundle = 1\n", encoding="utf-8")
|
||||
(dist_dir / "compiled.ts").write_text("export const compiled = 1\n", encoding="utf-8")
|
||||
|
||||
builder = IndexTreeBuilder(
|
||||
registry=MagicMock(),
|
||||
mapper=MagicMock(),
|
||||
config=None,
|
||||
incremental=False,
|
||||
)
|
||||
|
||||
source_files = builder._iter_source_files(frontend_dir, source_root=tmp_path)
|
||||
dirs_by_depth = builder._collect_dirs_by_depth(tmp_path)
|
||||
discovered_dirs = _relative_dirs(tmp_path, dirs_by_depth)
|
||||
|
||||
assert [path.name for path in source_files] == ["app.ts"]
|
||||
assert "frontend/dist" not in discovered_dirs
|
||||
|
||||
Reference in New Issue
Block a user