@earlyai/cli 2.8.1 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +62 -0
  2. package/dist/index.cjs +176 -162
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # @earlyai/cli
2
+
3
+ AI-powered CLI tool that generates unit tests for TypeScript/JavaScript codebases.
4
+
5
+ ## Commands
6
+
7
+ ### `gather-stats`
8
+
9
+ Gathers adoption statistics for EarlyAI-generated test files in merged PRs. Analyzes which `.early.test.*` files were added, modified, or deleted, and reports adoption metrics to the EarlyAI backend.
10
+
11
+ **Alias:** `stats`
12
+
13
+ ```bash
14
+ early gather-stats [options]
15
+ ```
16
+
17
+ #### Options
18
+
19
+ | Option | Env Var | Default | Description |
20
+ |---|---|---|---|
21
+ | `--api-key <key>` | `API_KEY` | — | EarlyAI API key (required) |
22
+ | `--token <token>` | `TOKEN` | — | GitHub/Bitbucket token (required) |
23
+ | `--git-org <org>` | `GIT_ORG` | auto-detected | Git organization name |
24
+ | `--git-repo <repo>` | `GIT_REPO` | auto-detected | Git repository name |
25
+ | `--scm-provider <provider>` | `SCM_PROVIDER` | `github` | SCM provider (`github` or `bitbucket`) |
26
+ | `--ref-name <ref>` | `REF_NAME` | — | Head branch name (required) |
27
+ | `--backfill [value]` | `BACKFILL` | `false` | Ignore last run timestamp and reprocess recent PRs |
28
+ | `--max-prs <number>` | `MAX_PRS` | `5` | Maximum PRs to process on first run or backfill |
29
+ | `--pr-number <number>` | `PR_NUMBER` | — | Process a single PR by number |
30
+ | `--summary-only [value]` | `SUMMARY_ONLY` | `true` | Report only the adoption summary per PR. When `false`, also includes per-file details (file paths, change types) and per-commit breakdowns |
31
+
32
+ #### How it works
33
+
34
+ **Incremental by default.** On each run, gather-stats records a timestamp. The next run only processes PRs merged after that timestamp — no cap on how many.
35
+
36
+ **First run.** When no previous run exists, there is no timestamp to start from. Instead, it processes the most recent merged PRs up to `--max-prs` (default: 5).
37
+
38
+ **Backfill mode (`--backfill`).** Resets the "since" timestamp and reprocesses the most recent merged PRs up to `--max-prs`. Use this to reprocess PRs that were missed or to refresh data after a bug fix.
39
+
40
+ **Single PR mode (`--pr-number`).** Fetches and processes only the specified PR. Bypasses the timestamp check, `--backfill`, and `--max-prs`. Use this to refresh data for a specific PR.
41
+
42
+ **What gets reported.** A merged PR is included in the report if:
43
+ 1. Its diff contains `.early.test.*` files (added, modified, or deleted), OR
44
+ 2. Any of its commits contain `.early.test.*` files, OR
45
+ 3. It has an EarlyAI workflow run (Early ran on it, even if no test files were committed)
46
+
47
+ PRs with no EarlyAI involvement are skipped.
48
+
49
+ **Summary-only mode (`--summary-only`, default: `true`).** By default, only the adoption summary is reported for each PR (how many tests were added, modified, deleted, or unchanged). This creates a single SUMMARY record per PR on the backend. Set `--summary-only false` to also include per-file details (file paths, change types) and per-commit breakdowns — useful for debugging or detailed auditing.
50
+
51
+ #### Examples
52
+
53
+ ```bash
54
+ # Normal incremental run
55
+ early gather-stats --api-key $KEY --token $TOKEN --ref-name master
56
+
57
+ # First run or backfill with more PRs
58
+ early gather-stats --api-key $KEY --token $TOKEN --ref-name master --backfill --max-prs 50
59
+
60
+ # Refresh data for a specific PR
61
+ early gather-stats --api-key $KEY --token $TOKEN --ref-name master --pr-number 1419
62
+ ```