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

Function buildMixedCommitMessage

apps/cli/internal/cli/commit_msg.go:231–266  ·  view source on GitHub ↗

buildMixedCommitMessage generates a commit message covering multiple change types. Subject line uses semicolon-separated segments: "chore: complete task 042; add task 045"

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

Source from the content-addressed store, hash-verified

229// buildMixedCommitMessage generates a commit message covering multiple change types.
230// Subject line uses semicolon-separated segments: "chore: complete task 042; add task 045"
231func buildMixedCommitMessage(changes TaskChanges, commitType string, includeBody, short bool) string {
232 var segments []string
233
234 if len(changes.Completed) > 0 {
235 segments = append(segments, changeSegment("complete", changes.Completed))
236 }
237 if len(changes.Added) > 0 {
238 segments = append(segments, changeSegment("add", changes.Added))
239 }
240 if len(changes.Started) > 0 {
241 segments = append(segments, changeSegment("start", changes.Started))
242 }
243 if len(changes.Blocked) > 0 {
244 segments = append(segments, changeSegment("block", changes.Blocked))
245 }
246 if len(changes.Cancelled) > 0 {
247 segments = append(segments, changeSegment("cancel", changes.Cancelled))
248 }
249
250 subject := fmt.Sprintf("%s: %s", commitType, strings.Join(segments, "; "))
251 if short {
252 return subject + "\n"
253 }
254
255 var parts []string
256 parts = append(parts, subject)
257
258 if includeBody {
259 body := buildMixedBody(changes)
260 if body != "" {
261 parts = append(parts, body)
262 }
263 }
264
265 return strings.Join(parts, "\n\n") + "\n"
266}
267
268// changeSegment returns a string like "complete task 042" or "add tasks 045, 046".
269func changeSegment(verb string, tasks []*model.Task) string {

Callers 2

buildMessageFromChangesFunction · 0.85

Calls 2

changeSegmentFunction · 0.85
buildMixedBodyFunction · 0.85

Tested by 1