di-sukharev / opencommit

Generate conventional git commit messages with AI in 1 second 🤯🔫
https://www.npmjs.com/package/opencommit
MIT License
5.98k stars 318 forks source link

Commits in VSCode #1

Closed alexllao closed 1 year ago

alexllao commented 1 year ago

Would it be possible to integrate it into VSCode? In this way, when making the commits from there, we would not have to go through the terminal.

di-sukharev commented 1 year ago

It's kinda possible :)

just run oc hook set and you can then click "Enter" key in the empty Source Control input and VSCode will open a file for editing the commit.

If VSCode doesn't open the commit editing window — you should probably turn on this setting:

Screenshot 2023-03-10 at 17 49 24
alexllao commented 1 year ago

Hi!!!

✖ Error: EPERM: operation not permitted, symlink 'C:\xxxxxxxxxxxxxxxxxxxxxxxx\node_modules\opencommit\out\cli.cjs' -> 'C:\Uxxxxxxxxxxxxxxxxxxxxxxx.git\hooks\prepare-commit-msg'

I've pre-commit with husky like this:

!/usr/bin/env sh

. "$(dirname -- "$0")/_/husky.sh" npx pretty-quick --staged npx --no-install lint-staged

di-sukharev commented 1 year ago

looks like an issue, shouldn't be conflicting with your hook. Anyway, do you want to research locally and make a PR? At least showing an error if it's a conflict.

alexllao commented 1 year ago

ufff i'm a newbye.

alexllao commented 1 year ago

I've this in my package.json

"husky": { "hooks": { "pre-commit": "lint-staged" } }, "lint-staged": { "**/*.{ts,tsx,md,js,jsx,json}": [ "prettier --write \"**/*.{ts,tsx,md,js,jsx,json}\"" ] },

alexllao commented 1 year ago

It would be interesting if by committing within VSCode, with the "SoureControl" plugin, and not passing any message to it, it would already do everything automatically.

Is it possible to define it in commit language?

Sin-título-1

alexllao commented 1 year ago

I think that issue may come from Windows.

di-sukharev commented 1 year ago

will investigate, thanks bro

di-sukharev commented 1 year ago

Besides CLI there is should be a vscode extension, openai key should be configured in vscode settings. also, it should not include any functionality besides comparing a diff of already staged files, it should have an icon button that suggests a text in the commit message window that I can edit.

image

I don't want to install anything globally, and while configuring an API key I've got an execution policy error on windows.

Could you provide error message pls

BenjaminHoegh commented 1 year ago

any ways to auto oc hook set?

di-sukharev commented 1 year ago

any ways to auto oc hook set?

i don't think it's a good idea, people could have their own hooks set, config true/false is ok here

mze9412 commented 1 year ago

I have a similar issue with VSCode remote development. I run oc on the remote machine from the integrated terminal in VSCode and don't get a suggested message in VSCode. The hook is set viia oc hook set

di-sukharev commented 1 year ago

I have a similar issue with VSCode remote development. I run oc on the remote machine from the integrated terminal in VSCode and don't get a suggested message in VSCode. The hook is set viia oc hook set

any error messages? how does the issue look? :)

mze9412 commented 1 year ago

When I run oc I get a commit message generated but cannot edit or see it inside VSCode. No error messages.

di-sukharev commented 1 year ago

@mze9412 you should enable setting in VSCode https://github.com/di-sukharev/opencommit/issues/1#issuecomment-1463546118

robertoandrade commented 4 days ago

Although I very much like the prompt and results from opencommit, I'd also like the ease of the GUI shortcut like some others have implemented:

Perhaps it could be as easy as forking one of those repos and stripping gptcommit out of it and swapping it by opencommit?