nber-cli 0.2.0__tar.gz → 0.3.0__tar.gz

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 (73) hide show
  1. {nber_cli-0.2.0 → nber_cli-0.3.0}/CHANGELOG.md +14 -0
  2. {nber_cli-0.2.0 → nber_cli-0.3.0}/PKG-INFO +1 -1
  3. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/changelog.md +16 -0
  4. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/cli.md +107 -1
  5. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/configuration.md +49 -1
  6. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/getting-started.md +30 -0
  7. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/index.md +4 -1
  8. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/python-api.md +96 -1
  9. nber_cli-0.3.0/docs/zh/changelog.md +41 -0
  10. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/cli.md +107 -1
  11. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/configuration.md +49 -1
  12. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/getting-started.md +30 -0
  13. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/index.md +4 -1
  14. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/python-api.md +96 -1
  15. {nber_cli-0.2.0 → nber_cli-0.3.0}/pyproject.toml +1 -1
  16. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/__init__.py +20 -1
  17. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/cli.py +200 -3
  18. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/core/models.py +34 -0
  19. nber_cli-0.3.0/src/nber_cli/feed.py +419 -0
  20. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/formatters.py +62 -1
  21. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/test_cli.py +376 -3
  22. nber_cli-0.3.0/tests/test_feed.py +382 -0
  23. {nber_cli-0.2.0 → nber_cli-0.3.0}/uv.lock +1 -1
  24. nber_cli-0.2.0/docs/zh/changelog.md +0 -25
  25. {nber_cli-0.2.0 → nber_cli-0.3.0}/.claude/agents/code-to-docs.md +0 -0
  26. {nber_cli-0.2.0 → nber_cli-0.3.0}/.claude/agents/sync-docs-for-i18n.md +0 -0
  27. {nber_cli-0.2.0 → nber_cli-0.3.0}/.claude/settings.json +0 -0
  28. {nber_cli-0.2.0 → nber_cli-0.3.0}/.claude-plugin/marketplace.json +0 -0
  29. {nber_cli-0.2.0 → nber_cli-0.3.0}/.codex/config.toml +0 -0
  30. {nber_cli-0.2.0 → nber_cli-0.3.0}/.github/workflows/docs.yml +0 -0
  31. {nber_cli-0.2.0 → nber_cli-0.3.0}/.github/workflows/lint.yml +0 -0
  32. {nber_cli-0.2.0 → nber_cli-0.3.0}/.github/workflows/publish.yml +0 -0
  33. {nber_cli-0.2.0 → nber_cli-0.3.0}/.github/workflows/pytest.yml +0 -0
  34. {nber_cli-0.2.0 → nber_cli-0.3.0}/.gitignore +0 -0
  35. {nber_cli-0.2.0 → nber_cli-0.3.0}/.mcp.json +0 -0
  36. {nber_cli-0.2.0 → nber_cli-0.3.0}/.python-version +0 -0
  37. {nber_cli-0.2.0 → nber_cli-0.3.0}/LICENSE +0 -0
  38. {nber_cli-0.2.0 → nber_cli-0.3.0}/README.md +0 -0
  39. {nber_cli-0.2.0 → nber_cli-0.3.0}/README.zh-CN.md +0 -0
  40. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/agents/claude-code.md +0 -0
  41. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/agents/codex.md +0 -0
  42. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/agents/index.md +0 -0
  43. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/agents/openclaw.md +0 -0
  44. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/agents/others.md +0 -0
  45. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/contributing.md +0 -0
  46. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/development.md +0 -0
  47. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/mcp.md +0 -0
  48. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/en/policy.md +0 -0
  49. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/agents/claude-code.md +0 -0
  50. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/agents/codex.md +0 -0
  51. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/agents/index.md +0 -0
  52. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/agents/openclaw.md +0 -0
  53. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/agents/others.md +0 -0
  54. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/contributing.md +0 -0
  55. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/development.md +0 -0
  56. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/mcp.md +0 -0
  57. {nber_cli-0.2.0 → nber_cli-0.3.0}/docs/zh/policy.md +0 -0
  58. {nber_cli-0.2.0 → nber_cli-0.3.0}/mkdocs.yml +0 -0
  59. {nber_cli-0.2.0 → nber_cli-0.3.0}/plugins/nber-cli/.claude-plugin/plugin.json +0 -0
  60. {nber_cli-0.2.0 → nber_cli-0.3.0}/plugins/nber-cli/.codex-plugin/plugin.json +0 -0
  61. {nber_cli-0.2.0 → nber_cli-0.3.0}/plugins/nber-cli/.mcp.json +0 -0
  62. {nber_cli-0.2.0 → nber_cli-0.3.0}/plugins/nber-cli/skills/NBER-CLI/SKILL.md +0 -0
  63. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/__main__.py +0 -0
  64. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/config.py +0 -0
  65. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/core/__init__.py +0 -0
  66. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/download.py +0 -0
  67. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/fetcher.py +0 -0
  68. {nber_cli-0.2.0 → nber_cli-0.3.0}/src/nber_cli/mcp.py +0 -0
  69. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/__init__.py +0 -0
  70. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/conftest.py +0 -0
  71. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/test_downloader.py +0 -0
  72. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/test_fetcher.py +0 -0
  73. {nber_cli-0.2.0 → nber_cli-0.3.0}/tests/test_main.py +0 -0
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.3.0] - 2026-06-03
6
+
7
+ ### Added
8
+ - `feed init` subcommand: initialize a local SQLite feed cache and write its path to user config.
9
+ - `feed fetch` subcommand: fetch NBER's new working papers RSS feed, cache seen items, and show newly discovered papers by default.
10
+ - `feed fetch --max-items`: limit displayed feed output. When used without `--display-all`, display-all behavior is enabled automatically.
11
+ - `feed migrate` subcommand: move the feed cache database and SQLite sidecar files to a new path, then update user config.
12
+ - `feed clean` subcommand: clean cached feed database records by age, date range, or all records after interactive confirmation.
13
+ - Python API exports for feed cache helpers and feed result models.
14
+
15
+ ### Changed
16
+ - Added user config support at `~/.nber-cli/config.json` for the feed cache database path.
17
+ - Expanded English and Chinese documentation for feed commands, configuration, Python API, and release notes.
18
+
5
19
  ## [0.2.0] - 2026-05-31
