Skip to content

Commit c3f9888

Browse files
committed
Fix test failures
1 parent 0d548c3 commit c3f9888

14 files changed

+260
-268
lines changed

.amazonq/cli-todo-lists/1761664085729.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.amazonq/cli-todo-lists/1761667777935.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/fig_integrations/src/shell/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ impl ShellExt for Shell {
196196
include_str!("scripts/bash-preexec.sh"),
197197
"}\n",
198198
"__fig_source_bash_preexec\n",
199-
"function __bp_adjust_histcontrol() { :; }\n",
200199
include_str!("scripts/pre.sh")
201200
)
202201
},
@@ -206,7 +205,6 @@ impl ShellExt for Shell {
206205
include_str!("scripts/bash-preexec.sh"),
207206
"}\n",
208207
"__fig_source_bash_preexec\n",
209-
"function __bp_adjust_histcontrol() { :; }\n",
210208
include_str!("scripts/post.bash")
211209
)
212210
},

crates/fig_util/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub mod env_var {
121121
PROCESS_LAUNCHED_BY_Q = "PROCESS_LAUNCHED_BY_Q",
122122

123123
/// The shell to use in qterm
124-
Q_SHELL = "Q_SHELL",
124+
Q_SHELL = "KIRO_SHELL",
125125

126126
/// Indicates the user is debugging the shell
127127
Q_DEBUG_SHELL = "Q_DEBUG_SHELL",

crates/q_cli/tests/snapshots/init__init_snapshot_bash_post_bash_profile.snap

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
source: q_cli/tests/init.rs
2+
source: crates/q_cli/tests/init.rs
33
expression: init
44
---
5-
Q_SHELL="/bin/zsh"
5+
KIRO_SHELL="/bin/zsh"
66
function __fig_source_bash_preexec() {
77
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
88
# https://github.com/rcaloras/bash-preexec
@@ -387,7 +387,6 @@ if [[ -z "${__bp_delay_install:-}" ]]; then
387387
fi;
388388
}
389389
__fig_source_bash_preexec
390-
function __bp_adjust_histcontrol() { :; }
391390
if [[ -n "${BASH:-}" ]]; then
392391

393392
# add ~/.local/bin to PATH
@@ -402,12 +401,12 @@ export TTY
402401

403402
export SHELL_PID="$$"
404403

405-
Q_LAST_PS1="$PS1"
406-
Q_LAST_PS2="$PS2"
407-
Q_LAST_PS3="$PS3"
404+
KIRO_LAST_PS1="$PS1"
405+
KIRO_LAST_PS2="$PS2"
406+
KIRO_LAST_PS3="$PS3"
408407

409-
if [[ -z "${Q_SHELL:-}" ]]; then
410-
Q_SHELL=$(q _ get-shell)
408+
if [[ -z "${KIRO_SHELL:-}" ]]; then
409+
KIRO_SHELL=$(q _ get-shell)
411410
fi
412411

413412
# Construct Operating System Command.
@@ -420,17 +419,17 @@ function __fig_preexec() {
420419

421420
# Reset user prompts before executing a command, but only if it hasn't
422421
# changed since we last set it.
423-
if [[ -n "${Q_USER_PS1+x}" && "${PS1}" = "${Q_LAST_PS1}" ]]; then
424-
Q_LAST_PS1="${Q_USER_PS1}"
425-
PS1="${Q_USER_PS1}"
422+
if [[ -n "${KIRO_USER_PS1+x}" && "${PS1}" = "${KIRO_LAST_PS1}" ]]; then
423+
KIRO_LAST_PS1="${KIRO_USER_PS1}"
424+
PS1="${KIRO_USER_PS1}"
426425
fi
427-
if [[ -n "${Q_USER_PS2+x}" && "${PS2}" = "${Q_LAST_PS2}" ]]; then
428-
Q_LAST_PS2="${Q_USER_PS2}"
429-
PS2="${Q_USER_PS2}"
426+
if [[ -n "${KIRO_USER_PS2+x}" && "${PS2}" = "${KIRO_LAST_PS2}" ]]; then
427+
KIRO_LAST_PS2="${KIRO_USER_PS2}"
428+
PS2="${KIRO_USER_PS2}"
430429
fi
431-
if [[ -n "${Q_USER_PS3+x}" && "${PS3}" = "${Q_LAST_PS3}" ]]; then
432-
Q_LAST_PS3="${Q_USER_PS3}"
433-
PS3="${Q_USER_PS3}"
430+
if [[ -n "${KIRO_USER_PS3+x}" && "${PS3}" = "${KIRO_LAST_PS3}" ]]; then
431+
KIRO_LAST_PS3="${KIRO_USER_PS3}"
432+
PS3="${KIRO_USER_PS3}"
434433
fi
435434

436435
_fig_done_preexec="yes"
@@ -448,14 +447,14 @@ function __fig_pre_prompt () {
448447
fig_osc "OSCUnlock=%s" "${QTERM_SESSION_ID}"
449448
fig_osc "Dir=%s" "${PWD}"
450449
fig_osc "Shell=bash"
451-
fig_osc "ShellPath=%s" "${Q_SHELL:-$SHELL}"
450+
fig_osc "ShellPath=%s" "${KIRO_SHELL:-$SHELL}"
452451
if [[ -n "${WSL_DISTRO_NAME}" ]]; then
453452
fig_osc "WSLDistro=%s" "${WSL_DISTRO_NAME}"
454453
fi
455454
fig_osc "PID=%d" "$$"
456455
fig_osc "ExitCode=%s" "$__fig_ret_value"
457456
fig_osc "TTY=%s" "${TTY}"
458-
fig_osc "Log=%s" "${Q_LOG_LEVEL}"
457+
fig_osc "Log=%s" "${KIRO_LOG_LEVEL}"
459458
fig_osc "User=%s" "${USER:-root}"
460459

461460
if command -v q >/dev/null 2>&1; then
@@ -476,15 +475,15 @@ function __fig_post_prompt () {
476475

477476
__fig_reset_hooks
478477

479-
# If Q_USER_PSx is undefined or PSx changed by user, update Q_USER_PSx.
480-
if [[ -z "${Q_USER_PS1+x}" || "${PS1}" != "${Q_LAST_PS1}" ]]; then
481-
Q_USER_PS1="${PS1}"
478+
# If KIRO_USER_PSx is undefined or PSx changed by user, update KIRO_USER_PSx.
479+
if [[ -z "${KIRO_USER_PS1+x}" || "${PS1}" != "${KIRO_LAST_PS1}" ]]; then
480+
KIRO_USER_PS1="${PS1}"
482481
fi
483-
if [[ -z "${Q_USER_PS2+x}" || "${PS2}" != "${Q_LAST_PS2}" ]]; then
484-
Q_USER_PS2="${PS2}"
482+
if [[ -z "${KIRO_USER_PS2+x}" || "${PS2}" != "${KIRO_LAST_PS2}" ]]; then
483+
KIRO_USER_PS2="${PS2}"
485484
fi
486-
if [[ -z "${Q_USER_PS3+x}" || "${PS3}" != "${Q_LAST_PS3}" ]]; then
487-
Q_USER_PS3="${PS3}"
485+
if [[ -z "${KIRO_USER_PS3+x}" || "${PS3}" != "${KIRO_LAST_PS3}" ]]; then
486+
KIRO_USER_PS3="${PS3}"
488487
fi
489488

490489
START_PROMPT="\[$(fig_osc StartPrompt)\]"
@@ -493,15 +492,15 @@ function __fig_post_prompt () {
493492
# it's already double quoted, dummy
494493
NEW_CMD="\[$(fig_osc NewCmd=${QTERM_SESSION_ID})\]"
495494

496-
# Reset $? first in case it's used in $Q_USER_PSx.
495+
# Reset $? first in case it's used in $KIRO_USER_PSx.
497496
__bp_set_ret_value "${__fig_ret_value}" "${__bp_last_argument_prev_command}"
498-
PS1="${START_PROMPT}${Q_USER_PS1}${END_PROMPT}${NEW_CMD}"
499-
PS2="${START_PROMPT}${Q_USER_PS2}${END_PROMPT}"
500-
PS3="${START_PROMPT}${Q_USER_PS3}${END_PROMPT}${NEW_CMD}"
497+
PS1="${START_PROMPT}${KIRO_USER_PS1}${END_PROMPT}${NEW_CMD}"
498+
PS2="${START_PROMPT}${KIRO_USER_PS2}${END_PROMPT}"
499+
PS3="${START_PROMPT}${KIRO_USER_PS3}${END_PROMPT}${NEW_CMD}"
501500

502-
Q_LAST_PS1="${PS1}"
503-
Q_LAST_PS2="${PS2}"
504-
Q_LAST_PS3="${PS3}"
501+
KIRO_LAST_PS1="${PS1}"
502+
KIRO_LAST_PS2="${PS2}"
503+
KIRO_LAST_PS3="${PS3}"
505504
}
506505

507506
__fig_reset_hooks() {

crates/q_cli/tests/snapshots/init__init_snapshot_bash_post_bashrc.snap

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
source: q_cli/tests/init.rs
2+
source: crates/q_cli/tests/init.rs
33
expression: init
44
---
5-
Q_SHELL="/bin/zsh"
5+
KIRO_SHELL="/bin/zsh"
66
function __fig_source_bash_preexec() {
77
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
88
# https://github.com/rcaloras/bash-preexec
@@ -387,7 +387,6 @@ if [[ -z "${__bp_delay_install:-}" ]]; then
387387
fi;
388388
}
389389
__fig_source_bash_preexec
390-
function __bp_adjust_histcontrol() { :; }
391390
if [[ -n "${BASH:-}" ]]; then
392391

393392
# add ~/.local/bin to PATH
@@ -402,12 +401,12 @@ export TTY
402401

403402
export SHELL_PID="$$"
404403

405-
Q_LAST_PS1="$PS1"
406-
Q_LAST_PS2="$PS2"
407-
Q_LAST_PS3="$PS3"
404+
KIRO_LAST_PS1="$PS1"
405+
KIRO_LAST_PS2="$PS2"
406+
KIRO_LAST_PS3="$PS3"
408407

409-
if [[ -z "${Q_SHELL:-}" ]]; then
410-
Q_SHELL=$(q _ get-shell)
408+
if [[ -z "${KIRO_SHELL:-}" ]]; then
409+
KIRO_SHELL=$(q _ get-shell)
411410
fi
412411

413412
# Construct Operating System Command.
@@ -420,17 +419,17 @@ function __fig_preexec() {
420419

421420
# Reset user prompts before executing a command, but only if it hasn't
422421
# changed since we last set it.
423-
if [[ -n "${Q_USER_PS1+x}" && "${PS1}" = "${Q_LAST_PS1}" ]]; then
424-
Q_LAST_PS1="${Q_USER_PS1}"
425-
PS1="${Q_USER_PS1}"
422+
if [[ -n "${KIRO_USER_PS1+x}" && "${PS1}" = "${KIRO_LAST_PS1}" ]]; then
423+
KIRO_LAST_PS1="${KIRO_USER_PS1}"
424+
PS1="${KIRO_USER_PS1}"
426425
fi
427-
if [[ -n "${Q_USER_PS2+x}" && "${PS2}" = "${Q_LAST_PS2}" ]]; then
428-
Q_LAST_PS2="${Q_USER_PS2}"
429-
PS2="${Q_USER_PS2}"
426+
if [[ -n "${KIRO_USER_PS2+x}" && "${PS2}" = "${KIRO_LAST_PS2}" ]]; then
427+
KIRO_LAST_PS2="${KIRO_USER_PS2}"
428+
PS2="${KIRO_USER_PS2}"
430429
fi
431-
if [[ -n "${Q_USER_PS3+x}" && "${PS3}" = "${Q_LAST_PS3}" ]]; then
432-
Q_LAST_PS3="${Q_USER_PS3}"
433-
PS3="${Q_USER_PS3}"
430+
if [[ -n "${KIRO_USER_PS3+x}" && "${PS3}" = "${KIRO_LAST_PS3}" ]]; then
431+
KIRO_LAST_PS3="${KIRO_USER_PS3}"
432+
PS3="${KIRO_USER_PS3}"
434433
fi
435434

436435
_fig_done_preexec="yes"
@@ -448,14 +447,14 @@ function __fig_pre_prompt () {
448447
fig_osc "OSCUnlock=%s" "${QTERM_SESSION_ID}"
449448
fig_osc "Dir=%s" "${PWD}"
450449
fig_osc "Shell=bash"
451-
fig_osc "ShellPath=%s" "${Q_SHELL:-$SHELL}"
450+
fig_osc "ShellPath=%s" "${KIRO_SHELL:-$SHELL}"
452451
if [[ -n "${WSL_DISTRO_NAME}" ]]; then
453452
fig_osc "WSLDistro=%s" "${WSL_DISTRO_NAME}"
454453
fi
455454
fig_osc "PID=%d" "$$"
456455
fig_osc "ExitCode=%s" "$__fig_ret_value"
457456
fig_osc "TTY=%s" "${TTY}"
458-
fig_osc "Log=%s" "${Q_LOG_LEVEL}"
457+
fig_osc "Log=%s" "${KIRO_LOG_LEVEL}"
459458
fig_osc "User=%s" "${USER:-root}"
460459

461460
if command -v q >/dev/null 2>&1; then
@@ -476,15 +475,15 @@ function __fig_post_prompt () {
476475

477476
__fig_reset_hooks
478477

479-
# If Q_USER_PSx is undefined or PSx changed by user, update Q_USER_PSx.
480-
if [[ -z "${Q_USER_PS1+x}" || "${PS1}" != "${Q_LAST_PS1}" ]]; then
481-
Q_USER_PS1="${PS1}"
478+
# If KIRO_USER_PSx is undefined or PSx changed by user, update KIRO_USER_PSx.
479+
if [[ -z "${KIRO_USER_PS1+x}" || "${PS1}" != "${KIRO_LAST_PS1}" ]]; then
480+
KIRO_USER_PS1="${PS1}"
482481
fi
483-
if [[ -z "${Q_USER_PS2+x}" || "${PS2}" != "${Q_LAST_PS2}" ]]; then
484-
Q_USER_PS2="${PS2}"
482+
if [[ -z "${KIRO_USER_PS2+x}" || "${PS2}" != "${KIRO_LAST_PS2}" ]]; then
483+
KIRO_USER_PS2="${PS2}"
485484
fi
486-
if [[ -z "${Q_USER_PS3+x}" || "${PS3}" != "${Q_LAST_PS3}" ]]; then
487-
Q_USER_PS3="${PS3}"
485+
if [[ -z "${KIRO_USER_PS3+x}" || "${PS3}" != "${KIRO_LAST_PS3}" ]]; then
486+
KIRO_USER_PS3="${PS3}"
488487
fi
489488

490489
START_PROMPT="\[$(fig_osc StartPrompt)\]"
@@ -493,15 +492,15 @@ function __fig_post_prompt () {
493492
# it's already double quoted, dummy
494493
NEW_CMD="\[$(fig_osc NewCmd=${QTERM_SESSION_ID})\]"
495494

496-
# Reset $? first in case it's used in $Q_USER_PSx.
495+
# Reset $? first in case it's used in $KIRO_USER_PSx.
497496
__bp_set_ret_value "${__fig_ret_value}" "${__bp_last_argument_prev_command}"
498-
PS1="${START_PROMPT}${Q_USER_PS1}${END_PROMPT}${NEW_CMD}"
499-
PS2="${START_PROMPT}${Q_USER_PS2}${END_PROMPT}"
500-
PS3="${START_PROMPT}${Q_USER_PS3}${END_PROMPT}${NEW_CMD}"
497+
PS1="${START_PROMPT}${KIRO_USER_PS1}${END_PROMPT}${NEW_CMD}"
498+
PS2="${START_PROMPT}${KIRO_USER_PS2}${END_PROMPT}"
499+
PS3="${START_PROMPT}${KIRO_USER_PS3}${END_PROMPT}${NEW_CMD}"
501500

502-
Q_LAST_PS1="${PS1}"
503-
Q_LAST_PS2="${PS2}"
504-
Q_LAST_PS3="${PS3}"
501+
KIRO_LAST_PS1="${PS1}"
502+
KIRO_LAST_PS2="${PS2}"
503+
KIRO_LAST_PS3="${PS3}"
505504
}
506505

507506
__fig_reset_hooks() {

crates/q_cli/tests/snapshots/init__init_snapshot_bash_pre_bash_profile.snap

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
source: q_cli/tests/init.rs
2+
source: crates/q_cli/tests/init.rs
33
expression: init
44
---
5-
Q_SHELL="/bin/zsh"
5+
KIRO_SHELL="/bin/zsh"
66
SHOULD_QTERM_LAUNCH="0"
77
function __fig_source_bash_preexec() {
88
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
@@ -388,7 +388,6 @@ if [[ -z "${__bp_delay_install:-}" ]]; then
388388
fi;
389389
}
390390
__fig_source_bash_preexec
391-
function __bp_adjust_histcontrol() { :; }
392391
#!/usr/bin/env bash
393392

394393
mkdir -p "${HOME}/.local/bin" > /dev/null 2>&1
@@ -398,22 +397,22 @@ if [[ -d "${HOME}/.local/bin" ]] && [[ ":$PATH:" != *":${HOME}/.local/bin:"* ]];
398397
PATH="${PATH:+"$PATH:"}${HOME}/.local/bin"
399398
fi
400399

401-
if [[ -n "${Q_NEW_SESSION:-}" ]]; then
400+
if [[ -n "${KIRO_NEW_SESSION:-}" ]]; then
402401
unset QTERM_SESSION_ID
403-
unset Q_TERM
404-
unset Q_NEW_SESSION
402+
unset KIRO_TERM
403+
unset KIRO_NEW_SESSION
405404
fi
406405

407-
if [[ -z "${Q_SET_PARENT_CHECK:-}" ]]; then
406+
if [[ -z "${KIRO_SET_PARENT_CHECK:-}" ]]; then
408407
# Load parent from env variables
409-
if [[ -z "${Q_PARENT:-}" && -n "${Q_SET_PARENT:-}" ]]; then
410-
export Q_PARENT="$Q_SET_PARENT"
411-
unset -v Q_SET_PARENT
408+
if [[ -z "${KIRO_PARENT:-}" && -n "${KIRO_SET_PARENT:-}" ]]; then
409+
export KIRO_PARENT="$KIRO_SET_PARENT"
410+
unset -v KIRO_SET_PARENT
412411
fi
413-
export Q_SET_PARENT_CHECK=1
412+
export KIRO_SET_PARENT_CHECK=1
414413
fi
415414

416-
# 0 = Yes, 1 = No, 2 = Fallback to Q_TERM
415+
# 0 = Yes, 1 = No, 2 = Fallback to KIRO_TERM
417416
if [ -z "${SHOULD_QTERM_LAUNCH:-}" ]; then
418417
q _ should-figterm-launch 1>/dev/null 2>&1
419418
SHOULD_QTERM_LAUNCH=$?
@@ -425,32 +424,32 @@ fi
425424
if [[ -t 1 ]] \
426425
&& [[ -z "${PROCESS_LAUNCHED_BY_Q:-}" ]] \
427426
&& command -v qterm 1>/dev/null 2>&1 \
428-
&& [[ ("${SHOULD_QTERM_LAUNCH}" -eq 0) || (("${SHOULD_QTERM_LAUNCH}" -eq 2) && (-z "${Q_TERM:-}" || (-z "${Q_TERM_TMUX:-}" && -n "${TMUX:-}"))) ]]
427+
&& [[ ("${SHOULD_QTERM_LAUNCH}" -eq 0) || (("${SHOULD_QTERM_LAUNCH}" -eq 2) && (-z "${KIRO_TERM:-}" || (-z "${KIRO_TERM_TMUX:-}" && -n "${TMUX:-}"))) ]]
429428
then
430-
# Pty module sets Q_TERM or Q_TERM_TMUX to avoid running twice.
431-
if [ -z "${Q_SHELL:-}" ]; then
432-
Q_SHELL=$(q _ get-shell)
429+
# Pty module sets KIRO_TERM or KIRO_TERM_TMUX to avoid running twice.
430+
if [ -z "${KIRO_SHELL:-}" ]; then
431+
KIRO_SHELL=$(q _ get-shell)
433432
fi
434-
Q_IS_LOGIN_SHELL="${Q_IS_LOGIN_SHELL:='0'}"
433+
KIRO_IS_LOGIN_SHELL="${KIRO_IS_LOGIN_SHELL:='0'}"
435434

436435
# shellcheck disable=SC2030
437436
if ([[ -n "${BASH:-}" ]] && shopt -q login_shell) \
438437
|| [[ -n "${ZSH_NAME:-}" && -o login ]]; then
439-
Q_IS_LOGIN_SHELL=1
438+
KIRO_IS_LOGIN_SHELL=1
440439
fi
441440

442441
# Do not launch figterm in non-interactive shells (like VSCode Tasks)
443442
if [[ $- == *i* ]]; then
444-
Q_TERM_NAME="$(basename "${Q_SHELL}") (qterm)"
445-
if [[ -z "${Q_TERM_PATH:-}" ]]; then
446-
if [[ -x "${HOME}/.local/bin/${Q_TERM_NAME}" ]]; then
447-
Q_TERM_PATH="${HOME}/.local/bin/${Q_TERM_NAME}"
443+
KIRO_TERM_NAME="$(basename "${KIRO_SHELL}") (qterm)"
444+
if [[ -z "${KIRO_TERM_PATH:-}" ]]; then
445+
if [[ -x "${HOME}/.local/bin/${KIRO_TERM_NAME}" ]]; then
446+
KIRO_TERM_PATH="${HOME}/.local/bin/${KIRO_TERM_NAME}"
448447
else
449-
Q_TERM_PATH="$(command -v qterm || echo "${HOME}/.local/bin/qterm")"
448+
KIRO_TERM_PATH="$(command -v qterm || echo "${HOME}/.local/bin/qterm")"
450449
fi
451450
fi
452451

453-
Q_EXECUTION_STRING="${BASH_EXECUTION_STRING:=$ZSH_EXECUTION_STRING}"
452+
KIRO_EXECUTION_STRING="${BASH_EXECUTION_STRING:=$ZSH_EXECUTION_STRING}"
454453

455454
# Get initial text.
456455
INITIAL_TEXT=""
@@ -463,6 +462,6 @@ then
463462
INITIAL_TEXT="${INITIAL_TEXT}${REPLY}\n"
464463
done
465464
fi
466-
Q_EXECUTION_STRING="${Q_EXECUTION_STRING}" Q_START_TEXT="$(printf "%b" "${INITIAL_TEXT}")" Q_SHELL="${Q_SHELL}" Q_IS_LOGIN_SHELL="${Q_IS_LOGIN_SHELL}" exec -a "${Q_TERM_NAME}" "${Q_TERM_PATH}"
465+
KIRO_EXECUTION_STRING="${KIRO_EXECUTION_STRING}" KIRO_START_TEXT="$(printf "%b" "${INITIAL_TEXT}")" KIRO_SHELL="${KIRO_SHELL}" KIRO_IS_LOGIN_SHELL="${KIRO_IS_LOGIN_SHELL}" exec -a "${KIRO_TERM_NAME}" "${KIRO_TERM_PATH}"
467466
fi
468467
fi

0 commit comments

Comments
 (0)