Summary
Add Perch CLI commands for controlling the native macOS menu bar app and launch-at-login behavior.
Today the Swift menu bar app already has LaunchAtLoginManager, and install.sh can opportunistically open a locally available app, but the published perch CLI only supports session management (add/list/done/reopen/doctor). Users should be able to manage the menu bar app from terminal scripts as well.
Proposed CLI
perch menubar start [--app-path <path>]
perch menubar stop
perch menubar status
perch menubar login enable [--app-path <path>]
perch menubar login disable
perch menubar login status
Behavior
perch menubar start
- Locate a local
PerchApp executable and launch it.
- Candidate locations, in order:
- explicit
--app-path
/Applications/Perch.app
- repo/dev builds such as
App/.build/arm64-apple-macosx/release/PerchApp
- repo/dev builds such as
App/.build/arm64-apple-macosx/debug/PerchApp
- If already running, exit successfully and print the existing PID.
- If no app is found, exit non-zero with a clear message explaining that the current CLI release does not install
PerchApp yet.
perch menubar stop
- Stop the native menu bar app, e.g. by finding/killing
PerchApp.
- Exit successfully if it is already stopped.
perch menubar status
- Print whether the menu bar app is running.
- Include PID(s) when running.
- Optional future:
--json.
perch menubar login enable
- Create/update
~/Library/LaunchAgents/com.resciencelab.perch.plist using the selected PerchApp executable path.
- Run the equivalent of:
launchctl bootout gui/$UID <plist> best-effort
launchctl bootstrap gui/$UID <plist>
launchctl enable gui/$UID/com.resciencelab.perch
- Validate the executable exists and is executable before writing the plist.
perch menubar login disable
launchctl bootout gui/$UID ~/Library/LaunchAgents/com.resciencelab.perch.plist best-effort.
- Remove
~/Library/LaunchAgents/com.resciencelab.perch.plist.
- Exit successfully if already disabled.
perch menubar login status
- Report whether the LaunchAgent plist exists.
- Ideally also report the configured executable path.
Non-goals
- Do not bundle or install
PerchApp in this issue.
- Do not add signing/notarization/DMG packaging.
- Do not change session storage or Raycast behavior.
Implementation Notes
- The Swift app already has equivalent behavior in
App/Sources/PerchAppCore/LaunchAtLoginManager.swift; mirror this behavior in Rust CLI to avoid requiring the app to be running.
- Keep this macOS-only. On unsupported platforms, return a clear error.
- Consider adding a small
cli/src/menubar.rs module.
Acceptance Criteria
Summary
Add Perch CLI commands for controlling the native macOS menu bar app and launch-at-login behavior.
Today the Swift menu bar app already has
LaunchAtLoginManager, andinstall.shcan opportunistically open a locally available app, but the publishedperchCLI only supports session management (add/list/done/reopen/doctor). Users should be able to manage the menu bar app from terminal scripts as well.Proposed CLI
Behavior
perch menubar startPerchAppexecutable and launch it.--app-path/Applications/Perch.appApp/.build/arm64-apple-macosx/release/PerchAppApp/.build/arm64-apple-macosx/debug/PerchAppPerchAppyet.perch menubar stopPerchApp.perch menubar status--json.perch menubar login enable~/Library/LaunchAgents/com.resciencelab.perch.plistusing the selectedPerchAppexecutable path.launchctl bootout gui/$UID <plist>best-effortlaunchctl bootstrap gui/$UID <plist>launchctl enable gui/$UID/com.resciencelab.perchperch menubar login disablelaunchctl bootout gui/$UID ~/Library/LaunchAgents/com.resciencelab.perch.plistbest-effort.~/Library/LaunchAgents/com.resciencelab.perch.plist.perch menubar login statusNon-goals
PerchAppin this issue.Implementation Notes
App/Sources/PerchAppCore/LaunchAtLoginManager.swift; mirror this behavior in Rust CLI to avoid requiring the app to be running.cli/src/menubar.rsmodule.Acceptance Criteria
perch menubar startstarts a local dev/releasePerchAppwhen available.perch menubar start --app-path <path>starts the explicit executable path.perch menubar startgives actionable error when no app is found.perch menubar stopstops the app and is idempotent.perch menubar statusreports running/stopped state.perch menubar login enable --app-path <path>writes a valid LaunchAgent plist and bootstraps it.perch menubar login disableremoves/unloads the LaunchAgent and is idempotent.perch menubar login statusreports enabled/disabled state.PerchAppautomatically.