eser 4.1.49 → 4.1.53

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.
Files changed (184) hide show
  1. package/chunks/{anthropic-QBGNUIP3.js → anthropic-YMZNUQKZ.js} +1 -1
  2. package/chunks/approve-VBXGXWZI.js +2 -0
  3. package/chunks/{ask-M3VS3GIJ.js → ask-6DWHUCLO.js} +1 -1
  4. package/chunks/block-Z4BELXXO.js +2 -0
  5. package/chunks/{build-Y4OQZN3X.js → build-4WTOXDXD.js} +1 -1
  6. package/chunks/cancel-HHW2G675.js +2 -0
  7. package/chunks/{changelog-gen-LMXK5T7J.js → changelog-gen-JTU6WIYA.js} +1 -1
  8. package/chunks/{chunk-YVKPHSJX.js → chunk-352YGR5O.js} +1 -1
  9. package/chunks/{chunk-FNPBHLLZ.js → chunk-3KGG2I2A.js} +1 -1
  10. package/chunks/{chunk-LYM57LLM.js → chunk-4BOZ4A55.js} +1 -1
  11. package/chunks/chunk-5GGWX7CO.js +4 -0
  12. package/chunks/{chunk-L7ROACZC.js → chunk-5QUEAV4O.js} +26 -26
  13. package/chunks/chunk-5YBG2HOI.js +3 -0
  14. package/chunks/chunk-67AFLWXV.js +4 -0
  15. package/chunks/chunk-6F4PFXYY.js +2 -0
  16. package/chunks/{chunk-TDIR6AUJ.js → chunk-6HJUPT5Y.js} +1 -1
  17. package/chunks/{chunk-RSYERFWM.js → chunk-6M64JLJW.js} +1 -1
  18. package/chunks/{chunk-U34MRDPH.js → chunk-6WFCBJPF.js} +1 -1
  19. package/chunks/{chunk-AWMLF355.js → chunk-7L4DDCRL.js} +1 -1
  20. package/chunks/{chunk-JMGANJGV.js → chunk-7V3IDYYI.js} +1 -1
  21. package/chunks/{chunk-C6URCXQM.js → chunk-BKWQQUSY.js} +1 -1
  22. package/chunks/{chunk-KHBIOZJE.js → chunk-BVIGTD2Z.js} +1 -1
  23. package/chunks/{chunk-Q56M5KDF.js → chunk-BZSILAX3.js} +1 -1
  24. package/chunks/{chunk-XFCBVUI7.js → chunk-DGI7M6TL.js} +1 -1
  25. package/chunks/{chunk-WTMV5GTZ.js → chunk-DTDUHDLM.js} +1 -1
  26. package/chunks/{chunk-DYMKE4R3.js → chunk-DYBJ6UPO.js} +1 -1
  27. package/chunks/{chunk-3TS5IRPD.js → chunk-EJBYYUXZ.js} +1 -1
  28. package/chunks/{chunk-3SBAWBWS.js → chunk-F4QK3J3J.js} +1 -1
  29. package/chunks/{chunk-MTCPFQ5I.js → chunk-FVXGVHUR.js} +1 -1
  30. package/chunks/{chunk-Q66KA572.js → chunk-GQ4WRANA.js} +1 -1
  31. package/chunks/{chunk-3MMV2UHT.js → chunk-H6U2EE7V.js} +1 -1
  32. package/chunks/{chunk-3D5TBTM3.js → chunk-HTC2FO4I.js} +2 -2
  33. package/chunks/{chunk-4NNSMDFH.js → chunk-IUORSUN6.js} +1 -1
  34. package/chunks/{chunk-D43XK3L2.js → chunk-JBUJTUEU.js} +1 -1
  35. package/chunks/chunk-KFVUFHJB.js +6 -0
  36. package/chunks/{chunk-XVH5L5HY.js → chunk-L6J3BWVP.js} +1 -1
  37. package/chunks/{chunk-FQY3JLY2.js → chunk-LRAHXO3G.js} +1 -1
  38. package/chunks/chunk-LS5MCZUM.js +2 -0
  39. package/chunks/chunk-MX5DKVDI.js +2 -0
  40. package/chunks/chunk-NE2J6ISX.js +6 -0
  41. package/chunks/chunk-NQS27P25.js +6 -0
  42. package/chunks/{chunk-43E7ZXUB.js → chunk-NYHMH3N5.js} +1 -1
  43. package/chunks/chunk-ODBJ5KMQ.js +3 -0
  44. package/chunks/chunk-OXP2FOO5.js +2 -0
  45. package/chunks/{chunk-6BILFSH2.js → chunk-PBZV2KA3.js} +1 -1
  46. package/chunks/{chunk-JTSRGXS4.js → chunk-PZUDTTK4.js} +1 -1
  47. package/chunks/{chunk-PPSDIDOI.js → chunk-QHVTWYZJ.js} +1 -1
  48. package/chunks/{chunk-N4NDBIQS.js → chunk-QXSFQQGJ.js} +1 -1
  49. package/chunks/{chunk-2DAFGT4S.js → chunk-RLA2Z7XV.js} +1 -1
  50. package/chunks/{chunk-FFEFO7MA.js → chunk-RLTTHJ3E.js} +1 -1
  51. package/chunks/{chunk-3PZVRB75.js → chunk-RSHUTH4K.js} +1 -1
  52. package/chunks/chunk-RUTM4VP7.js +11 -0
  53. package/chunks/{chunk-3VZXRI4F.js → chunk-SKW7N57D.js} +1 -1
  54. package/chunks/{chunk-SNWQNMGD.js → chunk-TJ4VL7T5.js} +1 -1
  55. package/chunks/{chunk-XBCL25QR.js → chunk-UTENCUNI.js} +1 -1
  56. package/chunks/{chunk-K7TY7247.js → chunk-V3KWM26F.js} +1 -1
  57. package/chunks/{chunk-U25GY4AZ.js → chunk-VGCEFEFY.js} +1 -1
  58. package/chunks/{chunk-HVQK35SO.js → chunk-VJSHVZ7R.js} +1 -1
  59. package/chunks/chunk-VKB3B2FE.js +4 -0
  60. package/chunks/{chunk-IIFFSCDJ.js → chunk-VXVW4UNH.js} +1 -1
  61. package/chunks/chunk-YWSOQJ7G.js +5 -0
  62. package/chunks/chunk-YXETE4S3.js +4 -0
  63. package/chunks/{chunk-PHOYLFXC.js → chunk-ZZMU6YO4.js} +1 -1
  64. package/chunks/{claude-code-UJYCO6CN.js → claude-code-RN3Q2VCK.js} +1 -1
  65. package/chunks/commitmsg-BRWGZ26L.js +15 -0
  66. package/chunks/concern-YFXJJ7DL.js +2 -0
  67. package/chunks/delegate-FVHPWQS7.js +2 -0
  68. package/chunks/{dev-XHMBUBQE.js → dev-UV7J3QTQ.js} +1 -1
  69. package/chunks/diagrams-IC2ADMKS.js +2 -0
  70. package/chunks/diagrams-MRJB73CF.js +2 -0
  71. package/chunks/done-DMKJ27IQ.js +2 -0
  72. package/chunks/{file-tools-shared-YKDNDDHR.js → file-tools-shared-IIW7WSUM.js} +1 -1
  73. package/chunks/followup-XKVSZT2H.js +2 -0
  74. package/chunks/free-IPJPYOJS.js +2 -0
  75. package/chunks/{gh-AWX6I7FO.js → gh-3GMLD6TO.js} +2 -2
  76. package/chunks/{gh-contributors-EDZTKR5E.js → gh-contributors-PNU47Y7Q.js} +1 -1
  77. package/chunks/{init-GBMYF3YG.js → init-BZ6B74SY.js} +1 -1
  78. package/chunks/init-ONTNPCSY.js +2 -0
  79. package/chunks/invoke-hook-ZM6UQND6.js +14 -0
  80. package/chunks/{kiro-V6SMU4OL.js → kiro-JS5UVLRL.js} +1 -1
  81. package/chunks/learn-SRDLP7B5.js +8 -0
  82. package/chunks/{list-NX7RRO6R.js → list-COFD6OUQ.js} +1 -1
  83. package/chunks/{list-ZVCGDRUH.js → list-RI4IF5TD.js} +1 -1
  84. package/chunks/{main-NCAKIBQC.js → main-PQW6MNZM.js} +1 -1
  85. package/chunks/manager-BMNUSWJO.js +7 -0
  86. package/chunks/{mod-VZT7JWPZ.js → mod-64M47KGW.js} +1 -1
  87. package/chunks/{mod-52TIS344.js → mod-6LLSLOX6.js} +1 -1
  88. package/chunks/{mod-NSL6IJRQ.js → mod-CTW3YE4Q.js} +1 -1
  89. package/chunks/{mod-7ICCX4OY.js → mod-D5IDWU35.js} +1 -1
  90. package/chunks/{mod-5NDTGNVM.js → mod-DESWHMN6.js} +1 -1
  91. package/chunks/{mod-DFDEWFDA.js → mod-MKKBIIC4.js} +1 -1
  92. package/chunks/{mod-KPIOBBDD.js → mod-YNYASB66.js} +1 -1
  93. package/chunks/next-FD3EHJW3.js +8 -0
  94. package/chunks/{ollama-DFG5G467.js → ollama-PL4UHEF2.js} +1 -1
  95. package/chunks/{opencode-UA45VV3W.js → opencode-K4G7UMAE.js} +1 -1
  96. package/chunks/pack-ZQMMSIIP.js +6 -0
  97. package/chunks/{purge-Q3FI3S5M.js → purge-LXL3F3EJ.js} +1 -1
  98. package/chunks/{release-4VI2Y2ZT.js → release-5PXID6GL.js} +2 -2
  99. package/chunks/{release-notes-2ZYPZ6TK.js → release-notes-3OMBQLOK.js} +1 -1
  100. package/chunks/{release-tag-SG4WPYDZ.js → release-tag-2B2CWVMZ.js} +1 -1
  101. package/chunks/reopen-3NA6JI4N.js +2 -0
  102. package/chunks/reset-XITFRWII.js +2 -0
  103. package/chunks/review-UVYK4M4T.js +2 -0
  104. package/chunks/rule-BAO7IP5S.js +7 -0
  105. package/chunks/run-EBKNNOG7.js +4 -0
  106. package/chunks/{run-DAKF5SJN.js → run-IMXYUDHS.js} +1 -1
  107. package/chunks/{scripts-VRQQ24O3.js → scripts-XTXYY5MJ.js} +1 -1
  108. package/chunks/{sdk-L2SQCWYV.js → sdk-EJKXYVDC.js} +8 -8
  109. package/chunks/{serve-5MTJLRIN.js → serve-T5HR56BZ.js} +1 -1
  110. package/chunks/session-SZYH2UOE.js +2 -0
  111. package/chunks/spec-CPRKQGOX.js +2 -0
  112. package/chunks/status-SRCNQJ4V.js +2 -0
  113. package/chunks/sync-WE6A7KC7.js +2 -0
  114. package/chunks/{system-JBGO2IFD.js → system-6TO2XBOH.js} +1 -1
  115. package/chunks/{system-QDBQLRO6.js → system-RWYI6DJF.js} +1 -1
  116. package/chunks/{validate-bom-XTZYCKGP.js → validate-bom-YFYXM4ND.js} +1 -1
  117. package/chunks/{validate-case-conflict-CQIPKKHY.js → validate-case-conflict-E7LKQYVM.js} +1 -1
  118. package/chunks/{validate-circular-deps-Y6X6GZCG.js → validate-circular-deps-L4MDRIG3.js} +1 -1
  119. package/chunks/{validate-commit-msg-MXTBUPTC.js → validate-commit-msg-2JQ2W6Y6.js} +1 -1
  120. package/chunks/{validate-docs-ZOHUOW3I.js → validate-docs-EXDICKDK.js} +1 -1
  121. package/chunks/{validate-filenames-6E634ZHO.js → validate-eof-UYQI6DYK.js} +1 -1
  122. package/chunks/{validate-export-names-7V3647EU.js → validate-export-names-QBYWTK5Q.js} +1 -1
  123. package/chunks/{validate-eof-4I2QAFTC.js → validate-filenames-Z6VSIR2C.js} +1 -1
  124. package/chunks/{validate-json-LRWPQ4JX.js → validate-json-2JS2Y4YU.js} +1 -1
  125. package/chunks/validate-large-files-JKQBKNS4.js +2 -0
  126. package/chunks/validate-licenses-7MVLVDZA.js +2 -0
  127. package/chunks/validate-line-endings-KMXN5IUT.js +2 -0
  128. package/chunks/validate-merge-conflict-N7M4OVXI.js +2 -0
  129. package/chunks/{validate-mod-exports-Y6W74PAB.js → validate-mod-exports-C7WDH4FK.js} +1 -1
  130. package/chunks/{validate-package-configs-VVCKJELU.js → validate-package-configs-AYVT55GJ.js} +1 -1
  131. package/chunks/validate-secrets-3PW5GJZD.js +2 -0
  132. package/chunks/validate-shebangs-JACZB7C3.js +2 -0
  133. package/chunks/validate-submodules-SCY4LARV.js +2 -0
  134. package/chunks/validate-symlinks-PDLYFPNE.js +2 -0
  135. package/chunks/{validate-toml-FNXGITZJ.js → validate-toml-NGF5Q27B.js} +1 -1
  136. package/chunks/validate-trailing-whitespace-PDAFNVPQ.js +2 -0
  137. package/chunks/{validate-yaml-YRAD4HU3.js → validate-yaml-ILJZJGDG.js} +1 -1
  138. package/chunks/{versions-LJSQVW77.js → versions-VGXMC5GM.js} +1 -1
  139. package/chunks/watch-WBZB2C5P.js +9 -0
  140. package/chunks/web-GAF33V4M.js +2 -0
  141. package/chunks/wontfix-JBPCNL6S.js +2 -0
  142. package/eser.js +1 -1
  143. package/package.json +1 -1
  144. package/chunks/approve-HF44PKLL.js +0 -2
  145. package/chunks/block-F7S7PYMQ.js +0 -2
  146. package/chunks/cancel-Q6LMMZBV.js +0 -2
  147. package/chunks/chunk-2TANTKYS.js +0 -4
  148. package/chunks/chunk-4TTJVJEI.js +0 -2
  149. package/chunks/chunk-C2IORZTF.js +0 -4
  150. package/chunks/chunk-EQUPVWVY.js +0 -2
  151. package/chunks/chunk-FXDWRGGR.js +0 -2
  152. package/chunks/chunk-GVTM4EOU.js +0 -4
  153. package/chunks/chunk-IZUADMIU.js +0 -3
  154. package/chunks/chunk-LJ7A5HYR.js +0 -2
  155. package/chunks/chunk-RBQ2FOSL.js +0 -17
  156. package/chunks/chunk-RBU3HF66.js +0 -10
  157. package/chunks/commitmsg-57EMHAFY.js +0 -11
  158. package/chunks/concern-7ZK3KY54.js +0 -2
  159. package/chunks/done-FQQYM27R.js +0 -2
  160. package/chunks/free-XOGOSVEQ.js +0 -2
  161. package/chunks/init-3HE3P3N3.js +0 -2
  162. package/chunks/invoke-hook-EIOZ5WSA.js +0 -12
  163. package/chunks/manager-GC34GK44.js +0 -7
  164. package/chunks/next-2LOPGEJO.js +0 -9
  165. package/chunks/pack-B5VXZEW7.js +0 -6
  166. package/chunks/reopen-6FB7DVV2.js +0 -2
  167. package/chunks/reset-T4YMGQPV.js +0 -2
  168. package/chunks/rule-EJKPIOLE.js +0 -7
  169. package/chunks/run-BV6BHCCQ.js +0 -4
  170. package/chunks/session-3HOLYHOY.js +0 -2
  171. package/chunks/spec-3P3HJT27.js +0 -2
  172. package/chunks/status-6XVLXNA5.js +0 -2
  173. package/chunks/sync-EEH6563X.js +0 -2
  174. package/chunks/validate-large-files-RV7O7ZUR.js +0 -2
  175. package/chunks/validate-licenses-KHDUSBXM.js +0 -2
  176. package/chunks/validate-line-endings-XOCAE22U.js +0 -2
  177. package/chunks/validate-merge-conflict-PDJRAIKU.js +0 -2
  178. package/chunks/validate-secrets-UI5XKJ6B.js +0 -2
  179. package/chunks/validate-shebangs-GE23Z6NU.js +0 -2
  180. package/chunks/validate-submodules-R5JKX3Z6.js +0 -2
  181. package/chunks/validate-symlinks-WBF6VHHT.js +0 -2
  182. package/chunks/validate-trailing-whitespace-UCMQTQ3B.js +0 -2
  183. package/chunks/watch-N3KV2ONB.js +0 -9
  184. package/chunks/wontfix-MJJ2LK6J.js +0 -2
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-GTHXGAMQ.js";import{a as O}from"./chunk-3XJLLDR5.js";import{a as D}from"./chunk-P7WCO724.js";import{a as S}from"./chunk-2XNFZXHY.js";import{i as p}from"./chunk-6DBKPC2O.js";import{e as _}from"./chunk-5WJ6AUNY.js";var y={DenoJson:"deno.json",DenoJsonc:"deno.jsonc",JsrJson:"jsr.json",JsrJsonc:"jsr.jsonc",PackageJson:"package.json"},k=[y.DenoJson,y.DenoJsonc,y.JsrJson,y.JsrJsonc,y.PackageJson],P=Symbol.for("baseDir"),F={name:{"deno.json":"name","deno.jsonc":"name","jsr.json":"name","jsr.jsonc":"name","package.json":"name"},version:{"deno.json":"version","deno.jsonc":"version","jsr.json":"version","jsr.jsonc":"version","package.json":"version"},description:{"package.json":"description"},license:{"deno.json":"license","deno.jsonc":"license","package.json":"license"},private:{"package.json":"private"},exports:{"deno.json":"exports","deno.jsonc":"exports","jsr.json":"exports","jsr.jsonc":"exports","package.json":"exports"},workspaces:{"deno.json":"workspace","deno.jsonc":"workspace","package.json":"workspaces"},imports:{"deno.json":"imports","deno.jsonc":"imports"},dependencies:{"package.json":"dependencies"},devDependencies:{"package.json":"devDependencies"}};var A=_(S(),1);var c={Unknown:0,EnvironmentFile:1,Json:2,JsonWithComments:3,Toml:4,Yaml:5};var I={[c.Unknown]:"unknown",[c.EnvironmentFile]:"environment",[c.Json]:"JSON",[c.JsonWithComments]:"JSONC",[c.Toml]:"TOML",[c.Yaml]:"YAML"},h=class extends Error{filepath;format;constructor(n,r,i){super(`Failed to parse ${I[r]??"unknown"} file "${n}": ${i.message}`,{cause:i}),this.name="ConfigParseError",this.filepath=n,this.format=r}};var M=e=>{let n=p.path.extname(e);return n===".json"?c.Json:n===".jsonc"?c.JsonWithComments:n===".yaml"||n===".yml"?c.Yaml:n===".toml"?c.Toml:n===".env"?c.EnvironmentFile:c.Unknown},x=async(e,n)=>{let r=n??M(e),i=await p.fs.readTextFile(e);try{return r===c.Json?{content:JSON.parse(i),filepath:e,format:r}:r===c.JsonWithComments?{content:O(i),filepath:e,format:r}:r===c.Yaml?{content:A.parse(i),filepath:e,format:r}:r===c.Toml?{content:D(i),filepath:e,format:r}:{content:void 0,filepath:e,format:c.Unknown}}catch(t){throw t instanceof Error?new h(e,r,t):new h(e,r,new Error(String(t)))}};var E=(e,n,r)=>{if(e==null)return r;let i=n.length;if(i===0)return e;let t=e;for(let o=0;o<i;o++){if(t==null)return r;let a=n[o];t=t[a]}return t===void 0?r:t};var m=class extends Error{filepath;constructor(n,r,i){super(n,{cause:i}),this.name="PackageLoadError",this.filepath=r}},$=async(e,n)=>{if(await p.fs.exists(e)===!1||(await p.fs.stat(e)).isFile===!1)return;let t=await p.fs.readTextFile(e),a=(await x(e)).content;if(a!==void 0)return{filepath:e,fileType:n,content:a,rawText:t}},Y=async(e,n)=>{let r=[];for(let i of n){let t=p.path.join(e,i),o=await $(t,i);o&&r.push(o)}return r},B=(e,n)=>E(e,n.split(".")),u=(e,n,r)=>{let i,t,o=[];for(let a of n){let l=r[e]?.[a.fileType];if(l===void 0)continue;let s=B(a.content,l);if(s===void 0)continue;let d={filepath:a.filepath,fileType:a.fileType,propertyPath:l};i===void 0?(i=s,t=d):o.push(d)}if(!(i===void 0||t===void 0))return{value:i,origin:t,alternateOrigins:o}},G=e=>e===void 0?F:b(F,e),H=e=>[...e].sort((n,r)=>k.indexOf(n)-k.indexOf(r)),T=async(e={})=>{let{baseDir:n=".",includeFiles:r=k,fieldMappings:i,searchParents:t=!1}=e,o=G(i),a=H(r),l=p.path.resolve(n),s=[];for(;s=await Y(l,a),!(s.length>0||!t);){let g=p.path.dirname(l);if(g===l)break;l=g}if(s.length===0)throw new m(`No config files found in ${n}. Looked for: ${a.join(", ")}`);return{name:u("name",s,o),version:u("version",s,o),description:u("description",s,o),license:u("license",s,o),private:u("private",s,o),exports:u("exports",s,o),workspaces:u("workspaces",s,o),imports:u("imports",s,o),dependencies:u("dependencies",s,o),devDependencies:u("devDependencies",s,o),[P]:l,_loadedFiles:s}},v=async(e={})=>{try{return await T(e)}catch(n){if(n instanceof m)return;throw n}},R=(e,n)=>{let r=e[n];if(!r)return[];let i=new Set([r.origin.filepath,...r.alternateOrigins.map(t=>t.filepath)]);return e._loadedFiles.filter(t=>i.has(t.filepath))},L=e=>e[P];var K=(e,n)=>{let r=n.split("."),i=e;for(let t of r){if(C.has(t)||i==null||typeof i!="object"||!Object.hasOwn(i,t))return;i=i[t]}return i},C=new Set(["__proto__","constructor","prototype"]),V=(e,n,r)=>{let i=n.split("."),t=e;for(let a=0;a<i.length-1;a++){let l=i[a];if(l===void 0||C.has(l))return;if(!Object.hasOwn(t,l)||typeof t[l]!="object"||t[l]===null){let s=Object.create(null);t[l]=s}t=t[l]}let o=i[i.length-1];o!==void 0&&!C.has(o)&&(t[o]=r)},q=e=>`${JSON.stringify(e,null,2)}
3
- `,z=async(e,n)=>{let r=JSON.parse(JSON.stringify(e.content));for(let[t,o]of Object.entries(n))V(r,t,o);let i=q(r);await p.fs.writeTextFile(e.filepath,i),e.content=r,e.rawText=i},Q=(e,n,r)=>{let{targetFiles:i="all",createIfMissing:t=!1}=r,o=e[n];if(i==="origin"){if(o===void 0){let s=e._loadedFiles[0];return t&&s!==void 0?[s]:[]}let l=e._loadedFiles.find(s=>s.filepath===o.origin.filepath);return l?[l]:[]}if(i==="all")return!o&&!t?[]:!o&&t?[...e._loadedFiles]:R(e,n);let a=new Set(i);return e._loadedFiles.filter(l=>a.has(l.fileType))},J=async(e,n,r,i={})=>{let t=[],o=[],a=[],l=Q(e,n,i);if(l.length===0)return{updated:t,failed:o,skipped:a};for(let s of l){let d=F[n]?.[s.fileType];if(!d){a.push(s.filepath);continue}if(K(s.content,d)===r){a.push(s.filepath);continue}try{await z(s,{[d]:r}),t.push(s.filepath)}catch(f){o.push({filepath:s.filepath,reason:f instanceof Error?f.message:String(f)})}}if(t.length>0){let s=e[n];if(s)s.value=r;else{let d=e._loadedFiles.find(g=>t.includes(g.filepath));if(d){let g=F[n]?.[d.fileType];g&&(e[n]={value:r,origin:{filepath:d.filepath,fileType:d.fileType,propertyPath:g},alternateOrigins:[]})}}}return{updated:t,failed:o,skipped:a}};var X=async(e,n,r)=>await J(e,"version",n,{...r,targetFiles:"all"});var w=class extends Error{constructor(n){super(n),this.name="WorkspaceError"}},U=async e=>{try{return await T({baseDir:e})}catch(n){throw n instanceof m?new w(`No package config file found in ${p.path.resolve(e)}`):n}},Z=async(e,n)=>{let r=[];for(let i of n)if(i.endsWith("/*")){let t=p.path.join(e,i.slice(0,-2));try{for await(let o of p.fs.readDir(t))o.isDirectory&&r.push(p.path.join(t,o.name))}catch{}}else if(i.includes("*")||i.includes("?")){let t=i.split("/"),o=[],a=0;for(let f=0;f<t.length;f++){if(t[f].includes("*")||t[f].includes("?")){a=f;break}o.push(t[f])}let l=p.path.join(e,...o),d=t.slice(a).join("/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]"),g=new RegExp(`^${d}$`);try{for await(let f of p.fs.walk(l,{includeDirs:!0,includeFiles:!1})){let j=p.path.relative(l,f.path);j!==""&&g.test(j)&&r.push(f.path)}}catch{}}else r.push(p.path.join(e,i));return r},ee=async e=>{let n=await U(e),r=n.workspaces?.value;if(!Array.isArray(r))throw new w("Package config doesn't have workspace field.");for(let o of r)if(typeof o!="string")throw new w("Package config workspace field should be an array of strings.");let i=await Z(e,r),t=[];for(let o of i){let a=await v({baseDir:o});if(a===void 0)continue;let l=a.name?.value,s=a.version?.value,d=a.private?.value;l!==void 0&&d!==!0&&t.push({name:l,version:s??"0.0.0",config:a})}return[n,t]};export{y as a,T as b,v as c,L as d,X as e,ee as f};
2
+ import{a as D}from"./chunk-GTHXGAMQ.js";import{a as j}from"./chunk-3XJLLDR5.js";import{a as O}from"./chunk-P7WCO724.js";import{a as S}from"./chunk-2XNFZXHY.js";import{i as p}from"./chunk-6DBKPC2O.js";import{e as _}from"./chunk-5WJ6AUNY.js";var y={DenoJson:"deno.json",DenoJsonc:"deno.jsonc",JsrJson:"jsr.json",JsrJsonc:"jsr.jsonc",PackageJson:"package.json"},k=[y.DenoJson,y.DenoJsonc,y.JsrJson,y.JsrJsonc,y.PackageJson],P=Symbol.for("baseDir"),F={name:{"deno.json":"name","deno.jsonc":"name","jsr.json":"name","jsr.jsonc":"name","package.json":"name"},version:{"deno.json":"version","deno.jsonc":"version","jsr.json":"version","jsr.jsonc":"version","package.json":"version"},description:{"package.json":"description"},license:{"deno.json":"license","deno.jsonc":"license","package.json":"license"},private:{"package.json":"private"},exports:{"deno.json":"exports","deno.jsonc":"exports","jsr.json":"exports","jsr.jsonc":"exports","package.json":"exports"},workspaces:{"deno.json":"workspace","deno.jsonc":"workspace","package.json":"workspaces"},imports:{"deno.json":"imports","deno.jsonc":"imports"},dependencies:{"package.json":"dependencies"},devDependencies:{"package.json":"devDependencies"}};var b=_(S(),1);var c={Unknown:0,EnvironmentFile:1,Json:2,JsonWithComments:3,Toml:4,Yaml:5};var I={[c.Unknown]:"unknown",[c.EnvironmentFile]:"environment",[c.Json]:"JSON",[c.JsonWithComments]:"JSONC",[c.Toml]:"TOML",[c.Yaml]:"YAML"},h=class extends Error{filepath;format;constructor(n,r,i){super(`Failed to parse ${I[r]??"unknown"} file "${n}": ${i.message}`,{cause:i}),this.name="ConfigParseError",this.filepath=n,this.format=r}};var A=e=>{let n=p.path.extname(e);return n===".json"?c.Json:n===".jsonc"?c.JsonWithComments:n===".yaml"||n===".yml"?c.Yaml:n===".toml"?c.Toml:n===".env"?c.EnvironmentFile:c.Unknown},x=async(e,n)=>{let r=n??A(e),i=await p.fs.readTextFile(e);try{return r===c.Json?{content:JSON.parse(i),filepath:e,format:r}:r===c.JsonWithComments?{content:j(i),filepath:e,format:r}:r===c.Yaml?{content:b.parse(i),filepath:e,format:r}:r===c.Toml?{content:O(i),filepath:e,format:r}:{content:void 0,filepath:e,format:c.Unknown}}catch(t){throw t instanceof Error?new h(e,r,t):new h(e,r,new Error(String(t)))}};var M=(e,n,r)=>{if(e==null)return r;let i=n.length;if(i===0)return e;let t=e;for(let o=0;o<i;o++){if(t==null)return r;let a=n[o];t=t[a]}return t===void 0?r:t};var m=class extends Error{filepath;constructor(n,r,i){super(n,{cause:i}),this.name="PackageLoadError",this.filepath=r}},$=async(e,n)=>{if(await p.fs.exists(e)===!1||(await p.fs.stat(e)).isFile===!1)return;let t=await p.fs.readTextFile(e),a=(await x(e)).content;if(a!==void 0)return{filepath:e,fileType:n,content:a,rawText:t}},Y=async(e,n)=>{let r=[];for(let i of n){let t=p.path.join(e,i),o=await $(t,i);o&&r.push(o)}return r},B=(e,n)=>M(e,n.split(".")),u=(e,n,r)=>{let i,t,o=[];for(let a of n){let l=r[e]?.[a.fileType];if(l===void 0)continue;let s=B(a.content,l);if(s===void 0)continue;let d={filepath:a.filepath,fileType:a.fileType,propertyPath:l};i===void 0?(i=s,t=d):o.push(d)}if(!(i===void 0||t===void 0))return{value:i,origin:t,alternateOrigins:o}},G=e=>e===void 0?F:D(F,e),H=e=>[...e].sort((n,r)=>k.indexOf(n)-k.indexOf(r)),T=async(e={})=>{let{baseDir:n=".",includeFiles:r=k,fieldMappings:i,searchParents:t=!1}=e,o=G(i),a=H(r),l=p.path.resolve(n),s=[];for(;s=await Y(l,a),!(s.length>0||!t);){let g=p.path.dirname(l);if(g===l)break;l=g}if(s.length===0)throw new m(`No config files found in ${n}. Looked for: ${a.join(", ")}`);return{name:u("name",s,o),version:u("version",s,o),description:u("description",s,o),license:u("license",s,o),private:u("private",s,o),exports:u("exports",s,o),workspaces:u("workspaces",s,o),imports:u("imports",s,o),dependencies:u("dependencies",s,o),devDependencies:u("devDependencies",s,o),[P]:l,_loadedFiles:s}},v=async(e={})=>{try{return await T(e)}catch(n){if(n instanceof m)return;throw n}},R=(e,n)=>{let r=e[n];if(!r)return[];let i=new Set([r.origin.filepath,...r.alternateOrigins.map(t=>t.filepath)]);return e._loadedFiles.filter(t=>i.has(t.filepath))},E=e=>e[P];var K=(e,n)=>{let r=n.split("."),i=e;for(let t of r){if(L.has(t)||i==null||typeof i!="object"||!Object.hasOwn(i,t))return;i=i[t]}return i},L=new Set(["__proto__","constructor","prototype"]),V=(e,n,r)=>{let i=n.split(".");for(let a of i)if(a===void 0||a.length===0||L.has(a))return;let t=e;for(let a=0;a<i.length-1;a++){let l=i[a];if(!Object.hasOwn(t,l)||typeof t[l]!="object"||t[l]===null){let s=Object.create(null);t[l]=s,t=s}else t=t[l]}let o=i[i.length-1];t[o]=r},q=e=>`${JSON.stringify(e,null,2)}
3
+ `,z=async(e,n)=>{let r=JSON.parse(JSON.stringify(e.content));for(let[t,o]of Object.entries(n))V(r,t,o);let i=q(r);await p.fs.writeTextFile(e.filepath,i),e.content=r,e.rawText=i},Q=(e,n,r)=>{let{targetFiles:i="all",createIfMissing:t=!1}=r,o=e[n];if(i==="origin"){if(o===void 0){let s=e._loadedFiles[0];return t&&s!==void 0?[s]:[]}let l=e._loadedFiles.find(s=>s.filepath===o.origin.filepath);return l?[l]:[]}if(i==="all")return!o&&!t?[]:!o&&t?[...e._loadedFiles]:R(e,n);let a=new Set(i);return e._loadedFiles.filter(l=>a.has(l.fileType))},J=async(e,n,r,i={})=>{let t=[],o=[],a=[],l=Q(e,n,i);if(l.length===0)return{updated:t,failed:o,skipped:a};for(let s of l){let d=F[n]?.[s.fileType];if(!d){a.push(s.filepath);continue}if(K(s.content,d)===r){a.push(s.filepath);continue}try{await z(s,{[d]:r}),t.push(s.filepath)}catch(f){o.push({filepath:s.filepath,reason:f instanceof Error?f.message:String(f)})}}if(t.length>0){let s=e[n];if(s)s.value=r;else{let d=e._loadedFiles.find(g=>t.includes(g.filepath));if(d){let g=F[n]?.[d.fileType];g&&(e[n]={value:r,origin:{filepath:d.filepath,fileType:d.fileType,propertyPath:g},alternateOrigins:[]})}}}return{updated:t,failed:o,skipped:a}};var X=async(e,n,r)=>await J(e,"version",n,{...r,targetFiles:"all"});var w=class extends Error{constructor(n){super(n),this.name="WorkspaceError"}},U=async e=>{try{return await T({baseDir:e})}catch(n){throw n instanceof m?new w(`No package config file found in ${p.path.resolve(e)}`):n}},Z=async(e,n)=>{let r=[];for(let i of n)if(i.endsWith("/*")){let t=p.path.join(e,i.slice(0,-2));try{for await(let o of p.fs.readDir(t))o.isDirectory&&r.push(p.path.join(t,o.name))}catch{}}else if(i.includes("*")||i.includes("?")){let t=i.split("/"),o=[],a=0;for(let f=0;f<t.length;f++){if(t[f].includes("*")||t[f].includes("?")){a=f;break}o.push(t[f])}let l=p.path.join(e,...o),d=t.slice(a).join("/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]"),g=new RegExp(`^${d}$`);try{for await(let f of p.fs.walk(l,{includeDirs:!0,includeFiles:!1})){let C=p.path.relative(l,f.path);C!==""&&g.test(C)&&r.push(f.path)}}catch{}}else r.push(p.path.join(e,i));return r},ee=async e=>{let n=await U(e),r=n.workspaces?.value;if(!Array.isArray(r))throw new w("Package config doesn't have workspace field.");for(let o of r)if(typeof o!="string")throw new w("Package config workspace field should be an array of strings.");let i=await Z(e,r),t=[];for(let o of i){let a=await v({baseDir:o});if(a===void 0)continue;let l=a.name?.value,s=a.version?.value,d=a.private?.value;l!==void 0&&d!==!0&&t.push({name:l,version:s??"0.0.0",config:a})}return[n,t]};export{y as a,T as b,v as c,E as d,X as e,ee as f};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- var s={id:"open-source",name:"Open Source",description:"Community-driven, inclusive, well-documented. Prioritize contributor experience, avoid exclusionary patterns, default to permissive choices.",extras:[{questionId:"status_quo",text:"Is this workaround common in the community?"},{questionId:"user_impact",text:"Does this make contribution harder?"}],specSections:["Contributor Guide","Public API Surface"],reminders:["Endpoint should be documented in API docs","Consider contributor experience for new patterns","Default to permissive, well-documented choices","New features and API changes must be documented so contributors can discover and use them"],acceptanceCriteria:["Public API documented","Changes reflected in README or relevant docs","No exclusionary patterns introduced"]};var r={id:"beautiful-product",name:"Beautiful Product",description:"Design and UX are first-class. Agent critiques UI/UX like a passionate designer. Empty states, error states, loading states, mobile layout \u2014 nothing ships unspecified.",extras:[{questionId:"status_quo",text:"How painful is the current experience?"},{questionId:"status_quo",text:"What does the current UI look like? Rate it 0-10 on design intentionality."},{questionId:"ambition",text:"In the 10-star version, what does the user feel?"},{questionId:"ambition",text:"What would a 10/10 design look like for this feature? Describe the emotional response you want from users."},{questionId:"ambition",text:"What makes this UI NOT look AI-generated? Name specific design decisions that differentiate it from generic templates."},{questionId:"verification",text:"How will you verify design quality? Will you review empty states, loading states, error states, and edge cases (long text, zero results, slow connection)?"}],specSections:["Design States (empty, loading, error, success)","Mobile Layout","Interaction Design"],reminders:["Loading state and error state must be designed, not placeholder","No AI slop \u2014 every UI element is intentional","Empty states need clear CTAs with examples","Rate each UI change 0-10 on design intentionality before marking task complete. If below 7, iterate.","Check all interaction states: loading, empty, error, success, partial. Missing states are bugs, not TODOs.","Edge case check: what happens with 47-character names? Zero results? Network failure mid-action?","AI SLOP BLACKLIST \u2014 reject these patterns in any UI implementation: (1) Purple/violet gradient backgrounds (2) 3-column feature grid with icon-in-circle + bold title + 2-line description (3) Icons in colored circles as decoration (4) Everything centered (text-align: center on all elements) (5) Uniform bubbly border-radius on every element (6) Decorative blobs, floating circles, wavy SVG dividers (7) Emoji as design elements in headings or bullets (8) Colored left-border on cards (9) Generic hero copy ('Welcome to X', 'Unlock the power of...') (10) Cookie-cutter section rhythm (hero \u2192 3 features \u2192 testimonials \u2192 pricing). If the implementation matches any of these patterns, reject it and ask for a redesign with specific, intentional alternatives."],acceptanceCriteria:["All UI states designed (empty, loading, error, success)","Mobile layout considered","No placeholder or skeleton UI left unfinished","All UI states specified and implemented: loading, empty, error, success, partial","No placeholder text in shipped UI \u2014 every empty state has warmth, a primary action, and context","Design rated 7+ on intentionality by the spec author"]};var a={id:"long-lived",name:"Long-Lived",description:"Built to last. Stability, maintainability, and backward compatibility matter. Every shortcut needs justification. Favor boring technology.",extras:[{questionId:"reversibility",text:"Will this decision still be correct in 2 years?"},{questionId:"verification",text:"Is documentation (README, CHANGELOG, API docs) up to date with this change?"},{questionId:"scope_boundary",text:"What technical debt would this introduce?"}],specSections:["Migration & Deprecation","Backward Compatibility"],reminders:["Favor boring technology over shiny new tools","Every shortcut needs explicit justification","Consider maintenance burden for new dependencies","If this task changes public behavior, API, CLI flags, or configuration \u2014 update README and relevant docs in the SAME task. Documentation is not a follow-up."],acceptanceCriteria:["Backward compatibility preserved","Migration path documented if breaking","No unnecessary new dependencies","Documentation updated for any public-facing change"]};var c={id:"move-fast",name:"Move Fast",description:"Optimize for shipping speed. Acceptable trade-offs on polish. Good enough is good enough. Reduce ceremony.",extras:[{questionId:"scope_boundary",text:"Which polish items can be deferred to v2?"},{questionId:"ambition",text:"What is the minimum viable 5-star version?"}],specSections:["v1 vs v2 Scope"],reminders:["Good enough is good enough \u2014 ship it","Reduce ceremony, optimize for feedback speed","Mark polish items for v2 explicitly"],acceptanceCriteria:["Core functionality works","v2 items explicitly deferred"]};var d={id:"compliance",name:"Compliance",description:"Audit trails, access controls, data handling rules. Every change is traceable. Verification is mandatory, not optional.",extras:[{questionId:"reversibility",text:"Is the audit trail preserved on rollback?"},{questionId:"verification",text:"Is there an audit/traceability requirement?"}],specSections:["Audit Trail","Access Control","Data Handling"],reminders:["Every state change must be traceable","Verification is mandatory, not optional","Document data handling and retention policies"],acceptanceCriteria:["Audit trail added for state changes","Access control verified","Data handling documented"]};var l={id:"learning-project",name:"Learning Project",description:"Experimentation is the goal. Encourage trying new patterns, don't punish dead ends. Document learnings over polish.",extras:[{questionId:"ambition",text:"What do you want to learn from building this?"},{questionId:"scope_boundary",text:"What experiments are explicitly allowed?"}],specSections:["Learning Goals","Experiment Log"],reminders:["Document learnings, not just outcomes","Dead ends are acceptable \u2014 document why","Try new patterns freely, polish later"],acceptanceCriteria:["Learnings documented","Experiment outcomes recorded"]};var u=[s,r,a,c,d,l];var N=()=>Promise.resolve(u),T=(n,t)=>{let e=[];for(let i of n)for(let o of i.extras)o.questionId===t&&e.push(o);return e},W=n=>{let t=[];for(let e of n)for(let i of e.reminders)t.push(`${e.id}: ${i}`);return t},M=n=>{let t=[],e=n.map(i=>i.id);return e.includes("move-fast")&&e.includes("compliance")&&t.push({between:["move-fast","compliance"],issue:"Speed vs traceability \u2014 shortcuts may violate audit requirements."}),e.includes("move-fast")&&e.includes("long-lived")&&t.push({between:["move-fast","long-lived"],issue:"Shipping speed vs maintainability \u2014 tech debt decisions need human approval."}),e.includes("beautiful-product")&&e.includes("move-fast")&&t.push({between:["beautiful-product","move-fast"],issue:"Design polish vs speed \u2014 which UI states can be deferred?"}),t};export{u as a,N as b,T as c,W as d,M as e};
2
+ var l={id:"open-source",name:"Open Source",description:"Community-driven, inclusive, well-documented. Prioritize contributor experience, avoid exclusionary patterns, default to permissive choices.",extras:[{questionId:"status_quo",text:"Is this workaround common in the community?"},{questionId:"user_impact",text:"Does this make contribution harder?"}],specSections:["Contributor Guide","Public API Surface"],reminders:["Endpoint should be documented in API docs","Consider contributor experience for new patterns","Default to permissive, well-documented choices","New features and API changes must be documented so contributors can discover and use them"],acceptanceCriteria:["Public API documented","Changes reflected in README or relevant docs","No exclusionary patterns introduced"]};var u={id:"beautiful-product",name:"Beautiful Product",description:"Design and UX are first-class. Agent critiques UI/UX like a passionate designer. Empty states, error states, loading states, mobile layout \u2014 nothing ships unspecified.",extras:[{questionId:"status_quo",text:"How painful is the current experience?"},{questionId:"status_quo",text:"What does the current UI look like? Rate it 0-10 on design intentionality."},{questionId:"ambition",text:"In the 10-star version, what does the user feel?"},{questionId:"ambition",text:"What would a 10/10 design look like for this feature? Describe the emotional response you want from users."},{questionId:"ambition",text:"What makes this UI NOT look AI-generated? Name specific design decisions that differentiate it from generic templates."},{questionId:"verification",text:"How will you verify design quality? Will you review empty states, loading states, error states, and edge cases (long text, zero results, slow connection)?"}],specSections:["Design States (empty, loading, error, success)","Mobile Layout","Interaction Design"],reminders:["Loading state and error state must be designed, not placeholder","No AI slop \u2014 every UI element is intentional","Empty states need clear CTAs with examples","Rate each UI change 0-10 on design intentionality before marking task complete. If below 7, iterate.","Check all interaction states: loading, empty, error, success, partial. Missing states are bugs, not TODOs.","Edge case check: what happens with 47-character names? Zero results? Network failure mid-action?","AI SLOP BLACKLIST \u2014 reject these patterns in any UI implementation: (1) Purple/violet gradient backgrounds (2) 3-column feature grid with icon-in-circle + bold title + 2-line description (3) Icons in colored circles as decoration (4) Everything centered (text-align: center on all elements) (5) Uniform bubbly border-radius on every element (6) Decorative blobs, floating circles, wavy SVG dividers (7) Emoji as design elements in headings or bullets (8) Colored left-border on cards (9) Generic hero copy ('Welcome to X', 'Unlock the power of...') (10) Cookie-cutter section rhythm (hero \u2192 3 features \u2192 testimonials \u2192 pricing). If the implementation matches any of these patterns, reject it and ask for a redesign with specific, intentional alternatives."],acceptanceCriteria:["All UI states designed (empty, loading, error, success)","Mobile layout considered","No placeholder or skeleton UI left unfinished","All UI states specified and implemented: loading, empty, error, success, partial","No placeholder text in shipped UI \u2014 every empty state has warmth, a primary action, and context","Design rated 7+ on intentionality by the spec author"]};var m={id:"long-lived",name:"Long-Lived",description:"Built to last. Stability, maintainability, and backward compatibility matter. Every shortcut needs justification. Favor boring technology.",extras:[{questionId:"reversibility",text:"Will this decision still be correct in 2 years?"},{questionId:"verification",text:"Is documentation (README, CHANGELOG, API docs) up to date with this change?"},{questionId:"scope_boundary",text:"What technical debt would this introduce?"}],specSections:["Migration & Deprecation","Backward Compatibility"],reminders:["Favor boring technology over shiny new tools","Every shortcut needs explicit justification","Consider maintenance burden for new dependencies","If this task changes public behavior, API, CLI flags, or configuration \u2014 update README and relevant docs in the SAME task. Documentation is not a follow-up."],acceptanceCriteria:["Backward compatibility preserved","Migration path documented if breaking","No unnecessary new dependencies","Documentation updated for any public-facing change"]};var p={id:"move-fast",name:"Move Fast",description:"Optimize for shipping speed. Acceptable trade-offs on polish. Good enough is good enough. Reduce ceremony.",extras:[{questionId:"scope_boundary",text:"Which polish items can be deferred to v2?"},{questionId:"ambition",text:"What is the minimum viable 5-star version?"}],specSections:["v1 vs v2 Scope"],reminders:["Good enough is good enough \u2014 ship it","Reduce ceremony, optimize for feedback speed","Mark polish items for v2 explicitly"],acceptanceCriteria:["Core functionality works","v2 items explicitly deferred"]};var h={id:"compliance",name:"Compliance",description:"Audit trails, access controls, data handling rules. Every change is traceable. Verification is mandatory, not optional.",extras:[{questionId:"reversibility",text:"Is the audit trail preserved on rollback?"},{questionId:"verification",text:"Is there an audit/traceability requirement?"}],specSections:["Audit Trail","Access Control","Data Handling"],reminders:["Every state change must be traceable","Verification is mandatory, not optional","Document data handling and retention policies"],acceptanceCriteria:["Audit trail added for state changes","Access control verified","Data handling documented"]};var f={id:"learning-project",name:"Learning Project",description:"Experimentation is the goal. Encourage trying new patterns, don't punish dead ends. Document learnings over polish.",extras:[{questionId:"ambition",text:"What do you want to learn from building this?"},{questionId:"scope_boundary",text:"What experiments are explicitly allowed?"}],specSections:["Learning Goals","Experiment Log"],reminders:["Document learnings, not just outcomes","Dead ends are acceptable \u2014 document why","Try new patterns freely, polish later"],acceptanceCriteria:["Learnings documented","Experiment outcomes recorded"]};var g=[l,u,m,p,h,f];var O=()=>Promise.resolve(g),_=(o,e)=>{let n=[];for(let i of o)for(let s of i.extras)s.questionId===e&&n.push(s);return n},$=(o,e)=>{let n=[];for(let i of o)for(let s of i.reminders){if(e!=null){let t=s.toLowerCase();if((t.includes("slop")||t.includes("ui element")||t.includes("design intentionality")||t.includes("interaction states")||t.includes("edge case check")||t.includes("loading state"))&&!e.involvesWebUI||(t.includes("api doc")||t.includes("endpoint should be"))&&!e.involvesPublicAPI)continue}n.push(`${i.id}: ${s}`)}return n},y=o=>{let e=o.toLowerCase();return e.includes("slop")||e.includes("ui element")||e.includes("design intentionality")||e.includes("interaction states")||e.includes("edge case check")||e.includes("loading state")||e.includes("api doc")||e.includes("endpoint should be")||e.includes("migration")||e.includes("rollback")},G=o=>{let e=[],n=[];for(let i of o)for(let s of i.reminders){let t=`${i.id}: ${s}`;y(s)?n.push(t):e.push(t)}return{tier1:e,tier2:n}},B=(o,e,n)=>{let i=e.includes(".")?`.${e.split(".").pop()}`:"",s=[".tsx",".jsx",".html",".css",".svelte",".vue"].includes(i),t=[".ts",".go",".py",".rs"].includes(i),c=[];for(let d of o)for(let a of d.reminders){if(!y(a))continue;let r=a.toLowerCase();(r.includes("slop")||r.includes("ui element")||r.includes("design intentionality")||r.includes("interaction states")||r.includes("edge case check")||r.includes("loading state"))&&!s||(r.includes("api doc")||r.includes("endpoint should be"))&&(!t||!n?.involvesPublicAPI)||c.push(`${d.id}: ${a}`)}return c},z=o=>{let e=[],n=o.map(i=>i.id);return n.includes("move-fast")&&n.includes("compliance")&&e.push({between:["move-fast","compliance"],issue:"Speed vs traceability \u2014 shortcuts may violate audit requirements."}),n.includes("move-fast")&&n.includes("long-lived")&&e.push({between:["move-fast","long-lived"],issue:"Shipping speed vs maintainability \u2014 tech debt decisions need human approval."}),n.includes("beautiful-product")&&n.includes("move-fast")&&e.push({between:["beautiful-product","move-fast"],issue:"Design polish vs speed \u2014 which UI states can be deferred?"}),e};export{g as a,O as b,_ as c,$ as d,G as e,B as f,z as g};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as E}from"./chunk-IIFFSCDJ.js";import{a as y}from"./chunk-LFNUSULJ.js";import{b as C}from"./chunk-JTSRGXS4.js";import{f as v}from"./chunk-P2MUEKFT.js";import{b as i,f as m,g as x,h as k,i as g}from"./chunk-YVN2NZL4.js";import{g as p}from"./chunk-FFWPJP7A.js";import{j as h}from"./chunk-6DBKPC2O.js";var l=C(),d=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),f=(e,o=[])=>{let s=e.split("/").filter(r=>r.length>0);for(let r of s){let t=r.startsWith(".")?r.slice(1):r;if(t.length===0)continue;let a=h.runtime.path.extname(t);if(a.length>0&&(t=t.slice(0,-a.length)),t.length!==0&&!o.includes(t)&&!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t))return!1}return!0},N=async(e={})=>{let{root:o=".",ignoreWords:s=[]}=e,r=await E(o),t=[];for(let a of r){let n=a.config.exports?.value;if(n!=null){if(typeof n=="string"){f(n,s)||t.push({packageName:a.name,exportPath:n,suggestion:d(n)});continue}if(n!==null&&typeof n=="object")for(let[u,c]of Object.entries(n))f(u,s)||t.push({packageName:a.name,exportPath:u,suggestion:d(u)}),typeof c=="string"&&!f(c,s)&&t.push({packageName:a.name,exportPath:c,suggestion:d(c)})}}return{isValid:t.length===0,violations:t,packagesChecked:r.length}},w=e=>v.fromPromise(()=>N(e)),b=e=>p.ok({root:"."}),A=e=>{if(p.isFail(e))return l.writeln(m("\u2717"),i(" "+String(e.error))),p.fail({exitCode:1});let{value:o}=e;if(l.writeln(g("\u2139"),i(` Checked ${o.packagesChecked} packages.`)),!o.isValid){l.writeln(m("\u2717"),i(` Found ${o.violations.length} naming violations:`));for(let s of o.violations)l.writeln(k("\u26A0"),i(" "+s.packageName)),l.writeln(g("\u2139"),i(` Export: ${s.exportPath}`)),l.writeln(g("\u2139"),i(` Suggestion: ${s.suggestion}`));return p.fail({exitCode:1})}return l.writeln(x("\u2713"),i(" All export names follow conventions.")),p.ok(void 0)},P=y.createTrigger({handler:w,adaptInput:b,adaptOutput:A}),W=async e=>await P({command:"validate-export-names",args:[],flags:{}});export{N as a,w as b,P as c,W as d};
2
+ import{a as E}from"./chunk-VXVW4UNH.js";import{a as y}from"./chunk-LFNUSULJ.js";import{b as C}from"./chunk-PZUDTTK4.js";import{f as v}from"./chunk-P2MUEKFT.js";import{b as i,f as m,g as x,h as k,i as g}from"./chunk-YVN2NZL4.js";import{g as p}from"./chunk-FFWPJP7A.js";import{j as h}from"./chunk-6DBKPC2O.js";var l=C(),d=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase(),f=(e,o=[])=>{let s=e.split("/").filter(r=>r.length>0);for(let r of s){let t=r.startsWith(".")?r.slice(1):r;if(t.length===0)continue;let a=h.runtime.path.extname(t);if(a.length>0&&(t=t.slice(0,-a.length)),t.length!==0&&!o.includes(t)&&!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(t))return!1}return!0},N=async(e={})=>{let{root:o=".",ignoreWords:s=[]}=e,r=await E(o),t=[];for(let a of r){let n=a.config.exports?.value;if(n!=null){if(typeof n=="string"){f(n,s)||t.push({packageName:a.name,exportPath:n,suggestion:d(n)});continue}if(n!==null&&typeof n=="object")for(let[u,c]of Object.entries(n))f(u,s)||t.push({packageName:a.name,exportPath:u,suggestion:d(u)}),typeof c=="string"&&!f(c,s)&&t.push({packageName:a.name,exportPath:c,suggestion:d(c)})}}return{isValid:t.length===0,violations:t,packagesChecked:r.length}},w=e=>v.fromPromise(()=>N(e)),b=e=>p.ok({root:"."}),A=e=>{if(p.isFail(e))return l.writeln(m("\u2717"),i(" "+String(e.error))),p.fail({exitCode:1});let{value:o}=e;if(l.writeln(g("\u2139"),i(` Checked ${o.packagesChecked} packages.`)),!o.isValid){l.writeln(m("\u2717"),i(` Found ${o.violations.length} naming violations:`));for(let s of o.violations)l.writeln(k("\u26A0"),i(" "+s.packageName)),l.writeln(g("\u2139"),i(` Export: ${s.exportPath}`)),l.writeln(g("\u2139"),i(` Suggestion: ${s.suggestion}`));return p.fail({exitCode:1})}return l.writeln(x("\u2713"),i(" All export names follow conventions.")),p.ok(void 0)},P=y.createTrigger({handler:w,adaptInput:b,adaptOutput:A}),W=async e=>await P({command:"validate-export-names",args:[],flags:{}});export{N as a,w as b,P as c,W as d};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{i as c}from"./chunk-6DBKPC2O.js";var l=".eser/learnings.jsonl",f=async(s,e)=>{let r=`${s}/${l}`,t=JSON.stringify(e)+`
3
+ `,o="";try{o=await c.fs.readTextFile(r)}catch{}await c.fs.writeTextFile(r,o+t)},y=async s=>{let e=`${s}/${l}`,r;try{r=await c.fs.readTextFile(e)}catch{return[]}return r.trim().split(`
4
+ `).filter(t=>t.length>0).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null)},m=async(s,e)=>{let r=await y(s);if(e<0||e>=r.length)return!1;let t=r.filter((a,i)=>i!==e),o=`${s}/${l}`,n=t.map(a=>JSON.stringify(a)).join(`
5
+ `)+(t.length>0?`
6
+ `:"");return await c.fs.writeTextFile(o,n),!0},u=async(s,e)=>{let r=await y(s);if(r.length===0)return[];let t=new Set(e.toLowerCase().split(/\s+/).filter(n=>n.length>3)),o=r.map(n=>{let a=n.text.toLowerCase().split(/\s+/),i=0;n.severity==="high"&&(i+=3),n.severity==="medium"&&(i+=1),n.type==="convention"&&(i+=2);for(let g of a)g.length>3&&t.has(g)&&(i+=2);return n.text.length<80&&(i+=1),{learning:n,score:i}});return o.sort((n,a)=>a.score-n.score),o.slice(0,5).map(n=>n.learning)},d=s=>s.map(e=>{let r=e.type==="mistake"?"\u26A0":e.type==="success"||e.type==="convention"?"\u2713":"\u26A0",t=e.type==="mistake"?"Past mistake":e.type==="success"?"Success":e.type==="convention"?"Convention":"Dependency";return`${r} ${t}: ${e.text} (from spec: ${e.spec})`});export{f as a,y as b,m as c,u as d,d as e};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as n}from"./chunk-3XJLLDR5.js";import{a as r}from"./chunk-HVQK35SO.js";var o=r({name:"validate-json",description:"Validate JSON syntax",canFix:!1,stacks:[],defaults:{},extensions:["json","jsonc"],checkFile(e,a,t){if(a===void 0)return[];if((t.exclude??[]).some(s=>e.path.includes(s)))return[];try{return e.name.endsWith(".jsonc")?n(a):JSON.parse(a),[]}catch(s){let i=s instanceof SyntaxError?s.message:"invalid JSON";return[{path:e.path,message:i}]}}}),p=o.run,f=o.validator,x=o.main;export{o as a,p as b,f as c,x as d};
2
+ import{a as n}from"./chunk-3XJLLDR5.js";import{a as r}from"./chunk-VJSHVZ7R.js";var o=r({name:"validate-json",description:"Validate JSON syntax",canFix:!1,stacks:[],defaults:{},extensions:["json","jsonc"],checkFile(e,a,t){if(a===void 0)return[];if((t.exclude??[]).some(s=>e.path.includes(s)))return[];try{return e.name.endsWith(".jsonc")?n(a):JSON.parse(a),[]}catch(s){let i=s instanceof SyntaxError?s.message:"invalid JSON";return[{path:e.path,message:i}]}}}),p=o.run,f=o.validator,x=o.main;export{o as a,p as b,f as c,x as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as b,b as w,d as F,f as D}from"./chunk-3D5TBTM3.js";import{a as C}from"./chunk-LFNUSULJ.js";import{b as h}from"./chunk-JTSRGXS4.js";import{f as R}from"./chunk-P2MUEKFT.js";import{b as l,f as m,g as k,h as A,i as g}from"./chunk-YVN2NZL4.js";import{g as d}from"./chunk-FFWPJP7A.js";var x=(e,r)=>{let o={},t=e.length;for(let s=0;s<t;s++){let n=e[s],a=r(n);o[a]===void 0?o[a]=[n]:o[a].push(n)}return o};var u=h(),P=(e,r)=>e===r?!0:typeof e!=typeof r||typeof e!="object"||e===null||r===null?!1:JSON.stringify(e)===JSON.stringify(r),O=(e,r)=>e[r],j=e=>e.startsWith("npm:@jsr/"),B=e=>{let r=e.slice(9),o=r.indexOf("__");if(o===-1)throw new Error(`Invalid npm JSR format: ${e}`);let t=r.slice(0,o),s=r.slice(o+2),n=s.indexOf("@"),a,p;return n===-1?(a=s,p=""):(a=s.slice(0,n),p=s.slice(n)),`jsr:@${t}/${a}${p}`},_=(e,r)=>j(r)?B(r):r.startsWith("npm:")?r:`npm:${e}@${r}`,S=e=>e==="workspace:*"||e.startsWith("workspace:"),M=(e,r,o)=>{let t=[],s=r.dependencies??{},n=r.devDependencies??{},a={...s,...n},p=o.imports??{};for(let[y,c]of Object.entries(a)){if(S(c))continue;let f=_(y,c),i=p[y];i===void 0?t.push({packageName:e,dependencyName:y,issue:"missing_in_deno",expected:f}):i!==f&&t.push({packageName:e,dependencyName:y,issue:"version_mismatch",expected:f,actual:i})}for(let[y,c]of Object.entries(p))a[y]===void 0&&t.push({packageName:e,dependencyName:y,issue:"missing_in_package",actual:p[y]});return t},G=async(e,r)=>{let o=[],t=[],s=await w({baseDir:e,includeFiles:[b.DenoJson,b.PackageJson]}),n=s._loadedFiles.find(c=>c.fileType===b.DenoJson),a=s._loadedFiles.find(c=>c.fileType===b.PackageJson);if(n===void 0||a===void 0)return{inconsistencies:[],dependencyInconsistencies:[]};let p=["name","version","exports"];for(let c of p){let f=O(n.content,c),i=O(a.content,c);f===void 0||i===void 0||P(f,i)||o.push({packageName:r,field:c,denoValue:f,packageValue:i})}let y=M(r,a.content,n.content);return t.push(...y),{inconsistencies:o,dependencyInconsistencies:t}},K=async(e={})=>{let{root:r=".",failFast:o=!1}=e,[t,s]=await D(r),n=[],a=[],p=0;for(let c of s){let f=F(c.config);try{let i=await G(f,c.name);if(p++,i.inconsistencies.length>0&&n.push(...i.inconsistencies),i.dependencyInconsistencies.length>0&&a.push(...i.dependencyInconsistencies),o&&(i.inconsistencies.length>0||i.dependencyInconsistencies.length>0))return{isConsistent:!1,inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}}catch{continue}}return{isConsistent:!(n.length>0||a.length>0),inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}},v=e=>typeof e=="string"?`"${e}"`:JSON.stringify(e,null,2),H=e=>{switch(e.issue){case"missing_in_deno":return`Missing in deno.json imports. Expected: ${e.expected}`;case"missing_in_package":return`Extra in deno.json imports (not in package.json): ${e.actual}`;case"version_mismatch":return`Version mismatch. Expected: ${e.expected}, Actual: ${e.actual}`}},L=e=>R.fromPromise(()=>K(e)),$=e=>d.ok({root:"."}),N=e=>{if(d.isFail(e))return u.writeln(m("\u2717"),l(" "+String(e.error))),d.fail({exitCode:1});let{value:r}=e;if(u.writeln(g("\u2139"),l(` Checked ${r.packagesChecked} packages.`)),!r.isConsistent){if(r.inconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.inconsistencies.length} field inconsistencies:`));let o=x(r.inconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.field} mismatch:`)),u.writeln(g("\u2139"),l(` deno.json: ${v(n.denoValue)}`)),u.writeln(g("\u2139"),l(` package.json: ${v(n.packageValue)}`))}}if(r.dependencyInconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.dependencyInconsistencies.length} dependency inconsistencies:`));let o=x(r.dependencyInconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.dependencyName}:`)),u.writeln(g("\u2139"),l(` ${H(n)}`))}}return d.fail({exitCode:1})}return u.writeln(k("\u2713"),l(" All package configs are consistent.")),d.ok(void 0)},J=C.createTrigger({handler:L,adaptInput:$,adaptOutput:N}),qn=async e=>await J({command:"validate-package-configs",args:[],flags:{}});export{K as a,L as b,J as c,qn as d};
2
+ import{a as b,b as w,d as F,f as D}from"./chunk-HTC2FO4I.js";import{a as C}from"./chunk-LFNUSULJ.js";import{b as h}from"./chunk-PZUDTTK4.js";import{f as R}from"./chunk-P2MUEKFT.js";import{b as l,f as m,g as k,h as A,i as g}from"./chunk-YVN2NZL4.js";import{g as d}from"./chunk-FFWPJP7A.js";var x=(e,r)=>{let o={},t=e.length;for(let s=0;s<t;s++){let n=e[s],a=r(n);o[a]===void 0?o[a]=[n]:o[a].push(n)}return o};var u=h(),P=(e,r)=>e===r?!0:typeof e!=typeof r||typeof e!="object"||e===null||r===null?!1:JSON.stringify(e)===JSON.stringify(r),O=(e,r)=>e[r],j=e=>e.startsWith("npm:@jsr/"),B=e=>{let r=e.slice(9),o=r.indexOf("__");if(o===-1)throw new Error(`Invalid npm JSR format: ${e}`);let t=r.slice(0,o),s=r.slice(o+2),n=s.indexOf("@"),a,p;return n===-1?(a=s,p=""):(a=s.slice(0,n),p=s.slice(n)),`jsr:@${t}/${a}${p}`},_=(e,r)=>j(r)?B(r):r.startsWith("npm:")?r:`npm:${e}@${r}`,S=e=>e==="workspace:*"||e.startsWith("workspace:"),M=(e,r,o)=>{let t=[],s=r.dependencies??{},n=r.devDependencies??{},a={...s,...n},p=o.imports??{};for(let[y,c]of Object.entries(a)){if(S(c))continue;let f=_(y,c),i=p[y];i===void 0?t.push({packageName:e,dependencyName:y,issue:"missing_in_deno",expected:f}):i!==f&&t.push({packageName:e,dependencyName:y,issue:"version_mismatch",expected:f,actual:i})}for(let[y,c]of Object.entries(p))a[y]===void 0&&t.push({packageName:e,dependencyName:y,issue:"missing_in_package",actual:p[y]});return t},G=async(e,r)=>{let o=[],t=[],s=await w({baseDir:e,includeFiles:[b.DenoJson,b.PackageJson]}),n=s._loadedFiles.find(c=>c.fileType===b.DenoJson),a=s._loadedFiles.find(c=>c.fileType===b.PackageJson);if(n===void 0||a===void 0)return{inconsistencies:[],dependencyInconsistencies:[]};let p=["name","version","exports"];for(let c of p){let f=O(n.content,c),i=O(a.content,c);f===void 0||i===void 0||P(f,i)||o.push({packageName:r,field:c,denoValue:f,packageValue:i})}let y=M(r,a.content,n.content);return t.push(...y),{inconsistencies:o,dependencyInconsistencies:t}},K=async(e={})=>{let{root:r=".",failFast:o=!1}=e,[t,s]=await D(r),n=[],a=[],p=0;for(let c of s){let f=F(c.config);try{let i=await G(f,c.name);if(p++,i.inconsistencies.length>0&&n.push(...i.inconsistencies),i.dependencyInconsistencies.length>0&&a.push(...i.dependencyInconsistencies),o&&(i.inconsistencies.length>0||i.dependencyInconsistencies.length>0))return{isConsistent:!1,inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}}catch{continue}}return{isConsistent:!(n.length>0||a.length>0),inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}},v=e=>typeof e=="string"?`"${e}"`:JSON.stringify(e,null,2),H=e=>{switch(e.issue){case"missing_in_deno":return`Missing in deno.json imports. Expected: ${e.expected}`;case"missing_in_package":return`Extra in deno.json imports (not in package.json): ${e.actual}`;case"version_mismatch":return`Version mismatch. Expected: ${e.expected}, Actual: ${e.actual}`}},L=e=>R.fromPromise(()=>K(e)),$=e=>d.ok({root:"."}),N=e=>{if(d.isFail(e))return u.writeln(m("\u2717"),l(" "+String(e.error))),d.fail({exitCode:1});let{value:r}=e;if(u.writeln(g("\u2139"),l(` Checked ${r.packagesChecked} packages.`)),!r.isConsistent){if(r.inconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.inconsistencies.length} field inconsistencies:`));let o=x(r.inconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.field} mismatch:`)),u.writeln(g("\u2139"),l(` deno.json: ${v(n.denoValue)}`)),u.writeln(g("\u2139"),l(` package.json: ${v(n.packageValue)}`))}}if(r.dependencyInconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.dependencyInconsistencies.length} dependency inconsistencies:`));let o=x(r.dependencyInconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.dependencyName}:`)),u.writeln(g("\u2139"),l(` ${H(n)}`))}}return d.fail({exitCode:1})}return u.writeln(k("\u2713"),l(" All package configs are consistent.")),d.ok(void 0)},J=C.createTrigger({handler:L,adaptInput:$,adaptOutput:N}),qn=async e=>await J({command:"validate-package-configs",args:[],flags:{}});export{K as a,L as b,J as c,qn as d};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{a as h,b as p,c as S,d as k,e as g,f as m,g as f}from"./chunk-YXETE4S3.js";import{a as c}from"./chunk-J7YTWK67.js";var y=class{capabilities=["text_generation","streaming"];provider="opencode";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=w(this.config,e,"json"),i=f(e.messages,e.system),s=p(this.binary,o,{signal:r,stdinData:i}),l=g(s.stderr),t=await k(s.stdout,this.modelId),u=await s.waitForExit(),a=await l,d=m("opencode",u.code,a);if(d!==null)throw d;return t}async*streamText(e,r){let o=w(this.config,e,"stream-json"),i=f(e.messages,e.system),s=p(this.binary,o,{signal:r,stdinData:i}),l=g(s.stderr);try{for await(let d of S(s.stdout)){let x=v(d);x!==null&&(yield x)}let t=await s.waitForExit(),u=await l,a=m("opencode",t.code,u);a!==null&&(yield{kind:"error",error:a})}catch(t){t instanceof c?yield{kind:"error",error:t}:yield{kind:"error",error:new c(t instanceof Error?t.message:String(t),{provider:"opencode",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},b={provider:"opencode",async createModel(n){let e=await h("opencode",n);return new y(e,n)}},w=(n,e,r)=>{let o=["--output-format",r];o.push("--model",n.model),e.maxTokens!==void 0&&o.push("--max-tokens",String(e.maxTokens));let i=n.properties?.args;return i!==void 0&&o.push(...i),o},v=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content_block_delta"||e.type==="assistant"){let r=e.delta?.text??e.message?.content?.[0]?.text;return r!==void 0?{kind:"content_delta",textDelta:r}:null}return e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown OpenCode error",{provider:"opencode"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as a,b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{a as k,b as p,c as h,e as m,f as u,g as f}from"./chunk-YXETE4S3.js";import{a as c}from"./chunk-J7YTWK67.js";var y=class{capabilities=["text_generation","streaming","tool_calling"];provider="claude-code";modelId;binary;config;constructor(e,n){this.binary=e,this.config=n,this.modelId=n.model}async generateText(e,n){let r=w(this.config,e,"json"),a=f(e.messages,e.system),o=p(this.binary,r,{signal:n,stdinData:a}),l=m(o.stderr),s=o.stdout.getReader(),i=[],d=new TextDecoder,g=await s.read();for(;g.done!==!0;)i.push(d.decode(g.value,{stream:!0})),g=await s.read();s.releaseLock();let T=await o.waitForExit(),_=await l,x=u("claude-code",T.code,_);if(x!==null)throw x;let S=i.join("");return v(S,this.modelId)}async*streamText(e,n){let r=this.config.properties?.streamFormat??"text",a=w(this.config,e,r),o=f(e.messages,e.system),l=p(this.binary,a,{signal:n,stdinData:o}),s=m(l.stderr);try{r==="stream-json"?yield*this.#t(l,s):yield*this.#e(l,s)}catch(i){i instanceof c?yield{kind:"error",error:i}:yield{kind:"error",error:new c(i instanceof Error?i.message:String(i),{provider:"claude-code",cause:i instanceof Error?i:void 0})}}}async*#e(e,n){let r=new TextDecoder,a=e.stdout.getReader(),o=await a.read();for(;o.done!==!0;){let d=r.decode(o.value,{stream:!0});d.length>0&&(yield{kind:"content_delta",textDelta:d}),o=await a.read()}a.releaseLock();let l=await e.waitForExit(),s=await n,i=u("claude-code",l.code,s);i!==null?yield{kind:"error",error:i}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}async*#t(e,n){for await(let l of h(e.stdout)){let s=E(l);s!==null&&(yield s)}let r=await e.waitForExit(),a=await n,o=u("claude-code",r.code,a);o!==null&&(yield{kind:"error",error:o})}close(){return Promise.resolve()}getRawClient(){return null}},P={provider:"claude-code",async createModel(t){let e=await k("claude",t);return new y(e,t)}},w=(t,e,n)=>{let r=[];n!=="text"&&r.push("--output-format",n),n==="stream-json"&&r.push("--verbose"),r.push("--model",t.model);let a=t.properties?.maxTurns;a!==void 0&&r.push("--max-turns",String(a));let o=t.properties?.allowedTools;if(o!==void 0)for(let s of o)r.push("--allowedTools",s);let l=t.properties?.args;return l!==void 0&&r.push(...l),r},v=(t,e)=>{try{let n=JSON.parse(t);return b(n,e)}catch{return{content:[{kind:"text",text:t.trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e}}},b=(t,e)=>{let n=[];if(t.result!==void 0)n.push({kind:"text",text:String(t.result)});else if(t.message?.content!==void 0)for(let r of t.message.content)r.type==="text"?n.push({kind:"text",text:r.text}):r.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:r.id??r.name,name:r.name,arguments:r.input??{}}});else typeof t=="string"&&n.push({kind:"text",text:t});return n.length===0&&n.push({kind:"text",text:JSON.stringify(t)}),{content:n,stopReason:t.stop_reason==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:t.usage?.input_tokens??0,outputTokens:t.usage?.output_tokens??0,totalTokens:(t.usage?.input_tokens??0)+(t.usage?.output_tokens??0)},modelId:e,rawResponse:t}},E=t=>{if(t===null||typeof t!="object")return null;let e=t;if(e.type==="assistant"){if(e.message?.content!==void 0){for(let n of e.message.content)if(n.type==="text")return{kind:"content_delta",textDelta:n.text}}return null}return e.type==="content_block_delta"?e.delta?.type==="text_delta"?{kind:"content_delta",textDelta:e.delta.text}:null:e.type==="result"?{kind:"message_done",stopReason:e.subtype==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown Claude Code error",{provider:"claude-code"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as a,P as b};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{i as c}from"./chunk-6DBKPC2O.js";var p=".eser/diagrams.json",g=i=>{let t=0;for(let s=0;s<i.length;s++){let a=i.charCodeAt(s);t=(t<<5)-t+a,t|=0}return Math.abs(t).toString(36)},u=i=>{let t=new Set,s=/(?:[\w@.-]+\/)*[\w@.-]+\.(?:ts|tsx|js|jsx|go|py|rs|md|json|yaml|yml)/g,a;for(;(a=s.exec(i))!==null;)t.add(a[0]);let r=/(?:@[\w-]+\/[\w-]+|[\w-]+\/[\w-]+)/g;for(;(a=r.exec(i))!==null;)a[0].includes(".")||t.add(a[0]);return[...t]},D=async(i,t)=>{let s=`${i}/${t}`,a;try{a=await c.fs.readTextFile(s)}catch{return[]}let r=[],e=a.split(`
3
+ `),n=new Date().toISOString(),o=!1,h=0,m="";for(let l=0;l<e.length;l++){let d=e[l];if(d.trim().startsWith("```mermaid")){o=!0,h=l+1,m="";continue}if(o&&d.trim()==="```"){o=!1,r.push({file:t,line:h,type:"mermaid",hash:g(m),referencedFiles:u(m),lastVerified:n});continue}if(o){m+=d+`
4
+ `;continue}if(/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯]/.test(d)&&e[l+1]&&/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯]/.test(e[l+1])){let f="",y=l;for(;y<e.length&&/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯┼├┤▶→←↓↑\|+\-]/.test(e[y]);)f+=e[y]+`
5
+ `,y++;f.length>20&&r.push({file:t,line:l+1,type:"ascii",hash:g(f),referencedFiles:u(f),lastVerified:n})}}return r},F=async i=>{let t=[],s=[],a=async(r,e)=>{try{for await(let n of c.fs.readDir(r))n.name.startsWith(".")||n.name==="node_modules"||(n.isFile&&n.name.endsWith(".md")&&s.push(e?`${e}/${n.name}`:n.name),n.isDirectory&&!n.name.startsWith(".")&&await a(`${r}/${n.name}`,e?`${e}/${n.name}`:n.name))}catch{}};await a(i,"");for(let r of s){let e=await D(i,r);t.push(...e)}try{for await(let r of c.fs.readDir(i))if(r.isFile&&r.name.endsWith(".puml")){let e=await c.fs.readTextFile(`${i}/${r.name}`);t.push({file:r.name,line:1,type:"plantuml",hash:g(e),referencedFiles:u(e),lastVerified:new Date().toISOString()})}}catch{}return t},w=async i=>{try{let t=await c.fs.readTextFile(`${i}/${p}`);return JSON.parse(t)}catch{return[]}},S=async(i,t)=>{await c.fs.writeTextFile(`${i}/${p}`,JSON.stringify(t,null,2)+`
6
+ `)},x=async(i,t,s)=>{let a=await w(i),r=!1,e=a.map(n=>n.file===t&&(s===void 0||n.line===s)?(r=!0,{...n,lastVerified:new Date().toISOString()}):n);return r&&await S(i,e),r},E=async(i,t)=>{let s=await w(i);if(s.length===0)return[];let a=new Set(t.map(e=>e.replace(/^\.\//,""))),r=[];for(let e of s)for(let n of e.referencedFiles)for(let o of a)if(o.includes(n)||n.includes(o)){r.push({file:e.file,line:e.line,type:e.type,reason:`${o} was modified but diagram references ${n}`});break}return r};export{F as a,w as b,S as c,x as d,E as e};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{b as _,c as X}from"./chunk-6F4PFXYY.js";import{a as W,d as F,e as M,g as H}from"./chunk-IUORSUN6.js";import{d as j,e as K}from"./chunk-KFVUFHJB.js";import{a as J}from"./chunk-NY4W44PI.js";import{c as z}from"./chunk-UEMWZOIU.js";import{i as Q}from"./chunk-6DBKPC2O.js";var O=e=>z(e),o=(e,t)=>O(t===null?e:`spec ${t} ${e}`),re="NEVER run git write commands (commit, add, push, checkout, stash, reset, merge, rebase, cherry-pick). Git is read-only for agents. The user controls git. You may read: git log, git diff, git status, git show, git blame.",se={hasAskUserTool:!0,optionPresentation:"tool",hasSubAgentDelegation:!0,subAgentMethod:"task"},oe=(e,t,n,s,r=se)=>{let c=e.execution.iteration>=t,m=r.hasAskUserTool?"Use AskUserQuestion for all decision points.":"Present options as a numbered list at every decision point.",a=[];n||a.push(re),a.push("Report progress honestly. Not done = 'not done'. Partial = 'partial: [works]/[doesn't]'. Untested = 'untested'. 4 of 6 = '4 of 6 done, 2 remaining'.",`Never skip steps or infer decisions. ${m} Recommend first, then ask. One noskills call per interaction \u2014 never batch-submit or backfill.`,"Display `roadmap` before other content. Display `gate` prominently.","NEVER suggest bypassing, skipping, or 'breaking out of' noskills. Discovery helps the user \u2014 it is not an obstacle. If scope changes: revise spec, reset and create new, or split.","NEVER ask permission to run the next noskills command. After spec new \u2192 run next immediately. After answering questions \u2192 run next. After approve \u2192 run next. After task completion \u2192 run next. The workflow is sequential \u2014 each step has one next step. Just run it.",'Discovery questions are adaptive. After each answer, generate 1-3 follow-up questions if the answer reveals ambiguity, risk, dependencies, or missing detail. Submit follow-ups via `noskills spec <name> followup <questionId> "question"`. Max 3 per question. Do NOT rush through discovery.',"Confidence scoring: every technical finding needs a confidence score (1-10). 9-10: verified (read code, ran test). 7-8: strong evidence. 5-6: reasonable inference. 3-4: guess. 1-2: speculation. State basis ('read X', 'inferred from Y'). If confidence < 5, prefix with '\u26A0 Unverified:'.");let v=s?.outOfScope??[],w=e.spec;switch(e.phase){case"IDLE":{let d=r.optionPresentation==="tool"?"Pass interactiveOptions DIRECTLY to AskUserQuestion options array (header max 12 chars). Use commandMap to resolve selections. For availableConcerns: AskUserQuestion with multiSelect:true, max 4 per question \u2014 split across questions if needed. Present ALL concerns.":"Present interactiveOptions as numbered list. Use commandMap to resolve selections. Present ALL availableConcerns as numbered list for multiselect.";return{rules:["If the user described a feature/bug/task, create a spec immediately: `noskills spec new \"description\"` \u2014 name is auto-generated. Do NOT present menus or ask 'What would you like to do?' unless the conversation has no prior context.",...a,d,"Encourage full context: 'Tell me what you want to build \u2014 one-liner, detailed requirements, meeting notes, anything.' Slug is auto-generated. Pass full text to `noskills spec new \"...\"`.","After spec new, ask: full discovery, quick discovery, or skip to spec draft. Never skip without asking.","Every task gets a spec. No exceptions. A one-liner fix, a config change, a 'simple' refactor \u2014 all get specs. The spec can be short but it must exist. 'Too simple for a spec' is the anti-pattern."],tone:"Welcoming. Present choices, then wait."}}case"DISCOVERY":{let d=r.hasAskUserTool?"Ask each question via AskUserQuestion. One question per call.":"Ask one question at a time as text.";return{modeOverride:"plan mode. DO NOT create, edit, or write any files. DO NOT run state-modifying commands. MAY read files and run read-only commands (cat, ls, grep, git log, git diff).",rules:[...a,`${d} Never answer questions yourself. Never submit answers without user confirmation. Pre-fill suggested answers from detailed descriptions \u2014 user must confirm each. With a fully formed plan, skip questions but MUST run premise challenge and alternatives.`,"DO NOT create, edit, or write any files.","DO NOT run shell commands that modify state.","You MAY read files and run read-only commands (cat, ls, grep, git log, git diff).","Pre-discovery: (1) pre-discovery codebase scan \u2014 read README, CLAUDE.md, design docs, last 20 commits, TODOs, existing specs, directory structure. Present a brief audit summary. (2) If `preDiscoveryResearch.required`, web-search every `extractedTerms` entry \u2014 report versions, API changes, deprecations. (3) Ask discovery mode: A) Explore scope B) Technical depth C) Validate my plan D) Ship fast. Adapt emphasis accordingly.","Before starting discovery questions, challenge the user's initial spec description against codebase findings. Flag: hidden complexity, conflicts with existing code, scope mismatch, overlapping modules. Ask clarifying follow-ups.","When asking questions, offer concrete options from codebase knowledge alongside the open-ended question (e.g., 'I see three scenarios: A)... B)... C)... D) Something else'). Push back on vague answers. Follow up on short answer with 'Can you be more specific?'","After answers, synthesize CURRENT STATE \u2192 THIS SPEC \u2192 6-MONTH IDEAL vision. Then: (1) expansion opportunities as numbered proposals with effort (S/M/L/XL), risk, completeness delta \u2014 options: Add/Defer/Skip. (2) Architectural decisions that BLOCK implementation \u2014 present with options, RECOMMENDATION, completeness scores. Unresolved = risk flag. (3) Error/rescue map: codepath | failure mode | handling. Flag CRITICAL GAPS as decisions.","Present DISCOVERY SUMMARY for confirmation: intent, scope, dream state, expansions, architectural decisions, error map. Ask for confirmation before generating spec. Submit all answers together in one `noskills next --answer` JSON call."],tone:"Curious interviewer with a stake in the answers. Comes PREPARED \u2014 read the codebase first. Challenge assumptions, think about architecture and failure modes."}}case"DISCOVERY_REVIEW":return{modeOverride:"You are in plan mode. Do not create, edit, or write any files. Present the discovery answers to the user for review and confirmation.",rules:[...a,"DO NOT create, edit, or write any files.","Present ALL discovery answers to the user clearly, one by one.",r.hasAskUserTool?"Use AskUserQuestion to ask: 'Are these answers correct, or would you like to revise any?'":"Ask the user: 'Are these answers correct, or would you like to revise any?' Present approval and revision as numbered options.","If the user approves, run the approve command.","If the user wants to revise, collect their corrections and submit them.","You MUST NOT approve on behalf of the user. The user must explicitly confirm.","If noskills output contains a splitProposal, present it to the user with the exact options shown. Do NOT split or merge specs on your own. Do NOT recommend one option over the other unless the user asks for your opinion. The user decides."],tone:"Careful reviewer. The user must confirm every answer."};case"SPEC_DRAFT":{let d=e.discovery.delegations??[],h=[];if(d.length>0){let l=d.filter(u=>u.status==="pending"),g=d.filter(u=>u.status==="answered"),b=d.map(u=>`- ${u.questionId}: delegated to ${u.delegatedTo} \u2014 ${u.status==="answered"?"ANSWERED \u2713":"PENDING"}`);h.push(`DELEGATION STATUS:
3
+ ${b.join(`
4
+ `)}${l.length>0?`
5
+ Approve BLOCKED \u2014 ${l.length} pending delegation(s).`:`
6
+ All ${g.length} delegation(s) answered. Approve is allowed.`}`)}return{modeOverride:"plan mode. DO NOT create, edit, or write any files. DO NOT run state-modifying commands. MAY read files and run read-only commands.",rules:[...a,...h,"DO NOT create, edit, or write any files.","Read the spec and present a summary to the user.","Flag any tasks that are too vague to execute.","Flag any missing acceptance criteria.","No placeholders in specs. If a task has 'TBD', 'TODO', 'to be determined', 'details to follow', or 'implement appropriate X' \u2014 fill in the detail or remove the task and add it as an open question.","Ask the user if they want to refine before approving.",r.hasAskUserTool?"When presenting classification options, use AskUserQuestion with multiSelect:true. Do NOT infer classification yourself.":"When presenting classification options, present them as a numbered list with multiselect (user picks multiple numbers). Do NOT infer classification yourself.","When generating or refining tasks, include a 'Files:' hint listing likely files to create/modify. Format: 'Files: `path/to/file.ts`, `path/to/other.ts`'. Hints, not constraints \u2014 helps sub-agents load right context.","If you identify issues in the spec (vague tasks, irrelevant sections, missing acceptance criteria), submit a refinement via: `"+o(`next --answer='{"refinement":"task-1: Add upload endpoint, task-2: Add validation middleware, task-3: Write integration tests"}'`,w)+"`. The spec will be updated and you can review again."],tone:"Thoughtful reviewer preparing to hand off to an implementer."}}case"SPEC_APPROVED":return{rules:[...a,"The spec is approved but execution has not started.","Do not start coding until the user triggers execution.","If the user wants changes, they must reset and re-spec.",r.hasAskUserTool?"Before starting execution, show the spec summary to the user and ask for final confirmation via AskUserQuestion.":"Before starting execution, show the spec summary to the user and ask for final confirmation. Present 'Start execution' and 'Not yet' as numbered options."],tone:"Patient. Wait for the go signal."};case"EXECUTING":{let d=o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,w),h,l,g="Verifier scope: (1) AC verification with evidence. (2) Plan alignment \u2014 does implementation match task description? Flag deviations. (3) Code quality \u2014 follows existing patterns? Flag style breaks, missing error handling. Categorize findings: CRITICAL (blocks completion), IMPORTANT (should fix), SUGGESTION (nice to have).";r.subAgentMethod==="task"?(h=`Spawn noskills-executor via Agent tool. Pass: task title, description, ACs, rules, scope constraints, concern reminders, file paths. Report via \`${d}\`.`,l=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. Never trust executor self-report alone. ${g}`):r.subAgentMethod==="spawn"?(h=`Use spawn_agent for noskills-executor. Pass: task, ACs, rules, scope, file paths. Use wait_agent to collect. Report via \`${d}\`.`,l=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. ${g}`):r.subAgentMethod==="fleet"?(h=`Use /fleet for parallel executors. Pass each: task, ACs, rules, scope, file paths. Report via \`${d}\`.`,l=`After fleet completes, run verification pass. ${g}`):r.subAgentMethod==="delegation"?(h=`Use Kiro agent delegation for noskills-executor. Pass: task, ACs, rules, scope, file paths. Report via \`${d}\`.`,l=`After executor completes, delegate to noskills-verifier with changed files + ACs + test commands. ${g}`):(h=`Execute tasks sequentially yourself. Verify (type-check + tests) after each. Report via \`${d}\`.`,l="");let b=r.subAgentMethod!=="none",u=b?`You are the orchestrator. NEVER edit files directly \u2014 delegate ALL edits to noskills-executor. ${h} On sub-agent failure, fall back to direct execution and note it in status.`:h,I=[...a,u,...l?[l]:[],"Do not explore beyond current task. Do not refactor outside scope. Do not add features, tests, or docs not in the spec. timebox context reads \u2014 the deliverable is working code.",...b?["Show a dispatch table: | Step | Agent | Files | Tasks | Est. |. Separate executor for implementation vs tests. Batch tightly-coupled files; parallelize independent modules."]:[],"Edit discipline: (1) Re-read file before editing. (2) Re-read after to confirm. (3) Files >500 LOC: read in chunks. (4) Run type-check + lint after edits \u2014 never mark AC passed if type-check fails. (5) If search returns few results, re-run narrower \u2014 assume truncation.",`On recurring patterns or corrections, ask: 'Permanent rule or just this task?' If permanent: \`${O('rule add "<description>"')}\`. Never write to \`.eser/rules/\` directly.`,"Before structural refactors on files >300 LOC, remove dead code first. Do NOT suggest pausing or stopping mid-spec \u2014 execute to completion. The user decides when to stop.","RATIONALIZATION ALERT: Never use 'should work now', 'looks correct', 'I'm confident', 'seems right', 'probably passes'. Run the command, read the output, report what happened. Evidence, not belief.","TDD: (1) Write test. (2) Run it \u2014 MUST fail. If it passes before implementation, the test is wrong. (3) Implement. (4) Run test \u2014 must pass. Skipping step 2 means the test is unverified.","Parallel vs serial sub-agents: PARALLEL when tasks touch different files with no shared state. SERIAL when tasks modify same files or depend on each other. When unsure, default to serial."];e.execution.lastVerification?.passed===!1&&I.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let f={rules:I,tone:"Direct. Orchestrate immediately \u2014 spawn sub-agents.",outOfScope:v.length>0?v:void 0};return c?{...f,urgency:`${e.execution.iteration}+ iterations \u2014 context degrading. Finish current task, recommend fresh session.`}:f}case"BLOCKED":return{rules:[...a,"Present the decision to the user exactly as described.","Do not suggest a preferred option unless the user asks for your opinion.","After the user decides, relay the answer immediately. Do not elaborate."],tone:"Brief. The user is making a decision, not having a discussion."};case"COMPLETED":return{rules:[...a,"Report the completion summary. Do not start new work.","If the user wants to continue, they start a new spec."],tone:"Concise. Celebrate briefly, then stop."};default:return{rules:[...a,`Run \`${o("next",w)}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},ie=5*60*1e3,ae=(e,t)=>{let n=e.spec,s;switch(e.phase){case"IDLE":s=`No active spec. Start one with: \`${O('spec new --name=<slug> "description"')}\``;break;case"DISCOVERY":s=`Discovery in progress for "${e.spec}". ${e.discovery.answers.length} questions answered so far.`;break;case"DISCOVERY_REVIEW":s=`Discovery answers ready for review. ${e.discovery.answers.length} answers collected. Waiting for user confirmation.`;break;case"SPEC_DRAFT":s=`Spec draft ready for review at ${e.specState.path}. Waiting for approval.`;break;case"SPEC_APPROVED":s=`Spec "${e.spec}" is approved. Waiting to start execution.`;break;case"EXECUTING":s=e.execution.lastProgress!==null?`Executing "${e.spec}", iteration ${e.execution.iteration}. Last progress: ${e.execution.lastProgress}. Continue with the current task.`:`Executing "${e.spec}", iteration ${e.execution.iteration}. Start the first task.`;break;case"BLOCKED":s=`Execution blocked: ${e.execution.lastProgress}. Ask the user to resolve.`;break;case"COMPLETED":s=`Spec "${e.spec}" completed in ${e.execution.iteration} iterations.`;break;default:s=`Run \`${o("next",n)}\` to get started.`}return{protocol:`Run \`${o('next --answer="..."',n)}\` to submit results and advance`,spec:e.spec,branch:e.branch,iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,activeConcerns:t.map(r=>r.id),resumeHint:s}},le=e=>{let t=e.spec;if(e.lastCalledAt===null)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase};let n=new Date(e.lastCalledAt).getTime();if(Date.now()-n>ie)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REVIEW \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${o("next",t)}\` for instructions. Submit results with \`${o('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},Z=[{key:"IDLE",label:"IDLE"},{key:"DISCOVERY",label:"DISCOVERY"},{key:"DISCOVERY_REVIEW",label:"REVIEW"},{key:"SPEC_DRAFT",label:"DRAFT"},{key:"SPEC_APPROVED",label:"APPROVED"},{key:"EXECUTING",label:"EXECUTING"},{key:"COMPLETED",label:"DONE"},{key:"IDLE_END",label:"IDLE"}],ce=e=>e==="BLOCKED"?Z.map(t=>t.key==="EXECUTING"?"[ EXECUTING (BLOCKED) ]":t.label).join(" \u2192 "):Z.map(t=>t.key==="IDLE"&&e==="IDLE"?"[ IDLE ]":t.key===e?`[ ${t.label} ]`:t.label).join(" \u2192 "),de=(e,t)=>{switch(e.phase){case"DISCOVERY_REVIEW":return{message:`${e.discovery.answers.length}/6 answers collected.`,action:"Type APPROVE to generate spec, or REVISE to correct answers.",phase:"DISCOVERY_REVIEW"};case"SPEC_APPROVED":return{message:`Spec approved. ${t?.tasks?.length??0} tasks ready.`,action:"Type START to begin execution.",phase:"SPEC_APPROVED"};default:return}},$e=async(e,t,n,s,r,c,m,a,v,w,d)=>{let h=ae(e,t),l=s?.maxIterationsBeforeRestart??15,g=s?.allowGit??!1,b=a??se,u=oe(e,l,g,r,b);if(e.phase==="EXECUTING"){let x=w??0,A=M(t).tier2.length,y=x+A;y>0&&(u={...u,tier2Summary:`${y} file-specific rules delivered via PreToolUse hook when editing matching files.`})}let I=le(e),f;switch(e.phase){case"IDLE":f=ee(t,W,n.length,m);break;case"DISCOVERY":f=await we(e,t,n,v,d);break;case"DISCOVERY_REVIEW":f=be(e,t);break;case"SPEC_DRAFT":f=ke(e);break;case"SPEC_APPROVED":f=xe(e);break;case"EXECUTING":f=Re(e,t,n,l,r,c);break;case"BLOCKED":f=Ie(e);break;case"COMPLETED":f=await Ae(e,d);break;default:f=ee(t,W,n.length,m)}let L=ce(e.phase),S=de(e,r),E={...f,meta:h,behavioral:u,roadmap:L};S!==void 0&&(E={...E,gate:S}),I!==void 0&&(E={...E,protocolGuide:I});let p=ue(e,t,m);if(p.length>0){let x=p.map(({label:T,description:R})=>({label:T,description:R})),A={};for(let T of p)A[T.label]=T.command;let y=b.optionPresentation==="tool"?"AskUserQuestion":"prose-numbered-list",C=b.optionPresentation==="tool"?"Use AskUserQuestion tool to present these options. Do NOT use prose.":"Present options as a numbered list. Ask user to pick a number.";E={...E,interactiveOptions:x,commandMap:A,toolHint:y,toolHintInstruction:C}}return E},ue=(e,t,n)=>{let s=e.spec;switch(e.phase){case"IDLE":{let r=[],m=(n?.existingSpecs??[]).filter(a=>a.phase!=="COMPLETED");t.length===0&&r.push({label:"Add concerns (Recommended)",description:"Shape how discovery and specs work by adding project concerns",command:O("concern add <id> [<id2> ...]")}),r.push({label:"Start a new spec",description:"Tell me what you want to build \u2014 a one-liner, detailed requirements, meeting notes, anything",command:O('spec new "description"')});for(let a of m.slice(0,2))r.push({label:`Continue: ${a.name} (${a.phase})`,description:a.detail??`Iteration ${a.iteration}`,command:o("next",a.name)});return t.length>0&&r.push({label:"Edit concerns",description:`Currently: ${t.map(a=>a.id).join(", ")}`,command:O("concern list")}),r.slice(0,4)}case"DISCOVERY_REVIEW":return e.discovery.approved?[{label:"Keep as one spec",description:"All work in a single spec",command:o('next --answer="keep"',s)},{label:"Split into separate specs",description:"Create one spec per independent area",command:o('next --answer="split"',s)}]:[{label:"Approve all answers",description:"Answers look correct \u2014 generate the spec",command:o('next --answer="approve"',s)},{label:"Revise answers",description:"Correct one or more discovery answers",command:o(`next --answer='{"revise":{...}}'`,s)}];case"SPEC_DRAFT":return[{label:"Approve spec",description:"Review looks good \u2014 approve and move to execution",command:o("approve",s)},{label:"Refine spec",description:"Submit refinements to improve tasks or sections",command:o(`next --answer='{"refinement":"..."}'`,s)},{label:"Save for later",description:"Keep the draft as-is. Others can review, add ACs, notes, or tasks. Come back anytime to approve.",command:o('next --answer="save"',s)},{label:"Start over",description:"Reset the spec and start fresh",command:o("reset",s)}];case"SPEC_APPROVED":return[{label:"Start execution",description:"Begin implementing the tasks",command:o('next --answer="start"',s)},{label:"Save for later",description:"Spec is approved but don't start execution yet. Others can still add ACs or notes.",command:o('next --answer="save"',s)}];case"EXECUTING":return[];case"BLOCKED":return[{label:"Resolve block",description:"Provide a resolution to unblock execution",command:o('next --answer="resolution"',s)},{label:"Reset spec",description:"Abandon this spec and start over",command:o("reset",s)}];case"COMPLETED":return[{label:"New spec",description:"Start a new feature spec",command:O('spec new --name=<slug> "description"')},{label:"Reopen spec",description:"Reopen this spec for revision",command:o("reopen",s)},{label:"Check status",description:"Review completed spec summary",command:O("status")}];default:return[]}},pe="noskills is a state-machine orchestrator that acts as a scrum master for both you and your agent \u2014 keeping work focused, decisions in your hands, and tokens efficient.",ee=(e,t,n,s)=>({phase:"IDLE",instruction:'No active spec. If the user described what they want, run `noskills spec new "description"` immediately \u2014 name is auto-generated. Present ALL available concerns (split across multiple calls if needed).',welcome:pe,existingSpecs:s?.existingSpecs??[],availableConcerns:t.map(r=>({id:r.id,description:r.description})),activeConcerns:e.map(r=>r.id),activeRulesCount:s?.rulesCount??n,behavioralNote:"These options are fallbacks. If the user already described what they want, act on it directly without presenting these options.",hint:e.length===0?"No concerns active. Consider adding concerns first \u2014 they shape discovery questions and specs.":void 0}),me=/\b(Node\.?js|Deno|Bun|Go|Rust|Python|Ruby|Java|Kotlin|Swift|PHP|React|Vue|Angular|Svelte|Next\.?js|Nuxt|Remix|Astro|SolidJS|Qwik|TypeScript|Webpack|Vite|esbuild|Rollup|Terraform|Docker|Kubernetes|PostgreSQL|MySQL|Redis|MongoDB|SQLite|Prisma|Drizzle|gRPC|GraphQL|tRPC)\s+v?(\d+(?:\.\d+)?(?:\.\d+)?\+?)\b/gi,he=e=>{if(e===null||e.length===0)return[];let t=[],n,s=new RegExp(me.source,"gi");for(;(n=s.exec(e))!==null;)t.push(`${n[1]} ${n[2]}`);return t},te=e=>{let t=he(e);if(t.length!==0)return{required:!0,instruction:"Before asking discovery questions, research the current state of all platforms, runtimes, libraries, and APIs mentioned in the spec description. Use web search and Context7 MCP if available. Report findings as a pre-discovery brief to the user. Do NOT assume your training data is current \u2014 versions change, APIs get added, features get deprecated.",extractedTerms:t}},ye=50*1024,ne=async e=>{if(e!==null)try{let t=await Q.fs.readTextFile(e);return t.length>ye?void 0:{provided:!0,content:t,instruction:"A plan document was provided. Read it carefully, extract relevant information for each discovery question, and present pre-filled answers for user review. Do NOT skip any question \u2014 present your extraction and let the user confirm, correct, or expand. IMPORTANT: When extracting answers from the plan, mark each extraction as [STATED] (directly written in the plan) or [INFERRED] (your interpretation). Present extractions individually for confirmation."}}catch{return}},ge=e=>{let t=[],n=e.toLowerCase(),s=["websocket","graphql","grpc","redis","postgres","mongodb","kafka","rabbitmq","docker","kubernetes","lambda","s3"];for(let r of s)n.includes(r)&&t.push(`Answer mentions ${r} \u2014 consider: error handling, versioning, fallback strategy`);return(n.includes("should work")||n.includes("standard approach")||n.includes("probably")||n.includes("i think")||n.includes("not sure"))&&t.push("Answer is vague \u2014 ask for specifics"),(n.includes("and also")||n.includes("we might")||n.includes("could also")||n.includes("maybe we should"))&&t.push("Scope expansion signal \u2014 clarify if in scope or deferred"),(n.includes("tricky")||n.includes("complicated")||n.includes("risky")||n.includes("not sure about"))&&t.push("Risk signal \u2014 dig deeper into what makes it risky"),(n.includes("depends on")||n.includes("after")||n.includes("blocked by")||n.includes("waiting for"))&&t.push("Dependency detected \u2014 clarify what happens if dependency isn't ready"),(n.includes("real-time")||n.includes("scalab")||n.includes("performance")||n.includes("latency")||n.includes("concurrent"))&&t.push("Performance/scale mention \u2014 ask about limits, degradation, monitoring"),t},fe=e=>{switch(e){case"full":return["Ask each discovery question as written. Push for specific, concrete answers.","If the answer is vague, ask follow-up questions before accepting."];case"validate":return["The user has a plan. Your job is to challenge it, not explore it.","For each question, identify assumptions and ask: 'What would prove this wrong?'","If the description already answers a question, present your understanding and ask to confirm.","When pre-filling answers from a rich description, plan, or prior discussion, DISTINGUISH between what the user EXPLICITLY STATED and what you INFERRED. Format each pre-filled item as: '[STATED] GPU skinning in all 3 renderers \u2014 you said this during technical discussion' or '[INFERRED] tangent space is 10-star scope \u2014 I assumed this based on complexity'. The user confirms stated items and corrects inferred items.","Present pre-filled answers ONE ITEM AT A TIME for confirmation, not as a completed block. The user's job is to correct your inferences, not rubber-stamp your summary. If you pre-fill 5 items and 2 are wrong, the user must be able to catch them individually."];case"technical-depth":return["Focus on architecture, data flow, performance, and integration points.","Before each question, scan the codebase for related implementations.","Ask: 'How does this interact with [existing system]?' for each integration point."];case"ship-fast":return["Focus on minimum viable scope.","For each question, also ask: 'What can we defer to a follow-up?'","Push for the smallest version that delivers value."];case"explore":return["Think bigger. What's the 10x version?","For each question, ask about adjacent opportunities.","Suggest possibilities the user might not have considered."]}},ve=(e,t)=>{let n=new Map;for(let s of e){let r="user"in s?s.user:"Unknown User";t!==void 0&&r===t.name||n.set(r,(n.get(r)??0)+1)}return[...n.entries()].map(([s,r])=>({name:s,contributions:`${r} answer${r>1?"s":""}`}))},we=async(e,t,n,s,r)=>{let c=e.spec,m=_(t),a=e.discovery.answers.length,v=X(e.discovery.answers),w=e.discovery.audience==="agent",d=ve(e.discovery.answers,s),h=(e.specNotes??[]).filter(i=>!i.text.startsWith("[TASK] ")).map(i=>({text:i.text,user:i.user})),l={...s!==void 0?{currentUser:s}:{},...d.length>0?{previousContributors:d}:{},...h.length>0?{notes:h}:{}},g=e.specDescription!==null&&e.specDescription.length>0,b=e.discovery.planPath!==null,u=e.discovery.mode;if(u===void 0&&g&&a===0&&!b){let k={phase:"DISCOVERY",instruction:"Before starting discovery, select the discovery mode that best fits this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:F(t)},transition:{onComplete:o('next --answer="<mode>"',c)},modeSelection:{required:!0,instruction:"Select the discovery mode.",options:[{id:"full",label:"Full discovery",description:"Standard 6 questions with all concern extras. Default for new features."},{id:"validate",label:"Validate my plan",description:"I already know what I want \u2014 challenge my assumptions, find gaps."},{id:"technical-depth",label:"Technical depth",description:"Focus on architecture, data flow, performance, integration points."},{id:"ship-fast",label:"Ship fast",description:"Minimum viable scope. What can we defer? What's the MVP?"},{id:"explore",label:"Explore scope",description:"Think bigger. 10x version? Adjacent opportunities? What are we missing?"}]}};if(r!==void 0)try{let P=await j(r,e.specDescription??"");P.length>0&&(k={...k,previousLearnings:K(P)})}catch{}return s!==void 0?{...k,currentUser:s}:k}let I=e.discovery.premisesCompleted===!0;if(u!==void 0&&!I&&!v){let i={phase:"DISCOVERY",instruction:"Before asking discovery questions, challenge the premises of this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:F(t)},transition:{onComplete:o(`next --answer='{"premises":[...]}'`,c)},premiseChallenge:{required:!0,instruction:"Read the spec description"+(e.discovery.planPath!==null?" and the plan document":"")+'. Identify 2-4 premises the spec assumes. Present each premise and ask the user to agree or disagree. Submit as JSON: {"premises":[{"text":"...","agreed":true/false,"revision":"..."}]}',prompts:["Is this the right problem to solve? Could a different framing yield a simpler solution?","What happens if we do nothing? Is this a real pain point or a hypothetical one?","What existing code already partially solves this? Can we build on it instead?"]}};return s!==void 0?{...i,currentUser:s}:i}let f=u!==void 0?fe(u):[],L=[...n,...f],S=e.specDescription??"",E=S.length>500,p=e.discovery.premises??[],x=p.filter(i=>i.agreed).map(i=>i.text),A=p.filter(i=>!i.agreed&&i.revision!==void 0).map(i=>({original:i.text,revision:i.revision}));if(v){let i=e.revisitHistory??[],k=i.length>0?i[i.length-1]:null,P={phase:"DISCOVERY",instruction:k!==null?"This spec was revisited from EXECUTING. All previous answers are preserved. Review and approve, or revise answers before regenerating the spec.":`All discovery questions answered. Run: \`${o("approve",c)}\``,questions:[],answeredCount:a,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",c)},...l};if(k!=null){let $=k;return{...P,revisited:!0,revisitReason:$.reason,previousProgress:{completedTasks:[...$.completedTasks],totalTasks:$.completedTasks.length}}}return P}if(w){let i=e.discovery.currentQuestion,k=m[i];if(k===void 0)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${o("approve",c)}\``,questions:[],answeredCount:a,context:{rules:n,concernReminders:[]},transition:{onComplete:o("approve",c)},...l};let P={id:k.id,text:k.text,concerns:[...k.concerns],extras:k.extras.map(N=>N.text)},$={phase:"DISCOVERY",instruction:`Ask this question to the user using AskUserQuestion. Submit the answer with: \`${o('next --agent --answer="<answer>"',c)}\``,questions:[P],answeredCount:a,currentQuestion:i,totalQuestions:m.length,context:{rules:L,concernReminders:F(t)},transition:{onComplete:`${o('next --agent --answer="<answer>"',c)}`},...l},D=$;if((x.length>0||A.length>0)&&(D={...D,...x.length>0?{agreedPremises:x}:{},...A.length>0?{revisedPremises:A}:{}}),i===0){let N=te(e.specDescription??null);N!==void 0&&(D={...D,preDiscoveryResearch:N});let B=await ne(e.discovery.planPath??null);B!==void 0&&(D={...D,planContext:B}),E&&B===void 0&&(D={...D,richDescription:{provided:!0,length:S.length,content:S,instruction:"The user provided a detailed description. For each question, extract relevant info and present as a pre-filled suggestion. IMPORTANT: When extracting answers from the description, mark each extraction as [STATED] (directly written by the user) or [INFERRED] (your interpretation). Present extractions individually for confirmation."}})}let Y=(e.discovery.followUps??[]).filter(N=>N.status==="pending");Y.length>0&&(D={...D,pendingFollowUps:Y});let G=e.discovery.answers.length>0?e.discovery.answers[e.discovery.answers.length-1]:void 0;if(G!==void 0){let N=ge(G.answer);N.length>0&&(D={...D,followUpHints:N})}return D!==$?D:$}let y=new Set(e.discovery.answers.map(i=>i.questionId)),C=m.filter(i=>!y.has(i.id)).map(i=>({id:i.id,text:i.text,concerns:[...i.concerns],extras:i.extras.map(k=>k.text)})),T=e.revisitHistory??[],R=T.length>0?T[T.length-1]:null,q=R!==null,U={phase:"DISCOVERY",instruction:q?"This spec was revisited from EXECUTING. Previous discovery answers are preserved \u2014 review and revise as needed, or approve to regenerate tasks.":"Conduct a thorough discovery conversation. FIRST: perform a pre-discovery codebase scan (README, CLAUDE.md, recent git log, TODOs, directory structure) and present a brief audit summary. THEN: challenge the user's spec description against your findings. THEN: ask the discovery questions one at a time, offering concrete options based on codebase knowledge. AFTER questions: present a dream state table (current \u2192 this spec \u2192 future), scored expansion proposals, architectural decisions, and an error/rescue map. FINALLY: present a complete discovery synthesis for user confirmation before submitting answers as a JSON object.",questions:C,answeredCount:a,context:{rules:L,concernReminders:F(t)},transition:{onComplete:`${o(`next --answer='{"status_quo":"...","ambition":"...",...}'`,c)}`},...l,...x.length>0?{agreedPremises:x}:{},...A.length>0?{revisedPremises:A}:{}};if(q&&R!==void 0)return{...U,revisited:!0,revisitReason:R.reason,previousProgress:{completedTasks:[...R.completedTasks],totalTasks:R.completedTasks.length}};if(a===0){let i=U,k=te(e.specDescription??null);k!==void 0&&(i={...i,preDiscoveryResearch:k});let P=await ne(e.discovery.planPath??null);if(P!==void 0&&(i={...i,planContext:P}),E&&P===void 0&&(i={...i,richDescription:{provided:!0,length:S.length,content:S,instruction:"The user provided a detailed description. For each question, extract relevant info and present as a pre-filled suggestion."}}),i!==U)return i}return U},be=(e,t)=>{let n=e.spec,s=_(t),r=e.discovery.answers.map(a=>{let v=s.find(w=>w.id===a.questionId);return{questionId:a.questionId,question:v?.text??a.questionId,answer:a.answer}}),c=J(e.discovery.answers);if(e.discovery.approved&&c.detected)return{phase:"DISCOVERY_REVIEW",instruction:"Discovery answers are approved. noskills detected multiple independent work areas in this spec. Present the split proposal to the user and let them decide whether to keep as one spec or split into separate specs.",answers:r,transition:{onApprove:o('next --answer="keep"',n),onRevise:o(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:c};let m=e.discovery.alternativesPresented===!0;return e.discovery.approved&&!m?{phase:"DISCOVERY_REVIEW",subPhase:"alternatives",instruction:"Based on discovery answers, propose 2-3 distinct implementation approaches. Present each with name, summary, effort (S/M/L/XL), risk (Low/Med/High), pros, and cons. Ask the user to choose one, or skip.",answers:r,transition:{onApprove:o(`next --answer='{"approach":"A","name":"...","summary":"...","effort":"M","risk":"Low"}'`,n),onRevise:o('next --answer="skip"',n)},alternatives:{required:!0,instruction:"Generate 2-3 approaches from discovery answers and codebase. Present via AskUserQuestion.",format:{fields:["id","name","summary","effort","risk","pros","cons"]}}}:{phase:"DISCOVERY_REVIEW",instruction:c.detected?"Present ALL discovery answers to the user for review. ALSO present the split proposal \u2014 noskills detected multiple independent areas.":"Present ALL discovery answers to the user for review. The user must confirm or correct each answer before the spec can be generated. Use AskUserQuestion to ask for confirmation.",answers:r,transition:{onApprove:o('next --answer="approve"',n),onRevise:o(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:c.detected?c:void 0}},ke=e=>{let t=e.spec;return e.classification===null?{phase:"SPEC_DRAFT",instruction:"Before generating the spec, classify what this spec involves. Ask the user to select all that apply.",specPath:e.specState.path??"",transition:{onApprove:`${o(`next --answer='{"involvesWebUI":false,"involvesCLI":false,"involvesPublicAPI":false,"involvesMigration":false,"involvesDataHandling":false}'`,t)}`},classificationRequired:!0,classificationPrompt:{options:[{id:"involvesWebUI",label:"Web/Mobile UI \u2014 layouts, responsive design, visual components"},{id:"involvesCLI",label:"CLI/Terminal UI \u2014 spinners, progress bars, interactive prompts"},{id:"involvesPublicAPI",label:"Public API changes"},{id:"involvesMigration",label:"Data migration or schema changes"},{id:"involvesDataHandling",label:"Data handling or privacy"}],instruction:"Select all that apply. Submit as JSON: `"+o(`next --answer='{"involvesWebUI":true,"involvesCLI":false,"involvesPublicAPI":false,...}'`,t)+"`. If none apply, answer with: `"+o('next --answer="none"',t)+"`"}}:{phase:"SPEC_DRAFT",instruction:"Spec draft is ready. Self-review before presenting to user.",specPath:e.specState.path??"",transition:{onApprove:o("approve",t)},selfReview:{required:!0,checks:["Placeholder scan: no TBD, TODO, vague requirements","Consistency: tasks match discovery, ACs match tasks","Scope: single spec, not multiple independent subsystems","Ambiguity: every AC has one interpretation"],instruction:"Review draft against these checks. Fix issues inline before presenting to user. Do not ask user to fix \u2014 fix it yourself."}}},xe=e=>{let t=e.spec;return{phase:"SPEC_APPROVED",instruction:"Spec is approved and ready. When the user is ready to start, begin execution.",specPath:e.specState.path??"",transition:{onStart:`${o('next --answer="start"',t)}`}}},Ee=(e,t)=>{if(t===null)return!1;let n=e.toLowerCase();return n.includes("mobile")||n.includes("layout")||n.includes("interaction design")?t.involvesWebUI:n.includes("ui state")||n.includes("skeleton ui")?t.involvesWebUI||t.involvesCLI:n.includes("readme")||n.includes("documentation updated")||n.includes("reflected in")&&n.includes("docs")?!0:n.includes("api doc")||n.includes("public api")?t.involvesPublicAPI:n.includes("migration")||n.includes("backward compat")||n.includes("deprecat")?t.involvesMigration:n.includes("audit trail")||n.includes("access control")||n.includes("data handling")||n.includes("data retention")?t.involvesDataHandling:!0},De=(e,t,n,s,r,c,m,a)=>{let v=[],w=new Set(a??[]),d=0,h=()=>`ac-${++d}`;if(s!==null)for(let l of s.items)w.has(l.id)||v.push({id:l.id,text:`[DEBT from iteration ${l.since}] ${l.text}`});if(t&&v.push({id:h(),text:`[FAILED] Tests \u2014 fix this first: ${n.slice(0,200)}`}),c!=null)for(let l of c.verification){let g=h();w.has(g)||v.push({id:g,text:l})}for(let l of e)if(l.acceptanceCriteria!==void 0&&l.acceptanceCriteria.length>0)for(let g of l.acceptanceCriteria){if(!Ee(g,r))continue;let b=h();w.has(b)||v.push({id:b,text:`(${l.id}) ${g}`})}if(m!==void 0)for(let l of m){let g=h();w.has(g)||v.push({id:g,text:`(folder: ${l.folder}) ${l.rule}`})}return v.push({id:"mandatory-tests",text:"Tests written and passing for all new and changed behavior"}),v.push({id:"mandatory-docs",text:"Documentation updated for all public-facing changes"}),v},Re=(e,t,n,s,r,c)=>{let m=e.spec,a=H(t),v=e.execution.iteration>=s,w=e.execution.lastVerification?.passed===!1,d=e.execution.lastVerification?.output??"",h=r?.tasks??[],l=e.execution.completedTasks??[],g=new Set(l),b=h.find(y=>!g.has(y.id))??null,u=b!==null?{id:b.id,title:b.title,totalTasks:h.length,completedTasks:l.length,...b.files!==void 0&&b.files.length>0?{files:b.files}:{}}:void 0;if(e.execution.awaitingStatusReport){let y=De(t,w,d,e.execution.debt,e.classification,r,c,e.execution.naItems),C=[];try{let q=JSON.parse(e.execution.lastProgress??"");Array.isArray(q.completed)&&(C=q.completed.filter(V=>typeof V=="string"&&V.startsWith("task-")))}catch{}let R={phase:"EXECUTING",instruction:C.length>=2?`${C.length} tasks reported complete. Report status against ALL relevant acceptance criteria.`:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:n,concernReminders:M(t).tier1},transition:{onComplete:`${o(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,m)}`,onBlocked:`${o('block "reason"',m)}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:y,reportFormat:{completed:"list item IDs you finished (e.g., ['debt-1', 'ac-3']) with evidence",remaining:"list item IDs not yet done",blocked:"list item IDs that need a decision from the user",na:"(optional) list item IDs that are not applicable to this task \u2014 they will be removed from future criteria",newIssues:"(optional) list NEW issues discovered during implementation \u2014 free text, will be assigned debt IDs automatically"}}};return C.length>=2&&(R={...R,batchTasks:C}),w&&(R={...R,verificationFailed:!0,verificationOutput:d.slice(0,2e3)}),R}let I=(e.execution.lastProgress??"").includes("Task not accepted"),f=e.execution.debt?.items??[],L=e.execution.debt?.unaddressedIterations??0,S=u!==void 0?`Execute task ${u.id}: ${u.title} (${u.completedTasks}/${u.totalTasks} completed)`:"All tasks completed. Run `"+o("done",m)+"` to finish.",E;if(w)E="Verification FAILED. Fix the failing tests before continuing.";else if(I&&f.length>0){let y=L>=3?` These items have been outstanding for ${L} iterations.`:"";E=`Task not accepted \u2014 ${f.length} remaining item(s) must be addressed before this task can be completed.${y} Address them, then submit a new status report.`}else E=S;let p={phase:"EXECUTING",instruction:E,task:u,context:{rules:n,concernReminders:M(t).tier1},transition:{onComplete:`${o('next --answer="..."',m)}`,onBlocked:`${o('block "reason"',m)}`,iteration:e.execution.iteration}};if(I&&f.length>0&&(p={...p,taskRejected:!0,rejectionReason:`${f.length} remaining item(s) must be addressed.`,rejectionRemaining:f.map(y=>y.text)}),e.execution.debt!==null&&e.execution.debt.items.length>0){let y=e.execution.debt.unaddressedIterations??0,C=y>=3?`URGENT: These items have been unaddressed for ${y} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";p={...p,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:C}}}if(w){let y=d.slice(0,2e3);p={...p,verificationFailed:!0,verificationOutput:y}}a.length>0&&(p={...p,concernTensions:a}),v&&(p={...p,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${o("next",m)}\` to resume - your progress is saved.`});let x=[...e.decisions].reverse().find(y=>!y.promoted);return x!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(p={...p,promotePrompt:{decisionId:x.id,question:x.question,choice:x.choice,prompt:`You just resolved a decision: "${x.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${O(`rule add "${x.choice}"`)}\``}}),e.execution.iteration===0&&!w&&!I&&(p={...p,preExecutionReview:{instruction:"Re-read spec before starting. Flag: missing info that will block mid-execution, wrong task order, unclear ACs. Better to catch now than mid-execution."}}),t.some(y=>y.id==="beautiful-product")&&(p={...p,designChecklist:{required:!0,instruction:"Before completing any UI task, rate your implementation 0-10 on these dimensions and include the ratings in your AC report:",dimensions:[{id:"hierarchy",label:"Information hierarchy \u2014 what does the user see first, second, third?"},{id:"states",label:"Interaction states \u2014 loading, empty, error, success all specified?"},{id:"edge-cases",label:"Edge cases \u2014 long text, zero results, slow connection handled?"},{id:"intentionality",label:"Overall intentionality \u2014 does this feel designed or generated?"}]}}),p},Ie=e=>{let t=e.spec;return{phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:e.execution.lastProgress??"Unknown",transition:{onResolved:`${o('next --answer="..."',t)}`}}},Ae=async(e,t)=>{let n={phase:"COMPLETED",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length,completionReason:e.completionReason,completionNote:e.completionNote},learningPrompt:{instruction:`Record learnings. For each insight, decide: one-time learning or permanent rule? One-time ("assumed X, was Y") \u2192 \`learn "text"\`. Permanent ("always/never do X") \u2192 \`learn "text" --rule\`. Run: \`noskills spec ${e.spec??"<name>"} learn "text"\` or \`learn "text" --rule\`.`,examples:[`noskills spec ${e.spec??"upload"} learn "Assumed S3 SDK v2, was v3"`,`noskills spec ${e.spec??"upload"} learn "Always use Result types" --rule`,"noskills learn promote 1"]}};if(t!==void 0)try{let{checkStaleness:s}=await import("./diagrams-IC2ADMKS.js"),r=await s(t,e.execution.modifiedFiles);if(r.length>0)return{...n,staleDiagrams:r.map(c=>({file:c.file,line:c.line,reason:c.reason}))}}catch{}return n};export{$e as a};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{c as o}from"./chunk-RBU3HF66.js";import{i as e}from"./chunk-6DBKPC2O.js";var d=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s);t=t.replace(/^## Status: .+$/m,`## Status: ${n}`),await e.fs.writeTextFile(s,t)}catch{}},u=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s),a=new RegExp(`^(- )\\[ \\]( ${n}:.*)$`,"m");t=t.replace(a,"$1[x]$2"),await e.fs.writeTextFile(s,t)}catch{}},w=async(r,i,n,s)=>{let t=`${r}/${o.specDir(i)}/progress.json`;try{let a=await e.fs.readTextFile(t),c=JSON.parse(a);for(let p of c.tasks)p.id===n&&(p.status=s);c.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(t,JSON.stringify(c,null,2)+`
2
+ import{c as o}from"./chunk-RUTM4VP7.js";import{i as e}from"./chunk-6DBKPC2O.js";var d=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s);t=t.replace(/^## Status: .+$/m,`## Status: ${n}`),await e.fs.writeTextFile(s,t)}catch{}},u=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s),a=new RegExp(`^(- )\\[ \\]( ${n}:.*)$`,"m");t=t.replace(a,"$1[x]$2"),await e.fs.writeTextFile(s,t)}catch{}},w=async(r,i,n,s)=>{let t=`${r}/${o.specDir(i)}/progress.json`;try{let a=await e.fs.readTextFile(t),c=JSON.parse(a);for(let p of c.tasks)p.id===n&&(p.status=s);c.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(t,JSON.stringify(c,null,2)+`
3
3
  `)}catch{}},f=async(r,i,n)=>{let s=`${r}/${o.specDir(i)}/progress.json`;try{let t=await e.fs.readTextFile(s),a=JSON.parse(t);a.status=n,a.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(s,JSON.stringify(a,null,2)+`
4
4
  `)}catch{}};export{d as a,u as b,w as c,f as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{i as f}from"./chunk-6DBKPC2O.js";var m=async(n,r)=>{let t=`${n}/.eser/specs/${r}/spec.md`,s;try{s=await f.fs.readTextFile(t)}catch{return null}return g(r,s)},g=(n,r)=>{let t=[],s=[],l=[],i="";for(let p of r.split(`
3
+ `)){let e=p.trim();if(e.startsWith("## ")){i=e.slice(3).trim().toLowerCase();continue}if(i.startsWith("tasks")){let a=e.match(/^-\s*\[[ x]\]\s*(task-\d+):\s*(.+)$/i);a!==null&&t.push({id:a[1],title:a[2].trim()});let c=e.match(/^Files?:\s*(.+)$/i);if(c!==null&&t.length>0){let h=t[t.length-1],d=c[1].split(",").map(o=>o.trim().replace(/^`|`$/g,"")).filter(o=>o.length>0);d.length>0&&(t[t.length-1]={...h,files:d})}}i.startsWith("out of scope")&&e.startsWith("- ")&&s.push(e.slice(2).trim()),i.startsWith("verification")&&e.startsWith("- ")&&l.push(e.slice(2).trim())}return{name:n,tasks:t,outOfScope:s,verification:l}},y=(n,r)=>{let t=new Set(r);for(let s of n)if(!t.has(s.id))return s;return null};export{m as a,g as b,y as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{c}from"./chunk-RUTM4VP7.js";var l={UNINITIALIZED:["IDLE"],IDLE:["DISCOVERY","COMPLETED"],DISCOVERY:["DISCOVERY_REVIEW","COMPLETED"],DISCOVERY_REVIEW:["DISCOVERY_REVIEW","SPEC_DRAFT","COMPLETED"],SPEC_DRAFT:["SPEC_DRAFT","SPEC_APPROVED","COMPLETED"],SPEC_APPROVED:["EXECUTING","COMPLETED"],EXECUTING:["COMPLETED","BLOCKED"],BLOCKED:["EXECUTING","COMPLETED"],COMPLETED:["IDLE","DISCOVERY"]},h=(e,t)=>l[e].includes(t),a=(e,t)=>{if(!h(e,t))throw new Error(`Invalid phase transition: ${e} \u2192 ${t}. Allowed: ${l[e].join(", ")}`)},S=(e,t)=>(a(e.phase,t),{...e,phase:t}),E=(e,t,n,s)=>(a(e.phase,"DISCOVERY"),{...e,phase:"DISCOVERY",spec:t,specDescription:s??null,branch:n,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1,planPath:null},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[]}),g=(e,t)=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot set discovery mode in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,mode:t}}},F=(e,t)=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete premises in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,premises:t,premisesCompleted:!0}}},w=(e,t)=>{if(e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot select approach in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,selectedApproach:t,alternativesPresented:!0}}},v=e=>{if(e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot skip alternatives in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,alternativesPresented:!0}}},C=(e,t,n,s)=>{if(e.phase!=="DISCOVERY"&&e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot add discovery answer in phase: ${e.phase}`);let i=e.discovery.answers.filter(r=>r.questionId!==t),o={questionId:t,answer:n,user:s?.name??"Unknown User",email:s?.email??"",timestamp:new Date().toISOString(),type:"original"};return{...e,discovery:{...e.discovery,answers:[...i,o]}}};var y=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete discovery in phase: ${e.phase}`);return{...e,phase:"DISCOVERY_REVIEW",discovery:{...e.discovery,completed:!0},specState:{path:c.specFile(e.spec),status:"draft"}}},D=e=>(a(e.phase,"SPEC_DRAFT"),{...e,phase:"SPEC_DRAFT"}),f=e=>{if(e.phase!=="DISCOVERY_REVIEW")throw new Error(`Cannot approve discovery answers in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,approved:!0}}},I=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot advance discovery question in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,currentQuestion:e.discovery.currentQuestion+1}}},x=e=>(a(e.phase,"SPEC_APPROVED"),{...e,phase:"SPEC_APPROVED",specState:{...e.specState,status:"approved"}}),O=e=>(a(e.phase,"EXECUTING"),{...e,phase:"EXECUTING",discovery:{...e.discovery,completed:!0,approved:!1},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]}});var P=(e,t)=>(a(e.phase,"BLOCKED"),{...e,phase:"BLOCKED",execution:{...e.execution,lastProgress:`BLOCKED: ${t}`}}),R=(e,t)=>({...e,decisions:[...e.decisions,t]}),U=(e,t,n)=>(a(e.phase,"COMPLETED"),{...e,phase:"COMPLETED",completionReason:t,completedAt:new Date().toISOString(),completionNote:n??null}),V=e=>{if(e.phase!=="COMPLETED")throw new Error(`Cannot reopen in phase: ${e.phase}`);return{...e,phase:"DISCOVERY",reopenedFrom:e.completionReason,completionReason:null,completedAt:null,completionNote:null,discovery:{...e.discovery,completed:!1,currentQuestion:0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null}},T=(e,t)=>{if(e.phase!=="EXECUTING"&&e.phase!=="BLOCKED")throw new Error(`Cannot revisit in phase: ${e.phase}. Only EXECUTING or BLOCKED can revisit.`);let n={from:e.phase,reason:t,completedTasks:[...e.execution.completedTasks],timestamp:new Date().toISOString()};return{...e,phase:"DISCOVERY",discovery:{...e.discovery,completed:!1,currentQuestion:0,approved:!1},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null,revisitHistory:[...e.revisitHistory??[],n]}},A=(e,t,n,s,i)=>{let o={from:t,to:n,user:s?.name??"Unknown User",email:s?.email??"",timestamp:new Date().toISOString(),reason:i},r=e.transitionHistory??[];return{...e,transitionHistory:[...r,o]}},L=(e,t,n)=>{let s=e.customACs??[],o={id:`custom-ac-${s.length+1}`,text:t,user:n?.name??"Unknown User",email:n?.email??"",timestamp:new Date().toISOString(),addedInPhase:e.phase};return{...e,customACs:[...s,o]}},b=(e,t,n)=>{let s=e.specNotes??[],o={id:`note-${s.length+1}`,text:t,user:n?.name??"Unknown User",email:n?.email??"",timestamp:new Date().toISOString(),phase:e.phase};return{...e,specNotes:[...s,o]}};var m=3,Y=(e,t,n,s)=>{let i=e.discovery.followUps??[],o=i.filter(d=>d.parentQuestionId===t).length;if(o>=m)return e;let p={id:`${t}${String.fromCharCode(97+o)}`,parentQuestionId:t,question:n,answer:null,status:"pending",createdBy:s,createdAt:new Date().toISOString()};return{...e,discovery:{...e.discovery,followUps:[...i,p]}}},_=(e,t,n)=>{let i=(e.discovery.followUps??[]).map(o=>o.id===t&&o.status==="pending"?{...o,answer:n,status:"answered",answeredAt:new Date().toISOString()}:o);return{...e,discovery:{...e.discovery,followUps:i}}},N=(e,t)=>{let s=(e.discovery.followUps??[]).map(i=>i.id===t&&i.status==="pending"?{...i,status:"skipped"}:i);return{...e,discovery:{...e.discovery,followUps:s}}};var $=(e,t)=>(e.discovery.followUps??[]).filter(n=>n.parentQuestionId===t),M=(e,t,n,s)=>{let i=e.discovery.delegations??[],o={questionId:t,delegatedTo:n,delegatedBy:s,status:"pending",delegatedAt:new Date().toISOString()};return{...e,discovery:{...e.discovery,delegations:[...i,o]}}},k=(e,t,n,s)=>{let o=(e.discovery.delegations??[]).map(r=>r.questionId===t&&r.status==="pending"?{...r,status:"answered",answer:n,answeredBy:s,answeredAt:new Date().toISOString()}:r);return{...e,discovery:{...e.discovery,delegations:o}}},W=e=>(e.discovery.delegations??[]).filter(t=>t.status==="pending"),Q=e=>({...e,phase:"IDLE",spec:null,branch:null,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1,planPath:null},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[],classification:null,completionReason:null,completedAt:null,completionNote:null,reopenedFrom:null});export{S as a,E as b,g as c,F as d,w as e,v as f,C as g,y as h,D as i,f as j,I as k,x as l,O as m,P as n,R as o,U as p,V as q,T as r,A as s,L as t,b as u,Y as v,_ as w,N as x,$ as y,M as z,k as A,W as B,Q as C};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as e}from"./chunk-NMEPQK3T.js";var i=new e({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-M3VS3GIJ.js")},list:{description:"List available AI providers",load:()=>import("./list-NX7RRO6R.js")}}});export{i as a};
2
+ import{a as e}from"./chunk-NMEPQK3T.js";var i=new e({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-6DWHUCLO.js")},list:{description:"List available AI providers",load:()=>import("./list-COFD6OUQ.js")}}});export{i as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{b as a}from"./chunk-4TTJVJEI.js";import{f as i,h as o,k as n}from"./chunk-SHN5MT56.js";import{i as r}from"./chunk-6DBKPC2O.js";var C=()=>{let t=r.process.isTerminal("stdout")?"interactive":"non-interactive",e=a({interaction:t});return{ctx:e,output:e.output}},d=()=>i({renderer:n.ansi(),sink:o.stdout()}),x=(s,t)=>({command:s,args:t._??[],flags:Object.fromEntries(Object.entries(t).filter(([e])=>e!=="_"))});export{C as a,d as b,x as c};
2
+ import{b as a}from"./chunk-5GGWX7CO.js";import{f as i,h as o,k as n}from"./chunk-SHN5MT56.js";import{i as r}from"./chunk-6DBKPC2O.js";var C=()=>{let t=r.process.isTerminal("stdout")?"interactive":"non-interactive",e=a({interaction:t});return{ctx:e,output:e.output}},d=()=>i({renderer:n.ansi(),sink:o.stdout()}),x=(s,t)=>({command:s,args:t._??[],flags:Object.fromEntries(Object.entries(t).filter(([e])=>e!=="_"))});export{C as a,d as b,x as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{b as _,c as b}from"./chunk-BNQAZLIQ.js";import{a as y,e as f}from"./chunk-J7YTWK67.js";var h=class{capabilities=["text_generation","streaming","tool_calling","vision","batch_processing"];provider="anthropic";modelId;client;config;constructor(t,n){this.client=t,this.config=n,this.modelId=n.model}async generateText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create(o,{signal:n,timeout:this.config.requestTimeoutMs});return k(a,this.modelId)}catch(a){throw i(a)}}async*streamText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create({...o,stream:!0},{signal:n,timeout:this.config.requestTimeoutMs}),r=null,l=null,c="",d=0,u=0;for await(let s of a)if(s.type==="message_start")d=s.message?.usage?.input_tokens??0;else if(s.type==="content_block_start")s.content_block?.type==="tool_use"&&(r=s.content_block.id??null,l=s.content_block.name??null,c="");else if(s.type==="content_block_delta")s.delta?.type==="text_delta"?yield{kind:"content_delta",textDelta:s.delta.text}:s.delta?.type==="input_json_delta"&&(c+=s.delta.partial_json??"",yield{kind:"tool_call_delta",textDelta:s.delta.partial_json});else if(s.type==="content_block_stop"){if(r!==null&&l!==null){let m={};try{m=JSON.parse(c||"{}")}catch{}yield{kind:"tool_call_delta",toolCall:{id:r,name:l,arguments:m}},r=null,l=null,c=""}}else s.type==="message_delta"&&(u=s.usage?.output_tokens??u,yield{kind:"message_done",stopReason:x(s.delta?.stop_reason),usage:{inputTokens:d,outputTokens:u,totalTokens:d+u}})}catch(a){yield{kind:"error",error:i(a)}}}async submitBatch(t,n){let o=t.items.map(a=>({custom_id:a.customId,params:p(this.config,a.options)}));try{let a=await this.client.beta.messages.batches.create({requests:o},{signal:n});return g(a)}catch(a){throw i(a)}}async getBatchJob(t,n){try{let o=await this.client.beta.messages.batches.retrieve(t,{signal:n});return g(o)}catch(o){throw i(o)}}async listBatchJobs(t,n){try{let o=await this.client.beta.messages.batches.list({limit:t?.limit,after_id:t?.after},{signal:n}),a=[];for(let r of o.data??[])a.push(g(r));return a}catch(o){throw i(o)}}async downloadBatchResults(t,n){try{let o=await this.client.beta.messages.batches.results(t.id,{signal:n}),a=[];for await(let r of o)r.result?.type==="succeeded"?a.push({customId:r.custom_id,result:k(r.result.message,this.modelId)}):a.push({customId:r.custom_id,error:r.result?.error?.message??"Unknown error"});return a}catch(o){throw i(o)}}async cancelBatchJob(t,n){try{await this.client.beta.messages.batches.cancel(t,{signal:n})}catch(o){throw i(o)}}async close(){}getRawClient(){return this.client}},A={provider:"anthropic",async createModel(e){let{default:t}=await import("./sdk-L2SQCWYV.js"),n={};e.apiKey!==void 0&&(n.apiKey=e.apiKey),e.baseUrl!==void 0&&(n.baseURL=e.baseUrl);let o=new t(n);return new h(o,e)}},p=(e,t)=>{let n={model:e.model,max_tokens:t.maxTokens??e.maxTokens,messages:R(t.messages)};return t.system!==void 0&&(n.system=t.system),t.temperature!==void 0&&(n.temperature=t.temperature),t.topP!==void 0&&(n.top_p=t.topP),t.stopWords!==void 0&&(n.stop_sequences=t.stopWords),t.tools!==void 0&&(n.tools=t.tools.map(o=>({name:o.name,description:o.description,input_schema:o.parameters??{type:"object",properties:{}}}))),t.toolChoice!==void 0&&(n.tool_choice={type:t.toolChoice}),t.thinkingBudget!==void 0&&(n.thinking={type:"enabled",budget_tokens:t.thinkingBudget}),n},R=e=>{let t=[];for(let n of e){if(n.role==="system")continue;let o=n.content.map(C);t.push({role:n.role==="tool"?"user":n.role,content:o})}return t},C=e=>{switch(e.kind){case"text":return{type:"text",text:e.text};case"image":{if(e.image.data!==void 0)return{type:"image",source:{type:"base64",media_type:e.image.mimeType??"image/png",data:w(e.image.data)}};if(e.image.url!==void 0){if(_(e.image.url)){let t=b(e.image.url);if(t!==null)return{type:"image",source:{type:"base64",media_type:t.mimeType,data:w(t.data)}}}return{type:"image",source:{type:"url",url:e.image.url}}}return{type:"text",text:"[unsupported image]"}}case"tool_call":return{type:"tool_use",id:e.toolCall.id,name:e.toolCall.name,input:e.toolCall.arguments};case"tool_result":return{type:"tool_result",tool_use_id:e.toolResult.toolCallId,content:e.toolResult.content,is_error:e.toolResult.isError};default:return{type:"text",text:`[unsupported content: ${e.kind}]`}}},k=(e,t)=>{let n=[];for(let o of e.content??[])o.type==="text"?n.push({kind:"text",text:o.text}):o.type==="thinking"?n.push({kind:"text",text:`[thinking] ${o.thinking}`}):o.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:o.id,name:o.name,arguments:o.input??{}}});return{content:n,stopReason:x(e.stop_reason),usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)},modelId:t,rawResponse:e}},x=e=>e==="end_turn"?"end_turn":e==="max_tokens"?"max_tokens":e==="tool_use"?"tool_use":e==="stop_sequence"?"stop":"end_turn",g=e=>({id:e.id,status:B(e.processing_status),createdAt:new Date(e.created_at),completedAt:e.ended_at!==void 0?new Date(e.ended_at):void 0,totalCount:e.request_counts?.total??0,doneCount:e.request_counts?.succeeded??0,failedCount:e.request_counts?.errored??0}),B=e=>e==="in_progress"?"processing":e==="ended"?"completed":e==="canceling"||e==="canceled"?"cancelled":"pending",i=e=>{if(e instanceof y)return e;let t=e instanceof Error?e:new Error(String(e)),n=e?.status??e?.statusCode??500;return f("anthropic",n,t)},w=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{h as a,A as b};
2
+ import{b as _,c as b}from"./chunk-BNQAZLIQ.js";import{a as y,e as f}from"./chunk-J7YTWK67.js";var h=class{capabilities=["text_generation","streaming","tool_calling","vision","batch_processing"];provider="anthropic";modelId;client;config;constructor(t,n){this.client=t,this.config=n,this.modelId=n.model}async generateText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create(o,{signal:n,timeout:this.config.requestTimeoutMs});return k(a,this.modelId)}catch(a){throw i(a)}}async*streamText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create({...o,stream:!0},{signal:n,timeout:this.config.requestTimeoutMs}),r=null,l=null,c="",d=0,u=0;for await(let s of a)if(s.type==="message_start")d=s.message?.usage?.input_tokens??0;else if(s.type==="content_block_start")s.content_block?.type==="tool_use"&&(r=s.content_block.id??null,l=s.content_block.name??null,c="");else if(s.type==="content_block_delta")s.delta?.type==="text_delta"?yield{kind:"content_delta",textDelta:s.delta.text}:s.delta?.type==="input_json_delta"&&(c+=s.delta.partial_json??"",yield{kind:"tool_call_delta",textDelta:s.delta.partial_json});else if(s.type==="content_block_stop"){if(r!==null&&l!==null){let m={};try{m=JSON.parse(c||"{}")}catch{}yield{kind:"tool_call_delta",toolCall:{id:r,name:l,arguments:m}},r=null,l=null,c=""}}else s.type==="message_delta"&&(u=s.usage?.output_tokens??u,yield{kind:"message_done",stopReason:x(s.delta?.stop_reason),usage:{inputTokens:d,outputTokens:u,totalTokens:d+u}})}catch(a){yield{kind:"error",error:i(a)}}}async submitBatch(t,n){let o=t.items.map(a=>({custom_id:a.customId,params:p(this.config,a.options)}));try{let a=await this.client.beta.messages.batches.create({requests:o},{signal:n});return g(a)}catch(a){throw i(a)}}async getBatchJob(t,n){try{let o=await this.client.beta.messages.batches.retrieve(t,{signal:n});return g(o)}catch(o){throw i(o)}}async listBatchJobs(t,n){try{let o=await this.client.beta.messages.batches.list({limit:t?.limit,after_id:t?.after},{signal:n}),a=[];for(let r of o.data??[])a.push(g(r));return a}catch(o){throw i(o)}}async downloadBatchResults(t,n){try{let o=await this.client.beta.messages.batches.results(t.id,{signal:n}),a=[];for await(let r of o)r.result?.type==="succeeded"?a.push({customId:r.custom_id,result:k(r.result.message,this.modelId)}):a.push({customId:r.custom_id,error:r.result?.error?.message??"Unknown error"});return a}catch(o){throw i(o)}}async cancelBatchJob(t,n){try{await this.client.beta.messages.batches.cancel(t,{signal:n})}catch(o){throw i(o)}}async close(){}getRawClient(){return this.client}},A={provider:"anthropic",async createModel(e){let{default:t}=await import("./sdk-EJKXYVDC.js"),n={};e.apiKey!==void 0&&(n.apiKey=e.apiKey),e.baseUrl!==void 0&&(n.baseURL=e.baseUrl);let o=new t(n);return new h(o,e)}},p=(e,t)=>{let n={model:e.model,max_tokens:t.maxTokens??e.maxTokens,messages:R(t.messages)};return t.system!==void 0&&(n.system=t.system),t.temperature!==void 0&&(n.temperature=t.temperature),t.topP!==void 0&&(n.top_p=t.topP),t.stopWords!==void 0&&(n.stop_sequences=t.stopWords),t.tools!==void 0&&(n.tools=t.tools.map(o=>({name:o.name,description:o.description,input_schema:o.parameters??{type:"object",properties:{}}}))),t.toolChoice!==void 0&&(n.tool_choice={type:t.toolChoice}),t.thinkingBudget!==void 0&&(n.thinking={type:"enabled",budget_tokens:t.thinkingBudget}),n},R=e=>{let t=[];for(let n of e){if(n.role==="system")continue;let o=n.content.map(C);t.push({role:n.role==="tool"?"user":n.role,content:o})}return t},C=e=>{switch(e.kind){case"text":return{type:"text",text:e.text};case"image":{if(e.image.data!==void 0)return{type:"image",source:{type:"base64",media_type:e.image.mimeType??"image/png",data:w(e.image.data)}};if(e.image.url!==void 0){if(_(e.image.url)){let t=b(e.image.url);if(t!==null)return{type:"image",source:{type:"base64",media_type:t.mimeType,data:w(t.data)}}}return{type:"image",source:{type:"url",url:e.image.url}}}return{type:"text",text:"[unsupported image]"}}case"tool_call":return{type:"tool_use",id:e.toolCall.id,name:e.toolCall.name,input:e.toolCall.arguments};case"tool_result":return{type:"tool_result",tool_use_id:e.toolResult.toolCallId,content:e.toolResult.content,is_error:e.toolResult.isError};default:return{type:"text",text:`[unsupported content: ${e.kind}]`}}},k=(e,t)=>{let n=[];for(let o of e.content??[])o.type==="text"?n.push({kind:"text",text:o.text}):o.type==="thinking"?n.push({kind:"text",text:`[thinking] ${o.thinking}`}):o.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:o.id,name:o.name,arguments:o.input??{}}});return{content:n,stopReason:x(e.stop_reason),usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)},modelId:t,rawResponse:e}},x=e=>e==="end_turn"?"end_turn":e==="max_tokens"?"max_tokens":e==="tool_use"?"tool_use":e==="stop_sequence"?"stop":"end_turn",g=e=>({id:e.id,status:B(e.processing_status),createdAt:new Date(e.created_at),completedAt:e.ended_at!==void 0?new Date(e.ended_at):void 0,totalCount:e.request_counts?.total??0,doneCount:e.request_counts?.succeeded??0,failedCount:e.request_counts?.errored??0}),B=e=>e==="in_progress"?"processing":e==="ended"?"completed":e==="canceling"||e==="canceled"?"cancelled":"pending",i=e=>{if(e instanceof y)return e;let t=e instanceof Error?e:new Error(String(e)),n=e?.status??e?.statusCode??500;return f("anthropic",n,t)},w=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{h as a,A as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{d as r}from"./chunk-GVTM4EOU.js";import{i}from"./chunk-6DBKPC2O.js";var t=async e=>{try{return await r`which ${e}`.noThrow().code()===0}catch{return!1}},s=async()=>{try{return(await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}},a=e=>i.env.has(e),d=async()=>{let[e,o,l,n]=await Promise.all([t("claude"),s(),t("opencode"),t("kiro")]);return[{name:"claude-code",alias:"cc",type:"CLI",available:e,detail:e?"claude binary found":"claude not on PATH"},{name:"ollama",alias:"ol",type:"HTTP",available:o,detail:o?"localhost:11434 reachable":"localhost:11434 not reachable"},{name:"opencode",alias:"oc",type:"CLI",available:l,detail:l?"opencode binary found":"opencode not on PATH"},{name:"kiro",alias:"kr",type:"CLI",available:n,detail:n?"kiro binary found":"kiro not on PATH"},{name:"anthropic",alias:"ant",type:"API",available:a("ANTHROPIC_API_KEY"),detail:a("ANTHROPIC_API_KEY")?"ANTHROPIC_API_KEY set":"ANTHROPIC_API_KEY not set"},{name:"openai",alias:"oai",type:"API",available:a("OPENAI_API_KEY"),detail:a("OPENAI_API_KEY")?"OPENAI_API_KEY set":"OPENAI_API_KEY not set"},{name:"gemini",alias:"gem",type:"API",available:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY"),detail:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY")?"API key set":"GEMINI_API_KEY not set"},{name:"vertexai",alias:"vtx",type:"API",available:a("GOOGLE_CLOUD_PROJECT"),detail:a("GOOGLE_CLOUD_PROJECT")?"GOOGLE_CLOUD_PROJECT set":"GOOGLE_CLOUD_PROJECT not set"}]};export{d as a};
2
+ import{d as r}from"./chunk-VKB3B2FE.js";import{i}from"./chunk-6DBKPC2O.js";var t=async e=>{try{return await r`which ${e}`.noThrow().code()===0}catch{return!1}},s=async()=>{try{return(await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}},a=e=>i.env.has(e),d=async()=>{let[e,o,l,n]=await Promise.all([t("claude"),s(),t("opencode"),t("kiro")]);return[{name:"claude-code",alias:"cc",type:"CLI",available:e,detail:e?"claude binary found":"claude not on PATH"},{name:"ollama",alias:"ol",type:"HTTP",available:o,detail:o?"localhost:11434 reachable":"localhost:11434 not reachable"},{name:"opencode",alias:"oc",type:"CLI",available:l,detail:l?"opencode binary found":"opencode not on PATH"},{name:"kiro",alias:"kr",type:"CLI",available:n,detail:n?"kiro binary found":"kiro not on PATH"},{name:"anthropic",alias:"ant",type:"API",available:a("ANTHROPIC_API_KEY"),detail:a("ANTHROPIC_API_KEY")?"ANTHROPIC_API_KEY set":"ANTHROPIC_API_KEY not set"},{name:"openai",alias:"oai",type:"API",available:a("OPENAI_API_KEY"),detail:a("OPENAI_API_KEY")?"OPENAI_API_KEY set":"OPENAI_API_KEY not set"},{name:"gemini",alias:"gem",type:"API",available:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY"),detail:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY")?"API key set":"GEMINI_API_KEY not set"},{name:"vertexai",alias:"vtx",type:"API",available:a("GOOGLE_CLOUD_PROJECT"),detail:a("GOOGLE_CLOUD_PROJECT")?"GOOGLE_CLOUD_PROJECT set":"GOOGLE_CLOUD_PROJECT not set"}]};export{d as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as S,b as G,c as R}from"./chunk-L5OC7F24.js";import{e as ee}from"./chunk-J2Z7NG2X.js";import{f as p,h as u,k as d}from"./chunk-SHN5MT56.js";import{b as r,d as i,f as w,g as y,h as Z,k as l}from"./chunk-YVN2NZL4.js";import{d as v}from"./chunk-GVTM4EOU.js";import{a as k}from"./chunk-XFCBVUI7.js";import{a as f,b as g}from"./chunk-FFWPJP7A.js";import{g as T,i as m}from"./chunk-6DBKPC2O.js";import{g as ie,m as O,n as K,o as I,p as le}from"./chunk-6G6UVWJN.js";var de="# eser CLI completions",B="eser",te=async e=>{try{return await m.fs.readTextFile(e)}catch{return""}},me=async e=>{try{return await m.fs.stat(e),!0}catch{return!1}},se=async e=>{let t=R(e,B);if(t.completionType==="file")return await me(t.completionsFile);let s=await te(t.rcFile),n=G(e,B);return s.includes(n)},ne=async e=>{let t=R(e,B),s=p({renderer:d.ansi(),sink:u.stdout()});try{if(t.completionType==="file"){let n=t.completionsFile,o=m.path.dirname(n);try{await m.fs.mkdir(o,{recursive:!0})}catch{}await m.fs.writeTextFile(n,`# eser CLI completions
2
+ import{a as S,b as G,c as R}from"./chunk-L5OC7F24.js";import{e as ee}from"./chunk-J2Z7NG2X.js";import{f as p,h as u,k as d}from"./chunk-SHN5MT56.js";import{b as r,d as i,f as w,g as y,h as Z,k as l}from"./chunk-YVN2NZL4.js";import{d as v}from"./chunk-VKB3B2FE.js";import{a as k}from"./chunk-DGI7M6TL.js";import{a as f,b as g}from"./chunk-FFWPJP7A.js";import{g as T,i as m}from"./chunk-6DBKPC2O.js";import{g as ie,m as O,n as K,o as I,p as le}from"./chunk-6G6UVWJN.js";var de="# eser CLI completions",B="eser",te=async e=>{try{return await m.fs.readTextFile(e)}catch{return""}},me=async e=>{try{return await m.fs.stat(e),!0}catch{return!1}},se=async e=>{let t=R(e,B);if(t.completionType==="file")return await me(t.completionsFile);let s=await te(t.rcFile),n=G(e,B);return s.includes(n)},ne=async e=>{let t=R(e,B),s=p({renderer:d.ansi(),sink:u.stdout()});try{if(t.completionType==="file"){let n=t.completionsFile,o=m.path.dirname(n);try{await m.fs.mkdir(o,{recursive:!0})}catch{}await m.fs.writeTextFile(n,`# eser CLI completions
3
3
  # This file is auto-generated. Run 'eser system completions --shell fish' to regenerate.
4
4
  complete -c eser -f
5
5
  complete -c eser -n "__fish_use_subcommand" -a "codebase" -d "Codebase management tools"
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as o}from"./chunk-HVQK35SO.js";var n=o({name:"validate-trailing-whitespace",description:"Remove trailing whitespace from lines",canFix:!0,stacks:[],defaults:{},checkFile(a,i){if(i===void 0)return[];let t=[],r=i.split(`
2
+ import{a as o}from"./chunk-VJSHVZ7R.js";var n=o({name:"validate-trailing-whitespace",description:"Remove trailing whitespace from lines",canFix:!0,stacks:[],defaults:{},checkFile(a,i){if(i===void 0)return[];let t=[],r=i.split(`
3
3
  `);for(let e=0;e<r.length;e++)/[ \t]+$/.test(r[e])&&t.push({path:a.path,line:e+1,message:"trailing whitespace"});return t},fixFile(a,i){let t=i.replace(/[ \t]+$/gm,"");if(t!==i)return{path:a.path,oldContent:i,newContent:t}}}),c=n.run,u=n.validator,d=n.main;export{n as a,c as b,u as c,d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as o}from"./chunk-HVQK35SO.js";var a=1024,s=o({name:"validate-large-files",description:"Detect files exceeding size limit",canFix:!1,stacks:[],defaults:{maxKb:a},checkAll(n,r){let e=r.maxKb??a,l=e*1024,t=[];for(let i of n)if(i.size>l){let c=Math.round(i.size/1024);t.push({path:i.path,message:`file is ${c}KB (max: ${e}KB)`})}return t}}),d=s.run,f=s.validator,x=s.main;export{s as a,d as b,f as c,x as d};
2
+ import{a as o}from"./chunk-VJSHVZ7R.js";var a=1024,s=o({name:"validate-large-files",description:"Detect files exceeding size limit",canFix:!1,stacks:[],defaults:{maxKb:a},checkAll(n,r){let e=r.maxKb??a,l=e*1024,t=[];for(let i of n)if(i.size>l){let c=Math.round(i.size/1024);t.push({path:i.path,message:`file is ${c}KB (max: ${e}KB)`})}return t}}),d=s.run,f=s.validator,x=s.main;export{s as a,d as b,f as c,x as d};
@@ -0,0 +1,11 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{a as P}from"./chunk-2XNFZXHY.js";import{i as s}from"./chunk-6DBKPC2O.js";import{e as v}from"./chunk-5WJ6AUNY.js";var f=()=>({version:"0.1.0",phase:"IDLE",spec:null,specDescription:null,branch:null,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1,planPath:null},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[],lastCalledAt:null,classification:null,completionReason:null,completedAt:null,completionNote:null,reopenedFrom:null,revisitHistory:[]}),j=(e,n,t,r)=>({concerns:e,tools:n,providers:t,project:r,maxIterationsBeforeRestart:15,verifyCommand:null,allowGit:!1,command:"npx eser@latest noskills"});var l=v(P(),1);var i=".eser",d=`${i}/.state`,S=`${d}/state.json`,m=`${i}/manifest.yml`,y=`${i}/concerns`,x=`${i}/rules`,u=`${i}/specs`,h=`${i}/workflows`,p=`${d}/specs`,A=`${d}/active.json`,a=`${i}/.sessions`,D=`${i}/.events`,c={eserDir:i,stateDir:d,stateFile:S,manifestFile:m,concernsDir:y,rulesDir:x,specsDir:u,workflowsDir:h,specStatesDir:p,activeFile:A,specDir:e=>`${u}/${e}`,specFile:e=>`${u}/${e}/spec.md`,specStateFile:e=>`${p}/${e}.json`,concernFile:e=>`${y}/${e}.json`,sessionsDir:a,sessionFile:e=>`${a}/${e}.json`,eventsDir:D,eserGitignore:`${i}/.gitignore`},w=async e=>{let n=`${e}/${S}`;try{let t=await s.fs.readTextFile(n);return JSON.parse(t)}catch{return f()}},L=async(e,n)=>{if(n==null)return w(e);let t=`${e}/${c.specDir(n)}`;try{await s.fs.stat(t)}catch{throw new Error(`Spec '${n}' not found. Run \`noskills spec list\` to see available specs.`)}let r=await T(e,n);if(r.spec===n)return r;let o=await w(e);return o.spec===n?o:{...r,spec:n}};var I=e=>{if(e===void 0)return null;for(let n of e)if(n.startsWith("--spec="))return n.slice(7);return null},M=e=>{let n=I(e);return n===null||n.length===0?{ok:!1,error:"Error: spec name is required. Use `noskills spec <name> <command>` format."}:{ok:!0,spec:n}},b=async(e,n)=>{let t=`${e}/${d}`,r=`${e}/${S}`;await s.fs.mkdir(t,{recursive:!0}),await s.fs.writeTextFile(r,JSON.stringify(n,null,2)+`
3
+ `)};var T=async(e,n)=>{let t=`${e}/${c.specStateFile(n)}`;try{let r=await s.fs.readTextFile(t);return JSON.parse(r)}catch{return f()}},C=async(e,n,t)=>{let r=`${e}/${p}`,o=`${e}/${c.specStateFile(n)}`;await s.fs.mkdir(r,{recursive:!0}),await s.fs.writeTextFile(o,JSON.stringify(t,null,2)+`
4
+ `)},J=async e=>{let n=`${e}/${p}`,t=[];try{for await(let r of s.fs.readDir(n))if(r.isFile&&r.name.endsWith(".json")){let o=r.name.replace(/\.json$/,""),g=await s.fs.readTextFile(`${n}/${r.name}`);t.push({name:o,state:JSON.parse(g)})}}catch{}return t},U=async e=>{let n=`${e}/${m}`;try{let t=await s.fs.readTextFile(n),r=l.parse(t);return r?.noskills===void 0?null:r.noskills}catch{return null}},q=async(e,n)=>{let t=`${e}/${m}`,r;try{let g=await s.fs.readTextFile(t);r=l.parseDocument(g)}catch{r=new l.Document({})}let o=r.createNode(n);o.commentBefore=" noskills orchestrator \u2014 inline comments in this section won't be preserved on next write",r.set("noskills",o),await s.fs.writeTextFile(t,r.toString())},V=async(e,n)=>{let t=`${e}/${c.concernFile(n)}`;try{let r=await s.fs.readTextFile(t);return JSON.parse(r)}catch{return null}},W=async(e,n)=>{let t=`${e}/${y}`,r=`${e}/${c.concernFile(n.id)}`;await s.fs.mkdir(t,{recursive:!0}),await s.fs.writeTextFile(r,JSON.stringify(n,null,2)+`
5
+ `)},B=async e=>{let n=`${e}/${y}`,t=[];try{for await(let r of s.fs.readDir(n))if(r.isFile&&r.name.endsWith(".json")){let o=await s.fs.readTextFile(`${n}/${r.name}`);t.push(JSON.parse(o))}}catch{}return t},G=async e=>{let n=[i,d,p,y,x,u,h,D];for(let r of n)await s.fs.mkdir(`${e}/${r}`,{recursive:!0});let t=`${e}/${c.eserGitignore}`;try{await s.fs.stat(t)}catch{await s.fs.writeTextFile(t,`# eser toolchain runtime state \u2014 not tracked by git
6
+ .state/
7
+ .sessions/
8
+ .events/
9
+ `)}},H=async(e,n)=>{await b(e,n),n.spec!==null&&await C(e,n.spec,n)},$=2*60*60*1e3,Q=async(e,n)=>{let t=`${e}/${a}`;await s.fs.mkdir(t,{recursive:!0}),await s.fs.writeTextFile(`${t}/${n.id}.json`,JSON.stringify(n,null,2)+`
10
+ `)},E=async(e,n)=>{try{let t=await s.fs.readTextFile(`${e}/${a}/${n}.json`);return JSON.parse(t)}catch{return null}},R=async e=>{let n=`${e}/${a}`,t=[];try{for await(let r of s.fs.readDir(n))if(r.isFile&&r.name.endsWith(".json"))try{let o=await s.fs.readTextFile(`${n}/${r.name}`);t.push(JSON.parse(o))}catch{}}catch{}return t},k=async(e,n)=>{try{return await s.fs.remove(`${e}/${a}/${n}.json`),!0}catch{return!1}},K=async(e,n,t)=>{let r=await E(e,n);if(r===null)return;let o={...r,phase:t,lastActiveAt:new Date().toISOString()};await s.fs.writeTextFile(`${e}/${a}/${n}.json`,JSON.stringify(o,null,2)+`
11
+ `)},z=async e=>{let n=await R(e),t=Date.now(),r=[];for(let o of n)t-new Date(o.lastActiveAt).getTime()>$&&(await k(e,o.id),r.push(o.id));return r},Y=e=>Date.now()-new Date(e.lastActiveAt).getTime()>$,X=()=>{let e=new Uint8Array(4);return crypto.getRandomValues(e),Array.from(e).map(n=>n.toString(16).padStart(2,"0")).join("")},Z=async e=>{try{let n=await s.fs.readTextFile(`${e}/${m}`);return l.parse(n)?.noskills!==void 0}catch{return!1}},N=e=>{let n=e.includes("\\")?"\\":"/",t=e.split(n).filter(Boolean);return t.length<=1?e.startsWith("/")?"/":e:(t.pop(),(e.startsWith("/")?"/":"")+t.join(n))},O=async e=>{let n=e;for(let t=0;t<100;t++){try{return await s.fs.stat(`${n}/${i}`),n}catch{}let r=N(n);if(r===n)return null;n=r}return null},ee=async()=>{let e=s.process.cwd(),n=s.env.get("NOSKILLS_PROJECT_ROOT")??null;if(n!==null)try{return await s.fs.stat(`${n}/${i}`),{root:n,found:!0}}catch{}let t=await O(e);return t!==null?{root:t,found:!0}:n!==null?{root:n,found:!1}:{root:e,found:!1}};export{f as a,j as b,c,w as d,L as e,I as f,M as g,b as h,T as i,C as j,J as k,U as l,q as m,V as n,W as o,B as p,G as q,H as r,Q as s,E as t,R as u,k as v,K as w,z as x,Y as y,X as z,Z as A,ee as B};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as o}from"./chunk-HVQK35SO.js";var p=[{name:"AWS Access Key ID",pattern:/AKIA[0-9A-Z]{16}/},{name:"Private Key",pattern:/-----BEGIN\s{1,5}(RSA\s{1,5}|EC\s{1,5}|DSA\s{1,5}|OPENSSH\s{1,5})?PRIVATE KEY-----/},{name:"Generic secret assignment",pattern:/(?:secret|password|api_key|apikey|access_token|auth_token|private_key)\s{0,5}[=:]\s{0,5}["'][^"']{8,}["']/i}],d=[/\.lock$/,/package-lock\.json$/,/\.test\./,/testdata\//,/\.snap$/,/\.min\./],t=o({name:"validate-secrets",description:"Detect credentials and private keys",canFix:!1,stacks:[],defaults:{},checkFile(a,s){if(s===void 0)return[];for(let e of d)if(e.test(a.path))return[];let n=[],r=s.split(`
2
+ import{a as o}from"./chunk-VJSHVZ7R.js";var p=[{name:"AWS Access Key ID",pattern:/AKIA[0-9A-Z]{16}/},{name:"Private Key",pattern:/-----BEGIN\s{1,5}(RSA\s{1,5}|EC\s{1,5}|DSA\s{1,5}|OPENSSH\s{1,5})?PRIVATE KEY-----/},{name:"Generic secret assignment",pattern:/(?:secret|password|api_key|apikey|access_token|auth_token|private_key)\s{0,5}[=:]\s{0,5}["'][^"']{8,}["']/i}],d=[/\.lock$/,/package-lock\.json$/,/\.test\./,/testdata\//,/\.snap$/,/\.min\./],t=o({name:"validate-secrets",description:"Detect credentials and private keys",canFix:!1,stacks:[],defaults:{},checkFile(a,s){if(s===void 0)return[];for(let e of d)if(e.test(a.path))return[];let n=[],r=s.split(`
3
3
  `);for(let e=0;e<r.length;e++){let i=r[e];for(let{name:c,pattern:l}of p)if(l.test(i)){n.push({path:a.path,line:e+1,message:`potential ${c} detected`});break}}return n}}),k=t.run,T=t.validator,y=t.main;export{t as a,k as b,T as c,y as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{n as $e}from"./chunk-NVPQJFAI.js";import{a as ge,b as me,d as X,e as Ye,f as et,g as tt,h as U}from"./chunk-LWQPFCWC.js";import{a as nt}from"./chunk-3OG2MEF2.js";import{c as fe}from"./chunk-3D5TBTM3.js";import{a as pe,b as re,c as z,d as Be}from"./chunk-NBA6EFWU.js";import{e as S}from"./chunk-5DWJ7WEE.js";import{i as o}from"./chunk-6DBKPC2O.js";import{e as H,i as Qe}from"./chunk-6G6UVWJN.js";var I=S.getLogger(["laroux-bundler","server-action-transform"]);function mn(e,t){return`${e.replace(/\.[cm]?[jt]sx?$/,"")}#${t}`}function hn(e,t){let n=mn(e,t);return`Object.defineProperties(${t}, {
2
+ import{a as ge,b as me,d as X,e as Ye,f as et,g as tt,h as U}from"./chunk-LWQPFCWC.js";import{n as $e}from"./chunk-NVPQJFAI.js";import{a as nt}from"./chunk-3OG2MEF2.js";import{c as fe}from"./chunk-HTC2FO4I.js";import{a as pe,b as re,c as z,d as Be}from"./chunk-NBA6EFWU.js";import{e as S}from"./chunk-5DWJ7WEE.js";import{i as o}from"./chunk-6DBKPC2O.js";import{e as H,i as Qe}from"./chunk-6G6UVWJN.js";var I=S.getLogger(["laroux-bundler","server-action-transform"]);function mn(e,t){return`${e.replace(/\.[cm]?[jt]sx?$/,"")}#${t}`}function hn(e,t){let n=mn(e,t);return`Object.defineProperties(${t}, {
3
3
  $$typeof: { value: Symbol.for("react.server.reference"), enumerable: false },
4
4
  $$id: { value: "${n}", enumerable: false },
5
5
  $$bound: { value: null, enumerable: false, writable: true }
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{e as x,f as w}from"./chunk-3D5TBTM3.js";import{a as O}from"./chunk-LFNUSULJ.js";import{a as F,c as U}from"./chunk-JTSRGXS4.js";import{o as i}from"./chunk-4TTJVJEI.js";import{a as S,b as v,c as P,d as u}from"./chunk-J2Z7NG2X.js";import{f as V}from"./chunk-P2MUEKFT.js";import{a as k}from"./chunk-MG65QJY6.js";import{g as a}from"./chunk-FFWPJP7A.js";import{j as y}from"./chunk-7ATUODBM.js";import{j as h}from"./chunk-6DBKPC2O.js";var{ctx:d,output:_}=F(),I=async(s={})=>{let{root:e="."}=s,o=y(e,"VERSION");try{return(await h.runtime.fs.readTextFile(o)).trim()}catch{return}},N=async(s,e)=>{let o=y(s,"VERSION");await h.runtime.fs.writeTextFile(o,e+`
2
+ import{e as x,f as w}from"./chunk-HTC2FO4I.js";import{a as O}from"./chunk-LFNUSULJ.js";import{a as F,c as U}from"./chunk-PZUDTTK4.js";import{o as i}from"./chunk-5GGWX7CO.js";import{a as S,b as v,c as P,d as u}from"./chunk-J2Z7NG2X.js";import{f as V}from"./chunk-P2MUEKFT.js";import{a as k}from"./chunk-MG65QJY6.js";import{g as a}from"./chunk-FFWPJP7A.js";import{j as y}from"./chunk-7ATUODBM.js";import{j as h}from"./chunk-6DBKPC2O.js";var{ctx:d,output:_}=F(),I=async(s={})=>{let{root:e="."}=s,o=y(e,"VERSION");try{return(await h.runtime.fs.readTextFile(o)).trim()}catch{return}},N=async(s,e)=>{let o=y(s,"VERSION");await h.runtime.fs.writeTextFile(o,e+`
3
3
  `)},M=s=>{let e=u("0.0.0");for(let o of s){let n=u(o);S(n,e)>0&&(e=n)}return v(e)},T=async(s={})=>{let{root:e="."}=s,[o,n]=await w(e),l=o.version?.value??"0.0.0";return{packages:[{name:o.name?.value??"(root)",version:l},...n.map(p=>({name:p.name,version:p.version}))]}},j=async(s,e={})=>{let{root:o=".",dryRun:n=!1,updateVersionFile:l=!0}=e,[c,f]=await w(o),p=c.version?.value??"0.0.0",b=c.name?.value??"(root)",A=[p,...f.map(t=>t.version)],C=M(A),r;if(s==="explicit"){if(e.explicitVersion===void 0)throw new Error('explicitVersion is required when command is "explicit".');u(e.explicitVersion),r=e.explicitVersion}else s==="sync"?r=C:r=v(P(u(C),s));let m=[],E=p!==r;n||await x(c,r),m.push({name:b,from:p,to:r,changed:E});for(let t of f){let g=t.version!==r;n||await x(t.config,r),m.push({name:t.name,from:t.version,to:r,changed:g})}let R=[];if(l){let t=await I({root:o}),g=t!==r;!n&&g&&await N(o,r),R.push({path:"VERSION",from:t??"",to:r,changed:g})}let $=m.filter(t=>t.changed).length;return{command:s,targetVersion:r,updates:m,fileUpdates:R,changedCount:$,dryRun:n}},H=s=>s.mode==="show"?V.fromPromise(async()=>({mode:"show",result:await T()})):V.fromPromise(async()=>({mode:"update",result:await j(s.command,s.options)})),D=s=>{let e=s.args[0];if(e===void 0)return a.ok({mode:"show"});let o=["sync","patch","minor","major"],n,l;o.includes(e)?n=e:(n="explicit",l=e);let c=s.flags["dry-run"]===!0;return a.ok({mode:"update",command:n,options:{dryRun:c,explicitVersion:l}})},W=s=>{if(a.isFail(s))return a.fail({exitCode:1,message:String(s.error)});let e=s.value;if(e.mode==="show")return console.table(e.result.packages),a.ok(void 0);let{result:o}=e;o.command==="sync"?i.info(d,"Syncing all versions..."):o.command==="explicit"?i.info(d,`Setting all versions to ${o.targetVersion}...`):i.info(d,`Bumping all versions (${o.command})...`),i.info(d,`Target version: ${o.targetVersion}`),console.table(o.updates);for(let n of o.fileUpdates)n.changed&&i.info(d,`${n.path} (${n.from} \u2192 ${n.to})`);return o.dryRun?i.info(d,`Dry run - ${o.changedCount} packages would be modified.`):i.success(d,`Done. Updated ${o.changedCount} packages.`),a.ok(void 0)},q=O.createTrigger({handler:H,adaptInput:D,adaptOutput:W}),ee=async s=>{let e=k(s??[],{boolean:["dry-run"]}),o=U("versions",e);return await q(o)};export{I as a,T as b,j as c,H as d,q as e,ee as f};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as s}from"./chunk-HVQK35SO.js";var l=[/^<{7}\s/,/^={7}$/,/^>{7}\s/],i=s({name:"validate-merge-conflict",description:"Detect merge conflict markers",canFix:!1,stacks:[],defaults:{},checkFile(a,o){if(o===void 0)return[];let r=[],e=o.split(`
2
+ import{a as s}from"./chunk-VJSHVZ7R.js";var l=[/^<{7}\s/,/^={7}$/,/^>{7}\s/],i=s({name:"validate-merge-conflict",description:"Detect merge conflict markers",canFix:!1,stacks:[],defaults:{},checkFile(a,o){if(o===void 0)return[];let r=[],e=o.split(`
3
3
  `);for(let t=0;t<e.length;t++)for(let n of l)if(n.test(e[t])){r.push({path:a.path,line:t+1,message:`merge conflict marker: ${e[t].slice(0,20)}`});break}return r}}),f=i.run,u=i.validator,d=i.main;export{i as a,f as b,u as c,d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-HVQK35SO.js";var n=r({name:"validate-eof",description:"Ensure files end with exactly one newline",canFix:!0,stacks:[],defaults:{},checkFile(i,e){return e===void 0?[]:e.length===0?[]:e.endsWith(`
2
+ import{a as r}from"./chunk-VJSHVZ7R.js";var n=r({name:"validate-eof",description:"Ensure files end with exactly one newline",canFix:!0,stacks:[],defaults:{},checkFile(i,e){return e===void 0?[]:e.length===0?[]:e.endsWith(`
3
3
  `)?e.endsWith(`
4
4
 
5
5
  `)?[{path:i.path,message:"file has multiple trailing newlines"}]:[]:[{path:i.path,message:"file does not end with a newline"}]},fixFile(i,e){if(e.length===0)return;let t=`${e.replace(/\n+$/,"")}
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{b as F,c as p}from"./chunk-KHBIOZJE.js";import{a as g,c as h}from"./chunk-JTSRGXS4.js";import{o as c}from"./chunk-4TTJVJEI.js";import{a as x}from"./chunk-MG65QJY6.js";import{g as d}from"./chunk-FFWPJP7A.js";var{ctx:m,output:E}=g(),b=e=>{let y=async s=>{let i={root:s?.root??".",fix:s?.fix??!1,exclude:s?.exclude??[],...e.defaults,...s},r=s?._changedFiles,t={root:i.root,extensions:e.extensions,exclude:i.exclude,includeOnly:r!==void 0&&r.length>0?r:void 0},l=await F(t),n=[],u=[];if(e.checkAll!==void 0){let o=await e.checkAll(l,i);n.push(...o)}else if(e.checkFile!==void 0)for(let o of l){let a=await p(o),f=e.checkFile(o,a,i);n.push(...f)}if(i.fix&&e.canFix&&e.fixFile!==void 0)for(let o of l){let a=await p(o);if(a===void 0)continue;let f=e.fixFile(o,a,i);f!==void 0&&u.push(f)}return{name:e.name,issues:n,mutations:u,filesChecked:l.length}},k={name:e.name,description:e.description,requiredStacks:e.stacks,async validate(s){let i=s.options?.fix,r=s.options??{},t=await y({root:s.root,fix:i??!1,exclude:[],...r});return{name:e.name,passed:t.issues.length===0,issues:t.issues.map(l=>({severity:"error",message:`${l.message}${l.fixed?" (fixed)":""}`,file:l.path,line:l.line})),stats:{filesChecked:t.filesChecked,issuesFound:t.issues.length,fixedCount:t.mutations.length}}}},T=async s=>{let i=e.canFix&&s.flags.fix===!0,r=s.flags.root??".",t=s.flags.exclude,l=t!==void 0?Array.isArray(t)?t:[t]:[];try{let n=await y({root:r,fix:i,exclude:l});if(n.mutations.length>0){let{writeMutations:o}=await import("./file-tools-shared-YKDNDDHR.js"),a=await o(n.mutations);c.success(m,`Fixed ${a} file(s) for ${e.name}.`)}if(n.issues.length===0&&n.mutations.length===0)return c.success(m,`${e.name}: ${n.filesChecked} files checked, no issues.`),d.ok(void 0);let u=n.issues.filter(o=>!o.fixed);if(u.length>0){for(let o of u){let a=o.line!==void 0?`${o.path}:${o.line}`:o.path;c.error(m,`${a}: ${o.message}`)}return d.fail({exitCode:1})}return d.ok(void 0)}catch(n){return c.error(m,n instanceof Error?n.message:String(n)),d.fail({exitCode:1})}};return{config:e,run:y,validator:k,main:async s=>{let i=e.canFix?["fix"]:[],r=x(s??[],{boolean:[...i,"help"],string:["root","exclude"],alias:{h:"help"}});if(r.help)return console.log(`eser codebase ${e.name} \u2014 ${e.description}
2
+ import{b as F,c as p}from"./chunk-BVIGTD2Z.js";import{a as g,c as h}from"./chunk-PZUDTTK4.js";import{o as c}from"./chunk-5GGWX7CO.js";import{a as x}from"./chunk-MG65QJY6.js";import{g as d}from"./chunk-FFWPJP7A.js";var{ctx:m,output:E}=g(),b=e=>{let y=async s=>{let i={root:s?.root??".",fix:s?.fix??!1,exclude:s?.exclude??[],...e.defaults,...s},r=s?._changedFiles,t={root:i.root,extensions:e.extensions,exclude:i.exclude,includeOnly:r!==void 0&&r.length>0?r:void 0},l=await F(t),n=[],u=[];if(e.checkAll!==void 0){let o=await e.checkAll(l,i);n.push(...o)}else if(e.checkFile!==void 0)for(let o of l){let a=await p(o),f=e.checkFile(o,a,i);n.push(...f)}if(i.fix&&e.canFix&&e.fixFile!==void 0)for(let o of l){let a=await p(o);if(a===void 0)continue;let f=e.fixFile(o,a,i);f!==void 0&&u.push(f)}return{name:e.name,issues:n,mutations:u,filesChecked:l.length}},k={name:e.name,description:e.description,requiredStacks:e.stacks,async validate(s){let i=s.options?.fix,r=s.options??{},t=await y({root:s.root,fix:i??!1,exclude:[],...r});return{name:e.name,passed:t.issues.length===0,issues:t.issues.map(l=>({severity:"error",message:`${l.message}${l.fixed?" (fixed)":""}`,file:l.path,line:l.line})),stats:{filesChecked:t.filesChecked,issuesFound:t.issues.length,fixedCount:t.mutations.length}}}},T=async s=>{let i=e.canFix&&s.flags.fix===!0,r=s.flags.root??".",t=s.flags.exclude,l=t!==void 0?Array.isArray(t)?t:[t]:[];try{let n=await y({root:r,fix:i,exclude:l});if(n.mutations.length>0){let{writeMutations:o}=await import("./file-tools-shared-IIW7WSUM.js"),a=await o(n.mutations);c.success(m,`Fixed ${a} file(s) for ${e.name}.`)}if(n.issues.length===0&&n.mutations.length===0)return c.success(m,`${e.name}: ${n.filesChecked} files checked, no issues.`),d.ok(void 0);let u=n.issues.filter(o=>!o.fixed);if(u.length>0){for(let o of u){let a=o.line!==void 0?`${o.path}:${o.line}`:o.path;c.error(m,`${a}: ${o.message}`)}return d.fail({exitCode:1})}return d.ok(void 0)}catch(n){return c.error(m,n instanceof Error?n.message:String(n)),d.fail({exitCode:1})}};return{config:e,run:y,validator:k,main:async s=>{let i=e.canFix?["fix"]:[],r=x(s??[],{boolean:[...i,"help"],string:["root","exclude"],alias:{h:"help"}});if(r.help)return console.log(`eser codebase ${e.name} \u2014 ${e.description}
3
3
  `),console.log(`Usage: eser codebase ${e.name} [options]
4
4
  `),console.log("Options:"),e.canFix&&console.log(" --fix Auto-fix issues"),console.log(" --root <dir> Root directory (default: .)"),console.log(" --exclude <p> Exclude pattern"),console.log(" -h, --help Show this help"),d.ok(void 0);let t=h(e.name,r);return await T(t)}}};export{b as a};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import{j as g}from"./chunk-6DBKPC2O.js";import{m as x}from"./chunk-6G6UVWJN.js";import{d as A}from"./chunk-5WJ6AUNY.js";var D={};A(D,{CommandBuilder:()=>p,CommandError:()=>u,ProcessGroup:()=>f,exec:()=>b,parseCommand:()=>h,spawnPty:()=>T});var u=class extends Error{constructor(e,n,s,i){super(e);this.command=n;this.code=s;this.stderr=i;this.name="CommandError"}};var m=new TextDecoder,p=class r{#t;#r;#e;constructor(t,e=[],n={}){this.#t=t,this.#r=e,this.#e={throwOnError:!0,stdout:"piped",stderr:"piped",...n}}cwd(t){return new r(this.#t,this.#r,{...this.#e,cwd:t})}env(t,e){let n=this.#e.env??{},s;return typeof t=="string"&&e!==void 0?s={...n,[t]:e}:t!==null&&typeof t=="object"?s={...n,...t}:s=n,new r(this.#t,this.#r,{...this.#e,env:s})}stdin(t){return new r(this.#t,this.#r,{...this.#e,stdin:t})}stdout(t){return new r(this.#t,this.#r,{...this.#e,stdout:t})}stderr(t){return new r(this.#t,this.#r,{...this.#e,stderr:t})}timeout(t){return new r(this.#t,this.#r,{...this.#e,timeout:t})}noThrow(){return new r(this.#t,this.#r,{...this.#e,throwOnError:!1})}quiet(){return new r(this.#t,this.#r,{...this.#e,stdout:"null",stderr:"null"})}printCommand(){let t=[this.#t,...this.#r].join(" ");return console.log(`$ ${t}`),this}async spawn(){let{runtime:t}=g,e=await t.exec.spawn(this.#t,this.#r,{cwd:this.#e.cwd,env:this.#e.env,stdin:this.#e.stdin,stdout:this.#e.stdout,stderr:this.#e.stderr});if(!e.success&&this.#e.throwOnError===!0){let n=m.decode(e.stderr);throw new u(`Command failed with exit code ${e.code}: ${this.#t}`,this.#t,e.code,n)}return e}async text(t="stdout"){let e=await this.spawn();switch(t){case"stdout":return m.decode(e.stdout).trim();case"stderr":return m.decode(e.stderr).trim();case"combined":return(m.decode(e.stdout)+m.decode(e.stderr)).trim()}}async json(){let t=await this.text();return JSON.parse(t)}async lines(){let t=await this.text();return t===""?[]:t.split(`
3
+ `)}async bytes(){return(await this.spawn()).stdout}async code(){return(await this.noThrow().spawn()).code}pipe(t){return new w([this,t])}child(){let{runtime:t}=g;return t.exec.spawnChild(this.#t,this.#r,{cwd:this.#e.cwd,env:this.#e.env,stdin:this.#e.stdin??"piped",stdout:this.#e.stdout??"piped",stderr:this.#e.stderr??"piped"})}},w=class r{#t;constructor(t){this.#t=t}pipe(t){return new r([...this.#t,t])}async text(){let t="";for(let e of this.#t){let n=await e.spawn();t=m.decode(n.stdout)}return t.trim()}async lines(){let t=await this.text();return t===""?[]:t.split(`
4
+ `)}};var h=(r,t)=>{let e=[];for(let s=0;s<r.length;s++){let i=r[s];if(i!==void 0&&e.push(i),s<t.length){let d=t[s];Array.isArray(d)?e.push(d.map(c=>S(String(c))).join(" ")):d!=null&&e.push(S(String(d)))}}let n=e.join("").trim();return B(n)},S=r=>/[\s"'\\$`]/.test(r)?`'${r.replace(/'/g,"'\\''")}'`:r,B=r=>{let t=[],e="",n=!1,s=!1,i=!1;for(let c=0;c<r.length;c++){let a=r[c];if(i){e+=a,i=!1;continue}if(a==="\\"){i=!0;continue}if(a==="'"&&!s){n=!n;continue}if(a==='"'&&!n){s=!s;continue}if(a===" "&&!n&&!s){e.length>0&&(t.push(e),e="");continue}e+=a}e.length>0&&t.push(e);let d=t[0];return d===void 0?["",[]]:[d,t.slice(1)]};var b=(r,...t)=>{let[e,n]=h(r,t);return new p(e,n)};var I=/\x04/g,M=/^Script (started|done),? ?(output file is )?[^\n]*\n?/gm,k=/^script: tcgetattr[^\n]*\n?/gm,$=r=>r.replace(I,"").replace(M,"").replace(k,""),L=(r,t)=>{let e=x();if(e==="darwin"){let n=t.map(i=>`'${i.replace(/'/g,"'\\''")}'`);return{cmd:"sh",args:["-c",`script -q /dev/null ${[r,...n].join(" ")} 2>/dev/null`],usesScript:!0}}return e==="linux"?{cmd:"sh",args:["-c",`script -qc '${(t.length>0?`${r} ${t.map(s=>`'${s.replace(/'/g,"'\\''")}'`).join(" ")}`:r).replace(/'/g,"'\\''")}' /dev/null 2>/dev/null`],usesScript:!0}:{cmd:r,args:t,usesScript:!1}},T=async r=>{let{runtime:t}=g,e=r.args!==void 0?[...r.args]:[],n=L(r.command,e),s={...r.env,TERM:"xterm-256color",COLUMNS:String(r.cols??80),LINES:String(r.rows??24)},i=t.exec.spawnChild(n.cmd,[...n.args],{cwd:r.cwd,env:s,stdin:"piped",stdout:"piped",stderr:"piped"}),d=new TextDecoder,c=new TextEncoder,a=[],C=!1,R=o=>{let l=n.usesScript?$(o):o;if(l.length!==0)for(let y of a)y(l)},v=async o=>{let l=o.getReader();try{for(;;){let{done:y,value:E}=await l.read();if(y)break;R(d.decode(E))}}catch{}finally{l.releaseLock()}},O=()=>{C||(C=!0,i.stdout&&v(i.stdout),i.stderr&&v(i.stderr))},P=null;return i.stdin&&(P=i.stdin.getWriter()),{onData(o){a.push(o),O()},write(o){P?.write(c.encode(o)).catch(()=>{})},resize(o,l){},kill(o){try{i.kill(o==="SIGKILL"?"SIGKILL":"SIGTERM")}catch{}},get pid(){return i.pid},get exitCode(){return i.status.then(o=>o.code)}}};var f=class{#t=new Map;get size(){return this.#t.size}add(t,e){let n={id:t,process:e,active:!0};return this.#t.set(t,n),e.exitCode.then(()=>{n.active=!1}).catch(()=>{n.active=!1}),n}get(t){return this.#t.get(t)}remove(t){let e=this.#t.get(t);return e===void 0?!1:(e.active&&e.process.kill(),this.#t.delete(t),!0)}list(){return[...this.#t.values()]}async killAll(t="SIGTERM"){for(let s of this.#t.values())s.active&&s.process.kill(t);let e=3e3,n=Date.now();for(let s of this.#t.values())if(s.active){let i=e-(Date.now()-n);i>0&&await Promise.race([s.process.exitCode,new Promise(d=>setTimeout(d,i))])}}forceKillAll(){for(let t of this.#t.values())t.active&&(t.process.kill("SIGKILL"),t.active=!1);this.#t.clear()}};export{u as a,p as b,h as c,b as d,T as e,f,D as g};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
- import{d as a,f as g}from"./chunk-3D5TBTM3.js";import{b as i}from"./chunk-NBA6EFWU.js";import{i as s}from"./chunk-6DBKPC2O.js";var u=async(n=".")=>{let[t,r]=await g(n);return r.map(e=>({name:e.name,version:e.version,path:a(e.config),config:e.config,entrypoints:c(e.config)}))},c=n=>{let t=n.exports?.value;if(t==null)return[];if(typeof t=="string")return[t];if(t!==null&&typeof t=="object"){let r=[];for(let e of Object.values(t))typeof e=="string"&&r.push(e);return r}return[]},d=(n,t)=>s.path.isAbsolute(n)?n:s.path.resolve(t,n),k=async n=>{let t=[];for await(let r of s.fs.walk(n,{exts:i,includeDirs:!1,skip:[/node_modules/,/\.git/]})){let e=s.path.relative(n,r.path),o=s.path.basename(e);o.endsWith("_test.ts")||o.endsWith("_bench.ts")||o.startsWith("_")||e.includes("testdata/")||t.push(`./${e}`)}return t.sort()};export{u as a,d as b,k as c};
2
+ import{d as a,f as g}from"./chunk-HTC2FO4I.js";import{b as i}from"./chunk-NBA6EFWU.js";import{i as s}from"./chunk-6DBKPC2O.js";var u=async(n=".")=>{let[t,r]=await g(n);return r.map(e=>({name:e.name,version:e.version,path:a(e.config),config:e.config,entrypoints:c(e.config)}))},c=n=>{let t=n.exports?.value;if(t==null)return[];if(typeof t=="string")return[t];if(t!==null&&typeof t=="object"){let r=[];for(let e of Object.values(t))typeof e=="string"&&r.push(e);return r}return[]},d=(n,t)=>s.path.isAbsolute(n)?n:s.path.resolve(t,n),k=async n=>{let t=[];for await(let r of s.fs.walk(n,{exts:i,includeDirs:!1,skip:[/node_modules/,/\.git/]})){let e=s.path.relative(n,r.path),o=s.path.basename(e);o.endsWith("_test.ts")||o.endsWith("_bench.ts")||o.startsWith("_")||e.includes("testdata/")||t.push(`./${e}`)}return t.sort()};export{u as a,d as b,k as c};