138 Commits

Author SHA1 Message Date
di-sukharev
a4716b35a4 1.1.28 v1.1.28 2023-03-29 11:26:59 +08:00
di-sukharev
c1e9062ce0 1.1.27 v1.1.27 2023-03-29 11:26:51 +08:00
di-sukharev
c7efa6f935 refactor: remove @dqbd/tiktoken dependency
chore(tsconfig.json): change target to ESNext
The @dqbd/tiktoken dependency was removed from the package.json file. This dependency was not being used in the project and was therefore removed to reduce the size of the project. The target in the tsconfig.json file was changed from ES2020 to ESNext to allow for the use of the latest ECMAScript features.
2023-03-29 11:26:19 +08:00
di-sukharev
1b70de1d20 fix(githook.ts): capitalize OpenCommit in console output
chore(githook.ts): remove unused import
refactor(tokenCount.ts): simplify token count calculation
The console output now correctly capitalizes OpenCommit for consistency with the project name. The unused import of fileURLToPath is removed. The tokenCount function is refactored to simplify the calculation of the token count. The Tiktoken library is no longer used, and the token count is now calculated based on the length of the content divided by an average token length of 2.7 characters.
2023-03-29 11:26:05 +08:00
di-sukharev
853662acc4 refactor(tokenCount.ts): format code with consistent indentation and quotes
The code has been reformatted to use consistent indentation and quotes. This improves the readability and maintainability of the code. No functionality has been changed.
2023-03-29 11:25:48 +08:00
di-sukharev
0e1ad33179 1.1.26 v1.1.26 2023-03-29 10:45:35 +08:00
di-sukharev
e7eaa5425e 1.1.25 v1.1.25 2023-03-29 10:45:30 +08:00
di-sukharev
4b96670374 Merge branch 'dev' 2023-03-29 10:45:17 +08:00
di-sukharev
e128cdece1 refactor(generateCommitMessageFromGitDiff.ts): rename mergeStrings to mergeDiffs and add maxDiffLength parameter
feat(generateCommitMessageFromGitDiff.ts): split file diffs into changes in files if they exceed the maximum token count
The mergeStrings function was renamed to mergeDiffs to better reflect its purpose. The function now takes an additional parameter, maxDiffLength, which is used to split file diffs into changes in files if they exceed the maximum token count. This change improves the efficiency of the function and reduces the number of tokens used.
2023-03-29 10:44:45 +08:00
di-sukharev
4cc73208cd chore(.gitignore): add test.ts to the list of ignored files
fix(prepare-commit-msg-hook.ts): add missing await keyword to getStagedFiles() function call
feat(prepare-commit-msg-hook.ts): add spinner to indicate commit message generation progress
feat(utils/mergeDiffs.ts): add mergeDiffs function to merge array of strings into an array of strings with a maximum length
The test.ts file is now ignored by git. The missing await keyword has been added to the getStagedFiles() function call. A spinner has been added to indicate the progress of commit message generation. The mergeDiffs function has been added to merge an array of strings into an array of strings with a maximum length.
2023-03-29 10:43:27 +08:00
di-sukharev
ea864d18f4 refactor(generateCommitMessageFromGitDiff.ts): update INIT_MESSAGES_PROMPT to improve readability and remove unnecessary line breaks 2023-03-29 09:35:35 +08:00
di-sukharev
5d131e66fa Merge branch 'master' into dev 2023-03-29 09:34:38 +08:00
di-sukharev
bf24be92a1 chore(generateCommitMessageFromGitDiff.ts): update INIT_MESSAGES_PROMPT to clarify commit message conventions and instructions 2023-03-29 09:32:15 +08:00
Raymond
3103ae18b8 Count file diff by token, not by length of string (#63)
* 1.1.23

* 1.1.24

* feat(package.json): add @dqbd/tiktoken dependency

refactor(generateCommitMessageFromGitDiff.ts): add tokenCount function to count the number of tokens in a string
refactor(generateCommitMessageFromGitDiff.ts): change the way the length of INIT_MESSAGES_PROMPT is calculated to use tokenCount function
refactor(generateCommitMessageFromGitDiff.ts): change the way the length of diff is calculated to use tokenCount function

refactor(generateCommitMessageFromGitDiff.ts): rename function parameter from diff to fileDiff and update function calls accordingly
feat(generateCommitMessageFromGitDiff.ts): add tokenCount function to count tokens in fileDiff and use it to check if fileDiff is bigger than MAX_REQ_TOKENS

feat(utils): add tokenCount function to count the number of tokens in a string
refactor(utils/mergeStrings.ts): use tokenCount function to count the number of tokens in a string instead of checking the length of the concatenated string

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2023-03-28 18:43:02 +08:00
R4V3N
7c9feba3ba Added Swedish Translation (#68)
* 1.1.23

* 1.1.24

* Added Swedish langauge

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2023-03-28 18:38:49 +08:00
di-sukharev
58369e4df9 1.1.24 v1.1.24 2023-03-28 11:32:17 +08:00
di-sukharev
3d50a67ece 1.1.23 v1.1.23 2023-03-28 11:32:13 +08:00
di-sukharev
a2d03e054c 🔀 chore(CommandsEnum.ts): reorder COMMANDS enum values
🐛 fix(config.ts): add missing new lines
🐛 fix(githook.ts): capitalize OpenCommit and fix grammar
The COMMANDS enum values were reordered to improve readability and consistency. In config.ts, missing new lines were added to improve code readability. In githook.ts, OpenCommit was capitalized and grammar was fixed to improve clarity.
2023-03-28 11:31:42 +08:00
di-sukharev
1c113c2901 style(commit.ts): add question mark to confirm message
feat(commit.ts): add support for pushing to selected remote instead of default remote
refactor(commit.ts): extract push command to a function and reuse it for both default and selected remote
2023-03-28 11:22:57 +08:00
di-sukharev
18dcb8e8c2 docs(CONTRIBUTING.md): fix typo in Contacts section
chore(package.json): change license from ISC to MIT
2023-03-28 11:20:09 +08:00
jessicakuijer
8b17b5e906 fix(commit.ts): add --verbose flag to git push command (#43)
* 🐛 fix(commit.ts): add --verbose flag to git push command
The --verbose flag is added to the git push command to provide more detailed output. This helps with debugging and identifying any issues that may arise during the push process.
2023-03-28 11:18:34 +08:00
Dang Quang Linh
284604f6a4 feat(i18n): add support for Vietnamese (Vietnam) language (vi_VN) (#51)
Co-authored-by: Sukharev <57486732+di-sukharev@users.noreply.github.com>
2023-03-28 11:16:17 +08:00
Esmerlin Joel Mieses
bdce94f2ac [FEAT](i18n): Add support for Spanish language (es_ES) (#58)
<3
2023-03-28 11:15:17 +08:00
Moret84
a3fade4d42 refactor(git.ts): use git rev-parse to get the root directory of the repository (#46)
The function getStagedFiles has been refactored to use git rev-parse to
get the root directory of the repository. This improves the reliability
of the function as it will work regardless of the current working
directory. The root directory is then passed to the git diff command to
get the list of staged files. With only the --relative flag, staged
diff(s) on files in a different same level directory as the current
working one would not be found by the command.
2023-03-24 10:11:50 +08:00
di-sukharev
83906fc704 docs(CONTRIBUTING.md): update branch name in step 6 from master to dev 2023-03-21 18:23:38 +08:00
di-sukharev
e7f7bfc2bd 1.1.22 v1.1.22 2023-03-21 15:52:54 +08:00
di-sukharev
3885ae5893 1.1.21 v1.1.21 2023-03-21 15:52:50 +08:00
di-sukharev
b8e05a5852 refactor(cli.ts): comment out checkIsLatestVersion function call
chore(checkIsLatestVersion.ts): add import for chalk library
2023-03-21 15:52:32 +08:00
di-sukharev
677b7ecad9 1.1.20 v1.1.20 2023-03-21 15:36:20 +08:00
di-sukharev
6ab06f9db3 1.1.19 v1.1.19 2023-03-21 15:36:16 +08:00
di-sukharev
38ac20612b feat(cli.ts): check if the latest version of opencommit is being used on startup
feat(api.ts): add function to get the latest version of opencommit from unpkg.com

feat(commit.ts): add support for pushing to multiple remotes and prompt user to choose which remote to push to

feat(i18n): add support for Portuguese (Brazil) language and translation for commit messages in pt_br.json

feat(utils): add checkIsLatestVersion function to check if the current version is the latest version
fix(git.ts): add --relative flag to getStagedFiles function to return relative paths
2023-03-21 15:36:05 +08:00
di-sukharev
54b8ba7419 chore(package.json): update version to 1.1.18
refactor(commit.ts): rename getStagedGitDiff to getChangedFiles and remove unused import of generateCommitMessageWithChatCompletion
refactor(commit.ts): reformat import statements for better readability

refactor(commit.ts): reformat code for better readability
feat(commit.ts): add support for selecting remote to push to when multiple remotes are available

refactor(commit.ts): remove unnecessary code and fix formatting
feat(commit.ts): add support for extraArgs parameter in generateCommitMessageFromGitDiff function

chore(checkIsLatestVersion.ts): update console message for clarity and readability
fix(git.ts): handle empty output from git command
fix(git.ts): add -- argument to git diff command to handle file names with leading hyphens
refactor(mergeStrings.ts): remove unnecessary whitespace and add missing semicolon
2023-03-21 15:35:04 +08:00
jessicakuijer
ff81d7e1ca feat(commit.ts) : Suggestion for the user to help how to choose where to push code on remotes (#20)
* 🔨 refactor(commit.ts): rename function to getGitRemotes and improve comments
This commit renames the function to getGitRemotes to better reflect its purpose. Additionally, the comments have been improved to better explain the function's behavior.

🚀 chore(commit.ts): add support for pushing to selected remote
This commit adds support for pushing to the selected remote. The user is prompted to choose a remote from the list of available remotes, and the selected remote is used to push the changes. The push command is run with the selected remote as an argument.

🐛 fix(commit.ts): fix formatting and add missing newline at end of file
This commit fixes the formatting of the code and adds a missing newline at the end of the file. The changes do not affect the functionality of the code.

* 🐛 fix(commit.ts): fix push command to include remote name
 feat(commit.ts): add support for multiple remotes
The push command was not including the remote name, which caused the push to fail. This has been fixed. Support for multiple remotes has been added, allowing the user to choose which remote to push to. If there is only one remote, the push command will automatically use that remote.
2023-03-21 15:14:13 +08:00
Nader Zouaoui
a6ccdb5f77 feature request: telling user when new version is available (#35)
*  feat(cli.ts): add checkIsLatestVersion function

This commit adds a new function that checks if the current version of OpenCommit is the latest version. The function uses the getOpenCommitLatestVersion function from the api module to get the latest version of OpenCommit. If the current version is not the latest version, a warning message is printed to the console, informing the user to update to the latest version to get the latest features and bug fixes.
2023-03-21 15:11:48 +08:00
Adriel Bento
fef8027959 feat(i18n): add support for Portuguese (Brazil) language (pt_br) (#34)
* feat(i18n): add support for Portuguese (Brazil) language (pt_br)
2023-03-21 15:09:48 +08:00
Moret84
0f48cc616e fix(git.ts): add relative flag to git diff command (#37)
The relative flag has been added to the git diff command in the
getStagedFiles function. This flag makes the output of the command
relative to the current working directory, which makes it easier to work
with the file paths and enables executing opencommit from anywhere in
the repository, not just from the root.
2023-03-21 15:08:46 +08:00
di-sukharev
b54ff02930 1.1.18 v1.1.18 2023-03-21 15:06:47 +08:00
di-sukharev
7fb46de105 1.1.17 v1.1.17 2023-03-21 15:06:43 +08:00
di-sukharev
2f6e98dc30 style(commit.ts): format code with prettier
refactor(commit.ts): add types to commit function parameters
fix(git.ts): handle empty string returned from getStagedFiles function

refactor(mergeStrings.ts): remove unnecessary blank line and add missing semicolon
2023-03-21 15:06:30 +08:00
di-sukharev
2aa6582c52 Merge remote-tracking branch 'origin/dev' 2023-03-21 14:51:44 +08:00
openefit
2acf833cd0 fix(generateCommitMessageFromGitDiff.ts): remove unnecessary character at the end of the line (#36) 2023-03-19 16:04:06 +08:00
Stuart van Beek
3f7025d50a feat: add support for .opencommitignore file (#22)
* feat: add support for .opencommitignore
2023-03-19 16:01:57 +08:00
Nader Zouaoui
d793bf1340 feat: Add support for extra args to be passed to the git commit command (#17)
* feat: Add support for extra args to be passed to the git commit command
2023-03-19 15:58:21 +08:00
di-sukharev
0092e92061 1.1.16 v1.1.16 2023-03-17 17:51:42 +08:00
di-sukharev
0f33b74942 1.1.15 v1.1.15 2023-03-17 17:51:36 +08:00
di-sukharev
8f0a32275e 1.1.14 v1.1.14 2023-03-17 17:50:39 +08:00
di-sukharev
b3509e34d0 1.1.13 v1.1.13 2023-03-17 14:20:51 +08:00
di-sukharev
5449d5cd61 1.1.12 v1.1.12 2023-03-17 14:20:39 +08:00
di-sukharev
b0d27e62ba Merge remote-tracking branch 'origin/master' into dev 2023-03-17 14:19:23 +08:00
openefit
5ae52cd8bb 🚀 i18n: add internationalization support (#31)
* 🚀  i18n: add internationalization support
2023-03-17 13:57:26 +08:00