6
20
 
7
21
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nber-cli
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A command line interface for reaching the National Bureau of Economic Research (NBER) paper without brower.
5
5
  Project-URL: Homepage, https://github.com/sepinetam/nber-cli
6
6
  Project-URL: Repository, https://github.com/sepinetam/nber-cli
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this project will be documented here.
4
4
 
5
+ ## 0.3.0 - 2026-06-03
6
+
7
+ ### Added
8
+
9
+ - Added `nber-cli feed init` for creating a local SQLite feed cache.
10
+ - Added `nber-cli feed fetch` for fetching NBER's new working papers RSS feed and showing newly cached items.
11
+ - Added `nber-cli feed fetch --max-items` for limiting displayed feed output.
12
+ - Added `nber-cli feed migrate` for moving the feed cache database and updating user config.
13
+ - Added `nber-cli feed clean` for cleaning cached feed database records with confirmation.
14
+ - Added Python API documentation for feed cache helpers and feed data models.
15
+
16
+ ### Changed
17
+
18
+ - Added user config documentation for `~/.nber-cli/config.json` and `feed.db-path`.
19
+ - Expanded English and Chinese feed cache documentation across CLI, getting started, configuration, and Python API pages.
20
+
5
21
  ## 0.2.0 - 2026-05-27
6
22
 
7
23
  ### Changed
@@ -22,6 +22,7 @@ Running `nber-cli` without a subcommand prints the top-level help and exits succ
22
22
  | `download` | Download one or more paper PDFs. |
23
23
  | `info` | Show metadata and abstract for one paper. |
24
24
  | `search` | Search NBER working papers. |
25
+ | `feed` | Manage the NBER new working papers RSS feed cache. |
25
26
  | `mcp-server` | Start the MCP server for agents. |
26
27
 
27
28
  ## download
@@ -139,6 +140,111 @@ nber-cli search "inflation" -f json
139
140
 
140
141
  When only `--start-date` is provided, NBER-CLI automatically uses the current date as the end date.
141
142
 
