(cmd: Command, options: { defaultOpen: boolean })
| 105 | |
| 106 | /** Build the `run` subcommand, mounted under a parent (`server` or top-level). */ |
| 107 | export function buildRunCommand(cmd: Command, options: { defaultOpen: boolean }): Command { |
| 108 | return cmd |
| 109 | .option( |
| 110 | '--port <port>', |
| 111 | `Bind port (default ${DEFAULT_SERVER_PORT})`, |
| 112 | String(DEFAULT_SERVER_PORT), |
| 113 | ) |
| 114 | .option( |
| 115 | '--host [host]', |
| 116 | `Bind host. Omit to bind ${DEFAULT_SERVER_HOST} (this machine only); pass --host to bind ${DEFAULT_LAN_HOST} (all interfaces), or --host <host> for a specific host. The bearer token is printed at startup.`, |
| 117 | ) |
| 118 | .option( |
| 119 | '--allowed-host <host...>', |
| 120 | 'Extra Host header value to allow through the DNS-rebinding check. Repeat or comma-separate; a leading dot matches a domain suffix (e.g. .example.com).', |
| 121 | ) |
| 122 | .option( |
| 123 | '--insecure-no-tls', |
| 124 | 'Allow a non-loopback bind without a TLS-terminating reverse proxy. Defaults to true; only relevant for non-loopback binds.', |
| 125 | true, |
| 126 | ) |
| 127 | .option( |
| 128 | '--allow-remote-shutdown', |
| 129 | 'On a non-loopback bind, keep POST /api/v1/shutdown enabled (default: route is disabled → 404).', |
| 130 | false, |
| 131 | ) |
| 132 | .option( |
| 133 | '--allow-remote-terminals', |
| 134 | 'On a non-loopback bind, keep the PTY /api/v1/terminals/* routes enabled (default: disabled → 404). Remote shell is high risk.', |
| 135 | false, |
| 136 | ) |
| 137 | .option( |
| 138 | '--log-level <level>', |
| 139 | `Server log level: ${VALID_LOG_LEVELS.join('|')}. Omit to keep logs off.`, |
| 140 | ) |
| 141 | .option( |
| 142 | '--debug-endpoints', |
| 143 | 'Mount /api/v1/debug/* routes for test introspection. OFF by default; production callers leave this unset.', |
| 144 | false, |
| 145 | ) |
| 146 | .option( |
| 147 | '--foreground', |
| 148 | 'Run the server in the foreground and keep this terminal attached until SIGINT/SIGTERM (do not daemonize).', |
| 149 | false, |
| 150 | ) |
| 151 | .option( |
| 152 | options.defaultOpen ? '--no-open' : '--open', |
| 153 | options.defaultOpen |
| 154 | ? 'Do not open the web UI in the default browser.' |
| 155 | : 'Open the web UI in the default browser once the server is healthy.', |
| 156 | options.defaultOpen, |
| 157 | ) |
| 158 | .addOption( |
| 159 | new Option('--daemon', 'Run as an idle-exiting background daemon (internal).').hideHelp(), |
| 160 | ) |
| 161 | .addOption( |
| 162 | new Option( |
| 163 | '--idle-grace-ms <ms>', |
| 164 | 'Idle-shutdown grace in ms (daemon mode, internal).', |
no test coverage detected