How j-kun-hub/ration works
Ration is a local-first menu-bar/tray allowance viewer with parallel macOS and Windows implementations. The main workflow refreshes local Codex and Claude records, parses provider windows, selects visible usage, and presents remaining quota and reset state; preferences and alerting are additional capabilities. Edges reflect README statements and the supplied excerpts or SOURCE INDEX references; unsampled macOS presentation and alert wiring is not inferred.
Main entry points: App.swift Menu bar shell · App.xaml.cs Windows startup · TrayService.cs Tray service · UsageCoordinator.cs Refresh coordinator
Components 31
macOS app
- Menu bar shell
Sources/Ration/App.swift - Themes and views
Sources/Ration/Views.swift
macOS core
- Preferences
Sources/RationCore/Settings.swift - Usage model
Sources/RationCore/Model.swift - Claude reader
Sources/RationCore/ClaudeSource.swift - Codex reader
Sources/RationCore/CodexSource.swift - Tail reader
Sources/RationCore/TailReader.swift - Formatting
Sources/RationCore/Formatting.swift - Appearance
Sources/RationCore/Appearance.swift - Alert center
Sources/RationCore/Alerts.swift - Alert channels
Sources/RationCore/Channels.swift - Process runner
Sources/RationCore/ProcessRunner.swift - Login item
Sources/RationCore/LoginItem.swift
Windows app
- Windows startup
Windows/Ration.Windows.App/App.xaml.cs - Preferences
Windows/Ration.Windows.App/AppSettings.cs - Refresh coordinator
Windows/Ration.Windows.App/UsageCoordinator.cs - Usage window
Windows/Ration.Windows.App/MainWindow.xaml.cs - Tray service
Windows/Ration.Windows.App/TrayService.cs - Visibility selection
Windows/Ration.Windows.App/TraySelection.cs - Startup service
Windows/Ration.Windows.App/StartupService.cs - Local alerts
Windows/Ration.Windows.App/LocalAlertScheduler.cs
Windows core
- Codex reader
Windows/Ration.Windows.Core/CodexUsageSource.cs - Claude reader
Windows/Ration.Windows.Core/ClaudeUsageSource.cs - Provider paths
Windows/Ration.Windows.Core/WindowsProviderPathResolver.cs - Tail reader
Windows/Ration.Windows.Core/TailReader.cs - Usage domain
Windows/Ration.Windows.Core/DomainModels.cs - Formatting
Windows/Ration.Windows.Core/Formatting.cs
Other components
- User
- Windows user
- Windows
- macOS
Connections 31
- User → Menu bar shell: opens
README.md - Menu bar shell → Claude reader: refreshes
Sources/Ration/App.swift - Menu bar shell → Codex reader: refreshes
Sources/Ration/App.swift - Codex reader → Tail reader: reads tail
Sources/RationCore/CodexSource.swift - Menu bar shell → Preferences: reads settings
Sources/Ration/App.swift - Menu bar shell → Themes and views: presents
README.md - Themes and views → Preferences: edits preferences
Sources/Ration/Views.swift - Menu bar shell → Alert center: syncs alerts
- Alert center → Preferences: uses preferences
Sources/RationCore/Alerts.swift - Alert channels → Process runner: runs commands
Sources/RationCore/Channels.swift - macOS → Login item: launches at login
- Windows user → Windows startup: starts
Windows/Ration.Windows.App/App.xaml.cs - Windows startup → Preferences: loads
Windows/Ration.Windows.App/App.xaml.cs - Windows startup → Startup service: creates
Windows/Ration.Windows.App/App.xaml.cs - Windows startup → Refresh coordinator: refreshes
Windows/Ration.Windows.App/App.xaml.cs - Refresh coordinator → Codex reader: reads
Windows/Ration.Windows.App/UsageCoordinator.cs - Refresh coordinator → Claude reader: reads
Windows/Ration.Windows.App/UsageCoordinator.cs - Codex reader → Provider paths: resolves paths
Windows/Ration.Windows.Core/CodexUsageSource.cs - Claude reader → Provider paths: resolves paths
Windows/Ration.Windows.Core/ClaudeUsageSource.cs - Codex reader → Tail reader: reads tail
Windows/Ration.Windows.Core/CodexUsageSource.cs - Refresh coordinator → Usage window: publishes snapshot
Windows/Ration.Windows.App/MainWindow.xaml.cs - Usage window → Preferences: edits preferences
Windows/Ration.Windows.App/MainWindow.xaml.cs - Windows startup → Tray service: creates
Windows/Ration.Windows.App/App.xaml.cs - Tray service → Visibility selection: selects usage
Windows/Ration.Windows.App/TrayService.cs - Tray service → Refresh coordinator: refreshes
Windows/Ration.Windows.App/TrayService.cs - Tray service → Startup service: toggles startup
Windows/Ration.Windows.App/TrayService.cs - Windows startup → Local alerts: syncs alerts
Windows/Ration.Windows.App/App.xaml.cs - Local alerts → Visibility selection: receives usages
- Windows → Startup service: registers login
Windows/Ration.Windows.App/StartupService.cs - Usage window → Formatting: formats values
Windows/Ration.Windows.App/MainWindow.xaml.cs - Tray service → Formatting: formats values
Windows/Ration.Windows.App/TrayService.cs