143
+ ## feed
144
+
145
+ `feed` works with NBER's new working papers RSS feed and a local SQLite cache. The cache tracks which RSS items have already been seen, so `feed fetch` can show only newly discovered papers by default.
146
+
147
+ ### feed init
148
+
149
+ Initialize the feed cache database and write the database path to the user config:
150
+
151
+ ```bash
152
+ nber-cli feed init
153
+ nber-cli feed init --db-path ~/.nber-cli/feed.db
154
+ ```
155
+
156
+ If `--db-path` is omitted, the default database path is `~/.nber-cli/feed.db`.
157
+
158
+ ### feed fetch
159
+
160
+ Fetch the RSS feed, store all fetched items in the cache, and display only new items by default:
161
+
162
+ ```bash
163
+ nber-cli feed fetch
164
+ ```
165
+
166
+ Display all fetched RSS items, including items already present in the cache:
167
+
168
+ ```bash
169
+ nber-cli feed fetch --display-all true
170
+ nber-cli feed fetch --display-all
171
+ ```
172
+
173
+ Limit displayed output:
174
+
175
+ ```bash
176
+ nber-cli feed fetch --max-items 5
177
+ ```
178
+
179
+ When `--max-items` is provided and `--display-all` is omitted, `--display-all` defaults to `true`. This makes `nber-cli feed fetch --max-items 5` show the first five fetched RSS items instead of showing nothing when there are no new items.
180
+
181
+ Return JSON:
182
+
183
+ ```bash
184
+ nber-cli feed fetch --format json
185
+ nber-cli feed fetch -f json
186
+ ```
187
+
188
+ ### feed migrate
189
+
190
+ Move the feed cache database to a new path and update the user config:
191
+
192
+ ```bash
193
+ nber-cli feed migrate ~/data/nber-feed.db
194
+ ```
195
+
196
+ Migration moves the SQLite database file and any SQLite sidecar files such as `-wal`, `-shm`, and `-journal`. The target path must not already exist.
197
+
198
+ ### feed clean
199
+
200
+ Clean cached feed database records. This deletes records from the local cache, not from NBER. Deleted cache records may be fetched again as new items if they still appear in the RSS feed.
201
+
202
+ Clean records not seen for 30 days:
203
+
204
+ ```bash
205
+ nber-cli feed clean
206
+ nber-cli feed clean --days 30
207
+ ```
208
+
209
+ Clean all cached records:
210
+
211
+ ```bash
212
+ nber-cli feed clean --all
213
+ ```
214
+
215
+ Clean records by last-seen date:
216
+
217
+ ```bash
218
+ nber-cli feed clean --end-date 2026-05-31
219
+ nber-cli feed clean --start-date 2026-05-01 --end-date 2026-05-31
220
+ ```
221
+
222
+ `--end-date` without `--start-date` cleans from the earliest cached record through the end date. `--start-date` and `--end-date` are inclusive. Passing only `--start-date` is invalid.
223
+
224
+ Before deleting anything, `feed clean` prints how many cached records match and asks for confirmation:
225
+
226
+ ```text
227
+ This operation is irreversible.
228
+ Deleted cache records may be fetched again as new items if they still appear in the RSS feed.
229
+ Continue? [y/N]:
230
+ ```
231
+
232
+ Only `y` or `Y` continues. Any other response aborts without deleting records.
233
+
234
+ ### feed Options
235
+
236
+ | Subcommand | Option | Description |
237
+ | --- | --- | --- |
238
+ | `init` | `--db-path` | SQLite cache database path. Defaults to `~/.nber-cli/feed.db`. |
239
+ | `fetch` | `--display-all [true|false]` | Display all fetched RSS items instead of only new items. |
240
+ | `fetch` | `--format`, `-f` | Output format: `list` or `json`. Defaults to `list`. |
241
+ | `fetch` | `--max-items` | Maximum number of feed items to display. |
242
+ | `migrate` | `new_db_path` | New SQLite cache database path. |
243
+ | `clean` | `--days` | Clean cached records not seen for this many days. Defaults to `30`. |
244
+ | `clean` | `--all` | Clean all cached feed records. |
245
+ | `clean` | `--start-date` | Clean cached records last seen on or after this date, formatted `YYYY-MM-DD`. |
246
+ | `clean` | `--end-date` | Clean cached records last seen on or before this date, formatted `YYYY-MM-DD`. |
247
+
142
248
  ## mcp-server
143
249
 
144
250
  Start the default stdio MCP server:
@@ -172,4 +278,4 @@ For client configuration and tool details, see [MCP Server](mcp.md).
172
278
 
