Lines 35-75javascript
35import { resolveTarget } from '../target.js';
36import { CLAUDE_CODE_OWNED_ENV_KEYS, buildClaudeCodeEnv, } from '../tools/claudeCodeEnv.js';
37import { buildHookCommand, buildHookEntry, removeAnyrayHookEntries, } from '../tools/claudeCodeHooks.js';
38import { HOOK_FLAG, PROMPT_HOOK_FLAG, hookBinaryIsDurable, hookBinaryPath, } from '../tools/sharedHooks.js';
39import { parseSsoLink } from '../util/ssoEnroll.js';
40import { buildFleetBootstrap, fleetBootstrapPath, } from '../util/fleetBootstrap.js';
41import { buildPlist, buildSystemdUnit, DEFAULT_LOOPBACK_PORT, PROXY_FLAG, } from '../util/proxyService.js';
42import { ACP_AGENT_FLAG, CLAUDE_ACP_NAME, CODEX_ACP_NAME, isSafeNpxCommand, } from '../tools/acpAgents.js';
43import { shSingleQuote } from '../tools/shellEnv.js';
44import { metadataHeaderValue } from '../types.js';
45import { bold, dim, fail, info, ok, warn } from '../util/log.js';
46const MANAGED_HELP = `${bold('anyray-connect managed')} — fleet-wide Claude Code routing via managed-settings.json
48Emit or install the OS \`managed-settings.json\` that points a managed fleet's
49Claude Code at the Anyray gateway. It reads at a HIGHER precedence than a user's
50\`~/.claude/settings.json\`, so it survives users editing or wiping their own
51settings. The managed file removes per-dev routing edits, but no credential is
52ever written to it: each user still needs one enrollment/bootstrap so the
53gateway can attribute and authenticate their requests.
55${bold('Modes')} (pick one)
56 --print Emit the managed-settings JSON to stdout for MDM packaging
57 (Jamf profile, Ansible template, etc.). Writes nothing unless
HighTrigger Reachable Persistence
A manifest entrypoint or package-local install chain reaches persistence behavior.
dist/commands/managed.jsView on unpkg · L55 MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/commands/managed.jsView on unpkg · L55 59 --write Write it to the OS system path (merging into any existing file,
60 preserving non-Anyray keys). Requires root (sudo).
61 --revert Remove only the Anyray-owned keys from the system file.
64 --tool <id> Which fleet artifact to emit (default claude-code):
65 claude-code the managed-settings.json described above
66 jetbrains acp.json registering the Anyray ACP agents
67 (--print only; needs --bin and --npx; takes
68 no gateway/attribution — everything resolves
69 from each user's own enrollment at launch)
70 shell /etc/profile.d snippet exporting the gateway
71 base URLs only (--print only; never a key)
72 bootstrap content-free fleet bootstrap file carrying
73 the org SSO link (--print only; needs --sso;
74 read by deferred-enrollment surfaces on
75 machines whose dev never ran Connect)