generatesaas 3.42.0 → 3.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{Command as id}from"commander";import*as Cs from"@clack/prompts";import{ex
5
5
  `),R=[u!=="none"?` Payment: ${y.cyan(_t[u].label)} (${O})`:` Payment: ${y.dim("none")}`,` Credits: ${W?y.cyan("Yes"):y.dim("No")}`,` AI features: ${F?y.cyan("Yes"):y.dim("No")}`,...ve?[]:[` Web AI: ${y.dim("No")} (app-first)`],` Email: ${y.cyan(Ot[be].label)}`,` Observability: ${B.length===0?y.dim("none"):y.cyan(B.map(ar=>xt[ar].label).join(", "))}`,` Multi-tenancy: ${oe?y.cyan("Yes"):y.dim("No")}`,` Projects: ${Oe?y.cyan("Yes"):y.dim("No")}`,` Docs app: ${xe?y.cyan("Yes"):y.dim("No")}`,` Desktop app: ${we?y.cyan("Yes"):y.dim("No")}`,` Mobile app: ${v?y.cyan("Yes"):y.dim("No")}`,...L==="none"?[]:[` In-app purch.: ${y.cyan("RevenueCat")}`],` Rev. sharing: ${$?y.cyan("Yes"):y.dim("No")}`].join(`
6
6
  `),Ee=[y.bold("Project"),c,"",y.bold("Infrastructure"),d,"",y.bold("Features"),R];if(z.length>0){let ar=z.map(Xr=>{let Ls=T[Xr.key]?y.green("provided"):y.dim("skipped");return` ${Xr.key}: ${Ls}`}).join(`
7
7
  `);Ee.push("",y.bold("Credentials"),ar)}f.note(Ee.join(`
8
- `),"Summary");let qr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(qr)||!qr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as Sn,existsSync as Js}from"fs";import{mkdir as qs}from"fs/promises";import{join as Xs}from"path";import{Readable as Zs}from"stream";import{pipeline as Er}from"stream/promises";import{extract as Qs}from"tar";import{join as Me}from"path";import{homedir as Fs}from"os";var mr="https://cli.generatesaas.com",wt=process.env.GENERATESAAS_API_URL??mr,J=".generatesaas",ue=Me(J,"manifest.json"),mn="nextjs",hr="nuxt",fr="2.4.1",hn=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),fn=Me(J,"staging"),gn=Me(J,"staging.json"),me=Me(Fs(),".generatesaas");var M=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.42.0"}});if(!i.ok){let s,o;try{o=await i.json(),s=o.error??`API ${i.status}: ${t}`}catch{s=`API ${i.status}: ${t}`}throw new M(i.status,s,o)}return i}import{existsSync as Vs,mkdirSync as Bs,readFileSync as Gs,writeFileSync as Ks}from"fs";import{dirname as Hs}from"path";import*as Pe from"@clack/prompts";function vt(){if(!Vs(me))return null;try{let e=JSON.parse(Gs(me,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${me}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Ue(e){let t=process.env.GENERATESAAS_API_URL;t&&t.replace(/\/+$/,"")!==mr||(Bs(Hs(me),{recursive:!0}),Ks(me,`${JSON.stringify({apiKey:e},null," ")}
8
+ `),"Summary");let qr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(qr)||!qr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as Sn,existsSync as Js}from"fs";import{mkdir as qs}from"fs/promises";import{join as Xs}from"path";import{Readable as Zs}from"stream";import{pipeline as Er}from"stream/promises";import{extract as Qs}from"tar";import{join as Me}from"path";import{homedir as Fs}from"os";var mr="https://cli.generatesaas.com",wt=process.env.GENERATESAAS_API_URL??mr,J=".generatesaas",ue=Me(J,"manifest.json"),mn="nextjs",hr="nuxt",fr="2.4.1",hn=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),fn=Me(J,"staging"),gn=Me(J,"staging.json"),me=Me(Fs(),".generatesaas");var M=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.43.0"}});if(!i.ok){let s,o;try{o=await i.json(),s=o.error??`API ${i.status}: ${t}`}catch{s=`API ${i.status}: ${t}`}throw new M(i.status,s,o)}return i}import{existsSync as Vs,mkdirSync as Bs,readFileSync as Gs,writeFileSync as Ks}from"fs";import{dirname as Hs}from"path";import*as Pe from"@clack/prompts";function vt(){if(!Vs(me))return null;try{let e=JSON.parse(Gs(me,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${me}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Ue(e){let t=process.env.GENERATESAAS_API_URL;t&&t.replace(/\/+$/,"")!==mr||(Bs(Hs(me),{recursive:!0}),Ks(me,`${JSON.stringify({apiKey:e},null," ")}
9
9
  `,{mode:384}))}async function at(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=vt();if(r)return r;if(!e?.prompt)throw new Error("API key not found. Set GENERATESAAS_API_KEY or run 'generatesaas init' to configure.");return kt()}async function kt(){let e=await Pe.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return Pe.isCancel(e)&&(Pe.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as Ys}from"fs/promises";async function Ae(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await Ys(t,"utf-8")):process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{latest:"0.0.0-ci",versions:[{version:"0.0.0-ci",date:new Date().toISOString(),breaking:!1}],entitlements:null}:await(await Se(e,"/versions")).json()}async function yn(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await Se(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof M&&r.status===404)return null;throw r}}async function bn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skills:{"generatesaas-update":{skillMd:`# Offline skill stub
10
10
  `,scripts:{},references:{}}}}:await(await Se(e,`/skills/${encodeURIComponent(t)}`)).json()}function $t(e){if(!(e instanceof M)||e.status!==403)return null;let t=e.body;return!t||t.code!=="update_window_expired"?null:{message:e.message,lastAllowedVersion:t.lastAllowedVersion??null}}var gr="nextjs";function wn(e){return{frontend:gr,architecture:e.architecture,deployTarget:e.deploymentTarget,database:e.databaseProvider,cache:e.cacheProvider,payment:e.paymentProvider,email:e.emailProvider,multiTenancy:e.multiTenancy,blog:!0,docs:e.docs,desktop:e.desktop,mobile:e.mobile,runner:!1,credits:e.credits,revenueSharing:e.revenueSharing,currency:e.defaultCurrency}}async function yr(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:"offline-test-token",licenseId:"offline-test-license-id",installId:t.installId}:await(await Se(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function vn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await Se(e,"/license/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function br(e,t){let r=await fetch(`${e}/license/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Verification service returned ${r.status}`);return await r.json()}async function kn(e,t,r){let n=await fetch(`${e}/license/inspect`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(r)});if(!n.ok){let i=await n.json().catch(()=>null);throw new Error(i?.error??`Inspect endpoint returned ${n.status}`)}return await n.json()}var wr=new Set([".git","node_modules",".pnpm-store",".env",".env.test",".turbo",".data","dist",".next",".next-e2e-web",".next-e2e-desktop",".wrangler",".devcontainer","playwright-report","test-results",".drive-out",".mastra"]),vr=new Set(["pnpm-lock.yaml","widget-documents.generated.ts"]);function ct(e){if(kr(e))return!0;for(let t of e.split("/"))if(vr.has(t))return!0;return!1}var Ws=new Set(["data","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md"]),En=["scripts/docs-lint.ts"],zs=["docs/superpowers","packages/cli","packages/cli-api","packages/database/tests/no-migration-history.test.ts","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function kr(e){let t=e.split("/");for(let r of t)if(wr.has(r))return!0;if(En.includes(e)||En.some(r=>r.startsWith(`${e}/`)))return!1;if(Ws.has(t[0]))return!0;for(let r of zs)if(e===r||e.startsWith(`${r}/`))return!0;return!1}async function jt(e,t,r){await qs(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Xs(n,`v${t}.tar.gz`);if(!Js(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await Er(Sn(a),Sr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await Er(Sn(i),Sr(r));return}let s=await Se(e,`/template/${encodeURIComponent(t)}`);if(!s.body)throw new Error("Empty response body");let o=Zs.fromWeb(s.body);await Er(o,Sr(r))}function Sr(e){return Qs({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!kr(r):!0},sync:!1})}import{readdir as Mt,readFile as lt,rm as An,rmdir as eo,writeFile as Et}from"fs/promises";import{join as K}from"path";async function In(e){let t;try{t=await Mt(e,{withFileTypes:!0})}catch{return!1}let r=!1;for(let n of t){let i=K(e,n.name);if(n.isDirectory()){await In(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await An(i,{force:!0})}return r||await eo(e).catch(()=>{}),r}async function Tn(e){let t=K(e,"packages/content"),r=[];try{r=(await Mt(t,{withFileTypes:!0})).filter(o=>o.isDirectory()).map(o=>o.name)}catch{return}let n=new Set;for(let o of r){let a=K(t,o),p;try{p=(await Mt(a,{withFileTypes:!0})).filter(h=>h.isDirectory())}catch{continue}for(let h of p)n.add(h.name),await In(K(a,h.name))}let i=await io(e),s=new Set([...n].filter(o=>i===void 0||i.has(o)));await Promise.all([...s].map(o=>An(K(e,"apps/web/public/images",o),{recursive:!0,force:!0}))),await oo(e,s)}var to="packages/config/src/index.ts",ro=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,no=/\bslug:\s*"([^"]+)"/g;async function io(e){let t;try{t=await lt(K(e,to),"utf-8")}catch{return}let r=ro.exec(t)?.[1];if(r===void 0)return;let n=[...r.matchAll(no)].map(i=>i[1]).filter(i=>i!==void 0);return n.length>0?new Set(n):void 0}var so="packages/translate/.meta/mdx-translation-meta.json";async function oo(e,t){if(t.size===0)return;let r=K(e,so),n;try{n=JSON.parse(await lt(r,"utf-8"))}catch{return}if(typeof n!="object"||n===null)return;let i=n;if(typeof i.locales!="object"||i.locales===null)return;let s={};for(let[o,a]of Object.entries(i.locales)){if(typeof a!="object"||a===null)continue;let p={};for(let[h,g]of Object.entries(a)){let k=h.split("/"),w=k.length>1?k[0]:void 0,P=k[k.length-1]?.startsWith("_")===!0;w!==void 0&&t.has(w)&&!P||(p[h]=g)}s[o]=p}await Et(r,`${JSON.stringify({...i,locales:s},null," ")}
11
11
  `)}var ao="packages/config/src/blog.ts";async function Rn(e){let t=K(e,ao),r=await lt(t,"utf-8"),n=Pn(Pn(r,"blogCategories",t),"blogAuthors",t);await Et(t,n)}function Pn(e,t,r){let n=new RegExp(`(export const ${t}\\b[^=]*=\\s*)\\[[\\s\\S]*?\\];`);if(!n.test(e))throw new Error(`emptyBlogConfig: could not find the \`export const ${t} = [...]\` declaration in ${r}. The boilerplate blog config may have been renamed or restructured; update the CLI strip in cleanup.ts.`);return e.replace(n,"$1[];")}async function _n(e){let t=K(e,"packages/i18n/translations"),r;try{r=await Mt(t)}catch{return}for(let n of r){let i=K(t,n,"web.json"),s;try{s=await lt(i,"utf-8")}catch{continue}let o=JSON.parse(s);!o.content?.categories||o.content.categories.blog===void 0||(o.content.categories.blog={},await Et(i,`${JSON.stringify(o,null," ")}
@@ -1738,7 +1738,7 @@ function posthogConfigured(): boolean {
1738
1738
  ${k}`:o.message))}else i()})})}async function ss(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await Te("pnpm",["install","--lockfile-only","--no-frozen-lockfile"],e),!0}catch(t){let r=t instanceof Error?t.message:String(t);return _.log.warn(`Lockfile regeneration failed: ${r}`),_.log.warn("Deploys using --frozen-lockfile may fail."),!1}}async function os(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping dependency installation."),_.log.info("Install pnpm: https://pnpm.io/installation"),!1;let t=_.spinner();t.start("Installing dependencies (this may take a minute)...");try{return await Te("pnpm",["install"],e),t.stop("Dependencies installed."),!0}catch(r){t.stop("Dependency installation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`pnpm install failed: ${n}`),_.log.warn("You can run it manually later."),!1}}async function as(e){if(!Re("pnpm"))return!1;let t=_.spinner();t.start("Generating baseline database migration...");try{return await Te("pnpm",["-F","@repo/database","generate"],e),t.stop("Baseline migration generated."),!0}catch(r){t.stop("Baseline migration generation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not generate baseline migration: ${n}`),_.log.warn("Run 'pnpm -F @repo/database generate' before your first deploy."),!1}}async function cs(e){if(!Re("pnpm"))return!1;try{await Kr(rr(e,"packages/mcp-widgets"))}catch{return!1}let t=_.spinner();t.start("Building the MCP widgets...");try{return await Te("pnpm",["-F","@repo/mcp-widgets","widgets:build"],e),t.stop("MCP widgets built."),!0}catch(r){t.stop("MCP widget build failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not build the MCP widgets: ${n}`),_.log.warn("Run 'pnpm -F @repo/mcp-widgets widgets:build' and commit the result."),!1}}async function ls(e){try{return await Kr(rr(e,".git")),_.log.info("Git repository already exists, skipping init."),!0}catch{}if(!Re("git"))return _.log.warn("git not found. Skipping repository initialization."),!1;let t=_.spinner();t.start("Initializing git repository...");try{return await Te("git",["init"],e),await Te("git",["add","-A"],e),await Te("git",["commit","--no-verify","-m","Initial commit from GenerateSaaS"],e),t.stop("Git repository initialized."),!0}catch{return t.stop("Git initialization failed."),_.log.warn("You can run git init manually later."),!1}}async function ps(e){if(!Re("pnpm"))return!1;try{await Kr(rr(e,".git"))}catch{return!1}try{let t=JSON.parse(await hp(rr(e,"package.json"),"utf-8")),r=!!t.devDependencies?.["simple-git-hooks"],n=!!t["simple-git-hooks"];if(!r||!n)return!1}catch{return!1}try{return await Te("pnpm",["exec","simple-git-hooks"],e),!0}catch{return _.log.warn("Could not install git hooks. Run 'pnpm exec simple-git-hooks' manually."),!1}}import*as Je from"@clack/prompts";import H from"picocolors";function ds(e,t){let r=rt(e);t.dockerAvailable||Je.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/"),t.baselineMigrationMissing&&Je.log.warn("No database migration was generated (the install did not complete). Run `pnpm install` then `pnpm --filter @repo/database generate` and commit the result BEFORE deploying - otherwise your first deploy pushes the schema untracked.");let n=[];n.push(`cd ${e.projectDir}`),t.pnpmInstalled||n.push("pnpm install"),t.mcpWidgetsUnbuilt&&n.push(`pnpm -F @repo/mcp-widgets widgets:build ${H.dim("# then commit the rebuilt widget document")}`),n.push(`pnpm infra ${H.dim(`# ${r.map(a=>en[a].label).join(", ")}`)}`),n.push(`pnpm dev ${H.dim("# http://localhost:3000")}`),t.skippedCredentials.length>0&&(n.push(""),n.push(H.dim("Fill in remaining TODO values in .env"))),Je.note(n.join(`
1739
1739
  `),H.yellow("Start Development"));let i=[];i.push(`App ${H.cyan("http://localhost:3000")}`),e.architecture==="separate"&&i.push(`API ${H.cyan("http://localhost:3010")}`),r.includes("mailpit")&&i.push(`Mailpit ${H.cyan("http://localhost:8025")}`),r.includes("inngest")&&i.push(`Inngest ${H.cyan("http://localhost:8288")}`),Je.note(i.join(`
1740
1740
  `),H.yellow("Dev Tools"));let s=[],o=fp(e);o.length>0&&s.push(`Set in production: ${H.dim(o.join(", "))}`),s.push("pnpm db:setup # Apply the database schema"),s.push(gp(e)),Je.note(s.join(`
1741
- `),H.yellow("Deployment"))}function fp(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function gp(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function nr(e,t){return e.versions.find(r=>r.version===t)?.cli}function us(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function ir(e,t,r="3.42.0"){if(us(r))return{ok:!0};let n=nr(e,e.latest);return!n||ht(n)===null?{ok:!0}:_e(r,n)>=0?{ok:!0}:{ok:!1,message:`Your installed generatesaas CLI (v${r}) is too old for template v${e.latest}, which needs CLI v${n} or newer. Run npx generatesaas@latest ${t} so npm fetches the current CLI. If the release happened minutes ago, npm may still be propagating it - retry shortly.`}}function ms(e,t,r="3.42.0"){if(us(r))return{ok:!0};let n=nr(e,t);return!n||ht(n)===null?{ok:!0}:_e(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import Ep from"picocolors";var Sp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function Pp(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`generatesaas-demo:${e}`)),r=[...new Uint8Array(t).subarray(0,16)].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function hs(e){e.command("init").description("Scaffold a new GenerateSaaS project").argument("[apiKey]","license key (same as --api-key)").option("-n, --name <name>","project name (lowercase, hyphens, starts with letter)").option("--app-name <name>","display name for the app").option("-l, --location <path>","project directory (default: ./{name})").addOption(new ee("--architecture <type>","fullstack or separate").choices([...nt])).addOption(new ee("--payment <provider>","payment provider").choices([...it])).addOption(new ee("--email <provider>","email provider").choices([...st])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new ee("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...je])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new ee("--currency <code>","default currency for billing").choices([...ce])).addOption(new ee("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...$e])).addOption(new ee("--deploy <target>","deployment target").choices([...le])).addOption(new ee("--database <provider>","database provider").choices([...pe])).addOption(new ee("--cache <provider>","cache provider").choices([...de])).option("--observability <providers>",`comma-separated observability providers (${G.join(", ")}); anything unselected ships no SDK`).option("--api-key <key>","API key (skips interactive prompt)").option("--base-url <url>","public base URL (e.g. https://example.com) - bakes into canonical/og/sitemap").option("-y, --yes","accept defaults for unspecified options (non-interactive)").addOption(new ee("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new ee("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await Ap(t?{...r,apiKey:t}:r)})}async function Ap(e){let t=performance.now();Zr("3.42.0");let r;try{r=pn(e)}catch(v){E.cancel(N(v)),process.exit(1)}let n=E.spinner(),i;try{i=await at({apiKey:e.apiKey,prompt:!e.yes})}catch(v){E.cancel(N(v)),process.exit(1)}e.demo&&Fr(i)!==Sp&&(E.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=he(i),o,a=async()=>{o=await Ae(s);let v=ir(o,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:o.latest,selectedVersion:o.latest,desktopAllowed:o.entitlements?.desktopAllowed??!0,mobileAllowed:o.entitlements?.mobileAllowed??!0}};n.start("Verifying access...");let p,h,g=!0,k=!0;try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(v){if(n.stop("Access verification failed."),v instanceof M&&v.status===401){e.yes&&(E.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),E.log.warning("Invalid API key."),i=await kt(),s=he(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(L){n.stop("Access verification failed."),E.cancel(L instanceof M&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else E.cancel(N(v)),process.exit(1)}E.log.success(`Latest version: ${p}`),r.desktop===!0&&!g&&(E.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!k&&(E.cancel("The mobile app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=dn({...r,...g?{}:{desktop:!1},...k?{}:{mobile:!1}}):w=await un(r,{desktopAllowed:g,mobileAllowed:k});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await Pp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:gr,version:h,installId:v,projectName:w.projectName,options:wn(w)}),F;try{F=await yr(s,L())}catch(ve){let $=$t(ve);if(!$?.lastAllowedVersion||!o)throw ve;n.stop("License activation failed.");let W=ms(o,$.lastAllowedVersion);if(W.ok||(E.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=nr(o,$.lastAllowedVersion);E.cancel(`${$.message} Re-run ${z?`npx generatesaas@${z} init`:"init"} without --yes to continue with v${$.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let ke=await E.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(E.isCancel(ke)||!ke)&&(E.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await yr(s,L())}P={token:F.token,keyHash:Fr(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),E.cancel(N(v)),process.exit(1)}let u=kp(w.projectDir);if(yp(u)&&bp(u).length>0)if(e.yes)E.log.info(`Directory ${u} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await E.select({message:`Directory ${u} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(E.isCancel(L)||L==="cancel")&&(E.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&wp(u,{recursive:!0,force:!0})}let O={...w,projectDir:u,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await jt(s,h,u),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),E.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Xt(O),!e.demo){let v=await mt(u);await l(vp(u,Ct),`${JSON.stringify(v,null," ")}
1741
+ `),H.yellow("Deployment"))}function fp(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function gp(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function nr(e,t){return e.versions.find(r=>r.version===t)?.cli}function us(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function ir(e,t,r="3.43.0"){if(us(r))return{ok:!0};let n=nr(e,e.latest);return!n||ht(n)===null?{ok:!0}:_e(r,n)>=0?{ok:!0}:{ok:!1,message:`Your installed generatesaas CLI (v${r}) is too old for template v${e.latest}, which needs CLI v${n} or newer. Run npx generatesaas@latest ${t} so npm fetches the current CLI. If the release happened minutes ago, npm may still be propagating it - retry shortly.`}}function ms(e,t,r="3.43.0"){if(us(r))return{ok:!0};let n=nr(e,t);return!n||ht(n)===null?{ok:!0}:_e(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import Ep from"picocolors";var Sp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function Pp(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`generatesaas-demo:${e}`)),r=[...new Uint8Array(t).subarray(0,16)].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function hs(e){e.command("init").description("Scaffold a new GenerateSaaS project").argument("[apiKey]","license key (same as --api-key)").option("-n, --name <name>","project name (lowercase, hyphens, starts with letter)").option("--app-name <name>","display name for the app").option("-l, --location <path>","project directory (default: ./{name})").addOption(new ee("--architecture <type>","fullstack or separate").choices([...nt])).addOption(new ee("--payment <provider>","payment provider").choices([...it])).addOption(new ee("--email <provider>","email provider").choices([...st])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new ee("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...je])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new ee("--currency <code>","default currency for billing").choices([...ce])).addOption(new ee("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...$e])).addOption(new ee("--deploy <target>","deployment target").choices([...le])).addOption(new ee("--database <provider>","database provider").choices([...pe])).addOption(new ee("--cache <provider>","cache provider").choices([...de])).option("--observability <providers>",`comma-separated observability providers (${G.join(", ")}); anything unselected ships no SDK`).option("--api-key <key>","API key (skips interactive prompt)").option("--base-url <url>","public base URL (e.g. https://example.com) - bakes into canonical/og/sitemap").option("-y, --yes","accept defaults for unspecified options (non-interactive)").addOption(new ee("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new ee("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await Ap(t?{...r,apiKey:t}:r)})}async function Ap(e){let t=performance.now();Zr("3.43.0");let r;try{r=pn(e)}catch(v){E.cancel(N(v)),process.exit(1)}let n=E.spinner(),i;try{i=await at({apiKey:e.apiKey,prompt:!e.yes})}catch(v){E.cancel(N(v)),process.exit(1)}e.demo&&Fr(i)!==Sp&&(E.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=he(i),o,a=async()=>{o=await Ae(s);let v=ir(o,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:o.latest,selectedVersion:o.latest,desktopAllowed:o.entitlements?.desktopAllowed??!0,mobileAllowed:o.entitlements?.mobileAllowed??!0}};n.start("Verifying access...");let p,h,g=!0,k=!0;try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(v){if(n.stop("Access verification failed."),v instanceof M&&v.status===401){e.yes&&(E.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),E.log.warning("Invalid API key."),i=await kt(),s=he(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(L){n.stop("Access verification failed."),E.cancel(L instanceof M&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else E.cancel(N(v)),process.exit(1)}E.log.success(`Latest version: ${p}`),r.desktop===!0&&!g&&(E.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!k&&(E.cancel("The mobile app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=dn({...r,...g?{}:{desktop:!1},...k?{}:{mobile:!1}}):w=await un(r,{desktopAllowed:g,mobileAllowed:k});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await Pp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:gr,version:h,installId:v,projectName:w.projectName,options:wn(w)}),F;try{F=await yr(s,L())}catch(ve){let $=$t(ve);if(!$?.lastAllowedVersion||!o)throw ve;n.stop("License activation failed.");let W=ms(o,$.lastAllowedVersion);if(W.ok||(E.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=nr(o,$.lastAllowedVersion);E.cancel(`${$.message} Re-run ${z?`npx generatesaas@${z} init`:"init"} without --yes to continue with v${$.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let ke=await E.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(E.isCancel(ke)||!ke)&&(E.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await yr(s,L())}P={token:F.token,keyHash:Fr(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),E.cancel(N(v)),process.exit(1)}let u=kp(w.projectDir);if(yp(u)&&bp(u).length>0)if(e.yes)E.log.info(`Directory ${u} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await E.select({message:`Directory ${u} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(E.isCancel(L)||L==="cancel")&&(E.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&wp(u,{recursive:!0,force:!0})}let O={...w,projectDir:u,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await jt(s,h,u),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),E.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Xt(O),!e.demo){let v=await mt(u);await l(vp(u,Ct),`${JSON.stringify(v,null," ")}
1742
1742
  `),await ts(u,u)}await is(u),await Qi(O,P),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),E.cancel(N(v)),process.exit(1)}!await ss(u)&&O.demo===!0&&(E.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let B=await os(u),oe=O.demo!==!0&&e.dbMigration!==!1,Oe=!1;oe&&B&&(await as(u),Oe=!0);let xe=B?await cs(u):!1;await ls(u),B&&await ps(u);let De=Re("docker"),Qe=ur(O).map(v=>v.key).filter(v=>!O.credentials?.[v]);ds(O,{pnpmInstalled:B,dockerAvailable:De,skippedCredentials:Qe,baselineMigrationMissing:oe&&!Oe,mcpWidgetsUnbuilt:O.ai&&!xe}),Qr(),E.log.info(Ep.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as sr}from"fs";import{readFile as vs}from"fs/promises";import{join as qe,resolve as Op}from"path";import*as b from"@clack/prompts";import C from"picocolors";import{mkdtemp as Ip,rm as Tp}from"fs/promises";import{tmpdir as Rp}from"os";import{join as _p}from"path";async function Hr(e,t,r,n,{olderRelease:i=!1}={}){let s=await Ip(_p(Rp(),"generatesaas-stage-"));try{await jt(e,t,s);let o=()=>Xt({...r,projectDir:s}),a=[];return i?a=await Qn(o):await o(),await Vr(s,n),a}finally{await Tp(s,{recursive:!0,force:!0})}}function fs(e){return e?"ON":"OFF"}var ft="packages/config/src/index.ts";function gs(e){let t=e.databaseProvider!==void 0&&e.databaseProvider!=="postgres",r=e.cacheProvider!==void 0&&e.cacheProvider!=="redis";return[...e.dockerServices??[]].filter(n=>!(n==="postgres"&&t)&&!(n==="redis"&&r)).sort()}function ys(e){return[...rt({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var Yr=[{key:"errorTracking",severity:"warn",normalize:e=>{e.errorTracking===void 0||e.observability!==void 0||(e.observability=e.errorTracking==="none"?[]:[e.errorTracking])},preserved:()=>!0,describe:()=>"Retired option `errorTracking`: it is now `observability`, an array, because a project may run more than one provider at once. Your recorded choice was migrated across automatically."},{key:"companion",severity:"warn",normalize:e=>{e.companion===void 0||e.runner!==void 0||(e.runner=e.companion)},preserved:()=>!0,describe:()=>"Retired option `companion`: it was renamed to `runner`, and that lane has since been removed. Your recorded choice was migrated across automatically so the removal is reported under one name."},{key:"runner",severity:"warn",preserved:e=>e.runner!==!0,describe:()=>"Retired option `runner`: your project recorded the runner ON, and the paired-device lane is GONE - not moved to config, removed. This update deletes the pairing endpoint, the dispatch transport, the relay, the `/runner/*` routes and the Runners page from your project, so machines your users had paired are no longer reachable from it. Chat and automations keep running on your app's own AI backend (`config.ai`); nothing else about them changes."},{key:"companionSource",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionSource\`: your project recorded a \`${String(e.companionSource)}\` daemon source. The paired-device lane that daemon served has been removed from your project, so there is no daemon left to source.`},{key:"companionName",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionName\`: your project recorded a branded daemon called ${e.companionName}. The paired-device lane is gone, so your project no longer ships an install flow to brand. An existing install on a user's machine keeps running; it has nothing left to pair with here.`},{key:"companionRepoUrl",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionRepoUrl\`: your project pointed its install flow at ${e.companionRepoUrl}. The paired-device lane is gone, so there is no install flow left to point anywhere.`},{key:"companionLocalPath",severity:"warn",preserved:e=>(e.companionLocalPath??"").trim()==="",describe:e=>`Retired option \`companionLocalPath\`: your project recorded a local daemon checkout at ${e.companionLocalPath}. The option is gone, and so is the paired-device lane behind it - nothing in your project is built from a local daemon checkout any more.`},{key:"desktopAutoRelease",severity:"warn",applies:e=>e.desktop===!0,preserved:e=>e.desktopAutoRelease!==!0,describe:()=>"Retired option `desktopAutoRelease`: your project recorded automatic desktop releases, but the release trigger is no longer an option - cutting a release publishes signed installers from your repository and spends your Actions minutes, so it is always deliberate now. The staged `.github/workflows/desktop-release.yml` runs on `workflow_dispatch` only (the Actions tab). Add a `workflow_run` block to it if you want the CI-chained trigger back."},{key:"billingScope",severity:"ask",applies:e=>e.multiTenancy===!0,preserved:e=>e.billingScope!=="organization",describe:()=>"Retired option `billingScope`: your project recorded organization-scoped billing, and organization billing is GONE - not moved to config, removed. Money now lives only on a USER: an organization has no balance, no plan and no payment-provider customer of its own, and a workspace is funded by that organization's OWNER, whose personal balance every credit spent in it is drawn from. Payments already in flight are safe - a webhook arriving with old organization metadata is credited to that organization's owner rather than dropped - but a STORED balance is not: the `credits` and `plan` columns an organization holds them in are going away, and this update does NOT migrate them for you. MOVE every paying organization's credits and plan onto its owner BEFORE you take new checkouts, or that balance goes with the columns. How should this update proceed?"},{key:"socialProviders",severity:"warn",preserved:e=>(e.socialProviders??[]).length===0,describe:e=>`Retired option \`socialProviders\`: your project recorded ${(e.socialProviders??[]).join(", ")}, but it is now a plain config value that starts empty. Add those IDs back to \`config.auth.socialProviders\` in ${ft} or their sign-in buttons stop rendering.`},{key:"mcpServer",severity:"warn",preserved:e=>e.mcpServer!==!0||e.ai===!0,describe:()=>`Retired option \`mcpServer\`: your project recorded the outward MCP server ON, but its code now ships to every project behind a config gate generated OFF without AI. Set \`config.mcpServer.enabled\` to \`true\` in ${ft} to keep your /mcp endpoint and its settings tab.`},{key:"emailTracking",severity:"ask",preserved:e=>e.emailTracking!==!1,describe:()=>`Retired option \`emailTracking\`: your project recorded email open/click tracking OFF, but it is now a plain config value generated ON. Applying this update as-is starts tracking opens and clicks for every user you mail. Put it back by setting \`config.email.tracking.enabled\` to \`false\` in ${ft}. How should this update proceed?`},{key:"aiBuiltin",severity:"warn",normalize:e=>{e.aiBuiltin===void 0&&e.aiByok!==void 0&&(e.aiBuiltin=e.aiByok===!1)},applies:e=>e.ai===!0,preserved:e=>e.aiBuiltin===ne(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${fs(e.aiBuiltin)}, but it is now a plain config value generated ${fs(ne(e))} for a project ${ne(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${ft} to keep your choice.`},{key:"aiByok",severity:"warn",applies:e=>e.ai===!0,preserved:e=>e.aiByok!==!1,describe:()=>`Retired option \`aiByok\`: your project recorded bring-your-own-key AI OFF, but it is now a plain config value generated ON. Set \`config.ai.byok\` to \`false\` in ${ft} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>gs(e).join(",")===ys(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${gs(e).join(", ")||"no services"}, but the local Docker services are now DERIVED from your stack - postgres when you self-host Postgres, redis when you self-host Redis, mailpit on SMTP, inngest always - so an inconsistent selection is no longer possible. Your regenerated \`infra/docker-compose.yml\` will contain ${ys(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===rn.length,describe:e=>`Retired option \`aiTools\`: your project recorded ${(e.aiTools??[]).join(", ")||"no AI tools"}, but the \`generatesaas-update\` skill bundle now ships to every AI-tool root (${ze.join(", ")}) so it is there whichever assistant you switch to. Delete the roots you do not use - they are plain text files with no runtime path.`},{key:"blog",severity:"warn",preserved:e=>e.blog!==!1,describe:()=>`Retired option \`blog\`: your project recorded the blog OFF, but content is no longer an option. This update adds the \`/blog\`, \`/alternatives\` and \`/compare\` route code to your project; every one of them 404s until you add a file under \`packages/content/{locale}/{section}/\`, and none of them appears in your navbar, footer, sitemap or llms.txt while it is empty. Delete an entry from \`config.content.sections\` in ${ft} to drop a section for good.`}],rg=Yr.map(e=>e.key);function bs(e){for(let t of Yr)t.normalize?.(e)}function ws(e){let t=[];for(let r of Yr){if(r.normalize?.(e),e[r.key]===void 0)continue;(!r.applies||r.applies(e))&&!r.preserved(e)&&t.push({key:r.key,message:r.describe(e),severity:r.severity}),delete e[r.key]}return t}function ks(e){e.command("update").description("Update AI skill files and stage template updates").allowExcessArguments(!0).option("--cwd <path>","project directory (default: current directory)").option("--answer <id=choice>","answer a question that would otherwise prompt (repeatable), e.g. --answer desktop-migration=keep-ai",xp,[]).action(async(t,r)=>{r.args.length>0&&b.log.warn("`auto` is now the default and the argument is ignored.");let n=Dp(t.answer),i=Op(t.cwd??process.cwd()),s=qe(i,ue),o;try{o=JSON.parse(await vs(s,"utf-8"))}catch{b.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}o.frontend===hr&&(b.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${hr}"\`).
1743
1743
 
1744
1744
  v${fr} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
@@ -1795,7 +1795,7 @@ ${k}`}).join(`
1795
1795
  `]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
1796
1796
  `],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function td(){return[...ze,...Br].flatMap(e=>tr.map(t=>Xe(e,t)))}function zr(e){return or(e)?(Zp(e,{recursive:!0}),!0):!1}function rd(e,t,r=[]){if(!or(e))return!1;let n=Jr(e,"utf-8"),i=n;for(let s of t)i=i.replace(s,"");for(let{from:s,to:o}of r)i=i.replace(s,o);return i===n?!1:(Ds(e,i,"utf-8"),!0)}function nd(e){let t=Xe(e,".gitignore");if(!or(t))return!1;let r=Jr(t,"utf-8"),n=r.split(`
1797
1797
  `).filter(i=>!i.includes(".generatesaas")).join(`
1798
- `);return n===r?!1:(Ds(t,n,"utf-8"),!0)}function Ns(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(Jr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let s=[],o=[];for(let a of td())zr(Xe(t,a))&&s.push(a);for(let a of Qp)zr(Xe(t,a))&&s.push(a);zr(Xe(t,J))&&s.push(`${J}/`);for(let a of ed){let p=Xe(t,a.file);rd(p,a.removals,a.replacements)?o.push(a.file):or(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}nd(t)&&o.push(".gitignore");for(let a of s)U.log.info(`Deleted ${a}`);for(let a of o)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new id().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.42.0").addHelpText("after",`
1798
+ `);return n===r?!1:(Ds(t,n,"utf-8"),!0)}function Ns(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(Jr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let s=[],o=[];for(let a of td())zr(Xe(t,a))&&s.push(a);for(let a of Qp)zr(Xe(t,a))&&s.push(a);zr(Xe(t,J))&&s.push(`${J}/`);for(let a of ed){let p=Xe(t,a.file);rd(p,a.removals,a.replacements)?o.push(a.file):or(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}nd(t)&&o.push(".gitignore");for(let a of s)U.log.info(`Deleted ${a}`);for(let a of o)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new id().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.43.0").addHelpText("after",`
1799
1799
  Examples:
1800
1800
  $ generatesaas init Interactive setup
1801
1801
  $ generatesaas init -n my-app -y Quick setup with defaults
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generatesaas",
3
- "version": "3.42.0",
3
+ "version": "3.43.0",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",