generatesaas 3.4.0 → 3.4.1

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 Ul}from"commander";import*as ho from"@clack/prompts";import{ex
5
5
  `),_=[M!=="none"?` Payment: ${h.cyan(Rt[M].label)} (${Ee})`:` Payment: ${h.dim("none")}`,` Credits: ${Ve?h.cyan("Yes"):h.dim("No")}`,` AI features: ${T?h.cyan("Yes"):h.dim("No")}`,...T?[` Runner: ${F?h.cyan("Yes"):h.dim("No")}`]:[],...ne?[]:[` Web AI: ${h.dim("No")} (desktop-first)`],` Email: ${h.cyan(It[te].label)}`,` Observability: ${Fe.length===0?h.dim("none"):h.cyan(Fe.map(Qt=>Tt[Qt].label).join(", "))}`,` Multi-tenancy: ${Se?h.cyan("Yes"):h.dim("No")}`,` Projects: ${b?h.cyan("Yes"):h.dim("No")}`,` Docs app: ${L?h.cyan("Yes"):h.dim("No")}`,` Desktop app: ${J?h.cyan("Yes"):h.dim("No")}`,` Rev. sharing: ${At?h.cyan("Yes"):h.dim("No")}`].join(`
6
6
  `),ge=[h.bold("Project"),c,"",h.bold("Infrastructure"),d,"",h.bold("Features"),_];if(Pe.length>0){let Qt=Pe.map(Br=>{let go=ct[Br.key]?h.green("provided"):h.dim("skipped");return` ${Br.key}: ${go}`}).join(`
7
7
  `);ge.push("",h.bold("Credentials"),Qt)}m.note(ge.join(`
8
- `),"Summary");let Vr=await m.confirm({message:"Proceed with these settings?"});(m.isCancel(Vr)||!Vr)&&(m.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:P,deploymentTarget:a,databaseProvider:f,cacheProvider:C,paymentProvider:M,emailProvider:te,observability:Fe,multiTenancy:Se,projects:b,docs:L,desktop:J,ai:T,webAi:ne,runner:F,revenueSharing:At,credits:Ve,defaultCurrency:Ee,...Object.keys(ct).length>0?{credentials:ct}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...I!==void 0?{demo:I}:{}}}import{createReadStream as mn,existsSync as To}from"fs";import{mkdir as _o}from"fs/promises";import{join as Oo}from"path";import{Readable as xo}from"stream";import{pipeline as ur}from"stream/promises";import{extract as Do}from"tar";import{join as Oe}from"path";import{homedir as wo}from"os";var dt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",Y=".generatesaas",ye=Oe(Y,"manifest.json"),rn="nextjs",ir="nuxt",or="2.4.1",nn=Oe(Y,"hashes.json"),xt=Oe(Y,"template-hashes.json"),Dt=Oe(Y,"template"),on=Oe(Y,"staging"),sn=Oe(Y,"staging.json"),pe=Oe(wo(),".generatesaas");var $=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function de(e){return{apiKey:e,baseUrl:dt}}async function ve(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.4.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 $(i.status,s,o)}return i}import{existsSync as bo,readFileSync as ko,writeFileSync as Eo,mkdirSync as So}from"fs";import{dirname as Ao}from"path";import*as we from"@clack/prompts";function ut(){if(!bo(pe))return null;try{let e=JSON.parse(ko(pe,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&we.log.warning(`Found old GitHub token in ${pe}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function xe(e){So(Ao(pe),{recursive:!0}),Eo(pe,JSON.stringify({apiKey:e},null," ")+`
8
+ `),"Summary");let Vr=await m.confirm({message:"Proceed with these settings?"});(m.isCancel(Vr)||!Vr)&&(m.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:P,deploymentTarget:a,databaseProvider:f,cacheProvider:C,paymentProvider:M,emailProvider:te,observability:Fe,multiTenancy:Se,projects:b,docs:L,desktop:J,ai:T,webAi:ne,runner:F,revenueSharing:At,credits:Ve,defaultCurrency:Ee,...Object.keys(ct).length>0?{credentials:ct}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...I!==void 0?{demo:I}:{}}}import{createReadStream as mn,existsSync as To}from"fs";import{mkdir as _o}from"fs/promises";import{join as Oo}from"path";import{Readable as xo}from"stream";import{pipeline as ur}from"stream/promises";import{extract as Do}from"tar";import{join as Oe}from"path";import{homedir as wo}from"os";var dt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",Y=".generatesaas",ye=Oe(Y,"manifest.json"),rn="nextjs",ir="nuxt",or="2.4.1",nn=Oe(Y,"hashes.json"),xt=Oe(Y,"template-hashes.json"),Dt=Oe(Y,"template"),on=Oe(Y,"staging"),sn=Oe(Y,"staging.json"),pe=Oe(wo(),".generatesaas");var $=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function de(e){return{apiKey:e,baseUrl:dt}}async function ve(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.4.1"}});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 $(i.status,s,o)}return i}import{existsSync as bo,readFileSync as ko,writeFileSync as Eo,mkdirSync as So}from"fs";import{dirname as Ao}from"path";import*as we from"@clack/prompts";function ut(){if(!bo(pe))return null;try{let e=JSON.parse(ko(pe,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&we.log.warning(`Found old GitHub token in ${pe}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function xe(e){So(Ao(pe),{recursive:!0}),Eo(pe,JSON.stringify({apiKey:e},null," ")+`
9
9
  `,{mode:384})}async function qe(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=ut();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 mt()}async function mt(){let e=await we.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return we.isCancel(e)&&(we.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as Po}from"fs/promises";async function be(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await Po(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 ve(e,"/versions")).json()}async function an(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await ve(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof $&&r.status===404)return null;throw r}}async function cn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skills:{"generatesaas-update":{skillMd:`# Offline skill stub
10
10
  `,scripts:{},references:{}}}}:await(await ve(e,`/skills/${encodeURIComponent(t)}`)).json()}function Nt(e){if(!(e instanceof $)||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 sr="nextjs";function ln(e){return{frontend:sr,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,runner:e.runner,credits:e.credits,revenueSharing:e.revenueSharing,currency:e.defaultCurrency}}async function ar(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:"offline-test-token",licenseId:"offline-test-license-id",installId:t.installId}:await(await ve(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function pn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await ve(e,"/license/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function cr(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 dn(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 lr=new Set([".git","node_modules",".pnpm-store",".env",".env.test",".turbo",".data","dist",".next",".next-e2e-web",".next-e2e-desktop",".svelte-kit",".wrangler",".devcontainer","playwright-report","test-results",".drive-out",".mastra"]),pr=new Set(["pnpm-lock.yaml"]);function Je(e){if(dr(e))return!0;for(let t of e.split("/"))if(pr.has(t))return!0;return!1}var Ro=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),un=["scripts/docs-lint.ts"],Io=["docs/superpowers","packages/cli","packages/cli-api","packages/config/tests/runner-brand-lockstep.test.ts","apps/web/tests/content/competitor-claims.test.ts","apps/runner","docs/agentrunner","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function dr(e){let t=e.split("/");for(let r of t)if(lr.has(r))return!0;if(un.includes(e)||un.some(r=>r.startsWith(e+"/")))return!1;if(Ro.has(t[0]))return!0;for(let r of Io)if(e===r||e.startsWith(r+"/"))return!0;return!1}async function Ct(e,t,r){await _o(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Oo(n,`v${t}.tar.gz`);if(!To(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await ur(mn(a),mr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await ur(mn(i),mr(r));return}let s=await ve(e,`/template/${encodeURIComponent(t)}`);if(!s.body)throw new Error("Empty response body");let o=xo.fromWeb(s.body);await ur(o,mr(r))}function mr(e){return Do({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!dr(r):!0},sync:!1})}import{readdir as Lt,readFile as Xe,rm as hn,rmdir as No,writeFile as ft}from"fs/promises";import{join as B}from"path";async function gn(e){let t;try{t=await Lt(e,{withFileTypes:!0})}catch{return!1}let r=!1;for(let n of t){let i=B(e,n.name);if(n.isDirectory()){await gn(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await hn(i,{force:!0})}return r||await No(e).catch(()=>{}),r}async function yn(e){let t=B(e,"packages/content"),r=[];try{r=(await Lt(t,{withFileTypes:!0})).filter(o=>o.isDirectory()).map(o=>o.name)}catch{return}let n=new Set;for(let o of r){let a=B(t,o),p;try{p=(await Lt(a,{withFileTypes:!0})).filter(u=>u.isDirectory())}catch{continue}for(let u of p)n.add(u.name),await gn(B(a,u.name))}let i=await jo(e),s=new Set([...n].filter(o=>i===void 0||i.has(o)));await Promise.all([...s].map(o=>hn(B(e,"apps/web/public/images",o),{recursive:!0,force:!0}))),await Mo(e,s)}var Co="packages/config/src/index.ts",Lo=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,$o=/\bslug:\s*"([^"]+)"/g;async function jo(e){let t;try{t=await Xe(B(e,Co),"utf-8")}catch{return}let r=Lo.exec(t)?.[1];if(r===void 0)return;let n=[...r.matchAll($o)].map(i=>i[1]).filter(i=>i!==void 0);return n.length>0?new Set(n):void 0}var Uo="packages/translate/.meta/mdx-translation-meta.json";async function Mo(e,t){if(t.size===0)return;let r=B(e,Uo),n;try{n=JSON.parse(await Xe(r,"utf-8"))}catch{return}if(typeof n!="object"||n===null)return;let i=n;if(typeof i.files!="object"||i.files===null)return;let s=i.files,o={};for(let[a,p]of Object.entries(s)){let u=a.split("/"),v=u.length>1?u[0]:void 0,g=u[u.length-1]?.startsWith("_")===!0;v!==void 0&&t.has(v)&&!g||(o[a]=p)}await ft(r,JSON.stringify({...i,files:o},null," ")+`
11
11
  `)}var Fo="packages/config/src/blog.ts";async function vn(e){let t=B(e,Fo),r=await Xe(t,"utf-8"),n=fn(fn(r,"blogCategories",t),"blogAuthors",t);await ft(t,n)}function fn(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 wn(e){let t=B(e,"packages/i18n/translations"),r;try{r=await Lt(t)}catch{return}for(let n of r){let i=B(t,n,"web.json"),s;try{s=await Xe(i,"utf-8")}catch{continue}let o=JSON.parse(s);!o.content?.categories||o.content.categories.blog===void 0||(o.content.categories.blog={},await ft(i,JSON.stringify(o,null," ")+`
@@ -1400,7 +1400,7 @@ function posthogConfigured(): boolean {
1400
1400
  ${g}`:o.message))}else i()})})}async function Vi(e){if(!nt("pnpm"))return j.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await rt("pnpm",["install","--lockfile-only","--no-frozen-lockfile","--config.minimumReleaseAge=0"],e),!0}catch(t){let r=t instanceof Error?t.message:String(t);return j.log.warn(`Lockfile regeneration failed: ${r}`),j.log.warn("Deploys using --frozen-lockfile may fail."),!1}}async function Bi(e){if(!nt("pnpm"))return j.log.warn("pnpm not found. Skipping dependency installation."),j.log.info("Install pnpm: https://pnpm.io/installation"),!1;let t=j.spinner();t.start("Installing dependencies (this may take a minute)...");try{return await rt("pnpm",["install","--config.minimumReleaseAge=0"],e),t.stop("Dependencies installed."),!0}catch(r){t.stop("Dependency installation failed.");let n=r instanceof Error?r.message:String(r);return j.log.warn(`pnpm install failed: ${n}`),j.log.warn("You can run it manually later."),!1}}async function Ki(e){try{return await Fi(Nr(e,".git")),j.log.info("Git repository already exists, skipping init."),!0}catch{}if(!nt("git"))return j.log.warn("git not found. Skipping repository initialization."),!1;let t=j.spinner();t.start("Initializing git repository...");try{return await rt("git",["init"],e),await rt("git",["add","-A"],e),await rt("git",["commit","--no-verify","-m","Initial commit from GenerateSaaS"],e),t.stop("Git repository initialized."),!0}catch{return t.stop("Git initialization failed."),j.log.warn("You can run git init manually later."),!1}}async function Gi(e){if(!nt("pnpm"))return!1;try{await Fi(Nr(e,".git"))}catch{return!1}try{let t=JSON.parse(await Wc(Nr(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 rt("pnpm",["exec","simple-git-hooks"],e),!0}catch{return j.log.warn("Could not install git hooks. Run 'pnpm exec simple-git-hooks' manually."),!1}}import*as it from"@clack/prompts";import z from"picocolors";function Hi(e,t){let r=Ge(e);t.dockerAvailable||it.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/");let n=[];n.push(`cd ${e.projectDir}`),t.pnpmInstalled||n.push("pnpm install"),n.push(`pnpm infra ${z.dim(`# ${r.map(a=>Hr[a].label).join(", ")}`)}`),n.push(`pnpm dev ${z.dim("# http://localhost:3000")}`),t.skippedCredentials.length>0&&(n.push(""),n.push(z.dim("Fill in remaining TODO values in .env"))),it.note(n.join(`
1401
1401
  `),z.yellow("Start Development"));let i=[];i.push(`App ${z.cyan("http://localhost:3000")}`),e.architecture==="separate"&&i.push(`API ${z.cyan("http://localhost:3010")}`),r.includes("mailpit")&&i.push(`Mailpit ${z.cyan("http://localhost:8025")}`),r.includes("inngest")&&i.push(`Inngest ${z.cyan("http://localhost:8288")}`),it.note(i.join(`
1402
1402
  `),z.yellow("Dev Tools"));let s=[],o=zc(e);o.length>0&&s.push(`Set in production: ${z.dim(o.join(", "))}`),s.push("pnpm db:setup # Apply the database schema"),s.push(qc(e)),it.note(s.join(`
1403
- `),z.yellow("Deployment"))}function zc(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_BASE_URL"];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 qc(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 ot(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 je(e,t){let r=ot(e),n=ot(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 Jt(e,t){return e.versions.find(r=>r.version===t)?.cli}function Yi(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ot(e)===null}function Xt(e,t,r="3.4.0"){if(Yi(r))return{ok:!0};let n=Jt(e,e.latest);return!n||ot(n)===null?{ok:!0}:je(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 Wi(e,t,r="3.4.0"){if(Yi(r))return{ok:!0};let n=Jt(e,t);return!n||ot(n)===null?{ok:!0}:je(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 tl from"picocolors";var rl="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function nl(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 zi(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([...He])).addOption(new ee("--payment <provider>","payment provider").choices([...Ye])).addOption(new ee("--email <provider>","email provider").choices([...We])).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/electron, built with Electron)").option("--no-desktop","exclude the desktop app").option("--ai","include the AI features (chat, models, automations, integrations); unlocks the runner").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 app is the AI product. Requires --desktop and --ai, and cannot be combined with --runner").option("--runner","include the runner feature - your web users connect a machine that runs their own AI subscriptions for this app").option("--no-runner","exclude the backend runner feature").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([...se])).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([...ae])).addOption(new ee("--database <provider>","database provider").choices([...ce])).addOption(new ee("--cache <provider>","cache provider").choices([...le])).option("--observability <providers>",`comma-separated observability providers (${V.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 il(t?{...r,apiKey:t}:r)})}async function il(e){let t=performance.now();Kr("3.4.0");let r;try{r=Qr(e)}catch(b){k.cancel(D(b)),process.exit(1)}let n=k.spinner(),i;try{i=await qe({apiKey:e.apiKey,prompt:!e.yes})}catch(b){k.cancel(D(b)),process.exit(1)}e.demo&&Ir(i)!==rl&&(k.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=de(i),o,a=async()=>{o=await be(s);let b=Xt(o,"init");if(!b.ok)throw new Error(b.message);return{latestVersion:o.latest,selectedVersion:o.latest,desktopAllowed:o.entitlements?.desktopAllowed??!0,runnerAllowed:o.entitlements?.runnerAllowed??!0}};n.start("Verifying access...");let p,u,v=!0,g=!0;try{({latestVersion:p,selectedVersion:u,desktopAllowed:v,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(b){if(n.stop("Access verification failed."),b instanceof $&&b.status===401){e.yes&&(k.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),k.log.warning("Invalid API key."),i=await mt(),s=de(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:u,desktopAllowed:v,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(L){n.stop("Access verification failed."),k.cancel(L instanceof $&&L.status===401?"Invalid API key.":D(L)),process.exit(1)}}else k.cancel(D(b)),process.exit(1)}k.log.success(`Latest version: ${p}`),r.desktop===!0&&!v&&(k.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.runner===!0&&!g&&(k.cancel("The runner is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=en({...r,...v?{}:{desktop:!1},...g?{}:{runner:!1}}):w=await tn(r,{desktopAllowed:v,runnerAllowed:g});let P;n.start("Activating license...");try{let b=e.demo&&w.baseUrl?await nl(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:sr,version:u,installId:b,projectName:w.projectName,options:ln(w)}),re;try{re=await ar(s,L())}catch(J){let T=Nt(J);if(!T?.lastAllowedVersion||!o)throw J;n.stop("License activation failed.");let he=Wi(o,T.lastAllowedVersion);if(he.ok||(k.cancel(`${T.message} ${he.message}`),process.exit(1)),e.yes){let F=Jt(o,T.lastAllowedVersion);k.cancel(`${T.message} Re-run ${F?`npx generatesaas@${F} init`:"init"} without --yes to continue with v${T.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let Ae=await k.confirm({message:`Your update window has ended. Continue with v${T.lastAllowedVersion} (the last version your license covers)?`});(k.isCancel(Ae)||!Ae)&&(k.cancel("Setup cancelled."),process.exit(0)),u=T.lastAllowedVersion,n.start(`Activating license for v${u}...`),re=await ar(s,L())}P={token:re.token,keyHash:Ir(i),installId:re.installId??b},n.stop("License activated.")}catch(b){n.stop("License activation failed."),k.cancel(D(b)),process.exit(1)}let f=el(w.projectDir);if(Jc(f)&&Xc(f).length>0)if(e.yes)k.log.info(`Directory ${f} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await k.select({message:`Directory ${f} 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"}]});(k.isCancel(L)||L==="cancel")&&(k.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Zc(f,{recursive:!0,force:!0})}let C={...w,projectDir:f,version:u,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(s,u,f),n.stop("Template downloaded.")}catch(b){n.stop("Download failed."),k.cancel(D(b)),process.exit(1)}n.start("Generating project files...");try{if(await zt(C),!e.demo){let b=await tt(f);await l(Qc(f,xt),JSON.stringify(b,null," ")+`
1403
+ `),z.yellow("Deployment"))}function zc(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_BASE_URL"];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 qc(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 ot(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 je(e,t){let r=ot(e),n=ot(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 Jt(e,t){return e.versions.find(r=>r.version===t)?.cli}function Yi(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ot(e)===null}function Xt(e,t,r="3.4.1"){if(Yi(r))return{ok:!0};let n=Jt(e,e.latest);return!n||ot(n)===null?{ok:!0}:je(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 Wi(e,t,r="3.4.1"){if(Yi(r))return{ok:!0};let n=Jt(e,t);return!n||ot(n)===null?{ok:!0}:je(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 tl from"picocolors";var rl="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function nl(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 zi(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([...He])).addOption(new ee("--payment <provider>","payment provider").choices([...Ye])).addOption(new ee("--email <provider>","email provider").choices([...We])).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/electron, built with Electron)").option("--no-desktop","exclude the desktop app").option("--ai","include the AI features (chat, models, automations, integrations); unlocks the runner").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 app is the AI product. Requires --desktop and --ai, and cannot be combined with --runner").option("--runner","include the runner feature - your web users connect a machine that runs their own AI subscriptions for this app").option("--no-runner","exclude the backend runner feature").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([...se])).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([...ae])).addOption(new ee("--database <provider>","database provider").choices([...ce])).addOption(new ee("--cache <provider>","cache provider").choices([...le])).option("--observability <providers>",`comma-separated observability providers (${V.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 il(t?{...r,apiKey:t}:r)})}async function il(e){let t=performance.now();Kr("3.4.1");let r;try{r=Qr(e)}catch(b){k.cancel(D(b)),process.exit(1)}let n=k.spinner(),i;try{i=await qe({apiKey:e.apiKey,prompt:!e.yes})}catch(b){k.cancel(D(b)),process.exit(1)}e.demo&&Ir(i)!==rl&&(k.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=de(i),o,a=async()=>{o=await be(s);let b=Xt(o,"init");if(!b.ok)throw new Error(b.message);return{latestVersion:o.latest,selectedVersion:o.latest,desktopAllowed:o.entitlements?.desktopAllowed??!0,runnerAllowed:o.entitlements?.runnerAllowed??!0}};n.start("Verifying access...");let p,u,v=!0,g=!0;try{({latestVersion:p,selectedVersion:u,desktopAllowed:v,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(b){if(n.stop("Access verification failed."),b instanceof $&&b.status===401){e.yes&&(k.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),k.log.warning("Invalid API key."),i=await mt(),s=de(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:u,desktopAllowed:v,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(L){n.stop("Access verification failed."),k.cancel(L instanceof $&&L.status===401?"Invalid API key.":D(L)),process.exit(1)}}else k.cancel(D(b)),process.exit(1)}k.log.success(`Latest version: ${p}`),r.desktop===!0&&!v&&(k.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.runner===!0&&!g&&(k.cancel("The runner is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=en({...r,...v?{}:{desktop:!1},...g?{}:{runner:!1}}):w=await tn(r,{desktopAllowed:v,runnerAllowed:g});let P;n.start("Activating license...");try{let b=e.demo&&w.baseUrl?await nl(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:sr,version:u,installId:b,projectName:w.projectName,options:ln(w)}),re;try{re=await ar(s,L())}catch(J){let T=Nt(J);if(!T?.lastAllowedVersion||!o)throw J;n.stop("License activation failed.");let he=Wi(o,T.lastAllowedVersion);if(he.ok||(k.cancel(`${T.message} ${he.message}`),process.exit(1)),e.yes){let F=Jt(o,T.lastAllowedVersion);k.cancel(`${T.message} Re-run ${F?`npx generatesaas@${F} init`:"init"} without --yes to continue with v${T.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let Ae=await k.confirm({message:`Your update window has ended. Continue with v${T.lastAllowedVersion} (the last version your license covers)?`});(k.isCancel(Ae)||!Ae)&&(k.cancel("Setup cancelled."),process.exit(0)),u=T.lastAllowedVersion,n.start(`Activating license for v${u}...`),re=await ar(s,L())}P={token:re.token,keyHash:Ir(i),installId:re.installId??b},n.stop("License activated.")}catch(b){n.stop("License activation failed."),k.cancel(D(b)),process.exit(1)}let f=el(w.projectDir);if(Jc(f)&&Xc(f).length>0)if(e.yes)k.log.info(`Directory ${f} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await k.select({message:`Directory ${f} 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"}]});(k.isCancel(L)||L==="cancel")&&(k.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Zc(f,{recursive:!0,force:!0})}let C={...w,projectDir:f,version:u,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(s,u,f),n.stop("Template downloaded.")}catch(b){n.stop("Download failed."),k.cancel(D(b)),process.exit(1)}n.start("Generating project files...");try{if(await zt(C),!e.demo){let b=await tt(f);await l(Qc(f,xt),JSON.stringify(b,null," ")+`
1404
1404
  `),await $i(f,f)}await Mi(f),await Ci(C,P),n.stop("Project files generated.")}catch(b){n.stop("Generation failed."),k.cancel(D(b)),process.exit(1)}!await Vi(f)&&C.demo===!0&&(k.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let Ee=await Bi(f);await Ki(f),Ee&&await Gi(f);let te=nt("docker"),Se=nr(C).map(b=>b.key).filter(b=>!C.credentials?.[b]);Hi(C,{pnpmInstalled:Ee,dockerAvailable:te,skippedCredentials:Se}),Gr(),k.log.info(tl.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as jr}from"fs";import{readFile as no}from"fs/promises";import{join as at,resolve as ul}from"path";import*as y from"@clack/prompts";import N from"picocolors";import{mkdtemp as ol,rm as sl}from"fs/promises";import{tmpdir as al}from"os";import{join as cl}from"path";async function Cr(e,t,r,n){let i=await ol(cl(al(),"generatesaas-stage-"));try{await Ct(e,t,i),await zt({...r,projectDir:i}),await Tr(i,n)}finally{await sl(i,{recursive:!0,force:!0})}}function St(e){return e.paymentProvider!==void 0&&e.paymentProvider!=="none"}var Lr=[{key:"architecture",label:"Architecture",hint:"Fullstack (frontend hosts the API) or a standalone Hono backend.",category:"Infrastructure",kind:"enum",default:"fullstack",choices:He,adoptable:!1,impact:"structural",shapesTree:!0},{key:"deploymentTarget",label:"Deployment target",hint:"Node.js / Docker or Vercel serverless.",category:"Infrastructure",kind:"enum",default:"node",choices:ae,adoptable:!1,impact:"config",shapesTree:!0},{key:"databaseProvider",label:"Database provider",hint:"Self-hosted PostgreSQL, Neon, or Supabase.",category:"Infrastructure",kind:"enum",default:"postgres",choices:ce,adoptable:!1,impact:"config",shapesTree:!0},{key:"cacheProvider",label:"Cache provider",hint:"Self-hosted Redis or Upstash.",category:"Infrastructure",kind:"enum",default:"redis",choices:le,adoptable:!1,impact:"config",shapesTree:!0},{key:"paymentProvider",label:"Payment provider",hint:"Stripe, Polar, or none.",category:"Features",kind:"enum",default:"none",choices:Ye,adoptable:!1,impact:"structural",shapesTree:!0},{key:"defaultCurrency",label:"Default currency",hint:"Billing and pricing currency.",category:"Features",kind:"enum",default:"USD",choices:se,adoptable:!1,impact:"config",shapesTree:!1},{key:"emailProvider",label:"Email provider",hint:"SMTP, Amazon SES, or Resend.",category:"Features",kind:"enum",default:"smtp",choices:We,adoptable:!1,impact:"config",shapesTree:!1},{key:"observability",label:"Observability",hint:"Which services receive your app's errors, and on PostHog its LLM analytics. Pick any combination - anything you do not pick costs nothing, since its SDK and its adapter are never generated.",category:"Features",kind:"multiselect",default:[],choices:V,adoptable:!0,impact:"config",shapesTree:!0},{key:"multiTenancy",label:"Multi-tenancy (organizations)",hint:"Adds organizations - teams, members, and shared resources.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!1},{key:"projects",label:"Projects",hint:"Adds projects - a switcher that scopes a user's work inside their account or organization.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"config",shapesTree:!1},{key:"docs",label:"Docs app",hint:"Adds the self-hosted Fumadocs documentation site (apps/docs).",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"desktop",label:"Desktop app",hint:"Adds the cross-platform desktop app (apps/electron, built with Electron).",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"ai",label:"AI features",hint:"Adds the AI surface (chat, models, automations, integrations) and unlocks the runner option. A desktop project ALWAYS ships the app's local AI stack: this option sets config.desktop.agents.enabled (the runtime gate on those screens). Off keeps config.ai.enabled false so the AI nav stays hidden - the AI packages still ship, because packages/translate depends on @repo/ai for the i18n pipeline every project uses.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"webAi",label:"AI in the web app",hint:"Whether the WEB app shows the AI surfaces - chat, automations, model and integration settings, and their nav entries. Off is the desktop-first shape: the desktop app is where your AI product lives and the website keeps account, billing and licensing only. The AI SERVICE is untouched either way (config.ai.enabled, the /api/ai routes and the desktop agents all stay exactly as your AI option set them), so the desktop app keeps talking to the same backend. Only meaningful with both AI features and the desktop app, and never with the runner - its pairing and device screens are part of the web AI surface.",category:"Features",kind:"boolean",default:!0,adoptable:!0,impact:"config",shapesTree:!1,requires:e=>e.ai===!0&&e.desktop===!0&&e.runner!==!0,requiresLabel:"requires AI features and the desktop app, and is unavailable with the runner (its pairing and device screens live in the web AI surface)"},{key:"runner",label:"Runner daemon",hint:"Lets your users connect a machine that runs their own AI subscriptions (and any device-side work you add) on their hardware. They install AgentRunner, the daemon we publish and keep updated - your project ships the pairing, dispatch and Runners surface, never the daemon. Needs an always-on backend: the transport holds one connection open per paired device, which serverless (Vercel) cannot do.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0,requires:e=>e.ai===!0&&e.webAi!==!1&&ie({...e,runner:!0})===void 0,requiresLabel:"requires AI features, the web AI surface, and an always-on deployment target (not Vercel)"},{key:"credits",label:"Metered credits",hint:"Adds metered usage credits on top of subscription plans.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"config",shapesTree:!1,requires:e=>St(e),requiresLabel:"requires a payment provider"},{key:"revenueSharing",label:"Revenue sharing",hint:"Opt-in MRR leaderboard with dofollow backlinks.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"config",shapesTree:!1}];function ll(e,t){return e[t]!==void 0}function qi(e){return Lr.filter(t=>t.adoptable&&!ll(e,t.key)&&(t.requires?t.requires(e):!0)).map(t=>({key:t.key,label:t.label,hint:t.hint,kind:t.kind,default:typeof t.default=="function"?t.default(e):t.default,...t.choices?{choices:t.choices}:{},impact:t.impact,...t.requiresLabel?{requiresLabel:t.requiresLabel}:{}}))}function pl(e,t){switch(e.kind){case"boolean":return typeof t=="boolean";case"enum":return typeof t=="string"&&(e.choices??[]).includes(t);case"multiselect":return Array.isArray(t)&&t.every(r=>typeof r=="string"&&(e.choices??[]).includes(r))}}function dl(e){let t=(e.choices??[]).map(r=>JSON.stringify(r)).join(", ");switch(e.kind){case"boolean":return"true or false";case"enum":return`one of ${t}`;case"multiselect":return`an array of ${t}`}}function Ji(e){let t=[];for(let r of Lr){let n=e[r.key];n!==void 0&&(pl(r,n)||t.push(`\`${r.key}\` is ${JSON.stringify(n)}, but it must be ${dl(r)}.`))}return t}function Xi(e){let t={};for(let r of Lr)if(typeof r.default=="function"){if(r.requires&&!r.requires(e))continue;t[r.key]=r.default(e)}else t[r.key]=Array.isArray(r.default)?[...r.default]:r.default;return{...t,...e}}function Zi(e){return e?"ON":"OFF"}var st="packages/config/src/index.ts";function Qi(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 eo(e){return[...Ge({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var $r=[{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 is now `runner`, because the daemon it names is AgentRunner. Your recorded choice was migrated across automatically - the feature itself is unchanged."},{key:"companionSource",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionSource\`: your project recorded a \`${String(e.companionSource)}\` daemon source. There is now one runner daemon - AgentRunner - which we publish and your users install from its own releases. Your project keeps the runner feature and its own pairing, dispatch and Runners page; it no longer holds or brands a daemon.`},{key:"companionName",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionName\`: your project recorded a branded daemon called ${e.companionName}. Buyers no longer brand or publish a daemon - your users install AgentRunner, which we maintain. Their existing install of your old daemon keeps running until they switch.`},{key:"companionRepoUrl",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionRepoUrl\`: your project pointed its install flow at ${e.companionRepoUrl}. It now points at AgentRunner, the one daemon we publish.`},{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 choice behind it - there is one runner daemon (AgentRunner) and we publish it, so nothing in your project is built from a local 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 ${st} or their sign-in buttons stop rendering.`},{key:"mcpServer",severity:"warn",preserved:e=>e.mcpServer!==!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. Set \`config.mcpServer.enabled\` to \`true\` in ${st} 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 ${st}. 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===St(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${Zi(e.aiBuiltin)}, but it is now a plain config value generated ${Zi(St(e))} for a project ${St(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${st} 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 ${st} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>Qi(e).join(",")===eo(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${Qi(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 ${eo(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===Wr.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 (${$e.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 ${st} to drop a section for good.`}],Tf=$r.map(e=>e.key);function to(e){for(let t of $r)t.normalize?.(e)}function ro(e){let t=[];for(let r of $r){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 io(e){e.command("update").description("Update AI skill files and stage template updates").argument("[mode]","pass 'auto' to mark the staged update for unattended apply by your AI assistant").option("--cwd <path>","project directory (default: current directory)").action(async(t,r)=>{let n=t==="auto"?"auto":void 0,i=ul(r.cwd??process.cwd()),s=at(i,ye),o;try{o=JSON.parse(await no(s,"utf-8"))}catch{y.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}o.frontend===ir&&(y.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${ir}"\`).
1405
1405
 
1406
1406
  v${or} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
@@ -1452,7 +1452,7 @@ ${g}`}).join(`
1452
1452
  `]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
1453
1453
  `],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function Ll(){return $e.flatMap(e=>xr.map(t=>Ue(e,t)))}function Mr(e){return Zt(e)?(Dl(e,{recursive:!0}),!0):!1}function $l(e,t,r=[]){if(!Zt(e))return!1;let n=Fr(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:(mo(e,i,"utf-8"),!0)}function jl(e){let t=Ue(e,".gitignore");if(!Zt(t))return!1;let r=Fr(t,"utf-8"),n=r.split(`
1454
1454
  `).filter(i=>!i.includes(".generatesaas")).join(`
1455
- `);return n===r?!1:(mo(t,n,"utf-8"),!0)}function fo(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ue(t,ye),n;try{n=JSON.parse(Fr(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 Ll())Mr(Ue(t,a))&&s.push(a);for(let a of Nl)Mr(Ue(t,a))&&s.push(a);Mr(Ue(t,Y))&&s.push(Y+"/");for(let a of Cl){let p=Ue(t,a.file);$l(p,a.removals,a.replacements)?o.push(a.file):Zt(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}jl(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 Me=new Ul().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.4.0").addHelpText("after",`
1455
+ `);return n===r?!1:(mo(t,n,"utf-8"),!0)}function fo(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ue(t,ye),n;try{n=JSON.parse(Fr(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 Ll())Mr(Ue(t,a))&&s.push(a);for(let a of Nl)Mr(Ue(t,a))&&s.push(a);Mr(Ue(t,Y))&&s.push(Y+"/");for(let a of Cl){let p=Ue(t,a.file);$l(p,a.removals,a.replacements)?o.push(a.file):Zt(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}jl(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 Me=new Ul().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.4.1").addHelpText("after",`
1456
1456
  Examples:
1457
1457
  $ generatesaas init Interactive setup
1458
1458
  $ 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.4.0",
3
+ "version": "3.4.1",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",