diff options
| author | Seth Troisi <[email protected]> | 2025-04-30 00:26:07 +0000 |
|---|---|---|
| committer | Seth Troisi <[email protected]> | 2025-04-30 22:17:08 +0000 |
| commit | 5f5edb4c9bac24c4875ffc1a5a97ad8cf11f4436 (patch) | |
| tree | 376f7f0863d0db0c354ec6f2212d16f9c20cd995 /packages/cli/src/ui/hooks/passthroughCommandProcessor.ts | |
| parent | 68a3020044b3c8567641c8fdcd5a369366dab981 (diff) | |
Added bang(!) commands as a shell passthrough
Diffstat (limited to 'packages/cli/src/ui/hooks/passthroughCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/passthroughCommandProcessor.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/cli/src/ui/hooks/passthroughCommandProcessor.ts b/packages/cli/src/ui/hooks/passthroughCommandProcessor.ts index 2a71c5ec..97244e8c 100644 --- a/packages/cli/src/ui/hooks/passthroughCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/passthroughCommandProcessor.ts @@ -9,6 +9,7 @@ import { useCallback } from 'react'; import { Config } from '@gemini-code/server'; import { type PartListUnion } from '@google/genai'; import { HistoryItem, StreamingState } from '../types.js'; +import { getCommandFromQuery } from '../utils/commandUtils.js'; // Helper function (consider moving to a shared util if used elsewhere) const addHistoryItem = ( @@ -40,15 +41,14 @@ export const usePassthroughProcessor = ( return false; } - // Passthrough commands don't start with special characters like '/' or '@' - if (trimmedQuery.startsWith('/') || trimmedQuery.startsWith('@')) { + const [symbol, command] = getCommandFromQuery(trimmedQuery); + + // Passthrough commands don't start with symbol + if (symbol !== undefined) { return false; } - const commandParts = trimmedQuery.split(/\s+/); - const commandName = commandParts[0]; - - if (config.getPassthroughCommands().includes(commandName)) { + if (config.getPassthroughCommands().includes(command)) { // Add user message *before* execution starts const userMessageTimestamp = Date.now(); addHistoryItem( @@ -60,7 +60,7 @@ export const usePassthroughProcessor = ( // Execute and capture output const targetDir = config.getTargetDir(); setDebugMessage( - `Executing shell command in ${targetDir}: ${trimmedQuery}`, + `Executing pass through command in ${targetDir}: ${trimmedQuery}`, ); const execOptions = { cwd: targetDir, |
