create-reintersect 0.1.0 → 0.1.3-staging.2f2d4a9f1438
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.mjs +6 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -144,7 +144,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
144
144
|
* This source code is licensed under the MIT license found in the
|
|
145
145
|
* LICENSE file in the root directory of this source tree.
|
|
146
146
|
*/
|
|
147
|
-
var hle=n((e=>{var t=Symbol.for(`react.transitional.element`);function n(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.jsx=n,e.jsxs=n})),$=n(((e,t)=>{t.exports=hle()}))();const gle={info:`›`,success:`✔`,warning:`!`,error:`✖`},_le=(e,t)=>({info:e.accent,success:e.success,warning:e.warning,error:e.danger})[t],vle={pending:`○`,done:`✔`,skipped:`-`,failed:`✖`},yle=(e,t)=>({pending:void 0,running:e.accent,done:e.success,skipped:void 0,failed:e.danger})[t],U7=({text:e,tone:t})=>{let n=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:_le(n,t),children:gle[t]}),(0,$.jsx)(c7,{children:e})]})},ble=({state:e})=>{let t=H7();return e===`running`?(0,$.jsx)(cle,{}):(0,$.jsx)(c7,{color:yle(t,e),dimColor:e===`pending`||e===`skipped`,children:vle[e]})},xle=({state:e,label:t,running:n,done:r})=>e===`running`?`${n}…`:e===`done`?r:t,Sle=({task:e})=>(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(ble,{state:e.state}),(0,$.jsx)(c7,{dimColor:e.state===`pending`||e.state===`skipped`,children:xle(e)}),e.detail===void 0?null:(0,$.jsx)(c7,{dimColor:!0,children:e.detail})]}),Cle=({palette:e,children:t})=>(0,$.jsx)(Xce,{theme:(0,Z.useMemo)(()=>mle(e),[e]),children:(0,$.jsx)(V7.Provider,{value:e,children:t})});var W7=class extends mc(`create-reintersect/CreateEnvironment`)(){};const wle=[``,`0`,`false`],Tle=rk(W7,DD(function*(){let e=yield*_U,t=yield*yF(`CI`).pipe(vF,_F(or(e=>!wle.includes(e.toLowerCase())))),n=yield*yF(`npm_config_user_agent`).pipe(vF),r=yield*AD(()=>re.isTTY===!0&&ie.isTTY===!0);return{argv:v,cwd:e.resolve(`.`),interactive:r&&!t,windows:ne===`win32`,userAgent:n}}).pipe(NO));var Ele=class extends tH()(`CreateNameInvalidError`,{projectName:pz,reason:pz}){},Dle=class extends tH()(`CreateDirectoryNotEmptyError`,{directory:pz}){},Ole=class extends tH()(`CreateSchemaNotApplicableError`,{schema:pz}){},kle=class extends tH()(`CreatePromptCancelledError`,{}){},Ale=class extends tH()(`CreateWriteFailedError`,{path:pz,detail:pz}){},jle=class extends tH()(`CreateCommandUnavailableError`,{command:pz}){},Mle=class extends tH()(`CreateCommandFailedError`,{command:pz,exitCode:mz,output:pz}){};const Nle={exitOnCtrlC:!0},G7=QO(A()),Ple=e=>RD(async()=>{await e.waitUntilRenderFlush(),e.unmount(),await e.waitUntilExit()}).pipe(ID),K7=({asked:e})=>(0,$.jsx)(s7,{flexDirection:`column`,children:e.map(({key:e,view:t})=>(0,$.jsx)(s7,{children:t},e))}),q7=e=>{let t=t=>(0,$.jsx)(Cle,{palette:e,children:t}),n=e=>qD(AD(()=>bce(t(e),Nle)),Ple).pipe(W(e=>({instance:e,rerender:n=>AD(()=>e.rerender(t(n)))}))),r=DD(function*(){let{instance:e,rerender:t}=yield*n((0,$.jsx)(K7,{asked:[]})),r=yield*Hv([]),i=yield*Hv(0),a=kre(()=>e.waitUntilExit()).pipe(GO(V(new kle)));return{ask:(e,{replacesLast:n})=>DD(function*(){let o=yield*HE(),s=yield*qv(i,e=>e+1),c=yield*qv(r,t=>Tr(n?Gr(t,1):t,{key:`question-${s}`,view:e(e=>XE(o,Qy(e)))}));return yield*t((0,$.jsx)(K7,{asked:c})),yield*UE(o).pipe(yO(a))})}});return{renderOnce:e=>eO(WD(n(e))),mountInk:n,withQuestionSession:e=>eO(G(r,t=>TO(e,G7,j(t)))),askInk:(e,t)=>G($O(G7),M({onSome:n=>n.ask(e,t),onNone:()=>eO(G(r,n=>n.ask(e,t)))}))}},J7=({message:e,children:t})=>{let{accent:n}=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:n,children:`?`}),(0,$.jsx)(c7,{bold:!0,children:e}),t]})},Y7=({message:e,answer:t})=>{let{success:n}=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:n,children:`✔`}),(0,$.jsx)(c7,{bold:!0,children:e}),(0,$.jsx)(c7,{dimColor:!0,children:t})]})},Fle=({text:e})=>{let{danger:t}=H7();return(0,$.jsx)(c7,{color:t,children:e})},Ile=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)();return n===void 0?(0,$.jsxs)(s7,{flexDirection:`column`,children:[(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(fle,{placeholder:e.placeholder,onSubmit:n=>{let i=n.trim()===``?e.placeholder:n.trim();r(i),t(i)}})}),M(e.error,{onNone:()=>null,onSome:e=>(0,$.jsx)(Fle,{text:e})})]}):(0,$.jsx)(Y7,{message:e.message,answer:n})},Lle=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)(),i=[...e.choices.filter(t=>t.value===e.initial),...e.choices.filter(t=>t.value!==e.initial)];if(n!==void 0){let t=i.find(e=>e.value===n)?.label??n;return(0,$.jsx)(Y7,{message:e.message,answer:t})}return(0,$.jsxs)(s7,{flexDirection:`column`,children:[(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(c7,{dimColor:!0,children:`Use the arrow keys, then Enter`})}),(0,$.jsx)(ale,{options:i.map(e=>({value:e.value,label:e.hint===void 0?e.label:`${e.label} ${e.hint}`})),onChange:e=>{let n=i.find(t=>t.value===e);n!==void 0&&(r(n.value),t(n.value))}})]})},Rle=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)(),i=e=>()=>{r(e),t(e)};return n===void 0?(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(Qce,{defaultChoice:e.initial?`confirm`:`cancel`,onConfirm:i(!0),onCancel:i(!1)})}):(0,$.jsx)(Y7,{message:e.message,answer:n?`Yes`:`No`})},zle=({version:e})=>{let{accent:t}=H7();return(0,$.jsxs)(s7,{gap:1,marginBottom:1,children:[(0,$.jsx)(c7,{bold:!0,color:t,children:`create-reintersect`}),(0,$.jsx)(c7,{dimColor:!0,children:e})]})},X7=({tasks:e})=>(0,$.jsx)(s7,{flexDirection:`column`,marginTop:1,children:e.map(e=>(0,$.jsx)(Sle,{task:e},e.id))}),Ble=({directory:e,commands:t,notes:n})=>{let{accent:r}=H7();return(0,$.jsxs)(s7,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(c7,{children:[`Your app is ready in `,(0,$.jsx)(c7,{bold:!0,children:e}),`. Next:`]}),(0,$.jsx)(s7,{flexDirection:`column`,paddingLeft:2,marginY:1,children:t.map(e=>(0,$.jsx)(c7,{color:r,children:e},e))}),n.map(e=>(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{dimColor:!0,children:`›`}),(0,$.jsx)(c7,{dimColor:!0,children:e})]},e))]})},Vle=(e,t)=>n=>L(n,n=>n.id===e?{...n,...t}:n),Z7={replacesLast:!1},Hle=e=>{let t=q7(e);return{text:e=>t.askInk(t=>(0,$.jsx)(Ile,{prompt:e,onAnswer:t}),{replacesLast:Gn(e.error)}),select:e=>t.askInk(t=>(0,$.jsx)(Lle,{prompt:e,onAnswer:t}),Z7),confirm:e=>t.askInk(t=>(0,$.jsx)(Rle,{prompt:e,onAnswer:t}),Z7),session:t.withQuestionSession}},Ule=e=>{let t=q7(e);return{intro:e=>t.renderOnce((0,$.jsx)(zle,{version:e})),tasks:(e,n)=>eO(DD(function*(){let r=L(e,e=>({...e,state:`pending`})),i=yield*Hv(r),{rerender:a}=yield*t.mountInk((0,$.jsx)(X7,{tasks:r})),o=(e,t)=>qv(i,Vle(e,t)).pipe(G(e=>a((0,$.jsx)(X7,{tasks:e}))));return yield*n({run:(e,t)=>o(e,{state:`running`}).pipe(GO(t),xO(()=>o(e,{state:`done`})),SO(()=>o(e,{state:`failed`}))),skip:(e,t)=>o(e,{state:`skipped`,detail:t})})})),nextSteps:e=>t.renderOnce((0,$.jsx)(Ble,{...e})),note:e=>t.renderOnce((0,$.jsx)(U7,{text:e,tone:`info`})),failure:e=>t.renderOnce((0,$.jsx)(U7,{text:e,tone:`error`}))}},Wle={intro:e=>NG(`create-reintersect ${e}`),tasks:(e,t)=>{let n=zl(L(e,e=>[e.id,e])),r=(e,t)=>M(Vl(n,e),{onNone:()=>e,onSome:t});return t({run:(e,t)=>NG(`${r(e,({running:e})=>e)}…`).pipe(GO(t),xO(()=>NG(`✔ ${r(e,({done:e})=>e)}`)),SO(()=>MG(`✖ ${r(e,({label:e})=>e)}`))),skip:(e,t)=>NG(`- ${r(e,({label:e})=>e)}: ${t}`)})},nextSteps:({directory:e,commands:t,notes:n})=>xD([``,`Your app is ready in ${e}. Next:`,``,...L(t,e=>` ${e}`),``,...n],e=>NG(e),{discard:!0}),note:e=>NG(e),failure:e=>MG(e)};var Q7=class extends mc(`create-reintersect/CreateOutput`)(){},$7=class extends mc(`create-reintersect/Prompter`)(){};const Gle=rk(Q7,DD(function*(){let{interactive:e}=yield*W7,t=B7(yield*_3);return e?Ule(t):Wle}).pipe(NO)),Kle=rk($7,W(_3,e=>Hle(B7(e))).pipe(NO)),qle={effect:`3.22.1`,"@effect/platform":`0.97.1`,"@effect/platform-node":`0.108.1`,"@effect/vitest":`0.30.0`},e9=`0.1.0`,Jle=[`hosted`,`next`,`hono-bun`,`effect`],Yle=[`zod`,`arktype`,`valibot`],t9=`hosted`,n9=[{value:`hosted`,label:`Reintersect hosting`,hint:`Reintersect runs it on Workers`},{value:`next`,label:`Next.js route`,hint:`Serve it from a Next.js app`},{value:`hono-bun`,label:`Hono on Bun`,hint:`Serve it from a Hono server`},{value:`effect`,label:`Effect`,hint:`Serve it with Effect's HttpLayerRouter`}],Xle=[{value:`zod`,label:`Zod`,hint:`recommended`},{value:`arktype`,label:`ArkType`},{value:`valibot`,label:`Valibot`}],Zle=[{value:`npm`,label:`npm`},{value:`pnpm`,label:`pnpm`},{value:`bun`,label:`Bun`}],r9=[`npm`,`pnpm`,`bun`],Qle=/^([a-z]+)\/(\S+)/u,$le=wR(az(...r9)),eue={name:`npm`,version:A()},i9=e=>x(e,er(e=>Jn(Qle.exec(e))),er(([,e,t])=>$le(e)?j({name:e,version:Jn(t)}):A()),N(()=>eue)),tue=(e,t)=>e.name===t?e:{name:t,version:A()},a9=e=>N(e.version,()=>`11.15.1`),o9=e=>({command:e,args:[`install`]}),s9=(e,t)=>({command:e,args:[`run`,t]}),c9=`reintersect`,l9=(e,t)=>KG(e).pipe(qG(`npm`,()=>({command:`npx`,args:[c9,...t]})),qG(`pnpm`,()=>({command:`pnpm`,args:[`exec`,c9,...t]})),qG(`bun`,()=>({command:`bunx`,args:[c9,...t]})),XG),u9=({command:e,args:t})=>bi([e,...t],` `),d9=e=>{let t=t=>u9(s9(e,t)),n=t=>u9(l9(e,t));return{install:u9(o9(e)),login:n([`login`]),envSet:n([`env`,`set`]),dev:t(`dev`),test:t(`test`),typecheck:t(`typecheck`),check:t(`check`),deploy:t(`deploy`),sandboxCheck:n([`check`,`--json`]),sandboxBuild:n([`build`]),sandboxDeploy:n([`deploy`,`--preview`,`--json`])}},nue={npm:[`package-lock.json`],pnpm:[`pnpm-lock.yaml`],bun:[`bun.lock`,`bun.lockb`]},f9=e=>`\${{ ${e} }}`,p9=e=>`hashFiles(${bi(L(nue[e],e=>`'${e}'`),`, `)})`,m9=[` - uses: actions/setup-node@v6`,` with:`,` node-version: 24`],h9=e=>{let t=`${p9(e)} != '' && '${e}' || ''`;return` cache: ${f9(t)}`},g9=(e,{locked:t,unlocked:n})=>[` - if: ${p9(e)} != ''`,` run: ${t}`,` - if: ${p9(e)} == ''`,` run: ${n}`],rue=e=>KG(e).pipe(qG(`npm`,e=>[...m9,h9(e),...g9(e,{locked:`npm ci`,unlocked:`npm install`})]),qG(`pnpm`,e=>[` - uses: pnpm/action-setup@v4`,...m9,h9(e),...g9(e,{locked:`pnpm install --frozen-lockfile`,unlocked:`pnpm install --no-frozen-lockfile`})]),qG(`bun`,e=>[...m9,` - uses: oven-sh/setup-bun@v2`,...g9(e,{locked:`bun install --frozen-lockfile`,unlocked:`bun install`})]),XG),iue=({packageManager:e})=>bi([`name: Reintersect`,``,`on:`,` push:`,` branches: [main]`,` pull_request:`,` workflow_dispatch:`,``,`permissions:`,` contents: read`,` id-token: write`,` pull-requests: write`,``,`concurrency:`,` group: reintersect-${f9(`github.ref`)}`,` cancel-in-progress: ${f9(`github.event_name == 'pull_request'`)}`,``,`jobs:`,` deploy:`,` runs-on: ubuntu-latest`,` steps:`,` - uses: actions/checkout@v6`,...rue(e),` - uses: reintersect/deploy@v1`,` with:`,` app-id: ${f9(`vars.REINTERSECT_APP_ID`)}`,``],`
|
|
147
|
+
var hle=n((e=>{var t=Symbol.for(`react.transitional.element`);function n(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.jsx=n,e.jsxs=n})),$=n(((e,t)=>{t.exports=hle()}))();const gle={info:`›`,success:`✔`,warning:`!`,error:`✖`},_le=(e,t)=>({info:e.accent,success:e.success,warning:e.warning,error:e.danger})[t],vle={pending:`○`,done:`✔`,skipped:`-`,failed:`✖`},yle=(e,t)=>({pending:void 0,running:e.accent,done:e.success,skipped:void 0,failed:e.danger})[t],U7=({text:e,tone:t})=>{let n=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:_le(n,t),children:gle[t]}),(0,$.jsx)(c7,{children:e})]})},ble=({state:e})=>{let t=H7();return e===`running`?(0,$.jsx)(cle,{}):(0,$.jsx)(c7,{color:yle(t,e),dimColor:e===`pending`||e===`skipped`,children:vle[e]})},xle=({state:e,label:t,running:n,done:r})=>e===`running`?`${n}…`:e===`done`?r:t,Sle=({task:e})=>(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(ble,{state:e.state}),(0,$.jsx)(c7,{dimColor:e.state===`pending`||e.state===`skipped`,children:xle(e)}),e.detail===void 0?null:(0,$.jsx)(c7,{dimColor:!0,children:e.detail})]}),Cle=({palette:e,children:t})=>(0,$.jsx)(Xce,{theme:(0,Z.useMemo)(()=>mle(e),[e]),children:(0,$.jsx)(V7.Provider,{value:e,children:t})});var W7=class extends mc(`create-reintersect/CreateEnvironment`)(){};const wle=[``,`0`,`false`],Tle=rk(W7,DD(function*(){let e=yield*_U,t=yield*yF(`CI`).pipe(vF,_F(or(e=>!wle.includes(e.toLowerCase())))),n=yield*yF(`npm_config_user_agent`).pipe(vF),r=yield*AD(()=>re.isTTY===!0&&ie.isTTY===!0);return{argv:v,cwd:e.resolve(`.`),interactive:r&&!t,windows:ne===`win32`,userAgent:n}}).pipe(NO));var Ele=class extends tH()(`CreateNameInvalidError`,{projectName:pz,reason:pz}){},Dle=class extends tH()(`CreateDirectoryNotEmptyError`,{directory:pz}){},Ole=class extends tH()(`CreateSchemaNotApplicableError`,{schema:pz}){},kle=class extends tH()(`CreatePromptCancelledError`,{}){},Ale=class extends tH()(`CreateWriteFailedError`,{path:pz,detail:pz}){},jle=class extends tH()(`CreateCommandUnavailableError`,{command:pz}){},Mle=class extends tH()(`CreateCommandFailedError`,{command:pz,exitCode:mz,output:pz}){};const Nle={exitOnCtrlC:!0},G7=QO(A()),Ple=e=>RD(async()=>{await e.waitUntilRenderFlush(),e.unmount(),await e.waitUntilExit()}).pipe(ID),K7=({asked:e})=>(0,$.jsx)(s7,{flexDirection:`column`,children:e.map(({key:e,view:t})=>(0,$.jsx)(s7,{children:t},e))}),q7=e=>{let t=t=>(0,$.jsx)(Cle,{palette:e,children:t}),n=e=>qD(AD(()=>bce(t(e),Nle)),Ple).pipe(W(e=>({instance:e,rerender:n=>AD(()=>e.rerender(t(n)))}))),r=DD(function*(){let{instance:e,rerender:t}=yield*n((0,$.jsx)(K7,{asked:[]})),r=yield*Hv([]),i=yield*Hv(0),a=kre(()=>e.waitUntilExit()).pipe(GO(V(new kle)));return{ask:(e,{replacesLast:n})=>DD(function*(){let o=yield*HE(),s=yield*qv(i,e=>e+1),c=yield*qv(r,t=>Tr(n?Gr(t,1):t,{key:`question-${s}`,view:e(e=>XE(o,Qy(e)))}));return yield*t((0,$.jsx)(K7,{asked:c})),yield*UE(o).pipe(yO(a))})}});return{renderOnce:e=>eO(WD(n(e))),mountInk:n,withQuestionSession:e=>eO(G(r,t=>TO(e,G7,j(t)))),askInk:(e,t)=>G($O(G7),M({onSome:n=>n.ask(e,t),onNone:()=>eO(G(r,n=>n.ask(e,t)))}))}},J7=({message:e,children:t})=>{let{accent:n}=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:n,children:`?`}),(0,$.jsx)(c7,{bold:!0,children:e}),t]})},Y7=({message:e,answer:t})=>{let{success:n}=H7();return(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{color:n,children:`✔`}),(0,$.jsx)(c7,{bold:!0,children:e}),(0,$.jsx)(c7,{dimColor:!0,children:t})]})},Fle=({text:e})=>{let{danger:t}=H7();return(0,$.jsx)(c7,{color:t,children:e})},Ile=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)();return n===void 0?(0,$.jsxs)(s7,{flexDirection:`column`,children:[(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(fle,{placeholder:e.placeholder,onSubmit:n=>{let i=n.trim()===``?e.placeholder:n.trim();r(i),t(i)}})}),M(e.error,{onNone:()=>null,onSome:e=>(0,$.jsx)(Fle,{text:e})})]}):(0,$.jsx)(Y7,{message:e.message,answer:n})},Lle=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)(),i=[...e.choices.filter(t=>t.value===e.initial),...e.choices.filter(t=>t.value!==e.initial)];if(n!==void 0){let t=i.find(e=>e.value===n)?.label??n;return(0,$.jsx)(Y7,{message:e.message,answer:t})}return(0,$.jsxs)(s7,{flexDirection:`column`,children:[(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(c7,{dimColor:!0,children:`Use the arrow keys, then Enter`})}),(0,$.jsx)(ale,{options:i.map(e=>({value:e.value,label:e.hint===void 0?e.label:`${e.label} ${e.hint}`})),onChange:e=>{let n=i.find(t=>t.value===e);n!==void 0&&(r(n.value),t(n.value))}})]})},Rle=({prompt:e,onAnswer:t})=>{let[n,r]=(0,Z.useState)(),i=e=>()=>{r(e),t(e)};return n===void 0?(0,$.jsx)(J7,{message:e.message,children:(0,$.jsx)(Qce,{defaultChoice:e.initial?`confirm`:`cancel`,onConfirm:i(!0),onCancel:i(!1)})}):(0,$.jsx)(Y7,{message:e.message,answer:n?`Yes`:`No`})},zle=({version:e})=>{let{accent:t}=H7();return(0,$.jsxs)(s7,{gap:1,marginBottom:1,children:[(0,$.jsx)(c7,{bold:!0,color:t,children:`create-reintersect`}),(0,$.jsx)(c7,{dimColor:!0,children:e})]})},X7=({tasks:e})=>(0,$.jsx)(s7,{flexDirection:`column`,marginTop:1,children:e.map(e=>(0,$.jsx)(Sle,{task:e},e.id))}),Ble=({directory:e,commands:t,notes:n})=>{let{accent:r}=H7();return(0,$.jsxs)(s7,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(c7,{children:[`Your app is ready in `,(0,$.jsx)(c7,{bold:!0,children:e}),`. Next:`]}),(0,$.jsx)(s7,{flexDirection:`column`,paddingLeft:2,marginY:1,children:t.map(e=>(0,$.jsx)(c7,{color:r,children:e},e))}),n.map(e=>(0,$.jsxs)(s7,{gap:1,children:[(0,$.jsx)(c7,{dimColor:!0,children:`›`}),(0,$.jsx)(c7,{dimColor:!0,children:e})]},e))]})},Vle=(e,t)=>n=>L(n,n=>n.id===e?{...n,...t}:n),Z7={replacesLast:!1},Hle=e=>{let t=q7(e);return{text:e=>t.askInk(t=>(0,$.jsx)(Ile,{prompt:e,onAnswer:t}),{replacesLast:Gn(e.error)}),select:e=>t.askInk(t=>(0,$.jsx)(Lle,{prompt:e,onAnswer:t}),Z7),confirm:e=>t.askInk(t=>(0,$.jsx)(Rle,{prompt:e,onAnswer:t}),Z7),session:t.withQuestionSession}},Ule=e=>{let t=q7(e);return{intro:e=>t.renderOnce((0,$.jsx)(zle,{version:e})),tasks:(e,n)=>eO(DD(function*(){let r=L(e,e=>({...e,state:`pending`})),i=yield*Hv(r),{rerender:a}=yield*t.mountInk((0,$.jsx)(X7,{tasks:r})),o=(e,t)=>qv(i,Vle(e,t)).pipe(G(e=>a((0,$.jsx)(X7,{tasks:e}))));return yield*n({run:(e,t)=>o(e,{state:`running`}).pipe(GO(t),xO(()=>o(e,{state:`done`})),SO(()=>o(e,{state:`failed`}))),skip:(e,t)=>o(e,{state:`skipped`,detail:t})})})),nextSteps:e=>t.renderOnce((0,$.jsx)(Ble,{...e})),note:e=>t.renderOnce((0,$.jsx)(U7,{text:e,tone:`info`})),failure:e=>t.renderOnce((0,$.jsx)(U7,{text:e,tone:`error`}))}},Wle={intro:e=>NG(`create-reintersect ${e}`),tasks:(e,t)=>{let n=zl(L(e,e=>[e.id,e])),r=(e,t)=>M(Vl(n,e),{onNone:()=>e,onSome:t});return t({run:(e,t)=>NG(`${r(e,({running:e})=>e)}…`).pipe(GO(t),xO(()=>NG(`✔ ${r(e,({done:e})=>e)}`)),SO(()=>MG(`✖ ${r(e,({label:e})=>e)}`))),skip:(e,t)=>NG(`- ${r(e,({label:e})=>e)}: ${t}`)})},nextSteps:({directory:e,commands:t,notes:n})=>xD([``,`Your app is ready in ${e}. Next:`,``,...L(t,e=>` ${e}`),``,...n],e=>NG(e),{discard:!0}),note:e=>NG(e),failure:e=>MG(e)};var Q7=class extends mc(`create-reintersect/CreateOutput`)(){},$7=class extends mc(`create-reintersect/Prompter`)(){};const Gle=rk(Q7,DD(function*(){let{interactive:e}=yield*W7,t=B7(yield*_3);return e?Ule(t):Wle}).pipe(NO)),Kle=rk($7,W(_3,e=>Hle(B7(e))).pipe(NO)),qle={effect:`3.22.1`,"@effect/platform":`0.97.1`,"@effect/platform-node":`0.108.1`,"@effect/vitest":`0.30.0`},e9=`0.1.3-staging.2f2d4a9f1438`,Jle=[`hosted`,`next`,`hono-bun`,`effect`],Yle=[`zod`,`arktype`,`valibot`],t9=`hosted`,n9=[{value:`hosted`,label:`Reintersect hosting`,hint:`Reintersect runs it on Workers`},{value:`next`,label:`Next.js route`,hint:`Serve it from a Next.js app`},{value:`hono-bun`,label:`Hono on Bun`,hint:`Serve it from a Hono server`},{value:`effect`,label:`Effect`,hint:`Serve it with Effect's HttpLayerRouter`}],Xle=[{value:`zod`,label:`Zod`,hint:`recommended`},{value:`arktype`,label:`ArkType`},{value:`valibot`,label:`Valibot`}],Zle=[{value:`npm`,label:`npm`},{value:`pnpm`,label:`pnpm`},{value:`bun`,label:`Bun`}],r9=[`npm`,`pnpm`,`bun`],Qle=/^([a-z]+)\/(\S+)/u,$le=wR(az(...r9)),eue={name:`npm`,version:A()},i9=e=>x(e,er(e=>Jn(Qle.exec(e))),er(([,e,t])=>$le(e)?j({name:e,version:Jn(t)}):A()),N(()=>eue)),tue=(e,t)=>e.name===t?e:{name:t,version:A()},a9=e=>N(e.version,()=>`11.15.1`),o9=e=>({command:e,args:[`install`]}),s9=(e,t)=>({command:e,args:[`run`,t]}),c9=`reintersect`,l9=(e,t)=>KG(e).pipe(qG(`npm`,()=>({command:`npx`,args:[c9,...t]})),qG(`pnpm`,()=>({command:`pnpm`,args:[`exec`,c9,...t]})),qG(`bun`,()=>({command:`bunx`,args:[c9,...t]})),XG),u9=({command:e,args:t})=>bi([e,...t],` `),d9=e=>{let t=t=>u9(s9(e,t)),n=t=>u9(l9(e,t));return{install:u9(o9(e)),login:n([`login`]),envSet:n([`env`,`set`]),dev:t(`dev`),test:t(`test`),typecheck:t(`typecheck`),check:t(`check`),deploy:t(`deploy`),sandboxCheck:n([`check`,`--json`]),sandboxBuild:n([`build`]),sandboxDeploy:n([`deploy`,`--preview`,`--json`])}},nue={npm:[`package-lock.json`],pnpm:[`pnpm-lock.yaml`],bun:[`bun.lock`,`bun.lockb`]},f9=e=>`\${{ ${e} }}`,p9=e=>`hashFiles(${bi(L(nue[e],e=>`'${e}'`),`, `)})`,m9=[` - uses: actions/setup-node@v6`,` with:`,` node-version: 24`],h9=e=>{let t=`${p9(e)} != '' && '${e}' || ''`;return` cache: ${f9(t)}`},g9=(e,{locked:t,unlocked:n})=>[` - if: ${p9(e)} != ''`,` run: ${t}`,` - if: ${p9(e)} == ''`,` run: ${n}`],rue=e=>KG(e).pipe(qG(`npm`,e=>[...m9,h9(e),...g9(e,{locked:`npm ci`,unlocked:`npm install`})]),qG(`pnpm`,e=>[` - uses: pnpm/action-setup@v4`,...m9,h9(e),...g9(e,{locked:`pnpm install --frozen-lockfile`,unlocked:`pnpm install --no-frozen-lockfile`})]),qG(`bun`,e=>[...m9,` - uses: oven-sh/setup-bun@v2`,...g9(e,{locked:`bun install --frozen-lockfile`,unlocked:`bun install`})]),XG),iue=({packageManager:e})=>bi([`name: Reintersect`,``,`on:`,` push:`,` branches: [main]`,` pull_request:`,` workflow_dispatch:`,``,`permissions:`,` contents: read`,` id-token: write`,` pull-requests: write`,``,`concurrency:`,` group: reintersect-${f9(`github.ref`)}`,` cancel-in-progress: ${f9(`github.event_name == 'pull_request'`)}`,``,`jobs:`,` deploy:`,` runs-on: ubuntu-latest`,` steps:`,` - uses: actions/checkout@v6`,...rue(e),` - uses: reintersect/deploy@v1`,` with:`,` app-id: ${f9(`vars.REINTERSECT_APP_ID`)}`,``],`
|
|
148
148
|
`),_9=`https://developers.reintersect.com`,v9=e=>`${_9}/${e}`,y9=`Look things up in the docs at ${_9}. As an agent, read ${v9(`llms.txt`)}: it's the SDK and API reference for agents.`,aue=e=>`1. \`${e.sandboxCheck}\` checks the app.
|
|
149
149
|
2. \`${e.sandboxBuild}\` bundles it.
|
|
150
150
|
3. \`${e.sandboxDeploy}\` deploys a preview.`,oue=e=>`1. \`${e.sandboxCheck}\` checks the app.
|
|
@@ -187,6 +187,7 @@ ${y9}
|
|
|
187
187
|
| Scopes | Declare the scopes each piece uses, for example \`scopes: ["blocks:write"]\` | Ask for scopes you don't use: widening scopes makes every workspace re-consent |
|
|
188
188
|
| Env | Declare \`env\` once in \`createReintersectApp\` and pass the same object to pieces that read it | Render, log, return or store a secret |
|
|
189
189
|
| Install config | \`installConfig\` on the app, \`config: InstallConfig\` on pieces that read it | Read per-workspace settings from env |
|
|
190
|
+
| App icon | \`icon: "./icon.png"\` in \`createReintersectApp\`: a square PNG, JPEG, GIF, WebP or AVIF file in this project, 1 MB or smaller. When asked for an icon, make the image file yourself (draw or generate it) and point \`icon\` at it. \`reintersect deploy\` uploads it. A preview shows it in the playground; installs see it once that version is published to production, and from then on the code owns the icon | A Lucide icon name (those are for blocks, message actions and components), an SVG, a URL, or telling the member to upload the icon in Settings |
|
|
190
191
|
|
|
191
192
|
${e.stack.template===`effect`?'## Schemas and handlers\n\n- Import every piece from `@reintersect/sdk/effect/app` and describe data with Effect `Schema`. Never mix in `@reintersect/sdk/app` pieces.\n- Handlers are generators: `function* ({ args, state }) { const tasks = yield* Tasks; ... }`. Never pass an `Effect.fn`: it hides the handler\'s context (check warns with `effect-fn-handler`).\n- Services come from Layers. Pieces yield services; `provide(app, Layer)` in `app.ts` supplies them, and `ReintersectApp.layer(app)` mounts the app on `HttpLayerRouter`.\n- Slash command options are a `Schema.Struct` with a `description` annotation on each field. `member()`, `circle()`, `appObject(kind)` and `choice({ value: "Label" })` come from `@reintersect/sdk/effect/app`.\n- A command or message action can return a `Stream` of answers; each element updates the posted answer.\n- Failure types are inferred; there is nothing to declare. Any failure a handler doesn\'t handle answers `handler_failed`, so turn the ones a member should see into a `notice` or `fieldErrors` result with `Effect.catchTag`.\n- Secrets: `secret()` in `env` gives a `Redacted<string>`; read it with `Redacted.value` only where it goes to another API.\n\n## Testing\n\nUse `@effect/vitest` with `makeTestHost` from `@reintersect/sdk/effect/testing`. Deliveries run in the test fiber, so `TestClock` drives time and failures compare as `Exit` values.\n\n```ts\nit.scoped("starts a task", () =>\n Effect.gen(function* () {\n const host = yield* makeTestHost(app, { config: { project: "Website" } });\n\n const block = yield* host.insert(TaskBlock, { id: "TASK-2", title: "Review the pricing page" });\n const result = yield* host.press(block, "Start");\n\n expect(result.state).toEqual({ status: "doing" });\n }),\n);\n```\n\nA deferred command or message action answers with `yield* host.settle` and shows up in `host.pushesOf("invocations.respond")`.\n\nTo swap a service in a test, pass `provide(appWithoutServices, TestLayer)` to `makeTestHost`. `ReintersectTestHost.layer(app)` gives the same host as a layer.':'## Schemas and handlers\n\n- Schemas: any Standard Schema with JSON Schema support works. This project uses the library in `schemas.ts`; Zod 4.2+, ArkType and Valibot wrapped in `toStandardJsonSchema()` are all accepted.\n- Block state schemas must not transform values (no defaults that rewrite, no pipes): state is stored as JSON.\n- Slash command options are one object schema from your library (`TaskOptions` in `schemas.ts`). Every option needs a description. A union of string literals is a choice; give each value a `title` for its label. Mark member, circle and app object options with `member()`, `circle()` or `appObject(kind)` from `@reintersect/sdk/app` (Zod and ArkType), or with `v.metadata(memberOption)` in Valibot. ArkType sorts the keys of an object schema, so use a record of schemas, one per option, when the order matters.\n- Handlers are plain functions or `async` functions. Return values; throw only for bugs. A command or message action that reports stages can be an `async function*`: each `yield` updates the posted answer.\n- Secrets: `secret()` in `env` gives a `Secret`. Call `.reveal()` only where the value goes to another API.\n\n## Testing\n\nUse the Promise kit from `@reintersect/sdk/testing`. It sends signed deliveries through the app\'s real router and checks every rendered tree.\n\n```ts\nconst host = createTestHost(app, { config: { project: "Website" }, env: { TASKS_URL: "https://tasks.example.com" } });\nconst block = await host.insert(TaskBlock, { id: "TASK-2", title: "Review the pricing page" });\nconst result = await host.press(block, "Start");\nexpect(result.state).toEqual({ status: "doing" });\n```\n\nOther host methods: `act(block, "move", args)`, `vote`, `tallies`, `resolveReference(url)`, `searchReferences(kind, query)`, `runCommand(name, options)`, `runMessageAction(id, message, { context })`, `emit(event, data)`, `expectPushed(operation)`, `as(testViewer("Ada"))` and `advance(duration)` for time. A deferred answer arrives after `settle()` as an `invocations.respond` push. `settle()` also runs a streamed answer to the end, and `answersOf(interactionToken)` lists every answer it sent.'}
|
|
192
193
|
|
|
@@ -194,7 +195,7 @@ ${e.stack.template===`effect`?'## Schemas and handlers\n\n- Import every piece f
|
|
|
194
195
|
|
|
195
196
|
1. Change the code in \`${n}/\`.
|
|
196
197
|
2. Cover the change with a test next to the code.
|
|
197
|
-
3. Run \`${t.test}\`, \`${t.typecheck}\` and \`${t.check}\`. \`reintersect check\` renders every block with sample props and checks patterns, scopes, icons and the export. It runs the full validator when you're signed in, and the SDK's structure rules otherwise.
|
|
198
|
+
3. Run \`${t.test}\`, \`${t.typecheck}\` and \`${t.check}\`. \`reintersect check\` renders every block with sample props and checks patterns, scopes, icons, the app icon file and the export. It runs the full validator when you're signed in, and the SDK's structure rules otherwise.
|
|
198
199
|
4. Try it with \`${t.dev}\`. It prints a playground link and sends real deliveries to your local code. Sign in first with \`${t.login}\`. In a Reintersect sandbox, skip this step and follow the next section.
|
|
199
200
|
|
|
200
201
|
${b9(t,e.stack.template)}
|
|
@@ -210,6 +211,7 @@ ${b9(t,e.stack.template)}
|
|
|
210
211
|
| \`pattern-host-unclaimed\` | List every pattern host in the app's \`domains\`, and verify it before sharing the app by link |
|
|
211
212
|
| \`schema-json-failed\` | Describe the value in JSON Schema: a \`jsonSchema\` annotation in Effect Schema, a \`toJsonSchema\` fallback in an ArkType \`scope\` |
|
|
212
213
|
| \`access-widened\` | Expected when you add scopes or hosts: workspaces must approve again |
|
|
214
|
+
| \`app-icon-missing\`, \`app-icon-empty\`, \`app-icon-too-large\`, \`app-icon-unsupported-type\` | Point \`icon\` at an image file in the project that is a PNG, JPEG, GIF, WebP or AVIF of 1 MB or less |
|
|
213
215
|
`},cue=e=>KG(e).pipe(qG(`hosted`,()=>"Reintersect hosts this app on Workers: `reintersect deploy` uploads it."),qG(`next`,()=>`The catch-all Next.js route \`${S9}\` hands everything under \`/api\` to the app: deliveries at \`/api/reintersect\`, app routes and \`/api/mcp\`. Keep other Next.js routes out of \`src/app/api\`. Deploy the Next.js app yourself and keep \`endpoint\` in \`src/reintersect/app.ts\` pointing at it. The project's JSX is Reintersect JSX: start any React page or component you add with \`/** @jsxImportSource react */\`.`),qG(`hono-bun`,()=>"A Hono server on Bun (`src/server.ts`) mounts the app under `/api`; deploy it yourself and keep `endpoint` in `src/app.ts` pointing at it."),qG(`effect`,()=>"`src/server.ts` mounts the app on an Effect `HttpLayerRouter` with `ReintersectApp.layer(app)`; deploy it yourself and keep `endpoint` in `src/app.ts` pointing at it."),XG),lue=e=>{let t=d9(e.packageManager.name),n=C9(e.stack);return`# AGENTS.md
|
|
214
216
|
|
|
215
217
|
${e.name.title} is a Reintersect app built with \`@reintersect/sdk\`. It adds a Task block, task links, a \`/task\` slash command and a File as a task message action to Reintersect.
|
|
@@ -218,6 +220,7 @@ ${e.name.title} is a Reintersect app built with \`@reintersect/sdk\`. It adds a
|
|
|
218
220
|
|
|
219
221
|
- Read \`${D9}\` before you change anything in \`${n}/\`. It holds the SDK rules for this project.
|
|
220
222
|
- The app is composed in \`${n}/app.ts\` and exported as \`export const app\`. Reintersect tooling imports that name; never add a default export.
|
|
223
|
+
- The app's icon is an image file in this project: set \`icon: "./icon.png"\` in \`createReintersectApp\` and \`reintersect deploy\` uploads it. It goes live with the next production version and replaces any icon uploaded in Settings.
|
|
221
224
|
- ${cue(e.stack.template)}
|
|
222
225
|
- ${y9}
|
|
223
226
|
|
|
@@ -1071,7 +1074,7 @@ export {
|
|
|
1071
1074
|
serve as PUT,
|
|
1072
1075
|
};
|
|
1073
1076
|
`)]),qG(`hono-bun`,()=>[G9(`src/server.ts`,zue(e.name))]),qG(`effect`,()=>[G9(`src/server.ts`,wue(x9))]),qG(`hosted`,()=>[]),XG),Xue=e=>{let t=C9(e.stack);return[G9(`package.json`,kue(e)),G9(`tsconfig.json`,que(e.stack)),G9(`.gitignore`,Vue(e.stack)),G9(`.dev.vars.example`,Hue),...w9(e.stack)?[G9(`.env.example`,Uue)]:[],G9(`README.md`,Nue(e)),G9(`AGENTS.md`,lue(e)),G9(`CLAUDE.md`,`@AGENTS.md
|
|
1074
|
-
`),G9(D9,sue(e)),G9(`.github/workflows/reintersect.yml`,iue({packageManager:e.packageManager.name})),...L(Object.entries(Jue(e)),([e,n])=>G9(`${t}/${e}`,n)),...Yue(e),...e.packageManager.name===`pnpm`?[G9(`pnpm-workspace.yaml`,Wue(e.packageManager))]:[]]};var K9=class extends mc(`create-reintersect/ProcessRunner`)(){};const Zue=rk(K9,DD(function*(){let e=yield*aG,t=yield*W7,n=({command:e,args:n,cwd:r})=>$W(e,...n).pipe(iG(r),eG(t.windows)),r=t=>e.exitCode(n(t).pipe(nG(`inherit`),rG(`inherit`),tG(`inherit`))).pipe(W(e=>({exitCode:Number(e),output:``}))),i=t=>e.start(n(t)).pipe(G(e=>bD({output:fP(e.stdout,e.stderr).pipe(bP(),pP),exitCode:W(e.exitCode,Number)},{concurrency:`unbounded`})),eO),a=e=>()=>V(new jle({command:e}));return{run:e=>KG(e.output).pipe(qG(`inherit`,()=>r(e)),qG(`capture`,()=>i(e)),XG,FD({BadArgument:a(e.command),SystemError:a(e.command)}))}})),Que=JO(`create.offerLoginAndDev`)(function*(e){let t=yield*$7,n=yield*Q7,r=yield*K9,{flags:i,installed:a,interactive:o,plan:s}=e,c=d9(s.packageManager.name),l=(e,n)=>e||!o?H(e):t.confirm({message:n,initial:!0}),u=e=>r.run({...e,cwd:s.directory,output:`inherit`});if(!a){let e=i.login||i.dev;return yield*gO(n.note(`Install the dependencies first, then run ${c.login} and ${c.dev}.`),()=>e).pipe(WD)}if(!(!(yield*l(i.login,`Sign in to Reintersect now?`))||(yield*u(l9(s.packageManager.name,[`login`]))).exitCode===0))return yield*n.note(`Sign-in didn't finish. Run ${c.login} when you're ready.`);let d=yield*l(i.dev,`Start the dev server now?`);yield*gO(u(s9(s.packageManager.name,`dev`)),()=>d).pipe(WD)}),$ue=`account.accounts.admin.api.app.apps.assets.auth.billing.blog.cdn.dashboard.dev.dispatch.docs.download.help.login.logout.mail.oauth.pay.payments.preview.security.settings.signin.signup.sso.staging.static.status.support.verify.www`.split(`.`),ede=[`admin`,`administrator`,`moderator`,`owner`,`security`,`support`,`system`],tde=e=>ti($ue,e)||e.startsWith(`reintersect`),nde=e=>{let t=e.normalize(`NFKC`).toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return ti(ede,t)||t.startsWith(`reintersect`)},q9=`my-reintersect-app`,rde=/^[a-z0-9][a-z0-9._-]*$/u,ide=e=>e.replace(/[^a-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,32).replace(/-+$/u,``),ade=e=>x(e.split(/[-._]+/u),di(lE),L(cE),bi(` `)),J9=(e,t)=>Cn(new Ele({projectName:e,reason:t})),ode=e=>{let t=e.trim().toLowerCase().replace(/\s+/gu,`-`),n=ide(t),r=ade(t);return t===``?J9(e,`Type a name for your app.`):t.length>214?J9(e,`Keep the name under 214 characters.`):rde.test(t)?n.length<3?J9(e,`Use at least 3 letters or digits.`):tde(n)||nde(r)?J9(e,`Reintersect keeps this name for itself. Pick another one.`):Sn({packageName:t,slug:n,title:r}):J9(e,`Use lowercase letters, digits, dashes, dots or underscores, starting with a letter or digit.`)},sde=[`.git`,`.DS_Store`],Y9=JO(`create.checkTarget`)(function*(e,t){let n=yield*nU,r=yield*_U,i=r.resolve(t,e),a=yield*ode(r.basename(i)),o=yield*n.readDirectory(i).pipe(IO(()=>[]));return hi(o,e=>!sde.includes(e))?yield*new Dle({directory:i}):{directory:i,name:a}}),X9=(e,t)=>DD(function*(){let n=yield*(yield*$7).text({message:`What's your app called?`,placeholder:q9,error:t});return yield*Y9(n,e).pipe(FD({CreateNameInvalidError:({reason:t})=>X9(e,j(t)),CreateDirectoryNotEmptyError:()=>X9(e,j(`The folder ${n} isn't empty. Pick another name.`))}))}),cde=JO(`create.resolveAnswers`)(function*(e){let t=yield*$7,{cwd:n,detected:r,flags:i,interactive:a}=e,o=(e,t,n)=>M(e,{onSome:H,onNone:()=>a?n():H(t)}),s=yield*M(i.directory,{onSome:e=>Y9(e,n),onNone:()=>a?X9(n,A()):Y9(q9,n)}),c=yield*o(i.template,t9,()=>t.select({message:`How should your app run?`,choices:n9,initial:t9})),l=yield*KG(c).pipe(qG(`effect`,()=>M(i.schema,{onNone:()=>H({template:`effect`}),onSome:e=>V(new Ole({schema:e}))})),YG(e=>o(i.schema,`zod`,()=>t.select({message:`Which schema library?`,choices:Xle,initial:`zod`})).pipe(W(t=>({template:e,schema:t}))))),u=yield*o(i.packageManager,r.name,()=>t.select({message:`Which package manager?`,choices:Zle,initial:r.name}));return{...s,stack:l,packageManager:tue(r,u)}}),lde=JO(`create.writeProject`)(function*(e,t){let n=yield*nU,r=yield*_U;yield*xD(t,t=>{let i=r.join(e,t.path);return n.makeDirectory(r.dirname(i),{recursive:!0}).pipe(GO(n.writeFileString(i,t.content)),KD(e=>new Ale({path:i,detail:e.message})))},{discard:!0})}),ude=JO(`create.installDependencies`)(function*(e,t){let n=yield*K9,r=o9(e.packageManager.name),i=yield*n.run({...r,cwd:e.directory,output:t});if(i.exitCode!==0)return yield*new Mle({command:u9(r),exitCode:i.exitCode,output:i.output})}),dde=[{args:[`init`,`--quiet`],failure:`git couldn't create the repository`},{args:[`add`,`--all`],failure:`git couldn't add the files`},{args:[`commit`,`--quiet`,`--message`,`Initial commit from create-reintersect`],failure:`created without a first commit: set your git name and email, then commit`}],fde=JO(`create.initGit`)(function*(e){let t=yield*K9,n=n=>t.run({command:`git`,args:n,cwd:e,output:`capture`});if((yield*n([`rev-parse`,`--is-inside-work-tree`])).exitCode===0)return j(`already inside a git repository`);let r=yield*Dre(dde,({args:e})=>W(n(e),({exitCode:e})=>e!==0));return $n(r,({failure:e})=>e)},PD(`CreateCommandUnavailableError`,()=>OD(`git isn't installed`))),pde=/[\s"'$`\\]/u,mde=e=>pde.test(e)?JSON.stringify(e):e,hde=(e,t)=>{let n=d9(e.packageManager.name);return{directory:t.relative===``?`this folder`:t.relative,commands:[...t.relative===``?[]:[`cd ${mde(t.relative)}`],...t.installed?[]:[n.install],n.login,n.dev],notes:[`README.md explains how to deploy from GitHub.`,`AGENTS.md and the reintersect-app skill teach coding agents the SDK.`]}},gde=JO(`create`)(function*(e){let t=yield*W7,n=yield*Q7,r=yield*$7,i=yield*_U;yield*n.intro(e9);let a=t.interactive&&!e.yes,o={...yield*cde({flags:e,interactive:a,cwd:t.cwd,detected:i9(t.userAgent)}).pipe(e=>a?r.session(e):e),sdkVersion:`0.4.
|
|
1077
|
+
`),G9(D9,sue(e)),G9(`.github/workflows/reintersect.yml`,iue({packageManager:e.packageManager.name})),...L(Object.entries(Jue(e)),([e,n])=>G9(`${t}/${e}`,n)),...Yue(e),...e.packageManager.name===`pnpm`?[G9(`pnpm-workspace.yaml`,Wue(e.packageManager))]:[]]};var K9=class extends mc(`create-reintersect/ProcessRunner`)(){};const Zue=rk(K9,DD(function*(){let e=yield*aG,t=yield*W7,n=({command:e,args:n,cwd:r})=>$W(e,...n).pipe(iG(r),eG(t.windows)),r=t=>e.exitCode(n(t).pipe(nG(`inherit`),rG(`inherit`),tG(`inherit`))).pipe(W(e=>({exitCode:Number(e),output:``}))),i=t=>e.start(n(t)).pipe(G(e=>bD({output:fP(e.stdout,e.stderr).pipe(bP(),pP),exitCode:W(e.exitCode,Number)},{concurrency:`unbounded`})),eO),a=e=>()=>V(new jle({command:e}));return{run:e=>KG(e.output).pipe(qG(`inherit`,()=>r(e)),qG(`capture`,()=>i(e)),XG,FD({BadArgument:a(e.command),SystemError:a(e.command)}))}})),Que=JO(`create.offerLoginAndDev`)(function*(e){let t=yield*$7,n=yield*Q7,r=yield*K9,{flags:i,installed:a,interactive:o,plan:s}=e,c=d9(s.packageManager.name),l=(e,n)=>e||!o?H(e):t.confirm({message:n,initial:!0}),u=e=>r.run({...e,cwd:s.directory,output:`inherit`});if(!a){let e=i.login||i.dev;return yield*gO(n.note(`Install the dependencies first, then run ${c.login} and ${c.dev}.`),()=>e).pipe(WD)}if(!(!(yield*l(i.login,`Sign in to Reintersect now?`))||(yield*u(l9(s.packageManager.name,[`login`]))).exitCode===0))return yield*n.note(`Sign-in didn't finish. Run ${c.login} when you're ready.`);let d=yield*l(i.dev,`Start the dev server now?`);yield*gO(u(s9(s.packageManager.name,`dev`)),()=>d).pipe(WD)}),$ue=`account.accounts.admin.api.app.apps.assets.auth.billing.blog.cdn.dashboard.dev.dispatch.docs.download.help.login.logout.mail.oauth.pay.payments.preview.security.settings.signin.signup.sso.staging.static.status.support.verify.www`.split(`.`),ede=[`admin`,`administrator`,`moderator`,`owner`,`security`,`support`,`system`],tde=e=>ti($ue,e)||e.startsWith(`reintersect`),nde=e=>{let t=e.normalize(`NFKC`).toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return ti(ede,t)||t.startsWith(`reintersect`)},q9=`my-reintersect-app`,rde=/^[a-z0-9][a-z0-9._-]*$/u,ide=e=>e.replace(/[^a-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,32).replace(/-+$/u,``),ade=e=>x(e.split(/[-._]+/u),di(lE),L(cE),bi(` `)),J9=(e,t)=>Cn(new Ele({projectName:e,reason:t})),ode=e=>{let t=e.trim().toLowerCase().replace(/\s+/gu,`-`),n=ide(t),r=ade(t);return t===``?J9(e,`Type a name for your app.`):t.length>214?J9(e,`Keep the name under 214 characters.`):rde.test(t)?n.length<3?J9(e,`Use at least 3 letters or digits.`):tde(n)||nde(r)?J9(e,`Reintersect keeps this name for itself. Pick another one.`):Sn({packageName:t,slug:n,title:r}):J9(e,`Use lowercase letters, digits, dashes, dots or underscores, starting with a letter or digit.`)},sde=[`.git`,`.DS_Store`],Y9=JO(`create.checkTarget`)(function*(e,t){let n=yield*nU,r=yield*_U,i=r.resolve(t,e),a=yield*ode(r.basename(i)),o=yield*n.readDirectory(i).pipe(IO(()=>[]));return hi(o,e=>!sde.includes(e))?yield*new Dle({directory:i}):{directory:i,name:a}}),X9=(e,t)=>DD(function*(){let n=yield*(yield*$7).text({message:`What's your app called?`,placeholder:q9,error:t});return yield*Y9(n,e).pipe(FD({CreateNameInvalidError:({reason:t})=>X9(e,j(t)),CreateDirectoryNotEmptyError:()=>X9(e,j(`The folder ${n} isn't empty. Pick another name.`))}))}),cde=JO(`create.resolveAnswers`)(function*(e){let t=yield*$7,{cwd:n,detected:r,flags:i,interactive:a}=e,o=(e,t,n)=>M(e,{onSome:H,onNone:()=>a?n():H(t)}),s=yield*M(i.directory,{onSome:e=>Y9(e,n),onNone:()=>a?X9(n,A()):Y9(q9,n)}),c=yield*o(i.template,t9,()=>t.select({message:`How should your app run?`,choices:n9,initial:t9})),l=yield*KG(c).pipe(qG(`effect`,()=>M(i.schema,{onNone:()=>H({template:`effect`}),onSome:e=>V(new Ole({schema:e}))})),YG(e=>o(i.schema,`zod`,()=>t.select({message:`Which schema library?`,choices:Xle,initial:`zod`})).pipe(W(t=>({template:e,schema:t}))))),u=yield*o(i.packageManager,r.name,()=>t.select({message:`Which package manager?`,choices:Zle,initial:r.name}));return{...s,stack:l,packageManager:tue(r,u)}}),lde=JO(`create.writeProject`)(function*(e,t){let n=yield*nU,r=yield*_U;yield*xD(t,t=>{let i=r.join(e,t.path);return n.makeDirectory(r.dirname(i),{recursive:!0}).pipe(GO(n.writeFileString(i,t.content)),KD(e=>new Ale({path:i,detail:e.message})))},{discard:!0})}),ude=JO(`create.installDependencies`)(function*(e,t){let n=yield*K9,r=o9(e.packageManager.name),i=yield*n.run({...r,cwd:e.directory,output:t});if(i.exitCode!==0)return yield*new Mle({command:u9(r),exitCode:i.exitCode,output:i.output})}),dde=[{args:[`init`,`--quiet`],failure:`git couldn't create the repository`},{args:[`add`,`--all`],failure:`git couldn't add the files`},{args:[`commit`,`--quiet`,`--message`,`Initial commit from create-reintersect`],failure:`created without a first commit: set your git name and email, then commit`}],fde=JO(`create.initGit`)(function*(e){let t=yield*K9,n=n=>t.run({command:`git`,args:n,cwd:e,output:`capture`});if((yield*n([`rev-parse`,`--is-inside-work-tree`])).exitCode===0)return j(`already inside a git repository`);let r=yield*Dre(dde,({args:e})=>W(n(e),({exitCode:e})=>e!==0));return $n(r,({failure:e})=>e)},PD(`CreateCommandUnavailableError`,()=>OD(`git isn't installed`))),pde=/[\s"'$`\\]/u,mde=e=>pde.test(e)?JSON.stringify(e):e,hde=(e,t)=>{let n=d9(e.packageManager.name);return{directory:t.relative===``?`this folder`:t.relative,commands:[...t.relative===``?[]:[`cd ${mde(t.relative)}`],...t.installed?[]:[n.install],n.login,n.dev],notes:[`README.md explains how to deploy from GitHub.`,`AGENTS.md and the reintersect-app skill teach coding agents the SDK.`]}},gde=JO(`create`)(function*(e){let t=yield*W7,n=yield*Q7,r=yield*$7,i=yield*_U;yield*n.intro(e9);let a=t.interactive&&!e.yes,o={...yield*cde({flags:e,interactive:a,cwd:t.cwd,detected:i9(t.userAgent)}).pipe(e=>a?r.session(e):e),sdkVersion:`0.4.3-staging.2f2d4a9f1438`},s=!e.noInstall,c=[{id:`files`,label:`Write your app`,running:`Writing your app`,done:`Wrote your app`},{id:`install`,label:`Install dependencies with ${o.packageManager.name}`,running:`Installing dependencies with ${o.packageManager.name}`,done:`Installed dependencies with ${o.packageManager.name}`},{id:`git`,label:`Create a git repository`,running:`Creating a git repository`,done:`Created a git repository`}];yield*n.tasks(c,n=>DD(function*(){yield*n.run(`files`,lde(o.directory,Xue(o))),yield*pO(s,{onTrue:()=>n.run(`install`,ude(o,t.interactive?`capture`:`inherit`)),onFalse:()=>n.skip(`install`,`skipped with --no-install`)});let r=yield*pO(e.noGit,{onTrue:()=>OD(`skipped with --no-git`),onFalse:()=>n.run(`git`,fde(o.directory))});yield*M(r,{onNone:()=>U,onSome:e=>n.skip(`git`,e)})})),yield*n.nextSteps(hde(o,{relative:i.relative(t.cwd,o.directory),installed:s})),yield*Que({plan:o,flags:e,interactive:a,installed:s})}),Z9=`create-reintersect`,Q9=C4(Z9,{directory:K1({name:`directory`}).pipe(G1),template:m2(`template`,Jle).pipe(g2(`t`),h2),schema:m2(`schema`,Yle).pipe(h2),packageManager:m2(`pm`,r9).pipe(h2),yes:p2(`yes`).pipe(g2(`y`)),noInstall:p2(`no-install`),noGit:p2(`no-git`),login:p2(`login`),dev:p2(`dev`)},gde),$9=l3(Q9.descriptor),_de=c3([$9]),vde=e=>x(e.trimEnd().split(`
|
|
1075
1078
|
`),Vr(20),bi(`
|
|
1076
1079
|
`)),yde=e=>KG(e).pipe(JG({CreateNameInvalidError:({projectName:e,reason:t})=>`"${e}" can't be an app name. ${t}`,CreateDirectoryNotEmptyError:({directory:e})=>`${e} isn't empty. Pick a new folder or empty this one first.`,CreateSchemaNotApplicableError:({schema:e})=>`The effect template uses Effect Schema, so --schema ${e} doesn't apply. Drop --schema.`,CreatePromptCancelledError:()=>`Cancelled.`,CreateWriteFailedError:({path:e,detail:t})=>`Couldn't write ${e}. Check that you can write to that folder.\n${t}`,CreateCommandUnavailableError:({command:e})=>`${e} isn't installed or isn't on your PATH.`,CreateCommandFailedError:({command:e,exitCode:t,output:n})=>bi(di([vde(n),`${e} failed with exit code ${t}. Fix the problem above, then run ${e} in your app's folder.`],e=>e!==``),`
|
|
1077
1080
|
|