UNPKG

3.6 kBMarkdownView Raw
1# Hophop
2![](https://img.shields.io/npm/v/@buildo/hophop.svg)
3
4A minimal tool to accelerate the GitHub workflow from the command line.
5
6## Installation
7
8`npm install -g @buildo/hophop` with a non-ancient version of `npm`
9
10## Setup
11
12- `hophop gh setup` to set the GitHub API access token
13 - to generate a GitHub token click on the url printed by `hophop` in the terminal ![image](https://cloud.githubusercontent.com/assets/4029499/23462847/cb5654ea-fe8f-11e6-88d0-92e1f411ee54.png)
14 with that link, the required permissions are already filled: all you need to do is click the green "Generate token" button at the bottom of the page
15
16## GitHub Workflow
17
18#### `hophop gh feature`
19
20to create a local branch referencing an open issue
21
22```bash
23hophop gh feature # if you don't know the issue number
24hophop gh feature 123 # if you already know the issue number
25```
26
27#### `hophop gh pr`
28
29to push the current feature branch and, if needed, open a Pull Request. The name of the pull request will cause GitHub to auto-close the issue when the PR is merged.
30
31```bash
32hophop gh pr # to open pull request on master
33hophop gh pr --base # to open pull request on a different branch (hophop will ask you to select a branch)
34```
35
36#### `hophop gh commit`
37
38to create a commit that closes an open issue.
39
40#### `hophop gh open`
41
42to open on Chrome the PR associated with current branch.
43
44## .hophoprc
45
46add an optional `.hophoprc` file in your project root folder in order to set default answers to the `hophop gh feature` task questions.
47
48Config:
49
50```ts
51type Option = 'ask' | 'no' | 'n' | 'nope' | 'yes' | 'y' | 'yep' | 'si' | 'of course' | 'youbetcha';
52
53type Config = {
54 apiUrl?: string; // default: 'https://api.github.com'
55 branchSuffix?: Option; // default: 'ask'
56 moveToWIP?: Option; // default: 'y'
57 openPRWithTestPlanTemplate?: Option; // default: 'y'
58 closeIssueWithPR?: Option // default: 'y',
59 openPRAsDraft?: 'Option' // default: 'n'
60 kaiten?: { // default: undefined
61 boardId: number;
62 backlogColumnId: number;
63 };
64};
65```
66
67#### example
68
69```yaml
70branchSuffix: y
71```
72
73## Kaiten support
74hophop supports using Kaiten for issue tracking. To enable Kaiten add the `kaiten` section in `.hophoprc`, for example:
75
76```yaml
77kaiten:
78 - boardId: 123123
79 backlogColumnId: 123123
80```
81
82You can configure as many combinations of boardId/backlogColumnId as you want:
83
84```yaml
85kaiten:
86 - boardId: 123123
87 backlogColumnId: 123123
88 - boardId: 456456
89 backlogColumnId: 456456
90```
91
92> You can retrieve board and column ids in the Kaiten UI by using the "copy link" functionality and getting the id from the resulting url
93
94Once Kaiten is configured all hophop commands will automatically use it instead of GitHub.
95Note that, in this case, the command `hophop gh feature` will also push the newly created local branch to the remote repository in order to move the issue's card from Backlog to WIP.
96
97## zsh autocompletion
98
99After installing the package, an autocompletion file is available at
100```
101NPM_PREFIX/lib/node_modules/@buildo/hophop/_hophop
102```
103
104where `NPM_PREFIX` is usually `/usr/local` and it can be retrieved using `npm prefix -g`
105
106#### Installation using oh-my-zsh
107
108If you use [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh), installing the autocompletion is as easy as:
109
110```bash
111mkdir -p ~/.oh-my-zsh/custom/plugins/hophop
112ln -s `(npm prefix -g)`/lib/node_modules/@buildo/hophop/bin/_hophop ~/.oh-my-zsh/custom/plugins/hophop/_hophop
113touch ~/.oh-my-zsh/custom/plugins/hophop/hophop.plugin.zsh
114```
115
116Then enable the plugin in your `.zshrc`, for example:
117```bash
118plugins=(git brew hophop)
119```