#!/usr/bin/env node

import { Command } from 'commander';
import packageJson from '../package.json';

import { registerConfigure } from './commands/configure';
import { registerRegisterAgent } from './commands/register-agent';
import { registerListAgents } from './commands/list-agents';
import { registerIssueToken } from './commands/issue-token';
import { registerRotateCredentials } from './commands/rotate-credentials';
import { registerTailAuditLog } from './commands/tail-audit-log';
import { registerCompletion } from './commands/completion';
import { registerScaffold } from './commands/scaffold';

const program = new Command();

program
  .name('sentryagent')
  .description('SentryAgent.ai CLI — manage agents, tokens, and audit logs')
  .version(packageJson.version, '-v, --version', 'Output the current version');

// Register all commands
registerConfigure(program);
registerRegisterAgent(program);
registerListAgents(program);
registerIssueToken(program);
registerRotateCredentials(program);
registerTailAuditLog(program);
registerCompletion(program);
registerScaffold(program);

// Parse args — commander will display help automatically on --help
program.parse(process.argv);
