noskills 4.1.55 → 4.5.0

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 (188) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +106 -58
  3. package/chunks/ajan-bridge-T5M4DPDT.js +1 -0
  4. package/chunks/anthropic-TS7EMQML.js +1 -0
  5. package/chunks/approve-HEW3VFYH.js +1 -0
  6. package/chunks/ask-AXHTCVD6.js +2 -0
  7. package/chunks/block-VN76CXZW.js +1 -0
  8. package/chunks/{browser-XLYVEO2J.js → browser-BGFD24RX.js} +1 -1
  9. package/chunks/bun-WZ7BVR7Y.js +1 -0
  10. package/chunks/cancel-7WRAST62.js +1 -0
  11. package/chunks/chunk-3ZJ3UGQL.js +48 -0
  12. package/chunks/chunk-4PF2MT7S.js +29 -0
  13. package/chunks/chunk-575Y3OEG.js +1 -0
  14. package/chunks/{chunk-DZTBXXB3.js → chunk-5DZHAHXW.js} +23 -23
  15. package/chunks/chunk-5PBNUBBY.js +3 -0
  16. package/chunks/{chunk-HNAHPI6V.js → chunk-5RLCKUIF.js} +1 -1
  17. package/chunks/chunk-6YSS6PEL.js +3 -0
  18. package/chunks/chunk-7GC46XEU.js +1 -0
  19. package/chunks/{chunk-LBPD4EIH.js → chunk-7PPUGTKL.js} +1 -1
  20. package/chunks/chunk-AUZWXMWA.js +27 -0
  21. package/chunks/chunk-CH6A3LES.js +91 -0
  22. package/chunks/{chunk-UG26APX2.js → chunk-CML74SNT.js} +1 -1
  23. package/chunks/chunk-CTTMQSHF.js +1 -0
  24. package/chunks/chunk-DBKXMYLF.js +4 -0
  25. package/chunks/chunk-DEHRWREM.js +1 -0
  26. package/chunks/chunk-EIGFDYGQ.js +1 -0
  27. package/chunks/chunk-EIMBEXUJ.js +1 -0
  28. package/chunks/chunk-EJYSOUEA.js +1 -0
  29. package/chunks/chunk-ENP4P2YH.js +0 -0
  30. package/chunks/{chunk-RJX4ZXQ4.js → chunk-EROZRDGT.js} +1 -1
  31. package/chunks/chunk-FE4MKOI4.js +1 -0
  32. package/chunks/chunk-GQTHILPL.js +5 -0
  33. package/chunks/chunk-HISXAZ4Y.js +1 -0
  34. package/chunks/chunk-I4Z2RF7L.js +31 -0
  35. package/chunks/chunk-IFE5SYGK.js +1 -0
  36. package/chunks/chunk-IGDFEGCH.js +2 -0
  37. package/chunks/chunk-JL3MAFYQ.js +1 -0
  38. package/chunks/chunk-JYVB6UAV.js +1 -0
  39. package/chunks/chunk-KJLEPI7T.js +1 -0
  40. package/chunks/chunk-KM64FL2X.js +1 -0
  41. package/chunks/chunk-KMLNG3EC.js +1 -0
  42. package/chunks/chunk-KRKOWSYW.js +148 -0
  43. package/chunks/chunk-KRRPOVQG.js +1 -0
  44. package/chunks/{chunk-CKETVOVQ.js → chunk-LJEWPIEI.js} +1 -1
  45. package/chunks/{chunk-VAP3TSYK.js → chunk-LN4NDYT6.js} +1 -1
  46. package/chunks/{chunk-Z3O5HAIO.js → chunk-NGCBWJML.js} +1 -1
  47. package/chunks/chunk-O4KKKYCH.js +1 -0
  48. package/chunks/chunk-OAWYVETM.js +1 -0
  49. package/chunks/chunk-PKEQKXZW.js +23 -0
  50. package/chunks/chunk-PRQ5CRIG.js +1 -0
  51. package/chunks/{chunk-SWYX6WYQ.js → chunk-PSX63TYP.js} +2 -2
  52. package/chunks/{chunk-5P46WSNG.js → chunk-Q4TI7EYT.js} +1 -1
  53. package/chunks/chunk-QKWJ72HI.js +3 -0
  54. package/chunks/chunk-RAQY37P6.js +1 -0
  55. package/chunks/{openai-QGEN33SU.js → chunk-S4MUTKHT.js} +3 -3
  56. package/chunks/chunk-SLO22P65.js +1 -0
  57. package/chunks/chunk-UE56BMAW.js +21 -0
  58. package/chunks/{chunk-O2NUECRA.js → chunk-VJRCTYGL.js} +1 -1
  59. package/chunks/chunk-VXU6XZ66.js +39 -0
  60. package/chunks/chunk-W4TQLLUK.js +7 -0
  61. package/chunks/{chunk-PKYW3S5P.js → chunk-XDRX4ZBJ.js} +1 -1
  62. package/chunks/{chunk-XNGHRJVK.js → chunk-Y5E7ZCCX.js} +1 -1
  63. package/chunks/chunk-Z7OYXH3J.js +1 -0
  64. package/chunks/claude-code-DIWRQKZA.js +1 -0
  65. package/chunks/cmd-46ZIHXLB.js +1 -0
  66. package/chunks/concern-QSENGU6C.js +1 -0
  67. package/chunks/{config-CZDLCSOC.js → config-S3UXTJN2.js} +1 -1
  68. package/chunks/decision-ledger-GY2W6VWL.js +1 -0
  69. package/chunks/delegate-WKXIER7E.js +1 -0
  70. package/chunks/deno-YM5PW6ZM.js +1 -0
  71. package/chunks/{diagrams-H7NLJF7W.js → diagrams-A7W2EBYV.js} +1 -1
  72. package/chunks/diagrams-CBCUA47B.js +1 -0
  73. package/chunks/{dist-UI3SRKS3.js → dist-3MH5UCQU.js} +3 -3
  74. package/chunks/done-WR3UFYJT.js +1 -0
  75. package/chunks/followup-5EGZEF5Q.js +1 -0
  76. package/chunks/free-KJQHRYZA.js +1 -0
  77. package/chunks/gemini-IWP24T63.js +1 -0
  78. package/chunks/init-437SU6XH.js +1 -0
  79. package/chunks/invoke-hook-LMCWNF65.js +13 -0
  80. package/chunks/kiro-THWCXS5L.js +1 -0
  81. package/chunks/{learn-KIZTV5OH.js → learn-ZTYKBZER.js} +1 -1
  82. package/chunks/ledger-FOOPJ2UO.js +1 -0
  83. package/chunks/list-HNGIOVBK.js +1 -0
  84. package/chunks/loader-command-3A5FK2RF.js +1 -0
  85. package/chunks/loader-reactor-YZM7HO4G.js +1 -0
  86. package/chunks/manager-2MOLEJ4Q.js +3 -0
  87. package/chunks/mod-6EZYRKWV.js +1 -0
  88. package/chunks/{mod-TYCXSLSH.js → mod-7VTKN6Q5.js} +1 -1
  89. package/chunks/mod-7X5TKHKC.js +1 -0
  90. package/chunks/mod-AJIRKRAH.js +1 -0
  91. package/chunks/mod-SFSUQWSB.js +8 -0
  92. package/chunks/mod-TGOMO3CJ.js +1 -0
  93. package/chunks/{multipart-parser-UVM6CEKF.js → multipart-parser-DKDFOZKD.js} +1 -1
  94. package/chunks/next-Y6FOPM4Z.js +15 -0
  95. package/chunks/node-AZK2C657.js +12 -0
  96. package/chunks/node-GQQ42DT2.js +68 -0
  97. package/chunks/node-J4GTOSL2.js +1 -0
  98. package/chunks/ollama-2KAMCXVL.js +1 -0
  99. package/chunks/openai-HHE35TAX.js +31 -0
  100. package/chunks/openai-YES2XJDU.js +1 -0
  101. package/chunks/opencode-S4M7WJTO.js +1 -0
  102. package/chunks/{pack-33LQ7SJT.js → pack-KUT53Z24.js} +4 -4
  103. package/chunks/plan-export-PG2BVRQZ.js +3 -0
  104. package/chunks/purge-JGNJNEET.js +4 -0
  105. package/chunks/reopen-RPDXN3CF.js +1 -0
  106. package/chunks/reset-RBCQO2RF.js +1 -0
  107. package/chunks/review-VMS5MYOV.js +1 -0
  108. package/chunks/{rule-XREVPB5P.js → rule-IB4VKSBC.js} +2 -2
  109. package/chunks/run-62PWXVII.js +3 -0
  110. package/chunks/sdk-FR7Z4YSC.js +1 -0
  111. package/chunks/{session-HBP5GGI2.js → session-Q43KMFL2.js} +1 -1
  112. package/chunks/spec-4RKLPOEM.js +1 -0
  113. package/chunks/{src-GLQPTDNR.js → src-HXQVVTGQ.js} +1 -1
  114. package/chunks/status-OGLFEFF7.js +1 -0
  115. package/chunks/sync-H35O5DN5.js +1 -0
  116. package/chunks/{unstable_chmod-RZ5DE3XZ.js → unstable_chmod-44MCKF3B.js} +1 -1
  117. package/chunks/validate-JX7UTAK5.js +1 -0
  118. package/chunks/vertexai-WF5CKMYI.js +1 -0
  119. package/chunks/watch-SOZDHLSC.js +8 -0
  120. package/chunks/web-3VGRM3W4.js +1 -0
  121. package/chunks/wontfix-RBOGLLWJ.js +1 -0
  122. package/chunks/workerd-I7MLRCLJ.js +1 -0
  123. package/noskills.js +1 -1
  124. package/package.json +2 -2
  125. package/chunks/anthropic-LDUWIUPL.js +0 -1
  126. package/chunks/approve-73ZFRV7E.js +0 -1
  127. package/chunks/ask-VGI3BFZW.js +0 -2
  128. package/chunks/block-5APPOQQK.js +0 -1
  129. package/chunks/bun-5VMFSLLY.js +0 -1
  130. package/chunks/cancel-ZYRZPFRH.js +0 -1
  131. package/chunks/chunk-2GF5IUQD.js +0 -39
  132. package/chunks/chunk-2N4GTHXQ.js +0 -1
  133. package/chunks/chunk-5CNPFLE6.js +0 -1
  134. package/chunks/chunk-5MN3MWQN.js +0 -1
  135. package/chunks/chunk-65A35QPF.js +0 -1
  136. package/chunks/chunk-7UX6WIXX.js +0 -1
  137. package/chunks/chunk-AGPCY6XP.js +0 -1
  138. package/chunks/chunk-AGWPQX43.js +0 -31
  139. package/chunks/chunk-AP3YBNPX.js +0 -1
  140. package/chunks/chunk-D3IKJ7FF.js +0 -1
  141. package/chunks/chunk-EKZXJCT7.js +0 -5
  142. package/chunks/chunk-H77MLIL5.js +0 -4
  143. package/chunks/chunk-JVCVWI3B.js +0 -3
  144. package/chunks/chunk-OLM5RTFK.js +0 -1
  145. package/chunks/chunk-OTRBRRIO.js +0 -1
  146. package/chunks/chunk-U5SHLIO4.js +0 -3
  147. package/chunks/chunk-UT6ZCLRA.js +0 -1
  148. package/chunks/chunk-XS5JHAC7.js +0 -1
  149. package/chunks/chunk-XXBSEOQR.js +0 -148
  150. package/chunks/chunk-YSLRAWBK.js +0 -1
  151. package/chunks/chunk-YSSDQJTT.js +0 -91
  152. package/chunks/chunk-YTNM7A5Y.js +0 -3
  153. package/chunks/claude-code-BWCSAVK2.js +0 -1
  154. package/chunks/cmd-ZXO6KFK6.js +0 -1
  155. package/chunks/concern-RB444PUE.js +0 -1
  156. package/chunks/delegate-QBPFR44C.js +0 -1
  157. package/chunks/deno-QOH6TCLQ.js +0 -1
  158. package/chunks/diagrams-I2QKL7WR.js +0 -1
  159. package/chunks/done-Z2MFKQ45.js +0 -1
  160. package/chunks/followup-JR63B3JS.js +0 -1
  161. package/chunks/free-R4ZTZ76O.js +0 -1
  162. package/chunks/gemini-YR5KT32S.js +0 -1
  163. package/chunks/init-F7JCAPQS.js +0 -1
  164. package/chunks/invoke-hook-CGV6UHU7.js +0 -13
  165. package/chunks/kiro-RGYUKJAX.js +0 -3
  166. package/chunks/list-6EQP6VUL.js +0 -1
  167. package/chunks/manager-R5KNPWLT.js +0 -6
  168. package/chunks/mod-A77UWGGG.js +0 -1
  169. package/chunks/next-J2YKXUKA.js +0 -7
  170. package/chunks/node-3FTYLC7H.js +0 -67
  171. package/chunks/node-BPWE6I45.js +0 -1
  172. package/chunks/ollama-LTZ43OHQ.js +0 -3
  173. package/chunks/openai-Y74OQTVB.js +0 -23
  174. package/chunks/opencode-PZDL7VDP.js +0 -1
  175. package/chunks/purge-G22VY6CI.js +0 -4
  176. package/chunks/reopen-JTFZBGHT.js +0 -1
  177. package/chunks/reset-AW2IS3F6.js +0 -1
  178. package/chunks/review-EESYDNMA.js +0 -1
  179. package/chunks/run-K7FAF7RR.js +0 -3
  180. package/chunks/sdk-6IMATOQ3.js +0 -40
  181. package/chunks/spec-5B3HC5PT.js +0 -1
  182. package/chunks/status-CQ4U3KBF.js +0 -1
  183. package/chunks/sync-TJLHMISX.js +0 -1
  184. package/chunks/vertexai-RUXZ24C2.js +0 -1
  185. package/chunks/watch-WCX4YBL5.js +0 -8
  186. package/chunks/web-PEDL6264.js +0 -1
  187. package/chunks/wontfix-7JMQAMWG.js +0 -1
  188. package/chunks/workerd-IIQRIOBX.js +0 -1