173
279
  ## Output Formats
174
280
 
175
- `info` and `search` default to `list`, a readable text format. Use `--format json` when piping output into scripts or agent workflows.
281
+ `info`, `search`, and `feed fetch` default to `list`, a readable text format. Use `--format json` when piping output into scripts or agent workflows.
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- NBER-CLI currently uses built-in runtime defaults rather than a user configuration file. The defaults are intentionally conservative and work for both CLI and MCP usage.
3
+ Most NBER-CLI runtime behavior uses built-in defaults. The feed cache also uses a small user config file to remember the SQLite database path selected by `nber-cli feed init` or `nber-cli feed migrate`.
4
4
 
5
5
  ## Runtime Defaults
6
6
 
@@ -15,6 +15,54 @@ NBER-CLI currently uses built-in runtime defaults rather than a user configurati
15
15
 
16
16
  These values live in `NBERCLIConfig` and `NBER_CLI_CONFIG`.
17
17
 
18
+ ## User Config File
19
+
20
+ The user config file is:
21
+
22
+ ```text
23
+ ~/.nber-cli/config.json
24
+ ```
25
+
26
+ At the moment, the config file is used for feed cache settings:
27
+
28
+ ```json
29
+ {
30
+ "feed": {
31
+ "db-path": "/Users/name/.nber-cli/feed.db"
32
+ }
33
+ }
34
+ ```
35
+
36
+ `feed.db-path` points to the SQLite database used by `nber-cli feed fetch` and `nber-cli feed clean`.
37
+
38
+ ## Feed Cache Database
39
+
40
+ Default feed cache database path:
41
+
42
+ ```text
43
+ ~/.nber-cli/feed.db
44
+ ```
45
+
46
+ Initialize the default cache:
47
+
48
+ ```bash
49
+ nber-cli feed init
50
+ ```
51
+
52
+ Initialize a cache at a custom path:
53
+
54
+ ```bash
55
+ nber-cli feed init --db-path ~/data/nber-feed.db
56
+ ```
57
+
58
+ Move an existing cache and update the config:
59
+
60
+ ```bash
61
+ nber-cli feed migrate ~/data/nber-feed.db
62
+ ```
63
+
64
+ The feed cache stores RSS items that have already been seen. `feed fetch` uses this cache to decide which items are new. `feed clean` deletes records from this local cache; if deleted records still appear in the RSS feed, they may be fetched again as new items.
65
+
18
66
  ## Output Paths
19
67
 
20
68
  Single download default:
@@ -73,6 +73,36 @@ Use `--all` to include related fields and published-version information when NBE
73
73
  nber-cli info w25000 --all
74
74
  ```
75
75
 
76
+ ## Follow New Papers with the Feed Cache
77
+
78
+ Initialize the local RSS feed cache:
79
+
80
+ ```bash
81
+ nber-cli feed init
82
+ ```
83
+
84
+ Fetch the NBER new working papers RSS feed:
85
+
86
+ ```bash
87
+ nber-cli feed fetch
88
+ ```
89
+
90
+ The first fetch stores the current RSS items in the cache and displays them as new. Later fetches show only items that were not already cached.
91
+
92
+ Limit output while showing the latest fetched items:
93
+
94
+ ```bash
95
+ nber-cli feed fetch --max-items 5
96
+ ```
97
+
98
+ Clean old cache records:
99
+
100
+ ```bash
101
+ nber-cli feed clean --days 30
102
+ ```
103
+
104
+ `feed clean` asks for confirmation before deleting cached records.
105
+
76
106
  ## Download a PDF
77
107
 
78
108
  Download into the current directory:
@@ -8,6 +8,7 @@ NBER-CLI focuses on the common research loop around NBER working papers:
8
8
 
9
9
  - Search for papers by keyword, author, title, abstract, or paper number.
10
10
  - Inspect a paper's title, authors, date, abstract, URL, and related metadata.
11
+ - Follow new working papers through NBER's RSS feed and a local cache.
11
12
  - Download a PDF by paper ID.
12
13
  - Run batch downloads into a target directory.
13
14
  - Serve paper search, lookup, and download operations as MCP tools.
@@ -19,6 +20,7 @@ Run without installing:
19
20
  ```bash
20
21
  uvx nber-cli search "Labor Economic"
21
22
  uvx nber-cli info w25000
