Shim generation
Updated shim_script to emit an absolute Python module invocation using the interpreter
running gh-forgejo-shim install-shim.
The wrapper now invokes the installed package through the pipx venv Python executable, so GUI apps do not
need gh-forgejo-shim itself to be discoverable through PATH.
Fixed the failure mode behind Codex.app reporting GitHub CLI unavailable. The generated
~/.local/bin/gh wrapper previously ran exec gh-forgejo-shim gh "$@", which fails
in stripped GUI environments where gh-forgejo-shim is not on PATH. It now executes
python -m gh_forgejo_shim gh "$@" through an absolute interpreter path captured at install time.
Updated shim_script to emit an absolute Python module invocation using the interpreter
running gh-forgejo-shim install-shim.
Kept old generated wrappers recognizable as managed so uninstall and overwrite behavior remain safe.
Added tests for absolute module invocation and for recognizing the older managed shell wrapper.
Running the current wrapper with a stripped PATH reproduced the GUI app failure:
exec: gh-forgejo-shim: not found. Codex.app can find gh, but once the wrapper
starts, it must be able to run the package without depending on another PATH lookup.
shlex.quote is used when embedding the Python executable path into the shell wrapper./bin/sh, but no longer needs gh-forgejo-shim on PATH.gh-forgejo-shim gh form and the new module form.
The snippet below uses the Diffs FileDiff component when available, with a static fallback.
Reference: Diffs documentation.
def shim_script(python_executable: str | None = None) -> str:
executable = python_executable or sys.executable
return "\n".join(
[
"#!/bin/sh",
f"# {MARKER}",
f'exec {shlex.quote(executable)} -m gh_forgejo_shim gh "$@"',
"",
]
)
Codex.app and other GUI tools can run the shim even when their subprocess environment does not expose the
pipx app directory in PATH. Normal terminal use is unchanged.
python3 -m unittest: passed, 39 tests.python3 -m compileall -q src tests: passed.exec: gh-forgejo-shim: not found.~/.local/bin/gh file must be refreshed for the fix to affect Codex.app.No new follow-up Beads issues were needed for this focused compatibility fix.