nber-cli 0.3.1__tar.gz → 0.5.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.
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.claude-plugin/marketplace.json +2 -2
- nber_cli-0.5.0/CHANGELOG.md +112 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/PKG-INFO +10 -2
- {nber_cli-0.3.1 → nber_cli-0.5.0}/README.md +7 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/README.zh-CN.md +7 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/agents/index.md +1 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/agents/openclaw.md +1 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/agents/others.md +1 -1
- nber_cli-0.5.0/docs/en/changelog.md +122 -0
- nber_cli-0.5.0/docs/en/cli.md +409 -0
- nber_cli-0.5.0/docs/en/configuration.md +202 -0
- nber_cli-0.5.0/docs/en/development.md +134 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/getting-started.md +16 -0
- nber_cli-0.5.0/docs/en/mcp.md +141 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/policy.md +9 -2
- nber_cli-0.5.0/docs/en/python-api.md +464 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/agents/index.md +1 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/agents/openclaw.md +1 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/agents/others.md +1 -1
- nber_cli-0.5.0/docs/zh/changelog.md +122 -0
- nber_cli-0.5.0/docs/zh/cli.md +409 -0
- nber_cli-0.5.0/docs/zh/configuration.md +202 -0
- nber_cli-0.5.0/docs/zh/development.md +134 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/getting-started.md +16 -0
- nber_cli-0.5.0/docs/zh/mcp.md +141 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/policy.md +8 -1
- nber_cli-0.5.0/docs/zh/python-api.md +464 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/plugins/nber-cli/.claude-plugin/plugin.json +2 -2
- {nber_cli-0.3.1 → nber_cli-0.5.0}/plugins/nber-cli/.codex-plugin/plugin.json +1 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/pyproject.toml +11 -2
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/__init__.py +32 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/cli.py +352 -34
- nber_cli-0.5.0/src/nber_cli/config.py +49 -0
- nber_cli-0.5.0/src/nber_cli/config.schema.json +54 -0
- nber_cli-0.5.0/src/nber_cli/config_store.py +266 -0
- nber_cli-0.5.0/src/nber_cli/core/models.py +185 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/db.py +246 -44
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/download.py +82 -28
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/feed.py +110 -70
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/fetcher.py +47 -23
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/formatters.py +6 -7
- nber_cli-0.5.0/src/nber_cli/info_cache.py +51 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/mcp.py +45 -27
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/conftest.py +5 -3
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_cli.py +537 -13
- nber_cli-0.5.0/tests/test_config_store.py +226 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_db.py +138 -1
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_downloader.py +173 -126
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_feed.py +132 -8
- nber_cli-0.5.0/tests/test_fetcher.py +597 -0
- nber_cli-0.5.0/tests/test_info_cache.py +342 -0
- nber_cli-0.5.0/tests/test_info_cache_flow.py +128 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_logs.py +32 -0
- nber_cli-0.5.0/tests/test_mcp.py +121 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/uv.lock +191 -1
- nber_cli-0.3.1/CHANGELOG.md +0 -52
- nber_cli-0.3.1/docs/en/changelog.md +0 -56
- nber_cli-0.3.1/docs/en/cli.md +0 -293
- nber_cli-0.3.1/docs/en/configuration.md +0 -129
- nber_cli-0.3.1/docs/en/development.md +0 -89
- nber_cli-0.3.1/docs/en/mcp.md +0 -108
- nber_cli-0.3.1/docs/en/python-api.md +0 -263
- nber_cli-0.3.1/docs/zh/changelog.md +0 -56
- nber_cli-0.3.1/docs/zh/cli.md +0 -293
- nber_cli-0.3.1/docs/zh/configuration.md +0 -129
- nber_cli-0.3.1/docs/zh/development.md +0 -89
- nber_cli-0.3.1/docs/zh/mcp.md +0 -108
- nber_cli-0.3.1/docs/zh/python-api.md +0 -263
- nber_cli-0.3.1/src/nber_cli/config.py +0 -28
- nber_cli-0.3.1/src/nber_cli/core/models.py +0 -83
- nber_cli-0.3.1/tests/test_fetcher.py +0 -138
- nber_cli-0.3.1/tests/test_info_cache.py +0 -148
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.claude/agents/code-to-docs.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.claude/agents/sync-docs-for-i18n.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.claude/settings.json +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.codex/config.toml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.github/workflows/docs.yml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.github/workflows/lint.yml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.github/workflows/publish.yml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.github/workflows/pytest.yml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.gitignore +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.mcp.json +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/.python-version +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/LICENSE +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/agents/claude-code.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/agents/codex.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/contributing.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/en/index.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/agents/claude-code.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/agents/codex.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/contributing.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/docs/zh/index.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/mkdocs.yml +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/plugins/nber-cli/.mcp.json +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/plugins/nber-cli/skills/NBER-CLI/SKILL.md +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/__main__.py +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/src/nber_cli/core/__init__.py +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/__init__.py +0 -0
- {nber_cli-0.3.1 → nber_cli-0.5.0}/tests/test_main.py +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
3
|
"name": "nber-cli",
|
|
4
4
|
"description": "Claude Code marketplace for NBER-CLI research workflows.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"owner": {
|
|
7
7
|
"name": "Song Tan",
|
|
8
8
|
"email": "sepinetam@gmail.com",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{
|
|
13
13
|
"name": "nber-cli",
|
|
14
14
|
"description": "Use NBER-CLI to search, inspect, download, and serve NBER working paper workflows.",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.4.0",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "Song Tan",
|
|
18
18
|
"email": "sepinetam@gmail.com"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
This file is the canonical release history. The English mirror at `docs/en/changelog.md` and the Chinese mirror at `docs/zh/changelog.md` are generated from the same source content and must stay in lock-step. Any release commit updates all three together.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.5.0] - 2026-06-16
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
- RSS feed parsing now uses `defusedxml` to block XML external entity (XXE) and entity expansion attacks.
|
|
13
|
+
- CLI downloads are restricted to the current working directory and its subdirectories by default. Use `nber-cli download --restrict false` to override per invocation. The `download.restrict_dir` config key is stored and validated, but the current CLI default remains `true`.
|
|
14
|
+
- Database `init` and `migrate` paths on macOS and Linux must reside within the user's home directory.
|
|
15
|
+
- Synchronous HTTP requests enforce TLS 1.2 as the minimum version.
|
|
16
|
+
- Selected info/download failure paths now avoid raw exception text; download-log messages and soft database warnings use sanitized summaries or exception class names.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- `nber-cli config show` / `get <key>` / `set <key> <value>` / `verify` for inspecting and editing `~/.nber-cli/config.json`.
|
|
20
|
+
- `download.concurrency` configuration option (default `3`) and the `--concurrency` / `-c` CLI flag to cap concurrent downloads.
|
|
21
|
+
- `--restrict true|false` flag on `nber-cli download` to control directory restriction per invocation.
|
|
22
|
+
- `--yes` flag for `nber-cli mcp-server`; the existing `--port` option now requires explicit confirmation when set to a non-default value.
|
|
23
|
+
- `sse` transport for `nber-cli mcp-server`.
|
|
24
|
+
- JSON Schema (`config.schema.json`) for validating `~/.nber-cli/config.json`.
|
|
25
|
+
- Strict raw-configuration validation that reports malformed JSON, invalid section/value types, and schema-minimum violations without silently injecting defaults.
|
|
26
|
+
- Plugin manifests and marketplace metadata now share the package version, and the Claude plugin skill path uses the case-sensitive tracked `./skills/NBER-CLI` directory.
|
|
27
|
+
- Domain invariant validation in all core dataclasses (`NBER`, `NBERSearchResults`, `NBERFeedItem`, `NBERFeedFetchResult`, clean results, and download results).
|
|
28
|
+
- `get_config_value`, `set_config_value`, `read_config`, `write_config`, and `validate_config` exported from the package top level.
|
|
29
|
+
- Paper ID format validation (`w?\d+`) across CLI, download, and MCP entry points.
|
|
30
|
+
- Validation of fetched paper titles, positive citation IDs, and response/request paper-ID agreement before metadata is accepted.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Replaced legacy `typing.Dict`, `List`, and `Optional` aliases with modern Python 3.11 syntax.
|
|
34
|
+
- Added `mypy` configuration and strengthened type annotations across `cli.py`, `config_store.py`, and `fetcher.py`.
|
|
35
|
+
- `mcp-server` transport name corrected to `streamable-http`; the existing `--port` option now uses `--yes` confirmation for non-default values.
|
|
36
|
+
- Retry loops in `fetcher.py` now use exponential backoff capped at 30 seconds.
|
|
37
|
+
- `feed fetch` skips malformed individual RSS items instead of failing the entire feed.
|
|
38
|
+
- Invalid configured or per-call download concurrency values are rejected or fall back to the documented safe default instead of creating an invalid semaphore.
|
|
39
|
+
- Database schema-changing and data-writing operations reject databases with a future `PRAGMA user_version`; the diagnostic schema-version reader remains read-only.
|
|
40
|
+
- Feed fetching establishes/validates the local schema before the network request, then writes feed items plus fetch history transactionally after the response is parsed; cleanup operations pair schema validation/upgrade and deletion in one SQLite transaction.
|
|
41
|
+
- `download.py` enables `raise_for_status=True` on `ClientSession`.
|
|
42
|
+
- Error handling narrowed to specific network/timeout exception types with preserved exception chains.
|
|
43
|
+
- Removed the info cache hit hint that was printed to stderr on cached `info` lookups.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- `feed fetch` now tolerates unescaped `<` characters followed by whitespace or a digit in RSS title and description text while keeping strict XML parsing for all other malformed input.
|
|
47
|
+
- RSS parse failures now report their line and column when available, and `feed fetch` reports runtime parse errors with exit code `1` without printing command usage.
|
|
48
|
+
|
|
49
|
+
## [0.4.0] - 2026-06-04
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- `nber-cli info --refresh` skips the local `info_cache` and re-fetches the paper from NBER. The new data is written back to the cache when the cache is enabled.
|
|
53
|
+
- `nber-cli info cache --turn-on` / `--turn-off` toggle the `info_cache` lookup globally and persist the state to `~/.nber-cli/config.json`.
|
|
54
|
+
- `nber-cli info cache --set-refresh <N>` sets the cache refresh interval in days. The value is persisted to `~/.nber-cli/config.json` and used as the TTL for every subsequent `info` call. Defaults to `30` days.
|
|
55
|
+
- `nber-cli info cache clear` with `--days`, `--all`, `--start-date`, or `--end-date` mirrors the `feed clean` parameter set, using `last_fetched_at` from the `info_cache` table. `nber-cli info cache clean` is a convenience alias for `clear --all`.
|
|
56
|
+
- `nber-cli info cache` (no sub-action) prints the current cache state, TTL, and cached row count.
|
|
57
|
+
- New `nber_cli.config_store` module: centralised read and write of `~/.nber-cli/config.json` plus the `InfoCacheSettings` dataclass and helpers (`get_info_cache_settings`, `set_info_cache_enabled`, `set_info_cache_ttl_days`).
|
|
58
|
+
- New `nber_cli.info_cache.get_paper_with_info_cache_result` async helper (in the `nber_cli.info_cache` module) that returns an `InfoCacheLookupResult` carrying the `NBER` paper and a `from_cache` flag, so callers (CLI and MCP) can surface a "loaded from cache" hint.
|
|
59
|
+
- Public Python API exports from the package top level: `InfoCacheSettings`, `clear_info_cache`, `count_info_cache`, `get_info_cache_settings`, `get_info_cache_ttl_days`, `is_info_cache_enabled`, `is_info_cache_expired`, `set_info_cache_enabled`, `set_info_cache_ttl_days`, `NBERInfoCacheClearResult`. `InfoCacheLookupResult` and `get_paper_with_info_cache_result` are exposed from the `nber_cli.info_cache` module rather than the package top level; import them as `from nber_cli.info_cache import ...`.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- `~/.nber-cli/config.json` now carries an `info` section: `info.cache_enabled` (default `true`) and `info.cache_ttl_days` (default `30`). Missing or malformed fields fall back to defaults.
|
|
63
|
+
- `info` now prints a one-line stderr hint when the paper was served from the local cache, pointing to `nber-cli info <id> --refresh` for a fresh fetch.
|
|
64
|
+
|
|
65
|
+
## [0.3.1] - 2026-06-03
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- `db init` and `db migrate` top-level subcommands replace `feed init` and `feed migrate`. The database is now general-purpose and stores feed cache, behavior logs, and paper metadata cache.
|
|
69
|
+
- `info_cache` table caches paper metadata fetched via `info` and the MCP `get_paper_info` tool. Subsequent lookups return immediately from the cache.
|
|
70
|
+
- `query_log`, `download_log`, and `info_log` tables record search keywords, download outcomes, and paper info lookups for later auditing.
|
|
71
|
+
- `schema_version` field written to `~/.nber-cli/config.json` so future schema migrations can roll forward safely.
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
- Default database renamed from `feed.db` to `nber.db`. Existing `~/.nber-cli/feed.db` installations continue to work without manual steps.
|
|
75
|
+
- Database schema upgraded from `user_version = 1` to `user_version = 2`. Existing v1 databases are upgraded automatically on next CLI invocation; original `feed_items` rows are preserved.
|
|
76
|
+
- Database code consolidated into `nber_cli.db`. The original `init_feed_database`, `migrate_feed_database`, and `get_feed_database_path` helpers are kept as thin compatibility wrappers.
|
|
77
|
+
|
|
78
|
+
## [0.3.0] - 2026-06-03
|
|
79
|
+
|
|
80
|
+
### Added
|
|
81
|
+
- `feed init` subcommand: initialize a local SQLite feed cache and write its path to user config.
|
|
82
|
+
- `feed fetch` subcommand: fetch NBER's new working papers RSS feed, cache seen items, and show newly discovered papers by default.
|
|
83
|
+
- `feed fetch --max-items`: limit displayed feed output. When used without `--display-all`, display-all behavior is enabled automatically.
|
|
84
|
+
- `feed migrate` subcommand: move the feed cache database and SQLite sidecar files to a new path, then update user config.
|
|
85
|
+
- `feed clean` subcommand: clean cached feed database records by age, date range, or all records after interactive confirmation.
|
|
86
|
+
- Python API exports for feed cache helpers and feed result models.
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
- Added user config support at `~/.nber-cli/config.json` for the feed cache database path.
|
|
90
|
+
- Expanded English and Chinese documentation for feed commands, configuration, Python API, and release notes.
|
|
91
|
+
|
|
92
|
+
## [0.2.0] - 2026-05-31
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
- `download` subcommand: single paper ID or batch mode (`--batch`), explicit file path (`--file`), target directory (`--save-base`).
|
|
96
|
+
- `info` subcommand: paper metadata with `--all` flag for full details and `--format json` option.
|
|
97
|
+
- `search` subcommand: full-text search with date filters (`--start-date`, `--end-date`), pagination (`--page`, `--per-page`), `--format json` option.
|
|
98
|
+
- `mcp-server` subcommand: MCP server for AI agent integration with stdio and streamable_http transports.
|
|
99
|
+
|
|
100
|
+
### Changed
|
|
101
|
+
- Reworked CLI into subcommand syntax (`nber-cli <subcommand>`).
|
|
102
|
+
- Simplified downloader to direct async HTTP PDF fetches (removed database-backed state tracking).
|
|
103
|
+
- Removed legacy web UI module and script entrypoint.
|
|
104
|
+
|
|
105
|
+
## [0.1.4] - 2025-08-09
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
- Added `--version` / `-v` flag to display current version.
|
|
109
|
+
- Added comprehensive help message with examples.
|
|
110
|
+
- Added `__main__.py` file to support `python -m nber_cli` usage.
|
|
111
|
+
- Added argument grouping for better CLI organization.
|
|
112
|
+
- Added automatic help display when no arguments are provided.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nber-cli
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A command
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A command-line interface for accessing National Bureau of Economic Research (NBER) papers without a browser.
|
|
5
5
|
Project-URL: Homepage, https://github.com/sepinetam/nber-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/sepinetam/nber-cli
|
|
7
7
|
Project-URL: Issues, https://github.com/sepinetam/nber-cli/issues
|
|
@@ -22,6 +22,7 @@ Requires-Python: >=3.11
|
|
|
22
22
|
Requires-Dist: aiohttp
|
|
23
23
|
Requires-Dist: aiohttp-retry
|
|
24
24
|
Requires-Dist: certifi
|
|
25
|
+
Requires-Dist: defusedxml>=0.7.1
|
|
25
26
|
Requires-Dist: fake-useragent
|
|
26
27
|
Requires-Dist: mcp>=1.27.1
|
|
27
28
|
Description-Content-Type: text/markdown
|
|
@@ -33,6 +34,8 @@ A command line interface for reaching the National Bureau of Economic Research (
|
|
|
33
34
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/lint.yml)
|
|
34
35
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/docs.yml)
|
|
35
36
|
[](LICENSE)
|
|
37
|
+
[](https://pypi.org/project/nber-cli/)
|
|
38
|
+
[](https://pepy.tech/projects/nber-cli)
|
|
36
39
|
|
|
37
40
|
[简体中文](README.zh-CN.md) | [Documentation](docs/en/index.md)
|
|
38
41
|
|
|
@@ -43,9 +46,14 @@ A command line interface for reaching the National Bureau of Economic Research (
|
|
|
43
46
|
- Search NBER working papers by title, paper number, author, abstract, or keyword.
|
|
44
47
|
- Fetch structured metadata and abstracts for a paper ID such as `w25000`.
|
|
45
48
|
- Download single papers or batches as PDF files.
|
|
49
|
+
- Track newly released NBER working papers through a local RSS feed cache (`nber-cli feed fetch` / `feed clean`).
|
|
50
|
+
- Cache paper metadata locally (`nber-cli info` writes to `info_cache`) with a sliding TTL, plus a behavior log for `search`, `download`, and `info` lookups.
|
|
51
|
+
- Store the cache, RSS items, and behavior logs in a local SQLite database at `~/.nber-cli/nber.db` (path configurable via `nber-cli db init` / `db migrate`).
|
|
46
52
|
- Expose the same core workflows as MCP tools for AI agents.
|
|
47
53
|
- Return human-readable output by default, with JSON output for automation.
|
|
48
54
|
|
|
55
|
+
See [Configuration](docs/en/configuration.md) for the full list of configurable values and the local database layout, and [Usage Policy](docs/en/policy.md) for what NBER-CLI writes to disk by default.
|
|
56
|
+
|
|
49
57
|
## Quick Start
|
|
50
58
|
|
|
51
59
|
### Use in Agents
|
|
@@ -5,6 +5,8 @@ A command line interface for reaching the National Bureau of Economic Research (
|
|
|
5
5
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/lint.yml)
|
|
6
6
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/docs.yml)
|
|
7
7
|
[](LICENSE)
|
|
8
|
+
[](https://pypi.org/project/nber-cli/)
|
|
9
|
+
[](https://pepy.tech/projects/nber-cli)
|
|
8
10
|
|
|
9
11
|
[简体中文](README.zh-CN.md) | [Documentation](docs/en/index.md)
|
|
10
12
|
|
|
@@ -15,9 +17,14 @@ A command line interface for reaching the National Bureau of Economic Research (
|
|
|
15
17
|
- Search NBER working papers by title, paper number, author, abstract, or keyword.
|
|
16
18
|
- Fetch structured metadata and abstracts for a paper ID such as `w25000`.
|
|
17
19
|
- Download single papers or batches as PDF files.
|
|
20
|
+
- Track newly released NBER working papers through a local RSS feed cache (`nber-cli feed fetch` / `feed clean`).
|
|
21
|
+
- Cache paper metadata locally (`nber-cli info` writes to `info_cache`) with a sliding TTL, plus a behavior log for `search`, `download`, and `info` lookups.
|
|
22
|
+
- Store the cache, RSS items, and behavior logs in a local SQLite database at `~/.nber-cli/nber.db` (path configurable via `nber-cli db init` / `db migrate`).
|
|
18
23
|
- Expose the same core workflows as MCP tools for AI agents.
|
|
19
24
|
- Return human-readable output by default, with JSON output for automation.
|
|
20
25
|
|
|
26
|
+
See [Configuration](docs/en/configuration.md) for the full list of configurable values and the local database layout, and [Usage Policy](docs/en/policy.md) for what NBER-CLI writes to disk by default.
|
|
27
|
+
|
|
21
28
|
## Quick Start
|
|
22
29
|
|
|
23
30
|
### Use in Agents
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/lint.yml)
|
|
6
6
|
[](https://github.com/sepinetam/nber-cli/actions/workflows/docs.yml)
|
|
7
7
|
[](LICENSE)
|
|
8
|
-
|
|
8
|
+
[](https://pypi.org/project/nber-cli/)
|
|
9
|
+
[](https://pepy.tech/projects/nber-cli)
|
|
9
10
|
[English](README.md) | [中文文档](docs/zh/index.md)
|
|
10
11
|
|
|
11
12
|
> **NBER** 是 [美国国家经济研究局](https://www.nber.org)(National Bureau of Economic Research)的注册商标。本项目是独立的开源工具,与美国国家经济研究局**不存在任何附属、认可或赞助关系**。使用本项目即视为同意[使用政策](docs/zh/policy.md)。
|
|
@@ -15,9 +16,14 @@
|
|
|
15
16
|
- 按标题、论文编号、作者、摘要或关键词搜索 NBER 工作论文。
|
|
16
17
|
- 通过 `w25000` 这样的论文编号获取结构化元数据和摘要。
|
|
17
18
|
- 下载单篇或批量论文 PDF。
|
|
19
|
+
- 通过本地 RSS feed 缓存追踪 NBER 新发布的工作论文(`nber-cli feed fetch` / `feed clean`)。
|
|
20
|
+
- 本地缓存论文元数据(`nber-cli info` 会写入 `info_cache`),采用滑动 TTL;同时为 `search`、`download` 和 `info` 查询记录行为日志。
|
|
21
|
+
- 把缓存、RSS 条目和行为日志统一存放在本地 SQLite 数据库 `~/.nber-cli/nber.db`(路径可通过 `nber-cli db init` / `db migrate` 配置)。
|
|
18
22
|
- 通过 MCP 工具把核心能力暴露给 AI Agent。
|
|
19
23
|
- 默认输出适合阅读的文本,也支持 JSON 输出用于自动化流程。
|
|
20
24
|
|
|
25
|
+
完整可配置项和本地数据库结构请见[配置](docs/zh/configuration.md),默认写入磁盘的内容请见[使用政策](docs/zh/policy.md)。
|
|
26
|
+
|
|
21
27
|
## 快速开始
|
|
22
28
|
|
|
23
29
|
### 在 Agent 中使用
|
|
@@ -33,7 +33,7 @@ Agents that support MCP can run NBER-CLI without a checked-out repository:
|
|
|
33
33
|
Agents that support skills should load the NBER-CLI skill from:
|
|
34
34
|
|
|
35
35
|
```text
|
|
36
|
-
plugins/nber-cli/skills/
|
|
36
|
+
plugins/nber-cli/skills/NBER-CLI/SKILL.md
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
The skill tells the agent when to use NBER-CLI, how to run `uvx nber-cli ...`, how to configure MCP, and how to interpret access errors.
|
|
@@ -24,7 +24,7 @@ This runs the published `nber-cli` package with `uvx`, so a checked-out copy of
|
|
|
24
24
|
If OpenClaw supports skill or instruction imports, load:
|
|
25
25
|
|
|
26
26
|
```text
|
|
27
|
-
plugins/nber-cli/skills/
|
|
27
|
+
plugins/nber-cli/skills/NBER-CLI/SKILL.md
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
The skill gives the agent the usage policy, command examples, JSON output guidance, and common error interpretation.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented here.
|
|
4
|
+
|
|
5
|
+
This page mirrors the canonical `CHANGELOG.md` at the repository root. The Chinese mirror at `docs/zh/changelog.md` carries the same content. Any release commit updates all three together.
|
|
6
|
+
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
## 0.5.0 - 2026-06-16
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
|
|
13
|
+
- RSS feed parsing now uses `defusedxml` to block XML external entity (XXE) and entity expansion attacks.
|
|
14
|
+
- CLI downloads are restricted to the current working directory and its subdirectories by default. Use `nber-cli download --restrict false` to override per invocation. The `download.restrict_dir` config key is stored and validated, but the current CLI default remains `true`.
|
|
15
|
+
- Database `init` and `migrate` paths on macOS and Linux must reside within the user's home directory.
|
|
16
|
+
- Synchronous HTTP requests enforce TLS 1.2 as the minimum version.
|
|
17
|
+
- Selected info/download failure paths now avoid raw exception text; download-log messages and soft database warnings use sanitized summaries or exception class names.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Added `nber-cli config show` / `get <key>` / `set <key> <value>` / `verify` for inspecting and editing `~/.nber-cli/config.json`.
|
|
22
|
+
- Added `download.concurrency` configuration option (default `3`) and the `--concurrency` / `-c` CLI flag to cap concurrent downloads.
|
|
23
|
+
- Added `--restrict true|false` flag on `nber-cli download` to control directory restriction per invocation.
|
|
24
|
+
- Added `--yes` for `nber-cli mcp-server`; the existing `--port` option now requires explicit confirmation when set to a non-default value.
|
|
25
|
+
- Added the `sse` transport for `nber-cli mcp-server`.
|
|
26
|
+
- Added JSON Schema (`config.schema.json`) for validating `~/.nber-cli/config.json`.
|
|
27
|
+
- Added strict raw-configuration validation that reports malformed JSON, invalid section/value types, and schema-minimum violations without silently injecting defaults.
|
|
28
|
+
- Added plugin manifest and marketplace metadata version synchronization, with the Claude plugin skill path corrected to the case-sensitive tracked `./skills/NBER-CLI` directory.
|
|
29
|
+
- Added domain invariant validation in all core dataclasses (`NBER`, `NBERSearchResults`, `NBERFeedItem`, `NBERFeedFetchResult`, clean results, and download results).
|
|
30
|
+
- Added `get_config_value`, `set_config_value`, `read_config`, `write_config`, and `validate_config` exports from the package top level.
|
|
31
|
+
- Added paper ID format validation (`w?\d+`) across CLI, download, and MCP entry points.
|
|
32
|
+
- Added validation of fetched paper titles, positive citation IDs, and response/request paper-ID agreement before metadata is accepted.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Replaced legacy `typing.Dict`, `List`, and `Optional` aliases with modern Python 3.11 syntax.
|
|
37
|
+
- Added `mypy` configuration and strengthened type annotations across `cli.py`, `config_store.py`, and `fetcher.py`.
|
|
38
|
+
- Corrected the `mcp-server` transport name to `streamable-http`; the existing `--port` option now uses `--yes` confirmation for non-default values.
|
|
39
|
+
- Retry loops in `fetcher.py` now use exponential backoff capped at 30 seconds.
|
|
40
|
+
- `feed fetch` skips malformed individual RSS items instead of failing the entire feed.
|
|
41
|
+
- Invalid configured or per-call download concurrency values are rejected or fall back to the documented safe default instead of creating an invalid semaphore.
|
|
42
|
+
- Database schema-changing and data-writing operations reject databases with a future `PRAGMA user_version`; the diagnostic schema-version reader remains read-only.
|
|
43
|
+
- Feed fetching establishes/validates the local schema before the network request, then writes feed items plus fetch history transactionally after the response is parsed; cleanup operations pair schema validation/upgrade and deletion in one SQLite transaction.
|
|
44
|
+
- `download.py` enables `raise_for_status=True` on `ClientSession`.
|
|
45
|
+
- Error handling narrowed to specific network/timeout exception types with preserved exception chains.
|
|
46
|
+
- Removed the info cache hit hint that was printed to stderr on cached `info` lookups.
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- `feed fetch` now tolerates unescaped `<` characters followed by whitespace or a digit in RSS title and description text while keeping strict XML parsing for all other malformed input.
|
|
51
|
+
- RSS parse failures now report their line and column when available, and `feed fetch` reports runtime parse errors with exit code `1` without printing command usage.
|
|
52
|
+
|
|
53
|
+
## 0.4.0 - 2026-06-04
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Added `nber-cli info --refresh` to bypass the local `info_cache` and re-fetch paper metadata from NBER. The fresh data is written back to the cache when the cache is enabled.
|
|
58
|
+
- Added `nber-cli info cache --turn-on` and `--turn-off` to toggle the `info_cache` lookup globally. The setting is persisted to `~/.nber-cli/config.json`.
|
|
59
|
+
- Added `nber-cli info cache --set-refresh <N>` to set the cache refresh interval in days. The value is persisted to `~/.nber-cli/config.json` and applied as the TTL for every subsequent `info` call. Defaults to `30` days.
|
|
60
|
+
- Added `nber-cli info cache clear` with the same parameter set as `feed clean`: `--days`, `--all`, `--start-date`, and `--end-date`. Filtering uses `last_fetched_at` from the `info_cache` table. `nber-cli info cache clean` is a convenience alias for `clear --all`.
|
|
61
|
+
- Added `nber-cli info cache` (no sub-action) to print the current cache state, TTL, and cached row count.
|
|
62
|
+
- Added `nber_cli.config_store` module with `InfoCacheSettings` and helpers (`get_info_cache_settings`, `set_info_cache_enabled`, `set_info_cache_ttl_days`) for reading and writing `~/.nber-cli/config.json`.
|
|
63
|
+
- Added `nber_cli.info_cache.get_paper_with_info_cache_result` async helper that returns an `InfoCacheLookupResult` carrying the `NBER` paper and a `from_cache` flag.
|
|
64
|
+
- Added public Python API exports from the package top level: `InfoCacheSettings`, `clear_info_cache`, `count_info_cache`, `get_info_cache_settings`, `get_info_cache_ttl_days`, `is_info_cache_enabled`, `is_info_cache_expired`, `set_info_cache_enabled`, `set_info_cache_ttl_days`, `NBERInfoCacheClearResult`. `InfoCacheLookupResult` and `get_paper_with_info_cache_result` are exposed from the `nber_cli.info_cache` module rather than the package top level; import them as `from nber_cli.info_cache import ...`.
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- `~/.nber-cli/config.json` now stores an `info` section: `info.cache_enabled` (default `true`) and `info.cache_ttl_days` (default `30`). Missing or malformed fields fall back to defaults.
|
|
69
|
+
- `info` now prints a one-line stderr hint when the paper was served from the local cache, pointing to `nber-cli info <id> --refresh` for a fresh fetch.
|
|
70
|
+
|
|
71
|
+
## 0.3.1 - 2026-06-03
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- Added `nber-cli db init` and `nber-cli db migrate` for initializing and relocating the local database. These replace `feed init` and `feed migrate`.
|
|
76
|
+
- Added `info_cache` table so repeated `nber-cli info` and MCP `get_paper_info` calls return immediately from cache.
|
|
77
|
+
- Added `query_log`, `download_log`, and `info_log` tables for recording search keywords, download outcomes, and info lookups.
|
|
78
|
+
- Added `schema_version` field in `~/.nber-cli/config.json` for forward-compatible schema upgrades.
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- Renamed default database file from `feed.db` to `nber.db`. Existing `~/.nber-cli/feed.db` installations keep working without manual steps.
|
|
83
|
+
- Upgraded database schema from version 1 to version 2 with automatic upgrade on next invocation.
|
|
84
|
+
- Consolidated database code into `nber_cli.db`. Old `init_feed_database` and `migrate_feed_database` helpers remain as thin compatibility wrappers.
|
|
85
|
+
|
|
86
|
+
## 0.3.0 - 2026-06-03
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- Added `nber-cli feed init` for creating a local SQLite feed cache.
|
|
91
|
+
- Added `nber-cli feed fetch` for fetching NBER's new working papers RSS feed and showing newly cached items.
|
|
92
|
+
- Added `nber-cli feed fetch --max-items` for limiting displayed feed output.
|
|
93
|
+
- Added `nber-cli feed migrate` for moving the feed cache database and updating user config.
|
|
94
|
+
- Added `nber-cli feed clean` for cleaning cached feed database records with confirmation.
|
|
95
|
+
- Added Python API documentation for feed cache helpers and feed data models.
|
|
96
|
+
|
|
97
|
+
### Changed
|
|
98
|
+
|
|
99
|
+
- Added user config documentation for `~/.nber-cli/config.json` and `feed.db-path`.
|
|
100
|
+
- Expanded English and Chinese feed cache documentation across CLI, getting started, configuration, and Python API pages.
|
|
101
|
+
|
|
102
|
+
## 0.2.0 - 2026-05-31
|
|
103
|
+
|
|
104
|
+
### Changed
|
|
105
|
+
|
|
106
|
+
- Reworked the CLI into `nber-cli download ...` subcommand syntax.
|
|
107
|
+
- Added `--file/-f` and `--save-base/-s` path handling behavior.
|
|
108
|
+
- Added `--batch/-b` multi-ID download mode.
|
|
109
|
+
- Removed database-backed download state tracking.
|
|
110
|
+
- Simplified the downloader to direct async HTTP PDF fetches.
|
|
111
|
+
- Updated documentation for the v0.2 command model.
|
|
112
|
+
- Removed the legacy web UI module and script entrypoint.
|
|
113
|
+
|
|
114
|
+
## 0.1.4 - 2025-08-09
|
|
115
|
+
|
|
116
|
+
### Added
|
|
117
|
+
|
|
118
|
+
- Added `--version` / `-v` flag to display current version.
|
|
119
|
+
- Added comprehensive help message with examples.
|
|
120
|
+
- Added `__main__.py` support for `python -m nber_cli`.
|
|
121
|
+
- Added argument grouping for better CLI organization.
|
|
122
|
+
- Added automatic help display when no arguments are provided.
|