Files
pangolin/server/Makefile
T
wangjia 6e2657049e feat(proto): add agent.proto contract + buf toolchain (tsk_V9IrIk2g5Q78)
Introduces the frozen control-plane ↔ agent gRPC contract and the full
buf v2 code-generation pipeline that task #6/#14/#15 depend on.

Changes:
- server/proto/pangolin/agent/v1/agent.proto: AgentService with 6 RPCs
  (Enroll, Register, Heartbeat, Subscribe, Ack, ReportUsage) and all
  supporting message types (Command + 5 payload variants, ConfigSnapshot,
  CredentialEntry, NodeLoad, UsageItem).  Red-line comments prohibit
  user_id/email and destination-address fields per privacy policy.
- server/buf.yaml: v2 format, STANDARD lint + FILE breaking rules.
- server/buf.gen.yaml: remote protoc-gen-go v1.36.4 + protoc-gen-go-grpc
  v1.5.1 plugins, out=internal/pb, paths=source_relative.
- server/internal/pb/pangolin/agent/v1/: generated agent.pb.go +
  agent_grpc.pb.go committed to repo (CI diff-clean verified).
- server/Makefile: proto / proto-lint / proto-breaking targets added.
- server/tools.go: buf v1.70.0, protoc-gen-go, protoc-gen-go-grpc pinned.
- server/go.mod / go.sum: buf and grpc tool deps added via go mod tidy.

Acceptance verified:
  buf lint  → zero warnings
  buf generate × 2 → git diff clean (idempotent)
  go build ./... → passes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 12:13:43 +08:00

52 lines
2.9 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.PHONY: build test test-unit test-integration vet lint generate migrate-up migrate-down build-codegen deps proto proto-lint proto-breaking
# ── deps ───────────────────────────────────────────────────────────────────────
deps:
go mod tidy
go mod download
# ── build ──────────────────────────────────────────────────────────────────────
build:
go build ./...
build-codegen: ## 激活码批次生成 CLI
go build -o bin/codegen ./cmd/codegen
# ── test ───────────────────────────────────────────────────────────────────────
test:
go test ./...
test-unit: ## 单测(不依赖外部服务)
go test -count=1 -race ./internal/codes/... -run 'Test[^I][^n][^t]'
test-integration: ## 集成测试(需本机 dockertestcontainers
go test -count=1 ./internal/codes/... -run TestInt
# ── vet / lint ─────────────────────────────────────────────────────────────────
vet:
go vet ./...
lint:
golangci-lint run ./...
# ── generate ───────────────────────────────────────────────────────────────────
generate:
@echo "generate: not yet configured (see task 1d)"
# ── proto ──────────────────────────────────────────────────────────────────────
proto: ## 从 proto/ 生成 internal/pb/ 代码(buf generate
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 generate
proto-lint: ## 检查 proto 语法与命名规范(buf lint
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 lint
proto-breaking: ## 与 main 分支对比检测 breaking changebuf breaking
## 注:proto 首次合入 main 前,main 无 .proto 文件,此命令预期报"had no .proto files"
## proto 合入 main 后,后续所有变更须通过此检查,无报错视为通过。
go run github.com/bufbuild/buf/cmd/buf@v1.70.0 breaking --against '../.git#branch=main,subdir=server'
# ── migrate ────────────────────────────────────────────────────────────────────
migrate-up:
@echo "migrate-up: see cmd/migrate"
migrate-down:
@echo "migrate-down: see cmd/migrate"