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:
+7
-2
@@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/versenilvis/iris/internal/workspace"
|
||||
"github.com/versenilvis/iris/spec"
|
||||
)
|
||||
|
||||
@@ -67,8 +68,8 @@ func getGitResultsFiltered(tokens []string, localOnly bool, args ...string) []sp
|
||||
return nil
|
||||
}
|
||||
|
||||
activeBranch := ""
|
||||
if args[0] == "branch" {
|
||||
activeBranch := workspace.DetectCached(cwd).GitBranch
|
||||
if activeBranch == "" && args[0] == "branch" {
|
||||
activeCmd := exec.CommandContext(ctx, "git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||
activeCmd.Dir = cwd
|
||||
if activeOut, err := activeCmd.Output(); err == nil {
|
||||
@@ -152,9 +153,13 @@ func getGitResultsFiltered(tokens []string, localOnly bool, args ...string) []sp
|
||||
})
|
||||
}
|
||||
|
||||
if activeBranch == "" {
|
||||
activeBranch = workspace.DetectCached(cwd).GitBranch
|
||||
}
|
||||
if activeBranch != "" {
|
||||
for i, r := range results {
|
||||
if r.Cmd == activeBranch {
|
||||
r.Priority = 100
|
||||
copy(results[1:i+1], results[0:i])
|
||||
results[0] = r
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user