import { ALLOWED_COMMANDS } from "@tasks/shared/worker"; export function isAllowedCommand( command: string, allowedCommands?: readonly string[] | null, ): boolean { const allowList = allowedCommands === undefined || allowedCommands === null ? ALLOWED_COMMANDS : allowedCommands; if (allowList.length === 0) return false; const normalized = command.trim().replace(/\s+/g, " "); return allowList.some((allowed) => normalized === allowed || normalized.startsWith(`${allowed} `)); }