usage

usage 0.12.1

工具與目錄
在這頁

新功能 1 項

01

產出報告不再龜速,底層抓蟲大掃除

現在你點擊產出 HTML 分析報告時,速度會快上很多。以前系統很笨,每次產報告都會把你的所有歷史紀錄檔從頭到尾重新讀一遍;現在它學會了「快取(cache,把讀過的資料暫存在記憶體裡)」,只要檔案沒被改過,它就會直接拿上次記住的結果來用。同時,我們對系統底層進行了大規模的「型別檢查(type-checking,確保每個變數都裝對東西的健康檢查)」,原本有 35% 的程式碼是檢查死角,現在全面覆蓋後,順手抓出了好幾個隱藏的變數錯用和重複設定問題。我們還加上了多國語系的自動防呆測試,以後只要有一國語言漏翻譯,系統在出廠前就會自動擋下,不會再發生切成日文卻默默跑出英文的怪事。就像圖書館員以前每次有人問庫存,都要把整座圖書館的書重新數一遍,現在他終於學會看庫存登記簿了;而且圖書館還趁機做了一次全棟安檢,把以前偷懶沒巡到的黑暗死角全掃了一遍,連標示牌翻譯漏字的瑕疵都抓出來了。

官方原文

**File-level cache for the HTML report loaders**: adapters/claude.py and adapters/codex.py gain an mtime+size-keyed LRU cache (matching history_loader), so generating a report no longer re-parses every JSONL log on each run; the Codex adapter shares one cache between load_entries and load_rate_limits. Whole-file OSError / PermissionError / sqlite3.Error are now printed to stderr when USAGE_DEBUG=1 (per-line JSONDecodeError stays silent).

**mypy --strict now covers the whole codebase**: removed the mypy exclude for adapters/, analyzer/, ui/ and usage_cli.py (a ~35% type-checking blind spot), added the missing generics and function annotations, and switched _group_by_agent to a PEP 695 type parameter. mypy --strict now checks all 70 source files.

**Three cross-module functions in adapters/claude.py are now public API**: get_claude_dirs, extract_project_from_dir, parse_jsonl (previously underscore-private), dropping the matching # type: ignore[attr-defined] in analyzer/reporter.py.

Removing the mypy exclude surfaced and fixed a few latent issues: a redundant parsed_entries re-annotation left over from the cache change in adapters/claude.py, the agent loop variable reused with two different types in analyzer/reporter.py (inner accumulator renamed agent_totals), and a redundant cast in menubar.py.

Added coverage for _apply_sort with the "time" sort key (which maps to None and is handled per-command).

Added an i18n key-parity test asserting all five i18n.json language sections share the same key set, so a forgotten translation fails CI instead of silently falling back to English.