generatesaas 3.0.1 → 3.0.2
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 +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import{Command as Rl}from"commander";import*as ls from"@clack/prompts";import{ex
|
|
|
5
5
|
`),T=[J!=="none"?` Payment: ${h.cyan(It[J].label)} (${fe})`:` Payment: ${h.dim("none")}`,` Credits: ${Be?h.cyan("Yes"):h.dim("No")}`,` AI features: ${L?h.cyan("Yes"):h.dim("No")}`,...L?[` Runner: ${V?h.cyan("Yes"):h.dim("No")}`]:[],...F?[]:[` Web AI: ${h.dim("No")} (desktop-first)`],` Email: ${h.cyan(Tt[X].label)}`,` Observability: ${he.length===0?h.dim("none"):h.cyan(he.map(er=>_t[er].label).join(", "))}`,` Multi-tenancy: ${Ee?h.cyan("Yes"):h.dim("No")}`,` Blog: ${Se?h.cyan("Yes"):h.dim("No")}`,` Docs app: ${Re?h.cyan("Yes"):h.dim("No")}`,` Desktop app: ${x?h.cyan("Yes"):h.dim("No")}`,` Rev. sharing: ${Ae?h.cyan("Yes"):h.dim("No")}`].join(`
|
|
6
6
|
`),ye=[h.bold("Project"),c,"",h.bold("Infrastructure"),d,"",h.bold("Features"),T];if(Pe.length>0){let er=Pe.map(Ur=>{let ps=at[Ur.key]?h.green("provided"):h.dim("skipped");return` ${Ur.key}: ${ps}`}).join(`
|
|
7
7
|
`);ye.push("",h.bold("Credentials"),er)}u.note(ye.join(`
|
|
8
|
-
`),"Summary");let Mr=await u.confirm({message:"Proceed with these settings?"});(u.isCancel(Mr)||!Mr)&&(u.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:A,deploymentTarget:a,databaseProvider:f,cacheProvider:$,paymentProvider:J,emailProvider:X,observability:he,multiTenancy:Ee,blog:Se,docs:Re,desktop:x,ai:L,webAi:F,runner:V,revenueSharing:Ae,credits:Be,defaultCurrency:fe,...Object.keys(at).length>0?{credentials:at}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...R!==void 0?{demo:R}:{}}}import{createReadStream as pn,existsSync as Es}from"fs";import{mkdir as Ss}from"fs/promises";import{join as Rs}from"path";import{Readable as As}from"stream";import{pipeline as mr}from"stream/promises";import{extract as Ps}from"tar";import{join as xe}from"path";import{homedir as ms}from"os";var pt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",H=".generatesaas",ve=xe(H,"manifest.json"),Qr="nextjs",sr="nuxt",or="2.4.1",en=xe(H,"hashes.json"),Dt=xe(H,"template-hashes.json"),Nt=xe(H,"template"),tn=xe(H,"staging"),rn=xe(H,"staging.json"),pe=xe(ms(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function de(e){return{apiKey:e,baseUrl:pt}}async function be(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.0.
|
|
8
|
+
`),"Summary");let Mr=await u.confirm({message:"Proceed with these settings?"});(u.isCancel(Mr)||!Mr)&&(u.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:A,deploymentTarget:a,databaseProvider:f,cacheProvider:$,paymentProvider:J,emailProvider:X,observability:he,multiTenancy:Ee,blog:Se,docs:Re,desktop:x,ai:L,webAi:F,runner:V,revenueSharing:Ae,credits:Be,defaultCurrency:fe,...Object.keys(at).length>0?{credentials:at}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...R!==void 0?{demo:R}:{}}}import{createReadStream as pn,existsSync as Es}from"fs";import{mkdir as Ss}from"fs/promises";import{join as Rs}from"path";import{Readable as As}from"stream";import{pipeline as mr}from"stream/promises";import{extract as Ps}from"tar";import{join as xe}from"path";import{homedir as ms}from"os";var pt=process.env.GENERATESAAS_API_URL??"https://cli.generatesaas.com",H=".generatesaas",ve=xe(H,"manifest.json"),Qr="nextjs",sr="nuxt",or="2.4.1",en=xe(H,"hashes.json"),Dt=xe(H,"template-hashes.json"),Nt=xe(H,"template"),tn=xe(H,"staging"),rn=xe(H,"staging.json"),pe=xe(ms(),".generatesaas");var j=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function de(e){return{apiKey:e,baseUrl:pt}}async function be(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.0.2"}});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 fs,readFileSync as hs,writeFileSync as gs,mkdirSync as ys}from"fs";import{dirname as vs}from"path";import*as we from"@clack/prompts";function dt(){if(!fs(pe))return null;try{let e=JSON.parse(hs(pe,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&we.log.warning(`Found old GitHub token in ${pe}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function De(e){ys(vs(pe),{recursive:!0}),gs(pe,JSON.stringify({apiKey:e},null," ")+`
|
|
9
9
|
`,{mode:384})}async function Je(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=dt();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 ut()}async function ut(){let e=await we.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return we.isCancel(e)&&(we.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as bs}from"fs/promises";async function ke(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await bs(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 be(e,"/versions")).json()}async function nn(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await be(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof j&&r.status===404)return null;throw r}}async function sn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skillMd:`# Offline skill stub
|
|
10
|
-
`,scripts:{}}:await(await be(e,`/skill/${encodeURIComponent(t)}`)).json()}function Ct(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 on(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:e.blog,docs:e.docs,desktop:e.desktop,runner:e.runner,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 be(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function an(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await be(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 cn(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",".svelte-kit",".wrangler",".devcontainer","playwright-report","test-results"]),dr=new Set(["pnpm-lock.yaml"]);function Xe(e){if(ur(e))return!0;for(let t of e.split("/"))if(dr.has(t))return!0;return!1}var ws=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md"]),ln=["scripts/docs-lint.ts"],ks=["docs/superpowers","packages/cli","packages/cli-api","packages/config/tests/runner-brand-lockstep.test.ts","apps/runner","docs/agentrunner","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function ur(e){let t=e.split("/");for(let r of t)if(pr.has(r))return!0;if(ln.includes(e)||ln.some(r=>r.startsWith(e+"/")))return!1;if(ws.has(t[0]))return!0;for(let r of ks)if(e===r||e.startsWith(r+"/"))return!0;return!1}async function $t(e,t,r){await Ss(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Rs(n,`v${t}.tar.gz`);if(!Es(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await mr(pn(a),fr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await mr(pn(i),fr(r));return}let o=await be(e,`/template/${encodeURIComponent(t)}`);if(!o.body)throw new Error("Empty response body");let s=As.fromWeb(o.body);await mr(s,fr(r))}function fr(e){return Ps({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!ur(r):!0},sync:!1})}import{readdir as fn,readFile as ht,rm as hr,writeFile as gt}from"fs/promises";import{join as Q}from"path";import{readFile as ft,rm as $s}from"fs/promises";import{join as mt}from"path";import{mkdir as Is,readdir as Ts,rm as _s,rmdir as Os,writeFile as xs}from"fs/promises";import{dirname as Lt,join as Ds,relative as Ns,sep as Cs}from"path";function Ne(e){return e.split(Cs).join("/")}async function jt(e){await Is(e,{recursive:!0})}async function l(e,t){await jt(Lt(e)),await xs(e,t,"utf-8")}async function Mt(e,t){await _s(e,{force:!0});let r=Lt(e);for(;r!==t&&r!==Lt(r);){try{await Os(r)}catch{return}r=Lt(r)}}async function ue(e,t,r,n){let i=[],o=await Ts(e,{withFileTypes:!0});for(let s of o){let a=Ds(e,s.name),p=Ne(Ns(t,a));r(p)||(s.isDirectory()?i.push(...await ue(a,t,r,n)):s.isFile()&&(n===void 0||n(p))&&i.push(a))}return i}function Ls(e){return new RegExp(`^[ \\t]*(?:\\/\\/|\\{\\/\\*|\\*) gsaas:${e}-start(?: \\*\\/\\})?[ \\t]*\\r?\\n[\\s\\S]*?^[ \\t]*(?:\\/\\/|\\{\\/\\*|\\*) gsaas:${e}-end(?: \\*\\/\\})?[ \\t]*\\r?\\n`,"gm")}function Z(e,t,r,n){let i=Ls(r);if(e.match(i)===null)throw new Error(`${n}: expected gsaas ${r} markers in ${t}, but found none (boilerplate drift).`);let o=e.replace(i,"");if(o.includes(`gsaas:${r}-start`)||o.includes(`gsaas:${r}-end`))throw new Error(`${n}: an unbalanced gsaas ${r} marker is left in ${t} (boilerplate drift).`);return o.replace(/\n{3,}/g,`
|
|
10
|
+
`,scripts:{}}:await(await be(e,`/skill/${encodeURIComponent(t)}`)).json()}function Ct(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 on(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:e.blog,docs:e.docs,desktop:e.desktop,runner:e.runner,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 be(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function an(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await be(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 cn(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",".svelte-kit",".wrangler",".devcontainer","playwright-report","test-results"]),dr=new Set(["pnpm-lock.yaml"]);function Xe(e){if(ur(e))return!0;for(let t of e.split("/"))if(dr.has(t))return!0;return!1}var ws=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),ln=["scripts/docs-lint.ts"],ks=["docs/superpowers","packages/cli","packages/cli-api","packages/config/tests/runner-brand-lockstep.test.ts","apps/runner","docs/agentrunner","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function ur(e){let t=e.split("/");for(let r of t)if(pr.has(r))return!0;if(ln.includes(e)||ln.some(r=>r.startsWith(e+"/")))return!1;if(ws.has(t[0]))return!0;for(let r of ks)if(e===r||e.startsWith(r+"/"))return!0;return!1}async function $t(e,t,r){await Ss(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=Rs(n,`v${t}.tar.gz`);if(!Es(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await mr(pn(a),fr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await mr(pn(i),fr(r));return}let o=await be(e,`/template/${encodeURIComponent(t)}`);if(!o.body)throw new Error("Empty response body");let s=As.fromWeb(o.body);await mr(s,fr(r))}function fr(e){return Ps({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!ur(r):!0},sync:!1})}import{readdir as fn,readFile as ht,rm as hr,writeFile as gt}from"fs/promises";import{join as Q}from"path";import{readFile as ft,rm as $s}from"fs/promises";import{join as mt}from"path";import{mkdir as Is,readdir as Ts,rm as _s,rmdir as Os,writeFile as xs}from"fs/promises";import{dirname as Lt,join as Ds,relative as Ns,sep as Cs}from"path";function Ne(e){return e.split(Cs).join("/")}async function jt(e){await Is(e,{recursive:!0})}async function l(e,t){await jt(Lt(e)),await xs(e,t,"utf-8")}async function Mt(e,t){await _s(e,{force:!0});let r=Lt(e);for(;r!==t&&r!==Lt(r);){try{await Os(r)}catch{return}r=Lt(r)}}async function ue(e,t,r,n){let i=[],o=await Ts(e,{withFileTypes:!0});for(let s of o){let a=Ds(e,s.name),p=Ne(Ns(t,a));r(p)||(s.isDirectory()?i.push(...await ue(a,t,r,n)):s.isFile()&&(n===void 0||n(p))&&i.push(a))}return i}function Ls(e){return new RegExp(`^[ \\t]*(?:\\/\\/|\\{\\/\\*|\\*) gsaas:${e}-start(?: \\*\\/\\})?[ \\t]*\\r?\\n[\\s\\S]*?^[ \\t]*(?:\\/\\/|\\{\\/\\*|\\*) gsaas:${e}-end(?: \\*\\/\\})?[ \\t]*\\r?\\n`,"gm")}function Z(e,t,r,n){let i=Ls(r);if(e.match(i)===null)throw new Error(`${n}: expected gsaas ${r} markers in ${t}, but found none (boilerplate drift).`);let o=e.replace(i,"");if(o.includes(`gsaas:${r}-start`)||o.includes(`gsaas:${r}-end`))throw new Error(`${n}: an unbalanced gsaas ${r} marker is left in ${t} (boilerplate drift).`);return o.replace(/\n{3,}/g,`
|
|
11
11
|
|
|
12
12
|
`).replace(/,(\r?\n[ \t]*[\]})])/g,"$1")}async function Y(e,t,r,n,i){let o=await ft(e,"utf-8"),s=o.indexOf(t);if(s===-1)throw new Error(`${i}: expected to find the ${n} seam, but it was missing (boilerplate drift).`);if(o.indexOf(t,s+t.length)!==-1)throw new Error(`${i}: the ${n} seam appears more than once (boilerplate drift).`);await l(e,o.slice(0,s)+r+o.slice(s+t.length))}async function Ze(e,t,r,n){let i=/\n([\t ]+)"/.exec(await ft(e,"utf-8"))?.[1];if(i!==r){let o=s=>s===" "?"tab":`${s.length}-space`;throw new Error(`${n}: expected ${e} to be ${o(r)}-indented, but it is ${i===void 0?"not indented":o(i)}-indented (boilerplate drift). Re-serializing it with the wrong indent would reformat the whole file.`)}await l(e,`${JSON.stringify(t,null,r)}
|
|
13
13
|
`)}async function js(e,t,r){let n=mt(e,"ai.mdx"),o=(await ft(n,"utf-8")).split(`
|
|
@@ -1449,7 +1449,7 @@ function posthogConfigured(): boolean {
|
|
|
1449
1449
|
${g}`:s.message))}else i()})})}async function $i(e){if(!je("pnpm"))return N.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await Le("pnpm",["install","--lockfile-only","--no-frozen-lockfile","--config.minimumReleaseAge=0"],e),!0}catch(t){let r=t instanceof Error?t.message:String(t);return N.log.warn(`Lockfile regeneration failed: ${r}`),N.log.warn("Deploys using --frozen-lockfile may fail."),!1}}async function Li(e){if(!je("pnpm"))return N.log.warn("pnpm not found. Skipping dependency installation."),N.log.info("Install pnpm: https://pnpm.io/installation"),!1;let t=N.spinner();t.start("Installing dependencies (this may take a minute)...");try{return await Le("pnpm",["install","--config.minimumReleaseAge=0"],e),t.stop("Dependencies installed."),!0}catch(r){t.stop("Dependency installation failed.");let n=r instanceof Error?r.message:String(r);return N.log.warn(`pnpm install failed: ${n}`),N.log.warn("You can run it manually later."),!1}}async function ji(e){if(!je("pnpm"))return!1;let t=N.spinner();t.start("Generating baseline database migration...");try{return await Le("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 N.log.warn(`Could not generate baseline migration: ${n}`),N.log.warn("Run 'pnpm -F @repo/database generate' before your first deploy."),!1}}async function Mi(e){try{return await Ci(Or(e,".git")),N.log.info("Git repository already exists, skipping init."),!0}catch{}if(!je("git"))return N.log.warn("git not found. Skipping repository initialization."),!1;let t=N.spinner();t.start("Initializing git repository...");try{return await Le("git",["init"],e),await Le("git",["add","-A"],e),await Le("git",["commit","--no-verify","-m","Initial commit from GenerateSaaS"],e),t.stop("Git repository initialized."),!0}catch{return t.stop("Git initialization failed."),N.log.warn("You can run git init manually later."),!1}}async function Ui(e){if(!je("pnpm"))return!1;try{await Ci(Or(e,".git"))}catch{return!1}try{let t=JSON.parse(await Nc(Or(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 Le("pnpm",["exec","simple-git-hooks"],e),!0}catch{return N.log.warn("Could not install git hooks. Run 'pnpm exec simple-git-hooks' manually."),!1}}import*as Me from"@clack/prompts";import q from"picocolors";function Vi(e,t){let r=He(e);t.dockerAvailable||Me.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/"),t.baselineMigrationMissing&&Me.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 - deploying without it crash-loops the container.");let n=[];n.push(`cd ${e.projectDir}`),t.pnpmInstalled||n.push("pnpm install"),n.push(`pnpm infra ${q.dim(`# ${r.map(a=>Br[a].label).join(", ")}`)}`),n.push(`pnpm dev ${q.dim("# http://localhost:3000")}`),t.skippedCredentials.length>0&&(n.push(""),n.push(q.dim("Fill in remaining TODO values in .env"))),Me.note(n.join(`
|
|
1450
1450
|
`),q.yellow("Start Development"));let i=[];i.push(`App ${q.cyan("http://localhost:3000")}`),e.architecture==="separate"&&i.push(`API ${q.cyan("http://localhost:3010")}`),r.includes("mailpit")&&i.push(`Mailpit ${q.cyan("http://localhost:8025")}`),r.includes("inngest")&&i.push(`Inngest ${q.cyan("http://localhost:8288")}`),Me.note(i.join(`
|
|
1451
1451
|
`),q.yellow("Dev Tools"));let o=[],s=Cc(e);s.length>0&&o.push(`Set in production: ${q.dim(s.join(", "))}`),o.push("pnpm db:setup # Apply the database schema"),o.push($c(e)),Me.note(o.join(`
|
|
1452
|
-
`),q.yellow("Deployment"))}function Cc(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_BASE_URL"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function $c(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 st(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 Ue(e,t){let r=st(e),n=st(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 Xt(e,t){return e.versions.find(r=>r.version===t)?.cli}function Fi(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:st(e)===null}function Zt(e,t,r="3.0.
|
|
1452
|
+
`),q.yellow("Deployment"))}function Cc(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_BASE_URL"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function $c(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 st(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 Ue(e,t){let r=st(e),n=st(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 Xt(e,t){return e.versions.find(r=>r.version===t)?.cli}function Fi(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:st(e)===null}function Zt(e,t,r="3.0.2"){if(Fi(r))return{ok:!0};let n=Xt(e,e.latest);return!n||st(n)===null?{ok:!0}:Ue(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 Bi(e,t,r="3.0.2"){if(Fi(r))return{ok:!0};let n=Xt(e,t);return!n||st(n)===null?{ok:!0}:Ue(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 Fc from"picocolors";var Bc="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function Kc(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 Ki(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 ne("--architecture <type>","fullstack or separate").choices([...Ye])).addOption(new ne("--payment <provider>","payment provider").choices([...We])).addOption(new ne("--email <provider>","email provider").choices([...qe])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--blog","enable blog").option("--no-blog","disable blog").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/electron, built with Electron)").option("--no-desktop","exclude the desktop app").option("--ai","include the AI features (chat, models, schedules, integrations); unlocks the runner").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop app is the AI product. Requires --desktop and --ai, and cannot be combined with --runner").option("--runner","include the runner feature - your web users connect a machine that runs their own AI subscriptions for this app").option("--no-runner","exclude the backend runner feature").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new ne("--currency <code>","default currency for billing").choices([...oe])).addOption(new ne("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...Oe])).addOption(new ne("--deploy <target>","deployment target").choices([...ae])).addOption(new ne("--database <provider>","database provider").choices([...ce])).addOption(new ne("--cache <provider>","cache provider").choices([...le])).option("--observability <providers>",`comma-separated observability providers (${B.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 ne("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new ne("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await Gc(t?{...r,apiKey:t}:r)})}async function Gc(e){let t=performance.now();Vr("3.0.2");let r;try{r=Jr(e)}catch(v){b.cancel(D(v)),process.exit(1)}let n=b.spinner(),i;try{i=await Je({apiKey:e.apiKey,prompt:!e.yes})}catch(v){b.cancel(D(v)),process.exit(1)}e.demo&&Pr(i)!==Bc&&(b.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=de(i),s,a=async()=>{s=await ke(o);let v=Zt(s,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:s.latest,selectedVersion:s.latest,desktopAllowed:s.entitlements?.desktopAllowed??!0,runnerAllowed:s.entitlements?.runnerAllowed??!0}};n.start("Verifying access...");let p,m,w=!0,g=!0;try{({latestVersion:p,selectedVersion:m,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),De(i)}catch(v){if(n.stop("Access verification failed."),v instanceof j&&v.status===401){e.yes&&(b.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),b.log.warning("Invalid API key."),i=await ut(),o=de(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:m,desktopAllowed:w,runnerAllowed:g}=await a()),n.stop("Access verified."),De(i)}catch(x){n.stop("Access verification failed."),b.cancel(x instanceof j&&x.status===401?"Invalid API key.":D(x)),process.exit(1)}}else b.cancel(D(v)),process.exit(1)}b.log.success(`Latest version: ${p}`),r.desktop===!0&&!w&&(b.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.runner===!0&&!g&&(b.cancel("The runner is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let k;e.yes?k=Xr({...r,...w?{}:{desktop:!1},...g?{}:{runner:!1}}):k=await Zr(r,{desktopAllowed:w,runnerAllowed:g});let A;n.start("Activating license...");try{let v=e.demo&&k.baseUrl?await Kc(k.baseUrl):crypto.randomUUID(),x=()=>({frontend:ar,version:m,installId:v,projectName:k.projectName,options:on(k)}),L;try{L=await cr(o,x())}catch(ge){let U=Ct(ge);if(!U?.lastAllowedVersion||!s)throw ge;n.stop("License activation failed.");let V=Bi(s,U.lastAllowedVersion);if(V.ok||(b.cancel(`${U.message} ${V.message}`),process.exit(1)),e.yes){let Ae=Xt(s,U.lastAllowedVersion);b.cancel(`${U.message} Re-run ${Ae?`npx generatesaas@${Ae} init`:"init"} without --yes to continue with v${U.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let F=await b.confirm({message:`Your update window has ended. Continue with v${U.lastAllowedVersion} (the last version your license covers)?`});(b.isCancel(F)||!F)&&(b.cancel("Setup cancelled."),process.exit(0)),m=U.lastAllowedVersion,n.start(`Activating license for v${m}...`),L=await cr(o,x())}A={token:L.token,keyHash:Pr(i),installId:L.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),b.cancel(D(v)),process.exit(1)}let f=Vc(k.projectDir);if(Lc(f)&&jc(f).length>0)if(e.yes)b.log.info(`Directory ${f} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let x=await b.select({message:`Directory ${f} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(b.isCancel(x)||x==="cancel")&&(b.cancel("Setup cancelled."),process.exit(0)),x==="overwrite"&&Mc(f,{recursive:!0,force:!0})}let $={...k,projectDir:f,version:m,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await $t(o,m,f),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),b.cancel(D(v)),process.exit(1)}n.start("Generating project files...");try{if(await zt($),!e.demo){let v=await it(f);await l(Uc(f,Dt),JSON.stringify(v,null," ")+`
|
|
1453
1453
|
`),await Oi(f,f)}await Ni(f),await Ti($,A),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),b.cancel(D(v)),process.exit(1)}!await $i(f)&&$.demo===!0&&(b.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let fe=await Li(f),X=$.demo!==!0&&e.dbMigration!==!1,he=!1;X&&fe&&(await ji(f),he=!0),await Mi(f),fe&&await Ui(f);let Ee=je("docker"),Re=ir($).map(v=>v.key).filter(v=>!$.credentials?.[v]);Vi($,{pnpmInstalled:fe,dockerAvailable:Ee,skippedCredentials:Re,baselineMigrationMissing:X&&!he}),Fr(),b.log.info(Fc.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as Cr}from"fs";import{readFile as Zi}from"fs/promises";import{join as ot,resolve as Zc}from"path";import*as y from"@clack/prompts";import C from"picocolors";import{mkdtemp as Hc,rm as Yc}from"fs/promises";import{tmpdir as Wc}from"os";import{join as qc}from"path";async function xr(e,t,r,n){let i=await Hc(qc(Wc(),"generatesaas-stage-"));try{await $t(e,t,i),await zt({...r,projectDir:i}),await Ir(i,n)}finally{await Yc(i,{recursive:!0,force:!0})}}function Rt(e){return e.paymentProvider!==void 0&&e.paymentProvider!=="none"}var Dr=[{key:"architecture",label:"Architecture",hint:"Fullstack (frontend hosts the API) or a standalone Hono backend.",category:"Infrastructure",kind:"enum",default:"fullstack",choices:Ye,adoptable:!1,impact:"structural",shapesTree:!0},{key:"deploymentTarget",label:"Deployment target",hint:"Node.js / Docker or Vercel serverless.",category:"Infrastructure",kind:"enum",default:"node",choices:ae,adoptable:!1,impact:"config",shapesTree:!0},{key:"databaseProvider",label:"Database provider",hint:"Self-hosted PostgreSQL, Neon, or Supabase.",category:"Infrastructure",kind:"enum",default:"postgres",choices:ce,adoptable:!1,impact:"config",shapesTree:!0},{key:"cacheProvider",label:"Cache provider",hint:"Self-hosted Redis or Upstash.",category:"Infrastructure",kind:"enum",default:"redis",choices:le,adoptable:!1,impact:"config",shapesTree:!0},{key:"paymentProvider",label:"Payment provider",hint:"Stripe, Polar, or none.",category:"Features",kind:"enum",default:"none",choices:We,adoptable:!1,impact:"structural",shapesTree:!0},{key:"defaultCurrency",label:"Default currency",hint:"Billing and pricing currency.",category:"Features",kind:"enum",default:"USD",choices:oe,adoptable:!1,impact:"config",shapesTree:!1},{key:"emailProvider",label:"Email provider",hint:"SMTP, Amazon SES, or Resend.",category:"Features",kind:"enum",default:"smtp",choices:qe,adoptable:!1,impact:"config",shapesTree:!1},{key:"observability",label:"Observability",hint:"Which services receive your app's errors, and on PostHog its LLM analytics. Pick any combination - anything you do not pick costs nothing, since its SDK and its adapter are never generated.",category:"Features",kind:"multiselect",default:[],choices:B,adoptable:!0,impact:"config",shapesTree:!0},{key:"multiTenancy",label:"Multi-tenancy (organizations)",hint:"Adds organizations - teams, members, and shared resources.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!1},{key:"blog",label:"Blog",hint:"Adds the marketing blog (content collection, list and post pages).",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!1},{key:"docs",label:"Docs app",hint:"Adds the self-hosted Fumadocs documentation site (apps/docs).",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"desktop",label:"Desktop app",hint:"Adds the cross-platform desktop app (apps/electron, built with Electron).",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"ai",label:"AI features",hint:"Adds the AI surface (chat, models, schedules, integrations) and unlocks the runner option. A desktop project ALWAYS ships the app's local AI stack: this option sets config.desktop.agents.enabled (the runtime gate on those screens). Off keeps config.ai.enabled false so the AI nav stays hidden - the AI packages still ship, because packages/translate depends on @repo/ai for the i18n pipeline every project uses.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0},{key:"webAi",label:"AI in the web app",hint:"Whether the WEB app shows the AI surfaces - chat, schedules, model and integration settings, and their nav entries. Off is the desktop-first shape: the desktop app is where your AI product lives and the website keeps account, billing and licensing only. The AI SERVICE is untouched either way (config.ai.enabled, the /api/ai routes and the desktop agents all stay exactly as your AI option set them), so the desktop app keeps talking to the same backend. Only meaningful with both AI features and the desktop app, and never with the runner - its pairing and device screens are part of the web AI surface.",category:"Features",kind:"boolean",default:!0,adoptable:!0,impact:"config",shapesTree:!1,requires:e=>e.ai===!0&&e.desktop===!0&&e.runner!==!0,requiresLabel:"requires AI features and the desktop app, and is unavailable with the runner (its pairing and device screens live in the web AI surface)"},{key:"runner",label:"Runner daemon",hint:"Lets your users connect a machine that runs their own AI subscriptions (and any device-side work you add) on their hardware. They install AgentRunner, the daemon we publish and keep updated - your project ships the pairing, dispatch and Runners surface, never the daemon. Needs an always-on backend: the transport holds one connection open per paired device, which serverless (Vercel) cannot do.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"structural",shapesTree:!0,requires:e=>e.ai===!0&&e.webAi!==!1&&ie({...e,runner:!0})===void 0,requiresLabel:"requires AI features, the web AI surface, and an always-on deployment target (not Vercel)"},{key:"credits",label:"Metered credits",hint:"Adds metered usage credits on top of subscription plans.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"config",shapesTree:!1,requires:e=>Rt(e),requiresLabel:"requires a payment provider"},{key:"revenueSharing",label:"Revenue sharing",hint:"Opt-in MRR leaderboard with dofollow backlinks.",category:"Features",kind:"boolean",default:!1,adoptable:!0,impact:"config",shapesTree:!1}];function zc(e,t){return e[t]!==void 0}function Gi(e){return Dr.filter(t=>t.adoptable&&!zc(e,t.key)&&(t.requires?t.requires(e):!0)).map(t=>({key:t.key,label:t.label,hint:t.hint,kind:t.kind,default:typeof t.default=="function"?t.default(e):t.default,...t.choices?{choices:t.choices}:{},impact:t.impact,...t.requiresLabel?{requiresLabel:t.requiresLabel}:{}}))}function Jc(e,t){switch(e.kind){case"boolean":return typeof t=="boolean";case"enum":return typeof t=="string"&&(e.choices??[]).includes(t);case"multiselect":return Array.isArray(t)&&t.every(r=>typeof r=="string"&&(e.choices??[]).includes(r))}}function Xc(e){let t=(e.choices??[]).map(r=>JSON.stringify(r)).join(", ");switch(e.kind){case"boolean":return"true or false";case"enum":return`one of ${t}`;case"multiselect":return`an array of ${t}`}}function Hi(e){let t=[];for(let r of Dr){let n=e[r.key];n!==void 0&&(Jc(r,n)||t.push(`\`${r.key}\` is ${JSON.stringify(n)}, but it must be ${Xc(r)}.`))}return t}function Yi(e){let t={};for(let r of Dr)if(typeof r.default=="function"){if(r.requires&&!r.requires(e))continue;t[r.key]=r.default(e)}else t[r.key]=Array.isArray(r.default)?[...r.default]:r.default;return{...t,...e}}function Wi(e){return e?"ON":"OFF"}var At="packages/config/src/index.ts";function qi(e){let t=e.databaseProvider!==void 0&&e.databaseProvider!=="postgres",r=e.cacheProvider!==void 0&&e.cacheProvider!=="redis";return[...e.dockerServices??[]].filter(n=>!(n==="postgres"&&t)&&!(n==="redis"&&r)).sort()}function zi(e){return[...He({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var Nr=[{key:"errorTracking",severity:"warn",normalize:e=>{e.errorTracking===void 0||e.observability!==void 0||(e.observability=e.errorTracking==="none"?[]:[e.errorTracking])},preserved:()=>!0,describe:()=>"Retired option `errorTracking`: it is now `observability`, an array, because a project may run more than one provider at once. Your recorded choice was migrated across automatically."},{key:"companion",severity:"warn",normalize:e=>{e.companion===void 0||e.runner!==void 0||(e.runner=e.companion)},preserved:()=>!0,describe:()=>"Retired option `companion`: it is now `runner`, because the daemon it names is AgentRunner. Your recorded choice was migrated across automatically - the feature itself is unchanged."},{key:"companionSource",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionSource\`: your project recorded a \`${String(e.companionSource)}\` daemon source. There is now one runner daemon - AgentRunner - which we publish and your users install from its own releases. Your project keeps the runner feature and its own pairing, dispatch and Runners page; it no longer holds or brands a daemon.`},{key:"companionName",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionName\`: your project recorded a branded daemon called ${e.companionName}. Buyers no longer brand or publish a daemon - your users install AgentRunner, which we maintain. Their existing install of your old daemon keeps running until they switch.`},{key:"companionRepoUrl",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionRepoUrl\`: your project pointed its install flow at ${e.companionRepoUrl}. It now points at AgentRunner, the one daemon we publish.`},{key:"companionLocalPath",severity:"warn",preserved:e=>(e.companionLocalPath??"").trim()==="",describe:e=>`Retired option \`companionLocalPath\`: your project recorded a local daemon checkout at ${e.companionLocalPath}. The option is gone, and so is the choice behind it - there is one runner daemon (AgentRunner) and we publish it, so nothing in your project is built from a local checkout any more.`},{key:"desktopAutoRelease",severity:"warn",applies:e=>e.desktop===!0,preserved:e=>e.desktopAutoRelease!==!0,describe:()=>"Retired option `desktopAutoRelease`: your project recorded automatic desktop releases, but the release trigger is no longer an option - cutting a release publishes signed installers from your repository and spends your Actions minutes, so it is always deliberate now. The staged `.github/workflows/desktop-release.yml` runs on `workflow_dispatch` only (the Actions tab). Add a `workflow_run` block to it if you want the CI-chained trigger back."},{key:"billingScope",severity:"ask",applies:e=>e.multiTenancy===!0,preserved:e=>e.billingScope!=="organization",describe:()=>"Retired option `billingScope`: your project recorded organization-scoped billing, and organization billing is GONE - not moved to config, removed. Money now lives only on a USER: an organization has no balance, no plan and no payment-provider customer of its own, and a workspace is funded by that organization's OWNER, whose personal balance every credit spent in it is drawn from. Payments already in flight are safe - a webhook arriving with old organization metadata is credited to that organization's owner rather than dropped - but a STORED balance is not: the `credits` and `plan` columns an organization holds them in are going away, and this update does NOT migrate them for you. MOVE every paying organization's credits and plan onto its owner BEFORE you take new checkouts, or that balance goes with the columns. How should this update proceed?"},{key:"socialProviders",severity:"warn",preserved:e=>(e.socialProviders??[]).length===0,describe:e=>`Retired option \`socialProviders\`: your project recorded ${(e.socialProviders??[]).join(", ")}, but it is now a plain config value that starts empty. Add those IDs back to \`config.auth.socialProviders\` in ${At} 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 ${At} 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 ${At}. 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===Rt(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${Wi(e.aiBuiltin)}, but it is now a plain config value generated ${Wi(Rt(e))} for a project ${Rt(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${At} 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 ${At} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>qi(e).join(",")===zi(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${qi(e).join(", ")||"no services"}, but the local Docker services are now DERIVED from your stack - postgres when you self-host Postgres, redis when you self-host Redis, mailpit on SMTP, inngest always - so an inconsistent selection is no longer possible. Your regenerated \`infra/docker-compose.yml\` will contain ${zi(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===Gr.length,describe:e=>`Retired option \`aiTools\`: your project recorded ${(e.aiTools??[]).join(", ")||"no AI tools"}, but the \`generatesaas-update\` skill bundle now ships to every AI-tool root (${$e.join(", ")}) so it is there whichever assistant you switch to. Delete the roots you do not use - they are plain text files with no runtime path.`}],df=Nr.map(e=>e.key);function Ji(e){for(let t of Nr)t.normalize?.(e)}function Xi(e){let t=[];for(let r of Nr){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 Qi(e){e.command("update").description("Update AI skill files and stage template updates").argument("[mode]","pass 'auto' to mark the staged update for unattended apply by your AI assistant").option("--cwd <path>","project directory (default: current directory)").action(async(t,r)=>{let n=t==="auto"?"auto":void 0,i=Zc(r.cwd??process.cwd()),o=ot(i,ve),s;try{s=JSON.parse(await Zi(o,"utf-8"))}catch{y.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}s.frontend===sr&&(y.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${sr}"\`).
|
|
1454
1454
|
|
|
1455
1455
|
v${or} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
|
|
@@ -1501,7 +1501,7 @@ ${k}`}).join(`
|
|
|
1501
1501
|
`]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
|
|
1502
1502
|
`],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function kl(){return $e.map(e=>Ve(e,Tr))}function Lr(e){return Qt(e)?(vl(e,{recursive:!0}),!0):!1}function El(e,t,r=[]){if(!Qt(e))return!1;let n=jr(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:(as(e,i,"utf-8"),!0)}function Sl(e){let t=Ve(e,".gitignore");if(!Qt(t))return!1;let r=jr(t,"utf-8"),n=r.split(`
|
|
1503
1503
|
`).filter(i=>!i.includes(".generatesaas")).join(`
|
|
1504
|
-
`);return n===r?!1:(as(t,n,"utf-8"),!0)}function cs(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ve(t,ve),n;try{n=JSON.parse(jr(r,"utf-8"))}catch{M.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await M.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(M.isCancel(i)&&(M.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),M.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{M.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of kl())Lr(Ve(t,a))&&o.push(a);for(let a of bl)Lr(Ve(t,a))&&o.push(a);Lr(Ve(t,H))&&o.push(H+"/");for(let a of wl){let p=Ve(t,a.file);El(p,a.removals,a.replacements)?s.push(a.file):Qt(p)&&M.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Sl(t)&&s.push(".gitignore");for(let a of o)M.log.info(`Deleted ${a}`);for(let a of s)M.log.info(`Modified ${a}`);M.log.success("Ejected successfully. This project is now fully standalone.")})}var Fe=new Rl().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.0.
|
|
1504
|
+
`);return n===r?!1:(as(t,n,"utf-8"),!0)}function cs(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Ve(t,ve),n;try{n=JSON.parse(jr(r,"utf-8"))}catch{M.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await M.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(M.isCancel(i)&&(M.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),M.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{M.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of kl())Lr(Ve(t,a))&&o.push(a);for(let a of bl)Lr(Ve(t,a))&&o.push(a);Lr(Ve(t,H))&&o.push(H+"/");for(let a of wl){let p=Ve(t,a.file);El(p,a.removals,a.replacements)?s.push(a.file):Qt(p)&&M.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Sl(t)&&s.push(".gitignore");for(let a of o)M.log.info(`Deleted ${a}`);for(let a of s)M.log.info(`Modified ${a}`);M.log.success("Ejected successfully. This project is now fully standalone.")})}var Fe=new Rl().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.0.2").addHelpText("after",`
|
|
1505
1505
|
Examples:
|
|
1506
1506
|
$ generatesaas init Interactive setup
|
|
1507
1507
|
$ generatesaas init -n my-app -y Quick setup with defaults
|