feat: add OpenAI Codex CLI support#51
Conversation
Closes #37 Add CodexTool with section-based AGENTS.md management using HTML comment markers for install/uninstall of individual instructions. Includes IDE capability registry entry, component detector support, and 23 unit tests. Bump version to 0.8.0.
📊 Code Quality ReportLinting Issues |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 75.39% 75.58% +0.19%
==========================================
Files 68 69 +1
Lines 7176 7257 +81
==========================================
+ Hits 5410 5485 +75
- Misses 1766 1772 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04484661fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
| if project_root is None: | ||
| raise ValueError("project_root is required for PROJECT scope") | ||
| return project_root / "AGENTS.md" |
There was a problem hiding this comment.
Route Codex instruction changes through section APIs
This tool now maps every instruction to the same file (AGENTS.md), but the main install/uninstall paths still treat installed_path as one-file-per-instruction (install_new._perform_installation writes the full file directly, and cli/uninstall.py unlinks it). In practice, installing multiple Codex instructions causes later installs to conflict/overwrite the whole file, and uninstalling one instruction can delete all Codex/manual content from AGENTS.md; this should use CodexTool.install_instruction/uninstall_instruction section logic instead of raw file writes/deletes.
Useful? React with 👍 / 👎.
| if not overwrite: | ||
| raise FileExistsError(f"Instruction already exists in AGENTS.md: {instruction.name}") | ||
| pattern = SECTION_PATTERN.format(name=re.escape(instruction.name)) | ||
| content = re.sub(pattern, section, content, flags=re.DOTALL) |
There was a problem hiding this comment.
Escape Codex overwrite replacement content
re.sub(pattern, section, content, flags=re.DOTALL) treats backslashes in section as backreferences, so overwrite fails or corrupts output when instruction content includes sequences like \1 (for example regex docs or Windows-style text), raising re.error: invalid group reference in real usage. Use a literal replacement strategy (e.g., function replacement) so instruction text is written verbatim.
Useful? React with 👍 / 👎.
Summary
CodexToolthat manages instruction sections in a singleAGENTS.mdfile using HTML comment markers (<!-- devsync:start:name -->/<!-- devsync:end:name -->)Closes #37
Test plan
pytest tests/unit/test_ai_tools_codex.py -v— all 23 tests passpytest tests/unit/test_ai_tools_detector.py -v— detector tests pass with 8 toolspytest tests/ -q— full suite passes (1567 passed)invoke quality— lint, format, typecheck all pass