@@ -0,0 +1,21 @@
1
+ import{d as ce,e as le}from"./chunk-XDRX4ZBJ.js";import{c as de}from"./chunk-IFE5SYGK.js";import{b as z,c as ie}from"./chunk-VJRCTYGL.js";import{f as G}from"./chunk-PKEQKXZW.js";import{a as X,d as _,e as Y,g as se,h as K,i as oe,j as re}from"./chunk-O4KKKYCH.js";import{a as j,f as ae}from"./chunk-KRKOWSYW.js";import{i as B}from"./chunk-Y5E7ZCCX.js";var Q={detected:!1,reason:"",proposals:[]},xe=[/\badditionally\b/i,/\bseparately\b/i,/\band also\b/i,/\banother issue\b/i,/\bsecond problem\b/i,/\bon the other hand\b/i,/\bplus\b/i],ue=/(?:^|[.!?]\s+)also[,\s]/im,Re=/(?:^|\n|\.\s+)\s*(?:\(\d+\)|\d+\.\s|(?:first|second|third|fourth|fifth)[:;,])/im,ke=/\b(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert)\s+\S+(?:\s+\S+){0,4}\s+AND\s+(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert)\s+/i,De=[/\buse\s+(?:the\s+)?(?:new\s+)?(\w+)\s+(?:type|interface|class|module|function)\b/i,/\bafter\s+(?:adding|creating|implementing)\b/i,/\bdepends\s+on\b/i,/\bprerequisite\b/i,/\brequires\s+(?:the\s+)?(?:above|previous|first)\b/i,/\bthen\s+use\b/i],me=(e,t)=>{if(t==="ship-fast")return Q;let n=new Map;for(let m of e)n.set(m.questionId,m.answer);let r=n.get("status_quo")??"",s=n.get("ambition")??"",o=n.get("scope_boundary")??"",i=n.get("verification")??"",l=Ce(r,s,o,i);return l.length<2||l.reduce((m,w)=>m+w.estimatedTasks,0)<=3||Le(l)?Q:{detected:!0,reason:`Discovery answers cover ${l.length} independent areas that could be separate specs.`,proposals:l}},Ce=(e,t,n,r)=>{let s=Ie(e,t);if(s.length>=2)return s.map(J);let o=Oe(e,t);if(o.length>=2)return o.map(J);let i=Te(e,t);return i.length>=2?i.map(J):[]},Ie=(e,t)=>{for(let[n,r]of[[e,"status_quo"],[t,"ambition"]]){if(!Re.test(n))continue;let s=Pe(n);if(s.length>=2)return s.map(o=>({text:o.trim(),sourceQuestions:[r]}))}return[]},Pe=e=>{let n=e.split(/\(\d+\)\s*/).slice(1).map(p=>p.trim()).filter(p=>p.length>0);if(n.length>=2)return n;let r=e.split(/(?:^|\n|(?<=\.)\s+)\s*\d+\.\s+/),s=r.length>1?r.slice(1).map(p=>p.trim()).filter(p=>p.length>0):[];if(s.length>=2)return s;let o=/(?:^|\n|(?<=\.)\s+)\s*(?:first|second|third|fourth|fifth)[:;,]\s*/i,i=e.split(o),l=i.length>1?i.slice(1).map(p=>p.trim()).filter(p=>p.length>0):[];return l.length>=2?l:[]},Oe=(e,t)=>{for(let[n,r]of[[e,"status_quo"],[t,"ambition"]]){if(ue.test(n)){let s=Ae(n,ue);if(s.length>=2)return s.map(o=>({text:o.trim(),sourceQuestions:[r]}))}for(let s of xe)if(s.test(n)){let o=n.split(s).map(i=>i.trim()).filter(i=>i.length>0);if(o.length>=2)return o.map(i=>({text:i,sourceQuestions:[r]}))}}return[]},Ae=(e,t)=>{let n=e.match(t);if(n===null||n.index===void 0)return[];let r=e.slice(0,n.index).trim(),s=e.slice(n.index+n[0].length).trim();return r.length>0&&s.length>0?[r,s]:[]},Te=(e,t)=>{for(let[n,r]of[[e,"status_quo"],[t,"ambition"]]){let s=ke.exec(n);if(s!==null&&s.index!==void 0){let o=n.toUpperCase().indexOf(" AND ",s.index);if(o>=0){let i=n.slice(0,o).trim(),l=n.slice(o+5).trim();if(i.length>0&&l.length>0)return[{text:i,sourceQuestions:[r]},{text:l,sourceQuestions:[r]}]}}}return[]},J=e=>{let t=Ne(e.text),n=Fe(e.text);return{name:t,description:e.text,estimatedTasks:n,relevantAnswers:[...e.sourceQuestions]}},Ne=e=>{let t=new Set(["the","a","an","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","shall","should","may","might","must","can","could","to","of","in","for","on","with","at","by","from","that","this","it","its","and","or","but","not","no","so","if","then","too","very","just"]),s=e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").split(/\s+/).filter(o=>o.length>0&&!t.has(o)).slice(0,4).join("-").replace(/--+/g,"-").replace(/^-|-$/g,"").slice(0,50);return s.length>0?s:"area"},Fe=e=>{let t=/\b(fix|add|restore|update|remove|refactor|rewrite|implement|create|migrate|convert|replace|extract|move|rename|split|merge|test|verify|validate|configure|setup|install|deploy)\b/gi,r=e.match(t)?.length??0;return Math.max(2,Math.min(r+1,5))},Le=e=>{for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let r=e[t],s=e[n],o=`${r.description} ${s.description}`;for(let m of De)if(m.test(o))return!0;let i=pe(r.description),l=pe(s.description);if([...i].filter(m=>l.has(m)).some(m=>/^[A-Z]/.test(m)||m.includes(".")))return!0}return!1},pe=e=>{let t=new Set,n=e.match(/\b[A-Z][a-zA-Z0-9]+\b/g);if(n!==null)for(let s of n)t.add(s);let r=e.match(/\b[\w-]+\.\w{1,4}\b/g);if(r!==null)for(let s of r)t.add(s);return t};var F=e=>de(e),d=(e,t)=>F(t===null?e:`spec ${t} ${e}`),Ve=[{key:"involvesWebUI",pattern:/\b(ui|frontend|component|react|css|html|button|modal|form|page|screen|layout|design|loading state|empty state|error state)\b/i},{key:"involvesCLI",pattern:/\b(cli|terminal|command.?line|stdout|stdin|ansi|tui|console)\b/i},{key:"involvesPublicAPI",pattern:/\b(api|endpoint|rest|graphql|webhook|public.?facing|sdk|client.?library)\b/i},{key:"involvesMigration",pattern:/\b(migrat\w*|schema.?change|breaking.?change|backward.?compat|upgrade|deprecat\w*)\b/i},{key:"involvesDataHandling",pattern:/\b(pii|gdpr|encrypt|personal.?data|user.?data|data.?retention|data.?safety|sensitive)\b/i}],we=e=>{let t=[];e.specDescription&&t.push(e.specDescription);let n=e.discovery?.userContext;Array.isArray(n)&&t.push(...n);for(let o of e.discovery?.answers??[])t.push(o.answer);let r=t.join(" "),s={involvesWebUI:!1,involvesCLI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1,source:"inferred",inferredFrom:[]};for(let{key:o,pattern:i}of Ve){let l=r.match(i);l!==null&&(s[o]=!0,s.inferredFrom.push(`${o}:${l[0].toLowerCase()}`))}return s},qe=[{key:"involvesWebUI",label:"Web UI"},{key:"involvesPublicAPI",label:"Public API"},{key:"involvesCLI",label:"CLI"},{key:"involvesMigration",label:"Migration"},{key:"involvesDataHandling",label:"Data Handling"}],_e=e=>{let t=new Map;for(let r of e.inferredFrom??[]){let s=r.indexOf(":");if(s===-1)continue;let o=r.slice(0,s),i=r.slice(s+1),l=t.get(o);l===void 0?t.set(o,[i]):l.includes(i)||l.push(i)}let n=["Based on your answers, this spec involves:"];for(let{key:r,label:s}of qe){let o=e[r]===!0,i=o?"\u2713":"\u2717";if(o){let l=t.get(r)??[];if(l.length>0){let p=l.map(m=>`"${m}"`).join(", ");n.push(` ${i} ${s} (mentions: ${p})`)}else n.push(` ${i} ${s}`)}else n.push(` ${i} ${s}`)}return n.join(`
2
+ `)},We="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.",he=["Interview the user relentlessly about every aspect of this plan until you reach a shared understanding.","Walk down each branch of the design tree, resolving dependencies between decisions one-by-one.","For each question, provide your recommended answer \u2014 don't just ask, offer your informed opinion.","Ask questions ONE AT A TIME. Do not batch questions. Each question deserves its own focused exchange.","If a question can be answered by exploring the codebase, explore the codebase INSTEAD of asking. Only ask the user what the codebase cannot tell you.","You are an honest engineer. Do NOT fill placeholders with assumptions.","You are investing in this spec like a CEO invests in a product \u2014 get the details right.","You are doing academic-level due diligence \u2014 no hand-waving, no 'we'll figure it out later.'","If a section is not applicable, ask the user to confirm it's N/A with a specific reason \u2014 don't decide yourself.","If two answers conflict, surface the conflict to the user \u2014 don't resolve it yourself.","If an answer is vague, push back and ask for specifics \u2014 don't accept vague."],ee={hasAskUserTool:!0,optionPresentation:"tool",hasSubAgentDelegation:!0,subAgentMethod:"task"},Be=e=>{let t=["CEO REVIEW \u2014 PREMISE CHECK: Restate the core premise in one sentence. Does it still hold? What evidence supports it? What challenges it?","CEO REVIEW \u2014 READINESS DASHBOARD: Score 8 dimensions 1-10 (premise-clarity, reuse-leverage, test-coverage, failure-mode-coverage, boundary-clarity, unresolved-decisions, verification-path, scope-discipline). State overall score. Verdict: APPROVED or NEEDS WORK.","CEO REVIEW \u2014 REFLECTION: Honest observation of the user's decision patterns during this spec. Not flattery. If they made a questionable choice, say so respectfully."];return e==="hold-scope"?t:[...t,"CEO REVIEW \u2014 REUSE SCORE: Table of existing modules/functions reused vs new code. Calculate approximate reuse percentage. Flag if <40%.","CEO REVIEW \u2014 DREAM STATE DELTA: Current state (2-3 sentences), 12-month ideal (2-3 sentences), what this spec delivers (%), remaining gap.","CEO REVIEW \u2014 FAILURE MODE REGISTRY: Table with #, Failure, Trigger, Mitigation. Every failure mode must have concrete mitigation. Include at minimum: data corruption, race conditions, backward compat, user confusion, performance.","CEO REVIEW \u2014 NOT IN SCOPE: Explicit list of what this spec does NOT touch, with reasons. This is a contract.","CEO REVIEW \u2014 UNRESOLVED DECISIONS: Table with #, Decision, Default, Notes. Every unresolved decision must have a safe default. Present to user.","CEO REVIEW \u2014 FILE-LEVEL PLAN: Table of every file created/modified with purpose. Plus: functions to reuse, files NOT modified.",e==="scope-expansion"?"CEO REVIEW \u2014 EXPANSION TABLE: Present all accepted expansions with LOC estimates.":"CEO REVIEW \u2014 SCOPE DISCIPLINE: List what was held out of scope and why."]},Ye=e=>{let t=e.filter(r=>r.suggestsPosture!==void 0);return t.length===0?null:t.length===1?`Based on your active concerns, suggested posture: ${t[0].suggestsPosture} (${t[0].name} active).`:`Multiple concerns suggest different postures (${t.map(r=>`${r.name}: ${r.suggestsPosture}`).join(", ")}). Please select manually: a/b/c/d.`},Ge=(e,t,n,r,s,o=ee,i)=>{let l=e.execution.iteration>=t,p=o.hasAskUserTool?"Use AskUserQuestion for all decision points.":"Present options as a numbered list at every decision point.",m=[];n||m.push(We),m.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. ${p} 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.","Listen first: after spec creation, ask 'Tell me about this \u2014 share as much context as you have.' Wait for their response before mode selection. Rich context (>200 chars) \u2192 pre-fill discovery answers as STATED/INFERRED. Brief response \u2192 proceed normally.",'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 w=s?.outOfScope??[],S=e.spec;switch(e.phase){case"IDLE":{let h=o.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.",...m,h,"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.","SPEC CREATION: When user says 'create a new spec', 'new spec', or similar \u2014 do NOT run `noskills spec new` without a description. Ask the user 'What do you want to build?' via AskUserQuestion first. Wait for their response. Then run: `noskills spec new \"their full response\"`. This takes < 5 seconds. Do not overthink it.","CONCERN MANAGEMENT: When the user wants to add or view concerns, run `noskills concern list` immediately. Do NOT analyze or recommend concerns. Present the list via AskUserQuestion (multiSelect:true, max 4 per question). Use a SINGLE `noskills concern add id1 id2 id3` command for all selections."],tone:"Welcoming. Present choices, then wait."}}case"DISCOVERY":{let h=o.hasAskUserTool?"Ask each question via AskUserQuestion. One question per call.":"Ask one question at a time as text.",g=r.flatMap(a=>a.conductRules?.DISCOVERY??[]);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:[...m,"MODE: You MUST be in plan mode during discovery. Do not exit plan mode. If you are not in plan mode, enter it now (Shift+Tab or /plan).",`${h} 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?'",(()=>{let a=re(r);return`${a.length>0?`After answers, ${a.join(" Also: ")}`:"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.",...he,...g],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_REFINEMENT":{let h=r.flatMap(u=>u.conductRules?.DISCOVERY_REFINEMENT??[]),g=Z(e),a;if(g==="stage-a"){let u=Ye(r),v=i?.defaultReviewPosture!==void 0;a=["COMPLETENESS ASSESSMENT: Before presenting answers for review, evaluate the spec's completeness across 6 dimensions. Score each 1-10: problem-clarity, scope-definition, technical-feasibility, verification-strategy, risk-identification, user-impact-analysis. Identify concrete gaps (specific, not vague). Present the table and gaps to the user.","Scoring guide: 9-10 = fully addressed; 7-8 = mostly addressed; 5-6 = partially; 3-4 = weakly; 1-2 = not addressed. A gap is anything the spec doesn't explicitly address that could cause problems during execution."],u!==null&&a.push(u),v?a.push(`Using project default posture: ${i.defaultReviewPosture} (from manifest.yml). To override, answer with a/b/c/d. Answer 'clear-posture' to remove this default.`):a.push("After presenting the completeness assessment, present the 4 review posture options: (a) Selective expansion \u2014 fill gaps only, no scope drift; (b) Hold scope \u2014 surface risks but no additions; (c) Scope expansion \u2014 actively explore adjacent features; (d) Scope reduction \u2014 cut to essentials. Ask user to choose."),a.push(o.hasAskUserTool?"Use AskUserQuestion to present the completeness table and posture options together in one question.":"Present completeness table and posture options in one message. User replies with 'a', 'b', 'c', or 'd'.")}else if(g==="stage-b"){let u=e.discovery.refinement?.reviewPosture;a=[u==="selective-expansion"?"REVIEW POSTURE: Selective expansion. Hold core scope rigid. Only suggest additions that address gaps from the completeness assessment. Each suggestion must explain: what gap it fills, what goes wrong if skipped. Target: raise completeness to 9+/10 with minimal additions.":u==="hold-scope"?"REVIEW POSTURE: Hold scope. Do NOT propose any additions or changes. Surface risks as observations, not change requests. Your job is to confirm the spec is ready, not to improve it.":u==="scope-expansion"?"REVIEW POSTURE: Scope expansion. Actively look for adjacent concerns and missing features. Each expansion must ride on infrastructure already being built. Present ALL suggestions as a multi-select table with columns: Addition | Why it rides cheap | LOC estimate.":"REVIEW POSTURE: Scope reduction. Identify everything that can be deferred. For each item: what's deferred, risk of deferring, minimal viable version. Present cut list for user approval."],e.discovery.refinement?.completenessScore&&a.push("RE-ASSESSMENT: After posture-guided review is complete, re-score the 6 completeness dimensions. Show delta: what was addressed (\u2713), what remains (\u25B3). Submit updated score as JSON {completeness: {...}} before CEO review."),a.push("When posture-guided review is complete, produce the CEO REVIEW ANALYSIS (see CEO review protocol rules below). Submit it as JSON {ceoReview: {...}, reflection?: '...'} to record it."),a.push(...Be(u??"selective-expansion"))}else a=["CEO review is complete. Present the updated completeness score delta, the readiness dashboard verdict, and ask the user to advance (approve), revise, or park the spec.",o.hasAskUserTool?"Use AskUserQuestion to present: updated completeness (delta table), readiness verdict, and options: advance / revise / park.":"Present delta and verdict. User answers: approve (advance), revise (return to stage-a), or park (cancel)."];return{modeOverride:"You are in plan mode. Do not create, edit, or write any files.",rules:[...m,"DO NOT create, edit, or write any files.",...a,...he,...h],tone:g==="stage-a"?"Structured evaluator. Score honestly \u2014 do not inflate.":g==="stage-b"?"Posture-guided reviewer. Follow the posture rules exactly.":"Decisive closer. Present delta and get a final decision."}}case"SPEC_PROPOSAL":{let h=e.discovery.delegations??[],g=[];if(h.length>0){let a=h.filter(y=>y.status==="pending"),u=h.filter(y=>y.status==="answered"),v=h.map(y=>`- ${y.questionId}: delegated to ${y.delegatedTo} \u2014 ${y.status==="answered"?"ANSWERED \u2713":"PENDING"}`);g.push(`DELEGATION STATUS:
3
+ ${v.join(`
4
+ `)}${a.length>0?`
5
+ Approve BLOCKED \u2014 ${a.length} pending delegation(s).`:`
6
+ All ${u.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:[...m,...g,"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.",o.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: `"+d(`next --answer='{"refinement":"task-1: Add upload endpoint, task-2: Add validation middleware, task-3: Write integration tests"}'`,S)+"`. 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:[...m,"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.",o.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 h=d(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,S),g,a,u="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).";o.subAgentMethod==="task"?(g=`Spawn noskills-executor via Agent tool. Pass: task title, description, ACs, rules, scope constraints, concern reminders, file paths. Report via \`${h}\`.`,a=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. Never trust executor self-report alone. ${u}`):o.subAgentMethod==="spawn"?(g=`Use spawn_agent for noskills-executor. Pass: task, ACs, rules, scope, file paths. Use wait_agent to collect. Report via \`${h}\`.`,a=`After executor completes, spawn noskills-verifier with changed files + ACs + test commands. ${u}`):o.subAgentMethod==="fleet"?(g=`Use /fleet for parallel executors. Pass each: task, ACs, rules, scope, file paths. Report via \`${h}\`.`,a=`After fleet completes, run verification pass. ${u}`):o.subAgentMethod==="delegation"?(g=`Use Kiro agent delegation for noskills-executor. Pass: task, ACs, rules, scope, file paths. Report via \`${h}\`.`,a=`After executor completes, delegate to noskills-verifier with changed files + ACs + test commands. ${u}`):(g=`Execute tasks sequentially yourself. Verify (type-check + tests) after each. Report via \`${h}\`.`,a="");let v=o.subAgentMethod!=="none",y=v?`You are the orchestrator. NEVER edit files directly \u2014 delegate ALL edits to noskills-executor. ${g} On sub-agent failure, fall back to direct execution and note it in status.`:g,k=[...m,"MODE: You MUST NOT be in plan mode during execution. If you are in plan mode, exit it now. Sub-agents need full write access.",y,...a?[a]:[],"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.",...v?["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: \`${F('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.",...v?["VERIFICATION REQUIRED: After EVERY task completion, you MUST spawn noskills-verifier before reporting done. If you skip verification and self-report, the status report will flag it. No exceptions \u2014 'it looks correct' is not verification."]:["VERIFICATION REQUIRED: After EVERY task completion, run type-check + tests before reporting done. Evidence of passing tests must be included in the status report."]];e.execution.lastVerification?.passed===!1&&k.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let L={rules:k,tone:"Direct. Orchestrate immediately \u2014 spawn sub-agents.",outOfScope:w.length>0?w:void 0};return l?{...L,urgency:`${e.execution.iteration}+ iterations \u2014 context degrading. Finish current task, recommend fresh session.`}:L}case"BLOCKED":return{rules:[...m,"MODE: Enter plan mode. Analyze the blocker. Present options to the user. Do not edit files.","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:[...m,"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:[...m,`Run \`${d("next",S)}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},Qe=300*1e3,He=e=>{let n=e.hasSubAgentDelegation?"enforced":"behavioral";return n==="enforced"?{level:n,capabilities:["PreToolUse file edit gate","Git write guard","Stop iteration tracking","PostToolUse file logging","Sub-agent delegation"]}:{level:n,capabilities:["Behavioral rules only"],gaps:["File edits not blocked in non-execution phases","Git write commands not blocked","No iteration tracking","No file change logging","No sub-agent delegation available"]}},je=(e,t,n=ee)=>{let r=e.spec,s;switch(e.phase){case"IDLE":s=`No active spec. Start one with: \`${F('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_REFINEMENT":s=`Discovery answers ready for review. ${e.discovery.answers.length} answers collected. Waiting for user confirmation.`;break;case"SPEC_PROPOSAL":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 \`${d("next",r)}\` to get started.`}let o=He(n);return{protocol:`Run \`${d('next --answer="..."',r)}\` to submit results and advance`,spec:e.spec,branch:e.branch,iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,activeConcerns:t.map(i=>i.id),resumeHint:s,enforcement:o}},Xe=e=>{let t=e.spec;if(e.lastCalledAt===null)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REFINEMENT \u2192 SPEC_PROPOSAL \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${d("next",t)}\` for instructions. Submit results with \`${d('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase};let n=new Date(e.lastCalledAt).getTime();if(Date.now()-n>Qe)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 DISCOVERY_REFINEMENT \u2192 SPEC_PROPOSAL \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE \u2192 IDLE",how:`Run \`${d("next",t)}\` for instructions. Submit results with \`${d('next --answer="..."',t)}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},ge=[{key:"IDLE",label:"IDLE"},{key:"DISCOVERY",label:"DISCOVERY"},{key:"DISCOVERY_REFINEMENT",label:"REFINEMENT"},{key:"SPEC_PROPOSAL",label:"PROPOSAL"},{key:"SPEC_APPROVED",label:"APPROVED"},{key:"EXECUTING",label:"EXECUTING"},{key:"COMPLETED",label:"COMPLETED"},{key:"IDLE_END",label:"IDLE"}],Ke=e=>e==="BLOCKED"?ge.map(t=>t.key==="EXECUTING"?"[ EXECUTING (BLOCKED) ]":t.label).join(" \u2192 "):ge.map(t=>t.key==="IDLE"&&e==="IDLE"?"[ IDLE ]":t.key===e?`[ ${t.label} ]`:t.label).join(" \u2192 "),ze=(e,t)=>{switch(e.phase){case"DISCOVERY_REFINEMENT":{let n=G(e.specState),r=`${e.discovery.answers.length}/6 answers collected.`;if(!n.canAdvance){let s=n.unresolvedSections.length+n.pendingDecisions.length;return{message:`${r} Spec incomplete: ${s} item(s) need resolution before advancing.`,action:`Resolve every placeholder + pending decision before approving. Do NOT advance until 100%. Unresolved: ${n.unresolvedSections.map(o=>o.sectionTitle).join(", ")||"none"}. Pending: ${n.pendingDecisions.map(o=>o.section).join(", ")||"none"}.`,phase:"DISCOVERY_REFINEMENT"}}return{message:`${r} All sections resolved.`,action:"Type APPROVE to generate spec, or REVISE to correct answers.",phase:"DISCOVERY_REFINEMENT"}}case"SPEC_APPROVED":return{message:`Spec approved. ${t?.tasks?.length??0} tasks ready.`,action:"Type START to begin execution.",phase:"SPEC_APPROVED"};default:return}},Dt=async(e,t,n,r,s,o,i,l,p,m,w)=>{let S=l??ee,h=je(e,t,S),g=r?.maxIterationsBeforeRestart??15,a=r?.allowGit??!1,u=Ge(e,g,a,t,s,S,r);if(e.phase==="EXECUTING"){let U=m??0,f=Y(t).tier2.length,x=U+f;x>0&&(u={...u,tier2Summary:`${x} file-specific rules delivered via PreToolUse hook when editing matching files.`})}let v=Xe(e),y;switch(e.phase){case"IDLE":y=fe(t,X,n.length,i);break;case"DISCOVERY":y=await it(e,t,n,p,w);break;case"DISCOVERY_REFINEMENT":y=at(e,t);break;case"SPEC_PROPOSAL":y=ct(e);break;case"SPEC_APPROVED":y=lt(e);break;case"EXECUTING":y=pt(e,t,n,g,s,o);break;case"BLOCKED":y=mt(e);break;case"COMPLETED":y=await ht(e,w);break;default:y=fe(t,X,n.length,i)}let k=Ke(e.phase),L=ze(e,s),R={...y,meta:h,behavioral:u,roadmap:k};L!==void 0&&(R={...R,gate:L}),v!==void 0&&(R={...R,protocolGuide:v});let E=be[e.phase];E!==void 0&&(R={...R,modeDirective:E});let I=Je(e,t,i,y);if(I.length>0){let U=I.map(({label:T,description:O})=>({label:T,description:O})),f={};for(let T of I)f[T.label]=T.command;let x=S.optionPresentation==="tool"?"AskUserQuestion":"prose-numbered-list",W=S.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.";R={...R,interactiveOptions:U,commandMap:f,toolHint:x,toolHintInstruction:W}}return R},Je=(e,t,n,r)=>{let s=e.spec;switch(e.phase){case"DISCOVERY":{let o=r;if(o?.activePlanDetected!==void 0){let i=o.activePlanDetected;return[{label:`Convert plan (${i.age})`,description:`Import ${i.path} as STATED pre-fill for discovery`,command:d('next --answer="import-plan"',s)},{label:"Share my own context",description:"Start fresh \u2014 tell me what you want to build",command:d('next --answer="<your context here>"',s)}]}return[]}case"IDLE":{let o=[],l=(n?.existingSpecs??[]).filter(p=>p.phase!=="COMPLETED");t.length===0&&o.push({label:"Add concerns (Recommended)",description:"Shape how discovery and specs work by adding project concerns",command:F("concern add <id> [<id2> ...]")}),o.push({label:"Start a new spec",description:"Tell me what you want to build \u2014 a one-liner, detailed requirements, meeting notes, anything",command:F('spec new "description"')});for(let p of l.slice(0,2))o.push({label:`Continue: ${p.name} (${p.phase})`,description:p.detail??`Iteration ${p.iteration}`,command:d("next",p.name)});return t.length>0&&o.push({label:"Edit concerns",description:`Currently: ${t.map(p=>p.id).join(", ")}`,command:F("concern list")}),o.slice(0,4)}case"DISCOVERY_REFINEMENT":return e.discovery.approved?[{label:"Keep as one spec",description:"All work in a single spec",command:d('next --answer="keep"',s)},{label:"Split into separate specs",description:"Create one spec per independent area",command:d('next --answer="split"',s)}]:[{label:"Approve all answers",description:"Answers look correct \u2014 generate the spec",command:d('next --answer="approve"',s)},{label:"Revise answers",description:"Correct one or more discovery answers",command:d(`next --answer='{"revise":{...}}'`,s)}];case"SPEC_PROPOSAL":return[{label:"Approve spec",description:"Review looks good \u2014 approve and move to execution",command:d("approve",s)},{label:"Refine spec",description:"Submit refinements to improve tasks or sections",command:d(`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:d('next --answer="save"',s)},{label:"Start over",description:"Reset the spec and start fresh",command:d("reset",s)}];case"SPEC_APPROVED":return[{label:"Start execution",description:"Begin implementing the tasks",command:d('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:d('next --answer="save"',s)}];case"EXECUTING":return[];case"BLOCKED":return[{label:"Resolve block",description:"Provide a resolution to unblock execution",command:d('next --answer="resolution"',s)},{label:"Reset spec",description:"Abandon this spec and start over",command:d("reset",s)}];case"COMPLETED":return[{label:"New spec",description:"Start a new feature spec",command:F('spec new --name=<slug> "description"')},{label:"Reopen spec",description:"Reopen this spec for revision",command:d("reopen",s)},{label:"Check status",description:"Review completed spec summary",command:F("status")}];default:return[]}},Ze="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.",fe=(e,t,n,r)=>({phase:"IDLE",instruction:(r?.existingSpecs??[]).length===0?'No specs yet. Ask the user: "What do you want to build?" \u2014 accept any input, then run `noskills spec new "their answer"` immediately. Do NOT list options or ask clarifying questions first.':'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:Ze,existingSpecs:r?.existingSpecs??[],availableConcerns:t.map(s=>({id:s.id,description:s.description})),activeConcerns:e.map(s=>s.id),activeRulesCount:r?.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}),et=/\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,tt=e=>{if(e===null||e.length===0)return[];let t=[],n,r=new RegExp(et.source,"gi");for(;(n=r.exec(e))!==null;)t.push(`${n[1]} ${n[2]}`);return t},ye=e=>{let t=tt(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}},Ee=50*1024,ve=async e=>{if(e!==null)try{let t=await B.fs.readTextFile(e);return t.length>Ee?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}},be={IDLE:"No active spec. Plan mode optional.",DISCOVERY:"Ensure you are in plan mode. Read-only. Analyze, research, ask.",DISCOVERY_REFINEMENT:"Ensure you are in plan mode. Read-only. Review answers, resolve placeholders.",SPEC_PROPOSAL:"Ensure you are in plan mode. Use ultraplan if available. Generate implementation map with file dependencies and execution order.",SPEC_APPROVED:"Exit plan mode. Prepare for execution.",EXECUTING:"Ensure you have exited plan mode. Sub-agents need full write access.",BLOCKED:"Enter plan mode. Analyze the blocker. Present options to user.",COMPLETED:"Plan mode optional. Review, record learnings."},Ct=e=>be[e],nt=async e=>{let t=[`${e}/plan.md`,`${e}/PLAN.md`,`${e}/.claude/plan.md`];for(let n of t)try{let r=await B.fs.stat(n),s=r.mtime??r.birthtime;if(!s)continue;let o=Date.now()-new Date(s).getTime();if(o>1440*60*1e3)continue;let i=await B.fs.readTextFile(n);if(i.length>Ee)continue;let l=i.replace(/^---[\s\S]*?---\n?/,""),m=l.split(`
7
+ `).filter(a=>a.trim().length>0).slice(0,3).join(`
8
+ `).slice(0,200),w=l.replace(/\s/g,"").length,S=/^## /m.test(l),h=w>=100&&S?"ok":"sparse",g=o<6e4?"just now":Math.floor(o/36e5)>0?`${Math.floor(o/36e5)}h ago`:`${Math.floor(o%36e5/6e4)}m ago`;return{path:n,age:o,ageLabel:g,preview:m,quality:h}}catch{continue}return null},st=e=>{let t=[],n=e.toLowerCase(),r=["websocket","graphql","grpc","redis","postgres","mongodb","kafka","rabbitmq","docker","kubernetes","lambda","s3"];for(let s of r)n.includes(s)&&t.push(`Answer mentions ${s} \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},ot=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."]}},rt=(e,t)=>{let n=new Map;for(let r of e){let s="user"in r?r.user:"Unknown User";t!==void 0&&s===t.name||n.set(s,(n.get(s)??0)+1)}return[...n.entries()].map(([r,s])=>({name:r,contributions:`${s} answer${s>1?"s":""}`}))},it=async(e,t,n,r,s)=>{let o=e.spec,i=z(t),l=e.discovery.answers.length,p=ie(e.discovery.answers),m=e.discovery.audience==="agent",w=rt(e.discovery.answers,r),S=(e.specNotes??[]).filter(c=>!c.text.startsWith("[TASK] ")).map(c=>({text:c.text,user:c.user})),h={...r!==void 0?{currentUser:r}:{},...w.length>0?{previousContributors:w}:{},...S.length>0?{notes:S}:{}},g=e.discovery.userContext!==void 0&&e.discovery.userContext.length>0,a=e.specDescription!==null&&e.specDescription.length>0,u=e.discovery.planPath!==null,v=e.discovery.mode;if(v===void 0&&!g&&l===0&&!u&&a){let c=null;s!==void 0&&(c=await nt(s));let b=c?.quality==="sparse"?`
9
+ \u26A0 The plan appears sparse \u2014 limited content detected.`:"",N={phase:"DISCOVERY",instruction:"The user just created this spec. Before starting discovery, ask them to share whatever context they have \u2014 requirements, notes, tasks, or just a brief description. Say: 'Tell me about this \u2014 share as much context as you have.' Listen first, then proceed."+(c!==null?`
10
+
11
+ A plan.md was detected (${c.ageLabel}, ${c.path}).${b}
12
+ You can import it or share your own context directly.`:""),questions:[],answeredCount:0,context:{rules:n,concernReminders:_(t)},transition:{onComplete:d('next --answer="<user context or just start>"',o)},...h,...c!==null?{activePlanDetected:{path:c.path,age:c.ageLabel,preview:c.preview,quality:c.quality}}:{}};return r!==void 0?{...N,currentUser:r}:N}let y=u?{planImported:!0}:{};if(v===void 0&&a&&l===0&&!u){let b={phase:"DISCOVERY",instruction:"Before starting discovery, select the discovery mode that best fits this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:_(t)},transition:{onComplete:d('next --answer="<mode>"',o)},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(s!==void 0)try{let P=await ce(s,e.specDescription??"");P.length>0&&(b={...b,previousLearnings:le(P)})}catch{}return r!==void 0?{...b,currentUser:r}:b}let k=e.discovery.premisesCompleted===!0;if(v!==void 0&&!k&&!p){let c=v==="ship-fast"?["Narrowest Wedge: What's the absolute minimum version of this that creates real, measurable value \u2014 without any surrounding features?"]:v==="explore"?["Demand Reality: What do users actually do today when they can't use this feature? Describe concrete workarounds \u2014 not hypothetical ones.","Status Quo: Why hasn't this been solved before? What existing solution is insufficient, and specifically where does it break down?","Desperate Specificity: Describe the exact moment a real user feels this pain \u2014 who, where, what did they do next?","Narrowest Wedge: What's the smallest version of this that creates real value?","Observation & Surprise: What's the most surprising thing you know about this problem or this user?","Think bigger: If this works perfectly, what's the 10x version? What should you build next?"]:["Demand Reality: What do users actually do today when they can't use this feature? Describe concrete workarounds \u2014 not hypothetical ones.","Status Quo: Why hasn't this been solved before? What existing solution is insufficient, and specifically where does it break down?","Desperate Specificity: Describe the exact moment a real user feels this pain. Name them if possible. What did they do next?","Narrowest Wedge: What's the smallest version of this that creates real, measurable value \u2014 without the surrounding features?","Observation & Surprise: What's the most surprising thing you've learned from watching real users encounter this problem?","Future-Fit: If this works perfectly in 6 months, what should you build next? Does that constrain any decisions you're making now?"],b={phase:"DISCOVERY",instruction:"Before asking discovery questions, challenge the premises of this spec.",questions:[],answeredCount:0,context:{rules:n,concernReminders:_(t)},transition:{onComplete:d(`next --answer='{"premises":[...]}'`,o)},...y,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:c}};return r!==void 0?{...b,currentUser:r}:b}let L=v!==void 0?ot(v):[],R=[...n,...L],E=e.specDescription??"",I=E.length>500,U=e.discovery.premises??[],f=U.filter(c=>c.agreed).map(c=>c.text),x=U.filter(c=>!c.agreed&&c.revision!==void 0).map(c=>({original:c.text,revision:c.revision}));if(p){let c=e.revisitHistory??[],b=c.length>0?c[c.length-1]:null,P={phase:"DISCOVERY",instruction:b!==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: \`${d("approve",o)}\``,questions:[],answeredCount:l,context:{rules:n,concernReminders:[]},transition:{onComplete:d("approve",o)},...h,...y};if(b!=null){let N=b;return{...P,revisited:!0,revisitReason:N.reason,previousProgress:{completedTasks:[...N.completedTasks],totalTasks:N.completedTasks.length}}}return P}if(m){let c=e.discovery.currentQuestion,b=i[c];if(b===void 0)return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${d("approve",o)}\``,questions:[],answeredCount:l,context:{rules:n,concernReminders:[]},transition:{onComplete:d("approve",o)},...h};let P={id:b.id,text:b.text,concerns:[...b.concerns],extras:b.extras.map(M=>M.text)},N={phase:"DISCOVERY",instruction:`Ask this question to the user using AskUserQuestion. Submit the answer with: \`${d('next --agent --answer="<answer>"',o)}\``,questions:[P],answeredCount:l,currentQuestion:c,totalQuestions:i.length,context:{rules:R,concernReminders:_(t)},transition:{onComplete:`${d('next --agent --answer="<answer>"',o)}`},...h,...y},C=N;if((f.length>0||x.length>0)&&(C={...C,...f.length>0?{agreedPremises:f}:{},...x.length>0?{revisedPremises:x}:{}}),c===0){let M=ye(e.specDescription??null);M!==void 0&&(C={...C,preDiscoveryResearch:M});let H=await ve(e.discovery.planPath??null);H!==void 0&&(C={...C,planContext:H}),I&&H===void 0&&(C={...C,richDescription:{provided:!0,length:E.length,content:E,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 te=(e.discovery.followUps??[]).filter(M=>M.status==="pending");te.length>0&&(C={...C,pendingFollowUps:te});let ne=e.discovery.answers.length>0?e.discovery.answers[e.discovery.answers.length-1]:void 0;if(ne!==void 0){let M=st(ne.answer);M.length>0&&(C={...C,followUpHints:M})}return C!==N?C:N}let W=new Set(e.discovery.answers.map(c=>c.questionId)),T=i.filter(c=>!W.has(c.id)).map(c=>({id:c.id,text:c.text,concerns:[...c.concerns],extras:c.extras.map(b=>b.text)})),O=e.revisitHistory??[],D=O.length>0?O[O.length-1]:null,A=D!==null,q={phase:"DISCOVERY",instruction:A?"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:T,answeredCount:l,context:{rules:R,concernReminders:_(t)},transition:{onComplete:`${d(`next --answer='{"status_quo":"...","ambition":"...",...}'`,o)}`},...h,...y,...f.length>0?{agreedPremises:f}:{},...x.length>0?{revisedPremises:x}:{}};if(A&&D!==void 0)return{...q,revisited:!0,revisitReason:D.reason,previousProgress:{completedTasks:[...D.completedTasks],totalTasks:D.completedTasks.length}};if(l===0){let c=q,b=ye(e.specDescription??null);b!==void 0&&(c={...c,preDiscoveryResearch:b});let P=await ve(e.discovery.planPath??null);if(P!==void 0&&(c={...c,planContext:P}),I&&P===void 0&&(c={...c,richDescription:{provided:!0,length:E.length,content:E,instruction:"The user provided a detailed description. For each question, extract relevant info and present as a pre-filled suggestion."}}),c!==q)return c}return q},at=(e,t)=>{let n=e.spec,r=z(t),s=e.discovery.answers.map(h=>{let g=r.find(a=>a.id===h.questionId);return{questionId:h.questionId,question:g?.text??h.questionId,answer:h.answer}}),o=me(e.discovery.answers);if(e.discovery.approved&&o.detected)return{phase:"DISCOVERY_REFINEMENT",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:s,transition:{onApprove:d('next --answer="keep"',n),onRevise:d(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:o};let i=e.discovery.alternativesPresented===!0;if(e.discovery.approved&&!i)return{phase:"DISCOVERY_REFINEMENT",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:s,transition:{onApprove:d(`next --answer='{"approach":"A","name":"...","summary":"...","effort":"M","risk":"Low"}'`,n),onRevise:d('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"]}}};let l=e.discovery.batchSubmitted===!0?" IMPORTANT: These answers were BATCH-SUBMITTED (not confirmed one-by-one). You MUST present EVERY answer individually and get explicit user confirmation for each. Do NOT auto-approve.":"",p=K(t),m=oe(t),w;if(p.length>0){let h=p.map(a=>({id:a.id,label:a.label,prompt:a.prompt,evidenceRequired:a.evidenceRequired,isRegistry:m.includes(a.id),concernId:a.concernId})),g=h.some(a=>a.isRegistry);w={dimensions:h,instruction:"Before approving, review the plan against each dimension below. For dimensions marked evidenceRequired, cite specific files or code. Present findings to the user for each dimension via AskUserQuestion \u2014 one dimension at a time.",...g?{registryInstruction:"Registry dimensions (isRegistry=true) require a structured table with every row filled. These tables will be included in the generated spec."}:{}}}let S=e.classification!==null&&e.classification.source==="inferred"?_e(e.classification):void 0;return{phase:"DISCOVERY_REFINEMENT",instruction:o.detected?`Present ALL discovery answers to the user for review. ALSO present the split proposal \u2014 noskills detected multiple independent areas.${l}`:`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.${l}`,answers:s,transition:{onApprove:d('next --answer="approve"',n),onRevise:d(`next --answer='{"revise":{"status_quo":"corrected answer"}}'`,n)},splitProposal:o.detected?o:void 0,reviewChecklist:w,classificationPreview:S,subPhase:Z(e),completenessScore:e.discovery.refinement?.completenessScore,reviewPosture:e.discovery.refinement?.reviewPosture}},ct=e=>{let t=e.spec;return e.classification===null?{phase:"SPEC_PROPOSAL",instruction:"Before generating the spec, classify what this spec involves. Ask the user to select all that apply.",specPath:e.specState.path??"",transition:{onApprove:`${d(`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: `"+d(`next --answer='{"involvesWebUI":true,"involvesCLI":false,"involvesPublicAPI":false,...}'`,t)+"`. If none apply, answer with: `"+d('next --answer="none"',t)+"`"}}:{phase:"SPEC_PROPOSAL",instruction:"Spec draft is ready. Self-review before presenting to user.",specPath:e.specState.path??"",transition:{onApprove:d("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."}}},lt=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:`${d('next --answer="start"',t)}`}}},dt=(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},ut=(e,t,n,r,s,o,i,l,p,m)=>{if(p==="review-gate"){let v=e.filter(k=>(k.reviewDimensions??[]).length>0)[m??0];return v===void 0?[]:K([v],s).map(k=>({id:`gate-${v.id}-${k.id}`,text:`(${v.id} \u2014 ${k.label}) ${k.prompt}${k.evidenceRequired?" [EVIDENCE REQUIRED \u2014 cite file paths, line numbers, or test names]":""}`}))}let w=[],S=new Set(l??[]),h=0,g=()=>`ac-${++h}`;if(r!==null)for(let a of r.items)S.has(a.id)||w.push({id:a.id,text:`[DEBT from iteration ${a.since}] ${a.text}`});if(t&&w.push({id:g(),text:`[FAILED] Tests \u2014 fix this first: ${n.slice(0,200)}`}),o!=null)for(let a of o.verification){let u=g();S.has(u)||w.push({id:u,text:a})}for(let a of e)if(a.acceptanceCriteria!==void 0&&a.acceptanceCriteria.length>0)for(let u of a.acceptanceCriteria){if(!dt(u,s))continue;let v=g();S.has(v)||w.push({id:v,text:`(${a.id}) ${u}`})}if(i!==void 0)for(let a of i){let u=g();S.has(u)||w.push({id:u,text:`(folder: ${a.folder}) ${a.rule}`})}if(o!=null){let a=o.tasks?.find(u=>u.files!==void 0&&u.files.length>0);a?.files!==void 0&&a.files.length>0&&w.push({id:"scope-check",text:`Scope check: only files listed in task (${a.files.join(", ")}) should be modified. Report any out-of-scope changes with justification.`})}return w.push({id:"mandatory-tests",text:"Tests written and passing for all new and changed behavior"}),w.push({id:"mandatory-docs",text:"Documentation updated for all public-facing changes"}),w},pt=(e,t,n,r,s,o)=>{let i=e.spec,l=se(t),p=e.execution.iteration>=r,m=e.execution.lastVerification?.passed===!1,w=e.execution.lastVerification?.output??"",S=s?.tasks??[],h=e.execution.completedTasks??[],g=new Set(h),a=S.find(f=>!g.has(f.id))??null,u=a!==null?{id:a.id,title:a.title,totalTasks:S.length,completedTasks:h.length,...a.files!==void 0&&a.files.length>0?{files:a.files}:{}}:void 0;if(e.execution.awaitingStatusReport){let f=e.execution.criteriaScope,x=e.execution.gateConcernCursor,W=ut(t,m,w,e.execution.debt,e.classification,s,o,e.execution.naItems,f,x),T;if(f==="review-gate"){let D=t.filter(c=>(c.reviewDimensions??[]).length>0),A=x??0,$=D[A],q=D.length;T=$!==void 0?`REVIEW GATE (${A+1}/${q}): Evaluate the ${$.name} concern dimensions against the actual implementation. Point to specific files, line numbers, and test names. File edits are BLOCKED \u2014 this is a review-only pass. Submit: noskills next --answer='{"completed":[...],"remaining":[...]}'`:"Review gate complete \u2014 submit to advance."}else{let D=[];try{let A=JSON.parse(e.execution.lastProgress??"");Array.isArray(A.completed)&&(D=A.completed.filter($=>typeof $=="string"&&$.startsWith("task-")))}catch{}T=D.length>=2?`${D.length} tasks reported complete. Report status against ALL relevant acceptance criteria.`:"Before this task is accepted, report your completion status against these acceptance criteria."}let O={phase:"EXECUTING",instruction:T,context:{rules:n,concernReminders:Y(t).tier1},transition:{onComplete:`${d(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`,i)}`,onBlocked:f!=="review-gate"?`${d('block "reason"',i)}`:void 0,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:W,reportFormat:f==="review-gate"?{completed:"list dimension IDs you verified with evidence (file:line, test name)",remaining:"list dimension IDs not yet verified",blocked:"list dimension IDs that need a decision before you can verify"}:{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"}},...f==="review-gate"?{subphase:"review-gate"}:{}};if(f!=="review-gate"){let D=[];try{let A=JSON.parse(e.execution.lastProgress??"");Array.isArray(A.completed)&&(D=A.completed.filter($=>typeof $=="string"&&$.startsWith("task-")))}catch{}D.length>=2&&(O={...O,batchTasks:D})}return m&&f!=="review-gate"&&(O={...O,verificationFailed:!0,verificationOutput:w.slice(0,2e3)}),O}let v=(e.execution.lastProgress??"").includes("Task not accepted"),y=e.execution.debt?.items??[],k=e.execution.debt?.unaddressedIterations??0,L=u!==void 0?`Execute task ${u.id}: ${u.title} (${u.completedTasks}/${u.totalTasks} completed)`:"All tasks completed. Run `"+d("done",i)+"` to finish.",R;if(m)R="Verification FAILED. Fix the failing tests before continuing.";else if(v&&y.length>0){let f=k>=3?` These items have been outstanding for ${k} iterations.`:"";R=`Task not accepted \u2014 ${y.length} remaining item(s) must be addressed before this task can be completed.${f} Address them, then submit a new status report.`}else R=L;let E={phase:"EXECUTING",instruction:R,task:u,context:{rules:n,concernReminders:Y(t).tier1},transition:{onComplete:`${d('next --answer="..."',i)}`,onBlocked:`${d('block "reason"',i)}`,iteration:e.execution.iteration}};if(v&&y.length>0&&(E={...E,taskRejected:!0,rejectionReason:`${y.length} remaining item(s) must be addressed.`,rejectionRemaining:y.map(f=>f.text)}),e.execution.debt!==null&&e.execution.debt.items.length>0){let f=e.execution.debt.unaddressedIterations??0,x=f>=3?`URGENT: These items have been unaddressed for ${f} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";E={...E,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:x}}}if(m){let f=w.slice(0,2e3);E={...E,verificationFailed:!0,verificationOutput:f}}if(l.length>0){let f=l.map(x=>`${x.between.join(" vs ")}: ${x.issue}`).join("; ");E={...E,concernTensions:l,instruction:`TENSION GATE: ${l.length} concern tension(s) detected: ${f}. You MUST present these to the user and get explicit resolution for each before proceeding. Use AskUserQuestion to ask which side to prioritize.`}}p&&(E={...E,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${d("next",i)}\` to resume - your progress is saved.`});let I=[...e.decisions].reverse().find(f=>!f.promoted);return I!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(E={...E,promotePrompt:{decisionId:I.id,question:I.question,choice:I.choice,prompt:`You just resolved a decision: "${I.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${F(`rule add "${I.choice}"`)}\``}}),e.execution.iteration===0&&!m&&!v&&(E={...E,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(f=>f.id==="beautiful-product")&&(E={...E,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?"}]}}),E},mt=e=>{let t=e.spec;return{phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:e.execution.lastProgress??"Unknown",transition:{onResolved:`${d('next --answer="..."',t)}`}}},ht=async(e,t)=>{let r={phase:"COMPLETED",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length,completionReason:e.completionReason,completionNote:e.completionNote},learningPrompt:{instruction:`LEARNING PENDING \u2014 Record learnings before moving on. 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"]},learningsPending:!0};if(t!==void 0)try{let{checkStaleness:s}=await import("./diagrams-CBCUA47B.js"),o=await s(t,e.execution.modifiedFiles);if(o.length>0)return{...r,staleDiagrams:o.map(i=>({file:i.file,line:i.line,reason:i.reason})),staleDiagramsBlocking:!0}}catch{}return r};var Se={UNINITIALIZED:["IDLE"],IDLE:["DISCOVERY","COMPLETED"],DISCOVERY:["DISCOVERY_REFINEMENT","COMPLETED"],DISCOVERY_REFINEMENT:["DISCOVERY_REFINEMENT","SPEC_PROPOSAL","COMPLETED"],SPEC_PROPOSAL:["SPEC_PROPOSAL","SPEC_APPROVED","COMPLETED"],SPEC_APPROVED:["EXECUTING","COMPLETED"],EXECUTING:["COMPLETED","BLOCKED"],BLOCKED:["EXECUTING","COMPLETED"],COMPLETED:["IDLE","DISCOVERY"]},ft=(e,t)=>Se[e].includes(t),V=(e,t)=>{if(!ft(e,t))throw new Error(`Invalid phase transition: ${e} \u2192 ${t}. Allowed: ${Se[e].join(", ")}`)},Ot=(e,t)=>(V(e.phase,t),{...e,phase:t}),At=(e,t,n,r)=>(V(e.phase,"DISCOVERY"),{...e,phase:"DISCOVERY",spec:t,specDescription:r??null,branch:n,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1,planPath:null},specState:{path:null,status:"none",metadata:j,placeholders:[]},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},decisions:[]}),Tt=(e,t)=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot set discovery mode in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,mode:t,entryComplete:!0}}};var Nt=(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}}},Ft=(e,t)=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`Cannot select approach in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,selectedApproach:t,alternativesPresented:!0}}},Lt=e=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`Cannot skip alternatives in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,alternativesPresented:!0}}},$t=(e,t,n,r)=>{if(e.phase!=="DISCOVERY"&&e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`Cannot add discovery answer in phase: ${e.phase}`);if(n.trim().length<20)throw new Error("Answer too short. Discovery answers must be meaningful (minimum 20 characters).");let s=e.discovery.answers.filter(i=>i.questionId!==t),o={questionId:t,answer:n,user:r?.name??"Unknown User",email:r?.email??"",timestamp:new Date().toISOString(),type:"original"};return{...e,discovery:{...e.discovery,answers:[...s,o]}}};var Mt=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete discovery in phase: ${e.phase}`);let t=wt(e);if(t.length>0)throw new Error(`Cannot complete discovery: ${t.length} pending follow-up(s). Answer or skip them first.`);return{...e,phase:"DISCOVERY_REFINEMENT",discovery:{...e.discovery,completed:!0},specState:{...e.specState,path:ae.specFile(e.spec),status:"draft"}}},yt=e=>e.classification!==null?e:{...e,classification:we(e)},Ut=e=>{let t=G(e.specState);if(!t.canAdvance){let n=t.unresolvedSections.map(s=>` - ${s.sectionTitle}`).join(`
13
+ `),r=t.pendingDecisions.map(s=>` - ${s.section}: ${s.question} (waiting for ${s.waitingFor.join(", ")})`).join(`
14
+ `);throw new Error(`Spec incomplete \u2014 cannot advance to SPEC_PROPOSAL.
15
+ `+(t.unresolvedSections.length>0?`
16
+ Unresolved sections:
17
+ ${n}`:"")+(t.pendingDecisions.length>0?`
18
+ Pending decisions:
19
+ ${r}`:"")+`
20
+
21
+ Use AskUserQuestion to resolve every item. Do not guess, infer, or fill in yourself.`)}return V(e.phase,"SPEC_PROPOSAL"),yt({...e,phase:"SPEC_PROPOSAL"})},Vt=e=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`Cannot approve discovery answers in phase: ${e.phase}`);return{...e,discovery:{...e.discovery,approved:!0}}},qt=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}}},_t=e=>(V(e.phase,"SPEC_APPROVED"),{...e,phase:"SPEC_APPROVED",specState:{...e.specState,status:"approved"}}),Wt=e=>(V(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 Bt=(e,t)=>(V(e.phase,"BLOCKED"),{...e,phase:"BLOCKED",execution:{...e.execution,lastProgress:`BLOCKED: ${t}`}}),Yt=(e,t)=>({...e,decisions:[...e.decisions,t]}),Gt=(e,t,n)=>(V(e.phase,"COMPLETED"),{...e,phase:"COMPLETED",completionReason:t,completedAt:new Date().toISOString(),completionNote:n??null}),Qt=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,refinement:void 0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null}},Ht=(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,refinement:void 0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[],debtCounter:0,naItems:[]},classification:null,revisitHistory:[...e.revisitHistory??[],n]}},Z=e=>{let t=e.discovery.refinement;return t?.reviewPosture?t.ceoReview?"stage-c":"stage-b":"stage-a"},jt=(e,t)=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`setCompletenessScore: invalid phase ${e.phase}`);let n=e.discovery.refinement;return{...e,discovery:{...e.discovery,refinement:{...n,initialCompletenessScore:n?.initialCompletenessScore??t,completenessScore:t}}}},Xt=(e,t)=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`setReviewPosture: invalid phase ${e.phase}`);return{...e,discovery:{...e.discovery,refinement:{...e.discovery.refinement,reviewPosture:t}}}},Kt=(e,t,n)=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`setCeoReviewReadiness: invalid phase ${e.phase}`);return{...e,discovery:{...e.discovery,refinement:{...e.discovery.refinement,ceoReview:{readinessScore:t,reflection:n}}}}},zt=e=>{if(e.phase!=="DISCOVERY_REFINEMENT")throw new Error(`clearRefinement: invalid phase ${e.phase}`);return{...e,discovery:{...e.discovery,refinement:void 0}}},Jt=(e,t,n,r,s)=>{let o={from:t,to:n,user:r?.name??"Unknown User",email:r?.email??"",timestamp:new Date().toISOString(),reason:s},i=e.transitionHistory??[];return{...e,transitionHistory:[...i,o]}},Zt=(e,t,n)=>{let r=e.customACs??[],o={id:`custom-ac-${r.length+1}`,text:t,user:n?.name??"Unknown User",email:n?.email??"",timestamp:new Date().toISOString(),addedInPhase:e.phase};return{...e,customACs:[...r,o]}},en=(e,t,n)=>{let r=e.specNotes??[],o={id:`note-${r.length+1}`,text:t,user:n?.name??"Unknown User",email:n?.email??"",timestamp:new Date().toISOString(),phase:e.phase};return{...e,specNotes:[...r,o]}},tn=(e,t)=>({...e,discovery:{...e.discovery,userContext:[...e.discovery.userContext??[],t],userContextProcessed:!1}}),nn=(e,t,n)=>({...e,discovery:{...e.discovery,userContext:[t],planPath:n}});var vt=3,sn=(e,t,n,r)=>{let s=e.discovery.followUps??[],o=s.filter(p=>p.parentQuestionId===t).length;if(o>=vt)return e;let l={id:`${t}${String.fromCharCode(97+o)}`,parentQuestionId:t,question:n,answer:null,status:"pending",createdBy:r,createdAt:new Date().toISOString()};return{...e,discovery:{...e.discovery,followUps:[...s,l]}}},on=(e,t,n)=>{let s=(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:s}}},rn=(e,t)=>{let r=(e.discovery.followUps??[]).map(s=>s.id===t&&s.status==="pending"?{...s,status:"skipped"}:s);return{...e,discovery:{...e.discovery,followUps:r}}},wt=e=>(e.discovery.followUps??[]).filter(t=>t.status==="pending"),an=(e,t)=>(e.discovery.followUps??[]).filter(n=>n.parentQuestionId===t),cn=(e,t,n,r)=>{let s=e.discovery.delegations??[],o={questionId:t,delegatedTo:n,delegatedBy:r,status:"pending",delegatedAt:new Date().toISOString()};return{...e,discovery:{...e.discovery,delegations:[...s,o]}}},ln=(e,t,n,r)=>{let o=(e.discovery.delegations??[]).map(i=>i.questionId===t&&i.status==="pending"?{...i,status:"answered",answer:n,answeredBy:r,answeredAt:new Date().toISOString()}:i);return{...e,discovery:{...e.discovery,delegations:o}}},dn=e=>(e.discovery.delegations??[]).filter(t=>t.status==="pending"),un=e=>{if(!new Set(["IDLE","EXECUTING","BLOCKED","COMPLETED"]).has(e.phase))throw new Error(`Cannot reset from ${e.phase}. Use \`cancel\` or \`wontfix\` instead.`);return{...e,phase:"IDLE",spec:null,branch:null,discovery:{answers:[],completed:!1,currentQuestion:0,audience:"human",approved:!1,planPath:null},specState:{path:null,status:"none",metadata:j,placeholders:[]},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{Ot as a,At as b,Tt as c,Nt as d,Ft as e,Lt as f,$t as g,Mt as h,yt as i,Ut as j,Vt as k,qt as l,_t as m,Wt as n,Bt as o,Yt as p,Gt as q,Qt as r,Ht as s,Z as t,jt as u,Xt as v,Kt as w,zt as x,Jt as y,Zt as z,en as A,tn as B,nn as C,sn as D,on as E,rn as F,an as G,cn as H,ln as I,dn as J,un as K,me as L,we as M,Dt as N,Ct as O,nt as P};
@@ -1 +1 @@
1
- import{c as s}from"./chunk-D3IKJ7FF.js";var o=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],a=[{questionId:"verification",text:"What tests should be written? (unit, integration, e2e \u2014 be specific about what behavior to test)"},{questionId:"verification",text:"What documentation needs updating? (README, API docs, CHANGELOG, inline comments)"}],d=n=>o.map(e=>{let t=a.filter(i=>i.questionId===e.id),r=s(n,e.id);return{...e,extras:[...t,...r]}});var u=n=>{let e=new Set(n.map(t=>t.questionId));return o.every(t=>e.has(t.id))};export{o as a,d as b,u as c};
1
+ import{c as s}from"./chunk-O4KKKYCH.js";var o=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],a=[{questionId:"verification",text:"What tests should be written? (unit, integration, e2e \u2014 be specific about what behavior to test)"},{questionId:"verification",text:"What documentation needs updating? (README, API docs, CHANGELOG, inline comments)"}],d=n=>o.map(e=>{let t=a.filter(i=>i.questionId===e.id),r=s(n,e.id);return{...e,extras:[...t,...r]}});var u=n=>{let e=new Set(n.map(t=>t.questionId));return o.every(t=>e.has(t.id))};export{o as a,d as b,u as c};
@@ -0,0 +1,39 @@
1
+ import{i as E}from"./chunk-Y5E7ZCCX.js";import{d as H}from"./chunk-HISXAZ4Y.js";var y=e=>e.map(n=>typeof n=="string"?Z(n):n),Z=e=>({kind:"text",value:e}),le=(...e)=>({kind:"bold",children:y(e)}),pe=(...e)=>({kind:"dim",children:y(e)});var ue=(...e)=>({kind:"group",children:y(e)});var g=(e,...n)=>({kind:"color",color:e,children:y(n)}),de=(...e)=>g("red",...e),ce=(...e)=>g("green",...e),me=(...e)=>g("yellow",...e),ye=(...e)=>g("blue",...e),he=(...e)=>g("magenta",...e),fe=(...e)=>g("cyan",...e),ke=(...e)=>g("gray",...e);var Se=(e,n)=>({kind:"table",headers:y(e),rows:n.map(r=>y(r))});var we=(e,...n)=>({kind:"alert",level:e,children:y(n)}),h=e=>{switch(e.kind){case"text":return e.value.length;case"newline":return 1;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.reduce((n,r)=>n+h(r),0);case"code-block":return e.value.length;case"table":case"list":return 0;case"gauge":{let n=e.width??20,r=e.label?` ${e.label}`:"";return n+` ${e.percent}%`.length+r.length}case"separator":return 0;case"alert":return 2+e.children.reduce((n,r)=>n+h(r),0)}};var S=(e,n)=>{let r=typeof e=="string"?"text":e instanceof Uint8Array?"bytes":"structured";return{data:e,meta:{timestamp:Date.now(),kind:r,channel:"stdout",...n}}};var L=e=>{switch(e.kind){case"text":return e.value;case"newline":return`
2
+ `;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.map(L).join("");case"code-block":return e.value.split(`
3
+ `).map(n=>` ${n}`).join(`
4
+ `)+`
5
+ `;case"table":{let n=e.headers.map((i,p)=>{let a=e.rows.reduce((T,c)=>{let d=c[p];return Math.max(T,d!==void 0?h(d):0)},0);return Math.max(h(i),a)}),r=(i,p)=>{let a=L(i),T=h(i);return a+" ".repeat(Math.max(0,p-T))},o=e.headers.map((i,p)=>r(i,n[p])).join(" "),t=n.map(i=>"-".repeat(i)).join(" "),l=e.rows.map(i=>i.map((p,a)=>r(p,n[a])).join(" ")).join(`
6
+ `);return`${o}
7
+ ${t}
8
+ ${l}
9
+ `}case"list":return e.items.map(n=>` - ${n.map(L).join("")}`).join(`
10
+ `)+`
11
+ `;case"gauge":{let n=e.width??20,r=Math.round(n*e.percent/100),o=n-r,t=`[${"=".repeat(r)}${" ".repeat(o)}]`,l=e.label?` ${e.label}`:"";return`${t} ${e.percent}%${l}`}case"separator":return e.label?`--- ${e.label} ---
12
+ `:`${"\u2500".repeat(40)}
13
+ `;case"alert":return`[${{info:"INFO",success:"OK",warning:"WARN",error:"ERROR"}[e.level]}] ${e.children.map(L).join("")}`}},R=()=>({name:"plain",render:e=>e.map(L).join("")});var I=()=>{let e=[];return{name:"buffer",writable:new WritableStream({write(n){e.push(n)}}),chunks:()=>e,items:()=>e.map(n=>n.data),clear:()=>{e.length=0}}};var ne=e=>{console.error(`[streams] Error at chunk #${e.chunkIndex} (${e.pendingCount} pending):`,e.error)},U=e=>{let n=[],r=e?.onError??ne,o=e?.renderer??R(),t=!1,l=!1,i=0,p=!1,a,d=(()=>{let u=e?.sink??I(),k=e?.layers??[];if(k.length===0)return u.writable;let{readable:v,writable:X}=new TransformStream,W=v;for(let D of k)W=W.pipeThrough(D.transform());return W.pipeTo(u.writable).catch(D=>{r({error:D,chunkIndex:i,pendingCount:n.length,lastChunk:n[n.length-1]})}),X})().getWriter(),w=async()=>{if(!l){for(l=!0,t=!1;n.length>0;){let u=n.shift();try{await d.ready,await d.write(u),i++}catch(k){r({error:k,chunkIndex:i,pendingCount:n.length,lastChunk:u}),n.length=0;break}}l=!1,a!==void 0&&(a(),a=void 0)}},$=()=>{t||(t=!0,queueMicrotask(w))},j=u=>{p||(n.push(u),$())},O={write:(...u)=>{let k=y(u),v=o.render(k);j(S(v))},writeln:(...u)=>{let k=y(u),v=o.render(k)+`
14
+ `;j(S(v))},flush:()=>n.length===0&&!t&&!l?Promise.resolve():new Promise(u=>{a=u,$()}),close:async()=>{p=!0,await O.flush();try{await d.close()}catch{}},pipe:(...u)=>U({sink:e?.sink,renderer:e?.renderer,layers:[...e?.layers??[],...u],onError:r})};return O};var P=class extends Error{constructor(n){super(n),this.name="StreamError"}},b=class extends P{cause;constructor(n,r){super(n),this.name="PipelineError",this.cause=r}},x=class extends P{constructor(n){super(`Pipeline timed out after ${n}ms`),this.name="TimeoutError"}};var re=()=>{let e,n=[],r,o={from:t=>(e=t,o),through:(...t)=>(n.push(...t),o),to:t=>(r=t,o),run:async t=>{if(e===void 0)throw new b("Pipeline has no source. Call .from() first.");if(r===void 0)throw new b("Pipeline has no sink. Call .to() first.");let l=e.readable;for(let a of n)l=l.pipeThrough(a.transform());let i=new AbortController,p;t?.timeout!==void 0&&t.timeout>0&&(p=setTimeout(()=>{i.abort(new x(t.timeout))},t.timeout));try{await l.pipeTo(r.writable,{signal:i.signal})}catch(a){throw a instanceof x?a:a instanceof DOMException&&a.name==="AbortError"?new x(t?.timeout??0):new b(`Pipeline failed: ${a instanceof Error?a.message:String(a)}`,a instanceof Error?a:void 0)}finally{p!==void 0&&clearTimeout(p)}},collect:async()=>{let t=I();return r=t,await o.run(),t.items()}};return o};var Y={};H(Y,{buffer:()=>I,multiplex:()=>K,nullSink:()=>z,stderr:()=>_,stdout:()=>N,writable:()=>F});var B,te=()=>(B===void 0&&(B=new TextEncoder),B),N=()=>{let e=E.process.stdout;return{name:"stdout",writable:new WritableStream({async write(n){let r=String(n.data),o=te().encode(r),t=e.getWriter();try{await t.write(o)}finally{t.releaseLock()}}})}};var q,oe=()=>(q===void 0&&(q=new TextEncoder),q),_=()=>{let e=E.process.stderr;return{name:"stderr",writable:new WritableStream({async write(n){let r=String(n.data),o=oe().encode(r),t=e.getWriter();try{await t.write(o)}finally{t.releaseLock()}}})}};var z=()=>({name:"null",writable:new WritableStream({write(e){}})});var F=(e,n)=>({name:n??"writable",writable:e});var K=(...e)=>{let n=e.map(r=>({name:r.name,writer:r.writable.getWriter()}));return{name:`multiplex(${e.map(r=>r.name).join(",")})`,writable:new WritableStream({async write(r){await Promise.all(n.map(o=>o.writer.write(r)))},async close(){await Promise.all(n.map(r=>r.writer.close()))},async abort(r){await Promise.all(n.map(o=>o.writer.abort(r)))}})}};var V={};H(V,{ansi:()=>J,markdown:()=>Q,plain:()=>R});var s="\x1B[",ae=`${s}0m`,m={bold:[`${s}1m`,`${s}22m`],dim:[`${s}2m`,`${s}22m`],italic:[`${s}3m`,`${s}23m`],underline:[`${s}4m`,`${s}24m`],strikethrough:[`${s}9m`,`${s}29m`]},M={black:`${s}30m`,red:`${s}31m`,green:`${s}32m`,yellow:`${s}33m`,blue:`${s}34m`,magenta:`${s}35m`,cyan:`${s}36m`,white:`${s}37m`,gray:`${s}90m`},A=`${s}39m`,C=e=>{switch(e.kind){case"text":return e.value;case"newline":return`
15
+ `;case"bold":case"dim":case"italic":case"underline":case"strikethrough":{let[n,r]=m[e.kind];return`${n}${e.children.map(C).join("")}${r}`}case"color":return`${M[e.color]??M.white}${e.children.map(C).join("")}${A}`;case"group":return e.children.map(C).join("");case"code-block":{let n=m.dim[0],r=m.dim[1];return e.value.split(`
16
+ `).map(o=>`${n} ${o}${r}`).join(`
17
+ `)+`
18
+ `}case"table":{let n=e.headers.map((c,d)=>{let w=e.rows.reduce(($,j)=>{let O=j[d];return Math.max($,O!==void 0?h(O):0)},0);return Math.max(h(c),w)}),r=m.bold[0],o=m.bold[1],t=m.dim[0],l=m.dim[1],i=(c,d)=>{let w=C(c),$=h(c);return w+" ".repeat(Math.max(0,d-$))},p=e.headers.map((c,d)=>`${r}${i(c,n[d])}${o}`).join(" "),a=`${t}${n.map(c=>"\u2500".repeat(c)).join("\u2500\u2500")}${l}`,T=e.rows.map(c=>c.map((d,w)=>i(d,n[w])).join(" ")).join(`
19
+ `);return`${p}
20
+ ${a}
21
+ ${T}
22
+ `}case"list":return e.items.map(n=>` \u2022 ${n.map(C).join("")}`).join(`
23
+ `)+`
24
+ `;case"gauge":{let n=e.width??20,r=Math.round(n*e.percent/100),o=n-r,t=`${M.green}${"\u2588".repeat(r)}${A}${m.dim[0]}${"\u2591".repeat(o)}${m.dim[1]}`,l=` ${e.percent}%`,i=e.label?`${m.dim[0]} ${e.label}${m.dim[1]}`:"";return`${t}${l}${i}`}case"separator":{let n=m.dim[0],r=m.dim[1];if(e.label){let o="\u2500".repeat(Math.max(0,33-e.label.length));return`${n}\u2500\u2500\u2500\u2500 ${e.label} ${o}${r}
25
+ `}return`${n}${"\u2500".repeat(40)}${r}
26
+ `}case"alert":{let n={info:"\u2139",success:"\u2713",warning:"\u25B2",error:"\u2717"},r={info:"cyan",success:"green",warning:"yellow",error:"red"},o=n[e.level];return`${M[r[e.level]]}${o}${A} ${e.children.map(C).join("")}`}}},J=()=>({name:"ansi",render:e=>{let n=e.map(C).join("");return n.includes(s)?n+ae:n}});var f=e=>{switch(e.kind){case"text":return e.value;case"newline":return`
27
+ `;case"bold":return`**${e.children.map(f).join("")}**`;case"italic":return`*${e.children.map(f).join("")}*`;case"strikethrough":return`~~${e.children.map(f).join("")}~~`;case"dim":case"underline":case"color":case"group":return e.children.map(f).join("");case"code-block":return`\`\`\`${e.language??""}
28
+ ${e.value}
29
+ \`\`\`
30
+ `;case"table":{let n=`| ${e.headers.map(f).join(" | ")} |`,r=`| ${e.headers.map(()=>"---").join(" | ")} |`,o=e.rows.map(t=>`| ${t.map(f).join(" | ")} |`).join(`
31
+ `);return`${n}
32
+ ${r}
33
+ ${o}
34
+ `}case"list":return e.items.map(n=>`- ${n.map(f).join("")}`).join(`
35
+ `)+`
36
+ `;case"gauge":{let n=e.label?` \u2014 ${e.label}`:"";return`**${e.percent}%**${n}`}case"separator":return e.label?`--- ${e.label} ---
37
+ `:`---
38
+ `;case"alert":{let n={info:"\u2139 Info",success:"\u2713 Success",warning:"\u26A0 Warning",error:"\u2717 Error"},r=e.children.map(f).join("");return`> **${n[e.level]}:** ${r}
39
+ `}}},Q=()=>({name:"markdown",render:e=>e.map(f).join("")});export{S as a,Z as b,le as c,pe as d,ue as e,de as f,ce as g,me as h,ye as i,he as j,fe as k,ke as l,Se as m,we as n,U as o,re as p,Y as q,V as r};
@@ -0,0 +1,7 @@
1
+ import{f as a}from"./chunk-KRKOWSYW.js";import{i as n}from"./chunk-Y5E7ZCCX.js";var m=t=>{if(t?.driver!=="acp")return!1;let e=t.driverPid;return typeof e!="number"?!1:n.process.isAlive(e)},f=async t=>{let e=`${t}/${a.progressesDir}/files-changed.jsonl`;try{let s=(await n.fs.readTextFile(e)).trim().split(`
2
+ `).filter(Boolean).map(r=>{try{return JSON.parse(r).file}catch{return null}}).filter(r=>r!==null);return[...new Set(s)]}catch{return[]}},p=async t=>{try{let{execSync:e}=await import("node:child_process"),i=e("git diff --name-only",{cwd:t,encoding:"utf-8",timeout:5e3}),r=e("git diff --stat",{cwd:t,encoding:"utf-8",timeout:5e3}).trim().split(`
3
+ `);return{files:i.trim().split(`
4
+ `).filter(Boolean),stat:r[r.length-1]??""}}catch{return{files:[],stat:""}}},y=async t=>{let e;try{let u=await n.fs.readTextFile(`${t}/${a.stateFile}`);e=JSON.parse(u)}catch{return null}let i=e.execution??{},[s,r]=await Promise.all([f(t),p(t)]),c=[...new Set([...s,...r.files])],o=(i.iteration??0)+1,l=r.stat.trim(),d=`${t}/${a.progressesDir}/iterations`;try{await n.fs.mkdir(d,{recursive:!0}),await n.fs.writeTextFile(`${d}/iteration-${o}.json`,JSON.stringify({iteration:o,files:c,gitStat:l,timestamp:new Date().toISOString()},null,2)+`
5
+ `)}catch{}e.execution={...i,iteration:o,modifiedFiles:c,lastProgress:l||i.lastProgress||null},e.lastCalledAt=new Date().toISOString();try{await n.fs.writeTextFile(`${t}/${a.stateFile}`,JSON.stringify(e,null,2)+`
6
+ `)}catch{}try{await n.fs.writeTextFile(`${t}/${a.progressesDir}/files-changed.jsonl`,"")}catch{}return{iteration:o,modifiedFiles:c,gitStat:l}},h=async(t,e)=>{let i;try{let r=await n.fs.readTextFile(`${t}/${a.stateFile}`);i=JSON.parse(r)}catch{return}let s={...i.execution??{}};e===null?(delete s.driver,delete s.driverPid):(s.driver=e,s.driverPid=n.process.pid),i.execution=s;try{await n.fs.writeTextFile(`${t}/${a.stateFile}`,JSON.stringify(i,null,2)+`
7
+ `)}catch{}};export{m as a,y as b,h as c};
@@ -1,4 +1,4 @@
1
- import{i as c}from"./chunk-XNGHRJVK.js";var l=".eser/learnings.jsonl",f=async(s,e)=>{let r=`${s}/${l}`,t=JSON.stringify(e)+`
1
+ import{i as c}from"./chunk-Y5E7ZCCX.js";var l=".eser/learnings.jsonl",f=async(s,e)=>{let r=`${s}/${l}`,t=JSON.stringify(e)+`
2
2
  `,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(`
3
3
  `).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(`
4
4
  `)+(t.length>0?`
@@ -1 +1 @@
1
- import{b as B,c as L}from"./chunk-CKETVOVQ.js";import{a as P,b,c as w,d as O,e as E,f as I,g as a,h as N,i as _,j as W,k as $,l as F,m as p,n as j,o as S,p as A,q as T,y as M}from"./chunk-YSLRAWBK.js";import{d as Q}from"./chunk-OTRBRRIO.js";var U={};Q(U,{AlreadyExistsError:()=>w,NotFoundError:()=>b,ProcessError:()=>O,RuntimeCapabilityError:()=>P,buildCommand:()=>R,clearWorkerdEnv:()=>L,createRuntime:()=>H,detectExecutionContext:()=>y,detectInvoker:()=>h,detectRuntime:()=>a,getArch:()=>j,getCliPrefix:()=>J,getHomedir:()=>S,getPlatform:()=>p,getPlatformInfo:()=>T,getRuntimeVersion:()=>N,getTmpdir:()=>A,isBrowser:()=>W,isCommandInPath:()=>v,isEdge:()=>F,isRuntime:()=>_,isServer:()=>$,matchCliPrefix:()=>D,populateEnvFromContext:()=>B,posixPath:()=>I,resolvePathDirs:()=>g,runtime:()=>i,toPosix:()=>E});var g=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},l=new Set(["deno","node","bun"]),h=(e,n,t,r,o,s)=>{let d=l.has(e)?e:n;if(!l.has(d))return{invoker:"binary",mode:"installed"};if(d==="bun")return r.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(d==="node"){let m=t[1]??"";if(m.includes("_npx")||m.includes("/npx"))return{invoker:"npx",mode:"on-demand"};if(m.includes("pnpm")||m.includes("pnpx"))return{invoker:"pnpx",mode:"on-demand"};let c=r.npm_execpath??"";return c.includes("npx")?{invoker:"npx",mode:"on-demand"}:c.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(r.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return d==="deno"?o!==void 0&&(o.startsWith("jsr:")||o.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},R=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,v=async e=>{let n=p(),t=n==="windows"?`${e}.exe`:e,r=i.env.get("PATH")??"",o=g(r,n);for(let s of o)try{return await i.fs.stat(i.path.join(s,t)),!0}catch{continue}return!1},D=(e,n)=>{for(let t of e){let r=n.indexOf(t);if(r>=0)return n.slice(0,r+1).join(" ");let o=n.findIndex(s=>s.endsWith(`/${t}`)||s.endsWith(`\\${t}`)||s.includes(`:${t}`));if(o>=0)return n.slice(0,o+1).join(" ")}},J=async(e,n)=>{let t=await y(e),r=i.process.argv;for(let o of n){if(r.includes(o))return`${t.command} ${o}`;if(r.some(d=>d.endsWith(`/${o}`)||d.endsWith(`\\${o}`)||d.includes(`:${o}`)))return t.command}},y=async e=>{let n=i.path.basename(i.process.execPath()),t=a(),r=i.process.argv,o=import.meta.url,s=l.has(n)?n:t,d={BUN_INSTALL:i.env.get("BUN_INSTALL"),npm_execpath:i.env.get("npm_execpath"),npm_config_user_agent:i.env.get("npm_config_user_agent")},m=!1;if(s==="deno"&&o.startsWith("file://")){let k=i.process.cwd();try{let x=i.path.join(k,"deno.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).tasks;u!==void 0&&"cli"in u&&(m=!0)}catch{}if(!m)try{let x=i.path.join(k,"package.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).scripts;u!==void 0&&"cli"in u&&(m=!0)}catch{}}let{invoker:c,mode:f}=h(n,t,r,d,o,m),K=l.has(s)?s:"compiled",q=R(c,f,e),z=await v(e.command);return{runtime:K,mode:f,invoker:c,command:q,isInPath:z}};var V={deno:async()=>(await import("./deno-QOH6TCLQ.js")).createDenoRuntime(),node:async()=>(await import("./node-BPWE6I45.js")).createNodeRuntime(),bun:async()=>(await import("./bun-5VMFSLLY.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-IIQRIOBX.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-XLYVEO2J.js")).createBrowserRuntime()},X=["fs","exec","env","path","process"],Y=e=>e!==void 0&&X.some(n=>e[n]!==void 0),Z=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),H=async e=>{let n=a(),t=V[n],r=t!==void 0?await t():M(n),o=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&Y(e)?Z(r,e,o):e?.capabilities?{...r,capabilities:o}:r},i=await H();export{g as a,h as b,R as c,v as d,D as e,J as f,y as g,H as h,i,U as j};
1
+ import{b as B,c as L}from"./chunk-LJEWPIEI.js";import{a as P,b,c as w,d as O,e as E,f as I,g as a,h as N,i as _,j as W,k as $,l as F,m as p,n as j,o as S,p as A,q as T,y as M}from"./chunk-FE4MKOI4.js";import{d as Q}from"./chunk-HISXAZ4Y.js";var U={};Q(U,{AlreadyExistsError:()=>w,NotFoundError:()=>b,ProcessError:()=>O,RuntimeCapabilityError:()=>P,buildCommand:()=>R,clearWorkerdEnv:()=>L,createRuntime:()=>H,detectExecutionContext:()=>y,detectInvoker:()=>h,detectRuntime:()=>a,getArch:()=>j,getCliPrefix:()=>J,getHomedir:()=>S,getPlatform:()=>p,getPlatformInfo:()=>T,getRuntimeVersion:()=>N,getTmpdir:()=>A,isBrowser:()=>W,isCommandInPath:()=>v,isEdge:()=>F,isRuntime:()=>_,isServer:()=>$,matchCliPrefix:()=>D,populateEnvFromContext:()=>B,posixPath:()=>I,resolvePathDirs:()=>g,runtime:()=>i,toPosix:()=>E});var g=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},l=new Set(["deno","node","bun"]),h=(e,n,t,r,o,s)=>{let d=l.has(e)?e:n;if(!l.has(d))return{invoker:"binary",mode:"installed"};if(d==="bun")return r.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(d==="node"){let m=t[1]??"";if(m.includes("_npx")||m.includes("/npx"))return{invoker:"npx",mode:"on-demand"};if(m.includes("pnpm")||m.includes("pnpx"))return{invoker:"pnpx",mode:"on-demand"};let c=r.npm_execpath??"";return c.includes("npx")?{invoker:"npx",mode:"on-demand"}:c.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(r.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return d==="deno"?o!==void 0&&(o.startsWith("jsr:")||o.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},R=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,v=async e=>{let n=p(),t=n==="windows"?`${e}.exe`:e,r=i.env.get("PATH")??"",o=g(r,n);for(let s of o)try{return await i.fs.stat(i.path.join(s,t)),!0}catch{continue}return!1},D=(e,n)=>{for(let t of e){let r=n.indexOf(t);if(r>=0)return n.slice(0,r+1).join(" ");let o=n.findIndex(s=>s.endsWith(`/${t}`)||s.endsWith(`\\${t}`)||s.includes(`:${t}`));if(o>=0)return n.slice(0,o+1).join(" ")}},J=async(e,n)=>{let t=await y(e),r=i.process.argv;for(let o of n){if(r.includes(o))return`${t.command} ${o}`;if(r.some(d=>d.endsWith(`/${o}`)||d.endsWith(`\\${o}`)||d.includes(`:${o}`)))return t.command}},y=async e=>{let n=i.path.basename(i.process.execPath()),t=a(),r=i.process.argv,o=import.meta.url,s=l.has(n)?n:t,d={BUN_INSTALL:i.env.get("BUN_INSTALL"),npm_execpath:i.env.get("npm_execpath"),npm_config_user_agent:i.env.get("npm_config_user_agent")},m=!1;if(s==="deno"&&o.startsWith("file://")){let k=i.process.cwd();try{let x=i.path.join(k,"deno.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).tasks;u!==void 0&&"cli"in u&&(m=!0)}catch{}if(!m)try{let x=i.path.join(k,"package.json"),C=await i.fs.readTextFile(x),u=JSON.parse(C).scripts;u!==void 0&&"cli"in u&&(m=!0)}catch{}}let{invoker:c,mode:f}=h(n,t,r,d,o,m),K=l.has(s)?s:"compiled",q=R(c,f,e),z=await v(e.command);return{runtime:K,mode:f,invoker:c,command:q,isInPath:z}};var V={deno:async()=>(await import("./deno-YM5PW6ZM.js")).createDenoRuntime(),node:async()=>(await import("./node-J4GTOSL2.js")).createNodeRuntime(),bun:async()=>(await import("./bun-WZ7BVR7Y.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-I7MLRCLJ.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-BGFD24RX.js")).createBrowserRuntime()},X=["fs","exec","env","path","process"],Y=e=>e!==void 0&&X.some(n=>e[n]!==void 0),Z=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),H=async e=>{let n=a(),t=V[n],r=t!==void 0?await t():M(n),o=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&Y(e)?Z(r,e,o):e?.capabilities?{...r,capabilities:o}:r},i=await H();export{g as a,h as b,R as c,v as d,D as e,J as f,y as g,H as h,i,U as j};
@@ -0,0 +1 @@
1
+ import{i as n}from"./chunk-Y5E7ZCCX.js";import{m as i}from"./chunk-FE4MKOI4.js";var f=[{envVars:["CLAUDE_CODE","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_SESSION_ID"],tool:"claude-code"},{envVars:["CURSOR_SESSION","CURSOR"],tool:"cursor"},{envVars:["KIRO_SESSION","KIRO"],tool:"kiro"},{envVars:["WINDSURF_SESSION"],tool:"windsurf"},{envVars:["GITHUB_COPILOT"],tool:"copilot"}],c=()=>{for(let e of f)for(let t of e.envVars){let o=n.env.get(t);if(o!==void 0&&o!=="")return e.tool}return null},g=()=>c()!==null?"agent":"human";var p=async e=>{try{let t=await n.fs.stat(e);return t.isFile?i()==="windows"?!0:t.mode===null||(t.mode&73)!==0:!1}catch{return!1}},a=async e=>{if(e.includes("/")||e.includes("\\")||e.includes(".."))return null;let t=i()==="windows",o=n.env.get("PATH")??n.env.get("Path")??"";if(o==="")return null;let u=t?["",...(n.env.get("PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";")]:[""],h=t?"\\":"/";for(let r of o.split(t?";":":"))if(r!=="")for(let s of u){let l=`${r}${h}${e}${t?s:s.toLowerCase()}`;if(await p(l))return l}return null},d=async e=>await a(e)!==null;export{c as a,g as b,d as c};
@@ -0,0 +1 @@
1
+ import{a,b,c}from"./chunk-RAQY37P6.js";import"./chunk-CML74SNT.js";import"./chunk-JYVB6UAV.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{a as ClaudeCodeModel,b as claudeCodeFactory,c as parseJsonResult};
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"./chunk-IFE5SYGK.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{c as cmd,b as cmdPrefix,d as extractPrefix,a as setCommandPrefix};
@@ -0,0 +1 @@
1
+ import{d as z}from"./chunk-7PPUGTKL.js";import{b as I,c as P}from"./chunk-IFE5SYGK.js";import{c as p,d,f as m,g as k,h as R,o as g,q as v,r as h}from"./chunk-VXU6XZ66.js";import{b as $,g as x}from"./chunk-O4KKKYCH.js";import{E as b,o as y,p as A,q as M,r as D}from"./chunk-KRKOWSYW.js";import{a as f,b as w}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var J=async t=>{let e=t?.[0];if(e==="add")return await U(t?.slice(1));if(e==="remove")return await E(t?.slice(1));if(e==="list")return await F(t?.slice(1));let n=I(),r=g({renderer:h.ansi(),sink:v.stdout()});return r.writeln(`Usage: ${n} concern <add <id> | remove <id> | list>`),await r.close(),f(void 0)},U=async t=>{let e=g({renderer:h.ansi(),sink:v.stdout()}),{root:n}=await b(),r=(t??[]).filter(o=>!o.startsWith("-")),a=await y(n);if(r.length===0)return e.writeln(m("Please provide concern ID(s): "),p(P("concern add open-source beautiful-product"))),await e.close(),w({exitCode:1});if(a===null)return e.writeln(m("noskills not initialized.")),await e.close(),w({exitCode:1});let c=await $(),i=[];for(let o of r){let l=await M(n,o);if(l===null&&(l=c.find(s=>s.id===o)??null,l!==null&&await D(n,l)),l===null){e.writeln(m(`Unknown concern: ${o}`)),e.writeln(d(` Available: ${c.map(s=>s.id).join(", ")}`));continue}if(a.concerns.includes(o)||i.includes(o)){e.writeln(d(`Concern "${o}" is already active.`));continue}i.push(o)}if(i.length>0){let o={...a,concerns:[...a.concerns,...i]};await A(n,o),e.writeln(k("\u2714"),` Activated concerns: ${i.join(", ")}`)}return await e.close(),f(void 0)},E=async t=>{let e=g({renderer:h.ansi(),sink:v.stdout()}),{root:n}=await b(),r=t?.[0],a=await y(n);if(r===void 0||r.length===0)return e.writeln(m("Please provide a concern ID: "),p(P("concern remove move-fast"))),await e.close(),w({exitCode:1});if(a===null)return e.writeln(m("noskills not initialized.")),await e.close(),w({exitCode:1});if(!a.concerns.includes(r))return e.writeln(d(`Concern "${r}" is not active.`)),await e.close(),f(void 0);let c={...a,concerns:a.concerns.filter(i=>i!==r)};return await A(n,c),e.writeln(k("\u2714")," Deactivated concern: ",p(r)),await e.close(),f(void 0)},T=t=>t.length===0?t:t[0].toUpperCase()+t.slice(1),F=async t=>{let e=t?.includes("--json")??!1,n=g({renderer:h.ansi(),sink:v.stdout()}),{root:r}=await b(),a=await y(r),c=await $(),i=a?.concerns??[],o=c.filter(s=>i.includes(s.id));if(e)return await n.close(),await z({concerns:c.map(s=>({id:s.id,description:s.description,category:s.category??"general",isActive:i.includes(s.id)})),active:i},"json"),f(void 0);let l=new Map;for(let s of c){let u=s.category??"general";l.has(u)||l.set(u,[]),l.get(u).push(s)}if(n.writeln(p("Concerns"),d(` (${c.length} available, ${i.length} active)`)),n.writeln(""),c.length===0)n.writeln(d(" No concerns defined."));else for(let[s,u]of l){n.writeln(p(T(s)+":"));for(let C of u){let j=i.includes(C.id);n.writeln(" ",j?k("\u25CF"):d("\u25CB")," ",j?p(C.id.padEnd(24)):d(C.id.padEnd(24)),d(C.description))}n.writeln("")}try{let s=x(o);if(s.length>0){n.writeln(R("\u26A0 Tensions detected:"));for(let u of s)n.writeln(d(` ${u.between[0]} \u2194 ${u.between[1]}: ${u.issue}`));n.writeln("")}}catch{}return await n.close(),f(void 0)};export{J as main};
@@ -1 +1 @@
1
- import{a as p,b as h,c as k,d as C,e as P,f as w}from"./chunk-HNAHPI6V.js";import{b as m}from"./chunk-UT6ZCLRA.js";import{c as d,d as n,f,g,o as l,q as o,r as u}from"./chunk-2GF5IUQD.js";import{a,b as c}from"./chunk-2N4GTHXQ.js";import"./chunk-XNGHRJVK.js";import"./chunk-CKETVOVQ.js";import"./chunk-YSLRAWBK.js";import"./chunk-OTRBRRIO.js";var G=async s=>{let e=s?.[0];if(e==="set-user")return await v(s?.slice(1));if(e==="get-user")return await x();if(e==="clear-user")return await A();let r=m(),i=l({renderer:u.ansi(),sink:o.stdout()});return i.writeln(`Usage: ${r} config <set-user | get-user | clear-user>`),await i.close(),a(void 0)},v=async s=>{let e=l({renderer:u.ansi(),sink:o.stdout()}),r=null,i=null,y=!1;for(let t of s??[])t.startsWith("--name=")?r=t.slice(7):t.startsWith("--email=")?i=t.slice(8):t==="--from-git"&&(y=!0);if(y){let t=await P();if(t===null)return e.writeln(f("Could not read git user config.")),await e.close(),c({exitCode:1});r=t.name,i=t.email}if(r===null||r.length===0)return e.writeln(f("Please provide a name: "),d(`${m()} config set-user --name="Your Name" --email="you@example.com"`)),await e.close(),c({exitCode:1});let U={name:r,email:i??""};return await k(U),e.writeln(g("User set: "),d(w(U))),e.writeln(n(` Stored in: ${p()}`)),await e.close(),a(void 0)},x=async()=>{let s=l({renderer:u.ansi(),sink:o.stdout()}),e=await h();return e===null?(s.writeln(n("No user configured.")),s.writeln(n(`Set one with: ${m()} config set-user --name="Your Name"`))):(s.writeln(d("User: "),w(e)),s.writeln(n(` File: ${p()}`))),await s.close(),a(void 0)},A=async()=>{let s=l({renderer:u.ansi(),sink:o.stdout()});return await C()?s.writeln(g("User identity cleared.")):s.writeln(n("No user configured.")),await s.close(),a(void 0)};export{G as main};
1
+ import{a as p,b as h,c as k,d as C,e as P,f as w}from"./chunk-5RLCKUIF.js";import{b as m}from"./chunk-IFE5SYGK.js";import{c as d,d as n,f,g,o as l,q as o,r as u}from"./chunk-VXU6XZ66.js";import{a,b as c}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var G=async s=>{let e=s?.[0];if(e==="set-user")return await v(s?.slice(1));if(e==="get-user")return await x();if(e==="clear-user")return await A();let r=m(),i=l({renderer:u.ansi(),sink:o.stdout()});return i.writeln(`Usage: ${r} config <set-user | get-user | clear-user>`),await i.close(),a(void 0)},v=async s=>{let e=l({renderer:u.ansi(),sink:o.stdout()}),r=null,i=null,y=!1;for(let t of s??[])t.startsWith("--name=")?r=t.slice(7):t.startsWith("--email=")?i=t.slice(8):t==="--from-git"&&(y=!0);if(y){let t=await P();if(t===null)return e.writeln(f("Could not read git user config.")),await e.close(),c({exitCode:1});r=t.name,i=t.email}if(r===null||r.length===0)return e.writeln(f("Please provide a name: "),d(`${m()} config set-user --name="Your Name" --email="you@example.com"`)),await e.close(),c({exitCode:1});let U={name:r,email:i??""};return await k(U),e.writeln(g("User set: "),d(w(U))),e.writeln(n(` Stored in: ${p()}`)),await e.close(),a(void 0)},x=async()=>{let s=l({renderer:u.ansi(),sink:o.stdout()}),e=await h();return e===null?(s.writeln(n("No user configured.")),s.writeln(n(`Set one with: ${m()} config set-user --name="Your Name"`))):(s.writeln(d("User: "),w(e)),s.writeln(n(` File: ${p()}`))),await s.close(),a(void 0)},A=async()=>{let s=l({renderer:u.ansi(),sink:o.stdout()});return await C()?s.writeln(g("User identity cleared.")):s.writeln(n("No user configured.")),await s.close(),a(void 0)};export{G as main};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-GQTHILPL.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import"./chunk-KRKOWSYW.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{g as captureTransition,c as computeSummary,b as countOpenQuestions,a as diffDecisions,e as readLedger,f as readSummary,d as toMeasurementDraft};
@@ -0,0 +1 @@
1
+ import{a as k}from"./chunk-DBKXMYLF.js";import{h as C}from"./chunk-5RLCKUIF.js";import{H as v}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import"./chunk-IFE5SYGK.js";import{f as n,g as u,o as f,q as w,r as h}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as S,h as g,j as y,m as E}from"./chunk-KRKOWSYW.js";import{a as d,b as a}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var $=async p=>{let e=f({renderer:h.ansi(),sink:w.stdout()}),{root:i}=await S(),s=y(p);if(!s.ok)return e.writeln(n(s.error)),await e.close(),a({exitCode:1});let m=(p??[]).filter(r=>!r.startsWith("--")),o=m[0],l=m.slice(1).join(" ");if(!o||!l)return e.writeln(n("Usage: noskills spec <name> delegate <questionId> <userName>")),await e.close(),a({exitCode:1});let t;try{t=await g(i,s.spec)}catch(r){let R=r instanceof Error?r.message:String(r);return e.writeln(n(R)),await e.close(),a({exitCode:1})}if(t.phase!=="DISCOVERY"&&t.phase!=="DISCOVERY_REFINEMENT")return e.writeln(n(`Cannot delegate in phase: ${t.phase}. Only during discovery.`)),await e.close(),a({exitCode:1});let c=await C(i),I=v(t,o,l,c.name);return await E(i,s.spec,I),await k(i,{ts:new Date().toISOString(),type:"delegation-created",spec:s.spec,user:c.name,question:o,from:c.name,to:l}),e.writeln(u("\u2714"),` Delegated "${o}" to ${l}`),await e.close(),d(void 0)};export{$ as main};
@@ -0,0 +1 @@
1
+ import{b as D,d as X,r as G}from"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";import we from"node:process";function Y(){let e=globalThis,r=e.process?.platform;if(typeof r=="string")return r.startsWith("win");let t=e.Deno?.build?.os;return typeof t=="string"?t==="windows":e.navigator?.platform?.startsWith("Win")??!1}var A=Y();function C(e){if(typeof e!="string")throw new TypeError(`Path must be a string, received "${JSON.stringify(e)}"`)}function H(e,r){if(r.length>=e.length)return e;let t=e.length-r.length;for(let o=r.length-1;o>=0;--o)if(e.charCodeAt(t+o)!==r.charCodeAt(o))return e;return e.slice(0,-r.length)}function k(e,r,t=0){let o=!1,s=e.length;for(let i=e.length-1;i>=t;--i)if(r(e.charCodeAt(i))){if(o){t=i+1;break}}else o||(o=!0,s=i+1);return e.slice(t,s)}function L(e,r){if(C(e),e.length===0)return e;if(typeof r!="string")throw new TypeError(`Suffix must be a string, received "${JSON.stringify(r)}"`)}function U(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function w(e){return e=U(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function S(e,r){if(e.length<=1)return e;let t=e.length;for(let o=e.length-1;o>0&&r(e.charCodeAt(o));o--)t=o;return e.slice(0,t)}function p(e){return e===47}function V(e,r=""){e instanceof URL&&(e=w(e)),L(e,r);let t=k(e,p),o=S(t,p);return r?H(o,r):o}function q(e){return e===47}function m(e){return e===47||e===92}function x(e){return e>=97&&e<=122||e>=65&&e<=90}function P(e){e=U(e);let r=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(r=`\\\\${e.hostname}${r}`),r}function ee(e,r=""){e instanceof URL&&(e=P(e)),L(e,r);let t=0;if(e.length>=2){let i=e.charCodeAt(0);x(i)&&e.charCodeAt(1)===58&&(t=2)}let o=k(e,m,t),s=S(o,m);return r?H(s,r):s}function re(e,r=""){return A?ee(e,r):V(e,r)}var te=A?";":":",B=A?"\\":"/";function W(e){if(C(e),e.length===0)return"."}function oe(e){e instanceof URL&&(e=w(e)),W(e);let r=-1,t=!1;for(let o=e.length-1;o>=1;--o)if(p(e.charCodeAt(o))){if(t){r=o;break}}else t=!0;return r===-1?p(e.charCodeAt(0))?"/":".":S(e.slice(0,r),p)}function ie(e){e instanceof URL&&(e=P(e)),W(e);let r=e.length,t=-1,o=-1,s=!0,i=0,a=e.charCodeAt(0);if(r>1)if(m(a)){if(t=i=1,m(e.charCodeAt(1))){let n=2,l=n;for(;n<r&&!m(e.charCodeAt(n));++n);if(n<r&&n!==l){for(l=n;n<r&&m(e.charCodeAt(n));++n);if(n<r&&n!==l){for(l=n;n<r&&!m(e.charCodeAt(n));++n);if(n===r)return e;n!==l&&(t=i=n+1)}}}}else x(a)&&e.charCodeAt(1)===58&&(t=i=2,r>2&&m(e.charCodeAt(2))&&(t=i=3));else if(m(a))return e;for(let n=r-1;n>=i;--n)if(m(e.charCodeAt(n))){if(!s){o=n;break}}else s=!1;if(o===-1){if(t===-1)return".";o=t}return S(e.slice(0,o),q)}function ne(e){return A?ie(e):oe(e)}function se(e){e instanceof URL&&(e=w(e)),C(e);let r=-1,t=0,o=-1,s=!0,i=0;for(let a=e.length-1;a>=0;--a){let n=e.charCodeAt(a);if(p(n)){if(!s){t=a+1;break}continue}o===-1&&(s=!1,o=a+1),n===46?r===-1?r=a:i!==1&&(i=1):r!==-1&&(i=-1)}return r===-1||o===-1||i===0||i===1&&r===o-1&&r===t+1?"":e.slice(r,o)}function ae(e){e instanceof URL&&(e=P(e)),C(e);let r=0,t=-1,o=0,s=-1,i=!0,a=0;e.length>=2&&e.charCodeAt(1)===58&&x(e.charCodeAt(0))&&(r=o=2);for(let n=e.length-1;n>=r;--n){let l=e.charCodeAt(n);if(m(l)){if(!i){o=n+1;break}continue}s===-1&&(i=!1,s=n+1),l===46?t===-1?t=n:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===o+1?"":e.slice(t,s)}function fe(e){return A?ae(e):se(e)}function N(e,r){let t=r.dir||r.root,o=r.base||(r.name??"")+(r.ext??"");return t?o===e?t:t===r.root?t+o:t+e+o:o}function $(e){if(e===null||typeof e!="object")throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof e}"`)}function le(e){return $(e),N("/",e)}function ce(e){return $(e),N("\\",e)}function me(e){return A?ce(e):le(e)}function j(e){return C(e),e.length>0&&p(e.charCodeAt(0))}function M(e){C(e);let r=e.length;if(r===0)return!1;let t=e.charCodeAt(0);return m(t)?!0:!!(x(t)&&r>2&&e.charCodeAt(1)===58&&m(e.charCodeAt(2)))}function de(e){return A?M(e):j(e)}function I(e){if(C(e),e.length===0)return"."}function _(e,r,t,o){let s="",i=0,a=-1,n=0,l;for(let c=0;c<=e.length;++c){if(c<e.length)l=e.charCodeAt(c);else{if(o(l))break;l=47}if(o(l)){if(!(a===c-1||n===1))if(a!==c-1&&n===2){if(s.length<2||i!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){let d=s.lastIndexOf(t);d===-1?(s="",i=0):(s=s.slice(0,d),i=s.length-1-s.lastIndexOf(t)),a=c,n=0;continue}else if(s.length===2||s.length===1){s="",i=0,a=c,n=0;continue}}r&&(s.length>0?s+=`${t}..`:s="..",i=2)}else s.length>0?s+=t+e.slice(a+1,c):s=e.slice(a+1,c),i=c-a-1;a=c,n=0}else l===46&&n!==-1?++n:n=-1}return s}function v(e){e instanceof URL&&(e=w(e)),I(e);let r=p(e.charCodeAt(0)),t=p(e.charCodeAt(e.length-1));return e=_(e,!r,"/",p),e.length===0&&!r&&(e="."),e.length>0&&t&&(e+="/"),r?`/${e}`:e}function K(e,...r){if(e===void 0)return".";e instanceof URL&&(e=w(e)),r=e?[e,...r]:r,r.forEach(o=>C(o));let t=r.filter(o=>o.length>0).join("/");return t===""?".":v(t)}function F(e){e instanceof URL&&(e=P(e)),I(e);let r=e.length,t=0,o,s=!1,i=e.charCodeAt(0);if(r>1)if(m(i))if(s=!0,m(e.charCodeAt(1))){let n=2,l=n;for(;n<r&&!m(e.charCodeAt(n));++n);if(n<r&&n!==l){let c=e.slice(l,n);for(l=n;n<r&&m(e.charCodeAt(n));++n);if(n<r&&n!==l){for(l=n;n<r&&!m(e.charCodeAt(n));++n);if(n===r)return`\\\\${c}\\${e.slice(l)}\\`;n!==l&&(o=`\\\\${c}\\${e.slice(l,n)}`,t=n)}}}else t=1;else x(i)&&e.charCodeAt(1)===58&&(o=e.slice(0,2),t=2,r>2&&m(e.charCodeAt(2))&&(s=!0,t=3));else if(m(i))return"\\";let a;return t<r?a=_(e.slice(t),!s,"\\",m):a="",a.length===0&&!s&&(a="."),a.length>0&&m(e.charCodeAt(r-1))&&(a+="\\"),o===void 0?s?a.length>0?`\\${a}`:"\\":a:s?a.length>0?`${o}\\${a}`:`${o}\\`:o+a}function Z(e,...r){if(e instanceof URL&&(e=P(e)),r=e?[e,...r]:r,r.forEach(a=>C(a)),r=r.filter(a=>a.length>0),r.length===0)return".";let t=!0,o=0,s=r[0];if(m(s.charCodeAt(0))){++o;let a=s.length;a>1&&m(s.charCodeAt(1))&&(++o,a>2&&(m(s.charCodeAt(2))?++o:t=!1))}let i=r.join("\\");if(t){for(;o<i.length&&m(i.charCodeAt(o));++o);o>=2&&(i=`\\${i.slice(o)}`)}return F(i)}function J(e,...r){return A?Z(e,...r):K(e,...r)}function ue(e){return A?F(e):v(e)}function pe(e){C(e);let r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;let t=p(e.charCodeAt(0)),o;t?(r.root="/",o=1):o=0;let s=-1,i=0,a=-1,n=!0,l=e.length-1,c=0;for(;l>=o;--l){let d=e.charCodeAt(l);if(p(d)){if(!n){i=l+1;break}continue}a===-1&&(n=!1,a=l+1),d===46?s===-1?s=l:c!==1&&(c=1):s!==-1&&(c=-1)}return s===-1||a===-1||c===0||c===1&&s===a-1&&s===i+1?(a!==-1&&(i===0&&t?r.base=r.name=e.slice(1,a):r.base=r.name=e.slice(i,a)),r.base=r.base||"/"):(i===0&&t?(r.name=e.slice(1,s),r.base=e.slice(1,a)):(r.name=e.slice(i,s),r.base=e.slice(i,a)),r.ext=e.slice(s,a)),i>0?r.dir=S(e.slice(0,i-1),p):t&&(r.dir="/"),r}function Ae(e){C(e);let r={root:"",dir:"",base:"",ext:"",name:""},t=e.length;if(t===0)return r;let o=0,s=e.charCodeAt(0);if(t>1){if(m(s)){if(o=1,m(e.charCodeAt(1))){let f=2,u=f;for(;f<t&&!m(e.charCodeAt(f));++f);if(f<t&&f!==u){for(u=f;f<t&&m(e.charCodeAt(f));++f);if(f<t&&f!==u){for(u=f;f<t&&!m(e.charCodeAt(f));++f);f===t?o=f:f!==u&&(o=f+1)}}}}else if(x(s)&&e.charCodeAt(1)===58)if(o=2,t>2){if(m(e.charCodeAt(2))){if(t===3)return r.root=r.dir=e,r.base="\\",r;o=3}}else return r.root=r.dir=e,r}else if(m(s))return r.root=r.dir=e,r.base="\\",r;o>0&&(r.root=e.slice(0,o));let i=-1,a=o,n=-1,l=!0,c=e.length-1,d=0;for(;c>=o;--c){if(s=e.charCodeAt(c),m(s)){if(!l){a=c+1;break}continue}n===-1&&(l=!1,n=c+1),s===46?i===-1?i=c:d!==1&&(d=1):i!==-1&&(d=-1)}return i===-1||n===-1||d===0||d===1&&i===n-1&&i===a+1?n!==-1&&(r.base=r.name=e.slice(a,n)):(r.name=e.slice(a,i),r.base=e.slice(a,n),r.ext=e.slice(i,n)),r.base=r.base||"\\",a>0&&a!==o?r.dir=e.slice(0,a-1):r.dir=r.root,r}function Ce(e){return A?Ae(e):pe(e)}function b(e){let r=globalThis,t=r.process?.cwd??r.Deno?.cwd;if(typeof t!="function")throw new TypeError(e);return t()}function O(...e){let r="",t=!1;for(let o=e.length-1;o>=-1&&!t;o--){let s;o>=0?s=e[o]:s=b("Resolved a relative path without a current working directory (CWD)"),C(s),s.length!==0&&(r=`${s}/${r}`,t=p(s.charCodeAt(0)))}return r=_(r,!t,"/",p),t?r.length>0?`/${r}`:"/":r.length>0?r:"."}function z(e,r){if(C(e),C(r),e===r)return""}function xe(e,r){if(z(e,r),e=O(e),r=O(r),e===r)return"";let t=1,o=e.length;for(;t<o&&p(e.charCodeAt(t));++t);let s=o-t,i=1,a=r.length;for(;i<a&&p(r.charCodeAt(i));++i);let n=a-i,l=s<n?s:n,c=-1,d=0;for(;d<=l;++d){if(d===l){if(n>l){if(p(r.charCodeAt(i+d)))return r.slice(i+d+1);if(d===0)return r.slice(i+d)}else s>l&&(p(e.charCodeAt(t+d))?c=d:d===0&&(c=0));break}let u=e.charCodeAt(t+d),E=r.charCodeAt(i+d);if(u!==E)break;p(u)&&(c=d)}let f="";for(d=t+c+1;d<=o;++d)(d===o||p(e.charCodeAt(d)))&&(f.length===0?f+="..":f+="/..");return f.length>0?f+r.slice(i+c):(i+=c,p(r.charCodeAt(i))&&++i,r.slice(i))}function y(...e){let r="",t="",o=!1;for(let s=e.length-1;s>=-1;s--){let i;s>=0?i=e[s]:r?(i=b("Resolved a relative path without a current working directory (CWD)"),(i===void 0||i.slice(0,3).toLowerCase()!==`${r.toLowerCase()}\\`)&&(i=`${r}\\`)):i=b("Resolved a drive-letter-less path without a current working directory (CWD)"),C(i);let a=i.length;if(a===0)continue;let n=0,l="",c=!1,d=i.charCodeAt(0);if(a>1)if(m(d))if(c=!0,m(i.charCodeAt(1))){let f=2,u=f;for(;f<a&&!m(i.charCodeAt(f));++f);if(f<a&&f!==u){let E=i.slice(u,f);for(u=f;f<a&&m(i.charCodeAt(f));++f);if(f<a&&f!==u){for(u=f;f<a&&!m(i.charCodeAt(f));++f);f===a?(l=`\\\\${E}\\${i.slice(u)}`,n=f):f!==u&&(l=`\\\\${E}\\${i.slice(u,f)}`,n=f)}}}else n=1;else x(d)&&i.charCodeAt(1)===58&&(l=i.slice(0,2),n=2,a>2&&m(i.charCodeAt(2))&&(c=!0,n=3));else m(d)&&(n=1,c=!0);if(!(l.length>0&&r.length>0&&l.toLowerCase()!==r.toLowerCase())&&(r.length===0&&l.length>0&&(r=l),o||(t=`${i.slice(n)}\\${t}`,o=c),o&&r.length>0))break}return t=_(t,!o,"\\",m),r+(o?"\\":"")+t||"."}function Re(e,r){z(e,r);let t=y(e),o=y(r);if(t===o||(e=t.toLowerCase(),r=o.toLowerCase(),e===r))return"";let s=0,i=e.length;for(;s<i&&e.charCodeAt(s)===92;++s);for(;i-1>s&&e.charCodeAt(i-1)===92;--i);let a=i-s,n=0,l=r.length;for(;n<l&&r.charCodeAt(n)===92;++n);for(;l-1>n&&r.charCodeAt(l-1)===92;--l);let c=l-n,d=a<c?a:c,f=-1,u=0;for(;u<=d;++u){if(u===d){if(c>d){if(r.charCodeAt(n+u)===92)return o.slice(n+u+1);if(u===2)return o.slice(n+u)}a>d&&(e.charCodeAt(s+u)===92?f=u:u===2&&(f=3));break}let Q=e.charCodeAt(s+u),Pe=r.charCodeAt(n+u);if(Q!==Pe)break;Q===92&&(f=u)}if(u!==d&&f===-1)return o;let E="";for(f===-1&&(f=0),u=s+f+1;u<=i;++u)(u===i||e.charCodeAt(u)===92)&&(E.length===0?E+="..":E+="\\..");return E.length>0?E+o.slice(n+f,l):(n+=f,o.charCodeAt(n)===92&&++n,o.slice(n,l))}function ge(e,r){return A?Re(e,r):xe(e,r)}function he(...e){return A?y(...e):O(...e)}var Oe={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!0},He=()=>{let e=r=>({isFile:r.isFile,isDirectory:r.isDirectory,isSymlink:r.isSymlink,size:r.size,mtime:r.mtime,atime:r.atime,birthtime:r.birthtime,mode:r.mode});return{async readFile(r,t){try{return await Deno.readFile(r,{signal:t?.signal})}catch(o){throw o instanceof Deno.errors.NotFound?new D(r):o}},async readTextFile(r,t){try{return await Deno.readTextFile(r,{signal:t?.signal})}catch(o){throw o instanceof Deno.errors.NotFound?new D(r):o}},async writeFile(r,t,o){await Deno.writeFile(r,t,{signal:o?.signal,mode:o?.mode,create:o?.create??!0,append:o?.append??!1})},async writeTextFile(r,t,o){await Deno.writeTextFile(r,t,{signal:o?.signal,mode:o?.mode,create:o?.create??!0,append:o?.append??!1})},async exists(r){try{return await Deno.stat(r),!0}catch(t){if(t instanceof Deno.errors.NotFound)return!1;throw t}},async stat(r){try{let t=await Deno.stat(r);return e(t)}catch(t){throw t instanceof Deno.errors.NotFound?new D(r):t}},async lstat(r){try{let t=await Deno.lstat(r);return e(t)}catch(t){throw t instanceof Deno.errors.NotFound?new D(r):t}},async mkdir(r,t){await Deno.mkdir(r,{recursive:t?.recursive??!1,mode:t?.mode})},async ensureDir(r){try{await Deno.mkdir(r,{recursive:!0})}catch(t){if(!(t instanceof Deno.errors.AlreadyExists))throw t}},async remove(r,t){try{await Deno.remove(r,{recursive:t?.recursive??!1})}catch(o){throw o instanceof Deno.errors.NotFound?new D(r):o}},async*readDir(r){try{for await(let t of Deno.readDir(r))yield{name:t.name,isFile:t.isFile,isDirectory:t.isDirectory,isSymlink:t.isSymlink}}catch(t){throw t instanceof Deno.errors.NotFound?new D(r):t}},async copyFile(r,t){await Deno.copyFile(r,t)},async rename(r,t){await Deno.rename(r,t)},async makeTempDir(r){return await Deno.makeTempDir({dir:r?.dir,prefix:r?.prefix,suffix:r?.suffix})},async realPath(r){try{return await Deno.realPath(r)}catch(t){throw t instanceof Deno.errors.NotFound?new D(r):t}},watch(r,t){let o=t?.recursive??!0,s=Deno.watchFs(r,{recursive:o}),i=a=>({kind:a.kind,paths:a.paths,flag:a.flag});return{close:()=>s.close(),[Symbol.asyncIterator]:async function*(){for await(let a of s)yield i(a)}}},async*walk(r,t){let o=t?.includeDirs??!0,s=t?.includeFiles??!0,i=t?.exts,a=t?.skip,n=async function*(l){for await(let c of Deno.readDir(l)){let d=J(l,c.name);if(!a?.some(f=>f.test(d))){if(c.isDirectory)o&&(yield{path:d,name:c.name,isFile:!1,isDirectory:!0,isSymlink:c.isSymlink}),yield*n(d);else if(c.isFile||c.isSymlink){if(!s||i&&!i.some(f=>c.name.endsWith(f.startsWith(".")?f:`.${f}`)))continue;yield{path:d,name:c.name,isFile:c.isFile,isDirectory:!1,isSymlink:c.isSymlink}}}}};yield*n(r)},async chmod(r,t){let{chmod:o}=await import("./unstable_chmod-44MCKF3B.js");await o(r,t)}}},ke=()=>({join:J,resolve:he,dirname:ne,basename:re,extname:fe,normalize:ue,isAbsolute:de,relative:ge,parse:Ce,format:me,sep:B,delimiter:te}),Le=()=>({async spawn(e,r=[],t){let o=G(t),s=new Deno.Command(e,{args:r,cwd:t?.cwd,env:t?.env,stdin:t?.stdinText===void 0?o.stdin:"piped",stdout:o.stdout,stderr:o.stderr,signal:t?.signal}),i;if(t?.stdinText===void 0)i=await s.output();else{let a=s.spawn(),n=a.stdin.getWriter(),l=n.write(new TextEncoder().encode(t.stdinText)).then(()=>n.close()).catch(()=>{});[i]=await Promise.all([a.output(),l])}return{success:i.success,code:i.code,stdout:o.stdout==="piped"?i.stdout:new Uint8Array,stderr:o.stderr==="piped"?i.stderr:new Uint8Array}},async exec(e,r=[],t){let o=await this.spawn(e,r,t);if(!o.success){let s=new TextDecoder().decode(o.stderr);throw new X(e,o.code,s)}return new TextDecoder().decode(o.stdout).trim()},async execJson(e,r=[],t){let o=await this.exec(e,r,t);return JSON.parse(o)},spawnChild(e,r=[],t){let o=G(t),i=new Deno.Command(e,{args:r,cwd:t?.cwd,env:t?.env,stdin:o.stdin,stdout:o.stdout,stderr:o.stderr,signal:t?.signal}).spawn(),a=(n,l)=>l!=="piped"||!n?Promise.resolve(new Uint8Array):new Response(n).arrayBuffer().then(c=>new Uint8Array(c));return{pid:i.pid,stdin:o.stdin==="piped"?i.stdin:null,stdout:o.stdout==="piped"?i.stdout:null,stderr:o.stderr==="piped"?i.stderr:null,status:i.status.then(n=>({success:n.success,code:n.code,signal:n.signal??void 0})),output:async()=>{let n=o.stdout==="piped"?i.stdout:null,l=o.stderr==="piped"?i.stderr:null,[c,d,f]=await Promise.all([i.status,a(n,o.stdout),a(l,o.stderr)]);return{success:c.success,code:c.code,stdout:d,stderr:f}},kill:n=>{i.kill(n)}}}}),Ue=()=>({get(e){return Deno.env.get(e)},set(e,r){Deno.env.set(e,r)},delete(e){Deno.env.delete(e)},has(e){return Deno.env.get(e)!==void 0},toObject(){return Deno.env.toObject()}}),We=()=>({exit(e){Deno.exit(e)},setExitCode(e){Deno.exitCode=e},cwd(){return Deno.cwd()},chdir(e){Deno.chdir(e)},hostname(){return Deno.hostname()},execPath(){return Deno.execPath()},argv:we.argv,argv0:we.argv0,args:Deno.args,pid:Deno.pid,isAlive(e){try{return Deno.kill(e,"SIGCONT"),!0}catch(r){return!(r instanceof Deno.errors.NotFound)}},stdin:Deno.stdin.readable,stdout:Deno.stdout.writable,stderr:Deno.stderr.writable,isTerminal(e){try{switch(e){case"stdin":return Deno.stdin.isTerminal();case"stdout":return Deno.stdout.isTerminal();case"stderr":return Deno.stderr.isTerminal()}}catch{return!1}},setStdinRaw(e){Deno.stdin.setRaw(e)},writeToStdout(e){Deno.stdout.writeSync(e)},consoleSize(){try{return Deno.consoleSize()}catch{return{columns:80,rows:24}}}}),vn=()=>{let e=He(),r=ke(),t=Le(),o=Ue(),s=We();return{name:"deno",version:Deno.version.deno,capabilities:Oe,fs:e,path:r,exec:t,env:o,process:s}};export{Oe as DENO_CAPABILITIES,vn as createDenoRuntime};
@@ -1 +1 @@
1
- import{a as k,b as v,c as F,d as R,e as b}from"./chunk-5P46WSNG.js";import{C as h,e as y}from"./chunk-XXBSEOQR.js";import{c as u,d as r,f as d,g as f,h as g,o as p,q as w,r as $}from"./chunk-2GF5IUQD.js";import{a,b as c}from"./chunk-2N4GTHXQ.js";import"./chunk-XNGHRJVK.js";import"./chunk-CKETVOVQ.js";import"./chunk-YSLRAWBK.js";import"./chunk-OTRBRRIO.js";var U=async m=>{let e=p({renderer:$.ansi(),sink:w.stdout()}),{root:n}=await h(),l=m?.[0];if(l==="scan"){let i=await k(n);await F(n,i),e.writeln(f("\u2714"),` Found ${i.length} diagram(s):`);for(let s of i)e.writeln(` ${s.file}:${s.line} `,r(`[${s.type}]`),r(` refs: ${s.referencedFiles.length}`));return await e.close(),a(void 0)}if(l==="list"||l===void 0){let i=await v(n);if(i.length===0)return e.writeln(r("No diagrams registered. Run: noskills diagrams scan")),await e.close(),a(void 0);e.writeln(u(`${i.length} diagram(s):`));for(let s of i)e.writeln(` ${s.file}:${s.line} `,r(`[${s.type}]`),` refs: ${s.referencedFiles.join(", ")||"none"}`),e.writeln(r(` verified: ${s.lastVerified.slice(0,10)}`));return await e.close(),a(void 0)}if(l==="check"){let s=(await y(n)).execution.modifiedFiles,o=await b(n,s);if(o.length===0)e.writeln(f("\u2714")," No stale diagrams.");else{e.writeln(g(`\u26A0 ${o.length} potentially stale diagram(s):`));for(let t of o)e.writeln(` ${t.file}:${t.line} `,r(`[${t.type}]`)),e.writeln(r(` ${t.reason}`))}return await e.close(),a(void 0)}if(l==="verify"){let i=m?.[1];if(!i)return e.writeln(d("Usage: noskills diagrams verify <file>")),await e.close(),c({exitCode:1});let s;for(let t of m??[])t.startsWith("--line=")&&(s=parseInt(t.slice(7),10));return await R(n,i,s)?e.writeln(f("\u2714"),` Verified: ${i}`):e.writeln(d(`Diagram not found in registry: ${i}`)),await e.close(),a(void 0)}return e.writeln(d("Unknown subcommand. Use: scan, list, check, verify")),await e.close(),c({exitCode:1})};export{U as main};
1
+ import{a as k,b as v,c as F,d as R,e as b}from"./chunk-Q4TI7EYT.js";import{c as u,d as r,f as d,g as f,h as g,o as p,q as w,r as $}from"./chunk-VXU6XZ66.js";import{E as h,g as y}from"./chunk-KRKOWSYW.js";import{a,b as m}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var U=async c=>{let e=p({renderer:$.ansi(),sink:w.stdout()}),{root:n}=await h(),l=c?.[0];if(l==="scan"){let i=await k(n);await F(n,i),e.writeln(f("\u2714"),` Found ${i.length} diagram(s):`);for(let s of i)e.writeln(` ${s.file}:${s.line} `,r(`[${s.type}]`),r(` refs: ${s.referencedFiles.length}`));return await e.close(),a(void 0)}if(l==="list"||l===void 0){let i=await v(n);if(i.length===0)return e.writeln(r("No diagrams registered. Run: noskills diagrams scan")),await e.close(),a(void 0);e.writeln(u(`${i.length} diagram(s):`));for(let s of i)e.writeln(` ${s.file}:${s.line} `,r(`[${s.type}]`),` refs: ${s.referencedFiles.join(", ")||"none"}`),e.writeln(r(` verified: ${s.lastVerified.slice(0,10)}`));return await e.close(),a(void 0)}if(l==="check"){let s=(await y(n)).execution.modifiedFiles,o=await b(n,s);if(o.length===0)e.writeln(f("\u2714")," No stale diagrams.");else{e.writeln(g(`\u26A0 ${o.length} potentially stale diagram(s):`));for(let t of o)e.writeln(` ${t.file}:${t.line} `,r(`[${t.type}]`)),e.writeln(r(` ${t.reason}`))}return await e.close(),a(void 0)}if(l==="verify"){let i=c?.[1];if(!i)return e.writeln(d("Usage: noskills diagrams verify <file>")),await e.close(),m({exitCode:1});let s;for(let t of c??[])t.startsWith("--line=")&&(s=parseInt(t.slice(7),10));return await R(n,i,s)?e.writeln(f("\u2714"),` Verified: ${i}`):e.writeln(d(`Diagram not found in registry: ${i}`)),await e.close(),a(void 0)}return e.writeln(d("Unknown subcommand. Use: scan, list, check, verify")),await e.close(),m({exitCode:1})};export{U as main};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e}from"./chunk-Q4TI7EYT.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{e as checkStaleness,b as readRegistry,a as scanProject,d as verifyDiagram,c as writeRegistry};
@@ -1,12 +1,12 @@
1
- import{a as b,c as O}from"./chunk-OTRBRRIO.js";var V=O((st,Q)=>{var M=1e3,N=M*60,q=N*60,A=q*24,ye=A*7,ge=A*365.25;Q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return be(e);if(t==="number"&&isFinite(e))return r.long?ve(e):me(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function be(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ge;case"weeks":case"week":case"w":return t*ye;case"days":case"day":case"d":return t*A;case"hours":case"hour":case"hrs":case"hr":case"h":return t*q;case"minutes":case"minute":case"mins":case"min":case"m":return t*N;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function me(e){var r=Math.abs(e);return r>=A?Math.round(e/A)+"d":r>=q?Math.round(e/q)+"h":r>=N?Math.round(e/N)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function ve(e){var r=Math.abs(e);return r>=A?$(e,r,A,"day"):r>=q?$(e,r,q,"hour"):r>=N?$(e,r,N,"minute"):r>=M?$(e,r,M,"second"):e+" ms"}function $(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var G=O((ot,X)=>{function _e(e){t.debug=t,t.default=t,t.coerce=S,t.disable=C,t.enable=s,t.enabled=y,t.humanize=V(),t.destroy=x,Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,v;function l(...d){if(!l.enabled)return;let F=l,_=Number(new Date),j=_-(i||_);F.diff=j,F.prev=i,F.curr=_,i=_,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let P=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(E,I)=>{if(E==="%%")return"%";P++;let K=t.formatters[I];if(typeof K=="function"){let Ce=d[P];E=K.call(F,Ce),d.splice(P,1),P--}return E}),t.formatArgs.call(F,d),(F.log||t.log).apply(F,d)}return l.namespace=o,l.useColors=t.useColors(),l.color=t.selectColor(o),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(a!==t.namespaces&&(a=t.namespaces,v=t.enabled(o)),v),set:d=>{c=d}}),typeof t.init=="function"&&t.init(l),l}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o=="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)c[0]==="-"?t.skips.push(c.slice(1)):t.names.push(c)}function u(o,i){let c=0,a=0,v=-1,l=0;for(;c<o.length;)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))i[a]==="*"?(v=a,l=c,a++):(c++,a++);else if(v!==-1)a=v+1,l++,c=l;else return!1;for(;a<i.length&&i[a]==="*";)a++;return a===i.length}function C(){let o=[...t.names,...t.skips.map(i=>"-"+i)].join(",");return t.enable(""),o}function y(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function S(o){return o instanceof Error?o.stack||o.message:o}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=_e});var Y=O((p,L)=>{p.formatArgs=Fe;p.save=Oe;p.load=Se;p.useColors=we;p.storage=Pe();p.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();p.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function we(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Fe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),e.splice(n,0,r)}p.log=console.debug||console.log||(()=>{});function Oe(e){try{e?p.storage.setItem("debug",e):p.storage.removeItem("debug")}catch{}}function Se(){let e;try{e=p.storage.getItem("debug")||p.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Pe(){try{return localStorage}catch{}}L.exports=G()(p);var{formatters:xe}=L.exports;xe.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var te=O((f,H)=>{var je=b("tty"),T=b("util");f.init=Be;f.log=Me;f.formatArgs=Ae;f.save=Ne;f.load=qe;f.useColors=Ee;f.destroy=T.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=b("supports-color");e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[t]=n,e},{});function Ee(){return"colors"in f.inspectOpts?!!f.inspectOpts.colors:je.isatty(process.stderr.fd)}function Ae(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
1
+ import{a as b,c as O}from"./chunk-HISXAZ4Y.js";var V=O((st,Q)=>{var M=1e3,N=M*60,q=N*60,A=q*24,ye=A*7,ge=A*365.25;Q.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return be(e);if(t==="number"&&isFinite(e))return r.long?ve(e):me(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function be(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ge;case"weeks":case"week":case"w":return t*ye;case"days":case"day":case"d":return t*A;case"hours":case"hour":case"hrs":case"hr":case"h":return t*q;case"minutes":case"minute":case"mins":case"min":case"m":return t*N;case"seconds":case"second":case"secs":case"sec":case"s":return t*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function me(e){var r=Math.abs(e);return r>=A?Math.round(e/A)+"d":r>=q?Math.round(e/q)+"h":r>=N?Math.round(e/N)+"m":r>=M?Math.round(e/M)+"s":e+"ms"}function ve(e){var r=Math.abs(e);return r>=A?$(e,r,A,"day"):r>=q?$(e,r,q,"hour"):r>=N?$(e,r,N,"minute"):r>=M?$(e,r,M,"second"):e+" ms"}function $(e,r,t,n){var s=r>=t*1.5;return Math.round(e/t)+" "+n+(s?"s":"")}});var G=O((ot,X)=>{function _e(e){t.debug=t,t.default=t,t.coerce=S,t.disable=C,t.enable=s,t.enabled=y,t.humanize=V(),t.destroy=x,Object.keys(e).forEach(o=>{t[o]=e[o]}),t.names=[],t.skips=[],t.formatters={};function r(o){let i=0;for(let c=0;c<o.length;c++)i=(i<<5)-i+o.charCodeAt(c),i|=0;return t.colors[Math.abs(i)%t.colors.length]}t.selectColor=r;function t(o){let i,c=null,a,v;function l(...d){if(!l.enabled)return;let F=l,_=Number(new Date),j=_-(i||_);F.diff=j,F.prev=i,F.curr=_,i=_,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let P=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(E,I)=>{if(E==="%%")return"%";P++;let K=t.formatters[I];if(typeof K=="function"){let Ce=d[P];E=K.call(F,Ce),d.splice(P,1),P--}return E}),t.formatArgs.call(F,d),(F.log||t.log).apply(F,d)}return l.namespace=o,l.useColors=t.useColors(),l.color=t.selectColor(o),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>c!==null?c:(a!==t.namespaces&&(a=t.namespaces,v=t.enabled(o)),v),set:d=>{c=d}}),typeof t.init=="function"&&t.init(l),l}function n(o,i){let c=t(this.namespace+(typeof i>"u"?":":i)+o);return c.log=this.log,c}function s(o){t.save(o),t.namespaces=o,t.names=[],t.skips=[];let i=(typeof o=="string"?o:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let c of i)c[0]==="-"?t.skips.push(c.slice(1)):t.names.push(c)}function u(o,i){let c=0,a=0,v=-1,l=0;for(;c<o.length;)if(a<i.length&&(i[a]===o[c]||i[a]==="*"))i[a]==="*"?(v=a,l=c,a++):(c++,a++);else if(v!==-1)a=v+1,l++,c=l;else return!1;for(;a<i.length&&i[a]==="*";)a++;return a===i.length}function C(){let o=[...t.names,...t.skips.map(i=>"-"+i)].join(",");return t.enable(""),o}function y(o){for(let i of t.skips)if(u(o,i))return!1;for(let i of t.names)if(u(o,i))return!0;return!1}function S(o){return o instanceof Error?o.stack||o.message:o}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}X.exports=_e});var Y=O((p,L)=>{p.formatArgs=Fe;p.save=Oe;p.load=Se;p.useColors=we;p.storage=Pe();p.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();p.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function we(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Fe(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+L.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),e.splice(n,0,r)}p.log=console.debug||console.log||(()=>{});function Oe(e){try{e?p.storage.setItem("debug",e):p.storage.removeItem("debug")}catch{}}function Se(){let e;try{e=p.storage.getItem("debug")||p.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Pe(){try{return localStorage}catch{}}L.exports=G()(p);var{formatters:xe}=L.exports;xe.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var te=O((f,H)=>{var je=b("tty"),T=b("util");f.init=Be;f.log=Me;f.formatArgs=Ae;f.save=Ne;f.load=qe;f.useColors=Ee;f.destroy=T.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");f.colors=[6,2,3,4,5,1];try{let e=b("supports-color");e&&(e.stderr||e).level>=2&&(f.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}f.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,r)=>{let t=r.substring(6).toLowerCase().replace(/_([a-z])/g,(s,u)=>u.toUpperCase()),n=process.env[r];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[t]=n,e},{});function Ee(){return"colors"in f.inspectOpts?!!f.inspectOpts.colors:je.isatty(process.stderr.fd)}function Ae(e){let{namespace:r,useColors:t}=this;if(t){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),u=` ${s};1m${r} \x1B[0m`;e[0]=u+e[0].split(`
2
2
  `).join(`
3
3
  `+u),e.push(s+"m+"+H.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Ie()+r+" "+e[0]}function Ie(){return f.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Me(...e){return process.stderr.write(T.formatWithOptions(f.inspectOpts,...e)+`
4
4
  `)}function Ne(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function qe(){return process.env.DEBUG}function Be(e){e.inspectOpts={};let r=Object.keys(f.inspectOpts);for(let t=0;t<r.length;t++)e.inspectOpts[r[t]]=f.inspectOpts[r[t]]}H.exports=G()(f);var{formatters:ee}=H.exports;ee.o=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts).split(`
5
- `).map(r=>r.trim()).join(" ")};ee.O=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts)}});var W=O((it,J)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?J.exports=Y():J.exports=te()});var se=O(h=>{"use strict";var De=h&&h.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),ke=h&&h.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),re=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&De(r,e,t);return ke(r,e),r};Object.defineProperty(h,"__esModule",{value:!0});h.req=h.json=h.toBuffer=void 0;var $e=re(b("http")),Le=re(b("https"));async function ne(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}h.toBuffer=ne;async function Te(e){let t=(await ne(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}h.json=Te;function He(e,r={}){let n=((typeof e=="string"?e:e.href).startsWith("https:")?Le:$e).request(e,r),s=new Promise((u,C)=>{n.once("response",u).once("error",C).end()});return n.then=s.then.bind(s),n}h.req=He});var ue=O(g=>{"use strict";var ie=g&&g.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),Re=g&&g.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),ce=g&&g.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ie(r,e,t);return Re(r,e),r},Ue=g&&g.__exportStar||function(e,r){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&ie(r,e,t)};Object.defineProperty(g,"__esModule",{value:!0});g.Agent=void 0;var ze=ce(b("net")),oe=ce(b("http")),Ge=b("https");Ue(se(),g);var w=Symbol("AgentBaseInternalState"),Z=class extends oe.Agent{constructor(r){super(r),this[w]={}}isSecureEndpoint(r){if(r){if(typeof r.secureEndpoint=="boolean")return r.secureEndpoint;if(typeof r.protocol=="string")return r.protocol==="https:"}let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
5
+ `).map(r=>r.trim()).join(" ")};ee.O=function(e){return this.inspectOpts.colors=this.useColors,T.inspect(e,this.inspectOpts)}});var W=O((it,J)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?J.exports=Y():J.exports=te()});var se=O(h=>{"use strict";var De=h&&h.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),ke=h&&h.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),re=h&&h.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&De(r,e,t);return ke(r,e),r};Object.defineProperty(h,"__esModule",{value:!0});h.req=h.json=h.toBuffer=void 0;var $e=re(b("http")),Le=re(b("https"));async function ne(e){let r=0,t=[];for await(let n of e)r+=n.length,t.push(n);return Buffer.concat(t,r)}h.toBuffer=ne;async function Te(e){let t=(await ne(e)).toString("utf8");try{return JSON.parse(t)}catch(n){let s=n;throw s.message+=` (input: ${t})`,s}}h.json=Te;function He(e,r={}){let n=((typeof e=="string"?e:e.href).startsWith("https:")?Le:$e).request(e,r),s=new Promise((u,C)=>{n.once("response",u).once("error",C).end()});return n.then=s.then.bind(s),n}h.req=He});var ue=O(g=>{"use strict";var ie=g&&g.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Re=g&&g.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),ce=g&&g.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&ie(r,e,t);return Re(r,e),r},Ue=g&&g.__exportStar||function(e,r){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&ie(r,e,t)};Object.defineProperty(g,"__esModule",{value:!0});g.Agent=void 0;var ze=ce(b("net")),oe=ce(b("http")),Ge=b("https");Ue(se(),g);var w=Symbol("AgentBaseInternalState"),Z=class extends oe.Agent{constructor(r){super(r),this[w]={}}isSecureEndpoint(r){if(r){if(typeof r.secureEndpoint=="boolean")return r.secureEndpoint;if(typeof r.protocol=="string")return r.protocol==="https:"}let{stack:t}=new Error;return typeof t!="string"?!1:t.split(`
6
6
  `).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}incrementSockets(r){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[r]||(this.sockets[r]=[]);let t=new ze.Socket({writable:!1});return this.sockets[r].push(t),this.totalSocketCount++,t}decrementSockets(r,t){if(!this.sockets[r]||t===null)return;let n=this.sockets[r],s=n.indexOf(t);s!==-1&&(n.splice(s,1),this.totalSocketCount--,n.length===0&&delete this.sockets[r])}getName(r){return this.isSecureEndpoint(r)?Ge.Agent.prototype.getName.call(this,r):super.getName(r)}createSocket(r,t,n){let s={...t,secureEndpoint:this.isSecureEndpoint(t)},u=this.getName(s),C=this.incrementSockets(u);Promise.resolve().then(()=>this.connect(r,s)).then(y=>{if(this.decrementSockets(u,C),y instanceof oe.Agent)try{return y.addRequest(r,s)}catch(S){return n(S)}this[w].currentSocket=y,super.createSocket(r,t,n)},y=>{this.decrementSockets(u,C),n(y)})}createConnection(){let r=this[w].currentSocket;if(this[w].currentSocket=void 0,!r)throw new Error("No socket was returned in the `connect()` function");return r}get defaultPort(){return this[w].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(r){this[w]&&(this[w].defaultPort=r)}get protocol(){return this[w].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(r){this[w]&&(this[w].protocol=r)}};g.Agent=Z});var ae=O(B=>{"use strict";var Je=B&&B.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(B,"__esModule",{value:!0});B.parseProxyResponse=void 0;var We=Je(W()),R=(0,We.default)("https-proxy-agent:parse-proxy-response");function Ze(e){return new Promise((r,t)=>{let n=0,s=[];function u(){let o=e.read();o?x(o):e.once("readable",u)}function C(){e.removeListener("end",y),e.removeListener("error",S),e.removeListener("readable",u)}function y(){C(),R("onend"),t(new Error("Proxy connection ended before receiving CONNECT response"))}function S(o){C(),R("onerror %o",o),t(o)}function x(o){s.push(o),n+=o.length;let i=Buffer.concat(s,n),c=i.indexOf(`\r
7
7
  \r
8
8
  `);if(c===-1){R("have not received end of HTTP headers yet..."),u();return}let a=i.slice(0,c).toString("ascii").split(`\r
9
- `),v=a.shift();if(!v)return e.destroy(),t(new Error("No header received from proxy CONNECT response"));let l=v.split(" "),d=+l[1],F=l.slice(2).join(" "),_={};for(let j of a){if(!j)continue;let P=j.indexOf(":");if(P===-1)return e.destroy(),t(new Error(`Invalid header from proxy CONNECT response: "${j}"`));let k=j.slice(0,P).toLowerCase(),E=j.slice(P+1).trimStart(),I=_[k];typeof I=="string"?_[k]=[I,E]:Array.isArray(I)?I.push(E):_[k]=E}R("got proxy server response: %o %o",v,_),C(),r({connect:{statusCode:d,statusText:F,headers:_},buffered:i})}e.on("error",S),e.on("end",y),u()})}B.parseProxyResponse=Ze});var nt=O(m=>{var Ke=m&&m.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),Qe=m&&m.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),pe=m&&m.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&Ke(r,e,t);return Qe(r,e),r},he=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});m.HttpsProxyAgent=void 0;var U=pe(b("net")),fe=pe(b("tls")),Ve=he(b("assert")),Xe=he(W()),Ye=ue(),et=b("url"),tt=ae(),D=(0,Xe.default)("https-proxy-agent"),le=e=>e.servername===void 0&&e.host&&!U.isIP(e.host)?{...e,servername:e.host}:e,z=class extends Ye.Agent{constructor(r,t){super(t),this.options={path:void 0},this.proxy=typeof r=="string"?new et.URL(r):r,this.proxyHeaders=t?.headers??{},D("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),s=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?de(t,"headers"):null,host:n,port:s}}async connect(r,t){let{proxy:n}=this;if(!t.host)throw new TypeError('No "host" provided');let s;n.protocol==="https:"?(D("Creating `tls.Socket`: %o",this.connectOpts),s=fe.connect(le(this.connectOpts))):(D("Creating `net.Socket`: %o",this.connectOpts),s=U.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},C=U.isIPv6(t.host)?`[${t.host}]`:t.host,y=`CONNECT ${C}:${t.port} HTTP/1.1\r
9
+ `),v=a.shift();if(!v)return e.destroy(),t(new Error("No header received from proxy CONNECT response"));let l=v.split(" "),d=+l[1],F=l.slice(2).join(" "),_={};for(let j of a){if(!j)continue;let P=j.indexOf(":");if(P===-1)return e.destroy(),t(new Error(`Invalid header from proxy CONNECT response: "${j}"`));let k=j.slice(0,P).toLowerCase(),E=j.slice(P+1).trimStart(),I=_[k];typeof I=="string"?_[k]=[I,E]:Array.isArray(I)?I.push(E):_[k]=E}R("got proxy server response: %o %o",v,_),C(),r({connect:{statusCode:d,statusText:F,headers:_},buffered:i})}e.on("error",S),e.on("end",y),u()})}B.parseProxyResponse=Ze});var nt=O(m=>{var Ke=m&&m.__createBinding||(Object.create?(function(e,r,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(r,t);(!s||("get"in s?!r.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,s)}):(function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]})),Qe=m&&m.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}):function(e,r){e.default=r}),pe=m&&m.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&Ke(r,e,t);return Qe(r,e),r},he=m&&m.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(m,"__esModule",{value:!0});m.HttpsProxyAgent=void 0;var U=pe(b("net")),fe=pe(b("tls")),Ve=he(b("assert")),Xe=he(W()),Ye=ue(),et=b("url"),tt=ae(),D=(0,Xe.default)("https-proxy-agent"),le=e=>e.servername===void 0&&e.host&&!U.isIP(e.host)?{...e,servername:e.host}:e,z=class extends Ye.Agent{constructor(r,t){super(t),this.options={path:void 0},this.proxy=typeof r=="string"?new et.URL(r):r,this.proxyHeaders=t?.headers??{},D("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),s=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?de(t,"headers"):null,host:n,port:s}}async connect(r,t){let{proxy:n}=this;if(!t.host)throw new TypeError('No "host" provided');let s;n.protocol==="https:"?(D("Creating `tls.Socket`: %o",this.connectOpts),s=fe.connect(le(this.connectOpts))):(D("Creating `net.Socket`: %o",this.connectOpts),s=U.connect(this.connectOpts));let u=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},C=U.isIPv6(t.host)?`[${t.host}]`:t.host,y=`CONNECT ${C}:${t.port} HTTP/1.1\r
10
10
  `;if(n.username||n.password){let c=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;u["Proxy-Authorization"]=`Basic ${Buffer.from(c).toString("base64")}`}u.Host=`${C}:${t.port}`,u["Proxy-Connection"]||(u["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let c of Object.keys(u))y+=`${c}: ${u[c]}\r
11
11
  `;let S=(0,tt.parseProxyResponse)(s);s.write(`${y}\r
12
12
  `);let{connect:x,buffered:o}=await S;if(r.emit("proxyConnect",x),this.emit("proxyConnect",x,r),x.statusCode===200)return r.once("socket",rt),t.secureEndpoint?(D("Upgrading socket connection to TLS"),fe.connect({...de(le(t),"host","path","port"),socket:s})):s;s.destroy();let i=new U.Socket({writable:!1});return i.readable=!0,r.once("socket",c=>{D("Replaying proxy buffer for failed request"),(0,Ve.default)(c.listenerCount("data")>0),c.push(o),c.push(null)}),i}};z.protocols=["http","https"];m.HttpsProxyAgent=z;function rt(e){e.resume()}function de(e,...r){let t={},n;for(n in e)r.includes(n)||(t[n]=e[n]);return t}});export default nt();
@@ -0,0 +1 @@
1
+ import{a as I}from"./chunk-DBKXMYLF.js";import{a as P,d as O}from"./chunk-LN4NDYT6.js";import{h as D}from"./chunk-5RLCKUIF.js";import{K as U,q as v,y as T}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{c as m}from"./chunk-IFE5SYGK.js";import{c as l,d as a,f as o,g as f,h,o as g,q as S,r as E}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as k,f as C,h as x,j as y,k as $,m as b}from"./chunk-KRKOWSYW.js";import{a as u,b as n}from"./chunk-OAWYVETM.js";import{i as w}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var B=async R=>{let e=g({renderer:E.ansi(),sink:S.stdout()}),{root:i}=await k(),p=y(R);if(!p.ok)return e.writeln(o(p.error)),await e.close(),n({exitCode:1});let t;try{t=await x(i,p.spec)}catch(s){let c=s instanceof Error?s.message:String(s);return e.writeln(o(c)),await e.close(),n({exitCode:1})}if(t.phase!=="EXECUTING")return e.writeln(o(`Cannot complete in phase: ${t.phase}`)),e.writeln(a("Only EXECUTING phase can transition to COMPLETED.")),await e.close(),n({exitCode:1});if(t.execution.awaitingStatusReport)return e.writeln(o("Cannot complete: status report is pending.")),e.writeln(a(`Submit a status report first: ${m(`next --answer='{"completed":[...],"remaining":[...]}'`)}`)),await e.close(),n({exitCode:1});if(t.execution.debt!==null&&t.execution.debt.items.length>0){e.writeln(h(`Warning: ${t.execution.debt.items.length} unresolved debt item(s).`));for(let s of t.execution.debt.items)e.writeln(a(` - ${s.id}: ${s.text}`));e.writeln("")}if(t.spec!==null){let s=`${i}/${C.specDir(t.spec)}`;try{await w.fs.stat(s)}catch{return e.writeln(o(`Active spec '${t.spec}' directory not found.`)),e.writeln(a("Run `noskills reset` to return to idle.")),await e.close(),n({exitCode:1})}}let d=await D(i),r=v(t,"done");r=T(r,"EXECUTING","COMPLETED",d),r.spec!==null&&await b(i,r.spec,r);let G=U(r);if(await $(i,G),r.spec!==null&&(await P(i,r.spec,"completed"),await O(i,r.spec,"completed")),await I(i,{ts:new Date().toISOString(),type:"phase-change",spec:t.spec??"unknown",user:d.name,from:"EXECUTING",to:"COMPLETED"}),e.writeln(f("\u2714")," Spec completed!"),e.writeln(""),e.writeln(" Spec: ",l(t.spec??"unknown")),e.writeln(` Iterations: ${t.execution.iteration}`),e.writeln(` Decisions: ${t.decisions.length}`),t.decisions.length>0){let s=t.decisions.filter(c=>c.promoted);s.length>0&&e.writeln(a(` Promoted to rules: ${s.length}`))}return e.writeln(""),e.writeln("Start a new spec with: ",l(`${m('spec new "..."')}`)),await e.close(),u(void 0)};export{B as main};
@@ -0,0 +1 @@
1
+ import{h as v}from"./chunk-5RLCKUIF.js";import{D as y,E as I,F as E,G as R}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import"./chunk-IFE5SYGK.js";import{d,f as o,g as p,o as S,q as x,r as F}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as q,h as C,j as U,m as c}from"./chunk-KRKOWSYW.js";import{a as l,b as i}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var W=async w=>{let e=S({renderer:F.ansi(),sink:x.stdout()}),{root:a}=await q(),n=U(w);if(!n.ok)return e.writeln(o(n.error)),await e.close(),i({exitCode:1});let f=(w??[]).filter(s=>!s.startsWith("--")),t=f[0],m=f.slice(1).join(" "),u=null,h=!1;for(let s of w??[])s.startsWith("--answer=")&&(u=s.slice(9)),s==="--skip"&&(h=!0);if(!t)return e.writeln(o('Usage: noskills spec <name> followup <questionId> "question text"')),e.writeln(d(' Or: noskills spec <name> followup <followUpId> --answer="text"')),e.writeln(d(" Or: noskills spec <name> followup <followUpId> --skip")),await e.close(),i({exitCode:1});let r;try{r=await C(a,n.spec)}catch(s){let A=s instanceof Error?s.message:String(s);return e.writeln(o(A)),await e.close(),i({exitCode:1})}if(u!==null){let s=I(r,t,u);return await c(a,n.spec,s),e.writeln(p("\u2714"),` Answered follow-up: ${t}`),await e.close(),l(void 0)}if(h){let s=E(r,t);return await c(a,n.spec,s),e.writeln(p("\u2714"),` Skipped follow-up: ${t}`),await e.close(),l(void 0)}if(m.length===0)return e.writeln(o("Follow-up question text is required.")),await e.close(),i({exitCode:1});if(r.phase!=="DISCOVERY"&&r.phase!=="DISCOVERY_REFINEMENT")return e.writeln(o(`Cannot add follow-ups in phase: ${r.phase}`)),await e.close(),i({exitCode:1});let O=await v(a),g=y(r,t,m,O.name);await c(a,n.spec,g);let k=R(g,t),$=k[k.length-1];return e.writeln(p("\u2714"),` Follow-up added: ${$?.id??t}`),await e.close(),l(void 0)};export{W as main};
@@ -0,0 +1 @@
1
+ import{c as a}from"./chunk-IFE5SYGK.js";import{c as e,d as t,o,q as n,r as i}from"./chunk-VXU6XZ66.js";import{a as r}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var u=async m=>{let s=o({renderer:i.ansi(),sink:n.stdout()});return s.writeln(t("noskills starts in idle mode with no enforcement. To work on a spec, run:")),s.writeln(e(` ${a('spec new "description"')}`)),await s.close(),r(void 0)};export{u as main};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-KMLNG3EC.js";import"./chunk-PSX63TYP.js";import"./chunk-EJYSOUEA.js";import"./chunk-JYVB6UAV.js";import"./chunk-OAWYVETM.js";import"./chunk-HISXAZ4Y.js";export{a as GeminiModel,b as geminiFactory};