lazyreview 0.1.4
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/.github/workflows/publish-npm.yml +51 -0
- package/.prettierrc +7 -0
- package/CLAUDE.md +50 -0
- package/README.md +119 -0
- package/dist/cli.js +3830 -0
- package/dist/cli.js.map +1 -0
- package/package.json +64 -0
- package/pnpm-workspace.yaml +5 -0
- package/src/app.tsx +235 -0
- package/src/cli.tsx +78 -0
- package/src/components/common/BorderedBox.tsx +41 -0
- package/src/components/common/Divider.tsx +31 -0
- package/src/components/common/EmptyState.tsx +35 -0
- package/src/components/common/FilterModal.tsx +117 -0
- package/src/components/common/LoadingIndicator.tsx +31 -0
- package/src/components/common/Modal.tsx +24 -0
- package/src/components/common/PaginationBar.tsx +56 -0
- package/src/components/common/SortModal.tsx +91 -0
- package/src/components/common/Spinner.tsx +28 -0
- package/src/components/common/index.ts +9 -0
- package/src/components/layout/HelpModal.tsx +61 -0
- package/src/components/layout/MainPanel.tsx +26 -0
- package/src/components/layout/Sidebar.tsx +71 -0
- package/src/components/layout/StatusBar.tsx +42 -0
- package/src/components/layout/TokenInputModal.tsx +92 -0
- package/src/components/layout/TopBar.tsx +44 -0
- package/src/components/layout/index.ts +6 -0
- package/src/components/pr/CommentsTab.tsx +92 -0
- package/src/components/pr/CommitsTab.tsx +142 -0
- package/src/components/pr/ConversationsTab.tsx +273 -0
- package/src/components/pr/FilesTab.tsx +532 -0
- package/src/components/pr/PRHeader.tsx +69 -0
- package/src/components/pr/PRListItem.tsx +92 -0
- package/src/components/pr/PRTabs.tsx +50 -0
- package/src/components/pr/index.ts +8 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/useActivePanel.ts +54 -0
- package/src/hooks/useAppKeymap.ts +22 -0
- package/src/hooks/useAuth.ts +131 -0
- package/src/hooks/useConfig.ts +52 -0
- package/src/hooks/useFilter.ts +192 -0
- package/src/hooks/useGitHub.ts +260 -0
- package/src/hooks/useInputFocus.tsx +35 -0
- package/src/hooks/useListNavigation.ts +121 -0
- package/src/hooks/useLoading.ts +25 -0
- package/src/hooks/usePagination.ts +87 -0
- package/src/models/comment.ts +15 -0
- package/src/models/commit.ts +20 -0
- package/src/models/diff.ts +93 -0
- package/src/models/errors.ts +24 -0
- package/src/models/file-change.ts +22 -0
- package/src/models/index.ts +12 -0
- package/src/models/pull-request.ts +40 -0
- package/src/models/review.ts +17 -0
- package/src/models/user.ts +9 -0
- package/src/screens/InvolvedScreen.tsx +161 -0
- package/src/screens/MyPRsScreen.tsx +161 -0
- package/src/screens/PRDetailScreen.tsx +88 -0
- package/src/screens/PRListScreen.tsx +96 -0
- package/src/screens/ReviewRequestsScreen.tsx +161 -0
- package/src/screens/SettingsScreen.tsx +284 -0
- package/src/screens/ThisRepoScreen.tsx +175 -0
- package/src/screens/index.ts +7 -0
- package/src/services/Auth.ts +314 -0
- package/src/services/Config.ts +81 -0
- package/src/services/GitHubApi.ts +262 -0
- package/src/services/Loading.ts +54 -0
- package/src/services/index.ts +27 -0
- package/src/theme/index.ts +28 -0
- package/src/theme/themes.ts +84 -0
- package/src/theme/types.ts +28 -0
- package/src/utils/date.ts +28 -0
- package/src/utils/git.ts +67 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/terminal.ts +25 -0
- package/tsconfig.json +24 -0
- package/tsup.config.ts +13 -0
- package/vitest.config.ts +26 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 2
|
|
17
|
+
|
|
18
|
+
- name: Check version change
|
|
19
|
+
id: version
|
|
20
|
+
run: |
|
|
21
|
+
OLD=$(git show HEAD~1:package.json | jq -r .version)
|
|
22
|
+
NEW=$(jq -r .version package.json)
|
|
23
|
+
if [ "$OLD" != "$NEW" ]; then
|
|
24
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
25
|
+
echo "Version changed: $OLD -> $NEW"
|
|
26
|
+
else
|
|
27
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
28
|
+
echo "Version unchanged: $NEW"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
- uses: pnpm/action-setup@v4
|
|
32
|
+
if: steps.version.outputs.changed == 'true'
|
|
33
|
+
with:
|
|
34
|
+
version: 9
|
|
35
|
+
|
|
36
|
+
- uses: actions/setup-node@v4
|
|
37
|
+
if: steps.version.outputs.changed == 'true'
|
|
38
|
+
with:
|
|
39
|
+
node-version: 20
|
|
40
|
+
registry-url: https://registry.npmjs.org
|
|
41
|
+
cache: pnpm
|
|
42
|
+
|
|
43
|
+
- name: Install and build
|
|
44
|
+
if: steps.version.outputs.changed == 'true'
|
|
45
|
+
run: pnpm install --frozen-lockfile && pnpm build
|
|
46
|
+
|
|
47
|
+
- name: Publish
|
|
48
|
+
if: steps.version.outputs.changed == 'true'
|
|
49
|
+
env:
|
|
50
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
51
|
+
run: npm publish --provenance --access public
|
package/.prettierrc
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# LazyReview
|
|
2
|
+
|
|
3
|
+
TUI code review tool for GitHub PRs built with Ink + Effect + TypeScript.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
├── cli.tsx # Entry point
|
|
10
|
+
├── app.tsx # Root component with Box layout
|
|
11
|
+
├── components/
|
|
12
|
+
│ ├── layout/ # TopBar, Sidebar, MainPanel, StatusBar
|
|
13
|
+
│ ├── pr/ # PRListItem, PRHeader, PRTabs, FilesTab, CommentsTab
|
|
14
|
+
│ └── common/ # EmptyState, LoadingIndicator
|
|
15
|
+
├── screens/ # PRListScreen, PRDetailScreen, MyPRsScreen, ReviewRequestsScreen, SettingsScreen
|
|
16
|
+
├── hooks/ # useGitHub, useAuth, useConfig, useLoading, useTheme, useListNavigation, useActivePanel
|
|
17
|
+
├── services/ # Effect services: GitHubApi, Auth, Config, Loading, layers
|
|
18
|
+
├── models/ # Zod schemas + TS types
|
|
19
|
+
├── theme/ # Theme types, color palettes, ThemeProvider
|
|
20
|
+
└── utils/ # date formatting, terminal helpers
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
- `pnpm build` - Build with tsup
|
|
26
|
+
- `pnpm start` - Run the TUI
|
|
27
|
+
- `pnpm dev` - Watch mode build
|
|
28
|
+
- `pnpm typecheck` - TypeScript type checking
|
|
29
|
+
- `pnpm test` - Run tests
|
|
30
|
+
- `pnpm test:watch` - Watch mode tests
|
|
31
|
+
- `pnpm test:coverage` - Tests with coverage (80% threshold)
|
|
32
|
+
|
|
33
|
+
## Stack
|
|
34
|
+
|
|
35
|
+
- **UI**: Ink 6 + @inkjs/ui + React 19
|
|
36
|
+
- **Services**: Effect (typed errors, dependency injection, layers)
|
|
37
|
+
- **Validation**: Zod schemas for API responses
|
|
38
|
+
- **Config**: YAML (~/.config/lazyreview/config.yaml)
|
|
39
|
+
- **Build**: tsup (ESM, node20 target)
|
|
40
|
+
- **Test**: Vitest + ink-testing-library
|
|
41
|
+
|
|
42
|
+
## Conventions
|
|
43
|
+
|
|
44
|
+
- Immutable patterns only (no mutation)
|
|
45
|
+
- Effect services with tagged errors
|
|
46
|
+
- Zod schemas for all external data
|
|
47
|
+
- Custom hooks for navigation: useListNavigation, useActivePanel
|
|
48
|
+
- Vim-style navigation (j/k/h/l) via useInput from ink
|
|
49
|
+
- Small files (<400 lines), high cohesion
|
|
50
|
+
- All user input validated with Zod
|
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# LazyReview
|
|
2
|
+
|
|
3
|
+
A terminal user interface (TUI) for reviewing GitHub pull requests. Keyboard-driven, vim-style navigation—inspired by lazygit.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
From npm (global):
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g lazyreview
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or run once with npx:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx lazyreview
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Requirements:** Node.js 20 or later.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
**From a git repository** (detects `origin` and loads that repo’s PRs):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
lazyreview
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**With an explicit owner/repo:**
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
lazyreview owner/repo
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
lazyreview facebook/react
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
On first run you’ll be prompted for a **GitHub Personal Access Token**. Create one at [GitHub → Settings → Developer settings → Personal access tokens](https://github.com/settings/tokens) with at least the `repo` scope.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **PR list** – Browse open PRs with filter, sort, and pagination
|
|
49
|
+
- **PR detail** – Title, author, labels, description, and tabs:
|
|
50
|
+
- **Conversations** – Description, reviews, and comments in one timeline
|
|
51
|
+
- **Commits** – Commit list with message, author, and date
|
|
52
|
+
- **Files** – File tree and side-by-side diff with syntax highlighting
|
|
53
|
+
- **Sidebar** – Involved, My PRs, For Review, This Repo, Settings
|
|
54
|
+
- **Themes** – Tokyo Night, Dracula, Catppuccin Mocha (configurable)
|
|
55
|
+
- **Git detection** – Auto-detects `owner/repo` from current directory’s `origin` remote
|
|
56
|
+
|
|
57
|
+
## Keyboard shortcuts
|
|
58
|
+
|
|
59
|
+
| Key | Action |
|
|
60
|
+
|-----|--------|
|
|
61
|
+
| `j` / `k` | Move down / up |
|
|
62
|
+
| `Enter` | Select / open |
|
|
63
|
+
| `Tab` | Switch focus (e.g. list ↔ sidebar) |
|
|
64
|
+
| `h` / `l` | In PR detail: focus file tree / diff panel |
|
|
65
|
+
| `b` | Toggle sidebar |
|
|
66
|
+
| `/` | Search / filter PRs |
|
|
67
|
+
| `s` | Sort PRs |
|
|
68
|
+
| `n` / `p` | Next / previous page |
|
|
69
|
+
| `1` / `2` / `3` | PR detail: Conversations / Commits / Files |
|
|
70
|
+
| `q` | Back or quit |
|
|
71
|
+
| `?` | Show help |
|
|
72
|
+
| `Ctrl+c` | Force quit |
|
|
73
|
+
|
|
74
|
+
## Commands
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
|---------|-------------|
|
|
78
|
+
| `lazyreview` | Start TUI (repo from current dir or last context) |
|
|
79
|
+
| `lazyreview owner/repo` | Start TUI for the given GitHub repo |
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
Configuration is optional. If used, it lives at:
|
|
84
|
+
|
|
85
|
+
- **macOS / Linux:** `~/.config/lazyreview/config.yaml`
|
|
86
|
+
- **Windows:** `%APPDATA%\lazyreview\config.yaml`
|
|
87
|
+
|
|
88
|
+
Example (YAML):
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
theme: tokyo-night # tokyo-night | dracula | catppuccin-mocha
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
GitHub token can be set via:
|
|
95
|
+
|
|
96
|
+
- Prompt on first run (stored locally), or
|
|
97
|
+
- Environment variable: `GITHUB_TOKEN`
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git clone https://github.com/your-username/lazyreview.git
|
|
103
|
+
cd lazyreview
|
|
104
|
+
pnpm install
|
|
105
|
+
pnpm build
|
|
106
|
+
pnpm start
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Scripts:
|
|
110
|
+
|
|
111
|
+
- `pnpm build` – Build (tsup)
|
|
112
|
+
- `pnpm start` – Run TUI
|
|
113
|
+
- `pnpm dev` – Watch build
|
|
114
|
+
- `pnpm typecheck` – TypeScript check
|
|
115
|
+
- `pnpm test` – Run tests
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|