Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

chore(rotation): strip OS package paths and keep reauth env portable

auroracapital8d6ec7b48f31
diff --git a/claude-ops/scripts/account-rotation/__tests__/reauth-env.test.mjs b/claude-ops/scripts/account-rotation/__tests__/reauth-env.test.mjs
index 8ba8b437..6635e1e3 100644
--- a/claude-ops/scripts/account-rotation/__tests__/reauth-env.test.mjs
+++ b/claude-ops/scripts/account-rotation/__tests__/reauth-env.test.mjs
@@ -21,10 +21,16 @@ assert(
'CLAUDE_DESKTOP_DISPLAY over DISPLAY',
);
-// path includes home .local/bin when HOME set
+// path includes home .local/bin when HOME set; never injects OS package roots
const p = resolveReauthPath({ HOME: '/tmp/fakehome', PATH: '/usr/bin' });
assert(p.includes('/tmp/fakehome/.local/bin'), 'local bin first');
assert(p.includes('/usr/bin'), 'keeps system path');
+assert(!p.includes('homebrew'), 'no homebrew hardcode');
+assert(!p.includes('/Users/'), 'no mac home hardcode');
+const pEmpty = resolveReauthPath({ HOME: '/tmp/fakehome', PATH: '' });
+// empty PATH falls back to minimal POSIX bins only
+assert(!pEmpty.includes('homebrew'), 'fallback has no homebrew');
+assert(pEmpty.includes('/usr/bin') || pEmpty.includes('.local'), 'fallback usable');
// child env
const env = buildReauthChildEnv({
diff --git a/claude-ops/scripts/account-rotation/reauth-env.mjs b/claude-ops/scripts/account-rotation/reauth-env.mjs
index 90266e3a..1e74f03f 100644
--- a/claude-ops/scripts/account-rotation/reauth-env.mjs
+++ b/claude-ops/scripts/account-rotation/reauth-env.mjs
@@ -19,22 +19,25 @@ export function resolveReauthDisplay(env = process.env) {
}
/**
- * Build PATH with optional user local bin, without hardcoding a home directory.
+ * Build PATH with optional user-local bin. No OS package-manager roots
+ * (Homebrew, Chocolatey, etc.). Prefer process PATH; fall back to a minimal
+ * POSIX list only when PATH is unset (common in stripped service units).
*/
export function resolveReauthPath(env = process.env) {
- const home = env.HOME || homedir();
+ const home = env.HOME || env.USERPROFILE || homedir();
+ const isWin = process.platform === 'win32' || /^(msys|cygwin)/i.test(String(env.OSTYPE || ''));
+ const sep = isWin || String(env.PATH || '').includes(';') ? ';' : ':';
const localBin = home ? join(home, '.local', 'bin') : '';
- const base = env.PATH || '/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin';
+ const base = env.PATH || (isWin ? '' : ['/usr/local/bin', '/usr/bin', '/bin'].join(sep));
const parts = [localBin, base].filter(Boolean);
- // de-dupe while preserving order
const seen = new Set();
const out = [];
- for (const chunk of parts.join(':').split(':')) {
+ for (const chunk of parts.join(sep).split(sep)) {
if (!chunk || seen.has(chunk)) continue;
seen.add(chunk);
out.push(chunk);
}
- return out.join(':');
+ return out.join(sep);
}
/**
diff --git a/claude-ops/scripts/install-crs-reconcilers-agent.sh b/claude-ops/scripts/install-crs-reconcilers-agent.sh
index 1c864ba5..deb43689 100755
--- a/claude-ops/scripts/install-crs-reconcilers-agent.sh
+++ b/claude-ops/scripts/install-crs-reconcilers-agent.sh
@@ -65,9 +65,13 @@ render_and_install() {
local name="$1" wrapper="$2" template="$3"
local dest="$HOME/Library/LaunchAgents/com.claude-ops.${name}.plist"
chmod +x "$wrapper" 2>/dev/null || true
+ # PATH/DISPLAY come from the install host (never bake OS package roots into the template).
+ local host_path="${PATH:-/usr/local/bin:/usr/bin:/bin}"
+ local host_display="${CLAUDE_DESKTOP_DISPLAY:-${DISPLAY:-:0}}"
PLIST_TEMPLATE_PATH="$template" WRAPPER_PATH="$wrapper" LOG_DIR_PATH="$LOG_DIR" CRS_HOME="$HOME" \
+ CRS_PATH="$host_path" CRS_DISPLAY="$host_display" \
node -e \
- 'const fs=require("fs");const e=(s)=>String(s??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const t=fs.readFileSync(process.env.PLIST_TEMPLATE_PATH,"utf8");process.stdout.write(t.replace(/__WRAPPER_PATH__/g,e(process.env.WRAPPER_PATH)).replace(/__LOG_DIR__/g,e(process.env.LOG_DIR_PATH)).replace(/__HOME__/g,e(process.env.CRS_HOME)));' \
+ 'const fs=require("fs");const e=(s)=>String(s??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const t=fs.readFileSync(process.env.PLIST_TEMPLATE_PATH,"utf8");process.stdout.write(t.replace(/__WRAPPER_PATH__/g,e(process.env.WRAPPER_PATH)).replace(/__LOG_DIR__/g,e(process.env.LOG_DIR_PATH)).replace(/__HOME__/g,e(process.env.CRS_HOME)).replace(/__PATH__/g,e(process.env.CRS_PATH||"")).replace(/__DISPLAY__/g,e(process.env.CRS_DISPLAY||":0")));' \
> "$dest"
launchctl bootout "gui/$(id -u)/com.claude-ops.${name}" 2>/dev/null || true
launchctl bootstrap "gui/$(id -u)" "$dest"
diff --git a/claude-ops/templates/com.claude-ops.magic-link-autoloop.plist b/claude-ops/templates/com.claude-ops.magic-link-autoloop.plist
index fc5e91ca..a571d758 100644
--- a/claude-ops/templates/com.claude-ops.magic-link-autoloop.plist
+++ b/claude-ops/templates/com.claude-ops.magic-link-autoloop.plist
@@ -5,8 +5,9 @@
Schedule: every 600s. Equivalent systemd: OnUnitActiveSec=600s.
The installer (scripts/install-crs-reconcilers-agent.sh) substitutes
- __WRAPPER_PATH__, __LOG_DIR__, __HOME__ and writes the rendered copy to
- ~/Library/LaunchAgents/com.claude-ops.magic-link-autoloop.plist before:
+ __WRAPPER_PATH__, __LOG_DIR__, __HOME__, __PATH__, __DISPLAY__ from the
+ host environment (no hardcoded package-manager paths in the template) and
+ writes the rendered copy to ~/Library/LaunchAgents/ before:
launchctl bootstrap "gui/$(id -u)" <plist>
To uninstall:
@@ -41,8 +42,9 @@
<key>EnvironmentVariables</key>
<dict>
+ <!-- Installer should expand PATH from the host; keep template free of OS package roots. -->
<key>PATH</key>
- <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
+ <string>__PATH__</string>
<key>HOME</key>
<string>__HOME__</string>
<key>NODE_NO_WARNINGS</key>
@@ -51,9 +53,9 @@
<key>CLAUDE_ROT_HEADED</key>
<string>1</string>
<key>CLAUDE_DESKTOP_DISPLAY</key>
- <string>:1</string>
+ <string>__DISPLAY__</string>
<key>DESKTOP_ACT_DISPLAY</key>
- <string>:1</string>
+ <string>__DISPLAY__</string>
<key>CLAUDE_ROT_VISUAL_CAPTCHA</key>
<string>1</string>
<key>CLAUDE_ROT_DESKTOP_ACT</key>