Documentation
¶
Index ¶
- Variables
- func Content(ctx context.Context, path string) (string, error)
- func HasExecuting(ctx context.Context, dir string) bool
- func MoveToCompleted(ctx context.Context, path string) error
- func ResetExecuting(ctx context.Context, dir string) error
- func SetContainer(ctx context.Context, path string, container string) error
- func SetStatus(ctx context.Context, path string, status string) error
- func Title(ctx context.Context, path string) (string, error)
- type Frontmatter
- type Manager
- type Prompt
- type Rename
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyPrompt = stderrors.New("prompt file is empty")
ErrEmptyPrompt is returned when a prompt file is empty or contains only whitespace.
Functions ¶
func Content ¶
Content returns the prompt content (without frontmatter) for passing to Docker. Returns ErrEmptyPrompt if the file is empty or contains only whitespace.
func HasExecuting ¶ added in v0.2.24
HasExecuting returns true if any prompt in dir has status "executing".
func MoveToCompleted ¶
MoveToCompleted sets status to "completed" and moves a prompt file to the completed/ subdirectory. This ensures files in completed/ always have the correct status.
func ResetExecuting ¶ added in v0.2.5
ResetExecuting resets any prompts with status "executing" back to "queued". This handles prompts that got stuck from a previous crash.
func SetContainer ¶ added in v0.2.11
SetContainer updates the container field in a prompt file's frontmatter. If the file has no frontmatter, adds frontmatter with the container field.
Types ¶
type Frontmatter ¶
type Frontmatter struct {
Status string `yaml:"status"`
Container string `yaml:"container,omitempty"`
}
Frontmatter represents the YAML frontmatter in a prompt file.
func ReadFrontmatter ¶ added in v0.2.0
func ReadFrontmatter(ctx context.Context, path string) (*Frontmatter, error)
ReadFrontmatter reads frontmatter from a file.
type Manager ¶ added in v0.2.26
type Manager interface {
ResetExecuting(ctx context.Context) error
HasExecuting(ctx context.Context) bool
ListQueued(ctx context.Context) ([]Prompt, error)
ReadFrontmatter(ctx context.Context, path string) (*Frontmatter, error)
SetStatus(ctx context.Context, path string, status string) error
SetContainer(ctx context.Context, path string, name string) error
Content(ctx context.Context, path string) (string, error)
Title(ctx context.Context, path string) (string, error)
MoveToCompleted(ctx context.Context, path string) error
NormalizeFilenames(ctx context.Context) ([]Rename, error)
}
Manager manages prompt file operations.
func NewManager ¶ added in v0.2.26
NewManager creates a new Manager.
type Rename ¶ added in v0.2.15
Rename represents a file rename operation.
func NormalizeFilenames ¶ added in v0.2.15
NormalizeFilenames scans a directory for .md files and ensures they follow the NNN-slug.md naming convention. Files are renamed if they: - Have no numeric prefix (gets next available number) - Have a duplicate number (later file gets next available number) - Have wrong format (e.g., 9-foo.md instead of 009-foo.md) Returns list of renames performed.