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:
VERSE
2026-07-26 19:10:56 +07:00
committed by GitHub
parent 85ac76e85a
commit 6ffb9f83f2
20 changed files with 1004 additions and 72 deletions
+7 -2
View File
@@ -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