usage

usage 0.29.10

工具與目錄
在這頁

新功能 1 項

01

看不見的整理:選單列程式分家,尺寸規則自動把關

這版選單列畫面不變,整理藏在牆裡。menubar.py 已膨脹到 2,485 行,第三次超過 2,000 行。圖示與警示的輔助程式搬到 menubar_chrome.py,狀態建立程式移至 menubar_state.py,主檔降至 2,230 行。只移動檔案直屬函式。PyObjC(讓 Python 接上 macOS Objective-C 的橋樑)靠 AppDelegate 的方法名稱連接控制項,搬動它會令對應控制項失靈;_popover_size 則拆成計算函式,留三行外殼,讓無 ObjC 執行環境的單元測試仍能跑。接著,CI(自動檢查流程)開始替檔案尺寸守門,超限就讓建置失敗;切割檔案時降上限,別為通過檢查抬高它。CLAUDE.md 的模組地圖從 24 列縮到 12 列,只留會踩雷的說明。像整理屋內管線,表面不變,日後維修不必再越鑿越大。

官方原文

**Nothing changes on screen in this release — it is housekeeping on the menu bar code.** menubar.py had reached 2485 lines, creeping past 2000 for the third time after being split apart twice. The icon and alert helpers moved into a new menubar_chrome.py, and the state constructors joined menubar_state.py, taking the file down to 2230. Only module-level functions moved: PyObjC binds AppDelegate methods by selector name, so relocating one would silently stop the matching control from working. _popover_size was split rather than moved, because it ends in NSMakeSize and menubar_state.py has to stay importable without the ObjC runtime for its projections to be unit-testable — the arithmetic moved as popover_dimensions() and a three-line shell stayed behind.

**The growth policy behind that cleanup is now enforced by CI rather than by discipline.** scripts/check_file_size.py fails the build when a guarded file passes its ceiling. The rule had been written in CLAUDE.md all along; nothing checked it, and the file grew back twice. Lower a ceiling when a cut lands, never raise it to go green.

**CLAUDE.md's module map lists only modules with a gotcha.** Half its rows restated what opening the file would tell you, and three separate rows repeated the same stdlib-only constraint. It went from 24 rows to 12.