import type { UniDeskConfig } from "./config";
import type { RenderedCliResult } from "./output";
import { runFrontendAuthCommand } from "./frontend-auth";

export async function runFrontendCommand(config: UniDeskConfig, args: string[]): Promise<Record<string, unknown> | RenderedCliResult> {
  const [scope = "auth"] = args;
  if (scope === "auth") return await runFrontendAuthCommand(config, args.slice(1));
  return {
    ok: false,
    error: "unsupported-frontend-command",
    command: "frontend",
    supportedScopes: ["auth"],
    examples: [
      "bun scripts/cli.ts frontend auth plan",
      "bun scripts/cli.ts frontend auth apply --confirm",
    ],
  };
}
