Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
9c229d8
fix(kiro): support kiro-cli 1.24+ Q Developer format
kilhyeonjun Feb 2, 2026
7559522
fix: require usage data for non-managed new format plans
kilhyeonjun Feb 2, 2026
0521c53
Consider usageBarsShowUsed in smart menu updates
Flohhhhh Feb 4, 2026
3e59132
Show dynamic credits in menu bar when Codex limits are exhausted
teron131 Feb 9, 2026
dde24d4
Amp: detect login redirects and fail fast
ratulsarna Feb 9, 2026
a60b184
Amp: detect login redirects and fail fast (#339)
ratulsarna Feb 9, 2026
cc7013b
fix: use region-specific API endpoint for MiniMax usage fetch
apoorvdarshan Jan 30, 2026
0422dd1
MiniMax: retry China API host on invalid credentials
ratulsarna Feb 10, 2026
609eb6b
MiniMax: preserve API fallback on China retry failure
ratulsarna Feb 10, 2026
6e31b4a
Update CHANGELOG.md
ratulsarna Feb 10, 2026
6e1a33a
Merge branch 'main' into codex/minimax-region-followup
ratulsarna Feb 10, 2026
cb43430
Update CHANGELOG for MiniMax region fallback
ratulsarna Feb 10, 2026
a26a4bb
Merge pull request #344 from steipete/codex/minimax-region-followup
ratulsarna Feb 10, 2026
262cc7c
Fix z.ai API schema changes - handle missing token limit fields
MohamedMohana Feb 10, 2026
b4b9227
Fix z.ai used percent fallback
ratulsarna Feb 10, 2026
0a82673
Handle empty z.ai responses
ratulsarna Feb 10, 2026
7825992
Redact z.ai quota URL in logs
ratulsarna Feb 10, 2026
42de9d7
Update CHANGELOG for z.ai quota fixes
ratulsarna Feb 10, 2026
d01b530
Fix z.ai menu visibility
ratulsarna Feb 10, 2026
448970d
fix: add claude opus 4.6 pricing
arandaschimpf Feb 10, 2026
6139be0
Merge pull request #348 from arandaschimpf/fix-add-claude-opus-4.6-pr…
ratulsarna Feb 10, 2026
9a205c6
Add Opus 4.6 pricing test
ratulsarna Feb 10, 2026
ac3e306
Add short aliases for opus-4-5, opus-4-6, haiku-4-5 models
1bcMax Feb 11, 2026
1ff30b9
Merge pull request #350 from 1bcMax/fix/opus-4-6-model-tracking
ratulsarna Feb 11, 2026
46ce3d7
Add Warp provider
Kathie-yu Feb 3, 2026
f13d2bb
Remove diagonal slash from Warp icon
Kathie-yu Feb 3, 2026
aee846b
Add Warp add-on credits support
Kathie-yu Feb 4, 2026
224314a
Harden Warp usage fetcher
ratulsarna Feb 11, 2026
4da5396
Address Warp review follow-ups
ratulsarna Feb 11, 2026
0d2899a
Refine Warp usage window semantics
ratulsarna Feb 11, 2026
a46f123
Improve Warp reset/detail rendering
ratulsarna Feb 11, 2026
924ec2e
Fix Warp no-bonus icon in show-used mode
ratulsarna Feb 11, 2026
1f2d171
Add Warp env override regression test
ratulsarna Feb 11, 2026
68b8efa
Fix Warp eye cutout rendering
ratulsarna Feb 11, 2026
2509030
Fix Warp bonus lane in show-used mode
ratulsarna Feb 11, 2026
fb0381a
Merge pull request #352 from steipete/codex/pr-294-warp-provider
ratulsarna Feb 11, 2026
030982d
Update changelog for Warp provider
ratulsarna Feb 11, 2026
f493450
Fix Warp usage fetch 429 edge rate limit
ratulsarna Feb 11, 2026
0a5896b
Fix script path casing and host-only SwiftPM packaging fallback
julerex Feb 12, 2026
13f7842
Merge pull request #359 from steipete/codex/pr-275-scripts-only
ratulsarna Feb 12, 2026
a33fa5e
Do not persist selected provider when menu opens
ratulsarna Feb 12, 2026
dd609d0
Exercise merged-menu path in regression test
ratulsarna Feb 12, 2026
1acd74f
Use resolved provider for merged menu refresh
ratulsarna Feb 12, 2026
20df569
Merge pull request #361 from steipete/codex/menu-open-no-settings-write
ratulsarna Feb 12, 2026
5b52899
Enforce Claude keychain prompt policy across keychain paths
ratulsarna Feb 12, 2026
3454405
Stabilize Claude OAuth keychain prompt policy tests
ratulsarna Feb 12, 2026
d761ade
Allow CLI OAuth delegated refresh in background
ratulsarna Feb 12, 2026
63a3810
Allow startup OAuth keychain bootstrap when cache is empty
ratulsarna Feb 12, 2026
d5714c5
Restore Warp no-bonus icon layout semantics
ratulsarna Feb 12, 2026
741db0f
Merge branch 'main' into codex/claude-keychain-policy-hard-enforcement
ratulsarna Feb 12, 2026
bc49112
Stabilize Claude prompt-policy tests under full suite
ratulsarna Feb 12, 2026
ede701b
Document pre-alert test cardinality follow-up
ratulsarna Feb 12, 2026
b2b7097
Clarify delegated OAuth recovery policy in background mode
ratulsarna Feb 12, 2026
6f0641d
Stabilize Claude OAuth full-suite test isolation
ratulsarna Feb 12, 2026
c1a8fe0
Suppress delegated refresh for never keychain policy
ratulsarna Feb 12, 2026
29cfa58
Merge pull request #360 from steipete/codex/claude-keychain-policy-ha…
ratulsarna Feb 13, 2026
5f9b46d
Prefer Claude CLI before web in auto fallback
ratulsarna Feb 13, 2026
cd1c231
Preserve Claude auto fallback error surfacing
ratulsarna Feb 13, 2026
b15acdf
Clarify Claude auto order by runtime in docs
ratulsarna Feb 13, 2026
acc3d4a
Harden idle-timeout PTY test against CI stalls
ratulsarna Feb 13, 2026
fb141df
Expose Claude keychain prompt policy in Preferences
ratulsarna Feb 13, 2026
3dcccda
Merge pull request #362 from steipete/codex/claude-auto-cli-before-web
ratulsarna Feb 13, 2026
d070f83
Merge branch 'main' into codex/claude-keychain-policy-ux
ratulsarna Feb 13, 2026
fc027a6
Merge pull request #364 from steipete/codex/claude-keychain-policy-ux
ratulsarna Feb 13, 2026
b38e4da
Update CHANGELOG.md
ratulsarna Feb 13, 2026
c2738ec
docs: prepare 0.18.0-beta.3 release
steipete Feb 13, 2026
2f5b6af
docs: update appcast for 0.18.0-beta.3
steipete Feb 13, 2026
0ace8b6
Improve OpenCode HTTP error extraction
ratulsarna Feb 14, 2026
f4f405a
fix: correct Claude CLI package name in setup message
daegwang Feb 14, 2026
8e3133c
Merge pull request #376 from daegwang/fix/claude-setup-message
ratulsarna Feb 15, 2026
27c1bb9
Add Ollama provider support
CryptoSageSnr Feb 1, 2026
3b3071d
Fix Ollama formatting violations
ratulsarna Feb 15, 2026
1270eda
Harden Ollama usage parsing for label variants and auth detection
ratulsarna Feb 15, 2026
783e7de
Complete Ollama token account support across settings and CLI
ratulsarna Feb 15, 2026
b2ef621
Add experimental Claude OAuth security reader
ratulsarna Feb 15, 2026
7a2a3b0
Avoid Security.framework polling in experimental refresh
ratulsarna Feb 15, 2026
8fa2d25
Add Claude OAuth diagnostics for expiry and source selection
ratulsarna Feb 15, 2026
97a81a4
Make experimental Claude reader ignore prompt policy
ratulsarna Feb 15, 2026
fe3cd2f
Apply stored prompt policy to experimental fallback
ratulsarna Feb 15, 2026
2b78ea9
Split testing overrides out of ClaudeOAuthCredentials
ratulsarna Feb 15, 2026
448b309
Adjust Ollama branding color for readability
ratulsarna Feb 15, 2026
e54e705
Reduce cyclomatic complexity in usage debug paths
ratulsarna Feb 15, 2026
e4e5e19
Harden Ollama session cookie detection
ratulsarna Feb 15, 2026
e006d1a
Harden Ollama manual cookie mode and auth detection
ratulsarna Feb 15, 2026
87687d6
Harden Ollama cookie import defaults and manual validation
ratulsarna Feb 15, 2026
c7bdbc6
Harden Ollama cookie fallback and diagnostics logging
ratulsarna Feb 15, 2026
5580a18
Keep Ollama auto cookie import Chrome-only by default
ratulsarna Feb 15, 2026
2c198b0
Align Ollama docs with Chrome-only auto import
ratulsarna Feb 15, 2026
cb0ddf3
Retry Ollama cookie candidates on auth failure
ratulsarna Feb 16, 2026
b58c62e
Retry Ollama cookie candidates after auth-like parse failures
ratulsarna Feb 16, 2026
c4452ba
Merge pull request #380 from steipete/codex/pr-286-audit
ratulsarna Feb 16, 2026
76525a8
Add shared provider candidate retry runner
ratulsarna Feb 16, 2026
32ffc9f
Use typed Ollama parse failures for retries
ratulsarna Feb 16, 2026
7630091
Merge branch 'main' into codex/claude-oauth-security-cli-experimental
ratulsarna Feb 16, 2026
e775a59
Move Claude prompt-free creds toggle to Advanced keychain settings
ratulsarna Feb 16, 2026
bca44fe
Harden experimental Claude keychain reads and account selection
ratulsarna Feb 16, 2026
e0bc042
Honor global keychain disable in experimental Claude reader
ratulsarna Feb 16, 2026
bbe0901
Skip Security.framework probe after security CLI sync
ratulsarna Feb 16, 2026
d3296fa
Remove unreachable retry runner fallback
ratulsarna Feb 16, 2026
565ddca
Add Ollama retry mapping coverage test
ratulsarna Feb 16, 2026
59f0710
Guard delegated observation and skip CLI fingerprint probes
ratulsarna Feb 16, 2026
879294e
Respect stored prompt mode for freshness sync and isolate coordinator…
ratulsarna Feb 16, 2026
9bf5dce
Align non-mac security CLI stub with readStrategy API
ratulsarna Feb 16, 2026
6d342aa
Keep experimental no-prompt repair on security CLI path
ratulsarna Feb 16, 2026
8db7fd6
Require baseline for CLI keychain change observation
ratulsarna Feb 16, 2026
8417076
Respect cooldown for background OAuth keychain retries
ratulsarna Feb 16, 2026
bf17033
Clarify security CLI interaction semantics
ratulsarna Feb 16, 2026
54120b9
Limit security CLI account pinning to user actions
ratulsarna Feb 16, 2026
ad48e05
Run Claude debug OAuth probe off MainActor
ratulsarna Feb 16, 2026
f2e55b2
Disable experimental Claude toggle when keychain is off
ratulsarna Feb 16, 2026
9681667
Clarify prompt policy applies to framework reader
ratulsarna Feb 16, 2026
95adbae
Merge pull request #288 from kilhyeonjun/fix/kiro-cli-1.24-format
ratulsarna Feb 16, 2026
ecb9888
Harden Kiro managed-plan parsing
ratulsarna Feb 16, 2026
48cd466
Run provider fetches off MainActor
ratulsarna Feb 16, 2026
75fe890
Update Warp API key guidance links
ratulsarna Feb 16, 2026
3237149
Update Warp API key setup instructions for clarity
ratulsarna Feb 17, 2026
9c86a1a
Respect stored mode in noninteractive keychain fallback
ratulsarna Feb 17, 2026
d5fa076
feat(kimi) fix kimi provider menu bar order
ajaxjiang96 Feb 5, 2026
7fbfa52
fix(kimi): swap UI labels to match usage data order
ajaxjiang96 Feb 5, 2026
c49b691
fix(kimi): avoid duplicate weekly usage when rate limit is missing
ajaxjiang96 Feb 5, 2026
cb1f824
Respect fallback policy in silent keychain probes
ratulsarna Feb 17, 2026
148d47e
Align OAuth availability test with fallback policy
ratulsarna Feb 17, 2026
dd2d746
Merge pull request #388 from steipete/codex/claude-oauth-security-cli…
ratulsarna Feb 17, 2026
b8189b4
Move Claude prompt-free toggle to Claude options
ratulsarna Feb 17, 2026
ad6c751
Scope Kimi short-window priority to automatic metric selection
ratulsarna Feb 17, 2026
8348c85
feat: Add OpenRouter provider for credit-based usage tracking
chountalas Feb 4, 2026
e61b73c
fix: Add missing openrouter switch cases for exhaustive matching
chountalas Feb 4, 2026
07927c4
Fix OpenRouter formatting and lint guards
ratulsarna Feb 17, 2026
a8752ee
Wire OpenRouter config token into fetch env
ratulsarna Feb 17, 2026
c1b53df
Preserve provider order and bound OpenRouter key fetch
ratulsarna Feb 17, 2026
67de5f5
Fix OpenRouter reset text and timeout logging
ratulsarna Feb 17, 2026
ff1c584
Harden OpenRouter logging and widget selection
ratulsarna Feb 17, 2026
6e007a4
Harden OpenRouter diagnostics and token account labels
ratulsarna Feb 17, 2026
d2aad5a
Harden OpenRouter errors and relabel snapshot copies
ratulsarna Feb 17, 2026
8547335
Gate OpenRouter test hooks and document snapshot copy
ratulsarna Feb 18, 2026
9d6b32b
Improve OpenRouter request resilience and headers
ratulsarna Feb 18, 2026
3be0bbc
Merge pull request #396 from steipete/codex/pr-298-audit
ratulsarna Feb 18, 2026
82a8183
Update OpenRouter icon and brand color
ratulsarna Feb 18, 2026
34a9039
Refine OpenRouter key quota popup semantics
ratulsarna Feb 18, 2026
d6a6905
Refine OpenRouter settings and fallback status icons
ratulsarna Feb 18, 2026
064ca72
Update CHANGELOG.md
ratulsarna Feb 19, 2026
06769eb
Merge pull request #306 from Flohhhhh/fix-tab-buttons-usage-bars
ratulsarna Feb 20, 2026
503ac4e
Add test for merged menu rebuilds switcher on usage change
ratulsarna Feb 20, 2026
0b64f58
Update CHANGELOG.md
ratulsarna Feb 20, 2026
063fb22
Fix redundant parentheses in Codex guard
ratulsarna Feb 20, 2026
390adf0
Merge origin/main into codex-credits-display and resolve tests conflict
ratulsarna Feb 20, 2026
e9f7f58
Merge pull request #336 from teron131/codex-credits-display
ratulsarna Feb 20, 2026
7ead92d
Handle OpenCode null subscription responses gracefully
ratulsarna Feb 21, 2026
106a4e8
Ignore cancelled OpenAI dashboard navigations
spirosrap Feb 20, 2026
c7d1c58
Mark navigation error helper nonisolated
spirosrap Feb 20, 2026
d99d872
Complete continuation on ignored cancelled navigation
spirosrap Feb 20, 2026
28c8277
Avoid early completion on cancelled WebKit navigation
ratulsarna Feb 21, 2026
828a37f
Merge pull request #412 from steipete/codex/fix-opencode-null-subscri…
ratulsarna Feb 21, 2026
559e7ec
Update CHANGELOG.md
ratulsarna Feb 21, 2026
519eba5
Merge pull request #390 from steipete/codex/pr-310-audit
ratulsarna Feb 22, 2026
44a6478
Merge upstream steipete/CodexBar with OAuth-first auth strategy
johnlarkin1 Feb 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"permissions": {
"allow": [
"mcp__plugin_github_github__issue_read",
"mcp__plugin_github_github__list_commits",
"mcp__plugin_github_github__get_commit",
"mcp__plugin_github_github__pull_request_read",
"mcp__plugin_github_github__get_file_contents",
"mcp__plugin_github_github__search_code",
"mcp__plugin_github_github__search_pull_requests",
"Bash(git log:*)"
]
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Xcode user/session
xcuserdata/
.swiftpm/xcode/xcshareddata/
.codexbar/config.json
*.env
*.local

# Build products
.build/
Expand Down Expand Up @@ -27,6 +31,7 @@ debug_*.swift
.DS_Store
.vscode/
.codex/environments/
.swiftpm-cache/

# Debug/analysis docs
docs/*-analysis.md
Expand Down
54 changes: 44 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,58 @@

## Unreleased
### Highlights
- Claude OAuth/keychain flows were reworked across a series of follow-up PRs to reduce prompt storms, stabilize background behavior, and make failure modes deterministic (#245, #305, #308, #309). Thanks @manikv12!
- Add an experimental option to suppress Claude Keychain prompts.
- Add OpenRouter provider for credit-based usage tracking (#396). Thanks @chountalas!
- Add Ollama provider, including token-account support in Settings and CLI (#380). Thanks @CryptoSageSnr!


### Providers & Usage
- OpenRouter: add credit tracking, key-quota popup support, token-account labels, fallback status icons, and updated icon/color (#396). Thanks @chountalas!
- Ollama: add provider support with token-account support in app/CLI, Chrome-default auto cookie import, and manual-cookie mode (#380). Thanks @CryptoSageSnr!
- Codex: in percent display mode with "show remaining," show remaining credits in the menu bar when session or weekly usage is exhausted (#336). Thanks @teron131!
- Menu: rebuild the merged provider switcher when “Show usage as used” changes so switcher progress updates immediately (#306). Thanks @Flohhhhh!
- Update Kiro parsing for `kiro-cli` 1.24+ / Q Developer formats and non-managed plan handling (#288). Thanks @kilhyeonjun!
- OpenCode: treat explicit `null` subscription responses as missing usage data, skip POST fallback, and return a clearer workspace-specific error (#412).
- OpenCode: surface clearer HTTP errors. Thanks @SalimBinYousuf1!
- Warp: update API key setup guidance.
- Fix Claude setup message package name (#376). Thanks @daegwang!

### Claude OAuth & Keychain
- Add an experimental Claude OAuth Security-CLI reader path and option in settings.
- Apply stored prompt mode and fallback policy to silent/noninteractive keychain probes.
- Add cooldown for background OAuth keychain retries.
- Disable experimental toggle when keychain access is disabled.

### Dev & Tests
- Run provider fetches and Claude debug OAuth probes off `MainActor`.
- Split Claude OAuth test overrides and isolate coordinator tests.


## 0.18.0-beta.3 — 2026-02-13
### Highlights
- Claude OAuth/keychain flows were reworked across a series of follow-up PRs to reduce prompt storms, stabilize background behavior, surface a setting to control prompt policy and make failure modes deterministic (#245, #305, #308, #309, #364). Thanks @manikv12!
- Claude: harden Claude Code PTY capture for `/usage` and `/status` (prompt automation, safer command palette confirmation, partial UTF-8 handling, and parsing guards against status-bar context meters) (#320).
- Provider correctness fixes landed for Cursor plan parsing and MiniMax region routing (#240, #234). Thanks @robinebers
and @theglove44!
- New provider: Warp (credits + add-on credits) (#352). Thanks @Kathie-yu!
- Provider correctness fixes landed for Cursor plan parsing and MiniMax region routing (#240, #234, #344). Thanks @robinebers and @theglove44!
- Menu bar animation behavior was hardened in merged mode and fallback mode (#283, #291). Thanks @vignesh07 and @Ilakiancs!
- CI/tooling reliability improved via pinned lint tools, deterministic macOS test execution, and PTY timing test stabilization plus Node 24-ready GitHub Actions upgrades (#292, #312, #290).

### Claude OAuth & Keychain (upgrade-relevant behavior)
- Claude OAuth creds are cached in CodexBar Keychain. This reduces Keychain prompts until the token expires.
- If Claude OAuth credentials are present but expired, CodexBar performs at most one delegated refresh handoff to the Claude CLI and one OAuth retry before falling back to Web/CLI in Auto mode.
- Claude Auto mode keeps Keychain prompts suppressed during background refreshes. Interactive Keychain prompting is only attempted during user-initiated repair flows (e.g. menu open / manual refresh) when cached OAuth is missing/expired/unusable.
- Claude OAuth-only mode stays strict: OAuth failures do not silently fall back to Web/CLI.
- Keychain prompting is hardened (cooldowns after explicit denial/cancel/no-access + pre-alert only when interaction is likely) to reduce repeated prompts during refresh.
- CodexBar syncs its cached OAuth token when the Claude Code Keychain entry changes, so updated auth is picked up without requiring a restart.
### Claude OAuth & Keychain
- Claude OAuth creds are cached in CodexBar Keychain to reduce repeated prompts.
- Prompts can still appear when Claude OAuth credentials are expired, invalid, or missing and re-auth is required.
- In Auto mode, background refresh keeps prompts suppressed; interactive prompts are limited to user actions (menu open or manual refresh).
- OAuth-only mode remains strict (no silent Web/CLI fallback); Auto mode may do one delegated CLI refresh + one OAuth retry before falling back.
- Preferences now expose a Claude Keychain prompt policy (Never / Only on user action / Always allow prompts) under Providers → Claude; if global Keychain access is disabled in Advanced, this control remains visible but inactive.

### Provider & Usage Fixes
- Warp: add Warp provider support (credits + add-on credits), configurable via Settings or `WARP_API_KEY`/`WARP_TOKEN` (#352). Thanks @Kathie-yu!
- Cursor: compute usage against `plan.limit` rather than `breakdown.total` to avoid incorrect limit interpretation (#240). Thanks @robinebers!
- MiniMax: correct API region URL selection to route requests to the expected regional endpoint (#234). Thanks @theglove44!
- MiniMax: always show the API region picker and retry the China endpoint when the global host rejects the token to avoid upgrade regressions for users without a persisted region (#344). Thanks @apoorvdarshan!
- Claude: add Opus 4.6 pricing so token cost scanning tracks USD consumed correctly (#348). Thanks @arandaschimpf!
- z.ai: handle quota responses with missing token-limit fields, avoid incorrect used-percent calculations, and harden empty-response behavior with safer logging (#346). Thanks @MohamedMohana and @halilertekin!
- z.ai: fix provider visibility in the menu when enabled with token-account credentials (availability now considers the effective fetch environment).
- Amp: detect login redirects during usage fetch and fail fast when the session is invalid (#339). Thanks @JosephDoUrden!
- Resource loading: fix app bundle lookup path to avoid "could not load resource bundle" startup failures (#223). Thanks @validatedev!
- OpenAI Web dashboard: keep WebView instances cached for reuse to reduce repeated network fetch overhead; tests were updated to avoid network-dependent flakes (#284). Thanks @vignesh07!
- Token-account precedence: selected token account env injection now correctly overrides provider config `apiKey` values in app and CLI environments. Thanks @arvindcr4!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CodexBar 🎚️ - May your tokens never run out. (LARKIN FORK)

Per steipete:
> Tiny macOS 14+ menu bar app that keeps your Codex, Claude, Cursor, Gemini, Antigravity, Droid (Factory), Copilot, z.ai, Kiro, Vertex AI, Augment, Amp, and JetBrains AI limits visible (session + weekly where available) and shows when each window resets. One status item per provider (or Merge Icons mode); enable what you use from Settings. No Dock icon, minimal UI, dynamic bar icons in the menu bar.
> Tiny macOS 14+ menu bar app that keeps your Codex, Claude, Cursor, Gemini, Antigravity, Droid (Factory), Copilot, z.ai, Kiro, Vertex AI, Augment, Amp, JetBrains AI, and OpenRouter limits visible (session + weekly where available) and shows when each window resets. One status item per provider (or Merge Icons mode); enable what you use from Settings. No Dock icon, minimal UI, dynamic bar icons in the menu bar.

<img src="codexbar.png" alt="CodexBar menu screenshot" width="520" />

Expand Down
6 changes: 3 additions & 3 deletions Scripts/compile_and_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ if [[ -n "${RELEASE_ARCHES}" ]]; then
ARCHES_VALUE="${RELEASE_ARCHES}"
fi
if [[ "${DEBUG_LLDB}" == "1" ]]; then
run_step "package app" env CODEXBAR_ALLOW_LLDB=1 ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/scripts/package_app.sh" debug
run_step "package app" env CODEXBAR_ALLOW_LLDB=1 ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/Scripts/package_app.sh" debug
else
if [[ -n "${SIGNING_MODE}" ]]; then
run_step "package app" env CODEXBAR_SIGNING="${SIGNING_MODE}" ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/scripts/package_app.sh"
run_step "package app" env CODEXBAR_SIGNING="${SIGNING_MODE}" ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/Scripts/package_app.sh"
else
run_step "package app" env ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/scripts/package_app.sh"
run_step "package app" env ARCHES="${ARCHES_VALUE}" "${ROOT_DIR}/Scripts/package_app.sh"
fi
fi

Expand Down
30 changes: 23 additions & 7 deletions Scripts/package_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ build_product_path() {
esac
}

# Resolve path to built binary; some SwiftPM versions use .build/$CONF/ when building for host only.
resolve_binary_path() {
local name="$1"
local arch="$2"
local candidate
candidate=$(build_product_path "$name" "$arch")
if [[ -f "$candidate" ]]; then
echo "$candidate"
return
fi
if [[ "$arch" == "arm64" || "$arch" == "x86_64" ]] && [[ -f ".build/$CONF/$name" ]]; then
echo ".build/$CONF/$name"
fi
}

verify_binary_arches() {
local binary="$1"; shift
local expected=("$@")
Expand All @@ -236,9 +251,9 @@ install_binary() {
local binaries=()
for arch in "${ARCH_LIST[@]}"; do
local src
src=$(build_product_path "$name" "$arch")
if [[ ! -f "$src" ]]; then
echo "ERROR: Missing ${name} build for ${arch} at ${src}" >&2
src=$(resolve_binary_path "$name" "$arch")
if [[ -z "$src" || ! -f "$src" ]]; then
echo "ERROR: Missing ${name} build for ${arch} at $(build_product_path "$name" "$arch")" >&2
exit 1
fi
binaries+=("$src")
Expand All @@ -254,14 +269,14 @@ install_binary() {

install_binary "CodexBar" "$APP/Contents/MacOS/CodexBar"
# Ship CodexBarCLI alongside the app for easy symlinking.
if [[ -f "$(build_product_path "CodexBarCLI" "${ARCH_LIST[0]}")" ]]; then
if [[ -n "$(resolve_binary_path "CodexBarCLI" "${ARCH_LIST[0]}")" ]]; then
install_binary "CodexBarCLI" "$APP/Contents/Helpers/CodexBarCLI"
fi
# Watchdog helper: ensures `claude` probes die when CodexBar crashes/gets killed.
if [[ -f "$(build_product_path "CodexBarClaudeWatchdog" "${ARCH_LIST[0]}")" ]]; then
if [[ -n "$(resolve_binary_path "CodexBarClaudeWatchdog" "${ARCH_LIST[0]}")" ]]; then
install_binary "CodexBarClaudeWatchdog" "$APP/Contents/Helpers/CodexBarClaudeWatchdog"
fi
if [[ -f "$(build_product_path "CodexBarWidget" "${ARCH_LIST[0]}")" ]]; then
if [[ -n "$(resolve_binary_path "CodexBarWidget" "${ARCH_LIST[0]}")" ]]; then
WIDGET_APP="$APP/Contents/PlugIns/CodexBarWidget.appex"
mkdir -p "$WIDGET_APP/Contents/MacOS" "$WIDGET_APP/Contents/Resources"
cat > "$WIDGET_APP/Contents/Info.plist" <<PLIST
Expand Down Expand Up @@ -334,7 +349,8 @@ if [[ ! -f "$APP/Contents/Resources/Icon-classic.icns" ]]; then
fi

# SwiftPM resource bundles (e.g. KeyboardShortcuts) are emitted next to the built binary.
PREFERRED_BUILD_DIR="$(dirname "$(build_product_path "CodexBar" "${ARCH_LIST[0]}")")"
CODEXBAR_BINARY="$(resolve_binary_path "CodexBar" "${ARCH_LIST[0]}")"
PREFERRED_BUILD_DIR="$(dirname "${CODEXBAR_BINARY:-$(build_product_path "CodexBar" "${ARCH_LIST[0]}")}")"
shopt -s nullglob
SWIFTPM_BUNDLES=("${PREFERRED_BUILD_DIR}/"*.bundle)
shopt -u nullglob
Expand Down
Loading