generatesaas 3.32.1 → 3.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import{Command as Jp}from"commander";import*as Ds from"@clack/prompts";import{ex
5
5
  `),R=[u!=="none"?` Payment: ${y.cyan(_t[u].label)} (${O})`:` Payment: ${y.dim("none")}`,` Credits: ${W?y.cyan("Yes"):y.dim("No")}`,` AI features: ${F?y.cyan("Yes"):y.dim("No")}`,...ve?[]:[` Web AI: ${y.dim("No")} (app-first)`],` Email: ${y.cyan(Ot[be].label)}`,` Observability: ${B.length===0?y.dim("none"):y.cyan(B.map(ir=>xt[ir].label).join(", "))}`,` Multi-tenancy: ${oe?y.cyan("Yes"):y.dim("No")}`,` Projects: ${Oe?y.cyan("Yes"):y.dim("No")}`,` Docs app: ${xe?y.cyan("Yes"):y.dim("No")}`,` Desktop app: ${we?y.cyan("Yes"):y.dim("No")}`,` Mobile app: ${v?y.cyan("Yes"):y.dim("No")}`,...L==="none"?[]:[` In-app purch.: ${y.cyan("RevenueCat")}`],` Rev. sharing: ${$?y.cyan("Yes"):y.dim("No")}`].join(`
6
6
  `),Ee=[y.bold("Project"),c,"",y.bold("Infrastructure"),d,"",y.bold("Features"),R];if(z.length>0){let ir=z.map(Jr=>{let Ns=T[Jr.key]?y.green("provided"):y.dim("skipped");return` ${Jr.key}: ${Ns}`}).join(`
7
7
  `);Ee.push("",y.bold("Credentials"),ir)}f.note(Ee.join(`
8
- `),"Summary");let zr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(zr)||!zr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as kn,existsSync as Ws}from"fs";import{mkdir as zs}from"fs/promises";import{join as Js}from"path";import{Readable as qs}from"stream";import{pipeline as br}from"stream/promises";import{extract as Xs}from"tar";import{join as Me}from"path";import{homedir as Ms}from"os";var wt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",J=".generatesaas",ue=Me(J,"manifest.json"),dn="nextjs",pr="nuxt",dr="2.4.1",un=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),mn=Me(J,"staging"),hn=Me(J,"staging.json"),me=Me(Ms(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.32.1"}});if(!i.ok){let o,s;try{s=await i.json(),o=s.error??`API ${i.status}: ${t}`}catch{o=`API ${i.status}: ${t}`}throw new j(i.status,o,s)}return i}import{existsSync as Us,mkdirSync as Fs,readFileSync as Vs,writeFileSync as Bs}from"fs";import{dirname as Ks}from"path";import*as Pe from"@clack/prompts";function vt(){if(!Us(me))return null;try{let e=JSON.parse(Vs(me,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${me}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Ue(e){Fs(Ks(me),{recursive:!0}),Bs(me,`${JSON.stringify({apiKey:e},null," ")}
8
+ `),"Summary");let zr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(zr)||!zr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as kn,existsSync as Ws}from"fs";import{mkdir as zs}from"fs/promises";import{join as Js}from"path";import{Readable as qs}from"stream";import{pipeline as br}from"stream/promises";import{extract as Xs}from"tar";import{join as Me}from"path";import{homedir as Ms}from"os";var wt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",J=".generatesaas",ue=Me(J,"manifest.json"),dn="nextjs",pr="nuxt",dr="2.4.1",un=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),mn=Me(J,"staging"),hn=Me(J,"staging.json"),me=Me(Ms(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.33.0"}});if(!i.ok){let o,s;try{s=await i.json(),o=s.error??`API ${i.status}: ${t}`}catch{o=`API ${i.status}: ${t}`}throw new j(i.status,o,s)}return i}import{existsSync as Us,mkdirSync as Fs,readFileSync as Vs,writeFileSync as Bs}from"fs";import{dirname as Ks}from"path";import*as Pe from"@clack/prompts";function vt(){if(!Us(me))return null;try{let e=JSON.parse(Vs(me,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${me}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Ue(e){Fs(Ks(me),{recursive:!0}),Bs(me,`${JSON.stringify({apiKey:e},null," ")}
9
9
  `,{mode:384})}async function at(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=vt();if(r)return r;if(!e?.prompt)throw new Error("API key not found. Set GENERATESAAS_API_KEY or run 'generatesaas init' to configure.");return kt()}async function kt(){let e=await Pe.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return Pe.isCancel(e)&&(Pe.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as Gs}from"fs/promises";async function Ae(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await Gs(t,"utf-8")):process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{latest:"0.0.0-ci",versions:[{version:"0.0.0-ci",date:new Date().toISOString(),breaking:!1}],entitlements:null}:await(await Se(e,"/versions")).json()}async function fn(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await Se(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof j&&r.status===404)return null;throw r}}async function gn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skills:{"generatesaas-update":{skillMd:`# Offline skill stub
10
10
  `,scripts:{},references:{}}}}:await(await Se(e,`/skills/${encodeURIComponent(t)}`)).json()}function $t(e){if(!(e instanceof j)||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 ur="nextjs";function yn(e){return{frontend:ur,architecture:e.architecture,deployTarget:e.deploymentTarget,database:e.databaseProvider,cache:e.cacheProvider,payment:e.paymentProvider,email:e.emailProvider,multiTenancy:e.multiTenancy,blog:!0,docs:e.docs,desktop:e.desktop,mobile:e.mobile,runner:!1,credits:e.credits,revenueSharing:e.revenueSharing,currency:e.defaultCurrency}}async function mr(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:"offline-test-token",licenseId:"offline-test-license-id",installId:t.installId}:await(await Se(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function bn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await Se(e,"/license/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function hr(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 wn(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 fr=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"]),gr=new Set(["pnpm-lock.yaml","widget-documents.generated.ts"]);function ct(e){if(yr(e))return!0;for(let t of e.split("/"))if(gr.has(t))return!0;return!1}var Hs=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),vn=["scripts/docs-lint.ts"],Ys=["docs/superpowers","packages/cli","packages/cli-api","packages/database/tests/no-migration-history.test.ts","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function yr(e){let t=e.split("/");for(let r of t)if(fr.has(r))return!0;if(vn.includes(e)||vn.some(r=>r.startsWith(`${e}/`)))return!1;if(Hs.has(t[0]))return!0;for(let r of Ys)if(e===r||e.startsWith(`${r}/`))return!0;return!1}async function jt(e,t,r){await zs(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Js(n,`v${t}.tar.gz`);if(!Ws(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await br(kn(a),wr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await br(kn(i),wr(r));return}let o=await Se(e,`/template/${encodeURIComponent(t)}`);if(!o.body)throw new Error("Empty response body");let s=qs.fromWeb(o.body);await br(s,wr(r))}function wr(e){return Xs({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!yr(r):!0},sync:!1})}import{readdir as Mt,readFile as lt,rm as Sn,rmdir as Zs,writeFile as Et}from"fs/promises";import{join as G}from"path";async function Pn(e){let t;try{t=await Mt(e,{withFileTypes:!0})}catch{return!1}let r=!1;for(let n of t){let i=G(e,n.name);if(n.isDirectory()){await Pn(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await Sn(i,{force:!0})}return r||await Zs(e).catch(()=>{}),r}async function An(e){let t=G(e,"packages/content"),r=[];try{r=(await Mt(t,{withFileTypes:!0})).filter(s=>s.isDirectory()).map(s=>s.name)}catch{return}let n=new Set;for(let s of r){let a=G(t,s),p;try{p=(await Mt(a,{withFileTypes:!0})).filter(h=>h.isDirectory())}catch{continue}for(let h of p)n.add(h.name),await Pn(G(a,h.name))}let i=await ro(e),o=new Set([...n].filter(s=>i===void 0||i.has(s)));await Promise.all([...o].map(s=>Sn(G(e,"apps/web/public/images",s),{recursive:!0,force:!0}))),await io(e,o)}var Qs="packages/config/src/index.ts",eo=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,to=/\bslug:\s*"([^"]+)"/g;async function ro(e){let t;try{t=await lt(G(e,Qs),"utf-8")}catch{return}let r=eo.exec(t)?.[1];if(r===void 0)return;let n=[...r.matchAll(to)].map(i=>i[1]).filter(i=>i!==void 0);return n.length>0?new Set(n):void 0}var no="packages/translate/.meta/mdx-translation-meta.json";async function io(e,t){if(t.size===0)return;let r=G(e,no),n;try{n=JSON.parse(await lt(r,"utf-8"))}catch{return}if(typeof n!="object"||n===null)return;let i=n;if(typeof i.locales!="object"||i.locales===null)return;let o={};for(let[s,a]of Object.entries(i.locales)){if(typeof a!="object"||a===null)continue;let p={};for(let[h,g]of Object.entries(a)){let k=h.split("/"),w=k.length>1?k[0]:void 0,P=k[k.length-1]?.startsWith("_")===!0;w!==void 0&&t.has(w)&&!P||(p[h]=g)}o[s]=p}await Et(r,`${JSON.stringify({...i,locales:o},null," ")}
11
11
  `)}var so="packages/config/src/blog.ts";async function In(e){let t=G(e,so),r=await lt(t,"utf-8"),n=En(En(r,"blogCategories",t),"blogAuthors",t);await Et(t,n)}function En(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 Tn(e){let t=G(e,"packages/i18n/translations"),r;try{r=await Mt(t)}catch{return}for(let n of r){let i=G(t,n,"web.json"),o;try{o=await lt(i,"utf-8")}catch{continue}let s=JSON.parse(o);!s.content?.categories||s.content.categories.blog===void 0||(s.content.categories.blog={},await Et(i,`${JSON.stringify(s,null," ")}
@@ -1602,7 +1602,7 @@ ${p}${g}`}import{readFile as Oi}from"fs/promises";import{existsSync as Rc}from"f
1602
1602
  export { ops } from "./${r}/index";
1603
1603
  `;await l(Wt(t,"providers/index.ts"),i),await l(Wt(t,"index.ts"),await $c(t,r))}async function $c(e,t){let r=Wt(e,"index.ts");if(!Cc(r))throw new Error(`generatePaymentBarrel: expected ${r} to exist - did packages/payments move?`);let n=await Nc(r,"utf-8"),i=Ni.filter(s=>s!==t);return n.split(`
1604
1604
  `).filter(s=>!i.some(a=>s.includes(`./providers/${a}/`))).join(`
1605
- `)}import{access as jc,readFile as qt,rm as zt}from"fs/promises";import{join as Z}from"path";var Ui=["sentry","posthog"],Cr={sentry:"src/providers/sentry",posthog:"src/providers/posthog"},Jt={sentry:["tests/sentry-load-guard.test.ts","tests/sentry-browser-scrub.test.ts"],posthog:["tests/posthog-load-guard.test.ts","tests/llm-analytics.test.ts"]},Mc=["tests/resolution.test.ts","tests/export-isolation.test.ts"],Uc=["src/providers/sentry/desktop-main.ts","src/providers/sentry/desktop-renderer.ts","src/resolve-desktop-main.ts","src/resolve-desktop-renderer.ts"],Fc=["./desktop-main","./desktop-renderer"],Vc=[`vi.mock("@sentry/electron/main", sdk.factories["@sentry/electron/main"]);
1605
+ `)}import{access as jc,readFile as qt,rm as zt}from"fs/promises";import{join as Z}from"path";var Ui=["sentry","posthog"],Cr={sentry:"src/providers/sentry",posthog:"src/providers/posthog"},Jt={sentry:["tests/sentry-load-guard.test.ts","tests/sentry-browser-scrub.test.ts","tests/sentry-server-scrub.test.ts"],posthog:["tests/posthog-load-guard.test.ts","tests/llm-analytics.test.ts"]},Mc=["tests/resolution.test.ts","tests/export-isolation.test.ts"],Uc=["src/providers/sentry/desktop-main.ts","src/providers/sentry/desktop-renderer.ts","src/resolve-desktop-main.ts","src/resolve-desktop-renderer.ts"],Fc=["./desktop-main","./desktop-renderer"],Vc=[`vi.mock("@sentry/electron/main", sdk.factories["@sentry/electron/main"]);
1606
1606
  `,`vi.mock("@sentry/electron/renderer", sdk.factories["@sentry/electron/renderer"]);
1607
1607
  `],Bc=[' describeGate("desktop main", "electronMain", async () => {',' describeGate("desktop renderer", "electronRenderer", async () => {',' describe("the desktop main init options", () => {',' describe("the desktop renderer init", () => {'],Li=`
1608
1608
  });
@@ -1726,7 +1726,7 @@ function posthogConfigured(): boolean {
1726
1726
  ${k}`:s.message))}else i()})})}async function ns(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await Te("pnpm",["install","--lockfile-only","--no-frozen-lockfile"],e),!0}catch(t){let r=t instanceof Error?t.message:String(t);return _.log.warn(`Lockfile regeneration failed: ${r}`),_.log.warn("Deploys using --frozen-lockfile may fail."),!1}}async function is(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping dependency installation."),_.log.info("Install pnpm: https://pnpm.io/installation"),!1;let t=_.spinner();t.start("Installing dependencies (this may take a minute)...");try{return await Te("pnpm",["install"],e),t.stop("Dependencies installed."),!0}catch(r){t.stop("Dependency installation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`pnpm install failed: ${n}`),_.log.warn("You can run it manually later."),!1}}async function ss(e){if(!Re("pnpm"))return!1;let t=_.spinner();t.start("Generating baseline database migration...");try{return await Te("pnpm",["-F","@repo/database","generate"],e),t.stop("Baseline migration generated."),!0}catch(r){t.stop("Baseline migration generation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not generate baseline migration: ${n}`),_.log.warn("Run 'pnpm -F @repo/database generate' before your first deploy."),!1}}async function os(e){if(!Re("pnpm"))return!1;try{await Br(Qt(e,"packages/mcp-widgets"))}catch{return!1}let t=_.spinner();t.start("Building the MCP widgets...");try{return await Te("pnpm",["-F","@repo/mcp-widgets","widgets:build"],e),t.stop("MCP widgets built."),!0}catch(r){t.stop("MCP widget build failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not build the MCP widgets: ${n}`),_.log.warn("Run 'pnpm -F @repo/mcp-widgets widgets:build' and commit the result."),!1}}async function as(e){try{return await Br(Qt(e,".git")),_.log.info("Git repository already exists, skipping init."),!0}catch{}if(!Re("git"))return _.log.warn("git not found. Skipping repository initialization."),!1;let t=_.spinner();t.start("Initializing git repository...");try{return await Te("git",["init"],e),await Te("git",["add","-A"],e),await Te("git",["commit","--no-verify","-m","Initial commit from GenerateSaaS"],e),t.stop("Git repository initialized."),!0}catch{return t.stop("Git initialization failed."),_.log.warn("You can run git init manually later."),!1}}async function cs(e){if(!Re("pnpm"))return!1;try{await Br(Qt(e,".git"))}catch{return!1}try{let t=JSON.parse(await sp(Qt(e,"package.json"),"utf-8")),r=!!t.devDependencies?.["simple-git-hooks"],n=!!t["simple-git-hooks"];if(!r||!n)return!1}catch{return!1}try{return await Te("pnpm",["exec","simple-git-hooks"],e),!0}catch{return _.log.warn("Could not install git hooks. Run 'pnpm exec simple-git-hooks' manually."),!1}}import*as Je from"@clack/prompts";import H from"picocolors";function ls(e,t){let r=rt(e);t.dockerAvailable||Je.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/"),t.baselineMigrationMissing&&Je.log.warn("No database migration was generated (the install did not complete). Run `pnpm install` then `pnpm --filter @repo/database generate` and commit the result BEFORE deploying - otherwise your first deploy pushes the schema untracked.");let n=[];n.push(`cd ${e.projectDir}`),t.pnpmInstalled||n.push("pnpm install"),t.mcpWidgetsUnbuilt&&n.push(`pnpm -F @repo/mcp-widgets widgets:build ${H.dim("# then commit the rebuilt widget document")}`),n.push(`pnpm infra ${H.dim(`# ${r.map(a=>Zr[a].label).join(", ")}`)}`),n.push(`pnpm dev ${H.dim("# http://localhost:3000")}`),t.skippedCredentials.length>0&&(n.push(""),n.push(H.dim("Fill in remaining TODO values in .env"))),Je.note(n.join(`
1727
1727
  `),H.yellow("Start Development"));let i=[];i.push(`App ${H.cyan("http://localhost:3000")}`),e.architecture==="separate"&&i.push(`API ${H.cyan("http://localhost:3010")}`),r.includes("mailpit")&&i.push(`Mailpit ${H.cyan("http://localhost:8025")}`),r.includes("inngest")&&i.push(`Inngest ${H.cyan("http://localhost:8288")}`),Je.note(i.join(`
1728
1728
  `),H.yellow("Dev Tools"));let o=[],s=op(e);s.length>0&&o.push(`Set in production: ${H.dim(s.join(", "))}`),o.push("pnpm db:setup # Apply the database schema"),o.push(ap(e)),Je.note(o.join(`
1729
- `),H.yellow("Deployment"))}function op(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function ap(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function er(e,t){return e.versions.find(r=>r.version===t)?.cli}function ps(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function tr(e,t,r="3.32.1"){if(ps(r))return{ok:!0};let n=er(e,e.latest);return!n||ht(n)===null?{ok:!0}:_e(r,n)>=0?{ok:!0}:{ok:!1,message:`Your installed generatesaas CLI (v${r}) is too old for template v${e.latest}, which needs CLI v${n} or newer. Run npx generatesaas@latest ${t} so npm fetches the current CLI. If the release happened minutes ago, npm may still be propagating it - retry shortly.`}}function ds(e,t,r="3.32.1"){if(ps(r))return{ok:!0};let n=er(e,t);return!n||ht(n)===null?{ok:!0}:_e(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import mp from"picocolors";var hp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function fp(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 us(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([...nt])).addOption(new Q("--payment <provider>","payment provider").choices([...it])).addOption(new Q("--email <provider>","email provider").choices([...st])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new Q("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...je])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new Q("--currency <code>","default currency for billing").choices([...ce])).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([...le])).addOption(new Q("--database <provider>","database provider").choices([...pe])).addOption(new Q("--cache <provider>","cache provider").choices([...de])).option("--observability <providers>",`comma-separated observability providers (${K.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 gp(t?{...r,apiKey:t}:r)})}async function gp(e){let t=performance.now();qr("3.32.1");let r;try{r=cn(e)}catch(v){E.cancel(N(v)),process.exit(1)}let n=E.spinner(),i;try{i=await at({apiKey:e.apiKey,prompt:!e.yes})}catch(v){E.cancel(N(v)),process.exit(1)}e.demo&&$r(i)!==hp&&(E.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=he(i),s,a=async()=>{s=await Ae(o);let v=tr(s,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:s.latest,selectedVersion:s.latest,desktopAllowed:s.entitlements?.desktopAllowed??!0,mobileAllowed:s.entitlements?.mobileAllowed??!0}};n.start("Verifying access...");let p,h,g=!0,k=!0;try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(v){if(n.stop("Access verification failed."),v instanceof j&&v.status===401){e.yes&&(E.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),E.log.warning("Invalid API key."),i=await kt(),o=he(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(L){n.stop("Access verification failed."),E.cancel(L instanceof j&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else E.cancel(N(v)),process.exit(1)}E.log.success(`Latest version: ${p}`),r.desktop===!0&&!g&&(E.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!k&&(E.cancel("The mobile app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=ln({...r,...g?{}:{desktop:!1},...k?{}:{mobile:!1}}):w=await pn(r,{desktopAllowed:g,mobileAllowed:k});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await fp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:ur,version:h,installId:v,projectName:w.projectName,options:yn(w)}),F;try{F=await mr(o,L())}catch(ve){let $=$t(ve);if(!$?.lastAllowedVersion||!s)throw ve;n.stop("License activation failed.");let W=ds(s,$.lastAllowedVersion);if(W.ok||(E.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=er(s,$.lastAllowedVersion);E.cancel(`${$.message} Re-run ${z?`npx generatesaas@${z} init`:"init"} without --yes to continue with v${$.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let ke=await E.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(E.isCancel(ke)||!ke)&&(E.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await mr(o,L())}P={token:F.token,keyHash:$r(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),E.cancel(N(v)),process.exit(1)}let u=up(w.projectDir);if(cp(u)&&lp(u).length>0)if(e.yes)E.log.info(`Directory ${u} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await E.select({message:`Directory ${u} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(E.isCancel(L)||L==="cancel")&&(E.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&pp(u,{recursive:!0,force:!0})}let O={...w,projectDir:u,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await jt(o,h,u),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),E.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Xt(O),!e.demo){let v=await mt(u);await l(dp(u,Ct),`${JSON.stringify(v,null," ")}
1729
+ `),H.yellow("Deployment"))}function op(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function ap(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function er(e,t){return e.versions.find(r=>r.version===t)?.cli}function ps(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function tr(e,t,r="3.33.0"){if(ps(r))return{ok:!0};let n=er(e,e.latest);return!n||ht(n)===null?{ok:!0}:_e(r,n)>=0?{ok:!0}:{ok:!1,message:`Your installed generatesaas CLI (v${r}) is too old for template v${e.latest}, which needs CLI v${n} or newer. Run npx generatesaas@latest ${t} so npm fetches the current CLI. If the release happened minutes ago, npm may still be propagating it - retry shortly.`}}function ds(e,t,r="3.33.0"){if(ps(r))return{ok:!0};let n=er(e,t);return!n||ht(n)===null?{ok:!0}:_e(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import mp from"picocolors";var hp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function fp(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 us(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([...nt])).addOption(new Q("--payment <provider>","payment provider").choices([...it])).addOption(new Q("--email <provider>","email provider").choices([...st])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new Q("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...je])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new Q("--currency <code>","default currency for billing").choices([...ce])).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([...le])).addOption(new Q("--database <provider>","database provider").choices([...pe])).addOption(new Q("--cache <provider>","cache provider").choices([...de])).option("--observability <providers>",`comma-separated observability providers (${K.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 gp(t?{...r,apiKey:t}:r)})}async function gp(e){let t=performance.now();qr("3.33.0");let r;try{r=cn(e)}catch(v){E.cancel(N(v)),process.exit(1)}let n=E.spinner(),i;try{i=await at({apiKey:e.apiKey,prompt:!e.yes})}catch(v){E.cancel(N(v)),process.exit(1)}e.demo&&$r(i)!==hp&&(E.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=he(i),s,a=async()=>{s=await Ae(o);let v=tr(s,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:s.latest,selectedVersion:s.latest,desktopAllowed:s.entitlements?.desktopAllowed??!0,mobileAllowed:s.entitlements?.mobileAllowed??!0}};n.start("Verifying access...");let p,h,g=!0,k=!0;try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(v){if(n.stop("Access verification failed."),v instanceof j&&v.status===401){e.yes&&(E.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),E.log.warning("Invalid API key."),i=await kt(),o=he(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(L){n.stop("Access verification failed."),E.cancel(L instanceof j&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else E.cancel(N(v)),process.exit(1)}E.log.success(`Latest version: ${p}`),r.desktop===!0&&!g&&(E.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!k&&(E.cancel("The mobile app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=ln({...r,...g?{}:{desktop:!1},...k?{}:{mobile:!1}}):w=await pn(r,{desktopAllowed:g,mobileAllowed:k});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await fp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:ur,version:h,installId:v,projectName:w.projectName,options:yn(w)}),F;try{F=await mr(o,L())}catch(ve){let $=$t(ve);if(!$?.lastAllowedVersion||!s)throw ve;n.stop("License activation failed.");let W=ds(s,$.lastAllowedVersion);if(W.ok||(E.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=er(s,$.lastAllowedVersion);E.cancel(`${$.message} Re-run ${z?`npx generatesaas@${z} init`:"init"} without --yes to continue with v${$.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let ke=await E.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(E.isCancel(ke)||!ke)&&(E.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await mr(o,L())}P={token:F.token,keyHash:$r(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),E.cancel(N(v)),process.exit(1)}let u=up(w.projectDir);if(cp(u)&&lp(u).length>0)if(e.yes)E.log.info(`Directory ${u} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await E.select({message:`Directory ${u} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(E.isCancel(L)||L==="cancel")&&(E.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&pp(u,{recursive:!0,force:!0})}let O={...w,projectDir:u,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await jt(o,h,u),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),E.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Xt(O),!e.demo){let v=await mt(u);await l(dp(u,Ct),`${JSON.stringify(v,null," ")}
1730
1730
  `),await Qi(u,u)}await rs(u),await Xi(O,P),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),E.cancel(N(v)),process.exit(1)}!await ns(u)&&O.demo===!0&&(E.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let B=await is(u),oe=O.demo!==!0&&e.dbMigration!==!1,Oe=!1;oe&&B&&(await ss(u),Oe=!0);let xe=B?await os(u):!1;await as(u),B&&await cs(u);let De=Re("docker"),Qe=lr(O).map(v=>v.key).filter(v=>!O.credentials?.[v]);ls(O,{pnpmInstalled:B,dockerAvailable:De,skippedCredentials:Qe,baselineMigrationMissing:oe&&!Oe,mcpWidgetsUnbuilt:O.ai&&!xe}),Xr(),E.log.info(mp.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as rr}from"fs";import{readFile as bs}from"fs/promises";import{join as qe,resolve as kp}from"path";import*as b from"@clack/prompts";import C from"picocolors";import{mkdtemp as yp,rm as bp}from"fs/promises";import{tmpdir as wp}from"os";import{join as vp}from"path";async function Kr(e,t,r,n,{olderRelease:i=!1}={}){let o=await yp(vp(wp(),"generatesaas-stage-"));try{await jt(e,t,o);let s=()=>Xt({...r,projectDir:o}),a=[];return i?a=await Xn(s):await s(),await jr(o,n),a}finally{await bp(o,{recursive:!0,force:!0})}}function ms(e){return e?"ON":"OFF"}var ft="packages/config/src/index.ts";function hs(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 fs(e){return[...rt({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var Gr=[{key:"errorTracking",severity:"warn",normalize:e=>{e.errorTracking===void 0||e.observability!==void 0||(e.observability=e.errorTracking==="none"?[]:[e.errorTracking])},preserved:()=>!0,describe:()=>"Retired option `errorTracking`: it is now `observability`, an array, because a project may run more than one provider at once. Your recorded choice was migrated across automatically."},{key:"companion",severity:"warn",normalize:e=>{e.companion===void 0||e.runner!==void 0||(e.runner=e.companion)},preserved:()=>!0,describe:()=>"Retired option `companion`: it was renamed to `runner`, and that lane has since been removed. Your recorded choice was migrated across automatically so the removal is reported under one name."},{key:"runner",severity:"warn",preserved:e=>e.runner!==!0,describe:()=>"Retired option `runner`: your project recorded the runner ON, and the paired-device lane is GONE - not moved to config, removed. This update deletes the pairing endpoint, the dispatch transport, the relay, the `/runner/*` routes and the Runners page from your project, so machines your users had paired are no longer reachable from it. Chat and automations keep running on your app's own AI backend (`config.ai`); nothing else about them changes."},{key:"companionSource",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionSource\`: your project recorded a \`${String(e.companionSource)}\` daemon source. The paired-device lane that daemon served has been removed from your project, so there is no daemon left to source.`},{key:"companionName",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionName\`: your project recorded a branded daemon called ${e.companionName}. The paired-device lane is gone, so your project no longer ships an install flow to brand. An existing install on a user's machine keeps running; it has nothing left to pair with here.`},{key:"companionRepoUrl",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionRepoUrl\`: your project pointed its install flow at ${e.companionRepoUrl}. The paired-device lane is gone, so there is no install flow left to point anywhere.`},{key:"companionLocalPath",severity:"warn",preserved:e=>(e.companionLocalPath??"").trim()==="",describe:e=>`Retired option \`companionLocalPath\`: your project recorded a local daemon checkout at ${e.companionLocalPath}. The option is gone, and so is the paired-device lane behind it - nothing in your project is built from a local daemon checkout any more.`},{key:"desktopAutoRelease",severity:"warn",applies:e=>e.desktop===!0,preserved:e=>e.desktopAutoRelease!==!0,describe:()=>"Retired option `desktopAutoRelease`: your project recorded automatic desktop releases, but the release trigger is no longer an option - cutting a release publishes signed installers from your repository and spends your Actions minutes, so it is always deliberate now. The staged `.github/workflows/desktop-release.yml` runs on `workflow_dispatch` only (the Actions tab). Add a `workflow_run` block to it if you want the CI-chained trigger back."},{key:"billingScope",severity:"ask",applies:e=>e.multiTenancy===!0,preserved:e=>e.billingScope!=="organization",describe:()=>"Retired option `billingScope`: your project recorded organization-scoped billing, and organization billing is GONE - not moved to config, removed. Money now lives only on a USER: an organization has no balance, no plan and no payment-provider customer of its own, and a workspace is funded by that organization's OWNER, whose personal balance every credit spent in it is drawn from. Payments already in flight are safe - a webhook arriving with old organization metadata is credited to that organization's owner rather than dropped - but a STORED balance is not: the `credits` and `plan` columns an organization holds them in are going away, and this update does NOT migrate them for you. MOVE every paying organization's credits and plan onto its owner BEFORE you take new checkouts, or that balance goes with the columns. How should this update proceed?"},{key:"socialProviders",severity:"warn",preserved:e=>(e.socialProviders??[]).length===0,describe:e=>`Retired option \`socialProviders\`: your project recorded ${(e.socialProviders??[]).join(", ")}, but it is now a plain config value that starts empty. Add those IDs back to \`config.auth.socialProviders\` in ${ft} or their sign-in buttons stop rendering.`},{key:"mcpServer",severity:"warn",preserved:e=>e.mcpServer!==!0,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 ${ft} to keep your /mcp endpoint and its settings tab.`},{key:"emailTracking",severity:"ask",preserved:e=>e.emailTracking!==!1,describe:()=>`Retired option \`emailTracking\`: your project recorded email open/click tracking OFF, but it is now a plain config value generated ON. Applying this update as-is starts tracking opens and clicks for every user you mail. Put it back by setting \`config.email.tracking.enabled\` to \`false\` in ${ft}. How should this update proceed?`},{key:"aiBuiltin",severity:"warn",normalize:e=>{e.aiBuiltin===void 0&&e.aiByok!==void 0&&(e.aiBuiltin=e.aiByok===!1)},applies:e=>e.ai===!0,preserved:e=>e.aiBuiltin===re(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${ms(e.aiBuiltin)}, but it is now a plain config value generated ${ms(re(e))} for a project ${re(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${ft} to keep your choice.`},{key:"aiByok",severity:"warn",applies:e=>e.ai===!0,preserved:e=>e.aiByok!==!1,describe:()=>`Retired option \`aiByok\`: your project recorded bring-your-own-key AI OFF, but it is now a plain config value generated ON. Set \`config.ai.byok\` to \`false\` in ${ft} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>hs(e).join(",")===fs(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${hs(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 ${fs(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===en.length,describe:e=>`Retired option \`aiTools\`: your project recorded ${(e.aiTools??[]).join(", ")||"no AI tools"}, but the \`generatesaas-update\` skill bundle now ships to every AI-tool root (${ze.join(", ")}) so it is there whichever assistant you switch to. Delete the roots you do not use - they are plain text files with no runtime path.`},{key:"blog",severity:"warn",preserved:e=>e.blog!==!1,describe:()=>`Retired option \`blog\`: your project recorded the blog OFF, but content is no longer an option. This update adds the \`/blog\`, \`/alternatives\` and \`/compare\` route code to your project; every one of them 404s until you add a file under \`packages/content/{locale}/{section}/\`, and none of them appears in your navbar, footer, sitemap or llms.txt while it is empty. Delete an entry from \`config.content.sections\` in ${ft} to drop a section for good.`}],Yf=Gr.map(e=>e.key);function gs(e){for(let t of Gr)t.normalize?.(e)}function ys(e){let t=[];for(let r of Gr){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 ws(e){e.command("update").description("Update AI skill files and stage template updates").allowExcessArguments(!0).option("--cwd <path>","project directory (default: current directory)").option("--answer <id=choice>","answer a question that would otherwise prompt (repeatable), e.g. --answer desktop-migration=keep-ai",Ep,[]).action(async(t,r)=>{r.args.length>0&&b.log.warn("`auto` is now the default and the argument is ignored.");let n=Sp(t.answer),i=kp(t.cwd??process.cwd()),o=qe(i,ue),s;try{s=JSON.parse(await bs(o,"utf-8"))}catch{b.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}s.frontend===pr&&(b.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${pr}"\`).
1731
1731
 
1732
1732
  v${dr} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
@@ -1783,7 +1783,7 @@ ${k}`}).join(`
1783
1783
  `]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
1784
1784
  `],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function Yp(){return ze.flatMap(e=>Fr.map(t=>Xe(e,t)))}function Yr(e){return nr(e)?(Kp(e,{recursive:!0}),!0):!1}function Wp(e,t,r=[]){if(!nr(e))return!1;let n=Wr(e,"utf-8"),i=n;for(let o of t)i=i.replace(o,"");for(let{from:o,to:s}of r)i=i.replace(o,s);return i===n?!1:(Os(e,i,"utf-8"),!0)}function zp(e){let t=Xe(e,".gitignore");if(!nr(t))return!1;let r=Wr(t,"utf-8"),n=r.split(`
1785
1785
  `).filter(i=>!i.includes(".generatesaas")).join(`
1786
- `);return n===r?!1:(Os(t,n,"utf-8"),!0)}function xs(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(Wr(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 o=[],s=[];for(let a of Yp())Yr(Xe(t,a))&&o.push(a);for(let a of Gp)Yr(Xe(t,a))&&o.push(a);Yr(Xe(t,J))&&o.push(`${J}/`);for(let a of Hp){let p=Xe(t,a.file);Wp(p,a.removals,a.replacements)?s.push(a.file):nr(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}zp(t)&&s.push(".gitignore");for(let a of o)U.log.info(`Deleted ${a}`);for(let a of s)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new Jp().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.32.1").addHelpText("after",`
1786
+ `);return n===r?!1:(Os(t,n,"utf-8"),!0)}function xs(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(Wr(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 o=[],s=[];for(let a of Yp())Yr(Xe(t,a))&&o.push(a);for(let a of Gp)Yr(Xe(t,a))&&o.push(a);Yr(Xe(t,J))&&o.push(`${J}/`);for(let a of Hp){let p=Xe(t,a.file);Wp(p,a.removals,a.replacements)?s.push(a.file):nr(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}zp(t)&&s.push(".gitignore");for(let a of o)U.log.info(`Deleted ${a}`);for(let a of s)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new Jp().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.33.0").addHelpText("after",`
1787
1787
  Examples:
1788
1788
  $ generatesaas init Interactive setup
1789
1789
  $ generatesaas init -n my-app -y Quick setup with defaults
@@ -5,7 +5,7 @@ description: Redraw the site's social share card (apps/web/public/og.png, the Op
5
5
 
6
6
  # OG image
7
7
 
8
- The static card at `apps/web/public/og.png` is what every shared link to the site shows. It should be **the product**, not a template box: the theme's dark ground with a soft primary glow off the top edge, the square logo beside the site name, and the landing page's own hero panel in a framed window that bleeds off the bottom edge. `pnpm og-image` builds it from the project's own files and the running site, so nothing in it is invented or eyeballed.
8
+ The static card at `apps/web/public/og.png` is what every shared link to the site shows. It should be **the product**, not a template box: the theme's dark ground with a soft primary glow off the top edge, the square logo beside the site name, and the landing page's own hero panel inside a realistic **browser window** that bleeds off the bottom edge: window chrome with the three traffic-light controls, an address bar showing the site's own domain (from `config.baseUrl`), rounded corners and a soft shadow. `pnpm og-image` builds it from the project's own files and the running site, so nothing in it is invented or eyeballed.
9
9
 
10
10
  ## When to run it
11
11
 
@@ -29,7 +29,7 @@ If the landing demo is out of date with the real app, fix the demo first: the ca
29
29
  ## Steps
30
30
 
31
31
  1. **Run the web app** (`pnpm dev`, or point `--url` at the deployed site). The landing page must render; no sign-in is involved.
32
- 2. **Pick the panel.** The default `#hero` captures the landing hero. If the landing has a product panel of its own - a dashboard tour scene, a framed app screenshot with demo data - capture that instead: find its element id in `apps/web/components/landing/` and pass `--selector "#<id>"`. A panel that carries its own window chrome wants `--fit box --margin 0`. Never capture a signed-in page or stage data for the shot: the card shows what the public landing shows.
32
+ 2. **Pick the panel.** The default `#hero` captures the landing hero. If the landing has a product panel of its own - a dashboard tour scene, a framed app screenshot with demo data - capture that instead: find its element id in `apps/web/components/landing/` and pass `--selector "#<id>"`. The script always wraps the capture in its browser window, so pick a panel WITHOUT its own window chrome (or crop to the content inside it); a window nested in a window reads as a mistake. Never capture a signed-in page or stage data for the shot: the card shows what the public landing shows.
33
33
  3. **Generate:** `pnpm og-image` (add the flags from step 2). It opens the page in headless Chromium at 1440x1000, 2x, dark colour scheme; waits for `load` plus `--wait` ms (default 5000) so tours and entrance animations settle; **removes** - never clicks - the cookie/consent banner, chat widgets and the Next dev badge (`--remove "<css>"` adds more); settles every animation; and screenshots the panel. It then composes the 1200x630 card, renders it at 1x, checks the size and writes `apps/web/public/og.png`.
34
34
  4. **Keep the per-page cards in step.** The same run resolves the four tokens to sRGB hex through a canvas (Satori, which draws `apps/web/components/seo/og-card.tsx`, cannot parse `oklch()`) and rewrites the `BRAND` constant there; the site name on those cards is drawn in the primary colour. `--no-og-card` skips this.
35
35
  5. **Look at the result.** Open `apps/web/public/og.png` and judge it: the logo and name sharp and centred, the panel readable, no banner, cursor, dev badge or half-finished animation in the frame, dark mode throughout. Re-run with a different `--selector`, `--wait`, `--fit` or `--margin` until it is right. The script prints the file's size and byte count; the card must be exactly 1200x630, which the layout's `og:image` tags declare.
@@ -51,6 +51,8 @@ If the landing demo is out of date with the real app, fix the demo first: the ca
51
51
 
52
52
  ## Rules
53
53
 
54
+ - A product screenshot on the card is ALWAYS inside the browser window the script draws: traffic-light controls, the site's own domain in the address bar, rounded corners, soft shadow. Never a bare screenshot or a plain frame. If you hand-build a card instead of running the script, draw the same window.
55
+
54
56
  - Colours come from `tooling/styles/theme.css` only. To change how the card looks, change the theme - never hand-pick a colour in the script, the card or `og-card.tsx`.
55
57
  - Never click the consent banner: a screenshot must not imply a choice. The script removes it from the DOM.
56
58
  - Do not wait for `networkidle` - pages that poll never settle; the script uses `load` plus a fixed wait.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generatesaas",
3
- "version": "3.32.1",
3
+ "version": "3.33.0",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@clack/prompts": "^1.7.0",
16
+ "@clack/prompts": "^1.8.1",
17
17
  "commander": "^15.0.0",
18
18
  "picocolors": "^1.1.1",
19
19
  "tar": "^7.5.22"
@@ -21,11 +21,11 @@
21
21
  "devDependencies": {
22
22
  "@repo/eslint-config": "0.0.0",
23
23
  "@repo/tsconfig": "1.0.0",
24
- "@types/node": "26.2.0",
25
- "eslint": "^9.39.5",
26
- "tsup": "^8.5.1",
24
+ "@types/node": "26.6.5",
25
+ "eslint": "^10.13.0",
26
+ "tsup": "^9.0.0",
27
27
  "typescript": "6.0.3",
28
- "vitest": "4.1.10"
28
+ "vitest": "5.0.5"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.18"