Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nya1/bananareporter

An easy to use CLI to generate custom reports in JSON, JSONL, CSV from multiple sources
https://github.com/nya1/bananareporter

cli command-line-tool github gitlab jsonl report report-generator reporting reporting-tool

Last synced: 2 months ago
JSON representation

An easy to use CLI to generate custom reports in JSON, JSONL, CSV from multiple sources

Awesome Lists containing this project

README

        


Banana Reporter Logo


Banana Reporter


Create a report in CSV, JSON and JSONL from multiple sources (GitLab, GitHub, Git local repository and todo.txt)


oclif
Version
Github
Total Downloads
License

* [Features](#features)
* [Quickstart](#quickstart)
* [Usage](#usage)
* [Commands](#commands)

# Features

- **Easy to use**: provide a `--from` and `--to` date range and a config file, all data will be fetched automatically
- **Multiple output formats**: output file can be a JSON, JSONL or CSV (via `--format`) _more coming soon_
- **Configurable**: data to be imported can be filtered using the configuration file and each option can be overridden per source
- **Sources Supported**
- [GitLab](./docs/sources/gitlab.md): commits
- [GitHub](./docs/sources/github.md): commits
- [Git CLI (local repository)](./docs/sources/git-cli.md): commits
- todo.txt: tasks
- **[Request a new source](https://github.com/nya1/bananareporter/issues/new?assignees=&labels=enhancement&template=new-source-request.md&title=)**

## Use cases

- create a PDF work report based on commits and tasks
- get insights on your activity

# Quickstart

0. Install banana reporter CLI `npm i -g bananareporter`

1. Create a config file `bananareporter.yaml` with the sources that you want to fetch

```yaml
sources:
- type: 'gitlab'
committerUsername: usernameOnGitlab
token: glpat-personalaccesstoken
# filters:
# - on: '$project.path_with_namespace'
# regex: '(namespace|anotherone)'
- type: 'github'
committerUsername: usernameOnGithub
# optional, needed for commits on private repositories
token: personalaccesstoken
# filters:
# - on: 'repository.full_name'
# regex: '(namespace|anotherone)'
# - type: 'todo.txt'
# file: './todo.txt'
```

2. Run the reporter with a date range (ISO8601 date)

```sh
bananareporter --from 2023-01-01 --to 2023-03-01 -c bananareporter.yaml
```

In the current directory you will find the output as `bananareporter_$FROM__$TO.json` (can be changed with `--out`)

Example of output (json) with gitlab and github sources:

```json
[
{
"id": "c12ba180bfecf45fcdcc40d6104d1f1b7ad409dc",
"date": "2023-01-13T07:51:21.730Z",
"username": "johndoe",
"description": "chore: update changelog and swagger branch:work git:aa33b04",
"projectId": "3318214",
"projectName": "awesome-frontend",
"type": "gitlab"
},
{
"id": "6e1b66a1dea89e957d8c44943f942be4874c0641",
"date": "2023-01-14T10:50:10.230Z",
"username": "johndoe",
"description": "refactor: compare date function branch:work git:ia1f241",
"projectId": "928544",
"projectName": "awesome-backend",
"type": "github"
}
]
```

# Usage

```sh-session
$ npm install -g bananareporter
$ bananareporter COMMAND
running command...
$ bananareporter (--version)
bananareporter/0.3.0 linux-x64 node-v16.19.0
$ bananareporter --help [COMMAND]
USAGE
$ bananareporter COMMAND
...
```

# Commands

* [`bananareporter help [COMMANDS]`](#bananareporter-help-commands)
* [`bananareporter run`](#bananareporter-run)

## `bananareporter help [COMMANDS]`

Display help for bananareporter.

```
USAGE
$ bananareporter help [COMMANDS] [-n]

ARGUMENTS
COMMANDS Command to show help for.

FLAGS
-n, --nested-commands Include all nested commands in the output.

DESCRIPTION
Display help for bananareporter.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.8/src/commands/help.ts)_

## `bananareporter run`

Run report

```
USAGE
$ bananareporter run -o --format json|jsonl|csv [-c ] [--to --from ]
[--delay ] [--include-raw-object]

FLAGS
-c, --config= config file location, by default ~/.config/bananareporter/config.yaml
-o, --out= (required) [default: ./bananareporter.json] file path to save the output
--delay= [default: 300] global delay in millisecons between http requests
--format= (required) [default: json] output file format

--from=2023-03-01 from date (ISO8601)
--include-raw-object include raw object in json/jsonl reporter output
--to=2023-03-31 to date (ISO8601)

DESCRIPTION
Run report

EXAMPLES
$ banana-reporter run --from 2023-01-01 --to 2023-01-31
report with 138 entries saved to ./bananareporter.json
```

_See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.3.0/dist/commands/run/index.ts)_