projectworkflowchain

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainStatusPlanned              = "planned"
	ChainStatusQueued               = "queued"
	ChainStatusCompleted            = "completed"
	ChainStatusPostValidationPassed = "post_validation_passed"
	ChainStatusBlocked              = "blocked"
)
View Source
const (
	StageStatusPlanned   = "planned"
	StageStatusQueued    = "queued"
	StageStatusCompleted = "completed"
	StageStatusBlocked   = "blocked"
)
View Source
const (
	InputKindJiraIssueKey = "jira_issue_key"
	InputKindSafeRef      = "safe_ref"

	ContextProviderJira        = "jira"
	ContextProviderConfluence  = "confluence"
	ContextProviderIndexedRepo = "indexed_repo"

	ContextModeLocalIngested = "local_ingested"
	ContextModeIndexed       = "indexed"

	TriggerOnChainStart              = "on_chain_start"
	TriggerAfterStageReviewPassed    = "after_stage_review_passed"
	GitOpsModeDraftPRAfterValidation = "draft_pr_after_post_validation"
)

Variables

View Source
var ErrInvalidInput = errors.New("invalid project workflow chain input")

Functions

This section is empty.

Types

type ChainFilter

type ChainFilter struct {
	ProjectID string
	ChainRef  string
	Status    string
}

type ChainRun

type ChainRun struct {
	ID             string     `json:"chain_run_id"`
	ProjectID      string     `json:"project_id"`
	ChainRef       string     `json:"chain_ref"`
	InputRef       string     `json:"input_ref"`
	Status         string     `json:"status"`
	ContextRefs    []string   `json:"context_refs,omitempty"`
	StageRuns      []StageRun `json:"stage_runs,omitempty"`
	WorkPlanIDs    []string   `json:"work_plan_ids,omitempty"`
	AutomationIDs  []string   `json:"automation_ids,omitempty"`
	CreatedByRunID string     `json:"created_by_run_id,omitempty"`
	TraceID        string     `json:"trace_id,omitempty"`
	GitOpsReady    bool       `json:"gitops_ready,omitempty"`
	PullRequestRef string     `json:"pull_request_ref,omitempty"`
	NextAction     string     `json:"next_action,omitempty"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
}

type Config

type Config struct {
	ProjectID            string        `json:"project_id"`
	ChainRef             string        `json:"chain_ref"`
	Enabled              bool          `json:"enabled"`
	InputKind            string        `json:"input_kind,omitempty"`
	InputPattern         string        `json:"input_pattern,omitempty"`
	ContextProvider      string        `json:"context_provider,omitempty"`
	ContextMode          string        `json:"context_mode,omitempty"`
	DefaultTitleTemplate string        `json:"default_title_template,omitempty"`
	GitOpsMode           string        `json:"gitops_mode,omitempty"`
	GitOpsEnabled        bool          `json:"gitops_enabled,omitempty"`
	Stages               []StageConfig `json:"stages,omitempty"`
}

type GitOpsFinalizeInput

type GitOpsFinalizeInput struct {
	ProjectID      string
	ChainRunID     string
	ChainRef       string
	InputRef       string
	WorkPlan       projectworkplan.WorkPlan
	StageRuns      []StageRun
	AutomationIDs  []string
	CreatedByRunID string
	TraceID        string
}

type GitOpsFinalizeResult

type GitOpsFinalizeResult struct {
	CommitRef      string
	PushRef        string
	PullRequestRef string
	EvidenceRefs   []string
	NoChanges      bool
	Skipped        bool
}

type GitOpsFinalizer

type GitOpsFinalizer interface {
	FinalizeWorkflowChain(context.Context, GitOpsFinalizeInput) (GitOpsFinalizeResult, error)
}

type ListResult

type ListResult struct {
	Chains []Config   `json:"chains,omitempty"`
	Runs   []ChainRun `json:"runs,omitempty"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(store Store, workflows WorkflowAPI, workPlans WorkPlanAPI, configs []Config) *Service

func (*Service) CallWorkflowChainTool

func (svc *Service) CallWorkflowChainTool(ctx context.Context, name string, arguments json.RawMessage) (any, error)

func (*Service) Get

func (svc *Service) Get(ctx context.Context, projectID, chainRunID string) (ChainRun, error)

func (*Service) HandleWorkPlanStatusChanged

func (svc *Service) HandleWorkPlanStatusChanged(ctx context.Context, change projectworkplan.WorkPlanStatusChange) error

func (*Service) List

func (svc *Service) List(ctx context.Context, filter ChainFilter) (ListResult, error)

func (*Service) RetryGitOps

func (svc *Service) RetryGitOps(ctx context.Context, projectID, chainRunID string) (ChainRun, error)

func (*Service) SetGitOpsFinalizer

func (svc *Service) SetGitOpsFinalizer(finalizer GitOpsFinalizer)

func (*Service) Start

func (svc *Service) Start(ctx context.Context, input StartInput) (StartResult, error)

type StageConfig

type StageConfig struct {
	StageRef                 string   `json:"stage_ref"`
	WorkflowRef              string   `json:"workflow_ref"`
	Trigger                  string   `json:"trigger,omitempty"`
	DependsOn                []string `json:"depends_on,omitempty"`
	AutomationRefTemplate    string   `json:"automation_ref_template,omitempty"`
	RequiredStatusBeforeNext string   `json:"required_status_before_next,omitempty"`
}

type StageRun

type StageRun struct {
	StageRef      string    `json:"stage_ref"`
	WorkflowRef   string    `json:"workflow_ref"`
	WorkflowID    string    `json:"workflow_id,omitempty"`
	Status        string    `json:"status"`
	WorkPlanID    string    `json:"work_plan_id,omitempty"`
	WorkTaskIDs   []string  `json:"work_task_ids,omitempty"`
	AutomationIDs []string  `json:"automation_ids,omitempty"`
	StartedAt     time.Time `json:"started_at,omitempty"`
	CompletedAt   time.Time `json:"completed_at,omitempty"`
	BlockedReason string    `json:"blocked_reason,omitempty"`
}

type StartInput

type StartInput struct {
	ProjectID      string
	ChainRef       string
	InputText      string
	CreatedByRunID string
	TraceID        string
	DryRun         bool
}

type StartResult

type StartResult struct {
	ProjectID      string     `json:"project_id"`
	ChainRef       string     `json:"chain_ref"`
	InputRef       string     `json:"input_ref"`
	Status         string     `json:"status"`
	ChainRunID     string     `json:"chain_run_id,omitempty"`
	StageRuns      []StageRun `json:"stage_runs,omitempty"`
	WorkPlanIDs    []string   `json:"work_plan_ids,omitempty"`
	AutomationIDs  []string   `json:"automation_ids,omitempty"`
	DryRun         bool       `json:"dry_run,omitempty"`
	NextAction     string     `json:"next_action"`
	PullRequestRef string     `json:"pull_request_ref,omitempty"`
}

type Store

type Store interface {
	CreateChainRun(context.Context, ChainRun) (ChainRun, error)
	GetChainRun(context.Context, string, string) (ChainRun, error)
	ListChainRuns(context.Context, ChainFilter) ([]ChainRun, error)
	UpdateChainRun(context.Context, ChainRun) (ChainRun, error)
	FindChainRunByWorkPlan(context.Context, string, string) (ChainRun, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL