โ Frequently Asked Questions โ Repo CLI
This page covers common questions about using the early generate-for-project command to generate tests across an entire folder or file.
๐ Which languages are supported?โ
The Repo CLI supports:
- JavaScript and TypeScript โ Jest, Mocha, and other frameworks
- Python โ pytest (auto-detected)
The CLI automatically detects the project language from file extensions and project markers (e.g., package.json for JS/TS, pyproject.toml or requirements.txt for Python).
๐ How does the CLI know if my project is Python?โ
The CLI auto-detects the language by inspecting the --target-directory:
- If the target is a
.pyfile, it's treated as Python - If the target folder contains Python project markers (
pyproject.toml,setup.py,setup.cfg,requirements.txt), it's treated as Python - If the folder contains
.pyfiles, it's treated as Python
No --language flag is needed.
๐ Where do I get my API key?โ
Contact support@startearly.ai to obtain your API key. Store it securely in your CI system (e.g., EARLY_API_KEY in GitHub Actions or Jenkins).
See: Central FAQ โ
๐ What tokens are required?โ
You need:
TOKENfor Git access (reading files, committing, commenting)
Details and permissions: Token Guide โ FAQ reference: Central FAQ SCM โ and Central FAQ SCM โ
๐งช Do I need to configure coverage myself?โ
- JavaScript / TypeScript
- Python
No. The CLI runs your test framework (e.g., Jest) to collect coverage.
You can customize the command via --coverage-command and --test-command.
See: Optional inputs โ
No coverage configuration is needed for Python. The agent generates tests directly by analyzing your source code โ it identifies testable functions and class methods without requiring a coverage run.
๐ฆ Can I use this in Jenkins or other CI/CD?โ
Yes โ the CLI supports GitHub Actions, Jenkins, CircleCI, GitLab, and more.
See CI examples Integration Guide - GitHub example โ and Jenkins example โ
๐ Where are test files placed?โ
- JavaScript / TypeScript
- Python
You control this via --test-structure:
siblingFolderโ next to sourcerootFolderโ inside roottests/folder
Test files are placed in .early.test/ sibling folders next to the source file:
src/
utils/
helpers.py
helpers.early.test/
test_my_function_early.py
test_another_function_early.py
Each testable function gets its own test file.
๐งช Can I run this manually?โ
- JavaScript / TypeScript
- Python
Yes โ you can run it locally or via npx:
npx @earlyai/cli generate-folder \
--folder ./src \
--ref-name main \
--token $TOKEN \
--api-key $API_KEY
Your machine needs to be configured to work with git and your SCM.
Yes โ install the CLI and py-agent, then run:
npm install -g @earlyai/cli
pip install py-agent
early generate-for-project \
--api-key $API_KEY \
--token $TOKEN \
--target-directory ./src \
--ref-name main
๐งน What about Prettier or ESLint?โ
Note: This applies to JavaScript/TypeScript projects only. Python does not yet support lint/format hooks.
Define:
LINT_COMMAND="npx --no eslint $early_filename --fix"
PRETTIER_COMMAND="npx --no prettier $early_filename --write"
Reference: Central FAQ - Lint Formatting โ
๐งต How is this different from generate-pr or generate-commit?โ
| Command | Use Case | Requires PR Context | Typical Use |
|---|---|---|---|
generate-pr | Per-pull-request generation | โ Yes | GitHub PRs |
generate-commit | For single commits | โ No | GitHub push, Jenkins |
generate-for-project | Repo folder-based generation | โ No | Coverage campaigns |
Compare: When to Use Which Agent โ
๐ Still need help?โ
- Email us: support@startearly.ai
- View the Central FAQ โ