# ed code-stats

> ed code-stats drives the Code Stats ability, the same one the Code Stats settings and page use.

- Canonical URL: https://getedith.pro/docs/cli/code-stats
- Updated: 2026-12-02

`ed code-stats` drives the Code Stats ability, the same one the Code Stats settings and page use. Edith mirrors every GitHub repository you can reach into a folder you choose, counts the commits that are yours across all of them, and keeps a report of commits, lines, streaks, languages and habits. The background agent owns the mirror and the report, so the status, run, cancel, report, export, authors and audit commands need Edith or Edith's background services running. The folder, schedule and identity commands write the shared settings directly.

[The `ed` command line](https://getedith.pro/docs/cli)

| Command | What it does |
| --- | --- |
| [`ed code-stats status`](https://getedith.pro/docs/cli/code-stats/status) | Shows the folder, schedule, last refresh and live progress. |
| [`ed code-stats run`](https://getedith.pro/docs/cli/code-stats/run) | Refreshes the mirror and recounts your commits. |
| [`ed code-stats cancel`](https://getedith.pro/docs/cli/code-stats/cancel) | Cancels the refresh in progress. |
| [`ed code-stats report`](https://getedith.pro/docs/cli/code-stats/report) | Prints the report for 30 days, 90 days, a year or all time. |
| [`ed code-stats folder`](https://getedith.pro/docs/cli/code-stats/folder) | Chooses the folder that holds the mirror. |
| [`ed code-stats schedule`](https://getedith.pro/docs/cli/code-stats/schedule) | Chooses a manual, hourly, daily or weekly refresh. |
| [`ed code-stats identity`](https://getedith.pro/docs/cli/code-stats/identity) | Lists, adds and removes the identities counted as you. |
| [`ed code-stats authors`](https://getedith.pro/docs/cli/code-stats/authors) | Lists the commit authors found in the mirror. |
| [`ed code-stats audit`](https://getedith.pro/docs/cli/code-stats/audit) | Explains what was counted and what was excluded, and why. |
| [`ed code-stats export`](https://getedith.pro/docs/cli/code-stats/export) | Renders the totals as PNG cards you can share, with no repository names. |

`status` is the default, so a bare `ed code-stats` shows the status. `identity` defaults to `identity list`.

## How it works

- Repositories are listed with the GitHub CLI (`gh`), so run `gh auth login` once for each account. Every account signed in to `gh` is counted, not just the active one, except the logins listed in `codeStatsExcludedAccounts` (the account checkboxes in Code Stats settings). Without `gh` the agent still analyses whatever is already in the folder.
- New repositories are cloned bare into `<folder>/<owner>/<repo>.git` and existing ones are fetched. Clones made by other tools as `<folder>/<owner>/<repo>/.git` are read as they are. Nothing in the folder is ever deleted.
- Results and the per-repository cache live in Edith's own data folder, not in the mirror, so the last report stays readable while an external drive is unplugged.
- A folder on an external drive under `/Volumes` is remembered while the drive is away. A scheduled refresh that comes due then waits for the drive, and runs once when it returns. The schedule counts from the first refresh you start, even one that the drive cut short.
- Forks are skipped and archived repositories are included unless you change `codeStatsIncludeForks` or `codeStatsIncludeArchived` with `ed config set`.

## Exit codes

| Code | When |
| --- | --- |
| 0 | the command completed |
| 2 | a range, schedule, interval, hour or weekday was not valid |
| 3 | the folder does not exist, an identity to remove is not listed, or no report exists yet |
| 4 | the background agent is not running |

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
