|
@@ -18,17 +18,17 @@ The CLI SHALL call `GET https://zenmux.ai/api/v1/management/subscription/detail`
|
|
|
- **WHEN** the user runs `zenmux-usage --timeout 2s` and a server has not responded within 2 seconds
|
|
- **WHEN** the user runs `zenmux-usage --timeout 2s` and a server has not responded within 2 seconds
|
|
|
- **THEN** the CLI aborts that account's request and records it as a timeout error while continuing with any remaining accounts
|
|
- **THEN** the CLI aborts that account's request and records it as a timeout error while continuing with any remaining accounts
|
|
|
|
|
|
|
|
-### Requirement: Render three quota windows per account
|
|
|
|
|
|
|
+### Requirement: Render two quota windows per account
|
|
|
|
|
|
|
|
-In human output mode the CLI SHALL render, for each resolved account, one labeled row per window (`5 hour`, `7 day`, `month`). Each row MUST include a fixed-width progress bar, the usage percentage to two decimals, the used-vs-max flows, and the used-vs-max USD value when the API provides them. Bars MUST be color-coded by usage band: green below 60%, yellow from 60% through 85%, red above 85%. The monthly window MUST render the `max_flows` and `max_value_usd` values and display `—` (em-dash) in place of used values since the API does not return `used_*` fields for that window.
|
|
|
|
|
|
|
+In human output mode the CLI SHALL render, for each resolved account, one labeled row per rolling window — `5 hour` and `7 day`. Each row MUST include a fixed-width progress bar, the usage percentage to two decimals, the used-vs-max flows, and the used-vs-max USD value. Bars MUST be color-coded by usage band: green below 60%, yellow from 60% through 85%, red above 85%. The monthly quota MUST NOT be rendered as a third progress-bar row; it is emitted separately by the "Display monthly cap" requirement.
|
|
|
|
|
|
|
|
#### Scenario: Healthy 5-hour window
|
|
#### Scenario: Healthy 5-hour window
|
|
|
- **WHEN** the API returns `quota_5_hour.usage_percentage = 0.0715`, `used_flows = 57.2`, `max_flows = 800`, `used_value_usd = 1.88`, `max_value_usd = 26.26` for an account
|
|
- **WHEN** the API returns `quota_5_hour.usage_percentage = 0.0715`, `used_flows = 57.2`, `max_flows = 800`, `used_value_usd = 1.88`, `max_value_usd = 26.26` for an account
|
|
|
- **THEN** that account's block contains a row labeled `5 hour`, a green-colored bar roughly 7% filled, `7.15%`, `57.2 / 800 flows`, and `$1.88 / $26.26`
|
|
- **THEN** that account's block contains a row labeled `5 hour`, a green-colored bar roughly 7% filled, `7.15%`, `57.2 / 800 flows`, and `$1.88 / $26.26`
|
|
|
|
|
|
|
|
-#### Scenario: Monthly window has no used values
|
|
|
|
|
-- **WHEN** the API returns `quota_monthly` with only `max_flows` and `max_value_usd` populated
|
|
|
|
|
-- **THEN** the monthly row prints `—` in place of used flows and used USD, and shows the `max_flows` and `max_value_usd` values
|
|
|
|
|
|
|
+#### Scenario: No monthly progress row rendered
|
|
|
|
|
+- **WHEN** an account is rendered in human mode
|
|
|
|
|
+- **THEN** the output MUST NOT contain a row labeled `month` inside the progress-bar block, and MUST NOT contain an em-dash (`—`) placeholder or `n/a` percentage inside the bar rows
|
|
|
|
|
|
|
|
#### Scenario: Color disabled via flag
|
|
#### Scenario: Color disabled via flag
|
|
|
- **WHEN** the user runs `zenmux-usage --no-color`
|
|
- **WHEN** the user runs `zenmux-usage --no-color`
|
|
@@ -52,7 +52,7 @@ For every resolved account the CLI SHALL print, before the quota rows, a header
|
|
|
|
|
|
|
|
### Requirement: Display token USD value consumed per account
|
|
### Requirement: Display token USD value consumed per account
|
|
|
|
|
|
|
|
-Below each account's three quota rows the CLI SHALL print a summary line labeled "Tokens consumed (estimated USD value)" showing the `used_value_usd` from the 7-day window for that account, formatted as USD to two decimals.
|
|
|
|
|
|
|
+Below each account's quota rows the CLI SHALL print a summary line labeled "Tokens consumed (estimated USD value)" showing the `used_value_usd` from the 7-day window for that account, formatted as USD to two decimals.
|
|
|
|
|
|
|
|
#### Scenario: 7-day used value present
|
|
#### Scenario: 7-day used value present
|
|
|
- **WHEN** an account's `quota_7_day.used_value_usd = 13.66`
|
|
- **WHEN** an account's `quota_7_day.used_value_usd = 13.66`
|
|
@@ -108,3 +108,19 @@ On `success: false` in a response body the CLI SHALL treat that account as a fai
|
|
|
#### Scenario: Single-account run preserves specific code
|
|
#### Scenario: Single-account run preserves specific code
|
|
|
- **WHEN** a single-account run (`--account work`, `--api-key`, or env-var fallback) fails with HTTP 401
|
|
- **WHEN** a single-account run (`--account work`, `--api-key`, or env-var fallback) fails with HTTP 401
|
|
|
- **THEN** the CLI exits with code 4
|
|
- **THEN** the CLI exits with code 4
|
|
|
|
|
+
|
|
|
|
|
+### Requirement: Display monthly cap
|
|
|
|
|
+
|
|
|
|
|
+Below the "Tokens consumed" summary line and above any "Next reset" line the CLI SHALL, in human output mode, emit a one-line summary of the monthly quota cap using `quota_monthly.max_flows` and `quota_monthly.max_value_usd`. The line MUST be formatted as `Monthly cap: <max_flows> flows · $<max_value_usd>` with `max_flows` printed without trailing zeros and `max_value_usd` formatted as USD to two decimals.
|
|
|
|
|
+
|
|
|
|
|
+#### Scenario: Monthly cap present
|
|
|
|
|
+- **WHEN** an account returns `quota_monthly.max_flows = 34560` and `quota_monthly.max_value_usd = 1134.33`
|
|
|
|
|
+- **THEN** the output contains a line `Monthly cap: 34560 flows · $1134.33`
|
|
|
|
|
+
|
|
|
|
|
+#### Scenario: Cap line placement
|
|
|
|
|
+- **WHEN** the human-mode block is rendered for an account
|
|
|
|
|
+- **THEN** the "Monthly cap:" line appears after the "Tokens consumed (estimated USD value):" line and before the "Next reset:" line (when a reset line is emitted)
|
|
|
|
|
+
|
|
|
|
|
+#### Scenario: JSON mode unchanged
|
|
|
|
|
+- **WHEN** the user runs `zenmux-usage --json`
|
|
|
|
|
+- **THEN** no "Monthly cap" line is injected into the JSON output; the `quota_monthly` field from the API response is the only monthly representation
|