Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cecli/tools/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ async def execute(

@classmethod
async def _get_confirmation(cls, coder, command_string, background):
"""Get user confirmation for command execution."""
"""Get user confirmation for command execution.

NOTE: This does NOT print the command itself. The caller (format_output
via _print_tool_call_info) is responsible for displaying the command
before this runs. Do not print the command here or it will appear twice.
"""
# Hash command for dict key lookup
command_hash = cls._hash_command(command_string)

Expand All @@ -231,16 +236,13 @@ async def _get_confirmation(cls, coder, command_string, background):
if fnmatch.fnmatch(command_string, pattern):
return True

formatted_command = coder.format_command_with_prefix(command_string)

if background:
prompt = "Allow execution of this background command?"
else:
prompt = "Allow execution of this command?"

confirmed = await coder.io.confirm_ask(
prompt,
subject=formatted_command,
explicit_yes_required=True,
allow_never=True,
group_response="Command Tool",
Expand All @@ -251,7 +253,6 @@ async def _get_confirmation(cls, coder, command_string, background):
if command_hash not in cls.ALLOWED_SESSION_COMMANDS:
session_allowed = await coder.io.confirm_ask(
"Allow this command for the rest of the session?",
subject=formatted_command,
)
cls.ALLOWED_SESSION_COMMANDS[command_hash] = session_allowed

Expand Down Expand Up @@ -686,7 +687,7 @@ def format_output(cls, coder, mcp_server, tool_response):
coder.io.tool_output(f"{color_start}Action:{color_end} {action}")
elif command:
coder.io.tool_output(f"{color_start}Command:{color_end}")
coder.io.tool_output(command)
coder.io.tool_output(coder.format_command_with_prefix(command))

coder.io.tool_output("")

Expand Down
Loading