feat(scoring): transition workflow learning and fix history UX (#39)
- add transition scoring engine to learn sequential workflows per directory using command skeletons - prioritize current active git branch over older branches in suggestions - restore strict chronological order for history navigation and bypass AI re-ranking - add in-memory session history for instant access to just-run commands - fix PTY prompt not syncing when using arrow keys in the history menu - fix history tie-breaker to properly prioritize newer commands by assigning larger IDs - fix potential mutex deadlock between bufferMu and pty write during history navigation - fix workspace git detection to remove depth limits and correctly identify repositories with detached HEADs - fix SQLite connection leaks in frecency queries - fix global state leaks in history tests by snapshotting and restoring registry states - modernize string prefix checks using strings.CutPrefix
This commit is contained in:
+8
-1
@@ -76,6 +76,13 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
}
|
||||
}
|
||||
|
||||
if mode == "history" && normalizedQuery == "" {
|
||||
if len(deduped) > maxSugg {
|
||||
deduped = deduped[:maxSugg]
|
||||
}
|
||||
return deduped
|
||||
}
|
||||
|
||||
if aiSugg := GetCurrentAISuggestion(); aiSugg != nil {
|
||||
normalizedCmd := strings.TrimSpace(aiSugg.Cmd)
|
||||
if normalizedCmd != "" && normalizedCmd != normalizedQuery && strings.HasPrefix(strings.ToLower(normalizedCmd), strings.ToLower(normalizedQuery)) {
|
||||
@@ -105,7 +112,7 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
ctxTimeout, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
store, _ := scoring.GetFrecencyStore()
|
||||
signals := scoring.CollectSignals(ctxTimeout, cwd, query, rootCmd, store)
|
||||
signals := scoring.CollectSignals(ctxTimeout, cwd, query, rootCmd, store, getPrevSkeleton())
|
||||
scored := scoring.Score(deduped, signals)
|
||||
|
||||
finalResults := make([]spec.Suggestion, 0, len(scored))
|
||||
|
||||
Reference in New Issue
Block a user