cursor-guard 4.8.1 → 4.8.2

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/ROADMAP.md CHANGED
@@ -3,8 +3,8 @@
3
3
  > 本文档描述 cursor-guard 从 V2 到 V7 的长期演进方向。
4
4
  > 每一代向下兼容,低版本功能永远不废弃。
5
5
  >
6
- > **当前版本**:`V4.8.1`
7
- > **文档状态**:`V2` ~ `V4.8.1` 已完成交付(含 V5 intent/audit 基础),`V5` 主体规划中
6
+ > **当前版本**:`V4.8.2`
7
+ > **文档状态**:`V2` ~ `V4.8.2` 已完成交付(含 V5 intent/audit 基础),`V5` 主体规划中
8
8
 
9
9
  ## 阅读导航
10
10
 
@@ -734,6 +734,14 @@ V4 经过 4 轮系统性代码审查,修复了以下关键问题:
734
734
  }
735
735
  ```
736
736
 
737
+ ### V4.8.2:Skill 目录运行时完整安装 ✅
738
+
739
+ | 修复 | 说明 |
740
+ |------|------|
741
+ | **autoInstallSkill 创建 references/ junction** | 之前只复制文档文件(SKILL.md、config-reference.md 等),导致 SKILL.md 中引用的 `references/mcp/server.js`、`references/lib/core/`、`references/dashboard/` 等全部 404。改为创建 `references/` → 扩展目录的 junction link(Windows 不需管理员权限),所有运行时文件通过链接自动可用 |
742
+ | **package.json 安装** | 复制 `package.json` 到 skill 目录,解决源码模式下 `require('../../package.json')` 失败 |
743
+ | **junction 失败降级** | 极少数环境无法创建 junction 时,fallback 到只复制文档文件(与之前行为一致) |
744
+
737
745
  ### V4.8.1:MCP Server esbuild 单文件打包 ✅
738
746
 
739
747
  | 修复/增强 | 说明 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-guard",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
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",
@@ -1 +1 @@
1
- {"version":"4.8.1"}
1
+ {"version":"4.8.2"}
@@ -84,21 +84,41 @@ function autoInstallSkill(extRoot, homePath, dirName) {
84
84
  fs.copyFileSync(roadmapSrc, path.join(skillTarget, 'ROADMAP.md'));
85
85
  }
86
86
 
87
+ // Link references/ → extension directory so SKILL.md paths resolve correctly
88
+ // (mcp/server.js, lib/core/*, dashboard/, bin/ etc.)
87
89
  const refsTarget = path.join(skillTarget, 'references');
88
- fs.mkdirSync(refsTarget, { recursive: true });
90
+ if (!fs.existsSync(refsTarget)) {
91
+ try {
92
+ fs.symlinkSync(extRoot, refsTarget, 'junction');
93
+ actions.push('references/ linked');
94
+ } catch {
95
+ // junction failed (rare) — fall back to copying essential docs only
96
+ fs.mkdirSync(refsTarget, { recursive: true });
97
+ _copyDocFiles(skillSrc, refsTarget);
98
+ }
99
+ }
89
100
 
90
- const configRef = path.join(skillSrc, 'config-reference.md');
91
- if (fs.existsSync(configRef)) fs.copyFileSync(configRef, path.join(refsTarget, 'config-reference.md'));
92
- const configRefCn = path.join(skillSrc, 'config-reference.zh-CN.md');
93
- if (fs.existsSync(configRefCn)) fs.copyFileSync(configRefCn, path.join(refsTarget, 'config-reference.zh-CN.md'));
94
- const recoveryMd = path.join(skillSrc, 'recovery.md');
95
- if (fs.existsSync(recoveryMd)) fs.copyFileSync(recoveryMd, path.join(refsTarget, 'recovery.md'));
96
- const schemaSrc = path.join(skillSrc, 'cursor-guard.schema.json');
97
- if (fs.existsSync(schemaSrc)) fs.copyFileSync(schemaSrc, path.join(refsTarget, 'cursor-guard.schema.json'));
101
+ // Copy package.json so `require('../../package.json')` in source mode works
102
+ const pkgSrc = path.join(extRoot, '..', '..', 'package.json');
103
+ const pkgDst = path.join(skillTarget, 'package.json');
104
+ if (fs.existsSync(pkgSrc) && !fs.existsSync(pkgDst)) {
105
+ fs.copyFileSync(pkgSrc, pkgDst);
106
+ }
98
107
 
99
108
  return actions;
100
109
  }
101
110
 
111
+ function _copyDocFiles(skillSrc, refsTarget) {
112
+ const docs = [
113
+ 'config-reference.md', 'config-reference.zh-CN.md',
114
+ 'recovery.md', 'cursor-guard.schema.json', 'cursor-guard.example.json',
115
+ ];
116
+ for (const f of docs) {
117
+ const src = path.join(skillSrc, f);
118
+ if (fs.existsSync(src)) fs.copyFileSync(src, path.join(refsTarget, f));
119
+ }
120
+ }
121
+
102
122
  function autoRegisterMcp(extRoot, homePath, wsRoot) {
103
123
  const actions = [];
104
124
  const mcpServerPath = path.join(extRoot, 'mcp', 'server.js');
@@ -35568,7 +35568,7 @@ var require_package = __commonJS({
35568
35568
  "package.json"(exports2, module2) {
35569
35569
  module2.exports = {
35570
35570
  name: "cursor-guard",
35571
- version: "4.8.1",
35571
+ version: "4.8.2",
35572
35572
  description: "Protects code from accidental AI overwrite or deletion in Cursor IDE \u2014 mandatory pre-write snapshots, review-before-apply, local Git safety net, and deterministic recovery. | \u4FDD\u62A4\u4EE3\u7801\u514D\u53D7 Cursor AI \u4EE3\u7406\u610F\u5916\u8986\u5199\u6216\u5220\u9664\u2014\u2014\u5F3A\u5236\u5199\u524D\u5FEB\u7167\u3001\u9884\u89C8\u518D\u6267\u884C\u3001\u672C\u5730 Git \u5B89\u5168\u7F51\u3001\u786E\u5B9A\u6027\u6062\u590D\u3002",
35573
35573
  keywords: [
35574
35574
  "cursor",
@@ -2,7 +2,7 @@
2
2
  "name": "cursor-guard-ide",
3
3
  "displayName": "Cursor Guard",
4
4
  "description": "AI code protection dashboard embedded in your IDE — real-time alerts, backup history, one-click snapshots",
5
- "version": "4.8.1",
5
+ "version": "4.8.2",
6
6
  "publisher": "zhangqiang8vipp",
7
7
  "license": "BUSL-1.1",
8
8
  "engines": {
@@ -3,8 +3,8 @@
3
3
  > 本文档描述 cursor-guard 从 V2 到 V7 的长期演进方向。
4
4
  > 每一代向下兼容,低版本功能永远不废弃。
5
5
  >
6
- > **当前版本**:`V4.8.1`
7
- > **文档状态**:`V2` ~ `V4.8.1` 已完成交付(含 V5 intent/audit 基础),`V5` 主体规划中
6
+ > **当前版本**:`V4.8.2`
7
+ > **文档状态**:`V2` ~ `V4.8.2` 已完成交付(含 V5 intent/audit 基础),`V5` 主体规划中
8
8
 
9
9
  ## 阅读导航
10
10
 
@@ -734,6 +734,14 @@ V4 经过 4 轮系统性代码审查,修复了以下关键问题:
734
734
  }
735
735
  ```
