mirror of
https://github.com/cocoindex-io/cocoindex-code.git
synced 2026-09-14 16:39:38 +08:00
2a3ba53b5c
Oh My Pi does not run Claude hooks/hooks.json. Ship a TypeScript extension (package.json#omp.extensions) that reindexes on session_start and after edit tool results, and add the matching PostToolUse hook for Grok/Claude. Fail-open if ccc or .cocoindex_code is missing.
28 lines
947 B
JSON
28 lines
947 B
JSON
{
|
|
"hooks": {
|
|
"SessionStart": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"timeout": 60,
|
|
"command": "root=\"${CLAUDE_PROJECT_DIR:-${GROK_WORKSPACE_ROOT:-}}\"; [ -z \"$root\" ] && root=\"$(git rev-parse --show-toplevel 2>/dev/null || pwd)\"; command -v ccc >/dev/null && test -d \"$root/.cocoindex_code\" && (cd \"$root\" && ccc index) 2>/dev/null || true"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Edit|Write|MultiEdit|search_replace",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"timeout": 30,
|
|
"command": "root=\"${CLAUDE_PROJECT_DIR:-${GROK_WORKSPACE_ROOT:-}}\"; [ -z \"$root\" ] && root=\"$(git rev-parse --show-toplevel 2>/dev/null || pwd)\"; command -v ccc >/dev/null && test -d \"$root/.cocoindex_code\" && (cd \"$root\" && ccc index) 2>/dev/null || true"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|