Documentation
¶
Overview ¶
Package prompt handles prompt file loading, saving, and queue management.
Index ¶
- Variables
- func StripNumberPrefix(filename string) string
- type BaseName
- type ContainerName
- type Counter
- type FileMover
- type Frontmatter
- type Manager
- func (pm *Manager) AllPreviousCompleted(ctx context.Context, n int) bool
- func (pm *Manager) Content(ctx context.Context, path string) (string, error)
- func (pm *Manager) FindCommitting(ctx context.Context) ([]string, error)
- func (pm *Manager) FindMissingCompleted(ctx context.Context, n int) []int
- func (pm *Manager) FindPromptStatusInProgress(ctx context.Context, number int) string
- func (pm *Manager) HasExecuting(ctx context.Context) bool
- func (pm *Manager) HasQueuedPromptsOnBranch(ctx context.Context, branch string, excludePath string) (bool, error)
- func (pm *Manager) IncrementRetryCount(ctx context.Context, path string) error
- func (pm *Manager) ListQueued(ctx context.Context) ([]Prompt, error)
- func (pm *Manager) Load(ctx context.Context, path string) (*PromptFile, error)
- func (pm *Manager) MoveToCancelled(ctx context.Context, path string) error
- func (pm *Manager) MoveToCompleted(ctx context.Context, path string) error
- func (pm *Manager) NormalizeFilenames(ctx context.Context, dir string) ([]Rename, error)
- func (pm *Manager) ReadFrontmatter(ctx context.Context, path string) (*Frontmatter, error)
- func (pm *Manager) ResetExecuting(ctx context.Context) error
- func (pm *Manager) ResetFailed(ctx context.Context) error
- func (pm *Manager) RollbackMoveToCompleted(ctx context.Context, completedPath string, mover FileMover) error
- func (pm *Manager) SetBranch(ctx context.Context, path string, branch string) error
- func (pm *Manager) SetContainer(ctx context.Context, path string, name string) error
- func (pm *Manager) SetPRURL(ctx context.Context, path string, url string) error
- func (pm *Manager) SetStatus(ctx context.Context, path string, status string) error
- func (pm *Manager) SetVersion(ctx context.Context, path string, version string) error
- func (pm *Manager) Title(ctx context.Context, path string) (string, error)
- type Prompt
- type PromptFile
- func (pf *PromptFile) Branch() string
- func (pf *PromptFile) Content() (string, error)
- func (pf *PromptFile) Issue() string
- func (pf *PromptFile) MarkApproved()
- func (pf *PromptFile) MarkCancelled()
- func (pf *PromptFile) MarkCommitting()
- func (pf *PromptFile) MarkCompleted()
- func (pf *PromptFile) MarkFailed()
- func (pf *PromptFile) MarkPendingVerification()
- func (pf *PromptFile) PRURL() string
- func (pf *PromptFile) PrepareForExecution(container, version string)
- func (pf *PromptFile) RetryCount() int
- func (pf *PromptFile) Save(ctx context.Context) error
- func (pf *PromptFile) SetBranch(branch string)
- func (pf *PromptFile) SetBranchIfEmpty(branch string)
- func (pf *PromptFile) SetIssue(issue string)
- func (pf *PromptFile) SetIssueIfEmpty(issue string)
- func (pf *PromptFile) SetLastFailReason(reason string)
- func (pf *PromptFile) SetPRURL(url string)
- func (pf *PromptFile) SetSummary(summary string)
- func (pf *PromptFile) Specs() []string
- func (pf *PromptFile) StampRejected(reason string)
- func (pf *PromptFile) Summary() string
- func (pf *PromptFile) Title() string
- func (pf *PromptFile) VerificationSection() string
- type PromptFileLoader
- func (p PromptFileLoader) Content(ctx context.Context, path string) (string, error)
- func (p PromptFileLoader) Load(ctx context.Context, path string) (*PromptFile, error)
- func (p PromptFileLoader) ReadFrontmatter(ctx context.Context, path string) (*Frontmatter, error)
- func (p PromptFileLoader) Title(ctx context.Context, path string) (string, error)
- type PromptMover
- func (p PromptMover) MoveToCancelled(ctx context.Context, path string) error
- func (p PromptMover) MoveToCompleted(ctx context.Context, path string) error
- func (p PromptMover) NormalizeFilenames(ctx context.Context, dir string) ([]Rename, error)
- func (p PromptMover) PrepareRollback(ctx context.Context, completedPath string) error
- func (p PromptMover) RollbackMove(ctx context.Context, completedPath string) error
- type PromptScanner
- func (p PromptScanner) AllPreviousCompleted(ctx context.Context, n int) bool
- func (p PromptScanner) FindCommitting(ctx context.Context) ([]string, error)
- func (p PromptScanner) FindMissingCompleted(ctx context.Context, n int) []int
- func (p PromptScanner) FindPromptStatusInProgress(ctx context.Context, number int) string
- func (p PromptScanner) HasExecuting(ctx context.Context) bool
- func (p PromptScanner) ListQueued(ctx context.Context) ([]Prompt, error)
- type PromptStatus
- func (s PromptStatus) CanTransitionTo(target PromptStatus) error
- func (s PromptStatus) IsActive() bool
- func (s PromptStatus) IsPreExecution() bool
- func (s PromptStatus) IsRejectable() bool
- func (s PromptStatus) IsTerminal() bool
- func (s PromptStatus) String() string
- func (s PromptStatus) Validate(ctx context.Context) error
- type PromptStatusManager
- func (p PromptStatusManager) IncrementRetryCount(ctx context.Context, path string) error
- func (p PromptStatusManager) SetBranch(ctx context.Context, path string, branch string) error
- func (p PromptStatusManager) SetContainer(ctx context.Context, path string, name string) error
- func (p PromptStatusManager) SetPRURL(ctx context.Context, path string, url string) error
- func (p PromptStatusManager) SetStatus(ctx context.Context, path string, status string) error
- func (p PromptStatusManager) SetVersion(ctx context.Context, path string, version string) error
- type PromptStatuses
- type Rename
- type SpecList
Constants ¶
This section is empty.
Variables ¶
var AvailablePromptStatuses = PromptStatuses{ IdeaPromptStatus, DraftPromptStatus, ApprovedPromptStatus, ExecutingPromptStatus, CompletedPromptStatus, FailedPromptStatus, InReviewPromptStatus, PendingVerificationPromptStatus, CancelledPromptStatus, CommittingPromptStatus, RejectedPromptStatus, }
AvailablePromptStatuses is the collection of all valid PromptStatus values.
var ErrEmptyPrompt = stderrors.New("prompt file is empty")
ErrEmptyPrompt is returned when a prompt file is empty or contains only whitespace.
Functions ¶
func StripNumberPrefix ¶ added in v0.47.0
StripNumberPrefix removes any leading numeric prefix (e.g. "200-foo.md" → "foo.md", "1-bar.md" → "bar.md"). Returns the original filename if no numeric prefix is found.
Types ¶
type BaseName ¶ added in v0.135.17
type BaseName string
BaseName is the prompt filename without the .md extension and with special characters replaced.
type ContainerName ¶ added in v0.135.17
type ContainerName string
ContainerName is a sanitized Docker container name derived from project and prompt names.
func (ContainerName) Sanitize ¶ added in v0.135.17
func (n ContainerName) Sanitize() ContainerName
Sanitize replaces any character not in [a-zA-Z0-9_-] with '-'.
func (ContainerName) String ¶ added in v0.135.17
func (n ContainerName) String() string
String returns the underlying string for use with exec / docker.
type Counter ¶ added in v0.17.24
type Counter interface {
CountBySpec(ctx context.Context, specID string) (completed, total int, err error)
}
Counter counts prompts linked to specs.
func NewCounter ¶ added in v0.17.24
func NewCounter(currentDateTimeGetter libtime.CurrentDateTimeGetter, dirs ...string) Counter
NewCounter creates a Counter that scans the given directories.
type Frontmatter ¶
type Frontmatter struct {
Status string `yaml:"status"`
Specs SpecList `yaml:"spec,omitempty,flow"`
Summary string `yaml:"summary,omitempty"`
Container string `yaml:"container,omitempty"`
DarkFactoryVersion string `yaml:"dark-factory-version,omitempty"`
Created string `yaml:"created,omitempty"`
Queued string `yaml:"queued,omitempty"`
Started string `yaml:"started,omitempty"`
Completed string `yaml:"completed,omitempty"`
PRURL string `yaml:"pr-url,omitempty"`
Branch string `yaml:"branch,omitempty"`
Issue string `yaml:"issue,omitempty"`
RetryCount int `yaml:"retryCount,omitempty"`
LastFailReason string `yaml:"lastFailReason,omitempty"`
Rejected string `yaml:"rejected,omitempty"`
RejectedReason string `yaml:"rejected_reason,omitempty"`
Cancelled string `yaml:"cancelled,omitempty"`
}
Frontmatter represents the YAML frontmatter in a prompt file.
func (Frontmatter) HasSpec ¶ added in v0.17.28
func (f Frontmatter) HasSpec(id string) bool
HasSpec returns true if the given spec ID is in the Specs list. Comparison is by parsed integer prefix: "019" matches "19", "0019", and "019-review-fix-loop". If either value has no numeric prefix, falls back to exact string match.
type Manager ¶ added in v0.2.26
type Manager struct {
// contains filtered or unexported fields
}
Manager manages prompt file operations.
func NewManager ¶ added in v0.2.26
func NewManager( inboxDir string, inProgressDir string, completedDir string, cancelledDir string, mover FileMover, currentDateTimeGetter libtime.CurrentDateTimeGetter, ) *Manager
NewManager creates a new Manager.
func (*Manager) AllPreviousCompleted ¶ added in v0.4.0
AllPreviousCompleted checks if all prompts with numbers less than n are in completed/.
func (*Manager) Content ¶ added in v0.2.26
Content returns the prompt content (without frontmatter) for passing to Docker.
func (*Manager) FindCommitting ¶ added in v0.123.0
FindCommitting returns paths of all prompt files in in-progress/ with status "committing".
func (*Manager) FindMissingCompleted ¶ added in v0.97.0
FindMissingCompleted returns prompt numbers less than n that are NOT in completed/.
func (*Manager) FindPromptStatusInProgress ¶ added in v0.97.0
FindPromptStatusInProgress looks up a prompt by number in the in-progress directory and returns its frontmatter status.
func (*Manager) HasExecuting ¶ added in v0.2.26
HasExecuting returns true if any prompt in dir has status "executing".
func (*Manager) HasQueuedPromptsOnBranch ¶ added in v0.42.0
func (pm *Manager) HasQueuedPromptsOnBranch( ctx context.Context, branch string, excludePath string, ) (bool, error)
HasQueuedPromptsOnBranch returns true if any queued prompt (other than excludePath) has the given branch value in its frontmatter.
func (*Manager) IncrementRetryCount ¶ added in v0.17.34
IncrementRetryCount increments the retryCount field in a prompt file's frontmatter.
func (*Manager) ListQueued ¶ added in v0.2.26
ListQueued scans a directory for .md files that should be picked up.
func (*Manager) Load ¶ added in v0.11.6
Load reads a prompt file from disk, parsing frontmatter and body.
func (*Manager) MoveToCancelled ¶ added in v0.151.0
MoveToCancelled sets status to "cancelled" (with timestamp) and moves a prompt file to the cancelled/ subdirectory.
func (*Manager) MoveToCompleted ¶ added in v0.2.26
MoveToCompleted sets status to "completed" and moves a prompt file to the completed/ subdirectory.
func (*Manager) NormalizeFilenames ¶ added in v0.2.26
NormalizeFilenames scans a directory for .md files and ensures they follow the NNN-slug.md naming convention. It also checks the completed directory for used numbers.
func (*Manager) ReadFrontmatter ¶ added in v0.2.26
ReadFrontmatter reads frontmatter from a file.
func (*Manager) ResetExecuting ¶ added in v0.2.26
ResetExecuting resets any prompts with status "executing" back to "approved".
func (*Manager) ResetFailed ¶ added in v0.10.6
ResetFailed resets any prompts with status "failed" back to "approved".
func (*Manager) RollbackMoveToCompleted ¶ added in v0.168.2
func (pm *Manager) RollbackMoveToCompleted( ctx context.Context, completedPath string, mover FileMover, ) error
RollbackMoveToCompleted is the inverse of MoveToCompleted. It moves a prompt file from pm.completedDir back to pm.inProgressDir and restores its frontmatter status to CommittingPromptStatus (the state the prompt was in immediately before MoveToCompleted ran). Used by workflow executors when the work commit fails after the move.
func (*Manager) SetBranch ¶ added in v0.17.17
SetBranch updates the branch field in a prompt file's frontmatter.
func (*Manager) SetContainer ¶ added in v0.2.26
SetContainer updates the container field in a prompt file's frontmatter.
func (*Manager) SetPRURL ¶ added in v0.16.0
SetPRURL updates the pr-url field in a prompt file's frontmatter.
func (*Manager) SetStatus ¶ added in v0.2.26
SetStatus updates the status field in a prompt file's frontmatter.
func (*Manager) SetVersion ¶ added in v0.6.0
SetVersion updates the dark-factory-version field in a prompt file's frontmatter.
type Prompt ¶
type Prompt struct {
Path string
Status PromptStatus
}
Prompt represents a prompt file with YAML frontmatter.
func (Prompt) Number ¶ added in v0.4.0
Number extracts the numeric prefix from the prompt filename. Returns -1 if the filename has no numeric prefix.
type PromptFile ¶ added in v0.11.6
type PromptFile struct {
Path string
Frontmatter Frontmatter
Body []byte // immutable after Load — never modified
// contains filtered or unexported fields
}
PromptFile represents a loaded prompt file with immutable body and mutable frontmatter.
func NewPromptFile ¶ added in v0.36.3
func NewPromptFile( path string, fm Frontmatter, body []byte, currentDateTimeGetter libtime.CurrentDateTimeGetter, ) *PromptFile
NewPromptFile creates a PromptFile with the given fields and currentDateTimeGetter. This is intended for use in tests where a PromptFile must be constructed without reading from disk.
func (*PromptFile) Branch ¶ added in v0.17.17
func (pf *PromptFile) Branch() string
Branch returns the branch field from frontmatter.
func (*PromptFile) Content ¶ added in v0.11.6
func (pf *PromptFile) Content() (string, error)
Content returns the body as a string, stripped of leading empty frontmatter blocks. Returns ErrEmptyPrompt if body is empty or whitespace-only.
func (*PromptFile) Issue ¶ added in v0.43.0
func (pf *PromptFile) Issue() string
Issue returns the issue tracker reference from the prompt frontmatter (empty string if unset).
func (*PromptFile) MarkApproved ¶ added in v0.24.2
func (pf *PromptFile) MarkApproved()
MarkApproved sets status to approved and ensures created/queued timestamps exist.
func (*PromptFile) MarkCancelled ¶ added in v0.62.0
func (pf *PromptFile) MarkCancelled()
MarkCancelled sets status to cancelled with a UTC timestamp.
func (*PromptFile) MarkCommitting ¶ added in v0.123.0
func (pf *PromptFile) MarkCommitting()
MarkCommitting sets the status to "committing" — container succeeded, awaiting git commit.
func (*PromptFile) MarkCompleted ¶ added in v0.11.6
func (pf *PromptFile) MarkCompleted()
MarkCompleted sets status to completed with timestamp and clears any previously recorded lastFailReason so a successful retry leaves no stale failure data in the frontmatter. The YAML tag is lastFailReason,omitempty so the field is dropped entirely from the serialised file when empty.
func (*PromptFile) MarkFailed ¶ added in v0.11.6
func (pf *PromptFile) MarkFailed()
MarkFailed sets status to failed with timestamp.
func (*PromptFile) MarkPendingVerification ¶ added in v0.28.0
func (pf *PromptFile) MarkPendingVerification()
MarkPendingVerification sets status to pending_verification.
func (*PromptFile) PRURL ¶ added in v0.17.17
func (pf *PromptFile) PRURL() string
PRURL returns the pr-url field from frontmatter.
func (*PromptFile) PrepareForExecution ¶ added in v0.11.6
func (pf *PromptFile) PrepareForExecution(container, version string)
PrepareForExecution sets all fields needed before container launch. This replaces separate SetContainer + SetVersion + SetStatus calls.
func (*PromptFile) RetryCount ¶ added in v0.17.34
func (pf *PromptFile) RetryCount() int
RetryCount returns the retryCount field from frontmatter.
func (*PromptFile) Save ¶ added in v0.11.6
func (pf *PromptFile) Save(ctx context.Context) error
Save writes the prompt file back to disk: frontmatter + body. Body is always preserved exactly as loaded.
func (*PromptFile) SetBranch ¶ added in v0.17.17
func (pf *PromptFile) SetBranch(branch string)
SetBranch sets the branch field in frontmatter.
func (*PromptFile) SetBranchIfEmpty ¶ added in v0.40.0
func (pf *PromptFile) SetBranchIfEmpty(branch string)
SetBranchIfEmpty sets the branch field only if it is currently empty.
func (*PromptFile) SetIssue ¶ added in v0.40.0
func (pf *PromptFile) SetIssue(issue string)
SetIssue sets the issue field in frontmatter.
func (*PromptFile) SetIssueIfEmpty ¶ added in v0.40.0
func (pf *PromptFile) SetIssueIfEmpty(issue string)
SetIssueIfEmpty sets the issue field only if it is currently empty.
func (*PromptFile) SetLastFailReason ¶ added in v0.98.0
func (pf *PromptFile) SetLastFailReason(reason string)
SetLastFailReason records the human-readable reason for the last failure.
func (*PromptFile) SetPRURL ¶ added in v0.16.0
func (pf *PromptFile) SetPRURL(url string)
SetPRURL sets the pr-url field in frontmatter.
func (*PromptFile) SetSummary ¶ added in v0.13.1
func (pf *PromptFile) SetSummary(summary string)
SetSummary sets the summary field in frontmatter.
func (*PromptFile) Specs ¶ added in v0.17.28
func (pf *PromptFile) Specs() []string
Specs returns the specs slice from frontmatter. Returns an empty slice if nil.
func (*PromptFile) StampRejected ¶ added in v0.133.0
func (pf *PromptFile) StampRejected(reason string)
StampRejected sets the rejected timestamp and reason, then marks status as rejected.
func (*PromptFile) Summary ¶ added in v0.149.0
func (pf *PromptFile) Summary() string
Summary extracts the content of the <summary> tag from the prompt body. Returns an empty string if no <summary> tag is found.
func (*PromptFile) Title ¶ added in v0.11.6
func (pf *PromptFile) Title() string
Title extracts the first # heading from the body.
func (*PromptFile) VerificationSection ¶ added in v0.28.0
func (pf *PromptFile) VerificationSection() string
VerificationSection extracts the content of the <verification> tag from the prompt body. Returns an empty string if no <verification> tag is found.
type PromptFileLoader ¶ added in v0.171.6
type PromptFileLoader struct {
// contains filtered or unexported fields
}
PromptFileLoader handles file I/O for prompt files.
func NewPromptFileLoader ¶ added in v0.171.6
func NewPromptFileLoader(currentDateTimeGetter libtime.CurrentDateTimeGetter) PromptFileLoader
NewPromptFileLoader creates a PromptFileLoader.
func (PromptFileLoader) Content ¶ added in v0.171.6
Content returns the prompt content (without frontmatter) for passing to Docker.
func (PromptFileLoader) Load ¶ added in v0.171.6
func (p PromptFileLoader) Load(ctx context.Context, path string) (*PromptFile, error)
Load reads a prompt file from disk, parsing frontmatter and body.
func (PromptFileLoader) ReadFrontmatter ¶ added in v0.171.6
func (p PromptFileLoader) ReadFrontmatter(ctx context.Context, path string) (*Frontmatter, error)
ReadFrontmatter reads frontmatter from a file.
type PromptMover ¶ added in v0.171.6
type PromptMover struct {
// contains filtered or unexported fields
}
PromptMover handles file movement operations for prompt files.
func NewPromptMover ¶ added in v0.171.6
func NewPromptMover( inProgressDir string, completedDir string, cancelledDir string, mover FileMover, currentDateTimeGetter libtime.CurrentDateTimeGetter, ) PromptMover
NewPromptMover creates a PromptMover.
func (PromptMover) MoveToCancelled ¶ added in v0.171.6
func (p PromptMover) MoveToCancelled(ctx context.Context, path string) error
MoveToCancelled sets status to "cancelled" (with timestamp) and moves a prompt file to the cancelled directory.
func (PromptMover) MoveToCompleted ¶ added in v0.171.6
func (p PromptMover) MoveToCompleted(ctx context.Context, path string) error
MoveToCompleted sets status to "completed" and moves a prompt file to the completed directory.
func (PromptMover) NormalizeFilenames ¶ added in v0.171.6
NormalizeFilenames scans a directory for .md files and ensures they follow the NNN-slug.md naming convention.
func (PromptMover) PrepareRollback ¶ added in v0.171.6
func (p PromptMover) PrepareRollback(ctx context.Context, completedPath string) error
PrepareRollback prepares a prompt file for rollback: loads it, sets status to CommittingPromptStatus, and saves. This separates state preparation from I/O so that RollbackMove can be retried independently.
func (PromptMover) RollbackMove ¶ added in v0.171.6
func (p PromptMover) RollbackMove(ctx context.Context, completedPath string) error
RollbackMove moves a prompt file from the completed directory back to the in-progress directory. The file must already have been prepared via PrepareRollback.
type PromptScanner ¶ added in v0.171.6
type PromptScanner struct {
// contains filtered or unexported fields
}
PromptScanner handles directory queries for prompt files.
func NewPromptScanner ¶ added in v0.171.6
func NewPromptScanner( inProgressDir, completedDir string, currentDateTimeGetter libtime.CurrentDateTimeGetter, ) PromptScanner
NewPromptScanner creates a PromptScanner.
func (PromptScanner) AllPreviousCompleted ¶ added in v0.171.6
func (p PromptScanner) AllPreviousCompleted(ctx context.Context, n int) bool
AllPreviousCompleted checks if all prompts with numbers less than n are in completed/.
func (PromptScanner) FindCommitting ¶ added in v0.171.6
func (p PromptScanner) FindCommitting(ctx context.Context) ([]string, error)
FindCommitting returns paths of all prompt files in in-progress/ with status "committing".
func (PromptScanner) FindMissingCompleted ¶ added in v0.171.6
func (p PromptScanner) FindMissingCompleted(ctx context.Context, n int) []int
FindMissingCompleted returns prompt numbers less than n that are NOT in completed/.
func (PromptScanner) FindPromptStatusInProgress ¶ added in v0.171.6
func (p PromptScanner) FindPromptStatusInProgress(ctx context.Context, number int) string
FindPromptStatusInProgress looks up a prompt by number in the in-progress directory and returns its status.
func (PromptScanner) HasExecuting ¶ added in v0.171.6
func (p PromptScanner) HasExecuting(ctx context.Context) bool
HasExecuting returns true if any prompt in the directory has status "executing".
func (PromptScanner) ListQueued ¶ added in v0.171.6
func (p PromptScanner) ListQueued(ctx context.Context) ([]Prompt, error)
ListQueued scans the in-progress directory for .md files ready to be picked up.
type PromptStatus ¶ added in v0.24.2
type PromptStatus string
PromptStatus represents the current state of a prompt.
const ( // IdeaPromptStatus indicates a rough concept that needs refinement before it can be reviewed. IdeaPromptStatus PromptStatus = "idea" // DraftPromptStatus indicates the prompt is complete and ready for human review and approval. DraftPromptStatus PromptStatus = "draft" // ApprovedPromptStatus indicates the prompt has been approved and queued for execution. ApprovedPromptStatus PromptStatus = "approved" // ExecutingPromptStatus indicates the prompt is currently being executed in a YOLO container. ExecutingPromptStatus PromptStatus = "executing" // CompletedPromptStatus indicates the prompt has been executed successfully. CompletedPromptStatus PromptStatus = "completed" // FailedPromptStatus indicates the prompt execution failed and needs fix or retry. FailedPromptStatus PromptStatus = "failed" // InReviewPromptStatus indicates the prompt's PR is under review. InReviewPromptStatus PromptStatus = "in_review" // PendingVerificationPromptStatus indicates the prompt is awaiting verification after review. PendingVerificationPromptStatus PromptStatus = "pending_verification" // CancelledPromptStatus indicates the prompt was cancelled before or during execution. CancelledPromptStatus PromptStatus = "cancelled" // CommittingPromptStatus indicates the container succeeded but the git commit is still pending. // The prompt stays in in-progress/ until the commit succeeds. CommittingPromptStatus PromptStatus = "committing" // RejectedPromptStatus indicates the prompt was deliberately abandoned before execution. // This is a terminal state — rejected prompts are moved to prompts/rejected/ and never executed. RejectedPromptStatus PromptStatus = "rejected" )
func (PromptStatus) CanTransitionTo ¶ added in v0.132.2
func (s PromptStatus) CanTransitionTo(target PromptStatus) error
CanTransitionTo returns nil if transitioning from s to target is valid, or an error naming both states if the transition is not in the table.
func (PromptStatus) IsActive ¶ added in v0.132.2
func (s PromptStatus) IsActive() bool
IsActive returns true if the prompt is in active processing (neither pre-execution nor terminal). Note: FailedPromptStatus is intentionally Active — failed prompts can be re-approved for retry.
func (PromptStatus) IsPreExecution ¶ added in v0.132.2
func (s PromptStatus) IsPreExecution() bool
IsPreExecution returns true if the prompt has not yet entered active execution.
func (PromptStatus) IsRejectable ¶ added in v0.133.0
func (s PromptStatus) IsRejectable() bool
IsRejectable returns true if the prompt may be rejected from its current state. Rejection is only allowed from pre-execution states (idea, draft, approved).
func (PromptStatus) IsTerminal ¶ added in v0.132.2
func (s PromptStatus) IsTerminal() bool
IsTerminal returns true if the prompt has reached a final, non-actionable state.
func (PromptStatus) String ¶ added in v0.24.2
func (s PromptStatus) String() string
String returns the string representation of the PromptStatus.
type PromptStatusManager ¶ added in v0.171.6
type PromptStatusManager struct {
// contains filtered or unexported fields
}
PromptStatusManager handles all status mutations for prompt files.
func NewPromptStatusManager ¶ added in v0.171.6
func NewPromptStatusManager( currentDateTimeGetter libtime.CurrentDateTimeGetter, ) PromptStatusManager
NewPromptStatusManager creates a PromptStatusManager.
func (PromptStatusManager) IncrementRetryCount ¶ added in v0.171.6
func (p PromptStatusManager) IncrementRetryCount(ctx context.Context, path string) error
IncrementRetryCount increments the retryCount field in a prompt file's frontmatter.
func (PromptStatusManager) SetBranch ¶ added in v0.171.6
SetBranch updates the branch field in a prompt file's frontmatter.
func (PromptStatusManager) SetContainer ¶ added in v0.171.6
SetContainer updates the container field in a prompt file's frontmatter.
func (PromptStatusManager) SetPRURL ¶ added in v0.171.6
SetPRURL updates the pr-url field in a prompt file's frontmatter.
func (PromptStatusManager) SetStatus ¶ added in v0.171.6
SetStatus updates the status field in a prompt file's frontmatter.
func (PromptStatusManager) SetVersion ¶ added in v0.171.6
SetVersion updates the dark-factory-version field in a prompt file's frontmatter.
type PromptStatuses ¶ added in v0.24.2
type PromptStatuses []PromptStatus
PromptStatuses is a slice of PromptStatus values.
func (PromptStatuses) Contains ¶ added in v0.24.2
func (p PromptStatuses) Contains(status PromptStatus) bool
Contains returns true if the given status is in the collection.