@entro314labs/ai-changelog-generator 3.8.2 → 3.8.4

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@entro314labs/ai-changelog-generator",
3
3
  "displayName": "AI Changelog Generator",
4
- "version": "3.8.2",
4
+ "version": "3.8.4",
5
5
  "type": "module",
6
6
  "description": "AI-powered changelog generator with MCP server support - works with most providers, online and local models",
7
7
  "main": "src/ai-changelog-generator.js",
@@ -80,6 +80,22 @@ export class ApplicationService {
80
80
  }
81
81
  }
82
82
 
83
+ async generateChangelog(options = {}) {
84
+ try {
85
+ const { version, since, author, tagRange, format, output, dryRun } = options
86
+ return await this.orchestrator.generateChangelog(version, since, {
87
+ author,
88
+ tagRange,
89
+ format,
90
+ output,
91
+ dryRun,
92
+ })
93
+ } catch (error) {
94
+ console.error(colors.errorMessage('Changelog generation error:'), error.message)
95
+ throw error
96
+ }
97
+ }
98
+
83
99
  async analyzeCurrentChanges() {
84
100
  try {
85
101
  await this.ensureInitialized()
@@ -290,13 +306,108 @@ export class ApplicationService {
290
306
  }
291
307
  }
292
308
 
293
- // Commit message generation
294
- async generateCommitMessage() {
309
+ // Commit message generation with AI and validation
310
+ async generateCommitMessage(options = {}) {
295
311
  try {
296
312
  await this.ensureInitialized()
297
- return await this.orchestrator.interactiveService.generateCommitSuggestion()
313
+
314
+ // Get current staged files and branch context
315
+ const { analyzeBranchIntelligence, getSuggestedCommitType, getWorkingDirectoryChanges } =
316
+ await import('../../shared/utils/utils.js')
317
+
318
+ const branchAnalysis = analyzeBranchIntelligence()
319
+ console.log('[generateCommitMessage] Branch analysis:', branchAnalysis)
320
+
321
+ // Get working directory changes (don't rely on staging service which expects interactive mode)
322
+ const cwd = this.options.cwd || this.options.repositoryPath
323
+ console.log('[generateCommitMessage] Getting working directory changes from:', cwd)
324
+
325
+ const workingChanges = getWorkingDirectoryChanges(cwd)
326
+ console.log('[generateCommitMessage] Found', workingChanges.length, 'working changes')
327
+
328
+ if (!workingChanges || workingChanges.length === 0) {
329
+ throw new Error('No changes detected in working directory')
330
+ }
331
+
332
+ // Convert working changes to file format expected by commit generation
333
+ const stagedFiles = workingChanges.map((change) => ({
334
+ status: change.status,
335
+ path: change.filePath,
336
+ filePath: change.filePath,
337
+ }))
338
+
339
+ const suggestedType = getSuggestedCommitType(branchAnalysis, stagedFiles)
340
+ console.log('[generateCommitMessage] Suggested type:', suggestedType)
341
+
342
+ // Generate AI commit message with branch intelligence
343
+ let commitMessage
344
+ try {
345
+ console.log('[generateCommitMessage] Attempting AI generation...')
346
+ commitMessage = await this.orchestrator.generateAICommitMessage(
347
+ branchAnalysis,
348
+ suggestedType,
349
+ stagedFiles
350
+ )
351
+ console.log('[generateCommitMessage] AI generated:', commitMessage)
352
+ } catch (error) {
353
+ console.log('[generateCommitMessage] AI generation failed, using fallback:', error.message)
354
+ // Fallback to rule-based generation
355
+ commitMessage = this.orchestrator.generateBranchAwareCommitMessage(
356
+ branchAnalysis,
357
+ suggestedType,
358
+ stagedFiles
359
+ )
360
+ console.log('[generateCommitMessage] Fallback generated:', commitMessage)
361
+ }
362
+
363
+ if (!commitMessage) {
364
+ throw new Error('Failed to generate commit message')
365
+ }
366
+
367
+ // Validate the generated message
368
+ console.log('[generateCommitMessage] Validating message...')
369
+ const validationResult = await this.orchestrator.validationService.validateCommitMessage(
370
+ commitMessage,
371
+ { branchAnalysis, stagedFiles, suggestedType }
372
+ )
373
+ console.log('[generateCommitMessage] Validation result:', validationResult)
374
+
375
+ // Improve if needed (only if validation enabled)
376
+ let improvedMessage = commitMessage
377
+ if (options.enableValidation && !validationResult.valid) {
378
+ console.log('[generateCommitMessage] Attempting to improve message...')
379
+ const improvementResult = await this.orchestrator.validationService.improveCommitMessage(
380
+ commitMessage,
381
+ { branchAnalysis, stagedFiles, suggestedType }
382
+ )
383
+ if (improvementResult.improved) {
384
+ improvedMessage = improvementResult.message
385
+ console.log('[generateCommitMessage] Improved to:', improvedMessage)
386
+ }
387
+ }
388
+
389
+ const result = {
390
+ message: improvedMessage,
391
+ validation: validationResult,
392
+ branchAnalysis,
393
+ suggestedType,
394
+ }
395
+ console.log('[generateCommitMessage] Returning result:', result)
396
+ return result
298
397
  } catch (error) {
299
398
  console.error(colors.errorMessage('Commit message generation error:'), error.message)
399
+ console.error('[generateCommitMessage] Full error:', error)
400
+ throw error
401
+ }
402
+ }
403
+
404
+ // Validate commit message
405
+ async validateCommitMessage(message, context = {}) {
406
+ try {
407
+ await this.ensureInitialized()
408
+ return await this.orchestrator.validationService.validateCommitMessage(message, context)
409
+ } catch (error) {
410
+ console.error(colors.errorMessage('Commit validation error:'), error.message)
300
411
  throw error
301
412
  }
302
413
  }
package/types/index.d.ts CHANGED
@@ -181,29 +181,30 @@ export interface CommitAnalysis {
181
181
  }
182
182
 
183
183
  export interface CurrentChangesAnalysis {
184
- staged: {
185
- files: string[]
186
- additions: number
187
- deletions: number
188
- summary: string
189
- }
190
- unstaged: {
191
- files: string[]
184
+ changes: Array<{
185
+ path: string
186
+ filePath: string
187
+ status: string
188
+ category: string
189
+ importance: string
190
+ diff: string
192
191
  additions: number
193
192
  deletions: number
193
+ language?: string
194
+ complexity?: string
195
+ businessRelevance?: string
196
+ risk?: string
197
+ }>
198
+ analysis: {
194
199
  summary: string
195
- }
196
- untracked: {
197
- files: string[]
198
- categories: Record<string, string[]>
199
- recommendations: string[]
200
- }
201
- aiAnalysis?: {
202
- model: AIModel
200
+ category: string
203
201
  impact: string
204
- suggestions: string[]
205
- readiness: 'ready' | 'needs-work' | 'incomplete'
206
- }
202
+ userFacing: boolean
203
+ complexity?: string
204
+ risk?: string
205
+ } | null
206
+ summary: string
207
+ error?: string
207
208
  }
208
209
 
209
210
  export interface RepositoryHealthCheck {