Skip to content

Commit 07860f2

Browse files
committed
Feat/manager (#20)\n\n* chore: quick update feat/manager at 2026-01-21 22:56:12\n\n* chore: quick update feat/manager at 2026-01-21 23:01:56
1 parent a8e3fba commit 07860f2

25 files changed

Lines changed: 5007 additions & 121 deletions

.version/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.29
1+
v0.1.0

README.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
- ⚙️ **Configuration-driven** - YAML-based project configuration
1818
- 📊 **Progress Display** - Visual progress bars and detailed error messages
1919
- 🗑️ **Cache Management** - Clean and manage dependency cache
20+
- 🌐 **Web UI** - Visual configuration editor with proto file browser
21+
- 🏥 **Environment Check** - Doctor command to diagnose development environment
22+
- 🎯 **Project Initialization** - Quick project setup with templates
2023

2124
## Installation
2225

@@ -71,8 +74,14 @@ protobuild gen
7174
| `format -w` | Format and write changes to files |
7275
| `format --diff` | Show diff of formatting changes |
7376
| `format --builtin` | Use builtin formatter instead of buf |
77+
| `web` | Start web-based configuration UI |
78+
| `web --port 9090` | Start web UI on custom port |
7479
| `clean` | Clean dependency cache |
7580
| `clean --dry-run` | Show what would be cleaned without deleting |
81+
| `init` | Initialize a new protobuild project |
82+
| `init --template grpc` | Initialize with specific template (basic, grpc, minimal) |
83+
| `doctor` | Check development environment and dependencies |
84+
| `doctor --fix` | Auto-install missing Go plugins |
7685
| `version` | Show version information |
7786

7887
## Configuration
@@ -238,6 +247,69 @@ protobuild format --builtin
238247
protobuild format -w proto/ api/
239248
```
240249

250+
### Web Configuration UI
251+
252+
```bash
253+
# Start web UI on default port (8080)
254+
protobuild web
255+
256+
# Start web UI on custom port
257+
protobuild web --port 9090
258+
```
259+
260+
The web interface provides:
261+
- 📝 Visual configuration editor
262+
- 📦 Dependency management
263+
- 🔌 Plugin configuration
264+
- 🚀 One-click build, lint, format operations
265+
- 📄 Real-time YAML preview
266+
- 📊 Project statistics dashboard
267+
- 🔍 Proto file browser with syntax highlighting
268+
- 📚 Configuration examples reference
269+
270+
### Initialize New Project
271+
272+
```bash
273+
# Interactive initialization
274+
protobuild init
275+
276+
# Use specific template
277+
protobuild init --template basic # Basic Go + gRPC project
278+
protobuild init --template grpc # Full gRPC-Gateway project
279+
protobuild init --template minimal # Minimal configuration
280+
281+
# Specify output directory
282+
protobuild init -o ./my-project
283+
```
284+
285+
### Check Development Environment
286+
287+
```bash
288+
# Diagnose environment issues
289+
protobuild doctor
290+
291+
# Auto-install missing Go plugins
292+
protobuild doctor --fix
293+
```
294+
295+
Example output:
296+
```
297+
🏥 Protobuild Doctor
298+
299+
Checking development environment...
300+
301+
✅ protoc installed (v25.1)
302+
✅ protoc-gen-go installed
303+
✅ protoc-gen-go-grpc installed
304+
✅ buf installed (v1.28.1)
305+
✅ api-linter installed
306+
✅ go installed (go1.21.5)
307+
✅ Configuration protobuf.yaml found
308+
⚠️ Vendor directory not found (run 'protobuild vendor')
309+
310+
✅ Environment check passed!
311+
```
312+
241313
### Force Vendor Update
242314

243315
```bash
@@ -339,7 +411,11 @@ protobuild
339411
│ │ └── yaml_types.go # YAML type definitions
340412
│ ├── format/ # Proto file formatting (builtin)
341413
│ ├── formatcmd/ # Format command (buf integration)
342-
│ └── linters/ # AIP linting rules
414+
│ ├── linters/ # AIP linting rules
415+
│ └── webcmd/ # Web configuration UI
416+
│ ├── cmd.go # Web command entry
417+
│ ├── server.go # HTTP server and API
418+
│ └── templates/ # HTML templates (Alpine.js + Tailwind)
343419
└── internal/
344420
├── depresolver/ # Multi-source dependency resolver
345421
├── modutil/ # Go module utilities
@@ -355,6 +431,20 @@ protobuild
355431
- [Multi-Source Dependencies](./docs/MULTI_SOURCE_DEPS.md) - Design document for multi-source dependency resolution
356432
- [Design Document](./docs/DESIGN.md) - Architecture and design documentation
357433
434+
## Roadmap
435+
436+
Upcoming features planned for future releases:
437+
438+
| Feature | Description | Status |
439+
|---------|-------------|--------|
440+
| 🔗 **Dependency Graph** | Visualize proto file import dependencies | Planned |
441+
| ⚠️ **Breaking Change Detection** | Detect incompatible changes between versions | Planned |
442+
| 📚 **API Documentation Generator** | Auto-generate Markdown/HTML docs from proto comments | Planned |
443+
| 🎭 **Mock Server** | Auto-start mock gRPC/HTTP server for testing | Planned |
444+
| 📝 **Proto Templates** | Quick generation of common proto patterns (CRUD, pagination) | Planned |
445+
| 📊 **Field Statistics** | Analyze field naming conventions and type distribution | Planned |
446+
| ✏️ **Online Editor** | Edit proto files directly in Web UI | Planned |
447+
358448
## License
359449
360450
[MIT License](LICENSE)

README_CN.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
- ⚙️ **配置驱动** - 基于 YAML 的项目配置
1818
- 📊 **进度显示** - 可视化进度条和详细错误信息
1919
- 🗑️ **缓存管理** - 清理和管理依赖缓存
20+
- 🌐 **Web 界面** - 可视化配置编辑器,支持 Proto 文件浏览
21+
- 🏥 **环境诊断** - Doctor 命令检查开发环境配置
22+
- 🎯 **项目初始化** - 快速项目设置,支持多种模板
2023

2124
## 安装
2225

@@ -72,8 +75,14 @@ protobuild gen
7275
| `format --diff` | 显示格式化差异 |
7376
| `format --exit-code` | 需要格式化时返回错误码(CI 适用)|
7477
| `format --builtin` | 使用内置格式化器 |
78+
| `web` | 启动 Web 配置管理界面 |
79+
| `web --port 9090` | 指定端口启动 Web 界面 |
7580
| `clean` | 清理依赖缓存 |
7681
| `clean --dry-run` | 预览将被清理的内容 |
82+
| `init` | 初始化新的 protobuild 项目 |
83+
| `init --template grpc` | 使用指定模板初始化(basic、grpc、minimal)|
84+
| `doctor` | 检查开发环境和依赖配置 |
85+
| `doctor --fix` | 自动安装缺失的 Go 插件 |
7786
| `version` | 显示版本信息 |
7887

7988
## 配置说明
@@ -239,6 +248,69 @@ protobuild format --builtin
239248
protobuild format -w proto/ api/
240249
```
241250

251+
### Web 配置管理界面
252+
253+
```bash
254+
# 在默认端口 (8080) 启动 Web 界面
255+
protobuild web
256+
257+
# 在指定端口启动 Web 界面
258+
protobuild web --port 9090
259+
```
260+
261+
Web 界面提供:
262+
- 📝 可视化配置编辑器
263+
- 📦 依赖管理
264+
- 🔌 插件配置
265+
- 🚀 一键执行构建、检查、格式化等操作
266+
- 📄 实时 YAML 配置预览
267+
- 📊 项目统计仪表盘
268+
- 🔍 Proto 文件浏览器(支持语法高亮)
269+
- 📚 配置示例参考
270+
271+
### 初始化新项目
272+
273+
```bash
274+
# 交互式初始化
275+
protobuild init
276+
277+
# 使用指定模板
278+
protobuild init --template basic # 基础 Go + gRPC 项目
279+
protobuild init --template grpc # 完整 gRPC-Gateway 项目
280+
protobuild init --template minimal # 最小化配置
281+
282+
# 指定输出目录
283+
protobuild init -o ./my-project
284+
```
285+
286+
### 检查开发环境
287+
288+
```bash
289+
# 诊断环境问题
290+
protobuild doctor
291+
292+
# 自动安装缺失的 Go 插件
293+
protobuild doctor --fix
294+
```
295+
296+
输出示例:
297+
```
298+
🏥 Protobuild Doctor
299+
300+
正在检查开发环境...
301+
302+
✅ protoc 已安装 (v25.1)
303+
✅ protoc-gen-go 已安装
304+
✅ protoc-gen-go-grpc 已安装
305+
✅ buf 已安装 (v1.28.1)
306+
✅ api-linter 已安装
307+
✅ go 已安装 (go1.21.5)
308+
✅ 配置文件 已找到 protobuf.yaml
309+
⚠️ Vendor 目录 未找到(请运行 'protobuild vendor')
310+
311+
✅ 环境检查通过!
312+
```
313+
242314
### 强制更新 Vendor
243315
244316
```bash
@@ -330,6 +402,20 @@ plugins:
330402
- [多源依赖设计](./docs/MULTI_SOURCE_DEPS.md) - 多源依赖解析设计文档
331403
- [设计文档](./docs/DESIGN_CN.md) - 架构和设计文档
332404
405+
## 路线图
406+
407+
以下是计划在未来版本中实现的功能:
408+
409+
| 功能 | 描述 | 状态 |
410+
|------|------|------|
411+
| 🔗 **依赖关系图** | 可视化 proto 文件的 import 依赖关系 | 计划中 |
412+
| ⚠️ **Breaking Change 检测** | 检测版本间的不兼容变更 | 计划中 |
413+
| 📚 **API 文档生成** | 从 proto 注释自动生成 Markdown/HTML 文档 | 计划中 |
414+
| 🎭 **Mock 服务器** | 自动启动用于测试的 mock gRPC/HTTP 服务器 | 计划中 |
415+
| 📝 **Proto 模板** | 快速生成常用 proto 模式(CRUD、分页等)| 计划中 |
416+
| 📊 **字段统计分析** | 分析字段命名规范和类型分布 | 计划中 |
417+
| ✏️ **在线编辑器** | 在 Web 界面直接编辑 proto 文件 | 计划中 |
418+
333419
## 项目架构
334420
335421
```
@@ -346,7 +432,11 @@ protobuild
346432
│ │ └── yaml_types.go # YAML 类型定义
347433
│ ├── format/ # Proto 文件格式化(内置)
348434
│ ├── formatcmd/ # 格式化命令(buf 集成)
349-
│ └── linters/ # AIP 检查规则
435+
│ ├── linters/ # AIP 检查规则
436+
│ └── webcmd/ # Web 配置管理界面
437+
│ ├── cmd.go # Web 命令入口
438+
│ ├── server.go # HTTP 服务器和 API
439+
│ └── templates/ # HTML 模板 (Alpine.js + Tailwind)
350440
└── internal/
351441
├── depresolver/ # 多源依赖解析器
352442
├── modutil/ # Go 模块工具

Taskfile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,7 @@ tasks:
128128
- task: lint
129129
- task: test
130130
- task: build
131+
web:
132+
desc: Run web server
133+
cmds:
134+
- go run -v *.go web

cmd/protobuild/cmd.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/pubgo/funk/running"
1818
"github.com/pubgo/protobuild/cmd/formatcmd"
1919
"github.com/pubgo/protobuild/cmd/linters"
20+
"github.com/pubgo/protobuild/cmd/webcmd"
2021
"github.com/pubgo/protobuild/internal/shutil"
2122
"github.com/pubgo/protobuild/internal/typex"
2223
"github.com/pubgo/redant"
@@ -72,13 +73,16 @@ func Main(ver string) *redant.Command {
7273
},
7374
Handler: handleStdinPlugin,
7475
Children: typex.Commands{
76+
newInitCommand(),
77+
newDoctorCommand(),
7578
newGenCommand(),
7679
newVendorCommand(&force, &update),
7780
newInstallCommand(&force),
7881
newLintCommand(cliArgs, options),
7982
newFormatCommand(),
8083
newDepsCommand(),
8184
newCleanCommand(&dryRun),
85+
webcmd.New(&protoCfg),
8286
newVersionCommand(),
8387
},
8488
}
@@ -201,7 +205,7 @@ func installPlugin(plg string, force bool) {
201205
slog.Error("command not found", slog.Any("name", plgName))
202206
}
203207

204-
if err == nil && !globalCfg.changed && !force {
208+
if err == nil && !globalCfg.Changed && !force {
205209
slog.Info("no changes", slog.Any("path", path))
206210
return
207211
}
@@ -256,7 +260,8 @@ func newLintCommand(cliArgs *linters.CliArgs, options typex.Options) *redant.Com
256260
}
257261

258262
includes := lo.Uniq(append(globalCfg.Includes, globalCfg.Vendor))
259-
if err := linters.Linter(cliArgs, globalCfg.Linter, includes, protoFiles); err != nil {
263+
linterCfg := toLinterConfig(globalCfg.Linter)
264+
if err := linters.Linter(cliArgs, linterCfg, includes, protoFiles); err != nil {
260265
return err
261266
}
262267
}

0 commit comments

Comments
 (0)