#!/usr/bin/env node

const required = [
  'DISCORD_BOT_TOKEN',
  'DISCORD_APPLICATION_ID',
  'DISCORD_GUILD_ID',
  'DISCORD_AGENT_CHANNEL_ID',
  'DISCORD_ALLOWED_USER_IDS',
  'HERMES_COMMAND',
]

const commands = [
  '/hermes status',
  '/hermes inbox',
  '/hermes summarize',
  '/hermes triage issue:<linearIssueId>',
  '/hermes apply decision:<decisionId>',
]

function check() {
  const missing = required.filter((name) => !process.env[name])

  console.log('Hermes Discord Control Channel')
  console.log('')
  console.log('Expected command surface:')
  for (const command of commands) {
    console.log(`- ${command}`)
  }
  console.log('')

  if (missing.length > 0) {
    console.error('Missing required environment variables:')
    for (const name of missing) {
      console.error(`- ${name}`)
    }
    process.exitCode = 1
    return
  }

  console.log('Environment shape looks ready.')
  console.log('Next step: register slash commands and keep the bot restricted to the configured channel.')
}

const command = process.argv[2] || 'check'

if (command !== 'check') {
  console.error(`Unknown command: ${command}`)
  console.error('Usage: node scripts/hermes-discord-control-channel.mjs check')
  process.exit(1)
}

check()
