MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _hook_script

Function _hook_script

src/codegraphcontext/cli/hook_manager.py:136–147  ·  view source on GitHub ↗
(repo_root: Path)

Source from the content-addressed store, hash-verified

134
135
136def _hook_script(repo_root: Path) -> str:
137 repo_root_value = _sh_quote(str(repo_root))
138 return (
139 "#!/bin/sh\n"
140 f"{MANAGED_MARKER}: CodeGraphContext auto-update hook\n"
141 f"CGC_REPO_ROOT={repo_root_value}\n"
142 "if command -v cgc >/dev/null 2>&1; then\n"
143 ' cgc update "$CGC_REPO_ROOT" --quiet\n'
144 "else\n"
145 ' python -m codegraphcontext update "$CGC_REPO_ROOT" --quiet\n'
146 "fi\n"
147 )
148
149
150def _sh_quote(value: str) -> str:

Callers 1

install_hooksFunction · 0.85

Calls 1

_sh_quoteFunction · 0.85

Tested by

no test coverage detected