@ridiormf/version-control 1.1.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 +708 -0
- package/bin/smart-commit.js +201 -0
- package/bin/version-control.js +4 -0
- package/dist/analyzer.d.ts +7 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +109 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/changelog.d.ts +49 -0
- package/dist/changelog.d.ts.map +1 -0
- package/dist/changelog.js +219 -0
- package/dist/changelog.js.map +1 -0
- package/dist/colors.d.ts +6 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +16 -0
- package/dist/colors.js.map +1 -0
- package/dist/commitGenerator.d.ts +27 -0
- package/dist/commitGenerator.d.ts.map +1 -0
- package/dist/commitGenerator.js +272 -0
- package/dist/commitGenerator.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +116 -0
- package/dist/config.js.map +1 -0
- package/dist/git.d.ts +7 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +18 -0
- package/dist/git.js.map +1 -0
- package/dist/gitCommands.d.ts +6 -0
- package/dist/gitCommands.d.ts.map +1 -0
- package/dist/gitCommands.js +55 -0
- package/dist/gitCommands.js.map +1 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +452 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +221 -0
- package/dist/index.js.map +1 -0
- package/dist/readline.d.ts +19 -0
- package/dist/readline.d.ts.map +1 -0
- package/dist/readline.js +129 -0
- package/dist/readline.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/updateChecker.d.ts +5 -0
- package/dist/updateChecker.d.ts.map +1 -0
- package/dist/updateChecker.js +117 -0
- package/dist/updateChecker.js.map +1 -0
- package/dist/updater.d.ts +22 -0
- package/dist/updater.d.ts.map +1 -0
- package/dist/updater.js +170 -0
- package/dist/updater.js.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +69 -0
- package/dist/version.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Smart Commit - Automatic commit message generator
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require("child_process");
|
|
8
|
+
const { colors } = require("../dist/colors.js");
|
|
9
|
+
const {
|
|
10
|
+
getStagedChanges,
|
|
11
|
+
generateCommitMessage,
|
|
12
|
+
} = require("../dist/commitGenerator.js");
|
|
13
|
+
const {
|
|
14
|
+
createInterface,
|
|
15
|
+
question,
|
|
16
|
+
closeInterface,
|
|
17
|
+
} = require("../dist/readline.js");
|
|
18
|
+
const { checkForUpdates } = require("../dist/updateChecker.js");
|
|
19
|
+
const { t, currentLanguage, isLanguageConfigured } = require("../dist/i18n.js");
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Show language info
|
|
23
|
+
*/
|
|
24
|
+
function showLanguageInfo() {
|
|
25
|
+
const source = isLanguageConfigured
|
|
26
|
+
? t.configuredManually
|
|
27
|
+
: t.detectedFromSystem;
|
|
28
|
+
console.log(
|
|
29
|
+
`${colors.cyan}ℹ${colors.reset} ${t.currentLanguageIs} ${
|
|
30
|
+
colors.bold
|
|
31
|
+
}${currentLanguage.toUpperCase()}${colors.reset} (${source})`
|
|
32
|
+
);
|
|
33
|
+
console.log(
|
|
34
|
+
` ${t.toChangeLanguage} ${colors.cyan}version-control config --lang <code>${colors.reset}`
|
|
35
|
+
);
|
|
36
|
+
console.log("");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function main() {
|
|
40
|
+
// Check for updates (non-blocking)
|
|
41
|
+
checkForUpdates().catch(() => {
|
|
42
|
+
// Silently ignore errors
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log("");
|
|
46
|
+
console.log(
|
|
47
|
+
`${colors.bold}${colors.cyan}═══════════════════════════════════════════════════════════${colors.reset}`
|
|
48
|
+
);
|
|
49
|
+
console.log(
|
|
50
|
+
`${colors.bold}${colors.cyan} ${t.smartCommit}${colors.reset}`
|
|
51
|
+
);
|
|
52
|
+
console.log(
|
|
53
|
+
`${colors.bold}${colors.cyan}═══════════════════════════════════════════════════════════${colors.reset}`
|
|
54
|
+
);
|
|
55
|
+
console.log("");
|
|
56
|
+
|
|
57
|
+
// Show language info
|
|
58
|
+
showLanguageInfo();
|
|
59
|
+
|
|
60
|
+
// Check for staged changes
|
|
61
|
+
const stagedFiles = execSync("git diff --cached --name-only", {
|
|
62
|
+
encoding: "utf8",
|
|
63
|
+
}).trim();
|
|
64
|
+
|
|
65
|
+
if (!stagedFiles) {
|
|
66
|
+
console.log(`${colors.yellow}ℹ${colors.reset} ${t.noStagedFiles}`);
|
|
67
|
+
console.log("");
|
|
68
|
+
console.log(`${colors.bold}${t.howToUse}${colors.reset}`);
|
|
69
|
+
console.log(` 1. ${t.makeChanges}`);
|
|
70
|
+
console.log(
|
|
71
|
+
` 2. ${t.stageFiles} ${colors.cyan}git add <files>${colors.reset}`
|
|
72
|
+
);
|
|
73
|
+
console.log(
|
|
74
|
+
` 3. ${t.runCommand} ${colors.cyan}yarn commit${colors.reset}`
|
|
75
|
+
);
|
|
76
|
+
console.log("");
|
|
77
|
+
process.exit(0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Get staged changes
|
|
81
|
+
const changes = getStagedChanges();
|
|
82
|
+
|
|
83
|
+
console.log(
|
|
84
|
+
`${colors.bold}${t.stagedFiles}${colors.reset} ${changes.length}`
|
|
85
|
+
);
|
|
86
|
+
changes.slice(0, 10).forEach((change) => {
|
|
87
|
+
const icon =
|
|
88
|
+
change.status === "added"
|
|
89
|
+
? "✨"
|
|
90
|
+
: change.status === "deleted"
|
|
91
|
+
? "🗑️"
|
|
92
|
+
: "📝";
|
|
93
|
+
const stats = `(+${change.additions}/-${change.deletions})`;
|
|
94
|
+
console.log(
|
|
95
|
+
` ${icon} ${change.path} ${colors.cyan}${stats}${colors.reset}`
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (changes.length > 10) {
|
|
100
|
+
console.log(` ... ${t.andMore} ${changes.length - 10} ${t.andMoreFiles}`);
|
|
101
|
+
}
|
|
102
|
+
console.log("");
|
|
103
|
+
|
|
104
|
+
// Generate commit message
|
|
105
|
+
console.log(`${colors.bold}${t.analyzingChanges}${colors.reset}`);
|
|
106
|
+
const suggestion = generateCommitMessage(changes);
|
|
107
|
+
|
|
108
|
+
console.log("");
|
|
109
|
+
console.log(`${colors.bold}${t.generatedMessage}${colors.reset}`);
|
|
110
|
+
console.log(`${colors.green}${suggestion.fullMessage}${colors.reset}`);
|
|
111
|
+
console.log("");
|
|
112
|
+
|
|
113
|
+
// Show breakdown
|
|
114
|
+
console.log(`${colors.bold}${t.details}${colors.reset}`);
|
|
115
|
+
console.log(` ${t.type} ${colors.cyan}${suggestion.type}${colors.reset}`);
|
|
116
|
+
if (suggestion.scope) {
|
|
117
|
+
console.log(
|
|
118
|
+
` ${t.scope} ${colors.cyan}${suggestion.scope}${colors.reset}`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
console.log(
|
|
122
|
+
` ${t.description} ${colors.cyan}${suggestion.description}${colors.reset}`
|
|
123
|
+
);
|
|
124
|
+
console.log("");
|
|
125
|
+
|
|
126
|
+
// Ask user
|
|
127
|
+
const rl = createInterface();
|
|
128
|
+
|
|
129
|
+
let choice = "";
|
|
130
|
+
while (true) {
|
|
131
|
+
choice = await question(
|
|
132
|
+
rl,
|
|
133
|
+
`${colors.bold}${t.options} [1] ${t.optionCommit} [2] ${t.optionEdit} [3] ${t.optionCancel} (${t.defaultLabel}: 1)\n${t.choice}${colors.reset} `
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// Default to option 1 if empty
|
|
137
|
+
if (!choice || choice.trim() === "") {
|
|
138
|
+
choice = "1";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (choice === "1" || choice === "2" || choice === "3") {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(`${colors.red}${t.invalidEnter}${colors.reset}`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let finalMessage = suggestion.fullMessage;
|
|
149
|
+
|
|
150
|
+
if (choice === "2") {
|
|
151
|
+
console.log("");
|
|
152
|
+
finalMessage = await question(
|
|
153
|
+
rl,
|
|
154
|
+
`${colors.bold}${t.enterCommitMessage}${colors.reset} `
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
if (!finalMessage.trim()) {
|
|
158
|
+
console.log("");
|
|
159
|
+
console.log(`${colors.red}${t.emptyMessage}${colors.reset}`);
|
|
160
|
+
await closeInterface(rl);
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
} else if (choice === "3") {
|
|
164
|
+
console.log("");
|
|
165
|
+
console.log(`${colors.yellow}${t.commitCancelled}${colors.reset}`);
|
|
166
|
+
await closeInterface(rl);
|
|
167
|
+
process.exit(0);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
await closeInterface(rl);
|
|
171
|
+
|
|
172
|
+
// Execute commit
|
|
173
|
+
console.log("");
|
|
174
|
+
console.log(`${colors.bold}${t.committing}${colors.reset}`);
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
execSync(`git commit -m "${finalMessage.replace(/"/g, '\\"')}"`, {
|
|
178
|
+
stdio: "inherit",
|
|
179
|
+
encoding: "utf8",
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
console.log("");
|
|
183
|
+
console.log(
|
|
184
|
+
`${colors.green}${colors.bold}✓ ${t.commitSuccess}${colors.reset}`
|
|
185
|
+
);
|
|
186
|
+
console.log("");
|
|
187
|
+
|
|
188
|
+
// Force clean exit
|
|
189
|
+
process.exit(0);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.log("");
|
|
192
|
+
console.log(`${colors.red}✗ ${t.commitFailed}${colors.reset}`);
|
|
193
|
+
console.log("");
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
main().catch((error) => {
|
|
199
|
+
console.error(`${colors.red}Error:${colors.reset}`, error.message);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChangeAnalysis } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Analyze changes from the last commit and suggest version type
|
|
4
|
+
* @returns Analysis object with suggested version type and reasons
|
|
5
|
+
*/
|
|
6
|
+
export declare function analyzeChanges(): ChangeAnalysis;
|
|
7
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;;GAGG;AACH,wBAAgB,cAAc,IAAI,cAAc,CAyH/C"}
|
package/dist/analyzer.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyzeChanges = analyzeChanges;
|
|
4
|
+
const git_1 = require("./git");
|
|
5
|
+
const i18n_1 = require("./i18n");
|
|
6
|
+
/**
|
|
7
|
+
* Analyze changes from the last commit and suggest version type
|
|
8
|
+
* @returns Analysis object with suggested version type and reasons
|
|
9
|
+
*/
|
|
10
|
+
function analyzeChanges() {
|
|
11
|
+
const lastCommitMsg = (0, git_1.git)("log -1 --pretty=%B");
|
|
12
|
+
const filesChanged = (0, git_1.git)("diff-tree --no-commit-id --name-only -r HEAD")
|
|
13
|
+
.split("\n")
|
|
14
|
+
.filter(Boolean);
|
|
15
|
+
const analysis = {
|
|
16
|
+
type: "patch", // default
|
|
17
|
+
reason: [],
|
|
18
|
+
filesChanged,
|
|
19
|
+
commitMsg: lastCommitMsg,
|
|
20
|
+
};
|
|
21
|
+
// Keywords that indicate MAJOR (breaking changes)
|
|
22
|
+
const majorKeywords = [
|
|
23
|
+
"breaking",
|
|
24
|
+
"break",
|
|
25
|
+
"incompatível",
|
|
26
|
+
"incompatible",
|
|
27
|
+
"remove",
|
|
28
|
+
"remov",
|
|
29
|
+
"delete",
|
|
30
|
+
"delet",
|
|
31
|
+
"refactor completo",
|
|
32
|
+
"reescrita",
|
|
33
|
+
"rewrite",
|
|
34
|
+
];
|
|
35
|
+
// Keywords that indicate MINOR (new features)
|
|
36
|
+
const minorKeywords = [
|
|
37
|
+
"add",
|
|
38
|
+
"adicion",
|
|
39
|
+
"nova",
|
|
40
|
+
"novo",
|
|
41
|
+
"new",
|
|
42
|
+
"feature",
|
|
43
|
+
"implement",
|
|
44
|
+
"criar",
|
|
45
|
+
"create",
|
|
46
|
+
"funcionalidade",
|
|
47
|
+
];
|
|
48
|
+
// Keywords that indicate PATCH (fixes)
|
|
49
|
+
const patchKeywords = [
|
|
50
|
+
"fix",
|
|
51
|
+
"corrig",
|
|
52
|
+
"bug",
|
|
53
|
+
"erro",
|
|
54
|
+
"error",
|
|
55
|
+
"ajust",
|
|
56
|
+
"ajeit",
|
|
57
|
+
"pequen",
|
|
58
|
+
"minor change",
|
|
59
|
+
];
|
|
60
|
+
const msgLower = lastCommitMsg.toLowerCase();
|
|
61
|
+
// Check for MAJOR
|
|
62
|
+
if (majorKeywords.some((kw) => msgLower.includes(kw))) {
|
|
63
|
+
analysis.type = "major";
|
|
64
|
+
analysis.reason.push((0, i18n_1.t)("breakingChange"));
|
|
65
|
+
}
|
|
66
|
+
// Check for critical files modified (config structure, main entry points)
|
|
67
|
+
const criticalFiles = [
|
|
68
|
+
"index.js",
|
|
69
|
+
"index.ts",
|
|
70
|
+
"package.json",
|
|
71
|
+
"projects.config.js",
|
|
72
|
+
"tasks.config.js",
|
|
73
|
+
];
|
|
74
|
+
const hasCriticalChanges = filesChanged.some((file) => criticalFiles.some((critical) => file.includes(critical)));
|
|
75
|
+
if (hasCriticalChanges && analysis.type !== "major") {
|
|
76
|
+
const configChanges = filesChanged.filter((f) => f.includes("config.js") || f.includes("config.ts"));
|
|
77
|
+
if (configChanges.length > 0) {
|
|
78
|
+
analysis.type = "minor";
|
|
79
|
+
analysis.reason.push((0, i18n_1.t)("configFilesModified"));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Check for MINOR
|
|
83
|
+
if (minorKeywords.some((kw) => msgLower.includes(kw)) &&
|
|
84
|
+
analysis.type === "patch") {
|
|
85
|
+
analysis.type = "minor";
|
|
86
|
+
analysis.reason.push((0, i18n_1.t)("newFeatureIndicated"));
|
|
87
|
+
}
|
|
88
|
+
// Check for new files
|
|
89
|
+
const newFiles = (0, git_1.git)("diff-tree --no-commit-id --diff-filter=A --name-only -r HEAD")
|
|
90
|
+
.split("\n")
|
|
91
|
+
.filter(Boolean);
|
|
92
|
+
if (newFiles.length > 0 && analysis.type === "patch") {
|
|
93
|
+
analysis.type = "minor";
|
|
94
|
+
analysis.reason.push(`🟡 ${newFiles.length} ${(0, i18n_1.t)("newFilesAdded")}`);
|
|
95
|
+
}
|
|
96
|
+
// Check for PATCH
|
|
97
|
+
if (patchKeywords.some((kw) => msgLower.includes(kw)) &&
|
|
98
|
+
analysis.type === "patch") {
|
|
99
|
+
analysis.reason.push((0, i18n_1.t)("bugFixIndicated"));
|
|
100
|
+
}
|
|
101
|
+
// If still no specific reason
|
|
102
|
+
if (analysis.reason.length === 0) {
|
|
103
|
+
if (analysis.type === "patch") {
|
|
104
|
+
analysis.reason.push((0, i18n_1.t)("smallChange"));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return analysis;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":";;AAQA,wCAyHC;AAjID,+BAA4B;AAE5B,iCAA2B;AAE3B;;;GAGG;AACH,SAAgB,cAAc;IAC5B,MAAM,aAAa,GAAG,IAAA,SAAG,EAAC,oBAAoB,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAA,SAAG,EAAC,8CAA8C,CAAC;SACrE,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnB,MAAM,QAAQ,GAAmB;QAC/B,IAAI,EAAE,OAAO,EAAE,UAAU;QACzB,MAAM,EAAE,EAAE;QACV,YAAY;QACZ,SAAS,EAAE,aAAa;KACzB,CAAC;IAEF,kDAAkD;IAClD,MAAM,aAAa,GAAG;QACpB,UAAU;QACV,OAAO;QACP,cAAc;QACd,cAAc;QACd,QAAQ;QACR,OAAO;QACP,QAAQ;QACR,OAAO;QACP,mBAAmB;QACnB,WAAW;QACX,SAAS;KACV,CAAC;IAEF,8CAA8C;IAC9C,MAAM,aAAa,GAAG;QACpB,KAAK;QACL,SAAS;QACT,MAAM;QACN,MAAM;QACN,KAAK;QACL,SAAS;QACT,WAAW;QACX,OAAO;QACP,QAAQ;QACR,gBAAgB;KACjB,CAAC;IAEF,uCAAuC;IACvC,MAAM,aAAa,GAAG;QACpB,KAAK;QACL,QAAQ;QACR,KAAK;QACL,MAAM;QACN,OAAO;QACP,OAAO;QACP,OAAO;QACP,QAAQ;QACR,cAAc;KACf,CAAC;IAEF,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;IAE7C,kBAAkB;IAClB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QA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AC,CAAC;IACjD,CAAC;IAED,sBAAsB;IACtB,MAAM,QAAQ,GAAG,IAAA,SAAG,EAClB,8DAA8D,CAC/D;SACE,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACrD,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC;QACxB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,IAAI,IAAA,QAAC,EAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,kBAAkB;IAClB,IACE,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjD,QAAQ,CAAC,IAAI,KAAK,OAAO,EACzB,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,QAAC,EAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,8BAA8B;IAC9B,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,QAAC,EAAC,aAAa,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commit information
|
|
3
|
+
*/
|
|
4
|
+
export interface CommitInfo {
|
|
5
|
+
hash: string;
|
|
6
|
+
message: string;
|
|
7
|
+
type: string;
|
|
8
|
+
scope?: string;
|
|
9
|
+
description: string;
|
|
10
|
+
breaking: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Changelog sections grouped by type
|
|
14
|
+
*/
|
|
15
|
+
export interface ChangelogSections {
|
|
16
|
+
breaking: string[];
|
|
17
|
+
added: string[];
|
|
18
|
+
changed: string[];
|
|
19
|
+
deprecated: string[];
|
|
20
|
+
removed: string[];
|
|
21
|
+
fixed: string[];
|
|
22
|
+
security: string[];
|
|
23
|
+
other: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get all commits since the last tag/version
|
|
27
|
+
* @returns Array of commit hashes and messages
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCommitsSinceLastTag(): CommitInfo[];
|
|
30
|
+
/**
|
|
31
|
+
* Parse commit message following Conventional Commits format
|
|
32
|
+
* @param hash - Commit hash
|
|
33
|
+
* @param message - Commit message
|
|
34
|
+
* @returns Parsed commit information
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseCommitMessage(hash: string, message: string): CommitInfo;
|
|
37
|
+
/**
|
|
38
|
+
* Group commits by type for changelog
|
|
39
|
+
* @param commits - Array of commit information
|
|
40
|
+
* @returns Grouped commits by section
|
|
41
|
+
*/
|
|
42
|
+
export declare function groupCommitsByType(commits: CommitInfo[]): ChangelogSections;
|
|
43
|
+
/**
|
|
44
|
+
* Remove duplicate or very similar entries
|
|
45
|
+
* @param entries - Array of changelog entries
|
|
46
|
+
* @returns Filtered array without duplicates
|
|
47
|
+
*/
|
|
48
|
+
export declare function removeDuplicates(entries: string[]): string[];
|
|
49
|
+
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../src/changelog.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,UAAU,EAAE,CAyBrD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAkD5E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,iBAAiB,CA4C3E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA2B5D"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommitsSinceLastTag = getCommitsSinceLastTag;
|
|
4
|
+
exports.parseCommitMessage = parseCommitMessage;
|
|
5
|
+
exports.groupCommitsByType = groupCommitsByType;
|
|
6
|
+
exports.removeDuplicates = removeDuplicates;
|
|
7
|
+
const git_1 = require("./git");
|
|
8
|
+
/**
|
|
9
|
+
* Get all commits since the last tag/version
|
|
10
|
+
* @returns Array of commit hashes and messages
|
|
11
|
+
*/
|
|
12
|
+
function getCommitsSinceLastTag() {
|
|
13
|
+
// Get the last tag
|
|
14
|
+
const lastTag = (0, git_1.git)("describe --tags --abbrev=0 2>/dev/null");
|
|
15
|
+
// Get commits since last tag, or all commits if no tag exists
|
|
16
|
+
let commits;
|
|
17
|
+
if (lastTag) {
|
|
18
|
+
// Commits since last tag
|
|
19
|
+
commits = (0, git_1.git)(`log ${lastTag}..HEAD --pretty=format:"%H|%s"`);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// No tag exists - get ALL commits (first release)
|
|
23
|
+
commits = (0, git_1.git)(`log --pretty=format:"%H|%s"`);
|
|
24
|
+
}
|
|
25
|
+
if (!commits) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return commits
|
|
29
|
+
.split("\n")
|
|
30
|
+
.filter(Boolean)
|
|
31
|
+
.map((line) => {
|
|
32
|
+
const [hash, message] = line.split("|");
|
|
33
|
+
return parseCommitMessage(hash, message);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse commit message following Conventional Commits format
|
|
38
|
+
* @param hash - Commit hash
|
|
39
|
+
* @param message - Commit message
|
|
40
|
+
* @returns Parsed commit information
|
|
41
|
+
*/
|
|
42
|
+
function parseCommitMessage(hash, message) {
|
|
43
|
+
// Regex for Conventional Commits: type(scope): description
|
|
44
|
+
const conventionalRegex = /^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/;
|
|
45
|
+
const match = message.match(conventionalRegex);
|
|
46
|
+
if (match) {
|
|
47
|
+
const [, type, , scope, breaking, description] = match;
|
|
48
|
+
return {
|
|
49
|
+
hash: hash.substring(0, 7),
|
|
50
|
+
message,
|
|
51
|
+
type: type.toLowerCase(),
|
|
52
|
+
scope,
|
|
53
|
+
description,
|
|
54
|
+
breaking: !!breaking || message.toLowerCase().includes("breaking"),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Fallback: try to identify type by keywords
|
|
58
|
+
const lowerMsg = message.toLowerCase();
|
|
59
|
+
let type = "other";
|
|
60
|
+
if (lowerMsg.match(/^(add|feat|feature|nova|novo|implement|criar)/)) {
|
|
61
|
+
type = "feat";
|
|
62
|
+
}
|
|
63
|
+
else if (lowerMsg.match(/^(fix|corrig|bug|erro|ajust)/)) {
|
|
64
|
+
type = "fix";
|
|
65
|
+
}
|
|
66
|
+
else if (lowerMsg.match(/^(remove|remov|delete|delet)/)) {
|
|
67
|
+
type = "removed";
|
|
68
|
+
}
|
|
69
|
+
else if (lowerMsg.match(/^(deprecat|obsolet)/)) {
|
|
70
|
+
type = "deprecated";
|
|
71
|
+
}
|
|
72
|
+
else if (lowerMsg.match(/^(refactor|reescrev|rewrite)/)) {
|
|
73
|
+
type = "refactor";
|
|
74
|
+
}
|
|
75
|
+
else if (lowerMsg.match(/^(docs|doc|documentation)/)) {
|
|
76
|
+
type = "docs";
|
|
77
|
+
}
|
|
78
|
+
else if (lowerMsg.match(/^(style|format)/)) {
|
|
79
|
+
type = "style";
|
|
80
|
+
}
|
|
81
|
+
else if (lowerMsg.match(/^(test|tests)/)) {
|
|
82
|
+
type = "test";
|
|
83
|
+
}
|
|
84
|
+
else if (lowerMsg.match(/^(chore|build|ci)/)) {
|
|
85
|
+
type = "chore";
|
|
86
|
+
}
|
|
87
|
+
else if (lowerMsg.match(/^(security|segurança|sec)/)) {
|
|
88
|
+
type = "security";
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
hash: hash.substring(0, 7),
|
|
92
|
+
message,
|
|
93
|
+
type,
|
|
94
|
+
description: message,
|
|
95
|
+
breaking: lowerMsg.includes("breaking") || lowerMsg.includes("break"),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Group commits by type for changelog
|
|
100
|
+
* @param commits - Array of commit information
|
|
101
|
+
* @returns Grouped commits by section
|
|
102
|
+
*/
|
|
103
|
+
function groupCommitsByType(commits) {
|
|
104
|
+
const sections = {
|
|
105
|
+
breaking: [],
|
|
106
|
+
added: [],
|
|
107
|
+
changed: [],
|
|
108
|
+
deprecated: [],
|
|
109
|
+
removed: [],
|
|
110
|
+
fixed: [],
|
|
111
|
+
security: [],
|
|
112
|
+
other: [],
|
|
113
|
+
};
|
|
114
|
+
for (const commit of commits) {
|
|
115
|
+
// Skip certain types that shouldn't appear in changelog
|
|
116
|
+
if (["chore", "docs", "style", "test", "build", "ci"].includes(commit.type)) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const entry = commit.scope
|
|
120
|
+
? `**${commit.scope}**: ${commit.description}`
|
|
121
|
+
: commit.description;
|
|
122
|
+
if (commit.breaking) {
|
|
123
|
+
sections.breaking.push(`⚠️ **BREAKING CHANGE**: ${entry}`);
|
|
124
|
+
}
|
|
125
|
+
else if (commit.type === "feat" || commit.type === "feature") {
|
|
126
|
+
sections.added.push(entry);
|
|
127
|
+
}
|
|
128
|
+
else if (commit.type === "fix") {
|
|
129
|
+
sections.fixed.push(entry);
|
|
130
|
+
}
|
|
131
|
+
else if (commit.type === "removed" || commit.type === "remove") {
|
|
132
|
+
sections.removed.push(entry);
|
|
133
|
+
}
|
|
134
|
+
else if (commit.type === "deprecated") {
|
|
135
|
+
sections.deprecated.push(entry);
|
|
136
|
+
}
|
|
137
|
+
else if (commit.type === "security") {
|
|
138
|
+
sections.security.push(entry);
|
|
139
|
+
}
|
|
140
|
+
else if (commit.type === "refactor" || commit.type === "perf") {
|
|
141
|
+
sections.changed.push(entry);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
sections.other.push(entry);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return sections;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Remove duplicate or very similar entries
|
|
151
|
+
* @param entries - Array of changelog entries
|
|
152
|
+
* @returns Filtered array without duplicates
|
|
153
|
+
*/
|
|
154
|
+
function removeDuplicates(entries) {
|
|
155
|
+
const unique = new Map();
|
|
156
|
+
for (const entry of entries) {
|
|
157
|
+
// Normalize text for comparison
|
|
158
|
+
const normalized = entry
|
|
159
|
+
.toLowerCase()
|
|
160
|
+
.replace(/[^a-z0-9\s]/g, "")
|
|
161
|
+
.replace(/\s+/g, " ")
|
|
162
|
+
.trim();
|
|
163
|
+
// If a very similar entry already exists, skip it
|
|
164
|
+
let isDuplicate = false;
|
|
165
|
+
for (const [key] of unique) {
|
|
166
|
+
const similarity = calculateSimilarity(normalized, key);
|
|
167
|
+
if (similarity > 0.8) {
|
|
168
|
+
isDuplicate = true;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (!isDuplicate) {
|
|
173
|
+
unique.set(normalized, entry);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return Array.from(unique.values());
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Calculate similarity between two strings (0-1)
|
|
180
|
+
* @param str1 - First string
|
|
181
|
+
* @param str2 - Second string
|
|
182
|
+
* @returns Similarity score (0-1)
|
|
183
|
+
*/
|
|
184
|
+
function calculateSimilarity(str1, str2) {
|
|
185
|
+
const longer = str1.length > str2.length ? str1 : str2;
|
|
186
|
+
const shorter = str1.length > str2.length ? str2 : str1;
|
|
187
|
+
if (longer.length === 0) {
|
|
188
|
+
return 1.0;
|
|
189
|
+
}
|
|
190
|
+
const editDistance = levenshteinDistance(longer, shorter);
|
|
191
|
+
return (longer.length - editDistance) / longer.length;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Calculate Levenshtein distance between two strings
|
|
195
|
+
* @param str1 - First string
|
|
196
|
+
* @param str2 - Second string
|
|
197
|
+
* @returns Edit distance
|
|
198
|
+
*/
|
|
199
|
+
function levenshteinDistance(str1, str2) {
|
|
200
|
+
const matrix = [];
|
|
201
|
+
for (let i = 0; i <= str2.length; i++) {
|
|
202
|
+
matrix[i] = [i];
|
|
203
|
+
}
|
|
204
|
+
for (let j = 0; j <= str1.length; j++) {
|
|
205
|
+
matrix[0][j] = j;
|
|
206
|
+
}
|
|
207
|
+
for (let i = 1; i <= str2.length; i++) {
|
|
208
|
+
for (let j = 1; j <= str1.length; j++) {
|
|
209
|
+
if (str2.charAt(i - 1) === str1.charAt(j - 1)) {
|
|
210
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return matrix[str2.length][str1.length];
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=changelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../src/changelog.ts"],"names":[],"mappings":";;AAgCA,wDAyBC;AAQD,gDAkDC;AAOD,gDA4CC;AAOD,4CA2BC;AAxMD,+BAA4B;AA4B5B;;;GAGG;AACH,SAAgB,sBAAsB;IACpC,mBAAmB;IACnB,MAAM,OAAO,GAAG,IAAA,SAAG,EAAC,wCAAwC,CAAC,CAAC;IAE9D,8DAA8D;IAC9D,IAAI,OAAe,CAAC;IACpB,IAAI,OAAO,EAAE,CAAC;QACZ,yBAAyB;QACzB,OAAO,GAAG,IAAA,SAAG,EAAC,OAAO,OAAO,gCAAgC,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACN,kDAAkD;QAClD,OAAO,GAAG,IAAA,SAAG,EAAC,6BAA6B,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,OAAO;SACX,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,SA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CAAC,GAAG,CACrB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACxB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACpB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CACrB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAQpB,CAAC"}
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ANSI color codes for terminal output
|
|
6
|
+
*/
|
|
7
|
+
exports.colors = {
|
|
8
|
+
reset: "\x1b[0m",
|
|
9
|
+
bold: "\x1b[1m",
|
|
10
|
+
red: "\x1b[31m",
|
|
11
|
+
green: "\x1b[32m",
|
|
12
|
+
yellow: "\x1b[33m",
|
|
13
|
+
blue: "\x1b[34m",
|
|
14
|
+
cyan: "\x1b[36m",
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,MAAM,GAAW;IAC5B,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File change information
|
|
3
|
+
*/
|
|
4
|
+
export interface FileChange {
|
|
5
|
+
path: string;
|
|
6
|
+
status: "added" | "modified" | "deleted" | "renamed";
|
|
7
|
+
additions: number;
|
|
8
|
+
deletions: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Commit suggestion
|
|
12
|
+
*/
|
|
13
|
+
export interface CommitSuggestion {
|
|
14
|
+
type: string;
|
|
15
|
+
scope?: string;
|
|
16
|
+
description: string;
|
|
17
|
+
fullMessage: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get staged file changes
|
|
21
|
+
*/
|
|
22
|
+
export declare function getStagedChanges(): FileChange[];
|
|
23
|
+
/**
|
|
24
|
+
* Analyze changes and generate commit message
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateCommitMessage(changes: FileChange[]): CommitSuggestion;
|
|
27
|
+
//# sourceMappingURL=commitGenerator.d.ts.map
|