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 -3
View File
@@ -18,10 +18,11 @@ func TestCollectSignals(t *testing.T) {
}
defer store.Close()
_ = store.Record(context.Background(), "npm run dev", tmpDir)
_ = store.Record(context.Background(), "npm test", "/other/dir")
_ = store.Record(context.Background(), "npm run dev", tmpDir, 0)
_ = store.Record(context.Background(), "npm test", "/other/dir", 0)
_ = store.RecordTransition(context.Background(), "git checkout", "npm run dev", tmpDir, 0)
signals := CollectSignals(context.Background(), tmpDir, "npm", "npm", store)
signals := CollectSignals(context.Background(), tmpDir, "npm", "npm", store, "git checkout")
if !signals.Workspace.HasNodeProject {
t.Error("expected HasNodeProject to be true in collected signals")
@@ -32,4 +33,7 @@ func TestCollectSignals(t *testing.T) {
if len(signals.GlobalFrecency) != 2 {
t.Errorf("expected global frecency to contain 2 entries, got %d", len(signals.GlobalFrecency))
}
if !signals.TransitionIsLocal || len(signals.TransitionEntries) != 1 || signals.TransitionEntries[0].NextSkeleton != "npm run dev" {
t.Errorf("expected transition entry 'npm run dev', got %v (isLocal=%v)", signals.TransitionEntries, signals.TransitionIsLocal)
}
}