From fd60d8e4251a7d50822977c536a50245caf29c0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 05:17:35 +0000 Subject: [PATCH 1/2] Initial plan From 3f6a3d063848a69255ce157a6f564b9d3695d317 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 05:21:06 +0000 Subject: [PATCH 2/2] feat: create src/shared/patterns.py with centralized get_filename_pattern_string() Co-authored-by: KHAEntertainment <43256680+KHAEntertainment@users.noreply.github.com> Agent-Logs-Url: https://github.com/KHAEntertainment/grok-multiagent-plugin/sessions/c147bc88-9dac-4881-9e47-f0f87afc51d0 --- src/shared/__init__.py | 1 + src/shared/patterns.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/shared/__init__.py create mode 100644 src/shared/patterns.py diff --git a/src/shared/__init__.py b/src/shared/__init__.py new file mode 100644 index 0000000..ad5da11 --- /dev/null +++ b/src/shared/__init__.py @@ -0,0 +1 @@ +# shared package diff --git a/src/shared/patterns.py b/src/shared/patterns.py new file mode 100644 index 0000000..9fbdc47 --- /dev/null +++ b/src/shared/patterns.py @@ -0,0 +1,28 @@ +""" +Shared regex patterns used by both grok_bridge.py and grok_agent.py. + +Centralizing these patterns ensures consistent parsing across all modules. +""" + +# Canonical list of supported file extensions for filename detection. +SUPPORTED_EXTENSIONS = ( + "py|js|ts|jsx|tsx|go|rs|java|c|cpp|h|hpp|cs|rb|php|swift|kt|scala|sh|bash" +) + +# Regex pattern string that matches a comment-style filename header, e.g.: +# # filename.py +_FILENAME_PATTERN_STRING = ( + r"^\s*#\s*([a-zA-Z_][a-zA-Z0-9_]*\.(?:" + + SUPPORTED_EXTENSIONS + + r"))\s*$" +) + + +def get_filename_pattern_string() -> str: + """Return the canonical regex string for matching comment-style filename headers. + + Both grok_bridge.py and grok_agent.py compile this string (with re.MULTILINE) + so that any change to the supported extension list is automatically reflected + in every consumer. + """ + return _FILENAME_PATTERN_STRING