Documentation
¶
Index ¶
Constants ¶
const ( SignalComplete = ".brr-complete" SignalFailed = ".brr-failed" SignalNeedsApproval = ".brr-needs-approval" )
Signal file paths used by the brr engine.
Variables ¶
var ErrInterrupted = errors.New("interrupted")
ErrInterrupted is returned when the engine is stopped by a user signal (Ctrl+C).
Functions ¶
func AcquireLock ¶ added in v0.3.0
acquireLock attempts to acquire an exclusive lock on .brr.lock in the working directory. Returns the lock file handle (caller must defer releaseLock) or an error if another brr instance is already running in this directory.
func ReleaseLock ¶ added in v0.3.0
releaseLock releases the advisory lock and closes the file handle. The lock file is intentionally kept on disk to prevent a race where another process acquires the old inode just before it is unlinked.
Types ¶
type Options ¶
type Options struct {
Prompt string // resolved prompt text
Max int // max iterations (0 = unlimited)
Command []string // command + args to run (prompt piped to stdin)
SkipLock bool // skip lock acquisition (caller holds the lock)
}
Options configures a loop run.
type Result ¶ added in v0.2.0
type Result struct {
Reason StopReason
ApprovalContent string // populated only for ReasonApproval
FailedContent string // populated only for ReasonFailed
}
Result carries the structured stop reason from a completed engine run.
type StopReason ¶ added in v0.2.0
type StopReason int
StopReason indicates why the engine stopped.
const ( ReasonComplete StopReason = iota // .brr-complete signal file ReasonFailed // .brr-failed signal file ReasonApproval // .brr-needs-approval signal file ReasonMaxIterations // max iteration count reached ReasonFailStreak // too many consecutive failures ReasonInterrupted // user signal (Ctrl+C / SIGTERM) )