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]
9595 return codegate_regex .match (last_user_message_str )
9696
9797
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+
98117class CodegateCli (PipelineStep ):
99118 """Pipeline step that handles codegate cli."""
100119
@@ -136,6 +155,8 @@ async def process(
136155 match = _get_cli_from_open_interpreter (last_user_message_str )
137156 elif context .client in [ClientType .CONTINUE ]:
138157 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 )
139160 else :
140161 # Check if "codegate" is the first word in the message
141162 match = codegate_regex .match (last_user_message_str )
You can’t perform that action at this time.
0 commit comments