# codeowners-cli

> A command line tool to quickly find code owners of definitions (class/function/...), files, and directories.

Latest version **0.2.0** (published 2019-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install codeowners-cli
pnpm add codeowners-cli
yarn add codeowners-cli
bun add codeowners-cli
```

Provides the commands `wtf`, `codeowners`, `diff-lines`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2019-11-24 |
| First published | 2019-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0 <12.0 |
| Dependencies | 12 |
| Unpacked size | 29.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Jonas Hübotter |
| Maintainers | antonbaumann |

## Links

- npm: https://www.npmjs.com/package/codeowners-cli
- Repository: https://github.com/antonbaumann/codeowners
- Homepage: https://github.com/antonbaumann/codeowners#readme
- Issues: https://github.com/antonbaumann/codeowners/issues
- npm.io page: https://npm.io/package/codeowners-cli

## Dependencies (12)

- [chalk](https://npm.io/package/chalk.md) ^3.0.0
- [core-js](https://npm.io/package/core-js.md) ^3.4.1
- [commander](https://npm.io/package/commander.md) ^3.0.2
- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.7.0
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.7.2
- [tree-sitter](https://npm.io/package/tree-sitter.md) ^0.15.14
- [tree-sitter-go](https://npm.io/package/tree-sitter-go.md) ^0.15.0
- [tree-sitter-java](https://npm.io/package/tree-sitter-java.md) ^0.13.0
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.7.0
- [tree-sitter-python](https://npm.io/package/tree-sitter-python.md) ^0.15.0
- [tree-sitter-javascript](https://npm.io/package/tree-sitter-javascript.md) ^0.15.1
- [tree-sitter-typescript](https://npm.io/package/tree-sitter-typescript.md) ^0.15.1

## Recent versions

- 0.2.0 (latest) — 2019-11-24
- 0.1.0 — 2019-11-23

## README

# Codeowners CLI

A command line tool to quickly find code owners of definitions (class/function/...), files, and directories.

### What you'll find in this document:

* [Inspiration](#inspiration)
* [Usage](#usage)
  * [Installation](#installation)
  * [`line`](#line)
  * [`def`](#def)
  * [Options](#options)
  * [Language support](#language-support)
* [Extensibility](#extensibility)
  * [Adding a new language](#adding-a-new-language)
* [Development](#development)
* [Release](#release)

## Inspiration

Starting to work on a larger software project is often intimidating. We developed this powerful tool to make it easier for programmers to get familiar with a new project. Codeowners is aiming to attack this problem on multiple levels:

1. It makes it easy to find a person of contact that owns a specific definition within a file. Depending on the programming language a definition may be a function or method definition, a class declaration or an interface. A substantial algorithm is used to provide accurate results that take into account the entire history of a project.
2. It provides a structured overview of a file/project that also includes information on code ownership.

Codeowners works with Git repositories. It uses [Tree-sitter](http://tree-sitter.github.io/tree-sitter/) parsers to build Abstract Syntax Trees of code written in a multitude of different programming languages. [Programming languages supported by Codeowners](#language-support) include:

* Java
* JavaScript
* Python
* Go

One of the core design-principles is to keep the effort required to [add support for a new programming language](#adding-a-new-language) to a bare minimum.

## Usage

To use Codeowners with your directory or file, it must be or be located within a Git repository and it must use one of the [supported programming languages](#language-support).

### Installation

You can install Codeowners globally with Yarn

    $ yarn global add codeowners

or NPM

    $ npm install -g codeowners

### `line`

```
codeowners line <file> <lineNumber>
```

Lookup code owners for a specific line of a file.

### `def`

```
codeowners def <file> <definition>
```

Lookup code owners given a definition inside a file.

### Options

| Option | Description |
| ------ | ----------- |
| `-d --depth <number>` | The maxmium recursive depth of the [code owner algorithm](#algorithm) (e.g. the number of commits to look back in history). Takes a positive number. Defaults to `undefined` -- unlimited recursive depth. |
| `-f --format <format>` | Output format. Allowed values are `pretty`, `data`, and `json`. Defaults to `pretty`. |
| `-s --strategy` | [Strategy](#strategies) used for the [code owner algorithm](#algorithm). Allowed values are `weighted-lines`, and `lines`. Defaults to `weighted-lines`. |
| `-v --version` | Outputs the version number |
| `-h --help` | Outputs usage information |

### Language support

* Java
* JavaScript
* Python
* Go

## Extensibility

### Adding a new language

To add support for a new language

* create a language file in `src/languages`;
* and add the language to `supportedLanguages` in `src/parse.ts`.

## Development

Listen to changes and make them accessible through `codeowners` from the command line:

    $ yarn start

Run ESLint:

    $ yarn eslint

Run TypeScript compiler checks:

    $ yarn tsc

Run tests:

    $ yarn test

## Release

1. Change the version in `package.json` and `src/index.ts`.
1. Create a pull request to merge the changes into `master`.
1. After the pull request was merged, create a new release listing the breaking changes and commits on `master` since the last release.
1. The release workflow will publish the package to NPM.

---
_Source: https://npm.io/package/codeowners-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
