Skip to main content
Glama
README.md
<h1 align="center">gitea-pulse</h1>

1. **A CI job fails, and you hit re-run** without knowing whether it's your change or a flaky test.
2. **Your pipeline gets slower** a few seconds at a time, and nobody notices until it takes twenty minutes.
3. **The same error breaks builds** across repos and branches, and you fix it from scratch each time.
4. **Jobs sit in the queue** and you can't tell if you need another runner.

**gitea-pulse answers all of them for your own Gitea Actions.** It pulls your run, job and step history from the Gitea API into a small local SQLite file, and tells you which jobs are flaky, which steps are getting slower, what your failures have in common, and how busy your runners are.

<p align="center">
  <a href="https://www.npmjs.com/package/gitea-pulse"><img src="https://img.shields.io/npm/v/gitea-pulse" alt="npm"></a>
  <a href="https://github.com/racstan/gitea-pulse/actions/workflows/test.yml"><img src="https://github.com/racstan/gitea-pulse/actions/workflows/test.yml/badge.svg" alt="Test"></a>
  <img src="https://img.shields.io/node/v/gitea-pulse" alt="Node.js version">
  <a href="#use-it-from-an-ai-agent-mcp"><img src="https://img.shields.io/badge/MCP-server-8A2BE2" alt="MCP server"></a>
  <a href="LICENSE.md"><img src="https://img.shields.io/badge/license-PolyForm%20Noncommercial%201.0.0-blue" alt="License: PolyForm Noncommercial 1.0.0"></a>
</p>

<p align="center"><b>Free for personal use.</b> Using it in a business, or selling, hosting or building a product on it, needs a license from the author, which may come with a fee that we agree on together: <a href="https://github.com/racstan/gitea-pulse/issues/new?template=commercial_license.yml">ask for one</a>.</p>

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/dashboard.gif" alt="The gitea-pulse dashboard: pick a repository, then scroll through the steps that fail most, failure groups, runner time lost, runner usage and flaky jobs" width="900"></p>

## What it tells you

| Question | What gitea-pulse shows |
| --- | --- |
| Is this failure my change or a flaky test? | **Flaky jobs**: jobs that failed and then passed on the same commit, with how often and when last. |
| Have we seen this error before? | **Failure groups**: failed jobs grouped by their error lines, across repos and branches, most common first. |
| Which step breaks most? | **Steps that fail most**: the first step to fail in each failed job, against how often it ran, with its top cause. |
| What got slower? | **Slowest jobs and steps**: median and 95th percentile, and the last 14 days against the 14 days before. |
| How healthy is a repo? | **Pass rate** per repo, branch and workflow, and **red spells**: how often and how long the default branch stayed red. |
| What do failures cost us? | **Runner time lost** to failed jobs and to attempts a re-run replaced. |
| Do we need another runner? | **Queue wait** (created to started) and **runner usage**: busy time, job time and the most jobs at once. |

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/overview.png" alt="CI overview across three repositories: runs, pass rate, failed and flaky jobs, queue wait, runners, runner time lost and the default branch" width="900"></p>

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/failures.png" alt="Steps that fail most, with their top cause, and failure groups with the error lines they share" width="900"></p>

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/runners.png" alt="Runner time lost per job, and runner usage per runner" width="900"></p>

<sub>The pictures and the demo video show made-up sample history (`demo/web-shop`, `demo/api`, `demo/docs-site`), made by `scripts/demo.mjs`.</sub>

## Three ways to use it

