MCPcopy Create free account
hub / github.com/JordanCoin/codemap / hookSessionStop

Function hookSessionStop

cmd/hooks.go:1115–1227  ·  view source on GitHub ↗

hookSessionStop summarizes what changed in the session and stops the daemon

(root string)

Source from the content-addressed store, hash-verified

1113
1114// hookSessionStop summarizes what changed in the session and stops the daemon
1115func hookSessionStop(root string) error {
1116 // Read state BEFORE stopping daemon (includes timeline)
1117 state := watch.ReadState(root)
1118
1119 // Stop the watch daemon
1120 stopDaemon(root)
1121
1122 fmt.Println()
1123 fmt.Println("📊 Session Summary")
1124 fmt.Println("==================")
1125
1126 // Show timeline from daemon events (if available)
1127 if state != nil && len(state.RecentEvents) > 0 {
1128 fmt.Println()
1129 fmt.Println("Edit Timeline:")
1130
1131 // Calculate stats
1132 totalDelta := 0
1133 fileEdits := make(map[string]int) // file -> edit count
1134 hubEdits := 0
1135
1136 for _, e := range state.RecentEvents {
1137 totalDelta += e.Delta
1138 fileEdits[e.Path]++
1139 if e.IsHub {
1140 hubEdits++
1141 }
1142 }
1143
1144 // Show last 10 events
1145 events := state.RecentEvents
1146 start := 0
1147 if len(events) > 10 {
1148 start = len(events) - 10
1149 fmt.Printf(" ... %d earlier events\n", start)
1150 }
1151
1152 for _, e := range events[start:] {
1153 deltaStr := ""
1154 if e.Delta > 0 {
1155 deltaStr = fmt.Sprintf(" +%d", e.Delta)
1156 } else if e.Delta < 0 {
1157 deltaStr = fmt.Sprintf(" %d", e.Delta)
1158 }
1159
1160 hubStr := ""
1161 if e.IsHub {
1162 hubStr = " ⚠️HUB"
1163 }
1164
1165 fmt.Printf(" %s %-6s %s%s%s\n",
1166 e.Time.Format("15:04:05"),
1167 e.Op,
1168 e.Path,
1169 deltaStr,
1170 hubStr,
1171 )
1172 }

Callers 2

RunHookFunction · 0.85

Calls 5

ReadStateFunction · 0.92
stopDaemonFunction · 0.85
getHubInfoNoFallbackFunction · 0.85
writeSessionHandoffFunction · 0.85
isHubMethod · 0.80

Tested by 1