This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/codegate/pipeline/cli Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,25 @@ def _get_cli_from_continue(last_user_message_str: str) -> Optional[re.Match[str]
95
95
return codegate_regex .match (last_user_message_str )
96
96
97
97
98
+ def _get_cli_from_copilot (last_user_message_str : str ) -> Optional [re .Match [str ]]:
99
+ """
100
+ Process Copilot-specific CLI command format.
101
+
102
+ Copilot sends messages in the format:
103
+ <attachment>file contents</attachment>codegate command
104
+
105
+ Args:
106
+ last_user_message_str (str): The message string from Copilot
107
+
108
+ Returns:
109
+ Optional[re.Match[str]]: A regex match object if command is found, None otherwise
110
+ """
111
+ cleaned_text = re .sub (
112
+ r"<attachment>.*</attachment>" , "" , last_user_message_str , flags = re .DOTALL
113
+ )
114
+ return codegate_regex .match (cleaned_text .strip ())
115
+
116
+
98
117
class CodegateCli (PipelineStep ):
99
118
"""Pipeline step that handles codegate cli."""
100
119
@@ -136,6 +155,8 @@ async def process(
136
155
match = _get_cli_from_open_interpreter (last_user_message_str )
137
156
elif context .client in [ClientType .CONTINUE ]:
138
157
match = _get_cli_from_continue (last_user_message_str )
158
+ elif context .client in [ClientType .COPILOT ]:
159
+ match = _get_cli_from_copilot (last_user_message_str )
139
160
else :
140
161
# Check if "codegate" is the first word in the message
141
162
match = codegate_regex .match (last_user_message_str )
You can’t perform that action at this time.
0 commit comments