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.
- package/README.md +697 -697
- package/README.zh-CN.md +696 -696
- package/ROADMAP.md +1775 -1758
- package/SKILL.md +631 -629
- package/docs/RELEASE.md +197 -196
- package/docs/SNAPSHOT-BOOKMARK.md +47 -0
- package/package.json +2 -1
- package/references/dashboard/public/app.js +2079 -2050
- package/references/dashboard/public/style.css +1660 -1628
- package/references/lib/core/backups.js +509 -507
- package/references/lib/core/core.test.js +39 -1
- package/references/lib/core/snapshot.js +441 -416
- package/references/mcp/mcp.test.js +381 -362
- package/references/mcp/server.js +404 -347
- package/references/vscode-extension/{cursor-guard-ide-4.9.12.vsix → dist/cursor-guard-ide-4.9.15.vsix} +0 -0
- package/references/vscode-extension/dist/dashboard/public/app.js +2079 -2050
- package/references/vscode-extension/dist/dashboard/public/style.css +1660 -1628
- package/references/vscode-extension/dist/extension.js +780 -704
- package/references/vscode-extension/dist/guard-version.json +1 -1
- package/references/vscode-extension/dist/lib/auto-setup.js +201 -192
- package/references/vscode-extension/dist/lib/core/backups.js +509 -507
- package/references/vscode-extension/dist/lib/core/snapshot.js +441 -416
- package/references/vscode-extension/dist/mcp/server.js +78 -12
- package/references/vscode-extension/dist/package.json +7 -1
- package/references/vscode-extension/dist/skill/ROADMAP.md +1775 -1758
- package/references/vscode-extension/dist/skill/SKILL.md +631 -629
- package/references/vscode-extension/extension.js +780 -704
- package/references/vscode-extension/lib/auto-setup.js +201 -192
- package/references/vscode-extension/package.json +7 -1
- package/references/vscode-extension/dist/cursor-guard-ide-4.9.12.vsix +0 -0
|
@@ -195,15 +195,53 @@ test('skips when tree is unchanged', () => {
|
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
+
test('createGitSnapshot writes Guard-Event trailer for MCP audit', () => {
|
|
199
|
+
const tmpDir = createTempGitRepo();
|
|
200
|
+
try {
|
|
201
|
+
const { loadConfig } = require('../utils');
|
|
202
|
+
const { cfg } = loadConfig(tmpDir);
|
|
203
|
+
createGitSnapshot(tmpDir, cfg);
|
|
204
|
+
const r = createGitSnapshot(tmpDir, cfg, {
|
|
205
|
+
allowEmptyTree: true,
|
|
206
|
+
context: {
|
|
207
|
+
trigger: 'mcp-event',
|
|
208
|
+
guardEvent: 'restore_project:preview',
|
|
209
|
+
summary: 'User asked for restore preview',
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
assert.strictEqual(r.status, 'created');
|
|
213
|
+
const body = execFileSync('git', ['log', '-1', '--format=%B', r.commitHash], { cwd: tmpDir, encoding: 'utf8' });
|
|
214
|
+
assert.match(body, /Guard-Event: restore_project:preview/);
|
|
215
|
+
assert.match(body, /Trigger: mcp-event/);
|
|
216
|
+
const { listBackups } = require('./backups');
|
|
217
|
+
const row = listBackups(tmpDir, { limit: 10 }).sources.find(s => s.commitHash === r.commitHash);
|
|
218
|
+
assert.strictEqual(row.guardEvent, 'restore_project:preview');
|
|
219
|
+
} finally {
|
|
220
|
+
cleanupDir(tmpDir);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
198
224
|
test('allowEmptyTree creates bookmark commit when tree unchanged', () => {
|
|
199
225
|
const tmpDir = createTempGitRepo();
|
|
200
226
|
try {
|
|
201
227
|
const { loadConfig } = require('../utils');
|
|
202
228
|
const { cfg } = loadConfig(tmpDir);
|
|
203
229
|
createGitSnapshot(tmpDir, cfg);
|
|
204
|
-
const result2 = createGitSnapshot(tmpDir, cfg, {
|
|
230
|
+
const result2 = createGitSnapshot(tmpDir, cfg, {
|
|
231
|
+
allowEmptyTree: true,
|
|
232
|
+
context: { trigger: 'manual', intent: 'user clicked snapshot with no tree delta' },
|
|
233
|
+
});
|
|
205
234
|
assert.strictEqual(result2.status, 'created');
|
|
235
|
+
assert.strictEqual(result2.bookmark, true);
|
|
206
236
|
assert.ok(result2.commitHash);
|
|
237
|
+
const body = execFileSync('git', ['log', '-1', '--format=%B', result2.commitHash], { cwd: tmpDir, encoding: 'utf8' });
|
|
238
|
+
assert.match(body, /Guard-Bookmark: true/);
|
|
239
|
+
assert.match(body, /Intent: user clicked snapshot with no tree delta/);
|
|
240
|
+
assert.match(body, /No file changes since last Guard baseline \(bookmark\)/);
|
|
241
|
+
const { listBackups } = require('./backups');
|
|
242
|
+
const tip = listBackups(tmpDir, { limit: 5 }).sources.find(s => s.commitHash === result2.commitHash);
|
|
243
|
+
assert.ok(tip);
|
|
244
|
+
assert.strictEqual(tip.guardBookmark, true);
|
|
207
245
|
} finally {
|
|
208
246
|
cleanupDir(tmpDir);
|
|
209
247
|
}
|