docs(agents): update AGENTS.md and development skills for cordis architecture

This commit is contained in:
ryan
2026-08-27 23:56:16 +08:00
parent 94c5aa4cd3
commit 75f226cfbf
12 changed files with 660 additions and 977 deletions
@@ -21,9 +21,9 @@ type createChannelResponse struct {
Name string `json:"name"`
}
// CreateChannel 示例:产品域 Handler(应放在 internal/apps/channel/routers.go)
// CreateChannel 示例:插件内 HTTP Handler(位于 plugins/domain/channel/handlers.go)
// @Summary 创建频道
// @Description 示例:语义路径下的业务接口,而非 /api/v1/custom/...
// @Description 示例:语义路径下的业务接口
// @Tags channel
// @Accept json
// @Produce json
@@ -39,7 +39,7 @@ func CreateChannel(c *gin.Context) {
return
}
// 通常结合 oauth.LoginRequired();此处仅演示从上下文取用户
// 从请求上下文中提取认证用户
userID := int64(9527)
result, err := CreateChannelLogic(c.Request.Context(), userID, req.Name)
@@ -12,13 +12,13 @@ import (
"go.uber.org/zap"
)
// channelCreated 示例 logics 返回值(真实代码可用 model 或专用 DTO)
// channelCreated 示例业务返回值(真实代码可用 model 或专用 DTO)
type channelCreated struct {
ID int64
Name string
}
// CreateChannelLogic 示例:模块内闭环业务(放在 apps/channel/logics.go)
// CreateChannelLogic 示例:插件内业务纯函数(位于 plugins/domain/channel/logics.go)
// 接收 context.Context,不依赖 gin.Context,便于单测与 Worker 复用。
func CreateChannelLogic(ctx context.Context, userID int64, name string) (*channelCreated, error) {
if name == "" {
@@ -30,7 +30,6 @@ func CreateChannelLogic(ctx context.Context, userID int64, name string) (*channe
zap.String("name", name),
)
// 轻量级本地逻辑;复杂持久化可进 model/repository
return &channelCreated{
ID: 1,
Name: fmt.Sprintf("%s (by %d)", name, userID),
@@ -12,10 +12,10 @@ import (
"go.uber.org/zap"
)
// ChannelService 示例有状态 Service(放在 internal/apps/channel/service.go)
// 需要注入 DB/客户端时使用;简单逻辑优先 logics.go 纯函数。
// ChannelService 示例有状态 Service(位于 plugins/domain/channel/service.go)
// 需要注入 DB/缓存时使用;简单逻辑优先 logics.go 纯函数。
type ChannelService struct {
// 例如:repo ChannelRepository
// 例如:db *gorm.DB
}
// NewChannelService 构造函数