@srgay/cursor-extension 1.0.6 → 1.0.7
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 +4 -0
- package/package.json +1 -1
- package/src/mcp-followup/cursor-mcp-followup.js +25 -4
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
2. **MCP Follow-up 面板**:在 Cursor 聊天框上方注入一个 MCP 反馈面板,连接 `mcp-feedback-enhanced` 的 WebSocket,让你直接在 Cursor 里回复 `interactive_feedback`,支持端口自动扫描/自定义,并能按当前窗口自动匹配对应端口(多窗口、多端口同时在线时也不误连)。
|
|
7
7
|
3. **输入法回车修复**:修复用中文输入法(拼音/注音等)组字时,按回车上屏候选词会被 Cursor 误当成「提交」的问题(含自带的 AskQuestion「Other」输入框)。
|
|
8
8
|
|
|
9
|
+
## 致谢
|
|
10
|
+
|
|
11
|
+
感谢 [LINUX DO](https://linux.do) 社区的交流氛围与灵感支持。
|
|
12
|
+
|
|
9
13
|
## 安装与使用(npx)
|
|
10
14
|
|
|
11
15
|
无需克隆仓库,直接用 `npx` 运行(需 Node.js ≥ 20):
|
package/package.json
CHANGED
|
@@ -748,6 +748,23 @@
|
|
|
748
748
|
return hit ? String(hit.port) : null;
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
+
// 端口对应窗口的「真实工作区名」:取自 Cursor 注入到该端口 MCP 服务进程的 WORKSPACE_FOLDER_PATHS
|
|
752
|
+
// (多根工作区取第一个),次选 CURSOR_WORKSPACE_LABEL。两者均来自 env、不受 AI 传入的
|
|
753
|
+
// project_directory 影响,是判断「端口属于哪个窗口/项目」最可信的来源;取不到时返回空串。
|
|
754
|
+
function portWorkspaceName(port) {
|
|
755
|
+
const key = String(port);
|
|
756
|
+
const folders = state.portWorkspaces[key];
|
|
757
|
+
if (folders) {
|
|
758
|
+
const first = String(folders)
|
|
759
|
+
.split(/[:;,\n]/)
|
|
760
|
+
.map((s) => s.trim())
|
|
761
|
+
.filter(Boolean)[0];
|
|
762
|
+
const name = basename(first);
|
|
763
|
+
if (name) return name;
|
|
764
|
+
}
|
|
765
|
+
return state.portLabels[key] || "";
|
|
766
|
+
}
|
|
767
|
+
|
|
751
768
|
// 选项文本:Port {port}[ · 状态][ · 项目名](状态在前、项目在后)。
|
|
752
769
|
// 下拉展开时所有项都带「状态 · 项目名」,便于按项目/状态区分端口;
|
|
753
770
|
// 收起时框里显示的是「选中项」,为避免与右侧项目名重复,选中项收起时不带项目名。
|
|
@@ -755,7 +772,8 @@
|
|
|
755
772
|
let text = "Port " + port;
|
|
756
773
|
if (status) text += " · " + status;
|
|
757
774
|
if (withProject) {
|
|
758
|
-
|
|
775
|
+
// 项目名优先用 env 的真实工作区名(WORKSPACE_FOLDER_PATHS),取不到才回退 AI 会话的 project_directory。
|
|
776
|
+
const project = portWorkspaceName(port) || state.portProjects[String(port)];
|
|
759
777
|
if (project) text += " · " + project;
|
|
760
778
|
}
|
|
761
779
|
return text;
|
|
@@ -874,14 +892,17 @@
|
|
|
874
892
|
}
|
|
875
893
|
|
|
876
894
|
function sessionTitle(data) {
|
|
877
|
-
|
|
895
|
+
// env 的真实工作区名最可信;取不到才回退 AI 会话的 project_directory。
|
|
896
|
+
const name = portWorkspaceName(state.socketPort) || basename(data && data.project_directory);
|
|
878
897
|
return name ? " · " + name : "";
|
|
879
898
|
}
|
|
880
899
|
|
|
881
900
|
function updateProjectName(data) {
|
|
901
|
+
// 头部项目名同样以 env 的真实工作区为主、AI 会话 project_directory 兜底(连不上 env 时仍有显示)。
|
|
902
|
+
const envName = portWorkspaceName(state.socketPort);
|
|
882
903
|
const dir = data && data.project_directory ? data.project_directory : "";
|
|
883
|
-
els.projectName.textContent = basename(dir) || "No project";
|
|
884
|
-
els.projectName.title = dir || "";
|
|
904
|
+
els.projectName.textContent = envName || basename(dir) || "No project";
|
|
905
|
+
els.projectName.title = state.portWorkspaces[String(state.socketPort)] || dir || "";
|
|
885
906
|
}
|
|
886
907
|
|
|
887
908
|
function setVisualState(stateName, message) {
|