// hooks/after.ts
import { readFile, rename, writeFile } from "node:fs/promises";
import { join } from "node:path";
async function cleanupReadme(cwd) {
  const content = await readFile(join(cwd, "README.md"), "utf8");
  await writeFile(
    join(cwd, "README.md"),
    content.replaceAll(/<!--bati:.*-->/g, "").replaceAll(/\n\n+/g, "\n\n").trimStart(),
    "utf-8"
  );
}
async function renameGitIgnore(cwd) {
  await rename(join(cwd, "gitignore"), join(cwd, ".gitignore"));
}
async function onafter(cwd, _meta) {
  await cleanupReadme(cwd);
  await renameGitIgnore(cwd);
}
export {
  onafter as default
};
