cctally 1.22.2 → 1.22.4
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.
- package/CHANGELOG.md +21 -0
- package/bin/_cctally_cache_report.py +1133 -880
- package/bin/_cctally_codex.py +518 -0
- package/bin/_cctally_dashboard.py +3 -3
- package/bin/_cctally_diff.py +240 -0
- package/bin/_cctally_doctor.py +479 -0
- package/bin/_cctally_five_hour.py +1688 -0
- package/bin/_cctally_forecast.py +1979 -0
- package/bin/_cctally_milestones.py +433 -0
- package/bin/_cctally_percent_breakdown.py +199 -0
- package/bin/_cctally_pricing_check.py +393 -0
- package/bin/_cctally_record.py +8 -5
- package/bin/_cctally_reporting.py +749 -0
- package/bin/_cctally_setup.py +172 -13
- package/bin/_cctally_statusline.py +630 -0
- package/bin/_cctally_sync_week.py +5 -4
- package/bin/_cctally_weekrefs.py +484 -0
- package/bin/_lib_cache_report.py +938 -0
- package/bin/_lib_diff_kernel.py +5 -8
- package/bin/_lib_fmt.py +325 -0
- package/bin/_lib_pricing_debug.py +182 -0
- package/bin/_lib_render.py +9 -24
- package/bin/_lib_subscription_weeks.py +2 -2
- package/bin/cctally +466 -9190
- package/package.json +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [1.22.4] - 2026-06-01
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **A surprise mid-week Anthropic usage reset is now reflected in the 7d percentage even when you were below ~25% usage.** When Anthropic zeroes the weekly counter mid-window (same reset timestamp, usage drops to ~0 — e.g. the 2026-06-01 incident), the reset detector previously only fired when the drop was at least 25 percentage points, so any account reset from a lower base (the observed 14% → 0%) slipped through: no `week_reset_events` row was written, the monotonic high-water-mark clamp kept reporting the stale pre-reset percentage across the statusline, `weekly`/`report`, and the dashboard, and post-reset 0% reads were silently dropped at the write site. The detector now ALSO fires on a reset-to-zero — when the post-reset value collapses to ~0 (≤ 1%) with at least a 3pp drop — independently of the 25pp magnitude gate, since a clean drop to zero is an unambiguous reset regardless of size (a lagging API replica reports a slightly-lower number, never a clean 0 against real usage), while the 3pp floor rejects 1%→0% replica jitter that would otherwise spuriously segment the week. The new discriminator is a single shared `_is_reset_drop()` helper wired into all four 7d detection sites (live + backfill, boundary-advance + in-place-credit branches) so they stay byte-identical; the 25pp partial-credit path and the separate 5h detector are unchanged. Regression: three new cases in `tests/test_in_place_credit_detection.py` (live reset-to-zero fires below 25pp, the 3pp floor rejects 1%→0% jitter, and backfill parity).
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- **Internal refactor (no user-facing change): extracted the shared formatting/color/table render primitives — the boxed-table renderer, the color/unicode capability detectors, the ANSI styling + display-width helpers, the integer/width-budget number formatters, the compact timestamp/week-window formatters, and the `_ANSI_ESC_RE` regex (plus the small `_parse_iso_datetime_optional` helper they depend on) — out of the `bin/cctally` single-file program into a new stdlib-only pure-function sibling module, `bin/_lib_fmt.py` (#126, the final tranche of the `bin/cctally` split).** This trims the main script by ~250 lines (2,969 → 2,715), and additionally converts the eight back-references these primitives had in `bin/_lib_render.py` and `bin/_lib_diff_kernel.py` from `cctally`-namespace shims into honest direct imports of the new kernel — with no change to any command's behavior, flags, output, or exit codes: every reporting/`diff`/`project`/`cache-report`/`forecast`/`blocks`/`percent-breakdown`/`five-hour-blocks` golden test is byte-identical and the full harness + pytest suite (1,329 checks) passes, a new `tests/test_lib_fmt_extraction_invariants.py` locks the extraction's import discipline, and the new module ships in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
15
|
+
|
|
16
|
+
## [1.22.3] - 2026-06-01
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Internal refactor (no user-facing change): extracted the OpenAI/Codex parity command family (`codex-daily`/`codex-monthly`/`codex-weekly`/`codex-session` plus their speed/timezone resolvers and the `--debug` cost-stats cluster) and the Claude reporting command family (`daily`/`monthly`/`weekly`/`session`) out of the `bin/cctally` single-file program into two new stdlib-only sibling modules — `bin/_cctally_codex.py` and `bin/_cctally_reporting.py` — continuing the ongoing `bin/cctally` split.** This trims the main script by ~980 lines (8,843 → 7,864) with no change to any command's behavior, flags, output, or exit codes — every `codex-daily`/`codex-monthly`/`codex-weekly`/`codex-session`, `daily`/`weekly`/`session`, `daily --instances`, and subgroup golden test is unchanged and the full harness + pytest suite passes — and both modules ship in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
20
|
+
- **Internal refactor (no user-facing change): extracted the two read-only diagnostics commands — `doctor` (`doctor_gather_state` + `cmd_doctor`) and `pricing-check` (the LiteLLM/Anthropic fetchers + `cmd_pricing_check` + its text renderer) — out of the `bin/cctally` single-file program into two new stdlib-only sibling modules, `bin/_cctally_doctor.py` and `bin/_cctally_pricing_check.py` (continuing the ongoing `bin/cctally` split).** This trims the main script by ~700 lines (11,441 → 10,744) with no change to either command's behavior, flags, output, or exit codes — every `doctor` and `pricing-check` golden test is unchanged and the full harness + pytest suite passes — and both modules ship in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
21
|
+
- **Internal refactor (no user-facing change): extracted the two 5-hour-window command families and the statusline command out of the `bin/cctally` single-file program into two new stdlib-only sibling modules — `bin/_cctally_five_hour.py` (`blocks` / `five-hour-blocks` / `five-hour-breakdown` plus the shared recorded-window resolution layer) and `bin/_cctally_statusline.py` (`statusline` glue plus the per-model context-window tables) — continuing the ongoing `bin/cctally` split.** This trims the main script by ~1,900 lines (10,741 → 8,843) with no change to any command's behavior, flags, output, or exit codes — every `blocks`, `five-hour-blocks`, `statusline`, subgroup, and 5h-canonical golden test is unchanged and the full harness + pytest suite passes — and both modules ship in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
22
|
+
- **Internal refactor (no user-facing change): extracted the `report`/`forecast`/`budget` command family — `cmd_report`, `cmd_forecast`, `cmd_budget`, the forecast core cluster (window resolvers, `ForecastInputs`/`ForecastOutput`/`BudgetRow`, the projection math, and the terminal/JSON/status-line renderers), and the ten budget render/snapshot helpers — out of the `bin/cctally` single-file program into a new stdlib-only sibling module, `bin/_cctally_forecast.py` (continuing the ongoing `bin/cctally` split).** This trims the main script by ~1,860 lines (7,864 → 6,000) with no change to any command's behavior, flags, output, or exit codes — every `forecast`, `budget`, and share golden test is byte-identical and the full harness + pytest suite passes — the budget write-path helpers and the week-boundary join layer stay in the main program (reached via the runtime namespace accessor), and the new module ships in the npm/brew/public packages (promoted to the mirror allowlist). A new namespace-binding regression test guards the module-boundary wiring. Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
23
|
+
- **Internal refactor (no user-facing change): split the `cache-report` command out of the `bin/cctally` single-file program — the pure data kernel was renamed to the conventional `bin/_lib_cache_report.py` and the command/render glue moved into a new stdlib-only sibling, `bin/_cctally_cache_report.py`, so `cache-report` now matches the `_lib_<x>`/`_cctally_<x>` shape of `statusline` and `doctor` (continuing the ongoing `bin/cctally` split).** This trims the main script by ~1,170 lines (6,000 → 4,833) with no change to the command's behavior, flags, output, or exit codes — every `cache-report` golden test is unchanged and the full harness + pytest suite passes — and both modules ship in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
24
|
+
- **Internal refactor (no user-facing change): extracted the weekly cost-snapshot + milestone DB cluster and the `percent-breakdown` command handler out of the `bin/cctally` single-file program into two new stdlib-only sibling modules — `bin/_cctally_milestones.py` and `bin/_cctally_percent_breakdown.py` (continuing the ongoing `bin/cctally` split).** This trims the main script by ~530 lines (4,831 → 4,297) with no change to any command's behavior, flags, output, or exit codes — every `percent-breakdown` and milestone-idempotency golden test is unchanged and the full harness + pytest suite passes — and both modules ship in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
25
|
+
- **Internal refactor (no user-facing change): extracted the `diff` command (`cmd_diff` plus its two-window debug-sample reporter) out of the `bin/cctally` single-file program into a new stdlib-only sibling module, `bin/_cctally_diff.py`, and folded the `range-cost` command into the existing `bin/_cctally_reporting.py` sibling (continuing the ongoing `bin/cctally` split).** This trims the main script by ~340 lines (4,297 → 3,954) with no change to either command's behavior, flags, output, or exit codes — every `diff` and `range-cost` golden test is unchanged and the full harness + pytest suite passes — and the new module ships in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
26
|
+
- **Internal refactor (no user-facing change): extracted the WeekRef / reset-event cluster — the canonical week-boundary resolvers, `get_recent_weeks`, the reset-event backfill/apply/overlap-clamp helpers, the per-WeekRef cost computer, and the two reset-drop-threshold constants — out of the `bin/cctally` single-file program into a new stdlib-only sibling module, `bin/_cctally_weekrefs.py`, and folded the 5-hour-block backfill into the existing `bin/_cctally_five_hour.py` sibling (continuing the ongoing `bin/cctally` split).** This trims the main script by ~660 lines (3,954 → 3,293) with no change to any command's behavior, flags, output, or exit codes — every affected `weekly`/`report`/`five-hour-blocks` golden test is unchanged and the full harness + pytest suite passes — and the new module ships in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
27
|
+
- **Internal refactor (no user-facing change): extracted the pricing-observed-models scan into the existing `bin/_cctally_pricing_check.py` sibling, the pure pricing-mismatch-debug kernel into a new stdlib-only module `bin/_lib_pricing_debug.py`, and the setup/hook settings-file glue into the existing `bin/_cctally_setup.py` sibling — the final batch of the `bin/cctally` single-file split (#125).** This trims the main script by ~320 lines (3,293 → 2,969) with no change to any command's behavior, flags, output, or exit codes — every `pricing-check`, `doctor`, and `setup` golden test is unchanged and the full harness + pytest suite (1,328 checks) passes — and the new module ships in the npm/brew/public packages (promoted to the mirror allowlist). Purely a maintainability / code-organization change; nothing to do on upgrade.
|
|
28
|
+
|
|
8
29
|
## [1.22.2] - 2026-05-30
|
|
9
30
|
|
|
10
31
|
### Changed
|