reportify-cli 0.1.48__tar.gz → 0.1.49__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.
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/PKG-INFO +1 -1
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/pyproject.toml +1 -1
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/auth.py +7 -27
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/.gitignore +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/Makefile +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/README.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/scripts/README.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/scripts/bump_version.sh +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/scripts/publish.sh +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/skills/reportify-agent/SKILL.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/skills/reportify-ai/SKILL.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/skills/reportify-ai/references/API_REFERENCE.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/skills/reportify-ai/references/COMMANDS.md +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/__init__.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/auth_config.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/client.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/__init__.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/agent.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/channels.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/concepts.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/docs.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/following.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/kb.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/macro.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/quant.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/search.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/stock.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/timeline.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/commands/user.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/main.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/output.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/params.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/settings.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/src/utils.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/__init__.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/integration/test_docs_integration.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/integration/test_stock_integration.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/__init__.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/test_auth_commands.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/test_auth_config.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/test_docs.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/test_quant.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/tests/test_commands/test_search.py +0 -0
- {reportify_cli-0.1.48 → reportify_cli-0.1.49}/uv.lock +0 -0
|
@@ -34,13 +34,17 @@ from src.settings import get_api_base_url
|
|
|
34
34
|
|
|
35
35
|
app = typer.Typer(help="Authentication", rich_markup_mode="rich")
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
# Reportify CLI 是 first-party 客户端, 用预注册的稳定 client_id (后端配置在
|
|
38
|
+
# OAUTH_FIRSTPARTY_CLIENTS 里), 不走 DCR. 这样可以拿到 api 域的 token (DCR
|
|
39
|
+
# 注册的客户端默认只能拿 mcp 域).
|
|
40
|
+
#
|
|
41
|
+
# Public client (PKCE 防 code 截获), client_id 公开不构成安全风险.
|
|
42
|
+
CLIENT_ID = "reportify-cli"
|
|
38
43
|
RESOURCE = "https://api.reportify.cn"
|
|
39
44
|
SCOPE = "api"
|
|
40
45
|
GRANT_TYPE_DEVICE = "urn:ietf:params:oauth:grant-type:device_code"
|
|
41
46
|
GRANT_TYPE_REFRESH = "refresh_token"
|
|
42
47
|
|
|
43
|
-
ENDPOINT_REGISTER = "/v1/oauth/register"
|
|
44
48
|
ENDPOINT_DEVICE_CODE = "/v1/oauth/device/code"
|
|
45
49
|
ENDPOINT_TOKEN = "/v1/oauth/token"
|
|
46
50
|
|
|
@@ -70,25 +74,6 @@ def _oauth_error(response: httpx.Response) -> tuple[str, str]:
|
|
|
70
74
|
return ("unknown_error", str(detail))
|
|
71
75
|
|
|
72
76
|
|
|
73
|
-
def _register_client(client: httpx.Client) -> str:
|
|
74
|
-
"""RFC 7591 Dynamic Client Registration —— 注册本地 CLI 实例, 返回 client_id。"""
|
|
75
|
-
resp = client.post(
|
|
76
|
-
ENDPOINT_REGISTER,
|
|
77
|
-
json={
|
|
78
|
-
"client_name": CLIENT_NAME,
|
|
79
|
-
"redirect_uris": [], # device flow 不需要
|
|
80
|
-
"grant_types": [GRANT_TYPE_DEVICE, GRANT_TYPE_REFRESH],
|
|
81
|
-
"response_types": [],
|
|
82
|
-
"token_endpoint_auth_method": "none",
|
|
83
|
-
"scope": SCOPE,
|
|
84
|
-
},
|
|
85
|
-
)
|
|
86
|
-
if resp.status_code != 200:
|
|
87
|
-
err, desc = _oauth_error(resp)
|
|
88
|
-
_err(f"failed to register client ({err}): {desc}")
|
|
89
|
-
return resp.json()["client_id"]
|
|
90
|
-
|
|
91
|
-
|
|
92
77
|
def _request_device_code(client: httpx.Client, client_id: str) -> dict:
|
|
93
78
|
resp = client.post(
|
|
94
79
|
ENDPOINT_DEVICE_CODE,
|
|
@@ -199,14 +184,9 @@ def login(
|
|
|
199
184
|
automatically; expired tokens are silently refreshed.
|
|
200
185
|
"""
|
|
201
186
|
base_url = get_api_base_url().rstrip("/")
|
|
202
|
-
#
|
|
203
|
-
existing = load_credential()
|
|
204
|
-
client_id = existing.client_id if existing and existing.client_id else None
|
|
187
|
+
client_id = CLIENT_ID # first-party 预注册, 不走 DCR
|
|
205
188
|
|
|
206
189
|
with httpx.Client(base_url=base_url, timeout=30.0) as client:
|
|
207
|
-
if not client_id:
|
|
208
|
-
client_id = _register_client(client)
|
|
209
|
-
|
|
210
190
|
device_resp = _request_device_code(client, client_id)
|
|
211
191
|
|
|
212
192
|
verification_uri_complete = device_resp.get("verification_uri_complete")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reportify_cli-0.1.48 → reportify_cli-0.1.49}/skills/reportify-ai/references/API_REFERENCE.md
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|