Skip to content

fix(init): refresh Codex hooks with hooks-only#212

Merged
zzet merged 3 commits into
zzet:mainfrom
blankanswer:fix/init-hooks-only-codex
Jul 1, 2026
Merged

fix(init): refresh Codex hooks with hooks-only#212
zzet merged 3 commits into
zzet:mainfrom
blankanswer:fix/init-hooks-only-codex

Conversation

@blankanswer

Copy link
Copy Markdown
Contributor

Summary

  • Extend gortex init --hooks-only so it refreshes Codex hooks in ~/.codex/config.toml alongside Claude Code hooks.
  • Keep hooks-only scoped to hook surfaces only: no MCP rewrite, no AGENTS.md, no skills/indexing, no project marker, and no global config update.
  • Respect --agents / --agents-skip in hooks-only mode, matching normal init selection semantics.
  • Document --hooks-only as refreshing supported agent hooks.

Changes

  • Added codex.InstallHooksOnly(...), which reuses existing Codex hook upsert logic while touching only top-level hooks.
  • Refactored Codex normal init to share the same hook upsert helper.
  • Updated runInitHooksOnly to:
    • refresh Claude Code hooks when claude-code is selected;
    • detect and refresh Codex hooks when codex is selected;
    • skip Codex when filtered out by --agents or --agents-skip.
  • Added integration coverage for hooks-only allow-list / skip behavior.
  • Added Codex adapter tests for fresh install, idempotency, preserve user hooks, preserve MCP/unrelated keys, force replacement, and dry-run behavior.

Out of scope

  • Normal gortex init behavior changes.
  • Codex hook semantics changes.
  • Codex PostToolUse source-read or file-list enrichment.
  • MCP tool-name hooks.
  • apply_patch hooks.
  • resolver, indexer, daemon, graph, or MCP tool changes.

Tests

  • go test ./cmd/gortex
  • go test ./internal/agents/codex
  • go test ./internal/agents/claudecode
  • git diff --check

@zzet zzet merged commit 75064cf into zzet:main Jul 1, 2026
11 checks passed
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.

2 participants