736
736
 
737
+ ### V4.8.2:Skill 目录运行时完整安装 ✅
738
+
739
+ | 修复 | 说明 |
740
+ |------|------|
741
+ | **autoInstallSkill 创建 references/ junction** | 之前只复制文档文件(SKILL.md、config-reference.md 等),导致 SKILL.md 中引用的 `references/mcp/server.js`、`references/lib/core/`、`references/dashboard/` 等全部 404。改为创建 `references/` → 扩展目录的 junction link(Windows 不需管理员权限),所有运行时文件通过链接自动可用 |
742
+ | **package.json 安装** | 复制 `package.json` 到 skill 目录,解决源码模式下 `require('../../package.json')` 失败 |
743
+ | **junction 失败降级** | 极少数环境无法创建 junction 时,fallback 到只复制文档文件(与之前行为一致) |
744
+
737
745
  ### V4.8.1:MCP Server esbuild 单文件打包 ✅
738
746
 
739
747
  | 修复/增强 | 说明 |
@@ -84,21 +84,41 @@ function autoInstallSkill(extRoot, homePath, dirName) {
84
84
  fs.copyFileSync(roadmapSrc, path.join(skillTarget, 'ROADMAP.md'));
85
85
  }
86
86
 
87
+ // Link references/ → extension directory so SKILL.md paths resolve correctly
88
+ // (mcp/server.js, lib/core/*, dashboard/, bin/ etc.)
87
89
  const refsTarget = path.join(skillTarget, 'references');