23
+ uvx nber-cli feed fetch --max-items 5
22
24
  uvx nber-cli download w34567
23
25
  ```
24
26
 
@@ -28,6 +30,7 @@ Install as a reusable command:
28
30
  uv tool install nber-cli
29
31
  nber-cli search "Labor Economic"
30
32
  nber-cli info w25000
33
+ nber-cli feed fetch --max-items 5
31
34
  nber-cli download w34567
32
35
  ```
33
36
 
@@ -66,4 +69,4 @@ Add it to an MCP client:
66
69
 
67
70
  ## Project Status
68
71
 
69
- The current public command model is `nber-cli` v0.2.0. The CLI is intentionally small and script-friendly: text output is optimized for human reading, and `--format json` is available where structured output matters.
72
+ The current public command model is `nber-cli` v0.3.0. The CLI is intentionally small and script-friendly: text output is optimized for human reading, and `--format json` is available where structured output matters.
@@ -2,6 +2,8 @@
2
2
 
3
3
  NBER-CLI exposes the same core functionality as importable Python functions. The API is asynchronous because lookup, search, and downloads perform network I/O.
4
4
 
5
+ Feed cache helpers are synchronous because they perform local SQLite work and a synchronous RSS fetch.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -90,6 +92,61 @@ async def main() -> None:
90
92
  asyncio.run(main())
91
93
  ```
92
94
 
95
+ ## Work with the Feed Cache
96
+
97
+ Initialize the default feed cache:
98
+
99
+ ```python
100
+ from nber_cli import init_feed_database
101
+
102
+ db_path = init_feed_database()
103
+ print(db_path)
104
+ ```
105
+
106
+ Fetch the NBER RSS feed and display new cached items:
107
+
108
+ ```python
109
+ from nber_cli import feed_results, fetch_feed
110
+
111
+ result = fetch_feed()
112
+ payload = feed_results(result)
113
+ print(payload["new_count"])
114
+ for item in payload["results"]:
115
+ print(item["id"], item["title"])
116
+ ```
117
+
118
+ Display all fetched RSS items and limit the returned items:
119
+
120
+ ```python
121
+ from nber_cli import fetch_feed
122
+
123
+ result = fetch_feed(display_all=True, max_items=5)
124
+ ```
125
+
126
+ Move the feed cache database:
127
+
128
+ ```python
129
+ from pathlib import Path
130
+
131
+ from nber_cli import migrate_feed_database
132
+
133
+ old_path, new_path = migrate_feed_database(Path("~/data/nber-feed.db"))
134
+ ```
135
+
136
+ Clean cached feed database records:
137
+
138
+ ```python
139
+ from nber_cli import clean_feed_cache
140
+
141
+ preview = clean_feed_cache(days=30, dry_run=True)
142
+ print(preview.matched_count)
143
+
144
+ result = clean_feed_cache(days=30)
145
+ print(result.deleted_count)
146
+ ```
147
+
148
+ `clean_feed_cache` deletes local cache records only. If deleted records still appear in the RSS feed, a later `fetch_feed` call may return them as new items again.
149
+
93
150
  ## Data Models
94
151
 
95
152
  ### NBER
@@ -118,6 +175,43 @@ asyncio.run(main())
118
175
  | `start_date` | `str` or `None` | Applied start date. |
119
176
  | `end_date` | `str` or `None` | Applied end date. |
120
177
 
178
+ ### NBERFeedItem
179
+
180
+ | Field | Type | Description |
181
+ | --- | --- | --- |
182
+ | `paper_id` | `str` | Paper ID, for example `w35254`. |
183
+ | `title` | `str` | Paper title parsed from the RSS item. |
184
+ | `authors` | `list[str]` | Author names parsed from the RSS title. |
185
+ | `abstract` | `str` | RSS item description. |
186
+ | `url` | `str` | Canonical NBER paper URL without the RSS fragment. |
187
+ | `source_url` | `str` | Original RSS item URL. |
188
+ | `guid` | `str` | RSS item GUID. |
189
+
190
+ ### NBERFeedFetchResult
191
+
192
+ | Field | Type | Description |
193
+ | --- | --- | --- |
194
+ | `source_url` | `str` | RSS feed URL. |
195
+ | `database_path` | `Path` | SQLite cache database path. |
196
+ | `total_fetched` | `int` | Number of RSS items fetched. |
197
+ | `new_count` | `int` | Number of fetched items that were not already in the cache. |
198
+ | `display_all` | `bool` | Whether returned items include all fetched items. |
199
+ | `items` | `list[NBERFeedItem]` | Items selected for display or structured output. |
200
+ | `max_items` | `int` or `None` | Display limit when provided. |
201
+
202
+ ### NBERFeedCleanResult
203
+
204
+ | Field | Type | Description |
205
+ | --- | --- | --- |
206
+ | `database_path` | `Path` | SQLite cache database path. |
207
+ | `matched_count` | `int` | Number of cache records matching the clean criteria. |
208
+ | `deleted_count` | `int` | Number of cache records deleted. |
209
+ | `mode` | `str` | Clean mode: `days`, `all`, or `date-range`. |
210
+ | `days` | `int` or `None` | Day threshold for `days` mode. |
211
+ | `start_date` | `str` or `None` | Inclusive start date for `date-range` mode. |
212
+ | `end_date` | `str` or `None` | Inclusive end date for `date-range` mode. |
213
+ | `dry_run` | `bool` | Whether the operation only counted matching records. |
214
+
121
215
  ### DownloadFailure
122
216
 
123
217
  | Field | Type | Description |
@@ -137,12 +231,13 @@ asyncio.run(main())
137
231
  Use formatter helpers when you want stable dictionaries for JSON output or MCP-style responses:
138
232
 
139
233
  ```python
