rednote-cli 0.1.1__tar.gz → 0.1.3__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.
- rednote-cli-0.1.3/PKG-INFO +107 -0
- rednote-cli-0.1.3/README.md +100 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/pyproject.toml +2 -2
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/__init__.py +1 -1
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/main.py +11 -1
- rednote-cli-0.1.3/src/rednote_cli.egg-info/PKG-INFO +107 -0
- rednote-cli-0.1.1/PKG-INFO +0 -76
- rednote-cli-0.1.1/README.md +0 -69
- rednote-cli-0.1.1/src/rednote_cli.egg-info/PKG-INFO +0 -76
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/setup.cfg +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/common/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/common/app_utils.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/common/config.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/common/enums.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/common/errors.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/account_manager.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/browser/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/browser/manager.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/database/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/core/database/manager.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/base.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/factory.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/media.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/models.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/validator.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/services/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/services/scraper_service.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/output/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/output/event_stream.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/output/formatter_json.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/output/formatter_table.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/output/writer.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/persistence/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/persistence/file_account_repo.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/extractor.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/publisher.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/runtime_extractor.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/runtime_publisher.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/runtime_registration.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/dto/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/dto/input_models.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/dto/output_models.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/account_list.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/account_mutation.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/auth_login.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/auth_status.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/doctor.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/init_runtime.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/note_get.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/note_search.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/publish_note.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/user_get.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/user_search.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/user_self.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/__main__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/account.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/doctor.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/init.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/note.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/publish.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/search.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/commands/user.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/options.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/runtime.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/cli/utils.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/domain/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/domain/errors.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/domain/note_search_filters.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/infra/__init__.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/infra/exit_codes.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/infra/logger.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/infra/paths.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/infra/platforms.py +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli.egg-info/SOURCES.txt +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli.egg-info/dependency_links.txt +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli.egg-info/entry_points.txt +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli.egg-info/requires.txt +0 -0
- {rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: rednote-cli
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Rednote platform CLI
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
# rednote-cli
|
|
9
|
+
|
|
10
|
+
Rednote 平台专用 CLI(独立安装、独立升级、独立发布)。
|
|
11
|
+
|
|
12
|
+
## 系统要求
|
|
13
|
+
|
|
14
|
+
- Python `3.12.x`
|
|
15
|
+
- `pipx`
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
brew update
|
|
21
|
+
brew upgrade python@3.12 pipx
|
|
22
|
+
python3.12 --version
|
|
23
|
+
pipx --version
|
|
24
|
+
pipx ensurepath
|
|
25
|
+
exec zsh
|
|
26
|
+
|
|
27
|
+
pipx install --python python3.12 rednote-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 升级
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pipx upgrade --python python3.12 rednote-cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
如果历史环境用了其他 Python(例如 3.14),先重建:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pipx reinstall --python python3.12 rednote-cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 卸载
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pipx uninstall rednote-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 快速开始
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
rednote-cli init runtime
|
|
52
|
+
rednote-cli doctor run --format json
|
|
53
|
+
rednote-cli account login
|
|
54
|
+
rednote-cli account status --format json
|
|
55
|
+
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 常用命令
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rednote-cli search note --keyword <kw> [--size N] [--sort-by <comprehensive|latest|most_liked|most_commented|most_favorited>] [--note-type <all|video|image_text>] [--publish-time <all|day|week|half_year>] [--search-scope <all|viewed|unviewed|following>] [--location <all|local|nearby>] [--account <user_id>] [--input <file|->]
|
|
62
|
+
|
|
63
|
+
rednote-cli note --note-id <id> [--xsec-token t] [--xsec-source src] [--comment-size N] [--sub-comment-size N] [--account <user_id>] [--input <file|->]
|
|
64
|
+
|
|
65
|
+
rednote-cli search user --keyword <kw> [--size N] [--account <user_id>] [--input <file|->]
|
|
66
|
+
|
|
67
|
+
rednote-cli user --user-id <id> [--xsec-token t] [--xsec-source src] [--account <user_id>] [--input <file|->]
|
|
68
|
+
|
|
69
|
+
rednote-cli user self --account <user_id>
|
|
70
|
+
|
|
71
|
+
rednote-cli publish --target image --account <account_uid> [--image-list csv] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
72
|
+
rednote-cli publish --target video --account <account_uid> [--video <path-or-url>] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## JSON 输入模式(`--input`)
|
|
76
|
+
|
|
77
|
+
参数优先级固定:
|
|
78
|
+
- 显式 CLI 参数 > `--input` JSON > 默认值
|
|
79
|
+
|
|
80
|
+
支持 `--input` 的命令:
|
|
81
|
+
- `search note`
|
|
82
|
+
- `search user`
|
|
83
|
+
- `note`
|
|
84
|
+
- `user`
|
|
85
|
+
- `publish`
|
|
86
|
+
|
|
87
|
+
不支持 `--input` 的命令:
|
|
88
|
+
- `init runtime`
|
|
89
|
+
- `doctor run`
|
|
90
|
+
- `account login|status|list|activate|deactivate|delete`
|
|
91
|
+
- `user self`
|
|
92
|
+
|
|
93
|
+
推荐 Agent 调用模板:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
97
|
+
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 输出与退出码
|
|
101
|
+
|
|
102
|
+
- 建议自动化调用统一使用 `--format json` + `--trace-id`
|
|
103
|
+
- 退出码:`0` 成功,`2` 参数错误,`3` 认证错误,`4` 风控/限流,`5` 内部错误,`6` 超时,`7` 依赖缺失/未实现
|
|
104
|
+
|
|
105
|
+
## 工作区文档
|
|
106
|
+
|
|
107
|
+
- Workspace 总览:`../../README.md`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# rednote-cli
|
|
2
|
+
|
|
3
|
+
Rednote 平台专用 CLI(独立安装、独立升级、独立发布)。
|
|
4
|
+
|
|
5
|
+
## 系统要求
|
|
6
|
+
|
|
7
|
+
- Python `3.12.x`
|
|
8
|
+
- `pipx`
|
|
9
|
+
|
|
10
|
+
## 安装
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
brew update
|
|
14
|
+
brew upgrade python@3.12 pipx
|
|
15
|
+
python3.12 --version
|
|
16
|
+
pipx --version
|
|
17
|
+
pipx ensurepath
|
|
18
|
+
exec zsh
|
|
19
|
+
|
|
20
|
+
pipx install --python python3.12 rednote-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 升级
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pipx upgrade --python python3.12 rednote-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
如果历史环境用了其他 Python(例如 3.14),先重建:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pipx reinstall --python python3.12 rednote-cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 卸载
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pipx uninstall rednote-cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 快速开始
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
rednote-cli init runtime
|
|
45
|
+
rednote-cli doctor run --format json
|
|
46
|
+
rednote-cli account login
|
|
47
|
+
rednote-cli account status --format json
|
|
48
|
+
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 常用命令
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
rednote-cli search note --keyword <kw> [--size N] [--sort-by <comprehensive|latest|most_liked|most_commented|most_favorited>] [--note-type <all|video|image_text>] [--publish-time <all|day|week|half_year>] [--search-scope <all|viewed|unviewed|following>] [--location <all|local|nearby>] [--account <user_id>] [--input <file|->]
|
|
55
|
+
|
|
56
|
+
rednote-cli note --note-id <id> [--xsec-token t] [--xsec-source src] [--comment-size N] [--sub-comment-size N] [--account <user_id>] [--input <file|->]
|
|
57
|
+
|
|
58
|
+
rednote-cli search user --keyword <kw> [--size N] [--account <user_id>] [--input <file|->]
|
|
59
|
+
|
|
60
|
+
rednote-cli user --user-id <id> [--xsec-token t] [--xsec-source src] [--account <user_id>] [--input <file|->]
|
|
61
|
+
|
|
62
|
+
rednote-cli user self --account <user_id>
|
|
63
|
+
|
|
64
|
+
rednote-cli publish --target image --account <account_uid> [--image-list csv] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
65
|
+
rednote-cli publish --target video --account <account_uid> [--video <path-or-url>] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## JSON 输入模式(`--input`)
|
|
69
|
+
|
|
70
|
+
参数优先级固定:
|
|
71
|
+
- 显式 CLI 参数 > `--input` JSON > 默认值
|
|
72
|
+
|
|
73
|
+
支持 `--input` 的命令:
|
|
74
|
+
- `search note`
|
|
75
|
+
- `search user`
|
|
76
|
+
- `note`
|
|
77
|
+
- `user`
|
|
78
|
+
- `publish`
|
|
79
|
+
|
|
80
|
+
不支持 `--input` 的命令:
|
|
81
|
+
- `init runtime`
|
|
82
|
+
- `doctor run`
|
|
83
|
+
- `account login|status|list|activate|deactivate|delete`
|
|
84
|
+
- `user self`
|
|
85
|
+
|
|
86
|
+
推荐 Agent 调用模板:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
90
|
+
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 输出与退出码
|
|
94
|
+
|
|
95
|
+
- 建议自动化调用统一使用 `--format json` + `--trace-id`
|
|
96
|
+
- 退出码:`0` 成功,`2` 参数错误,`3` 认证错误,`4` 风控/限流,`5` 内部错误,`6` 超时,`7` 依赖缺失/未实现
|
|
97
|
+
|
|
98
|
+
## 工作区文档
|
|
99
|
+
|
|
100
|
+
- Workspace 总览:`../../README.md`
|
|
@@ -7,10 +7,10 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "rednote-cli"
|
|
10
|
-
version = "0.1.
|
|
10
|
+
version = "0.1.3"
|
|
11
11
|
description = "Rednote platform CLI"
|
|
12
12
|
readme = "README.md"
|
|
13
|
-
requires-python = "
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
14
|
dependencies = [
|
|
15
15
|
"playwright==1.58.0",
|
|
16
16
|
"playwright-stealth==2.0.2",
|
|
@@ -7,6 +7,7 @@ from loguru import logger
|
|
|
7
7
|
|
|
8
8
|
from rednote_cli._runtime.common.config import is_browser_headful_forced
|
|
9
9
|
from rednote_cli._runtime.core.database.manager import init_db
|
|
10
|
+
from rednote_cli import __version__
|
|
10
11
|
from rednote_cli.adapters.platform.rednote.runtime_registration import register_rednote_runtime
|
|
11
12
|
from rednote_cli.cli.commands import account, doctor, init, note, publish, search, user
|
|
12
13
|
from rednote_cli.cli.options import CliContext
|
|
@@ -47,12 +48,21 @@ app.add_typer(search.app, name="search")
|
|
|
47
48
|
app.add_typer(publish.app, name="publish")
|
|
48
49
|
|
|
49
50
|
|
|
51
|
+
def _version_callback(value: bool) -> None:
|
|
52
|
+
if not value:
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
typer.echo(__version__)
|
|
56
|
+
raise typer.Exit(code=0)
|
|
57
|
+
|
|
58
|
+
|
|
50
59
|
@app.callback()
|
|
51
60
|
def main(
|
|
52
61
|
ctx: typer.Context,
|
|
53
62
|
format: str = typer.Option("table", "--format", help="输出格式:json(推荐给 Agent) | jsonl(流式) | table(人工查看)"),
|
|
54
63
|
out: str | None = typer.Option(None, "--out", help="将最终输出写入文件;stderr 日志不受影响"),
|
|
55
64
|
quiet: bool = typer.Option(False, "--quiet", help="静默日志,仅输出结果"),
|
|
65
|
+
version: bool = typer.Option(False, "--version", callback=_version_callback, is_eager=True, help="显示 rednote-cli 版本并退出"),
|
|
56
66
|
trace_id: str | None = typer.Option(None, "--trace-id", help="请求链路 ID,方便排查和关联日志/结果;建议外部系统全程透传"),
|
|
57
67
|
timeout: int = typer.Option(120, "--timeout", help="命令超时(秒)"),
|
|
58
68
|
):
|
|
@@ -90,7 +100,7 @@ def _normalize_global_options_position() -> None:
|
|
|
90
100
|
|
|
91
101
|
command_names = {"init", "doctor", "account", "note", "user", "search", "publish"}
|
|
92
102
|
value_options = {"--format", "--out", "--trace-id", "--timeout"}
|
|
93
|
-
flag_options = {"--quiet"}
|
|
103
|
+
flag_options = {"--quiet", "--version"}
|
|
94
104
|
all_options = value_options | flag_options
|
|
95
105
|
|
|
96
106
|
raw_args = sys.argv[1:]
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: rednote-cli
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Rednote platform CLI
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
# rednote-cli
|
|
9
|
+
|
|
10
|
+
Rednote 平台专用 CLI(独立安装、独立升级、独立发布)。
|
|
11
|
+
|
|
12
|
+
## 系统要求
|
|
13
|
+
|
|
14
|
+
- Python `3.12.x`
|
|
15
|
+
- `pipx`
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
brew update
|
|
21
|
+
brew upgrade python@3.12 pipx
|
|
22
|
+
python3.12 --version
|
|
23
|
+
pipx --version
|
|
24
|
+
pipx ensurepath
|
|
25
|
+
exec zsh
|
|
26
|
+
|
|
27
|
+
pipx install --python python3.12 rednote-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 升级
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pipx upgrade --python python3.12 rednote-cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
如果历史环境用了其他 Python(例如 3.14),先重建:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pipx reinstall --python python3.12 rednote-cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 卸载
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pipx uninstall rednote-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 快速开始
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
rednote-cli init runtime
|
|
52
|
+
rednote-cli doctor run --format json
|
|
53
|
+
rednote-cli account login
|
|
54
|
+
rednote-cli account status --format json
|
|
55
|
+
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 常用命令
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rednote-cli search note --keyword <kw> [--size N] [--sort-by <comprehensive|latest|most_liked|most_commented|most_favorited>] [--note-type <all|video|image_text>] [--publish-time <all|day|week|half_year>] [--search-scope <all|viewed|unviewed|following>] [--location <all|local|nearby>] [--account <user_id>] [--input <file|->]
|
|
62
|
+
|
|
63
|
+
rednote-cli note --note-id <id> [--xsec-token t] [--xsec-source src] [--comment-size N] [--sub-comment-size N] [--account <user_id>] [--input <file|->]
|
|
64
|
+
|
|
65
|
+
rednote-cli search user --keyword <kw> [--size N] [--account <user_id>] [--input <file|->]
|
|
66
|
+
|
|
67
|
+
rednote-cli user --user-id <id> [--xsec-token t] [--xsec-source src] [--account <user_id>] [--input <file|->]
|
|
68
|
+
|
|
69
|
+
rednote-cli user self --account <user_id>
|
|
70
|
+
|
|
71
|
+
rednote-cli publish --target image --account <account_uid> [--image-list csv] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
72
|
+
rednote-cli publish --target video --account <account_uid> [--video <path-or-url>] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## JSON 输入模式(`--input`)
|
|
76
|
+
|
|
77
|
+
参数优先级固定:
|
|
78
|
+
- 显式 CLI 参数 > `--input` JSON > 默认值
|
|
79
|
+
|
|
80
|
+
支持 `--input` 的命令:
|
|
81
|
+
- `search note`
|
|
82
|
+
- `search user`
|
|
83
|
+
- `note`
|
|
84
|
+
- `user`
|
|
85
|
+
- `publish`
|
|
86
|
+
|
|
87
|
+
不支持 `--input` 的命令:
|
|
88
|
+
- `init runtime`
|
|
89
|
+
- `doctor run`
|
|
90
|
+
- `account login|status|list|activate|deactivate|delete`
|
|
91
|
+
- `user self`
|
|
92
|
+
|
|
93
|
+
推荐 Agent 调用模板:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
97
|
+
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 输出与退出码
|
|
101
|
+
|
|
102
|
+
- 建议自动化调用统一使用 `--format json` + `--trace-id`
|
|
103
|
+
- 退出码:`0` 成功,`2` 参数错误,`3` 认证错误,`4` 风控/限流,`5` 内部错误,`6` 超时,`7` 依赖缺失/未实现
|
|
104
|
+
|
|
105
|
+
## 工作区文档
|
|
106
|
+
|
|
107
|
+
- Workspace 总览:`../../README.md`
|
rednote-cli-0.1.1/PKG-INFO
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: rednote-cli
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Rednote platform CLI
|
|
5
|
-
Requires-Python: ==3.12
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
|
|
8
|
-
# rednote-cli
|
|
9
|
-
|
|
10
|
-
Rednote 平台专用 CLI 包(独立安装、独立升级)。
|
|
11
|
-
|
|
12
|
-
## 安装
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
brew install pipx
|
|
16
|
-
pipx ensurepath
|
|
17
|
-
exec zsh
|
|
18
|
-
|
|
19
|
-
pipx install rednote-cli
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 快速开始
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
rednote-cli init runtime
|
|
26
|
-
rednote-cli doctor run --format json
|
|
27
|
-
rednote-cli account login
|
|
28
|
-
rednote-cli account status --format json
|
|
29
|
-
rednote-cli account list --only-active true
|
|
30
|
-
rednote-cli account list --only-active false
|
|
31
|
-
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
32
|
-
rednote-cli publish --target image --account user_001 --image-list /abs/a.jpg,/abs/b.jpg --title 标题 --content 正文 --format json
|
|
33
|
-
rednote-cli publish --target video --account user_001 --video /abs/demo.mp4 --title 标题 --content 正文 --format json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
命令结构(当前版本):
|
|
37
|
-
- `note` / `user` 作为详情查询入口,`search note|user` 作为统一搜索入口。
|
|
38
|
-
- 旧层级 `note get|search`、`user get|search` 已移除。
|
|
39
|
-
|
|
40
|
-
空参数行为(统一约定):
|
|
41
|
-
- `rednote-cli note`、`rednote-cli publish`、`rednote-cli account activate` 等缺少业务参数时,输出帮助文本并返回退出码 `0`。
|
|
42
|
-
- 非空调用但参数非法时,返回 JSON `INVALID_ARGS`(退出码 `2`)。
|
|
43
|
-
|
|
44
|
-
`account status` 会实时打开浏览器检查登录态并刷新账号存储(`is_logged_in/check_time/storage_state`),输出结构与 `account list --only-active false` 对齐。
|
|
45
|
-
|
|
46
|
-
`account list` 的 `--only-active` 支持显式 `true|false`(默认 `true`)。
|
|
47
|
-
|
|
48
|
-
发布能力说明:
|
|
49
|
-
- `publish --target image`:图文发布,支持本地/URL 图片,`--account` 必填。
|
|
50
|
-
- `publish --target video`:视频发布,支持本地/URL 视频(仅 `mp4/mov`),`--account` 必填。
|
|
51
|
-
|
|
52
|
-
## 自动化建议
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
rednote-cli --format json --trace-id req-001 <command> ...
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`--input`(面向 AI/Agent):
|
|
59
|
-
- 作用:从 JSON 文件或 stdin 读取参数,适合复杂命令的程序化调用。
|
|
60
|
-
- 优先级:显式 CLI 参数 > `--input` JSON > 默认值。
|
|
61
|
-
- 范围:`--input` 不是全局参数,仅 `search note|user`、`note`、`user`、`publish` 支持。
|
|
62
|
-
|
|
63
|
-
示例:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
67
|
-
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## 文档
|
|
71
|
-
|
|
72
|
-
完整文档请查看仓库根目录:
|
|
73
|
-
- `README.md`
|
|
74
|
-
- `DESIGN.md`
|
|
75
|
-
- `DEV.md`
|
|
76
|
-
- `USER_GUIDE.md`
|
rednote-cli-0.1.1/README.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# rednote-cli
|
|
2
|
-
|
|
3
|
-
Rednote 平台专用 CLI 包(独立安装、独立升级)。
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
brew install pipx
|
|
9
|
-
pipx ensurepath
|
|
10
|
-
exec zsh
|
|
11
|
-
|
|
12
|
-
pipx install rednote-cli
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 快速开始
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
rednote-cli init runtime
|
|
19
|
-
rednote-cli doctor run --format json
|
|
20
|
-
rednote-cli account login
|
|
21
|
-
rednote-cli account status --format json
|
|
22
|
-
rednote-cli account list --only-active true
|
|
23
|
-
rednote-cli account list --only-active false
|
|
24
|
-
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
25
|
-
rednote-cli publish --target image --account user_001 --image-list /abs/a.jpg,/abs/b.jpg --title 标题 --content 正文 --format json
|
|
26
|
-
rednote-cli publish --target video --account user_001 --video /abs/demo.mp4 --title 标题 --content 正文 --format json
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
命令结构(当前版本):
|
|
30
|
-
- `note` / `user` 作为详情查询入口,`search note|user` 作为统一搜索入口。
|
|
31
|
-
- 旧层级 `note get|search`、`user get|search` 已移除。
|
|
32
|
-
|
|
33
|
-
空参数行为(统一约定):
|
|
34
|
-
- `rednote-cli note`、`rednote-cli publish`、`rednote-cli account activate` 等缺少业务参数时,输出帮助文本并返回退出码 `0`。
|
|
35
|
-
- 非空调用但参数非法时,返回 JSON `INVALID_ARGS`(退出码 `2`)。
|
|
36
|
-
|
|
37
|
-
`account status` 会实时打开浏览器检查登录态并刷新账号存储(`is_logged_in/check_time/storage_state`),输出结构与 `account list --only-active false` 对齐。
|
|
38
|
-
|
|
39
|
-
`account list` 的 `--only-active` 支持显式 `true|false`(默认 `true`)。
|
|
40
|
-
|
|
41
|
-
发布能力说明:
|
|
42
|
-
- `publish --target image`:图文发布,支持本地/URL 图片,`--account` 必填。
|
|
43
|
-
- `publish --target video`:视频发布,支持本地/URL 视频(仅 `mp4/mov`),`--account` 必填。
|
|
44
|
-
|
|
45
|
-
## 自动化建议
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
rednote-cli --format json --trace-id req-001 <command> ...
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
`--input`(面向 AI/Agent):
|
|
52
|
-
- 作用:从 JSON 文件或 stdin 读取参数,适合复杂命令的程序化调用。
|
|
53
|
-
- 优先级:显式 CLI 参数 > `--input` JSON > 默认值。
|
|
54
|
-
- 范围:`--input` 不是全局参数,仅 `search note|user`、`note`、`user`、`publish` 支持。
|
|
55
|
-
|
|
56
|
-
示例:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
60
|
-
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## 文档
|
|
64
|
-
|
|
65
|
-
完整文档请查看仓库根目录:
|
|
66
|
-
- `README.md`
|
|
67
|
-
- `DESIGN.md`
|
|
68
|
-
- `DEV.md`
|
|
69
|
-
- `USER_GUIDE.md`
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: rednote-cli
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Rednote platform CLI
|
|
5
|
-
Requires-Python: ==3.12
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
|
|
8
|
-
# rednote-cli
|
|
9
|
-
|
|
10
|
-
Rednote 平台专用 CLI 包(独立安装、独立升级)。
|
|
11
|
-
|
|
12
|
-
## 安装
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
brew install pipx
|
|
16
|
-
pipx ensurepath
|
|
17
|
-
exec zsh
|
|
18
|
-
|
|
19
|
-
pipx install rednote-cli
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 快速开始
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
rednote-cli init runtime
|
|
26
|
-
rednote-cli doctor run --format json
|
|
27
|
-
rednote-cli account login
|
|
28
|
-
rednote-cli account status --format json
|
|
29
|
-
rednote-cli account list --only-active true
|
|
30
|
-
rednote-cli account list --only-active false
|
|
31
|
-
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json
|
|
32
|
-
rednote-cli publish --target image --account user_001 --image-list /abs/a.jpg,/abs/b.jpg --title 标题 --content 正文 --format json
|
|
33
|
-
rednote-cli publish --target video --account user_001 --video /abs/demo.mp4 --title 标题 --content 正文 --format json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
命令结构(当前版本):
|
|
37
|
-
- `note` / `user` 作为详情查询入口,`search note|user` 作为统一搜索入口。
|
|
38
|
-
- 旧层级 `note get|search`、`user get|search` 已移除。
|
|
39
|
-
|
|
40
|
-
空参数行为(统一约定):
|
|
41
|
-
- `rednote-cli note`、`rednote-cli publish`、`rednote-cli account activate` 等缺少业务参数时,输出帮助文本并返回退出码 `0`。
|
|
42
|
-
- 非空调用但参数非法时,返回 JSON `INVALID_ARGS`(退出码 `2`)。
|
|
43
|
-
|
|
44
|
-
`account status` 会实时打开浏览器检查登录态并刷新账号存储(`is_logged_in/check_time/storage_state`),输出结构与 `account list --only-active false` 对齐。
|
|
45
|
-
|
|
46
|
-
`account list` 的 `--only-active` 支持显式 `true|false`(默认 `true`)。
|
|
47
|
-
|
|
48
|
-
发布能力说明:
|
|
49
|
-
- `publish --target image`:图文发布,支持本地/URL 图片,`--account` 必填。
|
|
50
|
-
- `publish --target video`:视频发布,支持本地/URL 视频(仅 `mp4/mov`),`--account` 必填。
|
|
51
|
-
|
|
52
|
-
## 自动化建议
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
rednote-cli --format json --trace-id req-001 <command> ...
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`--input`(面向 AI/Agent):
|
|
59
|
-
- 作用:从 JSON 文件或 stdin 读取参数,适合复杂命令的程序化调用。
|
|
60
|
-
- 优先级:显式 CLI 参数 > `--input` JSON > 默认值。
|
|
61
|
-
- 范围:`--input` 不是全局参数,仅 `search note|user`、`note`、`user`、`publish` 支持。
|
|
62
|
-
|
|
63
|
-
示例:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
rednote-cli --format json --trace-id req-001 search note --input payload.json
|
|
67
|
-
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## 文档
|
|
71
|
-
|
|
72
|
-
完整文档请查看仓库根目录:
|
|
73
|
-
- `README.md`
|
|
74
|
-
- `DESIGN.md`
|
|
75
|
-
- `DEV.md`
|
|
76
|
-
- `USER_GUIDE.md`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/__init__.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/media.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/models.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/platforms/publishing/validator.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/_runtime/services/scraper_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/persistence/file_account_repo.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/__init__.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/extractor.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/adapters/platform/rednote/publisher.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/account_list.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/account_mutation.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/auth_status.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/init_runtime.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/note_search.py
RENAMED
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/publish_note.py
RENAMED
|
File without changes
|
|
File without changes
|
{rednote-cli-0.1.1 → rednote-cli-0.1.3}/src/rednote_cli/application/use_cases/user_search.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|