-
Notifications
You must be signed in to change notification settings - Fork 0
Config Overview
The .coco.config
is a central piece in customizing and controlling the behavior of coco
. It allows you to set project-level settings and is flexible enough to be defined in various locations, each with a specific order of priority.
coco
determines its configuration based on a hierarchical priority system. If a configuration is specified in more than one place, the one with the highest priority will be used. The order of priority, from highest to lowest, is as follows:
- Command Line Flags: These are the highest priority and override all other settings. Useful for quick, one-off changes or testing.
- Environment Variables: Set configuration options as environment variables for broader scope.
-
Project Config (
.coco.config.json
): This JSON file in your project root defines project-specific configurations. Ideal for settings that are specific to a single project. -
Git Profile (
.gitconfig
): Settings defined under a[coco]
section in your.gitconfig
. These are used unless overridden by higher-priority configurations. -
XDG Configuration Directory: If
XDG_CONFIG_HOME
is set,coco
will look for acoco/config
file in this directory.
The coco init
command simplifies the process of generating and updating your config file. When you run coco init
, you'll be guided through an interactive setup process where you can customize your installation. This command can:
- Create a new config file in your chosen location.
- Update an existing config with new settings.
- Help you manage configurations across different scopes (global or project-specific).
Here's an example of what a .coco.config.json
file might look like:
{
"$schema": "https://git-co.co/schema.json",
"openAIApiKey": "sk-xxxxxxxxxxxxxxxxx",
"tokenLimit": 1024,
"defaultBranch": "main",
"mode": "interactive"
}
You can also set coco
configurations in your .gitconfig
file:
...
# -- Start coco config --
[coco]
openAIApiKey = sk-xxxxxxxxxxxxxxxxxxxxxxxxx
tokenLimit = 1024
defaultBranch = main
mode = interactive
# -- End coco config --
Remember to define command line flags and environment variables in UPPER_SNAKE_CASE
. For example, openAIApiKey
in the config file would be OPENAI_API_KEY
as an environment variable.