lgit-cli 5.4.0__py3-none-any.whl → 5.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lgit/__init__.py CHANGED
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any
8
8
  try:
9
9
  __version__ = metadata.version("lgit-cli")
10
10
  except metadata.PackageNotFoundError:
11
- __version__ = "5.4.0"
11
+ __version__ = "5.6.0"
12
12
 
13
13
  _CORE_MODEL_EXPORTS = (
14
14
  "Mode",
lgit/api.py CHANGED
@@ -207,19 +207,19 @@ def strip_type_prefix(summary: str, commit_type: str | None = None, scope: str |
207
207
 
208
208
 
209
209
  def summary_from_holistic_analysis(analysis: ConventionalAnalysis, config: CommitConfig, stat: str = "") -> str | None:
210
- """Return a hard-limit-validated holistic summary from analysis, or None."""
211
-
212
- del stat
210
+ """Reuse a compliant analysis summary, repairing tense; return None when a summary call is needed."""
213
211
  if not analysis.summary or not str(analysis.summary).strip():
214
212
  return None
215
- summary = strip_type_prefix(
216
- str(analysis.summary).strip(),
217
- str(analysis.commit_type),
218
- None if analysis.scope is None else str(analysis.scope),
219
- ).rstrip(" .")
220
- if not summary:
213
+ commit_type = str(analysis.commit_type)
214
+ scope = None if analysis.scope is None else str(analysis.scope)
215
+ draft = strip_type_prefix(str(analysis.summary).strip(), commit_type, scope).rstrip(" .")
216
+ summary, _ = _accept_summary(draft, commit_type, stat)
217
+ if summary is None:
218
+ return None
219
+ prefix = f"{commit_type}({scope}): " if scope else f"{commit_type}: "
220
+ if len((prefix + summary).encode("utf-8")) > min(config.summary_soft_limit, config.summary_hard_limit):
221
221
  return None
222
- return str(CommitSummary.from_raw(summary, max_length=config.summary_hard_limit))
222
+ return summary
223
223
 
224
224
 
225
225
  async def generate_summary_from_analysis(
@@ -238,6 +238,7 @@ async def generate_summary_from_analysis(
238
238
  prefix_len = len(commit_type) + 2 + (len(scope) + 2 if scope else 0)
239
239
  chars = max(20, config.summary_guideline - prefix_len)
240
240
  details = "\n".join(f"- {detail}" for detail in analysis.body_texts()) or f"- {analysis.summary or ''}"
241
+ heading = strip_type_prefix(str(analysis.summary or ""), commit_type, scope).rstrip(" .")
241
242
  system_prompt, user_prompt = render_prompt(
242
243
  "summary",
243
244
  {
@@ -245,6 +246,7 @@ async def generate_summary_from_analysis(
245
246
  "scope": scope,
246
247
  "chars": chars,
247
248
  "user_context": user_context or "",
249
+ "draft": heading,
248
250
  "details": details,
249
251
  "stat": condense_stat(stat, max_files=30),
250
252
  },