Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentFetcher ¶
type ContentFetcher interface {
GetFileContents(ctx context.Context, installationID int64, repo, path string) ([]byte, error)
}
ContentFetcher is the subset of the github client this package needs. Defined here to avoid a direct dependency on the github package.
type FetchFunc ¶
FetchFunc returns the raw bytes of hats.md or an error.
func GitHubFetchFunc ¶
func GitHubFetchFunc(ctx context.Context, f ContentFetcher, installationID int64, repo, path string) FetchFunc
GitHubFetchFunc wires a ContentFetcher into a FetchFunc for a given repo and path. Each call to the returned FetchFunc issues one GetFileContents call — the caller owns retry/timeout policy.
The context is captured at construction time; pass a long-lived context (typically context.Background() or a shutdown-tied context). A request-scoped context would apply its cancellation or deadline to every future refresh.
type Hat ¶
type Hat struct {
Name string
WhenToPick string
RetrievalLabels []string
RetrievalBoostKeywords []string
Posture Posture
Phase1Asks string
// AnchorIssueNumbers collects every `#NNN` reference that appears in the
// Anchors paragraph, including PR numbers cited in parentheticals. Issue
// and PR numbers share a namespace on GitHub, so downstream consumers can
// treat these uniformly — but they are not a curated subset of issues.
AnchorIssueNumbers []int
}
Hat is one class entry in the taxonomy.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader caches a parsed Taxonomy with a TTL and returns stale results if a fetch fails after TTL expiry.
func (*Loader) Get ¶
Get returns the current taxonomy, refreshing if the cache is expired. On fetch error, returns the stale cached taxonomy if one exists; otherwise returns the fetch error.
The returned Taxonomy is a shallow copy of the cached value — Hats and their inner slices share backing storage with the cache, so callers must treat the result as read-only. Mutating any slice will corrupt future cache reads.
func (*Loader) Invalidate ¶
func (l *Loader) Invalidate()
Invalidate forces the next Get() to re-fetch.
type Posture ¶
type Posture string
Posture is one of the reasoning postures declared in hats.md.
const ( PostureCausalHypothesis Posture = "causal-hypothesis" PostureWorkaroundMenu Posture = "ambiguous-workaround-menu" PostureCausalNarrative Posture = "internal-regression" PostureDemandGating Posture = "demand-gating-needed" PostureConfigDependent Posture = "config-dependent" PostureBlockedOnUpstream Posture = "blocked-on-upstream" )