Summary
Allow llm-commit to use environment variables for setting default values for command-line flags.
Expected Benefits:
- Reduces the need to repeatedly specify options for frequent users.
- Provides a flexible mechanism for customizing
llm-commit behavior.
- Ensures compatibility with existing workflows by preserving explicit command-line argument precedence.
Problem statement
Currently, every execution of llm commit requires specifying command-line arguments for options such as model selection, token limits, temperature settings, and truncation behavior. This can be cumbersome, especially for users who consistently use the same settings.
While a previous update introduced LLM_COMMIT_STYLE for defining a default commit style, a broader mechanism for setting defaults via environment variables is still missing.
Proposed solution
Introduce support for environment variables corresponding to existing command-line flags. If an environment variable is set, it will be used as the default value unless overridden by an explicit command-line argument.
Environment Variables to Support:
LLM_COMMIT_MODEL → Default model (--model)
LLM_COMMIT_MAX_TOKENS → Default max tokens (--max-tokens)
LLM_COMMIT_TEMPERATURE → Default temperature (--temperature)
LLM_COMMIT_TRUNCATION_LIMIT → Default truncation limit (--truncation-limit)
LLM_COMMIT_NO_TRUNCATION → Disable truncation (--no-truncation)
LLM_COMMIT_HINT → Default hint (--hint)
Priority Rule
- Command-line arguments always override environment variable values.
- If no environment variable is set, fall back to tool defaults.
Example Usage:
# Set defaults in shell profile (e.g., .bashrc, .zshrc) or in current directory with direnv (.env)
export LLM_COMMIT_MODEL="4o"
export LLM_COMMIT_MAX_TOKENS=1000
export LLM_COMMIT_TEMPERATURE=0.95
export LLM_COMMIT_HINT="We are working on data-science related projects."
# Running without command-line flags uses these defaults
llm commit
# Override behavior using flags
llm commit --model "gpt-3.5-turbo" --temperature 0.9
Summary
Allow
llm-committo use environment variables for setting default values for command-line flags.Expected Benefits:
llm-commitbehavior.Problem statement
Currently, every execution of
llm commitrequires specifying command-line arguments for options such as model selection, token limits, temperature settings, and truncation behavior. This can be cumbersome, especially for users who consistently use the same settings.While a previous update introduced
LLM_COMMIT_STYLEfor defining a default commit style, a broader mechanism for setting defaults via environment variables is still missing.Proposed solution
Introduce support for environment variables corresponding to existing command-line flags. If an environment variable is set, it will be used as the default value unless overridden by an explicit command-line argument.
Environment Variables to Support:
LLM_COMMIT_MODEL→ Default model (--model)LLM_COMMIT_MAX_TOKENS→ Default max tokens (--max-tokens)LLM_COMMIT_TEMPERATURE→ Default temperature (--temperature)LLM_COMMIT_TRUNCATION_LIMIT→ Default truncation limit (--truncation-limit)LLM_COMMIT_NO_TRUNCATION→ Disable truncation (--no-truncation)LLM_COMMIT_HINT→ Default hint (--hint)Priority Rule
Example Usage: