@m3hti/commit-genie 3.1.0 → 3.1.1

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.
Files changed (47) hide show
  1. package/dist/services/analyzerService.d.ts +0 -157
  2. package/dist/services/analyzerService.d.ts.map +1 -1
  3. package/dist/services/analyzerService.js +23 -2001
  4. package/dist/services/analyzerService.js.map +1 -1
  5. package/dist/services/breakingChangeDetector.d.ts +9 -0
  6. package/dist/services/breakingChangeDetector.d.ts.map +1 -0
  7. package/dist/services/breakingChangeDetector.js +76 -0
  8. package/dist/services/breakingChangeDetector.js.map +1 -0
  9. package/dist/services/commitTypeDetector.d.ts +32 -0
  10. package/dist/services/commitTypeDetector.d.ts.map +1 -0
  11. package/dist/services/commitTypeDetector.js +490 -0
  12. package/dist/services/commitTypeDetector.js.map +1 -0
  13. package/dist/services/descriptionGenerator.d.ts +58 -0
  14. package/dist/services/descriptionGenerator.d.ts.map +1 -0
  15. package/dist/services/descriptionGenerator.js +569 -0
  16. package/dist/services/descriptionGenerator.js.map +1 -0
  17. package/dist/services/gitService.test.js +242 -24
  18. package/dist/services/gitService.test.js.map +1 -1
  19. package/dist/services/hookService.test.d.ts +2 -0
  20. package/dist/services/hookService.test.d.ts.map +1 -0
  21. package/dist/services/hookService.test.js +182 -0
  22. package/dist/services/hookService.test.js.map +1 -0
  23. package/dist/services/lintService.test.d.ts +2 -0
  24. package/dist/services/lintService.test.d.ts.map +1 -0
  25. package/dist/services/lintService.test.js +288 -0
  26. package/dist/services/lintService.test.js.map +1 -0
  27. package/dist/services/messageBuilder.d.ts +16 -0
  28. package/dist/services/messageBuilder.d.ts.map +1 -0
  29. package/dist/services/messageBuilder.js +135 -0
  30. package/dist/services/messageBuilder.js.map +1 -0
  31. package/dist/services/scopeDetector.d.ts +6 -0
  32. package/dist/services/scopeDetector.d.ts.map +1 -0
  33. package/dist/services/scopeDetector.js +51 -0
  34. package/dist/services/scopeDetector.js.map +1 -0
  35. package/dist/services/semanticAnalyzer.d.ts +25 -0
  36. package/dist/services/semanticAnalyzer.d.ts.map +1 -0
  37. package/dist/services/semanticAnalyzer.js +713 -0
  38. package/dist/services/semanticAnalyzer.js.map +1 -0
  39. package/dist/services/splitService.test.d.ts +2 -0
  40. package/dist/services/splitService.test.d.ts.map +1 -0
  41. package/dist/services/splitService.test.js +190 -0
  42. package/dist/services/splitService.test.js.map +1 -0
  43. package/dist/services/statsService.test.d.ts +2 -0
  44. package/dist/services/statsService.test.d.ts.map +1 -0
  45. package/dist/services/statsService.test.js +211 -0
  46. package/dist/services/statsService.test.js.map +1 -0
  47. package/package.json +1 -1