140
- from nber_cli import info, related, search_results
234
+ from nber_cli import feed_results, info, related, search_results
141
235
  ```
142
236
 
143
237
  - `info(paper)` returns core metadata.
144
238
  - `related(paper)` returns related optional fields.
145
239
  - `search_results(results)` returns a structured search payload.
240
+ - `feed_results(result)` returns a structured feed fetch payload.
146
241
 
147
242
  For human-readable text output, use the text formatters:
148
243
 
@@ -0,0 +1,41 @@
1
+ # 更新日志
2
+
3
+ 这里记录项目的重要变更。
4
+
5
+ ## 0.3.0 - 2026-06-03
6
+
7
+ ### Added
8
+
9
+ - 添加 `nber-cli feed init`,用于创建本地 SQLite feed 缓存。
10
+ - 添加 `nber-cli feed fetch`,用于获取 NBER 最新工作论文 RSS feed 并显示新缓存的条目。
11
+ - 添加 `nber-cli feed fetch --max-items`,用于限制 feed 输出数量。
12
+ - 添加 `nber-cli feed migrate`,用于移动 feed 缓存数据库并更新用户配置。
13
+ - 添加 `nber-cli feed clean`,用于在确认后清理 feed 缓存数据库记录。
14
+ - 补充 feed 缓存辅助函数和 feed 数据模型的 Python API 文档。
15
+
16
+ ### Changed
17
+
18
+ - 添加 `~/.nber-cli/config.json` 和 `feed.db-path` 的用户配置文档。
19
+ - 扩展中英文 CLI、快速开始、配置和 Python API 页面中的 feed 缓存文档。
20
+
21
+ ## 0.2.0 - 2026-05-27
22
+
23
+ ### Changed
24
+
25
+ - 将 CLI 重构为 `nber-cli download ...` 子命令语法。
26
+ - 添加 `--file/-f` 和 `--save-base/-s` 路径处理行为。
27
+ - 添加 `--batch/-b` 多编号下载模式。
28
+ - 移除基于数据库的下载状态跟踪。
29
+ - 将下载器简化为直接异步 HTTP PDF 获取。
30
+ - 更新 v0.2 命令模型文档。
31
+ - 移除旧 web UI 模块和脚本入口。
32
+
33
+ ## 0.1.4 - 2025-08-09
34
+
35
+ ### Added
36
+
37
+ - 添加 `--version` / `-v` 参数用于显示当前版本。
38
+ - 添加更完整的帮助信息和示例。
39
+ - 添加 `__main__.py` 以支持 `python -m nber_cli`。
40
+ - 添加参数分组以改善 CLI 结构。
41
+ - 不带参数运行时自动显示帮助信息。
@@ -22,6 +22,7 @@ nber-cli [--version] <command> [options]
22
22
  | `download` | 下载一篇或多篇论文 PDF。 |
23
23
  | `info` | 显示单篇论文的元数据和摘要。 |
24
24
  | `search` | 搜索 NBER 工作论文。 |
25
+ | `feed` | 管理 NBER 最新工作论文 RSS feed 的本地缓存。 |
25
26
  | `mcp-server` | 启动给 Agent 使用的 MCP server。 |
26
27
 
27
28
  ## download
@@ -139,6 +140,111 @@ nber-cli search "inflation" -f json
139
140
 
140
141
  只提供 `--start-date` 时,NBER-CLI 会自动使用当前日期作为结束日期。
141
142
 
143
+ ## feed
144
+
145
+ `feed` 用于处理 NBER 最新工作论文 RSS feed 和本地 SQLite 缓存。缓存会记录哪些 RSS 条目已经见过,因此 `feed fetch` 默认只显示新发现的论文。
146
+
147
+ ### feed init
148
+
149
+ 初始化 feed 缓存数据库,并把数据库路径写入用户配置:
150
+
151
+ ```bash
152
+ nber-cli feed init
153
+ nber-cli feed init --db-path ~/.nber-cli/feed.db
154
+ ```
155
+
156
+ 如果省略 `--db-path`,默认数据库路径是 `~/.nber-cli/feed.db`。
157
+
158
+ ### feed fetch
159
+
160
+ 获取 RSS feed,把所有获取到的条目写入缓存,并默认只显示新的条目:
161
+
162
+ ```bash
163
+ nber-cli feed fetch
164
+ ```
165
+
166
+ 显示所有获取到的 RSS 条目,包括缓存中已经存在的条目:
167
+
168
+ ```bash
169
+ nber-cli feed fetch --display-all true
170
+ nber-cli feed fetch --display-all
171
+ ```
172
+
173
+ 限制输出数量:
174
+
175
+ ```bash
176
+ nber-cli feed fetch --max-items 5
177
+ ```
178
+
179
+ 当提供 `--max-items` 且没有提供 `--display-all` 时,`--display-all` 默认会变成 `true`。因此 `nber-cli feed fetch --max-items 5` 会显示本次获取到的前 5 个 RSS 条目,而不是在没有新条目时显示空结果。
180
+
181
+ 返回 JSON:
182
+
183
+ ```bash
184
+ nber-cli feed fetch --format json
185
+ nber-cli feed fetch -f json
186
+ ```
187
+
188
+ ### feed migrate
189
+
190
+ 移动 feed 缓存数据库到新路径,并更新用户配置:
191
+
192
+ ```bash
193
+ nber-cli feed migrate ~/data/nber-feed.db
194
+ ```
195
+
196
+ 迁移会移动 SQLite 数据库文件,以及 `-wal`、`-shm`、`-journal` 等 SQLite sidecar 文件。目标路径不能已经存在。
197
+
198
+ ### feed clean
199
+
200
+ 清理 feed 缓存数据库记录。这个操作删除的是本地缓存记录,不会影响 NBER。被删除的缓存记录如果仍然出现在 RSS feed 中,后续可能会再次作为新条目被获取。
201
+
202
+ 清理 30 天没有再次出现的记录:
203
+
204
+ ```bash
205
+ nber-cli feed clean
206
+ nber-cli feed clean --days 30
207
+ ```
208
+
209
+ 清理全部缓存记录:
210
+
211
+ ```bash
212
+ nber-cli feed clean --all
213
+ ```
214
+
215
+ 按 last-seen 日期清理记录:
216
+
217
+ ```bash
218
+ nber-cli feed clean --end-date 2026-05-31
219
+ nber-cli feed clean --start-date 2026-05-01 --end-date 2026-05-31
220
+ ```
221
+
222
+ 只提供 `--end-date` 时,会从最早的缓存记录清理到该结束日期。`--start-date` 和 `--end-date` 都是前后包含的。只提供 `--start-date` 是无效的。
223
+
224
+ 删除前,`feed clean` 会先打印匹配到的缓存记录数量,并要求确认:
225
+
226
+ ```text
227
+ This operation is irreversible.
228
+ Deleted cache records may be fetched again as new items if they still appear in the RSS feed.
229
+ Continue? [y/N]:
230
+ ```
231
+
232
+ 只有输入 `y` 或 `Y` 才会继续。其他输入都会中止,不删除记录。
233
+
234
+ ### feed 选项
235
+
236
+ | 子命令 | 选项 | 说明 |
237
+ | --- | --- | --- |
238
+ | `init` | `--db-path` | SQLite 缓存数据库路径,默认是 `~/.nber-cli/feed.db`。 |
239
+ | `fetch` | `--display-all [true|false]` | 显示所有获取到的 RSS 条目,而不是只显示新条目。 |
240
+ | `fetch` | `--format`, `-f` | 输出格式:`list` 或 `json`,默认是 `list`。 |
241
+ | `fetch` | `--max-items` | 最多显示多少个 feed 条目。 |
242
+ | `migrate` | `new_db_path` | 新的 SQLite 缓存数据库路径。 |
243
+ | `clean` | `--days` | 清理这么多天没有再次出现的缓存记录,默认是 `30`。 |
244
+ | `clean` | `--all` | 清理全部 feed 缓存记录。 |
245
+ | `clean` | `--start-date` | 清理 last-seen 日期在该日期及之后的缓存记录,格式为 `YYYY-MM-DD`。 |
246
+ | `clean` | `--end-date` | 清理 last-seen 日期在该日期及之前的缓存记录,格式为 `YYYY-MM-DD`。 |
247
+
142
248
  ## mcp-server
143
249
 
144
250
  启动默认 stdio MCP server:
@@ -172,4 +278,4 @@ nber-cli mcp-server --transport streamable_http --port 8000
172
278
 
173
279
  ## 输出格式
174
280
 
175
- `info` 和 `search` 默认使用 `list`,这是一种适合人阅读的文本格式。需要把输出交给脚本或 Agent 工作流时,请使用 `--format json`。
281
+ `info`、`search` 和 `feed fetch` 默认使用 `list`,这是一种适合人阅读的文本格式。需要把输出交给脚本或 Agent 工作流时,请使用 `--format json`。
@@ -1,6 +1,6 @@
1
1
  # 配置
2
2
 
3
- NBER-CLI 当前使用内置运行时默认值,而不是用户配置文件。这些默认值刻意保持保守,适合 CLI MCP 两种用法。
3
+ NBER-CLI 的大多数运行时行为使用内置默认值。feed 缓存还会使用一个小型用户配置文件,用来记住 `nber-cli feed init` 或 `nber-cli feed migrate` 选择的 SQLite 数据库路径。
4
4
 
5
5
  ## 运行时默认值
6
6
 
@@ -15,6 +15,54 @@ NBER-CLI 当前使用内置运行时默认值,而不是用户配置文件。
15
15
 
16
16
  这些值位于 `NBERCLIConfig` 和 `NBER_CLI_CONFIG`。
17
17
 
18
+ ## 用户配置文件
19
+
20
+ 用户配置文件路径是:
21
+
22
+ ```text
23
+ ~/.nber-cli/config.json
24
+ ```
25
+
26
+ 目前配置文件用于 feed 缓存设置:
27
+
28
+ ```json
29
+ {
30
+ "feed": {
31
+ "db-path": "/Users/name/.nber-cli/feed.db"
32
+ }
33
+ }
34
+ ```
35
+
36
+ `feed.db-path` 指向 `nber-cli feed fetch` 和 `nber-cli feed clean` 使用的 SQLite 数据库。
37
+
38
+ ## Feed 缓存数据库
39
+
40
+ 默认 feed 缓存数据库路径:
41
+
42
+ ```text
43
+ ~/.nber-cli/feed.db
44
+ ```
45
+
46
+ 初始化默认缓存:
47
+
48
+ ```bash
49
+ nber-cli feed init
50
+ ```
51
+
52
+ 初始化到自定义路径:
53
+
54
+ ```bash
55
+ nber-cli feed init --db-path ~/data/nber-feed.db
56
+ ```
57
+
58
+ 移动已有缓存并更新配置:
59
+
60
+ ```bash
61
+ nber-cli feed migrate ~/data/nber-feed.db
62
+ ```
63
+
64
+ feed 缓存会存储已经见过的 RSS 条目。`feed fetch` 使用这个缓存判断哪些条目是新的。`feed clean` 删除的是本地缓存记录;如果被删除的记录仍然出现在 RSS feed 中,后续可能会再次作为新条目被获取。
65
+
18
66
  ## 输出路径
19
67
 
20
68
  单篇下载默认行为: