/**
 * Spark subcommands the `spark` tool is willing to run.
 * Anything not on this list is rejected so the agent cannot pass arbitrary
 * spark commands (e.g. `spark make:migration` with a bad path, destructive
 * migrations without confirm, etc.).
 */
export const SPARK_ALLOWED = [
  'make:controller',
  'make:model',
  'make:entity',
  'make:filter',
  'make:command',
  'make:validation',
  'make:migration',
  'make:seeder',
  'make:test',
  'make:config',
  'migrate',
  'migrate:rollback',
  'migrate:refresh',
  'migrate:status',
  'db:seed',
  'routes',
  'cache:clear',
  'optimize',
  'list',
  'about',
] as const;

export type SparkCommand = (typeof SPARK_ALLOWED)[number];

export const SPARK_DESTRUCTIVE = new Set<string>(['migrate:refresh']);

export function isAllowedSparkCommand(command: string): command is SparkCommand {
  return (SPARK_ALLOWED as readonly string[]).includes(command);
}
