@elsikora/commitizen-plugin-commitlint-ai 2.1.1-dev.3 → 2.2.0-dev.1

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.
Files changed (41) hide show
  1. package/dist/cjs/application/use-case/edit-commit.use-case.d.ts +78 -0
  2. package/dist/cjs/application/use-case/edit-commit.use-case.js +273 -0
  3. package/dist/cjs/application/use-case/edit-commit.use-case.js.map +1 -0
  4. package/dist/cjs/application/use-case/index.d.ts +1 -0
  5. package/dist/cjs/domain/entity/commit-message.entity.d.ts +6 -0
  6. package/dist/cjs/domain/entity/commit-message.entity.js +15 -2
  7. package/dist/cjs/domain/entity/commit-message.entity.js.map +1 -1
  8. package/dist/cjs/domain/value-object/commit-body.value-object.d.ts +9 -3
  9. package/dist/cjs/domain/value-object/commit-body.value-object.js +17 -8
  10. package/dist/cjs/domain/value-object/commit-body.value-object.js.map +1 -1
  11. package/dist/cjs/index.js +2 -0
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/infrastructure/di/container.d.ts +1 -0
  14. package/dist/cjs/infrastructure/di/container.js +7 -2
  15. package/dist/cjs/infrastructure/di/container.js.map +1 -1
  16. package/dist/cjs/infrastructure/llm/mock-llm.service.js +203 -0
  17. package/dist/cjs/infrastructure/llm/mock-llm.service.js.map +1 -0
  18. package/dist/cjs/presentation/commitizen.adapter.d.ts +7 -0
  19. package/dist/cjs/presentation/commitizen.adapter.js +26 -8
  20. package/dist/cjs/presentation/commitizen.adapter.js.map +1 -1
  21. package/dist/esm/application/use-case/edit-commit.use-case.d.ts +78 -0
  22. package/dist/esm/application/use-case/edit-commit.use-case.js +271 -0
  23. package/dist/esm/application/use-case/edit-commit.use-case.js.map +1 -0
  24. package/dist/esm/application/use-case/index.d.ts +1 -0
  25. package/dist/esm/domain/entity/commit-message.entity.d.ts +6 -0
  26. package/dist/esm/domain/entity/commit-message.entity.js +15 -2
  27. package/dist/esm/domain/entity/commit-message.entity.js.map +1 -1
  28. package/dist/esm/domain/value-object/commit-body.value-object.d.ts +9 -3
  29. package/dist/esm/domain/value-object/commit-body.value-object.js +17 -8
  30. package/dist/esm/domain/value-object/commit-body.value-object.js.map +1 -1
  31. package/dist/esm/index.js +1 -0
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/infrastructure/di/container.d.ts +1 -0
  34. package/dist/esm/infrastructure/di/container.js +7 -3
  35. package/dist/esm/infrastructure/di/container.js.map +1 -1
  36. package/dist/esm/infrastructure/llm/mock-llm.service.js +201 -0
  37. package/dist/esm/infrastructure/llm/mock-llm.service.js.map +1 -0
  38. package/dist/esm/presentation/commitizen.adapter.d.ts +7 -0
  39. package/dist/esm/presentation/commitizen.adapter.js +27 -9
  40. package/dist/esm/presentation/commitizen.adapter.js.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,271 @@
