zerostarter 0.0.0-daca3ce → 0.0.0-e763493

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/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # zerostarter
2
+
3
+ Go from zero to a production-ready SaaS, rebranded and ready to ship.
4
+
5
+ `zerostarter` scaffolds [ZeroStarter](https://zerostarter.dev), a full-stack TypeScript starter (Next.js web, Hono API, Drizzle + Postgres, better-auth), into a fresh, rebranded project in one command. It fetches the latest starter, renames it to your directory, installs dependencies, and (when Docker is running) provisions a local Postgres and runs migrations.
6
+
7
+ <p align="center">
8
+ <img src="https://raw.githubusercontent.com/nrjdalal/zerostarter/canary/.github/assets/cli.gif" alt="bunx zerostarter init scaffolds a rebranded product from ZeroStarter" width="900" />
9
+ </p>
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ # In a new, empty directory (its name becomes your project name):
15
+ bunx zerostarter init
16
+
17
+ # Start the dev servers on named portless .localhost URLs (bunx portless list to see them)
18
+ bun run dev
19
+ ```
20
+
21
+ That is the whole setup. When Docker is running, `init` provisions a local Postgres and migrates for you; otherwise set `POSTGRES_URL` in `.env` (a hosted database like Neon works) and run `bun run db:migrate`.
22
+
23
+ ## Commands
24
+
25
+ ```bash
26
+ bunx zerostarter <command> [dir] [options]
27
+ ```
28
+
29
+ | Command | What it does |
30
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
31
+ | `init [dir]` | Scaffold ZeroStarter into `dir` (default `.`) as a fresh product. Fetches, rebrands to the dir name, installs, and optionally provisions Postgres. |
32
+ | `reinit [dir]` | Re-scaffold an existing git repo (default `.`) as a fresh ZeroStarter, keeping `.git` and your `.env*` files so history, remote, and secrets survive. |
33
+ | `sync [dir]` | Re-baseline an existing fork (default `.`) on the latest ZeroStarter, preserving your content, branding, `package.json` identity, and favicon. |
34
+
35
+ ### `init`
36
+
37
+ Scaffold a new product. Run it in an empty directory (its name becomes the project name), or pass a name: `bunx zerostarter init my-app`.
38
+
39
+ | Option | Description |
40
+ | -------------- | --------------------------------------------------------------------- |
41
+ | `-y`, `--yes` | Skip prompts, taking defaults (provisions Postgres when Docker is up) |
42
+ | `--db` | Provision a local Postgres (via pglaunch) and migrate; needs Docker |
43
+ | `--dry-run` | Print the plan without writing anything |
44
+ | `-h`, `--help` | Display help |
45
+
46
+ ### `reinit`
47
+
48
+ Re-scaffold an existing repo in place. Every file is deleted (except `.git` and `.env*`), the latest ZeroStarter is fetched, and it is rebranded to the directory name. The commit lands on the current branch; push when ready. Requires a clean tree.
49
+
50
+ | Option | Description |
51
+ | -------------- | ---------------------------- |
52
+ | `-y`, `--yes` | Skip the confirmation prompt |
53
+ | `-h`, `--help` | Display help |
54
+
55
+ ### `sync`
56
+
57
+ Re-baseline a fork on the latest ZeroStarter. A gitpick overlay updates the starter files while your content, `public/marketing`, branding, `package.json` identity, dev-URL names, and favicon are preserved. Requires a clean tree; lands as a reviewable diff you commit yourself.
58
+
59
+ Skills you own are preserved too: sync only rewrites a skill whose `source` is this repo. One you authored, one you vendored from a tool, one you took from another upstream, one you edited, or one whose sync note you removed keeps your version, and sync names it in the summary rather than replacing it.
60
+
61
+ ## Requirements
62
+
63
+ - **[Bun](https://bun.sh)** runs the scaffolded project. If it is missing, the CLI offers to install it for you.
64
+ - **Docker** (optional) lets `init` provision a local Postgres and migrate automatically. Without it, point `POSTGRES_URL` at any Postgres and run `bun run db:migrate`.
65
+
66
+ ## Links
67
+
68
+ - Docs: [zerostarter.dev/docs](https://zerostarter.dev/docs)
69
+ - Repository: [github.com/nrjdalal/zerostarter](https://github.com/nrjdalal/zerostarter)
70
+
71
+ ## License
72
+
73
+ MIT
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../convert-DMU8fiBc.mjs";import{basename as f,delimiter as p,join as m,resolve as h}from"node:path";import{existsSync as g,readdirSync as _}from"node:fs";import{createInterface as v}from"node:readline/promises";import{parseArgs as y}from"node:util";import{randomBytes as b}from"node:crypto";import{spawn as ee}from"node:child_process";import{access as te}from"node:fs/promises";import{homedir as ne}from"node:os";var re={name:`zerostarter`,version:`0.0.0-daca3ce`,description:`Go from zero to a production-ready SaaS, rebranded and ready to ship.`,keywords:[`cli`,`saas`,`scaffold`,`starter`,`template`,`zerostarter`],homepage:`https://github.com/nrjdalal/zerostarter#readme`,bugs:`https://github.com/nrjdalal/zerostarter/issues`,license:`MIT`,author:{name:`Neeraj Dalal`,email:`admin@nrjdalal.com`,url:`https://nrjdalal.com`},repository:`nrjdalal/zerostarter`,funding:`https://github.com/sponsors/nrjdalal`,bin:{zerostarter:`dist/bin/index.mjs`},files:[`dist`],type:`module`,types:`./dist/index.d.mts`,exports:`./dist/index.mjs`,scripts:{build:`tsdown`,"check-types":`tsc --noEmit`,dev:`tsdown --watch`,test:`bun test`},devDependencies:{"@packages/config":`workspace:*`,"@types/bun":`catalog:`,"@types/node":`catalog:`,tsdown:`catalog:`,typescript:`catalog:`}};const x=(e,t=process.stdout)=>n=>t.isTTY?`\x1b[${e}m${n}\x1b[0m`:n,S=x(`38;5;208`),ie=x(`38;2;63;185;80`),C=x(`38;2;210;153;34`),w=x(`38;2;56;189;248`),T=x(`38;2;110;118;129`),E=x(`2`),D=x(`38;2;248;81;73`,process.stderr),O={barStart:`┌`,bar:`│`,barEnd:`└`,active:`◆`,submit:`◇`,radioOn:`●`,radioOff:`○`,warn:`▲`,error:`■`},k=()=>!!(process.stdin.isTTY&&process.stdout.isTTY),ae=(e,t=e)=>process.stdout.isTTY?`\x1b]8;;${e}\x07${t}\x1b]8;;\x07`:e,A=e=>{process.stdout.write(`\n${T(O.barStart)} ${e}\n`)},j=e=>{process.stdout.write(`${T(O.bar)}\n${T(O.barEnd)} ${e}\n`)},M=(e,t=[])=>{process.stdout.write(`${T(O.bar)}\n${w(O.submit)} ${e}\n`);for(let e of t)process.stdout.write(`${T(O.bar)} ${e}\n`)},N=(e,t=[])=>{process.stdout.write(`${T(O.bar)}\n${C(O.warn)} ${C(e)}\n`);for(let e of t)process.stdout.write(`${T(O.bar)} ${C(e)}\n`)},oe=e=>{let t=e?`${ie(O.radioOn)} Yes`:E(`${O.radioOff} Yes`),n=e?E(`${O.radioOff} No`):`${ie(O.radioOn)} No`;return`${T(O.bar)} ${t} ${E(`/`)} ${n}`},P=async(e,t=!0)=>{let n=process.stdout;return k()?new Promise(r=>{let i=t,a=process.stdin;n.write(`${T(O.bar)}\n${w(O.active)} ${e}\n`),n.write(oe(i)),a.setRawMode(!0),a.resume(),a.setEncoding(`utf8`);let o=()=>{a.setRawMode(!1),a.pause(),a.removeListener(`data`,c)},s=()=>{o(),n.write(`\r\x1B[K`),n.write(`\x1B[1A\r\x1B[K`),n.write(`${w(O.submit)} ${e} ${E(i?`Yes`:`No`)}\n`),r(i)};function c(e){e===``?(o(),n.write(`
3
- `),process.exit(1)):e===`\r`||e===`
4
- `?s():e===`y`||e===`Y`?(i=!0,s()):e===`n`||e===`N`?(i=!1,s()):(e===`\x1B[C`||e===`\x1B[D`||e===`\x1B[A`||e===`\x1B[B`||e===`h`||e===`l`)&&(i=!i,n.write(`\r\x1b[K${oe(i)}`))}a.on(`data`,c)}):(n.write(`${T(O.bar)}\n${w(O.submit)} ${e} ${E(t?`Yes`:`No`)}\n`),t)},se=async(e,t=``)=>{process.stdout.write(`${T(O.bar)}\n${w(O.active)} ${e}${t?` ${E(`(${t})`)}`:``}\n`);let n=v({input:process.stdin,output:process.stdout});try{return(await n.question(`${T(O.bar)} `)).trim()||t}finally{n.close()}};var ce=class extends Error{constructor(...e){super(...e),this.name=`SubprocessError`,this.stdout=``,this.stderr=``}};const le=[`.exe`,`.com`],F=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),ue=e=>F(F(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),de=async(e,t,n)=>{if(le.some(t=>e.toLowerCase().endsWith(t)))return!0;let r=(n.PATH||n.Path||``).split(p).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{return await Promise.any([t,...r].flatMap(t=>le.map(n=>te(`${h(t,e)}${n}`)))),!0}catch{return!1}},fe=async(e,t,n,r=process.platform===`win32`)=>{let i=n.cwd?String(n.cwd):`.`,a=n.env||process.env;return r&&!n.shell&&!await de(e,i,a)?[F(e),t.map(ue),{...n,shell:!0}]:[e,t,n]},I=async(e,t,n,r)=>{let i=[e,...t].join(` `),[a,o,s]=await fe(e,t,n);s.shell&&o.length>0&&(a=[a,...o].join(` `),o=[]);let c=ee(a,o,s),l=``,u=``;return new Promise((e,t)=>{let n=(e,n,r)=>{let i=new ce(e,r?{cause:r}:void 0);i.stdout=l,i.stderr=u,i.exitCode=n,t(i)},a=e=>{e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&e.code!==`EPIPE`&&n(`Command failed: ${i}`,void 0,e)};c.stdout&&(c.stdout.setEncoding(`utf8`),c.stdout.on(`data`,e=>{l+=e,r?.(e)}),c.stdout.on(`error`,a)),c.stderr&&(c.stderr.setEncoding(`utf8`),c.stderr.on(`data`,e=>{u+=e,r?.(e)}),c.stderr.on(`error`,a)),c.on(`error`,e=>n(`Command failed: ${i}`,void 0,e)),c.on(`close`,(t,r)=>{if(r)return n(`Command was terminated with ${r}: ${i}`);if(t!==0)return n(`Command failed with exit code ${t}: ${i}`,t??void 0);e({stdout:l,stderr:u})})})},L=async(e,t,n)=>{let{stdout:r}=await I(e,t,{cwd:n,stdio:[`ignore`,`pipe`,`pipe`]});return r},R=async(e,t,n)=>{await I(e,t,{cwd:n,stdio:`inherit`})},z=async(e,t)=>{try{return await I(e,t,{stdio:`ignore`}),!0}catch{return!1}},pe=RegExp(`\x1B\\[[0-9;?]*[a-zA-Z]`,`g`),me=e=>e.replace(pe,``),B=e=>e>=1e3?`[${(e/1e3).toFixed(2)}s]`:`[${e.toFixed(2)}ms]`,V=async(e,t,n)=>{let r=Date.now(),i=process.stdout;if(!i.isTTY){i.write(`${T(O.bar)}\n${w(O.active)} ${n.label}\n`),await R(e,t,n.cwd);return}let a=n.lines??3,o=[],s=0,c=``,l=``,u=()=>(i.columns||80)-1,d=e=>{i.write(e?`\x1B[?7h`:`\x1B[?7l`)},f=()=>{s>0&&(i.write(`[${s}A`),s=0)},p=()=>{f();let e=o.slice(-a);for(let t of e)i.write(`${T(O.bar)} ${E(t.slice(0,Math.max(0,u()-3)))}\n`);s=e.length},m=e=>{l+=e,c+=e;let t=c.split(`
5
- `);c=t.pop()??``;for(let e of t)o.push(me(e).replace(/\r/g,``).replace(/\t/g,` `).trimEnd()),p()};i.write(`${T(O.bar)}\n${w(O.active)} ${n.label}\n`),d(!1);try{await I(e,t,{cwd:n.cwd,stdio:[`ignore`,`pipe`,`pipe`]},m)}catch(e){throw f(),d(!0),i.write(l),e}f(),d(!0);let h=n.summarize(l,Date.now()-r).trim();i.write(`\r${w(O.submit)} ${h||n.label}\n`)},H=`pglaunch@5.5.7`,he=async()=>z(`docker`,[`info`]),U=e=>{let r=m(e,`.env`);if(!s(r)){let i=m(e,`.env.example`);n(r,s(i)?t(i):``)}return r},W=(e,n)=>{let r=`${n}=`,i=t(e).split(`
6
- `).find(e=>e.startsWith(r));return i?i.slice(r.length).trim():``},G=(e,r,i)=>{let a=`${r}=`,o=t(e).split(`
7
- `),s=o.findIndex(e=>e.startsWith(a));if(s>=0)o[s]=`${a}${i}`;else{for(;o.length&&o[o.length-1]===``;)o.pop();o.push(`${a}${i}`,``)}n(e,o.join(`
8
- `))},ge=e=>{let t=U(e);W(t,`BETTER_AUTH_SECRET`)||G(t,`BETTER_AUTH_SECRET`,b(32).toString(`base64`))},K=e=>{let t=m(e,`.env`);return s(t)&&W(t,`POSTGRES_URL`)!==``},_e=e=>{let t=e.match(/postgres(?:ql)?:\/\/[\w.:@\-/%?=&]+/);if(!t)return null;let n=e.match(/name "([^" ]+) :\d+" started/),r=e.match(/similar name "([^"]+)"/);return{url:t[0],container:n?n[1]:r?r[1]:``}},ve=async(e,t)=>{let n=t?[`--bun`,H,`-k`,`-c`]:[`--bun`,H,`-k`],r;try{r=await L(`bunx`,n,e)}catch(e){let t=e;r=[t.stdout,t.stderr].filter(Boolean).join(`
9
- `)}return _e(r)},ye=e=>new Promise(t=>setTimeout(t,e)),be=async e=>{if(e)for(let t=0;t<30;t++){if(await z(`docker`,[`exec`,e,`pg_isready`,`-U`,`postgres`]))return;await ye(1e3)}},xe=async e=>{let t=U(e),n=await ve(e,!1)||await ve(e,!0);if(!n)throw Error(`pglaunch did not print a connection URL`);G(t,`POSTGRES_URL`,n.url),await be(n.container);let r=Se(e);await V(`bun`,[`run`,`db:migrate`],{cwd:e,label:`Provisioning a local Postgres`,summarize:(e,t)=>e.includes(`migrations applied successfully`)?`${r} migration${r===1?``:`s`} applied ${B(t)}`:`Database migrated ${B(t)}`})},Se=e=>{try{return _(m(e,`packages/db/drizzle`)).filter(e=>e.endsWith(`.sql`)).length}catch{return 0}},q=async e=>{await V(`bun`,[`install`],{cwd:e,label:`Installing dependencies`,summarize:e=>(e.match(/[\d,]+ packages installed[^\n]*/g)??e.match(/Checked [^\n]*install[^\n]*/g))?.at(-1)?.trim()??`Dependencies installed`})},Ce=async()=>{if(!await z(`bun`,[`--version`]))throw Error(`bun is not on PATH`)},we=async(e=Ce,t=!!process.versions.bun,n=process.env.npm_config_user_agent||``)=>{if(t||n.startsWith(`bun/`))return!0;try{return await e(),!0}catch{return!1}},Te=async(e,t=`main`)=>{await L(`bunx`,[`--bun`,`gitpick@6.0.0`,`https://github.com/nrjdalal/zerostarter/tree/${t}`,e])},Ee=async(e,t=`main`)=>{await L(`bunx`,[`--bun`,`gitpick@6.0.0`,`https://github.com/nrjdalal/zerostarter/tree/${t}`,e,`-o`])},De=async(e=`main`)=>{let t=`https://raw.githubusercontent.com/nrjdalal/zerostarter/${e}/.gitpickignore`,n=await fetch(t);if(!n.ok)throw Error(`Could not fetch .gitpickignore from ${e} (HTTP ${n.status}).`);return n.text()},Oe=async e=>(await L(`git`,[`status`,`--porcelain`],e)).trim()===``,ke=async(e,t)=>{for(let n of t)try{await L(`git`,[`checkout`,`--`,n],e),await L(`git`,[`clean`,`-fd`,`--`,n],e)}catch{}},Ae=async e=>{await L(`git`,[`reset`,`--hard`,`HEAD`],e),await L(`git`,[`clean`,`-fd`],e)},je=async(e,t,n)=>{if(!s(m(e,`.git`)))throw Error(t);if(!await Oe(e))throw Error(n)},Me=async(e,t,n)=>{try{await n()}catch(n){throw await Ae(e),console.log(t),n}},Ne=async e=>{await L(`git`,[`init`,`-q`,`-b`,`canary`],e)},Pe=async(e,t)=>{await L(`git`,[`branch`,t],e)},J=async(e,t)=>{await L(`git`,[`add`,`-A`],e);try{await L(`git`,[`commit`,`--no-verify`,`-q`,`-m`,t],e)}catch{}},Fe=(e=process.env.npm_config_user_agent||``)=>e.startsWith(`bun/`)?`bunx`:e.startsWith(`pnpm/`)?`pnpm dlx`:e.startsWith(`yarn/`)?`yarn dlx`:e.startsWith(`npm/`)?`npx`:`unknown`,Ie=(e=process.platform)=>e===`win32`?{cmd:`powershell`,args:[`-Command`,`irm bun.sh/install.ps1 | iex`]}:{cmd:`bash`,args:[`-c`,`curl -fsSL https://bun.sh/install | bash`]},Le=(e=process.argv.slice(2))=>[`zerostarter`,...e].join(` `),Re=()=>m(process.env.BUN_INSTALL||m(ne(),`.bun`),`bin`),Y=async(e=!1)=>{if(await we())return;let t=Fe(),n=`bunx --bun ${Le()}`;if(console.error(D(`Seems like you are using ${t===`unknown`?`npx/pnpx`:t} or Windows, try using:`)),console.error(S(` ${n}`)),console.error(``),e||k()&&await P(`Or install bun now and continue?`,!0)){let{cmd:e,args:t}=Ie();console.error(`Installing bun from https://bun.sh/install ...`);try{if(await R(e,t),process.env.PATH=`${Re()}${p}${process.env.PATH||``}`,await we())return;console.error(D(`
10
- bun is installed but isn't on this shell's PATH yet. Open a new terminal and re-run:`)),console.error(S(` ${n}`))}catch{console.error(D(`
11
- Could not install bun. Install it from https://bun.sh, then re-run:`)),console.error(S(` ${n}`))}}process.exit(1)},ze=e=>!g(e)||_(e).filter(e=>e!==`.git`).length===0,X=e=>s(m(e,`packages/config/src/site.ts`)),Be=async e=>{let{positionals:t,values:n}=y({allowPositionals:!0,args:e,options:{db:{type:`boolean`},"dry-run":{type:`boolean`},help:{short:`h`,type:`boolean`},yes:{short:`y`,type:`boolean`}}});if(n.help){console.log(`Usage:
2
+ import{A as e,C as t,D as n,E as r,M as i,N as a,O as o,P as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,g,h as _,i as ee,j as v,k as y,l as b,m as te,n as x,o as S,p as C,r as ne,s as re,t as ie,u as ae,v as w,w as T,x as E,y as D}from"../convert-Cq2vrNh-.mjs";import{basename as oe,delimiter as se,dirname as ce,join as O,parse as le,resolve as k}from"node:path";import{existsSync as A,readFileSync as ue,readdirSync as de}from"node:fs";import{randomBytes as fe}from"node:crypto";import{createInterface as pe}from"node:readline/promises";import{parseArgs as me}from"node:util";import{homedir as he}from"node:os";var ge={name:`zerostarter`,version:`0.0.0-e763493`,description:`Go from zero to a production-ready SaaS, rebranded and ready to ship.`,keywords:[`cli`,`saas`,`scaffold`,`starter`,`template`,`zerostarter`],homepage:`https://github.com/nrjdalal/zerostarter#readme`,bugs:`https://github.com/nrjdalal/zerostarter/issues`,license:`MIT`,author:{name:`Neeraj Dalal`,email:`admin@nrjdalal.com`,url:`https://nrjdalal.com`},repository:`nrjdalal/zerostarter`,funding:`https://github.com/sponsors/nrjdalal`,bin:{zerostarter:`dist/bin/index.mjs`},files:[`dist`],type:`module`,types:`./dist/index.d.mts`,exports:`./dist/index.mjs`,scripts:{build:`tsdown`,"check-types":`tsc --noEmit`,dev:`tsdown --watch`},devDependencies:{"@packages/config":`workspace:*`,"@types/bun":`catalog:`,"@types/node":`catalog:`,tsdown:`catalog:`,typescript:`catalog:`}};const j=()=>!!(process.stdin.isTTY&&process.stdout.isTTY),M=(e,t=e)=>process.stdout.isTTY?`\x1b]8;;${e}\x07${t}\x1b]8;;\x07`:e,N=e=>M(e,u(e)),P=e=>{process.stdout.write(`\n ${D(g.barStart)} ${e}\n ${D(g.bar)}\n`)},F=e=>{process.stdout.write(` ${D(g.bar)}\n ${D(g.barEnd)} ${e}\n`)},I=(e=`Cancelled`)=>{process.stdout.write(` ${D(g.barEnd)} ${t(e)}\n`)},L=e=>e.replace(RegExp(`\x1B\\[[0-9;?]*[a-zA-Z]`,`g`),``).replace(RegExp(`\x1B\\]8;;.*?\\x07`,`g`),``).length,R=(e,t=``,n=!1)=>{let r=`\n${e}\n`.split(`
3
+ `),i=L(t),a=r.reduce((e,t)=>Math.max(e,L(t)),i),o=Math.max(a,54)+2,s=r.map(e=>` ${D(g.bar)} ${e}${` `.repeat(o-L(e))}${D(g.bar)}`).join(`
4
+ `),c=n?g.cornerBL:g.connectL;process.stdout.write(` ${u(g.active)} ${t} ${D(g.barH.repeat(Math.max(o-i-1,1))+g.cornerTR)}\n${s}\n ${D(c+g.barH.repeat(o+2)+g.cornerBR)}\n`)},z=(e,t=[])=>{process.stdout.write(` ${u(g.active)} ${e}\n`);for(let e of t)process.stdout.write(` ${D(g.bar)} ${e}\n`)},_e=e=>{process.stdout.write(` ${f(g.active)} ${f(e)}\n`)},B=(e,t=[])=>{process.stdout.write(` ${T(g.warn)} ${T(e)}\n`);for(let e of t)process.stdout.write(` ${D(g.bar)} ${T(e)}\n`)},ve=async(e,t,n)=>{let r=process.stdout,i=null;if(r.isTTY){let t=0;r.write(` ${c(0,e)}`),i=setInterval(()=>{t+=1,r.write(`\r\x1b[K ${c(t,e)}`)},400)}try{let e=await n();return i&&clearInterval(i),r.write(r.isTTY?`\r\x1b[K ${u(g.active)} ${t}\n`:` ${u(g.active)} ${t}\n`),e}catch(e){throw i&&clearInterval(i),r.isTTY&&r.write(`\r\x1B[K`),e}},ye=e=>{let t=e?`${f(g.radioOn)} Yes`:w(`${g.radioOff} Yes`),n=e?w(`${g.radioOff} No`):`${f(g.radioOn)} No`;return` ${D(g.bar)} ${t} ${w(`/`)} ${n}`},V=async(e,t=!0)=>{let n=process.stdout;return j()?new Promise(r=>{let i=t,a=process.stdin,o=Math.max(1,Math.ceil((5+L(e))/(n.columns||80)));n.write(` ${u(g.submit)} ${e}\n`),n.write(ye(i)),a.setRawMode(!0),a.resume(),a.setEncoding(`utf8`);let s=()=>{a.setRawMode(!1),a.pause(),a.removeListener(`data`,d)},c=()=>{n.write(`\r\x1b[K\x1b[${o}A\r\x1b[0J`)},l=()=>{s(),c(),r(i)};function d(t){t===``?(s(),c(),n.write(` ${u(g.submit)} ${w(e)}\n`),I(),process.exit(130)):t===`\r`||t===`
5
+ `?l():t===`y`||t===`Y`?(i=!0,l()):t===`n`||t===`N`?(i=!1,l()):(t===`\x1B[C`||t===`\x1B[D`||t===`\x1B[A`||t===`\x1B[B`||t===`h`||t===`l`)&&(i=!i,n.write(`\r\x1b[K${ye(i)}`))}a.on(`data`,d)}):(n.write(` ${u(g.active)} ${e} ${w(t?`Yes`:`No`)}\n`),t)},be=async(e,t)=>{if(t.length===0)return[];let n=process.stdout,r=new Set(t.filter(e=>e.checked).map(e=>e.value)),i=()=>t.filter(e=>r.has(e.value)).map(e=>e.label).join(`, `)||`none`;return j()?new Promise(a=>{let o=process.stdin,s=0,c=e=>{let n=t[e],i=r.has(n.value)?f(g.checkboxOn):w(g.checkboxOff),a=e===s?n.label:w(n.label);return` ${D(g.bar)} ${i} ${a}`},l=e=>{e||n.write(`\x1b[${t.length}A`);for(let e=0;e<t.length;e++)n.write(`\r\x1b[K${c(e)}\n`)};n.write(` ${u(g.submit)} ${e}\n`),l(!0),o.setRawMode(!0),o.resume(),o.setEncoding(`utf8`);let d=()=>{o.setRawMode(!1),o.pause(),o.removeListener(`data`,p)};function p(o){if(o===``)d(),n.write(`\x1b[${t.length+1}A\r\x1b[0J ${u(g.submit)} ${w(e)}\n`),I(),process.exit(130);else if(o===`\r`||o===`
6
+ `)d(),n.write(`\x1b[${t.length+1}A\r\x1b[0J ${u(g.submit)} ${e} ${w(i())}\n`),a([...r]);else if(o===`\x1B[A`||o===`k`)s=(s-1+t.length)%t.length,l(!1);else if(o===`\x1B[B`||o===`j`)s=(s+1)%t.length,l(!1);else if(o===` `){let e=t[s].value;r.has(e)?r.delete(e):r.add(e),l(!1)}}o.on(`data`,p)}):(n.write(` ${u(g.submit)} ${e} ${w(i())}\n`),[...r])},xe=async(e,t=``)=>{process.stdout.write(` ${u(g.submit)} ${e}${t?` ${w(`(${t})`)}`:``}\n`);let n=pe({input:process.stdin,output:process.stdout});try{return(await n.question(` ${D(g.bar)} `)).trim()||t}finally{n.close()}},Se=`pglaunch@5.5.7`,Ce=async()=>m(`docker`,[`info`]),we=e=>{let t=O(e,`.env`);if(!n(t)){let r=O(e,`.env.example`);i(t,n(r)?y(r):``)}return t},H=(e,t)=>{let n=`${t}=`,r=y(e).split(`
7
+ `).find(e=>e.startsWith(n));return r?r.slice(n.length).trim():``},U=(e,t,n)=>{let r=`${t}=`,a=y(e).split(`
8
+ `),o=a.findIndex(e=>e.startsWith(r));if(o>=0)a[o]=`${r}${n}`;else{for(;a.length&&a[a.length-1]===``;)a.pop();a.push(`${r}${n}`,``)}i(e,a.join(`
9
+ `))},Te=e=>{let t=we(e);H(t,`BETTER_AUTH_SECRET`)||U(t,`BETTER_AUTH_SECRET`,fe(32).toString(`base64`)),H(t,`AGENT_SIGNIN_ENABLED`)||U(t,`AGENT_SIGNIN_ENABLED`,`true`)},W=e=>{let t=O(e,`.env`);return n(t)&&H(t,`POSTGRES_URL`)!==``},Ee=e=>{let t=e.match(/postgres(?:ql)?:\/\/[\w.:@\-/%?=&]+/);if(!t)return null;let n=e.match(/name "([^" ]+) :\d+" started/),r=e.match(/similar name "([^"]+)"/);return{url:t[0],container:n?n[1]:r?r[1]:``}},De=async(e,t)=>{let n=t?[`--bun`,Se,`-k`,`-c`]:[`--bun`,Se,`-k`],r;try{r=await C(`bunx`,n,e)}catch(e){let t=e;r=[t.stdout,t.stderr].filter(Boolean).join(`
10
+ `)}return{launch:Ee(r),out:r}},Oe=e=>new Promise(t=>setTimeout(t,e)),ke=async e=>{if(e)for(let t=0;t<30;t++){if(await m(`docker`,[`exec`,e,`pg_isready`,`-U`,`postgres`]))return;await Oe(1e3)}},Ae=async e=>{let t=we(e),n=await De(e,!1),r=n.launch?n:await De(e,!0);if(!r.launch)throw Error(r.out.trim()||`pglaunch did not print a connection URL`);U(t,`POSTGRES_URL`,r.launch.url),await ke(r.launch.container),await _(`bun`,[`run`,`db:migrate`],{cwd:e,label:`Provisioning a local Postgres database`,done:`Provisioned a local Postgres database`})},G=async e=>{await _(`bun`,[`install`],{cwd:e,label:`Installing dependencies`,done:`Installed dependencies`})},je=async()=>{if(!await m(`bun`,[`--version`]))throw Error(`bun is not on PATH`)},Me=async(e=je,t=!!process.versions.bun,n=process.env.npm_config_user_agent||``)=>{if(t||n.startsWith(`bun/`))return!0;try{return await e(),!0}catch{return!1}},Ne=async(e,t=`main`)=>{await C(`bunx`,[`--bun`,`gitpick@6.0.0`,`https://github.com/nrjdalal/zerostarter/tree/${t}`,e])},Pe=async(e,t=`main`)=>{await C(`bunx`,[`--bun`,`gitpick@6.0.0`,`https://github.com/nrjdalal/zerostarter/tree/${t}`,e,`-o`])},Fe=async(e=`main`)=>{let t=`https://raw.githubusercontent.com/nrjdalal/zerostarter/${e}/.gitpickignore`,n=await fetch(t);if(!n.ok)throw Error(`Could not fetch .gitpickignore from ${e} (HTTP ${n.status}).`);return n.text()},Ie=async e=>(await C(`git`,[`status`,`--porcelain`],e)).trim()===``,Le=async(e,t)=>{for(let n of t)try{await C(`git`,[`checkout`,`--`,n],e),await C(`git`,[`clean`,`-fd`,`--`,n],e)}catch{}},Re=async e=>{await C(`git`,[`reset`,`--hard`,`HEAD`],e),await C(`git`,[`clean`,`-fd`],e)},ze=async(e,t,r)=>{if(!n(O(e,`.git`)))throw Error(t);if(!await Ie(e))throw Error(r)},Be=async(e,t,n)=>{try{await n()}catch(n){throw await Re(e),console.log(t),n}},Ve=async e=>{await C(`git`,[`init`,`-q`,`-b`,`canary`],e)},He=async(e,t)=>{await C(`git`,[`branch`,t],e)},K=async(e,t)=>{await C(`git`,[`add`,`-A`],e);try{await C(`git`,[`commit`,`--no-verify`,`-q`,`-m`,t],e)}catch{}},q=(e,n)=>{try{return me(n)}catch(n){process.stderr.write(`${t(n instanceof Error?n.message:String(n))}\n\n`),process.stdout.write(`${e}\n`),process.exit(1)}},Ue=(e=process.env.npm_config_user_agent||``)=>e.startsWith(`bun/`)?`bunx`:e.startsWith(`pnpm/`)?`pnpm dlx`:e.startsWith(`yarn/`)?`yarn dlx`:e.startsWith(`npm/`)?`npx`:`unknown`,We=(e=process.platform)=>e===`win32`?{cmd:`powershell`,args:[`-Command`,`irm bun.sh/install.ps1 | iex`]}:{cmd:`bash`,args:[`-c`,`curl -fsSL https://bun.sh/install | bash`]},Ge=(e=process.argv.slice(2))=>[`zerostarter`,...e].join(` `),Ke=()=>O(process.env.BUN_INSTALL||O(he(),`.bun`),`bin`),J=async(e=!1)=>{if(await Me())return;let n=Ue(),r=`bunx --bun ${Ge()}`;if(console.error(t(`Seems like you are using ${n===`unknown`?`npx/pnpx`:n} or Windows, try using:`)),console.error(E(` ${r}`)),console.error(``),e||j()&&await V(`Or install bun now and continue?`,!0)){let{cmd:e,args:n}=We();console.error(`Installing bun from https://bun.sh/install ...`);try{if(await te(e,n),process.env.PATH=`${Ke()}${se}${process.env.PATH||``}`,await Me())return;console.error(t(`
11
+ bun is installed but isn't on this shell's PATH yet. Open a new terminal and re-run:`)),console.error(E(` ${r}`))}catch{console.error(t(`
12
+ Could not install bun. Install it from https://bun.sh, then re-run:`)),console.error(E(` ${r}`))}}process.exit(1)},Y=[{value:`allowlist`,flag:`allowlist`,label:`Allowlist (grant console access by domain)`},{value:`apiDocs`,flag:`api-docs`,label:`API docs`},{value:`blog`,flag:`blog`,label:`Blog`},{value:`docs`,flag:`docs`,label:`Docs`},{value:`internalDocs`,flag:`internal-docs`,label:`Internal (console) docs`},{value:`waitlist`,flag:`waitlist`,label:`Waitlist (else a plain landing home)`}],qe=`Usage:
12
13
  $ bunx zerostarter init [dir] [options]
13
14
 
14
15
  Scaffold ZeroStarter into dir (default .) as a fresh product. The author's
@@ -19,12 +20,20 @@ latest ZeroStarter is fetched into it first.
19
20
 
20
21
  Options:
21
22
  -y, --yes Skip prompts, taking defaults (provisions Postgres when Docker is running)
23
+ --canary Scaffold from the canary branch instead of main (for testing)
22
24
  --db Provision a local Postgres (pglaunch) and migrate; needs Docker
23
25
  --dry-run Print the plan without writing anything
24
- -h, --help Display help`);return}n[`dry-run`]||await Y(!!n.yes);let r=k()&&!n.yes,i=t[0]??`.`,a=h(i),o=X(a);if(!o&&!ze(a)){if(!r)throw Error(`Directory is not empty. Run it in an empty directory, or pass a project name: bunx zerostarter init <name>`);let e=await se(`Directory isn't empty. Project name`);if(!e)throw Error(`No directory name provided.`);i=e}let c=h(i),l=f(c),d={name:l};if(n[`dry-run`]){console.log(`bunx zerostarter init (dry run)`),console.log(` target: ${c}`),console.log(` name: ${l}`),console.log(` mode: ${X(c)?`in place`:`fetch first`}`);return}if(A(w(`ZeroStarter`)),o&&r&&!await P(C(`Convert ${c} in place? This rewrites files and commits.`),!1)){j(`Aborted`);return}X(c)||(await Te(c),M(`Fetched the latest ZeroStarter`)),s(m(c,`.git`))||(await Ne(c),await J(c,`ci(init): scaffold from zerostarter`),await Pe(c,`main`)),u(c,d),M(`Rebranded to ${l}`),await q(c),await J(c,`ci(init): re-baseline as ${l}`),ge(c);let p=!1,g=await he(),_=K(c),v=!1;if(_?n.db&&N(`--db ignored: POSTGRES_URL is already set in .env.`):v=n.db?!0:r?await P(`Provision a local Postgres database now?`,g):g,v&&g)try{await xe(c),p=!0}catch(e){let t=e.stderr,n=t?String(t).trim():e instanceof Error?e.message:String(e);K(c)?N(`Postgres is provisioned, but the migration failed; run bun run db:migrate.`,n?[n]:[]):N(`Database setup failed; set POSTGRES_URL in .env yourself.`,n?[n]:[])}else v&&N(`Docker isn't running, so the database wasn't provisioned. Set POSTGRES_URL in .env, or start Docker and re-run for automatic setup.`);let b=[[`packages/config/src/site.ts`,`your brand: name, tagline, links`],[`web/next/content`,`your docs and blog`]];j(w(`${l} is ready`)),console.log(),console.log(`Next steps:`),c!==process.cwd()&&console.log(` ${S(`cd ${i}`)}`),K(c)||console.log(` ${S(`set POSTGRES_URL in .env`)} # your Postgres connection string`),p||console.log(` ${S(`bun run db:migrate`)}`),console.log(` ${S(`bun run dev`)}`),console.log(`
25
- Push to an empty GitHub repo when ready:`),console.log(` ${S(`git push origin canary`)}`),console.log(`
26
- Make it yours:`);for(let[e,t]of b)console.log(` ${e.padEnd(29)} ${t}`);p||console.log(`
27
- It needs a Postgres database to run: a hosted one like Neon works, or a local Docker one (re-run with Docker running to auto-provision). OAuth and other credentials are optional.`)},Ve=async t=>{let{positionals:n,values:r}=y({allowPositionals:!0,args:t,options:{help:{short:`h`,type:`boolean`},yes:{short:`y`,type:`boolean`}}});if(r.help){console.log(`Usage:
26
+ -h, --help Display help
27
+
28
+ Features (default on, except the waitlist; pass any flag to skip the interactive picker):
29
+ --api-docs, --no-api-docs The /api/docs API reference
30
+ --blog, --no-blog The /blog
31
+ --docs, --no-docs The /docs
32
+ --internal-docs, --no-internal-docs The /console/docs internal docs
33
+ --waitlist, --no-waitlist The /waitlist (off leaves a plain landing home)`,Je=e=>!A(e)||de(e).filter(e=>e!==`.git`).length===0,X=e=>n(O(e,`packages/config/src/site.ts`)),Ye=e=>{let t=e,{root:n}=le(t);for(;;){if(A(O(t,`bun.lock`))||A(O(t,`bun.lockb`)))return t;let e=O(t,`package.json`);if(A(e))try{if(JSON.parse(ue(e,`utf8`)).workspaces)return t}catch{}if(t===n)return null;t=ce(t)}},Xe=async e=>{let{positionals:t,values:r}=q(qe,{allowPositionals:!0,args:e,options:{canary:{type:`boolean`},db:{type:`boolean`},"dry-run":{type:`boolean`},help:{short:`h`,type:`boolean`},yes:{short:`y`,type:`boolean`},"api-docs":{type:`boolean`},"no-api-docs":{type:`boolean`},blog:{type:`boolean`},"no-blog":{type:`boolean`},docs:{type:`boolean`},"no-docs":{type:`boolean`},"internal-docs":{type:`boolean`},"no-internal-docs":{type:`boolean`},waitlist:{type:`boolean`},"no-waitlist":{type:`boolean`}}});if(r.help){console.log(qe);return}r[`dry-run`]||await J(!!r.yes);let i=j()&&!r.yes,a=r.canary?`canary`:`main`,o=r,s=Y.some(e=>o[e.flag]||o[`no-${e.flag}`]),c={...d};for(let e of Y)c[e.value]=o[`no-${e.flag}`]?!1:o[e.flag]?!0:d[e.value];let l=t[0]??`.`,u=k(l),f=X(u),p=!f&&!Je(u);if(!f&&!r[`dry-run`]){let e=Ye(p?process.cwd():ce(u));if(e)throw Error(`Cannot scaffold inside an existing project (a workspace was found at ${e}). Run it in a fresh directory outside that project.`)}if(r[`dry-run`]||P(N(`https://zerostarter.dev`)),p){if(!i)throw Error(`Directory is not empty. Run it in an empty directory, or pass a project name: bunx zerostarter init <name>`);let e=await xe(`What should we name your project?`);if(!e)throw Error(`No directory name provided.`);l=e}let m=k(l),h=oe(m),g={name:h},_=`--canary ignored: converting the existing checkout in place, so nothing is fetched.`,ee=e=>Y.filter(t=>e[t.value]).map(e=>e.value).join(`, `)||`none`;if(r[`dry-run`]){console.log(`bunx zerostarter init (dry run)`),console.log(` target: ${m}`),console.log(` name: ${h}`),console.log(` mode: ${X(m)?`in place`:`fetch ${a}`}`),console.log(` features: ${ee(c)}`),X(m)&&r.canary&&console.log(` note: ${_}`);return}if(f&&i&&!await V(`Convert ${h} in place? This rewrites files and commits.`,!1)){I(`Aborted`);return}if(i&&!s){let e=new Set(await be(`Which optional surfaces should this fork ship with?`,Y.map(e=>({value:e.value,label:e.label,checked:d[e.value]}))));for(let t of Y)c[t.value]=e.has(t.value)}if(X(m))r.canary&&B(_);else{let e=r.canary?` (canary)`:``;await ve(`Fetching the latest ZeroStarter${e}`,`Fetched the latest ZeroStarter${e}`,()=>Ne(m,a))}n(O(m,`.git`))||(await Ve(m),await K(m,`ci(init): scaffold from zerostarter`),await He(m,`main`)),await ve(`Rebranding to ${h}`,`Rebranded to ${h}`,()=>ie(m,g,c)),await G(m),await b(m),await K(m,`ci(init): re-baseline as ${h}`),Te(m);let v=!1,y=await Ce(),te=W(m),x=!1;if(te?r.db&&B(`--db ignored: POSTGRES_URL is already set in .env.`):x=r.db?!0:i?await V(`Provision a local Postgres database?`,y):y,x&&y)try{await Ae(m),v=!0}catch(e){if(W(m))B(`Postgres is provisioned, but the migration failed; run bun run db:migrate.`);else{let t=e instanceof Error?e.message.trim():String(e);B(`Database setup failed; set POSTGRES_URL in .env yourself.`,t?t.split(`
34
+ `).filter(e=>e.trim()).slice(-5):[])}}else x&&B(`Docker isn't running, so the database wasn't provisioned. Set POSTGRES_URL in .env, or start Docker and re-run for automatic setup.`);R([`${E(`packages/config/src/site.ts`)} and ${E(`web/next/content`)}`,`to manage branding and blogs & docs respectively`].join(`
35
+ `),`Edit and make it yours`),_e(`${h} is ready`);let S=[];m!==process.cwd()&&S.push(E(`cd ${l}`)),W(m)||S.push(`set POSTGRES_URL in .env`),v||S.push(E(`bun run db:migrate`)),S.push(E(`bun run dev`)),R(S.join(`
36
+ `),`Next steps`),F(`Learn more ${N(`https://zerostarter.dev/docs`)}`)},Ze=`Usage:
28
37
  $ bunx zerostarter reinit [dir] [options]
29
38
 
30
39
  Re-scaffold an existing git repo (default .) as a fresh ZeroStarter: delete every
@@ -34,7 +43,8 @@ branch; push when ready.
34
43
 
35
44
  Options:
36
45
  -y, --yes Skip the confirmation prompt
37
- -h, --help Display help`);return}await Y(!!r.yes);let i=h(n[0]??`.`),a=f(i),o=k()&&!r.yes;if(await je(i,`No git repository in ${i}. reinit re-scaffolds an existing repo; use init for a new project.`,`Working tree has uncommitted changes. Commit or stash them first; reinit deletes every tracked file.`),A(w(`ZeroStarter`)),o&&!await P(`Delete every file in ${i} (keeping .git and .env*) and re-scaffold as ${a}?`,!1)){j(`Aborted`);return}await Me(i,C(`reinit failed; restored your committed files (deleted gitignored files, except .env*, are gone).`),async()=>{e(i),await Ee(i),M(`Fetched the latest ZeroStarter (kept .git and .env*)`),u(i,{name:a}),M(`Rebranded to ${a}`),await q(i),ge(i),await J(i,`ci(reinit): re-baseline as ${a}`)}),j(w(`${a} re-scaffolded; .git history, remote, and .env* files are intact`)),console.log(),console.log(`Next steps:`),K(i)||console.log(` ${S(`set POSTGRES_URL in .env`)} # your Postgres connection string`),console.log(` ${S(`bun run db:migrate`)}`),console.log(` ${S(`bun run dev`)}`),console.log(` ${S(`git push`)} # to your existing remote`)},He=async e=>{let{positionals:t,values:n}=y({allowPositionals:!0,args:e,options:{help:{short:`h`,type:`boolean`}}});if(n.help){console.log(`Usage:
46
+ -h, --help Display help`,Qe=async e=>{let{positionals:t,values:n}=q(Ze,{allowPositionals:!0,args:e,options:{help:{short:`h`,type:`boolean`},yes:{short:`y`,type:`boolean`}}});if(n.help){console.log(Ze);return}await J(!!n.yes);let i=k(t[0]??`.`),a=oe(i),o=j()&&!n.yes;if(await ze(i,`No git repository in ${i}. reinit re-scaffolds an existing repo; use init for a new project.`,`Working tree has uncommitted changes. Commit or stash them first; reinit deletes every tracked file.`),P(N(`https://zerostarter.dev`)),o&&!await V(`Delete every file in ${a} (keeping .git and .env*) and re-scaffold?`,!1)){I(`Aborted`);return}await Be(i,T(`reinit failed; restored your committed files (deleted gitignored files, except .env*, are gone).`),async()=>{r(i),await Pe(i),z(`Fetched the latest ZeroStarter (kept .git and .env*)`),ie(i,{name:a}),z(`Rebranded to ${a}`),await G(i),await b(i),Te(i),await K(i,`ci(reinit): re-baseline as ${a}`)});let s=[];W(i)||s.push(`set POSTGRES_URL in .env`),s.push(E(`bun run db:migrate`)),s.push(E(`bun run dev`)),s.push(E(`git push`)),R(s.join(`
47
+ `),`Next steps`),F(f(`${a} re-scaffolded; .git history, remote, and .env* files are intact`))},$e=`Usage:
38
48
  $ bunx zerostarter sync [dir] [options]
39
49
 
40
50
  Re-baseline an existing fork (default .) on the latest ZeroStarter: a gitpick overlay
@@ -43,8 +53,9 @@ identity, and favicon are preserved. Requires a clean tree; lands as a reviewabl
43
53
  you commit yourself.
44
54
 
45
55
  Options:
46
- -h, --help Display help`);return}await Y();let u=h(t[0]??`.`);await je(u,`No git repository in ${u}. Run sync inside an existing fork.`,`Working tree has uncommitted changes. Commit or stash them first so the sync lands as a reviewable diff.`),A(w(`ZeroStarter`));let f=m(u,`package.json`),p=new Map(l(u).map(e=>[e,a(e)])),g=i(await De());g.length===0&&N(`No PRESERVE_ON_SYNC directive found; fork-owned files may be overwritten.`),await Me(u,C(`Sync failed; rolled the working tree back to your last commit.`),async()=>{await Ee(u),o(u),d(m(u,`.gitpickignore`));for(let[e,t]of p)s(e)&&r(e,c(t,a(e),e===f));await ke(u,g)}),M(`Overlaid the latest ZeroStarter (content, public/marketing, and branding preserved)`),await q(u),j(S(`Synced to the latest ZeroStarter`)),console.log(),console.log(`Starter files were updated (edits to them were overwritten); files you added and your`),console.log(`content, public/marketing, and branding were preserved.`),console.log(C(`Review the diff and commit: git -C ${u} status`))},{author:Z,name:Q,version:Ue}=re,$=`Version:
47
- ${Q}@${Ue}
56
+ -h, --help Display help`,et=async t=>{let{positionals:r,values:i}=q($e,{allowPositionals:!0,args:t,options:{help:{short:`h`,type:`boolean`}}});if(i.help){console.log($e);return}await J();let c=k(r[0]??`.`);await ze(c,`No git repository in ${c}. Run sync inside an existing fork.`,`Working tree has uncommitted changes. Commit or stash them first so the sync lands as a reviewable diff.`),P(N(`https://zerostarter.dev`));let u=O(c,`package.json`),d=new Map(o(c).map(t=>[t,e(t)])),f=s(await Fe()).preserve;f.length===0&&B(`No PRESERVE_ON_SYNC directive found; fork-owned files may be overwritten.`);let m=ne(c),h=ae(c),g=S();await Be(c,T(`Sync failed; rolled the working tree back to your last commit.`),async()=>{await Pe(c),x(c,m),v(O(c,`.gitpickignore`));for(let[t,r]of d)n(t)&&a(t,l(r,e(t),t===u));ee(c),g=p(c,h),await Le(c,f)}),z(`Overlaid the latest ZeroStarter (content, public/marketing, and branding preserved)`),await G(c),await b(c),re(c)&&B(`Your AGENTS.md has no skills-table markers, so the pre-commit hook that fills them fails.`,[`Add these two pairs under a ## Skills heading, then commit:`,`<!-- skills:custom --> <!-- /skills:custom -->`,`<!-- skills:vendored --> <!-- /skills:vendored -->`]);let _=e=>e.map(e=>`.agents/skills/${e}/SKILL.md`),y=e=>e.length===1?``:`s`;g.forkOwned.length>0&&z(`Left ${g.forkOwned.length} skill${y(g.forkOwned)} you own untouched:`,_(g.forkOwned)),g.customized.length>0&&(B(`Kept your edits to ${g.customized.length} skill${y(g.customized)}, so they did not take the update:`,_(g.customized)),z(`To take upstream's version instead, delete the skill directory and sync again.`)),g.unverified.length>0&&(B(`Updated ${g.unverified.length} skill${y(g.unverified)} with no sync record, so any edits of yours are in the diff rather than the file:`,_(g.unverified)),z(`Restore any with: git restore --source=HEAD -- .agents/skills/<name>/SKILL.md. Later syncs track them.`)),R([`Starter files were updated (edits overwritten); your content, public/marketing, branding, and the skills you own were preserved.`,T(`Review the diff and commit: git -C ${c} status`)].join(`
57
+ `),`Review the changes`),F(E(`Synced to the latest ZeroStarter`))},{author:Z,name:Q,version:tt}=ge,$=`Version:
58
+ ${Q}@${tt}
48
59
 
49
60
  Go from zero to a production-ready SaaS, rebranded and ready to ship.
50
61
 
@@ -62,4 +73,4 @@ Options:
62
73
  -h, --help Display help
63
74
 
64
75
  Author:
65
- ${Z.name} <${Z.email}> (${ae(Z.url)})`;(async()=>{try{let e=process.argv.slice(2),t=e[0],n=e.slice(1);switch(t){case`init`:return await Be(n);case`reinit`:return await Ve(n);case`sync`:return await He(n);case void 0:case`-h`:case`--help`:console.log($);return;case`-v`:case`--version`:console.log(`${Q}@${Ue}`);return;default:console.error(D(`Unknown command: ${t}\n`)),console.log($),process.exit(1)}}catch(e){console.error(D(e instanceof Error?e.message:String(e))),process.exit(1)}})();export{};
76
+ ${Z.name} <${Z.email}> (${M(Z.url)})`;(async()=>{try{let e=process.argv.slice(2),n=e[0],r=e.slice(1);switch(n){case`init`:return await Xe(r);case`reinit`:return await Qe(r);case`sync`:return await et(r);case void 0:case`-h`:case`--help`:console.log($);return;case`-v`:case`--version`:console.log(`${Q}@${tt}`);return;default:console.error(t(`Unknown command: ${n}\n`)),console.log($),process.exit(1)}}catch(e){h(e),process.exit(1)}})();export{};
@@ -0,0 +1,161 @@
1
+ import{delimiter as e,dirname as t,isAbsolute as n,join as r,relative as i,resolve as a,sep as o}from"node:path";import{existsSync as s,mkdirSync as c,readFileSync as l,readdirSync as u,rmSync as d,writeFileSync as f}from"node:fs";import{createHash as p}from"node:crypto";import{spawn as m}from"node:child_process";import{access as h}from"node:fs/promises";const g=e=>{let t=[],n=[],r=!1;for(let i of e.split(`
2
+ `)){let e=i.trim();if(e){if(!r&&e.startsWith(`# PRESERVE_ON_SYNC`)){n=e.slice(18).replace(/^\s*-\s*/,``).split(`,`).map(e=>e.trim()).filter(Boolean),r=!0;continue}e.startsWith(`#`)||t.push(e)}}return{excludes:t,preserve:n}},_=e=>s(e),v=e=>l(e,`utf8`),y=(e,n)=>{c(t(e),{recursive:!0}),f(e,n)},b=e=>{d(e,{force:!0,recursive:!0})},x=new Set([`node_modules`,`.next`,`.turbo`,`dist`]),S=(e,t=!0)=>{for(let n of u(e,{withFileTypes:!0})){let i=r(e,n.name);if(n.name===`.git`){if(t)continue;d(i,{force:!0,recursive:!0});continue}n.isDirectory()?x.has(n.name)?d(i,{force:!0,recursive:!0}):(S(i,!1),u(i).length===0&&d(i,{force:!0,recursive:!0})):n.name.startsWith(`.env`)||d(i,{force:!0})}},ee=e=>{let t=[];for(let n of u(e,{withFileTypes:!0})){if(n.name===`.git`||x.has(n.name))continue;let i=r(e,n.name);n.isDirectory()?t.push(...ee(i)):n.name===`package.json`&&t.push(i)}return t},C=e=>JSON.parse(v(e)),w=(e,t)=>{y(e,`${JSON.stringify(t,null,2)}\n`)},te=(e,t)=>{if(!s(e))return!1;let n=v(e),r=n.replace(t,``);return r!==n&&(f(e,r),!0)},T=[`homepage`,`bugs`,`license`,`author`,`repository`,`funding`],ne=[`name`,`version`,...T],re=(e,t)=>{let n={...e,...t};return Object.keys(n).length>0?n:void 0},ie=(e,t)=>{let n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];return n.length||r.length?[...new Set([...r,...n])]:void 0},ae=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`,`resolutions`,`catalog`,`scripts`,`overrides`],oe=(e,t,n)=>{let r={...t};for(let n of Object.keys(e))n in t||(r[n]=e[n]);for(let n of ae){let i=re(e[n],t[n]);i&&(r[n]=i)}let i=ie(e.workspaces,t.workspaces);if(i&&(r.workspaces=i),n)for(let t of ne)t in e?r[t]=e[t]:delete r[t];return r},E=(e,t,n=process.stdout)=>r=>n.isTTY?`\x1b[${e}m${r}\x1b[${t}m`:r,D=E(`36`,`39`),se=E(`32`,`39`),ce=E(`33`,`39`),O=E(`90`,`39`),k=E(`2`,`22`),A=E(`31`,`39`,process.stderr),le=E(`2`,`22`,process.stderr),ue=E(`38;5;208`,`39`),j=[`◇`,`◆`],M=(e,t)=>{let n=(e%j.length+j.length)%j.length;return`${D(j[n])} ${t}`},N={barStart:`┌`,bar:`│`,barEnd:`└`,active:`◆`,submit:`◇`,radioOn:`●`,radioOff:`○`,checkboxOn:`◼`,checkboxOff:`◻`,warn:`▲`,error:`■`,barH:`─`,cornerTR:`╮`,connectL:`├`,cornerBL:`╰`,cornerBR:`╯`};var P=class extends Error{constructor(...e){super(...e),this.name=`SubprocessError`,this.stdout=``,this.stderr=``}};const F=[`.exe`,`.com`],I=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),de=e=>I(I(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),fe=async(t,n,r)=>{if(F.some(e=>t.toLowerCase().endsWith(e)))return!0;let i=(r.PATH||r.Path||``).split(e).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{return await Promise.any([n,...i].flatMap(e=>F.map(n=>h(`${a(e,t)}${n}`)))),!0}catch{return!1}},pe=async(e,t,n,r=process.platform===`win32`)=>{let i=n.cwd?String(n.cwd):`.`,a=n.env||process.env;return r&&!n.shell&&!await fe(e,i,a)?[I(e),t.map(de),{...n,shell:!0}]:[e,t,n]},L=async(e,t,n,r)=>{let i=[e,...t].join(` `),[a,o,s]=await pe(e,t,n);s.shell&&o.length>0&&(a=[a,...o].join(` `),o=[]);let c=m(a,o,s),l=``,u=``;return new Promise((e,t)=>{let n=(e,n,r)=>{let i=new P(e,r?{cause:r}:void 0);i.stdout=l,i.stderr=u,i.exitCode=n,t(i)},a=e=>{e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&e.code!==`EPIPE`&&n(`Command failed: ${i}`,void 0,e)};c.stdout&&(c.stdout.setEncoding(`utf8`),c.stdout.on(`data`,e=>{l+=e,r?.(e)}),c.stdout.on(`error`,a)),c.stderr&&(c.stderr.setEncoding(`utf8`),c.stderr.on(`data`,e=>{u+=e,r?.(e)}),c.stderr.on(`error`,a)),c.on(`error`,e=>n(`Command failed: ${i}`,void 0,e)),c.on(`close`,(t,r)=>{if(r)return n(`Command was terminated with ${r}: ${i}`);if(t!==0)return n(`Command failed with exit code ${t}: ${i}`,t??void 0);e({stdout:l,stderr:u})})})},R=async(e,t,n)=>{let{stdout:r}=await L(e,t,{cwd:n,stdio:[`ignore`,`pipe`,`pipe`]});return r},z=async(e,t,n)=>{await L(e,t,{cwd:n,stdio:`inherit`})},me=async(e,t)=>{try{return await L(e,t,{stdio:`ignore`}),!0}catch{return!1}},he=RegExp(`\x1B\\[[0-9;?]*[a-zA-Z]`,`g`),B=e=>e.replace(he,``),V=new WeakSet,ge=e=>{if(process.stderr.write(`\n ${A(e instanceof Error?e.message:String(e))}\n`),!(e instanceof P)||V.has(e))return;let t=(e.stderr||e.stdout||``).trim();if(!t)return;let n=B(t).split(`
3
+ `).map(e=>e.trimEnd()).filter(Boolean).slice(-12);for(let e of n)process.stderr.write(` ${le(e)}\n`)},_e=async(e,t,n)=>{let r=process.stdout,i=n.label??``;if(!r.isTTY){i&&r.write(` ${D(N.active)} ${i}\n`),await z(e,t,n.cwd);return}let a=n.lines??3,o=[],s=0,c=0,l=``,u=``,d=()=>(r.columns||80)-1,f=e=>{r.write(e?`\x1B[?7h`:`\x1B[?7l`)},p=()=>{c>0&&(r.write(`[${c}A`),c=0)},m=()=>{p();let e=0;r.write(` ${M(s,i)}\n`),e++;for(let t of o.slice(-a))r.write(` ${O(N.bar)} ${k(t.slice(0,Math.max(0,d()-5)))}\n`),e++;c=e},h=e=>{u+=e,l+=e;let t=l.split(`
4
+ `);l=t.pop()??``;for(let e of t)o.push(B(e).replace(/\r/g,``).replace(/\t/g,` `).trimEnd()),m()};m(),f(!1);let g=()=>{f(!0),process.exit(130)};process.once(`SIGINT`,g);let _=setInterval(()=>{s+=1,m()},400),v=()=>{clearInterval(_),process.removeListener(`SIGINT`,g)};try{await L(e,t,{cwd:n.cwd,stdio:[`ignore`,`pipe`,`pipe`]},h)}catch(e){throw v(),p(),f(!0),r.write(u),e&&typeof e==`object`&&V.add(e),e}v(),p(),f(!0),r.write(` ${D(N.active)} ${n.done??i}\n`);for(let e of o.slice(-a))r.write(` ${O(N.bar)} ${k(e.slice(0,Math.max(0,d()-5)))}\n`)},H=`https://github.com/nrjdalal/zerostarter`,U=`.agents/skills/.sync.json`,W=()=>({adopted:[],customized:[],forkOwned:[],unverified:[]}),G=e=>p(`sha256`).update(e.replace(/\r\n/g,`
5
+ `)).digest(`hex`).slice(0,12),K=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`app`,q=(e,t,n)=>e.replaceAll(`ZeroStarter`,()=>n).replace(/(?<!bunx )zerostarter(?! scaffolding CLI)/g,t),J=`> Synced from ${H}.`,ve=()=>`> [!CAUTION]\n${J} Customize this skill or remove this note to stop syncing.`,Y=e=>e.replace(/^https?:\/\/github\.com\//,``).replace(/\/+$/,``),X=Y(H),Z=e=>{let t=e.split(`
6
+ `);if(t[0]===void 0||t[0].trim()!==`---`)return``;for(let e of t.slice(1)){if(e.trim()===`---`)break;if(e.startsWith(`source:`))return e.slice(7).trim()}return``},ye=e=>u(e,{withFileTypes:!0}).filter(t=>t.isDirectory()&&_(r(e,t.name,`SKILL.md`))).map(e=>e.name).sort(),be=e=>{let t=r(e,U);if(!_(t))return{};try{return C(t)}catch{return{}}},xe=e=>{let t=r(e,`.agents/skills`),n=new Map;if(!_(t))return n;for(let e of ye(t))n.set(e,v(r(t,e,`SKILL.md`)));return n},Se=(e,t,n,r,i=!1)=>{let a=e.replace(/\r\n/g,`
7
+ `).split(`
8
+ `),o=a.indexOf(`---`),s=a.indexOf(`---`,o+1);if(o!==0||s===-1)throw Error(`.agents/skills/${r}/SKILL.md has no frontmatter to reconcile (the skill shape drifted). Update packages/cli/src/skills.ts.`);let c=Z(e),l=i||c===``||c===`local`?H:c,u=a.slice(o+1,s).map(e=>e.startsWith(`source:`)?`source: ${l}`:q(e,t,n));u.some(e=>e.startsWith(`source:`))||u.push(`source: ${l}`);let d=q(a.slice(s+1).join(`
9
+ `),t,n).replace(/^\n+/,``),f=l===H?`${ve()}\n\n`:``;return`---\n${u.join(`
10
+ `)}\n---\n\n${f}${d}`},Ce=(e,t,n)=>{let i=r(e,`.agents/skills`),a=W();if(!_(i))return a;let o=K(t.name),s=be(e),c={};for(let e of ye(i)){let l=r(i,e,`SKILL.md`),u=v(l),d=Se(u,o,t.name,e),f=n===void 0?void 0:n.get(e),p=s[e];if(f!==void 0){let n=Z(f),r=t=>{y(l,f),t.push(e),p&&(c[e]=p)},i=Y(n);if(n!==``&&i!==X){r(a.forkOwned);continue}if(i===X&&!f.includes(J)){r(a.forkOwned);continue}if(p){if(p.written!==G(f)){r(a.customized);continue}}else G(f)!==G(d)&&G(f)!==G(Se(u,o,t.name,e,!0))&&a.unverified.push(e)}y(l,d),c[e]={ref:`main`,upstream:G(u),written:G(d)},a.adopted.push(e)}return w(r(e,U),c),a},we=e=>{let t=r(e,`AGENTS.md`);if(!_(t))return!1;let n=v(t);return!n.includes(`<!-- skills:custom -->`)||!n.includes(`<!-- skills:vendored -->`)},Te=async e=>{if(_(r(e,`.github/scripts/skills-manager.ts`)))try{await R(`bun`,[`.github/scripts/skills-manager.ts`],e)}catch{}},Ee=(e,t)=>{let n=C(r(e,`package.json`)).name;return n?Ce(e,{name:n},t):W()},Q={allowlist:!1,apiDocs:!0,blog:!0,docs:!0,internalDocs:!0,waitlist:!1},De=e=>`// Optional surfaces a fork enables or disables. Typed boolean (not \`as const\`) so a fork can flip them and the runtime gates are not dead code. Off means the routes 404 and the links, nav, sitemap, llms, and search drop the surface. waitlist off makes the home a plain landing page.
11
+ export const features = {
12
+ allowlist: ${e.allowlist},
13
+ apiDocs: ${e.apiDocs},
14
+ blog: ${e.blog},
15
+ docs: ${e.docs},
16
+ internalDocs: ${e.internalDocs},
17
+ waitlist: ${e.waitlist},
18
+ }
19
+
20
+ export type Feature = keyof typeof features`,Oe=({name:e},t=Q)=>{let n=e.charAt(0).toUpperCase()+e.slice(1);return`// Brand identity for this app: the single source a fork edits to rebrand. web reads it via lib/config.ts.
21
+ export const site = {
22
+ name: ${JSON.stringify(n)},
23
+ description: ${JSON.stringify(`${n} is just getting started. Tell its story here.`)},
24
+ tagline: "Your tagline, ready when you are.",
25
+ social: {
26
+ discord: "",
27
+ github: "",
28
+ x: "",
29
+ },
30
+ // Local-only dev agent identity (api/hono agents router).
31
+ agent: {
32
+ name: "LocalAgent",
33
+ email: "agent@local.host",
34
+ },
35
+ // Injectable long-form text blocks. A product sets its own, or leaves them empty.
36
+ apiReferenceDescription: "",
37
+ llmsFullPreamble: "",
38
+ } as const
39
+
40
+ export type Site = typeof site
41
+
42
+ ${De(t)}
43
+ `},ke=()=>`import { features, site } from "@packages/config/site"
44
+ import { redirect } from "next/navigation"
45
+
46
+ // Fresh fork: the waitlist capture when the waitlist feature is on, otherwise a plain landing page. Replace this with your real home when ready.
47
+ export default function Home() {
48
+ if (features.waitlist) redirect("/waitlist")
49
+
50
+ return (
51
+ <main className="flex min-h-svh flex-col items-center justify-center p-8 text-center">
52
+ <div className="mx-auto flex w-full max-w-xl flex-col items-center">
53
+ <h1 className="mb-4 text-5xl font-bold tracking-tight sm:text-6xl">{site.name}</h1>
54
+ <p className="text-muted-foreground max-w-md text-lg">{site.tagline}</p>
55
+ </div>
56
+ </main>
57
+ )
58
+ }
59
+ `,Ae=()=>`# AGENTS.md
60
+
61
+ Guidance for AI coding agents working in this repository.
62
+
63
+ ## Instructions
64
+
65
+ - ALWAYS: Use \`@/\` for imports, and follow the \`design\` skill for UI and styling conventions.
66
+ - ALWAYS: Keep documentation in sync with every change.
67
+ - NEVER: Include "Co-authored-by" in commit messages.
68
+ - NEVER: Use em-dashes (the long dash, U+2014) in code, comments, docs, or copy. Regular hyphens are fine; for a pause or aside, use a comma, colon, or period.
69
+
70
+ ## Skills
71
+
72
+ Skills live in \`.agents/skills\` (symlinked to \`.claude/skills\` and \`.github/skills\`, so every agent tool reads the same files). Each is a \`SKILL.md\` with a \`description\` trigger and a literal procedure. Start with \`codebase-map\` to orient, then load the task skill that fits.
73
+
74
+ These tables are generated from each skill's own description by \`bun .github/scripts/skills-manager.ts\`, which a pre-commit hook runs for you. **Custom** skills are maintained here; **vendored** skills are copied verbatim from an upstream project (re-vendor to update, do not hand-edit).
75
+
76
+ **Custom**
77
+
78
+ <!-- skills:custom -->
79
+
80
+ <!-- /skills:custom -->
81
+
82
+ **Vendored** (upstream, copied verbatim)
83
+
84
+ <!-- skills:vendored -->
85
+
86
+ <!-- /skills:vendored -->
87
+ `,je=({name:e})=>`# ${e.charAt(0).toUpperCase()+e.slice(1)}
88
+
89
+ Built on top of [ZeroStarter](https://zerostarter.dev).
90
+
91
+ ## Development
92
+
93
+ \`\`\`bash
94
+ bun run dev
95
+ \`\`\`
96
+
97
+ This serves named \`.localhost\` dev URLs via portless (\`bunx portless list\` shows them); \`PORTLESS=0 bun run dev\` uses fixed ports instead (web \`:3000\`, api \`:4000\`).
98
+ `,Me=()=>`---
99
+ slug: /docs
100
+ title: Introduction
101
+ description: Documentation.
102
+ ---
103
+
104
+ # Introduction
105
+
106
+ This is your documentation home. Start writing, this page is yours.
107
+ `,Ne=()=>`---
108
+ slug: /console/docs
109
+ title: Introduction
110
+ description: Internal documentation.
111
+ ---
112
+
113
+ # Introduction
114
+
115
+ Your team's internal docs live here.
116
+ `,Pe=e=>`---
117
+ title: Blog
118
+ description: Latest articles and updates
119
+ createdAt: ${e}
120
+ ---
121
+
122
+ ## Recent Posts
123
+
124
+ <BlogPostList />
125
+ `,Fe=e=>`---
126
+ title: Hello World
127
+ description: The first post on your new blog.
128
+ createdAt: ${e}
129
+ publishedAt: ${e}
130
+ ---
131
+
132
+ ## Hello World
133
+
134
+ Your very first post. Replace it with something worth reading.
135
+ `,Ie=()=>`import type { DocsConfig } from "./src/lib/docs"
136
+
137
+ const docsConfig = {
138
+ docs: {
139
+ "Getting Started": [
140
+ {
141
+ "/docs": {
142
+ title: "Introduction",
143
+ description: "Documentation.",
144
+ },
145
+ },
146
+ ],
147
+ },
148
+ console: {
149
+ "Getting Started": [
150
+ {
151
+ "/console/docs": {
152
+ title: "Introduction",
153
+ description: "Internal documentation.",
154
+ },
155
+ },
156
+ ],
157
+ },
158
+ } satisfies DocsConfig
159
+
160
+ export default docsConfig
161
+ `,$=(e,...t)=>r(e,...t),Le=e=>{let t=$(e,`.gitpickignore`);if(!_(t))return;let s=a(e),c=(e,t)=>{throw Error(`.gitpickignore entry "${e}" ${t}; the in-place converter only removes literal paths under the root.`)},l=g(v(t)).excludes.map(e=>{/[*?![\]]/.test(e)&&c(e,`is not a literal path (a glob or negation would diverge from gitpick's fetch)`);let t=i(s,a(s,e));return(n(e)||!t||t===`..`||t.startsWith(`..${o}`)||n(t))&&c(e,`is not inside the project`),r(s,t)});for(let e of l)b(e);b(t)},Re=/[ \t]*\{[^}\r\n]*href:[ \t]*["']\/hire["'][^}\r\n]*\},?[ \t]*\r?\n/,ze=(e,t)=>{let n=new Date,r=n.toISOString().slice(0,10),i=[n.getFullYear(),n.getMonth()+1,n.getDate()].map(e=>String(e).padStart(2,`0`)).join(`-`),a=i<r?i:r;y($(e,`web/next/content/docs/index.mdx`),Me()),y($(e,`web/next/content/blog/index.mdx`),Pe(a)),y($(e,`web/next/content/blog/hello-world.mdx`),Fe(a)),y($(e,`web/next/content/console/docs/index.mdx`),Ne()),y($(e,`web/next/docs.config.ts`),Ie()),y($(e,`web/next/public/.gitkeep`),``),y($(e,`web/next/src/app/page.tsx`),ke()),y($(e,`AGENTS.md`),Ae()),y($(e,`README.md`),je(t))},Be=`web/next/src/lib/marketing/fonts.ts`,Ve=e=>_($(e,Be)),He=(e,t=!1)=>{let n=$(e,`web/next/src/lib/fonts.ts`),r=$(e,Be),i=$(e,`web/next/src/components/common/navbar.tsx`);if(te(i,Re),_(r)&&!t)throw Error(`web/next/src/lib/marketing/fonts.ts survived the fork strip (add web/next/src/lib/marketing/ to .gitpickignore).`);if(_(n)&&v(n).includes(`fonts/marketing/`))throw Error(`fonts.ts references fonts/marketing/; author-only marketing fonts must live in the fork-excluded web/next/src/lib/marketing/, not the shared fonts.ts.`);if(_(i)&&/href:\s*["']\/hire["']/.test(v(i)))throw Error(`common/navbar.tsx still has the /hire entry after fixDangling (regex drift). Update packages/cli/src/convert.ts.`)},Ue=(e,t)=>{for(let[n,r]of[[`web/next`,t],[`api/hono`,`api.${t}`]]){let t=$(e,n,`package.json`),i=C(t),a=i.portless;if(!a||typeof a!=`object`||Array.isArray(a))throw Error(`${n}/package.json has no "portless" object to rebrand (the dev-URL setup drifted). Update packages/cli/src/convert.ts.`);let o=a;o.name=r,w(t,i)}},We=e=>{let t=C($(e,`package.json`)).name;t&&Ue(e,K(t))},Ge=(e,t,n)=>{y($(e,`packages/config/src/site.ts`),Oe(t,n));let r=K(t.name),i=$(e,`package.json`),a=C(i);a.name=r,a.version=`0.0.0`;for(let e of T)delete a[e];w(i,a),Ue(e,r)},Ke=(e,t,n=Q)=>{Le(e),ze(e,t),He(e),Ge(e,t,n),Ce(e,t)};export{C as A,A as C,_ as D,S as E,y as M,w as N,ee as O,g as P,M as S,oe as T,D as _,Q as a,se as b,Ee as c,me as d,ge as f,N as g,_e as h,We as i,b as j,v as k,Te as l,z as m,He as n,W as o,R as p,Ve as r,we as s,Ke as t,xe as u,k as v,ce as w,ue as x,O as y};
package/dist/index.d.mts CHANGED
@@ -2,8 +2,16 @@
2
2
  interface Brand {
3
3
  name: string;
4
4
  }
5
+ type FeatureFlags = {
6
+ allowlist: boolean;
7
+ apiDocs: boolean;
8
+ blog: boolean;
9
+ docs: boolean;
10
+ internalDocs: boolean;
11
+ waitlist: boolean;
12
+ };
5
13
  //#endregion
6
14
  //#region src/convert.d.ts
7
- declare const convertRepo: (root: string, brand: Brand) => void;
15
+ declare const convertRepo: (root: string, brand: Brand, features?: FeatureFlags) => void;
8
16
  //#endregion
9
17
  export { type Brand, convertRepo };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./convert-DMU8fiBc.mjs";export{e as convertRepo};
1
+ import{t as e}from"./convert-Cq2vrNh-.mjs";export{e as convertRepo};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zerostarter",
3
- "version": "0.0.0-daca3ce",
3
+ "version": "0.0.0-e763493",
4
4
  "description": "Go from zero to a production-ready SaaS, rebranded and ready to ship.",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,104 +0,0 @@
1
- import{dirname as e,join as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,rmSync as o,writeFileSync as s}from"node:fs";const c=e=>n(e),l=e=>i(e,`utf8`),u=(t,n)=>{r(e(t),{recursive:!0}),s(t,n)},d=e=>{o(e,{force:!0,recursive:!0})},f=new Set([`node_modules`,`.next`,`.turbo`,`dist`]),p=(e,n=!0)=>{for(let r of a(e,{withFileTypes:!0})){let i=t(e,r.name);if(r.name===`.git`){if(n)continue;o(i,{force:!0,recursive:!0});continue}r.isDirectory()?f.has(r.name)?o(i,{force:!0,recursive:!0}):(p(i,!1),a(i).length===0&&o(i,{force:!0,recursive:!0})):r.name.startsWith(`.env`)||o(i,{force:!0})}},m=e=>{let n=[];for(let r of a(e,{withFileTypes:!0})){if(r.name===`.git`||f.has(r.name))continue;let i=t(e,r.name);r.isDirectory()?n.push(...m(i)):r.name===`package.json`&&n.push(i)}return n},h=e=>JSON.parse(l(e)),g=(e,t)=>{u(e,`${JSON.stringify(t,null,2)}\n`)},_=(e,t)=>{if(!n(e))return!1;let r=l(e),i=r.replace(t,``);return i===r?!1:(s(e,i),!0)},v=[`homepage`,`bugs`,`license`,`author`,`repository`,`funding`],y=[`name`,`version`,...v],b=e=>{let t=e.split(`
2
- `).find(e=>e.trim().startsWith(`# PRESERVE_ON_SYNC`));return t?t.trim().slice(18).replace(/^\s*-\s*/,``).split(`,`).map(e=>e.trim()).filter(Boolean):[]},x=(e,t)=>{let n={...e,...t};return Object.keys(n).length>0?n:void 0},S=(e,t)=>{let n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];return n.length||r.length?[...new Set([...r,...n])]:void 0},C=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`,`resolutions`,`catalog`,`scripts`,`overrides`],w=(e,t,n)=>{let r={...t};for(let n of Object.keys(e))n in t||(r[n]=e[n]);for(let n of C){let i=x(e[n],t[n]);i&&(r[n]=i)}let i=S(e.workspaces,t.workspaces);if(i&&(r.workspaces=i),n)for(let t of y)t in e?r[t]=e[t]:delete r[t];return r},T=({name:e})=>{let t=e.charAt(0).toUpperCase()+e.slice(1);return`// Brand identity for this app: the single source a fork edits to rebrand. web reads it via lib/config.ts.
3
- export const site = {
4
- name: "${t}",
5
- description: "${t} is just getting started. Tell its story here.",
6
- tagline: "Your tagline, ready when you are.",
7
- social: {
8
- github: "",
9
- x: "",
10
- discord: "",
11
- },
12
- // Local-only dev agent identity (api/hono agents router).
13
- agent: {
14
- name: "LocalAgent",
15
- email: "agent@local.host",
16
- },
17
- // Injectable long-form text blocks. A product sets its own, or leaves them empty.
18
- apiReferenceDescription: "",
19
- llmsFullPreamble: "",
20
- } as const
21
-
22
- export type Site = typeof site
23
- `},E=()=>`import { redirect } from "next/navigation"
24
-
25
- // Fresh fork: redirect to the waitlist until you build your real home page.
26
- export default function Home() {
27
- redirect("/waitlist")
28
- }
29
- `,D=()=>'# AGENTS.md\n\nGuidance for AI coding agents working in this repository.\n\n## Instructions\n\n- ALWAYS: Use `@/` for imports, and follow the `design` skill for UI and styling conventions.\n- ALWAYS: Keep documentation in sync with every change.\n- NEVER: Include "Co-authored-by" in commit messages.\n- NEVER: Use em-dashes (the long dash, U+2014) in code, comments, docs, or copy. Regular hyphens are fine; for a pause or aside, use a comma, colon, or period.\n\n## Skills\n\nCustom skills live in `.agents/skills` (symlinked to `.claude/skills`). Start with the `codebase-map` skill to orient, then load the task skill that fits (`api-endpoint`, `db-migration`, `dev`, `design`, and more).\n',O=({name:e})=>`# ${e.charAt(0).toUpperCase()+e.slice(1)}
30
-
31
- Built on top of [ZeroStarter](https://zerostarter.dev).
32
-
33
- ## Development
34
-
35
- \`\`\`bash
36
- bun run dev
37
- \`\`\`
38
-
39
- Web runs on http://localhost:3000 and the API on http://localhost:4000.
40
- `,k=()=>`---
41
- slug: /docs
42
- title: Introduction
43
- description: Documentation.
44
- ---
45
-
46
- # Introduction
47
-
48
- This is your documentation home. Start writing, this page is yours.
49
- `,A=()=>`---
50
- slug: /console/docs
51
- title: Introduction
52
- description: Internal documentation.
53
- ---
54
-
55
- # Introduction
56
-
57
- Your team's internal docs live here.
58
- `,j=e=>`---
59
- title: Blog
60
- description: Latest articles and updates
61
- createdAt: ${e}
62
- ---
63
-
64
- ## Recent Posts
65
-
66
- <BlogPostList />
67
- `,M=e=>`---
68
- title: Hello World
69
- description: The first post on your new blog.
70
- createdAt: ${e}
71
- publishedAt: ${e}
72
- ---
73
-
74
- ## Hello World
75
-
76
- Your very first post. Replace it with something worth reading.
77
- `,N=()=>`import type { DocsConfig } from "./src/lib/docs/types"
78
-
79
- const docsConfig = {
80
- docs: {
81
- "Getting Started": [
82
- {
83
- "/docs": {
84
- title: "Introduction",
85
- description: "Documentation.",
86
- },
87
- },
88
- ],
89
- },
90
- console: {
91
- "Getting Started": [
92
- {
93
- "/console/docs": {
94
- title: "Introduction",
95
- description: "Internal documentation.",
96
- },
97
- },
98
- ],
99
- },
100
- } satisfies DocsConfig
101
-
102
- export default docsConfig
103
- `,P=(e,...n)=>t(e,...n),F=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`app`,I=e=>{let t=P(e,`.gitpickignore`);if(c(t)){for(let n of l(t).split(`
104
- `)){let t=n.trim();if(!(!t||t.startsWith(`#`))){if(/[*?![\]]/.test(t))throw Error(`.gitpickignore entry "${t}" is not a literal path; the in-place converter only supports literal paths (a glob or negation would diverge from gitpick's fetch).`);d(P(e,t))}}d(t)}},L=/\r?\nexport const caveat = localFont\(\{[\s\S]*?\r?\n\}\)\r?\n/,R=/\r?\nexport const newsreader = localFont\(\{[\s\S]*?\r?\n\}\)\r?\n/,z=/[ \t]*\{[^}\r\n]*href:[ \t]*["']\/hire["'][^}\r\n]*\},?[ \t]*\r?\n/,B=(e,t)=>{let n=new Date,r=n.toISOString().slice(0,10),i=[n.getFullYear(),n.getMonth()+1,n.getDate()].map(e=>String(e).padStart(2,`0`)).join(`-`),a=i<r?i:r;u(P(e,`web/next/content/docs/index.mdx`),k()),u(P(e,`web/next/content/blog/index.mdx`),j(a)),u(P(e,`web/next/content/blog/hello-world.mdx`),M(a)),u(P(e,`web/next/content/console/docs/index.mdx`),A()),u(P(e,`web/next/docs.config.ts`),N()),u(P(e,`web/next/public/.gitkeep`),``),u(P(e,`web/next/src/app/page.tsx`),E()),u(P(e,`AGENTS.md`),D()),u(P(e,`README.md`),O(t))},V=e=>{let t=P(e,`web/next/src/lib/fonts.ts`),n=P(e,`web/next/src/components/navbar/home.tsx`);if(_(t,L),_(t,R),_(n,z),c(t)&&l(t).includes(`fonts/marketing/`))throw Error(`fonts.ts still references fonts/marketing/ after fixDangling (regex drift). Update packages/cli/src/convert.ts.`);if(c(n)&&/href:\s*["']\/hire["']/.test(l(n)))throw Error(`navbar/home.tsx still has the /hire entry after fixDangling (regex drift). Update packages/cli/src/convert.ts.`)},H=(e,t)=>{u(P(e,`packages/config/src/site.ts`),T(t));let n=P(e,`package.json`),r=h(n);r.name=F(t.name),r.version=`0.0.0`;for(let e of v)delete r[e];g(n,r)},U=(e,t)=>{I(e),B(e,t),V(e),H(e,t)};export{p as a,l as c,u as d,g as f,b as i,h as l,V as n,c as o,w as r,m as s,U as t,d as u};