/**
 * Core slash command definitions — single source of truth.
 * Imported by both web (command-registry.ts) and API (CommandRegistry startup).
 * F142 Phase B: surface + source fields on every entry.
 */
import type { SlashCommandDefinition } from './types/command.js';

export const CORE_COMMANDS: readonly SlashCommandDefinition[] = [
  // --- general ---
  {
    name: '/help',
    usage: '/help',
    description: '打开功能速查面板',
    category: 'general',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/config',
    usage: '/config',
    description: '打开系统配置面板',
    category: 'general',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/config set',
    usage: '/config set <key> <value>',
    description: '热更新运行时配置',
    category: 'general',
    surface: 'web',
    source: 'core',
  },
  // --- memory ---
  {
    name: '/remember',
    usage: '/remember <key> <value>',
    description: '保存对话记忆',
    category: 'memory',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/recall',
    usage: '/recall [key]',
    description: '查看对话记忆（无 key 列出全部）',
    category: 'memory',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/approve',
    usage: '/approve <entryId>',
    description: '审批待发布的记忆条目',
    category: 'memory',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/archive',
    usage: '/archive <entryId>',
    description: '归档已发布的记忆条目',
    category: 'memory',
    surface: 'web',
    source: 'core',
  },
  // --- knowledge ---
  {
    name: '/evidence',
    usage: '/evidence <query>',
    description: '搜索项目知识库（Hindsight）',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/reflect',
    usage: '/reflect <query>',
    description: 'AI 反思项目知识',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/signals',
    usage: '/signals [inbox]',
    description: '查看今日 Signal inbox',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/signals search',
    usage: '/signals search <query>',
    description: '搜索 Signal 文章',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/signals sources',
    usage: '/signals sources [sourceId on|off]',
    description: '查看/切换信源启用状态',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/signals stats',
    usage: '/signals stats',
    description: '查看 Signal 统计信息',
    category: 'knowledge',
    surface: 'web',
    source: 'core',
  },
  // --- task ---
  {
    name: '/tasks extract',
    usage: '/tasks extract [N]',
    description: '从对话中提取任务',
    category: 'task',
    surface: 'web',
    source: 'core',
  },
  // --- vote ---
  { name: '/vote', usage: '/vote', description: '打开投票配置面板', category: 'vote', surface: 'web', source: 'core' },
  {
    name: '/vote status',
    usage: '/vote status',
    description: '查看当前投票状态',
    category: 'vote',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/vote cast',
    usage: '/vote cast <选项>',
    description: '投票给指定选项',
    category: 'vote',
    surface: 'web',
    source: 'core',
  },
  {
    name: '/vote end',
    usage: '/vote end',
    description: '结束当前投票并显示结果',
    category: 'vote',
    surface: 'web',
    source: 'core',
  },
  // --- game (both surfaces) ---
  {
    name: '/game',
    usage: '/game werewolf [player|god-view] [voice]',
    description: '开始狼人杀游戏',
    category: 'game',
    surface: 'both',
    source: 'core',
  },
  // --- connector ---
  {
    name: '/commands',
    usage: '/commands',
    description: '列出当前可用的 slash 命令',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/where',
    usage: '/where',
    description: '查看当前绑定的 thread',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/new',
    usage: '/new [标题]',
    description: '创建新 thread 并切换',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/threads',
    usage: '/threads',
    description: '列出最近的 threads',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/use',
    usage: '/use <F号|序号|关键词>',
    description: '切换到指定 thread',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/thread',
    usage: '/thread <thread_id> <message>',
    description: '切换到指定 thread 并发送消息',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/cats',
    usage: '/cats',
    description: '查看当前 thread 的猫猫',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/status',
    usage: '/status',
    description: 'Thread 概览（标题、时间、参与猫）',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/history',
    usage: '/history [N]',
    description: '查看本线程最近 N 轮对话（默认 1，最多 5）',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/unbind',
    usage: '/unbind',
    description: '解除当前群组的 thread 绑定',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/allow-group',
    usage: '/allow-group',
    description: '允许当前群组使用 bot',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  {
    name: '/deny-group',
    usage: '/deny-group',
    description: '禁止当前群组使用 bot',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
  // --- routing (F154: Cat Routing Personalization) ---
  {
    name: '/focus',
    usage: '/focus [猫名|clear]',
    description: '查看/设置当前 thread 的首选猫',
    category: 'connector',
    surface: 'connector',
    source: 'core',
    subcommands: ['clear'],
  },
  {
    name: '/ask',
    usage: '/ask <猫名> <消息>',
    description: '单次定向：把这条消息发给指定猫，不改变首选猫设置',
    category: 'connector',
    surface: 'connector',
    source: 'core',
  },
] as const;
