@brianlovin/hn-cli 0.3.0 → 0.4.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.
- package/README.md +80 -18
- package/dist/cli.js +89 -82
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ bun run start
|
|
|
40
40
|
| `⌘j` / `⌘k` | Navigate between root-level comments |
|
|
41
41
|
| `o` | Open story URL in browser |
|
|
42
42
|
| `c` | Chat with AI about the story |
|
|
43
|
+
| `s` | Open settings |
|
|
43
44
|
| `r` | Refresh stories |
|
|
44
45
|
| `q` | Quit |
|
|
45
46
|
|
|
@@ -70,15 +71,6 @@ export OPENAI_API_KEY=sk-...
|
|
|
70
71
|
|
|
71
72
|
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
73
|
|
|
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
74
|
---
|
|
83
75
|
|
|
84
76
|
## Development
|
|
@@ -89,6 +81,21 @@ While in chat mode, press `,` to access settings where you can:
|
|
|
89
81
|
bun install # Install dependencies
|
|
90
82
|
bun run start # Run the app
|
|
91
83
|
bun run dev # Run with hot reload
|
|
84
|
+
bun run dev:update # Run with simulated update notification
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Testing the update notification
|
|
88
|
+
|
|
89
|
+
To test the update notification UI without publishing a new version:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
bun run dev:update
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
You can also customize the simulated versions:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
HN_SIMULATE_VERSION=0.2.0 HN_SIMULATE_LATEST=0.5.0 bun run start
|
|
92
99
|
```
|
|
93
100
|
|
|
94
101
|
### Testing
|
|
@@ -112,23 +119,78 @@ bun run debug highlighted-comment # Test comment highlighting
|
|
|
112
119
|
- `src/app.ts` - Main app class with UI and keyboard handling
|
|
113
120
|
- `src/api.ts` - API client for fetching from HNPWA API
|
|
114
121
|
- `src/config.ts` - Configuration and API key management
|
|
122
|
+
- `src/settings.ts` - Configurable filter settings with validation
|
|
115
123
|
- `src/types.ts` - TypeScript types for HN data structures
|
|
116
124
|
- `src/test/` - Test suite
|
|
117
125
|
|
|
126
|
+
## Settings
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
|
|
130
|
+
### AI Provider
|
|
131
|
+
|
|
132
|
+
- Switch between Anthropic and OpenAI
|
|
133
|
+
- Change the model (Claude Sonnet/Haiku, GPT-4o/4o-mini)
|
|
134
|
+
- Add or clear API keys
|
|
135
|
+
|
|
136
|
+
### Story Filtering
|
|
137
|
+
|
|
138
|
+
These settings control which stories appear in your feed:
|
|
139
|
+
|
|
140
|
+
| Setting | Default | Description |
|
|
141
|
+
| ---------------- | ------- | ------------------------------------------------- |
|
|
142
|
+
| Max Stories | 24 | Maximum number of stories to display |
|
|
143
|
+
| Time Window | 24h | Only show stories from the last N hours |
|
|
144
|
+
| Min Points | 50 | Minimum upvotes required (OR min comments) |
|
|
145
|
+
| Min Comments | 20 | Minimum comments required (OR min points) |
|
|
146
|
+
|
|
147
|
+
### Comment Display
|
|
148
|
+
|
|
149
|
+
| Setting | Default | Description |
|
|
150
|
+
| ---------------- | ------- | ------------------------------------------------- |
|
|
151
|
+
| Root Comments | 12 | Maximum root-level comments shown per story |
|
|
152
|
+
| Child Comments | 8 | Maximum replies shown per comment |
|
|
153
|
+
| Nesting Depth | 3 | Maximum levels of nested replies |
|
|
154
|
+
|
|
155
|
+
Settings are stored locally at `~/.config/hn-cli/config.json`.
|
|
156
|
+
|
|
118
157
|
## Design decisions
|
|
119
158
|
|
|
120
|
-
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
All defaults are now customizable via the settings panel (`s`).
|
|
162
|
+
|
|
163
|
+
## Telemetry
|
|
164
|
+
|
|
165
|
+
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.
|
|
121
166
|
|
|
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
|
|
167
|
+
### What's collected
|
|
128
168
|
|
|
129
|
-
|
|
169
|
+
- App launches (with version number)
|
|
170
|
+
- Feature usage counts (TLDR, chat, refresh)
|
|
171
|
+
- Navigation patterns (stories selected, comments viewed)
|
|
172
|
+
- Keyboard shortcut usage
|
|
173
|
+
|
|
174
|
+
### What's NOT collected
|
|
175
|
+
|
|
176
|
+
- Story content, titles, or URLs
|
|
177
|
+
- Chat messages or AI responses
|
|
178
|
+
- API keys or credentials
|
|
179
|
+
- IP addresses or location data
|
|
180
|
+
|
|
181
|
+
### Disabling telemetry
|
|
182
|
+
|
|
183
|
+
**Option 1: Settings menu**
|
|
184
|
+
|
|
185
|
+
Press `s` to open settings, then toggle "Telemetry" off.
|
|
186
|
+
|
|
187
|
+
**Option 2: Launch flag**
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
hn --disable-telemetry
|
|
191
|
+
```
|
|
130
192
|
|
|
131
|
-
|
|
193
|
+
This permanently disables telemetry. Your preference is stored locally at `~/.config/hn-cli/config.json`.
|
|
132
194
|
|
|
133
195
|
## Credits
|
|
134
196
|
|