generatesaas 3.30.0 → 3.31.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 $p}from"commander";import*as Ps from"@clack/prompts";import{ex
5
5
  `),R=[m!=="none"?` Payment: ${y.cyan(It[m].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(Tt[be].label)}`,` Observability: ${B.length===0?y.dim("none"):y.cyan(B.map(Qt=>Rt[Qt].label).join(", "))}`,` Multi-tenancy: ${ae?y.cyan("Yes"):y.dim("No")}`,` Projects: ${_e?y.cyan("Yes"):y.dim("No")}`,` Docs app: ${Oe?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"),u,"",y.bold("Features"),R];if(z.length>0){let Qt=z.map(Br=>{let As=I[Br.key]?y.green("provided"):y.dim("skipped");return` ${Br.key}: ${As}`}).join(`
7
7
  `);Ee.push("",y.bold("Credentials"),Qt)}f.note(Ee.join(`
8
- `),"Summary");let Vr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(Vr)||!Vr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:E,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:m,emailProvider:be,observability:B,multiTenancy:ae,projects:_e,docs:Oe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(I).length>0?{credentials:I}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as hn,existsSync as Us}from"fs";import{mkdir as Fs}from"fs/promises";import{join as Vs}from"path";import{Readable as Bs}from"stream";import{pipeline as mr}from"stream/promises";import{extract as Ks}from"tar";import{join as je}from"path";import{homedir as Os}from"os";var gt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",q=".generatesaas",me=je(q,"manifest.json"),nn="nextjs",sr="nuxt",or="2.4.1",sn=je(q,"hashes.json"),xt=je(q,"template-hashes.json"),Dt=je(q,"template"),on=je(q,"staging"),an=je(q,"staging.json"),he=je(Os(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function fe(e){return{apiKey:e,baseUrl:gt}}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.30.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 xs,mkdirSync as Ds,readFileSync as Ns,writeFileSync as Cs}from"fs";import{dirname as Ls}from"path";import*as Pe from"@clack/prompts";function yt(){if(!xs(he))return null;try{let e=JSON.parse(Ns(he,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${he}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Me(e){Ds(Ls(he),{recursive:!0}),Cs(he,`${JSON.stringify({apiKey:e},null," ")}
8
+ `),"Summary");let Vr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(Vr)||!Vr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:E,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:m,emailProvider:be,observability:B,multiTenancy:ae,projects:_e,docs:Oe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(I).length>0?{credentials:I}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as hn,existsSync as Us}from"fs";import{mkdir as Fs}from"fs/promises";import{join as Vs}from"path";import{Readable as Bs}from"stream";import{pipeline as mr}from"stream/promises";import{extract as Ks}from"tar";import{join as je}from"path";import{homedir as Os}from"os";var gt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",q=".generatesaas",me=je(q,"manifest.json"),nn="nextjs",sr="nuxt",or="2.4.1",sn=je(q,"hashes.json"),xt=je(q,"template-hashes.json"),Dt=je(q,"template"),on=je(q,"staging"),an=je(q,"staging.json"),he=je(Os(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function fe(e){return{apiKey:e,baseUrl:gt}}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.31.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 xs,mkdirSync as Ds,readFileSync as Ns,writeFileSync as Cs}from"fs";import{dirname as Ls}from"path";import*as Pe from"@clack/prompts";function yt(){if(!xs(he))return null;try{let e=JSON.parse(Ns(he,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${he}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Me(e){Ds(Ls(he),{recursive:!0}),Cs(he,`${JSON.stringify({apiKey:e},null," ")}
9
9
  `,{mode:384})}async function st(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=yt();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 bt()}async function bt(){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 $s}from"fs/promises";async function Ae(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await $s(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 cn(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 ln(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 Nt(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 ar="nextjs";function pn(e){return{frontend:ar,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 cr(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 dn(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 lr(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 un(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 pr=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"]),dr=new Set(["pnpm-lock.yaml","widget-documents.generated.ts"]);function ot(e){if(ur(e))return!0;for(let t of e.split("/"))if(dr.has(t))return!0;return!1}var js=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),mn=["scripts/docs-lint.ts"],Ms=["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 ur(e){let t=e.split("/");for(let r of t)if(pr.has(r))return!0;if(mn.includes(e)||mn.some(r=>r.startsWith(`${e}/`)))return!1;if(js.has(t[0]))return!0;for(let r of Ms)if(e===r||e.startsWith(`${r}/`))return!0;return!1}async function Ct(e,t,r){await Fs(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Vs(n,`v${t}.tar.gz`);if(!Us(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await mr(hn(a),hr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await mr(hn(i),hr(r));return}let o=await Se(e,`/template/${encodeURIComponent(t)}`);if(!o.body)throw new Error("Empty response body");let s=Bs.fromWeb(o.body);await mr(s,hr(r))}function hr(e){return Ks({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!ur(r):!0},sync:!1})}import{readdir as Lt,readFile as at,rm as gn,rmdir as Gs,writeFile as wt}from"fs/promises";import{join as G}from"path";async function yn(e){let t;try{t=await Lt(e,{withFileTypes:!0})}catch{return!1}let r=!1;for(let n of t){let i=G(e,n.name);if(n.isDirectory()){await yn(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await gn(i,{force:!0})}return r||await Gs(e).catch(()=>{}),r}async function bn(e){let t=G(e,"packages/content"),r=[];try{r=(await Lt(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),d;try{d=(await Lt(a,{withFileTypes:!0})).filter(h=>h.isDirectory())}catch{continue}for(let h of d)n.add(h.name),await yn(G(a,h.name))}let i=await zs(e),o=new Set([...n].filter(s=>i===void 0||i.has(s)));await Promise.all([...o].map(s=>gn(G(e,"apps/web/public/images",s),{recursive:!0,force:!0}))),await Js(e,o)}var Hs="packages/config/src/index.ts",Ys=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,Ws=/\bslug:\s*"([^"]+)"/g;async function zs(e){let t;try{t=await at(G(e,Hs),"utf-8")}catch{return}let r=Ys.exec(t)?.[1];if(r===void 0)return;let n=[...r.matchAll(Ws)].map(i=>i[1]).filter(i=>i!==void 0);return n.length>0?new Set(n):void 0}var qs="packages/translate/.meta/mdx-translation-meta.json";async function Js(e,t){if(t.size===0)return;let r=G(e,qs),n;try{n=JSON.parse(await at(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 d={};for(let[h,g]of Object.entries(a)){let E=h.split("/"),w=E.length>1?E[0]:void 0,P=E[E.length-1]?.startsWith("_")===!0;w!==void 0&&t.has(w)&&!P||(d[h]=g)}o[s]=d}await wt(r,`${JSON.stringify({...i,locales:o},null," ")}
11
11
  `)}var Xs="packages/config/src/blog.ts";async function wn(e){let t=G(e,Xs),r=await at(t,"utf-8"),n=fn(fn(r,"blogCategories",t),"blogAuthors",t);await wt(t,n)}function fn(e,t,r){let n=new RegExp(`(export const ${t}\\b[^=]*=\\s*)\\[[\\s\\S]*?\\];`);if(!n.test(e))throw new Error(`emptyBlogConfig: could not find the \`export const ${t} = [...]\` declaration in ${r}. The boilerplate blog config may have been renamed or restructured; update the CLI strip in cleanup.ts.`);return e.replace(n,"$1[];")}async function vn(e){let t=G(e,"packages/i18n/translations"),r;try{r=await Lt(t)}catch{return}for(let n of r){let i=G(t,n,"web.json"),o;try{o=await at(i,"utf-8")}catch{continue}let s=JSON.parse(o);!s.content?.categories||s.content.categories.blog===void 0||(s.content.categories.blog={},await wt(i,`${JSON.stringify(s,null," ")}
@@ -833,10 +833,15 @@ ${On(e,"example")}`),e.mobile){let r=Vo(e);await l(`${e.projectDir}/apps/mobile/
833
833
  environment:
834
834
  MP_SMTP_AUTH_ACCEPT_ANY: 1
835
835
  MP_SMTP_AUTH_ALLOW_INSECURE: 1`),t.includes("inngest")){let s=e.architecture==="separate"?"http://host.docker.internal:3010/inngest":"http://host.docker.internal:3000/api/inngest";r.push(` inngest:
836
- image: inngest/inngest:v1.17.9
836
+ image: inngest/inngest:v1.46.0
837
837
  restart: unless-stopped
838
838
  ports:
839
839
  - "127.0.0.1:\${INNGEST_PORT:-8288}:8288"
840
+ healthcheck:
841
+ test: ["CMD", "inngest", "alpha", "doctor", "healthcheck"]
842
+ interval: 10s
843
+ timeout: 5s
844
+ retries: 5
840
845
  # \`-u\` is load-bearing, not tuning. Without it \`inngest dev\` AUTO-DISCOVERS, and it scans its own
841
846
  # container's localhost - where nothing is listening. It then registers zero apps and silently
842
847
  # runs no functions, so on a stock stack NOTHING that goes through Inngest is ever delivered: no
@@ -1384,7 +1389,7 @@ vi.mock("@upstash/lock", () => {
1384
1389
  `)}async function ii(e){await ec(e.projectDir,[...Qa])}async function si(e){let t=p(e.projectDir,"package.json"),r=await Z(t,"utf-8"),n=JSON.parse(r);!n.scripts||!("dev"in n.scripts)||(n.scripts.dev=e.architecture==="separate"?"turbo run dev --continue":"turbo run dev --continue --filter=!backend",await l(t,`${JSON.stringify(n,null," ")}
1385
1390
  `))}async function oi(e){let t=p(e.projectDir,"package.json"),r=JSON.parse(await Z(t,"utf-8")),n=r.scripts?.test;if(n!=="turbo run test --concurrency=4 && vitest run")throw new Error(`rewriteRootTestScript: expected the root test script to be "turbo run test --concurrency=4 && vitest run", got ${JSON.stringify(n)} (boilerplate drift).`);r.scripts.test="turbo run test --concurrency=4",await l(t,`${JSON.stringify(r,null," ")}
1386
1391
  `)}async function ai(e){e.docs||await k(p(e.projectDir,"apps/docs"),{recursive:!0})}async function ci(e){let t=p(e.projectDir,"docs/(platform)/meta.json"),r=JSON.parse(await Z(t,"utf-8"));if(r.title!=="GenerateSaaS")throw new Error(`stripUnusedDocsSilo: expected the feature-page group to be titled "GenerateSaaS", found ${JSON.stringify(r.title)} (boilerplate drift).`);r.title=e.appName,await Be(t,r," ","stripUnusedDocsSilo"),e.desktop||await k(p(e.projectDir,"docs/desktop"),{recursive:!0,force:!0}),e.mobile||await k(p(e.projectDir,"docs/mobile"),{recursive:!0,force:!0}),await tc(e),await oc(e)}async function V(e,t,r,n){await l(e,Ve(await Z(e,"utf-8"),t,r,n))}async function tc(e){let t=e.projectDir,r="stripUnusedDocsSilo",n=p(t,"docs/(platform)/configuration.mdx"),i=e.desktop;e.desktop||(await A(n,"| Desktop app + device sign-in - see [desktop app](/desktop) |","| Desktop app + device sign-in |","configuration.mdx desktop config-table link",r),await V(n,"configuration.mdx desktop TRUSTED_ORIGINS callout","desktop-origins-docs",r),await A(p(t,"docs/cli/init.mdx"),"the [desktop app](/desktop), AI features","the desktop app, AI features","cli init.mdx desktop app link",r),await V(p(t,"docs/(platform)/payments/organizations.mdx"),"payments organizations.mdx desktop tenancy callout","desktop-tenancy-docs",r),await V(p(t,"docs/(platform)/projects.mdx"),"projects.mdx desktop scoping callout","desktop-projects-docs",r),await V(p(t,"docs/(platform)/client-architecture.mdx"),"client-architecture.mdx desktop card","desktop-architecture-docs",r),await V(p(t,"docs/(platform)/screens.mdx"),"screens.mdx desktop halves","screens-desktop-docs",r),await V(p(t,"docs/(platform)/testing/e2e.mdx"),"testing/e2e.mdx desktop e2e callout","desktop-testing-docs",r),await A(p(t,"docs/(platform)/index.mdx"),` <Card href="/desktop" title="Desktop app" description="Cross-platform desktop app with device sign-in and AI agents." />
1387
- `,"","index.mdx desktop app card",r),await V(p(t,"docs/(platform)/ai.mdx"),"ai.mdx automation lanes row + section","desktop-lanes-docs",r)),i||(await V(n,"configuration.mdx desktop-AI paragraph","desktop-ai-docs",r),await A(p(t,"docs/(platform)/navigation.mdx"),"gates the desktop app's Chat and Automations, see [desktop AI](/desktop/ai) |","gates the desktop app's Chat and Automations |","navigation.mdx sidebar-flag agents-row link",r))}async function li(e){if(e.desktop)return;await k(p(e.projectDir,"apps/desktop"),{recursive:!0});let t=p(e.projectDir,"packages/i18n/translations");for(let i of await lt(t,{withFileTypes:!0}))i.isDirectory()&&await k(p(t,i.name,"desktop.json"),{force:!0});await k(p(e.projectDir,".github/workflows/desktop-release.yml"));for(let i of Za)await k(p(e.projectDir,i),{recursive:!0});await k(p(e.projectDir,"packages/utils/src/desktop-download.ts")),await k(p(e.projectDir,"packages/utils/tests/desktop-download.test.ts"));let r=p(e.projectDir,"packages/utils/package.json"),n=JSON.parse(await Z(r,"utf-8"));if(!n.exports?.["./desktop-download"])throw new Error("stripDesktopApp: expected packages/utils/package.json to carry the ./desktop-download export");delete n.exports["./desktop-download"],await Be(r,n," ","stripDesktopApp")}function rc(e){return e.desktop}async function pi(e){rc(e)||await k(p(e.projectDir,"packages/agent-core"),{recursive:!0})}var nc=["packages/mcp-widgets","packages/api/src/ai/mcp-apps","packages/api/src/routes/internal/ai/widgets-router.ts","packages/api/tests/routes/mcp-apps.test.ts","packages/api/tests/ai/organization-widgets.test.ts","packages/api/tests/routes/widgets-router.test.ts","packages/app-core/src/mcp-app","packages/app-core/src/test-support/mcp-fake-host.ts","packages/app-core/tests/mcp-app","packages/ui/src/components/mcp-widgets","packages/ui/src/lib/mcp-widgets","packages/ui/src/components/ai/tool-widget.tsx","packages/ui/src/components/ai/tool-widget.test.tsx","packages/ui/src/components/ai/tool-widget-split.test.tsx","docs/(platform)/mcp-widgets.mdx"],di="gsaas:mcp-apps-start";async function ic(e){let t=[];for(let r of await lt(p(e,"packages"),{withFileTypes:!0}))if(r.isDirectory())for(let n of["src","tests"]){let i=p(e,"packages",r.name,n);if(!Ua(i))continue;let o=await J(i,i,s=>s.split("/").includes("node_modules"),s=>/\.(?:ts|tsx)$/.test(s));for(let s of o)(await Z(s,"utf-8")).includes(di)&&t.push(s)}return t.sort()}async function ui(e){if(e.ai)return;let t="stripMcpApps",r=e.projectDir;for(let o of nc)await k(p(r,o),{recursive:!0});let n=await ic(r);if(n.length===0)throw new Error(`${t}: expected ${di} regions under packages/<name>/src or tests, but found none (boilerplate drift).`);for(let o of n)await Pt(o,o,"mcp-apps",t);let i=p(r,"packages/i18n/translations");await k(p(i,"en/mcp-widgets.json"));for(let o of await lt(i,{withFileTypes:!0}))o.isDirectory()&&await k(p(i,o.name,"mcp-widgets.json"),{force:!0});await A(p(r,"docs/(platform)/meta.json"),` "mcp-widgets",
1392
+ `,"","index.mdx desktop app card",r),await V(p(t,"docs/(platform)/ai.mdx"),"ai.mdx automation lanes row + section","desktop-lanes-docs",r),await A(p(t,"docs/(platform)/ai.mdx"),"| Creating or changing an automation on the user's computer (desktop) | `create_local_automation`, an `update_local_automation` beyond a rename or a pause, `delete_local_automation` ([how](/desktop/ai#what-runs-and-where)) | No |\n","","ai.mdx device-automation approval row",r)),i||(await V(n,"configuration.mdx desktop-AI paragraph","desktop-ai-docs",r),await A(p(t,"docs/(platform)/navigation.mdx"),"gates the desktop app's Chat and Automations, see [desktop AI](/desktop/ai) |","gates the desktop app's Chat and Automations |","navigation.mdx sidebar-flag agents-row link",r))}async function li(e){if(e.desktop)return;await k(p(e.projectDir,"apps/desktop"),{recursive:!0});let t=p(e.projectDir,"packages/i18n/translations");for(let i of await lt(t,{withFileTypes:!0}))i.isDirectory()&&await k(p(t,i.name,"desktop.json"),{force:!0});await k(p(e.projectDir,".github/workflows/desktop-release.yml"));for(let i of Za)await k(p(e.projectDir,i),{recursive:!0});await k(p(e.projectDir,"packages/utils/src/desktop-download.ts")),await k(p(e.projectDir,"packages/utils/tests/desktop-download.test.ts"));let r=p(e.projectDir,"packages/utils/package.json"),n=JSON.parse(await Z(r,"utf-8"));if(!n.exports?.["./desktop-download"])throw new Error("stripDesktopApp: expected packages/utils/package.json to carry the ./desktop-download export");delete n.exports["./desktop-download"],await Be(r,n," ","stripDesktopApp")}function rc(e){return e.desktop}async function pi(e){rc(e)||await k(p(e.projectDir,"packages/agent-core"),{recursive:!0})}var nc=["packages/mcp-widgets","packages/api/src/ai/mcp-apps","packages/api/src/routes/internal/ai/widgets-router.ts","packages/api/tests/routes/mcp-apps.test.ts","packages/api/tests/ai/organization-widgets.test.ts","packages/api/tests/routes/widgets-router.test.ts","packages/app-core/src/mcp-app","packages/app-core/src/test-support/mcp-fake-host.ts","packages/app-core/tests/mcp-app","packages/ui/src/components/mcp-widgets","packages/ui/src/lib/mcp-widgets","packages/ui/src/components/ai/tool-widget.tsx","packages/ui/src/components/ai/tool-widget.test.tsx","packages/ui/src/components/ai/tool-widget-split.test.tsx","docs/(platform)/mcp-widgets.mdx"],di="gsaas:mcp-apps-start";async function ic(e){let t=[];for(let r of await lt(p(e,"packages"),{withFileTypes:!0}))if(r.isDirectory())for(let n of["src","tests"]){let i=p(e,"packages",r.name,n);if(!Ua(i))continue;let o=await J(i,i,s=>s.split("/").includes("node_modules"),s=>/\.(?:ts|tsx)$/.test(s));for(let s of o)(await Z(s,"utf-8")).includes(di)&&t.push(s)}return t.sort()}async function ui(e){if(e.ai)return;let t="stripMcpApps",r=e.projectDir;for(let o of nc)await k(p(r,o),{recursive:!0});let n=await ic(r);if(n.length===0)throw new Error(`${t}: expected ${di} regions under packages/<name>/src or tests, but found none (boilerplate drift).`);for(let o of n)await Pt(o,o,"mcp-apps",t);let i=p(r,"packages/i18n/translations");await k(p(i,"en/mcp-widgets.json"));for(let o of await lt(i,{withFileTypes:!0}))o.isDirectory()&&await k(p(i,o.name,"mcp-widgets.json"),{force:!0});await A(p(r,"docs/(platform)/meta.json"),` "mcp-widgets",
1388
1393
  `,"","platform meta.json mcp-widgets entry",t),await V(p(r,"docs/(platform)/external-agent-mcp.mdx"),"external-agent-mcp.mdx widgets paragraph","mcp-apps-docs",t),await V(p(r,"docs/(platform)/ai.mdx"),"ai.mdx widgets under tool rows section","mcp-apps-docs",t)}async function sc(e,t,r,n){let i=await lt(e);for(let o of t){let s=i.filter(a=>a.startsWith(o));if(s.length===0)throw new Error(`${n}: expected ${r} to hold at least one ${o}* entry`);for(let a of s)await k(p(e,a),{recursive:!0})}}async function Pt(e,t,r,n){await l(e,Ve(await Z(e,"utf-8"),t,r,n))}async function oc(e){let t=e.projectDir,r="stripUnusedDocsSilo",n=e.mobile&&e.mobilePurchases==="revenuecat";e.mobile||(await A(p(t,"docs/(platform)/index.mdx"),` <Card href="/mobile" title="Mobile app" description="Cross-platform iOS and Android app with push, universal links, and store billing." />
1389
1394
  `,"","index.mdx mobile app card",r),await A(p(t,"docs/(platform)/configuration.mdx")," - see [mobile app](/mobile)","","configuration.mdx mobile config-table link",r),await A(p(t,"docs/(platform)/client-architecture.mdx"),` <Card href="/mobile" title="Mobile app">The Expo app - the third surface this client core serves.</Card>
1390
1395
  `,"","client-architecture.mdx mobile app card",r),await A(p(t,"docs/cli/init.mdx"),"The [mobile app](/mobile) (`apps/mobile`, built with Expo)","The mobile app (`apps/mobile`, built with Expo)","cli init.mdx mobile app link",r),await A(p(t,"docs/(platform)/notifications.mdx"),"- **On a phone too.** With the [mobile app](/mobile) shipped and `config.mobile.push.enabled` on, the same notification is delivered to the user's registered devices as a push - see [mobile notifications](/mobile/notifications).\n\n","","notifications.mdx mobile push bullet",r),await A(p(t,"docs/(platform)/authentication/social-oauth.mdx")," - the native flow adds `APPLE_APP_BUNDLE_IDENTIFIER`; without `APPLE_CLIENT_ID` it runs native-only (no web button), see [mobile auth](/mobile/auth) |"," |","social-oauth.mdx Apple native-flow tail",r),await A(p(t,"docs/(platform)/authentication/two-factor-and-passkeys.mdx"),"- **On the [mobile app](/mobile/auth)**, passkeys use the platform's own biometrics and are claimed by the same `.well-known` association files. The app's biometric **App lock** is a separate device gate, never a second factor.\n\n","","two-factor-and-passkeys.mdx mobile passkeys bullet",r),await A(p(t,"docs/(platform)/project-structure.mdx"),"the web, desktop and mobile apps","the web and desktop apps","project-structure.mdx surface list",r),await V(p(t,"docs/(platform)/testing/e2e.mdx"),"testing e2e.mdx mobile Maestro section","mobile-testing-docs",r),await V(p(t,"docs/(platform)/environment-variables/index.mdx"),"environment-variables mobile section","mobile-env-docs",r)),n||(await A(p(t,"docs/(platform)/payments/meta.json"),', "mobile-billing"',"","payments meta.json mobile-billing entry",r),await A(p(t,"docs/(platform)/payments/index.mdx"),` <Card href="/payments/mobile-billing" title="Mobile store billing" description="In-app purchases through RevenueCat, additive to your web provider." />
@@ -1454,7 +1459,7 @@ ${r} mailpit:
1454
1459
  # No \`-u\`: the harness registers the app by PUTting its own /api/inngest endpoint, and the
1455
1460
  # suite's port is derived per checkout - a baked URL would name a port nothing serves.
1456
1461
  - name: Start Inngest
1457
- run: docker run -d --name inngest --network host inngest/inngest:v1.17.9 inngest dev
1462
+ run: docker run -d --name inngest --network host inngest/inngest:v1.46.0 inngest dev
1458
1463
  `,d=wi(e)?`
1459
1464
  # The end-to-end suite, on a manual "Run workflow" dispatch only - it builds the app in production
1460
1465
  # mode and drives it with Playwright, too slow to pay for on every PR. It needs no keys and no
@@ -1711,12 +1716,12 @@ function posthogConfigured(): boolean {
1711
1716
  `,replace:""},{find:`import { serverReportingAllowed } from "@repo/utils/reporting";
1712
1717
  `,replace:""},{find:"export async function captureAiGeneration(event: AiGenerationEvent): Promise<void> {",replace:"export async function captureAiGeneration(_event: AiGenerationEvent): Promise<void> {"},{find:" * @param event - The call to record.",replace:" * @param _event - Ignored: no PostHog adapter was generated for this project."}]}var Oi=[{file:"src/resolve-server.ts",edits:dl},{file:"src/resolve-browser.ts",edits:ul},{file:"src/llm-analytics.ts",edits:kl,dualMode:!1}],El=[{file:"src/resolve-desktop-main.ts",edits:hl},{file:"src/resolve-desktop-renderer.ts",edits:fl}];import{readdir as Sl,readFile as Pl}from"fs/promises";import{join as ji}from"path";async function Mi(e){if(e.demo)return;let t=e.appName.trim()||e.projectName,r=JSON.stringify(t).slice(1,-1),n=ji(e.projectDir,"packages/i18n/translations"),i;try{i=await Sl(n)}catch{return}for(let o of i){let s=ji(n,o,"web.json"),a;try{a=await Pl(s,"utf-8")}catch{continue}let d=a.replaceAll("GenerateSaaS",()=>r);d!==a&&await l(s,d)}}async function Yt(e){let t=e.projectDir;e.demo||(await bn(t),await wn(t),await vn(t),await kn(t)),await En(t),await An(e),await Tn(e),await Rn(e),e.demo||await _n(e),await Dn(e),await Nn(e),await Cn(e),await Mn(e),await Fn(e),await Bn(e),await zn(e),await Jn(e),await ei(e),await ni(e),await ki(e),await ii(e),await si(e),await oi(e),await ai(e),await ci(e),await li(e),await pi(e),await ui(e),await gi(e),await mi(e),await hi(e),await bi(e),await Pi(e),await Ii(e),await Di(e),await Yn(e),await Mi(e),await ri(e)}import{basename as Fi,join as Vi,relative as Il}from"path";import{createHash as Ui}from"crypto";import{readFile as Al}from"fs/promises";async function Wt(e){let t=await Al(e);return Ui("sha256").update(t).digest("hex")}function _r(e){return Ui("sha256").update(e).digest("hex")}var Tl=new Set(["data",q]);function Rl(e){let t=e.split("/");for(let r of t)if(pr.has(r)||dr.has(r)||Tl.has(r)||r.startsWith(".env")&&!r.includes("example"))return!0;return!1}function Bi(e,t){return{projectName:e.projectName??Fi(t),appName:e.appName??e.projectName??Fi(t),projectDir:t,architecture:e.architecture??"fullstack",paymentProvider:e.paymentProvider??"none",emailProvider:e.emailProvider??"smtp",multiTenancy:e.multiTenancy??!1,projects:e.projects??!1,docs:e.docs??!1,desktop:e.desktop??!1,mobile:e.mobile??!1,mobilePurchases:e.mobilePurchases??"none",ai:e.ai??!1,webAi:e.webAi??!0,revenueSharing:e.revenueSharing??!1,credits:e.credits??!1,defaultCurrency:e.defaultCurrency??"USD",deploymentTarget:e.deploymentTarget??"node",databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",observability:e.observability??[],version:e.version,baseUrl:e.baseUrl,credentials:{},demo:!1}}function _l(e,t){return{version:e.version,initialVersion:e.version,appName:e.appName,projectName:e.projectName,frontend:nn,architecture:e.architecture,paymentProvider:e.paymentProvider,emailProvider:e.emailProvider,multiTenancy:e.multiTenancy,projects:e.projects,docs:e.docs,desktop:e.desktop,mobile:e.mobile,...e.mobile&&ne(e)?{mobilePurchases:e.mobilePurchases}:{},ai:e.ai,webAi:e.webAi,credits:e.credits,revenueSharing:e.revenueSharing,defaultCurrency:e.defaultCurrency,deploymentTarget:e.deploymentTarget,databaseProvider:e.databaseProvider,cacheProvider:e.cacheProvider,observability:e.observability,...e.baseUrl?{baseUrl:e.baseUrl}:{},...t&&{licenseToken:t.token,licenseKeyHash:t.keyHash,installId:t.installId}}}async function Ki(e,t){let n=(await J(e.projectDir,e.projectDir,Rl)).sort(),i=await Promise.all(n.map(async a=>[Ue(Il(e.projectDir,a)),await Wt(a)])),o=Object.fromEntries(i),s=_l(e,t);await l(Vi(e.projectDir,me),`${JSON.stringify(s,null," ")}
1713
1718
  `),await l(Vi(e.projectDir,sn),`${JSON.stringify(o,null," ")}
1714
- `)}import{relative as Ol}from"path";async function pt(e){let r=(await J(e,e,ot)).sort(),n=await Promise.all(r.map(async i=>[Ue(Ol(e,i)),await Wt(i)]));return Object.fromEntries(n)}import{copyFile as xl,mkdir as Dl,rm as Nl}from"fs/promises";import{dirname as Cl,join as Gi,relative as Ll}from"path";import{existsSync as $l}from"fs";async function Or(e,t){$l(t)&&await Nl(t,{recursive:!0,force:!0});let n=(await J(e,e,ot)).map(i=>({file:i,dest:Gi(t,Ue(Ll(e,i)))}));await Promise.all([...new Set(n.map(({dest:i})=>Cl(i)))].map(i=>Dl(i,{recursive:!0}))),await Promise.all(n.map(({file:i,dest:o})=>xl(i,o)))}async function Hi(e,t){await Or(e,Gi(t,Dt))}import{readdir as jl,readFile as Wi}from"fs/promises";import{existsSync as Ml}from"fs";import{dirname as Ul,join as oe,resolve as xr,sep as Dr}from"path";import{fileURLToPath as Fl}from"url";var Vl={"claude-code":".claude/skills",cursor:".cursor/skills",codex:".agents/skills","gemini-cli":".gemini/skills",windsurf:".windsurf/skills"},Ye=Object.values(Vl),Nr=["generatesaas-update","generatesaas-translate"],Bl=Ul(Fl(import.meta.url));function Kl(){return $t(Bl,["skill","content"],"content")}async function Cr(e,t){for(let r of Ye){let n=oe(e,r);for(let[i,o]of Object.entries(t)){let s=xr(n,i);if(!s.startsWith(n+Dr))continue;let a=oe(s,"scripts"),d=oe(s,"references");await Mt(a),await Mt(d),await l(oe(s,"SKILL.md"),o.skillMd.replaceAll("__SKILL_ROOT__",r));for(let[g,E]of Object.entries(o.scripts)){let w=xr(a,g);w.startsWith(a+Dr)&&await l(w,E)}let h=Object.entries(o.references);h.length===0&&await l(oe(d,".gitkeep"),"");for(let[g,E]of h){let w=xr(d,g);w.startsWith(d+Dr)&&await l(w,E)}}}}async function Yi(e){if(!Ml(e))return{};let t={};for(let r of await jl(e))r!==".gitkeep"&&(t[r]=await Wi(oe(e,r),"utf-8"));return t}async function zi(e){let t=Kl(),r={};for(let n of Nr){let i=oe(t,n);r[n]={skillMd:await Wi(oe(i,"SKILL.md"),"utf-8"),scripts:await Yi(oe(i,"scripts")),references:await Yi(oe(i,"references"))}}await Cr(e,r)}import{execFile as Gl,execFileSync as Hl}from"child_process";import{access as Lr,readFile as Yl}from"fs/promises";import{join as zt}from"path";import*as _ from"@clack/prompts";function Te(e){try{let t=process.platform==="win32"?"where":"which";return Hl(t,[e],{stdio:"ignore"}),!0}catch{return!1}}function Ie(e,t,r,n=3e5){return new Promise((i,o)=>{Gl(e,t,{cwd:r,timeout:n,maxBuffer:50*1024*1024},(s,a,d)=>{if(s){let h=String(a||"").trim(),E=[String(d||"").trim(),h].filter(Boolean).join(`
1719
+ `)}import{relative as Ol}from"path";async function pt(e){let r=(await J(e,e,ot)).sort(),n=await Promise.all(r.map(async i=>[Ue(Ol(e,i)),await Wt(i)]));return Object.fromEntries(n)}import{copyFile as xl,mkdir as Dl,rm as Nl}from"fs/promises";import{dirname as Cl,join as Gi,relative as Ll}from"path";import{existsSync as $l}from"fs";async function Or(e,t){$l(t)&&await Nl(t,{recursive:!0,force:!0});let n=(await J(e,e,ot)).map(i=>({file:i,dest:Gi(t,Ue(Ll(e,i)))}));await Promise.all([...new Set(n.map(({dest:i})=>Cl(i)))].map(i=>Dl(i,{recursive:!0}))),await Promise.all(n.map(({file:i,dest:o})=>xl(i,o)))}async function Hi(e,t){await Or(e,Gi(t,Dt))}import{readdir as jl,readFile as Wi}from"fs/promises";import{existsSync as Ml}from"fs";import{dirname as Ul,join as oe,resolve as xr,sep as Dr}from"path";import{fileURLToPath as Fl}from"url";var Vl={"claude-code":".claude/skills",cursor:".cursor/skills",codex:".agents/skills","gemini-cli":".gemini/skills",windsurf:".windsurf/skills"},Ye=Object.values(Vl),Nr=["generatesaas-update","generatesaas-translate","generatesaas-og-image","generatesaas-landing-animations"],Bl=Ul(Fl(import.meta.url));function Kl(){return $t(Bl,["skill","content"],"content")}async function Cr(e,t){for(let r of Ye){let n=oe(e,r);for(let[i,o]of Object.entries(t)){let s=xr(n,i);if(!s.startsWith(n+Dr))continue;let a=oe(s,"scripts"),d=oe(s,"references");await Mt(a),await Mt(d),await l(oe(s,"SKILL.md"),o.skillMd.replaceAll("__SKILL_ROOT__",r));for(let[g,E]of Object.entries(o.scripts)){let w=xr(a,g);w.startsWith(a+Dr)&&await l(w,E)}let h=Object.entries(o.references);h.length===0&&await l(oe(d,".gitkeep"),"");for(let[g,E]of h){let w=xr(d,g);w.startsWith(d+Dr)&&await l(w,E)}}}}async function Yi(e){if(!Ml(e))return{};let t={};for(let r of await jl(e))r!==".gitkeep"&&(t[r]=await Wi(oe(e,r),"utf-8"));return t}async function zi(e){let t=Kl(),r={};for(let n of Nr){let i=oe(t,n);r[n]={skillMd:await Wi(oe(i,"SKILL.md"),"utf-8"),scripts:await Yi(oe(i,"scripts")),references:await Yi(oe(i,"references"))}}await Cr(e,r)}import{execFile as Gl,execFileSync as Hl}from"child_process";import{access as Lr,readFile as Yl}from"fs/promises";import{join as zt}from"path";import*as _ from"@clack/prompts";function Te(e){try{let t=process.platform==="win32"?"where":"which";return Hl(t,[e],{stdio:"ignore"}),!0}catch{return!1}}function Ie(e,t,r,n=3e5){return new Promise((i,o)=>{Gl(e,t,{cwd:r,timeout:n,maxBuffer:50*1024*1024},(s,a,d)=>{if(s){let h=String(a||"").trim(),E=[String(d||"").trim(),h].filter(Boolean).join(`
1715
1720
  `);o(new Error(E?`${s.message}
1716
1721
  ${E}`:s.message))}else i()})})}async function qi(e){if(!Te("pnpm"))return _.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await Ie("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 Ji(e){if(!Te("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 Ie("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 Xi(e){if(!Te("pnpm"))return!1;let t=_.spinner();t.start("Generating baseline database migration...");try{return await Ie("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 Zi(e){if(!Te("pnpm"))return!1;try{await Lr(zt(e,"packages/mcp-widgets"))}catch{return!1}let t=_.spinner();t.start("Building the MCP widgets...");try{return await Ie("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 Qi(e){try{return await Lr(zt(e,".git")),_.log.info("Git repository already exists, skipping init."),!0}catch{}if(!Te("git"))return _.log.warn("git not found. Skipping repository initialization."),!1;let t=_.spinner();t.start("Initializing git repository...");try{return await Ie("git",["init"],e),await Ie("git",["add","-A"],e),await Ie("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 es(e){if(!Te("pnpm"))return!1;try{await Lr(zt(e,".git"))}catch{return!1}try{let t=JSON.parse(await Yl(zt(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 Ie("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 We from"@clack/prompts";import H from"picocolors";function ts(e,t){let r=et(e);t.dockerAvailable||We.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/"),t.baselineMigrationMissing&&We.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=>Hr[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"))),We.note(n.join(`
1717
1722
  `),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")}`),We.note(i.join(`
1718
1723
  `),H.yellow("Dev Tools"));let o=[],s=Wl(e);s.length>0&&o.push(`Set in production: ${H.dim(s.join(", "))}`),o.push("pnpm db:setup # Apply the database schema"),o.push(zl(e)),We.note(o.join(`
1719
- `),H.yellow("Deployment"))}function Wl(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 zl(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 dt(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 Re(e,t){let r=dt(e),n=dt(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 qt(e,t){return e.versions.find(r=>r.version===t)?.cli}function rs(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:dt(e)===null}function Jt(e,t,r="3.30.0"){if(rs(r))return{ok:!0};let n=qt(e,e.latest);return!n||dt(n)===null?{ok:!0}:Re(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 ns(e,t,r="3.30.0"){if(rs(r))return{ok:!0};let n=qt(e,t);return!n||dt(n)===null?{ok:!0}:Re(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import ep from"picocolors";var tp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function rp(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 is(e){e.command("init").description("Scaffold a new GenerateSaaS project").argument("[apiKey]","license key (same as --api-key)").option("-n, --name <name>","project name (lowercase, hyphens, starts with letter)").option("--app-name <name>","display name for the app").option("-l, --location <path>","project directory (default: ./{name})").addOption(new ee("--architecture <type>","fullstack or separate").choices([...tt])).addOption(new ee("--payment <provider>","payment provider").choices([...rt])).addOption(new ee("--email <provider>","email provider").choices([...nt])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new ee("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...$e])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new ee("--currency <code>","default currency for billing").choices([...le])).addOption(new ee("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...Le])).addOption(new ee("--deploy <target>","deployment target").choices([...pe])).addOption(new ee("--database <provider>","database provider").choices([...de])).addOption(new ee("--cache <provider>","cache provider").choices([...ue])).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 ee("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new ee("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await np(t?{...r,apiKey:t}:r)})}async function np(e){let t=performance.now();Kr("3.30.0");let r;try{r=en(e)}catch(v){S.cancel(N(v)),process.exit(1)}let n=S.spinner(),i;try{i=await st({apiKey:e.apiKey,prompt:!e.yes})}catch(v){S.cancel(N(v)),process.exit(1)}e.demo&&_r(i)!==tp&&(S.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=fe(i),s,a=async()=>{s=await Ae(o);let v=Jt(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 d,h,g=!0,E=!0;try{({latestVersion:d,selectedVersion:h,desktopAllowed:g,mobileAllowed:E}=await a()),n.stop("Access verified."),Me(i)}catch(v){if(n.stop("Access verification failed."),v instanceof j&&v.status===401){e.yes&&(S.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),S.log.warning("Invalid API key."),i=await bt(),o=fe(i),n.start("Verifying access...");try{({latestVersion:d,selectedVersion:h,desktopAllowed:g,mobileAllowed:E}=await a()),n.stop("Access verified."),Me(i)}catch(L){n.stop("Access verification failed."),S.cancel(L instanceof j&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else S.cancel(N(v)),process.exit(1)}S.log.success(`Latest version: ${d}`),r.desktop===!0&&!g&&(S.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!E&&(S.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=tn({...r,...g?{}:{desktop:!1},...E?{}:{mobile:!1}}):w=await rn(r,{desktopAllowed:g,mobileAllowed:E});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await rp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:ar,version:h,installId:v,projectName:w.projectName,options:pn(w)}),F;try{F=await cr(o,L())}catch(ve){let $=Nt(ve);if(!$?.lastAllowedVersion||!s)throw ve;n.stop("License activation failed.");let W=ns(s,$.lastAllowedVersion);if(W.ok||(S.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=qt(s,$.lastAllowedVersion);S.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 S.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(S.isCancel(ke)||!ke)&&(S.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await cr(o,L())}P={token:F.token,keyHash:_r(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),S.cancel(N(v)),process.exit(1)}let m=Ql(w.projectDir);if(ql(m)&&Jl(m).length>0)if(e.yes)S.log.info(`Directory ${m} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await S.select({message:`Directory ${m} 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"}]});(S.isCancel(L)||L==="cancel")&&(S.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Xl(m,{recursive:!0,force:!0})}let O={...w,projectDir:m,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(o,h,m),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),S.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Yt(O),!e.demo){let v=await pt(m);await l(Zl(m,xt),`${JSON.stringify(v,null," ")}
1724
+ `),H.yellow("Deployment"))}function Wl(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 zl(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 dt(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 Re(e,t){let r=dt(e),n=dt(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 qt(e,t){return e.versions.find(r=>r.version===t)?.cli}function rs(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:dt(e)===null}function Jt(e,t,r="3.31.0"){if(rs(r))return{ok:!0};let n=qt(e,e.latest);return!n||dt(n)===null?{ok:!0}:Re(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 ns(e,t,r="3.31.0"){if(rs(r))return{ok:!0};let n=qt(e,t);return!n||dt(n)===null?{ok:!0}:Re(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import ep from"picocolors";var tp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function rp(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 is(e){e.command("init").description("Scaffold a new GenerateSaaS project").argument("[apiKey]","license key (same as --api-key)").option("-n, --name <name>","project name (lowercase, hyphens, starts with letter)").option("--app-name <name>","display name for the app").option("-l, --location <path>","project directory (default: ./{name})").addOption(new ee("--architecture <type>","fullstack or separate").choices([...tt])).addOption(new ee("--payment <provider>","payment provider").choices([...rt])).addOption(new ee("--email <provider>","email provider").choices([...nt])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new ee("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...$e])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new ee("--currency <code>","default currency for billing").choices([...le])).addOption(new ee("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...Le])).addOption(new ee("--deploy <target>","deployment target").choices([...pe])).addOption(new ee("--database <provider>","database provider").choices([...de])).addOption(new ee("--cache <provider>","cache provider").choices([...ue])).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 ee("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new ee("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await np(t?{...r,apiKey:t}:r)})}async function np(e){let t=performance.now();Kr("3.31.0");let r;try{r=en(e)}catch(v){S.cancel(N(v)),process.exit(1)}let n=S.spinner(),i;try{i=await st({apiKey:e.apiKey,prompt:!e.yes})}catch(v){S.cancel(N(v)),process.exit(1)}e.demo&&_r(i)!==tp&&(S.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=fe(i),s,a=async()=>{s=await Ae(o);let v=Jt(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 d,h,g=!0,E=!0;try{({latestVersion:d,selectedVersion:h,desktopAllowed:g,mobileAllowed:E}=await a()),n.stop("Access verified."),Me(i)}catch(v){if(n.stop("Access verification failed."),v instanceof j&&v.status===401){e.yes&&(S.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),S.log.warning("Invalid API key."),i=await bt(),o=fe(i),n.start("Verifying access...");try{({latestVersion:d,selectedVersion:h,desktopAllowed:g,mobileAllowed:E}=await a()),n.stop("Access verified."),Me(i)}catch(L){n.stop("Access verification failed."),S.cancel(L instanceof j&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else S.cancel(N(v)),process.exit(1)}S.log.success(`Latest version: ${d}`),r.desktop===!0&&!g&&(S.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!E&&(S.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=tn({...r,...g?{}:{desktop:!1},...E?{}:{mobile:!1}}):w=await rn(r,{desktopAllowed:g,mobileAllowed:E});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await rp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:ar,version:h,installId:v,projectName:w.projectName,options:pn(w)}),F;try{F=await cr(o,L())}catch(ve){let $=Nt(ve);if(!$?.lastAllowedVersion||!s)throw ve;n.stop("License activation failed.");let W=ns(s,$.lastAllowedVersion);if(W.ok||(S.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=qt(s,$.lastAllowedVersion);S.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 S.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(S.isCancel(ke)||!ke)&&(S.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await cr(o,L())}P={token:F.token,keyHash:_r(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),S.cancel(N(v)),process.exit(1)}let m=Ql(w.projectDir);if(ql(m)&&Jl(m).length>0)if(e.yes)S.log.info(`Directory ${m} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await S.select({message:`Directory ${m} 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"}]});(S.isCancel(L)||L==="cancel")&&(S.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&Xl(m,{recursive:!0,force:!0})}let O={...w,projectDir:m,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await Ct(o,h,m),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),S.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Yt(O),!e.demo){let v=await pt(m);await l(Zl(m,xt),`${JSON.stringify(v,null," ")}
1720
1725
  `),await Hi(m,m)}await zi(m),await Ki(O,P),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),S.cancel(N(v)),process.exit(1)}!await qi(m)&&O.demo===!0&&(S.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let B=await Ji(m),ae=O.demo!==!0&&e.dbMigration!==!1,_e=!1;ae&&B&&(await Xi(m),_e=!0);let Oe=B?await Zi(m):!1;await Qi(m),B&&await es(m);let xe=Te("docker"),Xe=ir(O).map(v=>v.key).filter(v=>!O.credentials?.[v]);ts(O,{pnpmInstalled:B,dockerAvailable:xe,skippedCredentials:Xe,baselineMigrationMissing:ae&&!_e,mcpWidgetsUnbuilt:O.ai&&!Oe}),Gr(),S.log.info(ep.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as Xt}from"fs";import{readFile as ps}from"fs/promises";import{join as ze,resolve as cp}from"path";import*as b from"@clack/prompts";import C from"picocolors";import{mkdtemp as ip,rm as sp}from"fs/promises";import{tmpdir as op}from"os";import{join as ap}from"path";async function $r(e,t,r,n){let i=await ip(ap(op(),"generatesaas-stage-"));try{await Ct(e,t,i),await Yt({...r,projectDir:i}),await Or(i,n)}finally{await sp(i,{recursive:!0,force:!0})}}function ss(e){return e?"ON":"OFF"}var ut="packages/config/src/index.ts";function os(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 as(e){return[...et({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var jr=[{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 ${ut} 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 ${ut} 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 ${ut}. How should this update proceed?`},{key:"aiBuiltin",severity:"warn",normalize:e=>{e.aiBuiltin===void 0&&e.aiByok!==void 0&&(e.aiBuiltin=e.aiByok===!1)},applies:e=>e.ai===!0,preserved:e=>e.aiBuiltin===ne(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${ss(e.aiBuiltin)}, but it is now a plain config value generated ${ss(ne(e))} for a project ${ne(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${ut} 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 ${ut} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>os(e).join(",")===as(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${os(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 ${as(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===Wr.length,describe:e=>`Retired option \`aiTools\`: your project recorded ${(e.aiTools??[]).join(", ")||"no AI tools"}, but the \`generatesaas-update\` skill bundle now ships to every AI-tool root (${Ye.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 ${ut} to drop a section for good.`}],Af=jr.map(e=>e.key);function cs(e){for(let t of jr)t.normalize?.(e)}function ls(e){let t=[];for(let r of jr){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 ds(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",lp,[]).action(async(t,r)=>{r.args.length>0&&b.log.warn("`auto` is now the default and the argument is ignored.");let n=pp(t.answer),i=cp(t.cwd??process.cwd()),o=ze(i,me),s;try{s=JSON.parse(await ps(o,"utf-8"))}catch{b.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}s.frontend===sr&&(b.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${sr}"\`).
1721
1726
 
1722
1727
  v${or} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
@@ -1773,7 +1778,7 @@ ${E}`}).join(`
1773
1778
  `]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
1774
1779
  `],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function Np(){return Ye.flatMap(e=>Nr.map(t=>qe(e,t)))}function Ur(e){return Zt(e)?(Op(e,{recursive:!0}),!0):!1}function Cp(e,t,r=[]){if(!Zt(e))return!1;let n=Fr(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:(Es(e,i,"utf-8"),!0)}function Lp(e){let t=qe(e,".gitignore");if(!Zt(t))return!1;let r=Fr(t,"utf-8"),n=r.split(`
1775
1780
  `).filter(i=>!i.includes(".generatesaas")).join(`
1776
- `);return n===r?!1:(Es(t,n,"utf-8"),!0)}function Ss(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=qe(t,me),n;try{n=JSON.parse(Fr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of Np())Ur(qe(t,a))&&o.push(a);for(let a of xp)Ur(qe(t,a))&&o.push(a);Ur(qe(t,q))&&o.push(`${q}/`);for(let a of Dp){let d=qe(t,a.file);Cp(d,a.removals,a.replacements)?s.push(a.file):Zt(d)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Lp(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 Je=new $p().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.30.0").addHelpText("after",`
1781
+ `);return n===r?!1:(Es(t,n,"utf-8"),!0)}function Ss(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=qe(t,me),n;try{n=JSON.parse(Fr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of Np())Ur(qe(t,a))&&o.push(a);for(let a of xp)Ur(qe(t,a))&&o.push(a);Ur(qe(t,q))&&o.push(`${q}/`);for(let a of Dp){let d=qe(t,a.file);Cp(d,a.removals,a.replacements)?s.push(a.file):Zt(d)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Lp(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 Je=new $p().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.31.0").addHelpText("after",`
1777
1782
  Examples:
1778
1783
  $ generatesaas init Interactive setup
1779
1784
  $ generatesaas init -n my-app -y Quick setup with defaults
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: landing-animations
3
+ description: Build, change or review the landing page's animated product tour (the hero's tabbed scenes in apps/web/components/landing/hero/, hero-scenes.css) and the feature grid's scroll reveal (bento.css) - CSS-only motion with a resting frame that equals the final frame, 8s stories, a scripted pointer, a phone camera and reduced-motion support. Use when the user asks to add, replace, remove, retime or fix a hero tour scene, make the landing page animated, show their own product in the hero, or when a scene looks wrong on a phone, in dark mode or with reduced motion.
4
+ ---
5
+
6
+ # Landing animations
7
+
8
+ The landing hero plays a tabbed tour of the real app: one 1120x630 artboard per scene, scaled to the page in CSS, each scene an 8 second story told by a scripted pointer. Everything moves with CSS keyframes in `apps/web/components/landing/hero/hero-scenes.css`; the only JavaScript is one `setTimeout` in `hero-showcase.tsx` that switches tabs.
9
+
10
+ ## Where things live
11
+
12
+ | File | Role |
13
+ | --- | --- |
14
+ | `components/landing/hero/landing-hero.tsx` | Headline, sub-line, CTAs, trust row, then the showcase (server component) |
15
+ | `components/landing/hero/hero-showcase.tsx` | Tab strip, timer, hover pause, reduced-motion handling (client) |
16
+ | `lib/landing/hero-scene-ids.ts` | Scene ids in tour order, and the config flag that gates each one |
17
+ | `lib/landing/hero-scenes.tsx` | Registry: id to scene component, window chrome and address |
18
+ | `components/landing/hero/scenes/<id>-scene.tsx` | One scene's markup, in artboard px |
19
+ | `scenes/scene-app-shell.tsx` | The app's real sidebar and top bar, drawn at 1440x755 and scaled 7/9 |
20
+ | `scenes/scene-frame.tsx`, `mockups/animated/mockup-viewport.tsx` | Window chrome, the 1120x630 artboard and the phone camera wrapper |
21
+ | `scenes/scene-cursor.tsx`, `scenes/scene-step.ts`, `scenes/scene-ui.tsx` | Pointer, stagger helper, shared glyphs and page parts |
22
+ | `lib/landing/hero-scene-world.ts` | Demo names, addresses and amounts (data, not copy) |
23
+ | `components/landing/bento.css` | The feature grid's scroll-driven reveal |
24
+ | `packages/i18n/translations/en/web.json` | `landing.hero.tabs.*`, `landing.hero.tabs_short.*`, `landing.hero.tab_captions.*`, `demo.hero_scenes.<id>.*` |
25
+
26
+ ## The stack
27
+
28
+ - CSS only. Never add framer-motion, GSAP, Lottie or any animation library, and never animate per frame from JS (no `requestAnimationFrame`, no ResizeObserver).
29
+ - Scenes are server-rendered DOM - no video, no image, no chart library - so every caption ships in the HTML and the tour is crawlable.
30
+ - `MockupViewport` scales the artboard with `.fm-viewport { container-type: inline-size }` and `.fm-artboard { scale: calc(100cqw / var(--fm-artboard-w)) }`: the first paint is already scaled. Never use `tan(atan2())` for the ratio - WebKit computes it wrong and flips the tour upside down on iPhones.
31
+
32
+ ## The CSS contract (header of `hero-scenes.css`)
33
+
34
+ 1. **Resting frame = final frame.** Default styles are the finished frame, shown with no JS, under reduced motion and before hydration, and they must equal each story's 100% frame.
35
+ 2. **Every `animation-*` declaration lives in the one `@media (prefers-reduced-motion: no-preference)` block.** `@keyframes` stay outside it.
36
+ 3. **Longhand only.** A `var()` inside the `animation` shorthand hides the keyframe name from the minifier and the keyframes get dropped as unused.
37
+ 4. **At most one `hs-*` animation class per element.** Two would cascade, not merge. Nest a wrapper to combine (the wrapper owns WHEN, the inner `.hs-blink` owns the loop).
38
+ 5. **No Tailwind `translate-*` / `scale-*` on an element with transform keyframes.** Tailwind v4 emits the standalone `translate` / `scale` properties, which compose with the animated `transform`.
39
+ 6. **Stories run once and hold:** `animation-iteration-count: 1` plus `animation-fill-mode: forwards` (or `both` when a `--hs-step` delay needs its pre-delay frame; never a bare `backwards`). Only `.hs-blink`, `.hs-spin` and `.hs-pulse` are `infinite`.
40
+
41
+ Also: every keyframe states an explicit `100%` frame; no story keyframe ends by restating its 0% frame from 86% on; every scene owns its keyframe families (`hs-<id>-*`) - the only shared one is `hs-scene-enter`; never write `{ ... }` inside a comment in the no-preference block (the stylesheet specs parse it).
42
+
43
+ ## Timing
44
+
45
+ | What | Value |
46
+ | --- | --- |
47
+ | Tab length = story length | `intervalMs = 8000`; every story `animation-duration: 8s` |
48
+ | Story curve | `cubic-bezier(0.22, 1, 0.36, 1)` |
49
+ | Typing | `steps(N, end)`, one step per character, animating `width` (with a caret) or `clip-path` |
50
+ | Caret and placeholder cuts | `steps(1, end)` |
51
+ | Ambient ticks | `.hs-blink` 0.8s `steps(1, end)`; `.hs-spin` 1s linear; `.hs-pulse` 2s `cubic-bezier(0.4, 0, 0.6, 1)` |
52
+ | Scene entrance | `hs-scene-enter`: opacity 0 / `translateY(12px)` to in place by 5.5% |
53
+ | Cascades | one keyframe per family, delayed by `--hs-step` via `step(seconds)` from `scene-step.ts` |
54
+ | Percent to time | 1% = 80 ms; 6.25 points = 0.5 s |
55
+
56
+ A changed number never counts up: stack the old and new values in one grid cell (`col-start-1 row-start-1`) and crossfade them. A scroll inside a scene is a `transform`.
57
+
58
+ ## One beat at a time
59
+
60
+ One thing moves at a time and the pointer leads it. No two story beats in a scene may start within 6.25 points (0.5 s) of each other, except the pointer with the control it presses, and two halves of one change (`-old`/`-new`, a field and its caret, a container and its part). Resolve rows one by one on `--hs-step`; move summary figures as one later beat. Give each scene one cause and one effect - not two stories in 8 seconds. Land the payoff before 74%, while a phone is still zoomed in.
61
+
62
+ ## The pointer
63
+
64
+ - `<SceneCursor className="hs-<id>-cursor" />`, once per scene. It never fades: no `opacity` in its keyframes. Re-declare `.hs-<id>-cursor { opacity: 1; transform: translate(Xpx, Ypx); }` after `.hs-cursor` and before the no-preference block, and make that park equal the keyframes' 100% frame.
65
+ - Enter from off the right edge; every later waypoint keeps the arrow on the artboard (0-1102 x, 0-612 y).
66
+ - A press: pointer `scale(0.9)` on the press frame, ring from `scale(0.6)` at opacity 1 to `scale(1.35)` at opacity 0, the pressed control `scale(0.88)`.
67
+ - Travel: one leg is one gesture - `ease-in` on its first frame, `linear` inside, `ease-out` on the frame that starts its last segment (a one-segment leg takes `ease-in-out`); split any segment longer than about 220px.
68
+ - Park in clear space just right of or below the result the pointer produced - never over text.
69
+ - A scene whose settled screen draws nothing alive can pass `breathing` and bring the ring in with its own `hs-<id>-rest-ring` keyframes (opacity 0 until 89%, 1 from 95%).
70
+
71
+ ## The phone camera
72
+
73
+ Under 768px each scene's `.hs-camera.hs-<id>-camera` wrapper zooms on the story's beats. Its keyframes live in a `@media (max-width: 767px)` block nested in the no-preference block, with the resting `scale(1) translate(0px, 0px)` declared in the same width query. Origin is the artboard centre; every translate is a focal offset from it.
74
+
75
+ - Open wide and hold the whole screen for at least 12 points (`0%, 20%`), then ease in over a few stops.
76
+ - Every zoomed frame sits between 18% and 85%; the pull-back is finished before 86% and held to 100%.
77
+ - Peak at least 1.8 somewhere in the story; a table frame stays near 1.35-1.8x so a row keeps its label column.
78
+ - Frame the LABEL column (the name plus its first value), keep the sidebar and every line of text fully in or fully out - never cut mid-word - and show a wide beat (labels at the far edge, a toast across the window) wide.
79
+ - Hold ONE frame for a cause and its effect (a click and the list it changes, a send and the reply), and hold each frame for the whole beat: a pan that lands on a beat shows a phone reader nothing.
80
+ - Measure, do not guess: mark targets with `data-hs-at` and read their boxes in artboard coordinates. The pointer's coordinates start under the window chrome (44px with an address bar, 33px without).
81
+
82
+ ## Fidelity to the real app
83
+
84
+ - A scene shows the real screen as it is today. Draw the app shell with `SceneAppShell` (the real sidebar classes, rows from `apps/web/config/sidebar.ts`, labels from the app's own messages, the settings rail from `settingsNavGroups`; `surface="desktop"` for the desktop app's window and side panel) - never a hand-tuned sidebar.
85
+ - Write the page body in the app's own pixels with the real screen's own classes and components (`Card`, `buttonVariants`, `ProviderCard`, ...); the shell lays the 1440x755 window out and scales it 7/9 into the artboard. Dialogs and toasts go in `overlay`, over the whole window. A page longer than the window scrolls with a `hs-<id>-scroll` wrapper transform.
86
+ - Fake data is fine; a fake layout is not. Show only behaviour the app has. Numbers must agree with themselves.
87
+ - Colours come from the theme tokens (`bg-primary`, `text-muted-foreground`, ...). Never hand-pick a colour.
88
+ - Every visible string is a message: tab labels and captions under `landing.hero.*`; the real screen's own keys for everything the real screen prints; `demo.hero_scenes.<id>.*` only for copy the web bundle does not carry (desktop- and mobile-only strings, seeded content). Names, addresses, amounts and file contents are data in `hero-scene-world.ts` or the scene.
89
+ - Gate a scene on the flag of the surface it shows (`SCENE_GATES` in `hero-scene-ids.ts`), so a build that switched AI, payments, organizations, desktop or mobile off never advertises it.
90
+
91
+ ## Reduced motion, SSR and layout
92
+
93
+ - Nothing animates outside the no-preference block, so a reduced-motion visitor sees every scene's resting frame. `HeroShowcase` reads the preference with `useSyncExternalStore`: no auto-advance and no countdown bar under reduce.
94
+ - From `lg` the tab strip is one pill. Below `lg` it is a compact grid, flush with no card and without More: `compactTabColumns` picks as few rows as hold five tabs each (ten tabs make 2 x 5, six make 2 x 3), the stylesheet reads it as `--hs-cols` and centres a short last row, and a phone shows each scene's short label (`landing.hero.tabs_short.<id>`). Never let the strip scroll sideways.
95
+ - All panels and captions are in the HTML; inactive ones are `hidden` (which cancels their animations; showing one restarts them from 0%).
96
+ - No layout shift: the viewport reserves `aspect-ratio: 1120 / 630`, scenes are absolutely positioned inside a fixed, `overflow-hidden` artboard, and the headline has no entrance animation.
97
+
98
+ ## The feature grid reveal (`bento.css`)
99
+
100
+ The grid's tiles rise in as they enter the viewport with a scroll-driven animation and no JS: `animation-timeline: view()` inside `@supports (animation-timeline: view())` inside the reduced-motion gate, the range staggered with `--bento-lag` (a view timeline ignores `animation-delay`), the same story curve, resting on the finished frame, and no colour written.
101
+
102
+ ## Add or replace a scene
103
+
104
+ 1. Pick the screen and the ONE story: what the pointer does, what changes, where it ends. Screenshot the real screen first.
105
+ 2. Add the id to `HERO_SCENE_IDS` (tour order) and its flag to `SCENE_GATES` in `lib/landing/hero-scene-ids.ts`; add the tab label, its short phone label and the caption under `landing.hero.tabs.<id>`, `landing.hero.tabs_short.<id>` and `landing.hero.tab_captions.<id>` in `en/web.json`.
106
+ 3. Create `components/landing/hero/scenes/<id>-scene.tsx`: a root `<div className="hs-<id>-enter absolute inset-0">`, the page inside `SceneAppShell` (or the scene's own native surface), the real screen's keys plus `demo.hero_scenes.<id>` for the rest, and one `<SceneCursor className="hs-<id>-cursor" />`.
107
+ 4. Register it in `SCENES` in `lib/landing/hero-scenes.tsx` with its chrome and address (built from `config.domain` and `config.routes`).
108
+ 5. In `hero-scenes.css`: a commented section with the resting frame (final frame) and the cursor park; the rules inside the no-preference block (`.hs-<id>-enter` runs `hs-scene-enter`); the camera rule inside its width query; the `@keyframes hs-<id>-*` below.
109
+ 6. To replace a demo scene, delete its scene file, its CSS section, its keys and its id from `CHOREOGRAPHED_BEFORE_RULE` in the loop stylesheet spec.
110
+ 7. Run `pnpm --filter web test tests/components/landing` and do the QA pass below.
111
+
112
+ ## QA checklist
113
+
114
+ - Each scene's settled frame at 1280px, light and dark: the pointer parked off text, nothing half-faded, the final state readable.
115
+ - At 390px, frames at 25%, 40%, 55% and 70% of each scene (pause the panel's animations and set their `currentTime` to `pct * 80` ms): every frame shows what changes AND what it belongs to.
116
+ - Reduced motion: every scene still reads as the finished product shot.
117
+ - Hover the frame: the scene and the countdown freeze together.
118
+ - No layout shift as the hero loads.
119
+
120
+ ## Tests to keep
121
+
122
+ | Spec | Pins |
123
+ | --- | --- |
124
+ | `tests/components/landing/hero-scenes-loop-stylesheet.test.ts` | 8s stories run once and hold, typing on steps, only ambient loops, explicit 100% frames, rest equals end, no rewind, camera rules, one beat at a time, own keyframe families |
125
+ | `tests/components/landing/hero-scenes-cursor-stylesheet.test.ts` | Pointer park equals its last waypoint, no fade, every waypoint on the artboard |
126
+ | `tests/components/landing/hero-scenes.test.tsx` | Registry order, per-flag gates, artboard and camera, one pointer, one animation class per element, own families, no raw message keys |
127
+ | `tests/components/landing/hero-showcase.test.tsx` | Panels, auto-advance, visible-time counting, frame-only pause, reduced motion, countdown, keyboard |
128
+ | `e2e/landing-motion.spec.ts` | Real-browser motion contract: hs-* only, stories once, freeze on hover, nothing under reduced motion |
129
+
130
+ The two stylesheet specs read the CSS file from disk - the one place the animation facts exist - and are listed as cross-artifact checks in `packages/e2e-support/src/test-contract-debt.ts`.
131
+
132
+ ## Mistakes to avoid
133
+
134
+ | Mistake | Fix |
135
+ | --- | --- |
136
+ | Keyframes looping with a wind-down, so a late tab switch replays the opening | Stories run once and hold their 100% frame |
137
+ | A keyframe list with no 100% frame - the scene slides back to its resting look | State the 100% frame outright |
138
+ | Resting style differs from the 100% frame - reduced motion sees another ending | Rest equals end, every property |
139
+ | `animation` shorthand with `var()` - keyframes tree-shaken | Longhand properties |
140
+ | Tailwind `translate-*` on an animated element - transforms compose | Position with a wrapper |
141
+ | Camera zoomed at 0.4 s - phones never see the whole screen | Hold wide through 20% |
142
+ | Camera centred on numbers - phones see "27,100 · 41" with no label | Frame the label column, cap tables near 1.8x |
143
+ | Zoomed frame cutting sidebar words | Sidebar fully in or fully out |
144
+ | Pointer parked over text | Park in clear space right of or below the result |
145
+ | Two things moving at once, or two stories in one scene | One beat at a time, one cause and effect |
146
+ | A hand-tuned sidebar drifting from the real app | `SceneAppShell` with the app's own classes |
147
+ | Payoff landing during the pull-back | Land it before 74% |
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: og-image
3
+ description: Redraw the site's social share card (apps/web/public/og.png, the Open Graph / Twitter image every shared link shows) from the product itself - the landing page's hero panel captured in dark mode, framed under the logo and site name in the theme's own colours - and keep the generated per-page cards (og-card.tsx) in the same colours. Use when the user asks to redo, update, refresh or rebrand the OG image, share card, social preview or link preview, or after the logo, the brand colours in tooling/styles/theme.css, the site name, or the landing hero / dashboard demo changed.
4
+ ---
5
+
6
+ # OG image
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.
9
+
10
+ ## When to run it
11
+
12
+ - The logo (`config.logo.square`), the site name (`config.siteName`) or the brand colours (`tooling/styles/theme.css`) changed.
13
+ - The landing hero changed - a new hero visual, a dashboard tour, new demo data.
14
+ - The project still carries the boilerplate's card.
15
+
16
+ If the landing demo is out of date with the real app, fix the demo first: the card advertises it.
17
+
18
+ ## What it reads
19
+
20
+ | Input | Source | Override |
21
+ | --- | --- | --- |
22
+ | Colours | `--background`, `--foreground`, `--primary`, `--muted-foreground` from the `.dark` block of `tooling/styles/theme.css` (falling back to `:root`), verbatim | Change the theme, never the script |
23
+ | Site name | `config.siteName` from `@repo/config` | - |
24
+ | Logo | `config.logo.square` under `apps/web/public/` - an SVG is inlined so it scales crisply, a raster file is embedded | - |
25
+ | Display font | The first font file in `apps/web/assets/fonts/` (weight 600) | `--font <path> --font-weight <n>` |
26
+ | Panel | The landing page's `#hero` element | `--selector "<css>"` |
27
+ | Page | `http://localhost:3000` | `--url <url>` (local dev or production) |
28
+
29
+ ## Steps
30
+
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.
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
+ 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
+ 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.
36
+ 6. **Ship it.** Commit `og.png` and `og-card.tsx` together. If anything references the image with a cache key (`/og.png?v=N`), bump it. Social sites cache OG images for days: after deploying, force a refresh with the Facebook Sharing Debugger, LinkedIn Post Inspector and the X card validator.
37
+
38
+ ## Flags
39
+
40
+ | Flag | Default | Use |
41
+ | --- | --- | --- |
42
+ | `--url` | `http://localhost:3000` | The landing page to capture |
43
+ | `--selector` | `#hero` | The panel element |
44
+ | `--fit` | `content` | `content` keeps only the part of the element that paints (drops empty bands of a vertically centred hero); `box` takes the element's whole box |
45
+ | `--margin` | `40` | Pixels of page kept around the panel |
46
+ | `--wait` | `5000` | Milliseconds after `load` before the capture |
47
+ | `--remove` | consent, chat, dev badge | One more selector to remove before the capture (repeatable) |
48
+ | `--font`, `--font-weight` | first file in `apps/web/assets/fonts`, `600` | The display font for the site name |
49
+ | `--out` | `apps/web/public/og.png` | Where the card is written |
50
+ | `--no-og-card` | - | Leave `og-card.tsx` untouched |
51
+
52
+ ## Rules
53
+
54
+ - 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
+ - Never click the consent banner: a screenshot must not imply a choice. The script removes it from the DOM.
56
+ - Do not wait for `networkidle` - pages that poll never settle; the script uses `load` plus a fixed wait.
57
+ - A Chromium is needed: if Playwright reports a missing browser, run `pnpm --filter web exec playwright install chromium`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generatesaas",
3
- "version": "3.30.0",
3
+ "version": "3.31.0",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",