160 Commits

Author SHA1 Message Date
di-sukharev
aebe7e200f 3.0.17 2024-07-20 10:59:52 +03:00
di-sukharev
6f1e4bcec6 Merge remote-tracking branch 'origin/master' into dev 2024-07-20 10:58:16 +03:00
Takanori Matsumoto
73ccae9de3 🐛Fix: prompt-module/@commitlint (#336)
* fix(commitlint/utils.ts): correct variable used in search for JSON block end tag

* ♻️ (commitlint/config.ts & pwd-commitlint.ts): Refactor commitlint config loading to support both CJS and ESM modules

💡 (pwd-commitlint.ts): Add detailed comments and error handling for better clarity and robustness in commitlint module loading process

*  (package.json): Add setup script for e2e tests to install dependencies for commitlint configurations
🔧 (setup.sh): Add shell script to set up commitlint configurations for e2e tests

*  (config.ts): Add support for OCO_TEST_MOCK_TYPE configuration key to define test mock type for testing purposes
📝 (config.ts): Update documentation for OCO_TEST_MOCK_TYPE configuration key in configValidators and getConfig functions
📝 (testAi.ts): Add TEST_MOCK_TYPES constant array to define supported test mock types
📝 (testAi.ts): Update generateCommitMessage function to use OCO_TEST_MOCK_TYPE from config for different test mock types
📝 (commitlint.test.ts): Add e2e test for running "oco commitlint force" with different @commitlint versions using CJS and ESM
📝 (utils.ts): Add wait function to introduce delay in milliseconds for testing purposes

*  (commitlint.test.ts): refactor setupCommitlint function to accept a version parameter for better code organization and readability
📝 (commitlint.test.ts): add test case for commitlint@9 using CJS to ensure proper functionality and compatibility
📝 (commitlint.test.ts): add test case for commitlint@18 using CJS to ensure proper functionality and compatibility
📝 (commitlint.test.ts): add test case for commitlint@19 using ESM to ensure proper functionality and compatibility

* 🔧 (commitlint.test.ts): remove unnecessary commands to create and add index.ts file before running tests

* refactor(test/e2e/prompt-module/commitlint.test.ts): remove unused import configure
style(test/e2e/prompt-module/commitlint.test.ts): add missing semicolon for consistency
test(test/e2e/prompt-module/commitlint.test.ts): add e2e tests for @commitlint prompt-module integration

*  (e2e tests): add package.json copying to setupCommitlint for version accuracy
♻️ (commitlint config): refactor commitlint.config.js to use ES module syntax
 (package.json): specify "type": "module" to support ES module syntax
2024-07-04 11:08:08 +03:00
Drew Payment
c58e0c62a4 Feat/add gemini (#349) 2024-07-04 11:03:54 +03:00
di-sukharev
bf578da16a 3.0.16 2024-05-25 19:23:04 +03:00
Jakub Rosa
f814c6b89d add support for Azure OpenAI API - continue MR 167 (#324)
*  feat(api.ts): add support for Azure OpenAI API

The Azure OpenAI API is now supported in addition to the OpenAI API. The API type can be specified in the configuration file using the OPENAI_API_TYPE key. If the key is not specified, the default value is 'openai'. The AzureOpenAIApi class is added to the utils folder to handle the Azure OpenAI API calls. The createChatCompletion method is implemented in the AzureOpenAIApi class to handle the chat completion requests. The method is called in the generateCommitMessage method in the OpenAi class if the apiType is set to 'azure'.

* 🐛 fix(AzureOpenAI.ts): fix import path for AxiosRequestConfig to avoid conflicts with openai's axios dependency

In AzureOpenAI.ts, the import path for AxiosRequestConfig was changed to avoid conflicts with openai's axios dependency, which was causing lint errors.

* 🔧 fix(AzureOpenAI.ts): import RequiredError to fix error handling and remove commented out debug code

The RequiredError class was not being imported from the openai/dist/base module, causing errors to be thrown incorrectly. This has been fixed by importing the RequiredError class. Debug code has been removed and comments have been updated to reflect the changes made.

* 🔇 chore(AzureOpenAI.ts): remove console.log statement and translate Japanese comment

The commented console.log statement was removed to improve code cleanliness.

* 🔥 refactoring(api.ts, AzureOpenAI.ts): Leverage openai npm package
🐛 fix(config.ts): API Key string validation

*  (README.md): update opencommit command to set OCO_AI_PROVIDER instead of OPENAI_API_TYPE to improve consistency and clarity in configuration
♻️ (config.ts): update OCO_AI_PROVIDER enum in configValidators to include 'azure' and remove unnecessary conditionals to improve maintainability and extensibility
⬆️ (config.ts): add OCO_AZURE_API_VERSION to ConfigType and getConfig() to support new azure api version configuration
♻️ (engine/ollama.ts): add space between temperature and top_p properties to improve readability
♻️ (engine/openAi.ts): refactor OpenAi class to improve readability and maintainability by extracting configuration logic into separate switch statement
🔧 (generateCommitMessageFromGitDiff.ts): refactor MAX_TOKENS_INPUT and MAX_TOKENS_OUTPUT lines to improve readability
🔧 (generateCommitMessageFromGitDiff.ts): refactor generateCommitMessageByDiff and getMessagesPromisesByChangesInFile functions to use destructuring and improve readability
♻️ (generateCommitMessageFromGitDiff.ts): refactor getCommitMsgsPromisesFromFileDiffs function to use destructuring and improve readability
📝 (modules/commitlint/config.ts): add missing types to function parameters and improve readability by removing unnecessary comments and whitespace
📝 (modules/commitlint/utils.ts): fix indentation and add missing types to function parameters
📝 (prompts.ts): update INIT_MAIN_PROMPT description to include clarification on the use of present tense and line length
📝 (version.ts): fix import statements and add missing types to function parameters

*  (package.json): add @azure/openai dependency to support integration with Azure AI services
🔧 (config.ts): change CONFIG_KEYS.OCO_AZURE_API_VERSION to CONFIG_KEYS.OCO_AZURE_ENDPOINT to improve semantics and allow configuration of Azure endpoint URL
♻️ (config.ts): refactor configValidators to use OCO_AZURE_ENDPOINT instead of OCO_AZURE_API_VERSION and update validation message for OCO_AZURE_ENDPOINT
 (config.ts): add OCO_AZURE_ENDPOINT to getConfig function to retrieve Azure endpoint configuration from environment variables
 (azure.ts): introduce a new file azure.ts to implement Azure AI engine
 (azure.ts): implement generateCommitMessage function in Azure AI engine
 (prompts.ts): add a new line to INIT_MAIN_PROMPT to mention that changes within a single file should be described with a single commit message
♻️ (engine.ts): refactor getEngine function to add support for 'azure' as the AI provider and return the azure engine

* 📝 (prompts.ts): remove unnecessary information about crafting a concise commit message with a one single message for OCO_ONE_LINE_COMMIT configuration

* 3.0.14 (#333)

* test:  add the first E2E test and configuration to CI (#316)

* add tests

* Add push config (#220)

* feat: add instructions and support for configuring gpt-4-turbo (#320)

* 3.0.12

* build

* feat: add 'gpt-4-turbo' to supported models in README and config validation

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>

*  fix the broken E2E tests due to the addition of OCO_GITPUSH (#321)

* test(oneFile.test.ts): update test expectations to match new push prompt text

* build

* Feat: Add Claude 3 support (#318)

* 3.0.12

* build

* feat: anthropic claude 3 support

* fix: add system prompt

* fix: type check

* fix: package version

* fix: update anthropic for dependency bug fix

* feat: update build files

* feat: update version number

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>

* 🐛bug fix: enable to use the new format of OpenAI's project API Key (#328)

* fix(config.ts): remove validation for OCO_OPENAI_API_KEY length to accommodate variable key lengths

* build

* ♻️ refactor(config.ts): Addition of UnitTest environment and unittest for commands/config.ts#getConfig (#330)

* feat(jest.config.ts): update jest preset for TS ESM support and ignore patterns
feat(package.json): add test:unit script with NODE_OPTIONS for ESM
refactor(src/commands/config.ts): improve dotenv usage with dynamic paths
feat(src/commands/config.ts): allow custom config and env paths in getConfig
refactor(src/commands/config.ts): streamline environment variable access

feat(test/unit): add unit tests for config handling and utility functions

- Implement unit tests for `getConfig` function to ensure correct behavior
  in various scenarios including default values, global config, and local
  env file precedence.
- Add utility function `prepareFile` for creating temporary files during
  tests, facilitating testing of file-based configurations.

* feat(e2e.yml): add unit-test job to GitHub Actions for running unit tests on pull requests

* ci(test.yml): add GitHub Actions workflow for unit and e2e tests on pull requests

* refactor(config.ts): streamline environment variable access using process.env directly
test(config.test.ts): add setup and teardown for environment variables in tests to ensure test isolation

* feat(package.json): add `test:all` script to run all tests in Docker
refactor(package.json): consolidate Docker build steps into `test:docker-build` script for DRY principle
fix(package.json): ensure `test:unit:docker` and `test:e2e:docker` scripts use the same Docker image and remove container after run
chore(test/Dockerfile): remove default CMD to allow dynamic test script execution in Docker

* refactor(config.test.ts): anonymize API keys in tests for better security practices

* feat(config.test.ts): add tests for OCO_ANTHROPIC_API_KEY configuration

* refactor(config.ts): streamline path imports and remove unused DotenvParseOutput

- Simplify path module imports by removing default import and using named imports for `pathJoin` and `pathResolve`.
- Remove unused `DotenvParseOutput` import to clean up the code.

* refactor(config.test.ts): simplify API key mock values for clarity in tests

* test(config.test.ts): remove tests for default config values and redundant cases

- Removed tests that checked for default config values when no config or env files are present, as these scenarios are now handled differently.
- Eliminated tests for empty global config and local env files to streamline testing focus on actual config loading logic.
- Removed test for prioritizing local env over global config due to changes in config loading strategy, simplifying the configuration management.

* new version

---------

Co-authored-by: Takanori Matsumoto <matscube@gmail.com>
Co-authored-by: Moret84 <aurelienrivet@hotmail.fr>
Co-authored-by: yowatari <4982161+YOwatari@users.noreply.github.com>
Co-authored-by: metavind <94786679+metavind@users.noreply.github.com>

* 3.0.15

* build

* 🐛 (prepare-commit-msg-hook.ts): improve error message to cover missing OCO_ANTHROPIC_API_KEY and OCO_AZURE_API_KEY in addition to OCO_OPENAI_API_KEY

* 🐛 (azure.ts): fix check for OCO_AI_PROVIDER to properly assign provider variable
🐛 (azure.ts): initialize OpenAIClient only if provider is 'azure'
🔧 (Dockerfile): rearrange instructions to optimize caching by copying package.json and package-lock.json first before running npm ci and copying the rest of the files
🔧 (e2e/noChanges.test.ts): remove unnecessary line break
🔧 (e2e/oneFile.test.ts): remove unnecessary line break

---------

Co-authored-by: Takuya Ono <takuya-o@users.osdn.me>
Co-authored-by: GPT10 <57486732+di-sukharev@users.noreply.github.com>
Co-authored-by: Takanori Matsumoto <matscube@gmail.com>
Co-authored-by: Moret84 <aurelienrivet@hotmail.fr>
Co-authored-by: yowatari <4982161+YOwatari@users.noreply.github.com>
Co-authored-by: metavind <94786679+metavind@users.noreply.github.com>
Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2024-05-09 11:23:00 +03:00
Takanori Matsumoto
278e4cb4c2 ♻️ refactor(config.ts): Addition of UnitTest environment and unittest for commands/config.ts#getConfig (#330)
* feat(jest.config.ts): update jest preset for TS ESM support and ignore patterns
feat(package.json): add test:unit script with NODE_OPTIONS for ESM
refactor(src/commands/config.ts): improve dotenv usage with dynamic paths
feat(src/commands/config.ts): allow custom config and env paths in getConfig
refactor(src/commands/config.ts): streamline environment variable access

feat(test/unit): add unit tests for config handling and utility functions

- Implement unit tests for `getConfig` function to ensure correct behavior
  in various scenarios including default values, global config, and local
  env file precedence.
- Add utility function `prepareFile` for creating temporary files during
  tests, facilitating testing of file-based configurations.

* feat(e2e.yml): add unit-test job to GitHub Actions for running unit tests on pull requests

* ci(test.yml): add GitHub Actions workflow for unit and e2e tests on pull requests

* refactor(config.ts): streamline environment variable access using process.env directly
test(config.test.ts): add setup and teardown for environment variables in tests to ensure test isolation

* feat(package.json): add `test:all` script to run all tests in Docker
refactor(package.json): consolidate Docker build steps into `test:docker-build` script for DRY principle
fix(package.json): ensure `test:unit:docker` and `test:e2e:docker` scripts use the same Docker image and remove container after run
chore(test/Dockerfile): remove default CMD to allow dynamic test script execution in Docker

* refactor(config.test.ts): anonymize API keys in tests for better security practices

* feat(config.test.ts): add tests for OCO_ANTHROPIC_API_KEY configuration

* refactor(config.ts): streamline path imports and remove unused DotenvParseOutput

- Simplify path module imports by removing default import and using named imports for `pathJoin` and `pathResolve`.
- Remove unused `DotenvParseOutput` import to clean up the code.

* refactor(config.test.ts): simplify API key mock values for clarity in tests

* test(config.test.ts): remove tests for default config values and redundant cases

- Removed tests that checked for default config values when no config or env files are present, as these scenarios are now handled differently.
- Eliminated tests for empty global config and local env files to streamline testing focus on actual config loading logic.
- Removed test for prioritizing local env over global config due to changes in config loading strategy, simplifying the configuration management.
2024-05-05 18:46:15 +03:00
Takanori Matsumoto
e19305dee2 🐛bug fix: enable to use the new format of OpenAI's project API Key (#328)
* fix(config.ts): remove validation for OCO_OPENAI_API_KEY length to accommodate variable key lengths

* build
2024-05-02 12:07:21 +03:00
metavind
673eee209d Feat: Add Claude 3 support (#318)
* 3.0.12

* build

* feat: anthropic claude 3 support

* fix: add system prompt

* fix: type check

* fix: package version

* fix: update anthropic for dependency bug fix

* feat: update build files

* feat: update version number

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2024-04-14 13:20:12 +08:00
yowatari
a4480893cb feat: add instructions and support for configuring gpt-4-turbo (#320)
* 3.0.12

* build

* feat: add 'gpt-4-turbo' to supported models in README and config validation

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
2024-04-12 11:55:41 +08:00
Takanori Matsumoto
5cda8b1b03 test: add the first E2E test and configuration to CI (#316)
* add tests
2024-03-25 12:01:05 +08:00
digitalstudium
a192441f68 Switch ollama api endpoint from /api/generate to /api/chat (#304)
* 3.0.11

* build

* docs: update ollama usage readme (#301)

Signed-off-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: Albert Simon <albert.simon.sge@mango.com>

* 🚨 BREAKING CHANGES 🚨

- feat(engine/ollama): add support for local models and change prompt format to improve AI performance
+ fix(engine/ollama): fix issue with local model not responding correctly to requests

The commit message is now more concise, clear, and informative. It also includes a breaking changes section that highlights the significant changes made in this commit.

---------

Signed-off-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
Co-authored-by: Albert Simon <47634918+willyw0nka@users.noreply.github.com>
Co-authored-by: Albert Simon <albert.simon.sge@mango.com>
Co-authored-by: Константин Шуткин <shutkin-kn@mosmetro.ru>
2024-03-08 10:08:52 +08:00
di-sukharev
75d0f57f09 3.0.10 2024-03-03 19:44:30 +08:00
di-sukharev
02cef105a6 3.0.9 2024-02-28 19:29:17 +08:00
di-sukharev
62e44e5e35 3.0.8 2024-02-28 19:19:41 +08:00
di-sukharev
6155fca4b1 3.0.7 2024-02-28 19:19:09 +08:00
di-sukharev
53ae8926fa 3.0.6 2024-02-27 22:17:06 +08:00
di-sukharev
5f85cafc7e 3.0.5 2024-02-27 22:07:16 +08:00
Jaroslaw Weber
1d6980faf3 add ollama support (#269)
* add ollama support

---------

Co-authored-by: di-sukharev <dim.sukharev@gmail.com>
Co-authored-by: GPT10 <57486732+di-sukharev@users.noreply.github.com>
Co-authored-by: Jaroslaw Weber <jaroslaw.weber@adriel.com>
2024-02-27 22:01:13 +08:00
di-sukharev
2761403735 Merge remote-tracking branch 'origin/master' into dev 2023-09-09 15:52:13 +08:00
di-sukharev
ca049e4b5d chore(package.json): update deploy script to push tags before publishing to npm
The deploy script in package.json has been updated to push tags before publishing to npm. This ensures that the latest version tag is pushed to the remote repository before publishing the package.
2023-09-05 13:57:20 +08:00
di-sukharev
2d48648f52 chore(package.json): update version to 3.0.3
The version in package.json has been updated from 3.0.2 to 3.0.3. This change is made to reflect the latest version of the project.
2023-09-05 13:51:21 +08:00
di-sukharev
40297e0c6a chore(package.json): update version to 3.0.2
The version in package.json has been updated from 3.0.1 to 3.0.2. This change is made to reflect the latest version of the project.
2023-09-05 13:49:17 +08:00
di-sukharev
75f0cd47b8 chore(package.json): update version to 3.0.1
The version in package.json has been updated from 3.0.0 to 3.0.1. This change is made to reflect the new version of the project.
2023-09-05 13:48:09 +08:00
Sukharev
c76313737d #247: fix (#248) 2023-09-05 13:45:34 +08:00
di-sukharev
df705b97b7 Merge remote-tracking branch 'origin/master' into dev 2023-09-05 13:42:22 +08:00
di-sukharev
08fb4d801f chore: add .npmignore file and update package.json to include specific files in the "files" field
The .npmignore file is added to the project. It currently includes the file "out/github-action.cjs" to be ignored when publishing the package to npm.

In the package.json file, the "files" field is updated to include the files "out/cli.cjs" and "out/tiktoken_bg.wasm". This ensures that these files are included when publishing the package to npm.

The "deploy" script in the package.json file is also updated to include pushing tags to the remote repository using "git push --tags". This ensures that the newly created version tags are pushed along with the code changes.
2023-09-03 15:29:29 +08:00
Sukharev
b98b892ba1 v3.0.0 (#243)
* update major version

---------

Co-authored-by: E Einowski <5124085+EwiththeBowtie@users.noreply.github.com>
Co-authored-by: Max Zavodniuk <lovemaxonly@gmail.com>
Co-authored-by: Malthe Poulsen <30603252+malpou@users.noreply.github.com>
Co-authored-by: Sébastien Fichot <fichot.sebastien@gmail.com>
2023-09-03 15:16:02 +08:00
di-sukharev
0460a252e2 update major version 2023-09-03 15:11:14 +08:00
di-sukharev
ebeb68fd9b chore(package.json): update deploy script to use 'git push --follow-tags' instead of 'git push --tags'
The deploy script in package.json has been updated to use 'git push --follow-tags' instead of 'git push --tags'. This change ensures that tags are pushed along with the commit when deploying the application.
2023-09-03 15:07:43 +08:00
di-sukharev
765e9884dd chore(package.json): reorder scripts to improve readability and maintainability 2023-09-03 14:10:56 +08:00
Sébastien Fichot
12956d7633 feat: Integrate @commitlint for Enhanced Commit Message Generation and Configuration Support (#209)
* add commitlint support
* refactor code
* improve readme text
2023-09-03 14:00:18 +08:00
di-sukharev
916ddf02d1 2.4.2 2023-07-05 15:20:11 +08:00
di-sukharev
fa85ec0351 build 2023-07-05 15:20:03 +08:00
di-sukharev
3a7f2d69e7 2.4.1 2023-07-05 15:19:29 +08:00
di-sukharev
f240d35231 build 2023-07-05 15:19:20 +08:00
di-sukharev
04ee73ca9d 2.4.0 2023-07-05 15:18:19 +08:00
di-sukharev
91885cdd1c 2.3.0 2023-07-05 15:18:02 +08:00
di-sukharev
cad179953a 2.2.10 2023-05-26 13:14:42 +08:00
di-sukharev
792ab67ef1 2.2.9 2023-05-26 13:12:00 +08:00
di-sukharev
f69e716dcc 2.2.8 2023-05-26 13:10:29 +08:00
di-sukharev
56e02f2604 2.2.7 2023-05-26 13:08:08 +08:00
di-sukharev
c491fa4bad 2.2.6 2023-05-26 12:57:38 +08:00
di-sukharev
f7b1a6358f build 2023-05-26 12:55:27 +08:00
di-sukharev
5f9f29c467 2.2.5 2023-05-26 12:55:14 +08:00
di-sukharev
0ec5dab80a 2.2.4 2023-05-26 12:54:52 +08:00
di-sukharev
8d47a1bb0f chore(package.json): revert version to 2.2.3 and remove postversion script as it is no longer needed
feat(package.json): add deploy script to automate versioning, building, pushing and publishing the package to npm registry
2023-05-26 12:54:42 +08:00
di-sukharev
fad05e0757 2.2.4 2023-05-26 12:52:00 +08:00
di-sukharev
12f7e7eaf9 build 2023-05-26 12:51:55 +08:00
di-sukharev
6490532818 2.2.3 2023-05-26 12:43:53 +08:00