Skip to content

Allow the menu-bar app to run an operator startup script - #20

Open
lalalic wants to merge 1 commit into
alexanderradahl:mainfrom
lalalic:feat/runtime-start-script
Open

lalalic wants to merge 1 commit into
alexanderradahl:mainfrom
lalalic:feat/runtime-start-script

Conversation

@lalalic

@lalalic lalalic commented Sep 20, 2026

Copy link
Copy Markdown

Why

MacDevBridge.app can be the responsible macOS application for local automation processes it launches. In a local validation on current macOS, descendants launched through a shell inherited the parent app's privacy grants; the same held through a daemonized PM2 process. That makes it useful to let operators start their own long-lived local runtime under the menu-bar app rather than granting broad permissions separately to generic executables such as node, shells, or individual worker CLIs.

What this PR does

  • Adds an opt-in MAC_DEV_BRIDGE_RUNTIME_START_SCRIPT setting.
  • When configured, the menu-bar app runs /bin/zsh <script> once when the app launches.
  • The script receives the same child environment used by the bridge transport.
  • stdout/stderr go to runtime-start.log.
  • The hook is deliberately separate from Bridge Start/Stop, so operator services are not killed when the HTTP transport is stopped.
  • Nothing runs by default; the hook has no effect unless the environment variable points to an existing script.

A concrete use case is starting a process supervisor such as PM2 from the app, then having PM2 own Relay/worker services. The PR intentionally does not hardcode PM2 or any service into MacDevBridge.

Validation

  • swiftc -typecheck menubar/MenuBarApp.swift -framework AppKit
  • git diff --check

The fork-specific deployment additionally verified the startup hook by restarting the menu-bar app, recreating the PM2 daemon from that app-launched script, and observing the configured services return online.

@lalalic

lalalic commented Sep 20, 2026

Copy link
Copy Markdown
Author

Agents Relay job: Allow the menu-bar app to run an operator startup script

State: OPEN
PR: #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant