@theihtisham/ai-release-notes 1.0.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/LICENSE +21 -0
- package/README.md +1493 -0
- package/__tests__/analyzer.test.js +63 -0
- package/__tests__/categorizer.test.js +93 -0
- package/__tests__/config.test.js +92 -0
- package/__tests__/formatter.test.js +63 -0
- package/__tests__/formatters.test.js +394 -0
- package/__tests__/migration.test.js +322 -0
- package/__tests__/semver.test.js +94 -0
- package/__tests__/tones.test.js +252 -0
- package/action.yml +113 -0
- package/index.js +73 -0
- package/jest.config.js +10 -0
- package/package.json +41 -0
- package/src/ai-writer.js +108 -0
- package/src/analyzer.js +232 -0
- package/src/analyzers/migration.js +355 -0
- package/src/categorizer.js +182 -0
- package/src/config.js +162 -0
- package/src/constants.js +137 -0
- package/src/contributor.js +144 -0
- package/src/diff-analyzer.js +202 -0
- package/src/formatter.js +336 -0
- package/src/formatters/discord.js +174 -0
- package/src/formatters/html.js +195 -0
- package/src/formatters/index.js +42 -0
- package/src/formatters/markdown.js +123 -0
- package/src/formatters/slack.js +176 -0
- package/src/formatters/twitter.js +242 -0
- package/src/formatters/types.js +48 -0
- package/src/generator.js +297 -0
- package/src/integrations/changelog.js +125 -0
- package/src/integrations/discord.js +96 -0
- package/src/integrations/github-release.js +75 -0
- package/src/integrations/indexer.js +119 -0
- package/src/integrations/slack.js +112 -0
- package/src/integrations/twitter.js +128 -0
- package/src/logger.js +52 -0
- package/src/prompts.js +210 -0
- package/src/rate-limiter.js +92 -0
- package/src/semver.js +129 -0
- package/src/tones/casual.js +114 -0
- package/src/tones/humorous.js +164 -0
- package/src/tones/index.js +38 -0
- package/src/tones/professional.js +125 -0
- package/src/tones/technical.js +164 -0
- package/src/tones/types.js +26 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Technical tone adapter.
|
|
5
|
+
* Detailed technical changelog with API changes, migration notes,
|
|
6
|
+
* and code examples for breaking changes.
|
|
7
|
+
*/
|
|
8
|
+
class TechnicalTone {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.name = 'technical';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Apply technical tone to release data.
|
|
15
|
+
* @param {Object} data - ReleaseData object
|
|
16
|
+
* @returns {Object} Modified release data with technical tone
|
|
17
|
+
*/
|
|
18
|
+
apply(data) {
|
|
19
|
+
const result = { ...data };
|
|
20
|
+
|
|
21
|
+
// Transform summary
|
|
22
|
+
result.summary = this._technicalSummary(data);
|
|
23
|
+
|
|
24
|
+
// Transform categories
|
|
25
|
+
if (data.categories) {
|
|
26
|
+
result.categories = {};
|
|
27
|
+
for (const [category, changes] of Object.entries(data.categories)) {
|
|
28
|
+
const newCategory = this._technicalCategoryName(category);
|
|
29
|
+
result.categories[newCategory] = changes.map(c => ({
|
|
30
|
+
...c,
|
|
31
|
+
description: this._technicalDescription(c.description, c.type, c.scope),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Transform breaking changes with code examples
|
|
37
|
+
if (data.breaking) {
|
|
38
|
+
result.breaking = data.breaking.map(bc => ({
|
|
39
|
+
...bc,
|
|
40
|
+
description: this._technicalBreaking(bc.description, bc.scope),
|
|
41
|
+
migration_guide: bc.migration_guide
|
|
42
|
+
? this._technicalMigration(bc.migration_guide, bc.scope, bc.type)
|
|
43
|
+
: this._generateDefaultMigration(bc),
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generate a technical summary.
|
|
52
|
+
*/
|
|
53
|
+
_technicalSummary(data) {
|
|
54
|
+
const version = data.version || '0.0.0';
|
|
55
|
+
const parts = [];
|
|
56
|
+
|
|
57
|
+
parts.push(`v${version}`);
|
|
58
|
+
|
|
59
|
+
// Add semver implication
|
|
60
|
+
if (data.breaking && data.breaking.length > 0) {
|
|
61
|
+
parts.push('(MAJOR - contains breaking changes)');
|
|
62
|
+
} else if (data.categories) {
|
|
63
|
+
const catNames = Object.keys(data.categories).map(c => c.toLowerCase());
|
|
64
|
+
if (catNames.some(c => c.includes('feature'))) {
|
|
65
|
+
parts.push('(MINOR - new features)');
|
|
66
|
+
} else {
|
|
67
|
+
parts.push('(PATCH - bug fixes and improvements)');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Stats
|
|
72
|
+
const commitCount = data.diffSummary?.files_changed || 0;
|
|
73
|
+
if (commitCount > 0) {
|
|
74
|
+
parts.push(`โ ${commitCount} files affected`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (data.contributors && data.contributors.length > 0) {
|
|
78
|
+
parts.push(`โ ${data.contributors.length} contributor${data.contributors.length > 1 ? 's' : ''}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return parts.join(' ');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Map category names to technical names.
|
|
86
|
+
*/
|
|
87
|
+
_technicalCategoryName(category) {
|
|
88
|
+
const map = {
|
|
89
|
+
'๐ Features': 'feat: New Features',
|
|
90
|
+
'๐ Bug Fixes': 'fix: Bug Fixes',
|
|
91
|
+
'๐ฅ Breaking Changes': 'BREAKING: Incompatible Changes',
|
|
92
|
+
'โก Performance': 'perf: Performance Optimizations',
|
|
93
|
+
'โป๏ธ Refactoring': 'refactor: Code Refactoring',
|
|
94
|
+
'๐ Documentation': 'docs: Documentation',
|
|
95
|
+
'๐จ Style': 'style: Code Style',
|
|
96
|
+
'๐งช Tests': 'test: Test Suite',
|
|
97
|
+
'๐ง Chore': 'chore: Build/CI/Maintenance',
|
|
98
|
+
'๐ Security': 'security: Security Patches',
|
|
99
|
+
'New Features': 'feat: New Features',
|
|
100
|
+
'Bug Fixes and Resolutions': 'fix: Bug Fixes',
|
|
101
|
+
};
|
|
102
|
+
return map[category] || category;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Make a description more technical.
|
|
107
|
+
*/
|
|
108
|
+
_technicalDescription(desc, type, scope) {
|
|
109
|
+
if (!desc) return desc;
|
|
110
|
+
const prefix = scope ? `[${scope}] ` : '';
|
|
111
|
+
return `${prefix}${desc}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Technical breaking change description.
|
|
116
|
+
*/
|
|
117
|
+
_technicalBreaking(desc, scope) {
|
|
118
|
+
if (!desc) return desc;
|
|
119
|
+
const prefix = scope ? `[${scope}] ` : '';
|
|
120
|
+
return `${prefix}${desc}`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Enhance migration guide with technical details.
|
|
125
|
+
*/
|
|
126
|
+
_technicalMigration(guide, scope, type) {
|
|
127
|
+
if (!guide) return guide;
|
|
128
|
+
return guide;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Generate a default migration guide with before/after code examples.
|
|
133
|
+
* @param {Object} bc - Breaking change
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
_generateDefaultMigration(bc) {
|
|
137
|
+
const lines = [];
|
|
138
|
+
|
|
139
|
+
lines.push('### Migration Steps');
|
|
140
|
+
lines.push('');
|
|
141
|
+
lines.push(`1. Review the changes to \`${bc.scope || 'affected modules'}\``);
|
|
142
|
+
lines.push('2. Update your code to match the new API');
|
|
143
|
+
lines.push('3. Run your test suite to verify compatibility');
|
|
144
|
+
lines.push('');
|
|
145
|
+
|
|
146
|
+
if (bc.scope) {
|
|
147
|
+
lines.push('**Before:**');
|
|
148
|
+
lines.push('```javascript');
|
|
149
|
+
lines.push(`// Old ${bc.scope} API`);
|
|
150
|
+
lines.push(`// ${bc.description}`);
|
|
151
|
+
lines.push('```');
|
|
152
|
+
lines.push('');
|
|
153
|
+
lines.push('**After:**');
|
|
154
|
+
lines.push('```javascript');
|
|
155
|
+
lines.push(`// Updated ${bc.scope} API`);
|
|
156
|
+
lines.push(`// Check the documentation for new usage`);
|
|
157
|
+
lines.push('```');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return lines.join('\n');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
module.exports = { TechnicalTone };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {'professional'|'casual'|'humorous'|'technical'} Tone
|
|
5
|
+
* Supported tone types for release notes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* List of all supported tones.
|
|
10
|
+
* @type {Tone[]}
|
|
11
|
+
*/
|
|
12
|
+
const TONES = ['professional', 'casual', 'humorous', 'technical'];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if a tone string is valid.
|
|
16
|
+
* @param {string} tone
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
function isValidTone(tone) {
|
|
20
|
+
return TONES.includes(tone);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
TONES,
|
|
25
|
+
isValidTone,
|
|
26
|
+
};
|