Files
dotfiles/home/bin/opencode-go-token
T
Lap Tran 6e0bc81e85 chore(codex): route Codex to OpenCode Go without clobbering ChatGPT auth
The ChatGPT desktop app owns and rewrites ~/.codex/config.toml, so symlinking
that file into the repo leaked the app's own config (model, [desktop],
[plugins], [mcp_servers]) into git and got clobbered on launch.

- Stop symlinking ~/.codex/config.toml; keep it app-owned and merge the repo
  fragment home/.codex/config.toml into it on every activation
  (home.activation.codexOpenCodeGo + home/bin/codex-opencode-go-sync).
- Replace requires_openai_auth with a command-backed token
  (~/.local/bin/opencode-go-token reads the key from the opencode store), so
  ~/.codex/auth.json stays in ChatGPT mode and ChatGPT sign-in coexists with Go.
- Add the Codex 0.160+ profile file home/.codex/luna.config.toml (gpt-6-luna).
- Declare the chatgpt + codex casks; document the decision in AGENTS.md.

Verified: default deepseek-v4.1-flash and --profile luna both return over the Go
Responses API while auth.json remains in chatgpt mode.
2026-10-04 15:07:33 -04:00

18 lines
681 B
Bash
Executable File

#!/bin/sh
# Print the OpenCode Go API key on stdout.
#
# Codex uses this as its command-backed provider auth
# ([model_providers.opencode-go.auth].command). That keeps ~/.codex/auth.json
# untouched in ChatGPT mode, so the ChatGPT desktop app and the OpenCode Go
# subscription coexist in the same Codex install. The key is never committed; it
# is read live from the opencode auth store (the same source oc2 and Hermes use).
set -eu
auth="${XDG_DATA_HOME:-$HOME/.local/share}/opencode/auth.json"
py="$(command -v python3 || true)"
if [ -z "$py" ]; then
py=/usr/bin/python3
fi
exec "$py" -c 'import json, sys; print(json.load(open(sys.argv[1]))["opencode-go"]["key"])' "$auth"