使用说明
游标结构化DSL调试器
用于在Cursor IDE中调试Structurizr-DSL语法问题的专用工具。此工具使用模型上下文协议(MCP)与Cursor集成,提供实时StructurizrDSL错误检测、分析和修复建议。
特性
- 🔍 实时错误检测 -自动从Structureizr DSL文件中捕获语法错误
- 🛠️ 建议修复 -提供智能建议以纠正常见的DSL错误
- 🔄 浏览器集成 -使用Structurizer页面连接到Chrome以监控错误
- 🧩 游标IDE集成 -使用MCP工具与Cursor无缝集成
- ⚙️ 可配置的 -支持自定义Structurizr端口配置
- 📊 错误历史记录 -维护捕获的错误日志以供审查
需求
- Node.js 14+
- 光标IDE
- 启用远程调试的Google Chrome浏览器
- 本地运行的Structurizr-Lite(通常在端口8080上)
安装
-
克隆此存储库:
git clone https://github.com/your-username/structurizr-dsl-debugger.git cd structurizr-dsl-debugger -
安装依赖项:
npm install -
设置Cursor IDE集成:
npm run setup
用法
开始结构化
- 运行Structurizr-Lite(如果尚未运行):
docker run -it --rm -p 8080:8080 -v /path/to/workspace:/workspace structurizr/lite
使用调试器
-
在启用远程调试的情况下启动Chrome:
google-chrome --remote-debugging-port=9222 http://localhost:8080 -
启动DSL调试器:
# Standard start (default port 8080) npm start # With custom Structurizr port STRUCTURIZR_PORT=9090 npm start # Using the launcher with interactive prompts npm run debug -
在Cursor IDE中,使用MCP工具:
connectToBrowser: { "debugPort": 9222, "structurizrPort": 8080 } getDslErrors: { "count": 5 } clearDslErrors: {} fixDslError: { "line": 776, "fix": "dynamic ContainerName ErrorHandlingFlow {" }
简化版本
如果遇到主调试器的问题,请尝试简化版本:
node simplified-dsl-debugger.js
使用较短的MCP工具名称:
connect: { "port": 9222 }
errors: { "count": 5 }
fix: { "line": 776, "solution": "dynamic ContainerName ErrorHandlingFlow {" }
实用程序脚本
-
直接捕获错误:
npm run capture -
查看捕获的错误:
npm run errors
故障排除
Chrome连接问题
- 确保Chrome在端口9222上启用远程调试的情况下运行
- 检查Chrome是否已与
--remote-debugging-port旗帜 - 尝试使用以下命令重新启动Chrome:
google-chrome --remote-debugging-port=9222 http://localhost:8080
MCP工具问题
- 验证MCP服务器是否正在运行:
npm start - 尝试使用简化版本:
node simplified-dsl-debugger.js - 检查日志目录中捕获的错误
- 重新启动游标IDE
端口冲突
- Structurizer默认端口为8080
- 如果另一个应用程序正在使用端口8080,您可以:
- 更改Structurizr端口
- 更新调试器以使用新端口:
STRUCTURIZR_PORT=9090 npm start
许可证
麻省理工学院
