Skip to main content

โš™๏ธ Configuration โ€” Early CLI

The Early CLI (@earlyai/cli) mirrors GitHub Action options but is CI-agnostic.
Use it in Jenkins, CircleCI, GitLab, Bitbucket, or locally.


๐Ÿ”‘ Required Inputsโ€‹

VariableCLI FlagDescriptionRequiredDefault
API_KEY-k, --api-keyEarly API keyโœ… Yesโ€“
TOKEN-t, --tokenGitHub token with PR accessโœ… Yesโ€“
PR_NUMBER--pr-numberPR numberโœ… Yesโ€“
HEAD_REF--head-refPR branchโœ… Yesโ€“

For tokens and permissions, see:


โš™๏ธ Optional Inputsโ€‹

VariableCLI FlagDescriptionDefault
TEST_STRUCTURE-s, --test-structurerootFolder or siblingFoldersiblingFolder
TEST_FRAMEWORK-f, --test-frameworkjest, mocha (planned), vitest (planned)jest
TEST_FILE_SUFFIX--test-suffixspec or testtest
TEST_FILE_NAMING--test-file-namingcamelCase or kebabCasecamelCase
MAX_CONCURRENCY-c, --max-concurrencyNumber of concurrent workers (1โ€“4)4
AUTO_COMMIT--auto-committrue or falsetrue
TEST_COMMAND--test-commandCommand to validate generated testsSee Agent Jest Commands โ†’
COVERAGE_COMMAND--coverage-commandCommand to collect coverageSee Agent Jest Commands โ†’
CONTINUE-ON_TEST_ERRORS--continue-on-test-errorscontinue the operation if current tests fail.See Agent Jest Commands - tests fail โ†’
LINT_COMMAND--lint-commandLinting command. See Lint & Formatnpx --no eslint $early_filename --fix
PRETTIER_COMMAND--prettier-commandPrettier formatting command. See Lint & Formatnpx --no prettier $early_filename --write
GIT_ORG--git-orgGitHub org or usernameโ€“
GIT_REPO--git-repoGitHub repo nameโ€“
GIT_USER_EMAIL--git-user-emailGit commit author emailโ€“
GIT_USER_NAME--git-user-nameGit commit author nameโ€“
SCM_PROVIDER--scm-providergithub (default), bitbucket, etc.github

โš ๏ธ When using MAX_CONCURRENCY=4, set:

export NODE_OPTIONS="--max-old-space-size=5120"

See - Concurrency & Performance


๐Ÿงน Lint & Format Commandsโ€‹

Define these if your repo uses lint-staged, Husky, or CI linting.

LINT_COMMAND="npx --no eslint $early_filename --fix"
PRETTIER_COMMAND="npx --no prettier $early_filename --write"

See - Linting & Formatting


๐Ÿง  Memory & Concurrencyโ€‹

Default: MAX_CONCURRENCY=4

If your runner crashes:

export NODE_OPTIONS="--max-old-space-size=5120"

To reduce memory:

export MAX_CONCURRENCY=2

Do not exceed --max-old-space-size=6000 on standard runners. See Memory Tuning


๐Ÿงช Example: Local Executionโ€‹

export API_KEY=sk-abc123
export TOKEN=ghp-xyz456
export PR_NUMBER=14
export HEAD_REF=feature/refactor
export BASE_REF=main
export GIT_HOST=github.com
export GIT_ORG=earlyai
export GIT_REPO=backend
export SCM_PROVIDER=github
export AUTO_COMMIT=true
export TEST_FRAMEWORK=jest
export MAX_CONCURRENCY=4
export NODE_OPTIONS="--max-old-space-size=5120"
export LINT_COMMAND="npx --no eslint $early_filename --fix"
export PRETTIER_COMMAND="npx --no prettier $early_filename --write"

early generate-pr

โœ… Exit Codesโ€‹

CodeMeaning
0Success
1Configuration/environment error
2Generation error
3Commit/push failure

๐Ÿ‘‰ Next: Troubleshooting โ†’