⚙️ Configuration Options — early generate-commit
The early generate-commit command supports customization via CLI flags or environment variables. This page covers the required and optional settings for commit-based workflows.
🔑 Required Inputs
| Variable | Command Line Flag | Description | Required | Default |
|---|---|---|---|---|
| API_KEY | -k, --api-key | Early AI API key. See API Key Setup | ✅ Yes | – |
| TOKEN | -t, --token | Source control token. See Token Requirements | ✅ Yes | – |
| REF_NAME | --ref-name | The branch name of the commit. | ✅ Yes | – |
| COMMIT_HASH | --commit-hash | The SHA of the commit to analyze. | ✅ Yes | – |
| NODE_OPTIONS | (env only) | Node memory setting. See Memory Tuning | ⚠️ Optional | --max-old-space-size=5120 |
⚙️ Optional Inputs
| Variable | Flag | Description | Default |
|---|---|---|---|
| TEST_STRUCTURE | -s, --test-structure | Folder structure: siblingFolder or rootFolder. | siblingFolder |
| TEST_FRAMEWORK | -f, --test-framework | Test framework: jest, mocha, etc. | jest |
| TEST_FILE_SUFFIX | --test-suffix | Test file suffix (e.g. test, spec). | test |
| TEST_FILE_NAMING | --test-file-naming | Naming style: camelCase, snake_case, kebab-case. | camelCase |
| CHANGED_METHODS_ONLY | --changed-methods-only | Generate tests for changed code only. See Changed methods only | true |
| MAX_TESTABLES | --max-testables | MAX number of methods to generate tests for. See MAX testables | 5 |
| SKIP_COVERAGE_AFTER | --skip-coverage-after | Skip calculating coverage after test generation. See Skip coverage after | false |
| MAX_CONCURRENCY | -c, --max-concurrency | Parallel workers (1–4). See Concurrency Guide | 1 |
| AUTO_COMMIT | --auto-commit | Commit generated files: true or false. | true |
| TEST_COMMAND | --test-command | Custom test run command. | See Agent Jest Commands → |
| COVERAGE_COMMAND | --coverage-command | Custom coverage collection command. | See Agent Jest Commands → |
| CONTINUE-ON_TEST_ERRORS | --continue-on-test-errors | continue the operation if current tests fail. | See Agent Jest Commands - tests fail → |
| LINT_COMMAND | --lint-command | Linting command. See Lint & Format | npx --no eslint $early_filename --fix |
| PRETTIER_COMMAND | --prettier-command | Prettier formatting command. See Lint & Format | npx --no prettier $early_filename --write |
| GIT_USER_EMAIL | --git-user-email | Git email for commits. | 217573370+Early-Agent[bot]@users.noreply.github.com |
| GIT_USER_NAME | --git-user-name | Git name for commits. | – |
| SCM_PROVIDER | --scm-provider | github, bitbucket, etc. See SCM Support | github |
💡 Example: Full CLI Invocation
early generate-commit \
--commit-hash abcd1234 \
--ref-name main \
--test-framework mocha \
--test-structure __tests__ \
--test-suffix spec \
--test-file-naming kebab-case \
--max-concurrency 1 \
--auto-commit false \
--test-command "npm run test" \
--coverage-command "npm run coverage" \
--lint-command "npm run lint" \
--prettier-command "npm run format" \
--git-org earlyai \
--git-repo pull-request-test-generation \
--git-user-email ci@earlyai.com \
--git-user-name "Early Bot" \
--scm-provider github
🔐 Token Requirements
- ✅ Use a classic PAT with
reposcope (recommended) - 🟡 Fine-Grained PATs require Contents, Pull Requests, and Metadata (Read/Write)
✅ Best Practices
- Set environment variables in CI to reduce CLI verbosity
- Use
NODE_OPTIONS="--max-old-space-size=5120"if concurrency is 3+ - Include lint and format commands for clean commits
- Configure SCM provider explicitly if not using GitHub