From c2f42cd57e1f0d01c4e3987d696d74f70ddf7b8f Mon Sep 17 00:00:00 2001 From: ManuelReschke Date: Thu, 18 Jun 2026 10:31:18 +0200 Subject: [PATCH] feat(miner): add PHP ecosystem file extensions --- mempalace/miner.py | 30 +++++++++++++++++++++++++++++- tests/test_miner.py | 28 +++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/mempalace/miner.py b/mempalace/miner.py index aed1810..c8580fe 100644 --- a/mempalace/miner.py +++ b/mempalace/miner.py @@ -47,6 +47,34 @@ from .ids import ID_RECIPE, make_drawer_id_from_chunk logger = logging.getLogger("mempalace_mcp") +PHP_EXTENSIONS = { + # Compound Blade templates such as ``view.blade.php`` are covered by the + # final ``.php`` suffix. + ".php", + ".php3", + ".php4", + ".php5", + ".php7", + ".php8", + ".phtml", + ".phps", + ".phpt", + ".inc", + ".aw", + ".fcgi", + ".ctp", + ".module", + ".install", + ".profile", + ".theme", + ".engine", + ".twig", + ".blade", + ".tpl", + ".latte", + ".volt", +} + READABLE_EXTENSIONS = { ".txt", ".md", @@ -69,7 +97,7 @@ READABLE_EXTENSIONS = { ".csv", ".sql", ".toml", -} +} | PHP_EXTENSIONS SKIP_FILENAMES = { "entities.json", diff --git a/tests/test_miner.py b/tests/test_miner.py index 34ceff6..52d4399 100644 --- a/tests/test_miner.py +++ b/tests/test_miner.py @@ -10,7 +10,15 @@ import pytest import yaml from mempalace.config import normalize_wing_name -from mempalace.miner import detect_room, load_config, mine, scan_project, status +from mempalace.miner import ( + PHP_EXTENSIONS, + READABLE_EXTENSIONS, + detect_room, + load_config, + mine, + scan_project, + status, +) from mempalace.palace import NORMALIZE_VERSION, file_already_mined, prefetch_mined_set @@ -24,6 +32,24 @@ def scanned_files(project_root: Path, **kwargs): return sorted(path.relative_to(project_root).as_posix() for path in files) +def test_php_ecosystem_extensions_are_readable(): + assert PHP_EXTENSIONS <= READABLE_EXTENSIONS + + +def test_scan_project_includes_php_ecosystem_files(tmp_path): + expected = [] + for index, extension in enumerate(sorted(PHP_EXTENSIONS)): + filename = f"example_{index}{extension}" + write_file(tmp_path / filename, "