Skip to content

Commit 8cd0570

Browse files
refactor: move main entry point to cmd/k8s-wizard
Move main.go from api/ to cmd/k8s-wizard/ following Go project structure conventions. Optimize code with better separation of concerns and cleaner function organization. Ultraworked with [Sisyphus](https://github.com/code-yeonggu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent ff62b64 commit 8cd0570

File tree

3 files changed

+200
-215
lines changed

3 files changed

+200
-215
lines changed

Makefile

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
# Makefile for K8s Wizard (Unified)
1+
# Makefile for K8s Wizard
22

3-
.PHONY: all dev dev:api dev:web build build:api build:web clean install
3+
.PHONY: all dev dev_api dev_web build build_api build_web clean install run test fmt lint
44

5-
# 默认目标
5+
# Default target
66
all: build
77

8-
# 安装依赖
8+
# Install dependencies
99
install:
1010
cd web && npm install 2>/dev/null || echo "Node not installed, skipping web deps"
1111
go mod download
1212
go mod tidy
1313

14-
# 开发模式(同时启动前后端)
14+
# Development mode (start both frontend and backend)
1515
dev: install
16-
@echo "🚀 Starting dev servers..."
17-
@make dev:api &
18-
@make dev:web
16+
@echo "Starting dev servers..."
17+
@make dev_api &
18+
@make dev_web
1919

20-
# 开发 API
21-
dev:api:
22-
@echo "📡 Starting API server on :8080..."
23-
@go run api/main.go
20+
# Development API
21+
dev_api:
22+
@echo "Starting API server on :8080..."
23+
@go run ./cmd/k8s-wizard
2424

25-
# 开发 Web
26-
dev:web:
27-
@echo "🎨 Starting web server on :5173..."
25+
# Development Web
26+
dev_web:
27+
@echo "Starting web server on :5173..."
2828
@cd web && npm run dev 2>/dev/null || echo "Node not installed"
2929

30-
# 构建
31-
build: build:api build:web
30+
# Build
31+
build: build_api build_web
3232

33-
# 构建 API
34-
build:api:
35-
@echo "🔨 Building API..."
36-
@go build -o bin/k8s-wizard-api ./api
37-
@echo "API built to bin/k8s-wizard-api"
33+
# Build API
34+
build_api:
35+
@echo "Building API..."
36+
@go build -o bin/k8s-wizard ./cmd/k8s-wizard
37+
@echo "API built to bin/k8s-wizard"
3838

39-
# 构建 Web
40-
build:web:
41-
@echo "🔨 Building Web..."
39+
# Build Web
40+
build_web:
41+
@echo "Building Web..."
4242
@cd web && npm run build 2>/dev/null || echo "Skipping web build (Node not installed)"
43-
@echo "Web built to web/dist/"
43+
@echo "Web built to web/dist/"
4444

45-
# 运行
46-
run: build:api
47-
@echo "🚀 Running K8s Wizard..."
48-
@./bin/k8s-wizard-api
45+
# Run
46+
run: build_api
47+
@echo "Running K8s Wizard..."
48+
@./bin/k8s-wizard
4949

50-
# 清理
50+
# Clean
5151
clean:
5252
rm -rf bin/
5353
rm -rf web/dist/
5454
rm -rf web/node_modules/
55-
@echo "Cleaned build artifacts"
55+
@echo "Cleaned build artifacts"
5656

57-
# 测试
57+
# Test
5858
test:
5959
go test ./...
6060
@cd web && npm test 2>/dev/null || echo "Skipping web tests"
6161

62-
# 格式化
62+
# Format
6363
fmt:
6464
go fmt ./...
6565
@cd web && npm run format 2>/dev/null || echo "Skipping format"
6666

67-
# 代码检查
67+
# Lint
6868
lint:
6969
go vet ./...
7070
@cd web && npm run lint 2>/dev/null || echo "Skipping lint"

api/main.go

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)