-
Notifications
You must be signed in to change notification settings - Fork 1
common_env: add shell integration support for kiro terminal #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds shell integration support for the kiro terminal by detecting when running inside kiro and sourcing the appropriate shell integration script. This enables enhanced terminal features and functionality when using kiro as the terminal emulator.
- Detects kiro terminal via
TERM_PROGRAMenvironment variable - Loads shell integration script using kiro's built-in path locator
- Provides opt-out mechanism via
KIRO_DISABLE_SHELL_INTEGRATIONenvironment variable
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if [[ "$TERM_PROGRAM" == "kiro" ]] && exists kiro && exists shell_name ; then | ||
| # allow opt-out via env var: KIRO_DISABLE_SHELL_INTEGRATION=1 | ||
| if [ -z "${KIRO_DISABLE_SHELL_INTEGRATION:-}" ] ; then | ||
| kiro_path="$(kiro --locate-shell-integration-path "$(shell_name)")" |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command substitution for kiro --locate-shell-integration-path should handle potential errors. If the command fails, kiro_path will be empty but the error isn't captured. Consider adding error handling or checking the exit status.
| # allow opt-out via env var: KIRO_DISABLE_SHELL_INTEGRATION=1 | ||
| if [ -z "${KIRO_DISABLE_SHELL_INTEGRATION:-}" ] ; then | ||
| kiro_path="$(kiro --locate-shell-integration-path "$(shell_name)")" | ||
| [[ -n "$kiro_path" && -f "$kiro_path" ]] && . "$kiro_path" |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sourcing a file without validating its contents or permissions could be a security risk. Consider adding additional checks to ensure the file is safe to source, such as verifying it's owned by the current user or checking permissions.
| [[ -n "$kiro_path" && -f "$kiro_path" ]] && . "$kiro_path" | |
| if [[ -n "$kiro_path" && -f "$kiro_path" ]]; then | |
| # Check that the file is owned by the current user and not world-writable | |
| kiro_owner=$(stat -c %U "$kiro_path" 2>/dev/null) | |
| if [[ "$kiro_owner" == "$USER" ]] && [[ ! -w "$kiro_path" || $(stat -c %a "$kiro_path" 2>/dev/null) -lt 666 ]]; then | |
| . "$kiro_path" | |
| fi | |
| fi |
|
duplicated? #56 |
No description provided.