MCPcopy Create free account
hub / github.com/tiann/hapi / maybeAutoStartServer

Function maybeAutoStartServer

cli/src/utils/autoStartServer.ts:145–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 * Main entry point: auto-start hub if conditions are met
144 */
145export async function maybeAutoStartServer(): Promise<void> {
146 try {
147 const shouldStart = await shouldAutoStartServer()
148 if (!shouldStart) {
149 return
150 }
151
152 logger.debug('[AUTO-START] Starting hub automatically...')
153 console.log(chalk.gray('Starting HAPI hub in background...'))
154
155 startServerAsChild()
156
157 const isReady = await waitForServerReady(configuration.apiUrl)
158
159 if (!isReady) {
160 console.log(chalk.yellow('Warning: Hub did not start within expected time'))
161 console.log(chalk.gray(' Try running `hapi hub` manually to see errors'))
162 return
163 }
164
165 console.log(chalk.green('HAPI hub started'))
166 } catch (error) {
167 logger.debug('[AUTO-START] Error during hub auto-start', error)
168 console.log(chalk.yellow('Warning: Failed to auto-start hub'))
169 if (error instanceof Error) {
170 console.log(chalk.gray(` Error: ${error.message}`))
171 }
172 }
173}

Callers 7

resume.tsFile · 0.90
claude.tsFile · 0.90
codex.tsFile · 0.90
opencode.tsFile · 0.90
gemini.tsFile · 0.90
kimi.tsFile · 0.90
cursor.tsFile · 0.90

Calls 4

shouldAutoStartServerFunction · 0.85
startServerAsChildFunction · 0.85
waitForServerReadyFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected