adanos-cli 1.32.0__tar.gz → 1.33.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.32.0 → adanos_cli-1.33.0}/CHANGELOG.md +27 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/PKG-INFO +63 -9
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/README.md +62 -8
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/scripts/cli_audit.py +37 -8
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/__init__.py +1 -1
- adanos_cli-1.33.0/src/adanos_cli/activity_log.py +190 -0
- adanos_cli-1.33.0/src/adanos_cli/assets/__init__.py +1 -0
- adanos_cli-1.33.0/src/adanos_cli/assets/adanos-mark-color.svg +16 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/main.py +618 -117
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/nlp.py +22 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/summaries.py +31 -14
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_activity_log.py +111 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_agent_contract.py +156 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_auth.py +20 -4
- adanos_cli-1.33.0/tests/test_cli_audit.py +12 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_diagnostics.py +8 -1
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_onboarding.py +109 -3
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_power_features.py +256 -1
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_shell.py +136 -3
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_watchlists.py +2 -2
- adanos_cli-1.32.0/src/adanos_cli/activity_log.py +0 -103
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/.github/workflows/ci.yml +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/.github/workflows/cli-binaries.yml +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/.github/workflows/publish-pypi.yml +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/.gitignore +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/LICENSE +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/install.ps1 +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/install.sh +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/pyproject.toml +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/scripts/build_cli_binary.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/scripts/generate_homebrew_formula.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/scripts/pyinstaller_entrypoint.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/__main__.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/commands/__init__.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/commands/auth.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/commands/config.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/commands/extensions.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/commands/secrets.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/config.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/endpoints.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/shell_history.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/tty.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/update_notifier.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/utils.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/src/adanos_cli/watchlists.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/__init__.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/conftest.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_account.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_config_runtime.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_distribution.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_endpoint_coverage.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_extensions.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_logs.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_tty.py +0 -0
- {adanos_cli-1.32.0 → adanos_cli-1.33.0}/tests/test_update_notifier.py +0 -0
|
@@ -5,6 +5,33 @@ 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
|
+
## [1.33.0] - 2026-08-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Added a global, order-independent `--json` flag and structured JSON parser errors.
|
|
12
|
+
- Added `--token-stdin` for secure one-time onboarding token input.
|
|
13
|
+
- Added confirmation gates and `--force` for local profile, config, and watchlist deletion.
|
|
14
|
+
- Added direct multi-asset comparisons such as `adanos compare NVDA TSLA AAPL`; natural-language comparisons remain available through `adanos ask`.
|
|
15
|
+
- Added a fixed shell prompt with monthly API requests remaining and an explicit `/quota` refresh command.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Human market output now labels source activity precisely as mentions, trades, or tracked activity instead of the ambiguous `volume` label.
|
|
19
|
+
- The interactive shell now uses a clean wordmark by default and renders the bundled official Adanos mark in compatible iTerm2 sessions.
|
|
20
|
+
- Trader commands now lead with aggregate market behavior: `trending` and `search` no longer require a platform, `stats` defaults to all platforms, and `--platform` remains an optional source-level override.
|
|
21
|
+
- `scan`, watchlist symbols, briefing focus lists, and `compare` now accept natural space-separated asset lists while retaining the legacy flag/comma forms.
|
|
22
|
+
- Search summaries now show representative matching symbols and names instead of counts alone.
|
|
23
|
+
- Consensus output now describes its confidence score as data confidence.
|
|
24
|
+
- Explicit uppercase tickers in natural-language comparisons bypass unnecessary search calls before the four source comparisons.
|
|
25
|
+
- `--version` remains a conventional one-line response unless JSON is explicitly requested.
|
|
26
|
+
- Help and authentication examples now lead with hidden-prompt, stdin, or file-based secret input.
|
|
27
|
+
- The repository CLI audit now tests the requested binary and covers global JSON placement, structured parser errors, nested typo hints, and conventional version output.
|
|
28
|
+
- Text-mode token redemption now requires `--save` before consuming the one-time token; unsaved machine workflows must explicitly request JSON.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Prevented onboarding identity, delivery tokens, natural-language queries, and help invocations from leaking into the local activity log.
|
|
32
|
+
- Converted onboarding transport failures into concise structured errors instead of tracebacks.
|
|
33
|
+
- Fixed nested typo suggestions so `adanos auth curent` suggests `adanos auth current`.
|
|
34
|
+
|
|
8
35
|
## [1.32.0] - 2026-08-09
|
|
9
36
|
|
|
10
37
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adanos-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.33.0
|
|
4
4
|
Summary: CLI for the Adanos Market Sentiment API
|
|
5
5
|
Project-URL: Homepage, https://adanos.org
|
|
6
6
|
Project-URL: API_Docs, https://api.adanos.org/docs
|
|
@@ -89,7 +89,7 @@ python3 -m pip install -e ".[dev]"
|
|
|
89
89
|
If you already have an API key:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
adanos login
|
|
92
|
+
adanos login # paste the key at the hidden prompt
|
|
93
93
|
adanos whoami
|
|
94
94
|
adanos doctor
|
|
95
95
|
```
|
|
@@ -97,9 +97,12 @@ adanos doctor
|
|
|
97
97
|
First market checks:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
+
adanos stock TSLA
|
|
101
|
+
adanos compare NVDA TSLA AAPL
|
|
102
|
+
adanos trending stocks --limit 5
|
|
100
103
|
adanos consensus TSLA
|
|
101
104
|
adanos explain TSLA --profile investor
|
|
102
|
-
adanos scan
|
|
105
|
+
adanos scan stocks --style daytrader --top 10
|
|
103
106
|
```
|
|
104
107
|
|
|
105
108
|
Crypto:
|
|
@@ -123,6 +126,10 @@ Explicit interactive shell:
|
|
|
123
126
|
adanos shell
|
|
124
127
|
```
|
|
125
128
|
|
|
129
|
+
The shell prompt shows the latest monthly API request balance. Run `/quota` to
|
|
130
|
+
refresh it on demand; normal commands do not spend an extra request on quota
|
|
131
|
+
lookups.
|
|
132
|
+
|
|
126
133
|
One-shot command mode:
|
|
127
134
|
|
|
128
135
|
```bash
|
|
@@ -134,8 +141,7 @@ adanos stock NVDA
|
|
|
134
141
|
Persist a key locally:
|
|
135
142
|
|
|
136
143
|
```bash
|
|
137
|
-
adanos login
|
|
138
|
-
printf '%s\n' "$ADANOS_API_KEY" | adanos login --api-key-stdin
|
|
144
|
+
adanos login # interactive hidden prompt
|
|
139
145
|
adanos login --api-key-file ~/.config/adanos-cli/key.txt
|
|
140
146
|
```
|
|
141
147
|
|
|
@@ -150,14 +156,14 @@ Start a new signup from the CLI:
|
|
|
150
156
|
```bash
|
|
151
157
|
adanos onboard register --name "Jane Doe" --email "jane@example.com" --purpose "Trading research"
|
|
152
158
|
# then redeem the one-time token from the verification email
|
|
153
|
-
adanos onboard redeem --
|
|
159
|
+
adanos onboard redeem --save # paste the one-time code at the hidden prompt
|
|
154
160
|
```
|
|
155
161
|
|
|
156
162
|
Use profiles:
|
|
157
163
|
|
|
158
164
|
```bash
|
|
159
|
-
adanos auth login --
|
|
160
|
-
adanos auth login --
|
|
165
|
+
adanos auth login --profile prod
|
|
166
|
+
adanos auth login --profile staging
|
|
161
167
|
adanos auth switch prod
|
|
162
168
|
adanos auth current --json
|
|
163
169
|
```
|
|
@@ -189,6 +195,34 @@ Cross-platform consensus:
|
|
|
189
195
|
adanos consensus TSLA
|
|
190
196
|
```
|
|
191
197
|
|
|
198
|
+
Compare stocks across News, Reddit, X/Twitter, and Polymarket:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
adanos compare NVDA TSLA AAPL
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Common crypto symbols are detected automatically:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
adanos compare BTC ETH
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Search and trending use all relevant sources by default. Add `--platform` only when you want one source:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
adanos search Tesla
|
|
214
|
+
adanos trending stocks --limit 5
|
|
215
|
+
adanos trending crypto --limit 10
|
|
216
|
+
adanos search Tesla --platform news-stocks
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Sentiment screener:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
adanos scan stocks --style daytrader --top 10
|
|
223
|
+
adanos scan crypto --min-buzz 60 --min-volume 50
|
|
224
|
+
```
|
|
225
|
+
|
|
192
226
|
Narrative explanation:
|
|
193
227
|
|
|
194
228
|
```bash
|
|
@@ -198,11 +232,19 @@ adanos explain TSLA --profile investor
|
|
|
198
232
|
Watchlists:
|
|
199
233
|
|
|
200
234
|
```bash
|
|
201
|
-
adanos watchlist add core --asset stocks --symbols TSLA
|
|
235
|
+
adanos watchlist add core --asset stocks --symbols TSLA NVDA AAPL
|
|
202
236
|
adanos watchlist report core --asset stocks
|
|
203
237
|
adanos watch core --kind watchlist --asset stocks --refresh 60 --iterations 1
|
|
204
238
|
```
|
|
205
239
|
|
|
240
|
+
Destructive local operations prompt in an interactive terminal and require `--force` in scripts or JSON mode:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
adanos auth logout --profile staging --force
|
|
244
|
+
adanos watchlist delete core --force
|
|
245
|
+
adanos config clear --force
|
|
246
|
+
```
|
|
247
|
+
|
|
206
248
|
Raw endpoint access:
|
|
207
249
|
|
|
208
250
|
```bash
|
|
@@ -281,6 +323,18 @@ The repo also generates a Homebrew formula artifact for each tagged binary relea
|
|
|
281
323
|
|
|
282
324
|
PyPI publishing also happens from this repo, not from the API monorepo.
|
|
283
325
|
|
|
326
|
+
## Uninstall
|
|
327
|
+
|
|
328
|
+
Use the matching installer:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
pipx uninstall adanos-cli
|
|
332
|
+
brew uninstall adanos-cli
|
|
333
|
+
python3 -m pip uninstall adanos-cli
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
For the standalone installer, remove `~/.local/bin/adanos`. Local profiles and watchlists remain under `${XDG_CONFIG_HOME:-~/.config}/adanos-cli` until you explicitly remove them.
|
|
337
|
+
|
|
284
338
|
## Development
|
|
285
339
|
|
|
286
340
|
Install the repo in editable mode:
|
|
@@ -63,7 +63,7 @@ python3 -m pip install -e ".[dev]"
|
|
|
63
63
|
If you already have an API key:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
adanos login
|
|
66
|
+
adanos login # paste the key at the hidden prompt
|
|
67
67
|
adanos whoami
|
|
68
68
|
adanos doctor
|
|
69
69
|
```
|
|
@@ -71,9 +71,12 @@ adanos doctor
|
|
|
71
71
|
First market checks:
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
+
adanos stock TSLA
|
|
75
|
+
adanos compare NVDA TSLA AAPL
|
|
76
|
+
adanos trending stocks --limit 5
|
|
74
77
|
adanos consensus TSLA
|
|
75
78
|
adanos explain TSLA --profile investor
|
|
76
|
-
adanos scan
|
|
79
|
+
adanos scan stocks --style daytrader --top 10
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
Crypto:
|
|
@@ -97,6 +100,10 @@ Explicit interactive shell:
|
|
|
97
100
|
adanos shell
|
|
98
101
|
```
|
|
99
102
|
|
|
103
|
+
The shell prompt shows the latest monthly API request balance. Run `/quota` to
|
|
104
|
+
refresh it on demand; normal commands do not spend an extra request on quota
|
|
105
|
+
lookups.
|
|
106
|
+
|
|
100
107
|
One-shot command mode:
|
|
101
108
|
|
|
102
109
|
```bash
|
|
@@ -108,8 +115,7 @@ adanos stock NVDA
|
|
|
108
115
|
Persist a key locally:
|
|
109
116
|
|
|
110
117
|
```bash
|
|
111
|
-
adanos login
|
|
112
|
-
printf '%s\n' "$ADANOS_API_KEY" | adanos login --api-key-stdin
|
|
118
|
+
adanos login # interactive hidden prompt
|
|
113
119
|
adanos login --api-key-file ~/.config/adanos-cli/key.txt
|
|
114
120
|
```
|
|
115
121
|
|
|
@@ -124,14 +130,14 @@ Start a new signup from the CLI:
|
|
|
124
130
|
```bash
|
|
125
131
|
adanos onboard register --name "Jane Doe" --email "jane@example.com" --purpose "Trading research"
|
|
126
132
|
# then redeem the one-time token from the verification email
|
|
127
|
-
adanos onboard redeem --
|
|
133
|
+
adanos onboard redeem --save # paste the one-time code at the hidden prompt
|
|
128
134
|
```
|
|
129
135
|
|
|
130
136
|
Use profiles:
|
|
131
137
|
|
|
132
138
|
```bash
|
|
133
|
-
adanos auth login --
|
|
134
|
-
adanos auth login --
|
|
139
|
+
adanos auth login --profile prod
|
|
140
|
+
adanos auth login --profile staging
|
|
135
141
|
adanos auth switch prod
|
|
136
142
|
adanos auth current --json
|
|
137
143
|
```
|
|
@@ -163,6 +169,34 @@ Cross-platform consensus:
|
|
|
163
169
|
adanos consensus TSLA
|
|
164
170
|
```
|
|
165
171
|
|
|
172
|
+
Compare stocks across News, Reddit, X/Twitter, and Polymarket:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
adanos compare NVDA TSLA AAPL
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Common crypto symbols are detected automatically:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
adanos compare BTC ETH
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Search and trending use all relevant sources by default. Add `--platform` only when you want one source:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
adanos search Tesla
|
|
188
|
+
adanos trending stocks --limit 5
|
|
189
|
+
adanos trending crypto --limit 10
|
|
190
|
+
adanos search Tesla --platform news-stocks
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Sentiment screener:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
adanos scan stocks --style daytrader --top 10
|
|
197
|
+
adanos scan crypto --min-buzz 60 --min-volume 50
|
|
198
|
+
```
|
|
199
|
+
|
|
166
200
|
Narrative explanation:
|
|
167
201
|
|
|
168
202
|
```bash
|
|
@@ -172,11 +206,19 @@ adanos explain TSLA --profile investor
|
|
|
172
206
|
Watchlists:
|
|
173
207
|
|
|
174
208
|
```bash
|
|
175
|
-
adanos watchlist add core --asset stocks --symbols TSLA
|
|
209
|
+
adanos watchlist add core --asset stocks --symbols TSLA NVDA AAPL
|
|
176
210
|
adanos watchlist report core --asset stocks
|
|
177
211
|
adanos watch core --kind watchlist --asset stocks --refresh 60 --iterations 1
|
|
178
212
|
```
|
|
179
213
|
|
|
214
|
+
Destructive local operations prompt in an interactive terminal and require `--force` in scripts or JSON mode:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
adanos auth logout --profile staging --force
|
|
218
|
+
adanos watchlist delete core --force
|
|
219
|
+
adanos config clear --force
|
|
220
|
+
```
|
|
221
|
+
|
|
180
222
|
Raw endpoint access:
|
|
181
223
|
|
|
182
224
|
```bash
|
|
@@ -255,6 +297,18 @@ The repo also generates a Homebrew formula artifact for each tagged binary relea
|
|
|
255
297
|
|
|
256
298
|
PyPI publishing also happens from this repo, not from the API monorepo.
|
|
257
299
|
|
|
300
|
+
## Uninstall
|
|
301
|
+
|
|
302
|
+
Use the matching installer:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
pipx uninstall adanos-cli
|
|
306
|
+
brew uninstall adanos-cli
|
|
307
|
+
python3 -m pip uninstall adanos-cli
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For the standalone installer, remove `~/.local/bin/adanos`. Local profiles and watchlists remain under `${XDG_CONFIG_HOME:-~/.config}/adanos-cli` until you explicitly remove them.
|
|
311
|
+
|
|
258
312
|
## Development
|
|
259
313
|
|
|
260
314
|
Install the repo in editable mode:
|
|
@@ -8,7 +8,12 @@ import subprocess
|
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def _command() -> list[str]:
|
|
11
|
+
def _command(argv: list[str] | None = None) -> list[str]:
|
|
12
|
+
requested = list(sys.argv[1:] if argv is None else argv)
|
|
13
|
+
if requested[:1] == ["--"]:
|
|
14
|
+
requested = requested[1:]
|
|
15
|
+
if requested:
|
|
16
|
+
return requested
|
|
12
17
|
adanos = shutil.which("adanos")
|
|
13
18
|
if adanos:
|
|
14
19
|
return [adanos]
|
|
@@ -25,13 +30,18 @@ def _assert_ok(name: str, result: subprocess.CompletedProcess[str]) -> None:
|
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
def main() -> int:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
for name, args in (
|
|
34
|
+
("capabilities --output json", ("--output", "json", "capabilities")),
|
|
35
|
+
("capabilities --json prefix", ("--json", "capabilities")),
|
|
36
|
+
("capabilities --json suffix", ("capabilities", "--json")),
|
|
37
|
+
):
|
|
38
|
+
capabilities = _run(*args)
|
|
39
|
+
_assert_ok(name, capabilities)
|
|
40
|
+
payload = json.loads(capabilities.stdout)
|
|
41
|
+
assert payload["kind"] == "capabilities"
|
|
42
|
+
assert payload["command"] == "capabilities"
|
|
43
|
+
assert "auto" in payload["output_modes"]
|
|
44
|
+
assert "--api-key-stdin" in payload["auth"]["secret_input"]
|
|
35
45
|
|
|
36
46
|
text_capabilities = _run("--output", "text", "capabilities")
|
|
37
47
|
_assert_ok("capabilities text", text_capabilities)
|
|
@@ -48,9 +58,28 @@ def main() -> int:
|
|
|
48
58
|
_assert_ok("trending help", help_result)
|
|
49
59
|
assert "Examples:" in help_result.stdout
|
|
50
60
|
|
|
61
|
+
root_help = _run("--help")
|
|
62
|
+
_assert_ok("root help", root_help)
|
|
63
|
+
assert "--json" in root_help.stdout
|
|
64
|
+
|
|
65
|
+
version = _run("--version")
|
|
66
|
+
_assert_ok("version", version)
|
|
67
|
+
assert len(version.stdout.strip().splitlines()) == 1
|
|
68
|
+
assert version.stdout.startswith("adanos-cli ")
|
|
69
|
+
|
|
51
70
|
unknown = _run("wat")
|
|
52
71
|
assert unknown.returncode == 2
|
|
53
72
|
assert "hint:" in unknown.stderr
|
|
73
|
+
|
|
74
|
+
unknown_json = _run("--json", "not-a-command")
|
|
75
|
+
assert unknown_json.returncode == 2
|
|
76
|
+
assert unknown_json.stdout == ""
|
|
77
|
+
error_payload = json.loads(unknown_json.stderr)
|
|
78
|
+
assert error_payload["error"]["code"] == "usage_error"
|
|
79
|
+
|
|
80
|
+
nested_typo = _run("auth", "curent")
|
|
81
|
+
assert nested_typo.returncode == 2
|
|
82
|
+
assert "adanos auth current --help" in nested_typo.stderr
|
|
54
83
|
return 0
|
|
55
84
|
|
|
56
85
|
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""Local CLI activity logging."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from datetime import datetime, timezone
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from . import config as cli_config
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def activity_log_path() -> Path:
|
|
14
|
+
return cli_config.support_file_path("activity.log")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _utc_now() -> str:
|
|
18
|
+
return datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def sanitize_argv(argv: list[str]) -> list[str]:
|
|
22
|
+
sensitive_value_flags = {
|
|
23
|
+
"--api-key",
|
|
24
|
+
"--api-key-file",
|
|
25
|
+
"--company-name",
|
|
26
|
+
"--email",
|
|
27
|
+
"--name",
|
|
28
|
+
"--output-path",
|
|
29
|
+
"--purpose",
|
|
30
|
+
"--recovery-url",
|
|
31
|
+
"--text",
|
|
32
|
+
"--token",
|
|
33
|
+
}
|
|
34
|
+
ask_value_flags = {"--base-url", "--days", "--from", "--output", "--to"}
|
|
35
|
+
ask_bare_flags = {"--json", "--no-color", "--no-input", "--plain", "--quiet"}
|
|
36
|
+
sanitized: list[str] = []
|
|
37
|
+
redact_next = False
|
|
38
|
+
copy_next_ask_value = False
|
|
39
|
+
in_ask_query = False
|
|
40
|
+
ask_options_ended = False
|
|
41
|
+
ask_query_redacted = False
|
|
42
|
+
redact_later_positional = False
|
|
43
|
+
idx = 0
|
|
44
|
+
while idx < len(argv):
|
|
45
|
+
arg = argv[idx]
|
|
46
|
+
if redact_next:
|
|
47
|
+
if arg.startswith("-"):
|
|
48
|
+
sanitized.append("<redacted>")
|
|
49
|
+
redact_next = False
|
|
50
|
+
redact_later_positional = True
|
|
51
|
+
idx += 1
|
|
52
|
+
continue
|
|
53
|
+
sanitized.append("<redacted>")
|
|
54
|
+
redact_next = False
|
|
55
|
+
idx += 1
|
|
56
|
+
continue
|
|
57
|
+
if redact_later_positional and not arg.startswith("-"):
|
|
58
|
+
sanitized.append("<redacted>")
|
|
59
|
+
idx += 1
|
|
60
|
+
continue
|
|
61
|
+
|
|
62
|
+
flag_name = arg.split("=", 1)[0]
|
|
63
|
+
sensitive_spelling = flag_name in sensitive_value_flags or (
|
|
64
|
+
flag_name.startswith("--")
|
|
65
|
+
and len(flag_name) >= 5
|
|
66
|
+
and any(flag.startswith(flag_name) for flag in sensitive_value_flags)
|
|
67
|
+
)
|
|
68
|
+
if sensitive_spelling and "=" not in arg:
|
|
69
|
+
if in_ask_query:
|
|
70
|
+
copy_next_ask_value = False
|
|
71
|
+
sanitized.append(arg)
|
|
72
|
+
redact_next = True
|
|
73
|
+
idx += 1
|
|
74
|
+
continue
|
|
75
|
+
if sensitive_spelling:
|
|
76
|
+
if in_ask_query:
|
|
77
|
+
copy_next_ask_value = False
|
|
78
|
+
sanitized.append(f"{flag_name}=<redacted>")
|
|
79
|
+
idx += 1
|
|
80
|
+
continue
|
|
81
|
+
|
|
82
|
+
if arg == "ask" and not in_ask_query:
|
|
83
|
+
in_ask_query = True
|
|
84
|
+
sanitized.append(arg)
|
|
85
|
+
idx += 1
|
|
86
|
+
continue
|
|
87
|
+
if in_ask_query:
|
|
88
|
+
if ask_options_ended:
|
|
89
|
+
if not ask_query_redacted:
|
|
90
|
+
sanitized.append("<redacted>")
|
|
91
|
+
ask_query_redacted = True
|
|
92
|
+
idx += 1
|
|
93
|
+
continue
|
|
94
|
+
if arg == "--":
|
|
95
|
+
ask_options_ended = True
|
|
96
|
+
if not ask_query_redacted:
|
|
97
|
+
sanitized.append("<redacted>")
|
|
98
|
+
ask_query_redacted = True
|
|
99
|
+
idx += 1
|
|
100
|
+
continue
|
|
101
|
+
if copy_next_ask_value:
|
|
102
|
+
sanitized.append(arg)
|
|
103
|
+
copy_next_ask_value = False
|
|
104
|
+
idx += 1
|
|
105
|
+
continue
|
|
106
|
+
if arg in ask_value_flags:
|
|
107
|
+
sanitized.append(arg)
|
|
108
|
+
copy_next_ask_value = True
|
|
109
|
+
idx += 1
|
|
110
|
+
continue
|
|
111
|
+
if arg in ask_bare_flags:
|
|
112
|
+
sanitized.append(arg)
|
|
113
|
+
idx += 1
|
|
114
|
+
continue
|
|
115
|
+
if any(arg.startswith(flag + "=") for flag in ask_value_flags):
|
|
116
|
+
sanitized.append(arg)
|
|
117
|
+
idx += 1
|
|
118
|
+
continue
|
|
119
|
+
if not ask_query_redacted:
|
|
120
|
+
sanitized.append("<redacted>")
|
|
121
|
+
ask_query_redacted = True
|
|
122
|
+
idx += 1
|
|
123
|
+
continue
|
|
124
|
+
|
|
125
|
+
sanitized.append(arg)
|
|
126
|
+
idx += 1
|
|
127
|
+
|
|
128
|
+
if redact_next:
|
|
129
|
+
sanitized.append("<redacted>")
|
|
130
|
+
return sanitized
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _command_name(argv: list[str]) -> str | None:
|
|
134
|
+
value_flags = {"--api-key", "--api-key-file", "--base-url", "--output"}
|
|
135
|
+
skip_next = False
|
|
136
|
+
for token in argv:
|
|
137
|
+
if skip_next:
|
|
138
|
+
skip_next = False
|
|
139
|
+
continue
|
|
140
|
+
if token in value_flags:
|
|
141
|
+
skip_next = True
|
|
142
|
+
continue
|
|
143
|
+
if any(token.startswith(prefix + "=") for prefix in value_flags):
|
|
144
|
+
continue
|
|
145
|
+
if token.startswith("-"):
|
|
146
|
+
continue
|
|
147
|
+
return token
|
|
148
|
+
return None
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def append_activity(argv: list[str], *, source: str, exit_code: int, duration_ms: int) -> None:
|
|
152
|
+
path = activity_log_path()
|
|
153
|
+
cli_config.ensure_config_dir()
|
|
154
|
+
entry = {
|
|
155
|
+
"captured_at": _utc_now(),
|
|
156
|
+
"source": source,
|
|
157
|
+
"command": _command_name(argv),
|
|
158
|
+
"argv": sanitize_argv(argv),
|
|
159
|
+
"exit_code": exit_code,
|
|
160
|
+
"ok": exit_code == 0,
|
|
161
|
+
"duration_ms": max(0, int(duration_ms)),
|
|
162
|
+
}
|
|
163
|
+
with path.open("a", encoding="utf-8") as handle:
|
|
164
|
+
handle.write(json.dumps(entry, ensure_ascii=False, sort_keys=True) + "\n")
|
|
165
|
+
cli_config.apply_secure_permissions(path)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def read_activity(*, limit: int = 20, command: str | None = None, source: str | None = None) -> list[dict[str, Any]]:
|
|
169
|
+
path = activity_log_path()
|
|
170
|
+
if not path.exists():
|
|
171
|
+
return []
|
|
172
|
+
|
|
173
|
+
entries: list[dict[str, Any]] = []
|
|
174
|
+
for line in path.read_text(encoding="utf-8").splitlines():
|
|
175
|
+
if not line.strip():
|
|
176
|
+
continue
|
|
177
|
+
try:
|
|
178
|
+
payload = json.loads(line)
|
|
179
|
+
except json.JSONDecodeError:
|
|
180
|
+
continue
|
|
181
|
+
if not isinstance(payload, dict):
|
|
182
|
+
continue
|
|
183
|
+
if command and payload.get("command") != command:
|
|
184
|
+
continue
|
|
185
|
+
if source and payload.get("source") != source:
|
|
186
|
+
continue
|
|
187
|
+
entries.append(payload)
|
|
188
|
+
|
|
189
|
+
entries.reverse()
|
|
190
|
+
return entries[: max(1, limit)]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Bundled Adanos CLI brand assets."""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Ebene_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 417.9 417.45">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>.cls-1{fill:#727f87}.cls-2{fill:#c7c7c7}.cls-3{fill:#454e54}.cls-4{fill:url(#adanos-gradient)}</style>
|
|
5
|
+
<linearGradient id="adanos-gradient" x1="208.95" y1="375.39" x2="208.95" y2="-241.72" gradientUnits="userSpaceOnUse">
|
|
6
|
+
<stop offset="0" stop-color="#c76745"/>
|
|
7
|
+
<stop offset=".55" stop-color="#e5b86f"/>
|
|
8
|
+
<stop offset=".84" stop-color="#f8dda1"/>
|
|
9
|
+
<stop offset="1" stop-color="#f8ddd9"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
</defs>
|
|
12
|
+
<path class="cls-2" d="M408.87,309.26l-48.29-20.28-125.96,52.91c-8.16,3.86-16.92,5.8-25.67,5.8s-17.51-1.93-25.67-5.8l-125.96-52.91-48.29,20.28c-5.65,2.71-9.02,8.07-9.02,14.34s3.37,11.63,9.02,14.34l176.75,74.24.06.03c14.69,6.97,31.53,6.97,46.22,0l.13-.06,176.69-74.22c5.65-2.71,9.02-8.07,9.02-14.34s-3.37-11.63-9.02-14.34Z"/>
|
|
13
|
+
<path class="cls-1" d="M408.87,232.67l-48.29-20.28-82.44,34.63-3.96,1.66-3.96,1.66-35.61,14.96c-8.16,3.86-16.92,5.8-25.67,5.8s-17.51-1.93-25.67-5.8l-35.61-14.96-3.96-1.66-3.96-1.66-82.44-34.63-48.29,20.28c-5.65,2.71-9.02,8.07-9.02,14.34s3.37,11.63,9.02,14.34l48.29,20.28,3.96,1.66,3.96,1.66,120.55,50.63.06.03c14.69,6.97,31.53,6.97,46.22,0l.13-.06,120.48-50.61,3.96-1.66,3.96-1.66,48.29-20.28c5.65-2.71,9.02-8.07,9.02-14.34s-3.37-11.63-9.02-14.34Z"/>
|
|
14
|
+
<path class="cls-3" d="M408.87,156.09l-48.29-20.28-82.44,34.63-3.96,1.66-3.96,1.66-35.61,14.96c-8.16,3.86-16.92,5.8-25.67,5.8s-17.51-1.93-25.67-5.8l-35.61-14.96-3.96-1.66-3.96-1.66-82.44-34.63-48.29,20.28c-5.65,2.71-9.02,8.07-9.02,14.34s3.37,11.63,9.02,14.34l48.29,20.28,3.96,1.66,3.96,1.66,82.44,34.63,3.96,1.66,3.96,1.66,30.2,12.68.06.03c14.69,6.97,31.53,6.97,46.22,0l.13-.06,30.13-12.66,3.96-1.66,3.96-1.66,82.44-34.63,3.96-1.66,3.96-1.66,48.29-20.28c5.65-2.71,9.02-8.07,9.02-14.34s-3.37-11.63-9.02-14.34Z"/>
|
|
15
|
+
<path class="cls-4" d="M408.87,79.5L232.12,5.26l-.06-.03c-14.69-6.97-31.53-6.97-46.22,0l-.13.06L9.02,79.5c-5.65,2.71-9.02,8.07-9.02,14.34s3.37,11.63,9.02,14.34l48.29,20.28,3.96,1.66,3.96,1.66,82.44,34.63,3.96,1.66,3.96,1.66,30.2,12.68.06.03c14.69,6.97,31.53,6.97,46.22,0l.13-.06,30.13-12.66,3.96-1.66,3.96-1.66,82.44-34.63,3.96-1.66,3.96-1.66,48.29-20.28c5.65-2.71,9.02-8.07,9.02-14.34s-3.37-11.63-9.02-14.34Z"/>
|
|
16
|
+
</svg>
|