![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@denyhs/cortex-cli
Advanced tools
CLI tool to generate commit messages based on repository changes
This CLI is used to generate commit messages for you using AI! Visit https://commits.denyhs.com/ to learn more ❤️
A command-line tool to generate commit messages based on your repository changes.
npm install -g @denyhs/cortex-cli
Before using the CLI, you need to set your API token as an environment variable:
export CORTEX_GENERATE_COMMIT_MESSAGE_TOKEN=your_token_here
Or create a .env
file in your project root:
CORTEX_GENERATE_COMMIT_MESSAGE_TOKEN=your_token_here
You can also create a .cortexrc
file in your project root to set default options:
{
"stageAllChanges": true,
"include": ["src/**/*.js", "lib/**/*.js"],
"exclude": ["test/**", "**/*.test.js"],
"header": "feat: ",
"commitStaged": true,
"template": {
"name": "quave-projects",
"variables": {
"taskId": "123",
"taskName": "My task"
}
}
}
To make your IDE treat .cortexrc
as a JSON file:
VS Code
The repository includes .vscode/settings.json
with the correct configuration:
{
"files.associations": {
".cortexrc": "json"
}
}
JetBrains IDEs (WebStorm, IntelliJ, etc.)
The repository includes .idea/fileTypes/cortexrc.xml
with the correct configuration. If you're not using the provided configuration:
cortexrc
pattern under "File name patterns"Vim/Neovim Add to your configuration:
autocmd BufNewFile,BufRead .cortexrc setfiletype json
The CLI follows a strict priority order when applying configurations:
.cortexrc
file settings (lower priority)For example, if you have this .cortexrc
:
{
"include": ["src/**/*.js"],
"header": "feat: "
}
And run:
cortex commit-message --include "lib/**/*.js" --header "fix: "
The CLI will use:
include: ["lib/**/*.js"]
(from command line)header: "fix: "
(from command line)The values in .cortexrc
are overridden by the command-line flags.
Here are some common .cortexrc
configurations:
// Basic configuration for a JavaScript project
{
"stageAllChanges": true,
"include": ["src/**/*.js", "lib/**/*.js"],
"exclude": ["**/*.test.js", "**/*.spec.js"],
"header": "feat: "
}
// TypeScript project with automatic commit
{
"stageAllChanges": true,
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["**/*.test.ts", "**/__tests__/**"],
"commitStaged": true,
"header": "fix: "
}
// Full-stack project configuration
{
"stageAllChanges": true,
"include": [
"frontend/src/**/*.{js,jsx,ts,tsx}",
"backend/src/**/*.js",
"shared/**/*.js"
],
"exclude": [
"**/*.test.*",
"**/*.spec.*",
"**/dist/**",
"**/build/**"
],
"commitAndPushStaged": true
}
// Configuration for documentation changes
{
"stageAllChanges": true,
"include": [
"docs/**/*.md",
"**/*.mdx",
"**/README.md"
],
"header": "docs: ",
"commitStaged": true
}
Templates allow you to customize how your commit messages are generated using the template feature available at commits.denyhs.com/templates. You can use templates interactively with the --withTemplates
flag or specify a template name with --templateName
.
First, create your template on commits.denyhs.com/templates. Templates use variables (prefixed with #) that will be replaced with actual values. For example:
#taskId - #taskName
#GENERATED_MESSAGE
Then, in your .cortexrc
file, you can pre-define values for some or all of these variables:
{
"template": {
"name": "my-template",
"variables": {
"#taskName": "Creating login page"
}
}
}
When you run the CLI, it will:
.cortexrc
#taskId
in this case)#GENERATED_MESSAGE
with the AI-generated commit messageLet's say you have this template named "my-proj" on commits.denyhs.com:
#taskId - #taskName
#GENERATED_MESSAGE
Your .cortexrc
:
{
"template": {
"name": "my-proj",
"variables": {
"#taskName": "Creating login page"
}
}
}
When you run the CLI:
#taskId
123 - Creating login page
Finishing my amazing login page
Note: While you can use templates interactively with CLI flags (--withTemplates
or --templateName
), pre-defining template variables is only possible through the .cortexrc
file.
cortex commit-message [options]
--stageAllChanges
: Stage all changes before generating the message--include <patterns...>
: Include only files matching these patterns when staging (supports glob patterns)--exclude <patterns...>
: Exclude files matching these patterns when staging (supports glob patterns)--header <text>
: Add a custom header to the commit message (will be added above the generated message)--preScript <command>
: Execute a command before generating the commit message (e.g., linting, tests)--commitStaged
: After generating the message, prompt to commit staged changes--commitAndPushStaged
: After generating the message, prompt to commit staged changes and push them to the remote repository--verbose
: Show detailed information about the current configuration and execution--withTemplates
: Show an interactive prompt to choose from available templates for generating the commit message--templateName <templateName>
: Use a specific template by name to generate the commit message# Generate message for staged changes
cortex commit-message
# Use interactive template selection
cortex commit-message --withTemplates
# Use a specific template
cortex commit-message --templateName "my-template"
# Run linter before generating message
cortex commit-message --preScript "npm run lint"
# Run tests and stage all changes if they pass
cortex commit-message --preScript "npm test" --stageAllChanges
# Stage specific files and generate message
cortex commit-message --stageAllChanges --include "src/**/*.js" --exclude "**/*.test.js"
# Stage changes in specific directories
cortex commit-message --stageAllChanges --include "src/**" "lib/**" --exclude "test/**"
# Stage changes with patterns and commit
cortex commit-message --stageAllChanges --include "src/**/*.js" --header="feat: new feature" --commitStaged
# Stage filtered changes, generate message, and commit and push
cortex commit-message --stageAllChanges --include "src/**" --exclude "test/**" --commitAndPushStaged
# Generate message with a custom header
cortex commit-message --header="feat: new feature implementation"
# Generate message, commit, and push with a custom header
cortex commit-message --commitAndPushStaged --header="fix: resolve critical bug"
.cortexrc
file or command-line options[2.3.2] - 2025-01-22
mergeOptions
function to accept a callback that runs after loading higher priority options, improving pre-script execution timingFAQs
CLI tool to generate commit messages based on repository changes
The npm package @denyhs/cortex-cli receives a total of 15 weekly downloads. As such, @denyhs/cortex-cli popularity was classified as not popular.
We found that @denyhs/cortex-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.