./run install now also builds the Prospector.app menu-bar tray (~/Applications: ❖ Open/Stop/Quit, AppleScript-ObjC + sips/iconutil, no Swift/deps) and registers the prospector MCP in Claude (Desktop + global, non-invasive). New ./run stop and ./run tray; SKIP_DB/SKIP_TRAY/SKIP_MCP escape hatches. app.sh: --detach (background, for the tray), reuse an already-running instance instead of colliding, fail loudly if a process we started dies, pidfile in .run/. Fix the local front door: a prod build calls /prospector/* (api.ts API_BASE), so vite preview now proxies /prospector (passthrough) while dev keeps /api (rewrite), both injecting the bearer token. find_psql handles keg-only postgresql@N. Verified end-to-end: ./run install (deps/env/DB+5 migrations/build/tray/MCP), ./run app serves markets through the token proxy (200; 401 without token), tray launches resident, web tsc + 160 backend tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
2.2 KiB
AppleScript
58 lines
2.2 KiB
AppleScript
-- Prospector menu-bar (tray) app. Run via osascript by the app bundle's stub,
|
|
-- which passes the bundle Resources dir as the first argument. Creates a status
|
|
-- item with a small menu (Open / Stop / Quit) and keeps the run loop alive.
|
|
use framework "Foundation"
|
|
use framework "AppKit"
|
|
use scripting additions
|
|
|
|
property statusItem : missing value
|
|
property resourcesDir : ""
|
|
|
|
on run argv
|
|
set resourcesDir to (item 1 of argv) as text
|
|
set theApp to current application's NSApplication's sharedApplication()
|
|
theApp's setActivationPolicy:(current application's NSApplicationActivationPolicyAccessory)
|
|
|
|
set bar to current application's NSStatusBar's systemStatusBar()
|
|
set statusItem to bar's statusItemWithLength:(current application's NSVariableStatusItemLength)
|
|
set iconFile to resourcesDir & "/tray.png"
|
|
set img to current application's NSImage's alloc()'s initWithContentsOfFile:iconFile
|
|
if img is not missing value then
|
|
img's setTemplate:false
|
|
(statusItem's button()'s setImage:img)
|
|
else
|
|
(statusItem's button()'s setTitle:"❖")
|
|
end if
|
|
(statusItem's button()'s setToolTip:"Prospector")
|
|
|
|
set theMenu to current application's NSMenu's alloc()'s initWithTitle:"Prospector"
|
|
|
|
set openItem to current application's NSMenuItem's alloc()'s initWithTitle:"Open Prospector" action:"openProspector:" keyEquivalent:""
|
|
openItem's setTarget:me
|
|
theMenu's addItem:openItem
|
|
|
|
theMenu's addItem:(current application's NSMenuItem's separatorItem())
|
|
|
|
set stopItem to current application's NSMenuItem's alloc()'s initWithTitle:"Stop services" action:"stopServices:" keyEquivalent:""
|
|
stopItem's setTarget:me
|
|
theMenu's addItem:stopItem
|
|
|
|
set quitItem to current application's NSMenuItem's alloc()'s initWithTitle:"Quit Prospector" action:"quitTray:" keyEquivalent:"q"
|
|
quitItem's setTarget:me
|
|
theMenu's addItem:quitItem
|
|
|
|
statusItem's setMenu:theMenu
|
|
theApp's |run|()
|
|
end run
|
|
|
|
on openProspector:sender
|
|
do shell script "/bin/bash " & quoted form of (resourcesDir & "/launch.sh") & " > /dev/null 2>&1 &"
|
|
end openProspector:
|
|
|
|
on stopServices:sender
|
|
do shell script "/bin/bash " & quoted form of (resourcesDir & "/stop.sh") & " > /dev/null 2>&1"
|
|
end stopServices:
|
|
|
|
on quitTray:sender
|
|
current application's NSApplication's sharedApplication()'s terminate:me
|
|
end quitTray:
|