chore: add project planning-with-files hooks

This commit is contained in:
shiyue
2026-06-28 23:12:35 +08:00
parent cd37ecf10b
commit 519e877220
30 changed files with 3855 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
"""Codex PermissionRequest adapter for planning-with-files (v2.38.0).
Fires when Codex asks the user to permit a tool call. We surface a short
reminder that an active plan exists so the user reviews task_plan.md before
approving. Read-only; never blocks the request; always exits cleanly.
"""
from __future__ import annotations
import codex_hook_adapter as adapter
def main() -> None:
payload = adapter.load_payload()
root = adapter.cwd_from_payload(payload)
if not adapter.is_session_attached(root, adapter.session_id_from_payload(payload)):
return
plan = root / "task_plan.md"
if not plan.exists():
return
adapter.emit_json({
"systemMessage": (
"[planning-with-files] Active plan detected. Review the current phase "
"in task_plan.md before approving the tool request."
)
})
if __name__ == "__main__":
raise SystemExit(adapter.main_guard(main))