1
+ import { CommitMessage } from '../../domain/entity/commit-message.entity.js';
2
+ import { CommitBody } from '../../domain/value-object/commit-body.value-object.js';
3
+ import { CommitHeader } from '../../domain/value-object/commit-header.value-object.js';
4
+
5
+ /**
6
+ * Use case for editing existing commit messages with point editing capabilities
7
+ */
8
+ class EditCommitUseCase {
9
+ CLI_INTERFACE;
10
+ LLM_SERVICES;
11
+ VALIDATOR;
12
+ constructor(cliInterface, validator, llmServices) {
13
+ this.CLI_INTERFACE = cliInterface;
14
+ this.VALIDATOR = validator;
15
+ this.LLM_SERVICES = llmServices;
16
+ }
17
+ /**
18
+ * Execute the commit editing workflow
19
+ * @param {CommitMessage} commitMessage - The initial commit message to edit
20
+ * @param {ILlmPromptContext} context - The LLM prompt context
21
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration for regeneration
22
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
23
+ */
24
+ async execute(commitMessage, context, llmConfig) {
25
+ // Show current commit message
26
+ this.CLI_INTERFACE.log("\nCurrent commit message:");
27
+ this.CLI_INTERFACE.note("Commit Preview", commitMessage.toString());
28
+ // Validate current message
29
+ const validation = await this.VALIDATOR.validate(commitMessage);
30
+ if (validation.isValid) {
31
+ this.CLI_INTERFACE.success("✅ Validation: PASSED");
32
+ }
33
+ else {
34
+ this.CLI_INTERFACE.warn("❌ Validation: FAILED");
35
+ if (validation.errors && validation.errors.length > 0) {
36
+ for (const error of validation.errors) {
37
+ this.CLI_INTERFACE.error(` - ${error}`);
38
+ }
39
+ }
40
+ }
41
+ // Build edit options
42
+ const editOptions = [
43
+ { label: "✅ Confirm and use this commit message", value: "confirm" },
44
+ { isDisabled: true, label: "─────────────────────────────────", value: "separator1" },
45
+ { label: "🏷️ Edit commit type", value: "changeType" },
46
+ { label: "🎯 Edit commit scope", value: "changeScope" },
47
+ { label: "💬 Edit commit subject", value: "changeSubject" },
48
+ { label: commitMessage.getBody().getContent() ? "📄 Edit commit body" : "➕ Add commit body", value: "changeBody" },
49
+ { isDisabled: true, label: "─────────────────────────────────", value: "separator2" },
50
+ {
51
+ label: commitMessage.getBody().getFooter() ? "➖ Remove footer/issues" : "➕ Add footer/issues",
52
+ value: "toggleFooter",
53
+ },
54
+ {
55
+ label: commitMessage.isBreakingChange() ? "✔️ Unmark as breaking change" : "⚠️ Mark as breaking change",
56
+ value: "toggleBreaking",
57
+ },
58
+ ];
59
+ // Add regenerate option if LLM is configured
60
+ if (llmConfig) {
61
+ editOptions.splice(1, 0, { label: "🔄 Regenerate with AI", value: "regenerate" });
62
+ }
63
+ const action = await this.CLI_INTERFACE.select("What would you like to do?", editOptions);
64
+ switch (action) {
65
+ case "changeBody": {
66
+ return this.handleChangeBody(commitMessage, context, llmConfig);
67
+ }
68
+ case "changeScope": {
69
+ return this.handleChangeScope(commitMessage, context, llmConfig);
70
+ }
71
+ case "changeSubject": {
72
+ return this.handleChangeSubject(commitMessage, context, llmConfig);
73
+ }
74
+ case "changeType": {
75
+ return this.handleChangeType(commitMessage, context, llmConfig);
76
+ }
77
+ case "confirm": {
78
+ return commitMessage;
79
+ }
80
+ case "regenerate": {
81
+ return this.handleRegenerate(context, llmConfig);
82
+ }
83
+ case "toggleBreaking": {
84
+ return this.handleToggleBreaking(commitMessage, context, llmConfig);
85
+ }
86
+ case "toggleFooter": {
87
+ return this.handleToggleFooter(commitMessage, context, llmConfig);
88
+ }
89
+ default: {
90
+ // Should never reach here
91
+ return commitMessage;
92
+ }
93
+ }
94
+ }
95
+ /**
96
+ * Handle changing commit body
97
+ * @param {CommitMessage} commitMessage - The current commit message
98
+ * @param {ILlmPromptContext} context - The LLM prompt context
99
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
100
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
101
+ */
102
+ async handleChangeBody(commitMessage, context, llmConfig) {
103
+ const body = commitMessage.getBody();
104
+ this.CLI_INTERFACE.info("💡 Leave empty to remove body (clear all text and press Enter)");
105
+ const newBodyContent = await this.CLI_INTERFACE.text(context.body?.description ?? "Body description (optional):", body.getContent() ?? "");
106
+ const finalBodyContent = newBodyContent.trim() === "" ? undefined : newBodyContent.trim();
107
+ const newBody = new CommitBody(finalBodyContent, body.getBreakingChange(), body.getFooter());
108
+ const newMessage = commitMessage.withBody(newBody);
109
+ return this.execute(newMessage, context, llmConfig);
110
+ }
111
+ /**
112
+ * Handle changing commit scope
113
+ * @param {CommitMessage} commitMessage - The current commit message
114
+ * @param {ILlmPromptContext} context - The LLM prompt context
115
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
116
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
117
+ */
118
+ async handleChangeScope(commitMessage, context, llmConfig) {
119
+ const header = commitMessage.getHeader();
120
+ // Scope is optional, use placeholder to allow deletion
121
+ const newScope = await this.CLI_INTERFACE.text(context.scopeDescription ?? "What is the scope of this change?", header.getScope() ?? "");
122
+ const finalScope = newScope.trim() === "" ? undefined : newScope.trim();
123
+ const newHeader = new CommitHeader(header.getType(), header.getSubject(), finalScope);
124
+ const newMessage = commitMessage.withHeader(newHeader);
125
+ return this.execute(newMessage, context, llmConfig);
126
+ }
127
+ /**
128
+ * Handle changing commit subject
129
+ * @param {CommitMessage} commitMessage - The current commit message
130
+ * @param {ILlmPromptContext} context - The LLM prompt context
131
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
132
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
133
+ */
134
+ async handleChangeSubject(commitMessage, context, llmConfig) {
135
+ const header = commitMessage.getHeader();
136
+ // Subject is required by commitlint rules, use initialValue to prevent deletion
137
+ const newSubject = await this.CLI_INTERFACE.text(context.subject?.description ?? "Write a short, imperative description of the change:", "", header.getSubject());
138
+ const newHeader = new CommitHeader(header.getType(), newSubject.trim(), header.getScope());
139
+ const newMessage = commitMessage.withHeader(newHeader);
140
+ return this.execute(newMessage, context, llmConfig);
141
+ }
142
+ /**
143
+ * Handle changing commit type
144
+ * @param {CommitMessage} commitMessage - The current commit message
145
+ * @param {ILlmPromptContext} context - The LLM prompt context
146
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
147
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
148
+ */
149
+ async handleChangeType(commitMessage, context, llmConfig) {
150
+ const header = commitMessage.getHeader();
151
+ // Build type options
152
+ const typeOptions = context.typeEnum?.map((type) => {
153
+ const desc = context.typeDescriptions?.[type]?.description ?? "";
154
+ const emoji = context.typeDescriptions?.[type]?.emoji ?? "";
155
+ let cleanDesc = desc;
156
+ if (emoji && desc.startsWith(emoji)) {
157
+ cleanDesc = desc.slice(emoji.length).trim();
158
+ }
159
+ const label = emoji ? `${type} ${emoji}: ${cleanDesc}` : `${type}: ${cleanDesc}`;
160
+ return { label, value: type };
161
+ }) ?? [];
162
+ const newType = await this.CLI_INTERFACE.select(context.typeDescription ?? "Select the type of change:", typeOptions, header.getType());
163
+ const newHeader = new CommitHeader(newType, header.getSubject(), header.getScope());
164
+ const newMessage = commitMessage.withHeader(newHeader);
165
+ return this.execute(newMessage, context, llmConfig);
166
+ }
167
+ /**
168
+ * Handle AI regeneration of commit message
169
+ * @param {ILlmPromptContext} context - The LLM prompt context
170
+ * @param {LLMConfiguration} llmConfig - The LLM configuration
171
+ * @returns {Promise<CommitMessage>} Promise resolving to the regenerated commit message
172
+ */
173
+ async handleRegenerate(context, llmConfig) {
174
+ this.CLI_INTERFACE.startSpinner("🔄 Regenerating commit message with AI...");
175
+ try {
176
+ const service = this.LLM_SERVICES.find((s) => s.supports(llmConfig));
177
+ if (!service) {
178
+ throw new Error(`No LLM service found for provider: ${llmConfig.getProvider()}`);
179
+ }
180
+ const newCommitMessage = await service.generateCommitMessage(context, llmConfig);
181
+ this.CLI_INTERFACE.stopSpinner();
182
+ // Validate the new message
183
+ const validation = await this.VALIDATOR.validate(newCommitMessage);
184
+ this.CLI_INTERFACE.success("✅ New commit message generated successfully!");
185
+ this.CLI_INTERFACE.log("\nRegenerated commit message:");
186
+ this.CLI_INTERFACE.note("New Commit", newCommitMessage.toString());
187
+ if (validation.isValid) {
188
+ this.CLI_INTERFACE.success("✅ Validation: PASSED");
189
+ }
190
+ else {
191
+ this.CLI_INTERFACE.warn("❌ Validation: FAILED");
192
+ if (validation.errors) {
193
+ for (const error of validation.errors) {
194
+ this.CLI_INTERFACE.error(` - ${error}`);
195
+ }
196
+ }
197
+ }
198
+ // Continue editing with the new message
199
+ return this.execute(newCommitMessage, context, llmConfig);
200
+ }
201
+ catch (error) {
202
+ this.CLI_INTERFACE.stopSpinner();
203
+ this.CLI_INTERFACE.error("Failed to regenerate commit message");
204
+ this.CLI_INTERFACE.handleError("Error:", error);
205
+ // Ask if user wants to try again or go back to editing
206
+ const retry = await this.CLI_INTERFACE.confirm("Would you like to try regenerating again?", false);
207
+ if (retry) {
208
+ return this.handleRegenerate(context, llmConfig);
209
+ }
210
+ // Return to edit menu with original message
211
+ return this.execute(new CommitMessage(new CommitHeader(context.typeEnum?.[0] || "feat", "fix: update"), new CommitBody()), context, llmConfig);
212
+ }
213
+ }
214
+ /**
215
+ * Handle toggling breaking change status
216
+ * @param {CommitMessage} commitMessage - The current commit message
217
+ * @param {ILlmPromptContext} context - The LLM prompt context
218
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
219
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
220
+ */
221
+ async handleToggleBreaking(commitMessage, context, llmConfig) {
222
+ const body = commitMessage.getBody();
223
+ if (commitMessage.isBreakingChange()) {
224
+ // Remove breaking change
225
+ const newBody = new CommitBody(body.getContent(), undefined, body.getFooter());
226
+ const newMessage = commitMessage.withBody(newBody);
227
+ this.CLI_INTERFACE.success("✅ Removed breaking change marker");
228
+ return this.execute(newMessage, context, llmConfig);
229
+ }
230
+ else {
231
+ // Add breaking change
232
+ const breakingDescription = await this.CLI_INTERFACE.text("Describe the breaking change:", "", "");
233
+ const finalBreaking = breakingDescription.trim() === "" ? "BREAKING CHANGE" : breakingDescription.trim();
234
+ const newBody = new CommitBody(body.getContent(), finalBreaking, body.getFooter());
235
+ const newMessage = commitMessage.withBody(newBody);
236
+ this.CLI_INTERFACE.success("✅ Added breaking change marker");
237
+ return this.execute(newMessage, context, llmConfig);
238
+ }
239
+ }
240
+ /**
241
+ * Handle toggling footer/issues
242
+ * @param {CommitMessage} commitMessage - The current commit message
243
+ * @param {ILlmPromptContext} context - The LLM prompt context
244
+ * @param {LLMConfiguration | undefined} llmConfig - Optional LLM configuration
245
+ * @returns {Promise<CommitMessage>} Promise resolving to the edited commit message
246
+ */
247
+ async handleToggleFooter(commitMessage, context, llmConfig) {
248
+ const body = commitMessage.getBody();
249
+ if (body.getFooter()) {
250
+ // Remove footer
251
+ const newBody = new CommitBody(body.getContent(), body.getBreakingChange(), undefined);
252
+ const newMessage = commitMessage.withBody(newBody);
253
+ this.CLI_INTERFACE.success("✅ Footer/issues removed");
254
+ return this.execute(newMessage, context, llmConfig);
255
+ }
256
+ // Add footer
257
+ this.CLI_INTERFACE.info("💡 Examples: 'Closes #123', 'Fixes #456', 'Refs #789'");
258
+ const footer = await this.CLI_INTERFACE.text("Footer (issues, references):", "");
259
+ if (footer.trim() === "") {
260
+ this.CLI_INTERFACE.warn("Footer cannot be empty. Skipping...");
261
+ return this.execute(commitMessage, context, llmConfig);
262
+ }
263
+ const newBody = new CommitBody(body.getContent(), body.getBreakingChange(), footer.trim());
264
+ const newMessage = commitMessage.withBody(newBody);
265
+ this.CLI_INTERFACE.success("✅ Footer/issues added");
266
+ return this.execute(newMessage, context, llmConfig);
267
+ }
268
+ }
269
+
270
+ export { EditCommitUseCase };
271
+ //# sourceMappingURL=edit-commit.use-case.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-commit.use-case.js","sources":["../../../../../src/application/use-case/edit-commit.use-case.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAUA;;AAEG;MACU,iBAAiB,CAAA;AACZ,IAAA,aAAa;AAEb,IAAA,YAAY;AAEZ,IAAA,SAAS;AAE1B,IAAA,WAAA,CAAY,YAAkC,EAAE,SAA2B,EAAE,WAA+B,EAAA;AAC3G,QAAA,IAAI,CAAC,aAAa,GAAG,YAAY;AACjC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;AAC1B,QAAA,IAAI,CAAC,YAAY,GAAG,WAAW;IAChC;AAEA;;;;;;AAMG;AACH,IAAA,MAAM,OAAO,CAAC,aAA4B,EAAE,OAA0B,EAAE,SAA4B,EAAA;;AAEnG,QAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,2BAA2B,CAAC;AACnD,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC;;QAGnE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC;AAE/D,QAAA,IAAI,UAAU,CAAC,OAAO,EAAE;AACvB,YAAA,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,sBAAsB,CAAC;QACnD;aAAO;AACN,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI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2
3
  export * from './generate-commit-message.use-case';
