import { createProgram } from './cli/index.js'; import { maybeNotifyUpdate } from './cli/commands/update.js'; const argv = process.argv.slice(2); if (!argv.includes('update') && !argv.includes('server') && !argv.includes('mcp')) { maybeNotifyUpdate(); } const program = createProgram(process.cwd()); program.parseAsync().catch((err: unknown) => { const message = err instanceof Error ? err.message : String(err); if (message.startsWith('AgentHub not initialized')) { console.error( 'No AgentHub project here. Run `agenthub init`, or connect to a running server ' + 'with `agenthub init --server auto` (or set AGENTHUB_SERVER=http://:3377).', ); } else if (message.startsWith('File not found')) { console.error('Not found. Check the ID — or you may be pointed at the wrong server.'); } else { console.error(`Error: ${message}`); } process.exit(1); });