mode

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mode is the one switch on a run's kind. A pull request run is in publish mode and a local run in apply mode. cli and tui ask the mode instead of branching on run.Target.Kind themselves, and draft never learns of kinds.

Index

Constants

View Source
const (
	EndedPublished = "published"
	EndedReturned  = "returned"
)

Wait reasons: what ended a run for the agent.

Variables

This section is empty.

Functions

func RepliesTo

func RepliesTo(d *draft.Draft, noteID string) []draft.Reply

RepliesTo lists the replies to the note noteID, oldest first.

func Shown

func Shown[T any](m Mode, findings []T) (any, error)

Shown is findings as the agent reads them on a run of m's kind. A pull request run shows them as they are. A local run stores blocking false and side RIGHT on every finding, which mean nothing to the agent applying them, so its findings are re-encoded without those two keys.

Types

type InputRules

type InputRules struct {
	RefuseBlocking     bool
	RefuseSide         bool
	RefuseSuggestedFix bool
	// RefuseVerdict refuses summary's verdict, which only a pull request's publish step reads.
	RefuseVerdict bool
}

InputRules refuse input fields a run kind does not have. Stored local findings keep side RIGHT and blocking false, and Edit re-validates them, so these checks run only on what the agent sent.

type Mode

type Mode interface {
	// Kind is the target's kind: "" for a pull request run, run.KindLocal for a local run.
	Kind() string
	// Rules are the finding rules draft applies to every add and edit.
	Rules() draft.Rules
	// InputRules are the input checks the CLI makes on raw keys and set flags, before draft sees the input.
	InputRules() InputRules
	// Refuses returns a wrong-mode refusal when command, with the named flags set, does not apply to this run.
	Refuses(command string, flags []string) error
	// Ended returns why the run is over for the agent, EndedPublished or EndedReturned, or "" while it is not.
	Ended(dir string) (string, error)
	// Feedback is the payload loupe feedback and loupe wait return for the draft d of the run in dir.
	Feedback(d *draft.Draft, dir string) (map[string]any, error)
}

Mode is what a run's kind decides.

func Of

func Of(t run.Target) Mode

Of returns the mode of the run that t describes.

Jump to

Keyboard shortcuts

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