import { i as defineEventHandler, e as createError, O as resolveLogPath } from '../../nitro/nitro.mjs';
import * as fs from 'node:fs';
import 'node:path';
import 'node:module';
import 'node:os';
import 'dotenv';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:crypto';
import 'node:async_hooks';
import 'node:url';
import 'node:net';
import '@iconify/utils';
import 'consola';

const logs_delete = defineEventHandler(() => {
  const cwd = process.env.AIDEV_CWD;
  if (!cwd) {
    throw createError({ statusCode: 500, statusMessage: "AIDEV_CWD not set" });
  }
  const file = resolveLogPath(cwd);
  if (!fs.existsSync(file)) {
    return { path: file, exists: false, cleared: false };
  }
  fs.truncateSync(file, 0);
  return { path: file, exists: true, cleared: true };
});

export { logs_delete as default };
//# sourceMappingURL=logs.delete.mjs.map
