@@ -24,43 +24,63 @@ func headerTitle(appVersion string, gitAvailable bool) string {
2424 return title
2525}
2626
27- func showContext (gitAvailable bool ) {
27+ func GetStatusLines (gitAvailable bool ) [] string {
2828 cfg := config .Load ()
2929 projectDir := cfg .GetWorkDir ()
3030
31- width := 42
32- fmt . Println ( ui . Cyan + "┏" + strings . Repeat ( "━" , width - 2 ) + "┓" + ui . Reset )
33- fmt . Printf ( ui . Cyan + "┃ " + ui . Reset + ui . Bold + "PROJECT: " + ui . Reset + "%-*s" + ui . Cyan + " ┃ \n " + ui . Reset , width - 13 , filepath . Base ( projectDir ) )
34- fmt . Printf ( ui . Cyan + "┃ " + ui . Reset + "Path : %-*s" + ui . Cyan + " ┃ \n " + ui . Reset , width - 11 , projectDir )
35-
31+ var info [] string
32+ branch := "-"
33+ remote := system . CurrentRemote ( )
34+ sync := "0 ahead / 0 behind"
35+
3636 if gitAvailable {
3737 state := gitops .InspectRepoState ()
38- fmt .Printf (ui .Cyan + "┃ " + ui .Reset + "Branch : %-*s" + ui .Cyan + " ┃\n " + ui .Reset , width - 11 , state .Branch )
39- fmt .Printf (ui .Cyan + "┃ " + ui .Reset + "Remote : %-*s" + ui .Cyan + " ┃\n " + ui .Reset , width - 11 , system .CurrentRemote ())
38+ branch = state .Branch
4039 if state .HasAheadBehind {
41- fmt . Printf ( ui . Cyan + "┃ " + ui . Reset + "Sync : %-*s" + ui . Cyan + " ┃ \n " + ui . Reset , width - 11 , state .AheadBehindSummary () )
40+ sync = state .AheadBehindSummary ()
4241 }
43- } else {
44- fmt .Printf (ui .Cyan + "┃ " + ui .Reset + "Mode : %-*s" + ui .Cyan + " ┃\n " + ui .Reset , width - 11 , "Limited (Git unavailable)" )
4542 }
4643
47- if cfg .Owner != "" && cfg .Repo != "" {
48- repoURL := "github.com/" + cfg .Owner + "/" + cfg .Repo
49- fmt .Printf (ui .Cyan + "┃ " + ui .Reset + "GitHub : %-*s" + ui .Cyan + " ┃\n " + ui .Reset , width - 11 , repoURL )
50- }
44+ info = append (info , fmt .Sprintf ("Project : %s" , filepath .Base (projectDir )))
45+ info = append (info , fmt .Sprintf ("Branch : %s" , branch ))
46+ info = append (info , fmt .Sprintf ("Remote : %s" , remote ))
47+ info = append (info , fmt .Sprintf ("Sync : %s" , sync ))
48+
49+ // Dynamic Health Check & Assistant
50+ statusText := "HEALTHY"
51+ nextAction := "Ready for work"
5152
52- suggestions := config .HistorySuggestions (projectDir )
53- if len (suggestions ) > 0 {
54- fmt .Println (ui .Cyan + "┣" + strings .Repeat ("━" , width - 2 ) + "┫" + ui .Reset )
55- for _ , s := range suggestions {
56- fmt .Printf (ui .Cyan + "┃ " + ui .Reset + ui .Yellow + " " + ui .Reset + "%-*s" + ui .Cyan + " ┃\n " + ui .Reset , width - 13 , s )
53+ if ! gitAvailable {
54+ statusText = "LIMITED"
55+ nextAction = "Install Git"
56+ } else {
57+ state := gitops .InspectRepoState ()
58+ if state .HasConflicts {
59+ statusText = "CONFLICT"
60+ nextAction = "Fix Merge Conflicts"
61+ } else if state .WorkingTreeDirty {
62+ nextAction = "Commit your changes"
63+ } else if state .Ahead > 0 {
64+ nextAction = fmt .Sprintf ("Push %d commits" , state .Ahead )
65+ } else if state .Behind > 0 {
66+ nextAction = "Pull latest changes"
67+ } else if state .NeedsFirstPush {
68+ nextAction = "Publish repository"
5769 }
5870 }
59- fmt .Println (ui .Cyan + "┗" + strings .Repeat ("━" , width - 2 ) + "┛" + ui .Reset )
60- }
6171
62- func normalizeChoice (s string ) string {
63- return strings .ToLower (strings .TrimSpace (s ))
72+ info = append (info , "" )
73+ info = append (info , fmt .Sprintf ("Status : %s" , statusText ))
74+ info = append (info , fmt .Sprintf ("Next : %s" , nextAction ))
75+
76+ data := gitops .GetRecentActivityData (7 )
77+ if data != nil {
78+ spark := ui .CyberSparkline (data )
79+ info = append (info , "" )
80+ info = append (info , fmt .Sprintf ("Trend : %s" , spark ))
81+ }
82+
83+ return info
6484}
6585
6686func track (section , action string , fn func () bool ) {
0 commit comments