prcache

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package prcache provides PR status caching stored in ~/.wt/prs.json. PRs are stored independently of worktree entries, keyed by repoPath:branch, allowing PR info to be cached before worktrees are created.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheKey added in v0.18.0

func CacheKey(repoPath, branch string) string

CacheKey returns the cache key for a worktree, namespaced by repo path. Uses repoPath:branch since the PR is tied to the branch, not the folder.

func Path

func Path() string

Path returns the path to the PR cache file

Types

type Cache

type Cache struct {
	PRs map[string]*forge.PRInfo `json:"prs"`
	// contains filtered or unexported fields
}

Cache stores PR info keyed by repoPath:branch

func Load

func Load() *Cache

Load loads the PR cache from disk. Returns an empty cache if the file is missing or corrupted.

func LoadFrom added in v0.23.0

func LoadFrom(path string) *Cache

LoadFrom loads the PR cache from the given path. Returns an empty cache if the file is missing or corrupted.

func New added in v0.15.0

func New() *Cache

New returns an empty, initialized cache.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes PR info for a cache key

func (*Cache) Get

func (c *Cache) Get(key string) *forge.PRInfo

Get returns PR info for a cache key, or nil if not found

func (*Cache) Reset

func (c *Cache) Reset()

Reset clears all cached data

func (*Cache) Save

func (c *Cache) Save() error

Save saves the PR cache to disk atomically

func (*Cache) SaveIfDirty added in v0.17.0

func (c *Cache) SaveIfDirty() error

SaveIfDirty saves the cache to disk only if it has been modified. Resets the dirty flag after a successful save.

func (*Cache) SaveTo added in v0.23.0

func (c *Cache) SaveTo(path string) error

SaveTo saves the PR cache to the given path atomically.

func (*Cache) Set

func (c *Cache) Set(key string, pr *forge.PRInfo)

Set stores PR info for a cache key

Jump to

Keyboard shortcuts

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