Skip to main content

โ“ Frequently Asked Questions โ€” Early CLI

This page covers CLI-specific questions when running early generate-pr.
For shared topics like API keys, token scopes, and permissions, see the Fundamentals FAQ โ†’.


๐Ÿ” What permissions do tokens need?โ€‹

There are two tokens:


1. NPM_TOKEN โ€” for installing the CLIโ€‹

Used with GitHub Packages.
See Install Token โ†’


2. TOKEN โ€” for Git access and committing filesโ€‹

Used to access commit or PR metadata, push commits, and post comments.

See Token Requirements โ†’


๐Ÿ”‘ How do I get my API key?โ€‹

See API Key โ†’


๐Ÿงฑ Which CI/CD systems are supported?โ€‹

Any system with Node.js 20+:

  • Jenkins
  • CircleCI
  • GitLab
  • Bitbucket
  • Self-hosted agents

๐Ÿงช Which test frameworks are supported?โ€‹

  • โœ… Jest (required today)
  • ๐ŸŸก Vitest (coming soon)
  • โšช Mocha (planned)

See Framework Support โ†’


๐Ÿ“ˆ What coverage threshold is used?โ€‹

Currently fixed at 0%.
Only functions with zero coverage will be targeted.


โš™๏ธ How do I handle memory issues?โ€‹

If you hit a heap error:

export MAX_CONCURRENCY=2

Or:

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

See Memory Tuning โ†’


๐Ÿงฉ Can I override the coverage or test commands?โ€‹

Yes. Use these environment variables:

VariablePurpose
COVERAGE_COMMANDRun coverage before/after
TEST_COMMANDRun test validation

Flags like --coverageDirectory and --json must stay intact.
See Configuration โ†’


๐Ÿงพ How does auto-commit work?โ€‹

When AUTO_COMMIT=true:

  • Tests are committed to the branch
  • Only passing, valid tests are committed

To disable:

export AUTO_COMMIT=false

๐Ÿงน What if my repo enforces lint/format rules?โ€‹

Use:

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

These run before test validation and commit. You can customize the command, just leave the placeholders, as-is.

See Linting & Formatting โ†’


๐Ÿงช Can I run this locally?โ€‹

Yes. Example:

export API_KEY=...
export TOKEN=...
export HEAD_REF=my-branch
export AUTO_COMMIT=false

early generate-pr

Make sure your machine is configured to access your SCM.

See CLI Configuration โ†’


๐Ÿงฐ What if no tests are generated?โ€‹

Possible reasons:

  • All changed code is already covered
  • Nothing testable in this PR
  • Coverage failed to collect

โš ๏ธ Why did commit fail?โ€‹

Most likely: the branch changed mid-run and your push was rejected.

Fix:

  • Re-run the CLI

๐Ÿงฉ How does this differ from the GitHub Action?โ€‹

OptionUsage
GitHub ActionPR workflows in GitHub
Early CLIAny CI/CD system

Both produce identical output.


๐Ÿ’ฌ Still need help?โ€‹