Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions code_puppy/cli_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,20 @@ async def interactive_mode(message_renderer, initial_command: str = None) -> Non
if initial_command:
from code_puppy.command_line.shell_passthrough import (
execute_shell_passthrough,
is_known_cli_command,
is_powershell_cmdlet,
is_shell_passthrough,
)

if is_shell_passthrough(initial_command):
execute_shell_passthrough(initial_command)
initial_command = None
elif is_known_cli_command(initial_command) or is_powershell_cmdlet(
initial_command
):
# Auto-detect known CLI / PowerShell commands — bypass AI, zero tokens
execute_shell_passthrough(f"!{initial_command.strip()}")
initial_command = None

# Initialize the runtime agent manager
if initial_command:
Expand Down Expand Up @@ -597,13 +605,22 @@ async def interactive_mode(message_renderer, initial_command: str = None) -> Non
# Shell pass-through: !<command> executes directly, bypassing the agent
from code_puppy.command_line.shell_passthrough import (
execute_shell_passthrough,
is_known_cli_command,
is_powershell_cmdlet,
is_shell_passthrough,
)

if is_shell_passthrough(task):
execute_shell_passthrough(task)
continue

# Auto-detect known CLI commands (e.g. `ls`, `git status`, `grep …`)
# and PowerShell cmdlets (e.g. `Get-ChildItem`, `Set-Location`)
# — route directly to the shell, zero tokens consumed.
if is_known_cli_command(task) or is_powershell_cmdlet(task):
execute_shell_passthrough(f"!{task.strip()}")
continue

# Check for exit commands (plain text or command form)
if task.strip().lower() in ["exit", "quit"] or task.strip().lower() in [
"/exit",
Expand Down Expand Up @@ -1014,13 +1031,20 @@ async def execute_single_prompt(prompt: str, message_renderer) -> None:
# Shell pass-through: !<cmd> bypasses the agent even in -p mode
from code_puppy.command_line.shell_passthrough import (
execute_shell_passthrough,
is_known_cli_command,
is_powershell_cmdlet,
is_shell_passthrough,
)

if is_shell_passthrough(prompt):
execute_shell_passthrough(prompt)
return

# Auto-detect known CLI / PowerShell commands — bypass AI, zero tokens
if is_known_cli_command(prompt) or is_powershell_cmdlet(prompt):
execute_shell_passthrough(f"!{prompt.strip()}")
return

from code_puppy.messaging import emit_info

emit_info(f"Executing prompt: {prompt}")
Expand Down
Loading