Files
Local-Cursor/docs/architecture.md
FuDie0915 db73cf5a39 chore: import Local-Cursor v1.1.8 source snapshot
Includes the current working directory changes. Historical commits and release binaries are excluded to limit Gitea storage.
Source base: d7515973fbfd6dd2001fa156c483455b8081c7cb
2026-11-10 01:24:28 +08:00

44 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 项目结构说明
## 目录布局
```
Local-Curosr/
├── cmd/ # 独立可执行工具入口
│ └── ext-tool/ # proto 提取工具,从 Cursor 扩展源码生成 .proto 定义
├── internal/ # 内部业务包(不对外暴露)
│ ├── app/ # Wails 应用启动与生命周期
│ ├── appdata/ # 用户数据目录管理
│ ├── backend/ # 后端服务核心
│ │ ├── agent/ # Agent 引擎(模型适配、prompt 引擎、协议)
│ │ ├── forwarder/ # 请求转发与 AI 处理
│ │ ├── server/ # HTTP 路由、中间件、配置
│ │ └── host.go # 后端宿主,管理 HTTP/HTTPS 监听器
│ ├── bridge/ # Wails 前端桥接层
│ ├── buildinfo/ # 构建版本信息
│ ├── certs/ # CA 证书管理
│ ├── client/ # 客户端服务(MITM 代理、CLI wrapper 生成)
│ ├── cursor/ # Cursor 宿主交互(代理设置、证书安装)
│ ├── historymetrics/ # 历史用量指标
│ ├── logger/ # 日志
│ ├── mitm/ # MITM 代理服务
│ ├── modelchannel/ # 模型通道解析
│ ├── netproxy/ # 出站网络代理
│ ├── prompt/ # 静态 prompt 资产与加载
│ └── runtime/ # 运行时注入(auth token、账号信息)
├── proto/ # Protobuf 定义与扩展提取工具
├── scripts/ # 构建/发布辅助脚本
├── build/ # 平台构建配置与资源
├── cursor-tab-server/ # 独立子模块:Tab 补全服务
├── main.go # 主入口
├── go.mod # Go 模块定义
├── Taskfile.yml # 构建/发布任务
└── build/config.yml # Wails 构建配置
```
## 数据流
```
Cursor IDE → MITM(38081) → backend(39091) → 路由 → forwarder → agent/model → 上游模型
CLI agent → tls-bypass → HTTPS(39092) → 同一 backend mux → 同上
```