Closes #146, #147, #148. Parallel plan isolation (#148, @shawnli1874): init-session.sh slug mode creates .planning/YYYY-MM-DD-<slug>/ for each task. set-active-plan.sh/.ps1 switch the active plan pointer. resolve-plan-dir.sh/.ps1 provide the resolution chain ($PLAN_ID env, .active_plan file, newest plan dir, legacy fallback). All four Codex hooks route through the resolver. resolve_latest_dir now requires task_plan.md to be present, preventing system dirs like sessions/ from being selected as plan dirs. short_uuid() probes each Python candidate before trusting command -v, fixing silent failure on Windows Store aliases. Codex session isolation (#146, @githubYiheng): sessions attach to a plan by creating .planning/sessions/<session_id>.attached. user-prompt-submit.sh, pre_tool_use.py, stop.py, and post_tool_use.py all gate on session attachment before injecting context or blocking. Legacy mode preserved when .planning/sessions/ does not exist. Hermes integration notes (#147, @09ashishkapoor): docs/hermes.md gains an Integration Notes section covering current support level, what is not full parity with hook-native platforms, recommended integration pattern, and a tradeoffs table. 34 new tests across five files. Version bumped to 2.36.0 across 14 SKILL.md variants, plugin.json, marketplace.json, and CITATION.cff.
34 lines
884 B
Python
34 lines
884 B
Python
#!/usr/bin/env python3
|
|
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
|
|
|
|
stdout, _ = adapter.run_shell_script("stop.sh", root)
|
|
result = adapter.parse_json(stdout)
|
|
|
|
message = result.get("followup_message")
|
|
if not isinstance(message, str) or not message:
|
|
return
|
|
|
|
if "ALL PHASES COMPLETE" in message:
|
|
adapter.emit_json({"systemMessage": message})
|
|
return
|
|
|
|
if bool(payload.get("stop_hook_active")):
|
|
adapter.emit_json({"systemMessage": message})
|
|
return
|
|
|
|
adapter.emit_json({"decision": "block", "reason": message})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(adapter.main_guard(main))
|