jiff-geo-cli 0.1.1__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 (41) hide show
  1. jiff_geo_cli-0.1.1/PKG-INFO +264 -0
  2. jiff_geo_cli-0.1.1/README.md +249 -0
  3. jiff_geo_cli-0.1.1/geo_cli/__init__.py +4 -0
  4. jiff_geo_cli-0.1.1/geo_cli/api/__init__.py +1 -0
  5. jiff_geo_cli-0.1.1/geo_cli/api/article.py +229 -0
  6. jiff_geo_cli-0.1.1/geo_cli/api/auto_job.py +20 -0
  7. jiff_geo_cli-0.1.1/geo_cli/api/brand.py +45 -0
  8. jiff_geo_cli-0.1.1/geo_cli/api/eval_job.py +38 -0
  9. jiff_geo_cli-0.1.1/geo_cli/api/metrics.py +305 -0
  10. jiff_geo_cli-0.1.1/geo_cli/api/query.py +78 -0
  11. jiff_geo_cli-0.1.1/geo_cli/api/query_job.py +53 -0
  12. jiff_geo_cli-0.1.1/geo_cli/api/service_type.py +14 -0
  13. jiff_geo_cli-0.1.1/geo_cli/cli.py +62 -0
  14. jiff_geo_cli-0.1.1/geo_cli/client.py +96 -0
  15. jiff_geo_cli-0.1.1/geo_cli/commands/__init__.py +1 -0
  16. jiff_geo_cli-0.1.1/geo_cli/commands/article.py +255 -0
  17. jiff_geo_cli-0.1.1/geo_cli/commands/auto_job.py +46 -0
  18. jiff_geo_cli-0.1.1/geo_cli/commands/brand.py +50 -0
  19. jiff_geo_cli-0.1.1/geo_cli/commands/common.py +94 -0
  20. jiff_geo_cli-0.1.1/geo_cli/commands/config.py +18 -0
  21. jiff_geo_cli-0.1.1/geo_cli/commands/eval_job.py +60 -0
  22. jiff_geo_cli-0.1.1/geo_cli/commands/metrics.py +271 -0
  23. jiff_geo_cli-0.1.1/geo_cli/commands/query.py +158 -0
  24. jiff_geo_cli-0.1.1/geo_cli/commands/query_job.py +103 -0
  25. jiff_geo_cli-0.1.1/geo_cli/commands/service_type.py +28 -0
  26. jiff_geo_cli-0.1.1/geo_cli/config.py +82 -0
  27. jiff_geo_cli-0.1.1/geo_cli/constants.py +6 -0
  28. jiff_geo_cli-0.1.1/geo_cli/core/__init__.py +1 -0
  29. jiff_geo_cli-0.1.1/geo_cli/core/http.py +58 -0
  30. jiff_geo_cli-0.1.1/geo_cli/core/output.py +29 -0
  31. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/PKG-INFO +264 -0
  32. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/SOURCES.txt +39 -0
  33. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/dependency_links.txt +1 -0
  34. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/entry_points.txt +2 -0
  35. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/requires.txt +9 -0
  36. jiff_geo_cli-0.1.1/jiff_geo_cli.egg-info/top_level.txt +1 -0
  37. jiff_geo_cli-0.1.1/pyproject.toml +29 -0
  38. jiff_geo_cli-0.1.1/setup.cfg +4 -0
  39. jiff_geo_cli-0.1.1/tests/test_article.py +145 -0
  40. jiff_geo_cli-0.1.1/tests/test_cli.py +31 -0
  41. jiff_geo_cli-0.1.1/tests/test_metrics.py +215 -0
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: jiff-geo-cli
3
+ Version: 0.1.1
4
+ Summary: Command line tools for GEO platform automation.
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: typer<0.16.0,>=0.15.0
8
+ Requires-Dist: click<8.2.0,>=8.1.0
9
+ Requires-Dist: httpx>=0.27.0
10
+ Requires-Dist: rich>=13.0.0
11
+ Requires-Dist: python-dotenv>=1.0.0
12
+ Provides-Extra: dev
13
+ Requires-Dist: build>=1.2.0; extra == "dev"
14
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
15
+
16
+ # Geo CLI
17
+
18
+ Geo CLI is a command line tool for GEO platform automation. It is designed for agents and scripts: commands use explicit parameters and print JSON output so the result can be parsed reliably.
19
+
20
+ ## Installation
21
+
22
+ Install from PyPI after the package is published:
23
+
24
+ ```powershell
25
+ python -m pip install jiff-geo-cli
26
+ ```
27
+
28
+ Check that the command is available:
29
+
30
+ ```powershell
31
+ geo --version
32
+ geo --help
33
+ ```
34
+
35
+ If `geo` is not found, run it through Python's script directory for the environment where you installed the package, or reinstall with the Python interpreter you actually use:
36
+
37
+ ```powershell
38
+ python -m pip install --upgrade jiff-geo-cli
39
+ python -m pip show jiff-geo-cli
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ Initialize the local configuration file:
45
+
46
+ ```powershell
47
+ geo config init
48
+ ```
49
+
50
+ Then edit the generated `.env` file and add your API keys. The default user config path on Windows is:
51
+
52
+ ```text
53
+ C:\Users\<your-user>\.geo-cli\.env
54
+ ```
55
+
56
+ You can also put a `.env` file in the current working directory. Values in the current directory override the user-level config.
57
+
58
+ ## Configuration
59
+
60
+ Common configuration keys:
61
+
62
+ ```text
63
+ GEO_API_KEY=your_geo_api_key
64
+
65
+ REPORT_AGENT_API_KEY=your_report_agent_api_key
66
+ REPORT_AGENT_ID=ec71a005-e170-4d32-8d4b-d6f144571875
67
+
68
+ ARTICLE_API_KEY=your_article_service_api_key
69
+ ARTICLE_GROUP_ID=your_article_group_id
70
+ ARTICLE_GROUP_TEXT=your_article_group_display_text
71
+ ```
72
+
73
+ Defaults:
74
+
75
+ - `REPORT_AGENT_ID` can be omitted.
76
+
77
+ Required for article publishing:
78
+
79
+ - `ARTICLE_API_KEY`
80
+ - `ARTICLE_GROUP_ID`
81
+
82
+ Never paste API keys into chat logs or command output. Store them in `.env`.
83
+
84
+ ## Command Groups
85
+
86
+ Geo CLI provides these command groups:
87
+
88
+ ```text
89
+ geo config Local configuration
90
+ geo brand Brand management
91
+ geo service-type Service type lookup
92
+ geo query-job QueryJob management
93
+ geo query Query management
94
+ geo eval-job Evaluation job management
95
+ geo auto-job Auto-monitor configuration
96
+ geo metrics Metrics, data analysis, and reports
97
+ geo article Article account management and publishing
98
+ ```
99
+
100
+ Use `--help` at any level:
101
+
102
+ ```powershell
103
+ geo metrics --help
104
+ geo article --help
105
+ geo article jobs --help
106
+ ```
107
+
108
+ ## Metrics and Reports
109
+
110
+ Use `geo metrics` to query metrics and request data analysis/report generation.
111
+
112
+ Generate or continue an analysis report:
113
+
114
+ ```powershell
115
+ geo metrics analyze `
116
+ --brand-id 123 `
117
+ --message "Analyze this brand's recent performance and generate a concise report."
118
+ ```
119
+
120
+ Continue an existing analysis session:
121
+
122
+ ```powershell
123
+ geo metrics analyze `
124
+ --brand-id 123 `
125
+ --session-id "<session_id>" `
126
+ --message "Continue the report and expand the URL citation section."
127
+ ```
128
+
129
+ Query metric data:
130
+
131
+ ```powershell
132
+ geo metrics my-brand-stats --brand-id 123 --start-date 2026-06-01 --end-date 2026-06-30
133
+ geo metrics my-prompt-stats --brand-id 123 --platform Qwen
134
+ geo metrics domain-stats --brand-id 123
135
+ geo metrics url-stats --brand-id 123
136
+ geo metrics qa-details --brand-id 123 --chat-date 2026-06-30 --platform Qwen
137
+ ```
138
+
139
+ The report command can run for a long time. It is intended for data analysis and report generation tasks.
140
+
141
+ ## Article Publishing
142
+
143
+ Use `geo article` for publishing platform account management, login sessions, and asynchronous article publishing jobs.
144
+
145
+ List supported platforms:
146
+
147
+ ```powershell
148
+ geo article platforms
149
+ ```
150
+
151
+ Create a login session:
152
+
153
+ ```powershell
154
+ geo article login create --platform toutiao
155
+ ```
156
+
157
+ Open the returned `live_url` and finish login in the browser. Then check the login session:
158
+
159
+ ```powershell
160
+ geo article login get --session-id "<session_id>"
161
+ ```
162
+
163
+ Bind the returned `channel_id` to an account:
164
+
165
+ ```powershell
166
+ geo article accounts bind `
167
+ --platform toutiao `
168
+ --phone 13800138000 `
169
+ --channel-id "<channel_id>"
170
+ ```
171
+
172
+ List accounts:
173
+
174
+ ```powershell
175
+ geo article accounts list --platform toutiao --with-runtime
176
+ ```
177
+
178
+ Publish an article by account:
179
+
180
+ ```powershell
181
+ geo article publish `
182
+ --platform toutiao `
183
+ --phone 13800138000 `
184
+ --title "Article title" `
185
+ --content-file .\article.md `
186
+ --cover-image-url https://example.com/cover.jpg
187
+ ```
188
+
189
+ Publishing is asynchronous. The command creates a publish job and returns immediately. It does not wait for completion.
190
+
191
+ Check a publish job:
192
+
193
+ ```powershell
194
+ geo article jobs get --job-id "<job_id>"
195
+ ```
196
+
197
+ If a job status is `waiting_cookie`, open the returned `live_url`, finish browser verification, then save the cookie and continue:
198
+
199
+ ```powershell
200
+ geo article jobs save-cookie --job-id "<job_id>"
201
+ ```
202
+
203
+ Cancel a publish job:
204
+
205
+ ```powershell
206
+ geo article jobs cancel --job-id "<job_id>"
207
+ ```
208
+
209
+ Common job statuses:
210
+
211
+ ```text
212
+ queued Waiting in the server queue
213
+ checking_cookie Checking login cookie
214
+ starting_remote_login Starting remote login
215
+ waiting_cookie Waiting for user login or verification
216
+ publishing Publishing article
217
+ succeeded Published successfully
218
+ failed Publish failed
219
+ cancelled Cancelled
220
+ ```
221
+
222
+ ## Common Issues
223
+
224
+ ### `geo` is not found
225
+
226
+ Install the package in the Python environment you are using:
227
+
228
+ ```powershell
229
+ python -m pip install --upgrade jiff-geo-cli
230
+ python -m pip show jiff-geo-cli
231
+ ```
232
+
233
+ On Windows, if you use conda, install with that environment's Python:
234
+
235
+ ```powershell
236
+ D:\anaconda\envs\geo\python.exe -m pip install --upgrade jiff-geo-cli
237
+ D:\anaconda\envs\geo\Scripts\geo.exe --help
238
+ ```
239
+
240
+ ### Different environments show different versions
241
+
242
+ Each Python or conda environment has its own installed packages. Check the active package:
243
+
244
+ ```powershell
245
+ python -m pip show jiff-geo-cli
246
+ where geo
247
+ Get-Command geo | Format-List Source,Path
248
+ ```
249
+
250
+ Then upgrade the environment that owns the `geo` command.
251
+
252
+ ### Missing API key or group ID
253
+
254
+ Run:
255
+
256
+ ```powershell
257
+ geo config init
258
+ ```
259
+
260
+ Then add the required key to `.env`. Article publishing requires both `ARTICLE_API_KEY` and `ARTICLE_GROUP_ID`.
261
+
262
+ ## Development
263
+
264
+ Developer notes, local build steps, tests, and project structure are kept in `DEVELOPMENT.md`.
@@ -0,0 +1,249 @@
1
+ # Geo CLI
2
+
3
+ Geo CLI is a command line tool for GEO platform automation. It is designed for agents and scripts: commands use explicit parameters and print JSON output so the result can be parsed reliably.
4
+
5
+ ## Installation
6
+
7
+ Install from PyPI after the package is published:
8
+
9
+ ```powershell
10
+ python -m pip install jiff-geo-cli
11
+ ```
12
+
13
+ Check that the command is available:
14
+
15
+ ```powershell
16
+ geo --version
17
+ geo --help
18
+ ```
19
+
20
+ If `geo` is not found, run it through Python's script directory for the environment where you installed the package, or reinstall with the Python interpreter you actually use:
21
+
22
+ ```powershell
23
+ python -m pip install --upgrade jiff-geo-cli
24
+ python -m pip show jiff-geo-cli
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ Initialize the local configuration file:
30
+
31
+ ```powershell
32
+ geo config init
33
+ ```
34
+
35
+ Then edit the generated `.env` file and add your API keys. The default user config path on Windows is:
36
+
37
+ ```text
38
+ C:\Users\<your-user>\.geo-cli\.env
39
+ ```
40
+
41
+ You can also put a `.env` file in the current working directory. Values in the current directory override the user-level config.
42
+
43
+ ## Configuration
44
+
45
+ Common configuration keys:
46
+
47
+ ```text
48
+ GEO_API_KEY=your_geo_api_key
49
+
50
+ REPORT_AGENT_API_KEY=your_report_agent_api_key
51
+ REPORT_AGENT_ID=ec71a005-e170-4d32-8d4b-d6f144571875
52
+
53
+ ARTICLE_API_KEY=your_article_service_api_key
54
+ ARTICLE_GROUP_ID=your_article_group_id
55
+ ARTICLE_GROUP_TEXT=your_article_group_display_text
56
+ ```
57
+
58
+ Defaults:
59
+
60
+ - `REPORT_AGENT_ID` can be omitted.
61
+
62
+ Required for article publishing:
63
+
64
+ - `ARTICLE_API_KEY`
65
+ - `ARTICLE_GROUP_ID`
66
+
67
+ Never paste API keys into chat logs or command output. Store them in `.env`.
68
+
69
+ ## Command Groups
70
+
71
+ Geo CLI provides these command groups:
72
+
73
+ ```text
74
+ geo config Local configuration
75
+ geo brand Brand management
76
+ geo service-type Service type lookup
77
+ geo query-job QueryJob management
78
+ geo query Query management
79
+ geo eval-job Evaluation job management
80
+ geo auto-job Auto-monitor configuration
81
+ geo metrics Metrics, data analysis, and reports
82
+ geo article Article account management and publishing
83
+ ```
84
+
85
+ Use `--help` at any level:
86
+
87
+ ```powershell
88
+ geo metrics --help
89
+ geo article --help
90
+ geo article jobs --help
91
+ ```
92
+
93
+ ## Metrics and Reports
94
+
95
+ Use `geo metrics` to query metrics and request data analysis/report generation.
96
+
97
+ Generate or continue an analysis report:
98
+
99
+ ```powershell
100
+ geo metrics analyze `
101
+ --brand-id 123 `
102
+ --message "Analyze this brand's recent performance and generate a concise report."
103
+ ```
104
+
105
+ Continue an existing analysis session:
106
+
107
+ ```powershell
108
+ geo metrics analyze `
109
+ --brand-id 123 `
110
+ --session-id "<session_id>" `
111
+ --message "Continue the report and expand the URL citation section."
112
+ ```
113
+
114
+ Query metric data:
115
+
116
+ ```powershell
117
+ geo metrics my-brand-stats --brand-id 123 --start-date 2026-06-01 --end-date 2026-06-30
118
+ geo metrics my-prompt-stats --brand-id 123 --platform Qwen
119
+ geo metrics domain-stats --brand-id 123
120
+ geo metrics url-stats --brand-id 123
121
+ geo metrics qa-details --brand-id 123 --chat-date 2026-06-30 --platform Qwen
122
+ ```
123
+
124
+ The report command can run for a long time. It is intended for data analysis and report generation tasks.
125
+
126
+ ## Article Publishing
127
+
128
+ Use `geo article` for publishing platform account management, login sessions, and asynchronous article publishing jobs.
129
+
130
+ List supported platforms:
131
+
132
+ ```powershell
133
+ geo article platforms
134
+ ```
135
+
136
+ Create a login session:
137
+
138
+ ```powershell
139
+ geo article login create --platform toutiao
140
+ ```
141
+
142
+ Open the returned `live_url` and finish login in the browser. Then check the login session:
143
+
144
+ ```powershell
145
+ geo article login get --session-id "<session_id>"
146
+ ```
147
+
148
+ Bind the returned `channel_id` to an account:
149
+
150
+ ```powershell
151
+ geo article accounts bind `
152
+ --platform toutiao `
153
+ --phone 13800138000 `
154
+ --channel-id "<channel_id>"
155
+ ```
156
+
157
+ List accounts:
158
+
159
+ ```powershell
160
+ geo article accounts list --platform toutiao --with-runtime
161
+ ```
162
+
163
+ Publish an article by account:
164
+
165
+ ```powershell
166
+ geo article publish `
167
+ --platform toutiao `
168
+ --phone 13800138000 `
169
+ --title "Article title" `
170
+ --content-file .\article.md `
171
+ --cover-image-url https://example.com/cover.jpg
172
+ ```
173
+
174
+ Publishing is asynchronous. The command creates a publish job and returns immediately. It does not wait for completion.
175
+
176
+ Check a publish job:
177
+
178
+ ```powershell
179
+ geo article jobs get --job-id "<job_id>"
180
+ ```
181
+
182
+ If a job status is `waiting_cookie`, open the returned `live_url`, finish browser verification, then save the cookie and continue:
183
+
184
+ ```powershell
185
+ geo article jobs save-cookie --job-id "<job_id>"
186
+ ```
187
+
188
+ Cancel a publish job:
189
+
190
+ ```powershell
191
+ geo article jobs cancel --job-id "<job_id>"
192
+ ```
193
+
194
+ Common job statuses:
195
+
196
+ ```text
197
+ queued Waiting in the server queue
198
+ checking_cookie Checking login cookie
199
+ starting_remote_login Starting remote login
200
+ waiting_cookie Waiting for user login or verification
201
+ publishing Publishing article
202
+ succeeded Published successfully
203
+ failed Publish failed
204
+ cancelled Cancelled
205
+ ```
206
+
207
+ ## Common Issues
208
+
209
+ ### `geo` is not found
210
+
211
+ Install the package in the Python environment you are using:
212
+
213
+ ```powershell
214
+ python -m pip install --upgrade jiff-geo-cli
215
+ python -m pip show jiff-geo-cli
216
+ ```
217
+
218
+ On Windows, if you use conda, install with that environment's Python:
219
+
220
+ ```powershell
221
+ D:\anaconda\envs\geo\python.exe -m pip install --upgrade jiff-geo-cli
222
+ D:\anaconda\envs\geo\Scripts\geo.exe --help
223
+ ```
224
+
225
+ ### Different environments show different versions
226
+
227
+ Each Python or conda environment has its own installed packages. Check the active package:
228
+
229
+ ```powershell
230
+ python -m pip show jiff-geo-cli
231
+ where geo
232
+ Get-Command geo | Format-List Source,Path
233
+ ```
234
+
235
+ Then upgrade the environment that owns the `geo` command.
236
+
237
+ ### Missing API key or group ID
238
+
239
+ Run:
240
+
241
+ ```powershell
242
+ geo config init
243
+ ```
244
+
245
+ Then add the required key to `.env`. Article publishing requires both `ARTICLE_API_KEY` and `ARTICLE_GROUP_ID`.
246
+
247
+ ## Development
248
+
249
+ Developer notes, local build steps, tests, and project structure are kept in `DEVELOPMENT.md`.
@@ -0,0 +1,4 @@
1
+ from geo_cli.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
@@ -0,0 +1 @@
1
+ """Resource-specific Geo API clients."""