Skip to content

feat(hooks): add Codex CLI hooks support#1439

Merged
dyoshikawa merged 9 commits intodyoshikawa:mainfrom
henriquemod:main
Apr 6, 2026
Merged

feat(hooks): add Codex CLI hooks support#1439
dyoshikawa merged 9 commits intodyoshikawa:mainfrom
henriquemod:main

Conversation

@henriquemod
Copy link
Copy Markdown
Contributor

@henriquemod henriquemod commented Apr 4, 2026

Summary

  • Add hooks support for Codex CLI, enabling generation of .codex/hooks.json from unified rulesync hook definitions
  • Implement CodexcliHooks class with bidirectional conversion between canonical and Codex CLI hook formats (PascalCase event names, inline command format)
  • Register codexcli in the hooks processor factory with project and global scope support
  • Auto-configure .codex/config.toml with codex_hooks = true feature flag when generating hooks
  • Add comprehensive test coverage (334 lines) for all conversion paths and edge cases

Changes

File Description
src/types/hooks.ts Add Codex CLI hook event types and canonical name mappings
src/features/hooks/codexcli-hooks.ts CodexcliHooks class with inline converter
src/features/hooks/codexcli-hooks.test.ts Comprehensive tests
src/features/hooks/hooks-processor.ts Register codexcli in factory
src/features/hooks/hooks-processor.test.ts Update processor tests
src/cli/commands/gitignore-entries.ts Add .codex/hooks.json pattern
README.md, docs/, skills/ Update supported tools tables
.gitignore Add generated hooks entry

@henriquemod henriquemod mentioned this pull request Apr 4, 2026
Copy link
Copy Markdown
Owner

@dyoshikawa dyoshikawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the direction here, but I found a few behavior issues that should be addressed before this is merged. The biggest problem is that generating Codex hooks now mutates .codex/config.toml directly, which bypasses the normal write flow and can change the worktree even during preview-style execution; there is also a mismatch where non-command hooks can still be emitted for codexcli even though the processor declares command-only support.

- Filter out non-command hook types in canonicalToCodexcliHooks to
  prevent invalid entries in Codex CLI output
- Replace ensureCodexHooksFeatureFlag side-effect write with
  CodexcliConfigToml generated file that goes through the normal
  write pipeline, respecting dry-run mode
- Add regression tests for prompt-type hook filtering and
  CodexcliConfigToml generation
@dyoshikawa dyoshikawa merged commit 19d5cb2 into dyoshikawa:main Apr 6, 2026
6 checks passed
@dyoshikawa
Copy link
Copy Markdown
Owner

@henriquemod Thank you!

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