JSPM

  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q67723F
  • License ISC

CLI tool to generate commit messages based on repository changes

Package Exports

  • @denyhs/cortex-cli
  • @denyhs/cortex-cli/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@denyhs/cortex-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Cortex CLI

A command-line tool to generate commit messages based on your repository changes.

Installation

npm install -g @denyhs/cortex-cli

Configuration

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

Usage

cortex commit-message [options]

Options

  • No flags: Generate message for staged changes only (default)
  • --onlyStaged: Same as default, generate message for staged changes
  • --onlyUnstaged: Generate message for unstaged changes
  • --all: Generate message for all changes (staged and unstaged)
  • --stageAll: Stage all changes before generating the message
  • --header <text>: Add a custom header to the commit message (will be added above the generated message)
  • --commitStaged: After generating the message, prompt to commit staged changes
  • --commitAndPush: After generating the message, prompt to commit staged changes and push them to the remote repository

Examples

# Generate message for staged changes
cortex commit-message

# Generate message for all changes
cortex commit-message --all

# Stage all changes and generate message
cortex commit-message --stageAll

# Stage all changes, generate message with header, and commit
cortex commit-message --stageAll --header="feat: new feature implementation" --commitStaged

# Stage all changes, generate message, and commit and push
cortex commit-message --stageAll --commitAndPush

# 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 --commitAndPush --header="fix: resolve critical bug"

Features

  • Generates commit messages based on git diff
  • Supports different scopes of changes (staged, unstaged, or all)
  • Automatic staging of all changes
  • Copies generated message to clipboard
  • Optional custom header for commit messages
  • Optional automatic commit after message generation
  • Optional automatic push to remote after commit
  • Environment variable validation
  • Git repository validation