You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/helpers/ai.js
+24-18Lines changed: 24 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -228,42 +228,48 @@ async function generateCommitSuggestions(
228
228
instructionText=`\nIMPORTANT USER INSTRUCTION: ${activeInstruction}\n`;
229
229
}
230
230
231
-
constprompt=`You are a Git commit message generator. Based on the following changes${activeInstruction ? " and the user instruction" : ""}, suggest ${count} different commit messages. Each should be in Conventional Commits format.
231
+
constprompt=`You are a Git commit message generator. Based on the following changes${activeInstruction ? " and the user instruction" : ""}, suggest ${count} different commit messages. Each MUST follow Conventional Commits format with a detailed body.
232
232
${instructionText}
233
233
Changed files:
234
234
${filesList.join("\n")}
235
235
236
236
Diff:
237
237
${diff.substring(0,3000)}
238
238
239
-
For each suggestion, write:
240
-
1. **Subject line**: Type, scope (optional), and brief description. Max 50 characters. Use imperative mood.
241
-
2. **Blank line**
242
-
3. **Body**: Explain WHAT changed and WHY. Wrap at 72 characters. Use bullet points for multiple changes.
239
+
CRITICAL FORMAT REQUIREMENTS:
240
+
Each suggestion MUST have:
241
+
1. Subject line (max 50 chars): type(scope): brief description
242
+
2. Empty line
243
+
3. Body section with 2-4 bullet points explaining WHAT changed and WHY
243
244
244
-
Separate each suggestion with "---" on its own line.
245
+
EXAMPLE 1:
246
+
feat(auth): add JWT token validation
245
247
246
-
Example format:
247
-
feat: add user authentication
248
+
- Implement token verification middleware
249
+
- Add refresh token rotation for security
250
+
- Store tokens in httpOnly cookies
248
251
249
-
- Implement JWT token validation
250
-
- Add login endpoint with rate limiting
251
-
- Store refresh tokens securely
252
+
EXAMPLE 2:
253
+
fix(ui): resolve dark mode contrast issues
252
254
253
-
---
255
+
- Update color palette for better accessibility
256
+
- Add CSS variables for theme switching
257
+
- Test with WCAG 2.1 AA standards
254
258
255
-
fix: resolve memory leak in cache
259
+
EXAMPLE 3:
260
+
refactor(api): optimize database queries
256
261
257
-
- Clear expired entries every 5 minutes
258
-
- Use WeakMap for object references
262
+
- Add indexes for frequently queried fields
263
+
- Implement query caching with Redis
264
+
- Reduce response time by 40%
259
265
260
-
Write exactly ${count} suggestions, no other explanations.`;
266
+
Write exactly ${count} suggestions following this format. Separate each with "---" on its own line. Do NOT write single-line messages.`;
261
267
262
268
constmessages=[
263
269
{
264
270
role: "system",
265
271
content:
266
-
"You are a helpful assistant that generates professional Git commit messages. Always include a subject line and a detailed body explaining the changes.",
272
+
"You are a professional Git commit message writer. ALWAYS generate multi-line messages with a subject and detailed body. Never write single-line commits.",
267
273
},
268
274
{
269
275
role: "user",
@@ -276,7 +282,7 @@ Write exactly ${count} suggestions, no other explanations.`;
0 commit comments