cursor-guard 4.9.12 → 4.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +697 -697
  2. package/README.zh-CN.md +696 -696
  3. package/ROADMAP.md +1775 -1758
  4. package/SKILL.md +631 -629
  5. package/docs/RELEASE.md +197 -196
  6. package/docs/SNAPSHOT-BOOKMARK.md +47 -0
  7. package/package.json +2 -1
  8. package/references/dashboard/public/app.js +2079 -2050
  9. package/references/dashboard/public/style.css +1660 -1628
  10. package/references/lib/core/backups.js +509 -507
  11. package/references/lib/core/core.test.js +39 -1
  12. package/references/lib/core/snapshot.js +441 -416
  13. package/references/mcp/mcp.test.js +381 -362
  14. package/references/mcp/server.js +404 -347
  15. package/references/vscode-extension/{cursor-guard-ide-4.9.12.vsix → dist/cursor-guard-ide-4.9.15.vsix} +0 -0
  16. package/references/vscode-extension/dist/dashboard/public/app.js +2079 -2050
  17. package/references/vscode-extension/dist/dashboard/public/style.css +1660 -1628
  18. package/references/vscode-extension/dist/extension.js +780 -704
  19. package/references/vscode-extension/dist/guard-version.json +1 -1
  20. package/references/vscode-extension/dist/lib/auto-setup.js +201 -192
  21. package/references/vscode-extension/dist/lib/core/backups.js +509 -507
  22. package/references/vscode-extension/dist/lib/core/snapshot.js +441 -416
  23. package/references/vscode-extension/dist/mcp/server.js +78 -12
  24. package/references/vscode-extension/dist/package.json +7 -1
  25. package/references/vscode-extension/dist/skill/ROADMAP.md +1775 -1758
  26. package/references/vscode-extension/dist/skill/SKILL.md +631 -629
  27. package/references/vscode-extension/extension.js +780 -704
  28. package/references/vscode-extension/lib/auto-setup.js +201 -192
  29. package/references/vscode-extension/package.json +7 -1
  30. package/references/vscode-extension/dist/cursor-guard-ide-4.9.12.vsix +0 -0
