opencode-cursor-agent/refactor.md

2.1 KiB
Raw Permalink Blame History

.
├── build/                   # [Infrastructure] 存放 Dockerfile 與建置相關腳本
├── docker-compose.yml       # [Infrastructure] 本地開發環境編排 (Mongo, Redis, etc.)
├── etc/                     # [Configuration] 存放各環境的 yaml 設定檔範本
├── generate/                # [Contract] Interface First 定義區
│   └── api/                 # 存放 .api 原始定義,作為服務間的通訊契約
│   └── database/            # 如果有必要請幫我放建立db 的檔案
├── internal/                # [Framework Layer] 強依賴 go-zero 框架的實作區
│   ├── config/              # 框架層的 Config mapping
│   ├── logic/               # Adapter: 負責將框架 Request 轉接至 pkg/usecase
│   ├── server/              # Transport: gRPC/HTTP Server 實作 (僅處理協議)
│   └── svc/                 # DI Center: 依賴注入中心,管理全域 Resource (DB, Client)
├── pkg/                     # [Core Domain] 核心業務邏輯 (不依賴 go-zero 框架)
│   ├── domain/              # <Domain Layer> 
│   │   ├── entity/          # 純粹的業務物件 (POJO/POCO),不含資料庫標籤
│   │   ├── repository/      # Repository Interface: 定義資料存取規範 (DIP)
│   │   ├── const/           # 常數
│   │   └── usecase/         # Usecase Interface: 定義業務功能的 API 契約
│   ├── repository/          # <Infrastructure Layer> 
│   │   ├── *_test.go        # 使用 Testcontainers (Real DB) 進行整合測試
│   │   └── *.go             # 實作 domain/repository 接口 (MongoDB/Redis)
│   └── usecase/             # <Application Layer> 
│       ├── *_test.go        # 核心業務邏輯的 Unit Test (使用 Mock)
│       └── *.go             # 實作業務流程,協調 Repository 與 Utils
├── Makefile                 # [Automation] 封裝 protoc, test, build 等常用指令
├── go.mod                   # [Dependency]
└── main.go                  # [Entry] 服務啟動進入點