diff options
Diffstat (limited to 'packages/cli/src/services/FileCommandLoader.ts')
| -rw-r--r-- | packages/cli/src/services/FileCommandLoader.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/packages/cli/src/services/FileCommandLoader.ts b/packages/cli/src/services/FileCommandLoader.ts index 5b8d8c42..2942a8b9 100644 --- a/packages/cli/src/services/FileCommandLoader.ts +++ b/packages/cli/src/services/FileCommandLoader.ts @@ -21,10 +21,7 @@ import { SlashCommand, SlashCommandActionReturn, } from '../ui/commands/types.js'; -import { - DefaultArgumentProcessor, - ShorthandArgumentProcessor, -} from './prompt-processors/argumentProcessor.js'; +import { DefaultArgumentProcessor } from './prompt-processors/argumentProcessor.js'; import { IPromptProcessor, SHORTHAND_ARGS_PLACEHOLDER, @@ -224,16 +221,21 @@ export class FileCommandLoader implements ICommandLoader { } const processors: IPromptProcessor[] = []; + const usesArgs = validDef.prompt.includes(SHORTHAND_ARGS_PLACEHOLDER); + const usesShellInjection = validDef.prompt.includes( + SHELL_INJECTION_TRIGGER, + ); - // Add the Shell Processor if needed. - if (validDef.prompt.includes(SHELL_INJECTION_TRIGGER)) { + // Interpolation (Shell Execution and Argument Injection) + // If the prompt uses either shell injection OR argument placeholders, + // we must use the ShellProcessor. + if (usesShellInjection || usesArgs) { processors.push(new ShellProcessor(baseCommandName)); } - // The presence of '{{args}}' is the switch that determines the behavior. - if (validDef.prompt.includes(SHORTHAND_ARGS_PLACEHOLDER)) { - processors.push(new ShorthandArgumentProcessor()); - } else { + // Default Argument Handling + // If NO explicit argument injection ({{args}}) was used, we append the raw invocation. + if (!usesArgs) { processors.push(new DefaultArgumentProcessor()); } |
