-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commands Should work in Non-Interactive Mode #5435
Copy link
Copy link
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityarea/non-interactiveIssues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automationIssues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automationpriority/p1Important and should be addressed in the near term.Important and should be addressed in the near term.
Metadata
Metadata
Assignees
Labels
area/coreIssues related to User Interface, OS Support, Core FunctionalityIssues related to User Interface, OS Support, Core Functionalityarea/non-interactiveIssues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automationIssues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automationpriority/p1Important and should be addressed in the near term.Important and should be addressed in the near term.
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
Status
Closed
What happened?
Description
When running the Gemini CLI in a non-interactive environment, custom commands defined in
.tomlfiles are not being recognized or executed. The CLI either treats the command as a literal string or reports it as an invalid command.Instead of expanding the command from the corresponding
.tomlfile, the CLI either treats the custom command itself (e.g.,/pr-review) as the literal prompt text or fails with an "invalid command" error. This prevents the use of reusable prompts in automated workflows, which is a primary use case for this feature.Steps to Reproduce
cc @abhipatel12
What did you expect to happen?
When
gemini --prompt "/hello"is executed, the CLI should find the.gemini/commands/hello.tomlfile, expand the prompt, and execute that prompt with Gemini CLI non-interactively.Open to other syntax suggestions to make this work in headless mode, doesn't have to be slash commands.
Client information
N/A
Login information
N/A
Anything else we need to know?
The primary impact of this bug is on automation. The current workaround is to embed the entire multi-line prompt directly into the script. This defeats the purpose of having reusable custom commands, making workflows verbose and difficult to maintain. Enabling slash commands in non-interactive mode is critical for clean, modular, and maintainable automated workflows.
In addition, this makes it impossible to use extensions in non-interactive mode.