You've already forked agentic-coding-workflow
主流程
This commit is contained in:
+42
-20
@@ -40,6 +40,20 @@ func (p Phase) IsValid() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ArtifactPhases 是允许产出文档型产物的三个阶段(与 requirement_artifacts.phase
|
||||
// CHECK 约束一致):实施/验收阶段的产出是代码(走 ACP),不在此列。
|
||||
var ArtifactPhases = []Phase{PhasePlanning, PhasePrototyping, PhaseAuditing}
|
||||
|
||||
// IsArtifactPhase 报告 p 是否允许创建产物版本。
|
||||
func (p Phase) IsArtifactPhase() bool {
|
||||
for _, x := range ArtifactPhases {
|
||||
if p == x {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Status 是 Requirement / Issue 通用的开/关状态。
|
||||
type Status string
|
||||
|
||||
@@ -115,16 +129,20 @@ type Issue struct {
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// Prototype 是某条 Requirement 的一个原型设计版本快照。Version 在同一 Requirement
|
||||
// 内自增(max+1),CreatedBy 永远存在(DELETE RESTRICT)。
|
||||
type Prototype struct {
|
||||
ID uuid.UUID
|
||||
RequirementID uuid.UUID
|
||||
Version int
|
||||
Content string
|
||||
Note string
|
||||
CreatedBy uuid.UUID
|
||||
CreatedAt time.Time
|
||||
// Artifact 是某条 Requirement 在某阶段的一个产物文档版本快照。Version 在
|
||||
// (RequirementID, Phase) 内自增(max+1),CreatedBy 永远存在(DELETE RESTRICT)。
|
||||
// SourceMessageID 非 nil 时指向该产物派生自的 chat assistant 消息(仅追溯用,
|
||||
// schema 层 FK ON DELETE SET NULL,代码层不依赖 chat 模块)。
|
||||
type Artifact struct {
|
||||
ID uuid.UUID
|
||||
RequirementID uuid.UUID
|
||||
Phase Phase
|
||||
Version int
|
||||
Content string
|
||||
Note string
|
||||
SourceMessageID *int64
|
||||
CreatedBy uuid.UUID
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
// Caller 表示发起请求的用户上下文。Service 层据此判定鉴权。
|
||||
@@ -169,11 +187,12 @@ type IssueService interface {
|
||||
Reopen(ctx context.Context, c Caller, projectSlug string, number int) error
|
||||
}
|
||||
|
||||
// PrototypeService 暴露 Requirement 原型设计版本的应用服务方法。
|
||||
type PrototypeService interface {
|
||||
Create(ctx context.Context, c Caller, projectSlug string, reqNumber int, in CreatePrototypeInput) (*Prototype, error)
|
||||
List(ctx context.Context, c Caller, projectSlug string, reqNumber int) ([]*Prototype, error)
|
||||
GetByVersion(ctx context.Context, c Caller, projectSlug string, reqNumber int, version int) (*Prototype, error)
|
||||
// ArtifactService 暴露 Requirement 阶段产物版本的应用服务方法。
|
||||
type ArtifactService interface {
|
||||
Create(ctx context.Context, c Caller, projectSlug string, reqNumber int, in CreateArtifactInput) (*Artifact, error)
|
||||
// List 的 phase 传零值("")表示返回全部阶段产物(done 阶段汇总视图用)。
|
||||
List(ctx context.Context, c Caller, projectSlug string, reqNumber int, phase Phase) ([]*Artifact, error)
|
||||
GetByVersion(ctx context.Context, c Caller, projectSlug string, reqNumber int, phase Phase, version int) (*Artifact, error)
|
||||
}
|
||||
|
||||
// ===== 输入 DTO =====
|
||||
@@ -240,11 +259,14 @@ type CreateIssueInput struct {
|
||||
WorkspaceID *uuid.UUID
|
||||
}
|
||||
|
||||
// CreatePrototypeInput 创建一个原型设计版本。Version 由 Service 自动计算(max+1),
|
||||
// 不在此处提供。Note 可为空字符串。
|
||||
type CreatePrototypeInput struct {
|
||||
Content string
|
||||
Note string
|
||||
// CreateArtifactInput 创建一个阶段产物版本。Version 由 Service 自动计算
|
||||
// ((requirement, phase) 内 max+1),不在此处提供。Phase 必须是 ArtifactPhases
|
||||
// 之一;Note 可为空;SourceMessageID 仅在产物派生自 chat 消息时提供。
|
||||
type CreateArtifactInput struct {
|
||||
Phase Phase
|
||||
Content string
|
||||
Note string
|
||||
SourceMessageID *int64
|
||||
}
|
||||
|
||||
// UpdateIssueInput 是 Issue 的 patch 输入。RequirementNumber 为指针的指针,承载三种状态:
|
||||
|
||||
Reference in New Issue
Block a user