@stephenyang/stephen 0.1.0 → 0.1.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 +415 -220
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,377 +1,572 @@
|
|
|
1
1
|
# stephen
|
|
2
2
|
|
|
3
|
-
`stephen` is a personal TypeScript CLI
|
|
3
|
+
`stephen` is a personal TypeScript CLI for scriptable, agent-friendly workflows. It returns structured JSON by default and provides table output for list-style commands when human inspection is more convenient.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Current npm package:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @stephenyang/stephen
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
After installation:
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
```bash
|
|
14
|
+
stephen --help
|
|
15
|
+
```
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
- encrypted key persistence
|
|
13
|
-
- `sha1(key)` record IDs for compatibility with existing backend lookup behavior
|
|
14
|
-
- JSON-first output for scripts and agents
|
|
15
|
-
- table output for human inspection
|
|
16
|
-
- deterministic command contracts and exit codes
|
|
17
|
+
## Command Overview
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
```text
|
|
20
|
+
stephen ak Manage local API key records
|
|
21
|
+
stephen config Manage local CLI configuration
|
|
22
|
+
stephen disk Preview or run conservative disk cleanup
|
|
23
|
+
stephen video Sniff, download, and compress video media
|
|
24
|
+
stephen 36kr Fetch 36kr article details and channel lists
|
|
25
|
+
stephen toutiao Fetch Toutiao channels, searches, author feeds, and article details
|
|
26
|
+
stephen hn Fetch Hacker News top/new/best/search lists
|
|
27
|
+
```
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
Output rules:
|
|
21
30
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- Test before behavior: production behavior is expected to be developed with TDD.
|
|
31
|
+
- JSON is the default output format. Successful responses usually look like `{ "ok": true, "data": ... }`.
|
|
32
|
+
- Errors are rendered as JSON, usually `{ "ok": false, "error": { "code": "...", "message": "..." } }`.
|
|
33
|
+
- List and summary commands support `-t` / `--table`, equivalent to `--format table`.
|
|
34
|
+
- Detail commands stay JSON-only so downstream scripts can consume the full structure.
|
|
27
35
|
|
|
28
|
-
##
|
|
36
|
+
## Requirements
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
- Node.js 22+
|
|
39
|
+
- npm
|
|
40
|
+
- `curl`: used by `36kr` with browser-like request headers
|
|
41
|
+
- Playwright Chromium: required by `toutiao` and browser-based `video` sniffing
|
|
42
|
+
- `ffmpeg`: required by `video compress`
|
|
43
|
+
|
|
44
|
+
Install the Playwright browser:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx playwright install chromium
|
|
34
48
|
```
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
## `ak` API Key Manager
|
|
37
51
|
|
|
38
|
-
|
|
39
|
-
- `src/ak/crypto.ts`: SHA-1 IDs, prefix indexing, and encryption helpers
|
|
40
|
-
- `src/ak/runtime.ts`: local config loading and storage path resolution
|
|
41
|
-
- `src/ak/repository.ts`: SQLite persistence
|
|
42
|
-
- `src/ak/service.ts`: orchestration and domain behavior
|
|
43
|
-
- `src/ak/output.ts`: JSON and table rendering
|
|
44
|
-
- `src/ak/command.ts`: Commander-based CLI wiring
|
|
52
|
+
`ak` stores API key records in a local SQLite database. Keys are encrypted at rest and masked by default in normal output. Record IDs are generated as `sha1(key)`, so records can be retrieved by either ID or original key.
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
Record fields:
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
```text
|
|
57
|
+
env
|
|
58
|
+
userId
|
|
59
|
+
userName
|
|
60
|
+
email
|
|
61
|
+
phone
|
|
62
|
+
key
|
|
63
|
+
```
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
Recommended environment names:
|
|
55
66
|
|
|
56
|
-
|
|
67
|
+
```text
|
|
68
|
+
bzy-pre
|
|
69
|
+
bzy-prod
|
|
70
|
+
op-pre
|
|
71
|
+
op-prod
|
|
72
|
+
gitee
|
|
73
|
+
github
|
|
74
|
+
gitlab
|
|
75
|
+
```
|
|
57
76
|
|
|
58
|
-
-
|
|
59
|
-
- npm
|
|
77
|
+
Custom machine-friendly `env` values are also supported.
|
|
60
78
|
|
|
61
|
-
|
|
79
|
+
### Common Commands
|
|
80
|
+
|
|
81
|
+
Add a record:
|
|
62
82
|
|
|
63
83
|
```bash
|
|
64
|
-
|
|
84
|
+
stephen ak add -e github -k ghp_xxx -n Stephen -m stephen@example.com
|
|
65
85
|
```
|
|
66
86
|
|
|
67
|
-
|
|
87
|
+
Get a record by key or ID:
|
|
68
88
|
|
|
69
89
|
```bash
|
|
70
|
-
|
|
90
|
+
stephen ak get -e github -k ghp_xxx
|
|
91
|
+
stephen ak get --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e
|
|
71
92
|
```
|
|
72
93
|
|
|
73
|
-
|
|
94
|
+
List records:
|
|
74
95
|
|
|
75
96
|
```bash
|
|
76
|
-
|
|
97
|
+
stephen ak list
|
|
98
|
+
stephen ak list -e github
|
|
99
|
+
stephen ak list -q ste -f userName,email
|
|
100
|
+
stephen ak list -q ghp_ -f key -t
|
|
77
101
|
```
|
|
78
102
|
|
|
79
|
-
|
|
103
|
+
Update metadata:
|
|
80
104
|
|
|
81
105
|
```bash
|
|
82
|
-
|
|
106
|
+
stephen ak update -e github -k ghp_xxx -n StephenYang
|
|
107
|
+
stephen ak update --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e -m new@example.com
|
|
83
108
|
```
|
|
84
109
|
|
|
85
|
-
|
|
110
|
+
Delete a record:
|
|
86
111
|
|
|
87
|
-
|
|
112
|
+
```bash
|
|
113
|
+
stephen ak delete --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e --yes
|
|
114
|
+
```
|
|
88
115
|
|
|
89
|
-
|
|
90
|
-
- `video download`: download supported media inputs including page URLs, `m3u8` streams, and direct `mp4` links
|
|
91
|
-
- `video compress`: compress local video with `ffmpeg`
|
|
116
|
+
### `ak` Options
|
|
92
117
|
|
|
93
|
-
|
|
118
|
+
```text
|
|
119
|
+
-e, --env <env> Environment
|
|
120
|
+
-u, --user-id <userId> User ID
|
|
121
|
+
-n, --user-name <userName> User name
|
|
122
|
+
-m, --email <email> Email
|
|
123
|
+
-p, --phone <phone> Phone number
|
|
124
|
+
-k, --key <key> API key
|
|
125
|
+
-q, --query <query> Fuzzy query
|
|
126
|
+
-f, --field <field> Search fields, comma-separated
|
|
127
|
+
--id <id> Record ID
|
|
128
|
+
--limit <limit> List limit, default 50, max 100
|
|
129
|
+
--raw-key Show the full key
|
|
130
|
+
--format <json|table> Output format
|
|
131
|
+
-t, --table Table output
|
|
132
|
+
```
|
|
94
133
|
|
|
95
|
-
|
|
96
|
-
- HTTP-based fallback detection for simpler pages and direct media links
|
|
97
|
-
- a unified candidate model so `sniff` and `download` can handle `m3u8` and `mp4` consistently
|
|
98
|
-
- `ffmpeg`-backed compression with default `mp4` output, `h265` video, `aac` audio, and `64k` default audio bitrate
|
|
99
|
-
- explicit parameter support for resolution, video bitrate, audio bitrate, concurrency, request headers, and output selection
|
|
134
|
+
Query rules:
|
|
100
135
|
|
|
101
|
-
|
|
136
|
+
- `userId`, `userName`, `email`, and `phone` support fuzzy search.
|
|
137
|
+
- `key` search only supports low-sensitivity prefix matching.
|
|
138
|
+
- Keys are masked unless `--raw-key` is passed.
|
|
102
139
|
|
|
103
|
-
|
|
104
|
-
- `video sniff` mode default: `auto`, preferring browser-based detection before HTTP fallback
|
|
105
|
-
- `video compress` output default: `mp4`
|
|
106
|
-
- `video compress` video codec default: `h265`
|
|
107
|
-
- `video compress` audio codec default: `aac`
|
|
108
|
-
- `video compress` audio bitrate default: `64k`
|
|
109
|
-
- resolution unchanged unless the user passes an explicit resize option
|
|
140
|
+
## `config` Local Configuration
|
|
110
141
|
|
|
111
|
-
|
|
142
|
+
`config` manages local machine configuration. Currently supported key:
|
|
112
143
|
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
```text
|
|
145
|
+
ak.dbPath
|
|
146
|
+
```
|
|
115
147
|
|
|
116
|
-
|
|
148
|
+
List all config entries:
|
|
117
149
|
|
|
118
|
-
|
|
150
|
+
```bash
|
|
151
|
+
stephen config list
|
|
152
|
+
stephen config list -t
|
|
153
|
+
```
|
|
119
154
|
|
|
120
|
-
|
|
121
|
-
- `userId`
|
|
122
|
-
- `userName`
|
|
123
|
-
- `email`
|
|
124
|
-
- `phone`
|
|
125
|
-
- `key`
|
|
155
|
+
Get one config entry:
|
|
126
156
|
|
|
127
|
-
|
|
157
|
+
```bash
|
|
158
|
+
stephen config get ak.dbPath
|
|
159
|
+
```
|
|
128
160
|
|
|
129
|
-
|
|
130
|
-
- `bzy-prod`
|
|
131
|
-
- `op-pre`
|
|
132
|
-
- `op-prod`
|
|
133
|
-
- `gitee`
|
|
134
|
-
- `github`
|
|
135
|
-
- `gitlab`
|
|
161
|
+
Set the API key database path:
|
|
136
162
|
|
|
137
|
-
|
|
163
|
+
```bash
|
|
164
|
+
stephen config set ak.dbPath /Users/stephen/iDrive/stephen/ak.db
|
|
165
|
+
```
|
|
138
166
|
|
|
139
|
-
|
|
167
|
+
`ak.dbPath` resolution priority:
|
|
140
168
|
|
|
141
|
-
|
|
169
|
+
1. Local config file value `ak.dbPath`
|
|
170
|
+
2. `STEPHEN_AK_DB_PATH`
|
|
171
|
+
3. Legacy environment variable `STEPHEN_CLI_AK_DB_PATH`
|
|
172
|
+
4. Default `env-paths` data directory
|
|
173
|
+
|
|
174
|
+
## `disk cleanup`
|
|
175
|
+
|
|
176
|
+
`disk cleanup` provides conservative Windows disk cleanup. It previews by default and does not delete anything unless `--apply` is passed.
|
|
177
|
+
|
|
178
|
+
Cleanup levels:
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
safe Default level for common safe caches
|
|
182
|
+
dev safe + common developer caches
|
|
183
|
+
system safe + Windows system cleanup actions; apply mode requires --confirm
|
|
184
|
+
deep dev + system, and reports the largest 100 Downloads entries without deleting them
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Common commands:
|
|
142
188
|
|
|
143
189
|
```bash
|
|
144
|
-
stephen
|
|
145
|
-
stephen
|
|
190
|
+
stephen disk cleanup
|
|
191
|
+
stephen disk cleanup -t
|
|
192
|
+
stephen disk cleanup --level dev
|
|
193
|
+
stephen disk cleanup --level deep
|
|
194
|
+
stephen disk cleanup --apply
|
|
195
|
+
stephen disk cleanup --level system --apply --confirm
|
|
196
|
+
stephen disk cleanup --apply --disable-hibernate
|
|
146
197
|
```
|
|
147
198
|
|
|
148
|
-
|
|
199
|
+
Notes:
|
|
200
|
+
|
|
201
|
+
- `--apply` is required before cleanup actions are executed.
|
|
202
|
+
- `system` and `deep` require `--confirm` in apply mode.
|
|
203
|
+
- Downloads is never deleted; `deep` only reports the largest files and directories for manual review.
|
|
204
|
+
|
|
205
|
+
## `video`
|
|
206
|
+
|
|
207
|
+
`video` can sniff video candidates from pages or media URLs, download `mp4` / `m3u8`, and compress local videos with `ffmpeg`.
|
|
208
|
+
|
|
209
|
+
### Sniff
|
|
149
210
|
|
|
150
211
|
```bash
|
|
151
|
-
stephen
|
|
152
|
-
stephen
|
|
212
|
+
stephen video sniff https://example.com/watch/123
|
|
213
|
+
stephen video sniff https://example.com/watch/123 -t
|
|
214
|
+
stephen video sniff https://example.com/watch/123 --mode browser
|
|
215
|
+
stephen video sniff https://cdn.example.com/video.mp4 --mode http
|
|
153
216
|
```
|
|
154
217
|
|
|
155
|
-
|
|
218
|
+
Modes:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
auto Default; try browser sniffing first, then HTTP fallback
|
|
222
|
+
browser Use Playwright to capture page network requests
|
|
223
|
+
http Inspect direct URLs, HTML, and scripts without browser execution
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Proxy examples:
|
|
156
227
|
|
|
157
228
|
```bash
|
|
158
|
-
stephen
|
|
159
|
-
stephen
|
|
160
|
-
stephen ak list -q op_sk_ab -f key -t
|
|
229
|
+
stephen video sniff https://example.com/watch/123 --proxy http://127.0.0.1:7890
|
|
230
|
+
stephen video sniff https://example.com/watch/123 --skip-proxy
|
|
161
231
|
```
|
|
162
232
|
|
|
163
|
-
|
|
233
|
+
### Download
|
|
164
234
|
|
|
165
235
|
```bash
|
|
166
|
-
stephen
|
|
236
|
+
stephen video download https://cdn.example.com/video.mp4
|
|
237
|
+
stephen video download https://cdn.example.com/master.m3u8
|
|
238
|
+
stephen video download https://example.com/watch/123 --mode browser
|
|
239
|
+
stephen video download https://example.com/watch/123 --output-dir ./downloads
|
|
167
240
|
```
|
|
168
241
|
|
|
169
|
-
|
|
242
|
+
Download behavior:
|
|
243
|
+
|
|
244
|
+
- Direct `mp4` URLs are downloaded directly.
|
|
245
|
+
- `m3u8` playlists are fetched with their segments and merged into one output.
|
|
246
|
+
- Page URLs are sniffed first, then a compatible candidate is downloaded.
|
|
247
|
+
|
|
248
|
+
### Compress
|
|
170
249
|
|
|
171
250
|
```bash
|
|
172
|
-
stephen
|
|
251
|
+
stephen video compress ./input.mov
|
|
252
|
+
stephen video compress ./input.mov --output-path ./output.mp4
|
|
253
|
+
stephen video compress ./input.mov --resolution 1280x720
|
|
254
|
+
stephen video compress ./input.mov --video-bitrate 1800k --audio-bitrate 64k
|
|
255
|
+
stephen video compress ./input.mov -t
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Default compression settings:
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
container mp4
|
|
262
|
+
video codec libx265
|
|
263
|
+
audio codec aac
|
|
264
|
+
audio bitrate 64k
|
|
173
265
|
```
|
|
174
266
|
|
|
175
|
-
|
|
267
|
+
## `36kr`
|
|
176
268
|
|
|
177
|
-
-
|
|
178
|
-
- `-t` or `--format table` switches to table rendering.
|
|
179
|
-
- `--raw-key` shows the full key.
|
|
180
|
-
- Without `--raw-key`, the key is masked.
|
|
269
|
+
`36kr` uses curl to request 36kr pages and pagination APIs with browser-like headers. It supports article details and two information channels.
|
|
181
270
|
|
|
182
|
-
###
|
|
271
|
+
### Article Details
|
|
183
272
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
273
|
+
Pass the article ID; the CLI builds the article detail URL:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
stephen 36kr article 3853011900142848
|
|
277
|
+
```
|
|
188
278
|
|
|
189
|
-
|
|
279
|
+
Output includes:
|
|
190
280
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
281
|
+
```text
|
|
282
|
+
id
|
|
283
|
+
url
|
|
284
|
+
title
|
|
285
|
+
summary
|
|
286
|
+
author
|
|
287
|
+
publishTime
|
|
288
|
+
content.html
|
|
289
|
+
content.paragraphs
|
|
290
|
+
coverImage
|
|
291
|
+
images
|
|
292
|
+
imageSources
|
|
293
|
+
stats
|
|
294
|
+
organizations
|
|
295
|
+
newestArticles
|
|
296
|
+
relatedArticles
|
|
297
|
+
latestArticles
|
|
298
|
+
nextArticle
|
|
299
|
+
request
|
|
300
|
+
```
|
|
200
301
|
|
|
201
|
-
|
|
302
|
+
### Channel Lists
|
|
202
303
|
|
|
203
|
-
|
|
304
|
+
Supported channels:
|
|
204
305
|
|
|
205
|
-
|
|
306
|
+
```text
|
|
307
|
+
AI
|
|
308
|
+
technology
|
|
309
|
+
```
|
|
206
310
|
|
|
207
|
-
|
|
208
|
-
2. `STEPHEN_AK_DB_PATH`
|
|
209
|
-
3. legacy `STEPHEN_CLI_AK_DB_PATH`
|
|
210
|
-
4. default `env-paths` data directory
|
|
311
|
+
Examples:
|
|
211
312
|
|
|
212
|
-
|
|
313
|
+
```bash
|
|
314
|
+
stephen 36kr list AI
|
|
315
|
+
stephen 36kr list technology --pages 3
|
|
316
|
+
stephen 36kr list AI --pages 2 -t
|
|
317
|
+
```
|
|
213
318
|
|
|
214
|
-
|
|
319
|
+
Notes:
|
|
215
320
|
|
|
216
|
-
|
|
321
|
+
- `--pages` must be between 1 and 20.
|
|
322
|
+
- The first page is parsed from `https://36kr.com/information/<channel>/`.
|
|
323
|
+
- Later pages use the `pageCallback` from the page and call the 36kr pagination API.
|
|
217
324
|
|
|
218
|
-
|
|
325
|
+
List output includes:
|
|
219
326
|
|
|
220
|
-
```
|
|
221
|
-
|
|
327
|
+
```text
|
|
328
|
+
channel
|
|
329
|
+
items[].id
|
|
330
|
+
items[].title
|
|
331
|
+
items[].summary
|
|
332
|
+
items[].authorName
|
|
333
|
+
items[].publishTime
|
|
334
|
+
items[].url
|
|
335
|
+
meta.fetchedPages
|
|
336
|
+
meta.totalItems
|
|
337
|
+
meta.hasNextPage
|
|
338
|
+
meta.nextPageCallback
|
|
339
|
+
request
|
|
222
340
|
```
|
|
223
341
|
|
|
224
|
-
|
|
342
|
+
## `toutiao`
|
|
343
|
+
|
|
344
|
+
`toutiao` uses Playwright Chromium to collect Toutiao page data. This is useful for pages that require real browser execution, scrolling, or response interception.
|
|
225
345
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
346
|
+
### Channels and Keyword Feeds
|
|
347
|
+
|
|
348
|
+
Supported sources:
|
|
349
|
+
|
|
350
|
+
```text
|
|
351
|
+
tech
|
|
352
|
+
AI
|
|
353
|
+
光刻机
|
|
354
|
+
芯片
|
|
355
|
+
半导体
|
|
232
356
|
```
|
|
233
357
|
|
|
234
|
-
|
|
358
|
+
Examples:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
stephen toutiao list tech
|
|
362
|
+
stephen toutiao list AI --pages 2
|
|
363
|
+
stephen toutiao list 光刻机 -t
|
|
364
|
+
stephen toutiao list 芯片 --pages 3 -t
|
|
365
|
+
stephen toutiao list 半导体
|
|
366
|
+
```
|
|
235
367
|
|
|
236
|
-
|
|
368
|
+
Notes:
|
|
237
369
|
|
|
238
|
-
|
|
370
|
+
- `tech` uses the Toutiao technology channel.
|
|
371
|
+
- `AI`, `光刻机`, `芯片`, and `半导体` use Toutiao search feeds.
|
|
372
|
+
- `--pages` must be between 1 and 5.
|
|
239
373
|
|
|
240
|
-
|
|
374
|
+
List output includes:
|
|
241
375
|
|
|
242
|
-
|
|
376
|
+
```text
|
|
377
|
+
source
|
|
378
|
+
keyword
|
|
379
|
+
items[].id
|
|
380
|
+
items[].title
|
|
381
|
+
items[].abstract
|
|
382
|
+
items[].authorName
|
|
383
|
+
items[].commentCount
|
|
384
|
+
items[].publishTime
|
|
385
|
+
items[].url
|
|
386
|
+
items[].sourceUrl
|
|
387
|
+
hasMore
|
|
388
|
+
next
|
|
389
|
+
meta
|
|
390
|
+
```
|
|
243
391
|
|
|
244
|
-
###
|
|
392
|
+
### Article Details
|
|
245
393
|
|
|
246
|
-
|
|
394
|
+
Pass either an article ID or URL:
|
|
247
395
|
|
|
248
396
|
```bash
|
|
249
|
-
stephen
|
|
397
|
+
stephen toutiao article 1234567890
|
|
398
|
+
stephen toutiao article https://www.toutiao.com/article/1234567890/
|
|
250
399
|
```
|
|
251
400
|
|
|
252
|
-
|
|
401
|
+
Output includes:
|
|
402
|
+
|
|
403
|
+
```text
|
|
404
|
+
id
|
|
405
|
+
url
|
|
406
|
+
title
|
|
407
|
+
authorName
|
|
408
|
+
publishTimeText
|
|
409
|
+
content.text
|
|
410
|
+
content.paragraphs
|
|
411
|
+
request
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Author Feeds
|
|
415
|
+
|
|
416
|
+
Pass either an author token or author homepage URL:
|
|
253
417
|
|
|
254
418
|
```bash
|
|
255
|
-
stephen
|
|
419
|
+
stephen toutiao author MS4wLjABAAAAVuJhKsIQSKk3hYJ17wPrQUnUnNT7WadBo4T-QiyRk0A
|
|
420
|
+
stephen toutiao author 'https://www.toutiao.com/c/user/token/MS4wLjABAAAAVuJhKsIQSKk3hYJ17wPrQUnUnNT7WadBo4T-QiyRk0A/?source=profile'
|
|
421
|
+
stephen toutiao author MS4wLjABAAAAVuJhKsIQSKk3hYJ17wPrQUnUnNT7WadBo4T-QiyRk0A --pages 2 -t
|
|
256
422
|
```
|
|
257
423
|
|
|
258
|
-
|
|
424
|
+
Fetch article details for the author feed:
|
|
259
425
|
|
|
260
426
|
```bash
|
|
261
|
-
stephen
|
|
427
|
+
stephen toutiao author MS4wLjABAAAAVuJhKsIQSKk3hYJ17wPrQUnUnNT7WadBo4T-QiyRk0A --with-content
|
|
262
428
|
```
|
|
263
429
|
|
|
264
|
-
|
|
430
|
+
Notes:
|
|
265
431
|
|
|
266
|
-
|
|
432
|
+
- `--pages` must be between 1 and 5.
|
|
433
|
+
- Without `--with-content`, the command returns only the author article list.
|
|
434
|
+
- With `--with-content`, article details are fetched and returned in the `articles` field.
|
|
267
435
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
keySearchPrefix: string;
|
|
278
|
-
createdAt: string;
|
|
279
|
-
updatedAt: string;
|
|
280
|
-
}
|
|
436
|
+
## `hn` Hacker News
|
|
437
|
+
|
|
438
|
+
`hn` supports Hacker News story lists and search. JSON is the default output format, and list output supports `-t`.
|
|
439
|
+
|
|
440
|
+
Top stories:
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
stephen hn top
|
|
444
|
+
stephen hn top --limit 10 -t
|
|
281
445
|
```
|
|
282
446
|
|
|
283
|
-
|
|
447
|
+
New stories:
|
|
284
448
|
|
|
285
|
-
|
|
449
|
+
```bash
|
|
450
|
+
stephen hn new
|
|
451
|
+
stephen hn new --limit 20
|
|
452
|
+
```
|
|
286
453
|
|
|
287
|
-
|
|
454
|
+
Best stories:
|
|
288
455
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
456
|
+
```bash
|
|
457
|
+
stephen hn best
|
|
458
|
+
stephen hn best --limit 20 -t
|
|
459
|
+
```
|
|
293
460
|
|
|
294
|
-
|
|
461
|
+
Search:
|
|
295
462
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
-
|
|
299
|
-
|
|
300
|
-
- `%USERPROFILE%\AppData\Local\Temp`
|
|
301
|
-
- `%SystemRoot%\SoftwareDistribution\Download`
|
|
463
|
+
```bash
|
|
464
|
+
stephen hn search openai
|
|
465
|
+
stephen hn search "browser automation" --sort date --limit 20 -t
|
|
466
|
+
```
|
|
302
467
|
|
|
303
|
-
|
|
468
|
+
Options:
|
|
304
469
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
-
|
|
470
|
+
```text
|
|
471
|
+
--limit <limit> Number of items, 1 to 100
|
|
472
|
+
--sort <relevance|date> Search sort, default relevance
|
|
473
|
+
--format <json|table> Output format
|
|
474
|
+
-t, --table Table output
|
|
475
|
+
```
|
|
310
476
|
|
|
311
|
-
|
|
477
|
+
Output includes:
|
|
312
478
|
|
|
313
|
-
|
|
314
|
-
|
|
479
|
+
```text
|
|
480
|
+
items[].id
|
|
481
|
+
items[].title
|
|
482
|
+
items[].author
|
|
483
|
+
items[].score
|
|
484
|
+
items[].commentCount
|
|
485
|
+
items[].time
|
|
486
|
+
items[].url
|
|
487
|
+
meta
|
|
488
|
+
```
|
|
315
489
|
|
|
316
|
-
|
|
490
|
+
## Commands With Table Output
|
|
317
491
|
|
|
318
|
-
|
|
492
|
+
These commands are useful for quick human inspection:
|
|
319
493
|
|
|
320
494
|
```bash
|
|
321
|
-
stephen
|
|
495
|
+
stephen ak list -t
|
|
496
|
+
stephen config list -t
|
|
497
|
+
stephen disk cleanup -t
|
|
498
|
+
stephen video sniff <url> -t
|
|
499
|
+
stephen video download <url> -t
|
|
500
|
+
stephen video compress <file> -t
|
|
501
|
+
stephen 36kr list AI -t
|
|
502
|
+
stephen toutiao list tech -t
|
|
503
|
+
stephen toutiao author <token-or-url> -t
|
|
504
|
+
stephen hn top -t
|
|
505
|
+
stephen hn new -t
|
|
506
|
+
stephen hn best -t
|
|
507
|
+
stephen hn search openai -t
|
|
322
508
|
```
|
|
323
509
|
|
|
324
|
-
|
|
510
|
+
## Development
|
|
511
|
+
|
|
512
|
+
Install dependencies:
|
|
325
513
|
|
|
326
514
|
```bash
|
|
327
|
-
|
|
515
|
+
npm install
|
|
328
516
|
```
|
|
329
517
|
|
|
330
|
-
|
|
518
|
+
Type check:
|
|
331
519
|
|
|
332
520
|
```bash
|
|
333
|
-
|
|
521
|
+
npm run check
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Run tests:
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
npm test
|
|
334
528
|
```
|
|
335
529
|
|
|
336
|
-
|
|
530
|
+
Run coverage:
|
|
337
531
|
|
|
338
532
|
```bash
|
|
339
|
-
|
|
533
|
+
npm run coverage
|
|
340
534
|
```
|
|
341
535
|
|
|
342
|
-
|
|
536
|
+
Build:
|
|
343
537
|
|
|
344
538
|
```bash
|
|
345
|
-
|
|
539
|
+
npm run build
|
|
346
540
|
```
|
|
347
541
|
|
|
348
|
-
|
|
542
|
+
Run the built CLI locally:
|
|
349
543
|
|
|
350
544
|
```bash
|
|
351
|
-
|
|
545
|
+
node dist/index.js --help
|
|
352
546
|
```
|
|
353
547
|
|
|
354
|
-
|
|
548
|
+
Preview the npm package:
|
|
355
549
|
|
|
356
550
|
```bash
|
|
357
|
-
|
|
551
|
+
npm pack --dry-run
|
|
358
552
|
```
|
|
359
553
|
|
|
360
|
-
|
|
554
|
+
## Publishing
|
|
361
555
|
|
|
362
|
-
|
|
363
|
-
- `-t` or `--format table` switches to table rendering.
|
|
364
|
-
- Preview mode is the default.
|
|
365
|
-
- `--apply` is required before any cleanup is executed.
|
|
366
|
-
- `--confirm` is required for `system --apply` and `deep --apply`.
|
|
367
|
-
- Downloads is never deleted; `deep` only lists the largest 100 files/folders.
|
|
556
|
+
The current package is a scoped public package:
|
|
368
557
|
|
|
369
|
-
|
|
558
|
+
```text
|
|
559
|
+
@stephenyang/stephen
|
|
560
|
+
```
|
|
370
561
|
|
|
371
|
-
|
|
562
|
+
Publish:
|
|
372
563
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
564
|
+
```bash
|
|
565
|
+
npm publish --access public
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
Verify after publishing:
|
|
376
569
|
|
|
377
|
-
|
|
570
|
+
```bash
|
|
571
|
+
npm view @stephenyang/stephen version --json
|
|
572
|
+
```
|