adanos-cli 1.33.0__tar.gz → 1.34.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.
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/CHANGELOG.md +11 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/PKG-INFO +8 -6
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/README.md +4 -2
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/pyproject.toml +2 -2
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/scripts/generate_homebrew_formula.py +1 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/__init__.py +1 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/config.py +1 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/endpoints.py +6 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/main.py +8 -5
- adanos_cli-1.34.0/tests/conftest.py +27 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_account.py +10 -10
- adanos_cli-1.34.0/tests/test_api_154.py +71 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_distribution.py +1 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_endpoint_coverage.py +1 -1
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_onboarding.py +10 -10
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_shell.py +1 -1
- adanos_cli-1.33.0/tests/conftest.py +0 -12
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/.github/workflows/ci.yml +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/.github/workflows/cli-binaries.yml +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/.github/workflows/publish-pypi.yml +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/.gitignore +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/LICENSE +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/install.ps1 +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/install.sh +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/scripts/build_cli_binary.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/scripts/cli_audit.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/scripts/pyinstaller_entrypoint.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/__main__.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/activity_log.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/assets/__init__.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/assets/adanos-mark-color.svg +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/commands/__init__.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/commands/auth.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/commands/config.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/commands/extensions.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/commands/secrets.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/nlp.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/shell_history.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/summaries.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/tty.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/update_notifier.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/utils.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/src/adanos_cli/watchlists.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/__init__.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_activity_log.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_agent_contract.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_auth.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_cli_audit.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_config_runtime.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_diagnostics.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_extensions.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_logs.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_power_features.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_tty.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_update_notifier.py +0 -0
- {adanos_cli-1.33.0 → adanos_cli-1.34.0}/tests/test_watchlists.py +0 -0
|
@@ -5,6 +5,17 @@ All notable changes to `adanos-cli` will be documented in this file.
|
|
|
5
5
|
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.34.0] - 2026-10-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Add `--target` to `endpoint call sentiment.analyze` for sentiment about a company name or ticker.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Support API 1.54.0 and use `api.adanos.com` by default. Explicit saved, environment, and flag base URLs keep their precedence.
|
|
17
|
+
- Use `adanos.com` for website links, account recovery, package metadata, Homebrew, and the support email address.
|
|
18
|
+
|
|
8
19
|
## [1.33.0] - 2026-08-09
|
|
9
20
|
|
|
10
21
|
### Added
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: adanos-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.34.0
|
|
4
4
|
Summary: CLI for the Adanos Market Sentiment API
|
|
5
|
-
Project-URL: Homepage, https://adanos.
|
|
6
|
-
Project-URL: API_Docs, https://api.adanos.
|
|
5
|
+
Project-URL: Homepage, https://adanos.com
|
|
6
|
+
Project-URL: API_Docs, https://api.adanos.com/docs
|
|
7
7
|
Project-URL: Documentation, https://github.com/adanos-software/adanos-cli#readme
|
|
8
8
|
Project-URL: Repository, https://github.com/adanos-software/adanos-cli
|
|
9
9
|
Project-URL: Issues, https://github.com/adanos-software/adanos-cli/issues
|
|
@@ -28,14 +28,15 @@ Description-Content-Type: text/markdown
|
|
|
28
28
|
|
|
29
29
|
[](https://pypi.org/project/adanos-cli/)
|
|
30
30
|
|
|
31
|
-
`adanos-cli` is the command-line client for the [Adanos Market Sentiment API](https://api.adanos.
|
|
31
|
+
`adanos-cli` is the command-line client for the [Adanos Market Sentiment API](https://api.adanos.com/docs).
|
|
32
32
|
|
|
33
33
|
It is built for three use cases:
|
|
34
34
|
- traders who want fast stock and crypto sentiment reports
|
|
35
35
|
- analysts who want repeatable CLI workflows
|
|
36
36
|
- agents and automation that need stable JSON output
|
|
37
37
|
|
|
38
|
-
The CLI is versioned independently from the API backend. It
|
|
38
|
+
The CLI is versioned independently from the API backend. It supports API 1.54.0 at `https://api.adanos.com/docs` and uses the published Python SDK under the hood.
|
|
39
|
+
The default API host is `https://api.adanos.com`. Explicit `.org` or custom base URLs in saved settings, `ADANOS_BASE_URL`, or `--base-url` still take precedence.
|
|
39
40
|
|
|
40
41
|
## Install
|
|
41
42
|
|
|
@@ -257,6 +258,7 @@ adanos endpoint call reddit-stocks.market-sentiment --from 2026-05-01 --to 2026-
|
|
|
257
258
|
adanos endpoint call reddit-stocks.stock.mentions --ticker TSLA --from 2026-05-01 --to 2026-05-07 --limit 10 --offset 10 --include-inherited
|
|
258
259
|
adanos endpoint call x-stocks.stock.explain --ticker TSLA
|
|
259
260
|
adanos endpoint call sentiment.analyze --text "TSLA looks like a short squeeze setup"
|
|
261
|
+
adanos endpoint call sentiment.analyze --text "Apple beats estimates while Tesla falls" --target Apple
|
|
260
262
|
```
|
|
261
263
|
|
|
262
264
|
Polymarket endpoint output includes both `market_count` for selected-window breadth and `current_market_count` for live-only active-market breadth.
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/adanos-cli/)
|
|
4
4
|
|
|
5
|
-
`adanos-cli` is the command-line client for the [Adanos Market Sentiment API](https://api.adanos.
|
|
5
|
+
`adanos-cli` is the command-line client for the [Adanos Market Sentiment API](https://api.adanos.com/docs).
|
|
6
6
|
|
|
7
7
|
It is built for three use cases:
|
|
8
8
|
- traders who want fast stock and crypto sentiment reports
|
|
9
9
|
- analysts who want repeatable CLI workflows
|
|
10
10
|
- agents and automation that need stable JSON output
|
|
11
11
|
|
|
12
|
-
The CLI is versioned independently from the API backend. It
|
|
12
|
+
The CLI is versioned independently from the API backend. It supports API 1.54.0 at `https://api.adanos.com/docs` and uses the published Python SDK under the hood.
|
|
13
|
+
The default API host is `https://api.adanos.com`. Explicit `.org` or custom base URLs in saved settings, `ADANOS_BASE_URL`, or `--base-url` still take precedence.
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
@@ -231,6 +232,7 @@ adanos endpoint call reddit-stocks.market-sentiment --from 2026-05-01 --to 2026-
|
|
|
231
232
|
adanos endpoint call reddit-stocks.stock.mentions --ticker TSLA --from 2026-05-01 --to 2026-05-07 --limit 10 --offset 10 --include-inherited
|
|
232
233
|
adanos endpoint call x-stocks.stock.explain --ticker TSLA
|
|
233
234
|
adanos endpoint call sentiment.analyze --text "TSLA looks like a short squeeze setup"
|
|
235
|
+
adanos endpoint call sentiment.analyze --text "Apple beats estimates while Tesla falls" --target Apple
|
|
234
236
|
```
|
|
235
237
|
|
|
236
238
|
Polymarket endpoint output includes both `market_count` for selected-window breadth and `current_market_count` for live-only active-market breadth.
|
|
@@ -25,8 +25,8 @@ dev = [
|
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.urls]
|
|
28
|
-
Homepage = "https://adanos.
|
|
29
|
-
API_Docs = "https://api.adanos.
|
|
28
|
+
Homepage = "https://adanos.com"
|
|
29
|
+
API_Docs = "https://api.adanos.com/docs"
|
|
30
30
|
Documentation = "https://github.com/adanos-software/adanos-cli#readme"
|
|
31
31
|
Repository = "https://github.com/adanos-software/adanos-cli"
|
|
32
32
|
Issues = "https://github.com/adanos-software/adanos-cli/issues"
|
|
@@ -425,6 +425,9 @@ def _root_health(client: Any, args: Namespace) -> Any:
|
|
|
425
425
|
|
|
426
426
|
def _sentiment_analyze(client: Any, args: Namespace) -> Any:
|
|
427
427
|
text = _require_str(args, "text")
|
|
428
|
+
target = getattr(args, "target", None)
|
|
429
|
+
if target is not None:
|
|
430
|
+
return _raw_post_json(client, "/sentiment/v1/analyze", {"text": text, "target": target})
|
|
428
431
|
sentiment = getattr(client, "sentiment", None)
|
|
429
432
|
analyze = getattr(sentiment, "analyze", None)
|
|
430
433
|
if callable(analyze):
|
|
@@ -439,7 +442,7 @@ ENDPOINTS: dict[str, EndpointSpec] = {
|
|
|
439
442
|
"/sentiment/v1/analyze",
|
|
440
443
|
"Analyze one finance or trading text",
|
|
441
444
|
("text",),
|
|
442
|
-
|
|
445
|
+
("target",),
|
|
443
446
|
_sentiment_analyze,
|
|
444
447
|
),
|
|
445
448
|
"root.health": EndpointSpec(
|
|
@@ -642,6 +645,8 @@ def invoke_endpoint(client: Any, endpoint_id: str, args: Namespace) -> Any:
|
|
|
642
645
|
raise CliUsageError(f"Unknown endpoint id: {endpoint_id}. Valid ids: {valid}")
|
|
643
646
|
if getattr(args, "source", None) and "source" not in spec.required_params and "source" not in spec.optional_params:
|
|
644
647
|
raise CliUsageError(f"Endpoint {endpoint_id} does not support --source")
|
|
648
|
+
if getattr(args, "target", None) is not None and "target" not in spec.optional_params:
|
|
649
|
+
raise CliUsageError(f"Endpoint {endpoint_id} does not support --target")
|
|
645
650
|
return spec.invoke(client, args)
|
|
646
651
|
|
|
647
652
|
|
|
@@ -69,9 +69,9 @@ from .watchlists import (
|
|
|
69
69
|
upsert_watchlist_symbols,
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
SUPPORT_CONTACT_EMAIL = "support@adanos.
|
|
72
|
+
SUPPORT_CONTACT_EMAIL = "support@adanos.com"
|
|
73
73
|
PAID_ACCOUNT_TYPES = {"hobby", "professional"}
|
|
74
|
-
DEFAULT_RECOVERY_REQUEST_URL = "https://adanos.
|
|
74
|
+
DEFAULT_RECOVERY_REQUEST_URL = "https://adanos.com/api/recover"
|
|
75
75
|
ROOT_COMMANDS = (
|
|
76
76
|
"onboard",
|
|
77
77
|
"login",
|
|
@@ -219,7 +219,7 @@ def _style(text: str, *, fg: str | None = None, bold: bool = False, dim: bool =
|
|
|
219
219
|
|
|
220
220
|
def _print_welcome_screen(base_url: str, *, has_api_key: bool) -> None:
|
|
221
221
|
print(_style("ADANOS CLI", fg="cyan", bold=True))
|
|
222
|
-
print(_style("Stocks + Crypto sentiment for api.adanos.
|
|
222
|
+
print(_style("Stocks + Crypto sentiment for api.adanos.com", dim=True))
|
|
223
223
|
print("")
|
|
224
224
|
key_label = _style("configured", fg="green", bold=True) if has_api_key else _style("not configured", fg="red", bold=True)
|
|
225
225
|
print(f"API base URL: {_style(base_url, fg='blue')}")
|
|
@@ -2010,7 +2010,7 @@ def _run_onboard_recover(args: Namespace, *, json_mode: bool) -> int:
|
|
|
2010
2010
|
json_mode=json_mode,
|
|
2011
2011
|
code="onboard_recover_failed",
|
|
2012
2012
|
message=message if message else "Recovery request failed",
|
|
2013
|
-
hint="Retry later or open https://adanos.
|
|
2013
|
+
hint="Retry later or open https://adanos.com/key to use the hosted recovery form.",
|
|
2014
2014
|
status_code=status_code,
|
|
2015
2015
|
)
|
|
2016
2016
|
return 1
|
|
@@ -2197,7 +2197,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
2197
2197
|
parser = AdanosArgumentParser(
|
|
2198
2198
|
prog="adanos",
|
|
2199
2199
|
description=(
|
|
2200
|
-
"Comprehensive CLI for api.adanos.
|
|
2200
|
+
"Comprehensive CLI for api.adanos.com. Supports all OpenAPI endpoints for "
|
|
2201
2201
|
"News Stocks, Reddit Stocks, Reddit Crypto, X/Twitter Stocks, and Polymarket Stocks."
|
|
2202
2202
|
),
|
|
2203
2203
|
formatter_class=argparse.RawTextHelpFormatter,
|
|
@@ -2512,6 +2512,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
2512
2512
|
" adanos endpoint list --platform polymarket-stocks --search stock\n"
|
|
2513
2513
|
" adanos endpoint call reddit-stocks.trending --limit 10\n"
|
|
2514
2514
|
" adanos endpoint call polymarket-stocks.stock --ticker TSLA\n"
|
|
2515
|
+
' adanos endpoint call sentiment.analyze --text "Apple beats estimates" --target Apple\n'
|
|
2515
2516
|
),
|
|
2516
2517
|
)
|
|
2517
2518
|
ep_subs = p_endpoint.add_subparsers(dest="endpoint_cmd", required=True)
|
|
@@ -2531,6 +2532,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
2531
2532
|
" adanos endpoint call root.health\n"
|
|
2532
2533
|
" adanos endpoint call reddit-stocks.trending --limit 10\n"
|
|
2533
2534
|
" adanos endpoint call polymarket-stocks.stock --ticker TSLA\n"
|
|
2535
|
+
' adanos endpoint call sentiment.analyze --text "Apple beats estimates" --target Apple\n'
|
|
2534
2536
|
),
|
|
2535
2537
|
)
|
|
2536
2538
|
p_ep_call.add_argument("endpoint_id", choices=sorted(ENDPOINTS.keys()))
|
|
@@ -2539,6 +2541,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
2539
2541
|
p_ep_call.add_argument("--q")
|
|
2540
2542
|
p_ep_call.add_argument("--query")
|
|
2541
2543
|
p_ep_call.add_argument("--text")
|
|
2544
|
+
p_ep_call.add_argument("--target", help="Optional company name or ticker for sentiment.analyze")
|
|
2542
2545
|
p_ep_call.add_argument("--tickers", help="Comma-separated tickers")
|
|
2543
2546
|
p_ep_call.add_argument("--symbols", help="Comma-separated symbols")
|
|
2544
2547
|
p_ep_call.add_argument("--assets", help="Generic comma-separated assets (for compare)")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
10
|
+
SRC_ROOT = REPO_ROOT / "src"
|
|
11
|
+
|
|
12
|
+
for path in (REPO_ROOT, SRC_ROOT):
|
|
13
|
+
if str(path) not in sys.path:
|
|
14
|
+
sys.path.insert(0, str(path))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture
|
|
18
|
+
def isolated_config(tmp_path: Path, monkeypatch) -> None:
|
|
19
|
+
import adanos_cli.config as cli_config
|
|
20
|
+
|
|
21
|
+
cfg_dir = tmp_path / ".config" / "adanos-cli"
|
|
22
|
+
monkeypatch.setattr(cli_config, "CONFIG_DIR", cfg_dir)
|
|
23
|
+
monkeypatch.setattr(cli_config, "CONFIG_PATH", cfg_dir / "config.json")
|
|
24
|
+
monkeypatch.setattr(cli_config, "CREDENTIALS_PATH", cfg_dir / "credentials.json")
|
|
25
|
+
monkeypatch.delenv("ADANOS_BASE_URL", raising=False)
|
|
26
|
+
monkeypatch.delenv("ADANOS_API_KEY", raising=False)
|
|
27
|
+
monkeypatch.setenv("ADANOS_CLI_DISABLE_UPDATE_CHECK", "1")
|
|
@@ -14,8 +14,8 @@ import adanos_cli.main as cli_main
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@respx.mock
|
|
17
|
-
def test_account_status_free_plan_json(capsys) -> None:
|
|
18
|
-
respx.get("https://api.adanos.
|
|
17
|
+
def test_account_status_free_plan_json(isolated_config, capsys) -> None:
|
|
18
|
+
respx.get("https://api.adanos.com/reddit/stocks/v1/stats").mock(
|
|
19
19
|
return_value=httpx.Response(
|
|
20
20
|
200,
|
|
21
21
|
json={"total_mentions": 123},
|
|
@@ -45,8 +45,8 @@ def test_account_status_free_plan_json(capsys) -> None:
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
@respx.mock
|
|
48
|
-
def test_account_status_success_text_does_not_print_stats_note(capsys) -> None:
|
|
49
|
-
respx.get("https://api.adanos.
|
|
48
|
+
def test_account_status_success_text_does_not_print_stats_note(isolated_config, capsys) -> None:
|
|
49
|
+
respx.get("https://api.adanos.com/reddit/stocks/v1/stats").mock(
|
|
50
50
|
return_value=httpx.Response(
|
|
51
51
|
200,
|
|
52
52
|
json={"total_mentions": 420970, "unique_tickers": 5770},
|
|
@@ -66,8 +66,8 @@ def test_account_status_success_text_does_not_print_stats_note(capsys) -> None:
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
@respx.mock
|
|
69
|
-
def test_account_status_professional_plan_json(capsys) -> None:
|
|
70
|
-
respx.get("https://api.adanos.
|
|
69
|
+
def test_account_status_professional_plan_json(isolated_config, capsys) -> None:
|
|
70
|
+
respx.get("https://api.adanos.com/reddit/stocks/v1/stats").mock(
|
|
71
71
|
return_value=httpx.Response(
|
|
72
72
|
200,
|
|
73
73
|
json={"total_mentions": 987},
|
|
@@ -96,8 +96,8 @@ def test_account_status_professional_plan_json(capsys) -> None:
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
@respx.mock
|
|
99
|
-
def test_account_status_falls_back_to_non_monthly_reset_header(capsys) -> None:
|
|
100
|
-
respx.get("https://api.adanos.
|
|
99
|
+
def test_account_status_falls_back_to_non_monthly_reset_header(isolated_config, capsys) -> None:
|
|
100
|
+
respx.get("https://api.adanos.com/reddit/stocks/v1/stats").mock(
|
|
101
101
|
return_value=httpx.Response(
|
|
102
102
|
200,
|
|
103
103
|
json={"total_mentions": 123},
|
|
@@ -121,8 +121,8 @@ def test_account_status_falls_back_to_non_monthly_reset_header(capsys) -> None:
|
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
@respx.mock
|
|
124
|
-
def test_account_status_out_of_credits_text(capsys) -> None:
|
|
125
|
-
respx.get("https://api.adanos.
|
|
124
|
+
def test_account_status_out_of_credits_text(isolated_config, capsys) -> None:
|
|
125
|
+
respx.get("https://api.adanos.com/reddit/stocks/v1/stats").mock(
|
|
126
126
|
return_value=httpx.Response(
|
|
127
127
|
429,
|
|
128
128
|
json={
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
import pytest
|
|
5
|
+
import respx
|
|
6
|
+
|
|
7
|
+
import adanos_cli.config as cli_config
|
|
8
|
+
import adanos_cli.main as cli_main
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.parametrize(
|
|
12
|
+
("base_url", "target", "status"),
|
|
13
|
+
[
|
|
14
|
+
(None, None, 200),
|
|
15
|
+
(None, "Apple", 200),
|
|
16
|
+
("https://api.adanos.org", "Apple", 200),
|
|
17
|
+
(None, "Apple", 422),
|
|
18
|
+
],
|
|
19
|
+
)
|
|
20
|
+
@respx.mock
|
|
21
|
+
def test_sentiment_request_through_cli(base_url, target, status, tmp_path, monkeypatch, capsys):
|
|
22
|
+
monkeypatch.setattr(cli_config, "CONFIG_DIR", tmp_path)
|
|
23
|
+
monkeypatch.setattr(cli_config, "CONFIG_PATH", tmp_path / "config.json")
|
|
24
|
+
monkeypatch.setattr(cli_config, "CREDENTIALS_PATH", tmp_path / "credentials.json")
|
|
25
|
+
monkeypatch.setenv("ADANOS_API_KEY", "adanos_key_test")
|
|
26
|
+
monkeypatch.delenv("ADANOS_BASE_URL", raising=False)
|
|
27
|
+
response = (
|
|
28
|
+
{"sentiment_label": "positive", "components": {"engine_version": "5.5", "model_score": None}}
|
|
29
|
+
if status == 200
|
|
30
|
+
else {"detail": "Invalid target"}
|
|
31
|
+
)
|
|
32
|
+
route = respx.post(f"{base_url or 'https://api.adanos.com'}/sentiment/v1/analyze").mock(
|
|
33
|
+
return_value=httpx.Response(status, json=response)
|
|
34
|
+
)
|
|
35
|
+
argv = ["--json", "endpoint", "call", "sentiment.analyze", "--text", "Apple beats estimates"]
|
|
36
|
+
if base_url is not None:
|
|
37
|
+
argv += ["--base-url", base_url]
|
|
38
|
+
if target is not None:
|
|
39
|
+
argv += ["--target", target]
|
|
40
|
+
|
|
41
|
+
result = cli_main.main(argv)
|
|
42
|
+
captured = capsys.readouterr()
|
|
43
|
+
|
|
44
|
+
assert route.call_count == 1
|
|
45
|
+
request = route.calls[0].request
|
|
46
|
+
body = {"text": "Apple beats estimates"}
|
|
47
|
+
if target is not None:
|
|
48
|
+
body["target"] = target
|
|
49
|
+
assert json.loads(request.content) == body
|
|
50
|
+
assert request.headers["X-API-Key"] == "adanos_key_test"
|
|
51
|
+
if status == 200:
|
|
52
|
+
assert result == 0
|
|
53
|
+
assert json.loads(captured.out)["data"] == response
|
|
54
|
+
else:
|
|
55
|
+
assert result == 1
|
|
56
|
+
assert json.loads(captured.err)["error"]["status_code"] == 422
|
|
57
|
+
(tmp_path / "request-artifact.json").write_text(
|
|
58
|
+
json.dumps({"argv": argv, "request": body, "status": status, "exit_code": result}, indent=2)
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_target_is_rejected_for_other_endpoints(tmp_path, monkeypatch, capsys):
|
|
63
|
+
monkeypatch.setattr(cli_config, "CONFIG_DIR", tmp_path)
|
|
64
|
+
monkeypatch.setattr(cli_config, "CONFIG_PATH", tmp_path / "config.json")
|
|
65
|
+
monkeypatch.setattr(cli_config, "CREDENTIALS_PATH", tmp_path / "credentials.json")
|
|
66
|
+
argv = ["--json", "endpoint", "call", "root.health", "--target", "Apple"]
|
|
67
|
+
result = cli_main.main(argv)
|
|
68
|
+
captured = capsys.readouterr()
|
|
69
|
+
assert result == 2
|
|
70
|
+
assert json.loads(captured.err)["error"]["message"] == "Endpoint root.health does not support --target"
|
|
71
|
+
(tmp_path / "request-artifact.json").write_text(json.dumps({"argv": argv, "exit_code": result}, indent=2))
|
|
@@ -88,7 +88,7 @@ def test_render_formula_includes_install_and_test_blocks() -> None:
|
|
|
88
88
|
)
|
|
89
89
|
|
|
90
90
|
assert "class AdanosCli < Formula" in formula
|
|
91
|
-
assert 'homepage "https://adanos.
|
|
91
|
+
assert 'homepage "https://adanos.com"' in formula
|
|
92
92
|
assert "def install" in formula
|
|
93
93
|
assert 'assert_match "adanos", shell_output("#{bin}/adanos --help")' in formula
|
|
94
94
|
|
|
@@ -99,7 +99,7 @@ def test_sentiment_analyze_endpoint_spec_is_complete() -> None:
|
|
|
99
99
|
spec = ENDPOINTS["sentiment.analyze"]
|
|
100
100
|
assert spec.path == "/sentiment/v1/analyze"
|
|
101
101
|
assert spec.required_params == ("text",)
|
|
102
|
-
assert spec.optional_params ==
|
|
102
|
+
assert spec.optional_params == ("target",)
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
def test_news_endpoint_specs_are_complete() -> None:
|
|
@@ -138,8 +138,8 @@ def test_onboard_wizard_accepts_existing_key(tmp_path, monkeypatch) -> None:
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
@respx.mock
|
|
141
|
-
def test_onboard_register_accepts_email_verification_flow(capsys) -> None:
|
|
142
|
-
respx.post("https://api.adanos.
|
|
141
|
+
def test_onboard_register_accepts_email_verification_flow(isolated_config, capsys) -> None:
|
|
142
|
+
respx.post("https://api.adanos.com/auth/v1/register").mock(
|
|
143
143
|
return_value=httpx.Response(
|
|
144
144
|
202,
|
|
145
145
|
json={
|
|
@@ -172,7 +172,7 @@ def test_onboard_register_accepts_email_verification_flow(capsys) -> None:
|
|
|
172
172
|
|
|
173
173
|
@respx.mock
|
|
174
174
|
def test_onboard_recover_requests_email_confirmation(capsys) -> None:
|
|
175
|
-
respx.post("https://adanos.
|
|
175
|
+
respx.post("https://adanos.com/api/recover").mock(
|
|
176
176
|
return_value=httpx.Response(
|
|
177
177
|
200,
|
|
178
178
|
json={
|
|
@@ -192,7 +192,7 @@ def test_onboard_recover_requests_email_confirmation(capsys) -> None:
|
|
|
192
192
|
|
|
193
193
|
@respx.mock
|
|
194
194
|
def test_onboard_recover_json_outputs_structured_response(capsys) -> None:
|
|
195
|
-
respx.post("https://adanos.
|
|
195
|
+
respx.post("https://adanos.com/api/recover").mock(
|
|
196
196
|
return_value=httpx.Response(
|
|
197
197
|
200,
|
|
198
198
|
json={
|
|
@@ -223,7 +223,7 @@ def test_onboard_redeem_save_writes_config(tmp_path, monkeypatch) -> None:
|
|
|
223
223
|
monkeypatch.setattr(cli_config, "CONFIG_PATH", cfg_path)
|
|
224
224
|
monkeypatch.setattr(cli_config, "CREDENTIALS_PATH", credentials_path)
|
|
225
225
|
|
|
226
|
-
respx.post("https://api.adanos.
|
|
226
|
+
respx.post("https://api.adanos.com/auth/v1/key/redeem", json={"token": token}).mock(
|
|
227
227
|
return_value=httpx.Response(
|
|
228
228
|
200,
|
|
229
229
|
json={
|
|
@@ -242,7 +242,7 @@ def test_onboard_redeem_save_writes_config(tmp_path, monkeypatch) -> None:
|
|
|
242
242
|
assert credentials_path.exists()
|
|
243
243
|
|
|
244
244
|
data = json.loads(cfg_path.read_text(encoding="utf-8"))
|
|
245
|
-
assert data["base_url"] == "https://api.adanos.
|
|
245
|
+
assert data["base_url"] == "https://api.adanos.com"
|
|
246
246
|
credentials = json.loads(credentials_path.read_text(encoding="utf-8"))
|
|
247
247
|
assert credentials["active_profile"] == "default"
|
|
248
248
|
assert credentials["profiles"]["default"]["api_key"] == "adanos_key_abcdefghijklmnopqrstuvwxyz123456"
|
|
@@ -255,7 +255,7 @@ def test_onboard_redeem_accepts_token_stdin(tmp_path, monkeypatch, capsys) -> No
|
|
|
255
255
|
returned_data = {"success": True, "plan": "free"}
|
|
256
256
|
returned_data["api_" + "key"] = "adanos_key_fromstdinabcdefghijklmnopqrstuvwxyz"
|
|
257
257
|
monkeypatch.setattr(sys, "stdin", io.StringIO(delivery_value + "\n"))
|
|
258
|
-
respx.post("https://api.adanos.
|
|
258
|
+
respx.post("https://api.adanos.com/auth/v1/key/redeem", json={"to" + "ken": delivery_value}).mock(
|
|
259
259
|
return_value=httpx.Response(
|
|
260
260
|
200,
|
|
261
261
|
json=returned_data,
|
|
@@ -285,7 +285,7 @@ def test_onboard_redeem_rejects_token_stdin_from_tty(monkeypatch, capsys) -> Non
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
def test_onboard_redeem_network_error_is_structured(monkeypatch, capsys) -> None:
|
|
288
|
-
request = httpx.Request("POST", "https://api.adanos.
|
|
288
|
+
request = httpx.Request("POST", "https://api.adanos.com/auth/v1/key/redeem")
|
|
289
289
|
|
|
290
290
|
def fail_request(*_args, **_kwargs):
|
|
291
291
|
raise httpx.ConnectError("connection refused", request=request)
|
|
@@ -300,7 +300,7 @@ def test_onboard_redeem_network_error_is_structured(monkeypatch, capsys) -> None
|
|
|
300
300
|
assert "Traceback" not in captured.err
|
|
301
301
|
payload = json.loads(captured.err)
|
|
302
302
|
assert payload["error"]["code"] == "network_error"
|
|
303
|
-
assert payload["error"]["message"] == "Cannot reach API base URL https://api.adanos.
|
|
303
|
+
assert payload["error"]["message"] == "Cannot reach API base URL https://api.adanos.com."
|
|
304
304
|
|
|
305
305
|
|
|
306
306
|
def test_onboard_redeem_text_requires_safe_destination_before_request(monkeypatch, capsys) -> None:
|
|
@@ -357,7 +357,7 @@ def test_onboard_redeem_quiet_does_not_consume_unsaved_token(monkeypatch, capsys
|
|
|
357
357
|
def test_onboard_wizard_stops_after_register_until_email_arrives(tmp_path, monkeypatch, capsys) -> None:
|
|
358
358
|
_isolate_config(tmp_path, monkeypatch)
|
|
359
359
|
monkeypatch.setattr(cli_main, "is_interactive", lambda: True)
|
|
360
|
-
respx.post("https://api.adanos.
|
|
360
|
+
respx.post("https://api.adanos.com/auth/v1/register").mock(
|
|
361
361
|
return_value=httpx.Response(
|
|
362
362
|
202,
|
|
363
363
|
json={
|
|
@@ -204,7 +204,7 @@ def test_shell_header_uses_clean_wordmark_without_inline_image(monkeypatch, caps
|
|
|
204
204
|
cli_main._print_shell_header("https://api.adanos.org", has_api_key=False)
|
|
205
205
|
out = capsys.readouterr().out
|
|
206
206
|
|
|
207
|
-
assert out.startswith("ADANOS Market Sentiment CLI v1.
|
|
207
|
+
assert out.startswith("ADANOS Market Sentiment CLI v1.34.0\n")
|
|
208
208
|
assert "account: not configured | api: https://api.adanos.org" in out
|
|
209
209
|
assert "cwd:" in out
|
|
210
210
|
assert "█" not in out
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
8
|
-
SRC_ROOT = REPO_ROOT / "src"
|
|
9
|
-
|
|
10
|
-
for path in (REPO_ROOT, SRC_ROOT):
|
|
11
|
-
if str(path) not in sys.path:
|
|
12
|
-
sys.path.insert(0, str(path))
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|