โ๏ธ Configuration โ early generate-for-project
The early generate-for-project CLI command lets you boost coverage across a selected folder or file.
It accepts configuration via CLI flags or environment variables.
For memory, tokens, formatting, or concurrency guidance, refer to:
๐ Required Inputsโ
| Variable | CLI Flag | Description | Required | Default |
|---|---|---|---|---|
| API_KEY | -k, --api-key | Early API key | โ Yes | โ |
| TOKEN | -t, --token | SCM token with repo write access | โ Yes | โ |
| TARGET_DIRECTORY | --target-directory | directory or file to scan for untested code | โ Yes | โ |
| REF_NAME | --ref-name | Git branch name for commit | โ Yes | โ |
โ๏ธ Optional Inputsโ
| Variable | CLI 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 |
| MAX_CONCURRENCY | -c, --max-concurrency | Parallel workers (1โ4). See Concurrency Guide | 4 |
| AUTO_COMMIT | --auto-commit | Commit generated files: true or false. | true |
| TEST_COMMAND | --test-command | Validate tests via custom command | See Agent Jest Commands โ |
| COVERAGE_COMMAND | --coverage-command | Custom command to collect coverage | 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_ORG | --git-org | GitHub org or username | โ |
| GIT_REPO | --git-repo | GitHub repository name | โ |
| GIT_USER_EMAIL | --git-user-email | Commit author email | 217573370+Early-Agent[bot]@users.noreply.github.com |
| GIT_USER_NAME | --git-user-name | Commit author name | โ |
| SCM_PROVIDER | --scm-provider | github, bitbucket, etc. See SCM Support |
โ ๏ธ If using MAX_CONCURRENCY=4 (default), set NODE_OPTIONS for memory:
export NODE_OPTIONS="--max-old-space-size=5120"
๐งน Recommended Formattingโ
If your repository enforces linting or formatting rules, you should define custom commands to align with them.
See this guide to see the defaults and how to change them if needed Agent Jest Commands โ
๐ก Example: CLI Invocationโ
early generate-for-project \
--api-key <your_api_key> \
--token <your_github_token> \
--target-directory <path_to_file_or_directory> \
--ref-name <branch_name>
โ Best Practiceโ
Prefer environment variables in CI for simplicity and safety.
Avoid logging secrets in plaintext.