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/plus/ai/prompts.ts
+4-62Lines changed: 4 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -339,66 +339,8 @@ Example output structure:
339
339
Based on the provided commit messages and associated issues, create a set of markdown changelog entries following the instructions above. Do not include any explanatory text or metadata`,
template: `You are an advanced AI programming assistant tasked with organizing code changes into commits. Your goal is to create a new set of commits that are related, grouped logically, atomic, and easy to review. You will be working with code changes provided in a unified diff format.
346
-
347
-
First, examine the following unified Git diff of code changes:
348
-
349
-
<unified_diff>
350
-
\${diff}
351
-
</unified_diff>
352
-
353
-
Next, examine the following JSON array which represents a mapping of index to hunk headers in the unified_diff to be used later when mapping hunks to commits:
354
-
<hunk_map>
355
-
\${data}
356
-
</hunk_map>
357
-
358
-
359
-
Your task is to group the hunks in unified_diff into a set of commits, ordered into a commit history as an array. Follow these guidelines:
360
-
361
-
1. Only organize the hunks themselves, not individual lines within hunks.
362
-
2. Group hunks into logical units that make sense together and can be applied atomically.
363
-
3. Ensure each commit is self-contained and only depends on commits that come before it in the new history.
364
-
4. Write meaningful commit messages that accurately describe the changes in each commit.
365
-
5. Provide a detailed explanation of the changes in each commit.
366
-
6. Make sure the new commit history is easy to review and understand.
367
-
368
-
Output your new commit history as a JSON array. Each commit in the array should be an object representing a grouping of hunks forming that commit, with the following properties:
369
-
- "message": A string containing the commit message.
370
-
- "explanation": A string with a detailed explanation of the changes in the commit. Write the explanation as if you were explaining the changes to a reviewer who is familiar with the codebase but not the specific changes. Walk through the changes and make references to specific changes where needed, explaining how they achieve the objective of the commit.
371
-
- "hunks": An array of objects, each representing a hunk in the commit. Each hunk object should have:
372
-
- "hunk": The hunk index (number) from the hunk_map, matching the equivalent hunk you chose from the unified_diff.
373
-
374
-
Once you've completed your analysis, generate the JSON output following the specified format.
375
-
376
-
Here's an example of the expected JSON structure (note that this is just a structural example and does not reflect the actual content you should produce):
377
-
378
-
[
379
-
{
380
-
"message": "Example commit message",
381
-
"explanation": "Detailed explanation of the changes in this commit",
382
-
"hunks": [
383
-
{
384
-
"hunk": 2
385
-
},
386
-
{
387
-
"hunk": 7
388
-
}
389
-
]
390
-
}
391
-
]
392
-
393
-
Remember to base your organization of commits solely on the provided unified_diff and hunk_map. Do not introduce any new changes or modify the content of the hunks. Your task is to organize the existing hunks in a logical and reviewable manner.
394
-
395
-
\${instructions}
396
-
397
-
Now, proceed with your analysis and organization of the commits. Output only the JSON array containing the commits, and nothing else.`,
template: `You are an advanced AI programming assistant tasked with explaining code changes and how they would be best organized into commits. Your goal is to examine a unified diff of the code changes and explain the changes and how they should be grouped into a set of commits.
404
346
@@ -424,8 +366,8 @@ Remember to base your organization of commits solely on the provided unified_dif
424
366
Now, proceed with your analysis and explanation. Output only the explanation you have generated, and nothing else.`,
template: `Using the plan you provided in the previous step, your goal now is use it to create that new set of commits, ensuring that ALL the changes in the unified diff are included in the new set of commits.
0 commit comments