Skip to content

Commit 895220b

Browse files
Chore/gh config rw (#18)
* feat: mount gh config with --gh flag * chore: bump version to 1.1.7
1 parent 6d87039 commit 895220b

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

.codex_yolo.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ if [[ "${MOUNT_GH}" == "1" ]]; then
304304
if [[ -d "${HOME}/.copilot" ]]; then
305305
docker_args+=("-v" "${HOME}/.copilot:${CONTAINER_HOME}/.copilot")
306306
log_info "Warning: ${HOME}/.copilot is now mounted inside the container."
307+
if [[ -d "${HOME}/.config/gh" ]]; then
308+
docker_args+=("-v" "${HOME}/.config/gh:${CONTAINER_HOME}/.config/gh")
309+
log_info "Warning: ${HOME}/.config/gh is now mounted inside the container."
310+
else
311+
log_info "Warning: ${HOME}/.config/gh does not exist on the host; gh auth state may be unavailable inside the container."
312+
fi
307313
log_info "This enables gh workflows and GitHub Copilot-related host context access."
308314
else
309315
log_error "--gh enabled but ${HOME}/.copilot does not exist or is not a directory."

EXAMPLES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Prerequisites:
101101
- Host is already authenticated (`gh auth login`)
102102
- Host `~/.copilot` directory exists
103103

104+
When enabled, `~/.copilot` is mounted and `~/.config/gh` is also mounted if it exists on the host.
105+
104106
### Dry Run
105107
Preview Docker commands without executing:
106108
```bash

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ are shared between runs.
122122
For security reasons, `codex_yolo` **does not** mount by default:
123123
- `~/.ssh` - SSH keys are not available inside the container by default
124124
- `~/.copilot` - GitHub Copilot/GitHub CLI related state is not available unless explicitly enabled
125+
- `~/.config/gh` - GitHub CLI host auth config is not available unless explicitly enabled
125126
- SSH agent forwarding is disabled
126127
- No other host directories are mounted by default
127128

@@ -156,6 +157,7 @@ Requirements for `--gh`:
156157
- `~/.copilot` must exist on the host.
157158

158159
When enabled, `~/.copilot` is mounted into the container at `~/.copilot`.
160+
If present on the host, `~/.config/gh` is also mounted into the container at `~/.config/gh`.
159161

160162
## Troubleshooting
161163

@@ -202,7 +204,7 @@ Available options:
202204
- `--pull` flag to force a pull when running `./.codex_yolo.sh`
203205
- `--verbose` or `-v` flag to enable verbose output
204206
- `--mount-ssh` flag to enable SSH key mounting for git push access; see security warning above
205-
- `--gh` flag to mount host `~/.copilot` after validating host `gh` auth
207+
- `--gh` flag to mount host `~/.copilot` and host `~/.config/gh` (if present) after validating host `gh` auth
206208
- Each run checks npm for the latest `@openai/codex` version (unless skipped)
207209
and rebuilds the image if it is out of date.
208210
- Each run checks for codex_yolo script updates (unless skipped with `CODEX_SKIP_UPDATE_CHECK=1`)
@@ -224,7 +226,7 @@ Add these lines to your `.bashrc` or `.zshrc` for persistent completion.
224226

225227
## Security note
226228

227-
`codex_yolo` deliberately limits what gets mounted from the host. See the "What gets mounted from the host" section above for details. By default, your SSH agent is not forwarded and `~/.ssh`/`~/.copilot` are not mounted, keeping the blast radius smaller when running in `--yolo` mode. This comes at the cost of private repo access from inside the container unless you explicitly enable SSH mounting with `--mount-ssh` and GitHub Copilot state mounting with `--gh`.
229+
`codex_yolo` deliberately limits what gets mounted from the host. See the "What gets mounted from the host" section above for details. By default, your SSH agent is not forwarded and `~/.ssh`/`~/.copilot`/`~/.config/gh` are not mounted, keeping the blast radius smaller when running in `--yolo` mode. This comes at the cost of private repo access from inside the container unless you explicitly enable SSH mounting with `--mount-ssh` and GitHub Copilot/GitHub CLI state mounting with `--gh`.
228230

229231
The container enables passwordless `sudo` for the mapped user to allow system installs. Use with care; `sudo` writes into `/workspace` are cleaned up via a chown on exit, but they still run as root inside the container.
230232

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.6
1+
1.1.7

tests/integration_tests.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
354354
}
355355
trap cleanup_test_20 EXIT
356356

357-
mkdir -p "${test_home}/.copilot" "${test_home}/.codex"
357+
mkdir -p "${test_home}/.copilot" "${test_home}/.codex" "${test_home}/.config/gh"
358358
cat > "${fake_bin}/gh" <<'TESTEOF'
359359
#!/usr/bin/env bash
360360
if [[ "${1:-}" == "auth" ]] && [[ "${2:-}" == "status" ]]; then
@@ -374,11 +374,11 @@ TESTEOF
374374
cleanup_test_20
375375
trap - EXIT
376376

377-
if echo "${output}" | grep -q "\.copilot" && echo "${output}" | grep -q "Dry run"; then
378-
log_pass "--gh flag mounts ~/.copilot in dry run output"
377+
if echo "${output}" | grep -q "\.copilot" && echo "${output}" | grep -q "\.config/gh" && echo "${output}" | grep -q "Dry run"; then
378+
log_pass "--gh flag mounts ~/.copilot and ~/.config/gh in dry run output"
379379
else
380-
log_fail "--gh flag did not mount ~/.copilot as expected"
381-
log_info "Output snippet: $(echo "${output}" | grep -i copilot | head -5)"
380+
log_fail "--gh flag did not mount ~/.copilot and ~/.config/gh as expected"
381+
log_info "Output snippet: $(echo "${output}" | grep -E -i 'copilot|config/gh' | head -5)"
382382
fi
383383
else
384384
log_skip "Docker not available, skipping --gh flag test"

0 commit comments

Comments
 (0)