Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell-plugin/lib/config.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions shell-plugin/lib/context.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions shell-plugin/lib/helpers.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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[*]}"
Expand Down
Loading