Metadata-Version: 2.4
Name: github-repository-report
Version: 0.0.7
Summary: Generate timestamp reports for local GitHub repositories.
Author: Kaizten Analytics
License-Expression: LicenseRef-Proprietary
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# github-repository-report

Generate timestamp reports for local GitHub repositories and include command
output from each repository.

## Requirements

- Python 3
- GitHub CLI (`gh`) installed

The script only checks that `gh` exists. It does not call GitHub for the
timestamp report.

## Usage

```bash
github-repository-report
```

Without repository arguments, the CLI scans your home directory for local Git
repositories with GitHub remotes, prints the discovered repositories, and asks
which reports to generate. You can enter a single number, a comma-separated
list, a range, or `all`. The end-to-end script uses the `development` Docker
Compose profile automatically.

Generate a report for a specific discovered local repository:

```bash
github-repository-report --organization=kaizten --repository=tools
```

The command scans `--root` and automatically selects the matching local
checkout.

Useful options:

```bash
github-repository-report --root=~/workspace --output-dir=~/.github-repository-report --commit-days=30 --open
```

`--open` opens each generated HTML report in the default browser after it is
complete.

Each selected local repository is reported after running:

```bash
./sheriff.sh
```

After the Sheriff summary, the report also runs:

```bash
docker run -v <repository-path>:/data --env GITHUB_TOKEN kaizten/sheriff:latest repository --components
```

Its JSON response is rendered as a subsection for each component, with a menu
link and the component's name, hash, timestamp, file and folder counts, and
content types.

For each component, the report also invokes Sheriff `metrics` with that
component and the Docker-mounted repository URI (`file:///data/`). Sheriff’s
default metric options are used, and the JSON response is rendered as a
Metric/Value table in the component subsection. Metrics use `GITHUB_TOKEN` when
set, or fall back to the token from `gh auth token`.

If the repository contains `run-e2e.sh`, the report also runs:

```bash
./run-e2e.sh development
```

The script is invoked with the `development` profile.

The standalone HTML report has a menu for Summary, Errors, Components, Commits,
and End-to-End sections. It includes command, exit code, and combined output for
each command. The Errors section renders Sheriff summary rows as an HTML table
with context, component, test, error and warning counts, last modified time,
elapsed time, and status, plus total errors and warnings. If the summary cannot be parsed, the report shows a
concise error instead of the raw summary output. If `run-e2e.sh` is not found, the
report records that it was skipped. It also includes commits from the last 14
days by default, with each commit's short hash, timestamp, author name, subject,
and counts for files added, deleted, and changed. Commit hashes link to GitHub,
subjects are limited to 50 characters in the table, and the commits section
summarizes commit counts by GitHub user. Use `--commit-days` to choose a
different number of days.

The Commits section includes an inline daily activity plot and a per-user plot
for the same `--commit-days` window. The per-user plot groups each user’s
color-coded bars by date and shows zero-commit dates.

The report requests the Sheriff summary first. For each component, test, and
URI listed in that summary, it makes a separate Docker plot request with one
`--component`, `--test`, and `--uri` value. Each PNG is saved beside the HTML
report and embedded in that component's subsection. The Errors section presents
the summary results in a table.

Reports are written to:

```text
~/.github-repository-report/<owner>/<repository>/<owner>_<repository>_<timestamp>.html
```

## Development

```bash
python3 -m unittest discover -s . -p 'test_*.py'
npm pack --dry-run
```

## Publish

```bash
npm run publish:npm -- --dry-run
npm run publish:npm
```
