MCPcopy Create free account
hub / github.com/driangle/taskmd / buildMessageFromChanges

Function buildMessageFromChanges

apps/cli/internal/cli/commit_msg.go:107–121  ·  view source on GitHub ↗

buildMessageFromChanges routes to the appropriate message builder based on which change categories are present. Single-category changes use dedicated formats for backward compatibility; mixed changes use the combined format.

(changes TaskChanges, commitType string, includeBody, short bool)

Source from the content-addressed store, hash-verified

105// which change categories are present. Single-category changes use dedicated
106// formats for backward compatibility; mixed changes use the combined format.
107func buildMessageFromChanges(changes TaskChanges, commitType string, includeBody, short bool) string {
108 onlyCompleted := len(changes.Completed) > 0 && len(changes.Added) == 0 &&
109 len(changes.Started) == 0 && len(changes.Blocked) == 0 && len(changes.Cancelled) == 0
110 if onlyCompleted {
111 return buildCommitMessage(changes.Completed, commitType, includeBody, short)
112 }
113
114 onlyAdded := len(changes.Added) > 0 && len(changes.Completed) == 0 &&
115 len(changes.Started) == 0 && len(changes.Blocked) == 0 && len(changes.Cancelled) == 0
116 if onlyAdded {
117 return buildAddedTaskMessage(changes.Added, commitType)
118 }
119
120 return buildMixedCommitMessage(changes, commitType, includeBody, short)
121}
122
123func buildCommitMessage(tasks []*model.Task, commitType string, includeBody, short bool) string {
124 if len(tasks) == 1 {

Callers 1

runCommitMsgFunction · 0.85

Calls 3

buildCommitMessageFunction · 0.85
buildAddedTaskMessageFunction · 0.85
buildMixedCommitMessageFunction · 0.85

Tested by

no test coverage detected