From f5c707aca43a93f7f96623136cb131836f1fcdac Mon Sep 17 00:00:00 2001 From: Joe Black Date: Tue, 26 May 2026 07:42:50 -0400 Subject: [PATCH] feat(hooks): expand _CODE_FILE_EXTENSIONS to include config/schema formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add structured non-source file types (.yaml, .json, .toml, .graphql, .proto, .sql, .tf, .hcl, etc.) to the read-file nudge set. These extensions are common in real-world projects and repeated raw reads of them are equally well served by `search_for_pattern` or other Serena tools — the same rationale that applies to .py/.ts already applies to config, schema, and query files. Note added to the docstring: `search_for_pattern` works regardless of extension and is always a valid alternative to repeated raw reads. --- CHANGELOG.md | 3 +++ src/serena/hooks.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 088d77d9..e68a27d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Status of the `main` branch. Changes prior to the next official version change w - Add `serena-agent` CLI command so that `uvx serena-agent` can be used as entrypoint. - Fortls and pyright are now installed on the fly instead of being bundled in the serena-agent package. +* Hooks: + - Extend list of extensions that are considered code files (affects the reminder hook counter). + # v1.5.1 (2026-05-18) * General: diff --git a/src/serena/hooks.py b/src/serena/hooks.py index d9a9b03f..ef5e2106 100644 --- a/src/serena/hooks.py +++ b/src/serena/hooks.py @@ -272,6 +272,8 @@ class PreToolUseRemindAboutSymbolicToolsHook(PreToolUseHook): #: file suffixes for source-like files where symbolic tools are usually more #: appropriate than repeated raw reads. Lowercase and extension-only. + #: Note: ``search_for_pattern`` is always available regardless of extension and + #: is a better alternative to repeated raw reads for any structured file type. _CODE_FILE_EXTENSIONS: frozenset[str] = frozenset( ( ".al", @@ -289,14 +291,19 @@ class PreToolUseRemindAboutSymbolicToolsHook(PreToolUseHook): ".fs", ".fsx", ".go", + ".graphql", + ".gql", ".groovy", ".h", + ".hcl", ".hpp", ".hs", ".html", ".java", ".jl", ".js", + ".json", + ".jsonc", ".jsx", ".kt", ".kts", @@ -305,6 +312,7 @@ class PreToolUseRemindAboutSymbolicToolsHook(PreToolUseHook): ".m", ".matlab", ".php", + ".proto", ".ps1", ".py", ".r", @@ -313,11 +321,17 @@ class PreToolUseRemindAboutSymbolicToolsHook(PreToolUseHook): ".scala", ".sh", ".sol", + ".sql", ".svelte", ".swift", + ".tf", + ".tfvars", + ".toml", ".ts", ".tsx", ".vue", + ".yaml", + ".yml", ".zig", ) )