Skip to content

Commit 665ce9b

Browse files
committed
Update prompts, add summarizer utilities with GPL header, clean docs
1 parent 30c45de commit 665ce9b

4 files changed

Lines changed: 35 additions & 41 deletions

File tree

src/codestory/core/filters/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
# * along with this program; if not, you can contact us at support@codestory.build
1616
# */
1717
# -----------------------------------------------------------------------------
18-
"""
19-
Summarization module for generating commit message summaries from code chunks.
20-
"""
2118

2219
from codestory.core.diff.data.atomic_container import AtomicContainer
2320
from codestory.core.logging.utils import describe_container

src/codestory/core/semantic_analysis/summarization/prompts.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
# Single Chunk Summary Prompts
2626
# -----------------------------------------------------------------------------
2727

28-
INITIAL_SUMMARY_SYSTEM = """You are an expert developer writing Git commit messages.
28+
INITIAL_SUMMARY_SYSTEM = """You are an expert developer writing Git commit messages.
2929
30-
Given code changes with git patches and metadata (added/removed/modified symbols), write a concise commit message that describes what changed.
30+
Given a code change with a diff patch and optional metadata (languages, scopes, symbols), write a concise commit message.
3131
{message}
3232
Rules:
3333
- Single line, max 72 characters
@@ -48,23 +48,23 @@
4848

4949
BATCHED_SUMMARY_SYSTEM = """You are an expert developer writing Git commit messages.
5050
51-
Given a JSON array of code changes, write a commit message for each one. Each change includes git patches and metadata about added/removed/modified symbols.
51+
Given multiple code changes (each with diff patches and optional metadata), write one commit message per change.
5252
{message}
5353
Rules:
54-
- Output a JSON array of strings with one message per input change
54+
- Output a numbered list with one message per change
5555
- Each message: single line, max 72 characters, imperative mood
56-
- Output ONLY the JSON array, no other text
5756
- Match the input order exactly
5857
59-
Example:
60-
Input: [{{"git_patch": "..."}}, {{"git_patch": "..."}}]
61-
Output: ["Add user authentication", "Update config parser"]"""
58+
Example output:
59+
1. Add user authentication
60+
2. Update config parser
61+
3. Fix memory leak in cache"""
6262

6363
BATCHED_SUMMARY_USER = """Here are {count} code changes:
6464
6565
{changes}
6666
67-
Provide {count} commit messages as a JSON array:"""
67+
Provide {count} commit messages as a numbered list:"""
6868

6969

7070
# -----------------------------------------------------------------------------
@@ -90,20 +90,19 @@
9090

9191
BATCHED_CLUSTER_SUMMARY_SYSTEM = """You are an expert developer writing Git commit messages.
9292
93-
Given a JSON array where each element contains multiple related commit messages, combine each group into one cohesive commit message.
93+
Given multiple groups of related commit messages, combine each group into one cohesive commit message.
9494
{message}
9595
Rules:
96-
- Output a JSON array of strings with one message per input group
96+
- Output a numbered list with one message per group
9797
- Each message: single line, max 72 characters, imperative mood
98-
- Output ONLY the JSON array, no other text
9998
- Match the input order exactly
10099
101-
Example:
102-
Input: [["Add login", "Add logout"], ["Fix parser", "Update tests"]]
103-
Output: ["Add authentication system", "Fix parser and update tests"]"""
100+
Example output:
101+
1. Add authentication system
102+
2. Fix parser and update tests"""
104103

105104
BATCHED_CLUSTER_SUMMARY_USER = """Here are {count} groups of related commit messages:
106105
107106
{groups}
108107
109-
Provide {count} combined commit messages as a JSON array:"""
108+
Provide {count} combined commit messages as a numbered list:"""

src/codestory/core/semantic_analysis/summarization/summarizer_utils.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# -----------------------------------------------------------------------------
2+
# /*
3+
# * Copyright (C) 2025 CodeStory
4+
# *
5+
# * This program is free software; you can redistribute it and/or modify
6+
# * it under the terms of the GNU General Public License as published by
7+
# * the Free Software Foundation; Version 2.
8+
# *
9+
# * This program is distributed in the hope that it will be useful,
10+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# * GNU General Public License for more details.
13+
# *
14+
# * You should have received a copy of the GNU General Public License
15+
# * along with this program; if not, you can contact us at support@codestory.build
16+
# */
17+
# -----------------------------------------------------------------------------
18+
"""Utilities for preparing annotated patches from chunks for summarization."""
19+
20+
from __future__ import annotations
121

222
from typing import TYPE_CHECKING
323

src/codestory/summarization/summarizer_utils.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)