3
4
  export * from './manual-commit.use-case';
4
5
  export * from './validate-commit-message.use-case';
@@ -29,6 +29,12 @@ export declare class CommitMessage {
29
29
  isBreakingChange(): boolean;
30
30
  /**
31
31
  * Format the complete commit message
32
+ * Follows conventional commits format:
33
+ * <header>
34
+ *
35
+ * <body>
36
+ *
37
+ * <footer>
32
38
  * @returns {string} The formatted commit message
33
39
  */
34
40
  toString(): string;
@@ -38,12 +38,25 @@ class CommitMessage {
38
38
  }
39
39
  /**
40
40
  * Format the complete commit message
41
+ * Follows conventional commits format:
42
+ * <header>
43
+ *
44
+ * <body>
45
+ *
46
+ * <footer>
41
47
  * @returns {string} The formatted commit message
42
48
  */
43
49
  toString() {
44
50
  const parts = [this.HEADER.toString()];
45
- if (!this.BODY.isEmpty()) {
46
- parts.push(this.BODY.toString());
51
+ // Add body (content + breaking change) if not empty
52
+ const bodyText = this.BODY.toString();
53
+ if (bodyText) {
54
+ parts.push(bodyText);
55
+ }
56
+ // Add footer separately (for proper commitlint parsing)
57
+ const footer = this.BODY.getFooter();
58
+ if (footer) {
59
+ parts.push(footer);
47
60
  }
48
61
  return parts.join("\n\n");
49
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"commit-message.entity.js","sources":["../../../../../src/domain/entity/commit-message.entity.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;;AAEG;MACU,aAAa,CAAA;AACR,IAAA,IAAI;AAEJ,IAAA,MAAM;IAEvB,WAAA,CAAY,MAAoB,EAAE,IAAgB,EAAA;AACjD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IACjB;AAEA;;;AAGG;IACH,OAAO,GAAA;QACN,OAAO,IAAI,CAAC,IAAI;IACjB;AAEA;;;AAGG;IACH,iBAAiB,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;IACrC;AAEA;;;AAGG;IACH,SAAS,GAAA;QACR,OAAO,IAAI,CAAC,MAAM;IACnB;AAEA;;;AAGG;IACH,gBAAgB,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;IACrC;AAEA;;;AAGG;IACH,QAAQ,GAAA;QACP,MAAM,KAAK,GAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAErD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE;YACzB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjC;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B;AAEA;;;;AAIG;AACH,IAAA,QAAQ,CAAC,IAAgB,EAAA;QACxB,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5C;AAEA;;;;AAIG;AACH,IAAA,UAAU,CAAC,MAAoB,EAAA;QAC9B,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;IAC5C;AACA;;;;"}
1
+ {"version":3,"file":"commit-message.entity.js","sources":["../../../../../src/domain/entity/commit-message.entity.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;;AAEG;MACU,aAAa,CAAA;AACR,IAAA,IAAI;AAEJ,IAAA,MAAM;IAEvB,WAAA,CAAY,MAAoB,EAAE,IAAgB,EAAA;AACjD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;IACjB;AAEA;;;AAGG;IACH,OAAO,GAAA;QACN,OAAO,IAAI,CAAC,IAAI;IACjB;AAEA;;;AAGG;IACH,iBAAiB,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;IACrC;AAEA;;;AAGG;IACH,SAAS,GAAA;QACR,OAAO,IAAI,CAAC,MAAM;IACnB;AAEA;;;AAGG;IACH,gBAAgB,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;IACrC;AAEA;;;;;;;;;AASG;IACH,QAAQ,GAAA;QACP,MAAM,KAAK,GAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;;QAGrD,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;QAE7C,IAAI,QAAQ,EAAE;AACb,YAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB;;QAGA,MAAM,MAAM,GAAuB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;QAExD,IAAI,MAAM,EAAE;AACX,YAAA,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACnB;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B;AAEA;;;;AAIG;AACH,IAAA,QAAQ,CAAC,IAAgB,EAAA;QACxB,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5C;AAEA;;;;AAIG;AACH,IAAA,UAAU,CAAC,MAAoB,EAAA;QAC9B,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;IAC5C;AACA;;;;"}
@@ -4,7 +4,8 @@
4
4
  export declare class CommitBody {
5
5
  private readonly BREAKING_CHANGE;
6
6
  private readonly CONTENT;
7
- constructor(content?: string, breakingChange?: string);
7
+ private readonly FOOTER;
8
+ constructor(content?: string, breakingChange?: string, footer?: string);
8
9
  /**
9
10
  * Check if two bodies are equal
10
11
  * @param {CommitBody} other - The other commit body to compare with
@@ -21,6 +22,11 @@ export declare class CommitBody {
21
22
  * @returns {string | undefined} The body content or undefined
22
23
  */
23
24
  getContent(): string | undefined;
25
+ /**
26
+ * Get the footer (issues, references, etc.)
27
+ * @returns {string | undefined} The footer or undefined
28
+ */
29
+ getFooter(): string | undefined;
24
30
  /**
25
31
  * Check if there is a breaking change
26
32
  * @returns {boolean} True if there is a breaking change
@@ -32,8 +38,8 @@ export declare class CommitBody {
32
38
  */
33
39
  isEmpty(): boolean;
34
40
  /**
35
- * Format the body as a string
36
- * @returns {string} The formatted body text
41
+ * Format the body as a string (without footer)
42
+ * @returns {string} The formatted body text (content + breaking change only)
37
43
  */
38
44
  toString(): string;
39
45
  }
@@ -4,9 +4,11 @@
4
4
  class CommitBody {
5
5
  BREAKING_CHANGE;
6
6
  CONTENT;
7
- constructor(content, breakingChange) {
7
+ FOOTER;
8
+ constructor(content, breakingChange, footer) {
8
9
  this.CONTENT = content?.trim() ?? undefined;
9
10
  this.BREAKING_CHANGE = breakingChange?.trim() ?? undefined;
11
+ this.FOOTER = footer?.trim() ?? undefined;
10
12
  }
11
13
  /**
12
14
  * Check if two bodies are equal
@@ -14,7 +16,7 @@ class CommitBody {
14
16
  * @returns {boolean} True if the bodies are equal
15
17
  */
16
18
  equals(other) {
17
- return this.CONTENT === other.CONTENT && this.BREAKING_CHANGE === other.BREAKING_CHANGE;
19
+ return this.CONTENT === other.CONTENT && this.BREAKING_CHANGE === other.BREAKING_CHANGE && this.FOOTER === other.FOOTER;
18
20
  }
19
21
  /**
20
22
  * Get the breaking change description
@@ -30,6 +32,13 @@ class CommitBody {
30
32
  getContent() {
31
33
  return this.CONTENT;
32
34
  }
35
+ /**
36
+ * Get the footer (issues, references, etc.)
37
+ * @returns {string | undefined} The footer or undefined
38
+ */
39
+ getFooter() {
40
+ return this.FOOTER;
41
+ }
33
42
  /**
34
43
  * Check if there is a breaking change
35
44
  * @returns {boolean} True if there is a breaking change
@@ -42,20 +51,20 @@ class CommitBody {
42
51
  * @returns {boolean} True if the body is empty
43
52
  */
44
53
  isEmpty() {
45
- return !this.CONTENT && !this.BREAKING_CHANGE;
54
+ return !this.CONTENT && !this.BREAKING_CHANGE && !this.FOOTER;
46
55
  }
47
56
  /**
48
- * Format the body as a string
49
- * @returns {string} The formatted body text
57
+ * Format the body as a string (without footer)
58
+ * @returns {string} The formatted body text (content + breaking change only)
50
59
  */
51
60
  toString() {
52
61
  const parts = [];
53
- if (this.BREAKING_CHANGE) {
54
- parts.push(`BREAKING CHANGE: ${this.BREAKING_CHANGE}`);
55
- }
56
62
  if (this.CONTENT) {
57
63
  parts.push(this.CONTENT);
58
64
  }
65
+ if (this.BREAKING_CHANGE) {
66
+ parts.push(`BREAKING CHANGE: ${this.BREAKING_CHANGE}`);
67
+ }
59
68
  return parts.join("\n\n");
60
69
  }
61
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"commit-body.value-object.js","sources":["../../../../../src/domain/value-object/commit-body.value-object.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;MACU,UAAU,CAAA;AACL,IAAA,eAAe;AAEf,IAAA,OAAO;IAExB,WAAA,CAAY,OAAgB,EAAE,cAAuB,EAAA;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,SAAS;QAC3C,IAAI,CAAC,eAAe,GAAG,cAAc,EAAE,IAAI,EAAE,IAAI,SAAS;IAC3D;AAEA;;;;AAIG;AACH,IAAA,MAAM,CAAC,KAAiB,EAAA;AACvB,QAAA,OAAO,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe;IACxF;AAEA;;;AAGG;IACH,iBAAiB,GAAA;QAChB,OAAO,IAAI,CAAC,eAAe;IAC5B;AAEA;;;AAGG;IACH,UAAU,GAAA;QACT,OAAO,IAAI,CAAC,OAAO;IACpB;AAEA;;;AAGG;IACH,iBAAiB,GAAA;AAChB,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe;IAC9B;AAEA;;;AAGG;IACH,OAAO,GAAA;QACN,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe;IAC9C;AAEA;;;AAGG;IACH,QAAQ,GAAA;QACP,MAAM,KAAK,GAAkB,EAAE;AAE/B,QAAA,IAAI,IAAI,CAAC,eAAe,EAAE;YACzB,KAAK,CAAC,IAAI,CAAC,CAAA,iBAAA,EAAoB,IAAI,CAAC,eAAe,CAAA,CAAE,CAAC;QACvD;AAEA,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AACjB,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACzB;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B;AACA;;;;"}
1
+ {"version":3,"file":"commit-body.value-object.js","sources":["../../../../../src/domain/value-object/commit-body.value-object.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;MACU,UAAU,CAAA;AACL,IAAA,eAAe;AAEf,IAAA,OAAO;AAEP,IAAA,MAAM;AAEvB,IAAA,WAAA,CAAY,OAAgB,EAAE,cAAuB,EAAE,MAAe,EAAA;QACrE,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,SAAS;QAC3C,IAAI,CAAC,eAAe,GAAG,cAAc,EAAE,IAAI,EAAE,IAAI,SAAS;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS;IAC1C;AAEA;;;;AAIG;AACH,IAAA,MAAM,CAAC,KAAiB,EAAA;QACvB,OAAO,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,eAAe,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;IACxH;AAEA;;;AAGG;IACH,iBAAiB,GAAA;QAChB,OAAO,IAAI,CAAC,eAAe;IAC5B;AAEA;;;AAGG;IACH,UAAU,GAAA;QACT,OAAO,IAAI,CAAC,OAAO;IACpB;AAEA;;;AAGG;IACH,SAAS,GAAA;QACR,OAAO,IAAI,CAAC,MAAM;IACnB;AAEA;;;AAGG;IACH,iBAAiB,GAAA;AAChB,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe;IAC9B;AAEA;;;AAGG;IACH,OAAO,GAAA;AACN,QAAA,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,MAAM;IAC9D;AAEA;;;AAGG;IACH,QAAQ,GAAA;QACP,MAAM,KAAK,GAAkB,EAAE;AAE/B,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AACjB,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACzB;AAEA,QAAA,IAAI,IAAI,CAAC,eAAe,EAAE;YACzB,KAAK,CAAC,IAAI,CAAC,CAAA,iBAAA,EAAoB,IAAI,CAAC,eAAe,CAAA,CAAE,CAAC;QACvD;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B;AACA;;;;"}
package/dist/esm/index.js CHANGED
@@ -2,6 +2,7 @@ import { createAppContainer } from './infrastructure/di/container.js';
2
2
  import { CommitizenAdapter } from './presentation/commitizen.adapter.js';
3
3
  import 'dotenv/config';
4
4
  export { ConfigureLLMUseCase } from './application/use-case/configure-llm.use-case.js';
5
+ export { EditCommitUseCase } from './application/use-case/edit-commit.use-case.js';
5
6
  export { GenerateCommitMessageUseCase } from './application/use-case/generate-commit-message.use-case.js';
6
7
  export { ManualCommitUseCase } from './application/use-case/manual-commit.use-case.js';
7
8
  export { ValidateCommitMessageUseCase } from './application/use-case/validate-commit-message.use-case.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA;AACA,kBAAkB,EAAE;AAEpB;AACA,MAAM,OAAO,GAAsB,IAAI,iBAAiB,EAAE;AAE1D;;;;;;;AAOG;AACI,eAAe,QAAQ,CAAC,gBAAyB,EAAE,MAAiC,EAAA;IAC1F,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;AAClD;AAEA;AACA,YAAe;IACd,QAAQ;CACR;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA;AACA,kBAAkB,EAAE;AAEpB;AACA,MAAM,OAAO,GAAsB,IAAI,iBAAiB,EAAE;AAE1D;;;;;;;AAOG;AACI,eAAe,QAAQ,CAAC,gBAAyB,EAAE,MAAiC,EAAA;IAC1F,OAAO,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;AAClD;AAEA;AACA,YAAe;IACd,QAAQ;CACR;;;;"}
@@ -10,6 +10,7 @@ export declare const GenerateCommitMessageUseCaseToken: symbol;
10
10
  export declare const ValidateCommitMessageUseCaseToken: symbol;
11
11
  export declare const ConfigureLLMUseCaseToken: symbol;
12
12
  export declare const ManualCommitUseCaseToken: symbol;
13
+ export declare const EditCommitUseCaseToken: symbol;
13
14
  /**
14
15
  * Create and configure the application DI container
15
16
  * @returns {IContainer} The configured DI container
@@ -1,5 +1,6 @@
1
1
  import { createContainer } from '@elsikora/cladi';
2
2
  import { ConfigureLLMUseCase } from '../../application/use-case/configure-llm.use-case.js';
3
+ import { EditCommitUseCase } from '../../application/use-case/edit-commit.use-case.js';
3
4
  import { GenerateCommitMessageUseCase } from '../../application/use-case/generate-commit-message.use-case.js';
4
5
  import { ManualCommitUseCase } from '../../application/use-case/manual-commit.use-case.js';
5
6
  import { ValidateCommitMessageUseCase } from '../../application/use-case/validate-commit-message.use-case.js';
@@ -9,6 +10,7 @@ import { AnthropicLlmService } from '../llm/anthropic-llm.service.js';
9
10
  import { AWSBedrockLlmService } from '../llm/aws-bedrock-llm.service.js';
10
11
  import { AzureOpenAILlmService } from '../llm/azure-openai-llm.service.js';
11
12
  import { GoogleLlmService } from '../llm/google-llm.service.js';
13
+ import { MockLlmService } from '../llm/mock-llm.service.js';
12
14
  import { OllamaLlmService } from '../llm/ollama-llm.service.js';
13
15
  import { OpenAILlmService } from '../llm/openai-llm.service.js';
14
16
  import { CosmicConfigService } from '../service/cosmic-config.service.js';
@@ -29,6 +31,7 @@ const GenerateCommitMessageUseCaseToken = Symbol("GenerateCommitMessageUseCase")
29
31
  const ValidateCommitMessageUseCaseToken = Symbol("ValidateCommitMessageUseCase");
30
32
  const ConfigureLLMUseCaseToken = Symbol("ConfigureLLMUseCase");
31
33
  const ManualCommitUseCaseToken = Symbol("ManualCommitUseCase");
34
+ const EditCommitUseCaseToken = Symbol("EditCommitUseCase");
32
35
  /**
33
36
  * Create and configure the application DI container
34
37
  * @returns {IContainer} The configured DI container
@@ -44,8 +47,8 @@ function createAppContainer() {
44
47
  container.register(CommandServiceToken, new NodeCommandService(cliInterface));
45
48
  const commandService = container.get(CommandServiceToken) ?? new NodeCommandService(cliInterface);
46
49
  container.register(CommitRepositoryToken, new GitCommitRepository(commandService));
47
- // Register LLM services
48
- const llmServices = [new OpenAILlmService(), new AnthropicLlmService(), new GoogleLlmService(), new AzureOpenAILlmService(), new AWSBedrockLlmService(), new OllamaLlmService()];
50
+ // Register LLM services - MockLlmService must be first to intercept when MOCK_LLM=true
51
+ const llmServices = [new MockLlmService(), new OpenAILlmService(), new AnthropicLlmService(), new GoogleLlmService(), new AzureOpenAILlmService(), new AWSBedrockLlmService(), new OllamaLlmService()];
49
52
  container.register(LLMServicesToken, llmServices);
50
53
  // Register commit validator with LLM services
51
54
  container.register(CommitValidatorToken, new CommitlintValidatorService(llmServices));
@@ -56,8 +59,9 @@ function createAppContainer() {
56
59
  container.register(GenerateCommitMessageUseCaseToken, new GenerateCommitMessageUseCase(llmServices));
57
60
  container.register(ValidateCommitMessageUseCaseToken, new ValidateCommitMessageUseCase(validator));
58
61
  container.register(ManualCommitUseCaseToken, new ManualCommitUseCase(cliInterface));
62
+ container.register(EditCommitUseCaseToken, new EditCommitUseCase(cliInterface, validator, llmServices));
59
63
  return container;
60
64
  }
61
65
 
62
- export { CliInterfaceServiceToken, CommandServiceToken, CommitRepositoryToken, CommitValidatorToken, ConfigServiceToken, ConfigureLLMUseCaseToken, FileSystemServiceToken, GenerateCommitMessageUseCaseToken, LLMServicesToken, ManualCommitUseCaseToken, ValidateCommitMessageUseCaseToken, createAppContainer };
66
+ export { CliInterfaceServiceToken, CommandServiceToken, CommitRepositoryToken, CommitValidatorToken, ConfigServiceToken, ConfigureLLMUseCaseToken, EditCommitUseCaseToken, FileSystemServiceToken, GenerateCommitMessageUseCaseToken, LLMServicesToken, ManualCommitUseCaseToken, ValidateCommitMessageUseCaseToken, createAppContainer };
63
67
  //# sourceMappingURL=container.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sources":["../../../../../src/infrastructure/di/container.ts"],"sourcesContent":[null],"names":["ConfigureLLMUseCaseImpl","GenerateCommitMessageUseCaseImpl","ValidateCommitMessageUseCaseImpl","ManualCommitUseCaseImpl"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA;MACa,sBAAsB,GAAW,MAAM,CAAC,mBAAmB;MAC3D,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;MAC/D,mBAAmB,GAAW,MAAM,CAAC,gBAAgB;MACrD,kBAAkB,GAAW,MAAM,CAAC,eAAe;MACnD,oBAAoB,GAAW,MAAM,CAAC,iBAAiB;MACvD,qBAAqB,GAAW,MAAM,CAAC,kBAAkB;MACzD,gBAAgB,GAAW,MAAM,CAAC,aAAa;AAE5D;MACa,iCAAiC,GAAW,MAAM,CAAC,8BAA8B;MACjF,iCAAiC,GAAW,MAAM,CAAC,8BAA8B;MACjF,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;MAC/D,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;AAE5E;;;AAGG;SACa,kBAAkB,GAAA;AACjC,IAAA,MAAM,SAAS,GAAe,eAAe,CAAC,EAAE,CAAC;;IAGjD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,IAAI,qBAAqB,EAAE,CAAC;IACvE,SA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AAwB,EAAE,IAAIA,mBAAuB,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IACtG,SAAS,CAAC,QAAQ,CAAC,iCAAiC,EAAE,IAAIC,4BAAgC,CAAC,WAAW,CAAC,CAAC;IACxG,SAAS,CAAC,QAAQ,CAAC,iCAAiC,EAAE,IAAIC,4BAAgC,CAAC,SAAS,CAAC,CAAC;IACtG,SAAS,CAAC,QAAQ,CAAC,wBAAwB,EAAE,IAAIC,mBAAuB,CAAC,YAAY,CAAC,CAAC;AAEvF,IAAA,OAAO,SAAS;AACjB;;;;"}
1
+ {"version":3,"file":"container.js","sources":["../../../../../src/infrastructure/di/container.ts"],"sourcesContent":[null],"names":["ConfigureLLMUseCaseImpl","GenerateCommitMessageUseCaseImpl","ValidateCommitMessageUseCaseImpl","ManualCommitUseCaseImpl","EditCommitUseCaseImpl"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA;MACa,sBAAsB,GAAW,MAAM,CAAC,mBAAmB;MAC3D,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;MAC/D,mBAAmB,GAAW,MAAM,CAAC,gBAAgB;MACrD,kBAAkB,GAAW,MAAM,CAAC,eAAe;MACnD,oBAAoB,GAAW,MAAM,CAAC,iBAAiB;MACvD,qBAAqB,GAAW,MAAM,CAAC,kBAAkB;MACzD,gBAAgB,GAAW,MAAM,CAAC,aAAa;AAE5D;MACa,iCAAiC,GAAW,MAAM,CAAC,8BAA8B;MACjF,iCAAiC,GAAW,MAAM,CAAC,8BAA8B;MACjF,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;MAC/D,wBAAwB,GAAW,MAAM,CAAC,qBAAqB;MAC/D,sBAAsB,GAAW,MAAM,CAAC,mBAAmB;AAExE;;;AAGG;SACa,kBAAkB,GAAA;AACjC,IAAA,MAAM,SAAS,GAAe,eAAe,CAAC,EAAE,CAAC;;IAGjD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,IAAI,qBAAqB,EAAE,CAAC;IACvE,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