|
| 1 | +# Penify CLI - Configuration Commands |
| 2 | + |
| 3 | +The `config` command allows you to set up and manage configuration settings for Penify CLI. This document explains all available configuration options and how to use them. |
| 4 | + |
| 5 | +## Configuration Overview |
| 6 | + |
| 7 | +Penify CLI stores configuration in a JSON file at `~/.penify/config.json`. The configuration includes: |
| 8 | + |
| 9 | +- LLM (Large Language Model) settings for local commit message generation |
| 10 | +- JIRA integration settings for enhanced commit messages |
| 11 | +- API tokens and other credentials |
| 12 | + |
| 13 | +## Basic Usage |
| 14 | + |
| 15 | +```bash |
| 16 | +# Configure LLM settings |
| 17 | +penifycli config llm |
| 18 | + |
| 19 | +# Configure JIRA integration |
| 20 | +penifycli config jira |
| 21 | +``` |
| 22 | + |
| 23 | +## LLM Configuration |
| 24 | + |
| 25 | +### Web Interface |
| 26 | + |
| 27 | +Running `penifycli config llm` opens a web interface in your browser where you can configure: |
| 28 | + |
| 29 | +1. **Model**: The LLM model to use (e.g., `gpt-3.5-turbo`) |
| 30 | +2. **API Base URL**: The endpoint URL for your LLM API (e.g., `https://api.openai.com/v1`) |
| 31 | +3. **API Key**: Your authentication key for the LLM API |
| 32 | + |
| 33 | +### Supported LLMs |
| 34 | + |
| 35 | +Penify CLI supports various LLM providers: |
| 36 | + |
| 37 | +#### OpenAI |
| 38 | +- Model: `gpt-3.5-turbo` or `gpt-4` |
| 39 | +- API Base: `https://api.openai.com/v1` |
| 40 | +- API Key: Your OpenAI API key |
| 41 | + |
| 42 | +#### Anthropic |
| 43 | +- Model: `claude-instant-1` or `claude-2` |
| 44 | +- API Base: `https://api.anthropic.com/v1` |
| 45 | +- API Key: Your Anthropic API key |
| 46 | + |
| 47 | +#### Ollama (Local) |
| 48 | +- Model: `llama2` or any model you have installed |
| 49 | +- API Base: `http://localhost:11434` |
| 50 | +- API Key: (leave blank) |
| 51 | + |
| 52 | +#### Azure OpenAI |
| 53 | +- Model: Your deployed model name |
| 54 | +- API Base: Your Azure endpoint |
| 55 | +- API Key: Your Azure API key |
| 56 | + |
| 57 | +### Configuration File Structure |
| 58 | + |
| 59 | +After configuration, your `~/.penify/config.json` will contain: |
| 60 | + |
| 61 | +```json |
| 62 | +{ |
| 63 | + "llm": { |
| 64 | + "model": "gpt-3.5-turbo", |
| 65 | + "api_base": "https://api.openai.com/v1", |
| 66 | + "api_key": "sk-..." |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +## JIRA Configuration |
| 72 | + |
| 73 | +### Web Interface |
| 74 | + |
| 75 | +Running `penifycli config jira` opens a web interface where you can configure: |
| 76 | + |
| 77 | +1. **JIRA URL**: Your JIRA instance URL (e.g., `https://yourcompany.atlassian.net`) |
| 78 | +2. **Username**: Your JIRA username (typically your email) |
| 79 | +3. **API Token**: Your JIRA API token |
| 80 | + |
| 81 | +### Creating a JIRA API Token |
| 82 | + |
| 83 | +1. Log in to [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens) |
| 84 | +2. Click "Create API token" |
| 85 | +3. Give it a name (e.g., "Penify CLI") |
| 86 | +4. Copy the generated token and paste it into the configuration |
| 87 | + |
| 88 | +### Configuration File Structure |
| 89 | + |
| 90 | +After configuration, your `~/.penify/config.json` will contain: |
| 91 | + |
| 92 | +```json |
| 93 | +{ |
| 94 | + "jira": { |
| 95 | + "url": "https://yourcompany.atlassian.net", |
| 96 | + "username": "your.email@example.com", |
| 97 | + "api_token": "your-jira-api-token" |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +## Configuration Locations |
| 103 | + |
| 104 | +Penify CLI looks for configuration in multiple locations: |
| 105 | + |
| 106 | +1. Project-specific: `.penify/config.json` in the Git repository root |
| 107 | +2. User-specific: `~/.penify/config.json` in your home directory |
| 108 | + |
| 109 | +The project-specific configuration takes precedence if both exist. |
| 110 | + |
| 111 | +## Environment Variables |
| 112 | + |
| 113 | +You can override configuration settings using environment variables: |
| 114 | + |
| 115 | +- `PENIFY_API_TOKEN`: Override the stored API token |
| 116 | +- `PENIFY_LLM_MODEL`: Override the configured LLM model |
| 117 | +- `PENIFY_LLM_API_BASE`: Override the configured LLM API base URL |
| 118 | +- `PENIFY_LLM_API_KEY`: Override the configured LLM API key |
| 119 | +- `PENIFY_JIRA_URL`: Override the configured JIRA URL |
| 120 | +- `PENIFY_JIRA_USER`: Override the configured JIRA username |
| 121 | +- `PENIFY_JIRA_TOKEN`: Override the configured JIRA API token |
| 122 | + |
| 123 | +Example: |
| 124 | +```bash |
| 125 | +export PENIFY_LLM_MODEL="gpt-4" |
| 126 | +penifycli commit |
| 127 | +``` |
| 128 | + |
| 129 | +## Command-Line Configuration |
| 130 | + |
| 131 | +For advanced users or scripting, you can directly edit the configuration file: |
| 132 | + |
| 133 | +```bash |
| 134 | +# View current configuration |
| 135 | +cat ~/.penify/config.json |
| 136 | + |
| 137 | +# Edit configuration with your preferred editor |
| 138 | +nano ~/.penify/config.json |
| 139 | +``` |
| 140 | + |
| 141 | +## Sharing Configuration |
| 142 | + |
| 143 | +You can share configuration between machines by copying the `.penify/config.json` file. However, be cautious with API keys and credentials. |
| 144 | + |
| 145 | +For team settings, consider: |
| 146 | +1. Using a project-specific `.penify/config.json` with shared settings |
| 147 | +2. Excluding API keys from shared configuration |
| 148 | +3. Using environment variables for sensitive credentials |
| 149 | + |
| 150 | +## Troubleshooting |
| 151 | + |
| 152 | +### Common Issues |
| 153 | + |
| 154 | +1. **"Error reading configuration file"** |
| 155 | + - Check if the file exists: `ls -la ~/.penify` |
| 156 | + - Ensure it contains valid JSON: `cat ~/.penify/config.json` |
| 157 | + |
| 158 | +2. **"Failed to connect to LLM API"** |
| 159 | + - Verify API base URL and API key |
| 160 | + - Check network connectivity to the API endpoint |
| 161 | + - Ensure your account has access to the specified model |
| 162 | + |
| 163 | +3. **"Failed to connect to JIRA"** |
| 164 | + - Check JIRA URL format (should include `https://`) |
| 165 | + - Verify username and API token |
| 166 | + - Ensure your JIRA account has API access permissions |
0 commit comments