大改版,可以针对不同项目引擎进行初始化

This commit is contained in:
Nostars Developer
2026-07-27 15:09:13 +08:00
parent 6446261c69
commit 62efb3778c
112 changed files with 11020 additions and 899 deletions

View File

@@ -9,6 +9,8 @@ hooks/
├── session-init.sh # sessionStartBash
├── check-changelog.ps1 # stop / changelog guardPowerShell
├── check-changelog.sh # stop / changelog guardBash
├── changelog-scan.json # cursor-init 按项目类型生成的活动扫描策略
├── tests/ # PowerShell / Bash 共用回归测试
└── README.md
```
@@ -51,11 +53,12 @@ macOS/Linux 不需要 Windows dispatcher。将 `.cursor/hooks.json` 改为 Bash
}
```
同时把本机 `.cursor/local-env.json``shell` 设为 `bash`(或实际使用的 `zsh`。Bash 脚本不依赖 `jq`;优先用 `python3`Windows Git Bash 可回退 `python`安全解析/生成 JSON解释器缺失或解析失败时 fail-open 返回 `{}`
同时把本机 `.cursor/local-env.json``shell` 设为 `bash`(或实际使用的 `zsh`。Bash 脚本不依赖 `jq`;优先用 `python3`Windows Git Bash 可回退 `python`读取扫描配置并生成 JSON解释器缺失或解析失败时 fail-open 返回 `{}`
## 行为
- `session-init` 清除上一会话的 `.cursor/changelog/.changelog-ack`,并刷新 gitignored 的 `.cursor/changelog/.session-start`。非 `agent` 模式通过 hook `env` 设置 `CURSOR_SKIP_CHANGELOG=1`
- Cursor 的 `stop` 输入不包含可靠的工具编辑历史,因此 `check-changelog` 不解析不存在的“编辑证据”。它只在未 ack、未被 session 环境跳过,且 Godot 源码/配置同时晚于本会话起点与当前 changelog 时返回 `followup_message`,避免旧会话残留 mtime 误报
- 扫描从仓库根开始,覆盖 `project.godot``.gd``.tscn``.tres``.res``.gdshader``.cfg``.json``.cs``.csproj` 及常用工具脚本;跳过 `.git``.cursor``.godot`、依赖目录、Python 缓存/虚拟环境和常见构建输出目录
- Cursor 的 `stop` 输入不包含可靠的工具编辑历史,因此 `check-changelog` 使用 Git 工作区状态与文件时间共同判断。只有 `changelog-scan.json` 命中的项目源码/配置同时存在未提交内容差异,且晚于本会话起点与当前 changelog 时,才返回 `followup_message`
- `.session-start` 缺失、Git 不可用、状态读取失败或工作区无内容差异时均 fail-open 返回 `{}`。不得只因文件 mtime 较新就要求写开发日志
- 扫描文件名、扩展名与排除目录由 common + 所选项目类型 manifest 合并生成Hook 代码不得重新硬编码 Godot 或 Roblox 列表。
- 所有正常与失败路径都在 stdout 输出一个合法 JSON 对象;检查失败默认不阻断。