#!/usr/bin/env bun import { Command } from 'commander' import pkg from '../../../package.json' with { type: 'json' } import { authCommand, channelCommand, fileCommand, messageCommand, reactionCommand, userCommand, whoamiCommand, } from './commands/index' const program = new Command() program .name('agent-slackbot') .description('CLI tool for Slack bot integration using bot tokens (xoxb-)') .version(pkg.version) .option('--pretty', 'Pretty-print JSON output') .option('--bot ', 'Use specific bot (default: current)') .hook('preAction', (thisCmd, actionCmd) => { for (const [key, value] of Object.entries(thisCmd.opts())) { if (value === undefined) continue const source = actionCmd.getOptionValueSource(key) if (source === undefined || source === 'default') { actionCmd.setOptionValue(key, value) } } }) program.addCommand(authCommand) program.addCommand(whoamiCommand) program.addCommand(messageCommand) program.addCommand(channelCommand) program.addCommand(userCommand) program.addCommand(reactionCommand) program.addCommand(fileCommand) program.parseAsync(process.argv) export default program