gut-cli 0.1.20 → 0.1.21
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/.gut/commit.md +0 -4
- package/.gut/pr.md +0 -10
- package/.gut/review.md +0 -7
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/index.js +19 -8
- package/dist/lib/index.js.map +1 -1
- package/package.json +1 -1
package/.gut/commit.md
CHANGED
|
@@ -10,7 +10,3 @@ Analyze the git diff and generate a concise, meaningful commit message.
|
|
|
10
10
|
- Description should be lowercase, imperative mood, no period at end
|
|
11
11
|
- Keep the first line under 72 characters
|
|
12
12
|
- If changes are complex, add a blank line and bullet points for details
|
|
13
|
-
|
|
14
|
-
## Output
|
|
15
|
-
|
|
16
|
-
Respond with ONLY the commit message, nothing else.
|
package/.gut/pr.md
CHANGED
|
@@ -12,13 +12,3 @@ Generate a clear and informative PR title and description based on the branch in
|
|
|
12
12
|
- ## Summary section with 2-3 bullet points
|
|
13
13
|
- ## Changes section listing key modifications
|
|
14
14
|
- ## Test Plan section (suggest what to test)
|
|
15
|
-
|
|
16
|
-
## Output
|
|
17
|
-
|
|
18
|
-
Respond in JSON format:
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"title": "...",
|
|
22
|
-
"body": "..."
|
|
23
|
-
}
|
|
24
|
-
```
|
package/.gut/review.md
CHANGED
|
@@ -8,11 +8,4 @@ You are an expert code reviewer. Analyze the git diff and provide a structured r
|
|
|
8
8
|
- Code style and best practices
|
|
9
9
|
- Suggestions for improvement
|
|
10
10
|
|
|
11
|
-
## Output
|
|
12
|
-
|
|
13
11
|
Be constructive and specific. Include line numbers when possible.
|
|
14
|
-
|
|
15
|
-
Respond with a JSON object containing:
|
|
16
|
-
- summary: Brief overall assessment
|
|
17
|
-
- issues: Array of { severity: "critical"|"warning"|"suggestion", file, line?, message, suggestion? }
|
|
18
|
-
- positives: Array of good practices observed
|
package/dist/index.js
CHANGED
|
@@ -334,7 +334,7 @@ function findTemplate(repoRoot, templateName) {
|
|
|
334
334
|
}
|
|
335
335
|
return null;
|
|
336
336
|
}
|
|
337
|
-
function buildPrompt(userTemplate, templateName, context, language) {
|
|
337
|
+
function buildPrompt(userTemplate, templateName, context, language, outputFormat) {
|
|
338
338
|
let contextXml = "<context>\n";
|
|
339
339
|
for (const [key, value] of Object.entries(context)) {
|
|
340
340
|
if (value) {
|
|
@@ -347,7 +347,12 @@ ${value}
|
|
|
347
347
|
contextXml += "</context>\n\n";
|
|
348
348
|
const template = userTemplate || loadTemplate(templateName);
|
|
349
349
|
const langInstruction = language === "ja" ? "\n\nIMPORTANT: Respond in Japanese (\u65E5\u672C\u8A9E\u3067\u56DE\u7B54\u3057\u3066\u304F\u3060\u3055\u3044)." : "";
|
|
350
|
-
|
|
350
|
+
const outputSection = outputFormat ? `
|
|
351
|
+
|
|
352
|
+
<output-format>
|
|
353
|
+
${outputFormat}
|
|
354
|
+
</output-format>` : "";
|
|
355
|
+
return contextXml + "<instructions>\n" + template + langInstruction + "\n</instructions>" + outputSection;
|
|
351
356
|
}
|
|
352
357
|
var DEFAULT_MODELS = {
|
|
353
358
|
gemini: "gemini-2.0-flash",
|
|
@@ -397,7 +402,7 @@ async function generateCommitMessage(diff, options, template) {
|
|
|
397
402
|
const model = await getModel(options);
|
|
398
403
|
const prompt = buildPrompt(template, "commit", {
|
|
399
404
|
diff: diff.slice(0, 8e3)
|
|
400
|
-
}, options.language);
|
|
405
|
+
}, options.language, "Respond with ONLY the commit message, nothing else.");
|
|
401
406
|
const result = await generateText({
|
|
402
407
|
model,
|
|
403
408
|
prompt,
|
|
@@ -412,7 +417,13 @@ async function generatePRDescription(context, options, template) {
|
|
|
412
417
|
currentBranch: context.currentBranch,
|
|
413
418
|
commits: context.commits.map((c) => `- ${c}`).join("\n"),
|
|
414
419
|
diff: context.diff.slice(0, 6e3)
|
|
415
|
-
}, options.language
|
|
420
|
+
}, options.language, `Respond in JSON format:
|
|
421
|
+
\`\`\`json
|
|
422
|
+
{
|
|
423
|
+
"title": "...",
|
|
424
|
+
"body": "..."
|
|
425
|
+
}
|
|
426
|
+
\`\`\``);
|
|
416
427
|
const result = await generateText({
|
|
417
428
|
model,
|
|
418
429
|
prompt,
|
|
@@ -599,7 +610,7 @@ async function generateBranchName(description, options, context, template) {
|
|
|
599
610
|
description,
|
|
600
611
|
type: context?.type,
|
|
601
612
|
issue: context?.issue
|
|
602
|
-
}, options.language);
|
|
613
|
+
}, options.language, "Respond with ONLY the branch name, nothing else.");
|
|
603
614
|
const result = await generateText({
|
|
604
615
|
model,
|
|
605
616
|
prompt,
|
|
@@ -611,7 +622,7 @@ async function generateBranchNameFromDiff(diff, options, template) {
|
|
|
611
622
|
const model = await getModel(options);
|
|
612
623
|
const prompt = buildPrompt(template, "checkout", {
|
|
613
624
|
diff: diff.slice(0, 8e3)
|
|
614
|
-
}, options.language);
|
|
625
|
+
}, options.language, "Respond with ONLY the branch name, nothing else.");
|
|
615
626
|
const result = await generateText({
|
|
616
627
|
model,
|
|
617
628
|
prompt,
|
|
@@ -623,7 +634,7 @@ async function generateStashName(diff, options, template) {
|
|
|
623
634
|
const model = await getModel(options);
|
|
624
635
|
const prompt = buildPrompt(template, "stash", {
|
|
625
636
|
diff: diff.slice(0, 4e3)
|
|
626
|
-
}, options.language);
|
|
637
|
+
}, options.language, "Respond with ONLY the stash name, nothing else.");
|
|
627
638
|
const result = await generateText({
|
|
628
639
|
model,
|
|
629
640
|
prompt,
|
|
@@ -694,7 +705,7 @@ async function generateGitignore(context, options, template) {
|
|
|
694
705
|
files: context.files,
|
|
695
706
|
configFiles: context.configFiles,
|
|
696
707
|
existingGitignore: context.existingGitignore
|
|
697
|
-
}, options.language);
|
|
708
|
+
}, options.language, "Respond with ONLY the .gitignore content, nothing else. No explanations or markdown code blocks.");
|
|
698
709
|
const result = await generateText({
|
|
699
710
|
model,
|
|
700
711
|
prompt,
|