agenthub update: fetch + reset install to origin/<branch> + reinstall + rebuild, so users never touch git or pnpm. Robust to a dirty working tree (the 'commit before pull' wall) by resetting to remote; guards unpushed local commits and refuses to discard them. Adds a daily, non-blocking update hint on startup (detached background fetch + instant local comparison, like gh/npm/brew) that never auto-applies. Tests for the non-git-install path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
881 B
TypeScript
25 lines
881 B
TypeScript
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')) {
|
|
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://<host>: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);
|
|
});
|