MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _uninstall_codex_hook

Function _uninstall_codex_hook

graphify/install.py:2098–2115  ·  view source on GitHub ↗

Remove graphify PreToolUse hook from .codex/hooks.json.

(project_dir: Path)

Source from the content-addressed store, hash-verified

2096
2097
2098def _uninstall_codex_hook(project_dir: Path) -> None:
2099 """Remove graphify PreToolUse hook from .codex/hooks.json."""
2100 hooks_path = project_dir / ".codex" / "hooks.json"
2101 if not hooks_path.exists():
2102 return
2103 try:
2104 existing = json.loads(hooks_path.read_text(encoding="utf-8"))
2105 except json.JSONDecodeError:
2106 return
2107 pre_tool = existing.get("hooks", {}).get("PreToolUse", [])
2108 if not isinstance(pre_tool, list):
2109 return
2110 filtered = _strip_graphify_hooks(pre_tool)
2111 if filtered == pre_tool:
2112 return
2113 existing["hooks"]["PreToolUse"] = filtered
2114 _write_settings_with_backup(hooks_path, existing)
2115 print(f" .codex/hooks.json -> PreToolUse hook removed")
2116def _agents_install(project_dir: Path, platform: str, project: bool = False) -> None:
2117 """Write the graphify section to the local AGENTS.md for always-on platforms."""
2118 target = (project_dir or Path(".")) / "AGENTS.md"

Callers 3

_project_uninstallFunction · 0.85
uninstall_allFunction · 0.85
dispatch_install_cliFunction · 0.85

Calls 3

_strip_graphify_hooksFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected