@entro314labs/ai-changelog-generator 3.8.0 → 3.8.2

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.0",
4
+ "version": "3.8.2",
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",
@@ -18,46 +18,54 @@ export class ApplicationService {
18
18
  this.configManager = new ConfigurationManager(options.configPath)
19
19
  this.orchestrator = new ChangelogOrchestrator(this.configManager, this.options)
20
20
  this.initialized = false
21
+ this.initializationError = null
21
22
 
22
23
  // Apply options
23
24
  if (options.noColor || process.env.NO_COLOR) {
24
25
  colors.disable()
25
26
  }
26
27
 
27
- // Wait for orchestrator to initialize
28
- this.initializeAsync()
28
+ // Start initialization (don't await here to keep constructor sync)
29
+ this.initializationPromise = this.initializeAsync()
29
30
  }
30
31
 
31
32
  async initializeAsync() {
32
33
  try {
33
- // Wait for orchestrator services to be ready
34
- await this.orchestrator.ensureInitialized()
34
+ // Wait for orchestrator services to be ready with timeout
35
+ const timeoutPromise = new Promise((_, reject) =>
36
+ setTimeout(() => reject(new Error('Initialization timeout after 10 seconds')), 10000)
37
+ )
38
+
39
+ await Promise.race([
40
+ this.orchestrator.ensureInitialized(),
41
+ timeoutPromise
42
+ ])
43
+
35
44
  this.initialized = true
36
45
  } catch (error) {
46
+ this.initializationError = error
37
47
  console.error(
38
48
  colors.errorMessage('Application service initialization failed:'),
39
49
  error.message
40
50
  )
51
+ // Don't throw - allow graceful degradation
41
52
  }
42
53
  }
43
54
 
44
55
  async ensureInitialized() {
45
- if (!this.initialized) {
46
- await this.initializeAsync()
56
+ if (this.initialized) {
57
+ return
47
58
  }
48
- }
49
59
 
50
- async generateChangelog(options = {}) {
51
- try {
52
- const { version, since, author, tagRange, format, output, dryRun } = options
53
- return await this.orchestrator.generateChangelog(version, since, {
54
- author,
55
- tagRange,
56
- format,
57
- output,
58
- dryRun,
59
- })
60
- } catch (error) {
60
+ if (this.initializationError) {
61
+ throw new Error(`Service not initialized: ${this.initializationError.message}`)
62
+ }
63
+
64
+ // Wait for initialization to complete
65
+ await this.initializationPromise
66
+
67
+ if (this.initializationError) {
68
+ throw new Error(`Service initialization failed: ${this.initializationError.message}`)
61
69
  console.error(colors.errorMessage('Application service error:'), error.message)
62
70
  throw error
63
71
  }
@@ -54,6 +54,7 @@ export class AnalysisEngine {
54
54
  try {
55
55
  // Get cwd from git manager if available
56
56
  const cwd = this.gitService?.gitManager?.options?.cwd
57
+ console.log(`[AnalysisEngine] analyzeCurrentChanges called with cwd: ${cwd || 'undefined'}`)
57
58
  const changes = getWorkingDirectoryChanges(cwd)
58
59
 
59
60
  if (changes.length === 0) {
@@ -1437,14 +1437,20 @@ export function getWorkingDirectoryChanges(cwd = undefined) {
1437
1437
  const execOptions = { encoding: 'utf8' }
1438
1438
  if (cwd) {
1439
1439
  execOptions.cwd = cwd
1440
+ console.log(`[getWorkingDirectoryChanges] Running in cwd: ${cwd}`)
1441
+ } else {
1442
+ console.log(`[getWorkingDirectoryChanges] Running in process.cwd(): ${process.cwd()}`)
1440
1443
  }
1441
1444
  const result = execSync('git status --porcelain', execOptions)
1445
+ console.log(`[getWorkingDirectoryChanges] Git status result length: ${result.length}`)
1442
1446
 
1443
1447
  if (!result.trim()) {
1448
+ console.log('[getWorkingDirectoryChanges] No changes detected (empty result)')
1444
1449
  return []
1445
1450
  }
1446
1451
 
1447
1452
  const lines = result.split('\n').filter((line) => line.trim())
1453
+ console.log(`[getWorkingDirectoryChanges] Found ${lines.length} changed files`)
1448
1454
 
1449
1455
  const changes = lines.map((line) => {
1450
1456
  const status = line.substring(0, 2).trim() || '??'