@mattpolzin/harmony 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- harmony-npm/README.md +171 -0
- harmony-npm/harmony +4158 -2284
- harmony-npm/package.json +1 -1
harmony-npm/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
|
|
2
|
+
# Harmony
|
|
3
|
+
Harmony is a small tool that helps teams keep GitHub reviews running smoothly. It takes the work out of picking someone from a pool of developers to review a new PR. Harmony does this by heuristically determining who on a particular GitHub Team has the least current/recent review workload.
|
|
4
|
+
|
|
5
|
+
## Dependencies
|
|
6
|
+
### Runtime
|
|
7
|
+
Running Harmony only requires NodeJS 12+ (and a local installation of `git`).
|
|
8
|
+
### Build time
|
|
9
|
+
Building the latest commits of Harmony requires a HEAD build of the Idris 2 compiler. Each release page also indicates the version of Idris 2 that particular release will build against.
|
|
10
|
+
|
|
11
|
+
Alternatively, you can build Harmony with Docker (see [Docker Build](#docker-build)).
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
For any installation, you need to have a GitHub [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token).
|
|
15
|
+
|
|
16
|
+
You can eiher add the PAT to your environment as the `GITHUB_PAT` variable (perhaps exporting it from your shell resource file or profile) or you can store your PAT in Harmony's config file. The first time you start Harmony, it will ask you to configure your PAT if you don't want to use the Environment variable. You only need one of (a) the ENV var and (b) the config property and the environment variable will take precedence if you have both set.
|
|
17
|
+
|
|
18
|
+
### NPM
|
|
19
|
+
You can install Harmony via npm directly by running `npm install -g @mattpolzin/harmony`.
|
|
20
|
+
|
|
21
|
+
### GitHub Release
|
|
22
|
+
You can install any Harmony release by downloading the `harmony-npm.tar.gz` file from the GitHub Release page, unzipping it, and running `npm install --global`.
|
|
23
|
+
|
|
24
|
+
### From Source
|
|
25
|
+
The normal installation assumes a HEAD build of Idris 2 is installed. For an alternative, see the [Docker Build](#docker-build) instructions below.
|
|
26
|
+
|
|
27
|
+
Build Harmony from source with a call to `make`. Then install it globally with `make install`.
|
|
28
|
+
|
|
29
|
+
#### Docker Build
|
|
30
|
+
If you want to build Harmony without installing Idris 2 on your system, you can build Harmony within a Docker container and then install the resulting Javascript onto your system.
|
|
31
|
+
|
|
32
|
+
First, download the latest nightly Docker image:
|
|
33
|
+
```shell
|
|
34
|
+
docker pull mattpolzin2/idris-docker:nightly
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then, from a directory containing this Harmony git repository, build Harmony:
|
|
38
|
+
```shell
|
|
39
|
+
docker run --rm -v "$(pwd):/build" mattpolzin2/idris-docker:nightly bash -c "cd /build && make"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
At this point you are done with Docker. From the same directory, install Harmony globally:
|
|
43
|
+
```shell
|
|
44
|
+
npm install --global
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Bash completion
|
|
48
|
+
Set up Bash completion by adding the following to your Bash resource file or profile:
|
|
49
|
+
```shell
|
|
50
|
+
eval "$(harmony --bash-completion-script)"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You can set up tab completion in Zsh, too:
|
|
54
|
+
```shell
|
|
55
|
+
autoload -U +X compinit && compinit
|
|
56
|
+
autoload -U +X bashcompinit && bashcompinit
|
|
57
|
+
eval "$(harmony --bash-completion-script)"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
The first time you start Harmony in any particular folder, you will be asked to provide some information about the GitHub repository you are working with. This information is stored in a file named `harmony.json` in the current working directory.
|
|
62
|
+
|
|
63
|
+
Note that the GitHub organization and repository are both slugs, not names. These are the values you find in a GitHub URL pointing to your repository. Harmony does not work with personal repositories because they do not have teams or members.
|
|
64
|
+
```
|
|
65
|
+
$ harmony sync
|
|
66
|
+
Creating a new configuration (storing in harmony.json)...
|
|
67
|
+
|
|
68
|
+
Harmony uses a GitHub Personal Access Token (PAT) to communicate with GitHub.
|
|
69
|
+
You can set this via the $GITHUB_PAT environment variable or a config property.
|
|
70
|
+
If you don't set in your config now, you can set later with `harmony config githubPAT abcdefg`.
|
|
71
|
+
The ENV var will always take precedence over the config property.
|
|
72
|
+
|
|
73
|
+
What PAT would you like to set in the config file (ENTER for default: unset)?
|
|
74
|
+
|
|
75
|
+
What GitHub org would you like to use harmony for (ENTER for default: myorg)?
|
|
76
|
+
|
|
77
|
+
What repository would you like to use harmony for (ENTER for default: myrepo)?
|
|
78
|
+
|
|
79
|
+
What GitHub remote repo would you like to use harmony for (ENTER for default: origin)?
|
|
80
|
+
|
|
81
|
+
Would you like harmony to comment when it assigns reviewers? [Y/n]
|
|
82
|
+
Would you like harmony to assign teams in addition to individuals when it assigns reviewers? [Y/n]
|
|
83
|
+
Creating config...
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Once configured, Harmony supports the following commands: `branch`, `pr`, `assign`, `contribute`, `whoami`, `reflect`, `list`, `graph`, `config`, and `sync`.
|
|
87
|
+
|
|
88
|
+
### Branch
|
|
89
|
+
Running `harmony branch` will print the URI for accessing the currently checked out branch on GitHub.
|
|
90
|
+
|
|
91
|
+
Many operating systems have an `open` command (though the name "open" is not ubiquitous); this means you can run something like `open $(harmony branch)` to open a web browser to the current branch on GitHub.
|
|
92
|
+
|
|
93
|
+
### PR
|
|
94
|
+
Running `harmony pr` with a branch checked out will reach out to GitHub to determine if there is an open PR for that branch. If there is a PR, Harmony will print a URI that can be used to view the PR. IF there is not a PR, Harmony will help you create one.
|
|
95
|
+
|
|
96
|
+
If you need to create a PR still, you will be prompted for a branch to open the PR against (merge into, eventually), a title for the PR, and a description for the PR. If you have an `EDITOR` environment variable set, Harmony will use that editor to get the PR description from you. If you have a PR template at `.github/PULL_REQUEST_TEMPLATE.md`, Harmony will also preload that into your editor. If you do not have an `EDITOR` environment variable set, you will still be able to enter a description from the command line but PR templates are only supported when an `EDITOR` is specified.
|
|
97
|
+
|
|
98
|
+
Many operating systems have an `open` command (though the name "open" is not ubiquitous); this means you can run something like `open $(harmony pr)` to open a web browser to an existing PR for the current branch.
|
|
99
|
+
|
|
100
|
+
### Assign
|
|
101
|
+
Running `harmony assign {<team> | +<user>} [...]` will help you create a PR if one does not exist yet and then it will pick someone to review the PR (from one of the listed teams) and assign both that user and the teams you listed as reviewers of the PR.
|
|
102
|
+
|
|
103
|
+
You can also require that specific additional users (on top of the one Harmony will pick for you) are assigned to the PR. You do this by specifying those users' logins prefixed with '+' as arguments to Harmony.
|
|
104
|
+
|
|
105
|
+
#### Examples
|
|
106
|
+
Assign the most available reviewer from the "developers" GitHub Team:
|
|
107
|
+
```shell
|
|
108
|
+
harmony assign developers
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Assign the most available reviewer from either the "frontend" or "backend" GitHub Team:
|
|
112
|
+
```shell
|
|
113
|
+
harmony assign frontend backend
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Assign the most available reviewer from the "web" team and additionally assign the users with logins "carl001" and "emmaham":
|
|
117
|
+
```shell
|
|
118
|
+
harmony assign web +carl001 +emmaham
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Contribute
|
|
122
|
+
Running `harmony contribute` will print the URI of the oldest PR waiting for your review. If you are not requested for review on any PRs, Harmony will suggest a PR that you are not assigned to.
|
|
123
|
+
|
|
124
|
+
You can skip PRs and retrieve the next-oldest one by passing a dash followed by the number to skip (e.g. `-2` to skip the two oldest waiting PRs).
|
|
125
|
+
|
|
126
|
+
You can simultaneously get the URI for a PR to review and checkout the branch needing review by passing the `--checkout` or `-c` option to the `contribute` command.
|
|
127
|
+
|
|
128
|
+
Many operating systems have an `open` command (though the name "open" is not ubiquitous); this means you can run something like `open $(harmony contribute)` to open a web browser to the PR that Harmony is suggesting.
|
|
129
|
+
|
|
130
|
+
#### Examples
|
|
131
|
+
Retrieve a URI for the oldest unreviewed and open PR (prioritizing PRs for which you are an assigned reviewer):
|
|
132
|
+
```shell
|
|
133
|
+
harmony contribute
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Retrieve a URI for a PR to contribute a review, skipping over the first 3 suggestions:
|
|
137
|
+
```shell
|
|
138
|
+
harmony contribute -3
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Retrieve a URI for a PR to contribute a review and check the git branch out as well:
|
|
142
|
+
```shell
|
|
143
|
+
harmony contribute --checkout
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Who Am I
|
|
147
|
+
Running `harmony whoami` will print information about the currently configured and authenticated user.
|
|
148
|
+
|
|
149
|
+
### Reflect
|
|
150
|
+
Running `harmony reflect` will show a summary of your review requests and authored pull requests.
|
|
151
|
+
|
|
152
|
+
### List
|
|
153
|
+
Running `harmony list <team>` will list the members of the given GitHub Team.
|
|
154
|
+
|
|
155
|
+
### Graph
|
|
156
|
+
Running `harmony graph <team>` will graph the relative review workload of each of the members of the given GitHub Team.
|
|
157
|
+
|
|
158
|
+
### Config
|
|
159
|
+
Running `harmony config <property>` will read the given configuration property. `harmony config <property> <value>` will set the configuration property.
|
|
160
|
+
|
|
161
|
+
Not all configuration properties can be read/set with this command.
|
|
162
|
+
#### Properties
|
|
163
|
+
- `assignTeams` -- When picking a reviewer from a team, assign the team as a reviewer as well.
|
|
164
|
+
- `assignUsers` -- When assigning a team as a reviewer, pick a user to review as well.
|
|
165
|
+
- `commentOnAssign` -- When assigning a reviewer chosen by Harmony, comment on the pull request.
|
|
166
|
+
- `defaultRemote` -- When pushing new branches, what remote destination should be used.
|
|
167
|
+
- `githubPAT` -- If the `$GITHUB_PAT` environment variable is not set, this Personal Access Token is used to authenticate with GitHub.
|
|
168
|
+
|
|
169
|
+
### Sync
|
|
170
|
+
Running `harmony sync` will sync the locally configured team slugs and user logins that are used by auto-completion for Harmony. This sync is also performed automatically the first time you run Harmony after more than a day without the configuration being synced.
|
|
171
|
+
|