When user wants one line commits the system prompt and the user/assistant one-shot example were contradicting each other, confusing the LLM. This fix modifies the assistant output so that prompt and one-shot are consistent.
This commit adds a new 'describe' mode to the config command, allowing users
to get detailed information about configuration parameters. It includes:
1. New CONFIG_MODES.describe enum value
2. Functions to generate and print help messages for config parameters
3. Updated configCommand to handle the new 'describe' mode
4. README updates to document the new 'describe' functionality
- Added OCO_GITPUSH='true' environment variable to all e2e test commands
- Fixed ESM module import issues in commitlint tests by using process.cwd()
- Replaced import.meta.url usage with relative paths from project root
- All e2e tests now properly test the git push prompt functionality
- Fixed Jest configuration error by removing duplicate modulePathIgnorePatterns property
- Consolidated the ignore patterns into a single declaration
- This resolves the TypeScript compilation error preventing tests from running
- export parseCustomHeaders from src/utils/engine.ts
- use parseCustomHeaders in OpenAiEngine for config.customHeaders
- remove try/catch and inline JSON.parse logic
- update config test to expect headers as object and drop JSON.parse
Centralize header parsing for reuse and simplify engine code
Update tests to match new header format for clarity
Use OpenAI.ClientOptions for stronger typing and clarity
Extract custom headers parsing into parseCustomHeaders util
Simplify getEngine by delegating header parsing to helper
Improve maintainability and reduce code duplication
Add OCO_API_CUSTOM_HEADERS variable to README, config enum,
and env parsing to allow JSON string of custom headers.
Validate that custom headers are valid JSON in config validator.
Extend AiEngineConfig with customHeaders and pass headers to
OllamaEngine and OpenAiEngine clients when creating requests.
Parse custom headers in utils/engine and warn on invalid format.
Add unit tests to ensure OCO_API_CUSTOM_HEADERS is handled
correctly and merged from env over global config.
This enables users to send additional headers such as
Authorization or tracing headers with LLM API calls.
The space normalization logic is updated to replace only multiple spaces
and tabs with a single space, while preserving newlines. This change
ensures that the formatting of the content is maintained, especially
when dealing with empty line requirements and max line length.
Resolves persistent `ReferenceError: exports is not defined` errors
encountered during unit tests (`unit-test (20.x)` job) in the GitHub
Actions CI environment. These errors occurred specifically when
importing `cli-testing-library` in the global Jest setup file
(`test/jest-setup.ts`), despite tests passing locally with the same
Node.js version (v20.19.0).
After iterative testing, the following Jest configuration combination
was identified as necessary to ensure consistent ESM handling and test
success in both local and CI environments:
- Set preset to `ts-jest/presets/default-esm` for stricter ESM rules.
- Configured `transformIgnorePatterns` to ensure Jest transforms specific ESM dependencies (`cli-testing-library`, `@clack`, `cleye`) within `node_modules`.
- Expanded the `transform` pattern (`^.+\\.(ts|tsx|js|jsx|mjs)$`) to explicitly cover various script types handled by `ts-jest`.
- Included explicit `tsconfig` overrides (`module: 'ESNext'`, `target: 'ES2022'`) within the `ts-jest` transform options to resolve potential environment discrepancies.
- Retained `moduleNameMapper` for `.js` imports for reliable module resolution.
- Ensured `cli-testing-library` imports remain in the global setup (`test/jest-setup.ts`).
- Removed test cache clearing from the `test:unit` script in `package.json`.
This configuration now passes reliably across environments.
Including rimraf in the project allows for easier and more efficient
removal of files and directories, enhancing the development workflow,
especially for tasks like cleaning up build artifacts.
The space normalization logic is updated to replace only multiple spaces
and tabs with a single space, while preserving newlines. This change
ensures that the formatting of the content is maintained, especially
when dealing with empty line requirements and max line length.
Resolves persistent `ReferenceError: exports is not defined` errors
encountered during unit tests (`unit-test (20.x)` job) in the GitHub
Actions CI environment. These errors occurred specifically when
importing `cli-testing-library` in the global Jest setup file
(`test/jest-setup.ts`), despite tests passing locally with the same
Node.js version (v20.19.0).
After iterative testing, the following Jest configuration combination
was identified as necessary to ensure consistent ESM handling and test
success in both local and CI environments:
- Set preset to `ts-jest/presets/default-esm` for stricter ESM rules.
- Configured `transformIgnorePatterns` to ensure Jest transforms specific ESM dependencies (`cli-testing-library`, `@clack`, `cleye`) within `node_modules`.
- Expanded the `transform` pattern (`^.+\\.(ts|tsx|js|jsx|mjs)$`) to explicitly cover various script types handled by `ts-jest`.
- Included explicit `tsconfig` overrides (`module: 'ESNext'`, `target: 'ES2022'`) within the `ts-jest` transform options to resolve potential environment discrepancies.
- Retained `moduleNameMapper` for `.js` imports for reliable module resolution.
- Ensured `cli-testing-library` imports remain in the global setup (`test/jest-setup.ts`).
- Removed test cache clearing from the `test:unit` script in `package.json`.
This configuration now passes reliably across environments.
Including rimraf in the project allows for easier and more efficient
removal of files and directories, enhancing the development workflow,
especially for tasks like cleaning up build artifacts.
The commitlint configuration and prompts have been refactored to enhance
clarity and maintain consistency throughout the codebase. The type
assertion for commitLintConfig is updated to use 'as any' for better
type handling. Additionally, formatting adjustments are made in the
prompts to ensure proper readability and alignment with the defined
conventions. These changes aim to streamline the commit message
generation process and improve overall code maintainability.
This update introduces a new structure for generating commit messages by defining a constant for commit types and consolidating the logic into a single function. The changes enhance readability and maintainability while ensuring consistent formatting based on the OCO_OMIT_SCOPE configuration.
This change allows opencommit to locate commitlint installed globally
(with opencommit), which is useful for project that does not use node.js
environment or dose not have opencommit and @commitlint installed locally.
Add DeepSeekEngine to support DeepSeek API. This
includes a new DeepSeekConfig interface and updates to
the engine selection logic.
feat(README.md, src/commands/config.ts): Add DeepSeek support
Adds support for the DeepSeek AI provider. Updates the README,
config validation, and model list to include DeepSeek. This
allows users to utilize DeepSeek models with the OpenCommit
tool.
fix(deepseek.ts): update DeepSeek API base URL to include version number v1
refactor(deepseek.ts): improve DeepSeekEngine constructor
The DeepSeekEngine constructor is refactored to use the
spread syntax for better readability and maintainability
when merging config parameters. The baseURL is now
explicitly set within the constructor.
fix(README.md): remove Groq from the list of supported AI providers
refactor(deepseek.ts): rename interface DeepseekConfig to DeepSeekEngineeekConfig and fix typo
Revert "refactor(deepseek.ts): rename interface DeepseekConfig to DeepSeekEngineeekConfig and fix typo"
This reverts commit f492367d3885fa97cd685feca889f93d6c465b2f.
refactor(deepseek.ts): Rename DeepseekConfig to DeepSeekConfig for consistency
✨ feat(engine): add DeepSeekEngine to support DeepSeek API
♻️ refactor(engine): improve OpenAiEngine and create a
new DeepSeekEngine class to handle DeepSeek API
requests. The DeepSeekEngine class inherits from
OpenAiEngine and overrides the
generateCommitMessage method to use the DeepSeek
API. This change improves code organization and
maintainability.
🐛 Fix: Correct DeepSeekEngine import and class name
The import path and class name for DeepSeekEngine were
incorrect, causing a runtime error. This commit corrects
the import path and class name to `DeepseekEngine` to
resolve the issue.
Revert "🐛 Fix: Correct DeepSeekEngine import and class name"
This reverts commit 738fd36c434d9df9c3a458b1e8230c974bd2a76e.
🐛 Fix: Correct DeepSeekEngine import and class name
The import path and class name for DeepSeekEngine were corrected to match the actual file and class name. This fixes a runtime error.
Restore ./out directory to master state