Skip to content

Conversation

@xtetsuji
Copy link
Owner

@xtetsuji xtetsuji commented Oct 9, 2025

No description provided.

@xtetsuji xtetsuji self-assigned this Oct 9, 2025
@xtetsuji xtetsuji requested a review from Copilot October 9, 2025 14:59
Copy link
Contributor

Copilot AI left a 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_PROGRAM environment variable
  • Loads shell integration script using kiro's built-in path locator
  • Provides opt-out mechanism via KIRO_DISABLE_SHELL_INTEGRATION environment 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)")"
Copy link

Copilot AI Oct 9, 2025

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.

Copilot uses AI. Check for mistakes.
# 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"
Copy link

Copilot AI Oct 9, 2025

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.

Suggested change
[[ -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

Copilot uses AI. Check for mistakes.
@xtetsuji
Copy link
Owner Author

duplicated? #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants