oed-cli 0.2.0__tar.gz → 0.2.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.
- {oed_cli-0.2.0/src/oed_cli.egg-info → oed_cli-0.2.3}/PKG-INFO +100 -33
- {oed_cli-0.2.0 → oed_cli-0.2.3}/README.md +405 -338
- {oed_cli-0.2.0 → oed_cli-0.2.3}/pyproject.toml +68 -68
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/__init__.py +6 -6
- oed_cli-0.2.3/src/oed_cli/auth.py +176 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/cli.py +278 -278
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/dynamic.py +594 -473
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/http.py +42 -5
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/invoke.py +479 -305
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/main.py +658 -409
- {oed_cli-0.2.0 → oed_cli-0.2.3/src/oed_cli.egg-info}/PKG-INFO +100 -33
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli.egg-info/SOURCES.txt +5 -1
- oed_cli-0.2.3/tests/test_ag_auth_cli.py +153 -0
- oed_cli-0.2.3/tests/test_auth.py +132 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/tests/test_cli.py +294 -294
- oed_cli-0.2.3/tests/test_dynamic.py +1043 -0
- oed_cli-0.2.3/tests/test_invoke.py +297 -0
- oed_cli-0.2.0/tests/test_dynamic.py +0 -737
- {oed_cli-0.2.0 → oed_cli-0.2.3}/LICENSE +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/setup.cfg +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/__main__.py +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/discovery.py +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/errors.py +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli/py.typed +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli.egg-info/dependency_links.txt +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli.egg-info/entry_points.txt +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli.egg-info/requires.txt +0 -0
- {oed_cli-0.2.0 → oed_cli-0.2.3}/src/oed_cli.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oed-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: oed — openEuler Infra command line. Auto-discovered, AI-friendly.
|
|
5
5
|
Author: oed-cli contributors
|
|
6
6
|
License: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://
|
|
8
|
-
Project-URL: Documentation, https://
|
|
9
|
-
Project-URL: Bug Tracker, https://
|
|
7
|
+
Project-URL: Homepage, https://atomgit.com/openeuler/oed-cli
|
|
8
|
+
Project-URL: Documentation, https://atomgit.com/openeuler/oed-cli/blob/master/docs/cli-design.md
|
|
9
|
+
Project-URL: Bug Tracker, https://atomgit.com/openeuler/oed-cli/issues
|
|
10
10
|
Keywords: openEuler,cli,discovery,ai-agent,openapi
|
|
11
11
|
Classifier: Development Status :: 3 - Alpha
|
|
12
12
|
Classifier: Environment :: Console
|
|
@@ -60,7 +60,7 @@ only thing that has to be versioned is the gateway's OpenAPI spec itself.
|
|
|
60
60
|
|
|
61
61
|
- **Zero boilerplate.** No copy-pasted OpenAPI clients, no per-service
|
|
62
62
|
SDKs, no `--data` to escape, no `User-Agent` headers to remember.
|
|
63
|
-
- **Runtime discovery.** The `oed cve
|
|
63
|
+
- **Runtime discovery.** The `oed cve --help` list you saw
|
|
64
64
|
above is built from `https://api-gateway.osinfra.cn/discovery/apis` on
|
|
65
65
|
every call. New services, new endpoints, and new schema fields show up
|
|
66
66
|
without an `oed` upgrade. A 10-minute cache keeps CI bursts cheap;
|
|
@@ -90,14 +90,14 @@ pipx install oed-cli
|
|
|
90
90
|
From source:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
git clone https://
|
|
93
|
+
git clone https://atomgit.com/openeuler/oed-cli && cd oed-cli
|
|
94
94
|
pip install -e .
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
Verify:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
oed --version # → oed, version 0.2.
|
|
100
|
+
oed --version # → oed, version 0.2.3
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
---
|
|
@@ -106,8 +106,24 @@ oed --version # → oed, version 0.2.0
|
|
|
106
106
|
|
|
107
107
|
```bash
|
|
108
108
|
pip install oed-cli
|
|
109
|
-
oed cve
|
|
109
|
+
oed cve getSecurityNoticeByCveId --cve-id CVE-2019-10082
|
|
110
110
|
```
|
|
111
|
+
#### (optional) Call an AtomGit operation — store a token once
|
|
112
|
+
|
|
113
|
+
Operations on the `ag` (AtomGit) service authenticate via an `access_token`
|
|
114
|
+
query parameter. Store a personal access token once, and every `oed ag ...`
|
|
115
|
+
call injects it automatically:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
oed ag login
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Then `oed ag listAuthenticatedUserIssues` just works — no per-call token
|
|
122
|
+
flag needed. Full details (`oed ag login --token <pat> [--no-verify]`,
|
|
123
|
+
`--status`, `oed ag logout`, how the token is stored, auto-injection rules)
|
|
124
|
+
are in the [AtomGit (`ag`) authentication](#atomgit-ag-authentication)
|
|
125
|
+
section below.
|
|
126
|
+
|
|
111
127
|
|
|
112
128
|
That's it. `oed` discovers the service from the gateway, pulls its OpenAPI
|
|
113
129
|
spec, derives `--cve-id` from the declared `query` parameter, fills WAF-safe
|
|
@@ -136,7 +152,7 @@ browser headers, and ships the request through the production gateway:
|
|
|
136
152
|
Output is plain JSON on stdout — pipe straight into `jq`:
|
|
137
153
|
|
|
138
154
|
```bash
|
|
139
|
-
oed cve
|
|
155
|
+
oed cve getSecurityNoticeByCveId --cve-id CVE-2019-10082 \
|
|
140
156
|
| jq '.response.result[0] | {cveId, affectedProduct, affectedComponent}'
|
|
141
157
|
```
|
|
142
158
|
|
|
@@ -171,7 +187,7 @@ Don't guess. Each operation auto-derives its own flags from the OpenAPI
|
|
|
171
187
|
schema:
|
|
172
188
|
|
|
173
189
|
```bash
|
|
174
|
-
oed cve
|
|
190
|
+
oed cve getSecurityNoticeByCveId --help
|
|
175
191
|
```
|
|
176
192
|
|
|
177
193
|
```json
|
|
@@ -199,7 +215,7 @@ oed cve-sa-backend getSecurityNoticeByCveId --help
|
|
|
199
215
|
Same idea at the service level — list every operation with one flag each:
|
|
200
216
|
|
|
201
217
|
```bash
|
|
202
|
-
oed cve
|
|
218
|
+
oed cve --help | jq '.operations | length'
|
|
203
219
|
# → 37
|
|
204
220
|
```
|
|
205
221
|
|
|
@@ -209,33 +225,80 @@ oed cve-sa-backend --help | jq '.operations | length'
|
|
|
209
225
|
|
|
210
226
|
```bash
|
|
211
227
|
# Dry-run — preview the request without hitting the network
|
|
212
|
-
oed cve
|
|
228
|
+
oed cve getSecurityNoticeByCveId --cve-id CVE-2019-10082 --dry-run
|
|
213
229
|
|
|
214
|
-
#
|
|
215
|
-
oed
|
|
230
|
+
# Date-filtered query — pagination comes back as total/page/size
|
|
231
|
+
oed meeting listMeetings --date 2026-07-29
|
|
232
|
+
# → response.data: [ { "topic": "安全sig例会", "group_name": "security-committee",
|
|
233
|
+
# "date": "2026-07-29", "start": "16:00", "end": "18:00",
|
|
234
|
+
# "join_url": "https://meeting.huaweicloud.com:36443/#/j/985661561", ... } ]
|
|
216
235
|
|
|
217
|
-
#
|
|
218
|
-
oed
|
|
236
|
+
# Forum — Discourse `/latest.json`;
|
|
237
|
+
oed forum listLatestTopics --per-page 2
|
|
238
|
+
# → response.topic_list.topics: [ { "title": "《openEuler社区论坛使用指南&规则》",
|
|
239
|
+
# "posts_count": 12, "created_at": "2023-01-16T07:53:30.163Z" }, ... ]
|
|
219
240
|
|
|
220
|
-
# POST
|
|
221
|
-
oed
|
|
222
|
-
--json '{"
|
|
241
|
+
# Search — POST JSON body; `keyword` + `lang` are required, pageSize must be 6-49
|
|
242
|
+
oed search multisearchDocByKeyword \
|
|
243
|
+
--json '{"keyword":"软件源安装速度慢怎么办","lang":"zh","page":1,"pageSize":10}'
|
|
244
|
+
# → response.obj.records: [ { "title": "<span>软件下载慢问题</span>",
|
|
245
|
+
# "path": "https://eur.openeuler.openatom.cn/coprs/",
|
|
246
|
+
# "type": "service", "lang": "zh" }, ... ]
|
|
223
247
|
|
|
224
|
-
# Bulk JSON for scripts — `--params` is the escape hatch when you have many fields
|
|
225
|
-
oed cve-sa-backend getSecurityNoticeByCveId --params '{"cveId":"1"}'
|
|
226
248
|
|
|
227
|
-
# Raw OpenAPI spec, for debugging
|
|
228
|
-
oed schema cve-sa-backend | jq '.paths | keys'
|
|
229
249
|
```
|
|
230
250
|
|
|
231
251
|
---
|
|
232
252
|
|
|
253
|
+
## AtomGit (`ag`) authentication
|
|
254
|
+
|
|
255
|
+
AtomGit operations authenticate through the `access_token` query parameter
|
|
256
|
+
declared on their spec. Store a personal access token once, and every
|
|
257
|
+
`oed ag ...` call uses it automatically:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Interactive (prompts for the token, never echoes it back)
|
|
261
|
+
oed ag login
|
|
262
|
+
|
|
263
|
+
# Non-interactive — good for CI / scripts
|
|
264
|
+
oed ag login --token <pat>
|
|
265
|
+
|
|
266
|
+
# Skip validating the token against AtomGit before storing
|
|
267
|
+
oed ag login --token <pat> --no-verify
|
|
268
|
+
|
|
269
|
+
# Just report whether a token is configured (no network, no prompt)
|
|
270
|
+
oed ag login --status
|
|
271
|
+
|
|
272
|
+
# Forget the stored token
|
|
273
|
+
oed ag logout
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Token storage:
|
|
277
|
+
|
|
278
|
+
- Windows: encrypted at rest for the current user via DPAPI (no extra deps).
|
|
279
|
+
- Elsewhere: base64, which is documented obfuscation, **not** encryption.
|
|
280
|
+
- Lives under the cache dir (`tokens/ag.json`); `oed cache clear` never
|
|
281
|
+
touches credentials.
|
|
282
|
+
|
|
283
|
+
Auto-injection on real calls:
|
|
284
|
+
|
|
285
|
+
- If the operation declares `access_token` and you don't pass one, the stored
|
|
286
|
+
token is filled in automatically — `oed ag listAuthenticatedUserIssues` just
|
|
287
|
+
works.
|
|
288
|
+
- An explicit `--access-token <pat>` always wins over the stored one.
|
|
289
|
+
- If the operation requires a token and none is available anywhere, you get a
|
|
290
|
+
clear `ag_token_missing` error with a hint, instead of an opaque gateway 401.
|
|
291
|
+
- `--dry-run` and request echo views mask the token as `<stored>` — the real
|
|
292
|
+
value only ever goes out on the wire.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
233
296
|
## Local development
|
|
234
297
|
|
|
235
298
|
### Clone and install (editable)
|
|
236
299
|
|
|
237
300
|
```bash
|
|
238
|
-
git clone https://
|
|
301
|
+
git clone https://atomgit.com/openeuler/oed-cli && cd oed-cli
|
|
239
302
|
pip install -e ".[dev]"
|
|
240
303
|
```
|
|
241
304
|
|
|
@@ -248,10 +311,11 @@ invocation. Drop it with `pip uninstall oed-cli` when you're done.
|
|
|
248
311
|
python -m pytest -q
|
|
249
312
|
```
|
|
250
313
|
|
|
251
|
-
|
|
252
|
-
per-parameter flag coercion, the `API_`-prefix alias,
|
|
253
|
-
|
|
254
|
-
|
|
314
|
+
58 tests cover v0.1 + v0.2 dispatch, the operation-help cheatsheet,
|
|
315
|
+
per-parameter flag coercion, the `API_`-prefix alias, the
|
|
316
|
+
`resolve_runtime_gateway` no-fallback semantics, every exit code path, and
|
|
317
|
+
v0.4's `ag` token store (DPAPI/base64) + auto-injection.
|
|
318
|
+
They monkeypatch the discovery layer so no gateway access is needed.
|
|
255
319
|
|
|
256
320
|
### Smoke-test against the live gateway
|
|
257
321
|
|
|
@@ -261,13 +325,13 @@ oed info
|
|
|
261
325
|
# → {"ok": true, "services_total": 8, "community": "openeuler", ...}
|
|
262
326
|
|
|
263
327
|
# 2) Real CVE query (canonical end-to-end test)
|
|
264
|
-
oed cve
|
|
328
|
+
oed cve getSecurityNoticeByCveId --cve-id CVE-2019-10082
|
|
265
329
|
|
|
266
330
|
# 3) Dry-run to inspect URL + body without hitting the network
|
|
267
|
-
oed cve
|
|
331
|
+
oed cve getSecurityNoticeByCveId --cve-id 1 --dry-run
|
|
268
332
|
|
|
269
333
|
# 4) Verify the canonical URL routing
|
|
270
|
-
oed cve
|
|
334
|
+
oed cve getSecurityNoticeByCveId --dry-run --cve-id 1 \
|
|
271
335
|
| jq '.url'
|
|
272
336
|
# → "https://apig.osinfra.cn/cve-security-notice-server/securitynotice/getByCveId"
|
|
273
337
|
```
|
|
@@ -328,7 +392,10 @@ to eyeball `oed services` output every week.
|
|
|
328
392
|
| `oed info` hangs or `waf_block` exit 2 | gateway unreachable / WAF | confirm `curl https://api-gateway.osinfra.cn`; see `context/discoverAPI.md` §6 |
|
|
329
393
|
| Chinese output garbled on Windows | console codepage not UTF-8 | `chcp 65001`, or pipe `\| python`, or `PYTHONIOENCODING=utf-8 oed …` |
|
|
330
394
|
| `error="spec_missing"` (exit 4) on a known service | upstream hasn't published the spec yet | wait for the gateway-side OpenAPI yaml; nothing to do on the oed side |
|
|
331
|
-
|
|
|
395
|
+
| `error="ag_token_missing"` on an `ag` call | operation needs a token, none stored | `oed ag login` (or pass `--access-token <pat>`) |
|
|
396
|
+
| `error="body_fields_via_params"` (exit 1) on a POST | body fields were passed via `--params` (which only covers query/path) | resend the fields with `--json '{...}'` — `oed <service> <op> --help` lists the body schema |
|
|
397
|
+
| `error="gateway_managed_param"` (exit 1) on a `forum` call | `Api-Key` / `Api-Username` were passed (`--api-key` or `--params`) | drop them — `oed` auto-fills both placeholder headers on every `forum` call and the gateway converts them |
|
|
398
|
+
| A `cve` call exits 2 (`waf_block`) | spec points to a `.test.osinfra.cn` host | already handled — `oed` reads `base_url` from the discovery feed (no fallback) and ignores the spec's `x-apigateway-backend.httpEndpoints.address` for the host |
|
|
332
399
|
|
|
333
400
|
### Offline mode
|
|
334
401
|
|
|
@@ -358,7 +425,7 @@ python -c "from oed_cli.main import main; sys.argv = ['oed','--help']; main()"
|
|
|
358
425
|
## Contributing
|
|
359
426
|
|
|
360
427
|
Issues and patches welcome on
|
|
361
|
-
[
|
|
428
|
+
[atomgit.com/openeuler/oed-cli](https://atomgit.com/openeuler/oed-cli).
|
|
362
429
|
|
|
363
430
|
Dev install:
|
|
364
431
|
|