cursor-guard 4.9.0 → 4.9.6
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 +94 -28
- package/README.zh-CN.md +91 -25
- package/ROADMAP.md +51 -9
- package/SKILL.md +32 -22
- package/package.json +1 -1
- package/references/config-reference.md +68 -7
- package/references/config-reference.zh-CN.md +68 -7
- package/references/cursor-guard.example.json +11 -7
- package/references/cursor-guard.schema.json +30 -7
- package/references/dashboard/public/app.js +73 -27
- package/references/dashboard/public/index.html +8 -7
- package/references/lib/auto-backup.js +40 -2
- package/references/lib/core/backups.js +46 -16
- package/references/lib/core/core.test.js +101 -22
- package/references/lib/core/dashboard.js +37 -23
- package/references/lib/core/doctor.js +19 -13
- package/references/lib/core/pre-warning.js +296 -0
- package/references/lib/core/snapshot.js +24 -2
- package/references/lib/core/status.js +15 -7
- package/references/lib/utils.js +46 -20
- package/references/mcp/mcp.test.js +60 -12
- package/references/mcp/server.js +72 -60
- package/references/quickstart.zh-CN.md +46 -21
- package/references/vscode-extension/build-vsix.js +4 -3
- package/references/vscode-extension/dist/LICENSE +65 -0
- package/references/vscode-extension/dist/{cursor-guard-ide-4.9.0.vsix → cursor-guard-ide-4.9.6.vsix} +0 -0
- package/references/vscode-extension/dist/dashboard/public/app.js +73 -27
- package/references/vscode-extension/dist/dashboard/public/index.html +8 -7
- package/references/vscode-extension/dist/extension.js +498 -296
- package/references/vscode-extension/dist/guard-version.json +1 -1
- package/references/vscode-extension/dist/lib/auto-backup.js +40 -2
- package/references/vscode-extension/dist/lib/core/backups.js +46 -16
- package/references/vscode-extension/dist/lib/core/dashboard.js +37 -23
- package/references/vscode-extension/dist/lib/core/doctor.js +19 -13
- package/references/vscode-extension/dist/lib/core/pre-warning.js +296 -0
- package/references/vscode-extension/dist/lib/core/snapshot.js +24 -2
- package/references/vscode-extension/dist/lib/core/status.js +15 -7
- package/references/vscode-extension/dist/lib/sidebar-webview.js +502 -433
- package/references/vscode-extension/dist/lib/status-bar.js +95 -68
- package/references/vscode-extension/dist/lib/tree-view.js +174 -114
- package/references/vscode-extension/dist/lib/utils.js +46 -20
- package/references/vscode-extension/dist/mcp/server.js +393 -30
- package/references/vscode-extension/dist/package.json +1 -1
- package/references/vscode-extension/dist/skill/ROADMAP.md +51 -9
- package/references/vscode-extension/dist/skill/SKILL.md +32 -22
- package/references/vscode-extension/dist/skill/config-reference.md +68 -7
- package/references/vscode-extension/dist/skill/config-reference.zh-CN.md +68 -7
- package/references/vscode-extension/dist/skill/cursor-guard.example.json +11 -7
- package/references/vscode-extension/dist/skill/cursor-guard.schema.json +30 -7
- package/references/vscode-extension/extension.js +498 -296
- package/references/vscode-extension/lib/sidebar-webview.js +502 -433
- package/references/vscode-extension/lib/status-bar.js +95 -68
- package/references/vscode-extension/lib/tree-view.js +174 -114
- package/references/vscode-extension/package.json +1 -1
|
@@ -60,9 +60,16 @@ const I18N = {
|
|
|
60
60
|
'alert.action.deleted': 'Deleted',
|
|
61
61
|
'alert.action.renamed': 'Renamed',
|
|
62
62
|
'alert.breakdown': '{added} added, {modified} modified, {deleted} deleted',
|
|
63
|
-
'alert.suggestion': 'Check recent changes and consider creating a manual snapshot',
|
|
64
|
-
'alert.viewFiles': 'View file details ({n} files)',
|
|
65
|
-
'
|
|
63
|
+
'alert.suggestion': 'Check recent changes and consider creating a manual snapshot',
|
|
64
|
+
'alert.viewFiles': 'View file details ({n} files)',
|
|
65
|
+
'preWarning.title': 'Pre-Warning',
|
|
66
|
+
'preWarning.none': 'No destructive edit risk detected',
|
|
67
|
+
'preWarning.active': 'Delete Risk',
|
|
68
|
+
'preWarning.file': 'File',
|
|
69
|
+
'preWarning.risk': 'Risk',
|
|
70
|
+
'preWarning.methods': 'Methods removed',
|
|
71
|
+
'preWarning.suggestion': 'Review this deletion before applying or restore from the latest snapshot',
|
|
72
|
+
'modal.alertFiles': 'Alert File Details',
|
|
66
73
|
'modal.col.restore': 'Restore',
|
|
67
74
|
'modal.copyRestore': 'Copy cmd',
|
|
68
75
|
'modal.restorePreDelete':'Restore pre-delete',
|
|
@@ -170,8 +177,9 @@ const I18N = {
|
|
|
170
177
|
'issue.disk_critically_low': 'Disk space critically low ({gb} GB free)',
|
|
171
178
|
'issue.disk_low': 'Disk space low ({gb} GB free)',
|
|
172
179
|
'issue.git_backup_stale': 'Last git backup is stale ({rel})',
|
|
173
|
-
'issue.active_alert': 'Active alert: {type} — {count} files in {window}s',
|
|
174
|
-
'issue.
|
|
180
|
+
'issue.active_alert': 'Active alert: {type} — {count} files in {window}s',
|
|
181
|
+
'issue.pre_warning_active': 'Pre-warning active: {summary}',
|
|
182
|
+
'issue.alert_high_velocity': 'High volume of file changes detected. Consider reviewing recent modifications and creating a manual snapshot.',
|
|
175
183
|
|
|
176
184
|
'check.Git installed': 'Git installed',
|
|
177
185
|
'check.Git repository': 'Git repository',
|
|
@@ -288,9 +296,16 @@ const I18N = {
|
|
|
288
296
|
'alert.action.deleted': '删除',
|
|
289
297
|
'alert.action.renamed': '重命名',
|
|
290
298
|
'alert.breakdown': '新增 {added} · 修改 {modified} · 删除 {deleted}',
|
|
291
|
-
'alert.suggestion': '建议检查近期变更,并考虑手动创建快照',
|
|
292
|
-
'alert.viewFiles': '查看文件详情({n} 个文件)',
|
|
293
|
-
'
|
|
299
|
+
'alert.suggestion': '建议检查近期变更,并考虑手动创建快照',
|
|
300
|
+
'alert.viewFiles': '查看文件详情({n} 个文件)',
|
|
301
|
+
'preWarning.title': '事先预警',
|
|
302
|
+
'preWarning.none': '未检测到破坏性编辑风险',
|
|
303
|
+
'preWarning.active': '删除风险',
|
|
304
|
+
'preWarning.file': '文件',
|
|
305
|
+
'preWarning.risk': '风险',
|
|
306
|
+
'preWarning.methods': '移除的方法数',
|
|
307
|
+
'preWarning.suggestion': '建议在应用前检查这次删除,或直接从最新快照恢复',
|
|
308
|
+
'modal.alertFiles': '告警文件详情',
|
|
294
309
|
'modal.col.restore': '恢复',
|
|
295
310
|
'modal.copyRestore': '复制命令',
|
|
296
311
|
'modal.restorePreDelete':'恢复删除前',
|
|
@@ -399,7 +414,8 @@ const I18N = {
|
|
|
399
414
|
'issue.disk_low': '磁盘空间不足({gb} GB 可用)',
|
|
400
415
|
'issue.git_backup_stale': '最近 Git 备份已过时({rel})',
|
|
401
416
|
'issue.active_alert': '活跃告警:{type}——{count} 个文件在 {window} 秒内变更',
|
|
402
|
-
'issue.
|
|
417
|
+
'issue.pre_warning_active': '事先预警生效:{summary}',
|
|
418
|
+
'issue.alert_high_velocity': '检测到大量文件变更,建议检查最近修改并手动创建快照。',
|
|
403
419
|
|
|
404
420
|
'check.Git installed': 'Git 安装状态',
|
|
405
421
|
'check.Git repository': 'Git 仓库',
|
|
@@ -557,8 +573,9 @@ const ISSUE_PATTERNS = [
|
|
|
557
573
|
{ re: /^Disk space low \((.+?) GB free\)$/, key: 'issue.disk_low', extract: ['gb'] },
|
|
558
574
|
{ re: /^Last git backup is stale \((.+?)\)$/, key: 'issue.git_backup_stale', extract: ['rel'] },
|
|
559
575
|
{ re: /^Active alert: (.+?) — (\d+) files in (\d+)s$/, key: 'issue.active_alert', extract: ['type', 'count', 'window'] },
|
|
560
|
-
{ re: /^
|
|
561
|
-
|
|
576
|
+
{ re: /^Pre-warning active: (.+)$/, key: 'issue.pre_warning_active', extract: ['summary'] },
|
|
577
|
+
{ re: /^High volume of file changes/, key: 'issue.alert_high_velocity' },
|
|
578
|
+
];
|
|
562
579
|
|
|
563
580
|
function translateIssue(text) {
|
|
564
581
|
for (const p of ISSUE_PATTERNS) {
|
|
@@ -850,13 +867,14 @@ function renderAll() {
|
|
|
850
867
|
|
|
851
868
|
/* ── Rendering: Overview ──────────────────────────────────── */
|
|
852
869
|
|
|
853
|
-
function renderOverview(d) {
|
|
854
|
-
renderHealthCard(d.health);
|
|
855
|
-
renderGitBackupCard(d.lastBackup);
|
|
856
|
-
renderShadowBackupCard(d.lastBackup);
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
870
|
+
function renderOverview(d) {
|
|
871
|
+
renderHealthCard(d.health);
|
|
872
|
+
renderGitBackupCard(d.lastBackup);
|
|
873
|
+
renderShadowBackupCard(d.lastBackup);
|
|
874
|
+
renderPreWarningCard(d.preWarnings);
|
|
875
|
+
renderWatcherCard(d.watcher);
|
|
876
|
+
renderAlertCard(d.alerts);
|
|
877
|
+
}
|
|
860
878
|
|
|
861
879
|
function renderHealthCard(health) {
|
|
862
880
|
const el = $('#card-health');
|
|
@@ -889,9 +907,9 @@ function renderGitBackupCard(lastBackup) {
|
|
|
889
907
|
`;
|
|
890
908
|
}
|
|
891
909
|
|
|
892
|
-
function renderShadowBackupCard(lastBackup) {
|
|
893
|
-
const el = $('#card-shadow-backup');
|
|
894
|
-
const s = lastBackup?.shadow;
|
|
910
|
+
function renderShadowBackupCard(lastBackup) {
|
|
911
|
+
const el = $('#card-shadow-backup');
|
|
912
|
+
const s = lastBackup?.shadow;
|
|
895
913
|
if (!s) {
|
|
896
914
|
el.innerHTML = `<div class="card-label">${t('shadowBackup.title')}</div><div class="card-empty">${t('shadowBackup.none')}</div>`;
|
|
897
915
|
return;
|
|
@@ -899,12 +917,40 @@ function renderShadowBackupCard(lastBackup) {
|
|
|
899
917
|
el.innerHTML = `
|
|
900
918
|
<div class="card-label">${t('shadowBackup.title')}</div>
|
|
901
919
|
<div class="card-value">${esc(relativeTime(s.timestamp))}</div>
|
|
902
|
-
<div class="card-detail text-muted text-sm">${esc(formatTime(s.timestamp))}</div>
|
|
903
|
-
`;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
function
|
|
907
|
-
const el = $('#card-
|
|
920
|
+
<div class="card-detail text-muted text-sm">${esc(formatTime(s.timestamp))}</div>
|
|
921
|
+
`;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
function renderPreWarningCard(preWarnings) {
|
|
925
|
+
const el = $('#card-prewarning');
|
|
926
|
+
if (!preWarnings?.active) {
|
|
927
|
+
el.innerHTML = `
|
|
928
|
+
<div class="card-label">${t('preWarning.title')}</div>
|
|
929
|
+
<div class="card-status"><span class="status-dot status-healthy"></span><span>${t('preWarning.none')}</span></div>
|
|
930
|
+
`;
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const warning = preWarnings.latest || {};
|
|
935
|
+
const file = warning.file || '-';
|
|
936
|
+
const risk = warning.riskPercent !== undefined ? `${warning.riskPercent}%` : '-';
|
|
937
|
+
const methods = warning.removedMethodCount || 0;
|
|
938
|
+
|
|
939
|
+
el.innerHTML = `
|
|
940
|
+
<div class="card-label">${t('preWarning.title')}</div>
|
|
941
|
+
<div class="card-status"><span class="status-dot status-warning"></span><span class="status-text status-warning">${t('preWarning.active')}</span></div>
|
|
942
|
+
<div class="alert-details">
|
|
943
|
+
<div class="alert-detail-row"><span class="alert-detail-label">${t('preWarning.file')}</span><span class="text-mono">${esc(file)}</span></div>
|
|
944
|
+
<div class="alert-detail-row"><span class="alert-detail-label">${t('preWarning.risk')}</span><span>${esc(risk)}</span></div>
|
|
945
|
+
${methods > 0 ? `<div class="alert-detail-row"><span class="alert-detail-label">${t('preWarning.methods')}</span><span>${methods}</span></div>` : ''}
|
|
946
|
+
<div class="alert-detail-row alert-breakdown text-sm">${esc(warning.summary || t('preWarning.suggestion'))}</div>
|
|
947
|
+
<div class="alert-detail-row alert-suggestion text-sm text-muted">${t('preWarning.suggestion')}</div>
|
|
948
|
+
</div>
|
|
949
|
+
`;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function renderWatcherCard(watcher) {
|
|
953
|
+
const el = $('#card-watcher');
|
|
908
954
|
let st = 'stopped';
|
|
909
955
|
if (watcher?.running) st = 'running';
|
|
910
956
|
else if (watcher?.stale) st = 'stale';
|
|
@@ -44,13 +44,14 @@
|
|
|
44
44
|
<section id="screen-overview" class="screen">
|
|
45
45
|
<h2 class="section-title" data-i18n="overview.title">Overview</h2>
|
|
46
46
|
<div id="overview-grid" class="card-grid">
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</
|
|
47
|
+
<div id="card-health" class="card card-health"><div class="skeleton-block"></div></div>
|
|
48
|
+
<div id="card-git-backup" class="card"><div class="skeleton-block"></div></div>
|
|
49
|
+
<div id="card-shadow-backup" class="card"><div class="skeleton-block"></div></div>
|
|
50
|
+
<div id="card-prewarning" class="card"><div class="skeleton-block"></div></div>
|
|
51
|
+
<div id="card-watcher" class="card"><div class="skeleton-block"></div></div>
|
|
52
|
+
<div id="card-alert" class="card"><div class="skeleton-block"></div></div>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
54
55
|
|
|
55
56
|
<!-- Screen 2: Backups & Recovery ─────────────────────── -->
|
|
56
57
|
<section id="screen-backups" class="screen">
|