Skip to content

Commit 9a9a2cc

Browse files
committed
Enhanced Commit Metadata & Documentation
Added print_commit_metadata function for consistent display of commit info Updated template files with clearer instructions and new sections like "Announcement Request" and "Summary Request" Fixed test cases in summarize_target.bats suite for more accurate validation
1 parent f5b0072 commit 9a9a2cc

File tree

7 files changed

+86
-27
lines changed

7 files changed

+86
-27
lines changed

ANNOUNCEMENT.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Introducing giv v1.0.3 – October 2024
2+
3+
Exciting news! We're thrilled to announce the latest update to giv, packed with features that will enhance your experience and streamline your workflow.
4+
5+
## What’s New
6+
7+
### Improved Commit Metadata Display
8+
We've added a new function called `print_commit_metadata` in our helper tools. This addition ensures that commit information is displayed consistently across all platforms, making it easier for you to track changes and maintain project history.
9+
10+
### Enhanced Documentation Templates
11+
Our documentation templates have received a major overhaul with clearer instructions and the introduction of new sections like "Announcement Request" and "Summary Request". These updates aim to provide you with more comprehensive guidance when working with giv.
12+
13+
### More Reliable Testing
14+
We've corrected several test cases in our `summarize_target.bats` suite, ensuring they now properly validate output. This means that our tests are more accurate than ever before, giving you confidence in the reliability of giv's features.
15+
16+
## Real-World Impact
17+
18+
With these updates, users can expect a more seamless and consistent experience when working with giv. The enhanced documentation templates make it easier to understand and utilize the software effectively, while improved testing ensures that all features work as intended every time.
19+
20+
Whether you're a developer looking for streamlined commit metadata display or a project manager needing comprehensive documentation, this update has something for everyone.
21+
22+
## Getting Started
23+
24+
Ready to experience these exciting updates? If you haven't already, download giv from our [website](https://giv.io/download). For existing users, simply upgrade to the latest version by running:
25+
26+
```sh
27+
giv upgrade
28+
```
29+
30+
## What’s Next?
31+
32+
We're constantly working on new features and improvements. Keep an eye out for upcoming releases that will bring even more functionality and ease of use to giv.
33+
34+
## Conclusion
35+
36+
Don't miss out on these game-changing updates! Download or upgrade to giv v1.0.3 today and experience the difference for yourself. If you have any questions or feedback, feel free to reach out to our support team at [support@giv.io](mailto:support@giv.io).
37+
38+
Happy coding! 🚀

src/helpers.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@ get_commit_date() {
548548
fi
549549
}
550550

