@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.
Files changed (2) hide show
  1. package/README.md +415 -220
  2. 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 built for agent-friendly workflows first and interactive terminal use second.
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
- The current flagship command is `ak`, a local API key manager. The CLI also includes a conservative Windows disk cleanup command for low-risk cache cleanup.
5
+ Current npm package:
6
6
 
7
- Roadmap work is underway for a new `video` command group focused on browser-assisted media detection, media downloads, and local video compression.
7
+ ```bash
8
+ npm install -g @stephenyang/stephen
9
+ ```
10
+
11
+ After installation:
8
12
 
9
- `ak` provides:
13
+ ```bash
14
+ stephen --help
15
+ ```
10
16
 
11
- - SQLite-backed local storage
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
- ## Design Philosophy
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
- `stephen` follows a few strong rules:
29
+ Output rules:
21
30
 
22
- - Machine-readable by default: commands return JSON unless table mode is explicitly requested.
23
- - Local-first: commands should work offline and avoid unnecessary remote coupling.
24
- - Secrets stay protected: sensitive values are encrypted at rest and masked in normal output.
25
- - Small, composable layers: parsing, domain logic, storage, and rendering should stay separate.
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
- ## Project Layout
36
+ ## Requirements
29
37
 
30
- ```text
31
- src/ source code
32
- docs/ local design notes and references
33
- tests/ automated tests
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
- Key modules for `ak`:
50
+ ## `ak` API Key Manager
37
51
 
38
- - `src/ak/schema.ts`: validation, field parsing, and masking helpers
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
- Key modules for `disk cleanup`:
54
+ Record fields:
47
55
 
48
- - `src/disk/types.ts`: shared report shapes
49
- - `src/disk/runtime.ts`: filesystem and process integration
50
- - `src/disk/service.ts`: conservative cleanup orchestration
51
- - `src/disk/output.ts`: JSON and table rendering
52
- - `src/disk/command.ts`: Commander-based CLI wiring
56
+ ```text
57
+ env
58
+ userId
59
+ userName
60
+ email
61
+ phone
62
+ key
63
+ ```
53
64
 
54
- ## Getting Started
65
+ Recommended environment names:
55
66
 
56
- Requirements:
67
+ ```text
68
+ bzy-pre
69
+ bzy-prod
70
+ op-pre
71
+ op-prod
72
+ gitee
73
+ github
74
+ gitlab
75
+ ```
57
76
 
58
- - Node.js 22+
59
- - npm
77
+ Custom machine-friendly `env` values are also supported.
60
78
 
61
- Install dependencies:
79
+ ### Common Commands
80
+
81
+ Add a record:
62
82
 
63
83
  ```bash
64
- npm install
84
+ stephen ak add -e github -k ghp_xxx -n Stephen -m stephen@example.com
65
85
  ```
66
86
 
67
- Run tests:
87
+ Get a record by key or ID:
68
88
 
69
89
  ```bash
70
- npm test
90
+ stephen ak get -e github -k ghp_xxx
91
+ stephen ak get --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e
71
92
  ```
72
93
 
73
- Run coverage:
94
+ List records:
74
95
 
75
96
  ```bash
76
- npm run coverage
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
- Build the CLI:
103
+ Update metadata:
80
104
 
81
105
  ```bash
82
- npm run build
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
- ## Roadmap
110
+ Delete a record:
86
111
 
87
- Planned next major capability: `video`
112
+ ```bash
113
+ stephen ak delete --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e --yes
114
+ ```
88
115
 
89
- - `video sniff`: inspect a page or media URL and return candidate downloadable video resources in JSON by default
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
- Current direction for `video`:
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
- - browser-first detection for sites that only reveal media requests during real page execution
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
- Planned defaults:
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
- - JSON output first, with optional table mode when it improves readability
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
- Supporting documents:
142
+ `config` manages local machine configuration. Currently supported key:
112
143
 
113
- - [2026-04-27-video-command-solution-report.md](/D:/Development/Stephen/PersonalCli/docs/2026-04-27-video-command-solution-report.md)
114
- - [2026-04-27-video-command-implementation-plan.md](/D:/Development/Stephen/PersonalCli/docs/2026-04-27-video-command-implementation-plan.md)
144
+ ```text
145
+ ak.dbPath
146
+ ```
115
147
 
116
- ## `ak` Command
148
+ List all config entries:
117
149
 
118
- The `ak` command manages API key records with these fields:
150
+ ```bash
151
+ stephen config list
152
+ stephen config list -t
153
+ ```
119
154
 
120
- - `env`
121
- - `userId`
122
- - `userName`
123
- - `email`
124
- - `phone`
125
- - `key`
155
+ Get one config entry:
126
156
 
127
- Recommended environments:
157
+ ```bash
158
+ stephen config get ak.dbPath
159
+ ```
128
160
 
129
- - `bzy-pre`
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
- `env` now accepts custom machine-friendly values. The built-in values above remain the recommended defaults and are shown in CLI help and validation messages.
163
+ ```bash
164
+ stephen config set ak.dbPath /Users/stephen/iDrive/stephen/ak.db
165
+ ```
138
166
 
139
- ### Examples
167
+ `ak.dbPath` resolution priority:
140
168
 
141
- Add a record:
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 ak add -e bzy-pre -k op_sk_abcdef123456 -n Stephen
145
- stephen ak add -e team-a-prod -k op_sk_abcdef123456 -n 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
- Get a record:
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 ak get -e bzy-pre -k op_sk_abcdef123456
152
- stephen ak get --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e
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
- List records:
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 ak list -e bzy-pre
159
- stephen ak list -q ste -f userName,email
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
- Update metadata:
233
+ ### Download
164
234
 
165
235
  ```bash
