Documentation
¶
Overview ¶
Package watch provides fingerprint calculation and tick scheduling for watch mode. It detects repository state changes by computing fingerprints and comparing them across ticks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCmd ¶
CheckCmd returns a tea.Cmd that computes the fingerprint asynchronously. The provided context allows cancellation on app shutdown.
func ShouldRefresh ¶
ShouldRefresh returns true when the fingerprint has changed and no refresh is already in flight. This implements the debounce/in-flight rule: skip refresh while one is running, reevaluate on next tick.
Types ¶
type FingerprintMsg ¶
FingerprintMsg carries the result of a fingerprint check.
type Fingerprinter ¶
Fingerprinter computes a change fingerprint for the current repo state. The fingerprint is compare-mode aware:
- Committed-ref mode: concatenates rev-parse of HEAD and base ref.
- Working-tree mode: additionally incorporates git diff --name-only HEAD to detect staged/unstaged edits.
func (*Fingerprinter) Fingerprint ¶
func (f *Fingerprinter) Fingerprint(ctx context.Context, baseRef string, workingTree bool) (string, error)
Fingerprint returns a string that changes whenever the repository state relevant to the current compare changes. baseRef must be a symbolic ref (e.g., "origin/main") so that rev-parse resolves it live on each tick. Passing an already-resolved SHA would make the base half of the fingerprint static.