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:
@@ -36,6 +36,22 @@ var DefaultContextRules = []ContextRule{
|
||||
},
|
||||
bonus: 40,
|
||||
},
|
||||
&SimpleContextRule{
|
||||
check: func(ws workspace.WorkspaceInfo, cmd string) bool {
|
||||
if !ws.HasGit || ws.GitBranch == "" {
|
||||
return false
|
||||
}
|
||||
isRelevantCmd := strings.HasPrefix(cmd, "git push") || strings.HasPrefix(cmd, "git pull") ||
|
||||
strings.HasPrefix(cmd, "git checkout") || strings.HasPrefix(cmd, "git switch") ||
|
||||
strings.HasPrefix(cmd, "git branch") || strings.HasPrefix(cmd, "git merge") ||
|
||||
strings.HasPrefix(cmd, "git rebase")
|
||||
if !isRelevantCmd {
|
||||
return false
|
||||
}
|
||||
return strings.HasSuffix(cmd, " "+ws.GitBranch) || strings.Contains(cmd, " "+ws.GitBranch+" ")
|
||||
},
|
||||
bonus: 60,
|
||||
},
|
||||
&SimpleContextRule{
|
||||
check: func(ws workspace.WorkspaceInfo, cmd string) bool {
|
||||
return ws.HasGit && (strings.HasPrefix(cmd, "git init") || strings.HasPrefix(cmd, "git clone"))
|
||||
|
||||
Reference in New Issue
Block a user