@entro314labs/ai-changelog-generator 3.1.1 → 3.2.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.
- package/CHANGELOG.md +383 -877
- package/README.md +8 -3
- package/ai-changelog-mcp.sh +0 -0
- package/ai-changelog.sh +0 -0
- package/bin/ai-changelog-dxt.js +9 -9
- package/bin/ai-changelog-mcp.js +19 -17
- package/bin/ai-changelog.js +6 -6
- package/package.json +80 -48
- package/src/ai-changelog-generator.js +83 -81
- package/src/application/orchestrators/changelog.orchestrator.js +791 -516
- package/src/application/services/application.service.js +137 -128
- package/src/cli.js +76 -57
- package/src/domains/ai/ai-analysis.service.js +289 -209
- package/src/domains/analysis/analysis.engine.js +253 -193
- package/src/domains/changelog/changelog.service.js +1062 -784
- package/src/domains/changelog/workspace-changelog.service.js +420 -249
- package/src/domains/git/git-repository.analyzer.js +348 -258
- package/src/domains/git/git.service.js +132 -112
- package/src/infrastructure/cli/cli.controller.js +390 -274
- package/src/infrastructure/config/configuration.manager.js +220 -190
- package/src/infrastructure/interactive/interactive-staging.service.js +154 -135
- package/src/infrastructure/interactive/interactive-workflow.service.js +200 -159
- package/src/infrastructure/mcp/mcp-server.service.js +208 -207
- package/src/infrastructure/metrics/metrics.collector.js +140 -123
- package/src/infrastructure/providers/core/base-provider.js +87 -40
- package/src/infrastructure/providers/implementations/anthropic.js +101 -99
- package/src/infrastructure/providers/implementations/azure.js +124 -101
- package/src/infrastructure/providers/implementations/bedrock.js +136 -126
- package/src/infrastructure/providers/implementations/dummy.js +23 -23
- package/src/infrastructure/providers/implementations/google.js +123 -114
- package/src/infrastructure/providers/implementations/huggingface.js +94 -87
- package/src/infrastructure/providers/implementations/lmstudio.js +75 -60
- package/src/infrastructure/providers/implementations/mock.js +69 -73
- package/src/infrastructure/providers/implementations/ollama.js +89 -66
- package/src/infrastructure/providers/implementations/openai.js +88 -89
- package/src/infrastructure/providers/implementations/vertex.js +227 -197
- package/src/infrastructure/providers/provider-management.service.js +245 -207
- package/src/infrastructure/providers/provider-manager.service.js +145 -125
- package/src/infrastructure/providers/utils/base-provider-helpers.js +308 -302
- package/src/infrastructure/providers/utils/model-config.js +220 -195
- package/src/infrastructure/providers/utils/provider-utils.js +105 -100
- package/src/infrastructure/validation/commit-message-validation.service.js +259 -161
- package/src/shared/constants/colors.js +453 -180
- package/src/shared/utils/cli-demo.js +285 -0
- package/src/shared/utils/cli-entry-utils.js +257 -249
- package/src/shared/utils/cli-ui.js +447 -0
- package/src/shared/utils/diff-processor.js +513 -0
- package/src/shared/utils/error-classes.js +125 -156
- package/src/shared/utils/json-utils.js +93 -89
- package/src/shared/utils/utils.js +1117 -945
- package/types/index.d.ts +353 -344
package/src/cli.js
CHANGED
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* Provides command-line interface for changelog generation functionality
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
8
|
+
import process from 'node:process'
|
|
9
|
+
|
|
10
|
+
import { hideBin } from 'yargs/helpers'
|
|
11
|
+
import yargs from 'yargs/yargs'
|
|
12
|
+
|
|
13
|
+
import { AIChangelogGenerator } from './ai-changelog-generator.js'
|
|
14
|
+
import colors from './shared/constants/colors.js'
|
|
15
|
+
import { EnhancedConsole, SimpleSpinner } from './shared/utils/cli-ui.js'
|
|
12
16
|
|
|
13
17
|
async function runCLI() {
|
|
14
18
|
const argv = await yargs(hideBin(process.argv))
|
|
@@ -17,141 +21,156 @@ async function runCLI() {
|
|
|
17
21
|
.option('tag', {
|
|
18
22
|
alias: ['v', 'version'],
|
|
19
23
|
type: 'string',
|
|
20
|
-
description: 'Version tag for changelog'
|
|
24
|
+
description: 'Version tag for changelog',
|
|
21
25
|
})
|
|
22
26
|
.option('since', {
|
|
23
27
|
alias: 's',
|
|
24
28
|
type: 'string',
|
|
25
|
-
description: 'Generate changelog since commit/tag'
|
|
29
|
+
description: 'Generate changelog since commit/tag',
|
|
26
30
|
})
|
|
27
31
|
.option('detailed', {
|
|
28
32
|
type: 'boolean',
|
|
29
|
-
description: 'Generate detailed technical analysis'
|
|
33
|
+
description: 'Generate detailed technical analysis',
|
|
30
34
|
})
|
|
31
35
|
.option('enterprise', {
|
|
32
36
|
type: 'boolean',
|
|
33
|
-
description: 'Generate enterprise-ready documentation'
|
|
37
|
+
description: 'Generate enterprise-ready documentation',
|
|
34
38
|
})
|
|
35
39
|
.option('interactive', {
|
|
36
40
|
alias: 'i',
|
|
37
41
|
type: 'boolean',
|
|
38
|
-
description: 'Run in interactive mode'
|
|
42
|
+
description: 'Run in interactive mode',
|
|
39
43
|
})
|
|
40
44
|
.option('analyze', {
|
|
41
45
|
type: 'boolean',
|
|
42
|
-
description: 'Analyze current working directory changes'
|
|
46
|
+
description: 'Analyze current working directory changes',
|
|
43
47
|
})
|
|
44
48
|
.option('health', {
|
|
45
49
|
type: 'boolean',
|
|
46
|
-
description: 'Assess repository health'
|
|
50
|
+
description: 'Assess repository health',
|
|
47
51
|
})
|
|
48
52
|
.option('branches', {
|
|
49
53
|
type: 'boolean',
|
|
50
|
-
description: 'Analyze all branches'
|
|
54
|
+
description: 'Analyze all branches',
|
|
51
55
|
})
|
|
52
56
|
.option('comprehensive', {
|
|
53
57
|
type: 'boolean',
|
|
54
|
-
description: 'Comprehensive repository analysis'
|
|
58
|
+
description: 'Comprehensive repository analysis',
|
|
55
59
|
})
|
|
56
60
|
.option('model', {
|
|
57
61
|
type: 'string',
|
|
58
|
-
description: 'Override AI model selection'
|
|
62
|
+
description: 'Override AI model selection',
|
|
59
63
|
})
|
|
60
64
|
.option('no-attribution', {
|
|
61
65
|
type: 'boolean',
|
|
62
|
-
description: 'Disable attribution footer'
|
|
66
|
+
description: 'Disable attribution footer',
|
|
63
67
|
})
|
|
64
68
|
.option('validate', {
|
|
65
69
|
type: 'boolean',
|
|
66
|
-
description: 'Validate configuration'
|
|
70
|
+
description: 'Validate configuration',
|
|
67
71
|
})
|
|
68
72
|
.help()
|
|
69
73
|
.alias('help', 'h')
|
|
70
|
-
.parse()
|
|
74
|
+
.parse()
|
|
71
75
|
|
|
72
76
|
try {
|
|
73
77
|
const generator = new AIChangelogGenerator({
|
|
74
78
|
analysisMode: argv.detailed ? 'detailed' : argv.enterprise ? 'enterprise' : 'standard',
|
|
75
79
|
modelOverride: argv.model,
|
|
76
|
-
includeAttribution: !argv.noAttribution
|
|
77
|
-
})
|
|
80
|
+
includeAttribution: !argv.noAttribution,
|
|
81
|
+
})
|
|
78
82
|
|
|
79
83
|
if (argv.model) {
|
|
80
|
-
generator.setModelOverride(argv.model)
|
|
84
|
+
generator.setModelOverride(argv.model)
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
if (argv.detailed) {
|
|
84
|
-
generator.setAnalysisMode('detailed')
|
|
88
|
+
generator.setAnalysisMode('detailed')
|
|
85
89
|
} else if (argv.enterprise) {
|
|
86
|
-
generator.setAnalysisMode('enterprise')
|
|
90
|
+
generator.setAnalysisMode('enterprise')
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
if (argv.validate) {
|
|
90
|
-
console.log(colors.infoMessage('🔧 Validating configuration...'))
|
|
91
|
-
await generator.validateConfiguration()
|
|
92
|
-
console.log(colors.successMessage('✅ Configuration is valid'))
|
|
93
|
-
return
|
|
94
|
+
console.log(colors.infoMessage('🔧 Validating configuration...'))
|
|
95
|
+
await generator.validateConfiguration()
|
|
96
|
+
console.log(colors.successMessage('✅ Configuration is valid'))
|
|
97
|
+
return
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
if (argv.interactive) {
|
|
97
|
-
console.log(colors.infoMessage('🎮 Starting interactive mode...'))
|
|
98
|
-
await generator.runInteractive()
|
|
99
|
-
return
|
|
101
|
+
console.log(colors.infoMessage('🎮 Starting interactive mode...'))
|
|
102
|
+
await generator.runInteractive()
|
|
103
|
+
return
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
if (argv.health) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
const healthSpinner = new SimpleSpinner('Assessing repository health...')
|
|
108
|
+
healthSpinner.start()
|
|
109
|
+
await generator.assessRepositoryHealth()
|
|
110
|
+
healthSpinner.succeed('Repository health assessment complete')
|
|
111
|
+
return
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
if (argv.analyze) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
const analyzeSpinner = new SimpleSpinner('Analyzing current changes...')
|
|
116
|
+
analyzeSpinner.start()
|
|
117
|
+
await generator.analyzeCurrentChanges()
|
|
118
|
+
analyzeSpinner.succeed('Current changes analysis complete')
|
|
119
|
+
return
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
if (argv.branches) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
const branchSpinner = new SimpleSpinner('Analyzing branches...')
|
|
124
|
+
branchSpinner.start()
|
|
125
|
+
await generator.analyzeRepository({ type: 'branches' })
|
|
126
|
+
branchSpinner.succeed('Branch analysis complete')
|
|
127
|
+
return
|
|
118
128
|
}
|
|
119
129
|
|
|
120
130
|
if (argv.comprehensive) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
const compSpinner = new SimpleSpinner('Running comprehensive analysis...')
|
|
132
|
+
compSpinner.start()
|
|
133
|
+
await generator.analyzeRepository({ type: 'comprehensive' })
|
|
134
|
+
compSpinner.succeed('Comprehensive analysis complete')
|
|
135
|
+
return
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
// Default: Generate changelog
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
const changelogSpinner = new SimpleSpinner('Generating changelog...')
|
|
140
|
+
changelogSpinner.start()
|
|
141
|
+
const result = await generator.generateChangelog(argv.tag || argv.version, argv.since)
|
|
142
|
+
|
|
130
143
|
if (result) {
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
changelogSpinner.succeed('Changelog generated successfully!')
|
|
145
|
+
|
|
133
146
|
// Show metrics
|
|
134
|
-
const metrics = generator.getMetrics()
|
|
135
|
-
|
|
147
|
+
const metrics = generator.getMetrics()
|
|
148
|
+
EnhancedConsole.metrics(
|
|
149
|
+
`Processed ${metrics.commitsProcessed} commits in ${formatDuration(Date.now() - metrics.startTime)}`
|
|
150
|
+
)
|
|
151
|
+
} else {
|
|
152
|
+
changelogSpinner.fail('Failed to generate changelog')
|
|
136
153
|
}
|
|
137
|
-
|
|
138
154
|
} catch (error) {
|
|
139
|
-
|
|
155
|
+
EnhancedConsole.error(`Error: ${error.message}`)
|
|
140
156
|
if (process.env.DEBUG) {
|
|
141
|
-
|
|
157
|
+
EnhancedConsole.error(error.stack)
|
|
142
158
|
}
|
|
143
|
-
process.exit(1)
|
|
159
|
+
process.exit(1)
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
|
|
147
163
|
function formatDuration(ms) {
|
|
148
|
-
const seconds = Math.round(ms / 1000)
|
|
149
|
-
return seconds > 0 ? `${seconds}s` : `${ms}ms
|
|
164
|
+
const seconds = Math.round(ms / 1000)
|
|
165
|
+
return seconds > 0 ? `${seconds}s` : `${ms}ms`
|
|
150
166
|
}
|
|
151
167
|
|
|
152
|
-
export { runCLI }
|
|
168
|
+
export { runCLI }
|
|
153
169
|
|
|
154
170
|
// If this file is run directly, execute CLI
|
|
155
171
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
156
|
-
runCLI()
|
|
157
|
-
|
|
172
|
+
runCLI().catch((error) => {
|
|
173
|
+
console.error('CLI Error:', error.message)
|
|
174
|
+
process.exit(1)
|
|
175
|
+
})
|
|
176
|
+
}
|