Package Exports
- git-coco
- git-coco/dist/index.esm.mjs
- git-coco/dist/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 (git-coco) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
coco π€ π¦
Commit Copilot, or coco, is your personal scribe for git commit messages. Leveraging the power of LangChainπ¦π and LLMs to encapsulate your staged changes into meaningful commit messages!
Installation
Get started by adding coco to your project's development dependencies:
npm i git-coco --save-devOr, for global access, you can install coco system-wide:
npm i -g git-cocoUsage
There are two main ways to use coco:
Interactive Mode
Just type coco and let the friendly prompts guide you through the commit process!
coco -iThe interactive mode offers you several benefits:
- Preview and approve or regenerate the commit message before it's committed
- Customize your prompts for a personalized commit experience
Command Line Interface (CLI)
If you're the type who likes to keep it simple, you can pass your commit message directly as a CLI argument:
coco --openAIApiKey="sk_your-openai-api-key"Assuming you've stored your API key in the config file (learn more), you can also commit with:
git commit -m $(coco)Alternatively, take advantage of coco's full potential by allowing it to make the commit for you!
coco -sThe coco.config
coco.config houses the project-level settings and can be defined in multiple places, adhering to a hierarchical order of priority. If the same configuration is found in multiple places, the higher priority one will be considered.
From highest to lowest, the priority order is:
- Command Line Flags: Flags in the command line have the highest priority, and they override all other settings.
- Environment Variables: Next in line are environment variables. You can set any configuration option as an environment variable.
- Project Config (
.coco.config.json): Create a.coco.config.jsonfile in your project root to set configurations. It's recommended to store your OpenAI API key here alongside any other project-specific configurations. - Git Profile (
.gitconfig): You can definecocosettings under a[coco]section in your git profile. These settings will be used unless overridden by higher-priority ones. - XDG Configuration Directory: If
XDG_CONFIG_HOMEis set,cocowill look for acoco/configfile in this directory for configurations.
Here's an example .coco.config.json file:
{
"openAIApiKey": "sk_your-openai-api-key",
}And the same settings in .gitconfig:
[coco]
openAIApiKey = sk_your-openai-api-keyRemember, command line flags and environment variables should be defined in UPPER_SNAKE_CASE. For instance, the openAIApiKey setting becomes OPENAI_API_KEY.
Options
| Name | Type | Default Value | Description |
|---|---|---|---|
| openAIApiKey | string | None | Your OpenAI API key |
| tokenLimit | number | 500 | Maximum number of tokens for the commit message |
| prompt | string | "What are the changes in this commit?" |
Prompt for OpenAI GPT-3 |
| temperature | number | 0.4 | Controls randomness in GPT-3 output. Lower values yield focused output; higher values offer diversity |
| mode | stdout | interactive |
stdout |
Preferred output method for generated commit messages |
| summarizePrompt | string | "Summarize the changes in this large file:" |
GPT-3 prompt for summarizing large files |
| ignoredFiles | string[] | ["package-lock.json"] |
Paths of files to be excluded when generating commit messages |
| ignoredExtensions | string[] | [".map", ".lock"] |
File extensions to be excluded when generating commit messages |
Roadmap
- Interactive mode π€
- Stdout π€
- LangChain integration π¦
- Additional tests! π§ͺ
- Conventional commits π
- HuggingFace integration π
- Google Vertex AI integration (?)
- Automatic changelog generation π«£
- Rebase support π
-
coco --amend b31dfcπ©βπ»
...and more! π§βπ¬ π
Contribution
Have an idea for a feature or want to get involved, we welcome contributions!
Please check out our CONTRIBUTING.md for more information.