package/docs/RELEASE.md CHANGED
@@ -1,196 +1,197 @@
1
- # Release guide / 发版流程指南
2
-
3
- **Audience / 读者**:本仓库维护者、其他开发者、以及需要代为执行发版步骤的 **AI 助手**(Agent)。
4
- **Repo / 仓库**:<https://github.com/zhangqiang8vipp/cursor-guard>
5
-
6
- **Jump / 跳转**:[English](#english-for-maintainers-and-ai-agents) · [中文(维护者与 AI)](#中文维护者与-ai-助手)
7
-
8
- ---
9
-
10
- ## English (for maintainers and AI agents)
11
-
12
- ### Single source of truth
13
-
14
- - All release versions come from the **repository root** `package.json` → field **`version`** (semver, e.g. `4.9.8`).
15
- - `references/vscode-extension/build-vsix.js` reads that value and writes the same version into:
16
- - `references/vscode-extension/dist/package.json`
17
- - `references/vscode-extension/dist/guard-version.json`
18
- - The **npm** package name is `cursor-guard@<version>`. The **VSIX** file name is always `cursor-guard-ide-<version>.vsix`.
19
-
20
- Never hand-type an old version in release notes while the repo already has a higher `version`.
21
-
22
- ### Quick machine-readable checklist
23
-
24
- From the repo root:
25
-
26
- ```bash
27
- npm run release:checklist
28
- ```
29
-
30
- Copy the printed table into your tracker. It is always aligned with the current `package.json`.
31
-
32
- ### Step-by-step release procedure
33
-
34
- 1. **Bump version**
35
- Edit root `package.json` → `version`. Optionally sync `package-lock.json` (`npm install` or manual bump of the top-level `version` fields).
36
-
37
- 2. **Run tests (recommended)**
38
- ```bash
39
- npm test
40
- ```
41
-
42
- 3. **Build the VSIX**
43
- ```bash
44
- cd references/vscode-extension
45
- node build-vsix.js
46
- cd dist
47
- npx --yes @vscode/vsce package --no-dependencies
48
- ```
49
- Output: `references/vscode-extension/dist/cursor-guard-ide-<version>.vsix`.
50
-
51
- 4. **Commit**
52
- Include source changes, updated `dist/` if your workflow commits it, and the new `.vsix` if you ship it from the repo. Use a clear message, e.g. `release: vX.Y.Z — …`.
53
-
54
- 5. **Tag and push**
55
- ```bash
56
- git tag -a vX.Y.Z -m "vX.Y.Z"
57
- git push origin <default-branch>
58
- git push origin vX.Y.Z
59
- ```
60
-
61
- 6. **GitHub Release + attach VSIX**
62
- - Create a release for tag `vX.Y.Z` and attach `cursor-guard-ide-X.Y.Z.vsix`.
63
- - **Windows + GitHub CLI (`gh`) — avoid mojibake in release notes**
64
- On Windows, passing long Chinese (or mixed) text inline with `gh release edit --notes "..."` often corrupts encoding (garbled text on GitHub).
65
- **Always** put the body in a **UTF-8** file and use:
66
- ```bash
67
- gh release create vX.Y.Z path/to/cursor-guard-ide-X.Y.Z.vsix --title "Cursor Guard vX.Y.Z" --notes-file RELEASE_NOTES.md
68
- ```
69
- or for an existing release:
70
- ```bash
71
- gh release edit vX.Y.Z --notes-file RELEASE_NOTES.md
72
- ```
73
- Save `RELEASE_NOTES.md` as UTF-8 in VS Code / Cursor (default). Keep the release **title** ASCII-only if your shell is unreliable with Unicode.
74
- - This repo’s `.gitignore` includes `.release-notes-*.md` so temporary note files are not committed by mistake.
75
-
76
- 7. **Maintenance branches (optional)**
77
- If you use branches like `release/v4.8.x`, fast-forward them to the current default branch when your policy requires it.
78
-
79
- 8. **npm publish**
80
- From the repo root:
81
- ```bash
82
- npm publish --access public
83
- ```
84
- If npm returns **EOTP**, open the URL it prints, complete authentication in the browser, then run `npm publish` again. AI agents cannot complete OTP for you.
85
-
86
- 9. **VS Code Marketplace (optional)**
87
- Not required for GitHub Release + VSIX. If you publish there, use a personal access token and `npx @vscode/vsce publish` from `references/vscode-extension/dist` (see VS Code publishing docs).
88
-
89
- ### Hints for AI agents
90
-
91
- - Read root `package.json` → `version` before claiming a release number.
92
- - Prefer `npm run release:checklist` over inventing version strings.
93
- - After editing release notes on Windows, use **`gh … --notes-file`** with a UTF-8 file; do not rely on huge `--notes "…"` strings in PowerShell.
94
- - Do not echo npm OTP URLs as “user must visit” without also explaining they must complete the flow in a real browser.
95
- - Never paste publish tokens into chat logs.
96
-
97
- ---
98
-
99
- ## 中文(维护者与 AI 助手)
100
-
101
- ### 唯一版本源
102
-
103
- - 一切发版版本号以**仓库根目录** `package.json` 的 **`version`** 为准(semver,例如 `4.9.8`)。
104
- - 执行 `references/vscode-extension/build-vsix.js` 时,会把同一版本写入扩展构建产物中的 `package.json` 与 `guard-version.json`。
105
- - **npm** 包为 `cursor-guard@<version>`;**VSIX** 固定命名为 `cursor-guard-ide-<version>.vsix`。
106
-
107
- 仓库已是新版本时,不要在对外说明里仍写旧的版本号(例如仍写 4.9.5)。
108
-
109
- ### 一键打印检查表
110
-
111
- 在仓库根目录:
112
-
113
- ```bash
114
- npm run release:checklist
115
- ```
116
-
117
- 将终端输出复制到你的发版记录即可,内容与当前 `package.json` 一致。
118
-
119
- ### 发版步骤(建议顺序)
120
-
121
- 1. **改版本号**
122
- 修改根目录 `package.json` 的 `version`。如需,同步 `package-lock.json` 顶部版本字段或执行 `npm install` 更新锁文件。
123
-
124
- 2. **测试(建议)**
125
- ```bash
126
- npm test
127
- ```
128
-
129
- 3. **构建 VSIX**
130
- ```bash
131
- cd references/vscode-extension
132
- node build-vsix.js
133
- cd dist
134
- npx --yes @vscode/vsce package --no-dependencies
135
- ```
136
- 得到:`references/vscode-extension/dist/cursor-guard-ide-<version>.vsix`。
137
-
138
- 4. **Git 提交**
139
- 按你们仓库习惯包含源码与 `dist/`(若纳入版本控制)及新的 `.vsix`。提交信息建议含 `release: vX.Y.Z`。
140
-
141
- 5. **打标签并推送**
142
- ```bash
143
- git tag -a vX.Y.Z -m "vX.Y.Z"
144
- git push origin <默认分支>
145
- git push origin vX.Y.Z
146
- ```
147
-
148
- 6. **GitHub Release 并上传 VSIX**
149
- - 为标签 `vX.Y.Z` 创建 Release,上传对应 VSIX。
150
- - **Windows 上使用 `gh` 写中文说明时务必注意编码**
151
- 在 PowerShell 里用很长的 `gh release edit --notes "……中文……"` 容易导致 GitHub 上显示**乱码**。
152
- **正确做法**:把正文保存为 **UTF-8** 的 Markdown 文件(如 `RELEASE_NOTES.md`,用 Cursor/VS Code 保存即可),然后执行:
153
- ```bash
154
- gh release create vX.Y.Z ./references/vscode-extension/dist/cursor-guard-ide-X.Y.Z.vsix --title "Cursor Guard vX.Y.Z" --notes-file RELEASE_NOTES.md
155
- ```
156
- 或已有 Release 时:
157
- ```bash
158
- gh release edit vX.Y.Z --notes-file RELEASE_NOTES.md
159
- ```
160
- **标题**建议只用 ASCII(如 `Cursor Guard v4.9.8`),避免控制台编码问题。
161
- - 本仓库 `.gitignore` 已忽略 `.release-notes-*.md`,避免临时说明文件被误提交。
162
-
163
- 7. **release 维护分支(可选)**
164
- 若使用 `release/v4.8.x` 等分支,按团队策略决定是否快进到当前默认分支。
165
-
166
- 8. **npm 发布**
167
- 在仓库根目录:
168
- ```bash
169
- npm publish --access public
170
- ```
171
- 若提示 **OTP / 二次验证**,在浏览器完成 npm 提示的认证后**再执行一次** `npm publish`。AI 无法代替你完成浏览器验证。
172
-
173
- 9. **VS Code 扩展市场(可选)**
174
- 非必须;多数用户通过 GitHub Release + VSIX 安装即可。若上架市场,需 PAT 与 `vsce publish`(见官方文档)。
175
-
176
- ### 给其他 AI 助手的摘要
177
-
178
- - 发版前先读根目录 `package.json` 的 `version`,不要臆造版本号。
179
- - 优先执行 `npm run release:checklist` 生成与仓库一致的步骤表。
180
- - 在 Windows 上更新 GitHub Release 正文时,用 **`gh … --notes-file`** + UTF-8 文件,避免在命令行里直接塞长中文。
181
- - 不要在对话中粘贴 npm / GitHub 令牌;OTP 必须用户本人在浏览器完成。
182
-
183
- ---
184
-
185
- ## Related files / 相关文件
186
-
187
- | File | Purpose |
188
- |------|---------|
189
- | `scripts/print-release-checklist.js` | Implements `npm run release:checklist` |
190
- | `references/vscode-extension/build-vsix.js` | Assembles `dist/` and syncs version from root `package.json` |
191
- | `README.md` / `README.zh-CN.md` | Short “Release checklist” sections + link here |
192
- | `.gitignore` | Ignores `.release-notes-*.md` |
193
-
194
- ---
195
-
196
- *Last updated / 最后更新: 2026-03-22(v4.9.9:随包分发与 README 入口)*
1
+ # Release guide / 发版流程指南
2
+
3
+ **Audience / 读者**:本仓库维护者、其他开发者、以及需要代为执行发版步骤的 **AI 助手**(Agent)。
4
+ **Repo / 仓库**:<https://github.com/zhangqiang8vipp/cursor-guard>
5
+
6
+ **Jump / 跳转**:[English](#english-for-maintainers-and-ai-agents) · [中文(维护者与 AI)](#中文维护者与-ai-助手)
7
+
8
+ ---
9
+
10
+ ## English (for maintainers and AI agents)
11
+
12
+ ### Single source of truth
13
+
14
+ - All release versions come from the **repository root** `package.json` → field **`version`** (semver, e.g. `4.9.8`).
15
+ - `references/vscode-extension/build-vsix.js` reads that value and writes the same version into:
16
+ - `references/vscode-extension/dist/package.json`
17
+ - `references/vscode-extension/dist/guard-version.json`
18
+ - The **npm** package name is `cursor-guard@<version>`. The **VSIX** file name is always `cursor-guard-ide-<version>.vsix`.
19
+
20
+ Never hand-type an old version in release notes while the repo already has a higher `version`.
21
+
22
+ ### Quick machine-readable checklist
23
+
24
+ From the repo root:
25
+
26
+ ```bash
27
+ npm run release:checklist
28
+ ```
29
+
30
+ Copy the printed table into your tracker. It is always aligned with the current `package.json`.
31
+
32
+ ### Step-by-step release procedure
33
+
34
+ 1. **Bump version**
35
+ Edit root `package.json` → `version`. Optionally sync `package-lock.json` (`npm install` or manual bump of the top-level `version` fields).
36
+
37
+ 2. **Run tests (recommended)**
38
+ ```bash
39
+ npm test
40
+ ```
41
+
42
+ 3. **Build the VSIX**
43
+ ```bash
44
+ cd references/vscode-extension
45
+ node build-vsix.js
46
+ cd dist
47
+ npx --yes @vscode/vsce package --no-dependencies
48
+ ```
49
+ Output: `references/vscode-extension/dist/cursor-guard-ide-<version>.vsix`.
50
+
51
+ 4. **Commit**
52
+ Include source changes, updated `dist/` if your workflow commits it, and the new `.vsix` if you ship it from the repo. Use a clear message, e.g. `release: vX.Y.Z — …`.
53
+
54
+ 5. **Tag and push**
55
+ ```bash
56
+ git tag -a vX.Y.Z -m "vX.Y.Z"
57
+ git push origin <default-branch>
58
+ git push origin vX.Y.Z
59
+ ```
60
+
61
+ 6. **GitHub Release + attach VSIX**
62
+ - Create a release for tag `vX.Y.Z` and attach `cursor-guard-ide-X.Y.Z.vsix`.
63
+ - **Windows + GitHub CLI (`gh`) — avoid mojibake in release notes**
64
+ On Windows, passing long Chinese (or mixed) text inline with `gh release edit --notes "..."` often corrupts encoding (garbled text on GitHub).
65
+ **Always** put the body in a **UTF-8** file and use:
66
+ ```bash
67
+ gh release create vX.Y.Z path/to/cursor-guard-ide-X.Y.Z.vsix --title "Cursor Guard vX.Y.Z" --notes-file RELEASE_NOTES.md
68
+ ```
69
+ or for an existing release:
70
+ ```bash
71
+ gh release edit vX.Y.Z --notes-file RELEASE_NOTES.md
72
+ ```
73
+ Save `RELEASE_NOTES.md` as UTF-8 in VS Code / Cursor (default). Keep the release **title** ASCII-only if your shell is unreliable with Unicode.
74
+ - This repo’s `.gitignore` includes `.release-notes-*.md` so temporary note files are not committed by mistake.
75
+
76
+ 7. **Maintenance branches (optional)**
77
+ If you use branches like `release/v4.8.x`, fast-forward them to the current default branch when your policy requires it.
78
+
79
+ 8. **npm publish**
80
+ From the repo root:
81
+ ```bash
82
+ npm publish --access public
83
+ ```
84
+ If npm returns **EOTP**, open the URL it prints, complete authentication in the browser, then run `npm publish` again. AI agents cannot complete OTP for you.
85
+
86
+ 9. **VS Code Marketplace (optional)**
87
+ Not required for GitHub Release + VSIX. If you publish there, use a personal access token and `npx @vscode/vsce publish` from `references/vscode-extension/dist` (see VS Code publishing docs).
88
+
89
+ ### Hints for AI agents
90
+
91
+ - Read root `package.json` → `version` before claiming a release number.
92
+ - Prefer `npm run release:checklist` over inventing version strings.
93
+ - After editing release notes on Windows, use **`gh … --notes-file`** with a UTF-8 file; do not rely on huge `--notes "…"` strings in PowerShell.
94
+ - Do not echo npm OTP URLs as “user must visit” without also explaining they must complete the flow in a real browser.
95
+ - Never paste publish tokens into chat logs.
96
+
97
+ ---
98
+
99
+ ## 中文(维护者与 AI 助手)
100
+
101
+ ### 唯一版本源
102
+
103
+ - 一切发版版本号以**仓库根目录** `package.json` 的 **`version`** 为准(semver,例如 `4.9.8`)。
104
+ - 执行 `references/vscode-extension/build-vsix.js` 时,会把同一版本写入扩展构建产物中的 `package.json` 与 `guard-version.json`。
105
+ - **npm** 包为 `cursor-guard@<version>`;**VSIX** 固定命名为 `cursor-guard-ide-<version>.vsix`。
106
+
107
+ 仓库已是新版本时,不要在对外说明里仍写旧的版本号(例如仍写 4.9.5)。
108
+
109
+ ### 一键打印检查表
110
+
111
+ 在仓库根目录:
112
+
113
+ ```bash
114
+ npm run release:checklist
115
+ ```
116
+
117
+ 将终端输出复制到你的发版记录即可,内容与当前 `package.json` 一致。
118
+
119
+ ### 发版步骤(建议顺序)
120
+
121
+ 1. **改版本号**
122
+ 修改根目录 `package.json` 的 `version`。如需,同步 `package-lock.json` 顶部版本字段或执行 `npm install` 更新锁文件。
123
+
124
+ 2. **测试(建议)**
125
+ ```bash
126
+ npm test
127
+ ```
128
+
129
+ 3. **构建 VSIX**
130
+ ```bash
131
+ cd references/vscode-extension
132
+ node build-vsix.js
133
+ cd dist
134
+ npx --yes @vscode/vsce package --no-dependencies
135
+ ```
136
+ 得到:`references/vscode-extension/dist/cursor-guard-ide-<version>.vsix`。
137
+
138
+ 4. **Git 提交**
139
+ 按你们仓库习惯包含源码与 `dist/`(若纳入版本控制)及新的 `.vsix`。提交信息建议含 `release: vX.Y.Z`。
140
+
141
+ 5. **打标签并推送**
142
+ ```bash
143
+ git tag -a vX.Y.Z -m "vX.Y.Z"
144
+ git push origin <默认分支>
145
+ git push origin vX.Y.Z
146
+ ```
147
+
148
+ 6. **GitHub Release 并上传 VSIX**
149
+ - 为标签 `vX.Y.Z` 创建 Release,上传对应 VSIX。
150
+ - **Windows 上使用 `gh` 写中文说明时务必注意编码**
151
+ 在 PowerShell 里用很长的 `gh release edit --notes "……中文……"` 容易导致 GitHub 上显示**乱码**。
152
+ **正确做法**:把正文保存为 **UTF-8** 的 Markdown 文件(如 `RELEASE_NOTES.md`,用 Cursor/VS Code 保存即可),然后执行:
153
+ ```bash
154
+ gh release create vX.Y.Z ./references/vscode-extension/dist/cursor-guard-ide-X.Y.Z.vsix --title "Cursor Guard vX.Y.Z" --notes-file RELEASE_NOTES.md
155
+ ```
156
+ 或已有 Release 时:
157
+ ```bash
158
+ gh release edit vX.Y.Z --notes-file RELEASE_NOTES.md
159
+ ```
160
+ **标题**建议只用 ASCII(如 `Cursor Guard v4.9.8`),避免控制台编码问题。
161
+ - 本仓库 `.gitignore` 已忽略 `.release-notes-*.md`,避免临时说明文件被误提交。
162
+
163
+ 7. **release 维护分支(可选)**
164
+ 若使用 `release/v4.8.x` 等分支,按团队策略决定是否快进到当前默认分支。
165
+
166
+ 8. **npm 发布**
167
+ 在仓库根目录:
168
+ ```bash
169
+ npm publish --access public
170
+ ```
171
+ 若提示 **OTP / 二次验证**,在浏览器完成 npm 提示的认证后**再执行一次** `npm publish`。AI 无法代替你完成浏览器验证。
172
+
173
+ 9. **VS Code 扩展市场(可选)**
174
+ 非必须;多数用户通过 GitHub Release + VSIX 安装即可。若上架市场,需 PAT 与 `vsce publish`(见官方文档)。
175
+
176
+ ### 给其他 AI 助手的摘要
177
+
178
+ - 发版前先读根目录 `package.json` 的 `version`,不要臆造版本号。
179
+ - 优先执行 `npm run release:checklist` 生成与仓库一致的步骤表。
180
+ - 在 Windows 上更新 GitHub Release 正文时,用 **`gh … --notes-file`** + UTF-8 文件,避免在命令行里直接塞长中文。
181
+ - 不要在对话中粘贴 npm / GitHub 令牌;OTP 必须用户本人在浏览器完成。
182
+
183
+ ---
184
+
185
+ ## Related files / 相关文件
186
+
187
+ | File | Purpose |
188
+ |------|---------|
189
+ | `scripts/print-release-checklist.js` | Implements `npm run release:checklist` |
190
+ | `references/vscode-extension/build-vsix.js` | Assembles `dist/` and syncs version from root `package.json` |
191
+ | `README.md` / `README.zh-CN.md` | Short “Release checklist” sections + link here |
192
+ | `docs/SNAPSHOT-BOOKMARK.md` | Design note: bookmark commit when manual snapshot tree unchanged (intent timeline, event-restore friendly) |
193
+ | `.gitignore` | Ignores `.release-notes-*.md` |
194
+
195
+ ---
196
+
197
+ *Last updated / 最后更新: 2026-03-23(v4.9.13:补充 `docs/SNAPSHOT-BOOKMARK.md` 索引)*
@@ -0,0 +1,47 @@
1
+ # Manual snapshot “bookmark” when the tree is unchanged / 树未变时的手动快照「书签」
2
+
3
+ ## Why we do this / 为什么这样选
4
+
5
+ When you call **`snapshot_now`** (MCP) or **Snapshot Now** (IDE), you often add an **`intent`** (and optional **agent** / **session**). If the Guard snapshot **tree is identical** to the previous baseline, Git has nothing new to store as a *different tree* — but from a **product** perspective, “no new tree” must not mean **“nothing happened”**.
6
+
7
+ We **still create a normal Git commit** on the manual snapshot ref (`refs/guard/snapshot` for MCP; same mechanism when `allowEmptyTree` is used) with:
8
+
9
+ - The **same tree** as the parent (a true “empty” or **bookmark** commit in Git terms).
10
+ - **`Guard-Bookmark: true`** in the commit trailers for machines and UI.
11
+ - A default **`Summary`** line when you did not supply one, so the backup list is not blank.
12
+ - Your **`Intent` / `Agent` / `Session`** trailers when provided.
13
+
14
+ This matches the earlier design choice: **prefer a bookmark commit over rewriting history** (no `amend` of the previous commit) and **over a separate sidecar store** for the common case — one timeline, one `list_backups` source of truth.
15
+
16
+ ## Pros / 优点
17
+
18
+ - **Visible audit trail**: time + intent appear on the dashboard timeline and in `list_backups`.
19
+ - **No history rewrite**: previous commit hashes stay valid; no trailer surgery on old commits.
20
+ - **Same stack as today**: `listBackups` + trailers + restore by hash still work; bookmark commits are valid restore targets (tree equals parent — a deliberate no-op restore).
21
+ - **Future-friendly for event-based restore**: each user action can map to a **stable commit hash** and timestamp even when the tree did not move — good for “restore to the state *as of* this acknowledged intent” and for correlating MCP calls with timeline entries.
22
+
23
+ ## Cons / 缺点
24
+
25
+ - **Extra commits** on `refs/guard/snapshot` (and any code path using `allowEmptyTree`): retention / ref length grow slightly faster if users spam snapshot with no changes.
26
+ - **Semantic nuance**: restoring *to* a bookmark commit may change nothing relative to parent; documentation and UI must say **“bookmark / no tree change”** so it is not confused with a content-bearing restore point.
27
+ - **Not used for auto-backup**: the watcher still skips when the tree is unchanged (`allowEmptyTree` off) to avoid noise.
28
+
29
+ ## Scope / 范围
30
+
31
+ - **Manual paths**: MCP `snapshot_now` (already uses `allowEmptyTree: true`) and IDE snapshot (same).
32
+ - **Automatic backup**: unchanged — still **skip** when tree unchanged.
33
+
34
+ ## MCP: `record_guard_event`
35
+
36
+ Dedicated tool for **agent workflows** after other MCP calls: writes **`Guard-Event:`** (short label, e.g. `restore_project:execute`) plus optional **`detail`** → Summary, **`intent`**, **`agent`**, **`session`**. Same mechanics as manual snapshot with **`allowEmptyTree`**: if the tree is unchanged vs the Guard baseline, you still get a **bookmark commit** on `refs/guard/snapshot` so the event is visible on the timeline — not a silent no-op.
37
+
38
+ ## Related code / 相关实现
39
+
40
+ - `references/lib/core/snapshot.js` — `allowEmptyTree`, `Guard-Bookmark`, `Guard-Event` (via `context.guardEvent`), default summary, `bookmark: true` on result.
41
+ - `references/lib/core/backups.js` — `TRAILER_MAP` entries `Guard-Bookmark` → `guardBookmark`, `Guard-Event` → `guardEvent`.
42
+ - `references/mcp/server.js` — tool **`record_guard_event`**.
43
+ - Dashboard — bookmark badge, **MCP/audit event** row, drawer fields.
44
+
45
+ ---
46
+
47
+ *Introduced in v4.9.13; `record_guard_event` in v4.9.14.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-guard",
3
- "version": "4.9.12",
3
+ "version": "4.9.15",
4
4
  "description": "Protects code from accidental AI overwrite or deletion in Cursor IDE — mandatory pre-write snapshots, review-before-apply, local Git safety net, and deterministic recovery. | 保护代码免受 Cursor AI 代理意外覆写或删除——强制写前快照、预览再执行、本地 Git 安全网、确定性恢复。",
5
5
  "keywords": [
6
6
  "cursor",
@@ -39,6 +39,7 @@
39
39
  "README.md",
40
40
  "README.zh-CN.md",
41
41
  "docs/RELEASE.md",
42
+ "docs/SNAPSHOT-BOOKMARK.md",
42
43
  "ROADMAP.md",
43
44
  "LICENSE",
44
45
  "references/auto-backup.ps1",