- **CLI:** `gitea-pulse sync` pulls history; `gitea-pulse report` prints flaky jobs, slowest jobs and steps with their trend, top failure causes, the steps that fail most, pass rate per repo, branch and workflow, how long the default branch stayed red, runner time lost to failures and re-runs, queue wait and runner load.
- **Local dashboard:** `gitea-pulse serve` shows charts per repo, failure groups, the steps that fail most, red spells, time lost and runner usage in your browser.
- **MCP server:** `gitea-pulse mcp` lets an AI agent ask "why did run X fail?" or "is job Y flaky?" before it re-runs CI. See [Use it from an AI agent](#use-it-from-an-ai-agent-mcp).

## Getting started

You need Node.js 22.13 or later (gitea-pulse uses Node's built-in SQLite, so there's nothing native to compile) and a Gitea access token that can read your repositories.

```sh
export GITEA_URL=http://localhost:3000
export GITEA_TOKEN=...            # a token with read access to repositories
npx gitea-pulse sync              # every repository the token can see; stores history in ./gitea-pulse.sqlite
npx gitea-pulse report            # flaky jobs, slow steps, failure causes, pass rates, queue wait, runner load
npx gitea-pulse serve             # the same as a local web page at http://127.0.0.1:41873/
```

Useful options (see `gitea-pulse --help`):

```sh
npx gitea-pulse sync --repo owner/name        # one repository
npx gitea-pulse report --repo owner/name --since 30d --limit 5
npx gitea-pulse report --json                 # the same data for scripts
npx gitea-pulse report --db other.sqlite      # use another database file
npx gitea-pulse serve --port 5000             # dashboard on another port
```

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/cli.gif" alt="gitea-pulse sync pulling three repositories, then gitea-pulse report printing flaky jobs, slowest jobs and steps, failure causes and the steps that fail most" width="800"></p>

The dashboard comes in light and dark, following your system or the choice in its top bar:

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/light.png" alt="The dashboard in light mode for one repository over the last 30 days" width="900"></p>

The dashboard only listens on your own computer (127.0.0.1) unless you pass `--host`; it has no login, so don't expose it to a network you don't trust. Pick a repository and a time range at the top; the address keeps them, so you can bookmark a view.

The first sync reads all history (a few hundred runs take about a minute; requests are spaced out on purpose). After that a sync only fetches what is new, so run it as often as you like, for example from cron. The token is only sent to your Gitea and is never printed.

## Use it from an AI agent (MCP)

`gitea-pulse mcp` is an MCP server on stdio. It reads the same SQLite file as `sync` and `report`, so an agent can check whether a failure is flaky or already known before it hits re-run.

<p align="center"><img src="https://raw.githubusercontent.com/racstan/gitea-pulse/main/docs/media/mcp.gif" alt="An AI agent asks gitea-pulse's run_failure tool about a failed run, gets the failing step, its error lines, how often the same failure was seen and the job's flake record, and decides to re-run" width="900"></p>

**Claude Code:**

```sh
claude mcp add gitea-pulse -e GITEA_URL=http://localhost:3000 -e GITEA_TOKEN=... -- npx -y gitea-pulse mcp --db /absolute/path/gitea-pulse.sqlite
```

**Claude Desktop, Cursor, VS Code, Windsurf and other MCP apps:** add this to the app's MCP settings (`claude_desktop_config.json`, `.cursor/mcp.json`, and so on; VS Code calls the top key `servers`):

```json
{
  "mcpServers": {
    "gitea-pulse": {
      "command": "npx",
      "args": ["-y", "gitea-pulse", "mcp", "--db", "/absolute/path/gitea-pulse.sqlite"],
      "env": { "GITEA_URL": "http://localhost:3000", "GITEA_TOKEN": "..." }
    }
  }
}
```

gitea-pulse is also listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/) as `io.github.racstan/gitea-pulse`.

Use an absolute `--db` path (the agent's working folder is not yours). The file is created if missing, and the agent can fill it with `sync_repo`. The token is only read from the environment and never printed.

Tools:

- `run_failure`: why a run failed (failed jobs and steps, error lines, seen elsewhere, flaky?). Takes a run number or a run URL.
- `job_flakiness`: is a job flaky, with its last flakes.
- `slowest`: slowest jobs and steps with p50, p95 and trend.
- `failure_groups`: the steps that fail most and the most common failure causes.
- `pass_rate`: pass rate per repo, whether the default branch is red and how long it stayed red, weakest branches and workflows.
- `time_lost`: runner time spent on failed jobs and on attempts a re-run replaced.
- `repos`: stored repositories, run counts and last sync.
- `sync_repo`: pull the latest runs of one repo so answers are fresh.

Try asking: "Why did run 262 in demo/app fail? Should I re-run it?", "Is the Embedder job flaky?", "What are the three most common CI failures this month?", "What got slower in demo/app?"

## How it works

- **Flaky jobs:** the same commit and job failed and then passed, on a re-run or a later attempt. Jobs are scored by how often that happens.
- **Failure causes:** for failed jobs only, the error lines before the failure are cleaned of paths, numbers and timestamps into a signature, and failures are grouped by it.
- **Slowness:** median and 95th-percentile time per job and step, over time. The trend compares the median of the last 14 days with the 14 days before, and is shown only when each has at least 5 runs. Queue wait is the time from a job being created to it starting.
- **Steps that fail most:** the first step to fail in each failed job, counted against how often the step ran.
- **Red spells:** on each repo's default branch, from the first failed run to the end of the next passing one; count, median, longest, and whether it is red now.
- **Time lost:** runner time on failed jobs plus every job of an attempt that a re-run replaced.
- **Runner usage:** busy time is wall-clock time with at least one job running, so jobs running side by side count once; job time adds them all up.
- **Sync is incremental:** it remembers how far it got per repository and stays well under the API's rate limits.

## Support

If gitea-pulse saves you time, you can support it through [GitHub Sponsors](https://github.com/sponsors/racstan) or [Buy Me a Coffee](https://buymeacoffee.com/rachitasthana).

## License

[PolyForm Noncommercial 1.0.0](LICENSE.md). Free for personal and other noncommercial use; for anything else, [ask for a commercial license](https://github.com/racstan/gitea-pulse/issues/new?template=commercial_license.yml).