1// Writes a new project's agent config files — AGENTS.md, CLAUDE.md (an import of it),2// .gemini/settings.json. The AGENTS.md text is the file beside this one, `install/AGENTS.md`,3// with {{SKILL}} (the installed skill folder's name) and {{STACK}} filled in. It keeps the CLI's4// shape (the CLI commands pointer `wix create` writes) and says what the CLI's cannot: which skills5// this project carries, where, how to restore them, and the one rule about Wix calls.6// `wix create` writes its own set only when @wix/cli resolves from the project's node_modules at7// scaffold time; setup scaffolds with --skip-install and attach never runs the CLI scaffold,8// so we write them. Fill-only: a file that exists is left alone.9import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";10import { dirname, join } from "node:path";
19export function writeAgentsMd(projectDir, vars) {
20 const written = [], kept = [];
21 const agents = join(projectDir, "AGENTS.md");
22 if (existsSync(agents)) kept.push("AGENTS.md");
23 else {
24 // {{MIGRATION}} is a paragraph on a migration preview (vars.migration = { parentSiteId, deploySiteId }), else nothing.
25 const migration = vars.migration
26 ? `\n\n**Under migration.** \`wix.config.json\` names site ${vars.migration.deploySiteId}, which only hosts this deployment; the site being migrated is ${vars.migration.parentSiteId} — its content is what the pages show and its dashboard (\`https://manage.wix.com/dashboard/${vars.migration.parentSiteId}\`) is where the business is managed. \`.env.local\` (\`wix env pull\`) carries that site's app: the SDK client and every admin, discovery and seed call run against it; only \`wix release\` goes to the deploy site. Completing the migration, once the user approves the preview, follows \`.agents/skills/${vars.skill}/guides/migration.md\`.`