166
- stephen ak update -e bzy-pre -k op_sk_abcdef123456 -m new@example.com
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
- Delete a record:
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 ak delete --id fdb441954fd4573a72fb5a52ce359e0d77c3fa0e --yes
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
- ### Output Rules
267
+ ## `36kr`
176
268
 
177
- - Default output is JSON.
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
- ### Query Rules
271
+ ### Article Details
183
272
 
184
- - `-q` / `--query` enables fuzzy search
185
- - `-f` / `--field` selects searchable fields
186
- - fuzzy search is supported for `userId`, `userName`, `email`, and `phone`
187
- - `key` search is prefix-based only through a low-sensitivity prefix index
273
+ Pass the article ID; the CLI builds the article detail URL:
274
+
275
+ ```bash
276
+ stephen 36kr article 3853011900142848
277
+ ```
188
278
 
189
- ### Short Flags
279
+ Output includes:
190
280
 
191
- - `-e` => `--env`
192
- - `-u` => `--user-id`
193
- - `-n` => `--user-name`
194
- - `-m` => `--email`
195
- - `-p` => `--phone`
196
- - `-k` => `--key`
197
- - `-q` => `--query`
198
- - `-f` => `--field`
199
- - `-t` => table output
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
- ## Storage Model
302
+ ### Channel Lists
202
303
 
203
- Runtime storage uses local SQLite. The full key is encrypted before persistence, while a small prefix index supports limited prefix search for `key`.
304
+ Supported channels:
204
305
 
205
- The database path resolves in this order:
306
+ ```text
307
+ AI
308
+ technology
309
+ ```
206
310
 
207
- 1. local config file `<config dir>/config.json` with `ak.dbPath`
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
- This keeps `ak` local-first while letting each machine point to a different synced directory such as iDrive.
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
- ### iDrive Setup
319
+ Notes:
215
320
 
216
- For a synced setup, keep the config local and point the database file into the local iDrive folder on each machine.
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
- PowerShell example:
325
+ List output includes:
219
326
 
