eser 4.1.23 → 4.1.26
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/chunks/add-ORJYWG26.js +7 -0
- package/chunks/{anthropic-GBDSASP5.js → anthropic-SL274RBQ.js} +1 -1
- package/chunks/approve-5NJ4JWD3.js +1 -0
- package/chunks/ask-TFJCKH5G.js +2 -0
- package/chunks/block-ADHHHUFZ.js +1 -0
- package/chunks/{browser-6UKLTPJO.js → browser-XCMD2IZQ.js} +1 -1
- package/chunks/{build-VKOO2WEA.js → build-2W7YVR7J.js} +2 -2
- package/chunks/{bun-N3TIWBPP.js → bun-YFFBDKUJ.js} +1 -1
- package/chunks/changelog-gen-LV5VWTZS.js +7 -0
- package/chunks/chunk-2J2PXBOC.js +1 -0
- package/chunks/{chunk-NIX3WX3O.js → chunk-3EFU5R2M.js} +1 -1
- package/chunks/{chunk-7GS5KPVF.js → chunk-3I4JG3PJ.js} +1 -1
- package/chunks/{chunk-7QNRH7OR.js → chunk-3K42AALS.js} +1 -1
- package/chunks/{chunk-TMFPDVYN.js → chunk-3OEM65F2.js} +17 -17
- package/chunks/{chunk-RGUC6KAZ.js → chunk-4H4O3TGK.js} +1 -1
- package/chunks/{chunk-V5HTJPFW.js → chunk-4HAIX3WN.js} +3 -3
- package/chunks/chunk-4VL2RZIN.js +1 -0
- package/chunks/chunk-5AK4OGCO.js +1 -0
- package/chunks/chunk-5MN3MWQN.js +1 -0
- package/chunks/chunk-5RK3346P.js +4 -0
- package/chunks/chunk-6HYGGBEQ.js +1 -0
- package/chunks/{chunk-PLRSDG6G.js → chunk-762C2IM6.js} +1 -1
- package/chunks/{chunk-NZFUFGOC.js → chunk-AAV7D6DF.js} +1 -1
- package/chunks/{chunk-DLVQNMNV.js → chunk-AKJB4CER.js} +1 -1
- package/chunks/{chunk-NSZ4HGDI.js → chunk-ANY26ROY.js} +1 -1
- package/chunks/{chunk-IAWIWTDY.js → chunk-AYSPDG4K.js} +1 -1
- package/chunks/{chunk-DOV5776P.js → chunk-BCHXUKWW.js} +2 -2
- package/chunks/{chunk-3DMTTLUJ.js → chunk-BDTJR6UH.js} +1 -1
- package/chunks/{chunk-BP2MZX2P.js → chunk-C3PZVQ3Z.js} +1 -1
- package/chunks/{chunk-M5TBBQQC.js → chunk-CKD2KOHA.js} +3 -3
- package/chunks/chunk-CPRLAMEG.js +1 -0
- package/chunks/chunk-DWYVBWBP.js +91 -0
- package/chunks/{chunk-PBSR4XR2.js → chunk-ETMOOGY2.js} +1 -1
- package/chunks/chunk-G34MS4XJ.js +1 -0
- package/chunks/chunk-GVSBZ6JV.js +1 -0
- package/chunks/{chunk-C3OSYHJY.js → chunk-H4OFOQQ2.js} +1 -1
- package/chunks/{chunk-XWYLEYLY.js → chunk-HTBLWLKV.js} +1 -1
- package/chunks/chunk-JOXKA7TJ.js +7 -0
- package/chunks/{chunk-JQHMDTPL.js → chunk-KAEAT6A4.js} +1 -1
- package/chunks/chunk-LO424HF3.js +60 -0
- package/chunks/chunk-LOFP256P.js +1 -0
- package/chunks/{chunk-O2MNBI7V.js → chunk-MBC2JM7F.js} +1 -1
- package/chunks/{chunk-2R4MK2KR.js → chunk-MYSTBVWT.js} +1 -1
- package/chunks/chunk-NGZZAQ7G.js +1 -0
- package/chunks/chunk-NLNSK3KE.js +1 -0
- package/chunks/chunk-NT2MQK7O.js +6 -0
- package/chunks/{chunk-SJQWPBMJ.js → chunk-NTPOK5H6.js} +1 -1
- package/chunks/{chunk-DZD6MI45.js → chunk-PO3SXFUE.js} +1 -1
- package/chunks/chunk-Q54LOR4S.js +2 -0
- package/chunks/{chunk-5C7ZQN6X.js → chunk-QIODVVTY.js} +1 -1
- package/chunks/{chunk-ZY72QNKZ.js → chunk-QIYWONJL.js} +1 -1
- package/chunks/chunk-QZY4BKI7.js +1 -0
- package/chunks/chunk-RBB5ITAS.js +2 -0
- package/chunks/chunk-RYLOB2JU.js +1 -0
- package/chunks/{chunk-VFMYWG2I.js → chunk-SBOTNOWZ.js} +1 -1
- package/chunks/{chunk-Z7742D7Q.js → chunk-SG4G3OOO.js} +1 -1
- package/chunks/{chunk-FGDJVQG3.js → chunk-TTYO2XJO.js} +1 -1
- package/chunks/{chunk-EW5NCPPE.js → chunk-TUTRX7VR.js} +3 -3
- package/chunks/{chunk-UJX2S56V.js → chunk-TXL6YOFL.js} +1 -1
- package/chunks/{chunk-4Q3SEHPE.js → chunk-U47ABJCC.js} +1 -1
- package/chunks/chunk-U65FD6J3.js +1 -0
- package/chunks/{chunk-7M3ONEMO.js → chunk-UKYKMDYU.js} +1 -1
- package/chunks/{chunk-DRQWYJMH.js → chunk-UNL4H5EY.js} +1 -1
- package/chunks/{chunk-ATLUGTI7.js → chunk-V2N5L24J.js} +2 -2
- package/chunks/chunk-VVHXAOEH.js +1 -0
- package/chunks/{chunk-HPVL4BVQ.js → chunk-W3REWI3H.js} +2 -2
- package/chunks/{chunk-MQH4XBFN.js → chunk-XMCQMTAA.js} +1 -1
- package/chunks/chunk-YMY2URYM.js +1 -0
- package/chunks/{chunk-XJ3VEVYL.js → chunk-YQU3TEIG.js} +1 -1
- package/chunks/chunk-YWCEHTZB.js +2 -0
- package/chunks/chunk-YXSB6RET.js +1 -0
- package/chunks/chunk-Z4WPWVC7.js +10 -0
- package/chunks/chunk-ZED5RIVL.js +1 -0
- package/chunks/chunk-ZH37DSUQ.js +1 -0
- package/chunks/claude-code-K37KYX7W.js +1 -0
- package/chunks/clone-PAQMCIA3.js +5 -0
- package/chunks/{commitmsg-SQRQONCS.js → commitmsg-ZGOEO5YG.js} +2 -2
- package/chunks/{deno-PZXN5K3J.js → deno-MMJLKXAE.js} +1 -1
- package/chunks/{dev-FLO2KEPZ.js → dev-JHAHGTZP.js} +2 -2
- package/chunks/file-tools-shared-77P7MI54.js +1 -0
- package/chunks/gemini-ARTUPDPZ.js +1 -0
- package/chunks/gh-SXEDNWHD.js +4 -0
- package/chunks/{gh-contributors-5SHGJHAQ.js → gh-contributors-G3QZZAUO.js} +3 -3
- package/chunks/init-3GXDO32O.js +1 -0
- package/chunks/init-IPZHDMAH.js +12 -0
- package/chunks/install-VY2L6NDB.js +2 -0
- package/chunks/kiro-XQDHURLU.js +1 -0
- package/chunks/{list-MN7OUE52.js → list-2RZIQZGH.js} +1 -1
- package/chunks/{list-B7L4FZKG.js → list-DSVIPH45.js} +1 -1
- package/chunks/{list-UZKWSA4S.js → list-V2HZCPDN.js} +1 -1
- package/chunks/load-config-KG4RTCR2.js +1 -0
- package/chunks/{main-WVXCURBF.js → main-FQFNY7SM.js} +2 -2
- package/chunks/manifest-5CYL3HR3.js +1 -0
- package/chunks/mod-5ACKR2OE.js +1 -0
- package/chunks/{mod-PEAFMI6F.js → mod-CUIGNRIK.js} +1 -1
- package/chunks/mod-NSY6WUYH.js +27 -0
- package/chunks/mod-QJMMYECF.js +10 -0
- package/chunks/mod-T76TRJWM.js +1 -0
- package/chunks/{mod-CI56JMO4.js → mod-TLLZ3NAM.js} +2 -2
- package/chunks/mod-TSU5UWXA.js +1 -0
- package/chunks/{mod-JTBNNSZZ.js → mod-U6LEXPVR.js} +1 -1
- package/chunks/{mod-MKMQWZ6G.js → mod-VZPKQ7DG.js} +1 -1
- package/chunks/mod-WYRORC72.js +1 -0
- package/chunks/new-EAETGSIR.js +4 -0
- package/chunks/next-F2BIIAZC.js +3 -0
- package/chunks/{node-VPHAK3FD.js → node-SMAAGOR3.js} +1 -1
- package/chunks/ollama-6JZ2IKR7.js +1 -0
- package/chunks/opencode-CHIAJALZ.js +1 -0
- package/chunks/recipe-applier-R4YJPGQR.js +1 -0
- package/chunks/registry-fetcher-J6X32PGP.js +1 -0
- package/chunks/{release-YJOLKWDT.js → release-6PVE4O6P.js} +2 -2
- package/chunks/release-notes-734LKEJB.js +3 -0
- package/chunks/release-tag-YX727TXO.js +1 -0
- package/chunks/reset-PAPDZIDC.js +1 -0
- package/chunks/rule-4GNOR3GE.js +2 -0
- package/chunks/{run-7JXDS75G.js → run-ES4BLQQX.js} +1 -1
- package/chunks/{scripts-RSK5XDRW.js → scripts-COIXD5AD.js} +1 -1
- package/chunks/{serve-U6IXMGXQ.js → serve-B4V2BCWM.js} +2 -2
- package/chunks/{server-PXE4DB3V.js → server-RYWDAYED.js} +1 -1
- package/chunks/spec-SNAUMQSR.js +1 -0
- package/chunks/status-CY5IKIYS.js +1 -0
- package/chunks/sync-OAPV43JS.js +1 -0
- package/chunks/system-5A6DQLM5.js +1 -0
- package/chunks/system-5LLFPIWV.js +1 -0
- package/chunks/update-O75M4SDJ.js +5 -0
- package/chunks/validate-bom-6G7EYFOP.js +1 -0
- package/chunks/validate-case-conflict-OWHWRTSQ.js +1 -0
- package/chunks/validate-circular-deps-TCYSZKME.js +1 -0
- package/chunks/validate-commit-msg-UPJJ7E4M.js +1 -0
- package/chunks/validate-docs-ZTCE5XLF.js +1 -0
- package/chunks/validate-eof-6RMNMAWI.js +1 -0
- package/chunks/validate-export-names-5ZVQ4PGM.js +1 -0
- package/chunks/validate-filenames-5YB27RN4.js +1 -0
- package/chunks/validate-json-6CLTN4AN.js +1 -0
- package/chunks/validate-large-files-KEMHYWKH.js +1 -0
- package/chunks/validate-licenses-WIVY6G5Z.js +1 -0
- package/chunks/validate-line-endings-KNFYAVBG.js +1 -0
- package/chunks/validate-merge-conflict-PYKGIFY5.js +1 -0
- package/chunks/validate-mod-exports-X5UZPD7J.js +1 -0
- package/chunks/validate-package-configs-SYKEIB53.js +1 -0
- package/chunks/validate-secrets-BWDFWN64.js +1 -0
- package/chunks/validate-shebangs-MP6VTLWO.js +1 -0
- package/chunks/validate-submodules-RQXISWKG.js +1 -0
- package/chunks/validate-symlinks-IPRYMDZD.js +1 -0
- package/chunks/validate-toml-KJZK7QVM.js +1 -0
- package/chunks/validate-trailing-whitespace-RO42VWQG.js +1 -0
- package/chunks/validate-yaml-H7G726ZM.js +1 -0
- package/chunks/versions-KW5UTMNV.js +1 -0
- package/chunks/vertexai-TPGIAJNA.js +1 -0
- package/chunks/workerd-LKKH32SO.js +1 -0
- package/eser.js +1 -1
- package/package.json +1 -1
- package/chunks/add-4LRHVBEC.js +0 -7
- package/chunks/approve-364KOMLB.js +0 -1
- package/chunks/ask-752YJEHO.js +0 -2
- package/chunks/block-JVJQU723.js +0 -1
- package/chunks/changelog-gen-ZCNNOY7G.js +0 -7
- package/chunks/chunk-2TRQKCFC.js +0 -1
- package/chunks/chunk-3TYZYY77.js +0 -1
- package/chunks/chunk-4HMEWMWL.js +0 -1
- package/chunks/chunk-5O7V5P53.js +0 -1
- package/chunks/chunk-5UGVJVIQ.js +0 -1
- package/chunks/chunk-6YRN6OJC.js +0 -2
- package/chunks/chunk-BKVQBSFV.js +0 -6
- package/chunks/chunk-CDLEA2PD.js +0 -1
- package/chunks/chunk-GRTR6TNJ.js +0 -1
- package/chunks/chunk-H2JGLZIR.js +0 -1
- package/chunks/chunk-HVMMNGY5.js +0 -7
- package/chunks/chunk-L2BYHWDC.js +0 -1
- package/chunks/chunk-LRL56YFE.js +0 -1
- package/chunks/chunk-LU3DHXOC.js +0 -2
- package/chunks/chunk-NADES3GN.js +0 -1
- package/chunks/chunk-QIUIPRJP.js +0 -1
- package/chunks/chunk-R6F4EK2B.js +0 -4
- package/chunks/chunk-RUZDG5PT.js +0 -60
- package/chunks/chunk-SCCNNGD4.js +0 -2
- package/chunks/chunk-SCULX2ND.js +0 -1
- package/chunks/chunk-VGFZXQMW.js +0 -1
- package/chunks/chunk-WE7PSSAQ.js +0 -91
- package/chunks/chunk-X4ZCYXOT.js +0 -1
- package/chunks/chunk-XMTGT2NJ.js +0 -10
- package/chunks/chunk-Y6DLCHJN.js +0 -1
- package/chunks/chunk-YUXQ7JNG.js +0 -1
- package/chunks/chunk-ZTLJ775S.js +0 -1
- package/chunks/claude-code-PWTLM554.js +0 -1
- package/chunks/clone-DASXIL35.js +0 -5
- package/chunks/file-tools-shared-ESMPLZVJ.js +0 -1
- package/chunks/gemini-I6F5N7PS.js +0 -1
- package/chunks/gh-Y4BXDXR5.js +0 -4
- package/chunks/init-GXBXQGGV.js +0 -1
- package/chunks/init-UFJL24PW.js +0 -12
- package/chunks/install-Q2KQZM62.js +0 -2
- package/chunks/kiro-NMTIFMT4.js +0 -1
- package/chunks/load-config-TSM3AAQ6.js +0 -1
- package/chunks/manifest-VJQJG2LS.js +0 -1
- package/chunks/mod-3PJAIZ2O.js +0 -1
- package/chunks/mod-FKPTF5D5.js +0 -1
- package/chunks/mod-GZ6BSK2P.js +0 -1
- package/chunks/mod-QODEWK3G.js +0 -9
- package/chunks/mod-S33TIBIC.js +0 -1
- package/chunks/mod-STKIZYZ3.js +0 -27
- package/chunks/new-W5YBJFGW.js +0 -4
- package/chunks/next-773GX25N.js +0 -3
- package/chunks/ollama-DQ5VM4HI.js +0 -1
- package/chunks/opencode-IZMQZ4ZK.js +0 -1
- package/chunks/recipe-applier-F2REROYS.js +0 -1
- package/chunks/registry-fetcher-ZJ76EHBA.js +0 -1
- package/chunks/release-notes-Z53AFCII.js +0 -3
- package/chunks/release-tag-QRIKYVQB.js +0 -1
- package/chunks/reset-5LQGIOGB.js +0 -1
- package/chunks/rule-K42YEAMO.js +0 -2
- package/chunks/spec-5446CSQC.js +0 -1
- package/chunks/status-HK3P6J6G.js +0 -1
- package/chunks/sync-4FSA5257.js +0 -1
- package/chunks/system-3MH6OCP6.js +0 -1
- package/chunks/system-DTVAUBIX.js +0 -1
- package/chunks/update-QD5S73WT.js +0 -5
- package/chunks/validate-bom-IVALGNGE.js +0 -1
- package/chunks/validate-case-conflict-LKECKLD5.js +0 -1
- package/chunks/validate-circular-deps-PXFPCBXA.js +0 -1
- package/chunks/validate-commit-msg-77CBKGOF.js +0 -1
- package/chunks/validate-docs-3UGB7LN7.js +0 -1
- package/chunks/validate-eof-ZSIYNHO5.js +0 -1
- package/chunks/validate-export-names-BPSCBX7B.js +0 -1
- package/chunks/validate-filenames-G4XJ2LHN.js +0 -1
- package/chunks/validate-json-YRCFW2O7.js +0 -1
- package/chunks/validate-large-files-MWWSFDOE.js +0 -1
- package/chunks/validate-licenses-Q2YA2MND.js +0 -1
- package/chunks/validate-line-endings-C6NHWHGI.js +0 -1
- package/chunks/validate-merge-conflict-KTBL4FUY.js +0 -1
- package/chunks/validate-mod-exports-LQIIQRIS.js +0 -1
- package/chunks/validate-package-configs-36PYXIWC.js +0 -1
- package/chunks/validate-secrets-UFDJ7ITY.js +0 -1
- package/chunks/validate-shebangs-3UO4MDMZ.js +0 -1
- package/chunks/validate-submodules-YA654D3B.js +0 -1
- package/chunks/validate-symlinks-R2PNE5TG.js +0 -1
- package/chunks/validate-toml-7H2N5AKI.js +0 -1
- package/chunks/validate-trailing-whitespace-HXO7M3ED.js +0 -1
- package/chunks/validate-yaml-ZJJCQVBB.js +0 -1
- package/chunks/versions-CWT5S7G4.js +0 -1
- package/chunks/vertexai-2SMP54AR.js +0 -1
- package/chunks/workerd-NXKZMQPV.js +0 -1
- /package/chunks/{chunk-QXTK62N4.js → chunk-ACQUINWH.js} +0 -0
- /package/chunks/{chunk-VTQ72OK7.js → chunk-FDZP7B5Y.js} +0 -0
- /package/chunks/{chunk-4OIKB2P5.js → chunk-T7K64JD5.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-3EFU5R2M.js";import"./chunk-762C2IM6.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import"./chunk-DXB73IDG.js";export{a as GeminiModel,b as geminiFactory};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as l}from"./chunk-KAEAT6A4.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import"./chunk-2J2PXBOC.js";import"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b as o,e as r,h as i}from"./chunk-PLJNPQFC.js";import{g as t}from"./chunk-DQAEQEXD.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var c=l(),m=()=>{c.writeln(i("\u2139"),o(` eser codebase gh \u2014 GitHub operations
|
|
2
|
+
`)),console.log("Subcommands:"),console.log(" contributors Update contributor list in README.md"),console.log(" release-notes Sync CHANGELOG to GitHub Releases"),console.log(" release-tag Create and push release git tags"),console.log(`
|
|
3
|
+
Run 'eser codebase gh <subcommand> --help' for details.`)},w=async u=>{let n=u??[],s=n[0],e=n.slice(1);if(s===void 0||s==="--help"||s==="-h")return m(),t.ok(void 0);switch(s){case"contributors":return await(await import("./gh-contributors-G3QZZAUO.js")).main(e);case"release-notes":return await(await import("./release-notes-734LKEJB.js")).main(e);case"release-tag":return await(await import("./release-tag-YX727TXO.js")).main(e);default:return c.writeln(r("\u2717"),o(` Unknown gh subcommand: ${s}
|
|
4
|
+
`)),m(),t.fail({exitCode:1})}};export{w as main};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import"./chunk-DDLQMSA7.js";import{a as A}from"./chunk-6U2VEZEM.js";import{a as
|
|
1
|
+
import"./chunk-DDLQMSA7.js";import{a as A}from"./chunk-6U2VEZEM.js";import{a as y,b as $}from"./chunk-KAEAT6A4.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import{f as R}from"./chunk-NUSNMQPL.js";import"./chunk-2J2PXBOC.js";import"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b as c,e as C,f as g,h as x}from"./chunk-PLJNPQFC.js";import{c as l}from"./chunk-BCHXUKWW.js";import"./chunk-ZOZYBQX2.js";import"./chunk-UNL4H5EY.js";import"./chunk-DWYVBWBP.js";import{a as w}from"./chunk-HPPFA3XU.js";import{g as a}from"./chunk-DQAEQEXD.js";import"./chunk-WUJUQPHI.js";import"./chunk-A2GDVOQP.js";import{n as b}from"./chunk-GLSCZGXA.js";import"./chunk-ZE5T64HQ.js";import{v as p}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var d=y(),m="<!-- CONTRIBUTORS:START -->",u="<!-- CONTRIBUTORS:END -->",O=async()=>{let t=await l.exec`gh repo view --json owner,name`.text(),e=JSON.parse(t);return{owner:e.owner.login,name:e.name}},U=async(t,e)=>{let n=await l.exec`gh api repos/${t}/${e}/contributors --paginate`.text();return JSON.parse(n).filter(o=>!o.login.includes("[bot]"))},M=(t,e=8)=>{if(t.length===0)return`${m}
|
|
2
2
|
${u}`;let n=[];for(let r=0;r<t.length;r+=e){let i=t.slice(r,r+e).map(s=>` <td align="center"><a href="${s.html_url}"><img src="${s.avatar_url}?s=80" width="80" /><br /><sub>${s.login}</sub></a></td>`);n.push(` <tr>
|
|
3
3
|
${i.join(`
|
|
4
4
|
`)}
|
|
5
|
-
</tr>`)}return`${
|
|
5
|
+
</tr>`)}return`${m}
|
|
6
6
|
<table>
|
|
7
7
|
${n.join(`
|
|
8
8
|
`)}
|
|
9
9
|
</table>
|
|
10
|
-
${u}`},T=(t,e)=>{let n=t.indexOf(
|
|
10
|
+
${u}`},T=(t,e)=>{let n=t.indexOf(m),r=t.indexOf(u);if(n===-1||r===-1)throw new Error(`Could not find contributor markers in README. Add '${m}' and '${u}' markers to the file.`);let o=t.slice(0,n),i=t.slice(r+u.length),s=`${o}${e}${i}`;return{content:s,changed:s!==t}},k=async(t={})=>{let{readmePath:e="README.md",columnsPerRow:n=8,commit:r=!1}=t,o=b(e),i=await O(),s=await U(i.owner,i.name),E=M(s,n),P=await p.runtime.fs.readTextFile(o),{content:v,changed:h}=T(P,E),f=!1;return h&&(await p.runtime.fs.writeTextFile(o,v),r&&(await l.exec`git add ${o}`.spawn(),await l.exec`git -c user.name=${"github-actions[bot]"} -c user.email=${"github-actions[bot]@users.noreply.github.com"} commit -m ${"docs: update contributors list"}`.spawn(),await l.exec`git push`.spawn(),f=!0)),{contributorCount:s.length,readmePath:o,updated:h,committed:f}},N=t=>R.fromPromise(()=>k(t)),S=t=>{let e=t.flags.columns,n=e!==void 0?Number(e):void 0;return a.ok({readmePath:t.flags.readme??void 0,columnsPerRow:n,commit:t.flags.commit===!0})},I=t=>{if(a.isFail(t)){let n=t.error,r=n instanceof Error?n.message:n.message??String(n);return d.writeln(C("\u2717"),c(" "+r)),a.fail({exitCode:1})}let{value:e}=t;return e.updated?e.committed?d.writeln(g("\u2713"),c(` Updated ${e.contributorCount} contributors and committed changes.`)):d.writeln(g("\u2713"),c(` Updated ${e.contributorCount} contributors in ${e.readmePath}.`)):d.writeln(x("\u2139"),c(` No changes \u2014 ${e.contributorCount} contributors already up to date.`)),a.ok(void 0)},D=A.createTrigger({handler:N,adaptInput:S,adaptOutput:I}),G=async t=>{let e=w(t??[],{string:["columns","readme"],boolean:["commit"],alias:{h:"help"}});if(e.help)return console.log(`eser codebase gh contributors \u2014 Update contributor list
|
|
11
11
|
`),console.log("Options:"),console.log(" --columns <n> Number of columns per row (default: 8)"),console.log(" --readme <path> Path to README.md (default: README.md)"),console.log(" --commit Auto-commit and push changes"),console.log(" --help, -h Show this help"),a.ok(void 0);let n=$("gh-contributors",e);return await D(n)};export{U as fetchContributors,M as generateContributorMarkdown,O as getRepoInfo,D as handleCli,G as main,T as replaceContributorSection,k as updateContributors,N as updateContributorsHandler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./chunk-BK2BDHKB.js";import{a as $,b as v,e as k,g as P,h as j,j as b,k as C}from"./chunk-NT2MQK7O.js";import"./chunk-Q7QMINSQ.js";import"./chunk-6FMPNAZ3.js";import"./chunk-5MN3MWQN.js";import{a as y}from"./chunk-ZED5RIVL.js";import{f as w,h as g,k as h}from"./chunk-TTYO2XJO.js";import{c as p,d as a,f as o,g as u}from"./chunk-PLJNPQFC.js";import"./chunk-OLM5RTFK.js";import"./chunk-BCHXUKWW.js";import"./chunk-RYLOB2JU.js";import"./chunk-UNL4H5EY.js";import"./chunk-DWYVBWBP.js";import"./chunk-HPPFA3XU.js";import{a as d}from"./chunk-DQAEQEXD.js";import{t as c}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var x=y;var i=async t=>{try{return await c.fs.stat(t),!0}catch{return!1}},D=async(t,e)=>{try{let n=await c.fs.readTextFile(t);return JSON.parse(n)[e]??null}catch{return null}},T=async t=>{let e=[];return(await i(`${t}/package.json`)||await i(`${t}/deno.json`))&&e.push("typescript"),await i(`${t}/go.mod`)&&e.push("go"),await i(`${t}/Cargo.toml`)&&e.push("rust"),(await i(`${t}/pyproject.toml`)||await i(`${t}/setup.py`))&&e.push("python"),e},z=async t=>{let e=[],n=await D(`${t}/package.json`,"dependencies");return n!==null&&("react"in n&&e.push("react"),"vue"in n&&e.push("vue"),"svelte"in n&&e.push("svelte"),"next"in n&&e.push("nextjs"),"express"in n&&e.push("express"),"hono"in n&&e.push("hono")),e},B=async t=>{let e=[];return await i(`${t}/.github/workflows`)&&e.push("github-actions"),await i(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await i(`${t}/Jenkinsfile`)&&e.push("jenkins"),await i(`${t}/.circleci`)&&e.push("circleci"),e},E=async t=>{if(await i(`${t}/deno.json`))return"deno";let e=await D(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},I=async t=>{let[e,n,r,l]=await Promise.all([T(t),z(t),B(t),E(t)]);return{languages:e,frameworks:n,ci:r,testRunner:l}};var Q=async t=>{let e=w({renderer:h.ansi(),sink:g.stdout()}),n=c.process.cwd();if(await C(n))return e.writeln(u("noskills is already initialized in this project.")),e.writeln(a("Run `noskills sync` to regenerate tool files.")),await e.close(),d(void 0);e.writeln(p("noskills init")),e.writeln(""),e.writeln(a("Scanning project..."));let r=await I(n);for(let s of r.languages)e.writeln(" ",o("\u2714"),` ${s}`);for(let s of r.frameworks)e.writeln(" ",o("\u2714"),` ${s}`);for(let s of r.ci)e.writeln(" ",o("\u2714"),` ${s}`);r.testRunner!==null&&e.writeln(" ",o("\u2714"),` test runner: ${r.testRunner}`),e.writeln(""),e.writeln(a("Detecting AI providers..."));let l=await x();for(let s of l)s.available?e.writeln(" ",o("\u25CF")," ",p(`${s.name} (${s.alias})`),a(` ${s.detail}`)):e.writeln(" ",a("\u25CB")," ",a(`${s.name} (${s.alias}) ${s.detail}`));let f=l.filter(s=>s.available).map(s=>s.name);e.writeln(""),e.writeln(a("Initializing...")),await b(n),e.writeln(" Created .nos/");for(let s of m)await j(n,s);e.writeln(` Bootstrapped ${m.length} concerns into .nos/concerns/`);let N=v([],f,r);await P(n,N),e.writeln(" Created .nos/config.json");let R=$();await k(n,R),e.writeln(" Created .nos/.state/state.json"),e.writeln("");let S=f.length;return e.writeln(o("Done."),` ${S} AI provider(s) detected.`),e.writeln("Start a spec with: ",p('noskills spec new "..."')),await e.close(),d(void 0)};export{Q as main};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{f as P,h as R,k as F}from"./chunk-TTYO2XJO.js";import{b as t,c as E,d as s,e as o,f as x,j as v}from"./chunk-PLJNPQFC.js";import"./chunk-ZOZYBQX2.js";import{a as T}from"./chunk-DWYVBWBP.js";import"./chunk-HPPFA3XU.js";import{a as A,b as i,f as $}from"./chunk-DQAEQEXD.js";import{t as b}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var S=["minimal","blog","dashboard","docs"],V=async O=>{let{positional:N,flags:m}=T(O??[],[{name:"template",short:"t",type:"string",default:"minimal",description:"Project template"},{name:"force",short:"f",type:"boolean",description:"Overwrite"},{name:"no-git",type:"boolean",description:"Skip git"},{name:"no-install",type:"boolean",description:"Skip install"}]),r=N[0]??"my-laroux-app",l=m.template,j=m.force,L=m["no-git"],n=F.ansi(),e=P({renderer:n,sink:R.stdout()});if(!S.includes(l))return await e.close(),i({message:`${n.render([o(`
|
|
2
|
+
Error: Invalid template "${l}"`)])}
|
|
3
|
+
Available templates: ${S.join(", ")}`,exitCode:1});e.writeln(v(`
|
|
4
|
+
\u2728 Creating new laroux.js project in ./${r}
|
|
5
|
+
`)),e.writeln(s(` Template: ${l}`));let c="eser",p=`laroux-template-${l}`,k="main",d=`${b.process.cwd()}/${r}`;try{await b.fs.mkdir(d,{recursive:!0})}catch{return await e.close(),i({message:n.render([o(`
|
|
6
|
+
Could not create directory: ${d}`)]),exitCode:1})}e.writeln(s(` Fetching from gh:${c}/${p}...
|
|
7
|
+
`));try{let a=await import("./registry-fetcher-J6X32PGP.js"),u=await import("./recipe-applier-R4YJPGQR.js"),f=await $(()=>a.fetchRecipeFromRepo(c,p,k,"recipe.json"),()=>{});if(f._tag==="Ok"&&f.value!==void 0){let g=`https://raw.githubusercontent.com/${c}/${p}/${k}`,w=await u.applyRecipe(f.value,{cwd:d,registryUrl:g,force:j,variables:{project_name:r}});e.writeln(x(`
|
|
8
|
+
\u{1F389} Project created successfully!`)),e.writeln(s(` ${w.written.length} files written`))}else{let g=await import("./mod-NSY6WUYH.js"),w=`gh:${c}/${p}`,y=await $(()=>g.scaffold({specifier:w,targetDir:r,force:j,skipPostInstall:L,interactive:!0}),h=>({message:h.message}));if(y._tag==="Fail")return await e.close(),i({message:n.render([o(`
|
|
9
|
+
Scaffolding failed: ${y.error.message}`)]),exitCode:1});let C=y.value;if(e.writeln(x(`
|
|
10
|
+
\u{1F389} Project created successfully!`)),Object.keys(C.variables).length>0){e.writeln(t(`
|
|
11
|
+
Variables applied:`));for(let[h,_]of Object.entries(C.variables))e.writeln(t(" "),s(h),t(`: ${_}`))}}}catch(a){let u=a instanceof Error?a.message:String(a);return await e.close(),i({message:n.render([o(`
|
|
12
|
+
Failed: ${u}`)]),exitCode:1})}return e.writeln(),e.writeln(E("Next steps:")),e.writeln(),e.writeln(t(` cd ${r}`)),e.writeln(t(" laroux dev")),e.writeln(),e.writeln(t("Then open "),v("http://localhost:8000"),t(" in your browser.")),e.writeln(),e.writeln(s("Learn more at https://laroux.now/")),e.writeln(),await e.close(),A(void 0)};export{V as main};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as E}from"./chunk-3I4JG3PJ.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import"./chunk-GXPLME3K.js";import"./chunk-2J2PXBOC.js";import{f as A,h as C,k as H}from"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b,c as O,d as l,e as k,f as w,g as y,h as j}from"./chunk-PLJNPQFC.js";import{a as $}from"./chunk-HPPFA3XU.js";import{g as r}from"./chunk-DQAEQEXD.js";import{v as e}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var M={precommit:{hookName:"pre-commit",args:""},commitmsg:{hookName:"commit-msg",args:'-- "$1"'},prepush:{hookName:"pre-push",args:""}},P="# @eser managed hook",I=async(i,n)=>{let s=await e.getCliCommand({command:"eser",devCommand:"deno task cli",npmPackage:"eser",jsrPackage:"@eser/cli"}),t=n.length>0?` ${n}`:"",o=`${s} workflows run -e ${i}${t}`;return["#!/bin/sh",`${P} \u2014 generated by \`eser codebase install\``,"# Do not edit. Re-run `eser codebase install` to update.","",o,""].join(`
|
|
2
|
+
`)},S=async()=>{try{let t=(await e.runtime.exec.exec("git",["rev-parse","--git-dir"])).trim();if(t.length>0)return t}catch{}let i=e.runtime.process.cwd(),n=e.runtime.path.join(i,".git");try{if((await e.runtime.fs.stat(n)).isDirectory)return n}catch{}return null},G=i=>{let n=i.workflows;if(!Array.isArray(n))return[];let s=new Set;for(let t of n)if(Array.isArray(t.on))for(let o of t.on)typeof o=="string"&&s.add(o);return[...s]},T=H.ansi(),U=async i=>{let n=$(i??[],{boolean:["force","dry-run","help"],alias:{h:"help",f:"force",n:"dry-run"}});if(n.help)return console.log("eser codebase install \u2014 Install git hooks from .manifest.yml"),console.log(""),console.log("Flags:"),console.log(" --force, -f Overwrite non-managed hooks"),console.log(" --dry-run, -n Show what would happen without writing"),console.log(" --help, -h Show this help"),r.ok(void 0);let s=A({renderer:T,sink:C.stdout()}),t=n.force,o=n["dry-run"],d=await S();if(d===null)return s.writeln(k("Error: not inside a git repository")),await s.close(),r.fail({exitCode:1});let p=e.runtime.path.join(d,"hooks"),g=e.runtime.process.cwd(),a=await E(g);if(a===null)return s.writeln(k("Error: no .manifest.yml found in current directory")),await s.close(),r.fail({exitCode:1});let c=G(a);if(c.length===0)return s.writeln(y("No workflow events found \u2014 nothing to install.")),await s.close(),r.ok(void 0);o||await e.runtime.fs.ensureDir(p);let f=0,v=0,u=0;for(let N of c){let F=M[N];if(F===void 0){s.writeln(l(` skip ${N} (unknown event, no hook mapping)`));continue}let{hookName:m,args:K}=F,D=e.runtime.path.join(p,m),_=await I(N,K),R=!1,x=!1;try{let q=await e.runtime.fs.readTextFile(D);R=!0,x=q.includes(P)}catch{}if(o){R?x?s.writeln(j(` would update ${m} (managed)`)):t?s.writeln(y(` would overwrite ${m} (--force)`)):s.writeln(y(` would skip ${m} (user hook; use --force to overwrite)`)):s.writeln(j(` would create ${m}`));continue}if(R&&!x&&!t){s.writeln(y(` skip ${m} \u2014 user hook exists (use --force to overwrite)`)),v++;continue}await e.runtime.fs.writeTextFile(D,_);try{await e.runtime.fs.chmod(D,493)}catch{}R&&x?(s.writeln(w(` updated ${m}`)),u++):(s.writeln(w(` installed ${m}`)),f++)}s.writeln();let h=[];return f>0&&h.push(`${f} installed`),u>0&&h.push(`${u} updated`),v>0&&h.push(`${v} skipped`),o?s.writeln(l("(dry run \u2014 no changes made)")):h.length>0?s.writeln(w(`Done: ${h.join(", ")}.`)):s.writeln(l("Nothing to do.")),await s.close(),r.ok(void 0)},W=async i=>{if($(i??[],{boolean:["help"],alias:{h:"help"}}).help)return console.log("eser codebase uninstall \u2014 Remove managed git hooks"),r.ok(void 0);let s=A({renderer:T,sink:C.stdout()}),t=await S();if(t===null)return s.writeln(k("Error: not inside a git repository")),await s.close(),r.fail({exitCode:1});let o=e.runtime.path.join(t,"hooks"),d=0,p=Object.values(M).map(a=>a.hookName),g=[...new Set(p)];for(let a of g){let c=e.runtime.path.join(o,a);try{(await e.runtime.fs.readTextFile(c)).includes(P)&&(await e.runtime.fs.remove(c),s.writeln(w(` removed ${a}`)),d++)}catch{}}return s.writeln(),d>0?s.writeln(w(`Done: ${d} hook(s) removed.`)):s.writeln(l("No managed hooks found.")),await s.close(),r.ok(void 0)},X=async i=>{if($(i??[],{boolean:["help"],alias:{h:"help"}}).help)return console.log("eser codebase status \u2014 Show git hook installation status"),r.ok(void 0);let s=A({renderer:T,sink:C.stdout()}),t=await S();if(t===null)return s.writeln(k("Error: not inside a git repository")),await s.close(),r.fail({exitCode:1});let o=e.runtime.path.join(t,"hooks"),d=e.runtime.process.cwd(),p=await E(d);if(p===null)return s.writeln(k("Error: no .manifest.yml found in current directory")),await s.close(),r.fail({exitCode:1});let g=G(p);if(g.length===0)return s.writeln(l("No workflow events found in manifest.")),await s.close(),r.ok(void 0);s.writeln(O("Git hook status:")),s.writeln();for(let a of g){let c=M[a];if(c===void 0){s.writeln(b(" "),l(a.padEnd(14)),b(" "),l("(no hook mapping)"));continue}let{hookName:f}=c,v=e.runtime.path.join(o,f),u;try{(await e.runtime.fs.readTextFile(v)).includes(P)?u=w("managed (@eser)"):u=y("user hook")}catch{u=l("not installed")}s.writeln(b(` ${f.padEnd(14)} `),u)}return s.writeln(),await s.close(),r.ok(void 0)};export{U as main,X as statusMain,W as uninstallMain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-QIODVVTY.js";import"./chunk-3K42AALS.js";import"./chunk-OLM5RTFK.js";import"./chunk-BCHXUKWW.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as KiroModel,b as kiroFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R,d as h}from"./chunk-NUSNMQPL.js";import{f as S}from"./chunk-
|
|
1
|
+
import{a as R,d as h}from"./chunk-NUSNMQPL.js";import{f as S}from"./chunk-5AK4OGCO.js";import{f as m,h as f,k as y}from"./chunk-TTYO2XJO.js";import{c as p,d as l,j as d}from"./chunk-PLJNPQFC.js";import{a as u}from"./chunk-HPPFA3XU.js";import{a as n,b as o,c as g}from"./chunk-DQAEQEXD.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var w=["project","structure","utility"],C={project:"PROJECTS",structure:"STRUCTURES",utility:"UTILITIES"},k=t=>R(async r=>{try{let s=await S(t.registrySource,{local:t.local}),e=[...s.recipes];if(t.language!==void 0&&(e=e.filter(i=>i.language===t.language)),t.scale!==void 0&&(e=e.filter(i=>i.scale===t.scale)),t.tag!==void 0&&(e=e.filter(i=>i.tags!==void 0&&i.tags.includes(t.tag))),e.length===0)return r.out.writeln("No recipes found matching your filters."),r.out.writeln("Run ",l("`eser kit list`")," without filters to see all recipes."),n({manifest:s,recipes:e});r.out.writeln(p(`${s.name} \u2014 ${s.description}`)),r.out.writeln();for(let i of w){let c=e.filter(a=>a.scale===i);if(c.length!==0){r.out.writeln(d(C[i]));for(let a of c)r.out.writeln(` ${a.name.padEnd(20)} ${a.description} `,l(`[${a.language}]`));r.out.writeln()}}return n({manifest:s,recipes:e})}catch(s){let e=s instanceof Error?s.message:String(s);return o({_tag:"RegistryError",message:e})}});var $=async t=>{let r=u(t??[],{string:["registry","language","scale","tag"],boolean:["local"]}),s=m({renderer:y.ansi(),sink:f.stdout()}),e=await h(k({registrySource:r.registry,language:r.language,scale:r.scale,tag:r.tag,local:r.local===!0}),{out:s});return await s.close(),g(e)?n(void 0):o({exitCode:1})};export{$ as main};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as h,b as u,c as k}from"./chunk-
|
|
1
|
+
import{a as h,b as u,c as k}from"./chunk-MYSTBVWT.js";import"./chunk-3I4JG3PJ.js";import"./chunk-GXPLME3K.js";import{f as m,h as c,k as w}from"./chunk-TTYO2XJO.js";import{b as t,c as a,d as e}from"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import{a as g}from"./chunk-HPPFA3XU.js";import{a as i}from"./chunk-DQAEQEXD.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var R=async(y,p)=>{let d=g(y??[],{string:["config"],boolean:["help"],alias:{h:"help"}});if(d.help)return console.log(`eser workflows list \u2014 List available workflows and tools
|
|
2
2
|
`),console.log("Options:"),console.log(" --config <path> Config directory (default: .)"),console.log(" -h, --help Show this help"),i(void 0);let o=m({renderer:w.ansi(),sink:c.stdout()}),A=d.config??".",r=await u(A),n=h();if(n.register(k),p?.tools!==void 0&&n.registerAll(p.tools),r!==null&&r.workflows.length>0){o.writeln(a("Workflows:"));for(let s of r.workflows){let x=s.on.length>0?s.on.join(", "):"(no events)",f=s.steps.length,C=f===1?"step":"steps";o.writeln(t(` ${s.id.padEnd(20)} `),e(x.padEnd(25)),t(` ${f} ${C}`))}}else o.writeln(e("No workflows defined."));o.writeln();let l=n.getAll();if(l.length>0){o.writeln(a(`Registered tools (${l.length}):`));for(let s of l)o.writeln(t(` ${s.name.padEnd(28)} `),e(s.description))}else o.writeln(e("No tools registered."));return await o.close(),i(void 0)};export{R as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-ZED5RIVL.js";import{f as o,h as m,k as d}from"./chunk-TTYO2XJO.js";import{c as t,d as a,f as l,l as n}from"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import{a as i}from"./chunk-DQAEQEXD.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=o({renderer:d.ansi(),sink:m.stdout()});e.writeln(t("AI Providers")),e.writeln("");let r=await p(),v=r.map(s=>[s.available?l("\u25CF"):a("\u25CB"),s.available?t(`${s.name} (${s.alias})`):a(`${s.name} (${s.alias})`),a(s.type),s.available?s.detail:a(s.detail)]);e.writeln(n(["","Provider","Type","Status"],v));let u=r.filter(s=>s.available).length;return e.writeln(a(`${u}/${r.length} providers available`)),await e.close(),i(void 0)};export{$ as main};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-CKD2KOHA.js";import"./chunk-Y6DZEK4W.js";import"./chunk-OBIEQJDE.js";import"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import"./chunk-A2GDVOQP.js";import"./chunk-ZE5T64HQ.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as loadConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as K,b as j,c as M,d as F,f as N}from"./chunk-
|
|
1
|
+
import{a as K,b as j,c as M,d as F,f as N}from"./chunk-3OEM65F2.js";import{a as Q}from"./chunk-CKD2KOHA.js";import"./chunk-5RK3346P.js";import"./chunk-UKYKMDYU.js";import"./chunk-4H4O3TGK.js";import"./chunk-V2N5L24J.js";import"./chunk-Y6DZEK4W.js";import"./chunk-34GCQZ3Z.js";import"./chunk-3APERFKY.js";import{a as X}from"./chunk-ZF2XYULB.js";import"./chunk-GXPLME3K.js";import{b as Y}from"./chunk-2J2PXBOC.js";import{d as G,e as m,g as V}from"./chunk-OBIEQJDE.js";import{a as v}from"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import"./chunk-A2GDVOQP.js";import"./chunk-GLSCZGXA.js";import"./chunk-ZE5T64HQ.js";import{g as W,t as s}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var B=m.getLogger(["laroux-bundler","prebuilt-bundler"]),w=class{config;cachedManifest=null;constructor(e){this.config=e}async getBundle(){B.debug("\u{1F4E6} Loading prebuilt bundle from disk...");let e=s.path.resolve(this.config.distDir,"client","manifest.json"),t=await s.fs.readTextFile(e),r=JSON.parse(t),o=s.path.resolve(this.config.distDir,"client","module-map.json"),i={};try{let p=await s.fs.readTextFile(o);i=JSON.parse(p),B.debug(`\u2705 Loaded module map with ${Object.keys(i).length} entries`)}catch{B.warn("\u26A0\uFE0F Module map not found, SSR may fail for client components")}this.cachedManifest=r;let l=r.entrypoint?`/${r.entrypoint}`:"/client.js";return B.debug(`\u2705 Loaded manifest with entrypoint: ${l}`),{clientCode:null,moduleMap:i,chunkManifest:r,entrypoint:l}}async reload(){this.cachedManifest=null,await this.getBundle()}};var A=m.getLogger(["laroux-bundler","runtime-bundler"]),_=class{clientComponents=new Map;moduleMap=null;bundleCode=null;chunkManifest=null;lastScan=0;scanInterval=1e3;config;async getOrCreateBundle(){let e=Date.now();return(e-this.lastScan>this.scanInterval||!this.bundleCode)&&(await this.rebuild(),this.lastScan=e),{clientCode:this.bundleCode,moduleMap:this.moduleMap,clientComponents:this.clientComponents,chunkManifest:this.chunkManifest}}constructor(e){this.config=e}async rebuild(){let{plugin:e}=this.config,t=e.analyzeClientComponents?await e.analyzeClientComponents(this.config.srcDir,this.config.projectRoot):[];this.clientComponents.clear();for(let o of t)this.clientComponents.set(o.filePath,o);this.moduleMap=e.createModuleMap?await e.createModuleMap(t):{};let r=await this.bundleClientCode(t);this.bundleCode=r.code,this.chunkManifest=r.manifest}async bundleClientCode(e){let{plugin:t}=this.config,r=s.process.cwd(),o=await s.fs.makeTempDir({prefix:"rsc-runtime-",dir:r});try{if(!t.createClientEntry)throw new Error("Framework plugin does not provide createClientEntry");let i=await t.createClientEntry(e,r,o),l=K("deno-bundler",{entryName:"client"}),p={client:i};for(let g of e)p[g.relativePath]=g.filePath;let u={entrypoints:p,outputDir:o,format:"esm",platform:"browser",codeSplitting:j.codeSplitting,minify:j.minify,sourcemap:!1},a=await l.bundle(u);if(!a.success){let g=a.errors?.map(c=>c.message).join(", ")??"Unknown error";throw new Error(`Bundle failed: ${g}`)}let d=a.outputs.get("client.js");if(!d)throw new Error("Bundle output 'client.js' not found in bundle result");let f=new TextDecoder().decode(d.code),h={version:"1.0",buildId:"runtime",timestamp:Date.now(),logLevel:"debug",entrypoint:"__runtime_bundle.js",hmrEnabled:!0,chunks:{},files:{}};for(let g of e){let c=g.relativePath;h.chunks[c]={main:"__runtime_bundle",deps:[],size:0}}return{code:f,manifest:h}}catch(i){let l=i instanceof Error?i.message:String(i),p=i instanceof Error?i.stack:null;A.error("\u274C Runtime bundling failed:"),A.error(` Error: ${l}`),p!==null&&A.error(` Stack trace:
|
|
2
2
|
${p}`);let u=f=>f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),a=`
|
|
3
3
|
console.error("Runtime bundling failed:", ${JSON.stringify(l)});
|
|
4
4
|
document.getElementById("root").innerHTML = '<div class="error"><h2>Bundle Error</h2><pre>${u(l)}</pre></div>';
|
|
5
|
-
`,d={version:"1.0",buildId:"runtime-error",timestamp:Date.now(),logLevel:"error",entrypoint:"__runtime_bundle.js",hmrEnabled:!1,chunks:{},files:{}};return{code:a,manifest:d}}finally{try{await s.fs.remove(o,{recursive:!0})}catch(i){A.debug("Temp directory cleanup failed",{error:i})}}}clear(){this.clientComponents.clear(),this.moduleMap=null,this.bundleCode=null,this.lastScan=0}};var D=class{cache;constructor(e){this.cache=new _(e)}async getBundle(){let e=await this.cache.getOrCreateBundle();return{clientCode:e.clientCode,moduleMap:e.moduleMap,chunkManifest:e.chunkManifest,entrypoint:"/__runtime_bundle.js"}}async getRuntimeBundle(){return await this.cache.getOrCreateBundle()}async rebuild(){await this.cache.rebuild()}clear(){this.cache.clear()}};var Z={name:"noop",renderPage:()=>Promise.resolve({html:""}),renderRSC:()=>Promise.resolve(new Response("")),generateBootstrapScript:()=>""};var ee={name:"noop",createShell:()=>"<!DOCTYPE html><html><head></head><body></body></html>",createStreamingStart:()=>"<!DOCTYPE html><html><head></head><body>",createStreamingEnd:()=>"</body></html>"};var b=m.getLogger(["laroux-server","hmr"]),$=class{clients=new Set;handleConnection(e){this.clients.add(e),b.debug(`HMR client connected (${this.clients.size} total)`),this.sendToClient(e,{type:"connected"}),e.addEventListener("close",()=>{this.clients.delete(e),b.debug(`HMR client disconnected (${this.clients.size} remaining)`)}),e.addEventListener("error",t=>{b.error("HMR WebSocket error:",{event:t}),this.clients.delete(e)})}notifyUpdate(e=Date.now(),t){let r={type:"update",timestamp:e,changedModules:t};b.debug(`Notifying ${this.clients.size} clients of update${t?` (${t.length} modules changed)`:""}`);for(let o of this.clients)this.sendToClient(o,r)}notifyError(e){let t={type:"error",message:e};b.warn(`Notifying clients of error: ${e}`);for(let r of this.clients)this.sendToClient(r,t)}sendToClient(e,t){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify(t))}catch(r){b.error("Failed to send HMR message:",{error:r})}}getClientCount(){return this.clients.size}close(){for(let e of this.clients)e.close();this.clients.clear()}};var L=m.getLogger(["laroux-server","api-handler"]);function ie(n){let e=new Set;return{pattern:n.replace(/\[\.\.\.(\w+)\]/g,(r,o)=>(e.add(o),`:${o}*`)).replace(/\[(\w+)\]/g,(r,o)=>`:${o}`),catchAllParams:e}}function se(n,e){let{pattern:t,catchAllParams:r}=ie(e),i=new URLPattern({pathname:t}).exec({pathname:n});if(!i)return null;let l={},p=i.pathname.groups;for(let[u,a]of Object.entries(p))r.has(u)?l[u]=a?a.split("/").filter(Boolean):[]:l[u]=a??"";return l}var H=class{routes=[];moduleCache=new Map;registryDir="";async loadRoutes(e){try{let t=`file://${e}/server/api-routes.ts`;this.registryDir=s.path.resolve(e,"server");let r=await import(t);this.routes=r.apiRoutes||[],L.debug(`Loaded ${this.routes.length} API route(s)`)}catch{this.routes=[],L.debug("No API routes registry found")}}async handleRequest(e,t){let r=new URL(e.url),o=e.method;for(let i of this.routes){let l=se(t,i.path);if(l!==null){L.debug(`API route matched: ${o} ${t} -> ${i.path}`);try{let p=s.path.resolve(this.registryDir,i.modulePath),u=this.moduleCache.get(p);u||(u=await import(`file://${p}`),this.moduleCache.set(p,u));let a=u[o];return a?await a({request:e,params:l,searchParams:r.searchParams}):(L.debug(`Method ${o} not allowed for ${i.path}`),new Response("Method Not Allowed",{status:405,headers:{Allow:this.getAllowedMethods(u).join(", ")}}))}catch(p){return L.error(`API route error: ${i.path}`,{error:p}),new Response(JSON.stringify({error:"Internal Server Error"}),{status:500,headers:{"Content-Type":"application/json"}})}}}return null}getAllowedMethods(e){let t=[];return e.GET&&t.push("GET"),e.POST&&t.push("POST"),e.PUT&&t.push("PUT"),e.DELETE&&t.push("DELETE"),e.PATCH&&t.push("PATCH"),e.HEAD&&t.push("HEAD"),e.OPTIONS&&t.push("OPTIONS"),t}clearCache(){this.moduleCache.clear()}};var P=m.getLogger(["laroux-server","proxy-handler"]),T=class{proxies=[];moduleCache=new Map;registryDir="";async loadProxies(e){try{let t=`file://${e}/server/proxy-registry.ts`;this.registryDir=s.path.resolve(e,"server");let r=await import(t);this.proxies=r.proxyRegistry||[],P.debug(`Loaded ${this.proxies.length} proxy definition(s)`)}catch{this.proxies=[],P.debug("No proxy registry found")}}async runProxies(e,t){let r=t;for(let o of this.proxies)if(this.matchesPrefix(r,o.pathPrefix)){P.debug(`Running proxy: ${o.pathPrefix} for ${r}`);try{let i=s.path.resolve(this.registryDir,o.modulePath),l=this.moduleCache.get(i);l||(l=await import(`file://${i}`),this.moduleCache.set(i,l));let p=l.default;if(typeof p!="function"){P.warn(`Proxy ${o.modulePath} does not export a default function`);continue}let u=await p({request:e,pathname:r,params:{}});if(u.type==="response")return P.debug(`Proxy ${o.pathPrefix} returned response`),{result:u,finalPathname:r};if(u.type==="redirect")return P.debug(`Proxy ${o.pathPrefix} redirecting to ${u.url}`),{result:u,finalPathname:r};u.type==="rewrite"&&(P.debug(`Proxy ${o.pathPrefix} rewriting to ${u.pathname}`),r=u.pathname)}catch(i){return P.error(`Proxy error: ${o.pathPrefix}`,{error:i}),{result:{type:"response",response:new Response(JSON.stringify({error:"Proxy Error"}),{status:500,headers:{"Content-Type":"application/json"}})},finalPathname:r}}}return{result:{type:"next"},finalPathname:r}}matchesPrefix(e,t){return t==="/"?!0:e===t||e.startsWith(t+"/")}clearCache(){this.moduleCache.clear()}};function te(n,e){let t=X(n,e.path);if(t===null)return null;let r={};for(let[o,i]of Object.entries(t))Array.isArray(i)?r[o]=[...i]:typeof i=="string"&&(r[o]=i);return r}function U(n,e){for(let t of e){let r=te(n,t);if(r!==null)return{route:t,params:r}}return null}var le=["trace","debug","info","warn","error","fatal"];var oe="manifest.json",ue=n=>({trace:v.Debug,debug:v.Debug,info:v.Info,warn:v.Warning,error:v.Error,fatal:v.Critical})[n],R,E;async function pe(n){let e=ue(n),{output:t,renderers:r,sinks:o}=await import("./mod-PEAFMI6F.js"),i=t({renderer:r.ansi(),sink:o.stdout()});await G.configure({sinks:{console:V.getOutputSink(i)},loggers:[{category:["laroux-server"],lowestLevel:e,sinks:["console"]},{category:["laroux-bundler"],lowestLevel:e,sinks:["console"]},{category:["laroux"],lowestLevel:e,sinks:["console"]}]}),R=m.getLogger(["laroux-server","server"]),E=m.getLogger(["laroux-server","bundler"])}var O=null;function ot(){O=null}async function ce(n){if(O!==null)return O;let t=`file://${s.path.join(n.distDir,"server","_generated-routes.ts")}?t=${Date.now()}`,{generatedRoutes:r}=await import(t);return O=r,r}async function re(n,e){let t=s.path.resolve(n.distDir,"server","src","app",`${e}.js`);if(await s.fs.exists(t))return t;for(let r of Y){let o=s.path.resolve(n.distDir,"server","src","app",`${e}.${r}`);if(await s.fs.exists(o))return o}return t}async function ne(n,e){let t=Date.now(),o=`file://${await re(e,"layout")}?t=${t}`,{Layout:i}=await import(o),l=await ce(e),p=U(n,l);if(p===null){let a=`file://${await re(e,"not-found")}?t=${t}`,{NotFound:d}=await import(a);return{Layout:i,Page:d,params:{}}}return{Layout:i,Page:p.route.component,params:p.params}}async function de(n){try{let e=s.path.resolve(n.distDir,"client",oe),t=await s.fs.readTextFile(e);return JSON.parse(t).buildId}catch{return"unknown"}}async function me(n){try{let e=s.path.resolve(n.distDir,"client",oe),t=await s.fs.stat(e),r=await s.fs.stat(n.srcDir);return t.mtime===null||r.mtime===null?!1:t.mtime>r.mtime}catch{return!1}}function I(n){return{projectRoot:n.projectRoot,srcDir:n.srcDir,distDir:n.distDir,logLevel:n.logLevel,fonts:n.fonts,images:n.images,cssModuleTypes:n.cssModuleTypes,noCssModuleAutoReference:n.noCssModuleAutoReference,browserShims:n.browserShims,serverExternals:n.build.serverExternals}}async function ge(n,e={}){let{config:t,bundler:r,hmrManager:o}=n,{frameworkPlugin:i,cssPlugin:l}=e;try{let c=s.path.resolve(t.distDir,"server","actions-manifest.json");if(await s.fs.exists(c)){let x=await s.fs.readTextFile(c),z=JSON.parse(x),q=Date.now(),C=0;for(let J of z.actions)try{let k=s.path.resolve(t.distDir,"server",J);await s.fs.exists(k)&&(await import(`file://${k}?t=${q}`),C++)}catch(k){R.warn(`Failed to load action ${J}:`,{error:k})}C>0&&R.debug(`Server actions loaded: ${C} file(s)`)}else R.debug("No actions manifest found (optional)")}catch(c){R.warn("Failed to load server actions:",{error:c})}await ne("/",t);let p=await de(t);E.debug(`Build ID: ${p}`);let a={...n,getApp:c=>ne(c,t),buildId:p},d=await r.getBundle(),f={framework:i,css:l,bundlerBackend:"deno-bundler"};if(d.clientCode!==null&&o!==null){if(i!==void 0){let c=M(I(t),f);N(c,async y=>{if(r instanceof D)try{await r.rebuild()}catch(x){E.error("Compilation failed:",{error:x})}E.info(`\u2713 Compiled in ${y.duration.toFixed(0)}ms`),o?.notifyUpdate(Date.now(),y.changedFiles)})}}else if(t.mode.isWatch&&i!==void 0){let c=M(I(t),f);N(c,y=>{E.info(`\u2713 Compiled in ${y.duration.toFixed(0)}ms`)})}let h="";d.clientCode!==null&&o!==null?h=" HMR":d.clientCode!==null&&(h=" Watch"),R.info(`RSC Server${h}`),R.info(` Local: http://localhost:${t.server.port}`);let{startHTTPServer:g}=await import("./server-PXE4DB3V.js");return g(a),a}async function it(n){let e=n.projectRoot??s.process.cwd(),t=n.logLevel??"info",r=n.mode==="dev",{renderer:o,htmlShell:i,frameworkPlugin:l,cssPlugin:p}=n;await pe(t);let u=await Q(e),a={...u,srcDir:s.path.resolve(e,u.srcDir),distDir:s.path.resolve(e,u.distDir),publicDir:s.path.resolve(e,u.publicDir),logLevel:t,mode:{isDev:r,isBuild:!1,isServe:!r,isWatch:r}};n.port!==void 0&&(a.server.port=n.port),n.hmr!==void 0?a.server.hmr=n.hmr:r&&(a.server.hmr=!0),n.open!==void 0&&(a.server.open=n.open),r&&(a.build.minify=!1);let d=await me(a),f=r||!d,h={framework:l,css:p};if(f&&r&&l!==void 0){let C=M(I(a),{...h,bundlerBackend:"deno-bundler"});await F(C)}else if(f&&l!==void 0){let C=M(I(a),{...h,bundlerBackend:"rolldown"});await F(C)}let g,c=null;r&&a.server.hmr?(c=new $,g=new w({distDir:a.distDir})):g=new w({distDir:a.distDir});let y=new H;await y.loadRoutes(a.distDir);let x=new T;await x.loadProxies(a.distDir),await ge({config:a,bundler:g,hmrManager:c,apiHandler:y,middlewareDispatcher:x,renderer:o??Z,htmlShell:i??ee},{frameworkPlugin:l,cssPlugin:p}),n.open&&fe(`http://localhost:${a.server.port}`)}function fe(n){let e={darwin:["open"],linux:["xdg-open"],windows:["cmd","/c","start"]},t=W(),r=e[t];r&&r[0]&&s.exec.spawnChild(r[0],[...r.slice(1),n],{stdout:"null",stderr:"null"})}export{le as VALID_LOG_LEVELS,ot as clearRoutesCache,it as startServer};
|
|
5
|
+
`,d={version:"1.0",buildId:"runtime-error",timestamp:Date.now(),logLevel:"error",entrypoint:"__runtime_bundle.js",hmrEnabled:!1,chunks:{},files:{}};return{code:a,manifest:d}}finally{try{await s.fs.remove(o,{recursive:!0})}catch(i){A.debug("Temp directory cleanup failed",{error:i})}}}clear(){this.clientComponents.clear(),this.moduleMap=null,this.bundleCode=null,this.lastScan=0}};var D=class{cache;constructor(e){this.cache=new _(e)}async getBundle(){let e=await this.cache.getOrCreateBundle();return{clientCode:e.clientCode,moduleMap:e.moduleMap,chunkManifest:e.chunkManifest,entrypoint:"/__runtime_bundle.js"}}async getRuntimeBundle(){return await this.cache.getOrCreateBundle()}async rebuild(){await this.cache.rebuild()}clear(){this.cache.clear()}};var Z={name:"noop",renderPage:()=>Promise.resolve({html:""}),renderRSC:()=>Promise.resolve(new Response("")),generateBootstrapScript:()=>""};var ee={name:"noop",createShell:()=>"<!DOCTYPE html><html><head></head><body></body></html>",createStreamingStart:()=>"<!DOCTYPE html><html><head></head><body>",createStreamingEnd:()=>"</body></html>"};var b=m.getLogger(["laroux-server","hmr"]),$=class{clients=new Set;handleConnection(e){this.clients.add(e),b.debug(`HMR client connected (${this.clients.size} total)`),this.sendToClient(e,{type:"connected"}),e.addEventListener("close",()=>{this.clients.delete(e),b.debug(`HMR client disconnected (${this.clients.size} remaining)`)}),e.addEventListener("error",t=>{b.error("HMR WebSocket error:",{event:t}),this.clients.delete(e)})}notifyUpdate(e=Date.now(),t){let r={type:"update",timestamp:e,changedModules:t};b.debug(`Notifying ${this.clients.size} clients of update${t?` (${t.length} modules changed)`:""}`);for(let o of this.clients)this.sendToClient(o,r)}notifyError(e){let t={type:"error",message:e};b.warn(`Notifying clients of error: ${e}`);for(let r of this.clients)this.sendToClient(r,t)}sendToClient(e,t){if(e.readyState===WebSocket.OPEN)try{e.send(JSON.stringify(t))}catch(r){b.error("Failed to send HMR message:",{error:r})}}getClientCount(){return this.clients.size}close(){for(let e of this.clients)e.close();this.clients.clear()}};var L=m.getLogger(["laroux-server","api-handler"]);function ie(n){let e=new Set;return{pattern:n.replace(/\[\.\.\.(\w+)\]/g,(r,o)=>(e.add(o),`:${o}*`)).replace(/\[(\w+)\]/g,(r,o)=>`:${o}`),catchAllParams:e}}function se(n,e){let{pattern:t,catchAllParams:r}=ie(e),i=new URLPattern({pathname:t}).exec({pathname:n});if(!i)return null;let l={},p=i.pathname.groups;for(let[u,a]of Object.entries(p))r.has(u)?l[u]=a?a.split("/").filter(Boolean):[]:l[u]=a??"";return l}var H=class{routes=[];moduleCache=new Map;registryDir="";async loadRoutes(e){try{let t=`file://${e}/server/api-routes.ts`;this.registryDir=s.path.resolve(e,"server");let r=await import(t);this.routes=r.apiRoutes||[],L.debug(`Loaded ${this.routes.length} API route(s)`)}catch{this.routes=[],L.debug("No API routes registry found")}}async handleRequest(e,t){let r=new URL(e.url),o=e.method;for(let i of this.routes){let l=se(t,i.path);if(l!==null){L.debug(`API route matched: ${o} ${t} -> ${i.path}`);try{let p=s.path.resolve(this.registryDir,i.modulePath),u=this.moduleCache.get(p);u||(u=await import(`file://${p}`),this.moduleCache.set(p,u));let a=u[o];return a?await a({request:e,params:l,searchParams:r.searchParams}):(L.debug(`Method ${o} not allowed for ${i.path}`),new Response("Method Not Allowed",{status:405,headers:{Allow:this.getAllowedMethods(u).join(", ")}}))}catch(p){return L.error(`API route error: ${i.path}`,{error:p}),new Response(JSON.stringify({error:"Internal Server Error"}),{status:500,headers:{"Content-Type":"application/json"}})}}}return null}getAllowedMethods(e){let t=[];return e.GET&&t.push("GET"),e.POST&&t.push("POST"),e.PUT&&t.push("PUT"),e.DELETE&&t.push("DELETE"),e.PATCH&&t.push("PATCH"),e.HEAD&&t.push("HEAD"),e.OPTIONS&&t.push("OPTIONS"),t}clearCache(){this.moduleCache.clear()}};var P=m.getLogger(["laroux-server","proxy-handler"]),T=class{proxies=[];moduleCache=new Map;registryDir="";async loadProxies(e){try{let t=`file://${e}/server/proxy-registry.ts`;this.registryDir=s.path.resolve(e,"server");let r=await import(t);this.proxies=r.proxyRegistry||[],P.debug(`Loaded ${this.proxies.length} proxy definition(s)`)}catch{this.proxies=[],P.debug("No proxy registry found")}}async runProxies(e,t){let r=t;for(let o of this.proxies)if(this.matchesPrefix(r,o.pathPrefix)){P.debug(`Running proxy: ${o.pathPrefix} for ${r}`);try{let i=s.path.resolve(this.registryDir,o.modulePath),l=this.moduleCache.get(i);l||(l=await import(`file://${i}`),this.moduleCache.set(i,l));let p=l.default;if(typeof p!="function"){P.warn(`Proxy ${o.modulePath} does not export a default function`);continue}let u=await p({request:e,pathname:r,params:{}});if(u.type==="response")return P.debug(`Proxy ${o.pathPrefix} returned response`),{result:u,finalPathname:r};if(u.type==="redirect")return P.debug(`Proxy ${o.pathPrefix} redirecting to ${u.url}`),{result:u,finalPathname:r};u.type==="rewrite"&&(P.debug(`Proxy ${o.pathPrefix} rewriting to ${u.pathname}`),r=u.pathname)}catch(i){return P.error(`Proxy error: ${o.pathPrefix}`,{error:i}),{result:{type:"response",response:new Response(JSON.stringify({error:"Proxy Error"}),{status:500,headers:{"Content-Type":"application/json"}})},finalPathname:r}}}return{result:{type:"next"},finalPathname:r}}matchesPrefix(e,t){return t==="/"?!0:e===t||e.startsWith(t+"/")}clearCache(){this.moduleCache.clear()}};function te(n,e){let t=X(n,e.path);if(t===null)return null;let r={};for(let[o,i]of Object.entries(t))Array.isArray(i)?r[o]=[...i]:typeof i=="string"&&(r[o]=i);return r}function U(n,e){for(let t of e){let r=te(n,t);if(r!==null)return{route:t,params:r}}return null}var le=["trace","debug","info","warn","error","fatal"];var oe="manifest.json",ue=n=>({trace:v.Debug,debug:v.Debug,info:v.Info,warn:v.Warning,error:v.Error,fatal:v.Critical})[n],R,E;async function pe(n){let e=ue(n),{output:t,renderers:r,sinks:o}=await import("./mod-CUIGNRIK.js"),i=t({renderer:r.ansi(),sink:o.stdout()});await G.configure({sinks:{console:V.getOutputSink(i)},loggers:[{category:["laroux-server"],lowestLevel:e,sinks:["console"]},{category:["laroux-bundler"],lowestLevel:e,sinks:["console"]},{category:["laroux"],lowestLevel:e,sinks:["console"]}]}),R=m.getLogger(["laroux-server","server"]),E=m.getLogger(["laroux-server","bundler"])}var O=null;function ot(){O=null}async function ce(n){if(O!==null)return O;let t=`file://${s.path.join(n.distDir,"server","_generated-routes.ts")}?t=${Date.now()}`,{generatedRoutes:r}=await import(t);return O=r,r}async function re(n,e){let t=s.path.resolve(n.distDir,"server","src","app",`${e}.js`);if(await s.fs.exists(t))return t;for(let r of Y){let o=s.path.resolve(n.distDir,"server","src","app",`${e}.${r}`);if(await s.fs.exists(o))return o}return t}async function ne(n,e){let t=Date.now(),o=`file://${await re(e,"layout")}?t=${t}`,{Layout:i}=await import(o),l=await ce(e),p=U(n,l);if(p===null){let a=`file://${await re(e,"not-found")}?t=${t}`,{NotFound:d}=await import(a);return{Layout:i,Page:d,params:{}}}return{Layout:i,Page:p.route.component,params:p.params}}async function de(n){try{let e=s.path.resolve(n.distDir,"client",oe),t=await s.fs.readTextFile(e);return JSON.parse(t).buildId}catch{return"unknown"}}async function me(n){try{let e=s.path.resolve(n.distDir,"client",oe),t=await s.fs.stat(e),r=await s.fs.stat(n.srcDir);return t.mtime===null||r.mtime===null?!1:t.mtime>r.mtime}catch{return!1}}function I(n){return{projectRoot:n.projectRoot,srcDir:n.srcDir,distDir:n.distDir,logLevel:n.logLevel,fonts:n.fonts,images:n.images,cssModuleTypes:n.cssModuleTypes,noCssModuleAutoReference:n.noCssModuleAutoReference,browserShims:n.browserShims,serverExternals:n.build.serverExternals}}async function ge(n,e={}){let{config:t,bundler:r,hmrManager:o}=n,{frameworkPlugin:i,cssPlugin:l}=e;try{let c=s.path.resolve(t.distDir,"server","actions-manifest.json");if(await s.fs.exists(c)){let x=await s.fs.readTextFile(c),z=JSON.parse(x),q=Date.now(),C=0;for(let J of z.actions)try{let k=s.path.resolve(t.distDir,"server",J);await s.fs.exists(k)&&(await import(`file://${k}?t=${q}`),C++)}catch(k){R.warn(`Failed to load action ${J}:`,{error:k})}C>0&&R.debug(`Server actions loaded: ${C} file(s)`)}else R.debug("No actions manifest found (optional)")}catch(c){R.warn("Failed to load server actions:",{error:c})}await ne("/",t);let p=await de(t);E.debug(`Build ID: ${p}`);let a={...n,getApp:c=>ne(c,t),buildId:p},d=await r.getBundle(),f={framework:i,css:l,bundlerBackend:"deno-bundler"};if(d.clientCode!==null&&o!==null){if(i!==void 0){let c=M(I(t),f);N(c,async y=>{if(r instanceof D)try{await r.rebuild()}catch(x){E.error("Compilation failed:",{error:x})}E.info(`\u2713 Compiled in ${y.duration.toFixed(0)}ms`),o?.notifyUpdate(Date.now(),y.changedFiles)})}}else if(t.mode.isWatch&&i!==void 0){let c=M(I(t),f);N(c,y=>{E.info(`\u2713 Compiled in ${y.duration.toFixed(0)}ms`)})}let h="";d.clientCode!==null&&o!==null?h=" HMR":d.clientCode!==null&&(h=" Watch"),R.info(`RSC Server${h}`),R.info(` Local: http://localhost:${t.server.port}`);let{startHTTPServer:g}=await import("./server-RYWDAYED.js");return g(a),a}async function it(n){let e=n.projectRoot??s.process.cwd(),t=n.logLevel??"info",r=n.mode==="dev",{renderer:o,htmlShell:i,frameworkPlugin:l,cssPlugin:p}=n;await pe(t);let u=await Q(e),a={...u,srcDir:s.path.resolve(e,u.srcDir),distDir:s.path.resolve(e,u.distDir),publicDir:s.path.resolve(e,u.publicDir),logLevel:t,mode:{isDev:r,isBuild:!1,isServe:!r,isWatch:r}};n.port!==void 0&&(a.server.port=n.port),n.hmr!==void 0?a.server.hmr=n.hmr:r&&(a.server.hmr=!0),n.open!==void 0&&(a.server.open=n.open),r&&(a.build.minify=!1);let d=await me(a),f=r||!d,h={framework:l,css:p};if(f&&r&&l!==void 0){let C=M(I(a),{...h,bundlerBackend:"deno-bundler"});await F(C)}else if(f&&l!==void 0){let C=M(I(a),{...h,bundlerBackend:"rolldown"});await F(C)}let g,c=null;r&&a.server.hmr?(c=new $,g=new w({distDir:a.distDir})):g=new w({distDir:a.distDir});let y=new H;await y.loadRoutes(a.distDir);let x=new T;await x.loadProxies(a.distDir),await ge({config:a,bundler:g,hmrManager:c,apiHandler:y,middlewareDispatcher:x,renderer:o??Z,htmlShell:i??ee},{frameworkPlugin:l,cssPlugin:p}),n.open&&fe(`http://localhost:${a.server.port}`)}function fe(n){let e={darwin:["open"],linux:["xdg-open"],windows:["cmd","/c","start"]},t=W(),r=e[t];r&&r[0]&&s.exec.spawnChild(r[0],[...r.slice(1),n],{stdout:"null",stderr:"null"})}export{le as VALID_LOG_LEVELS,ot as clearRoutesCache,it as startServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-3I4JG3PJ.js";import"./chunk-GXPLME3K.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as MANIFEST_FILENAMES,c as getManifestPath,b as loadManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as G,b as v}from"./chunk-TXL6YOFL.js";import{a as P,b as g}from"./chunk-GETSWLMF.js";import{a as S,b as J}from"./chunk-3EFU5R2M.js";import{a as K,b as V}from"./chunk-U47ABJCC.js";import{a as h,b as O,c as k,d as R,e as B,f as E}from"./chunk-762C2IM6.js";import"./chunk-5MN3MWQN.js";import{a as f,b as u}from"./chunk-BDTJR6UH.js";import{a as A,b as C}from"./chunk-QIYWONJL.js";import{a as M,b as w}from"./chunk-AAV7D6DF.js";import{a as I,b as T}from"./chunk-QIODVVTY.js";import{a as l,b as m,c as s,d,e as y,f as F,g as x}from"./chunk-3K42AALS.js";import"./chunk-OLM5RTFK.js";import"./chunk-BCHXUKWW.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var o=null,b=async()=>{if(o!==null)return o;let{anthropicFactory:e}=await import("./anthropic-SL274RBQ.js"),{openaiFactory:r}=await import("./openai-XMIVMDDL.js"),{geminiFactory:t}=await import("./gemini-ARTUPDPZ.js"),{vertexaiFactory:a}=await import("./vertexai-TPGIAJNA.js"),{claudeCodeFactory:i}=await import("./claude-code-K37KYX7W.js"),{ollamaFactory:c}=await import("./ollama-6JZ2IKR7.js"),{openCodeFactory:n}=await import("./opencode-CHIAJALZ.js"),{kiroFactory:p}=await import("./kiro-XQDHURLU.js");return o=[e,r,t,a,i,c,n,p],o};export{G as AnthropicModel,f as ClaudeCodeModel,S as GeminiModel,I as KiroModel,A as OllamaModel,P as OpenAIModel,M as OpenCodeModel,K as VertexAIModel,v as anthropicFactory,y as captureStderr,F as classifyExitCode,E as classifyGenAIError,u as claudeCodeFactory,b as defaultFactories,x as formatMessagesAsText,J as geminiFactory,T as kiroFactory,O as mapContentBlockToGenAIPart,B as mapGenAIResponseToResult,k as mapMessagesToGenAI,h as mapRoleToGenAI,R as mapToolsToGenAI,C as ollamaFactory,w as openCodeFactory,g as openaiFactory,s as parseJsonlStream,d as parseTextOutput,l as resolveBinary,m as spawnCliProcess,V as vertexaiFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f as g,g as h,h as i,i as j,j as k,k as l}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f as g,g as h,h as i,i as j,j as k,k as l}from"./chunk-TTYO2XJO.js";import{n as f}from"./chunk-PLJNPQFC.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{b as PipelineError,a as StreamError,c as TimeoutError,d as createChunk,e as defineLayer,k as layers,g as output,h as pipeline,l as renderers,i as sinks,j as sources,f as span};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{a as _}from"./chunk-GXPLME3K.js";import{d as L}from"./chunk-2J2PXBOC.js";import{f as U,h as H,k as G}from"./chunk-TTYO2XJO.js";import{b as w,d as S,e as C,f as O,j as z}from"./chunk-PLJNPQFC.js";import{b as N}from"./chunk-BCHXUKWW.js";import{a as q}from"./chunk-HPPFA3XU.js";import{a as E,b as $,d as V,f as D}from"./chunk-DQAEQEXD.js";import{t as l}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import{b as v}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var x=class extends TransformStream{constructor(t){let e;super({transform(s,a){if(e!==void 0){let n=new Uint8Array(e.length+s.length);n.set(e),n.set(s,e.length),s=n}for(let n=t;n<=s.length;n+=t)a.enqueue(s.slice(n-t,n));let f=-s.length%t;e=f?s.slice(f):void 0},flush(s){e?.length&&s.enqueue(e)}})}};var P=class{#s;#n;#t;#e=[];#r=!1;constructor(){let{readable:t,writable:e}=new TransformStream;this.#s=ReadableStream.from(this.#i()),this.#n=e,this.#t=t.pipeThrough(new x(512)).getReader()}async#a(){let{done:t,value:e}=await this.#t.read();if(!t){if(e.length!==512)throw new RangeError(`Cannot extract the tar archive: The tarball chunk has an unexpected number of bytes (${e.length})`);return this.#e.push(e),this.#e.shift()}}async*#i(){for(let e=0;e<2;++e){let{done:s,value:a}=await this.#t.read();if(s||a.length!==512)throw new RangeError("Cannot extract the tar archive: The tarball is too small to be valid");this.#e.push(a)}let t=new TextDecoder;for(;;){for(;this.#r;)await new Promise(n=>setTimeout(n,0));if(this.#e.every(n=>n.every(o=>o===0))){await this.#t.cancel("Tar stream finished prematurely");return}let e=await this.#a();if(e==null){if(this.#e.every(n=>n.every(o=>o===0)))break;throw new TypeError("Cannot extract the tar archive: The tarball has invalid ending")}let s=parseInt(t.decode(e.subarray(148,156)),8);if(e.fill(32,148,156),e.reduce((n,o)=>n+o)!==s)throw new SyntaxError("Cannot extract the tar archive: An archive entry has invalid header checksum");let a={name:t.decode(e.subarray(0,100)).split("\0")[0],mode:parseInt(t.decode(e.subarray(100,108)),8),uid:parseInt(t.decode(e.subarray(108,116)),8),gid:parseInt(t.decode(e.subarray(116,124)),8),size:parseInt(t.decode(e.subarray(124,136)).trimEnd(),8),mtime:parseInt(t.decode(e.subarray(136,147)),8),typeflag:t.decode(e.subarray(156,157)),linkname:t.decode(e.subarray(157,257)).split("\0")[0]};a.typeflag==="\0"&&(a.typeflag="0"),[117,115,116,97,114,0,48,48].every((n,o)=>e[o+257]===n)&&(a={...a,magic:t.decode(e.subarray(257,263)),version:t.decode(e.subarray(263,265)),uname:t.decode(e.subarray(265,297)).split("\0")[0],gname:t.decode(e.subarray(297,329)).split("\0")[0],devmajor:t.decode(e.subarray(329,337)).replaceAll("\0",""),devminor:t.decode(e.subarray(337,345)).replaceAll("\0",""),prefix:t.decode(e.subarray(345,500)).split("\0")[0]});let f={path:("prefix"in a&&a.prefix.length?a.prefix+"/":"")+a.name,header:a};["1","2","3","4","5","6"].includes(a.typeflag)||(f.readable=this.#l(a.size)),yield f}}async*#o(t){for(let e=Math.ceil(t/512);e>0;--e){let s=await this.#a();if(s==null)throw new SyntaxError("Cannot extract the tar archive: Unexpected end of Tarball");e===1&&t%512?yield s.subarray(0,t%512):yield s}}#l(t){this.#r=!0;let e=()=>this.#r=!1,s=this.#o(t);return new ReadableStream({type:"bytes",async pull(a){let{done:f,value:n}=await s.next();if(f)return e(),a.close(),a.byobRequest?.respond(0);if(a.byobRequest?.view){let o=new Uint8Array(a.byobRequest.view.buffer),i=o.length;i<n.length?(o.set(n.slice(0,i)),a.byobRequest.respond(i),a.enqueue(n.slice(i))):(o.set(n),a.byobRequest.respond(n.length))}else a.enqueue(n)},async cancel(){for await(let a of s);e()}})}get readable(){return this.#s}get writable(){return this.#n}};var M=async(r,t,e={})=>{let{stripComponents:s=0,subpath:a}=e,f=a!==void 0?l.path.normalize(a).replace(/^\/+/,""):void 0,o=r.pipeThrough(new DecompressionStream("gzip")).pipeThrough(new P);for await(let i of o){let c=l.path.normalize(i.path);if(c.startsWith("..")||l.path.isAbsolute(c)){i.readable!==void 0&&await i.readable.cancel();continue}let u=c.split(l.path.sep).slice(s);if(u.length===0){i.readable!==void 0&&await i.readable.cancel();continue}let d=u.join(l.path.sep);if(f!==void 0){if(!d.startsWith(f)){i.readable!==void 0&&await i.readable.cancel();continue}if(d.slice(f.length).replace(/^\/+/,"")===""){i.readable!==void 0&&await i.readable.cancel();continue}}let h=f!==void 0?l.path.join(t,d.slice(f.length).replace(/^\/+/,"")):l.path.join(t,d);if(await l.fs.ensureDir(l.path.dirname(h)),i.readable!==void 0){let b=new Response(i.readable),m=new Uint8Array(await b.arrayBuffer());await l.fs.writeFile(h,m)}}};var re="main",se=r=>{let[t,e]=r.split("#");if(t===void 0)throw new Error(`Invalid GitHub specifier: ${r}`);let s=t.split("/");if(s.length<2)throw new Error(`Invalid GitHub specifier: ${r}. Expected format: owner/repo[/path][#ref]`);let[a,f,...n]=s;if(a===void 0||f===void 0)throw new Error(`Invalid GitHub specifier: ${r}. Expected format: owner/repo[/path][#ref]`);return{provider:"github",raw:r,owner:a,repo:f,ref:e??re,path:n.length>0?n.join("/"):void 0}},ne=async(r,t)=>{let e=r,{owner:s,repo:a,ref:f,path:n}=e,o=`https://codeload.github.com/${s}/${a}/tar.gz/${f}`,i=await fetch(o);if(!i.ok)throw i.status===404?new Error(`Repository not found: ${s}/${a} (ref: ${f})`):new Error(`Failed to fetch template: ${i.status} ${i.statusText}`);if(i.body===null)throw new Error("Response body is empty");await M(i.body,t,{stripComponents:1,subpath:n})},W={name:"github",prefixes:["github","gh"],isDefault:!0,parse:se,fetch:ne};var g={providers:new Map,defaultProvider:null,initialized:!1},A=()=>{g.initialized||(g.initialized=!0,B(W))},B=r=>{g.providers.set(r.name,r);for(let t of r.prefixes)g.providers.set(t,r);r.isDefault===!0&&(g.defaultProvider=r)},ae=r=>(A(),g.providers.get(r)??null),ie=()=>(A(),g.defaultProvider),X=r=>{A();let t=r.indexOf(":");if(t!==-1){let e=r.slice(0,t),s=r.slice(t+1),a=g.providers.get(e);if(a===void 0)throw new Error(`Unknown provider prefix: ${e}`);return{provider:a,ref:a.parse(s)}}if(g.defaultProvider===null)throw new Error("No default provider registered");return{provider:g.defaultProvider,ref:g.defaultProvider.parse(r)}},I=async(r,t)=>{let{provider:e,ref:s}=X(r);return await e.fetch(s,t),s};var J=[".manifest.yml",".manifest.yaml"],j=async r=>{for(let t of J){let e=l.path.join(r,t);try{let s=await l.fs.readTextFile(e),a=_(s);if(typeof a.name!="string"||a.name==="")throw new Error(`Template config missing required 'name' field: ${e}`);return a}catch(s){if(s instanceof v)continue;throw s}}return null},oe=r=>{let t=r.description??r.name,e=r.default!==void 0?` [${r.default}]`:"",s=r.required===!0?" (required)":"",a=`${t}${s}${e}: `,f=globalThis.prompt(a);return f===null||f===""?r.default??null:f},Y=(r,t)=>r.pattern===void 0||new RegExp(r.pattern).test(t)?null:`Value '${t}' does not match pattern '${r.pattern}'`,F=(r,t)=>{let{provided:e,interactive:s}=t,a=r.variables??[],f={...e},n=[];for(let o of a){let{name:i,required:c,default:p}=o;if(f[i]!==void 0){let u=Y(o,f[i]);u!==null&&n.push(`${i}: ${u}`);continue}if(s){let u=oe(o);if(u!==null){let d=Y(o,u);d!==null?n.push(`${i}: ${d}`):f[i]=u;continue}}if(p!==void 0){f[i]=p;continue}c===!0&&n.push(`Missing required variable: ${i}`)}if(n.length>0)throw new Error(`Variable resolution failed:
|
|
2
|
+
${n.join(`
|
|
3
|
+
`)}`);return f},K=async r=>{for(let t of J){let e=l.path.join(r,t);try{return await l.fs.stat(e),e}catch{continue}}return null};var Q=/\{\{\s*\.(\w+)\s*\}\}/g,le=["png","jpg","jpeg","gif","ico","webp","svg","woff","woff2","ttf","eot","otf","zip","tar","gz","bz2","xz","7z","pdf","doc","docx","xls","xlsx","ppt","pptx","exe","dll","so","dylib","mp3","mp4","avi","mov","webm"],fe=r=>L(r.toLowerCase(),le),ce=(r,t)=>{for(let e of t)if(e.startsWith("*")){let s=e.slice(1);if(r.endsWith(s))return!0}else if(e.includes("*")){let s=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");if(new RegExp(`^${s}$`).test(r))return!0}else if(r===e||r.startsWith(e+"/"))return!0;return!1},T=(r,t)=>r.replace(Q,(e,s)=>{let a=t[s];return a===void 0?`{{.${s}}}`:a}),R=r=>Q.test(r),Z=async(r,t)=>{let{variables:e,ignore:s}=t,a=[],f=[];for await(let n of l.fs.walk(r,{includeDirs:!0})){let o=l.path.relative(r,n.path);o!==""&&(ce(o,s)||(n.isDirectory?R(n.name)&&f.push(n.path):n.isFile&&a.push(n.path)))}for(let n of a){let o=l.path.basename(n),i=l.path.dirname(n);if(!fe(n))try{let c=await l.fs.readTextFile(n);if(R(c)){let p=T(c,e);await l.fs.writeTextFile(n,p)}}catch(c){if(!(c instanceof Error&&c.name==="InvalidData"))throw c}if(R(o)){let c=T(o,e),p=l.path.join(i,c);p!==n&&await l.fs.rename(n,p)}}f.sort((n,o)=>o.split(l.path.sep).length-n.split(l.path.sep).length);for(let n of f){let o=l.path.basename(n),i=l.path.dirname(n),c=T(o,e),p=l.path.join(i,c);p!==n&&await l.fs.rename(n,p)}},ee=async r=>{try{await l.fs.remove(r)}catch(t){if(!(t instanceof v))throw t}};var k=async r=>{let{specifier:t,targetDir:e,variables:s={},force:a=!1,skipPostInstall:f=!1,interactive:n=!1}=r,o=l.path.isAbsolute(e)?e:l.path.join(l.process.cwd(),e);try{let m=[];for await(let y of l.fs.readDir(o)){m.push(y);break}if(m.length>0&&!a)throw new Error(`Target directory is not empty: ${o}. Use --force to overwrite.`)}catch(m){if(!(m instanceof v))throw m}await l.fs.ensureDir(o),await I(t,o);let i=await j(o),c=i?.name??t,p=i!==null?F(i,{provided:s,interactive:n}):s,u=[".git",".manifest.yml",".manifest.yaml",...i?.ignore??[]];await Z(o,{variables:p,ignore:u});let d=await K(o);d!==null&&await ee(d);let h=i?.postInstall??[],b=[];if(!f&&h.length>0)for(let m of h)try{(await N`${m}`.cwd(o).stdout("inherit").stderr("inherit").noThrow().spawn()).success?b.push(m):console.warn(`Post-install command failed: ${m}`)}catch(y){console.warn(`Post-install command error: ${m}`,y)}return{templateName:c,targetDir:o,variables:p,postInstallCommands:b}};var ze=async r=>{let t=q(r??l.process.args,{string:["path","var"],boolean:["force","interactive","skip-post-install","help"],alias:{p:"path",f:"force",i:"interactive",h:"help"},collect:["var"]});if(t.help)return console.log(`Usage: scaffold <specifier> [options]
|
|
4
|
+
|
|
5
|
+
Options:
|
|
6
|
+
-p, --path <dir> Target directory (default: .)
|
|
7
|
+
-f, --force Overwrite existing files
|
|
8
|
+
-i, --interactive Prompt for missing variables
|
|
9
|
+
--var key=value Set a template variable (repeatable)
|
|
10
|
+
--skip-post-install Skip post-install commands
|
|
11
|
+
-h, --help Show this help message
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
scaffold eser/ajan
|
|
15
|
+
scaffold gh:eser/ajan#v1.0 -p ./my-project
|
|
16
|
+
scaffold eser/ajan --var name=my-app --var author=me`),E(void 0);let e=G.ansi(),s=U({renderer:e,sink:H.stdout()});if(t._.length===0)return await s.close(),$({message:`${e.render([C("Error: Template specifier is required")])}
|
|
17
|
+
|
|
18
|
+
Usage: scaffold <specifier> [options]
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
scaffold eser/ajan
|
|
22
|
+
scaffold gh:eser/ajan#v1.0
|
|
23
|
+
scaffold eser/ajan -p ./my-project`,exitCode:1});let a=String(t._[0]),f=t.path??".",n=t.force??!1,o=t["skip-post-install"]??!1,i=t.interactive??!1,c=t.var,p={};if(c!==void 0)for(let h of c){let[b,...m]=String(h).split("=");b!==void 0&&(p[b]=m.join("="))}s.writeln(w("Scaffolding from "),z(a),w("..."));let u=await D(()=>k({specifier:a,targetDir:f,variables:p,force:n,skipPostInstall:o,interactive:i}),h=>({message:h.message}));if(V(u))return await s.close(),$({message:e.render([C(`
|
|
24
|
+
Scaffolding failed: ${u.error.message}`)]),exitCode:1});let d=u.value;if(s.writeln(O(`
|
|
25
|
+
Scaffolded ${d.templateName} to ${d.targetDir}`)),Object.keys(d.variables).length>0){s.writeln(w(`
|
|
26
|
+
Variables applied:`));for(let[h,b]of Object.entries(d.variables))s.writeln(w(" "),S(h),w(`: ${b}`))}if(d.postInstallCommands.length>0){s.writeln(w(`
|
|
27
|
+
Post-install commands executed:`));for(let h of d.postInstallCommands)s.writeln(w(" "),S(h))}return await s.close(),E(void 0)};export{I as fetchTemplate,ie as getDefaultProvider,ae as getProvider,R as hasVariables,j as loadTemplateConfig,ze as main,X as parseSpecifier,B as registerProvider,F as resolveVariables,k as scaffold,T as substituteVariables};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as Pe}from"./chunk-AYSPDG4K.js";import{a as $e}from"./chunk-NTPOK5H6.js";import{a as ke,c as he}from"./chunk-W3REWI3H.js";import{a as xe,c as be}from"./chunk-XMCQMTAA.js";import{a as Ve,c as we}from"./chunk-VVHXAOEH.js";import{a as Ce}from"./chunk-TUTRX7VR.js";import{a as Se}from"./chunk-4HAIX3WN.js";import{a as De}from"./chunk-HTBLWLKV.js";import{a as Te}from"./chunk-GVSBZ6JV.js";import"./chunk-AKJB4CER.js";import{a as Fe,c as Re}from"./chunk-JOXKA7TJ.js";import{a as ae,c as se}from"./chunk-G34MS4XJ.js";import{a as oe,c as ie}from"./chunk-ANY26ROY.js";import{a as re,c as ne}from"./chunk-H4OFOQQ2.js";import{a as le,c as de}from"./chunk-U65FD6J3.js";import{a as ce,c as pe}from"./chunk-6HYGGBEQ.js";import{a as me,c as ue}from"./chunk-QZY4BKI7.js";import{a as fe,c as ge}from"./chunk-4VL2RZIN.js";import{a as ve,c as ye}from"./chunk-NGZZAQ7G.js";import{a as K,c as U}from"./chunk-PO3SXFUE.js";import{a as X,c as H}from"./chunk-YWCEHTZB.js";import{a as Q,c as Z}from"./chunk-YMY2URYM.js";import{a as ee,c as te}from"./chunk-YQU3TEIG.js";import{a as G}from"./chunk-SBOTNOWZ.js";import"./chunk-CPRLAMEG.js";import{b as B,c as Y}from"./chunk-3I4JG3PJ.js";import"./chunk-V2N5L24J.js";import"./chunk-Y6DZEK4W.js";import"./chunk-34GCQZ3Z.js";import"./chunk-3APERFKY.js";import"./chunk-6U2VEZEM.js";import"./chunk-KAEAT6A4.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import"./chunk-NUSNMQPL.js";import"./chunk-GXPLME3K.js";import{b as _}from"./chunk-2J2PXBOC.js";import{f as W,h as J,k as z}from"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b as g,d as y,e as x,f as R,g as L,j as q}from"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import{a as O}from"./chunk-HPPFA3XU.js";import{a as T,b as A}from"./chunk-DQAEQEXD.js";import{t as F}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var C=async t=>{let s=await B(t);return s===null?null:s},Me=async t=>await Y(t);var P={name:"validate-circular-deps",description:"Detect circular package dependencies",requiredStacks:[],async validate(t){let s=await De({root:t.root});return{name:"validate-circular-deps",passed:!s.hasCycles,issues:s.cycles.map(a=>({severity:"error",message:`Circular dependency: ${a.join(" \u2192 ")}`})),stats:{packagesChecked:s.packagesChecked}}}};var $={name:"validate-mod-exports",description:"Validate mod.ts exports all files",requiredStacks:["javascript"],async validate(t){let s=await Pe({root:t.root});return{name:"validate-mod-exports",passed:s.isComplete,issues:s.missingExports.map(a=>({severity:"error",message:`Missing export in ${a.packageName}: ${a.file}`,file:a.file})),stats:{packagesChecked:s.packagesChecked}}}};var E={name:"validate-export-names",description:"Validate export naming conventions",requiredStacks:["javascript"],async validate(t){let s=await Te({root:t.root});return{name:"validate-export-names",passed:s.isValid,issues:s.violations.map(a=>({severity:"error",message:`${a.packageName}: "${a.exportPath}" should be "${a.suggestion}"`})),stats:{packagesChecked:s.packagesChecked}}}};var j={name:"validate-docs",description:"Validate JSDoc documentation",requiredStacks:["javascript"],async validate(t){let s=t.options?.requireExamples,a=await Se({root:t.root,requireExamples:s});return{name:"validate-docs",passed:a.isValid,issues:a.issues.map(e=>({severity:"error",message:`${e.symbol}: ${e.issue}`,file:e.file,line:e.line})),stats:{filesChecked:a.filesChecked,symbolsChecked:a.symbolsChecked}}}};var M={name:"validate-package-configs",description:"Validate deno.json/package.json consistency",requiredStacks:["javascript"],async validate(t){let s=await $e({root:t.root}),a=[];for(let e of s.inconsistencies)a.push({severity:"error",message:`${e.packageName}: ${e.field} mismatch - deno.json: ${JSON.stringify(e.denoValue)}, package.json: ${JSON.stringify(e.packageValue)}`});for(let e of s.dependencyInconsistencies){let i=`${e.packageName}: ${e.dependencyName} - ${e.issue}`;e.expected!==void 0&&e.actual!==void 0&&(i+=` (expected: ${e.expected}, actual: ${e.actual})`),a.push({severity:"error",message:i})}return{name:"validate-package-configs",passed:s.isConsistent,issues:a,stats:{packagesChecked:s.packagesChecked}}}};var qe=[{pattern:/\bDeno\.cwd\(\)/,replacement:"runtime.process.cwd()"},{pattern:/\bDeno\.env\.get\b/,replacement:"runtime.env.get()"},{pattern:/\bDeno\.env\.set\b/,replacement:"runtime.env.set()"},{pattern:/\bDeno\.env\.delete\b/,replacement:"runtime.env.delete()"},{pattern:/\bDeno\.env\.has\b/,replacement:"runtime.env.has()"},{pattern:/\bDeno\.env\.toObject\b/,replacement:"runtime.env.toObject()"},{pattern:/\bDeno\.readTextFile\b/,replacement:"runtime.fs.readTextFile()"},{pattern:/\bDeno\.readFile\b/,replacement:"runtime.fs.readFile()"},{pattern:/\bDeno\.writeTextFile\b/,replacement:"runtime.fs.writeTextFile()"},{pattern:/\bDeno\.writeFile\b/,replacement:"runtime.fs.writeFile()"},{pattern:/\bDeno\.mkdir\b/,replacement:"runtime.fs.mkdir()"},{pattern:/\bDeno\.remove\b/,replacement:"runtime.fs.remove()"},{pattern:/\bDeno\.stat\b/,replacement:"runtime.fs.stat()"},{pattern:/\bDeno\.lstat\b/,replacement:"runtime.fs.lstat()"},{pattern:/\bDeno\.readDir\b/,replacement:"runtime.fs.readDir()"},{pattern:/\bDeno\.copyFile\b/,replacement:"runtime.fs.copyFile()"},{pattern:/\bDeno\.rename\b/,replacement:"runtime.fs.rename()"},{pattern:/\bDeno\.open\b/,replacement:"runtime.fs (or @eser/streams)"},{pattern:/\bDeno\.exit\b/,replacement:"runtime.process.exit()"},{pattern:/\bnew Deno\.Command\b/,replacement:"runtime.exec.spawn() (or @eser/shell/exec)"},{pattern:/\bDeno\.args\b/,replacement:"runtime.process.args"}],We=[],Je=t=>We.some(s=>s.test(t)),ze=(t,s)=>{let a=t.slice(0,s);return a.includes("//")||a.includes("/*")&&!a.includes("*/")},_e=(t,s)=>{let a=!1,e=!1,i=!1;for(let n=0;n<s;n++){let l=t[n];(n>0?t[n-1]:"")!=="\\"&&(l==="'"&&!e&&!i&&(a=!a),l==='"'&&!a&&!i&&(e=!e),l==="`"&&!a&&!e&&(i=!i))}return a||e||i},b=G({name:"validate-runtime-js-apis",description:"Detect direct usage of runtime-specific APIs (use @eser/standards/cross-runtime instead)",canFix:!1,stacks:["javascript"],defaults:{},extensions:_,checkFile(t,s){if(s===void 0)return[];if(Je(t.path))return[];let a=[],e=s.split(`
|
|
2
|
+
`);for(let i=0;i<e.length;i++){let n=e[i];for(let{pattern:l,replacement:d}of qe){let c=l.exec(n);c!==null&&(ze(n,c.index)||_e(n,c.index)||a.push({path:t.path,line:i+1,message:`direct Deno API usage: ${c[0]} \u2014 use @eser/standards/cross-runtime (${d})`}))}}return a}}),ct=b.run,Ee=b.validator,pt=b.main;var k={validators:new Map,initialized:!1},Ye=()=>{o(P),o($),o(E),o(j),o(M),o(U),o(H),o(Z),o(te),o(se),o(ie),o(ne),o(de),o(pe),o(ue),o(ge),o(ye),o(he),o(be),o(we),o(Re),o(Ee)},I=()=>{k.initialized||(k.initialized=!0,Ye())},o=t=>{k.validators.set(t.name,t)},Ge=t=>(I(),k.validators.get(t)??null),N=()=>(I(),[...k.validators.values()]),Ke=()=>(I(),[...k.validators.keys()]),Ue=t=>({name:t.config.name,description:t.config.description,run:async s=>{let a=await t.run(s);return{name:a.name,passed:a.issues.length===0,issues:a.issues.map(e=>({path:e.path,line:e.line,message:e.message,fixed:e.fixed})),mutations:a.mutations.map(e=>({path:e.path,oldContent:e.oldContent,newContent:e.newContent})),stats:{filesChecked:a.filesChecked,issuesFound:a.issues.length}}}}),Xe=t=>({name:t.name,description:t.description,run:async s=>{let a=await t.validate({root:s.root??".",options:s});return{name:a.name,passed:a.passed,issues:a.issues.map(e=>({path:e.file,line:e.line,message:e.message})),mutations:[],stats:a.stats}}}),He=()=>{let t=[],s=[K,X,Q,ee,ae,oe,re,le,ce,me,fe,ve,ke,xe,Ve,Fe,b];for(let e of s)t.push(Ue(e));let a=[P,$,E,j,M];for(let e of a)t.push(Xe(e));return t.push({name:"validate-commit-msg",description:"Validate conventional commit format",run:async e=>{let i=e.commitMsgFile??e._args?.[0]??".git/COMMIT_EDITMSG",{runtime:n}=await import("./mod-WYRORC72.js"),l;try{l=await n.fs.readTextFile(i)}catch{return{name:"validate-commit-msg",passed:!1,issues:[{message:`cannot read commit message file: ${i}`}],mutations:[],stats:{}}}let d=Ce(l,{allowAsterisk:e.allowAsterisk,allowMultipleScopes:e.allowMultipleScopes,forceScope:e.forceScope,types:e.types});return{name:"validate-commit-msg",passed:d.valid,issues:d.issues.map(c=>({message:c})),mutations:[],stats:{}}}}),t};var Qe=async(t={})=>{let s=t.root??F.process.cwd(),e=(await C(s))?.stack??[],i=[...t.skip??[]],n=t.only??[],l=N(),d=[],c=[],V=[];for(let p of l){if(n.length>0&&!n.includes(p.name))continue;if(i.includes(p.name)){V.push(p.name);continue}if(p.requiredStacks.length>0&&e.length>0&&!p.requiredStacks.some(w=>e.includes(w))){c.push({name:p.name,reason:`Requires '${p.requiredStacks.join("' or '")}' stack`});continue}let S={...t.fix!==void 0?{fix:t.fix}:{}},m=await p.validate({root:s,options:S});d.push(m)}return{passed:d.every(p=>p.passed),results:d,skipped:c,disabled:V}},Ot=async t=>{let s=O(t??F.process.args,{string:["root","only","skip"],boolean:["fix","help"],alias:{h:"help"}});if(s.help)return console.log("Usage: deno run --allow-all ./validation/mod.ts [options]"),console.log(),console.log("Options:"),console.log(" --root <dir> Root directory (default: cwd)"),console.log(" --only <validators> Run only specific validators (comma-separated)"),console.log(" --skip <validators> Skip specific validators (comma-separated)"),console.log(" --fix Auto-fix issues where supported"),console.log(" -h, --help Show this help message"),T(void 0);let a=z.ansi(),e=W({renderer:a,sink:J.stdout()}),i=s.root,n=s.fix,l=s.only,d=s.skip,c=l!==void 0?l.split(",").map(r=>r.trim()):void 0,V=d!==void 0?d.split(",").map(r=>r.trim()):void 0,S=(await C(i??"."))?.stack?.join(", ")??"all (no .manifest.yml)";e.writeln(g(`Validating codebase...
|
|
3
|
+
`)),e.writeln(g("Stack: "),q(S),g(`
|
|
4
|
+
`));let m=await Qe({root:i,only:c,skip:V,fix:n});for(let r of m.results){let u=r.passed?R("PASS"):x("FAIL"),v=Object.entries(r.stats).map(([f,D])=>`${D} ${f}`).join(", ");e.writeln(g(` ${r.name.padEnd(18)} `),u,g(` (${v})`))}if(m.skipped.length>0){e.writeln(y(`
|
|
5
|
+
Skipped (stack not configured):`));for(let r of m.skipped)e.writeln(y(` - ${r.name}: ${r.reason}`))}if(m.disabled.length>0){e.writeln(y(`
|
|
6
|
+
Disabled:`));for(let r of m.disabled)e.writeln(y(` - ${r}`))}let h=m.results.flatMap(r=>r.issues.map(u=>({validator:r.name,...u})));if(h.length>0){e.writeln(x(`
|
|
7
|
+
Issues (${h.length}):
|
|
8
|
+
`));let r=new Map;for(let u of h){let v=u.file??u.validator,f=r.get(v)??[];f.push(u),r.set(v,f)}for(let[u,v]of r){e.writeln(y(` ${u}`));for(let f of v){let D=f.severity==="error"?x("error"):L("warning"),je=f.line!==void 0?`:${f.line}`:"";e.writeln(g(" "),D,g(`${je}: ${f.message}`))}e.writeln()}}let w=m.results.filter(r=>!r.passed).length;return w>0?(await e.close(),A({message:a.render([x(`
|
|
9
|
+
${w} check(s) failed with ${h.length} issue(s)`)]),exitCode:1})):(e.writeln(R(`
|
|
10
|
+
All checks passed!`)),await e.close(),T(void 0))};export{Me as getProjectConfigPath,Ge as getValidator,Ke as getValidatorNames,N as getValidators,He as getWorkflowTools,C as loadProjectConfig,Ot as main,o as registerValidator,Qe as validate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-LO424HF3.js";import"./chunk-LOFP256P.js";import"./chunk-TTYO2XJO.js";import"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import"./chunk-MBC2JM7F.js";import"./chunk-DQAEQEXD.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{d as completionsHandler,f as doctorHandler,a as installHandler,b as uninstallHandler,c as updateHandler,e as versionHandler};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as T,h as J}from"./chunk-
|
|
1
|
+
import{c as T,h as J}from"./chunk-5RK3346P.js";import{a as S}from"./chunk-4H4O3TGK.js";import{b as B,c as W}from"./chunk-2J2PXBOC.js";import{e as h}from"./chunk-OBIEQJDE.js";import"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import"./chunk-GLSCZGXA.js";import"./chunk-ZE5T64HQ.js";import{t as i}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var P=h.getLogger(["laroux-bundler","rsc-analyze"]);function Z(t){return{filePath:t.filePath,relativePath:t.relativePath,exportNames:[...t.exports]}}async function E(t,e,n){if(P.debug(`\u{1F50D} Analyzing client components in: ${t}`),!n){let p=(await T(t,{projectRoot:e})).map(Z);return P.debug(`\u{1F4CA} Total client components found: ${p.length}`),p}let r=[],o=0,a=0,l=await T(t,{projectRoot:e});for(let s of l){let p=0;try{p=(await i.fs.stat(s.filePath)).mtime?.getTime()??0}catch{continue}let c=n.getClientComponent(s.filePath,p);if(c){o++,c.isClient&&r.push({filePath:s.filePath,relativePath:s.relativePath,exportNames:c.exportNames});continue}a++;let x=[...s.exports];n.setClientComponent(s.filePath,!0,x,p),r.push({filePath:s.filePath,relativePath:s.relativePath,exportNames:x}),P.debug(` \u2713 Found client component: ${s.relativePath} (exports: ${x.join(", ")})`)}return(o>0||a>0)&&P.debug(`\u{1F4CA} Component analysis: ${o} cache hits, ${a} analyzed`),P.debug(`\u{1F4CA} Total client components found: ${r.length}`),r}async function _(t){let e=[],n=/(?:node_modules|\.test\.|\.spec\.)/;for await(let r of S(t,"**/*.{tsx,ts,jsx,js}",n))e.push(i.path.join(t,r));return e}var v=h.getLogger(["laroux-bundler","rsc-transform"]);async function H(t,e){let n=i.path.dirname(t.relativePath),r=i.path.join(e,n);await i.fs.ensureDir(r);let o=tt(t),a=t.relativePath.split("/").pop(),l=i.path.join(r,a);return await i.fs.writeTextFile(l,o),{originalPath:t.filePath,transformedPath:l}}function tt(t){let e=t.exportNames.map(n=>n==="default"?`export default createClientReference(
|
|
2
2
|
"./${t.relativePath}",
|
|
3
3
|
"default"
|
|
4
4
|
);`:`export const ${n} = createClientReference(
|
|
@@ -18,7 +18,7 @@ import { createClientReference } from "@eser/laroux-react/protocol";
|
|
|
18
18
|
${e.join(`
|
|
19
19
|
|
|
20
20
|
`)}
|
|
21
|
-
`}async function A(t,e,n){v.debug(`\u{1F504} Transforming ${t.length} client component(s)...`);let r=[];for(let o of t){let a=await H(o,e);v.debug(` \u2713 ${o.relativePath} \u2192 ${i.path.relative(n,a.transformedPath)}`),r.push(a)}return v.debug("\u2705 Transformation complete"),r}function et(t){let e=new Map;for(let n of t){e.set(`./${n.originalPath}`,n.transformedPath);let r=n.originalPath.split("/").pop();e.set(`./${r}`,n.transformedPath)}return e}async function U(t,e,n){let r={generated:new Date().toISOString(),components:t.map(o=>({original:o.originalPath,transformed:i.path.relative(n,o.transformedPath)}))};await i.fs.writeTextFile(e,JSON.stringify(r,null,2)),v.debug(`\u{1F4DD} Transform manifest saved to: ${i.path.relative(n,e)}`)}var nt=h.getLogger(["laroux-bundler","rsc-module-map"]);function L(t){let e={};for(let n of t){let r=`./${n.relativePath}`,o=W(n.relativePath,".js");e[r]={id:r,chunks:[o],name:n.exportNames[0]??"default"}}return e}function rt(t){let e={};for(let[n,r]of Object.entries(t))e[n]={id:r.id,chunks:r.chunks,name:r.name};return e}async function F(t,e){let n=JSON.stringify(t,null,2);await i.fs.writeTextFile(e,n),nt.debug(`\u{1F4DD} Module map saved to: ${e}`)}async function ot(t){let e=await i.fs.readTextFile(t);return JSON.parse(e)}function N(t){let e={};for(let n of t)e[n.relativePath]={id:n.relativePath,chunks:["client.js"],name:n.exportNames[0]??"default"};return e}var u=h.getLogger(["laroux-bundler","rsc-rewrite-imports"]);function st(t,e){let n=!1,r=!1,o=!1,a="";for(let l=0;l<e;l++){let s=t[l];if(s===void 0)break;if(a==="\\"){a=s;continue}s==="'"&&!r&&!o?n=!n:s==='"'&&!n&&!o?r=!r:s==="`"&&!n&&!r&&(o=!o),a=s}return n||r||o}function Q(t){let e=[],n=/import\s+(?:type\s+)?(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)(?:\s*,\s*(?:\{[^}]*\}|\*\s+as\s+\w+|\w+))*\s+from\s+)?["']([^"']+)["'];?/g,r;for(;(r=n.exec(t))!==null;){let o=r[1];o&&(st(t,r.index)||(o.startsWith("./")||o.startsWith("../")||o.startsWith("@/"))&&e.push({original:r[0],path:o,startIndex:r.index,endIndex:r.index+r[0].length}))}return e}function G(t,e,n){if(e.startsWith("@/")){let a=e.slice(2);return i.path.join(n,"src",a)}let r=i.path.dirname(t);return i.path.resolve(r,e)}function it(t,e){if(e.has(t))return e.get(t);let n=B.map(r=>`.${r}`);for(let r of n){let o=t.endsWith(r)?t:t+r;if(e.has(o))return e.get(o)}return null}function X(t,e){if(e.has(t))return e.get(t);if(!t.endsWith(".module.css")){let n=t+".module.css";if(e.has(n))return e.get(n)}return null}async function q(t,e,n,r,o){let a=await i.fs.readTextFile(t),l=Q(a),s=a,p=0,
|
|
21
|
+
`}async function A(t,e,n){v.debug(`\u{1F504} Transforming ${t.length} client component(s)...`);let r=[];for(let o of t){let a=await H(o,e);v.debug(` \u2713 ${o.relativePath} \u2192 ${i.path.relative(n,a.transformedPath)}`),r.push(a)}return v.debug("\u2705 Transformation complete"),r}function et(t){let e=new Map;for(let n of t){e.set(`./${n.originalPath}`,n.transformedPath);let r=n.originalPath.split("/").pop();e.set(`./${r}`,n.transformedPath)}return e}async function U(t,e,n){let r={generated:new Date().toISOString(),components:t.map(o=>({original:o.originalPath,transformed:i.path.relative(n,o.transformedPath)}))};await i.fs.writeTextFile(e,JSON.stringify(r,null,2)),v.debug(`\u{1F4DD} Transform manifest saved to: ${i.path.relative(n,e)}`)}var nt=h.getLogger(["laroux-bundler","rsc-module-map"]);function L(t){let e={};for(let n of t){let r=`./${n.relativePath}`,o=W(n.relativePath,".js");e[r]={id:r,chunks:[o],name:n.exportNames[0]??"default"}}return e}function rt(t){let e={};for(let[n,r]of Object.entries(t))e[n]={id:r.id,chunks:r.chunks,name:r.name};return e}async function F(t,e){let n=JSON.stringify(t,null,2);await i.fs.writeTextFile(e,n),nt.debug(`\u{1F4DD} Module map saved to: ${e}`)}async function ot(t){let e=await i.fs.readTextFile(t);return JSON.parse(e)}function N(t){let e={};for(let n of t)e[n.relativePath]={id:n.relativePath,chunks:["client.js"],name:n.exportNames[0]??"default"};return e}var u=h.getLogger(["laroux-bundler","rsc-rewrite-imports"]);function st(t,e){let n=!1,r=!1,o=!1,a="";for(let l=0;l<e;l++){let s=t[l];if(s===void 0)break;if(a==="\\"){a=s;continue}s==="'"&&!r&&!o?n=!n:s==='"'&&!n&&!o?r=!r:s==="`"&&!n&&!r&&(o=!o),a=s}return n||r||o}function Q(t){let e=[],n=/import\s+(?:type\s+)?(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)(?:\s*,\s*(?:\{[^}]*\}|\*\s+as\s+\w+|\w+))*\s+from\s+)?["']([^"']+)["'];?/g,r;for(;(r=n.exec(t))!==null;){let o=r[1];o&&(st(t,r.index)||(o.startsWith("./")||o.startsWith("../")||o.startsWith("@/"))&&e.push({original:r[0],path:o,startIndex:r.index,endIndex:r.index+r[0].length}))}return e}function G(t,e,n){if(e.startsWith("@/")){let a=e.slice(2);return i.path.join(n,"src",a)}let r=i.path.dirname(t);return i.path.resolve(r,e)}function it(t,e){if(e.has(t))return e.get(t);let n=B.map(r=>`.${r}`);for(let r of n){let o=t.endsWith(r)?t:t+r;if(e.has(o))return e.get(o)}return null}function X(t,e){if(e.has(t))return e.get(t);if(!t.endsWith(".module.css")){let n=t+".module.css";if(e.has(n))return e.get(n)}return null}async function q(t,e,n,r,o){let a=await i.fs.readTextFile(t),l=Q(a),s=a,p=0,c=0;for(let m of l){let C=G(t,m.path,o);if(X(C,n)){let M=m.path.endsWith(".module.css")?`${m.path}.json`:`${m.path}.module.css.json`,y=m.original.match(/^import\s+["']/),f;y?f=m.original.replace(/^import\s+["']([^"']+)["'];?/,`import styles from "${M}" with { type: "json" };`):f=m.original.replace(`"${m.path}"`,`"${M}" with { type: "json" }`).replace(`'${m.path}'`,`'${M}' with { type: "json" }`);let d=m.startIndex+c,w=m.endIndex+c;s=s.slice(0,d)+f+s.slice(w),c+=f.length-m.original.length,p++;continue}let $=it(C,e);if($){let M=i.path.relative(o,t),y=i.path.join(r,M),f=i.path.relative(i.path.dirname(y),$),d=f.startsWith(".")?f:`./${f}`,w=m.original.replace(`"${m.path}"`,`"${d}"`).replace(`'${m.path}'`,`'${d}'`),I=m.startIndex+c,b=m.endIndex+c;s=s.slice(0,I)+w+s.slice(b),c+=w.length-m.original.length,p++}else if(m.path.startsWith("@/")){let M=i.path.relative(o,t),y=i.path.join(r,M),f=i.path.join(o,"dist","server","src",m.path.slice(2)),d=i.path.relative(i.path.dirname(y),f),w=d.startsWith(".")?d:`./${d}`,I=m.original.replace(`"${m.path}"`,`"${w}"`).replace(`'${m.path}'`,`'${w}'`),b=m.startIndex+c,Y=m.endIndex+c;s=s.slice(0,b)+I+s.slice(Y),c+=I.length-m.original.length,p++}}let x=i.path.relative(o,t),g=i.path.join(r,x);return await i.fs.ensureDir(i.path.dirname(g)),await i.fs.writeTextFile(g,s),{originalPath:t,rewrittenPath:g,importsRewritten:p}}function K(t){let e=new Map;for(let n of t){e.set(n.originalPath,n.transformedPath);let r=n.originalPath.replace(/\.(tsx|ts|jsx|js)$/,"");e.set(r,n.transformedPath)}return e}function R(t){let e=new Map;for(let n of t){let r=n.replace(/\.module\.css$/,".module.css.json");e.set(n,r);let o=n.replace(/\.module\.css$/,"");e.set(o,r)}return e}async function z(t,e,n,r,o){u.debug(`\u{1F504} Rewriting imports in ${t.length} server component(s)...`);let a=K(e),l=R(n);u.debug(` Found ${n.length} CSS module(s) to track`);let s=[];for(let p of t){let c=await q(p,a,l,r,o);c.importsRewritten>0?u.debug(` \u2713 ${i.path.relative(o,p)} (${c.importsRewritten} import(s) rewritten)`):u.debug(` \u2713 ${i.path.relative(o,p)} (no client imports)`),s.push(c)}return u.debug("\u2705 Import rewriting complete"),s}async function V(t,e,n){let r=await i.fs.readTextFile(t),o=Q(r),a=r,l=0,s=0;for(let p of o){let c=G(t,p.path,n);if(X(c,e)){let g=p.path.endsWith(".module.css")?`${p.path}.json`:`${p.path}.module.css.json`,m=p.original.match(/^import\s+["']/),C;m?C=p.original.replace(/^import\s+["']([^"']+)["'];?/,`import styles from "${g}" with { type: "json" };`):C=p.original.replace(`"${p.path}"`,`"${g}" with { type: "json" }`).replace(`'${p.path}'`,`'${g}' with { type: "json" }`);let O=p.startIndex+s,$=p.endIndex+s;a=a.slice(0,O)+C+a.slice($),s+=C.length-p.original.length,l++}}return l>0&&await i.fs.writeTextFile(t,a),{importsRewritten:l}}async function at(t,e,n,r){u.debug(`\u{1F504} Rewriting CSS module imports in ${t.length} client component(s)...`);let o=R(e);u.debug(` Found ${e.length} CSS module(s) to track`);let a=0;for(let l of t){let s=await V(l.filePath,o,r);s.importsRewritten>0&&(u.debug(` \u2713 ${i.path.relative(r,l.filePath)} (${s.importsRewritten} CSS import(s) rewritten)`),a+=s.importsRewritten)}a>0?u.debug(`\u2705 Rewrote ${a} CSS module import(s) in ${t.length} client component(s)`):u.debug("\u2705 No CSS module imports found in client components")}async function D(t,e,n){u.debug("\u{1F504} Rewriting CSS module imports in all src files...");let r=R(e),o=[];for await(let l of S(t,"**/*.{tsx,ts}",/node_modules/))o.push(i.path.join(t,l));u.debug(` Found ${o.length} source file(s) to check`);let a=0;for(let l of o){let s=await V(l,r,n);s.importsRewritten>0&&(u.debug(` \u2713 ${i.path.relative(n,l)} (${s.importsRewritten} CSS import(s) rewritten)`),a+=s.importsRewritten)}a>0?u.debug(`\u2705 Rewrote ${a} CSS module import(s) in ${o.length} source file(s)`):u.debug("\u2705 No CSS module imports needed rewriting")}var lt=["entry.tsx","error-boundary.tsx","error-overlay.tsx","globals.d.ts","hmr-client.tsx","index.ts","lazy-loader.ts","smart-refresh.tsx"];function pt(t){if(t.startsWith("jsr:"))return!0;if(URL.canParse(t)){let e=new URL(t);return e.protocol==="https:"||e.protocol==="http:"}return!1}function mt(t){return URL.canParse(t)&&t.startsWith("file://")?new URL(t).pathname:t}function ct(t){let e=t.match(/^jsr:@([^/]+)\/([^@]+)@[\^~]?([^/]+)(.*)$/);if(e){let[,r,o,a,l]=e;return`${new URL(`https://jsr.io/@${r}/${o}/${a}`).href}${l}`}let n=t.match(/^jsr:@([^/]+)\/([^/]+)(.*)$/);if(n){let[,r,o,a]=n;return`${new URL(`https://jsr.io/@${r}/${o}`).href}${a}`}throw new Error(`Cannot parse JSR specifier: ${t}`)}function ut(t){return t.replace(/@jsxImportSource\s+npm:react@[^\s*]+/g,"@jsxImportSource react").replace(/@jsxImportSourceTypes\s+npm:react@[^\s*]+/g,"@jsxImportSourceTypes react").replace(/from\s+["']jsr:(@[^@]+)@[^"'/]+([^"']*)["']/g,'from "$1$2"').replace(/import\s*\(\s*["']jsr:(@[^@]+)@[^"'/]+([^"']*)["']\s*\)/g,'import("$1$2")').replace(/from\s+["']npm:\/?([^@]+)@[^"'/]+([^"']*)["']/g,'from "$1$2"').replace(/import\s*\(\s*["']npm:\/?([^@]+)@[^"'/]+([^"']*)["']\s*\)/g,'import("$1$2")')}function ft(){let e=import.meta.resolve("@eser/laroux-react/client/bootstrap").replace(/\/index\.ts$/,"");return e.startsWith("jsr:")&&(e=ct(e)),{isRemote:pt(e),baseUrl:e}}async function gt(t){let{isRemote:e,baseUrl:n}=ft();for(let r of lt){let o=i.path.resolve(t,r),a=n.endsWith("/")?new URL(r,n).href:new URL(`${n}/${r}`).href;if(e)try{let l=await fetch(a);if(!l.ok)throw new Error(`HTTP ${l.status}`);let s=await l.text();s=ut(s),await i.fs.writeTextFile(o,s)}catch(l){throw new Error(`Failed to fetch bootstrap file ${r} from ${a}: ${l instanceof Error?l.message:String(l)}`)}else{let l=mt(a);await J(l,o,{overwrite:!0})}}}async function k(t,e,n){let r=i.path.resolve(n,"_client-entry.tsx");await i.fs.ensureDir(n),await gt(n);let o=t.map((s,p)=>`import * as __component_${p} from "${s.filePath}";`).join(`
|
|
22
22
|
`),a=t.map((s,p)=>` __RUNTIME_MODULES__["${`./${s.relativePath}`}"] = __component_${p};`).join(`
|
|
23
23
|
`),l=`/**
|
|
24
24
|
* Auto-generated Client Entry Point - Runtime Bundle
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as S}from"./chunk-2J2PXBOC.js";import{e as q}from"./chunk-OBIEQJDE.js";import"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import{t as n}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var h=q.getLogger(["laroux","image-optimizer"]),$=null;async function j(){return $===null&&($=await import("npm:sharp@^0.33.5")),$.default??$}var F={formats:["webp","original"],widths:[640,768,1024,1280,1920],quality:{webp:80,avif:75,jpeg:85,png:90},generateBlurPlaceholder:!0,placeholderWidth:10};async function B(i){let r=[],o=["jpg","jpeg","png","gif","webp"];async function a(t){try{for await(let e of n.fs.readDir(t)){let s=n.path.resolve(t,e.name);e.isDirectory?await a(s):e.isFile&&S(e.name.toLowerCase(),o)&&r.push(s)}}catch{}}return await a(i),r}async function E(i,r){return`data:image/webp;base64,${(await(await j())(i).resize(r,void 0,{fit:"inside"}).blur(5).webp({quality:20}).toBuffer()).toString("base64")}`}async function C(i,r,o,a={}){let t=await j(),e={...F,...a},s=t(i),l=await s.metadata();if(l.width===void 0||l.height===void 0)throw new Error(`Could not read image dimensions: ${i}`);let u=l.width,w=l.height,y=u/w,m=n.path.extname(i),p=m.slice(1).toLowerCase(),f=n.path.basename(i,m),x=`${o}/${f}`,I=[];for(let c of e.widths){if(c>u)continue;let O=Math.round(c/y);for(let b of e.formats){let z,d;b==="original"?(d=p,z=n.path.resolve(r,`${f}-${c}w.${p}`)):(d=b,z=n.path.resolve(r,`${f}-${c}w.${b}`)),await n.fs.ensureDir(n.path.dirname(z));let g=s.clone().resize(c,O,{fit:"cover"});b==="webp"?g=g.webp({quality:e.quality.webp}):b==="avif"?g=g.avif({quality:e.quality.avif}):d==="jpg"||d==="jpeg"?g=g.jpeg({quality:e.quality.jpeg}):d==="png"&&(g=g.png({quality:e.quality.png}));let P=await g.toBuffer();await n.fs.writeFile(z,P),I.push({path:z,format:d,width:c,height:O,size:P.length})}}let v;return e.generateBlurPlaceholder&&(v=await E(i,e.placeholderWidth)),{originalPath:i,publicPath:x,originalWidth:u,originalHeight:w,variants:I,blurDataUrl:v,aspectRatio:y}}async function V(i,r,o="/images",a={}){h.info(`Scanning for images in ${i}...`);let t=await B(i);if(t.length===0)return h.debug("No images found to optimize"),{timestamp:Date.now(),images:{}};h.info(`Found ${t.length} image(s) to optimize`);let e={},s=0,l=0;for(let m of t)try{let p=await n.fs.stat(m);s+=p.size;let f=await C(m,r,o,a);e[m]=f;let x=f.variants.reduce((I,v)=>I+v.size,0);l+=x,h.debug(`Optimized: ${n.path.basename(m)} \u2192 ${f.variants.length} variants`)}catch(p){h.warn(`Failed to optimize ${m}: ${p instanceof Error?p.message:String(p)}`)}let u={timestamp:Date.now(),images:e},w=n.path.resolve(r,"image-manifest.json");await n.fs.ensureDir(n.path.dirname(w)),await n.fs.writeTextFile(w,JSON.stringify(u,null,2));let y=s>0?((1-l/s)*100).toFixed(1):0;return h.info(`Image optimization complete: ${t.length} images, ${y}% size reduction`),u}function M(i,r="webp"){return i.variants.filter(a=>a.format===r).sort((a,t)=>a.width-t.width).map(a=>`${a.path} ${a.width}w`).join(", ")}function D(i,r,o="webp"){let a=i.variants.filter(t=>t.format===o).sort((t,e)=>t.width-e.width);return a.find(t=>t.width>=r)??a.at(-1)}export{M as generateSrcset,D as getBestVariant,C as optimizeImage,V as optimizeImages,B as scanImages};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-UKYKMDYU.js";import"./chunk-4H4O3TGK.js";import"./chunk-2J2PXBOC.js";import"./chunk-OBIEQJDE.js";import"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import"./chunk-BCHXUKWW.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{e as ABOVE_FOLD_PATTERNS,d as CRITICAL_LAYERS,f as CRITICAL_PROPERTY_PATTERNS,m as DEFAULT_CRITICAL_UNIVERSAL_CSS,b as compileTailwind,n as createTailwindPlugin,c as expandApplyDirectives,h as extractCriticalPageCss,j as extractCriticalUniversalCss,l as extractThemeLayer,i as generateAsyncCssLoader,k as generateCriticalUniversalCss,g as getDefaultCriticalCssConfig,a as loadStylesheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,q as o,r as p,s as q,t as r}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,q as o,r as p,s as q,t as r}from"./chunk-ETMOOGY2.js";import"./chunk-OBIEQJDE.js";import"./chunk-USCAYIWL.js";import"./chunk-PLJNPQFC.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{j as chunkToInlineScript,l as createInlineRSCStream,k as createInlineTransformStream,q as createReactHtmlShellBuilder,o as createReactRenderer,m as generateInlineBootstrapScript,n as generateInlineCompletionScript,c as generateRSCPayloadScript,e as loadModuleMap,r as reactHtmlShellBuilder,p as reactRenderer,i as renderApp,f as renderRSC,h as renderRSCResponse,a as renderSSR,d as renderToReadableStream,b as serializeRSCPayload,g as streamToResponse};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as r,m as s,n as t,o as u,p as v,q as w,r as x,s as A,t as B,u as C}from"./chunk-YXSB6RET.js";import{b as y,c as z}from"./chunk-SG4G3OOO.js";import{a as p,b as q}from"./chunk-FDZP7B5Y.js";import{a,b,c,d}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{c as AlreadyExistsError,b as NotFoundError,d as ProcessError,a as RuntimeCapabilityError,u as buildCommand,z as clearWorkerdEnv,A as createRuntime,C as current,x as detectExecutionContext,t as detectInvoker,e as detectRuntime,l as getArch,w as getCliCommand,m as getHomedir,k as getPlatform,o as getPlatformInfo,f as getRuntimeVersion,n as getTmpdir,h as isBrowser,v as isCommandInPath,j as isEdge,g as isRuntime,i as isServer,y as populateEnvFromContext,q as posixPath,s as resolvePathDirs,B as runtime,r as searchFileHierarchy,p as toPosix};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as b,b as D}from"./chunk-NLNSK3KE.js";import{e as C}from"./chunk-Q54LOR4S.js";import{a as A,d as E}from"./chunk-NUSNMQPL.js";import{f as y}from"./chunk-5AK4OGCO.js";import{f as k,h as R,k as $}from"./chunk-TTYO2XJO.js";import{d as m,e as w,f as h,j as v}from"./chunk-PLJNPQFC.js";import{a as P}from"./chunk-HPPFA3XU.js";import{a as g,b as p,c as j}from"./chunk-DQAEQEXD.js";import{t as N}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var S=r=>A(async t=>{try{let s=await y(r.registrySource,{local:r.local}),a=s.recipes.filter(n=>n.scale==="project"),o=a.find(n=>n.name===r.templateName);if(o===void 0)return p({_tag:"TemplateNotFound",message:`Template '${r.templateName}' not found. Available: ${a.map(n=>n.name).join(", ")}`});await N.fs.mkdir(r.targetDir,{recursive:!0});let f={project_name:r.projectName,...r.variables},e=await C(o,{cwd:r.targetDir,registryUrl:s.registryUrl,force:!0,variables:f}),u=await b(r.targetDir),d=D(o,u);t.out.writeln(h(`\u2713 Created ${r.projectName} with ${e.written.length} file(s)`));for(let n of e.written)t.out.writeln(` \u2192 ${n}`);if(d.instructions.length>0){t.out.writeln(m(`
|
|
2
|
+
Next steps:`)),t.out.writeln(m(` cd ${r.projectName}`));for(let n of d.instructions)t.out.writeln(m(` ${n}`))}return g({template:o,result:e,depInfo:d})}catch(s){let a=s instanceof Error?s.message:String(s);return p({_tag:"ApplyError",message:a})}});var B=async r=>{let t=P(r??[],{string:["name","registry","var"],boolean:["local"],collect:["var"]}),s=t._[0],a=t.name??s,o=t.registry,f=t.local===!0,e=k({renderer:$.ansi(),sink:R.stdout()}),u={};for(let c of t.var){let[i,...l]=String(c).split("=");i!==void 0&&i!==""&&(u[i]=l.join("="))}if(s===void 0){try{let i=(await y(o,{local:f})).recipes.filter(l=>l.scale==="project");e.writeln("Usage: eser kit new <template> [--name <project-name>] [--var key=value]"),e.writeln(),e.writeln("Available project templates:"),e.writeln();for(let l of i)e.writeln(` ${l.name.padEnd(20)} ${l.description} `,m(`[${l.language}]`))}catch(c){let i=c instanceof Error?c.message:String(c);e.writeln(w(`Error: ${i}`))}return await e.close(),g(void 0)}if(a===void 0)return e.writeln(w("Project name is required.")),await e.close(),p({exitCode:1});e.writeln(v(`
|
|
3
|
+
Creating ${a} from ${s}...
|
|
4
|
+
`));let d=`${Deno.cwd()}/${a}`,n=await E(S({templateName:s,projectName:a,targetDir:d,registrySource:o,local:f,variables:u}),{out:e});return await e.close(),j(n)?g(void 0):p({exitCode:1})};export{B as main};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as f}from"./chunk-Z4WPWVC7.js";import{b as O,c as g,d as E}from"./chunk-BK2BDHKB.js";import{a as k,c as _,d as I,f as q}from"./chunk-LXVBR775.js";import{c as y,d as x,e as D,f as S,i as v,k as C}from"./chunk-NT2MQK7O.js";import{a as m,b as h}from"./chunk-DQAEQEXD.js";import{t as l}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var B=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],u=t=>B.map(n=>({...n,extras:O(t,n.id)})),p=(t,n)=>{let s=new Set(n.map(r=>r.questionId));for(let r of t)if(!s.has(r.id))return r;return null},R=t=>{let n=new Set(t.map(s=>s.questionId));return B.every(s=>n.has(s.id))};var w=(t,n,s)=>{switch(t.phase){case"IDLE":return b();case"DISCOVERY":return $(t,n,s);case"SPEC_DRAFT":return W(t);case"SPEC_APPROVED":case"BUILDING":return U(t,n,s);case"BLOCKED":return G(t);case"DONE":return V(t);default:return b()}},b=()=>({phase:"IDLE",instruction:'No active spec. Start one with: noskills spec new "description"'}),$=(t,n,s)=>{let r=u(n),e=p(r,t.discovery.answers);if(e===null)return{phase:"DISCOVERY",instruction:"All discovery questions answered. Run: noskills approve",question:{id:"",text:"",concerns:[],extras:[]},context:{rules:s,concernReminders:[]},transition:{onComplete:"noskills approve",remainingQuestions:0}};let o=t.discovery.answers.length,i=r.length;return{phase:"DISCOVERY",instruction:"Ask the user the following question and relay their answer.",question:{id:e.id,text:e.text,concerns:[...e.concerns],extras:e.extras.map(c=>c.text)},context:{rules:s,concernReminders:g(n)},transition:{onComplete:'noskills next --answer="..."',remainingQuestions:i-o-1}}},W=t=>({phase:"SPEC_DRAFT",instruction:"Spec draft is ready for review. Ask the user to review and approve.",specPath:t.specState.path??"",transition:{onApprove:"noskills approve"}}),U=(t,n,s)=>{let r=E(n),e={phase:"BUILDING",instruction:"Read the spec and implement the next task. Report progress when done.",context:{rules:s,concernReminders:g(n)},transition:{onComplete:'noskills next --answer="..."',onBlocked:'noskills block "reason"',iteration:t.building.iteration}};return r.length>0?{...e,concernTensions:r}:e},G=t=>({phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:t.building.lastProgress??"Unknown",transition:{onResolved:'noskills next --answer="..."'}}),V=t=>({phase:"DONE",summary:{spec:t.spec,iterations:t.building.iteration,decisionsCount:t.decisions.length}});var A=(t,n,s,r)=>{let e=[];e.push(`# Spec: ${t}`),e.push(""),e.push("## Status: draft"),e.push(""),s.length>0&&(e.push(`## Concerns: ${s.map(o=>o.id).join(", ")}`),e.push("")),e.push("## Discovery Answers"),e.push("");for(let o of n)e.push(`### ${o.questionId}`),e.push(""),e.push(o.answer),e.push("");for(let o of s)if(o.specSections.length>0)for(let i of o.specSections)e.push(`## ${i} (${o.id})`),e.push(""),e.push("_To be filled in during implementation._"),e.push("");if(r.length>0){e.push("## Decisions"),e.push(""),e.push("| # | Decision | Choice | Promoted |"),e.push("|---|----------|--------|----------|");for(let o=0;o<r.length;o++){let i=r[o];e.push(`| ${o+1} | ${i.question} | ${i.choice} | ${i.promoted?"yes":"no"} |`)}e.push("")}return e.push("## Tasks"),e.push(""),e.push("_To be generated from discovery answers._"),e.push(""),e.push("## Verification"),e.push(""),e.push("_To be defined based on discovery answers._"),e.push(""),e.join(`
|
|
2
|
+
`)};var Q=async(t,n,s)=>{if(n.spec===null)throw new Error("No active spec");let r=`${t}/${y.specDir(n.spec)}`,e=`${t}/${y.specFile(n.spec)}`;await l.fs.mkdir(r,{recursive:!0});let o=A(n.spec,n.discovery.answers,s,n.decisions);return await l.fs.writeTextFile(e,o),e};var ne=async t=>{let n=l.process.cwd();if(!await C(n)){let a=JSON.stringify({error:"noskills not initialized. Run: noskills init"});return await d(a),h({exitCode:1})}let s=null;if(t!==void 0)for(let a of t)a.startsWith("--answer=")&&(s=a.slice(9));let r=await x(n),e=await S(n);if(e===null){let a=JSON.stringify({error:"No config found"});return await d(a),h({exitCode:1})}let i=(await v(n)).filter(a=>e.concerns.includes(a.id));if(s!==null){let a=await z(n,r,e,i,s);await D(n,a);let F=await f(n),P=w(a,i,F);return await d(JSON.stringify(P,null,2)),m(void 0)}let c=await f(n),T=w(r,i,c);return await d(JSON.stringify(T,null,2)),m(void 0)},z=async(t,n,s,r,e)=>{switch(n.phase){case"DISCOVERY":{let o=u(r),i=p(o,n.discovery.answers);if(i===null)return n;let c=_(n,i.id,e);return R(c.discovery.answers)&&(c=I(c),await Q(t,c,r)),c}case"BUILDING":return q(n,e);case"BLOCKED":return k(n,"BUILDING");default:return n}},d=async t=>{let n=new TextEncoder,s=l.process.stdout.getWriter();await s.write(n.encode(t+`
|
|
3
|
+
`)),s.releaseLock()};export{ne as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as F}from"./chunk-
|
|
1
|
+
import{b as F}from"./chunk-T7K64JD5.js";import{b as v,d as E}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";import*as s from"node:fs/promises";import*as x from"node:fs";import*as i from"node:path";import*as g from"node:os";import*as b from"node:child_process";import d from"node:process";import{Buffer as w}from"node:buffer";import{Readable as k,Writable as O}from"node:stream";var S={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!1},R=()=>{let n=e=>({isFile:e.isFile(),isDirectory:e.isDirectory(),isSymlink:e.isSymbolicLink(),size:e.size,mtime:e.mtime,atime:e.atime,birthtime:e.birthtime}),a=(e,t)=>{throw e instanceof Error&&"code"in e&&e.code==="ENOENT"?new v(t):e};return{async readFile(e,t){try{let r=await s.readFile(e,{signal:t?.signal});return new Uint8Array(r)}catch(r){return a(r,e)}},async readTextFile(e,t){try{return await s.readFile(e,{encoding:"utf-8",signal:t?.signal})}catch(r){return a(r,e)}},async writeFile(e,t,r){let c=r?.append?"a":"w";await s.writeFile(e,t,{signal:r?.signal,mode:r?.mode,flag:c})},async writeTextFile(e,t,r){let c=r?.append?"a":"w";await s.writeFile(e,t,{encoding:"utf-8",signal:r?.signal,mode:r?.mode,flag:c})},async exists(e){try{return await s.access(e),!0}catch{return!1}},async stat(e){try{let t=await s.stat(e);return n(t)}catch(t){return a(t,e)}},async lstat(e){try{let t=await s.lstat(e);return n(t)}catch(t){return a(t,e)}},async mkdir(e,t){await s.mkdir(e,{recursive:t?.recursive??!1,mode:t?.mode})},async ensureDir(e){await s.mkdir(e,{recursive:!0})},async remove(e,t){try{await s.rm(e,{recursive:t?.recursive??!1,force:!1})}catch(r){a(r,e)}},async*readDir(e){try{let t=await s.readdir(e,{withFileTypes:!0});for(let r of t)yield{name:r.name,isFile:r.isFile(),isDirectory:r.isDirectory(),isSymlink:r.isSymbolicLink()}}catch(t){a(t,e)}},async copyFile(e,t){await s.copyFile(e,t)},async rename(e,t){await s.rename(e,t)},async makeTempDir(e){let t=e?.dir??g.tmpdir(),r=e?.prefix??"",c=e?.suffix??"",u=await s.mkdtemp(i.join(t,r));if(c){let o=u+c;return await s.rename(u,o),o}return u},async realPath(e){try{return await s.realpath(e)}catch(t){throw t instanceof Error&&"code"in t&&t.code==="ENOENT"?new v(e):t}},watch(e,t){let r=t?.recursive??!0,c=[],u=[],o=[],l=!1,P=m=>{l||(o.length>0?o.shift()({value:m,done:!1}):u.push(m))};for(let m of e)try{let f=x.watch(m,{recursive:r},(h,y)=>{y!==null&&P({kind:h==="rename"?"create":"modify",paths:[i.join(m,y)]})});c.push(f)}catch{}return{close:()=>{l=!0;for(let m of c)m.close();for(let m of o)m({value:void 0,done:!0});o=[]},[Symbol.asyncIterator]:()=>({next:()=>l?Promise.resolve({value:void 0,done:!0}):u.length>0?Promise.resolve({value:u.shift(),done:!1}):new Promise(m=>{o.push(m)})})}},async chmod(e,t){await s.chmod(e,t)},async*walk(e,t){let r=t?.includeDirs??!0,c=t?.includeFiles??!0,u=t?.exts,o=t?.skip,l=async function*(P){let m=await s.readdir(P,{withFileTypes:!0});for(let f of m){let h=i.join(P,f.name);if(o?.some(p=>p.test(h)))continue;let y=f.isSymbolicLink();if(f.isDirectory())r&&(yield{path:h,name:f.name,isFile:!1,isDirectory:!0,isSymlink:y}),yield*l(h);else if(f.isFile()||y){if(!c||u&&!u.some(p=>f.name.endsWith(p.startsWith(".")?p:`.${p}`)))continue;yield{path:h,name:f.name,isFile:f.isFile(),isDirectory:!1,isSymlink:y}}}};yield*l(e)}}},W=()=>({join:i.join,resolve:i.resolve,dirname:i.dirname,basename:i.basename,extname:i.extname,normalize:i.normalize,isAbsolute:i.isAbsolute,relative:i.relative,parse:i.parse,format:i.format,sep:i.sep,delimiter:i.delimiter}),A=()=>({spawn(n,a=[],e){return new Promise((t,r)=>{let c=b.spawn(n,a,{cwd:e?.cwd,env:e?.env?{...d.env,...e.env}:void 0,stdio:F(e),signal:e?.signal}),u=[],o=[];c.stdout?.on("data",l=>u.push(l)),c.stderr?.on("data",l=>o.push(l)),c.on("error",r),c.on("close",l=>{t({success:l===0,code:l??1,stdout:new Uint8Array(w.concat(u)),stderr:new Uint8Array(w.concat(o))})})})},async exec(n,a=[],e){let t=await this.spawn(n,a,e);if(!t.success){let r=new TextDecoder().decode(t.stderr);throw new E(n,t.code,r)}return new TextDecoder().decode(t.stdout).trim()},async execJson(n,a=[],e){let t=await this.exec(n,a,e);return JSON.parse(t)},spawnChild(n,a=[],e){let t=b.spawn(n,a,{cwd:e?.cwd,env:e?.env?{...d.env,...e.env}:void 0,stdio:F(e),signal:e?.signal}),r=[],c=[];t.stdout?.on("data",o=>r.push(o)),t.stderr?.on("data",o=>c.push(o));let u=new Promise((o,l)=>{t.on("error",l),t.on("close",(P,m)=>{o({success:P===0,code:P??1,signal:m??void 0})})});return{pid:t.pid,stdin:t.stdin?O.toWeb(t.stdin):null,stdout:t.stdout?k.toWeb(t.stdout):null,stderr:t.stderr?k.toWeb(t.stderr):null,status:u,output:async()=>{let o=await u;return{success:o.success,code:o.code,stdout:new Uint8Array(w.concat(r)),stderr:new Uint8Array(w.concat(c))}},kill:o=>{t.kill(o)}}}}),D=()=>({get(n){return d.env[n]},set(n,a){d.env[n]=a},delete(n){delete d.env[n]},has(n){return n in d.env},toObject(){let n={};for(let[a,e]of Object.entries(d.env))e!==void 0&&(n[a]=e);return n}}),C=()=>({exit(n){d.exit(n)},setExitCode(n){d.exitCode=n},cwd(){return d.cwd()},chdir(n){d.chdir(n)},hostname(){return g.hostname()},execPath(){return d.execPath},args:d.argv.slice(2),pid:d.pid,stdin:k.toWeb(d.stdin),stdout:O.toWeb(d.stdout),stderr:O.toWeb(d.stderr)}),j=()=>{let n=R(),a=W(),e=A(),t=D(),r=C();return{name:"node",version:d.versions.node,capabilities:S,fs:n,path:a,exec:e,env:t,process:r}};export{S as NODE_CAPABILITIES,j as createNodeRuntime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-QIYWONJL.js";import"./chunk-3K42AALS.js";import"./chunk-OLM5RTFK.js";import"./chunk-BCHXUKWW.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as OllamaModel,b as ollamaFactory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-AAV7D6DF.js";import"./chunk-3K42AALS.js";import"./chunk-OLM5RTFK.js";import"./chunk-BCHXUKWW.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as OpenCodeModel,b as openCodeFactory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-Q54LOR4S.js";import"./chunk-5AK4OGCO.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{e as applyRecipe,f as applyRecipeChain,b as fileExists,a as isPathSafe,c as processContent,d as runPostInstall};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-5AK4OGCO.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{b as DEFAULT_REGISTRY_URL,a as FETCH_TIMEOUT_MS,c as LOCAL_REGISTRY_PATH,e as detectLocalRegistry,g as fetchRecipeFile,i as fetchRecipeFolder,j as fetchRecipeFromRepo,f as fetchRegistry,h as parseGitHubRawUrl,d as registryFetch};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-RBB5ITAS.js";import"./chunk-V2N5L24J.js";import"./chunk-Y6DZEK4W.js";import"./chunk-34GCQZ3Z.js";import"./chunk-3APERFKY.js";import{a as g}from"./chunk-6U2VEZEM.js";import{a as C,b as v}from"./chunk-KAEAT6A4.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import{f as w}from"./chunk-NUSNMQPL.js";import"./chunk-GXPLME3K.js";import"./chunk-2J2PXBOC.js";import"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b as n,e as h,f,g as y,h as o}from"./chunk-PLJNPQFC.js";import{b as l}from"./chunk-BCHXUKWW.js";import{a as m}from"./chunk-HPPFA3XU.js";import{g as i}from"./chunk-DQAEQEXD.js";import"./chunk-WUJUQPHI.js";import"./chunk-A2GDVOQP.js";import"./chunk-GLSCZGXA.js";import"./chunk-ZE5T64HQ.js";import"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var t=C(),A=async()=>(await l`git status --porcelain`.noThrow().text()).length===0,b=async()=>{let e=await l`git log @{u}..HEAD --oneline`.noThrow().text();return e.length>0?e.split(`
|
|
2
2
|
`):[]},P=async(e,s)=>{for(let r of s)await l`git add ${r}`.spawn();await l`git commit -m ${e}`.spawn()},O=async()=>{await l`git push origin HEAD`.spawn()},k=async e=>{await l`git tag -d ${e}`.noThrow().spawn();let s=`:refs/tags/${e}`;await l`git push origin ${s}`.noThrow().spawn()},T=async e=>{let s=new TextEncoder,r=new TextDecoder,a=new Uint8Array(256);await Deno.stderr.write(s.encode(`${e} [y/N] `));let p=await Deno.stdin.read(a),d=r.decode(a.subarray(0,p??0)).trim();return d==="y"||d==="Y"},M=async e=>{let{type:s,dryRun:r=!1}=e;if(!await A())throw new Error("Working tree is dirty. Commit or stash changes first.");let a=await b();if(a.length>0&&e.yes!==!0)throw new Error(`You have ${a.length} unpushed commit(s):
|
|
3
3
|
${a.join(`
|
|
4
4
|
`)}
|
|
5
5
|
|
|
6
|
-
Push first, or re-run with --yes to continue anyway.`);let p=await c()??"0.0.0";s!=="same"&&await(await import("./versions-
|
|
6
|
+
Push first, or re-run with --yes to continue anyway.`);let p=await c()??"0.0.0";s!=="same"&&await(await import("./versions-KW5UTMNV.js")).versions(s,{dryRun:r});let d=await c()??p,u=!1;try{await(await import("./changelog-gen-LV5VWTZS.js")).generateChangelog({dryRun:r}),u=!0}catch{u=!1}let x=!1,E=!1;if(!r){u&&await l`deno fmt CHANGELOG.md`.noThrow().spawn();let R=["VERSION","CHANGELOG.md","pkg/*/deno.json","pkg/*/package.json","package.json"],$=`chore(codebase): release v${d}`;await P($,R),x=!0,await O(),E=!0}return{version:d,previousVersion:p,changelogGenerated:u,committed:x,pushed:E,dryRun:r}},U=async(e={})=>{let{dryRun:s=!1}=e;if(!await A())throw new Error("Working tree is dirty. Commit and push first.");let r=await b();if(r.length>0)throw new Error(`You have unpushed commits. Push first, then rerelease.
|
|
7
7
|
${r.join(`
|
|
8
8
|
`)}`);let a=await c();if(a===void 0||!/^\d+\.\d+\.\d+$/.test(a))throw new Error(`Invalid or missing version in VERSION file: "${a}"`);let p=`v${a}`;if(!s){let d=`chore(codebase): release v${a}`;await l`git commit --allow-empty -m ${d}`.spawn(),await l`git push origin HEAD`.spawn()}return{version:a,tag:p,dryRun:s}},H=async(e={})=>{let s=await c();if(s===void 0||!/^\d+\.\d+\.\d+$/.test(s))throw new Error(`Invalid or missing version in VERSION file: "${s}"`);let r=`v${s}`;if(e.yes!==!0)throw new Error(`This will delete tag ${r} locally and remotely. Re-run with --yes to confirm.`);return await k(r),{version:s,tag:r,deleted:!0}},I=e=>w.fromPromise(()=>M(e)),V=e=>w.fromPromise(()=>U(e)),D=e=>w.fromPromise(()=>H(e)),j=e=>{let s=e.args[0];return s===void 0||!["patch","minor","major","same"].includes(s)?i.fail(g.adaptError("Usage: eser codebase release <patch|minor|major|same> [--dry-run] [--yes]")):i.ok({type:s,dryRun:e.flags["dry-run"]===!0,yes:e.flags.yes===!0})},N=e=>i.ok({dryRun:e.flags["dry-run"]===!0}),G=e=>i.ok({yes:e.flags.yes===!0}),S=e=>{if(i.isFail(e)){let r=e.error,a=r instanceof Error?r.message:r.message??String(r);return t.writeln(h("\u2717"),n(" "+a)),i.fail({exitCode:1})}let{value:s}=e;return s.dryRun?(t.writeln(y("\u26A0"),n(" [DRY RUN] Release preview:")),t.writeln(o("\u2139"),n(` Version: ${s.previousVersion} -> ${s.version}`)),t.writeln(o("\u2139"),n(` Changelog: ${s.changelogGenerated?"generated":"no user-facing changes"}`)),t.writeln(o("\u2139"),n(" No changes were made."))):(t.writeln(f("\u2713"),n(` Released v${s.version}`)),t.writeln(o("\u2139"),n(` Version: ${s.previousVersion} -> ${s.version}`)),t.writeln(o("\u2139"),n(` Changelog: ${s.changelogGenerated?"updated":"no user-facing changes"}`)),t.writeln(o("\u2139"),n(` Committed: ${s.committed}`)),t.writeln(o("\u2139"),n(` Pushed: ${s.pushed}`)),t.writeln(o("\u2139"),n(" CI will validate, tag, and publish.")),t.writeln(o("\u2139"),n(" Watch: https://github.com/eser/stack/actions"))),i.ok(void 0)},Y=e=>{if(i.isFail(e)){let r=e.error,a=r instanceof Error?r.message:r.message??String(r);return t.writeln(h("\u2717"),n(" "+a)),i.fail({exitCode:1})}let{value:s}=e;return s.dryRun?t.writeln(y("\u26A0"),n(` [DRY RUN] Would delete and recreate tag ${s.tag}`)):(t.writeln(f("\u2713"),n(` Re-tagged ${s.tag}`)),t.writeln(o("\u2139"),n(" CI will validate and publish."))),i.ok(void 0)},F=e=>{if(i.isFail(e)){let r=e.error,a=r instanceof Error?r.message:r.message??String(r);return t.writeln(h("\u2717"),n(" "+a)),i.fail({exitCode:1})}let{value:s}=e;return s.deleted&&t.writeln(f("\u2713"),n(` Deleted tag v${s.version} (local + remote).`)),i.ok(void 0)},W=g.createTrigger({handler:I,adaptInput:j,adaptOutput:S}),L=g.createTrigger({handler:V,adaptInput:N,adaptOutput:Y}),B=g.createTrigger({handler:D,adaptInput:G,adaptOutput:F}),re=async e=>{let s=m(e??[],{boolean:["dry-run","yes"],alias:{n:"dry-run",y:"yes"}}),r=s._[0],a=s["dry-run"]===!0,p=s.yes===!0;if(r!==void 0&&!a&&!p&&["patch","minor","major","same"].includes(r)){let u=await c()??"0.0.0";if(t.writeln(o("\u2139"),n(` Current version: ${u}`)),t.writeln(o("\u2139"),n(` Bump type: ${r}`)),t.writeln(o("\u2139"),n(" This will bump version, generate changelog, commit, and push.")),await t.flush(),!await T("Proceed?"))return t.writeln(y("\u26A0"),n(" Aborted.")),i.ok(void 0);s.yes=!0}let d=v("release",s);return await W(d)},ne=async e=>{let s=m(e??[],{boolean:["dry-run"],alias:{n:"dry-run"}}),r=v("rerelease",s);return await L(r)},te=async e=>{let s=m(e??[],{boolean:["yes"],alias:{y:"yes"}}),r=v("unrelease",s);return await B(r)};export{W as handleReleaseCli,L as handleRereleaseCli,B as handleUnreleaseCli,re as main,M as release,I as releaseHandler,U as rerelease,V as rereleaseHandler,ne as rereleaseMain,H as unrelease,D as unreleaseHandler,te as unreleaseMain};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"./chunk-DDLQMSA7.js";import{a as y}from"./chunk-6U2VEZEM.js";import{a as E,b as A}from"./chunk-KAEAT6A4.js";import"./chunk-ZH37DSUQ.js";import"./chunk-LOFP256P.js";import"./chunk-ZF2XYULB.js";import"./chunk-4S7QYPS6.js";import{f as $}from"./chunk-NUSNMQPL.js";import"./chunk-2J2PXBOC.js";import"./chunk-TTYO2XJO.js";import"./chunk-USCAYIWL.js";import{b as p,e as P,f as m,g as C}from"./chunk-PLJNPQFC.js";import{c as u}from"./chunk-BCHXUKWW.js";import"./chunk-ZOZYBQX2.js";import"./chunk-UNL4H5EY.js";import"./chunk-DWYVBWBP.js";import{a as v}from"./chunk-HPPFA3XU.js";import{g as l}from"./chunk-DQAEQEXD.js";import"./chunk-WUJUQPHI.js";import"./chunk-A2GDVOQP.js";import{j as R,n as w}from"./chunk-GLSCZGXA.js";import"./chunk-ZE5T64HQ.js";import{v as c}from"./chunk-YXSB6RET.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var h=E(),O=/^##\s{1,100}\[?([^\]\s]+)\]?\s{0,100}-?\s{0,100}([0-9]{4}-[0-9]{2}-[0-9]{2})?\s{0,100}$/,T=t=>{let e=t.trim().replace(/^refs\/tags\//,"");return e.startsWith("v")?e:`v${e}`},k=t=>{let e=t.split(/\r?\n/),r=[];for(let s=0;s<e.length;s+=1){let i=e[s].match(O);i!==null&&/^\d/.test(i[1])&&r.push({version:i[1],date:i[2]??"",headingLineIndex:s})}return r.length===0?[]:r.map((s,o)=>{let i=r[o+1],g=s.headingLineIndex+1,a=i!==void 0?i.headingLineIndex:e.length,n=e.slice(g,a);for(;n.length>0&&n[0].trim()==="";)n.shift();for(;n.length>0&&n[n.length-1].trim()==="";)n.pop();let d=[`## ${s.version}${s.date!==""?` - ${s.date}`:""}`];return n.length>0&&d.push("",...n),{version:s.version,date:s.date,tag:`v${s.version}`,notes:`${d.join(`
|
|
2
|
+
`).trim()}
|
|
3
|
+
`}})},I=async(t={})=>{let{changelogPath:e="CHANGELOG.md",root:r="."}=t,s=w(r,e),o=await c.runtime.fs.readTextFile(s);return{entries:k(o)}},S=async(t,e)=>{try{return await u.exec`gh release view ${t} --repo ${e}`.quiet().text(),!0}catch{return!1}},b=async t=>{let{repo:e,createIfMissing:r=!1,changelogPath:s="CHANGELOG.md",root:o=".",releaseTitle:i="eserstack {tag}"}=t,{entries:g}=await I({changelogPath:s,root:o});if(g.length===0)throw new Error("No release headings found in CHANGELOG.md.");let a=t.tag!==void 0?T(t.tag):g[0].tag,n=g.find(x=>x.tag===a);if(n===void 0)throw new Error(`No matching changelog section found for ${a}.`);let d=await c.runtime.fs.makeTempDir({prefix:"eserstack-release-"}),f=R(d,`${a}-notes.md`);await c.runtime.fs.writeTextFile(f,n.notes);try{if(await S(a,e))return await u.exec`gh release edit ${a} --repo ${e} --notes-file ${f}`.spawn(),{tag:a,entry:n,action:"updated"};if(!r)return{tag:a,entry:n,action:"skipped"};let N=i.replace("{tag}",a);try{return await u.exec`gh release create ${a} --repo ${e} --title ${N} --notes-file ${f}`.spawn(),{tag:a,entry:n,action:"created"}}catch{return await u.exec`gh release edit ${a} --repo ${e} --notes-file ${f}`.spawn(),{tag:a,entry:n,action:"updated"}}}finally{await c.runtime.fs.remove(d,{recursive:!0})}},G=t=>$.fromPromise(()=>b(t)),H=t=>{let e=t.flags.repo??c.runtime.env.get("GITHUB_REPOSITORY")??"";return e===""?l.fail(y.adaptError("Missing repository. Pass --repo or set GITHUB_REPOSITORY.")):l.ok({repo:e,tag:t.flags.tag??void 0,createIfMissing:t.flags["create-if-missing"]===!0})},L=t=>{if(l.isFail(t)){let r=t.error,s=r instanceof Error?r.message:r.message??String(r);return h.writeln(P("\u2717"),p(" "+s)),l.fail({exitCode:1})}let{value:e}=t;switch(e.action){case"created":h.writeln(m("\u2713"),p(` Created release ${e.tag} with changelog notes.`));break;case"updated":h.writeln(m("\u2713"),p(` Updated release notes for ${e.tag}.`));break;case"skipped":h.writeln(C("\u26A0"),p(` Release ${e.tag} not found. Skipping (pass --create-if-missing to create).`));break}return l.ok(void 0)},M=y.createTrigger({handler:G,adaptInput:H,adaptOutput:L}),W=async t=>{let e=v(t??[],{string:["repo","tag"],boolean:["create-if-missing"],alias:{h:"help"}}),r=A("release-notes",e);return await M(r)};export{M as handleCli,S as hasGitHubRelease,W as main,T as normalizeTag,I as parseChangelog,k as parseChangelogText,b as syncReleaseNotes,G as syncReleaseNotesHandler};
|