move

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package move is the one place a ticket changes lanes. Four write-sites grew up around the board — the CLI's move, the TUI's gated and forced moves, and the sign-off accept — and every rule that had to run "after a move" needed all four found by hand; a review caught the fourth only by searching. The gate check, the claim-on-pull, the status write and the lane's settle now run here, and the callers keep what is genuinely theirs: flags, staging, wording, and the pending/confirm dance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	To           string
	Actor        string
	ActorAliases []string
	// Interactive marks a human pressing a key — the one thing an agent
	// cannot claim, and the signal requires-human-exit listens for.
	Interactive bool
	// Force writes despite refusals; what was overridden is returned, the
	// caller says it out loud. Nothing marks the ticket itself (deliberate).
	Force bool
	// Question and Reason ride into the gate check: entering a question lane
	// or a parking lane is judged on what the move brings along.
	Question string
	Reason   string
	// Stage is applied and PERSISTED before the gate runs — the CLI stages
	// outcome, question and commits this way, and a refused move keeps them:
	// requiring two commands to satisfy one move would be a poor contract for
	// an agent. nil skips it.
	Stage func(*ticket.Ticket) error
	// Reload re-reads the gate env after Stage wrote to the board. nil keeps
	// the env the caller passed.
	Reload func() (gate.Env, error)
	// ClaimOnPull stages assignee=Actor in memory for the gate and writes it
	// in the move when the ticket is unassigned — capture belongs to nobody,
	// the pull claims (invariant 12). The CLI claims inside Stage instead.
	ClaimOnPull bool
	// Folder is the logbook folder a settle files into (initials-date).
	Folder string
	// Prepare runs on each ticket a doorway files — the callers stamp commits
	// there. nil skips it.
	Prepare func(*ticket.Ticket) error
}

Request carries one lane change. The zero value of every optional field means "not this caller's behaviour": Stage is the CLI's persisted pre-gate write, ClaimOnPull is the TUI's in-memory claim, Reload refreshes the env after staging changed the board.

type Result

type Result struct {
	Ticket   *ticket.Ticket
	Refused  gate.Violations
	Overrode gate.Violations
	Claimed  bool
	// The lane's settle, straight from lane.Settle: what left for the
	// logbook, whether the doorway (true) or the cap ran, the cap's size for
	// the caller's wording, and the never-silent partial error.
	Trimmed   []ticket.Trimmed
	Filed     bool
	Holds     int
	SettleErr error
}

Result reports what happened. Refused non-empty means nothing was written (and Force was off); everything else describes the write that landed.

func Move

func Move(s *ticket.Store, env gate.Env, id string, req Request) (*Result, error)

Move performs one lane change: optional persisted staging, the gate, the write, the settle — in that order, the same order every caller ran alone.

Jump to

Keyboard shortcuts

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