88
- fs.mkdirSync(refsTarget, { recursive: true });
90
+ if (!fs.existsSync(refsTarget)) {
91
+ try {
92
+ fs.symlinkSync(extRoot, refsTarget, 'junction');
93
+ actions.push('references/ linked');
94
+ } catch {
95
+ // junction failed (rare) — fall back to copying essential docs only
96
+ fs.mkdirSync(refsTarget, { recursive: true });
97
+ _copyDocFiles(skillSrc, refsTarget);
98
+ }
99
+ }
89
100
 
90
- const configRef = path.join(skillSrc, 'config-reference.md');
91
- if (fs.existsSync(configRef)) fs.copyFileSync(configRef, path.join(refsTarget, 'config-reference.md'));
92
- const configRefCn = path.join(skillSrc, 'config-reference.zh-CN.md');
93
- if (fs.existsSync(configRefCn)) fs.copyFileSync(configRefCn, path.join(refsTarget, 'config-reference.zh-CN.md'));
94
- const recoveryMd = path.join(skillSrc, 'recovery.md');
95
- if (fs.existsSync(recoveryMd)) fs.copyFileSync(recoveryMd, path.join(refsTarget, 'recovery.md'));
96
- const schemaSrc = path.join(skillSrc, 'cursor-guard.schema.json');
97
- if (fs.existsSync(schemaSrc)) fs.copyFileSync(schemaSrc, path.join(refsTarget, 'cursor-guard.schema.json'));
101
+ // Copy package.json so `require('../../package.json')` in source mode works
102
+ const pkgSrc = path.join(extRoot, '..', '..', 'package.json');
103
+ const pkgDst = path.join(skillTarget, 'package.json');
104
+ if (fs.existsSync(pkgSrc) && !fs.existsSync(pkgDst)) {
105
+ fs.copyFileSync(pkgSrc, pkgDst);
106
+ }
98
107
 
99
108
  return actions;
100
109
  }
101
110
 
111
+ function _copyDocFiles(skillSrc, refsTarget) {
112
+ const docs = [
113
+ 'config-reference.md', 'config-reference.zh-CN.md',
114
+ 'recovery.md', 'cursor-guard.schema.json', 'cursor-guard.example.json',
115
+ ];
116
+ for (const f of docs) {
117
+ const src = path.join(skillSrc, f);
118
+ if (fs.existsSync(src)) fs.copyFileSync(src, path.join(refsTarget, f));
119
+ }
120
+ }
121
+
102
122
  function autoRegisterMcp(extRoot, homePath, wsRoot) {
103
123
  const actions = [];
104
124
  const mcpServerPath = path.join(extRoot, 'mcp', 'server.js');
@@ -2,7 +2,7 @@
2
2
  "name": "cursor-guard-ide",
3
3
  "displayName": "Cursor Guard",
4
4
  "description": "AI code protection dashboard embedded in your IDE — real-time alerts, backup history, one-click snapshots",
5
- "version": "4.8.1",
5
+ "version": "4.8.2",
6
6
  "publisher": "zhangqiang8vipp",
7
7
  "license": "BUSL-1.1",
8
8
  "engines": {