Documentation
¶
Overview ¶
Package runner orchestrates the main dark-factory event loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWorktreeOrSubmodule = stderrors.New(
"worktree CWD detected: .git is a file (worktree or submodule); " +
"dark-factory cannot run from a worktree unless hideGit=true. " +
"To proceed: --set hideGit=true or add 'hideGit: true' to .dark-factory.yaml. " +
"See docs/troubleshooting.md and the 'PR via Pre-Created Worktree' runbook for details",
)
ErrWorktreeOrSubmodule is returned when dark-factory is started from a git worktree or submodule CWD (where .git is a regular file pointing to the parent repo) without hideGit=true.
Functions ¶
func CheckGitSafety ¶ added in v0.167.0
CheckGitSafety verifies git safety conditions before starting either the daemon or a one-shot run:
- Refuse to start from a worktree or submodule CWD — the .git pointer points to the parent repo's worktrees/ directory, which is not mounted.
- Abort if .git/index.lock exists — all git operations will fail.
Skips both checks when hideGit is true (the operator has explicitly opted into the .git mask, so the worktree pointer is hidden anyway).
func DetectWorktreeOrSubmodule ¶ added in v0.164.3
DetectWorktreeOrSubmodule checks whether the current working directory is a git worktree or submodule. In both cases, .git is a regular file (not a directory) that points into the parent repository's .git/worktrees or .git/modules directory.
Types ¶
type OneShotRunner ¶ added in v0.31.0
OneShotRunner processes all queued prompts and exits cleanly.
func NewOneShotRunner ¶ added in v0.31.0
func NewOneShotRunner( inboxDir string, inProgressDir string, completedDir string, logDir string, specsInboxDir string, specsInProgressDir string, specsCompletedDir string, specsLogDir string, promptManager PromptManager, locker lock.Locker, proc processor.Processor, specGen generator.SpecGenerator, currentDateTimeGetter libtime.CurrentDateTimeGetter, containerChecker executor.ContainerChecker, autoApprove bool, slugMigrator slugmigrator.Migrator, hideGit bool, startupLogger func(), ) OneShotRunner
NewOneShotRunner creates a new OneShotRunner. startupLogger is an optional func called after lock acquisition to emit the effective-config log line. Pass nil to skip the startup log.
type PromptManager ¶ added in v0.119.2
type PromptManager interface {
NormalizeFilenames(ctx context.Context, dir string) ([]prompt.Rename, error)
Load(ctx context.Context, path string) (*prompt.PromptFile, error)
ListQueued(ctx context.Context) ([]prompt.Prompt, error)
}
PromptManager is the subset of prompt.Manager that the runner package uses.
type Runner ¶
Runner orchestrates the main processing loop.
func NewRunner ¶
func NewRunner( inboxDir string, inProgressDir string, completedDir string, logDir string, specsInboxDir string, specsInProgressDir string, specsCompletedDir string, specsLogDir string, promptManager PromptManager, locker lock.Locker, watcher watcher.Watcher, processor processor.Processor, server server.Server, specWatcher specwatcher.SpecWatcher, projectName project.Name, containerChecker executor.ContainerChecker, n notifier.Notifier, slugMigrator slugmigrator.Migrator, currentDateTimeGetter libtime.CurrentDateTimeGetter, maxPromptDuration time.Duration, containerStopper executor.ContainerStopper, startupLogger func(), hideGit bool, preflightChecker preflight.Checker, logWriter io.Writer, ) Runner
NewRunner creates a new Runner. startupLogger is an optional func called after lock acquisition to emit the effective-config log line. Pass nil to skip the startup log.
type StartupDeps ¶ added in v0.119.7
type StartupDeps struct {
InboxDir string
InProgressDir string
CompletedDir string
LogDir string
SpecsInboxDir string
SpecsInProgressDir string
SpecsCompletedDir string
SpecsLogDir string
PromptManager PromptManager
ContainerChecker executor.ContainerChecker
Notifier notifier.Notifier // may be nil (oneshot passes nil)
ProjectName string // may be empty (oneshot passes "")
SlugMigrator slugmigrator.Migrator
CurrentDateTimeGetter libtime.CurrentDateTimeGetter
}
StartupDeps carries every dependency the shared startup sequence needs. Both Runner and OneShotRunner populate this struct from their own fields before calling startupSequence.