Documentation
¶
Overview ¶
Package registry remembers what flow created, so that open, delete, list and status can find it again. It is a cache of facts about the world, not the source of truth: every reader must tolerate drift — a worktree deleted by hand, a workspace closed, a branch renamed — and never crash because of it.
Index ¶
- Constants
- func DefaultPath() string
- type Entry
- type ErrUnknownVersion
- type File
- func (f *File) All() []Entry
- func (f *File) Find(repoKey, ticketID string) (Entry, bool)
- func (f *File) FindAnyRepo(ticketID string) (Entry, bool, bool)
- func (f *File) ForRepo(repoKey string) []Entry
- func (f *File) MatchByPath(dir string) (Entry, bool, bool)
- func (f *File) Remove(repoKey, ticketID string) bool
- func (f *File) Upsert(e Entry)
- type Store
- type Workspace
Constants ¶
const Version = 1
Version is the on-disk schema version. An unknown version is a hard error rather than a silent partial read, so a newer flow's file is never truncated by an older one.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
func DefaultPath() string
DefaultPath returns the registry location, honoring FLOW_REGISTRY for tests.
Types ¶
type Entry ¶
type Entry struct {
TicketID string `json:"ticket_id"`
Slug string `json:"slug"`
RepoKey string `json:"repo_key"`
RepoRoot string `json:"repo_root"`
WorktreePath string `json:"worktree_path"`
Branch string `json:"branch"`
BaseBranch string `json:"base_branch"`
AssetsPath string `json:"assets_path"`
Workspace Workspace `json:"workspace"`
CreatedAt time.Time `json:"created_at"`
LastOpenedAt time.Time `json:"last_opened_at"`
// Extra preserves fields written by a future version of flow so that an
// older binary rewriting the file does not discard them.
Extra map[string]json.RawMessage `json:"-"`
}
Entry is everything flow knows about one ticket in one repository.
func (Entry) MarshalJSON ¶
MarshalJSON writes the known fields plus anything preserved from a newer schema.
func (*Entry) UnmarshalJSON ¶
UnmarshalJSON decodes an entry while retaining any fields this version of flow does not know about.
type ErrUnknownVersion ¶
ErrUnknownVersion reports a registry written by a newer flow.
func (*ErrUnknownVersion) Error ¶
func (e *ErrUnknownVersion) Error() string
type File ¶
File is the whole registry document.
func (*File) FindAnyRepo ¶
FindAnyRepo returns the entry for a ticket in any repo, and reports whether the match was ambiguous across repositories.
func (*File) MatchByPath ¶
MatchByPath finds the entry whose worktree path is dir or an ancestor of it. Matching is on path-segment boundaries, so /a/b never matches /a/bc.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes the registry file, serializing concurrent flow invocations with a lock on a sibling .lock file.
type Workspace ¶
type Workspace struct {
Provider string `json:"provider,omitempty"`
ID string `json:"id,omitempty"`
Label string `json:"label,omitempty"`
TabID string `json:"tab_id,omitempty"`
RootPaneID string `json:"root_pane_id,omitempty"`
}
Workspace records the terminal workspace flow created for a ticket.