220
- ```powershell
221
- $env:STEPHEN_AK_DB_PATH = 'D:\iDrive\stephen\ak.db'
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
- Local config file example:
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
- ```json
227
- {
228
- "ak": {
229
- "dbPath": "D:\\iDrive\\stephen\\ak.db"
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
- If both are present, the local config file wins. `config get` and `config list` will still show the environment variable in `envValue`, but the effective `source` becomes `"config"`. `STEPHEN_CLI_AK_DB_PATH` is still accepted as a legacy fallback for existing machines.
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
- ## `config` Command
368
+ Notes:
237
369
 
238
- The `config` command manages local CLI configuration values.
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
- Current supported keys:
374
+ List output includes:
241
375
 
242
- - `ak.dbPath`
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
- ### Examples
392
+ ### Article Details
245
393
 
246
- List all config values and their effective sources:
394
+ Pass either an article ID or URL:
247
395
 
248
396
  ```bash
249
- stephen config list
397
+ stephen toutiao article 1234567890
398
+ stephen toutiao article https://www.toutiao.com/article/1234567890/
250
399
  ```
251
400
 
252
- Get one config value:
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 config get ak.dbPath
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
- Set one config value in the local config file:
424
+ Fetch article details for the author feed:
259
425
 
260
426
  ```bash
261
- stephen config set ak.dbPath D:\iDrive\stephen\ak.db
427
+ stephen toutiao author MS4wLjABAAAAVuJhKsIQSKk3hYJ17wPrQUnUnNT7WadBo4T-QiyRk0A --with-content
262
428
  ```
263
429
 
264
- `config set` always writes the local config file. If `STEPHEN_AK_DB_PATH` or the legacy `STEPHEN_CLI_AK_DB_PATH` is also set, the file config still has higher priority for the effective runtime value, and `config get` / `config list` will show `source: "config"`.
430
+ Notes:
265
431
 
266
- The persisted record shape is conceptually:
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
- ```ts
269
- interface AkRecord {
270
- id: string; // sha1(key)
271
- env: string; // recommended values exist, custom values allowed
272
- userId: string | null;
273
- userName: string | null;
274
- email: string | null;
275
- phone: string | null;
276
- keyCiphertext: string;
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
- ## `disk cleanup` Command
447
+ New stories:
284
448
 
285
- The `disk cleanup` command provides layered Windows cleanup. It previews by default, uses JSON output by default, and avoids deleting user data such as Downloads.
449
+ ```bash
450
+ stephen hn new
451
+ stephen hn new --limit 20
452
+ ```
286
453
 
287
- Cleanup levels:
454
+ Best stories:
288
455
 
289
- - `safe`: current conservative cache cleanup. This is the default.
290
- - `dev`: `safe` plus common developer caches.
291
- - `system`: `safe` plus Windows system cleanup actions. Applying this level requires `--confirm`.
292
- - `deep`: `dev` plus `system`, and reports the top 100 largest Downloads files/folders without deleting them. Applying this level requires `--confirm`.
456
+ ```bash
457
+ stephen hn best
458
+ stephen hn best --limit 20 -t
459
+ ```
293
460
 
294
- `safe` targets:
461
+ Search:
295
462
 
296
- - `%USERPROFILE%\AppData\Local\npm-cache`
297
- - `%USERPROFILE%\AppData\Local\NuGet`
298
- - `%USERPROFILE%\.cache`
299
- - `%USERPROFILE%\.m2`
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
- Additional `dev` targets:
468
+ Options:
304
469
 
305
- - `%USERPROFILE%\.gradle\caches`
306
- - `%USERPROFILE%\.pnpm-store`
307
- - `%USERPROFILE%\AppData\Local\pnpm\store`
308
- - `%USERPROFILE%\AppData\Local\Yarn\Cache`
309
- - `%USERPROFILE%\AppData\Local\pip\Cache`
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
- Additional `system` actions:
477
+ Output includes:
312
478
 
313
- - `%SystemRoot%\Temp`
314
- - `dism.exe /Online /Cleanup-Image /StartComponentCleanup`
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
- ### Examples
490
+ ## Commands With Table Output
317
491
 
318
- Preview cleanup results in JSON:
492
+ These commands are useful for quick human inspection:
319
493
 
320
494
  ```bash
321
- stephen disk cleanup
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
- Preview developer cleanup:
510
+ ## Development
511
+
512
+ Install dependencies:
325
513
 
326
514
  ```bash
327
- stephen disk cleanup --level dev
515
+ npm install
328
516
  ```
329
517
 
330
- Preview deep cleanup, including Downloads top 100 entries:
518
+ Type check:
331
519
 
332
520
  ```bash
333
- stephen disk cleanup --level deep
521
+ npm run check
522
+ ```
523
+
524
+ Run tests:
525
+
526
+ ```bash
527
+ npm test
334
528
  ```
335
529
 
336
- Apply safe cleanup:
530
+ Run coverage:
337
531
 
338
532
  ```bash
339
- stephen disk cleanup --apply
533
+ npm run coverage
340
534
  ```
341
535
 
342
- Apply system cleanup after explicit confirmation:
536
+ Build:
343
537
 
344
538
  ```bash
345
- stephen disk cleanup --level system --apply --confirm
539
+ npm run build
346
540
  ```
347
541
 
348
- Apply cleanup and disable Windows hibernation:
542
+ Run the built CLI locally:
349
543
 
350
544
  ```bash
351
- stephen disk cleanup --apply --disable-hibernate
545
+ node dist/index.js --help
352
546
  ```
353
547
 
354
- Render cleanup targets as a table:
548
+ Preview the npm package:
355
549
 
356
550
  ```bash
357
- stephen disk cleanup -t
551
+ npm pack --dry-run
358
552
  ```
359
553
 
360
- ### Output Rules
554
+ ## Publishing
361
555
 
362
- - Default output is JSON.
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
- ## Verification Standard
558
+ ```text
559
+ @stephenyang/stephen
560
+ ```
370
561
 
371
- Before calling work complete:
562
+ Publish:
372
563
 
373
- - run `npm test`
374
- - run `npm run coverage`
375
- - run `npm run build`
564
+ ```bash
565
+ npm publish --access public
566
+ ```
567
+
568
+ Verify after publishing:
376
569
 
377
- The project targets full unit coverage for the implemented modules.
570
+ ```bash
571
+ npm view @stephenyang/stephen version --json
572
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stephenyang/stephen",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A personal TypeScript CLI for agent-friendly workflows.",
5
5
  "homepage": "https://gitee.com/ywmblue/personal-cli",
6
6
  "bugs": {