@brianlovin/hn-cli 0.3.0 → 0.4.1
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 +88 -34
- package/dist/cli.js +89 -82
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A terminal UI for browsing Hacker News, modeled after the HN reader on my [personal website](https://brianlovin.com/hn).
|
|
4
4
|
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
bunx @brianlovin/hn-cli
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
> Requires [Bun](https://bun.sh). Install with `curl -fsSL https://bun.sh/install | bash`
|
|
12
|
-
|
|
13
5
|
## Installation
|
|
14
6
|
|
|
15
7
|
```bash
|
|
@@ -34,14 +26,15 @@ bun run start
|
|
|
34
26
|
|
|
35
27
|
### Navigation
|
|
36
28
|
|
|
37
|
-
| Key
|
|
38
|
-
|
|
|
39
|
-
| `j` / `k`
|
|
40
|
-
|
|
|
41
|
-
| `o`
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
29
|
+
| Key | Action |
|
|
30
|
+
| --------- | ---------------------------- |
|
|
31
|
+
| `j` / `k` | Navigate between stories |
|
|
32
|
+
| `space` | Jump to next root comment |
|
|
33
|
+
| `o` | Open story URL in browser |
|
|
34
|
+
| `r` | Refresh stories |
|
|
35
|
+
| `c` | Chat with AI about the story |
|
|
36
|
+
| `t` | AI-generated tl;dr |
|
|
37
|
+
| `s` | Open settings |
|
|
45
38
|
|
|
46
39
|
### Mouse Support
|
|
47
40
|
|
|
@@ -70,15 +63,6 @@ export OPENAI_API_KEY=sk-...
|
|
|
70
63
|
|
|
71
64
|
Press `c` to start a chat, and you'll be guided through the setup. Your key is stored locally at `~/.config/hn-cli/config.json`.
|
|
72
65
|
|
|
73
|
-
**Settings**
|
|
74
|
-
|
|
75
|
-
While in chat mode, press `,` to access settings where you can:
|
|
76
|
-
|
|
77
|
-
- Switch between Anthropic and OpenAI
|
|
78
|
-
- Change the model
|
|
79
|
-
- Add additional API keys
|
|
80
|
-
- Clear stored keys
|
|
81
|
-
|
|
82
66
|
---
|
|
83
67
|
|
|
84
68
|
## Development
|
|
@@ -89,6 +73,21 @@ While in chat mode, press `,` to access settings where you can:
|
|
|
89
73
|
bun install # Install dependencies
|
|
90
74
|
bun run start # Run the app
|
|
91
75
|
bun run dev # Run with hot reload
|
|
76
|
+
bun run dev:update # Run with simulated update notification
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Testing the update notification
|
|
80
|
+
|
|
81
|
+
To test the update notification UI without publishing a new version:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
bun run dev:update
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
You can also customize the simulated versions:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
HN_SIMULATE_VERSION=0.2.0 HN_SIMULATE_LATEST=0.5.0 bun run start
|
|
92
91
|
```
|
|
93
92
|
|
|
94
93
|
### Testing
|
|
@@ -112,23 +111,78 @@ bun run debug highlighted-comment # Test comment highlighting
|
|
|
112
111
|
- `src/app.ts` - Main app class with UI and keyboard handling
|
|
113
112
|
- `src/api.ts` - API client for fetching from HNPWA API
|
|
114
113
|
- `src/config.ts` - Configuration and API key management
|
|
114
|
+
- `src/settings.ts` - Configurable filter settings with validation
|
|
115
115
|
- `src/types.ts` - TypeScript types for HN data structures
|
|
116
116
|
- `src/test/` - Test suite
|
|
117
117
|
|
|
118
|
+
## Settings
|
|
119
|
+
|
|
120
|
+
Press `s` at any time to open the settings panel. Use `j`/`k` to navigate, `←`/`→` or `Enter` to adjust values, and `r` to reset all settings to defaults.
|
|
121
|
+
|
|
122
|
+
### AI Provider
|
|
123
|
+
|
|
124
|
+
- Switch between Anthropic and OpenAI
|
|
125
|
+
- Change the model (Claude Sonnet/Haiku, GPT-4o/4o-mini)
|
|
126
|
+
- Add or clear API keys
|
|
127
|
+
|
|
128
|
+
### Story Filtering
|
|
129
|
+
|
|
130
|
+
These settings control which stories appear in your feed:
|
|
131
|
+
|
|
132
|
+
| Setting | Default | Description |
|
|
133
|
+
| ------------ | ------- | ------------------------------------------ |
|
|
134
|
+
| Max Stories | 24 | Maximum number of stories to display |
|
|
135
|
+
| Time Window | 24h | Only show stories from the last N hours |
|
|
136
|
+
| Min Points | 50 | Minimum upvotes required (OR min comments) |
|
|
137
|
+
| Min Comments | 20 | Minimum comments required (OR min points) |
|
|
138
|
+
|
|
139
|
+
### Comment Display
|
|
140
|
+
|
|
141
|
+
| Setting | Default | Description |
|
|
142
|
+
| -------------- | ------- | ------------------------------------------- |
|
|
143
|
+
| Root Comments | 12 | Maximum root-level comments shown per story |
|
|
144
|
+
| Child Comments | 8 | Maximum replies shown per comment |
|
|
145
|
+
| Nesting Depth | 3 | Maximum levels of nested replies |
|
|
146
|
+
|
|
147
|
+
Settings are stored locally at `~/.config/hn-cli/config.json`.
|
|
148
|
+
|
|
118
149
|
## Design decisions
|
|
119
150
|
|
|
120
|
-
|
|
151
|
+
The default settings match my HN reader on my [personal website](https://brianlovin.com/hn). I made these choices so that it's easier for me to keep up with the most interesting stories throughout the day without getting sucked too deep into long comment threads or the flood of new submissions.
|
|
152
|
+
|
|
153
|
+
All defaults are now customizable via the settings panel (`s`).
|
|
154
|
+
|
|
155
|
+
## Telemetry
|
|
121
156
|
|
|
122
|
-
|
|
123
|
-
- Only shows "link" type posts (excludes jobs, polls)
|
|
124
|
-
- Requires minimum story engagement: 50+ points OR 20+ comments
|
|
125
|
-
- Ranked by: points + (comments × 0.75) + recency bonus
|
|
126
|
-
- Maximum 24 posts displayed
|
|
127
|
-
- Comments: max 12 root comments, max 8 children per parent, max 3 levels deep
|
|
157
|
+
This CLI collects anonymous usage data to help understand how people use it and what features to improve. No personal information or content is ever collected.
|
|
128
158
|
|
|
129
|
-
|
|
159
|
+
### What's collected
|
|
160
|
+
|
|
161
|
+
- App launches (with version number)
|
|
162
|
+
- Feature usage counts (TLDR, chat, refresh)
|
|
163
|
+
- Navigation patterns (stories selected, comments viewed)
|
|
164
|
+
- Keyboard shortcut usage
|
|
165
|
+
|
|
166
|
+
### What's NOT collected
|
|
167
|
+
|
|
168
|
+
- Story content, titles, or URLs
|
|
169
|
+
- Chat messages or AI responses
|
|
170
|
+
- API keys or credentials
|
|
171
|
+
- IP addresses or location data
|
|
172
|
+
|
|
173
|
+
### Disabling telemetry
|
|
174
|
+
|
|
175
|
+
**Option 1: Settings menu**
|
|
176
|
+
|
|
177
|
+
Press `s` to open settings, then toggle "Telemetry" off.
|
|
178
|
+
|
|
179
|
+
**Option 2: Launch flag**
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
hn --disable-telemetry
|
|
183
|
+
```
|
|
130
184
|
|
|
131
|
-
|
|
185
|
+
This permanently disables telemetry. Your preference is stored locally at `~/.config/hn-cli/config.json`.
|
|
132
186
|
|
|
133
187
|
## Credits
|
|
134
188
|
|