{"id":15354916,"url":"https://github.com/capaj/contrib-locs","last_synced_at":"2026-02-12T12:47:29.755Z","repository":{"id":57206675,"uuid":"286111467","full_name":"capaj/contrib-locs","owner":"capaj","description":"a CLI util to keep a list of all people who are to blame for all the the inidividual lines in the codebase ","archived":false,"fork":false,"pushed_at":"2023-06-21T08:05:51.000Z","size":1829,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T14:05:27.275Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capaj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-08T20:03:45.000Z","updated_at":"2022-06-14T16:25:28.000Z","dependencies_parsed_at":"2025-02-12T19:48:05.308Z","dependency_job_id":"18fee9c1-a6e5-4fff-8418-8dde6d094262","html_url":"https://github.com/capaj/contrib-locs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fcontrib-locs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fcontrib-locs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fcontrib-locs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fcontrib-locs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/contrib-locs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492466,"owners_count":20947541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-10-01T12:21:39.323Z","updated_at":"2026-02-12T12:47:24.736Z","avatar_url":"https://github.com/capaj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contrib-locs\n\na CLI util to keep a list of all people who are to blame for all the the individual lines in the codebase. This can be used to roughly compare contribution volume between all the comitters.\n\nOnly runs in node 16. If you need node 18, please upvote this: https://github.com/nodegit/nodegit/issues/1980\n\n## Install\n\n```\nnpm i contrib-locs -g\n```\n\nit stores the ledger inside the repo in json format. It can look like this:\n\n```json\n{\n  \"lastCommit\": \"aaaaa\",\n  \"contributors\": [\n    {\n      \"email\": \"capajj@gmail.com\",\n      \"loc\": 299,\n      \"total_additions\": 247,\n      \"total_deletions\": 52,\n      \"percentageOfTotal\": 100\n    }\n  ]\n}\n```\n\nIt counts all the lines added/removed in all commits, so the line is counted even if it was removed later.\n\nThere are two command\n\n- `init`\n- `preCommit`\n\n## First run\n\ninvoke `contrib-locs init` in your project repo root.\n\n## Set up githooks with husky\n\nHere's an example husky(7.x.x) CLI command to use to set up git hook to update contributors before each commit:\n\n```\n npx husky add .husky/pre-commit \"contrib-locs preCommit\"\n```\n\n## Config\n\nIs defined in the root of your git repo in a file `.contrib-locs` file. File format is JSON5.\nDefault config looks like this:\n\n```js\n{\n  matchFiles: ['*', '!contrib-locs.json'],\n  matchUsers: ['*', '!*[bot]@users.noreply.github.com'] // filters out github bots\n}\n```\n\n### Including/excluding files\n\nYou will most likely want to ignore certain files. Like for example files that are generated code.\nBy default contrib-locs only works on files that are in git, so if such files are in `.gitignore` there's no additional config needed.\nIf you want to exclude/include files in git add `matchFiles`\n\nFor example if you only want to count files that are typescript files and markdown, you can use this:\n\n```js\n{\n  matchFiles: ['**/*.ts', '**/*.tsx', '**/*.md']\n}\n```\n\n`match` is used as param for [micromatch](https://www.npmjs.com/package/micromatch) so you can also negate if needed. Like if you want to count all files except json:\n\n```js\n{\n  matchFiles: ['*', '!**/*.json']\n}\n```\n\n### Including/excluding users\n\n```js\n{\n  matchUsers: ['*@uber.com', '!*[bot]@users.noreply.github.com'] // only people from uber domain will get counted, bots will be ignored\n}\n```\n\ncontributions from unmatched users are skipped. They don't even count into the `totalLinesAddedOrRemoved`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fcontrib-locs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fcontrib-locs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fcontrib-locs/lists"}