Documentation
¶
Overview ¶
Package queue reads and writes a nod queue: a markdown file of approval requests that agents add to and humans resolve.
Index ¶
Constants ¶
const TimeLayout = "2006-01-02 15:04"
TimeLayout is the minute-precision local timestamp used in the file.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrConflict = errors.New("already resolved with a different verdict") )
Functions ¶
func NormalizeID ¶
NormalizeID turns "7", "n-7" or "N-7" into "N-7".
Types ¶
type Item ¶
type Item struct {
ID string `json:"id"`
Agent string `json:"agent"`
Summary string `json:"summary"`
Action string `json:"action"`
Ref string `json:"ref"`
Key string `json:"key,omitempty"`
Asked time.Time `json:"asked"`
Verdict Verdict `json:"verdict,omitempty"`
ResolvedAt time.Time `json:"resolved_at,omitzero"`
By string `json:"by,omitempty"`
Note string `json:"note,omitempty"`
}
Item is one approval request.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a parsed nod file. Unknown lines survive a round trip.
func Parse ¶
Parse reads a nod file. It never fails on unknown content; lines it doesn't understand are kept as-is.
func (*Queue) Add ¶
Add stores a new open item at the end of the Open section and returns it with its assigned ID. Fields are cleaned; Asked must be set by the caller.
type Store ¶
type Store struct {
Path string
}
Store is a nod file on disk. Update is safe across goroutines and processes.
func (Store) Load ¶
Load reads the queue without locking. A missing file is an empty queue. Writers replace the file atomically, so readers never see a torn write.
type Verdict ¶
type Verdict string
Verdict is how a request was resolved. The empty verdict means still open.
func ParseVerdict ¶
ParseVerdict accepts approved/declined/done/dropped in any case.