feat(hooks): expand _CODE_FILE_EXTENSIONS to include config/schema formats

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.
This commit is contained in:
Joe Black authored and Michael Panchenko committed 2026-05-26 16:43:47 +02:00
1 parent 6956948180
commit f5c707aca4
2 files changed
+17

No files matched your search

+3
View File
@@ -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:
+14
View File
@@ -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",
)
)