@kitlangton/ghui 0.1.18 → 0.1.20
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.
- package/README.md +14 -3
- package/bin/ghui.js +64 -1
- package/package.json +6 -2
- package/src/App.tsx +932 -510
- package/src/appCommands.ts +330 -0
- package/src/commands.ts +68 -0
- package/src/config.ts +10 -0
- package/src/domain.ts +43 -13
- package/src/errors.ts +10 -0
- package/src/index.tsx +23 -2
- package/src/mergeActions.ts +1 -6
- package/src/pullRequestCache.ts +19 -0
- package/src/pullRequestViews.ts +45 -0
- package/src/services/BrowserOpener.ts +22 -0
- package/src/services/Clipboard.ts +46 -0
- package/src/services/CommandRunner.ts +14 -6
- package/src/services/GitHubService.ts +327 -161
- package/src/services/MockGitHubService.ts +146 -0
- package/src/ui/CommandPalette.tsx +143 -0
- package/src/ui/DetailsPane.tsx +49 -63
- package/src/ui/FooterHints.tsx +91 -182
- package/src/ui/PullRequestDiffPane.tsx +105 -87
- package/src/ui/PullRequestList.tsx +102 -49
- package/src/ui/colors.ts +167 -1
- package/src/ui/diff.ts +69 -63
- package/src/ui/diffStats.tsx +25 -0
- package/src/ui/modals.tsx +270 -302
- package/src/ui/primitives.tsx +92 -2
- package/src/ui/pullRequests.ts +44 -12
- package/src/ui/singleLineInput.ts +25 -0
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Terminal UI for keeping up with your open GitHub pull requests across repositori
|
|
|
4
4
|
|
|
5
5
|
`ghui` gives you one keyboard-driven place to review PR details, inspect diffs, leave diff comments, manage labels, toggle draft state, merge, open PRs in GitHub, and copy PR metadata without leaving the terminal.
|
|
6
6
|
|
|
7
|
+
<img width="1420" height="856" alt="image" src="https://github.com/user-attachments/assets/5e560a4a-5887-4baa-a6d4-e1f4f0410c70" />
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -21,8 +23,6 @@ Run it from anywhere:
|
|
|
21
23
|
ghui
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
<img width="1420" height="856" alt="image" src="https://github.com/user-attachments/assets/5e560a4a-5887-4baa-a6d4-e1f4f0410c70" />
|
|
25
|
-
|
|
26
26
|
## Local Development
|
|
27
27
|
|
|
28
28
|
Clone, install, and link:
|
|
@@ -34,15 +34,25 @@ bun install
|
|
|
34
34
|
bun link
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
With Nix flakes:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nix develop
|
|
41
|
+
bun install
|
|
42
|
+
bun run dev
|
|
43
|
+
```
|
|
44
|
+
|
|
37
45
|
## Configuration
|
|
38
46
|
|
|
39
47
|
- `GHUI_AUTHOR`: author passed to `gh search prs`, defaults to `@me`
|
|
48
|
+
- `GHUI_REPO`: optional `owner/name` repository queue for browsing all open PRs in a repo
|
|
40
49
|
- `GHUI_PR_FETCH_LIMIT`: max PRs fetched, defaults to `200`
|
|
41
50
|
|
|
42
51
|
Example:
|
|
43
52
|
|
|
44
53
|
```bash
|
|
45
54
|
GHUI_AUTHOR=@me ghui
|
|
55
|
+
GHUI_REPO=basecamp/omarchy ghui
|
|
46
56
|
```
|
|
47
57
|
|
|
48
58
|
You can also copy `.env.example` to `.env` and edit the values locally.
|
|
@@ -54,6 +64,7 @@ You can also copy `.env.example` to `.env` and edit the values locally.
|
|
|
54
64
|
- `gg` / `G`: jump to first or last pull request
|
|
55
65
|
- `ctrl-u` / `ctrl-d`: page up or down
|
|
56
66
|
- `tab` / `shift-tab`: switch PR queue
|
|
67
|
+
- `ctrl-p` / `cmd-k`: open the command palette
|
|
57
68
|
- `/`: filter
|
|
58
69
|
- `enter`: expand details; normal PR actions still work while details are expanded
|
|
59
70
|
- `esc`: return from expanded details, leave diff/comment mode, or close modal
|
|
@@ -68,7 +79,7 @@ You can also copy `.env.example` to `.env` and edit the values locally.
|
|
|
68
79
|
- `s`: toggle draft or ready-for-review state
|
|
69
80
|
- `m`: merge
|
|
70
81
|
- `x`: close with confirmation
|
|
71
|
-
- `t`: choose theme
|
|
82
|
+
- `t`: choose theme, including `System` to match your terminal colors
|
|
72
83
|
- `l`: manage labels
|
|
73
84
|
- `o`: open PR in browser
|
|
74
85
|
- `y`: copy PR metadata
|
package/bin/ghui.js
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const packageJson = await Bun.file(new URL("../package.json", import.meta.url)).json()
|
|
4
|
+
|
|
5
|
+
const help = `ghui ${packageJson.version}
|
|
6
|
+
|
|
7
|
+
Terminal UI for GitHub pull requests.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
ghui Start the TUI
|
|
11
|
+
ghui upgrade Upgrade ghui to the latest npm release
|
|
12
|
+
ghui -v, --version
|
|
13
|
+
Print the installed version
|
|
14
|
+
ghui -h, --help Show this help message
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
const args = Bun.argv.slice(2)
|
|
18
|
+
const command = args[0]
|
|
19
|
+
const commands = ["upgrade", "help", "version"]
|
|
20
|
+
|
|
21
|
+
const editDistance = (a, b) => {
|
|
22
|
+
const distances = Array.from({ length: a.length + 1 }, (_, i) => [i])
|
|
23
|
+
for (let j = 1; j <= b.length; j++) distances[0][j] = j
|
|
24
|
+
|
|
25
|
+
for (let i = 1; i <= a.length; i++) {
|
|
26
|
+
for (let j = 1; j <= b.length; j++) {
|
|
27
|
+
distances[i][j] = Math.min(
|
|
28
|
+
distances[i - 1][j] + 1,
|
|
29
|
+
distances[i][j - 1] + 1,
|
|
30
|
+
distances[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return distances[a.length][b.length]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (command === "-h" || command === "--help" || command === "help") {
|
|
39
|
+
console.log(help)
|
|
40
|
+
process.exit(0)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (command === "-v" || command === "--version" || command === "version") {
|
|
44
|
+
console.log(packageJson.version)
|
|
45
|
+
process.exit(0)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (command === "upgrade") {
|
|
49
|
+
const proc = Bun.spawn({
|
|
50
|
+
cmd: ["npm", "install", "-g", `${packageJson.name}@latest`],
|
|
51
|
+
stdin: "inherit",
|
|
52
|
+
stdout: "inherit",
|
|
53
|
+
stderr: "inherit",
|
|
54
|
+
})
|
|
55
|
+
process.exit(await proc.exited)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (command !== undefined) {
|
|
59
|
+
const suggestion = commands.find((name) => editDistance(command, name) <= 2)
|
|
60
|
+
console.error(`Unknown command: ${command}`)
|
|
61
|
+
if (suggestion) console.error(`Did you mean: ghui ${suggestion}?`)
|
|
62
|
+
console.error("Run `ghui --help` for usage.")
|
|
63
|
+
process.exit(1)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
await import("../src/index.tsx")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitlangton/ghui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Terminal UI for GitHub pull requests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,8 +35,12 @@
|
|
|
35
35
|
"ghui": "bin/ghui.js"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"
|
|
38
|
+
"changeset": "npm exec --package @changesets/cli@2.31.0 -- changeset",
|
|
39
|
+
"changeset:status": "npm exec --package @changesets/cli@2.31.0 -- changeset status",
|
|
40
|
+
"changeset:version": "npm exec --package @changesets/cli@2.31.0 -- changeset version",
|
|
41
|
+
"dev": "GHUI_MOTEL_PORT=${GHUI_MOTEL_PORT:-27686} bun --watch bin/ghui.js",
|
|
39
42
|
"start": "bun run src/index.tsx",
|
|
43
|
+
"start:mock": "GHUI_MOCK_PR_COUNT=400 GHUI_MOCK_REPO_COUNT=4 bun run src/index.tsx",
|
|
40
44
|
"test": "bun test test",
|
|
41
45
|
"typecheck": "tsc --noEmit"
|
|
42
46
|
},
|