gut-cli 0.1.23 → 0.1.24
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/dist/index.js +9 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +9 -20
- package/dist/lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -479,6 +479,10 @@ async function generateCommitMessage(diff, options, template) {
|
|
|
479
479
|
});
|
|
480
480
|
return result.text.trim();
|
|
481
481
|
}
|
|
482
|
+
var PRDescriptionSchema = z.object({
|
|
483
|
+
title: z.string().describe("Concise PR title (50-72 chars)"),
|
|
484
|
+
body: z.string().describe("PR description in markdown format")
|
|
485
|
+
});
|
|
482
486
|
async function generatePRDescription(context, options, template) {
|
|
483
487
|
const model = await getModel(options);
|
|
484
488
|
const prompt = buildPrompt(
|
|
@@ -490,29 +494,14 @@ async function generatePRDescription(context, options, template) {
|
|
|
490
494
|
commits: context.commits.map((c) => `- ${c}`).join("\n"),
|
|
491
495
|
diff: context.diff.slice(0, 6e3)
|
|
492
496
|
},
|
|
493
|
-
options.language
|
|
494
|
-
`Respond in JSON format:
|
|
495
|
-
\`\`\`json
|
|
496
|
-
{
|
|
497
|
-
"title": "...",
|
|
498
|
-
"body": "..."
|
|
499
|
-
}
|
|
500
|
-
\`\`\``
|
|
497
|
+
options.language
|
|
501
498
|
);
|
|
502
|
-
const result = await
|
|
499
|
+
const result = await generateObject({
|
|
503
500
|
model,
|
|
504
|
-
|
|
505
|
-
|
|
501
|
+
schema: PRDescriptionSchema,
|
|
502
|
+
prompt
|
|
506
503
|
});
|
|
507
|
-
|
|
508
|
-
const cleaned = result.text.replace(/```json\n?|\n?```/g, "").trim();
|
|
509
|
-
return JSON.parse(cleaned);
|
|
510
|
-
} catch {
|
|
511
|
-
return {
|
|
512
|
-
title: context.currentBranch.replace(/[-_]/g, " "),
|
|
513
|
-
body: result.text
|
|
514
|
-
};
|
|
515
|
-
}
|
|
504
|
+
return result.object;
|
|
516
505
|
}
|
|
517
506
|
var CodeReviewSchema = z.object({
|
|
518
507
|
summary: z.string().describe("Brief overall assessment"),
|