cursor-guard 2.1.1 → 3.1.0

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 CHANGED
@@ -20,6 +20,8 @@ When Cursor's AI agent edits your files, there's a risk of accidental overwrites
20
20
  - **Configurable scope** — Protect only what matters via `.cursor-guard.json`
21
21
  - **Secrets filtering** — Sensitive files (`.env`, keys, certificates) are auto-excluded from backups
22
22
  - **Auto-backup script** — A cross-platform watcher (Node.js) that periodically snapshots to a dedicated Git branch without disturbing your working tree
23
+ - **MCP tool calls (optional)** — 7 structured tools (diagnostics, snapshot, restore, status, etc.) with JSON responses and lower token cost
24
+ - **Auto-fix diagnostics** — `doctor_fix` automatically patches missing configs, uninitialized Git repos, gitignore gaps, and stale locks
23
25
 
24
26
  ---
25
27
 
@@ -84,19 +86,30 @@ After installation, your directory structure should look like this:
84
86
 
85
87
  ```
86
88
  .cursor/skills/cursor-guard/
87
- ├── SKILL.md # AI agent instructions
89
+ ├── SKILL.md # AI agent instructions (with MCP dual-path logic)
90
+ ├── ROADMAP.md # Version evolution roadmap
88
91
  ├── README.md
89
92
  ├── README.zh-CN.md
90
93
  ├── LICENSE
91
94
  ├── package.json
92
95
  └── references/
93
96
  ├── lib/
94
- │ ├── auto-backup.js # Backup core (Node.js)
95
- │ ├── guard-doctor.js # Health check core
96
- └── utils.js # Shared utilities
97
+ │ ├── auto-backup.js # Backup watcher (calls Core)
98
+ │ ├── guard-doctor.js # Health check CLI (calls Core)
99
+ ├── utils.js # Shared utilities
100
+ │ └── core/ # V3 Core layer (pure logic)
101
+ │ ├── doctor.js # Diagnostics (incl. MCP self-check)
102
+ │ ├── doctor-fix.js # Auto-fix common issues
103
+ │ ├── snapshot.js # Git snapshots + shadow copies
104
+ │ ├── backups.js # Backup listing + retention
105
+ │ ├── restore.js # Single file / project restore
106
+ │ └── status.js # Backup system status
107
+ ├── mcp/
108
+ │ └── server.js # MCP Server (7 tools)
97
109
  ├── bin/
98
- │ ├── cursor-guard-backup.js # CLI entry: npx cursor-guard-backup
99
- └── cursor-guard-doctor.js # CLI entry: npx cursor-guard-doctor
110
+ │ ├── cursor-guard-backup.js # CLI: npx cursor-guard-backup
111
+ ├── cursor-guard-doctor.js # CLI: npx cursor-guard-doctor
112
+ │ └── cursor-guard-mcp (server.js)# CLI: npx cursor-guard-mcp
100
113
  ├── auto-backup.ps1 / .sh # Thin wrappers
101
114
  ├── guard-doctor.ps1 / .sh
102
115
  ├── recovery.md # Recovery commands
@@ -128,7 +141,22 @@ The skill activates automatically when the AI agent detects risky operations or
128
141
  cp .cursor/skills/cursor-guard/references/cursor-guard.example.json .cursor-guard.json
129
142
  ```
130
143
 
131
- 5. **(Optional) Run auto-backup** in a separate terminal:
144
+ 5. **(Optional) Enable MCP tool calls** add to `.cursor/mcp.json`:
145
+
146
+ ```jsonc
147
+ {
148
+ "mcpServers": {
149
+ "cursor-guard": {
150
+ "command": "node",
151
+ "args": ["<skill-path>/references/mcp/server.js"]
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ This gives the AI agent 7 structured tools (diagnostics, snapshot, restore, etc.) with JSON responses — faster, more reliable, and lower token cost. Everything works without MCP too.
158
+
159
+ 6. **(Optional) Run auto-backup** in a separate terminal:
132
160
 
133
161
  ```bash
134
162
  npx cursor-guard-backup --path /my/project
@@ -167,8 +195,18 @@ Regardless of config, you can always override per-request:
167
195
 
168
196
  Run in a separate terminal while working in Cursor. Cross-platform — requires Node.js >= 18.
169
197
 
198
+ Important:
199
+
200
+ - You can run the command from any directory
201
+ - But `--path` must point to the project root you want to protect
202
+ - If you are already in the project root, `--path .` is fine
203
+ - If you are not in the project root, do not use `--path .`; use the full target path instead
204
+
170
205
  ```bash
171
- # Via npx (after npm install)
206
+ # If you are already in the project root
207
+ npx cursor-guard-backup --path .
208
+
209
+ # If you are not in the project root
172
210
  npx cursor-guard-backup --path /my/project
173
211
  npx cursor-guard-backup --path /my/project --interval 30
174
212
 
@@ -179,6 +217,14 @@ npx cursor-guard-backup --path /my/project --interval 30
179
217
  ./references/auto-backup.sh /my/project
180
218
  ```
181
219
 
220
+ Wrong example:
221
+
222
+ ```bash
223
+ # You are in some other directory
224
+ # In that case --path . protects the current directory, not your real project
225
+ npx cursor-guard-backup --path .
226
+ ```
227
+
182
228
  The script uses Git plumbing commands to snapshot to `refs/guard/auto-backup` — it never switches branches or touches your working index. The ref lives outside `refs/heads/` so `git push --all` won't push it. Supports `shadow` mode for non-Git directories.
183
229
 
184
230
  ### Health Check
@@ -247,6 +293,9 @@ The skill activates on these signals:
247
293
  - Time-based recovery: "restore to N minutes ago", "go back to yesterday"
248
294
  - Version-based recovery: "previous version", "go back N versions"
249
295
  - History issues: checkpoints missing, Timeline not working, save failures
296
+ - Health check: "guard doctor", "check guard setup", "is MCP working"
297
+ - Auto-fix: "guard fix", "fix config"
298
+ - Backup status: "guard status", "is the watcher running", "last backup time"
250
299
 
251
300
  ---
252
301
 
@@ -254,9 +303,12 @@ The skill activates on these signals:
254
303
 
255
304
  | File | Purpose |
256
305
  |------|---------|
257
- | `SKILL.md` | Main skill instructions for the AI agent |
258
- | `references/lib/auto-backup.js` | Auto-backup core logic (Node.js) |
259
- | `references/lib/guard-doctor.js` | Health check core logic (Node.js) |
306
+ | `SKILL.md` | Main skill instructions for the AI agent (with MCP dual-path) |
307
+ | `ROADMAP.md` | Version evolution roadmap (V2-V7) |
308
+ | `references/lib/core/` | Core layer: 6 pure-logic modules (doctor / doctor-fix / snapshot / backups / restore / status) |
309
+ | `references/mcp/server.js` | MCP Server: 7 structured tools (optional) |
310
+ | `references/lib/auto-backup.js` | Auto-backup watcher (calls Core) |
311
+ | `references/lib/guard-doctor.js` | Health check CLI shell (calls Core) |
260
312
  | `references/lib/utils.js` | Shared utilities (config, glob, git, manifest) |
261
313
  | `references/bin/cursor-guard-backup.js` | CLI entry: `npx cursor-guard-backup` |
262
314
  | `references/bin/cursor-guard-doctor.js` | CLI entry: `npx cursor-guard-doctor` |