-
Notifications
You must be signed in to change notification settings - Fork 0
🎉 DotNetCampus Terminal 第一个预览版本 - AI 团队协作开发成果 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the legacy Walterlv.Terminal project and introduces a full preview of the DotNetCampus.Terminal application, including core modules for device management, file sync, UI views, and SSH key deployment.
- Removed the old
Walterlv.Terminalsample project and its manifest - Added the new
DotNetCampus.Terminalproject with views, viewmodels, utilities, and modules - Implemented core features: SSH device handling, file sync, key deployment, status bars, and terminal UI
Reviewed Changes
Copilot reviewed 152 out of 153 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Walterlv.Terminal/* | Removed old Avalonia-based sample project |
| src/DotNetCampus.Terminal/Views/*.axaml.cs and *.axaml | Added UI definitions and code-behind for the terminal UI |
| src/DotNetCampus.Terminal/ViewModels/*.cs | Added MVVM viewmodels for devices, sync, deploy, status |
| src/DotNetCampus.Terminal/Utils/*.cs | Added utility classes for network, shell operations |
| src/DotNetCampus.Terminal/Modules/SshManagement/*.cs | Added SSH key generation and deployment services |
| src/DotNetCampus.Terminal/Program.cs & Modules/Startup.cs | Configured new console-based Avalonia entry point and DI |
| // var toggleButton = (ToggleButton)sender!; | ||
| // var info = (IRemoteDeviceInfo)toggleButton.DataContext!; | ||
| // var isChecked = toggleButton.IsChecked is true; | ||
| // if (isChecked && !ViewModel.FavoriteDevices.Contains(deviceInfo)) | ||
| // { | ||
| // ViewModel.FavoriteDevices.Add(deviceInfo); | ||
| // } | ||
| // else if (!isChecked && ViewModel.FavoriteDevices.Contains(deviceInfo)) | ||
| // { | ||
| // ViewModel.FavoriteDevices.Remove(deviceInfo); | ||
| // } |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This block of commented-out code can be removed to reduce clutter and improve readability since it’s not currently used.
| // var toggleButton = (ToggleButton)sender!; | |
| // var info = (IRemoteDeviceInfo)toggleButton.DataContext!; | |
| // var isChecked = toggleButton.IsChecked is true; | |
| // if (isChecked && !ViewModel.FavoriteDevices.Contains(deviceInfo)) | |
| // { | |
| // ViewModel.FavoriteDevices.Add(deviceInfo); | |
| // } | |
| // else if (!isChecked && ViewModel.FavoriteDevices.Contains(deviceInfo)) | |
| // { | |
| // ViewModel.FavoriteDevices.Remove(deviceInfo); | |
| // } |
| DataContext is StatusBarViewModel viewModel) | ||
| { | ||
| // Tag格式: "F1,显示帮助文档和操作指南,True" | ||
| var parts = tag.Split(','); |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing the Tag string by comma is brittle if the description ever contains commas; consider using a structured attached property or a small helper class instead of parsing a delimited string.
| private static string BuildSshCommand(string host, int port, string userName, string? password) | ||
| { | ||
| var sshCmd = $"ssh {userName}@{host}"; | ||
|
|
||
| if (port != 22) | ||
| { | ||
| sshCmd += $" -p {port}"; | ||
| } | ||
|
|
||
| // 如果有密码,可以使用sshpass(Linux/macOS)或其他方式 | ||
| // 但为了安全起见,通常建议让用户手动输入密码 | ||
| Log.Info($"[Shell] 构建SSH命令: {sshCmd}"); | ||
|
|
||
| return sshCmd; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// 在新标签页中启动命令 | ||
| /// </summary> | ||
| private static async Task<bool> LaunchInNewTabAsync(TerminalType terminalType, string command) |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Injecting user-provided host or userName directly into a shell command can lead to command injection; consider using ProcessStartInfo.ArgumentList or validating/sanitizing inputs before building the command string.
| private static string BuildSshCommand(string host, int port, string userName, string? password) | |
| { | |
| var sshCmd = $"ssh {userName}@{host}"; | |
| if (port != 22) | |
| { | |
| sshCmd += $" -p {port}"; | |
| } | |
| // 如果有密码,可以使用sshpass(Linux/macOS)或其他方式 | |
| // 但为了安全起见,通常建议让用户手动输入密码 | |
| Log.Info($"[Shell] 构建SSH命令: {sshCmd}"); | |
| return sshCmd; | |
| } | |
| /// <summary> | |
| /// 在新标签页中启动命令 | |
| /// </summary> | |
| private static async Task<bool> LaunchInNewTabAsync(TerminalType terminalType, string command) | |
| private static List<string> BuildSshCommand(string host, int port, string userName, string? password) | |
| { | |
| var sshArgs = new List<string> { "ssh", $"{userName}@{host}" }; | |
| if (port != 22) | |
| { | |
| sshArgs.Add("-p"); | |
| sshArgs.Add(port.ToString()); | |
| } | |
| // 如果有密码,可以使用sshpass(Linux/macOS)或其他方式 | |
| // 但为了安全起见,通常建议让用户手动输入密码 | |
| Log.Info($"[Shell] 构建SSH命令: {string.Join(" ", sshArgs)}"); | |
| return sshArgs; | |
| } | |
| /// <summary> | |
| /// 在新标签页中启动命令 | |
| /// </summary> | |
| private static async Task<bool> LaunchInNewTabAsync(TerminalType terminalType, List<string> commandArgs) |
| public string Passphrase | ||
| { | ||
| get => _passphrase; | ||
| set => SetFieldTrackingChanges(ref _passphrase, value); |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing sensitive data like passphrases in a plain string may leave it in memory longer than necessary; consider using SecureString or clearing the variable immediately after use.
| public string Passphrase | |
| { | |
| get => _passphrase; | |
| set => SetFieldTrackingChanges(ref _passphrase, value); | |
| public SecureString Passphrase | |
| { | |
| get => _passphrase; | |
| set | |
| { | |
| if (_passphrase != null) | |
| { | |
| _passphrase.Dispose(); | |
| } | |
| _passphrase = value; | |
| OnPropertyChanged(nameof(Passphrase)); | |
| } |
| "id_ed25519", // Ed25519 (现代、安全) | ||
| "id_rsa", // RSA (广泛兼容) | ||
| "id_ecdsa", // ECDSA (椭圆曲线) | ||
| "id_dsa", // DSA (已废弃,但可能存在) |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] DSA keys (id_dsa) are considered weak and deprecated; it may be safer to remove or deprioritize this entry to discourage its use.
| "id_dsa", // DSA (已废弃,但可能存在) |
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
- 将 tags 触发条件简化为 '*' - 移除对特定tag格式的限制 - 现在任何tag都会触发自动化构建和发布
- 修复 macOS/Linux 打包时 devices.toml 等配置文件位置错误的问题
- 将 Unix 系统的 find + cp 方式改为 rsync 方式,保留文件夹结构
- 更新 DevOps 专家经验总结,记录跨平台文件夹结构保留的重要经验
问题原因:
- Windows PowerShell 的 Copy-Item -Recurse 会保留文件夹结构
- Unix 的 find ... -exec cp {} ... 只复制文件到目标根目录,丢失文件夹结构
解决方案:
- 使用 rsync -av --exclude='*.pdb' --exclude='*.dbg' --exclude='*.dsym' 保留文件夹结构
📋 概述
这是 DotNetCampus Terminal 项目的第一个预览版本,展示了基于 .NET 9.0 和 Consolonia 的远程设备连接管理工具的核心功能。本版本由 AI 团队协作开发完成,实现了多个关键模块的基础功能。
🚀 主要功能
1. 核心架构
2. 设备管理
3. 文件同步
4. 用户界面
5. SSH 连接管理
6. DevOps 自动化
🏗️ 技术亮点
增量同步优化
现代化 UI 设计
配置管理系统
高性能日志系统
🔧 技术栈
📈 性能改进
文件同步性能提升
内存和CPU优化
🎯 AI 协作开发模式
本项目采用了创新的 AI 多角色协作开发模式:
每个 AI 角色都有明确的职责分工和技术规范,确保了代码质量和项目的可维护性。
🧪 测试和质量保证
📦 构建和部署
本地构建
发布构建
🔮 未来计划
短期目标 (下个版本)
中期目标
长期目标
🎖️ 致谢
特别感谢 AI 团队的协作开发:
📋 变更日志
v0.1.0-preview (2025-07-10)
新功能
技术改进
开发体验
🔍 代码审查清单
🚨 注意事项
📞 反馈和支持
如果您在使用过程中遇到任何问题或有改进建议,请通过以下方式反馈:
这个 PR 代表了 AI 协作开发的一个重要里程碑,展示了现代软件开发的新可能性。我们期待您的反馈和建议! 🎯