git-coco 0.15.1 → 0.16.0
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.d.ts +8 -0
- package/dist/index.esm.mjs +35 -9
- package/dist/index.js +35 -9
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -140,6 +140,13 @@ type BaseConfig = {
|
|
|
140
140
|
* @default 'main'
|
|
141
141
|
*/
|
|
142
142
|
defaultBranch: string;
|
|
143
|
+
/**
|
|
144
|
+
* Whether to include the current branch name in the commit prompt for context.
|
|
145
|
+
* When enabled, the current git branch name will be included in the prompt.
|
|
146
|
+
*
|
|
147
|
+
* @default true
|
|
148
|
+
*/
|
|
149
|
+
includeBranchName?: boolean;
|
|
143
150
|
};
|
|
144
151
|
type ConfigWithServiceObject = BaseConfig & Partial<BaseCommandOptions> & {
|
|
145
152
|
service: LLMService;
|
|
@@ -177,6 +184,7 @@ interface CommitOptions extends BaseCommandOptions {
|
|
|
177
184
|
ignoredExtensions: string[];
|
|
178
185
|
withPreviousCommits: number;
|
|
179
186
|
conventional: boolean;
|
|
187
|
+
includeBranchName: boolean;
|
|
180
188
|
}
|
|
181
189
|
type CommitArgv = Arguments<CommitOptions>;
|
|
182
190
|
|
package/dist/index.esm.mjs
CHANGED
|
@@ -47,7 +47,7 @@ import { lint, load } from '@commitlint/core';
|
|
|
47
47
|
/**
|
|
48
48
|
* Current build version from package.json
|
|
49
49
|
*/
|
|
50
|
-
const BUILD_VERSION = "0.
|
|
50
|
+
const BUILD_VERSION = "0.16.0";
|
|
51
51
|
|
|
52
52
|
const isInteractive = (config) => {
|
|
53
53
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -610,6 +610,11 @@ const schema$1 = {
|
|
|
610
610
|
"type": "string",
|
|
611
611
|
"description": "Default git branch for the repository.",
|
|
612
612
|
"default": "main"
|
|
613
|
+
},
|
|
614
|
+
"includeBranchName": {
|
|
615
|
+
"type": "boolean",
|
|
616
|
+
"description": "Whether to include the current branch name in the commit prompt for context. When enabled, the current git branch name will be included in the prompt.",
|
|
617
|
+
"default": true
|
|
613
618
|
}
|
|
614
619
|
},
|
|
615
620
|
"required": [
|
|
@@ -6534,6 +6539,7 @@ const getRepo = () => {
|
|
|
6534
6539
|
* - format_instructions: Instructions for the output format (JSON with title and body)
|
|
6535
6540
|
* - additional_context: Optional user-provided context to guide the commit message generation
|
|
6536
6541
|
* - commit_history: Optional history of previous commits for context
|
|
6542
|
+
* - branch_name_context: String containing formatted branch name (or empty if disabled)
|
|
6537
6543
|
*/
|
|
6538
6544
|
const template$4 = `Write informative git commit message, in the imperative, based on the diffs & file changes provided in the "Diff Summary" section.
|
|
6539
6545
|
Commit Messages must have a short description that is less than 50 characters and a longer detailed summary around 300 characters, the shorter and more concise the better.
|
|
@@ -6550,6 +6556,8 @@ Please follow the guidelines below when writing your commit message:
|
|
|
6550
6556
|
{{summary}}
|
|
6551
6557
|
""""""
|
|
6552
6558
|
|
|
6559
|
+
{{branch_name_context}}
|
|
6560
|
+
|
|
6553
6561
|
{{format_instructions}}
|
|
6554
6562
|
|
|
6555
6563
|
{{commit_history}}
|
|
@@ -6557,7 +6565,7 @@ Please follow the guidelines below when writing your commit message:
|
|
|
6557
6565
|
{{additional_context}}
|
|
6558
6566
|
`;
|
|
6559
6567
|
// Define the variables that will be passed to the prompt template
|
|
6560
|
-
const inputVariables$3 = ['summary', 'format_instructions', 'additional_context', 'commit_history'];
|
|
6568
|
+
const inputVariables$3 = ['summary', 'format_instructions', 'additional_context', 'commit_history', 'branch_name_context'];
|
|
6561
6569
|
const COMMIT_PROMPT = new PromptTemplate({
|
|
6562
6570
|
template: template$4,
|
|
6563
6571
|
inputVariables: inputVariables$3,
|
|
@@ -6597,6 +6605,8 @@ Based on the following diff summary, generate a conventional commit message that
|
|
|
6597
6605
|
{{summary}}
|
|
6598
6606
|
""""""
|
|
6599
6607
|
|
|
6608
|
+
{{branch_name_context}}
|
|
6609
|
+
|
|
6600
6610
|
{{format_instructions}}
|
|
6601
6611
|
|
|
6602
6612
|
{{commit_history}}
|
|
@@ -6613,6 +6623,7 @@ const conventionalInputVariables = [
|
|
|
6613
6623
|
'additional_context',
|
|
6614
6624
|
'commit_history',
|
|
6615
6625
|
'format_instructions',
|
|
6626
|
+
'branch_name_context',
|
|
6616
6627
|
];
|
|
6617
6628
|
const CONVENTIONAL_COMMIT_PROMPT = new PromptTemplate({
|
|
6618
6629
|
template: CONVENTIONAL_TEMPLATE,
|
|
@@ -7029,6 +7040,11 @@ const options$3 = {
|
|
|
7029
7040
|
default: false,
|
|
7030
7041
|
alias: 'c',
|
|
7031
7042
|
},
|
|
7043
|
+
includeBranchName: {
|
|
7044
|
+
description: 'Include the current branch name in the commit prompt for context',
|
|
7045
|
+
type: 'boolean',
|
|
7046
|
+
default: true,
|
|
7047
|
+
},
|
|
7032
7048
|
};
|
|
7033
7049
|
const builder$3 = (yargs) => {
|
|
7034
7050
|
return yargs.options(options$3).usage(getCommandUsageHeader(command$3));
|
|
@@ -10951,22 +10967,32 @@ const handler$3 = async (argv, logger) => {
|
|
|
10951
10967
|
commit_history = `## Commit History\n${commitHistoryData}`;
|
|
10952
10968
|
}
|
|
10953
10969
|
}
|
|
10970
|
+
// Get current branch name - we need this for ticket extraction regardless of prompt inclusion
|
|
10971
|
+
const branchName = await getCurrentBranchName({ git });
|
|
10972
|
+
// Check if branch name should be included in the prompt context
|
|
10973
|
+
const includeBranchName = argv.includeBranchName !== undefined
|
|
10974
|
+
? argv.includeBranchName
|
|
10975
|
+
: config.includeBranchName !== false; // Default to true if not explicitly set to false
|
|
10976
|
+
// Create branch name context string based on the configuration
|
|
10977
|
+
const branchNameContext = includeBranchName ? `Current git branch name: ${branchName}` : '';
|
|
10978
|
+
// Get variables for the prompt
|
|
10979
|
+
const variables = {
|
|
10980
|
+
summary: context,
|
|
10981
|
+
format_instructions: formatInstructions,
|
|
10982
|
+
additional_context: additional_context,
|
|
10983
|
+
commit_history: commit_history,
|
|
10984
|
+
branch_name_context: branchNameContext,
|
|
10985
|
+
};
|
|
10954
10986
|
console.log('context', context);
|
|
10955
10987
|
console.log('prompt', prompt);
|
|
10956
10988
|
const commitMsg = await executeChain({
|
|
10957
10989
|
llm,
|
|
10958
10990
|
prompt,
|
|
10959
|
-
variables
|
|
10960
|
-
summary: context,
|
|
10961
|
-
format_instructions: formatInstructions,
|
|
10962
|
-
additional_context: additional_context,
|
|
10963
|
-
commit_history: commit_history,
|
|
10964
|
-
},
|
|
10991
|
+
variables,
|
|
10965
10992
|
parser,
|
|
10966
10993
|
});
|
|
10967
10994
|
// Construct the full commit message
|
|
10968
10995
|
const appendedText = argv.append ? `\n\n${argv.append}` : '';
|
|
10969
|
-
const branchName = await getCurrentBranchName({ git });
|
|
10970
10996
|
const ticketId = extractTicketIdFromBranchName(branchName);
|
|
10971
10997
|
const ticketFooter = argv.appendTicket && ticketId ? `\n\nPart of **${ticketId}**` : '';
|
|
10972
10998
|
const fullMessage = `${commitMsg.title}\n\n${commitMsg.body}${appendedText}${ticketFooter}`;
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline$1);
|
|
|
69
69
|
/**
|
|
70
70
|
* Current build version from package.json
|
|
71
71
|
*/
|
|
72
|
-
const BUILD_VERSION = "0.
|
|
72
|
+
const BUILD_VERSION = "0.16.0";
|
|
73
73
|
|
|
74
74
|
const isInteractive = (config) => {
|
|
75
75
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -632,6 +632,11 @@ const schema$1 = {
|
|
|
632
632
|
"type": "string",
|
|
633
633
|
"description": "Default git branch for the repository.",
|
|
634
634
|
"default": "main"
|
|
635
|
+
},
|
|
636
|
+
"includeBranchName": {
|
|
637
|
+
"type": "boolean",
|
|
638
|
+
"description": "Whether to include the current branch name in the commit prompt for context. When enabled, the current git branch name will be included in the prompt.",
|
|
639
|
+
"default": true
|
|
635
640
|
}
|
|
636
641
|
},
|
|
637
642
|
"required": [
|
|
@@ -6556,6 +6561,7 @@ const getRepo = () => {
|
|
|
6556
6561
|
* - format_instructions: Instructions for the output format (JSON with title and body)
|
|
6557
6562
|
* - additional_context: Optional user-provided context to guide the commit message generation
|
|
6558
6563
|
* - commit_history: Optional history of previous commits for context
|
|
6564
|
+
* - branch_name_context: String containing formatted branch name (or empty if disabled)
|
|
6559
6565
|
*/
|
|
6560
6566
|
const template$4 = `Write informative git commit message, in the imperative, based on the diffs & file changes provided in the "Diff Summary" section.
|
|
6561
6567
|
Commit Messages must have a short description that is less than 50 characters and a longer detailed summary around 300 characters, the shorter and more concise the better.
|
|
@@ -6572,6 +6578,8 @@ Please follow the guidelines below when writing your commit message:
|
|
|
6572
6578
|
{{summary}}
|
|
6573
6579
|
""""""
|
|
6574
6580
|
|
|
6581
|
+
{{branch_name_context}}
|
|
6582
|
+
|
|
6575
6583
|
{{format_instructions}}
|
|
6576
6584
|
|
|
6577
6585
|
{{commit_history}}
|
|
@@ -6579,7 +6587,7 @@ Please follow the guidelines below when writing your commit message:
|
|
|
6579
6587
|
{{additional_context}}
|
|
6580
6588
|
`;
|
|
6581
6589
|
// Define the variables that will be passed to the prompt template
|
|
6582
|
-
const inputVariables$3 = ['summary', 'format_instructions', 'additional_context', 'commit_history'];
|
|
6590
|
+
const inputVariables$3 = ['summary', 'format_instructions', 'additional_context', 'commit_history', 'branch_name_context'];
|
|
6583
6591
|
const COMMIT_PROMPT = new prompts$1.PromptTemplate({
|
|
6584
6592
|
template: template$4,
|
|
6585
6593
|
inputVariables: inputVariables$3,
|
|
@@ -6619,6 +6627,8 @@ Based on the following diff summary, generate a conventional commit message that
|
|
|
6619
6627
|
{{summary}}
|
|
6620
6628
|
""""""
|
|
6621
6629
|
|
|
6630
|
+
{{branch_name_context}}
|
|
6631
|
+
|
|
6622
6632
|
{{format_instructions}}
|
|
6623
6633
|
|
|
6624
6634
|
{{commit_history}}
|
|
@@ -6635,6 +6645,7 @@ const conventionalInputVariables = [
|
|
|
6635
6645
|
'additional_context',
|
|
6636
6646
|
'commit_history',
|
|
6637
6647
|
'format_instructions',
|
|
6648
|
+
'branch_name_context',
|
|
6638
6649
|
];
|
|
6639
6650
|
const CONVENTIONAL_COMMIT_PROMPT = new prompts$1.PromptTemplate({
|
|
6640
6651
|
template: CONVENTIONAL_TEMPLATE,
|
|
@@ -7051,6 +7062,11 @@ const options$3 = {
|
|
|
7051
7062
|
default: false,
|
|
7052
7063
|
alias: 'c',
|
|
7053
7064
|
},
|
|
7065
|
+
includeBranchName: {
|
|
7066
|
+
description: 'Include the current branch name in the commit prompt for context',
|
|
7067
|
+
type: 'boolean',
|
|
7068
|
+
default: true,
|
|
7069
|
+
},
|
|
7054
7070
|
};
|
|
7055
7071
|
const builder$3 = (yargs) => {
|
|
7056
7072
|
return yargs.options(options$3).usage(getCommandUsageHeader(command$3));
|
|
@@ -10973,22 +10989,32 @@ const handler$3 = async (argv, logger) => {
|
|
|
10973
10989
|
commit_history = `## Commit History\n${commitHistoryData}`;
|
|
10974
10990
|
}
|
|
10975
10991
|
}
|
|
10992
|
+
// Get current branch name - we need this for ticket extraction regardless of prompt inclusion
|
|
10993
|
+
const branchName = await getCurrentBranchName({ git });
|
|
10994
|
+
// Check if branch name should be included in the prompt context
|
|
10995
|
+
const includeBranchName = argv.includeBranchName !== undefined
|
|
10996
|
+
? argv.includeBranchName
|
|
10997
|
+
: config.includeBranchName !== false; // Default to true if not explicitly set to false
|
|
10998
|
+
// Create branch name context string based on the configuration
|
|
10999
|
+
const branchNameContext = includeBranchName ? `Current git branch name: ${branchName}` : '';
|
|
11000
|
+
// Get variables for the prompt
|
|
11001
|
+
const variables = {
|
|
11002
|
+
summary: context,
|
|
11003
|
+
format_instructions: formatInstructions,
|
|
11004
|
+
additional_context: additional_context,
|
|
11005
|
+
commit_history: commit_history,
|
|
11006
|
+
branch_name_context: branchNameContext,
|
|
11007
|
+
};
|
|
10976
11008
|
console.log('context', context);
|
|
10977
11009
|
console.log('prompt', prompt);
|
|
10978
11010
|
const commitMsg = await executeChain({
|
|
10979
11011
|
llm,
|
|
10980
11012
|
prompt,
|
|
10981
|
-
variables
|
|
10982
|
-
summary: context,
|
|
10983
|
-
format_instructions: formatInstructions,
|
|
10984
|
-
additional_context: additional_context,
|
|
10985
|
-
commit_history: commit_history,
|
|
10986
|
-
},
|
|
11013
|
+
variables,
|
|
10987
11014
|
parser,
|
|
10988
11015
|
});
|
|
10989
11016
|
// Construct the full commit message
|
|
10990
11017
|
const appendedText = argv.append ? `\n\n${argv.append}` : '';
|
|
10991
|
-
const branchName = await getCurrentBranchName({ git });
|
|
10992
11018
|
const ticketId = extractTicketIdFromBranchName(branchName);
|
|
10993
11019
|
const ticketFooter = argv.appendTicket && ticketId ? `\n\nPart of **${ticketId}**` : '';
|
|
10994
11020
|
const fullMessage = `${commitMsg.title}\n\n${commitMsg.body}${appendedText}${ticketFooter}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-coco",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "zero-effort git commits with coco.",
|
|
5
5
|
"author": "gfargo <ghfargo@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@langchain/community": "^0.3.32",
|
|
94
94
|
"@langchain/core": "^0.3.40",
|
|
95
95
|
"@langchain/ollama": "^0.2.0",
|
|
96
|
-
"@langchain/openai": "^0.
|
|
96
|
+
"@langchain/openai": "^0.5.0",
|
|
97
97
|
"ajv": "^8.16.0",
|
|
98
98
|
"ajv-formats": "^3.0.1",
|
|
99
99
|
"chalk": "4.1.2",
|