generatesaas 3.3.0 → 3.3.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 $l}from"commander";import*as uo from"@clack/prompts";import{ex
5
5
  `),_=[U!=="none"?` Payment: ${h.cyan(Rt[U].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")}`]:[],...re?[]:[` Web AI: ${h.dim("No")} (desktop-first)`],` Email: ${h.cyan(It[ee].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: ${v?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
  `),he=[h.bold("Project"),c,"",h.bold("Infrastructure"),d,"",h.bold("Features"),_];if(Pe.length>0){let Qt=Pe.map(Fr=>{let mo=ct[Fr.key]?h.green("provided"):h.dim("skipped");return` ${Fr.key}: ${mo}`}).join(`
7
7
  `);he.push("",h.bold("Credentials"),Qt)}m.note(he.join(`
8
- `),"Summary");let Mr=await m.confirm({message:"Proceed with these settings?"});(m.isCancel(Mr)||!Mr)&&(m.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:P,deploymentTarget:a,databaseProvider:f,cacheProvider:C,paymentProvider:U,emailProvider:ee,observability:Fe,multiTenancy:Se,projects:v,docs:L,desktop:J,ai:T,webAi:re,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 dn,existsSync as Po}from"fs";import{mkdir as Ro}from"fs/promises";import{join as Io}from"path";import{Readable as To}from"stream";import{pipeline as ur}from"stream/promises";import{extract as _o}from"tar";import{join as Oe}from"path";import{homedir as go}from"os";var dt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",Y=".generatesaas",ge=Oe(Y,"manifest.json"),en="nextjs",ir="nuxt",or="2.4.1",tn=Oe(Y,"hashes.json"),xt=Oe(Y,"template-hashes.json"),Dt=Oe(Y,"template"),rn=Oe(Y,"staging"),nn=Oe(Y,"staging.json"),le=Oe(go(),".generatesaas");var $=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function pe(e){return{apiKey:e,baseUrl:dt}}async function ye(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.3.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 yo,readFileSync as vo,writeFileSync as wo,mkdirSync as bo}from"fs";import{dirname as ko}from"path";import*as ve from"@clack/prompts";function ut(){if(!yo(le))return null;try{let e=JSON.parse(vo(le,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&ve.log.warning(`Found old GitHub token in ${le}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function xe(e){bo(ko(le),{recursive:!0}),wo(le,JSON.stringify({apiKey:e},null," ")+`
8
+ `),"Summary");let Mr=await m.confirm({message:"Proceed with these settings?"});(m.isCancel(Mr)||!Mr)&&(m.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:s,architecture:P,deploymentTarget:a,databaseProvider:f,cacheProvider:C,paymentProvider:U,emailProvider:ee,observability:Fe,multiTenancy:Se,projects:v,docs:L,desktop:J,ai:T,webAi:re,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 dn,existsSync as Po}from"fs";import{mkdir as Ro}from"fs/promises";import{join as Io}from"path";import{Readable as To}from"stream";import{pipeline as ur}from"stream/promises";import{extract as _o}from"tar";import{join as Oe}from"path";import{homedir as go}from"os";var dt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",Y=".generatesaas",ge=Oe(Y,"manifest.json"),en="nextjs",ir="nuxt",or="2.4.1",tn=Oe(Y,"hashes.json"),xt=Oe(Y,"template-hashes.json"),Dt=Oe(Y,"template"),rn=Oe(Y,"staging"),nn=Oe(Y,"staging.json"),le=Oe(go(),".generatesaas");var $=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function pe(e){return{apiKey:e,baseUrl:dt}}async function ye(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.3.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 yo,readFileSync as vo,writeFileSync as wo,mkdirSync as bo}from"fs";import{dirname as ko}from"path";import*as ve from"@clack/prompts";function ut(){if(!yo(le))return null;try{let e=JSON.parse(vo(le,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&ve.log.warning(`Found old GitHub token in ${le}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function xe(e){bo(ko(le),{recursive:!0}),wo(le,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 ve.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return ve.isCancel(e)&&(ve.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as Eo}from"fs/promises";async function we(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await Eo(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 ye(e,"/versions")).json()}async function on(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await ye(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof $&&r.status===404)return null;throw r}}async function sn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skillMd:`# Offline skill stub
10
10
  `,scripts:{}}:await(await ye(e,`/skill/${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 an(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 ye(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function cn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await ye(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 ln(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 So=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),pn=["scripts/docs-lint.ts"],Ao=["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(pn.includes(e)||pn.some(r=>r.startsWith(e+"/")))return!1;if(So.has(t[0]))return!0;for(let r of Ao)if(e===r||e.startsWith(r+"/"))return!0;return!1}async function Ct(e,t,r){await Ro(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Io(n,`v${t}.tar.gz`);if(!Po(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await ur(dn(a),mr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await ur(dn(i),mr(r));return}let s=await ye(e,`/template/${encodeURIComponent(t)}`);if(!s.body)throw new Error("Empty response body");let o=To.fromWeb(s.body);await ur(o,mr(r))}function mr(e){return _o({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 mn,rmdir as Oo,writeFile as ft}from"fs/promises";import{join as B}from"path";async function fn(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 fn(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await mn(i,{force:!0})}return r||await Oo(e).catch(()=>{}),r}async function hn(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 fn(B(a,u.name))}let i=await Co(e),s=new Set([...n].filter(o=>i===void 0||i.has(o)));await Promise.all([...s].map(o=>mn(B(e,"apps/web/public/images",o),{recursive:!0,force:!0}))),await $o(e,s)}var xo="packages/config/src/index.ts",Do=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,No=/\bslug:\s*"([^"]+)"/g;async function Co(e){let t;try{t=await Xe(B(e,xo),"utf-8")}catch{return}let r=Do.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 Lo="packages/translate/.meta/mdx-translation-meta.json";async function $o(e,t){if(t.size===0)return;let r=B(e,Lo),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("/"),w=u.length>1?u[0]:void 0,g=u[u.length-1]?.startsWith("_")===!0;w!==void 0&&t.has(w)&&!g||(o[a]=p)}await ft(r,JSON.stringify({...i,files:o},null," ")+`
11
11
  `)}var jo="packages/config/src/blog.ts";async function gn(e){let t=B(e,jo),r=await Xe(t,"utf-8"),n=un(un(r,"blogCategories",t),"blogAuthors",t);await ft(t,n)}function un(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 yn(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 Ui(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 Mi(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 Fi(e){try{return await ji(xr(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 Vi(e){if(!nt("pnpm"))return!1;try{await ji(xr(e,".git"))}catch{return!1}try{let t=JSON.parse(await Hc(xr(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 Bi(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=>Kr[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=Yc(e);o.length>0&&s.push(`Set in production: ${z.dim(o.join(", "))}`),s.push("pnpm db:setup # Apply the database schema"),s.push(Wc(e)),it.note(s.join(`
1403
- `),z.yellow("Deployment"))}function Yc(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 Wc(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 Ki(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.3.0"){if(Ki(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 Gi(e,t,r="3.3.0"){if(Ki(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 Qc from"picocolors";var el="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function tl(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 Hi(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 Q("--architecture <type>","fullstack or separate").choices([...He])).addOption(new Q("--payment <provider>","payment provider").choices([...Ye])).addOption(new Q("--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 Q("--currency <code>","default currency for billing").choices([...oe])).addOption(new Q("--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 Q("--deploy <target>","deployment target").choices([...se])).addOption(new Q("--database <provider>","database provider").choices([...ae])).addOption(new Q("--cache <provider>","cache provider").choices([...ce])).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 Q("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new Q("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await rl(t?{...r,apiKey:t}:r)})}async function rl(e){let t=performance.now();Vr("3.3.0");let r;try{r=Xr(e)}catch(v){b.cancel(D(v)),process.exit(1)}let n=b.spinner(),i;try{i=await qe({apiKey:e.apiKey,prompt:!e.yes})}catch(v){b.cancel(D(v)),process.exit(1)}e.demo&&Ir(i)!==el&&(b.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=pe(i),o,a=async()=>{o=await we(s);let v=Xt(o,"init");if(!v.ok)throw new Error(v.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,w=!0,g=!0;try{({latestVersion:p,selectedVersion:u,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(v){if(n.stop("Access verification failed."),v instanceof $&&v.status===401){e.yes&&(b.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),b.log.warning("Invalid API key."),i=await mt(),s=pe(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:u,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(L){n.stop("Access verification failed."),b.cancel(L instanceof $&&L.status===401?"Invalid API key.":D(L)),process.exit(1)}}else b.cancel(D(v)),process.exit(1)}b.log.success(`Latest version: ${p}`),r.desktop===!0&&!w&&(b.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&&(b.cancel("The runner is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let k;e.yes?k=Zr({...r,...w?{}:{desktop:!1},...g?{}:{runner:!1}}):k=await Qr(r,{desktopAllowed:w,runnerAllowed:g});let P;n.start("Activating license...");try{let v=e.demo&&k.baseUrl?await tl(k.baseUrl):crypto.randomUUID(),L=()=>({frontend:sr,version:u,installId:v,projectName:k.projectName,options:an(k)}),te;try{te=await ar(s,L())}catch(J){let T=Nt(J);if(!T?.lastAllowedVersion||!o)throw J;n.stop("License activation failed.");let fe=Gi(o,T.lastAllowedVersion);if(fe.ok||(b.cancel(`${T.message} ${fe.message}`),process.exit(1)),e.yes){let F=Jt(o,T.lastAllowedVersion);b.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 b.confirm({message:`Your update window has ended. Continue with v${T.lastAllowedVersion} (the last version your license covers)?`});(b.isCancel(Ae)||!Ae)&&(b.cancel("Setup cancelled."),process.exit(0)),u=T.lastAllowedVersion,n.start(`Activating license for v${u}...`),te=await ar(s,L())}P={token:te.token,keyHash:Ir(i),installId:te.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),b.cancel(D(v)),process.exit(1)}let f=Zc(k.projectDir);if(zc(f)&&qc(f).length>0)if(e.yes)b.log.info(`Directory ${f} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await b.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"}]});(b.isCancel(L)||L==="cancel")&&(b.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Jc(f,{recursive:!0,force:!0})}let C={...k,projectDir:f,version:u,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(s,u,f),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),b.cancel(D(v)),process.exit(1)}n.start("Generating project files...");try{if(await zt(C),!e.demo){let v=await tt(f);await l(Xc(f,xt),JSON.stringify(v,null," ")+`
1403
+ `),z.yellow("Deployment"))}function Yc(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 Wc(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 Ki(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.3.1"){if(Ki(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 Gi(e,t,r="3.3.1"){if(Ki(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 Qc from"picocolors";var el="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function tl(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 Hi(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 Q("--architecture <type>","fullstack or separate").choices([...He])).addOption(new Q("--payment <provider>","payment provider").choices([...Ye])).addOption(new Q("--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 Q("--currency <code>","default currency for billing").choices([...oe])).addOption(new Q("--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 Q("--deploy <target>","deployment target").choices([...se])).addOption(new Q("--database <provider>","database provider").choices([...ae])).addOption(new Q("--cache <provider>","cache provider").choices([...ce])).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 Q("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new Q("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await rl(t?{...r,apiKey:t}:r)})}async function rl(e){let t=performance.now();Vr("3.3.1");let r;try{r=Xr(e)}catch(v){b.cancel(D(v)),process.exit(1)}let n=b.spinner(),i;try{i=await qe({apiKey:e.apiKey,prompt:!e.yes})}catch(v){b.cancel(D(v)),process.exit(1)}e.demo&&Ir(i)!==el&&(b.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let s=pe(i),o,a=async()=>{o=await we(s);let v=Xt(o,"init");if(!v.ok)throw new Error(v.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,w=!0,g=!0;try{({latestVersion:p,selectedVersion:u,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(v){if(n.stop("Access verification failed."),v instanceof $&&v.status===401){e.yes&&(b.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),b.log.warning("Invalid API key."),i=await mt(),s=pe(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:u,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),xe(i)}catch(L){n.stop("Access verification failed."),b.cancel(L instanceof $&&L.status===401?"Invalid API key.":D(L)),process.exit(1)}}else b.cancel(D(v)),process.exit(1)}b.log.success(`Latest version: ${p}`),r.desktop===!0&&!w&&(b.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&&(b.cancel("The runner is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let k;e.yes?k=Zr({...r,...w?{}:{desktop:!1},...g?{}:{runner:!1}}):k=await Qr(r,{desktopAllowed:w,runnerAllowed:g});let P;n.start("Activating license...");try{let v=e.demo&&k.baseUrl?await tl(k.baseUrl):crypto.randomUUID(),L=()=>({frontend:sr,version:u,installId:v,projectName:k.projectName,options:an(k)}),te;try{te=await ar(s,L())}catch(J){let T=Nt(J);if(!T?.lastAllowedVersion||!o)throw J;n.stop("License activation failed.");let fe=Gi(o,T.lastAllowedVersion);if(fe.ok||(b.cancel(`${T.message} ${fe.message}`),process.exit(1)),e.yes){let F=Jt(o,T.lastAllowedVersion);b.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 b.confirm({message:`Your update window has ended. Continue with v${T.lastAllowedVersion} (the last version your license covers)?`});(b.isCancel(Ae)||!Ae)&&(b.cancel("Setup cancelled."),process.exit(0)),u=T.lastAllowedVersion,n.start(`Activating license for v${u}...`),te=await ar(s,L())}P={token:te.token,keyHash:Ir(i),installId:te.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),b.cancel(D(v)),process.exit(1)}let f=Zc(k.projectDir);if(zc(f)&&qc(f).length>0)if(e.yes)b.log.info(`Directory ${f} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await b.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"}]});(b.isCancel(L)||L==="cancel")&&(b.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Jc(f,{recursive:!0,force:!0})}let C={...k,projectDir:f,version:u,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(s,u,f),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),b.cancel(D(v)),process.exit(1)}n.start("Generating project files...");try{if(await zt(C),!e.demo){let v=await tt(f);await l(Xc(f,xt),JSON.stringify(v,null," ")+`
1404
1404
  `),await Ci(f,f)}await $i(f),await Di(C,P),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),b.cancel(D(v)),process.exit(1)}!await Ui(f)&&C.demo===!0&&(b.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let Ee=await Mi(f);await Fi(f),Ee&&await Vi(f);let ee=nt("docker"),Se=nr(C).map(v=>v.key).filter(v=>!C.credentials?.[v]);Bi(C,{pnpmInstalled:Ee,dockerAvailable:ee,skippedCredentials:Se}),Br(),b.log.info(Qc.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as Lr}from"fs";import{readFile as eo}from"fs/promises";import{join as at,resolve as pl}from"path";import*as y from"@clack/prompts";import N from"picocolors";import{mkdtemp as nl,rm as il}from"fs/promises";import{tmpdir as ol}from"os";import{join as sl}from"path";async function Dr(e,t,r,n){let i=await nl(sl(ol(),"generatesaas-stage-"));try{await Ct(e,t,i),await zt({...r,projectDir:i}),await Tr(i,n)}finally{await il(i,{recursive:!0,force:!0})}}function St(e){return e.paymentProvider!==void 0&&e.paymentProvider!=="none"}var Nr=[{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:se,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:ae,adoptable:!1,impact:"config",shapesTree:!0},{key:"cacheProvider",label:"Cache provider",hint:"Self-hosted Redis or Upstash.",category:"Infrastructure",kind:"enum",default:"redis",choices:ce,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:oe,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&&ne({...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 al(e,t){return e[t]!==void 0}function Yi(e){return Nr.filter(t=>t.adoptable&&!al(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 cl(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 ll(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 Wi(e){let t=[];for(let r of Nr){let n=e[r.key];n!==void 0&&(cl(r,n)||t.push(`\`${r.key}\` is ${JSON.stringify(n)}, but it must be ${ll(r)}.`))}return t}function zi(e){let t={};for(let r of Nr)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 qi(e){return e?"ON":"OFF"}var st="packages/config/src/index.ts";function Ji(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 Xi(e){return[...Ge({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var Cr=[{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 ${qi(e.aiBuiltin)}, but it is now a plain config value generated ${qi(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=>Ji(e).join(",")===Xi(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${Ji(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 ${Xi(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===Hr.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.`}],Pf=Cr.map(e=>e.key);function Zi(e){for(let t of Cr)t.normalize?.(e)}function Qi(e){let t=[];for(let r of Cr){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 to(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=pl(r.cwd??process.cwd()),s=at(i,ge),o;try{o=JSON.parse(await eo(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 Nl(){return $e.map(e=>Ue(e,_r))}function jr(e){return Zt(e)?(Ol(e,{recursive:!0}),!0):!1}function Cl(e,t,r=[]){if(!Zt(e))return!1;let n=Ur(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:(lo(e,i,"utf-8"),!0)}function Ll(e){let t=Ue(e,".gitignore");if(!Zt(t))return!1;let r=Ur(t,"utf-8"),n=r.split(`
1454
1454
  `).filter(i=>!i.includes(".generatesaas")).join(`
1455
- `);return n===r?!1:(lo(t,n,"utf-8"),!0)}function po(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ue(t,ge),n;try{n=JSON.parse(Ur(r,"utf-8"))}catch{M.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await M.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(M.isCancel(i)&&(M.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)}),M.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{M.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let s=[],o=[];for(let a of Nl())jr(Ue(t,a))&&s.push(a);for(let a of xl)jr(Ue(t,a))&&s.push(a);jr(Ue(t,Y))&&s.push(Y+"/");for(let a of Dl){let p=Ue(t,a.file);Cl(p,a.removals,a.replacements)?o.push(a.file):Zt(p)&&M.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Ll(t)&&o.push(".gitignore");for(let a of s)M.log.info(`Deleted ${a}`);for(let a of o)M.log.info(`Modified ${a}`);M.log.success("Ejected successfully. This project is now fully standalone.")})}var Me=new $l().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.3.0").addHelpText("after",`
1455
+ `);return n===r?!1:(lo(t,n,"utf-8"),!0)}function po(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ue(t,ge),n;try{n=JSON.parse(Ur(r,"utf-8"))}catch{M.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await M.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(M.isCancel(i)&&(M.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)}),M.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{M.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let s=[],o=[];for(let a of Nl())jr(Ue(t,a))&&s.push(a);for(let a of xl)jr(Ue(t,a))&&s.push(a);jr(Ue(t,Y))&&s.push(Y+"/");for(let a of Dl){let p=Ue(t,a.file);Cl(p,a.removals,a.replacements)?o.push(a.file):Zt(p)&&M.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Ll(t)&&o.push(".gitignore");for(let a of s)M.log.info(`Deleted ${a}`);for(let a of o)M.log.info(`Modified ${a}`);M.log.success("Ejected successfully. This project is now fully standalone.")})}var Me=new $l().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.3.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.3.0",
3
+ "version": "3.3.1",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",