Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions out/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18755,10 +18755,11 @@ var configValidators = {
"gpt-3.5-turbo-0125",
"gpt-4",
"gpt-4-1106-preview",
"gpt-4-turbo-preview",
"gpt-4-0125-preview"
"gpt-4-0125-preview",
"gpt-4-turbo",
"gpt-4-turbo-preview"
].includes(value),
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'`
`${value} is not supported yet, use 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-0125-preview' or 'gpt-4-turbo-preview'`
);
return value;
},
Expand All @@ -18778,6 +18779,14 @@ var configValidators = {
);
return value;
},
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
validateConfig(
"OCO_GITPUSH" /* OCO_GITPUSH */,
typeof value === "boolean",
"Must be true or false"
);
return value;
},
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
validateConfig(
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
Expand Down Expand Up @@ -18814,6 +18823,7 @@ var getConfig = () => {
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
};
const configExists = (0, import_fs.existsSync)(configPath);
Expand All @@ -18822,7 +18832,7 @@ var getConfig = () => {
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
const config8 = (0, import_ini.parse)(configFile);
for (const configKey of Object.keys(config8)) {
if (!config8[configKey] || ["null", "undefined"].includes(config8[configKey])) {
if (["null", "undefined"].includes(config8[configKey])) {
config8[configKey] = void 0;
continue;
}
Expand Down Expand Up @@ -22472,13 +22482,15 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
ce(`${source_default.green("\u2714")} Successfully committed`);
ce(stdout);
const remotes = await getGitRemotes();
if (config7?.OCO_GITPUSH === false)
return;
if (!remotes.length) {
const { stdout: stdout2 } = await execa("git", ["push"]);
if (stdout2)
ce(stdout2);
process.exit(0);
}
if (remotes.length === 1) {
if (remotes.length === 1 && config7?.OCO_GITPUSH !== true) {
const isPushConfirmedByUser = await Q3({
message: "Do you want to run `git push`?"
});
Expand Down
18 changes: 14 additions & 4 deletions out/github-action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24244,10 +24244,11 @@ var configValidators = {
"gpt-3.5-turbo-0125",
"gpt-4",
"gpt-4-1106-preview",
"gpt-4-turbo-preview",
"gpt-4-0125-preview"
"gpt-4-0125-preview",
"gpt-4-turbo",
"gpt-4-turbo-preview"
].includes(value),
`${value} is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'`
`${value} is not supported yet, use 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-0125-preview' or 'gpt-4-turbo-preview'`
);
return value;
},
Expand All @@ -24267,6 +24268,14 @@ var configValidators = {
);
return value;
},
["OCO_GITPUSH" /* OCO_GITPUSH */](value) {
validateConfig(
"OCO_GITPUSH" /* OCO_GITPUSH */,
typeof value === "boolean",
"Must be true or false"
);
return value;
},
["OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */](value) {
validateConfig(
"OCO_AI_PROVIDER" /* OCO_AI_PROVIDER */,
Expand Down Expand Up @@ -24303,6 +24312,7 @@ var getConfig = () => {
OCO_MESSAGE_TEMPLATE_PLACEHOLDER: process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || "$msg",
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || "conventional-commit",
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || "openai",
OCO_GITPUSH: process.env.OCO_GITPUSH === "false" ? false : true,
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === "true" ? true : false
};
const configExists = (0, import_fs.existsSync)(configPath);
Expand All @@ -24311,7 +24321,7 @@ var getConfig = () => {
const configFile = (0, import_fs.readFileSync)(configPath, "utf8");
const config7 = (0, import_ini.parse)(configFile);
for (const configKey of Object.keys(config7)) {
if (!config7[configKey] || ["null", "undefined"].includes(config7[configKey])) {
if (["null", "undefined"].includes(config7[configKey])) {
config7[configKey] = void 0;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/oneFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ it('cli flow to generate commit message for 1 new file (staged)', async () => {
expect(await findByText('Confirm the commit message?')).toBeInTheConsole();
userEvent.keyboard('[Enter]');

expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
userEvent.keyboard('[Enter]');

expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
Expand Down Expand Up @@ -47,7 +47,7 @@ it('cli flow to generate commit message for 1 changed file (not staged)', async

expect(await findByText('Successfully committed')).toBeInTheConsole();

expect(await findByText('Do you want to run `git push`?')).toBeInTheConsole();
expect(await findByText('Choose a remote to push to')).toBeInTheConsole();
userEvent.keyboard('[Enter]');

expect(await findByText('Successfully pushed all commits to origin')).toBeInTheConsole();
Expand Down