-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/manager #20
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
Feat/manager #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,9 @@ | |
| - ⚙️ **Configuration-driven** - YAML-based project configuration | ||
| - 📊 **Progress Display** - Visual progress bars and detailed error messages | ||
| - 🗑️ **Cache Management** - Clean and manage dependency cache | ||
| - 🌐 **Web UI** - Visual configuration editor with proto file browser | ||
| - 🏥 **Environment Check** - Doctor command to diagnose development environment | ||
| - 🎯 **Project Initialization** - Quick project setup with templates | ||
|
|
||
| ## Installation | ||
|
|
||
|
|
@@ -71,8 +74,14 @@ protobuild gen | |
| | `format -w` | Format and write changes to files | | ||
| | `format --diff` | Show diff of formatting changes | | ||
| | `format --builtin` | Use builtin formatter instead of buf | | ||
| | `web` | Start web-based configuration UI | | ||
| | `web --port 9090` | Start web UI on custom port | | ||
| | `clean` | Clean dependency cache | | ||
| | `clean --dry-run` | Show what would be cleaned without deleting | | ||
| | `init` | Initialize a new protobuild project | | ||
| | `init --template grpc` | Initialize with specific template (basic, grpc, minimal) | | ||
| | `doctor` | Check development environment and dependencies | | ||
| | `doctor --fix` | Auto-install missing Go plugins | | ||
|
Comment on lines
+77
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| | `version` | Show version information | | ||
|
|
||
| ## Configuration | ||
|
|
@@ -238,6 +247,69 @@ protobuild format --builtin | |
| protobuild format -w proto/ api/ | ||
| ``` | ||
|
|
||
| ### Web Configuration UI | ||
|
|
||
| ```bash | ||
| # Start web UI on default port (8080) | ||
| protobuild web | ||
|
|
||
| # Start web UI on custom port | ||
| protobuild web --port 9090 | ||
| ``` | ||
|
|
||
| The web interface provides: | ||
| - 📝 Visual configuration editor | ||
| - 📦 Dependency management | ||
| - 🔌 Plugin configuration | ||
| - 🚀 One-click build, lint, format operations | ||
| - 📄 Real-time YAML preview | ||
| - 📊 Project statistics dashboard | ||
| - 🔍 Proto file browser with syntax highlighting | ||
| - 📚 Configuration examples reference | ||
|
|
||
| ### Initialize New Project | ||
|
|
||
| ```bash | ||
| # Interactive initialization | ||
| protobuild init | ||
|
|
||
| # Use specific template | ||
| protobuild init --template basic # Basic Go + gRPC project | ||
| protobuild init --template grpc # Full gRPC-Gateway project | ||
| protobuild init --template minimal # Minimal configuration | ||
|
|
||
| # Specify output directory | ||
| protobuild init -o ./my-project | ||
| ``` | ||
|
|
||
| ### Check Development Environment | ||
|
|
||
| ```bash | ||
| # Diagnose environment issues | ||
| protobuild doctor | ||
|
|
||
| # Auto-install missing Go plugins | ||
| protobuild doctor --fix | ||
| ``` | ||
|
|
||
| Example output: | ||
| ``` | ||
| 🏥 Protobuild Doctor | ||
|
|
||
| Checking development environment... | ||
|
|
||
| ✅ protoc installed (v25.1) | ||
| ✅ protoc-gen-go installed | ||
| ✅ protoc-gen-go-grpc installed | ||
| ✅ buf installed (v1.28.1) | ||
| ✅ api-linter installed | ||
| ✅ go installed (go1.21.5) | ||
| ✅ Configuration protobuf.yaml found | ||
| ⚠️ Vendor directory not found (run 'protobuild vendor') | ||
|
|
||
| ✅ Environment check passed! | ||
| ``` | ||
|
Comment on lines
+250
to
+311
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ### Force Vendor Update | ||
|
|
||
| ```bash | ||
|
|
@@ -339,7 +411,11 @@ protobuild | |
| │ │ └── yaml_types.go # YAML type definitions | ||
| │ ├── format/ # Proto file formatting (builtin) | ||
| │ ├── formatcmd/ # Format command (buf integration) | ||
| │ └── linters/ # AIP linting rules | ||
| │ ├── linters/ # AIP linting rules | ||
| │ └── webcmd/ # Web configuration UI | ||
| │ ├── cmd.go # Web command entry | ||
| │ ├── server.go # HTTP server and API | ||
| │ └── templates/ # HTML templates (Alpine.js + Tailwind) | ||
|
Comment on lines
+415
to
+418
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| └── internal/ | ||
| ├── depresolver/ # Multi-source dependency resolver | ||
| ├── modutil/ # Go module utilities | ||
|
|
@@ -355,6 +431,20 @@ protobuild | |
| - [Multi-Source Dependencies](./docs/MULTI_SOURCE_DEPS.md) - Design document for multi-source dependency resolution | ||
| - [Design Document](./docs/DESIGN.md) - Architecture and design documentation | ||
|
|
||
| ## Roadmap | ||
|
|
||
| Upcoming features planned for future releases: | ||
|
|
||
| | Feature | Description | Status | | ||
| |---------|-------------|--------| | ||
| | 🔗 **Dependency Graph** | Visualize proto file import dependencies | Planned | | ||
| | ⚠️ **Breaking Change Detection** | Detect incompatible changes between versions | Planned | | ||
| | 📚 **API Documentation Generator** | Auto-generate Markdown/HTML docs from proto comments | Planned | | ||
| | 🎭 **Mock Server** | Auto-start mock gRPC/HTTP server for testing | Planned | | ||
| | 📝 **Proto Templates** | Quick generation of common proto patterns (CRUD, pagination) | Planned | | ||
| | 📊 **Field Statistics** | Analyze field naming conventions and type distribution | Planned | | ||
| | ✏️ **Online Editor** | Edit proto files directly in Web UI | Planned | | ||
|
Comment on lines
+434
to
+446
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## License | ||
|
|
||
| [MIT License](LICENSE) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,9 @@ | |
| - ⚙️ **配置驱动** - 基于 YAML 的项目配置 | ||
| - 📊 **进度显示** - 可视化进度条和详细错误信息 | ||
| - 🗑️ **缓存管理** - 清理和管理依赖缓存 | ||
| - 🌐 **Web 界面** - 可视化配置编辑器,支持 Proto 文件浏览 | ||
| - 🏥 **环境诊断** - Doctor 命令检查开发环境配置 | ||
| - 🎯 **项目初始化** - 快速项目设置,支持多种模板 | ||
|
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## 安装 | ||
|
|
||
|
|
@@ -72,8 +75,14 @@ protobuild gen | |
| | `format --diff` | 显示格式化差异 | | ||
| | `format --exit-code` | 需要格式化时返回错误码(CI 适用)| | ||
| | `format --builtin` | 使用内置格式化器 | | ||
| | `web` | 启动 Web 配置管理界面 | | ||
| | `web --port 9090` | 指定端口启动 Web 界面 | | ||
| | `clean` | 清理依赖缓存 | | ||
| | `clean --dry-run` | 预览将被清理的内容 | | ||
| | `init` | 初始化新的 protobuild 项目 | | ||
| | `init --template grpc` | 使用指定模板初始化(basic、grpc、minimal)| | ||
| | `doctor` | 检查开发环境和依赖配置 | | ||
| | `doctor --fix` | 自动安装缺失的 Go 插件 | | ||
|
Comment on lines
+78
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| | `version` | 显示版本信息 | | ||
|
|
||
| ## 配置说明 | ||
|
|
@@ -239,6 +248,69 @@ protobuild format --builtin | |
| protobuild format -w proto/ api/ | ||
| ``` | ||
|
|
||
| ### Web 配置管理界面 | ||
|
|
||
| ```bash | ||
| # 在默认端口 (8080) 启动 Web 界面 | ||
| protobuild web | ||
|
|
||
| # 在指定端口启动 Web 界面 | ||
| protobuild web --port 9090 | ||
| ``` | ||
|
|
||
| Web 界面提供: | ||
| - 📝 可视化配置编辑器 | ||
| - 📦 依赖管理 | ||
| - 🔌 插件配置 | ||
| - 🚀 一键执行构建、检查、格式化等操作 | ||
| - 📄 实时 YAML 配置预览 | ||
| - 📊 项目统计仪表盘 | ||
| - 🔍 Proto 文件浏览器(支持语法高亮) | ||
| - 📚 配置示例参考 | ||
|
|
||
| ### 初始化新项目 | ||
|
|
||
| ```bash | ||
| # 交互式初始化 | ||
| protobuild init | ||
|
|
||
| # 使用指定模板 | ||
| protobuild init --template basic # 基础 Go + gRPC 项目 | ||
| protobuild init --template grpc # 完整 gRPC-Gateway 项目 | ||
| protobuild init --template minimal # 最小化配置 | ||
|
|
||
| # 指定输出目录 | ||
| protobuild init -o ./my-project | ||
| ``` | ||
|
|
||
| ### 检查开发环境 | ||
|
|
||
| ```bash | ||
| # 诊断环境问题 | ||
| protobuild doctor | ||
|
|
||
| # 自动安装缺失的 Go 插件 | ||
| protobuild doctor --fix | ||
| ``` | ||
|
|
||
| 输出示例: | ||
| ``` | ||
| 🏥 Protobuild Doctor | ||
|
|
||
| 正在检查开发环境... | ||
|
|
||
| ✅ protoc 已安装 (v25.1) | ||
| ✅ protoc-gen-go 已安装 | ||
| ✅ protoc-gen-go-grpc 已安装 | ||
| ✅ buf 已安装 (v1.28.1) | ||
| ✅ api-linter 已安装 | ||
| ✅ go 已安装 (go1.21.5) | ||
| ✅ 配置文件 已找到 protobuf.yaml | ||
| ⚠️ Vendor 目录 未找到(请运行 'protobuild vendor') | ||
|
|
||
| ✅ 环境检查通过! | ||
| ``` | ||
|
Comment on lines
+251
to
+312
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ### 强制更新 Vendor | ||
|
|
||
| ```bash | ||
|
|
@@ -330,6 +402,20 @@ plugins: | |
| - [多源依赖设计](./docs/MULTI_SOURCE_DEPS.md) - 多源依赖解析设计文档 | ||
| - [设计文档](./docs/DESIGN_CN.md) - 架构和设计文档 | ||
|
|
||
| ## 路线图 | ||
|
|
||
| 以下是计划在未来版本中实现的功能: | ||
|
|
||
| | 功能 | 描述 | 状态 | | ||
| |------|------|------| | ||
| | 🔗 **依赖关系图** | 可视化 proto 文件的 import 依赖关系 | 计划中 | | ||
| | ⚠️ **Breaking Change 检测** | 检测版本间的不兼容变更 | 计划中 | | ||
| | 📚 **API 文档生成** | 从 proto 注释自动生成 Markdown/HTML 文档 | 计划中 | | ||
| | 🎭 **Mock 服务器** | 自动启动用于测试的 mock gRPC/HTTP 服务器 | 计划中 | | ||
| | 📝 **Proto 模板** | 快速生成常用 proto 模式(CRUD、分页等)| 计划中 | | ||
| | 📊 **字段统计分析** | 分析字段命名规范和类型分布 | 计划中 | | ||
| | ✏️ **在线编辑器** | 在 Web 界面直接编辑 proto 文件 | 计划中 | | ||
|
Comment on lines
+405
to
+417
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## 项目架构 | ||
|
|
||
| ``` | ||
|
|
@@ -346,7 +432,11 @@ protobuild | |
| │ │ └── yaml_types.go # YAML 类型定义 | ||
| │ ├── format/ # Proto 文件格式化(内置) | ||
| │ ├── formatcmd/ # 格式化命令(buf 集成) | ||
| │ └── linters/ # AIP 检查规则 | ||
| │ ├── linters/ # AIP 检查规则 | ||
| │ └── webcmd/ # Web 配置管理界面 | ||
| │ ├── cmd.go # Web 命令入口 | ||
| │ ├── server.go # HTTP 服务器和 API | ||
| │ └── templates/ # HTML 模板 (Alpine.js + Tailwind) | ||
|
Comment on lines
+436
to
+439
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| └── internal/ | ||
| ├── depresolver/ # 多源依赖解析器 | ||
| ├── modutil/ # Go 模块工具 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,3 +128,7 @@ tasks: | |
| - task: lint | ||
| - task: test | ||
| - task: build | ||
| web: | ||
| desc: Run web server | ||
| cmds: | ||
| - go run -v *.go web | ||
|
Comment on lines
+131
to
+134
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ import ( | |
| "github.com/pubgo/funk/running" | ||
| "github.com/pubgo/protobuild/cmd/formatcmd" | ||
| "github.com/pubgo/protobuild/cmd/linters" | ||
| "github.com/pubgo/protobuild/cmd/webcmd" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "github.com/pubgo/protobuild/internal/shutil" | ||
| "github.com/pubgo/protobuild/internal/typex" | ||
| "github.com/pubgo/redant" | ||
|
|
@@ -72,13 +73,16 @@ func Main(ver string) *redant.Command { | |
| }, | ||
| Handler: handleStdinPlugin, | ||
| Children: typex.Commands{ | ||
| newInitCommand(), | ||
| newDoctorCommand(), | ||
|
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| newGenCommand(), | ||
| newVendorCommand(&force, &update), | ||
| newInstallCommand(&force), | ||
| newLintCommand(cliArgs, options), | ||
| newFormatCommand(), | ||
| newDepsCommand(), | ||
| newCleanCommand(&dryRun), | ||
| webcmd.New(&protoCfg), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| newVersionCommand(), | ||
| }, | ||
| } | ||
|
|
@@ -201,7 +205,7 @@ func installPlugin(plg string, force bool) { | |
| slog.Error("command not found", slog.Any("name", plgName)) | ||
| } | ||
|
|
||
| if err == nil && !globalCfg.changed && !force { | ||
| if err == nil && !globalCfg.Changed && !force { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| slog.Info("no changes", slog.Any("path", path)) | ||
| return | ||
| } | ||
|
|
@@ -256,7 +260,8 @@ func newLintCommand(cliArgs *linters.CliArgs, options typex.Options) *redant.Com | |
| } | ||
|
|
||
| includes := lo.Uniq(append(globalCfg.Includes, globalCfg.Vendor)) | ||
| if err := linters.Linter(cliArgs, globalCfg.Linter, includes, protoFiles); err != nil { | ||
| linterCfg := toLinterConfig(globalCfg.Linter) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if err := linters.Linter(cliArgs, linterCfg, includes, protoFiles); err != nil { | ||
| return err | ||
| } | ||
| } | ||
|
|
||
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.
These new features significantly enhance the tool's usability and completeness. The Web UI, environment check, and project initialization capabilities are valuable additions.