Skip to content

feat: keep the terminal for the fixed command under codigest capture - #10

Merged
NaNIsaac merged 1 commit into
mainfrom
feat/codigest-runners
Oct 28, 2026
Merged

NaNIsaac merged 1 commit into
mainfrom
feat/codigest-runners

Conversation

@NaNIsaac

Copy link
Copy Markdown
Owner

With codigest's terminal capture on, hf (and ㅗㄹ) was captured like any typed line: its output went through codigest's pipe, so the fixed command it runs did too. An interactive one then failed, for example codex with "stdout is not a terminal".

codigest 9c4cf56 (NaNIsaac/codigest#53) added a contract for programs that run other command lines; this uses it in the bash, zsh and PowerShell functions:

  • The function name and its Korean-layout twin are appended to CODIGEST_RUNNERS ($global:CODIGEST_RUNNERS in PowerShell). codigest's hook does not capture a line that starts with one of them, so hf keeps the terminal.
  • The fixed command goes to codigest's __cdg_run when that function exists at the moment hf runs (PowerShell: . __cdg_run $fixed, in the caller's scope as Invoke-Expression was), otherwise to eval / Invoke-Expression as before. __cdg_run applies the hook's own rules: codex, editors and the like run plainly with the terminal, other commands are captured under the fixed line.
  • Because both are read only when used, it does not matter whether hanfix or codigest is loaded first. Without codigest, or with an older codigest, nothing changes. fish is unchanged: codigest has no fish hook.

README (English and Korean) gets one paragraph under "Fix the previous command". Version 0.2.6.

Tests

  • cargo test: the init scripts register both names (bash/zsh, PowerShell) and fish does not.
  • tests/shells.ps1: the names are in $global:CODIGEST_RUNNERS, and hf -y hands the fixed line to a __cdg_run stand-in defined after hanfix.
  • tests/shells.sh (bash, zsh on Linux CI): the same with a shell-function stand-in, runners: hf ㅗㄹ and cdg_run:echo hanfix-ok.
  • Local end-to-end (not in CI), Windows ConPTY, codigest's real hook from main 9c4cf56, pwsh 7 and Git Bash, each in both load orders: a mistyped codex (a probe function) re-run with ㅗㄹ gets the terminal; a mistyped captured command re-run with hf -y is captured under its fixed line with its output; neither hf line is captured. With hanfix 0.2.5 and the same hook the codex probe gets a pipe.

local-ci: 4573909 | cargo test --release --locked 4 passed; tests/shells.ps1 with the built 0.2.6 (ok powershell, ok powershell with codigest); end-to-end above, 4/4; conventions.py check: 0 findings | tests/shells.sh (needs util-linux script) and macOS only in CI; real ssh session not run (owner check after release)

@NaNIsaac
NaNIsaac merged commit 1a71714 into main Oct 28, 2026
21 checks passed
@NaNIsaac
NaNIsaac deleted the feat/codigest-runners branch October 28, 2026 14:38
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.

1 participant