551+
print_commit_metadata() {
552+
commit="$1"
553+
commit_version="$(get_version_info "$commit" "$(find_version_file)")"
554+
printf '**Project Title:*** %s\n' "$(get_project_title)"
555+
printf '**Version:*** %s\n' "${commit_version}"
556+
printf '**Commit ID:*** %s\n' "$commit"
557+
printf '**Date:** %s\n' "$(get_commit_date "$commit")"
558+
printf '**Message:** %s\n' "$(get_message_header "$commit")"
559+
}
560+
551561
# Replaces every “[NAME]” in stdin with the contents of
552562
# the environment variable GIV_TOKEN_NAME (if set).
553563
#
@@ -677,18 +687,17 @@ build_history() {
677687
fi
678688

679689
# header
680-
printf '**Commit ID:*** %s\n' "$commit" >>"$hist"
690+
printf '### Commit ID %s\n' "$commit" >>"$hist"
681691
printf '**Date:** %s\n' "$(get_commit_date "$commit")" >>"$hist"
682-
msg=$(get_message_header "$commit")
683-
printf '**Message:** %s\n' "$msg" >>"$hist"
684-
685692
# version
686693
vf=$(find_version_file)
687694
[ -n "$vf" ] && print_debug "Found version file: $vf"
688695
[ -n "$vf" ] && {
689696
ver=$(get_version_info "$commit" "$vf")
690697
[ -n "$ver" ] && printf '**Version:** %s\n' "$ver" >>"$hist"
691698
}
699+
msg=$(get_message_header "$commit")
700+
printf '**Message:** %s\n' "$msg" >>"$hist"
692701

693702
# diff
694703
diff_out=$(build_diff "$commit" "$diff_pattern" "$debug")
@@ -876,7 +885,7 @@ summarize_target() {
876885
if git rev-parse --verify "$target" >/dev/null 2>&1; then
877886
print_debug "Summarizing single commit: $target"
878887
summarize_commit "$target" "$gen_mode" >>"$summaries_file"
879-
printf '\n' >>"$summaries_file"
888+
printf '\n========================\n\n' >>"$summaries_file"
880889
return
881890
fi
882891

@@ -922,17 +931,9 @@ summarize_commit() {
922931
print_debug "Using summary prompt: ${summary_template}"
923932
printf '%s\n' "${summary_template}" >"${pr}"
924933
res=$(generate_response "${pr}" "${gen_mode}" "0.9" "32768")
925-
# header
926-
927-
printf '**Project Title:*** %s\n' "$(get_project_title)" >"$res_file"
928-
{
929-
printf '**Version:*** %s\n' "${sc_version}"
930-
printf '**Commit ID:*** %s\n' "$commit"
931-
printf '**Date:** %s\n' "$(get_commit_date "$commit")"
932-
printf '**Message:** %s\n' "$(get_message_header "$commit")"
933-
printf '========================\n\n'
934-
} >>"$res_file"
935934

935+
print_commit_metadata "$commit" >"$res_file"
936+
printf '\n\n' >>"$res_file"
936937
echo "${res}" >>"${res_file}"
937938

938939
printf '%s\n' "${res}"

templates/announcement_prompt.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
# Summary of Changes
1+
# Announcement Request
22

3+
## Recent Changes
4+
5+
```markdown
36
[SUMMARY]
7+
```
8+
9+
## Instructions
410

5-
Write one engaging blog post announcing the [VERSION] release of [PROJECT_TITLE], using the following guidelines:
11+
Write one engaging blog post announcing the recent changes to [PROJECT_TITLE], using the information in the [Recent Changes](#recent-changes) section and the following guidelines:
612

713
1. Audience & Tone
814
• General audience interested in the software
@@ -40,3 +46,4 @@ Write one engaging blog post announcing the [VERSION] release of [PROJECT_TITLE]
4046
• Ensure all technical details are translated into user-friendly language
4147

4248
[RULES]
49+
[EXAMPLE]

templates/final_summary_prompt.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
[PROJECT_TITLE] [VERSION]
1+
# Summary Request
2+
Project: [PROJECT_TITLE]
3+
4+
5+
## Recent Changes
26
[SUMMARY]
3-
Write a structured, Keep a Changelog–style summary of the provided change summaries.
7+
8+
## Instructions
9+
10+
Write a structured, summary of the recent changes.
411

512
1. Overview
613
- Begin with a section summarizing all of the changes, and the purpose and scope of these changes.

templates/message_prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Summary of Changes
1+
# Commit Message Request
22

33
[SUMMARY]
44

templates/summary_prompt.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
[PROJECT_TITLE] [VERSION]
1+
# Summary Request
2+
Project: [PROJECT_TITLE]
3+
4+
## Git Diff
25
[SUMMARY]
6+
7+
## Instructions
8+
39
Write a structured, Keep a Changelog–style summary of the provided git diff. Do not include any version headings or other releases—just one section of grouped changes with type prefixes for each list item.
410

511
1. Overview

tests/summarize_target.bats

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ setup() {
55
TMP_REPO="$BATS_TEST_DIRNAME/.tmp/tmp_repo"
66
rm -rf "$TMP_REPO"
77
mkdir -p "$TMP_REPO"
8-
cd "$TMP_REPO"
8+
cd "$TMP_REPO" || exit 1
99
git init -q
1010
git config user.name "Test"
1111
git config user.email "test@example.com"
12-
12+
1313
# Make two commits
1414
echo "first" >a.txt
1515
git add a.txt
@@ -54,7 +54,7 @@ teardown() {
5454
run cat "$summaries"
5555
# lines: SUMMARIZE:--current MODE:mymode then blank
5656
[ "${lines[0]}" = "SUMMARIZE:--current MODE:mymode" ]
57-
[ -z "${lines[1]}" ]
57+
[ -z "${lines[2]}" ]
5858
}
5959

6060
@test "summarize single commit writes exactly that commit" {
@@ -63,7 +63,7 @@ teardown() {
6363
[ "$status" -eq 0 ]
6464
run cat "$summaries"
6565
[ "${lines[0]}" = "SUMMARIZE:$FIRST_SHA MODE:xyz" ]
66-
[ -z "${lines[1]}" ]
66+
[ -z "${lines[2]}" ]
6767
}
6868
@test "summarize two-dot range writes both commits" {
6969
summaries=$(mktemp)
@@ -151,9 +151,9 @@ teardown() {
151151
[ "$status" -eq 0 ]
152152

153153
run grep -v '^$' "$summaries"
154-
154+
printf '%s\n' "$output"
155155
[ "$status" -eq 0 ]
156-
[ "${#lines[@]}" -eq 1 ]
156+
[ "${#lines[@]}" -eq 2 ]
157157
[ "${lines[0]}" = "SUMMARIZE:HEAD~1 MODE:x" ]
158158
}
159159

0 commit comments

Comments
 (0)