import { d as defineCommand, b as legacyRootDirArgs, c as cwdArgs } from '../shared/nuxi.C0YEEVs2.mjs';
import { l as loadKit } from '../shared/nuxi.BiWTNJI4.mjs';
import { c as cleanupNuxtDirs } from '../shared/nuxi.DQbQuzNE.mjs';
import { r as resolve } from '../shared/nuxi.Do0aYBCO.mjs';
import 'node:crypto';
import 'node:path';
import 'node:process';
import '../shared/nuxi.DQjfoGl0.mjs';
import 'node:util';
import 'node:tty';
import 'node:url';
import '../shared/nuxi.BLb4POFS.mjs';
import 'node:fs';
import 'node:assert';
import 'node:v8';
import '../shared/nuxi.CrvQqJcE.mjs';

const cleanup = defineCommand({
  meta: {
    name: "cleanup",
    description: "Clean up generated Nuxt files and caches"
  },
  args: {
    ...cwdArgs,
    ...legacyRootDirArgs
  },
  async run(ctx) {
    const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
    const { loadNuxtConfig } = await loadKit(cwd);
    const nuxtOptions = await loadNuxtConfig({ cwd, overrides: { dev: true } });
    await cleanupNuxtDirs(nuxtOptions.rootDir, nuxtOptions.buildDir);
  }
});

export { cleanup as default };
