-
Notifications
You must be signed in to change notification settings - Fork 396
Description
Summary
Amazon Q Chat should execute commands within the user's actual shell environment (bash, zsh, etc.) to access user-defined aliases, functions, environment variables, and other shell customizations.
Problem Statement
Currently, Amazon Q Chat executes commands in a separate bash shell that doesn't have access to the user's shell configuration. This means:
- Custom aliases defined in .zshrc, etc. are not available
- User-defined shell functions cannot be used
- Custom environment variables are not accessible
- PATH modifications and other shell customizations are not applied
This creates a disconnect between how users work in their terminal and how Amazon Q Chat executes commands, requiring users to provide full command paths or avoid using their custom shortcuts.
Proposed Solution
Modify Amazon Q Chat to:
- Detect the user's default shell (bash, zsh, fish, etc.)
- Execute commands through that shell with the user's configuration loaded
- Preserve the shell's environment between command executions within a session
For example, when a user with zsh as their default shell asks Amazon Q to run a command like "bb" (which might be an alias for "brazil-build"), Amazon Q should:
• Execute the command through zsh
• Load the user's .zshrc configuration
• Run the command with all aliases and functions available
Benefits
• Seamless integration with the user's existing workflow
• Reduced friction when asking Amazon Q to execute commands
• Ability to use shorthand commands and aliases familiar to the user
• Consistent environment between terminal and Amazon Q Chat
Use Cases
- Running aliased commands like "gt" instead of "gradle tasks"
- Using custom functions defined in shell configuration
- Accessing environment variables set in shell startup files
- Utilizing modified PATH or other environment customizations
Technical Considerations
• Security implications of executing commands in the user's shell environment
• Handling different shell types (bash, zsh, fish, etc.)
• Maintaining shell state between command executions
• Potential performance implications
Example
When a user with an alias "describereg" for 'aws cloudformation describe-type-registration --profile default --registration-token' in their .zshrc asks:
run describereg foobar
Amazon Q should execute this in the user's zsh environment with their .zshrc loaded, effectively running:
aws cloudformation describe-type-registration --profile default --registration-token foobar