Documentation
¶
Overview ¶
Package pattern turns a stream of recorded commands into reusable-recipe suggestions, deterministically and without any machine learning.
The approach is structural template mining (the Drain/IPLoM family applied to shell commands): commands are tokenized and grouped by a structural signature, then the slots that vary across a group's occurrences become fill-in-the-blank parameters. Crucially, what counts as a "value" is learned from observed variation — yore never has to understand a token's meaning — so the whole thing is a pure function of the input, reproducible and offline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Candidate ¶
type Candidate struct {
Name string // proposed recipe name
Template string // command with {blanks}, ready to display/save
Params []Param // the blanks, in template order
Count int // occurrences (within the recency window)
Dirs []string // distinct directories it ran in (capped)
LastUsed time.Time // most recent occurrence
Key string // stable structural id, for dedup and dismissal
}
Candidate is a suggested recipe mined from repeated usage.
func Detect ¶
func Detect(obs []Observation, opts Options) []Candidate
Detect mines suggestions from observations. It is deterministic: the same input always yields the same candidates.
type Observation ¶
Observation is one recorded command run, the only input the engine needs.
type Options ¶
type Options struct {
MinCount int // minimum occurrences to suggest (default 5)
RecentWithin time.Duration // ignore commands older than this (default 30d; 0 = no limit)
Now time.Time // reference time (default time.Now)
MaxValues int // cap on evidence values shown per param (default 5)
Limit int // cap on candidates returned (0 = all)
}
Options tunes detection.