diff --git a/shell-plugin/lib/config.zsh b/shell-plugin/lib/config.zsh index 2c12b63318..b28c1914a8 100644 --- a/shell-plugin/lib/config.zsh +++ b/shell-plugin/lib/config.zsh @@ -38,7 +38,7 @@ typeset -h _FORGE_SESSION_REASONING_EFFORT # Terminal context capture settings # Master switch for terminal context capture (preexec/precmd hooks) -typeset -h _FORGE_TERM_ENABLED="${FORGE_TERM_ENABLED:-true}" +typeset -h _FORGE_TERM="${FORGE_TERM:-true}" # Maximum number of commands to keep in the ring buffer (metadata: cmd + exit code) typeset -h _FORGE_TERM_MAX_COMMANDS="${FORGE_TERM_MAX_COMMANDS:-5}" # OSC 133 semantic prompt marker emission: "auto", "on", or "off" diff --git a/shell-plugin/lib/context.zsh b/shell-plugin/lib/context.zsh index 207a58b487..02e2f22084 100644 --- a/shell-plugin/lib/context.zsh +++ b/shell-plugin/lib/context.zsh @@ -67,7 +67,7 @@ typeset -g _FORGE_TERM_PENDING_TS="" # Called before each command executes. # Records the command text and timestamp, emits OSC 133 B+C markers. function _forge_context_preexec() { - [[ "$_FORGE_TERM_ENABLED" != "true" ]] && return + [[ "$_FORGE_TERM" != "true" ]] && return _FORGE_TERM_PENDING_CMD="$1" _FORGE_TERM_PENDING_TS="$(date +%s)" # OSC 133 B: prompt end / command start @@ -87,7 +87,7 @@ function _forge_context_precmd() { # even when context capture is disabled. _forge_osc133_emit "D;$last_exit" - [[ "$_FORGE_TERM_ENABLED" != "true" ]] && return + [[ "$_FORGE_TERM" != "true" ]] && return # Only record if we have a pending command from preexec if [[ -n "$_FORGE_TERM_PENDING_CMD" ]]; then @@ -115,7 +115,7 @@ function _forge_context_precmd() { # Register using standard zsh hook arrays for coexistence with other plugins. # precmd is prepended so it runs first and captures the real $? from the # command, before other plugins (powerlevel10k, starship, etc.) overwrite it. -if [[ "$_FORGE_TERM_ENABLED" == "true" ]]; then +if [[ "$_FORGE_TERM" == "true" ]]; then preexec_functions+=(_forge_context_preexec) precmd_functions=(_forge_context_precmd "${precmd_functions[@]}") fi diff --git a/shell-plugin/lib/helpers.zsh b/shell-plugin/lib/helpers.zsh index a7a62a57e9..e18ced3567 100644 --- a/shell-plugin/lib/helpers.zsh +++ b/shell-plugin/lib/helpers.zsh @@ -29,7 +29,7 @@ function _forge_exec() { # can legitimately contain colons (URLs, port mappings, paths, etc.). # Use `local -x` so the variables are exported only to the child forge # process and do not leak into the caller's shell environment. - if [[ "$_FORGE_TERM_ENABLED" == "true" && ${#_FORGE_TERM_COMMANDS} -gt 0 ]]; then + if [[ "$_FORGE_TERM" == "true" && ${#_FORGE_TERM_COMMANDS} -gt 0 ]]; then # Join the ring-buffer arrays with the ASCII Unit Separator (\x1F). # We use IFS-based joining ("${arr[*]}") rather than ${(j.SEP.)arr} because # zsh does NOT expand $'...' ANSI-C escapes inside parameter expansion flags. @@ -66,7 +66,7 @@ function _forge_exec_interactive() { # Use `local -x` so the variables are exported only for the duration of # this function call (i.e. inherited by the child forge process) and do # not leak into the caller's shell environment. - if [[ "$_FORGE_TERM_ENABLED" == "true" && ${#_FORGE_TERM_COMMANDS} -gt 0 ]]; then + if [[ "$_FORGE_TERM" == "true" && ${#_FORGE_TERM_COMMANDS} -gt 0 ]]; then local _old_ifs="$IFS" _sep=$'\x1f' IFS="$_sep" local -x _FORGE_TERM_COMMANDS="${_FORGE_TERM_COMMANDS[*]}"