NewLife/NewLife.Studio

Detail
Zip
Compare
~ 笑笑 ~ authored at 2026-05-26 12:09:09
5eb3d11
docs Loading... Loading... 0001-01-01 08:05:00
src Loading... Loading... 0001-01-01 08:05:00
tests Loading... Loading... 0001-01-01 08:05:00
.gitignore Loading... Loading... 0001-01-01 08:05:00
AGENTS.md Loading... Loading... 0001-01-01 08:05:00
NewLife.Studio.slnx Loading... Loading... 0001-01-01 08:05:00
README.md Loading... Loading... 0001-01-01 08:05:00
README.md
# NewLife.Studio <p align="center"> <strong>NewLife 团队全产品工作室窗口</strong> </p> <p align="center"> <a href="#"><img src="https://img.shields.io/badge/.NET-9.0-512BD4?logo=dotnet" alt=".NET 9.0"></a> <a href="#"><img src="https://img.shields.io/badge/Avalonia-12.0.3-8B5CF6?logo=avalonia" alt="Avalonia 12.0.3"></a> <a href="#"><img src="https://img.shields.io/badge/tests-286%20passed-success" alt="286 tests passed"></a> <a href="#"><img src="https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-blue" alt="Platform"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License"></a> </p> --- ## 简介 **NewLife.Studio** 是 NewLife 团队生态的统一桌面管理工具。基于 Avalonia UI 构建,采用可插拔模块架构,将团队旗下所有开源产品(数据库管理、MQTT、消息队列、Redis、Stardust、Modbus 等)整合到单一窗口中,让开发者无需在多个工具间切换。 ### 产品矩阵 | 产品 | 定位 | Studio 模块 | |------|------|------------| | **XCode** | 大数据中间件,ORM + 分表分库 | DataStudio | | **NewLife.Redis** | Redis 高性能客户端 | RedisStudio | | **NewLife.MQTT** | MQTT 消息队列 | MqttStudio | | **NewLife.MQ** | 自研轻量消息队列 | MqStudio | | **Stardust** | 星尘分布式监控平台 | StardustConsole | | **NewLife.Modbus** | Modbus 工业协议 | ModbusStudio | --- ## 特性 - **模块化架构** — 通过 `IStudioModule` 接口实现插件式模块,零耦合接入 - **AI 助手集成** — 内置 OpenAI 兼容的 AI 对话面板,支持 Tool Calling(6 个内置数据库工具) - **数据库工作室** — SQL 编辑器、表浏览、元数据查看、结果导出(CSV/JSON/SQL) - **本地安全存储** — JSON 文件持久化,敏感信息 AES 加密(基于机器指纹) - **跨平台** — 基于 Avalonia UI,支持 Windows / Linux / macOS - **完善的测试** — 286 个单元测试,5 个测试项目全覆盖 --- ## 快速开始 ### 环境要求 - [.NET 9.0 SDK](https://dotnet.microsoft.com/download/dotnet/9.0) ### 构建与运行 ```bash # 克隆仓库 git clone https://github.com/NewLifeX/NewLife.Studio.git cd NewLife.Studio # 还原依赖 dotnet restore # 构建 dotnet build # 运行 dotnet run --project src/App/NewLife.Studio.App # 运行测试 dotnet test # 发布 (Windows x64) dotnet publish src/App/NewLife.Studio.App -c Release -r win-x64 --self-contained ``` --- ## 架构 ``` ┌──────────────────────────────────────────┐ │ App (Shell) │ │ ┌────────┬──────────────────┬─────────┐ │ │ │ NavBar │ ModuleHost │ AIPanel │ │ │ │ 48px │ (Content) │ 300px │ │ │ └────────┴──────────────────┴─────────┘ │ └──────────────────────────────────────────┘ │ ▲ ▼ │ ┌──────────────────────────────────────────┐ │ Modules (插件) │ │ DataStudio MqttStudio MqStudio ... │ └──────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────┐ │ Providers (能力提供者) │ │ Data AI (更多...) │ └──────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────┐ │ Framework (基础设施) │ │ Core Store AI │ └──────────────────────────────────────────┘ ``` **依赖方向**: `App → Modules → Providers → Framework`(严格单向) 详细架构说明见 [AGENTS.md](/NewLife/NewLife.Studio/Blob/master/AGENTS.md)。 --- ## 项目结构 ``` NewLife.Studio/ ├── src/ │ ├── Framework/ # 基础设施层 │ │ ├── NewLife.Studio.Core/ # 核心接口、服务定位器 │ │ ├── NewLife.Studio.Store/ # 本地存储 (JSON + AES) │ │ └── NewLife.Studio.AI/ # AI 引擎 + Tool Calling │ ├── Providers/ # 能力提供者 │ │ └── NewLife.Studio.Data/ # 数据库访问层 │ ├── App/ # 应用 Shell │ │ └── NewLife.Studio.App/ # 主窗口、导航、模块加载 │ └── Modules/ # 功能模块 (插件) │ └── DataStudio/ # 数据工作室 (MVP) ├── tests/ # 测试项目 │ ├── NewLife.Studio.Core.Tests/ (59 tests) │ ├── NewLife.Studio.Store.Tests/ (37 tests) │ ├── NewLife.Studio.Data.Tests/ (28 tests) │ ├── NewLife.Studio.AI.Tests/ (79 tests) │ └── NewLife.Studio.Modules.DataStudio.Tests/ (99 tests) ├── AGENTS.md # AI 快速上手指南 └── README.md # 本文件 ``` --- ## 技术栈 | 类别 | 技术 | 版本 | |------|------|------| | 运行时 | .NET | 9.0 | | UI 框架 | Avalonia UI | 12.0.3 | | MVVM | CommunityToolkit.Mvvm | 8.4.1 | | 依赖注入 | Microsoft.Extensions.DependencyInjection | 9.0 | | 测试框架 | xUnit + Moq | 2.9.3 / 4.20.72 | | 覆盖率 | coverlet.collector | 6.0.4 | | 数据库 (MVP) | Microsoft.Data.Sqlite | 9.0 | | AI 接口 | OpenAI-compatible API | - | | 序列化 | System.Text.Json | 9.0 | --- ## AI 助手 NewLife.Studio 内置 AI 对话面板,支持 OpenAI 兼容 API。AI 可以通过 Tool Calling 直接操作数据库: | 工具名称 | 功能 | |----------|------| | `connections.list` | 列出已保存的数据库连接 | | `db.open` | 打开指定数据库连接 | | `schema.tables` | 获取表列表 | | `schema.table` | 获取表结构详情 | | `query.select` | 执行只读 SQL 查询 | | `query.sample` | 获取表样本数据 | 所有 SQL 查询经过安全过滤,仅允许 `SELECT` / `PRAGMA` / `EXPLAIN` 语句。 --- ## 路线图 ### 当前阶段 (MVP) - [x] Shell 框架 (主窗口、导航栏、模块切换) - [x] 本地安全存储 - [x] SQLite 数据库管理 (连接、浏览、查询、导出) - [x] AI 助手面板 + Tool Calling - [x] 完整测试覆盖 (286 tests) ### 下一阶段 (模块扩展) - [ ] **MqttStudio** — MQTT 客户端管理、主题订阅、消息收发 - [ ] **MqStudio** — 消息队列管理、死信处理 - [ ] **RedisStudio** — Redis 数据浏览、命令执行 - [ ] **StardustConsole** — 星尘监控面板 - [ ] **ModbusStudio** — Modbus 设备连接、寄存器读写 ### 远期规划 - [ ] 更多 Data Provider (MySQL、PostgreSQL、SQL Server) - [ ] 数据可视化 (图表、仪表盘) - [ ] 插件市场 - [ ] 多语言国际化 --- ## 贡献 欢迎提交 Issue 和 Pull Request。 ### 开发约定 - 每个 `src/` 项目对应 `tests/` 下的同名测试项目 - 接口以 `I` 开头,异步方法以 `Async` 结尾 - 新增模块放在 `src/Modules/` 下,实现 `IStudioModule` 接口 - 新增 Provider 放在 `src/Providers/` 下 更多约定见 [AGENTS.md](/NewLife/NewLife.Studio/Blob/master/AGENTS.md)。 --- ## 相关链接 - [NewLife 团队](https://github.com/NewLifeX) - [XCode](https://github.com/NewLifeX/X) - [NewLife.Redis](https://github.com/NewLifeX/NewLife.Redis) - [Avalonia UI](https://avaloniaui.net/) --- ## 许可证 [MIT License](/NewLife/NewLife.Studio/Blob/master/LICENSE)