| summary | Development workflow: build/run scripts, logging, and keychain migration notes. | |||
|---|---|---|---|---|
| read_when |
|
# Full build, test, package, and launch (recommended)
./Scripts/compile_and_run.sh
# Just build and package (no tests)
./Scripts/package_app.sh
# Launch existing app (no rebuild)
./Scripts/launch.sh- Make code changes in
Sources/CodexBar/ - Run
./Scripts/compile_and_run.shto rebuild and launch - Check logs in Console.app (filter by "codexbar")
- Optional file log: enable Debug → Logging → "Enable file logging" to write
~/Library/Logs/CodexBar/CodexBar.log(verbosity defaults to "Verbose")
You'll see one keychain prompt per stored credential on the first launch. This is a one-time migration that converts existing keychain items to use kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly.
Zero prompts! The migration flag is stored in UserDefaults, so future rebuilds won't prompt.
- Ad-hoc signed development builds change code signature on every rebuild
- macOS keychain normally prompts when signature changes
- We use
ThisDeviceOnlyaccessibility to prevent prompts - Migration runs once to convert any existing items
defaults delete com.steipete.codexbar KeychainMigrationV1CompletedCodexBar automatically refreshes Augment cookies from your browser:
- Automatic Import: On every usage refresh, CodexBar imports fresh cookies from your browser
- Browser Priority: Chrome → Arc → Safari → Firefox → Brave (configurable)
- Session Detection: Looks for Auth0/NextAuth session cookies
- Fallback: If import fails, uses last known good cookies from keychain
- Default: Every 5 minutes (configurable in Preferences → General)
- Minimum: 30 seconds
- Cookie import happens automatically on each refresh
- Chrome
- Arc
- Safari
- Firefox
- Brave
- Edge
If automatic import fails:
- Open Preferences → Providers → Augment
- Change "Cookie source" to "Manual"
- Paste cookie header from browser DevTools
CodexBar/
├── Sources/CodexBar/ # Main app (SwiftUI + AppKit)
│ ├── CodexBarApp.swift # App entry point
│ ├── StatusItemController.swift # Menu bar icon
│ ├── UsageStore.swift # Usage data management
│ ├── SettingsStore.swift # User preferences
│ ├── Providers/ # Provider-specific code
│ │ ├── Augment/ # Augment Code integration
│ │ ├── Claude/ # Anthropic Claude
│ │ ├── Codex/ # OpenAI Codex
│ │ └── ...
│ └── KeychainMigration.swift # One-time keychain migration
├── Sources/CodexBarCore/ # Shared business logic
├── Tests/CodexBarTests/ # XCTest suite
└── Scripts/ # Build and packaging scripts
- Create
Sources/CodexBar/Providers/YourProvider/ - Implement
ProviderImplementationprotocol - Add to
ProviderRegistry.swift - Add icon to
Resources/ProviderIcon-yourprovider.svg
# Enable verbose logging
export CODEXBAR_LOG_LEVEL=debug
./Scripts/compile_and_run.sh
# Check logs in Console.app
# Filter: subsystem:com.steipete.codexbar category:augment-cookieswift testswiftformat Sources Tests
swiftlint --strict./Scripts/package_app.sh
# Creates: CodexBar.app (ad-hoc signed)./Scripts/sign-and-notarize.sh
# Creates: CodexBar-arm64.zip (notarized for distribution)See docs/RELEASING.md for full release process.
# Check crash logs
ls -lt ~/Library/Logs/DiagnosticReports/CodexBar* | head -5
# Check Console.app for errors
# Filter: process:CodexBar# Verify migration completed
defaults read com.steipete.codexbar KeychainMigrationV1Completed
# Should output: 1
# Check migration logs
log show --predicate 'category == "KeychainMigration"' --last 5m- Check browser is supported (Chrome, Arc, Safari, Firefox, Brave)
- Verify you're logged into Augment in that browser
- Check Preferences → Providers → Augment → Cookie source is "Automatic"
- Enable debug logging and check Console.app
- No dock icon (LSUIElement = true)
- Status item only (NSStatusBar)
- SwiftUI for preferences, AppKit for menu
- Hidden 1×1 window keeps SwiftUI lifecycle alive
- Automatic browser import via SweetCookieKit
- Keychain storage for persistence
- Manual override for debugging
- Auto-refresh on every usage poll
- Background timer (configurable frequency)
- Parallel provider fetches
- Exponential backoff on errors
- Widget snapshot for iOS widget