Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:15:01 +08:00
commit 2fbdb7fc3d
23 changed files with 2851 additions and 0 deletions

34
hooks/create-session.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Create and initialize spec-dev session tracking file
set -euo pipefail
# Read JSON input from stdin
input=$(cat)
# Extract session_id and cwd from JSON
session_id=$(echo "$input" | jq -r '.session_id')
cwd=$(echo "$input" | jq -r '.cwd')
# Normalize CWD for filesystem (replace / with -)
normalized_cwd=$(echo "$cwd" | sed 's|^/||' | sed 's|/|-|g')
# Create cache directory path
cache_dir="$HOME/.local/cache/codethread-plugins/spec-dev/$normalized_cwd"
session_file="$cache_dir/$session_id.json"
# Create directory if it doesn't exist
mkdir -p "$cache_dir"
# Create initial session file
cat > "$session_file" <<EOF
{
"status": "enabled",
"compactions": 0,
"cwd": "$cwd",
"created": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
}
EOF
echo "✓ Session tracking initialized: $session_file"
exit 0