[
    {
        "warning": "The [main documentation](https://github.com/bakhirev/assayo/blob/main/documents/RU.md) is in russian. This is a translation. It may contain errors. If you a native speaker, you can help improve this translation. Thanks!"
    },
    {
        "p": "Visualization and analysis of git commit statistics. Performance tool for Team Lead and IT-audit"
    },
    {
        "p": "**Links:** [demo](https://bakhirev.github.io/demo/?dump=./test.txt), [online version](https://bakhirev.github.io/demo/?ref=github), [docker](https://hub.docker.com/r/bakhirev/assayo), [reddit](https://www.reddit.com/r/ITManagers/comments/1e5k291/the_visualization_and_analysis_of_git_commit/), [habr](https://habr.com/ru/articles/852782/)."
    },
    {
        "p": "**Video:** [english](https://www.youtube.com/watch?v=uMbhrrd25t4), [español](https://www.youtube.com/watch?v=skmctb_2rZ0), [русский](https://www.youtube.com/watch?v=jwCp_-bhrCQ)."
    },
    {
        "h5": "Employee can evaluate new workplace"
    },
    {
        "li": [
            "work speed;",
            "number of extra hours worked;",
            "areas of competence;",
            "volume of features and bugs;",
            "working style of colleagues;"
        ]
    },
    {
        "h5": "Team lead can evaluate employees"
    },
    {
        "li": [
            "identify slackers;",
            "estimate the amount of code;",
            "learn the work speed;",
            "notice behavioral anomalies;",
            "see the dynamics of work by week;"
        ]
    },
    {
        "h5": "Founder can evaluate product"
    },
    {
        "li": [
            "product cost;",
            "cost of features;",
            "development time;",
            "forecast of rework time;",
            "forecast cost;"
        ]
    },
    {
        "h3": "Table of contents"
    },
    {
        "h3": "How to quickly view the number of commits?"
    },
    {
        "p": "In the root directory of your project, run:"
    },
    {
        "pre": [
            "git shortlog -s -n -e"
        ]
    },
    {
        "h3": "How to create a local report with using library?"
    },
    {
        "p": "NodeJS:"
    },
    {
        "pre": [
            "npx assayo"
        ]
    },
    {
        "p": "PHP:"
    },
    {
        "pre": [
            "composer require bakhirev/assayo",
            "vendor/bin/assayo"
        ]
    },
    {
        "p": "Python:"
    },
    {
        "pre": [
            "pipx install assayo",
            "assayo"
        ]
    },
    {
        "p": "Ruby:"
    },
    {
        "pre": [
            "gem install assayo",
            "assayo"
        ]
    },
    {
        "p": "The script will create a folder `./assayo` with a report about repository:"
    },
    {
        "pre": [
            "./assayo/index.html - report",
            "./assayo/log.txt    - information from git"
        ]
    },
    {
        "p": "If you do not have NodeJS/PHP , see the items \"How to download data from git?\" and \"How to view the report?\""
    },
    {
        "h3": "How to concat authors?"
    },
    {
        "p": "In the root directory of your project, you need to create a `.mailmap` file."
    },
    {
        "p": "Example of the contents of the file:"
    },
    {
        "pre": [
            "Alex B <alex@mail.uk>",
            "Alex B <alex@mail.uk> <alex@gov.tk>",
            "Alex B <alex@mail.uk> <bakhirev@ya.kz>",
            "Alex B <alex@mail.uk> <man64@yahoo.com>"
        ]
    },
    {
        "p": "Read more about the format of this file you can [here](https://git-scm.com/docs/gitmailmap)."
    },
    {
        "h3": "How to export data from git?"
    },
    {
        "h4": "For online viewing"
    },
    {
        "p": "In the root directory of your project run:"
    },
    {
        "pre": [
            "git --no-pager log --raw --numstat --oneline --all --reverse --date=iso-strict --pretty=format:\"%ad>%aN>%aE>%s\" > log.txt"
        ]
    },
    {
        "h4": "For offline viewing"
    },
    {
        "pre": [
            "git --no-pager log --raw --numstat --oneline --all --reverse --date=iso-strict --pretty=format:\"%ad>%aN>%aE>%s\" | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/`/\"/g' | sed -e 's/\\$/S/g' | sed -e '1s/^/R(f\\`/' | sed -e '$s/$/\\`\\);/' > log.txt"
        ]
    },
    {
        "p": "Git will create a file `log.txt`. This file contains data for show a report. The difference between the online and offline format is the presence of a wrapper for strings. The offline format will be pulled up like a `js` file if you just opened `/build/index.html `"
    },
    {
        "h4": "If you use PowerShell in Windows"
    },
    {
        "p": "By default, the output encoding may not match UTF-8 and the resulting log file will be unreadable. Before saving the log, you can change the encoding with the command."
    },
    {
        "pre": "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8"
    },
    {
        "p": "Or open a saved file and manually change the encoding to UTF-8."
    },
    {
        "h3": "How to view the report?"
    },
    {
        "h4": "Using website"
    },
    {
        "li": [
            "go to the [website](https://bakhirev.github.io/);",
            "click the “[Demo](https://bakhirev.github.io/demo)” button;",
            "drop the `log.txt` file into the browser window;"
        ]
    },
    {
        "h4": "Use the library NodeJS"
    },
    {
        "li": [
            "run `npx assayo`",
            "open `./assayo/index.html`"
        ]
    },
    {
        "h4": "Use the library PHP"
    },
    {
        "li": [
            "run `composer require bakhirev/assayo`",
            "run `vendor/bin/assayo`",
            "open `./assayo/index.html`"
        ]
    },
    {
        "h4": "Use the library Python"
    },
    {
        "li": [
            "run `pipx install assayo`",
            "run `assayo`",
            "open `./assayo/index.html`"
        ]
    },
    {
        "h4": "Use the library Ruby"
    },
    {
        "li": [
            "run `gem install assayo`",
            "run `assayo`",
            "open `./assayo/index.html`"
        ]
    },
    {
        "h4": "Use source code"
    },
    {
        "li": [
            "download this repository `git clone https://github.com/bakhirev/assayo.git`;",
            "drop the `log.txt` file to the `/build` folder;",
            "run `/build/index.html`;",
            "or drop the `/build` folder to your repository (where the `log.txt` is located). You can change the name. For example, from `/build` to `/report`."
        ]
    },
    {
        "p": "  In this case, it is important that the `log.txt` file is generated by the command for offline viewing."
    },
    {
        "h3": "How to rebuild the HTML report from source code?"
    },
    {
        "li": [
            "download this repository `git clone https://github.com/bakhirev/assayo.git`",
            "run `npm install`",
            "run `npm run build:local`",
            "the new HTML build will be in the `/build` folder"
        ]
    },
    {
        "h3": "How to view a report on a group of microservices?"
    },
    {
        "li": [
            "generate for each microservice file `log.txt` (`log-1.txt`, `log-2.txt`, `log-3.txt` and etc.) You can do this manually, or use the [Assayo Crawler](https://github.com/bakhirev/assayo-crawler) module for automatic log collection;",
            "see “How to view an online report?”. At the last step, drag all the files at once into the browser window.",
            "see “How to see a report offline?”. At the second step, drag all microservice files (`log-1.txt`, `log-2.txt`, `log-3.txt` and etc.) to the report folder (`/build`)."
        ]
    },
    {
        "h3": "How to brand the interface?"
    },
    {
        "p": "You can create your own interface theme. Options:"
    },
    {
        "li": [
            "**Title**. You can set default document title in the URL parameter ```title```. Example: ```?title=You Company```",
            "**Visual theme**. To do this, you need to prepare a CSS file with new styles and specify its URL in the ```theme``` parameter. Example: ```?theme=//company.com/some.css```. You can use class names as selectors. Most of them do not change in new versions.",
            "**Language**. You can set language in the URL parameter ```lang```. Example: ```?lang=es```"
        ]
    },
    {
        "p": "**Example:** [demo](https://bakhirev.github.io/demo/themes/)"
    },
    {
        "h3": "How to sign commits?"
    },
    {
        "p": "Follow the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/). Example:"
    },
    {
        "pre": [
            "JIRA-1234 feat(profile): Added avatar for user "
        ]
    },
    {
        "li": [
            "task number in the task tracker `(JIRA-1234)`",
            "type of work `(feat, fix, style, refactor, test, doc и т.д.)`",
            "feature `(profile - new page on site or new function, use one (two) short wordor an abbreviation)`",
            "what problem were solved `(Added avatar for user)`"
        ]
    },
    {
        "h3": "How to add checking for commit message?"
    },
    {
        "h4": "Use file `commit-msg`"
    },
    {
        "p": "1. Create file `commit-msg` in folder `.git/hooks/`"
    },
    {
        "p": "2. Add this text in file:"
    },
    {
        "pre": [
            "#!/usr/bin/env bash",
            "if ! grep -iqE \"(JIRA-[0-9]{1,5})(\\s)(feat|fix|docs|style|refactor|test|chore)((\\([a-z0-9_-]{1,}\\)){0,})(:\\s)([a-z]{1,})\" \"$1\"; then",
            "   echo \"Need commit message like: JIRA-12 fix(profile): some text. Read Semantic Commit Messages\" >&2",
            "   exit 1",
            "fi"
        ]
    },
    {
        "h4": "Use package [pre-commit](https://www.npmjs.com/package/pre-commit)"
    },
    {
        "p": "1. Add in file `package.json` property `commit-msg`:"
    },
    {
        "pre": [
            "  ...",
            "  \"commit-msg\": {",
            "    \"regex\": \"(JIRA-[0-9]{1,5})(\\\\s)(feat|fix|docs|style|refactor|test|chore)((\\\\([a-z0-9_-]{1,}\\\\)){0,})(:\\\\s)([a-z]{1,})\",",
            "    \"error-message\": \"Need commit message like: JIRA-12 fix(profile): some text Read Semantic Commit Messages\"",
            "  },",
            "  ..."
        ]
    },
    {
        "p": "2. Run command `npm install pre-commit`"
    },
    {
        "h3": "How to automate data collection?"
    },
    {
        "h4": "With backend"
    },
    {
        "li": [
            "use module [Assayo Crawler](https://github.com/bakhirev/assayo-crawler);"
        ]
    },
    {
        "h4": "Without backend"
    },
    {
        "li": [
            "create a clone of the repository you need;",
            "copy the `build` folder to the root;",
            "open `build/index.html` in the browser and add it to bookmarks;",
            "add a shortcut to `build/assets/ci-cd.sh` to the startup folder (Windows);"
        ]
    },
    {
        "p": "  Every time you restart the computer, the script will update statistics on all the data that automatically merged into the main branch."
    },
    {
        "h3": "DevOps (CI/CD)"
    },
    {
        "h4": "Public server"
    },
    {
        "p": "You can upload the data file for report construction to a public URL. And use the website’s [assayo](https://bakhirev.github.io/?ref=github&lang=en) to visualize it."
    },
    {
        "pre": [
            "https://bakhirev.github.io/demo/?dump=//you_site.com/some/log.txt"
        ]
    },
    {
        "h4": "Private server"
    },
    {
        "li": [
            "download the [docker image](https://hub.docker.com/r/bakhirev/assayo);",
            "run it on your local network;",
            "use the web interface to view the reports, set the URL of the data in the URL parameter ```dump```:"
        ]
    },
    {
        "pre": [
            "http://assayo_url/?dump=//you_url/some/log.txt",
            "assayo_url - URL of the assayo container, it listens on port 80;",
            "you_url    - URL of your container with git logs;"
        ]
    },
    {
        "p": "By default, the image will run at ```http://127.0.0.1:80/```. If it doesn't work, check if port 80 is free."
    },
    {
        "h4": "How to update the Docker image?"
    },
    {
        "li": [
            "run ```npm run build:docker```",
            "run ```docker build -t assayo .```",
            "visually check the image ```docker run --name assayo -p 80:80 -d assayo```;",
            "add tag ```docker tag assayo bakhirev/assayo:latest```;",
            "push image to [Docker Hub](https://hub.docker.com/r/bakhirev/assayo) ```docker push bakhirev/assayo:latest```;"
        ]
    },
    {
        "h3": "️ About application"
    },
    {
        "h4": "Architecture"
    },
    {
        "img": "<img src=\"https://raw.githubusercontent.com/bakhirev/assayo-crawler/12af4410fc93384cafb108a4429e43f9a874dbaa/schema.svg\" width=\"70%\" />"
    },
    {
        "p": "1. [Reports showcase UI](https://github.com/bakhirev/assayo-showcase) displays a list of available reports. Each report consists of a title, description, and a list of repositories."
    },
    {
        "p": "2. [Crawler service](https://github.com/bakhirev/assayo-crawler) collects repository logs for the report."
    },
    {
        "p": "3. [Log visualization UI](https://github.com/bakhirev/assayo) **(you here)** displays report. Needs a log file for work."
    },
    {
        "h4": "How to add or edit a translation?"
    },
    {
        "p": "You can add a new translation or correct an existing one in the ```ts/translations/``` folder."
    },
    {
        "p": "[Instruction](https://github.com/firstcontributions/first-contributions)"
    },
    {
        "h4": "RoadMap:"
    },
    {
        "p": "Releases are planned approximately once every six months. What’s next:"
    },
    {
        "li": [
            "more recommendations and achievements;",
            "annual/monthly summaries, report printing;",
            "localization and internationalization;",
            "file analysis;",
            "different roles for statistics (hiding finances);",
            "development of the backend, integration with other systems;"
        ]
    },
    {
        "h4": "Feedback, comments"
    },
    {
        "li": [
            "\uD83D\uDCF1 [https://t.me/bakhirev](https://t.me/bakhirev) (priority method of communication)",
            "\uD83D\uDCE7 [alexey-bakhirev@yandex.ru](mailto:alexey-bakhirev@yandex.ru)",
            "\uD83C\uDF10 [https://bakhirev.github.io/](https://bakhirev.github.io/?ref=github&lang=en)"
        ]
    }
]