Mas cosass para autocompile
This commit is contained in:
33
.claude/scripts/compile-on-save.sh
Executable file
33
.claude/scripts/compile-on-save.sh
Executable 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
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"playwright": {
|
||||
"command": "npx",
|
||||
"args": ["@anthropic-ai/mcp-playwright@latest"]
|
||||
},
|
||||
"fetch": {
|
||||
"command": "npx",
|
||||
"args": ["@anthropic-ai/mcp-fetch@latest"]
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user