@entro314labs/ai-changelog-generator 3.7.0 → 3.8.0

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.
@@ -288,9 +288,13 @@ export class JsonUtils {
288
288
  if (typeof obj === 'string') {
289
289
  strings.push(obj)
290
290
  } else if (Array.isArray(obj)) {
291
- obj.forEach((item) => JsonUtils.extractStrings(item, strings))
291
+ obj.forEach((item) => {
292
+ JsonUtils.extractStrings(item, strings)
293
+ })
292
294
  } else if (obj && typeof obj === 'object') {
293
- Object.values(obj).forEach((value) => JsonUtils.extractStrings(value, strings))
295
+ Object.values(obj).forEach((value) => {
296
+ JsonUtils.extractStrings(value, strings)
297
+ })
294
298
  }
295
299
  return strings
296
300
  }
@@ -720,7 +720,9 @@ export function throttle(func, limit) {
720
720
  if (!inThrottle) {
721
721
  func.apply(this, args)
722
722
  inThrottle = true
723
- setTimeout(() => (inThrottle = false), limit)
723
+ setTimeout(() => {
724
+ inThrottle = false
725
+ }, limit)
724
726
  }
725
727
  }
726
728
  }
@@ -814,7 +816,9 @@ export function analyzeSemanticChanges(diff, filePath) {
814
816
  const matches = [...diff.matchAll(regex)]
815
817
  if (matches.length > 0) {
816
818
  analysis.patterns.add(pattern)
817
- matches.forEach((match) => analysis.codeElements.add(match[1]))
819
+ matches.forEach((match) => {
820
+ analysis.codeElements.add(match[1])
821
+ })
818
822
  }
819
823
  })
820
824
 
@@ -1059,14 +1063,11 @@ export function buildEnhancedPrompt(commitAnalysis, analysisMode = 'standard') {
1059
1063
  const {
1060
1064
  subject,
1061
1065
  files = [],
1062
- semanticAnalysis = {},
1063
- diffStats = {},
1064
- complexity = {},
1065
- riskAssessment = {},
1066
+ // semanticAnalysis, diffStats, complexity, riskAssessment - unused
1066
1067
  } = commitAnalysis
1067
1068
 
1068
1069
  // Detect merge commits and upgrade analysis mode for better specificity
1069
- const isMergeCommit = subject && subject.toLowerCase().includes('merge')
1070
+ const isMergeCommit = subject?.toLowerCase().includes('merge')
1070
1071
  const effectiveAnalysisMode = isMergeCommit && files.length > 10 ? 'detailed' : analysisMode
1071
1072
 
1072
1073
  // Debug logging for merge commits (disabled)
@@ -1185,7 +1186,7 @@ Provide a JSON response with ONLY these fields (use definitive language - NO "li
1185
1186
  * Validate and correct AI categorization and impact assessment based on commit characteristics
1186
1187
  */
1187
1188
  export function validateCommitCategory(category, commitAnalysis) {
1188
- const { files = [], diffStats = {}, subject = '' } = commitAnalysis
1189
+ const { files = [] } = commitAnalysis
1189
1190
  const fileCount = files.length
1190
1191
  const addedFiles = files.filter((f) => f.status === 'A' || f.status === '??').length
1191
1192
  const { insertions = 0, deletions = 0 } = diffStats
@@ -1431,9 +1432,13 @@ function extractCategoryFromText(content) {
1431
1432
  *
1432
1433
  * @returns {Array} Array of change objects with status and filePath
1433
1434
  */
1434
- export function getWorkingDirectoryChanges() {
1435
+ export function getWorkingDirectoryChanges(cwd = undefined) {
1435
1436
  try {
1436
- const result = execSync('git status --porcelain', { encoding: 'utf8' })
1437
+ const execOptions = { encoding: 'utf8' }
1438
+ if (cwd) {
1439
+ execOptions.cwd = cwd
1440
+ }
1441
+ const result = execSync('git status --porcelain', execOptions)
1437
1442
 
1438
1443
  if (!result.trim()) {
1439
1444
  return []
@@ -1621,6 +1626,7 @@ export function summarizeFileChanges(changes) {
1621
1626
  summary,
1622
1627
  categories,
1623
1628
  stats,
1629
+ totalFiles: changes.length,
1624
1630
  languages: Array.from(languages),
1625
1631
  }
1626
1632
  }