Mas cosass para autocompile

This commit is contained in:
Jordan
2026-03-24 10:51:41 +00:00
parent db90dfaca2
commit c32776a8ff
2 changed files with 44 additions and 11 deletions

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Hook PostToolUse: compila index-base.tpl cuando Claude lo edita
# Recibe JSON por stdin con info del tool use
INPUT=$(cat)
# Extraer file_path del tool input
FILE_PATH=$(echo "$INPUT" | node -e "
const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
process.stdout.write(d?.tool_input?.file_path || '');
" 2>/dev/null)
# Solo compilar si es index-base.tpl
if [[ "$FILE_PATH" != *"index-base.tpl" ]]; then
exit 0
fi
# Leer el puerto del server Python del .docker/.env
ENV_FILE="${CLAUDE_PROJECT_DIR}/.docker/.env"
if [ ! -f "$ENV_FILE" ]; then exit 0; fi
SERVER_PORT=$(grep "^ACAI_HOST_PORT=" "$ENV_FILE" | cut -d= -f2 | tr -d '[:space:]')
if [ -z "$SERVER_PORT" ]; then
SERVER_PORT="9091"
fi
# Llamar al server Python para compilar
curl -s -X POST "http://localhost:${SERVER_PORT}/api/compile-module" \
-H "Content-Type: application/json" \
-d "{\"file_path\": \"${FILE_PATH}\", \"project_dir\": \"${CLAUDE_PROJECT_DIR}\"}" \
> /dev/null 2>&1 &
exit 0

View File

@@ -1,15 +1,15 @@
{ {
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@anthropic-ai/mcp-playwright@latest"]
},
"fetch": {
"command": "npx",
"args": ["@anthropic-ai/mcp-fetch@latest"]
}
},
"permissions": { "permissions": {
"allow": ["Bash(docker exec:*)"] "allow": ["Bash(docker exec:*)", "mcp__acai-code__*"]
},
"hooks": {
"PostToolUse": [
{
"type": "command",
"matcher": "Write|Edit",
"command": "bash ${CLAUDE_PROJECT_DIR}/.claude/scripts/compile-on-save.sh",
"timeout": 30
}
]
} }
} }