cursor Init 完善多人协同changelog,以及godot相关基础skill和代码规范
This commit is contained in:
@@ -1,15 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# session-init.sh — 会话启动时检测 composer_mode,非 agent 模式设置跳过标志
|
||||
# sessionStart:重置 changelog 运行态标记,并在非 agent 模式下跳过检查。
|
||||
|
||||
input=$(cat)
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)
|
||||
cursor_dir=$(dirname -- "$script_dir")
|
||||
rm -f -- "$cursor_dir/changelog/.changelog-ack" 2>/dev/null
|
||||
: > "$cursor_dir/changelog/.session-start" 2>/dev/null || true
|
||||
|
||||
mode=$(echo "$input" | python3 -c "import sys,json; print(json.load(sys.stdin).get('composer_mode',''))" 2>/dev/null || echo "")
|
||||
python_cmd=''
|
||||
for candidate in python3 python; do
|
||||
if command -v "$candidate" >/dev/null 2>&1 &&
|
||||
"$candidate" -c 'import json' >/dev/null 2>&1; then
|
||||
python_cmd=$candidate
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f ".cursor/changelog/.changelog-ack"
|
||||
if [ -n "$python_cmd" ]; then
|
||||
result=$(
|
||||
printf '%s' "$input" | "$python_cmd" -c '
|
||||
import json
|
||||
import sys
|
||||
|
||||
if [ -n "$mode" ] && [ "$mode" != "agent" ]; then
|
||||
echo "{\"env\":{\"CURSOR_SKIP_CHANGELOG\":\"1\",\"CURSOR_COMPOSER_MODE\":\"$mode\"}}"
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
mode = data.get("composer_mode", "")
|
||||
if not isinstance(mode, str):
|
||||
mode = ""
|
||||
except Exception:
|
||||
mode = ""
|
||||
|
||||
if mode and mode != "agent":
|
||||
print(json.dumps({
|
||||
"env": {
|
||||
"CURSOR_SKIP_CHANGELOG": "1",
|
||||
"CURSOR_COMPOSER_MODE": mode,
|
||||
}
|
||||
}, ensure_ascii=False, separators=(",", ":")))
|
||||
else:
|
||||
print("{}")
|
||||
' 2>/dev/null
|
||||
) || result='{}'
|
||||
if [ -n "$result" ]; then
|
||||
printf '%s\n' "$result"
|
||||
else
|
||||
printf '{}\n'
|
||||
fi
|
||||
else
|
||||
echo "{}"
|
||||
printf '{}\n'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user