Implements deterministic feature lifecycle management for agent-driven
development. Agents use the CLI in pods; operators control via REST API.
Library (internal/sdlc/):
- Feature lifecycle with 10 phases (draft → released)
- Classifier engine with priority-ordered rules
- Artifact tracking with approval workflow
- Task management within features
- YAML-based state persistence
CLI (cmd/sdlc/):
- init, state, next, feature, artifact, task, query commands
- --json flag for machine-readable output
- Runs inside project pods
API (21 endpoints under /projects/{id}/sdlc/):
- State: GET /state, GET /next
- Features: CRUD + transition/block/unblock
- Artifacts: approve/reject per type
- Tasks: add/start/complete/block
- Queries: blocked/ready/needs-approval
Architecture:
- Port: SDLCExecutor interface (internal/port/)
- Adapter: kubectl exec into pods (internal/adapter/kubernetes/)
- Service: pod resolution + logging (internal/service/)
- Handlers: 5 files under 500-line limit (internal/handlers/)
Also includes template upgrades (chassis framework, UI components,
OpenAPI helpers, backend/frontend guides) and component improvements.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
package sdlc
|
|
|
|
import "time"
|
|
|
|
// Artifact tracks the status of a feature artifact.
|
|
type Artifact struct {
|
|
Status ArtifactStatus `yaml:"status" json:"status"`
|
|
Path string `yaml:"path" json:"path"`
|
|
ApprovedBy string `yaml:"approved_by,omitempty" json:"approved_by,omitempty"`
|
|
ApprovedAt *time.Time `yaml:"approved_at,omitempty" json:"approved_at,omitempty"`
|
|
RejectedBy string `yaml:"rejected_by,omitempty" json:"rejected_by,omitempty"`
|
|
RejectedAt *time.Time `yaml:"rejected_at,omitempty" json:"rejected_at,omitempty"`
|
|
Total int `yaml:"total,omitempty" json:"total,omitempty"`
|
|
Completed int `yaml:"completed,omitempty" json:"completed,omitempty"`
|
|
InProgress int `yaml:"in_progress,omitempty" json:"in_progress,omitempty"`
|
|
Blocked int `yaml:"blocked,omitempty" json:"blocked,omitempty"`
|
|
}
|
|
|
|
// NewArtifact creates an artifact in pending status.
|
|
func NewArtifact(artifactType ArtifactType) *Artifact {
|
|
return &Artifact{
|
|
Status: StatusPending,
|
|
Path: ArtifactFilename(artifactType),
|
|
}
|
|
}
|
|
|
|
// Approve marks the artifact as approved.
|
|
func (a *Artifact) Approve(by string) {
|
|
now := time.Now().UTC()
|
|
a.Status = StatusApproved
|
|
a.ApprovedBy = by
|
|
a.ApprovedAt = &now
|
|
a.RejectedBy = ""
|
|
a.RejectedAt = nil
|
|
}
|
|
|
|
// Reject marks the artifact as rejected.
|
|
func (a *Artifact) Reject(by string) {
|
|
now := time.Now().UTC()
|
|
a.Status = StatusRejected
|
|
a.RejectedBy = by
|
|
a.RejectedAt = &now
|
|
}
|
|
|
|
// MarkDraft sets the artifact status to draft.
|
|
func (a *Artifact) MarkDraft() {
|
|
a.Status = StatusDraft
|
|
}
|
|
|
|
// MarkPassed sets the artifact status to passed.
|
|
func (a *Artifact) MarkPassed() {
|
|
a.Status = StatusPassed
|
|
}
|
|
|
|
// MarkFailed sets the artifact status to failed.
|
|
func (a *Artifact) MarkFailed() {
|
|
a.Status = StatusFailed
|
|
}
|
|
|
|
// MarkNeedsFix sets the artifact status to needs_fix.
|
|
func (a *Artifact) MarkNeedsFix() {
|
|
a.Status = StatusNeedsFix
|
|
}
|