state

package
v8.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package state locates and appends to the JSONL records tk keeps beside the ticket store — the commit journal, the mutation log and the retrospect markers the journal watcher fires from. It is a leaf package so that both pkg/journal and pkg/ticket can reach it: pkg/journal already imports pkg/ticket for the watch cycle, so the primitives the store layer needs cannot live there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendJSONL

func AppendJSONL(path string, values ...any) error

AppendJSONL appends each value to path as one JSON line, creating the parent directory and the file if they do not exist. Each line is written by a single Write to a descriptor opened O_APPEND, which is what keeps two processes appending to one log from interleaving halves of a record.

func Dir

func Dir(proj string) (string, error)

Dir returns ~/.ticket/state/<project>/.

func MutationLogPath

func MutationLogPath(proj string) (string, error)

MutationLogPath returns the project's mutations.jsonl — a sibling of the commit journal under ~/.ticket/state/<project>/, or the override root's own state tree when TK_STORE_ROOT is set.

The one state path that follows the override. The commit journal stays HOME-bound because the commands that write it are refused outright while the override is set (refuseIsolatedStore in cmd/root.go); a mutation is appended by every write and cannot be refused, so a sandbox left writing into HOME would file its throwaway tickets in the machine's real audit trail.

func RetrospectLogPath

func RetrospectLogPath(proj string) (string, error)

RetrospectLogPath returns the project's retrospects.jsonl — the markers that keep the watch cycle from firing `loom retrospect` twice for one close, beside the commit journal under ~/.ticket/state/<project>/.

It follows TK_STORE_ROOT on the same terms as MutationLogPath. The watcher never runs under the override — refuseIsolatedStore refuses it, and `tk serve` starts no journal loop there — but a path helper that resolved HOME regardless would be the thing that breaks that seam if one ever did.

Types

This section is empty.

Jump to

Keyboard shortcuts

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