A comprehensive DevOps CLI toolkit with terminal UI
npm install ops-toolkitA comprehensive DevOps CLI toolkit with terminal UI built with Bun, TypeScript, and modern architecture.
- 🔍 系统监控 - 实时CPU、内存和磁盘使用情况
- 📋 日志管理 - 查看、搜索和分析日志
- 🚀 部署工具 - 轻松部署应用程序
- ⚙️ 系统管理 - 用户和服务管理
- 🎨 终端UI - 美观的终端界面
- 🏗️ 模块化架构 - 可扩展的插件系统
- 🛡️ 类型安全 - 完整的TypeScript支持
- 📊 结构化日志 - 多级别日志记录
- ⚡ 高性能 - 异步处理和优化
- 🔧 配置管理 - 灵活的配置系统
``bash全局安装
bun add -g ops-toolkit
🏃♂️ Quick Start
`bash
启动交互式UI
ops系统监控
ops monitor
ops monitor system # 系统资源
ops monitor processes # 进程监控
ops monitor network # 网络监控日志管理
ops logs # 交互式日志查看器
ops logs view # 查看特定日志文件
ops logs search # 搜索日志
ops logs tail # 跟踪日志文件部署工具
ops deploy # 交互式部署
ops deploy # 部署特定应用
ops deploy rollback # 回滚部署
ops deploy status # 检查部署状态系统管理
ops system # 系统管理菜单
ops system users # 用户管理
ops system services # 服务管理
ops system config # 配置管理
`Quick Start
`bash
Start the interactive UI
opsShow system monitoring
ops monitorView logs
ops logsDeploy application
ops deploySystem management
ops system
`Commands
$3
`bash
ops monitor # Show system monitoring dashboard
ops monitor system # System resources
ops monitor processes # Process monitoring
ops monitor network # Network monitoring
`$3
`bash
ops logs # Interactive log viewer
ops logs view # View specific log file
ops logs search # Search logs
ops logs tail # Tail log file
`$3
`bash
ops deploy # Interactive deployment
ops deploy # Deploy specific application
ops deploy rollback # Rollback deployment
ops deploy status # Check deployment status
`$3
`bash
ops system # System management menu
ops system users # User management
ops system services # Service management
ops system config # Configuration management
`🏗️ Architecture
Ops Toolkit 采用现代化的模块化架构设计:
`
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ CLI 入口层 │ │ CLI 核心层 │ │ 命令层 │
├─────────────────┤ ├──────────────────┤ ├─────────────────┤
│ bin/ops-toolkit │ -> │ CLI App │ -> │ Monitor Cmd │
│ src/index.ts │ │ CommandRegistry │ │ Logs Cmd │
│ │ │ CommandDiscovery│ │ Deploy Cmd │
└─────────────────┘ └──────────────────┘ │ System Cmd │
└─────────────────┘
│
┌─────────────────┐ ┌──────────────────┐ │
│ 工具层 │ │ 类型定义 │ │
├─────────────────┤ ├──────────────────┤ │
│ Logger │ │ Commands Types │ <-------------┘
│ ConfigManager │ │ UI Types │
│ ErrorHandler │ │ System Types │
│ SystemUtils │ │ │
└─────────────────┘ └──────────────────┘
`详细架构请参考 架构文档
💻 Development
`bash
克隆仓库
git clone https://github.com/liangshaojie/ops-toolkit.git
cd ops-toolkit安装依赖
bun install启动开发模式
bun run dev构建项目
bun run build运行测试
bun test代码检查
bun run lint自动修复
bun run lint:fix格式化代码
bun run format类型检查
bun run typecheck
`$3
详细的开发指南请参考 开发文档
$3
完整的API文档请参考 API文档
⚙️ Configuration
配置文件位于
~/.ops-toolkit/config.json:`json
{
"version": "1.2.0",
"environment": "development",
"monitor": {
"refreshInterval": 5000,
"showProcesses": true,
"maxProcesses": 20,
"enableRealTime": false
},
"logs": {
"defaultPath": "/var/log",
"maxLines": 1000,
"follow": false,
"level": 1,
"enableFileLogging": false,
"logDirectory": "~/.ops-toolkit/logs"
},
"deploy": {
"defaultEnv": "production",
"backupEnabled": true,
"confirmBeforeDeploy": true,
"rollbackEnabled": true,
"maxRetries": 3
},
"system": {
"showHiddenServices": false,
"cacheTimeout": 30000,
"enableNotifications": true
},
"ui": {
"theme": "default",
"animations": true,
"sound": false,
"language": "zh-CN"
}
}
`$3
`bash
开发模式
export NODE_ENV=development启用调试日志
export DEBUG=true自定义配置目录
export OPS_CONFIG_DIR=/path/to/config自定义日志级别
export OPS_LOG_LEVEL=debug
`Configuration
Configuration files are located in
~/.ops-toolkit/:`json
{
"monitor": {
"refreshInterval": 1000,
"showProcesses": true
},
"logs": {
"defaultPath": "/var/log",
"maxLines": 1000
},
"deploy": {
"defaultEnv": "production",
"backupEnabled": true
}
}
`🤝 Contributing
我们欢迎所有形式的贡献!请阅读 开发指南 了解详细的贡献流程。
$3
1. Fork 仓库
2. 创建功能分支 (
git checkout -b feature/amazing-feature)
3. 提交更改 (git commit -m 'feat: add amazing feature')
4. 推送到分支 (git push origin feature/amazing-feature)
5. 创建 Pull Request$3
遵循 Conventional Commits 规范:
-
feat: 新功能
- fix: 修复bug
- refactor: 重构代码
- docs: 文档更新
- style: 代码格式化
- test: 测试相关
- chore: 构建/工具相关$3
在提交前请确保:
- [ ] 所有测试通过 (
bun test)
- [ ] 类型检查无错误 (bun run typecheck)
- [ ] 代码检查通过 (bun run lint`)- [x] 模块化架构重构
- [x] TypeScript 类型安全
- [x] 统一错误处理
- [x] 结构化日志系统
- [x] 配置管理系统
- [x] 命令注册和发现机制
- [x] 系统监控基础功能
- [x] 完整的开发工具链
- [ ] 终端UI界面 (OpenTUI集成)
- [ ] 日志管理功能
- [ ] 部署工具实现
- [ ] 系统管理功能
- [ ] 插件系统
- [ ] 配置验证器
- [ ] 性能监控仪表板
- [ ] 自动化部署流水线
- [ ] 容器管理支持
- [ ] 云平台集成
- [ ] 多语言支持
- [ ] 团队协作功能
- 代码行数: ~2000+
- TypeScript 覆盖率: 100%
- 测试覆盖率: 进行中
- 文档覆盖率: 95%
- 构建时间: < 5s
- 启动时间: < 100ms
- Bun - 高性能 JavaScript 运行时
- OpenTUI - 终端UI框架
- Commander.js - CLI 框架
- Chalk - 终端颜色库
- 受现代 DevOps 工具启发
- 📧 邮箱: support@ops-toolkit.dev
- 💬 讨论: GitHub Discussions
- 🐛 问题报告: GitHub Issues
- 📖 文档: 文档中心
本项目基于 MIT 许可证 - 详见 LICENSE 文件
---
⭐ Star • 🍴 Fork • 📥 Download
Made with ❤️ by the Ops Toolkit Team