MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / LoadForStory

Method LoadForStory

internal/tui/diff.go:51–69  ·  view source on GitHub ↗

LoadForStory fetches the git diff for a specific story's commit. If no commit is found, it shows a "not committed yet" message.

(storyID, title string)

Source from the content-addressed store, hash-verified

49// LoadForStory fetches the git diff for a specific story's commit.
50// If no commit is found, it shows a "not committed yet" message.
51func (d *DiffViewer) LoadForStory(storyID, title string) {
52 d.storyID = storyID
53
54 // Find the commit for this story (match both ID and title to avoid
55 // false positives from previous PRD runs with the same story IDs)
56 commitHash, err := git.FindCommitForStory(d.baseDir, storyID, title)
57 if err != nil || commitHash == "" {
58 d.noCommit = true
59 d.offset = 0
60 d.loaded = true
61 d.err = nil
62 d.lines = nil
63 d.stats = ""
64 return
65 }
66
67 d.noCommit = false
68 d.loadDiff(storyID, commitHash)
69}
70
71// loadDiff loads a diff, either for a specific commit or the full branch.
72func (d *DiffViewer) loadDiff(storyID, commitHash string) {

Callers 1

UpdateMethod · 0.80

Calls 2

loadDiffMethod · 0.95
FindCommitForStoryFunction · 0.92

Tested by

no test coverage detected