Conversation
There was a problem hiding this comment.
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)")" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.