@@ -0,0 +1,490 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.determineCommitType = determineCommitType;
4
+ exports.hasLogicChanges = hasLogicChanges;
5
+ exports.isFormattingOnlyChange = isFormattingOnlyChange;
6
+ exports.hasOnlyNonStyleJsChanges = hasOnlyNonStyleJsChanges;
7
+ exports.extractNonCommentChanges = extractNonCommentChanges;
8
+ exports.isCommentOnlyChange = isCommentOnlyChange;
9
+ /**
10
+ * Determine the commit type based on analysis
11
+ */
12
+ function determineCommitType(filesAffected, diff, stagedFiles, exportDiff) {
13
+ const diffLower = diff.toLowerCase();
14
+ const cleanedDiff = extractNonCommentChanges(diff);
15
+ const cleanedDiffLower = cleanedDiff.toLowerCase();
16
+ const filePaths = stagedFiles.map((f) => f.path.toLowerCase());
17
+ // === FILE TYPE BASED DETECTION (highest priority) ===
18
+ // If only test files changed
19
+ if (filesAffected.test > 0 &&
20
+ filesAffected.source === 0 &&
21
+ filesAffected.docs === 0) {
22
+ return 'test';
23
+ }
24
+ // If only docs changed
25
+ if (filesAffected.docs > 0 &&
26
+ filesAffected.source === 0 &&
27
+ filesAffected.test === 0) {
28
+ return 'docs';
29
+ }
30
+ // If only config files changed
31
+ if (filesAffected.config > 0 &&
32
+ filesAffected.source === 0 &&
33
+ filesAffected.test === 0 &&
34
+ filesAffected.docs === 0) {
35
+ return 'chore';
36
+ }
37
+ // === DOCS DETECTION (comment-only changes) ===
38
+ // Check if the changes are only adding/modifying comments (documentation)
39
+ if (isCommentOnlyChange(diff)) {
40
+ return 'docs';
41
+ }
42
+ // === FORMATTING-ONLY DETECTION (code style, not CSS) ===
43
+ // Per Conventional Commits: "style" = changes that do not affect the meaning of the code
44
+ // (white-space, formatting, missing semi-colons, etc.)
45
+ if (isFormattingOnlyChange(diff)) {
46
+ return 'style';
47
+ }
48
+ // === STYLE DETECTION (CSS/UI) ===
49
+ // CSS/UI styling changes also classify as "style"
50
+ // Check for CSS/styling file extensions
51
+ const isStyleFile = filePaths.some(p => p.endsWith('.css') ||
52
+ p.endsWith('.scss') ||
53
+ p.endsWith('.sass') ||
54
+ p.endsWith('.less') ||
55
+ p.endsWith('.styl') ||
56
+ p.endsWith('.stylus') ||
57
+ p.includes('.styles.') ||
58
+ p.includes('.style.') ||
59
+ p.includes('styles/') ||
60
+ p.includes('/theme') ||
61
+ p.includes('theme.') ||
62
+ p.includes('.theme.'));
63
+ // Check for styled-components, Tailwind, or inline style changes in diff content
64
+ const hasStyledComponentChanges = /^\+.*\bstyled\s*[.(]/m.test(diff) ||
65
+ /^\+.*\bcss\s*`/m.test(diff) ||
66
+ /^\+.*\@emotion\/styled/m.test(diff);
67
+ const hasTailwindChanges = /^\+.*\bclassName\s*=.*\b(flex|grid|bg-|text-|p-|m-|w-|h-|rounded|border|shadow|hover:|focus:|sm:|md:|lg:|xl:)/m.test(diff);
68
+ const hasInlineStyleChanges = /^\+.*\bstyle\s*=\s*\{\{/m.test(diff);
69
+ const hasThemeChanges = /^\+.*(theme\s*[:=]|colors\s*[:=]|palette\s*[:=]|spacing\s*[:=]|typography\s*[:=])/m.test(diff);
70
+ const hasSxPropChanges = /^\+.*\bsx\s*=\s*\{/m.test(diff);
71
+ // Only classify as "style" if it's a CSS file OR contains actual CSS/styling code
72
+ const hasActualStyleChanges = isStyleFile || hasStyledComponentChanges ||
73
+ hasTailwindChanges || hasInlineStyleChanges ||
74
+ hasThemeChanges || hasSxPropChanges;
75
+ // NEVER classify as style if it's just JS without CSS
76
+ // This prevents console.log, debug statements, comments, test prints from being labeled as style
77
+ if (hasActualStyleChanges && !hasOnlyNonStyleJsChanges(diff, filePaths)) {
78
+ return 'style';
79
+ }
80
+ // === PERFORMANCE DETECTION ===
81
+ const perfPatterns = [
82
+ /\bperformance\b/i,
83
+ /\boptimiz(e|ation|ing)\b/i,
84
+ /\bfaster\b/i,
85
+ /\bspeed\s*(up|improvement)\b/i,
86
+ /\bcach(e|ing)\b/i,
87
+ /\bmemoiz(e|ation)\b/i,
88
+ /\blazy\s*load/i,
89
+ /\basync\b.*\bawait\b/i,
90
+ /\bparallel\b/i,
91
+ /\bbatch(ing)?\b/i,
92
+ ];
93
+ if (perfPatterns.some(p => p.test(cleanedDiffLower))) {
94
+ return 'perf';
95
+ }
96
+ // === DETECT NEW FUNCTIONALITY FIRST ===
97
+ // This must come BEFORE fix detection to avoid false positives when new functions contain validation
98
+ const hasNewFiles = stagedFiles.some((f) => f.status === 'A');
99
+ // Comprehensive new code detection
100
+ const hasNewExports = /^\+\s*export\s+(function|class|const|let|var|interface|type|default)/m.test(diff);
101
+ const hasNewFunctions = /^\+\s*(async\s+)?function\s+\w+/m.test(diff);
102
+ const hasNewArrowFunctions = /^\+\s*(export\s+)?(const|let|var)\s+\w+\s*=\s*(async\s+)?\([^)]*\)\s*=>/m.test(diff);
103
+ const hasNewClasses = /^\+\s*(export\s+)?(class|abstract\s+class)\s+\w+/m.test(diff);
104
+ // Detect new class/object methods - exclude control flow keywords (if, for, while, etc.)
105
+ // which share the `keyword(...) {` shape but are NOT method declarations
106
+ const hasNewMethods = /^\+\s+(async\s+)?(?!if|else|for|while|do|switch|catch|return|throw|new|typeof|instanceof|delete|void|yield|await\b)\w+\s*\([^)]*\)\s*{/m.test(diff);
107
+ const hasNewInterfaces = /^\+\s*(export\s+)?(interface|type)\s+\w+/m.test(diff);
108
+ const hasNewComponents = /^\+\s*(export\s+)?(const|function)\s+[A-Z]\w+/m.test(diff); // React components start with capital
109
+ const hasNewImports = /^\+\s*import\s+/m.test(diff);
110
+ // Count significant additions vs removals
111
+ const addedLines = (diff.match(/^\+[^+]/gm) || []).length;
112
+ const removedLines = (diff.match(/^-[^-]/gm) || []).length;
113
+ const netNewLines = addedLines - removedLines;
114
+ // Detect if we're adding new functionality
115
+ const hasNewFunctionality = hasNewExports || hasNewFunctions || hasNewArrowFunctions ||
116
+ hasNewClasses || hasNewMethods || hasNewInterfaces || hasNewComponents;
117
+ // === FEAT DETECTION (export-aware, AST-based) - CHECK BEFORE FIX ===
118
+ // Only treat as feat when the PUBLIC export surface grows
119
+ const removedExportNames = new Set(exportDiff.removed.map(e => e.name));
120
+ const hasNewExportedSymbols = exportDiff.added.some(e => !removedExportNames.has(e.name));
121
+ const hasAnyExportChanges = exportDiff.added.length > 0 || exportDiff.removed.length > 0;
122
+ if (hasNewFiles) {
123
+ return 'feat';
124
+ }
125
+ // New EXPORTED symbols = feat (public API surface grows)
126
+ if (hasNewExportedSymbols) {
127
+ return 'feat';
128
+ }
129
+ // New functions/classes that are NOT exported: internal refactoring
130
+ if (hasNewFunctionality && !hasNewExportedSymbols && !hasAnyExportChanges) {
131
+ // Balanced add/remove ratio indicates extraction/reorganization → refactor
132
+ if (addedLines > 0 && removedLines > 0) {
133
+ const ratio = Math.min(addedLines, removedLines) / Math.max(addedLines, removedLines);
134
+ if (ratio > 0.3) {
135
+ return 'refactor';
136
+ }
137
+ }
138
+ // Heavily additive internal code falls through to feat patterns / fallback below
139
+ }
140
+ // Significant net additions with new imports often means new feature
141
+ if (hasNewImports && netNewLines > 5) {
142
+ return 'feat';
143
+ }
144
+ // Check for new feature indicators in comments/strings
145
+ const featPatterns = [
146
+ /\badd(s|ed|ing)?\s+(new\s+)?(feature|support|ability|option|functionality)/i,
147
+ /\bimplement(s|ed|ing)?\s+\w+/i,
148
+ /\bintroduc(e|es|ed|ing)\s+(new\s+)?\w+/i,
149
+ /\benable(s|d|ing)?\s+(new\s+)?\w+/i,
150
+ /\bnew\s+(feature|function|method|api|endpoint)/i,
151
+ ];
152
+ if (featPatterns.some(p => p.test(cleanedDiff))) {
153
+ return 'feat';
154
+ }
155
+ // === FIX DETECTION ===
156
+ // Only check for validation patterns AFTER confirming no new functions/classes were added
157
+ // Check if this is adding validation/guards to existing code (defensive coding = fix)
158
+ const hasOnlyModifications = stagedFiles.every((f) => f.status === 'M');
159
+ const validationPatterns = [
160
+ /^\+.*\btypeof\s+\w+\s*===?\s*['"`]\w+['"`]/m, // typeof checks
161
+ /^\+.*\binstanceof\s+\w+/m, // instanceof checks
162
+ /^\+.*\bArray\.isArray\s*\(/m, // Array.isArray checks
163
+ /^\+.*\b(Number|String|Boolean)\.is\w+\s*\(/m, // Number.isNaN, etc.
164
+ /^\+.*\bif\s*\(\s*typeof\b/m, // if (typeof ...
165
+ /^\+.*\bif\s*\(\s*!\w+\s*\)/m, // if (!var) guards
166
+ /^\+.*\bif\s*\(\s*\w+\s*(===?|!==?)\s*(null|undefined)\s*\)/m, // null/undefined checks
167
+ /^\+.*\bif\s*\(\s*(null|undefined)\s*(===?|!==?)\s*\w+\s*\)/m, // null/undefined checks (reversed)
168
+ /^\+.*\bif\s*\(\s*[\w.\[\]]+\s*[<>]=?\s*-?\d/m, // numeric boundary checks: if (n < 0), if (arr[i] <= 0)
169
+ /^\+.*\bif\s*\(\s*-?\d+\s*[<>]=?\s*[\w.\[\]]+/m, // numeric boundary checks (reversed): if (0 > n)
170
+ /^\+.*\?\?/m, // Nullish coalescing
171
+ /^\+.*\?\./m, // Optional chaining
172
+ /^\+.*\|\|/m, // Default value patterns (when combined with guards)
173
+ ];
174
+ // Check if this is a simplification refactor (using modern syntax to replace verbose code)
175
+ // When deletions > additions significantly, it's likely simplifying existing code, not adding new checks
176
+ const isSimplificationRefactor = removedLines > addedLines &&
177
+ (removedLines - addedLines) >= 3 && // At least 3 net lines removed (significant simplification)
178
+ (/^\+.*\?\./m.test(diff) || // Using optional chaining
179
+ /^\+.*\?\?/m.test(diff) // Using nullish coalescing
180
+ ) &&
181
+ (/^-.*\bif\s*\(/m.test(diff) // Removing if statements
182
+ );
183
+ // If it's a simplification (replacing verbose ifs with optional chaining), it's refactor
184
+ if (isSimplificationRefactor) {
185
+ return 'refactor';
186
+ }
187
+ // If only modifying files (no new functions detected) and adding validation patterns, it's likely a fix
188
+ if (hasOnlyModifications && validationPatterns.some(p => p.test(diff))) {
189
+ return 'fix';
190
+ }
191
+ const fixPatterns = [
192
+ /\bfix(es|ed|ing)?\s*(the\s*)?(bug|issue|error|problem|crash)/i,
193
+ /\bfix(es|ed|ing)?\b/i, // Simple "fix" or "fixed" alone
194
+ /\bbug\s*fix/i,
195
+ /\bBUG:/i, // Bug comment markers
196
+ /\bhotfix\b/i,
197
+ /\bpatch(es|ed|ing)?\b/i,
198
+ /\bresolv(e|es|ed|ing)\s*(the\s*)?(issue|bug|error)/i,
199
+ /\bcorrect(s|ed|ing)?\s*(the\s*)?(bug|issue|error|problem)/i,
200
+ /\brepair(s|ed|ing)?\b/i,
201
+ /\bhandle\s*(error|exception|null|undefined)/i,
202
+ /\bnull\s*check/i,
203
+ /\bundefined\s*check/i,
204
+ /\btry\s*{\s*.*\s*}\s*catch/i,
205
+ /\bif\s*\(\s*!\s*\w+\s*\)/, // Null/undefined guards
206
+ /\bwas\s*broken\b/i, // "was broken" indicates fixing
207
+ /\bbroken\b.*\bfix/i, // broken...fix pattern
208
+ ];
209
+ if (fixPatterns.some(p => p.test(cleanedDiff))) {
210
+ return 'fix';
211
+ }
212
+ // === REFACTOR DETECTION ===
213
+ const refactorPatterns = [
214
+ /\brefactor(s|ed|ing)?\b/i,
215
+ /\brestructur(e|es|ed|ing)\b/i,
216
+ /\bclean\s*up\b/i,
217
+ /\bsimplif(y|ies|ied|ying)\b/i,
218
+ /\brenam(e|es|ed|ing)\b/i,
219
+ /\bmov(e|es|ed|ing)\s*(to|from|into)\b/i,
220
+ /\bextract(s|ed|ing)?\s*(function|method|class|component)/i,
221
+ /\binline(s|d|ing)?\b/i,
222
+ /\bdedup(licate)?\b/i,
223
+ /\bDRY\b/,
224
+ /\breorganiz(e|es|ed|ing)\b/i,
225
+ ];
226
+ if (refactorPatterns.some(p => p.test(cleanedDiff))) {
227
+ return 'refactor';
228
+ }
229
+ // If modifications with balanced adds/removes and no new functionality, likely refactor
230
+ // UNLESS the change modifies conditional logic (if/while/for/switch conditions),
231
+ // which typically alters behavior and should be treated as a fix, not a refactor
232
+ if (hasOnlyModifications && !hasNewFunctionality) {
233
+ // Check if the diff modifies conditions inside control flow statements.
234
+ // When both the removed and added lines contain the SAME control flow keyword
235
+ // but with different conditions, it's a behavioral change (fix), not a refactor.
236
+ const removedCondition = /^-\s*(if|while|for|switch)\s*\(/m.test(diff);
237
+ const addedCondition = /^\+\s*(if|while|for|switch)\s*\(/m.test(diff);
238
+ const isConditionChange = removedCondition && addedCondition;
239
+ if (isConditionChange) {
240
+ return 'fix';
241
+ }
242
+ // If roughly equal adds and removes, it's likely refactoring
243
+ if (addedLines > 0 && removedLines > 0) {
244
+ const ratio = Math.min(addedLines, removedLines) / Math.max(addedLines, removedLines);
245
+ if (ratio > 0.5) { // More strict ratio - must be very balanced
246
+ return 'refactor';
247
+ }
248
+ }
249
+ }
250
+ // === CHORE DETECTION ===
251
+ const chorePatterns = [
252
+ /\bdependenc(y|ies)\b/i,
253
+ /\bupgrade\b/i,
254
+ /\bupdate\s*(version|dep)/i,
255
+ /\bbump\b/i,
256
+ /\bpackage\.json\b/i,
257
+ /\bpackage-lock\.json\b/i,
258
+ /\byarn\.lock\b/i,
259
+ /\b\.gitignore\b/i,
260
+ /\bci\b.*\b(config|setup)\b/i,
261
+ /\blint(er|ing)?\b/i,
262
+ ];
263
+ if (chorePatterns.some(p => p.test(cleanedDiff)) || chorePatterns.some(p => filePaths.some(f => p.test(f)))) {
264
+ return 'chore';
265
+ }
266
+ // === FALLBACK ===
267
+ // If we have more additions than removals, lean towards feat
268
+ if (filesAffected.source > 0) {
269
+ if (netNewLines > 10) {
270
+ return 'feat'; // Significant new code added
271
+ }
272
+ if (hasOnlyModifications) {
273
+ return 'refactor'; // Modifications without clear new functionality
274
+ }
275
+ return 'feat'; // Default for source changes with new files
276
+ }
277
+ return 'chore';
278
+ }
279
+ /**
280
+ * Check if diff contains actual logic changes (not just formatting)
281
+ */
282
+ function hasLogicChanges(diff) {
283
+ // Remove formatting-only changes and check if there's real code
284
+ const lines = diff.split('\n').filter(line => (line.startsWith('+') || line.startsWith('-')) &&
285
+ !line.startsWith('+++') &&
286
+ !line.startsWith('---'));
287
+ for (const line of lines) {
288
+ const content = line.substring(1).trim();
289
+ // Skip empty lines, comments, and whitespace-only
290
+ if (content.length === 0 ||
291
+ content.startsWith('//') ||
292
+ content.startsWith('/*') ||
293
+ content.startsWith('*') ||
294
+ content === '{' ||
295
+ content === '}' ||
296
+ content === ';') {
297
+ continue;
298
+ }
299
+ // Has actual code change
300
+ return true;
301
+ }
302
+ return false;
303
+ }
304
+ /**
305
+ * Check if the diff contains ONLY formatting changes (no logic impact).
306
+ * Formatting changes include: semicolons, blank lines, indentation, trailing commas, braces.
307
+ * Per Conventional Commits, these should be classified as "style".
308
+ */
309
+ function isFormattingOnlyChange(diff) {
310
+ const lines = diff.split('\n').filter(line => (line.startsWith('+') || line.startsWith('-')) &&
311
+ !line.startsWith('+++') &&
312
+ !line.startsWith('---'));
313
+ if (lines.length === 0) {
314
+ return false;
315
+ }
316
+ // Pair up removed and added lines to detect indentation-only changes
317
+ const removed = [];
318
+ const added = [];
319
+ for (const line of lines) {
320
+ const content = line.substring(1);
321
+ const trimmed = content.trim();
322
+ // Empty / whitespace-only lines are always formatting
323
+ if (trimmed.length === 0) {
324
+ continue;
325
+ }
326
+ // Standalone semicolons, braces, trailing commas are formatting
327
+ if (trimmed === ';' || trimmed === '{' || trimmed === '}' || trimmed === ',') {
328
+ continue;
329
+ }
330
+ // Collect lines for indentation-only and semicolon-only comparison
331
+ if (line.startsWith('-')) {
332
+ removed.push(trimmed);
333
+ }
334
+ else {
335
+ added.push(trimmed);
336
+ }
337
+ }
338
+ // If no added/removed content lines remain, it's purely blank line changes
339
+ if (removed.length === 0 && added.length === 0) {
340
+ return true;
341
+ }
342
+ // Check if each added line corresponds to a removed line that differs only by
343
+ // formatting (trailing semicolons, trailing commas, whitespace)
344
+ if (removed.length !== added.length) {
345
+ return false;
346
+ }
347
+ for (let i = 0; i < removed.length; i++) {
348
+ // Normalize: strip trailing semicolons, commas, and whitespace
349
+ const normalizeFormatting = (s) => s.replace(/[;\s,]+$/g, '').replace(/^\s+/, '');
350
+ const normRemoved = normalizeFormatting(removed[i]);
351
+ const normAdded = normalizeFormatting(added[i]);
352
+ if (normRemoved !== normAdded) {
353
+ return false;
354
+ }
355
+ }
356
+ return true;
357
+ }
358
+ /**
359
+ * Check if the changes are ONLY non-style JavaScript changes
360
+ * (console.log, debug statements, test prints, comments, etc.)
361
+ * Returns true if JS files have changes but NO actual styling changes
362
+ */
363
+ function hasOnlyNonStyleJsChanges(diff, filePaths) {
364
+ // Check if all files are JavaScript/TypeScript (not CSS)
365
+ const hasOnlyJsFiles = filePaths.every(p => p.endsWith('.js') ||
366
+ p.endsWith('.jsx') ||
367
+ p.endsWith('.ts') ||
368
+ p.endsWith('.tsx') ||
369
+ p.endsWith('.mjs') ||
370
+ p.endsWith('.cjs'));
371
+ if (!hasOnlyJsFiles) {
372
+ return false;
373
+ }
374
+ // Patterns that indicate NON-style changes (debug, logging, test output)
375
+ const nonStylePatterns = [
376
+ /console\.(log|debug|info|warn|error|trace|dir|table)/,
377
+ /debugger\b/,
378
+ /logger\.\w+/i,
379
+ /debug\s*\(/,
380
+ /print\s*\(/,
381
+ /console\.assert/,
382
+ /console\.time/,
383
+ /console\.count/,
384
+ /console\.group/,
385
+ /process\.stdout/,
386
+ /process\.stderr/,
387
+ /\.toLog\(/,
388
+ /\.log\(/,
389
+ /winston\./,
390
+ /pino\./,
391
+ /bunyan\./,
392
+ /log4js\./,
393
+ ];
394
+ // Get all added/changed lines
395
+ const changedLines = diff.split('\n').filter(line => line.startsWith('+') && !line.startsWith('+++'));
396
+ // If the changes match non-style patterns, return true
397
+ const hasNonStyleChanges = changedLines.some(line => nonStylePatterns.some(pattern => pattern.test(line)));
398
+ // Check if there are NO style-related patterns in the JS files
399
+ const stylePatterns = [
400
+ /styled\s*[.(]/,
401
+ /css\s*`/,
402
+ /\bstyle\s*=\s*\{\{/,
403
+ /className\s*=/,
404
+ /\bsx\s*=/,
405
+ /theme\./,
406
+ /colors\./,
407
+ /palette\./,
408
+ ];
409
+ const hasStylePatterns = changedLines.some(line => stylePatterns.some(pattern => pattern.test(line)));
410
+ // Return true only if we have non-style changes AND no style patterns
411
+ return hasNonStyleChanges && !hasStylePatterns;
412
+ }
413
+ /**
414
+ * Extract non-comment changed lines from a diff for keyword analysis.
415
+ * Filters out comment lines to prevent false positives from descriptive text.
416
+ */
417
+ function extractNonCommentChanges(diff) {
418
+ return diff.split('\n')
419
+ .filter(line => (line.startsWith('+') || line.startsWith('-')) &&
420
+ !line.startsWith('+++') &&
421
+ !line.startsWith('---'))
422
+ .map(line => line.substring(1))
423
+ .filter(line => {
424
+ const trimmed = line.trim();
425
+ if (trimmed.length === 0)
426
+ return false;
427
+ // Filter out comment lines
428
+ if (trimmed.startsWith('//') ||
429
+ trimmed.startsWith('/*') ||
430
+ trimmed.startsWith('*') ||
431
+ trimmed.startsWith('*/') ||
432
+ trimmed.startsWith('#') ||
433
+ trimmed.startsWith('<!--') ||
434
+ trimmed.startsWith('-->') ||
435
+ trimmed.startsWith('"""') ||
436
+ trimmed.startsWith("'''") ||
437
+ /^\/\*\*/.test(trimmed) ||
438
+ /^\*\s*@\w+/.test(trimmed)) {
439
+ return false;
440
+ }
441
+ // Filter out lines that are purely string literals
442
+ if (/^(?:return\s+)?(['"`]).*\1[;,]?\s*$/.test(trimmed)) {
443
+ return false;
444
+ }
445
+ return true;
446
+ })
447
+ .join('\n');
448
+ }
449
+ /**
450
+ * Check if the diff contains only comment changes (documentation)
451
+ * Returns true if ALL changes are comments (no code changes)
452
+ */
453
+ function isCommentOnlyChange(diff) {
454
+ // Get all changed lines (additions and deletions)
455
+ const lines = diff.split('\n').filter(line => (line.startsWith('+') || line.startsWith('-')) &&
456
+ !line.startsWith('+++') &&
457
+ !line.startsWith('---'));
458
+ if (lines.length === 0) {
459
+ return false;
460
+ }
461
+ let hasCommentChanges = false;
462
+ for (const line of lines) {
463
+ const content = line.substring(1).trim();
464
+ // Skip empty lines
465
+ if (content.length === 0) {
466
+ continue;
467
+ }
468
+ // Check if line is a comment
469
+ const isComment = content.startsWith('//') || // Single-line comment
470
+ content.startsWith('/*') || // Multi-line comment start
471
+ content.startsWith('*') || // Multi-line comment body
472
+ content.startsWith('*/') || // Multi-line comment end
473
+ content.startsWith('#') || // Shell/Python/Ruby comments
474
+ content.startsWith('<!--') || // HTML comments
475
+ content.startsWith('-->') || // HTML comment end
476
+ content.startsWith('"""') || // Python docstring
477
+ content.startsWith("'''") || // Python docstring
478
+ /^\/\*\*/.test(content) || // JSDoc start
479
+ /^\*\s*@\w+/.test(content); // JSDoc tag
480
+ if (isComment) {
481
+ hasCommentChanges = true;
482
+ }
483
+ else {
484
+ // Found a non-comment change - not a comment-only diff
485
+ return false;
486
+ }
487
+ }
488
+ return hasCommentChanges;
489
+ }
490
+ //# sourceMappingURL=commitTypeDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commitTypeDetector.js","sourceRoot":"","sources":["../../src/services/commitTypeDetector.ts"],"names":[],"mappings":";;AAMA,kDA6TC;AAKD,0CA0BC;AAOD,wDA4DC;AAOD,4DAgEC;AAMD,4DAoCC;AAMD,kDA6CC;AAtkBD;;GAEG;AACH,SAAgB,mBAAmB,CACjC,aAA8C,EAC9C,IAAY,EACZ,WAAkB,EAClB,UAAsB;IAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,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CAAC;YACd,iBAAiB,GAAG,IAAI,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,uDAAuD;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { ASTClassifierResult, ChangeAnalysis, CommitType, FileChange, SemanticAnalysis } from '../types';
2
+ /**
3
+ * Generate a description for formatting-only changes
4
+ */
5
+ export declare function generateFormattingDescription(diff: string, stagedFiles: FileChange[]): string;
6
+ /**
7
+ * Generate a description from AST analysis results.
8
+ * Produces specific, human-readable descriptions based on structural signals.
9
+ * Returns empty string if AST data is insufficient for a good description.
10
+ */
11
+ export declare function generateASTDescription(astResult: ASTClassifierResult, commitType: CommitType): string;
12
+ /**
13
+ * Detect test+implementation file pairs.
14
+ * Returns the pair info if files match naming conventions, null otherwise.
15
+ */
16
+ export declare function detectTestImplPair(stagedFiles: {
17
+ status: string;
18
+ path: string;
19
+ }[]): {
20
+ implFile: string;
21
+ testFile: string;
22
+ implStatus: string;
23
+ testStatus: string;
24
+ } | null;
25
+ /**
26
+ * Generate description using lightweight file content analysis (JSON, CSS, YAML, MD).
27
+ * Returns null if no structural info is available.
28
+ */
29
+ export declare function generateFileContentDescription(stagedFiles: {
30
+ status: string;
31
+ path: string;
32
+ }[], diff: string): string | null;
33
+ /**
34
+ * Generate description using hunk header context (function/class names).
35
+ * Works for any language that git can identify scope for.
36
+ * Returns null if no hunk context is available.
37
+ */
38
+ export declare function generateHunkDescription(stagedFiles: {
39
+ status: string;
40
+ path: string;
41
+ }[], diff: string, commitType: CommitType): string | null;
42
+ /**
43
+ * Generate a descriptive commit message
44
+ * Uses AST analysis for specific descriptions when available,
45
+ * falls back to semantic analysis and regex-based descriptions.
46
+ */
47
+ export declare function generateDescription(filesAffected: ChangeAnalysis['filesAffected'], fileStatuses: any, stagedFiles: any[], diff: string, semanticAnalysis?: SemanticAnalysis, astResult?: ASTClassifierResult, commitType?: CommitType): string;
48
+ /**
49
+ * Generate description based on semantic analysis
50
+ * Creates intent-based messages like "update UserProfile validation logic"
51
+ */
52
+ export declare function generateSemanticDescription(semantic: SemanticAnalysis, stagedFiles: FileChange[]): string;
53
+ /**
54
+ * Generate an alternative description style
55
+ * Uses AST data when available, otherwise falls back to regex extraction.
56
+ */
57
+ export declare function generateAlternativeDescription(analysis: ChangeAnalysis, diff: string): string;
58
+ //# sourceMappingURL=descriptionGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptionGenerator.d.ts","sourceRoot":"","sources":["../../src/services/descriptionGenerator.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAuF7F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,GACrB,MAAM,CAuHR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAC9C;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqCvF;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC/C,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAkBf;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE;IAA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