Skip to content

Commit ddd023d

Browse files
committed
Update summary generation and prompt templates
* refactor: Modify command summary to generate final summary from prompts and improve flow * fix: Correct conditional check in helpers.sh for dry-run behavior * style: Adjust indentation and commenting for clarity * docs: Update templates/summary_prompt.md to provide clearer instructions for changelog formatting * feat: Introduce new template for detailed changelog with sections and tags to enhance readability * chore: Clean up temporary file usage for better resource management
1 parent f52fc22 commit ddd023d

File tree

4 files changed

+74
-17
lines changed

4 files changed

+74
-17
lines changed

src/giv.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,9 @@ cmd_summary() {
537537
sum_output_file="${1:-}"
538538
sum_revision="${2:---current}"
539539
sum_model_mode="${3:-auto}"
540-
sum_dry_run="${4:-}"
540+
#sum_dry_run="${4:-}"
541541

542542
summaries_file=$(portable_mktemp "summary_summaries_XXXXXX.md")
543-
544543
summarize_target "${sum_revision}" "${summaries_file}" "${sum_model_mode}"
545544
print_debug "$(cat "${summaries_file}" || true)"
546545

@@ -550,18 +549,13 @@ cmd_summary() {
550549
exit 1
551550
fi
552551

553-
if [ -n "${sum_output_file}" ]; then
554-
if [ "${sum_dry_run}" != "true" ]; then
555-
cp "${summaries_file}" "${sum_output_file}"
556-
printf 'Summary written to %s\n' "${sum_output_file}"
557-
else
558-
cat "${summaries_file}"
559-
fi
560-
else
561-
cat "${summaries_file}"
562-
fi
552+
# Generate final summary from summaries
553+
prompt_file_name="${PROMPT_DIR}/final_summary_prompt.md"
554+
tmp_prompt_file=$(portable_mktemp "final_summary_prompt_XXXXXX.md")
555+
build_prompt "${prompt_file_name}" "${summaries_file}" >"${tmp_prompt_file}"
556+
print_debug "$(cat "${tmp_prompt_file}" || true)"
557+
generate_from_prompt "${tmp_prompt_file}" "${sum_output_file}" "${sum_model_mode}"
563558
}
564-
565559
cmd_release_notes() {
566560
summaries_file=$(portable_mktemp "release_notes_summaries_XXXXXX.md")
567561
summarize_target "${REVISION}" "${summaries_file}" "${model_mode}"

src/helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ generate_from_prompt() {
407407
fi
408408

409409
# 2) Dry‐run? Just print and exit
410-
if [ "${dry_run:-}" = "true" ]; then
410+
if [ "${dry_run:-}" = "true" ] || [ -z "${response_output_file}" ]; then
411411
printf '%s\n' "$res"
412412
return 0
413413
fi

templates/final_summary_prompt.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[PROJECT_TITLE] [VERSION]
2+
[SUMMARY]
3+
Write a structured, Keep a Changelog–style summary of the provided change summaries.
4+
5+
1. Overview
6+
- Begin with a section summarizing all of the changes, and the purpose and scope of these changes.
7+
8+
2. Change Groups
9+
For each group below (omit any with no entries), include the heading and list bullet points. Each bullet point should prefixed with the type tag:
10+
11+
### Added
12+
- Describe each new feature: what changed, why it was added, and its impact.
13+
- Mention affected files or components when relevant.
14+
15+
### Fixed
16+
- Describe each bug fix: what was broken, how it’s now resolved, and any side-effects.
17+
- Reference files or tests updated.
18+
19+
### Documentation
20+
- Summarize documentation updates: what was clarified or added, and why.
21+
22+
### Style
23+
- List formatting or lint changes; note any tooling/formatter updates.
24+
25+
### Refactored
26+
- Explain code restructuring: what modules or components were reorganized and benefit gained.
27+
28+
### Performance
29+
- Detail optimizations: what was improved and performance gains measured.
30+
31+
### Tests
32+
- Outline new or updated tests: what scenarios now covered or fixed.
33+
34+
### Build
35+
- Note changes to build scripts, dependencies, or CI configurations.
36+
37+
### CI/CD
38+
- Summarize pipeline/job changes or additions.
39+
40+
### Chores
41+
- Miscellaneous maintenance tasks not covered above.
42+
43+
### Security
44+
- Describe any security patches or vulnerability fixes.
45+
46+
3. Formatting & Tone
47+
- Use bullet points (`- `) under each heading
48+
- Write in natural, professional language—avoid raw diff syntax.
49+
- Group related items together and maintain logical order.
50+
- Do not include groups with no related items.
51+
- Each list item should provide enough detail to understand the change.
52+
53+
4. Processing Instructions
54+
- Review the provided change summaries.
55+
- Assign changes to the appropriate group above.
56+
- Extract file paths or components when pertinent.
57+
- If possible, explain "what" changed, "why," and the "impact."
58+
- Only use information provided in this content in your response.
59+
- Consolidate related changes from different summaries to avoid duplicating information.
60+
- Determine if older changes have been superseded and use only the latest information.
61+
62+
[EXAMPLE]
63+
[RULES]

templates/summary_prompt.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ Write a structured, Keep a Changelog–style summary of the provided git diff. D
4848
- Keep each bullet under 120 characters.
4949
- Write in natural, professional language—avoid raw diff syntax.
5050
- Group related items together and maintain logical order.
51+
- Do not include groups with no related items.
5152
- Each list item should provide enough detail to understand the change.
5253

5354
4. Processing Instructions
5455
- Parse the git diff to detect each change’s type.
5556
- Assign changes to the appropriate group above.
5657
- Extract file paths or components when pertinent.
57-
- If possible, explain "what" changed, "why," and the "impact."
58-
- Only use information provided in this content in your response.
58+
- If possible, explain "what" changed, "why," and the "impact."
59+
- Only use information provided in this content in your response.
5960

6061
[EXAMPLE]
6162
[RULES]
62-

0 commit comments

Comments
 (0)