MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / FormatChangesForDisplay

Function FormatChangesForDisplay

internal/cli/activity_changes.go:34–55  ·  view source on GitHub ↗

FormatChangesForDisplay is the Go twin of formatChangesForDisplay in web/src/lib/utils/activityChanges.ts (BUG-2789). It sanitises an activity row's `changes` metadata string for a surface where a HUMAN reads it: the CLI's `pad project activity` and `pad workspace audit-log`. The rules, and the reas

(changes string)

Source from the content-addressed store, hash-verified

32// The wire surfaces (REST, --format json, bootstrap, MCP) return the metadata
33// verbatim by design; this is a display rule only.
34func FormatChangesForDisplay(changes string) string {
35 if changes == "" {
36 return ""
37 }
38 var kept []string
39 for _, part := range strings.Split(changes, ";") {
40 trimmed := strings.TrimFunc(part, jsIsSpace)
41 colon := strings.IndexByte(trimmed, ':')
42 if colon == -1 {
43 continue
44 }
45 field := strings.TrimFunc(trimmed[:colon], jsIsSpace)
46 if !looksLikeFieldKey(field) || suppressedChangeFields[field] {
47 continue
48 }
49 if !strings.Contains(trimmed[colon+1:], "→") {
50 continue
51 }
52 kept = append(kept, trimmed)
53 }
54 return strings.Join(kept, "; ")
55}
56
57var suppressedChangeFields = map[string]bool{"implementation_notes": true, "decision_log": true}
58

Callers 3

auditLogDetailFunction · 0.92
activityCmdFunction · 0.92

Calls 3

appendFunction · 0.85
JoinMethod · 0.80
looksLikeFieldKeyFunction · 0.70