**Motivations:** - Centraliser les fichiers Cursor (rules, skills, agents, commands, hooks) par user et par projet **Root causes:** - N/A **Correctifs:** - N/A **Evolutions:** - desk: rules, skills-cursor, agents, commands, hooks, argv/hooks/mcp.json - ncantu: README placeholder - 4NK_node, algo, builazoo, ia_local, lecoffre_ng, lecoffre_ng_pprod, lecoffre_ng_test: .cursor contents **Pages affectées:** - cursor/desk/, cursor/ncantu/, cursor/<project>/
32 lines
756 B
Bash
Executable File
32 lines
756 B
Bash
Executable File
#!/bin/bash
|
|
# Shared helpers for Cursor hooks. Source with: source "$(dirname "$0")/lib.sh"
|
|
|
|
LOG_DIR="${CURSOR_HOOKS_LOG_DIR:-$HOME/.cursor/logs}"
|
|
LOG_FILE="${LOG_DIR}/hooks.log"
|
|
|
|
log_event() {
|
|
local event="$1"
|
|
local summary="$2"
|
|
mkdir -p "$LOG_DIR"
|
|
echo "[$(date -Iseconds)] [$event] $summary" >> "$LOG_FILE"
|
|
}
|
|
|
|
log_json() {
|
|
local event="$1"
|
|
local json="$2"
|
|
mkdir -p "$LOG_DIR"
|
|
echo "[$(date -Iseconds)] [$event] $json" >> "$LOG_FILE"
|
|
}
|
|
|
|
log_json_truncated() {
|
|
local event="$1"
|
|
local json="$2"
|
|
local max="${3:-500}"
|
|
mkdir -p "$LOG_DIR"
|
|
if [ ${#json} -gt "$max" ]; then
|
|
echo "[$(date -Iseconds)] [$event] ${json:0:$max}... (truncated)" >> "$LOG_FILE"
|
|
else
|
|
echo "[$(date -Iseconds)] [$event] $json" >> "$LOG_FILE"
|
|
fi
|
|
}
|