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 +17
-0
lines changed
src/codegate/pipeline/cli Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,21 @@ def _get_cli_from_continue(last_user_message_str: str) -> Optional[re.Match[str]
9494
9595 return codegate_regex .match (last_user_message_str )
9696
97+ def _get_cli_from_copilot (last_user_message_str : str ) -> Optional [re .Match [str ]]:
98+ """
99+ Process Copilot-specific CLI command format.
100+
101+ Copilot sends messages in the format:
102+ <attachment>file contents</attachment>codegate command
103+
104+ Args:
105+ last_user_message_str (str): The message string from Copilot
106+
107+ Returns:
108+ Optional[re.Match[str]]: A regex match object if command is found, None otherwise
109+ """
110+ cleaned_text = re .sub (r'<attachment>.*</attachment>' , '' , last_user_message_str , flags = re .DOTALL )
111+ return codegate_regex .match (cleaned_text .strip ())
97112
98113class CodegateCli (PipelineStep ):
99114 """Pipeline step that handles codegate cli."""
@@ -136,6 +151,8 @@ async def process(
136151 match = _get_cli_from_open_interpreter (last_user_message_str )
137152 elif context .client in [ClientType .CONTINUE ]:
138153 match = _get_cli_from_continue (last_user_message_str )
154+ elif context .client in [ClientType .COPILOT ]:
155+ match = _get_cli_from_copilot (last_user_message_str )
139156 else :
140157 # Check if "codegate" is the first word in the message
141158 match = codegate_regex .match (last_user_message_str )
You can’t perform that action at this time.
0 commit comments