noskills 4.1.29 → 4.1.30

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 (51) hide show
  1. package/chunks/{approve-UATWGG53.js → approve-5N5LJ2WQ.js} +1 -1
  2. package/chunks/{ask-5YIOZTBI.js → ask-TR4ZPBU5.js} +1 -1
  3. package/chunks/{block-IDVJLPNV.js → block-WWW3MXHP.js} +1 -1
  4. package/chunks/{browser-XCMD2IZQ.js → browser-JYFQKVFU.js} +1 -1
  5. package/chunks/bun-KVGAHBUF.js +1 -0
  6. package/chunks/{chunk-52HFDP2R.js → chunk-4IFPLK7L.js} +1 -1
  7. package/chunks/{chunk-QHS53BRV.js → chunk-5ORUHRWF.js} +1 -1
  8. package/chunks/{chunk-SOMEQCOS.js → chunk-6C2MLMD6.js} +1 -1
  9. package/chunks/{chunk-D6Q2GR7X.js → chunk-6QFROYLO.js} +1 -1
  10. package/chunks/{chunk-6XR33H6Q.js → chunk-7ADGJB4H.js} +1 -1
  11. package/chunks/chunk-AB4ZUDV6.js +1 -0
  12. package/chunks/{chunk-G65TSD56.js → chunk-AT7V3AKV.js} +1 -1
  13. package/chunks/{chunk-OM4QJ24S.js → chunk-HLQNHWXS.js} +1 -1
  14. package/chunks/{chunk-FPO2JRU3.js → chunk-HS6FTDDW.js} +1 -1
  15. package/chunks/{chunk-FAK366X2.js → chunk-I6ISQXVP.js} +1 -1
  16. package/chunks/{chunk-O3PI76HM.js → chunk-KBNVVXFC.js} +1 -1
  17. package/chunks/{chunk-SBUQXH6U.js → chunk-LBOCIPVF.js} +1 -1
  18. package/chunks/{chunk-TNKUKNM4.js → chunk-LZSLKXJE.js} +1 -1
  19. package/chunks/{chunk-XHFYREAD.js → chunk-M2ZPJN26.js} +1 -1
  20. package/chunks/{chunk-MJVACJ6D.js → chunk-OJUA2UZK.js} +1 -1
  21. package/chunks/{chunk-LEPZPNTN.js → chunk-QEEZKZXM.js} +1 -1
  22. package/chunks/{chunk-UWD66JGG.js → chunk-RVIPYZ7F.js} +1 -1
  23. package/chunks/{chunk-G2NW625V.js → chunk-TGA7MX5P.js} +1 -1
  24. package/chunks/{chunk-SG4G3OOO.js → chunk-WV3HK5WR.js} +1 -1
  25. package/chunks/{claude-code-Z7LYZDY5.js → claude-code-3XV3QOZJ.js} +1 -1
  26. package/chunks/{concern-JUE2IFQI.js → concern-P4L2VWAE.js} +1 -1
  27. package/chunks/{deno-H6NPLC5O.js → deno-5VR3ZY4Z.js} +1 -1
  28. package/chunks/{done-LOYNEBUX.js → done-IBA3FUE5.js} +1 -1
  29. package/chunks/{init-FMAEQACG.js → init-HS26Q2YL.js} +1 -1
  30. package/chunks/{invoke-hook-2VRIZ4VU.js → invoke-hook-JZBFLW46.js} +1 -1
  31. package/chunks/{kiro-C7DKUCGL.js → kiro-IXVNKPRT.js} +1 -1
  32. package/chunks/{list-U5OS3WZ4.js → list-UT3MSC6R.js} +1 -1
  33. package/chunks/{mod-RWDPEKPY.js → mod-LUIKS5KC.js} +1 -1
  34. package/chunks/{next-WEQWWHMJ.js → next-ZZAZ6ZVW.js} +1 -1
  35. package/chunks/node-MZTU6BAB.js +1 -0
  36. package/chunks/{ollama-HRLYSKFN.js → ollama-K4QCYLVL.js} +1 -1
  37. package/chunks/{opencode-QKZUHQHY.js → opencode-QBVD5FAD.js} +1 -1
  38. package/chunks/{purge-AISADFMA.js → purge-FBZME5ZJ.js} +1 -1
  39. package/chunks/{reset-2II5XIWI.js → reset-VZO7YXM6.js} +1 -1
  40. package/chunks/{rule-3UTOQ32B.js → rule-4D2CRBI4.js} +1 -1
  41. package/chunks/{run-EP6XJQXK.js → run-LEX6S5D7.js} +1 -1
  42. package/chunks/{spec-BLGJLET3.js → spec-RTBL43T7.js} +1 -1
  43. package/chunks/{status-K2DRYXDX.js → status-B4YAFCOQ.js} +1 -1
  44. package/chunks/{sync-NR33ZH7R.js → sync-XMUP5YHZ.js} +1 -1
  45. package/chunks/{watch-DTNAKL6O.js → watch-7DNXJAAQ.js} +1 -1
  46. package/chunks/{workerd-LKKH32SO.js → workerd-QUMEG65S.js} +1 -1
  47. package/noskills.js +1 -1
  48. package/package.json +1 -1
  49. package/chunks/bun-YFFBDKUJ.js +0 -1
  50. package/chunks/chunk-C2SQE5AG.js +0 -1
  51. package/chunks/node-SMAAGOR3.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as l}from"./chunk-FPO2JRU3.js";var F=s=>{if(s===void 0)return"json";for(let n of s)if(n==="-o"||n.startsWith("--output")){let t=s.indexOf(n);if(n.includes("="))return x(n.split("=")[1]??"json");let i=s[t+1];if(i!==void 0&&!i.startsWith("-"))return x(i)}return"json"},O=s=>{if(s===void 0)return[];let n=[],t=!1;for(let i=0;i<s.length;i++){if(t){t=!1;continue}let o=s[i];if(!o.startsWith("--output=")){if(o==="-o"||o==="--output"){t=!0;continue}n.push(o)}}return n},x=s=>{let n=s.toLowerCase();return n==="md"||n==="markdown"?"markdown":n==="text"||n==="txt"||n==="plain"?"text":"json"},e=(s,n)=>s[n],$=s=>JSON.stringify(s,null,2),w=s=>{let n=s,t=[],i=e(n,"phase");i!==void 0&&(t.push(`# noskills \u2014 ${i}`),t.push(""));let o=e(n,"instruction");o!==void 0&&(t.push("## Instruction"),t.push(""),t.push(o),t.push(""));let a=e(n,"questions");if(a!==void 0&&a.length>0)for(let r of a){if(t.push(`## Question: ${r.id}`),t.push(""),t.push(`> ${r.text}`),r.extras!==void 0&&r.extras.length>0){t.push(""),t.push("Also consider:");for(let m of r.extras)t.push(`- ${m}`)}t.push("")}let h=e(n,"statusReport");if(h!==void 0){t.push("## Acceptance Criteria"),t.push("");for(let r of h.criteria)t.push(`- [ ] ${r}`);t.push("")}let p=e(n,"previousIterationDebt");if(p!==void 0){t.push(`## Debt (from iteration ${p.fromIteration})`),t.push(""),t.push(`> ${p.note}`),t.push("");for(let r of p.items)t.push(`- ${r}`);t.push("")}e(n,"verificationFailed")===!0&&(t.push("## Verification FAILED"),t.push(""),t.push("```"),t.push(String(e(n,"verificationOutput")??"")),t.push("```"),t.push(""));let c=e(n,"behavioral");if(c!==void 0){t.push("## Behavioral"),t.push(""),t.push(`**Tone:** ${c.tone}`),t.push("");for(let r of c.rules)t.push(`- ${r}`);c.urgency!==void 0&&(t.push(""),t.push(`**Urgency:** ${c.urgency}`)),t.push("")}let f=e(n,"meta");f!==void 0&&(t.push("---"),t.push(""),t.push(`*${f.resumeHint}*`),t.push(""));let d=e(n,"transition");if(d!==void 0){t.push("## Next Steps"),t.push("");for(let[r,m]of Object.entries(d))r!=="iteration"&&t.push(`- **${r}:** \`${m}\``);t.push("")}let u=e(n,"summary");u!==void 0&&(t.push("## Summary"),t.push(""),t.push(`- Spec: ${u.spec}`),t.push(`- Iterations: ${u.iterations}`),t.push(`- Decisions: ${u.decisionsCount}`),t.push(""));let g=e(n,"clearContext");return g!==void 0&&(t.push("---"),t.push(""),t.push(`**Action required:** ${g.reason}`),t.push("")),t.join(`
1
+ import{a as l}from"./chunk-HS6FTDDW.js";var F=s=>{if(s===void 0)return"json";for(let n of s)if(n==="-o"||n.startsWith("--output")){let t=s.indexOf(n);if(n.includes("="))return x(n.split("=")[1]??"json");let i=s[t+1];if(i!==void 0&&!i.startsWith("-"))return x(i)}return"json"},O=s=>{if(s===void 0)return[];let n=[],t=!1;for(let i=0;i<s.length;i++){if(t){t=!1;continue}let o=s[i];if(!o.startsWith("--output=")){if(o==="-o"||o==="--output"){t=!0;continue}n.push(o)}}return n},x=s=>{let n=s.toLowerCase();return n==="md"||n==="markdown"?"markdown":n==="text"||n==="txt"||n==="plain"?"text":"json"},e=(s,n)=>s[n],$=s=>JSON.stringify(s,null,2),w=s=>{let n=s,t=[],i=e(n,"phase");i!==void 0&&(t.push(`# noskills \u2014 ${i}`),t.push(""));let o=e(n,"instruction");o!==void 0&&(t.push("## Instruction"),t.push(""),t.push(o),t.push(""));let a=e(n,"questions");if(a!==void 0&&a.length>0)for(let r of a){if(t.push(`## Question: ${r.id}`),t.push(""),t.push(`> ${r.text}`),r.extras!==void 0&&r.extras.length>0){t.push(""),t.push("Also consider:");for(let m of r.extras)t.push(`- ${m}`)}t.push("")}let h=e(n,"statusReport");if(h!==void 0){t.push("## Acceptance Criteria"),t.push("");for(let r of h.criteria)t.push(`- [ ] ${r}`);t.push("")}let p=e(n,"previousIterationDebt");if(p!==void 0){t.push(`## Debt (from iteration ${p.fromIteration})`),t.push(""),t.push(`> ${p.note}`),t.push("");for(let r of p.items)t.push(`- ${r}`);t.push("")}e(n,"verificationFailed")===!0&&(t.push("## Verification FAILED"),t.push(""),t.push("```"),t.push(String(e(n,"verificationOutput")??"")),t.push("```"),t.push(""));let c=e(n,"behavioral");if(c!==void 0){t.push("## Behavioral"),t.push(""),t.push(`**Tone:** ${c.tone}`),t.push("");for(let r of c.rules)t.push(`- ${r}`);c.urgency!==void 0&&(t.push(""),t.push(`**Urgency:** ${c.urgency}`)),t.push("")}let f=e(n,"meta");f!==void 0&&(t.push("---"),t.push(""),t.push(`*${f.resumeHint}*`),t.push(""));let d=e(n,"transition");if(d!==void 0){t.push("## Next Steps"),t.push("");for(let[r,m]of Object.entries(d))r!=="iteration"&&t.push(`- **${r}:** \`${m}\``);t.push("")}let u=e(n,"summary");u!==void 0&&(t.push("## Summary"),t.push(""),t.push(`- Spec: ${u.spec}`),t.push(`- Iterations: ${u.iterations}`),t.push(`- Decisions: ${u.decisionsCount}`),t.push(""));let g=e(n,"clearContext");return g!==void 0&&(t.push("---"),t.push(""),t.push(`**Action required:** ${g.reason}`),t.push("")),t.join(`
2
2
  `)},k=s=>{let n=s,t=[],i=e(n,"phase");i!==void 0&&t.push(`[${i}]`);let o=e(n,"instruction");o!==void 0&&t.push(o);let a=e(n,"questions");if(a!==void 0&&a.length>0){for(let u of a)if(t.push(""),t.push(`Question [${u.id}]: ${u.text}`),u.extras!==void 0)for(let g of u.extras)t.push(` - ${g}`)}let h=e(n,"statusReport");if(h!==void 0){t.push(""),t.push("Criteria:");for(let u of h.criteria)t.push(` - ${u}`)}let p=e(n,"previousIterationDebt");if(p!==void 0){t.push(""),t.push(p.note);for(let u of p.items)t.push(` - ${u}`)}e(n,"verificationFailed")===!0&&(t.push(""),t.push(`Verification failed: ${String(e(n,"verificationOutput")??"").slice(0,200)}`));let c=e(n,"meta");c!==void 0&&(t.push(""),t.push(c.resumeHint));let f=e(n,"summary");f!==void 0&&t.push(`Spec: ${f.spec}, Iterations: ${f.iterations}, Decisions: ${f.decisionsCount}`);let d=e(n,"clearContext");return d!==void 0&&(t.push(""),t.push(d.reason)),t.join(`
3
3
  `)},b=(s,n)=>{switch(n){case"markdown":return w(s);case"text":return k(s);default:return $(s)}},v=async(s,n)=>{let t=b(s,n),i=new TextEncoder,o=l.process.stdout.getWriter();await o.write(i.encode(t+`
4
4
  `)),o.releaseLock()};export{F as a,O as b,b as c,v as d};
@@ -1 +1 @@
1
- import{b as s}from"./chunk-FDZP7B5Y.js";import{a as t}from"./chunk-ACQUINWH.js";var c={fs:!1,fsSync:!1,exec:!1,process:!1,env:!0,stdin:!1,stdout:!1,kv:!0},d=()=>{let e=()=>{throw new t("fs","workerd")};return{readFile:e,readTextFile:e,writeFile:e,writeTextFile:e,exists:e,stat:e,lstat:e,mkdir:e,ensureDir:e,remove:e,readDir:()=>{throw new t("fs","workerd")},copyFile:e,rename:e,makeTempDir:e,realPath:e,watch:e,walk:e,chmod:e}},w=()=>s,u=()=>{let e=()=>{throw new t("exec","workerd")};return{spawn:e,exec:e,execJson:e,spawnChild:e}},r=new Map,l=()=>({get(e){return r.get(e)},set(e,o){r.set(e,o)},delete(e){r.delete(e)},has(e){return r.has(e)},toObject(){return Object.fromEntries(r)}}),g=e=>{for(let[o,n]of Object.entries(e))n!=null&&n.constructor===String&&r.set(o,n)},k=()=>{r.clear()},m=()=>{let e=()=>{throw new t("process","workerd")};return{exit:e,setExitCode:e,cwd:e,chdir:e,hostname:e,execPath:e,get args(){throw new t("process","workerd")},get pid(){throw new t("process","workerd")},get stdin(){throw new t("process","workerd")},get stdout(){throw new t("process","workerd")},get stderr(){throw new t("process","workerd")}}},v=()=>{let e=d(),o=w(),n=u(),i=l(),a=m();return{name:"workerd",version:"unknown",capabilities:c,fs:e,path:o,exec:n,env:i,process:a}};export{c as a,g as b,k as c,v as d};
1
+ import{b as s}from"./chunk-FDZP7B5Y.js";import{a as t}from"./chunk-ACQUINWH.js";var c={fs:!1,fsSync:!1,exec:!1,process:!1,env:!0,stdin:!1,stdout:!1,kv:!0},d=()=>{let e=()=>{throw new t("fs","workerd")};return{readFile:e,readTextFile:e,writeFile:e,writeTextFile:e,exists:e,stat:e,lstat:e,mkdir:e,ensureDir:e,remove:e,readDir:()=>{throw new t("fs","workerd")},copyFile:e,rename:e,makeTempDir:e,realPath:e,watch:e,walk:e,chmod:e}},w=()=>s,l=()=>{let e=()=>{throw new t("exec","workerd")};return{spawn:e,exec:e,execJson:e,spawnChild:e}},r=new Map,u=()=>({get(e){return r.get(e)},set(e,o){r.set(e,o)},delete(e){r.delete(e)},has(e){return r.has(e)},toObject(){return Object.fromEntries(r)}}),k=e=>{for(let[o,n]of Object.entries(e))n!=null&&n.constructor===String&&r.set(o,n)},g=()=>{r.clear()},m=()=>{let e=()=>{throw new t("process","workerd")};return{exit:e,setExitCode:e,cwd:e,chdir:e,hostname:e,execPath:e,get args(){throw new t("process","workerd")},get pid(){throw new t("process","workerd")},get stdin(){throw new t("process","workerd")},get stdout(){throw new t("process","workerd")},get stderr(){throw new t("process","workerd")},isTerminal(){return!1},setStdinRaw(){throw new t("process","workerd")}}},v=()=>{let e=d(),o=w(),n=l(),i=u(),a=m();return{name:"workerd",version:"unknown",capabilities:c,fs:e,path:o,exec:n,env:i,process:a}};export{c as a,k as b,g as c,v as d};
@@ -1 +1 @@
1
- import{a as k,b as p,c as h,e as m,f as u,g as f}from"./chunk-G65TSD56.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming","tool_calling"];provider="claude-code";modelId;binary;config;constructor(e,n){this.binary=e,this.config=n,this.modelId=n.model}async generateText(e,n){let r=w(this.config,e,"json"),s=f(e.messages,e.system);r.push("-p",s);let o=p(this.binary,r,{signal:n}),l=m(o.stderr),i=o.stdout.getReader(),a=[],d=new TextDecoder,g=await i.read();for(;g.done!==!0;)a.push(d.decode(g.value,{stream:!0})),g=await i.read();i.releaseLock();let T=await o.waitForExit(),_=await l,x=u("claude-code",T.code,_);if(x!==null)throw x;let S=a.join("");return v(S,this.modelId)}async*streamText(e,n){let r=this.config.properties?.streamFormat??"text",s=w(this.config,e,r),o=f(e.messages,e.system);s.push("-p",o);let l=p(this.binary,s,{signal:n}),i=m(l.stderr);try{r==="stream-json"?yield*this.#t(l,i):yield*this.#e(l,i)}catch(a){a instanceof c?yield{kind:"error",error:a}:yield{kind:"error",error:new c(a instanceof Error?a.message:String(a),{provider:"claude-code",cause:a instanceof Error?a:void 0})}}}async*#e(e,n){let r=new TextDecoder,s=e.stdout.getReader(),o=await s.read();for(;o.done!==!0;){let d=r.decode(o.value,{stream:!0});d.length>0&&(yield{kind:"content_delta",textDelta:d}),o=await s.read()}s.releaseLock();let l=await e.waitForExit(),i=await n,a=u("claude-code",l.code,i);a!==null?yield{kind:"error",error:a}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}async*#t(e,n){for await(let l of h(e.stdout)){let i=E(l);i!==null&&(yield i)}let r=await e.waitForExit(),s=await n,o=u("claude-code",r.code,s);o!==null&&(yield{kind:"error",error:o})}close(){return Promise.resolve()}getRawClient(){return null}},P={provider:"claude-code",async createModel(t){let e=await k("claude",t);return new y(e,t)}},w=(t,e,n)=>{let r=[];n!=="text"&&r.push("--output-format",n),n==="stream-json"&&r.push("--verbose"),r.push("--model",t.model);let s=t.properties?.maxTurns;s!==void 0&&r.push("--max-turns",String(s));let o=t.properties?.allowedTools;if(o!==void 0)for(let i of o)r.push("--allowedTools",i);let l=t.properties?.args;return l!==void 0&&r.push(...l),r},v=(t,e)=>{try{let n=JSON.parse(t);return b(n,e)}catch{return{content:[{kind:"text",text:t.trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e}}},b=(t,e)=>{let n=[];if(t.result!==void 0)n.push({kind:"text",text:String(t.result)});else if(t.message?.content!==void 0)for(let r of t.message.content)r.type==="text"?n.push({kind:"text",text:r.text}):r.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:r.id??r.name,name:r.name,arguments:r.input??{}}});else typeof t=="string"&&n.push({kind:"text",text:t});return n.length===0&&n.push({kind:"text",text:JSON.stringify(t)}),{content:n,stopReason:t.stop_reason==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:t.usage?.input_tokens??0,outputTokens:t.usage?.output_tokens??0,totalTokens:(t.usage?.input_tokens??0)+(t.usage?.output_tokens??0)},modelId:e,rawResponse:t}},E=t=>{if(t===null||typeof t!="object")return null;let e=t;if(e.type==="assistant"){if(e.message?.content!==void 0){for(let n of e.message.content)if(n.type==="text")return{kind:"content_delta",textDelta:n.text}}return null}return e.type==="content_block_delta"?e.delta?.type==="text_delta"?{kind:"content_delta",textDelta:e.delta.text}:null:e.type==="result"?{kind:"message_done",stopReason:e.subtype==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown Claude Code error",{provider:"claude-code"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as ClaudeCodeModel,P as claudeCodeFactory};
1
+ import{a as k,b as p,c as h,e as m,f as u,g as f}from"./chunk-AT7V3AKV.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming","tool_calling"];provider="claude-code";modelId;binary;config;constructor(e,n){this.binary=e,this.config=n,this.modelId=n.model}async generateText(e,n){let r=w(this.config,e,"json"),s=f(e.messages,e.system);r.push("-p",s);let o=p(this.binary,r,{signal:n}),l=m(o.stderr),i=o.stdout.getReader(),a=[],d=new TextDecoder,g=await i.read();for(;g.done!==!0;)a.push(d.decode(g.value,{stream:!0})),g=await i.read();i.releaseLock();let T=await o.waitForExit(),_=await l,x=u("claude-code",T.code,_);if(x!==null)throw x;let S=a.join("");return v(S,this.modelId)}async*streamText(e,n){let r=this.config.properties?.streamFormat??"text",s=w(this.config,e,r),o=f(e.messages,e.system);s.push("-p",o);let l=p(this.binary,s,{signal:n}),i=m(l.stderr);try{r==="stream-json"?yield*this.#t(l,i):yield*this.#e(l,i)}catch(a){a instanceof c?yield{kind:"error",error:a}:yield{kind:"error",error:new c(a instanceof Error?a.message:String(a),{provider:"claude-code",cause:a instanceof Error?a:void 0})}}}async*#e(e,n){let r=new TextDecoder,s=e.stdout.getReader(),o=await s.read();for(;o.done!==!0;){let d=r.decode(o.value,{stream:!0});d.length>0&&(yield{kind:"content_delta",textDelta:d}),o=await s.read()}s.releaseLock();let l=await e.waitForExit(),i=await n,a=u("claude-code",l.code,i);a!==null?yield{kind:"error",error:a}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}async*#t(e,n){for await(let l of h(e.stdout)){let i=E(l);i!==null&&(yield i)}let r=await e.waitForExit(),s=await n,o=u("claude-code",r.code,s);o!==null&&(yield{kind:"error",error:o})}close(){return Promise.resolve()}getRawClient(){return null}},P={provider:"claude-code",async createModel(t){let e=await k("claude",t);return new y(e,t)}},w=(t,e,n)=>{let r=[];n!=="text"&&r.push("--output-format",n),n==="stream-json"&&r.push("--verbose"),r.push("--model",t.model);let s=t.properties?.maxTurns;s!==void 0&&r.push("--max-turns",String(s));let o=t.properties?.allowedTools;if(o!==void 0)for(let i of o)r.push("--allowedTools",i);let l=t.properties?.args;return l!==void 0&&r.push(...l),r},v=(t,e)=>{try{let n=JSON.parse(t);return b(n,e)}catch{return{content:[{kind:"text",text:t.trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e}}},b=(t,e)=>{let n=[];if(t.result!==void 0)n.push({kind:"text",text:String(t.result)});else if(t.message?.content!==void 0)for(let r of t.message.content)r.type==="text"?n.push({kind:"text",text:r.text}):r.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:r.id??r.name,name:r.name,arguments:r.input??{}}});else typeof t=="string"&&n.push({kind:"text",text:t});return n.length===0&&n.push({kind:"text",text:JSON.stringify(t)}),{content:n,stopReason:t.stop_reason==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:t.usage?.input_tokens??0,outputTokens:t.usage?.output_tokens??0,totalTokens:(t.usage?.input_tokens??0)+(t.usage?.output_tokens??0)},modelId:e,rawResponse:t}},E=t=>{if(t===null||typeof t!="object")return null;let e=t;if(e.type==="assistant"){if(e.message?.content!==void 0){for(let n of e.message.content)if(n.type==="text")return{kind:"content_delta",textDelta:n.text}}return null}return e.type==="content_block_delta"?e.delta?.type==="text_delta"?{kind:"content_delta",textDelta:e.delta.text}:null:e.type==="result"?{kind:"message_done",stopReason:e.subtype==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown Claude Code error",{provider:"claude-code"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as ClaudeCodeModel,P as claudeCodeFactory};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-D6Q2GR7X.js";import{a as y,b as P}from"./chunk-UXRWSNVZ.js";import{k as g,l as b,m as A,n as x}from"./chunk-MJVACJ6D.js";import{c,d as o,f as u,g as v,o as p,q as m,r as w}from"./chunk-52HFDP2R.js";import{a,b as d}from"./chunk-2N4GTHXQ.js";import{a as f}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var q=async r=>{let e=r?.[0];if(e==="add")return await $(r?.slice(1));if(e==="remove")return await M(r?.slice(1));if(e==="list")return await I();let i=await g(f.process.cwd()),n=P(i),s=p({renderer:w.ansi(),sink:m.stdout()});return s.writeln(`Usage: ${n} concern <add <id> | remove <id> | list>`),await s.close(),a(void 0)},$=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern add open-source",s))),await e.close(),d({exitCode:1});let t=await A(i,n);if(t===null&&(t=(await C()).find(h=>h.id===n)??null,t!==null&&await x(i,t)),t===null){let k=await C();return e.writeln(u(`Unknown concern: ${n}`)),k.length>0&&e.writeln(o(` Available: ${k.map(h=>h.id).join(", ")}`)),await e.close(),d({exitCode:1})}if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is already active.`)),await e.close(),a(void 0);let l={...s,concerns:[...s.concerns,n]};return await b(i,l),e.writeln(v("\u2714")," Activated concern: ",c(n)),e.writeln(o(` ${t.description}`)),await e.close(),a(void 0)},M=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern remove move-fast",s))),await e.close(),d({exitCode:1});if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(!s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is not active.`)),await e.close(),a(void 0);let t={...s,concerns:s.concerns.filter(l=>l!==n)};return await b(i,t),e.writeln(v("\u2714")," Deactivated concern: ",c(n)),await e.close(),a(void 0)},I=async()=>{let r=p({renderer:w.ansi(),sink:m.stdout()}),e=f.process.cwd(),i=await g(e),n=await C(),s=i?.concerns??[];if(r.writeln(c("Concerns")),r.writeln(""),n.length===0)r.writeln(o(" No concerns defined."));else for(let t of n){let l=s.includes(t.id);r.writeln(" ",l?v("\u25CF"):o("\u25CB")," ",l?c(t.id):o(t.id),o(` ${t.description.slice(0,60)}...`))}return await r.close(),a(void 0)};export{q as main};
1
+ import{a as C}from"./chunk-6QFROYLO.js";import{a as y,b as P}from"./chunk-UXRWSNVZ.js";import{k as g,l as b,m as A,n as x}from"./chunk-OJUA2UZK.js";import{c,d as o,f as u,g as v,o as p,q as m,r as w}from"./chunk-4IFPLK7L.js";import{a,b as d}from"./chunk-2N4GTHXQ.js";import{a as f}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var q=async r=>{let e=r?.[0];if(e==="add")return await $(r?.slice(1));if(e==="remove")return await M(r?.slice(1));if(e==="list")return await I();let i=await g(f.process.cwd()),n=P(i),s=p({renderer:w.ansi(),sink:m.stdout()});return s.writeln(`Usage: ${n} concern <add <id> | remove <id> | list>`),await s.close(),a(void 0)},$=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern add open-source",s))),await e.close(),d({exitCode:1});let t=await A(i,n);if(t===null&&(t=(await C()).find(h=>h.id===n)??null,t!==null&&await x(i,t)),t===null){let k=await C();return e.writeln(u(`Unknown concern: ${n}`)),k.length>0&&e.writeln(o(` Available: ${k.map(h=>h.id).join(", ")}`)),await e.close(),d({exitCode:1})}if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is already active.`)),await e.close(),a(void 0);let l={...s,concerns:[...s.concerns,n]};return await b(i,l),e.writeln(v("\u2714")," Activated concern: ",c(n)),e.writeln(o(` ${t.description}`)),await e.close(),a(void 0)},M=async r=>{let e=p({renderer:w.ansi(),sink:m.stdout()}),i=f.process.cwd(),n=r?.[0],s=await g(i);if(n===void 0||n.length===0)return e.writeln(u("Please provide a concern ID: "),c(y("concern remove move-fast",s))),await e.close(),d({exitCode:1});if(s===null)return e.writeln(u("noskills not initialized.")),await e.close(),d({exitCode:1});if(!s.concerns.includes(n))return e.writeln(o(`Concern "${n}" is not active.`)),await e.close(),a(void 0);let t={...s,concerns:s.concerns.filter(l=>l!==n)};return await b(i,t),e.writeln(v("\u2714")," Deactivated concern: ",c(n)),await e.close(),a(void 0)},I=async()=>{let r=p({renderer:w.ansi(),sink:m.stdout()}),e=f.process.cwd(),i=await g(e),n=await C(),s=i?.concerns??[];if(r.writeln(c("Concerns")),r.writeln(""),n.length===0)r.writeln(o(" No concerns defined."));else for(let t of n){let l=s.includes(t.id);r.writeln(" ",l?v("\u25CF"):o("\u25CB")," ",l?c(t.id):o(t.id),o(` ${t.description.slice(0,60)}...`))}return await r.close(),a(void 0)};export{q as main};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-T7K64JD5.js";import{b as D,d as Q}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";function X(){let e=globalThis,r=e.Deno?.build?.os;return typeof r=="string"?r==="windows":e.navigator?.platform?.startsWith("Win")??e.process?.platform?.startsWith("win")??!1}var A=X();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 P(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 Y(e,r=""){e instanceof URL&&(e=P(e)),L(e,r);let t=k(e,p),o=S(t,p);return r?H(o,r):o}function V(e){return e===47}function m(e){return e===47||e===92}function R(e){return e>=97&&e<=122||e>=65&&e<=90}function E(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 q(e,r=""){e instanceof URL&&(e=E(e)),L(e,r);let t=0;if(e.length>=2){let i=e.charCodeAt(0);R(i)&&e.charCodeAt(1)===58&&(t=2)}let o=k(e,m,t),s=S(o,m);return r?H(s,r):s}function ee(e,r=""){return A?q(e,r):Y(e,r)}var re=A?";":":",B=A?"\\":"/";function W(e){if(C(e),e.length===0)return"."}function te(e){e instanceof URL&&(e=P(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 oe(e){e instanceof URL&&(e=E(e)),W(e);let r=e.length,t=-1,o=-1,s=!0,i=0,f=e.charCodeAt(0);if(r>1)if(m(f)){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 R(f)&&e.charCodeAt(1)===58&&(t=i=2,r>2&&m(e.charCodeAt(2))&&(t=i=3));else if(m(f))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),V)}function ie(e){return A?oe(e):te(e)}function ne(e){e instanceof URL&&(e=P(e)),C(e);let r=-1,t=0,o=-1,s=!0,i=0;for(let f=e.length-1;f>=0;--f){let n=e.charCodeAt(f);if(p(n)){if(!s){t=f+1;break}continue}o===-1&&(s=!1,o=f+1),n===46?r===-1?r=f: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 se(e){e instanceof URL&&(e=E(e)),C(e);let r=0,t=-1,o=0,s=-1,i=!0,f=0;e.length>=2&&e.charCodeAt(1)===58&&R(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:f!==1&&(f=1):t!==-1&&(f=-1)}return t===-1||s===-1||f===0||f===1&&t===s-1&&t===o+1?"":e.slice(t,s)}function fe(e){return A?se(e):ne(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 ae(e){return $(e),N("/",e)}function le(e){return $(e),N("\\",e)}function ce(e){return A?le(e):ae(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:!!(R(t)&&r>2&&e.charCodeAt(1)===58&&m(e.charCodeAt(2)))}function me(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,f=-1,n=0,l;for(let a=0;a<=e.length;++a){if(a<e.length)l=e.charCodeAt(a);else{if(o(l))break;l=47}if(o(l)){if(!(f===a-1||n===1))if(f!==a-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)),f=a,n=0;continue}else if(s.length===2||s.length===1){s="",i=0,f=a,n=0;continue}}r&&(s.length>0?s+=`${t}..`:s="..",i=2)}else s.length>0?s+=t+e.slice(f+1,a):s=e.slice(f+1,a),i=a-f-1;f=a,n=0}else l===46&&n!==-1?++n:n=-1}return s}function F(e){e instanceof URL&&(e=P(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=P(e)),r=e?[e,...r]:r,r.forEach(o=>C(o));let t=r.filter(o=>o.length>0).join("/");return t===""?".":F(t)}function b(e){e instanceof URL&&(e=E(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 a=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`\\\\${a}\\${e.slice(l)}\\`;n!==l&&(o=`\\\\${a}\\${e.slice(l,n)}`,t=n)}}}else t=1;else R(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 f;return t<r?f=_(e.slice(t),!s,"\\",m):f="",f.length===0&&!s&&(f="."),f.length>0&&m(e.charCodeAt(r-1))&&(f+="\\"),o===void 0?s?f.length>0?`\\${f}`:"\\":f:s?f.length>0?`${o}\\${f}`:`${o}\\`:o+f}function Z(e,...r){if(e instanceof URL&&(e=E(e)),r=e?[e,...r]:r,r.forEach(f=>C(f)),r=r.filter(f=>f.length>0),r.length===0)return".";let t=!0,o=0,s=r[0];if(m(s.charCodeAt(0))){++o;let f=s.length;f>1&&m(s.charCodeAt(1))&&(++o,f>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 b(i)}function J(e,...r){return A?Z(e,...r):K(e,...r)}function de(e){return A?b(e):F(e)}function ue(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,f=-1,n=!0,l=e.length-1,a=0;for(;l>=o;--l){let d=e.charCodeAt(l);if(p(d)){if(!n){i=l+1;break}continue}f===-1&&(n=!1,f=l+1),d===46?s===-1?s=l:a!==1&&(a=1):s!==-1&&(a=-1)}return s===-1||f===-1||a===0||a===1&&s===f-1&&s===i+1?(f!==-1&&(i===0&&t?r.base=r.name=e.slice(1,f):r.base=r.name=e.slice(i,f)),r.base=r.base||"/"):(i===0&&t?(r.name=e.slice(1,s),r.base=e.slice(1,f)):(r.name=e.slice(i,s),r.base=e.slice(i,f)),r.ext=e.slice(s,f)),i>0?r.dir=S(e.slice(0,i-1),p):t&&(r.dir="/"),r}function pe(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 u=2,c=u;for(;u<t&&!m(e.charCodeAt(u));++u);if(u<t&&u!==c){for(c=u;u<t&&m(e.charCodeAt(u));++u);if(u<t&&u!==c){for(c=u;u<t&&!m(e.charCodeAt(u));++u);u===t?o=u:u!==c&&(o=u+1)}}}}else if(R(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,f=o,n=-1,l=!0,a=e.length-1,d=0;for(;a>=o;--a){if(s=e.charCodeAt(a),m(s)){if(!l){f=a+1;break}continue}n===-1&&(l=!1,n=a+1),s===46?i===-1?i=a:d!==1&&(d=1):i!==-1&&(d=-1)}return i===-1||n===-1||d===0||d===1&&i===n-1&&i===f+1?n!==-1&&(r.base=r.name=e.slice(f,n)):(r.name=e.slice(f,i),r.base=e.slice(f,n),r.ext=e.slice(i,n)),r.base=r.base||"\\",f>0&&f!==o?r.dir=e.slice(0,f-1):r.dir=r.root,r}function Ae(e){return A?pe(e):ue(e)}function O(...e){let r="",t=!1;for(let o=e.length-1;o>=-1&&!t;o--){let s;if(o>=0)s=e[o];else{let{Deno:i}=globalThis;if(typeof i?.cwd!="function")throw new TypeError("Resolved a relative path without a current working directory (CWD)");s=i.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 Ce(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,f=r.length;for(;i<f&&p(r.charCodeAt(i));++i);let n=f-i,l=s<n?s:n,a=-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))?a=d:d===0&&(a=0));break}let c=e.charCodeAt(t+d),x=r.charCodeAt(i+d);if(c!==x)break;p(c)&&(a=d)}let u="";for(d=t+a+1;d<=o;++d)(d===o||p(e.charCodeAt(d)))&&(u.length===0?u+="..":u+="/..");return u.length>0?u+r.slice(i+a):(i+=a,p(r.charCodeAt(i))&&++i,r.slice(i))}function T(...e){let r="",t="",o=!1;for(let s=e.length-1;s>=-1;s--){let i,{Deno:f}=globalThis;if(s>=0)i=e[s];else if(r){if(typeof f?.env?.get!="function"||typeof f?.cwd!="function")throw new TypeError("Resolved a relative path without a current working directory (CWD)");i=f.cwd(),(i===void 0||i.slice(0,3).toLowerCase()!==`${r.toLowerCase()}\\`)&&(i=`${r}\\`)}else{if(typeof f?.cwd!="function")throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)");i=f.cwd()}C(i);let n=i.length;if(n===0)continue;let l=0,a="",d=!1,u=i.charCodeAt(0);if(n>1)if(m(u))if(d=!0,m(i.charCodeAt(1))){let c=2,x=c;for(;c<n&&!m(i.charCodeAt(c));++c);if(c<n&&c!==x){let v=i.slice(x,c);for(x=c;c<n&&m(i.charCodeAt(c));++c);if(c<n&&c!==x){for(x=c;c<n&&!m(i.charCodeAt(c));++c);c===n?(a=`\\\\${v}\\${i.slice(x)}`,l=c):c!==x&&(a=`\\\\${v}\\${i.slice(x,c)}`,l=c)}}}else l=1;else R(u)&&i.charCodeAt(1)===58&&(a=i.slice(0,2),l=2,n>2&&m(i.charCodeAt(2))&&(d=!0,l=3));else m(u)&&(l=1,d=!0);if(!(a.length>0&&r.length>0&&a.toLowerCase()!==r.toLowerCase())&&(r.length===0&&a.length>0&&(r=a),o||(t=`${i.slice(l)}\\${t}`,o=d),o&&r.length>0))break}return t=_(t,!o,"\\",m),r+(o?"\\":"")+t||"."}function xe(e,r){z(e,r);let t=T(e),o=T(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 f=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 a=l-n,d=f<a?f:a,u=-1,c=0;for(;c<=d;++c){if(c===d){if(a>d){if(r.charCodeAt(n+c)===92)return o.slice(n+c+1);if(c===2)return o.slice(n+c)}f>d&&(e.charCodeAt(s+c)===92?u=c:c===2&&(u=3));break}let v=e.charCodeAt(s+c),ge=r.charCodeAt(n+c);if(v!==ge)break;v===92&&(u=c)}if(c!==d&&u===-1)return o;let x="";for(u===-1&&(u=0),c=s+u+1;c<=i;++c)(c===i||e.charCodeAt(c)===92)&&(x.length===0?x+="..":x+="\\..");return x.length>0?x+o.slice(n+u,l):(n+=u,o.charCodeAt(n)===92&&++n,o.slice(n,l))}function Re(e,r){return A?xe(e,r):Ce(e,r)}function he(...e){return A?T(...e):O(...e)}var Fe={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!0},be=()=>{let e=r=>({isFile:r.isFile,isDirectory:r.isDirectory,isSymlink:r.isSymlink,size:r.size,mtime:r.mtime,atime:r.atime,birthtime:r.birthtime});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=f=>({kind:f.kind,paths:f.paths,flag:f.flag});return{close:()=>s.close(),[Symbol.asyncIterator]:async function*(){for await(let f of s)yield i(f)}}},async*walk(r,t){let o=t?.includeDirs??!0,s=t?.includeFiles??!0,i=t?.exts,f=t?.skip,n=async function*(l){for await(let a of Deno.readDir(l)){let d=J(l,a.name);if(!f?.some(u=>u.test(d))){if(a.isDirectory)o&&(yield{path:d,name:a.name,isFile:!1,isDirectory:!0,isSymlink:a.isSymlink}),yield*n(d);else if(a.isFile||a.isSymlink){if(!s||i&&!i.some(u=>a.name.endsWith(u.startsWith(".")?u:`.${u}`)))continue;yield{path:d,name:a.name,isFile:a.isFile,isDirectory:!1,isSymlink:a.isSymlink}}}}};yield*n(r)},async chmod(r,t){let{chmod:o}=await import("./unstable_chmod-WRDBWEC2.js");await o(r,t)}}},Oe=()=>({join:J,resolve:he,dirname:ie,basename:ee,extname:fe,normalize:de,isAbsolute:me,relative:Re,parse:Ae,format:ce,sep:B,delimiter:re}),He=()=>({async spawn(e,r=[],t){let o=G(t),i=await new Deno.Command(e,{args:r,cwd:t?.cwd,env:t?.env,stdin:o.stdin,stdout:o.stdout,stderr:o.stderr,signal:t?.signal}).output();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 Q(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(),f=(n,l)=>l!=="piped"||!n?Promise.resolve(new Uint8Array):new Response(n).arrayBuffer().then(a=>new Uint8Array(a));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,[a,d,u]=await Promise.all([i.status,f(n,o.stdout),f(l,o.stderr)]);return{success:a.success,code:a.code,stdout:d,stderr:u}},kill:n=>{i.kill(n)}}}}),ke=()=>({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()}}),Le=()=>({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()},args:Deno.args,pid:Deno.pid,stdin:Deno.stdin.readable,stdout:Deno.stdout.writable,stderr:Deno.stderr.writable}),En=()=>{let e=be(),r=Oe(),t=He(),o=ke(),s=Le();return{name:"deno",version:Deno.version.deno,capabilities:Fe,fs:e,path:r,exec:t,env:o,process:s}};export{Fe as DENO_CAPABILITIES,En as createDenoRuntime};
1
+ import{a as G}from"./chunk-T7K64JD5.js";import{b as D,d as Q}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";function X(){let e=globalThis,r=e.Deno?.build?.os;return typeof r=="string"?r==="windows":e.navigator?.platform?.startsWith("Win")??e.process?.platform?.startsWith("win")??!1}var A=X();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 P(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 Y(e,r=""){e instanceof URL&&(e=P(e)),L(e,r);let t=k(e,p),o=S(t,p);return r?H(o,r):o}function V(e){return e===47}function m(e){return e===47||e===92}function R(e){return e>=97&&e<=122||e>=65&&e<=90}function E(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 q(e,r=""){e instanceof URL&&(e=E(e)),L(e,r);let t=0;if(e.length>=2){let i=e.charCodeAt(0);R(i)&&e.charCodeAt(1)===58&&(t=2)}let o=k(e,m,t),s=S(o,m);return r?H(s,r):s}function ee(e,r=""){return A?q(e,r):Y(e,r)}var re=A?";":":",B=A?"\\":"/";function W(e){if(C(e),e.length===0)return"."}function te(e){e instanceof URL&&(e=P(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 oe(e){e instanceof URL&&(e=E(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 R(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),V)}function ie(e){return A?oe(e):te(e)}function ne(e){e instanceof URL&&(e=P(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 se(e){e instanceof URL&&(e=E(e)),C(e);let r=0,t=-1,o=0,s=-1,i=!0,a=0;e.length>=2&&e.charCodeAt(1)===58&&R(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 ae(e){return A?se(e):ne(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 fe(e){return $(e),N("/",e)}function le(e){return $(e),N("\\",e)}function ce(e){return A?le(e):fe(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:!!(R(t)&&r>2&&e.charCodeAt(1)===58&&m(e.charCodeAt(2)))}function me(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 f=0;f<=e.length;++f){if(f<e.length)l=e.charCodeAt(f);else{if(o(l))break;l=47}if(o(l)){if(!(a===f-1||n===1))if(a!==f-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=f,n=0;continue}else if(s.length===2||s.length===1){s="",i=0,a=f,n=0;continue}}r&&(s.length>0?s+=`${t}..`:s="..",i=2)}else s.length>0?s+=t+e.slice(a+1,f):s=e.slice(a+1,f),i=f-a-1;a=f,n=0}else l===46&&n!==-1?++n:n=-1}return s}function F(e){e instanceof URL&&(e=P(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=P(e)),r=e?[e,...r]:r,r.forEach(o=>C(o));let t=r.filter(o=>o.length>0).join("/");return t===""?".":F(t)}function b(e){e instanceof URL&&(e=E(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 f=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`\\\\${f}\\${e.slice(l)}\\`;n!==l&&(o=`\\\\${f}\\${e.slice(l,n)}`,t=n)}}}else t=1;else R(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=E(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 b(i)}function J(e,...r){return A?Z(e,...r):K(e,...r)}function de(e){return A?b(e):F(e)}function ue(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,f=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:f!==1&&(f=1):s!==-1&&(f=-1)}return s===-1||a===-1||f===0||f===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 pe(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 u=2,c=u;for(;u<t&&!m(e.charCodeAt(u));++u);if(u<t&&u!==c){for(c=u;u<t&&m(e.charCodeAt(u));++u);if(u<t&&u!==c){for(c=u;u<t&&!m(e.charCodeAt(u));++u);u===t?o=u:u!==c&&(o=u+1)}}}}else if(R(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,f=e.length-1,d=0;for(;f>=o;--f){if(s=e.charCodeAt(f),m(s)){if(!l){a=f+1;break}continue}n===-1&&(l=!1,n=f+1),s===46?i===-1?i=f: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 Ae(e){return A?pe(e):ue(e)}function O(...e){let r="",t=!1;for(let o=e.length-1;o>=-1&&!t;o--){let s;if(o>=0)s=e[o];else{let{Deno:i}=globalThis;if(typeof i?.cwd!="function")throw new TypeError("Resolved a relative path without a current working directory (CWD)");s=i.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 Ce(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,f=-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))?f=d:d===0&&(f=0));break}let c=e.charCodeAt(t+d),x=r.charCodeAt(i+d);if(c!==x)break;p(c)&&(f=d)}let u="";for(d=t+f+1;d<=o;++d)(d===o||p(e.charCodeAt(d)))&&(u.length===0?u+="..":u+="/..");return u.length>0?u+r.slice(i+f):(i+=f,p(r.charCodeAt(i))&&++i,r.slice(i))}function T(...e){let r="",t="",o=!1;for(let s=e.length-1;s>=-1;s--){let i,{Deno:a}=globalThis;if(s>=0)i=e[s];else if(r){if(typeof a?.env?.get!="function"||typeof a?.cwd!="function")throw new TypeError("Resolved a relative path without a current working directory (CWD)");i=a.cwd(),(i===void 0||i.slice(0,3).toLowerCase()!==`${r.toLowerCase()}\\`)&&(i=`${r}\\`)}else{if(typeof a?.cwd!="function")throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)");i=a.cwd()}C(i);let n=i.length;if(n===0)continue;let l=0,f="",d=!1,u=i.charCodeAt(0);if(n>1)if(m(u))if(d=!0,m(i.charCodeAt(1))){let c=2,x=c;for(;c<n&&!m(i.charCodeAt(c));++c);if(c<n&&c!==x){let v=i.slice(x,c);for(x=c;c<n&&m(i.charCodeAt(c));++c);if(c<n&&c!==x){for(x=c;c<n&&!m(i.charCodeAt(c));++c);c===n?(f=`\\\\${v}\\${i.slice(x)}`,l=c):c!==x&&(f=`\\\\${v}\\${i.slice(x,c)}`,l=c)}}}else l=1;else R(u)&&i.charCodeAt(1)===58&&(f=i.slice(0,2),l=2,n>2&&m(i.charCodeAt(2))&&(d=!0,l=3));else m(u)&&(l=1,d=!0);if(!(f.length>0&&r.length>0&&f.toLowerCase()!==r.toLowerCase())&&(r.length===0&&f.length>0&&(r=f),o||(t=`${i.slice(l)}\\${t}`,o=d),o&&r.length>0))break}return t=_(t,!o,"\\",m),r+(o?"\\":"")+t||"."}function xe(e,r){z(e,r);let t=T(e),o=T(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 f=l-n,d=a<f?a:f,u=-1,c=0;for(;c<=d;++c){if(c===d){if(f>d){if(r.charCodeAt(n+c)===92)return o.slice(n+c+1);if(c===2)return o.slice(n+c)}a>d&&(e.charCodeAt(s+c)===92?u=c:c===2&&(u=3));break}let v=e.charCodeAt(s+c),ge=r.charCodeAt(n+c);if(v!==ge)break;v===92&&(u=c)}if(c!==d&&u===-1)return o;let x="";for(u===-1&&(u=0),c=s+u+1;c<=i;++c)(c===i||e.charCodeAt(c)===92)&&(x.length===0?x+="..":x+="\\..");return x.length>0?x+o.slice(n+u,l):(n+=u,o.charCodeAt(n)===92&&++n,o.slice(n,l))}function Re(e,r){return A?xe(e,r):Ce(e,r)}function he(...e){return A?T(...e):O(...e)}var Fe={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!0},be=()=>{let e=r=>({isFile:r.isFile,isDirectory:r.isDirectory,isSymlink:r.isSymlink,size:r.size,mtime:r.mtime,atime:r.atime,birthtime:r.birthtime});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 f of Deno.readDir(l)){let d=J(l,f.name);if(!a?.some(u=>u.test(d))){if(f.isDirectory)o&&(yield{path:d,name:f.name,isFile:!1,isDirectory:!0,isSymlink:f.isSymlink}),yield*n(d);else if(f.isFile||f.isSymlink){if(!s||i&&!i.some(u=>f.name.endsWith(u.startsWith(".")?u:`.${u}`)))continue;yield{path:d,name:f.name,isFile:f.isFile,isDirectory:!1,isSymlink:f.isSymlink}}}}};yield*n(r)},async chmod(r,t){let{chmod:o}=await import("./unstable_chmod-WRDBWEC2.js");await o(r,t)}}},Oe=()=>({join:J,resolve:he,dirname:ie,basename:ee,extname:ae,normalize:de,isAbsolute:me,relative:Re,parse:Ae,format:ce,sep:B,delimiter:re}),He=()=>({async spawn(e,r=[],t){let o=G(t),i=await new Deno.Command(e,{args:r,cwd:t?.cwd,env:t?.env,stdin:o.stdin,stdout:o.stdout,stderr:o.stderr,signal:t?.signal}).output();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 Q(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(f=>new Uint8Array(f));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,[f,d,u]=await Promise.all([i.status,a(n,o.stdout),a(l,o.stderr)]);return{success:f.success,code:f.code,stdout:d,stderr:u}},kill:n=>{i.kill(n)}}}}),ke=()=>({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()}}),Le=()=>({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()},args:Deno.args,pid:Deno.pid,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)}}),En=()=>{let e=be(),r=Oe(),t=He(),o=ke(),s=Le();return{name:"deno",version:Deno.version.deno,capabilities:Fe,fs:e,path:r,exec:t,env:o,process:s}};export{Fe as DENO_CAPABILITIES,En as createDenoRuntime};
@@ -1 +1 @@
1
- import{a as C,d as U}from"./chunk-O3PI76HM.js";import{a as E}from"./chunk-OM4QJ24S.js";import{a as S}from"./chunk-UXRWSNVZ.js";import{e as f,f as h,k as g}from"./chunk-MJVACJ6D.js";import{c as n,d as i,f as l,g as m,o as d,q as w,r as u}from"./chunk-52HFDP2R.js";import{a as o,b as p}from"./chunk-2N4GTHXQ.js";import{a as c}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var G=async y=>{let e=d({renderer:u.ansi(),sink:w.stdout()}),s=c.process.cwd(),t=await f(s),$=await g(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot complete in phase: ${t.phase}`)),e.writeln(i("Only EXECUTING phase can transition to DONE.")),await e.close(),p({exitCode:1});let r=E(t,"DONE");if(await h(s,r),r.spec!==null&&(await C(s,r.spec,"done"),await U(s,r.spec,"done")),e.writeln(m("\u2714")," Spec completed!"),e.writeln(""),e.writeln(" Spec: ",n(t.spec??"unknown")),e.writeln(` Iterations: ${t.execution.iteration}`),e.writeln(` Decisions: ${t.decisions.length}`),t.decisions.length>0){let a=t.decisions.filter(k=>k.promoted);a.length>0&&e.writeln(i(` Promoted to rules: ${a.length}`))}return e.writeln(""),e.writeln("Start a new spec with: ",n(`${S('spec new "..."',$)}`)),await e.close(),o(void 0)};export{G as main};
1
+ import{a as C,d as U}from"./chunk-KBNVVXFC.js";import{a as E}from"./chunk-HLQNHWXS.js";import{a as S}from"./chunk-UXRWSNVZ.js";import{e as f,f as h,k as g}from"./chunk-OJUA2UZK.js";import{c as n,d as i,f as l,g as m,o as d,q as w,r as u}from"./chunk-4IFPLK7L.js";import{a as o,b as p}from"./chunk-2N4GTHXQ.js";import{a as c}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var G=async y=>{let e=d({renderer:u.ansi(),sink:w.stdout()}),s=c.process.cwd(),t=await f(s),$=await g(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot complete in phase: ${t.phase}`)),e.writeln(i("Only EXECUTING phase can transition to DONE.")),await e.close(),p({exitCode:1});let r=E(t,"DONE");if(await h(s,r),r.spec!==null&&(await C(s,r.spec,"done"),await U(s,r.spec,"done")),e.writeln(m("\u2714")," Spec completed!"),e.writeln(""),e.writeln(" Spec: ",n(t.spec??"unknown")),e.writeln(` Iterations: ${t.execution.iteration}`),e.writeln(` Decisions: ${t.decisions.length}`),t.decisions.length>0){let a=t.decisions.filter(k=>k.promoted);a.length>0&&e.writeln(i(` Promoted to rules: ${a.length}`))}return e.writeln(""),e.writeln("Start a new spec with: ",n(`${S('spec new "..."',$)}`)),await e.close(),o(void 0)};export{G as main};
@@ -1 +1 @@
1
- import{a as G,b as z}from"./chunk-XHFYREAD.js";import{a as $,b as R,e as T,f as M,g as j,h as r,i as u}from"./chunk-C2SQE5AG.js";import{b as q}from"./chunk-LEPZPNTN.js";import"./chunk-AGPCY6XP.js";import{a as v}from"./chunk-UWD66JGG.js";import{a as U}from"./chunk-D6Q2GR7X.js";import{a as w}from"./chunk-UXRWSNVZ.js";import{a as I,b as D,f as E,k as J,l as L,n as F,p as O,r as N}from"./chunk-MJVACJ6D.js";import"./chunk-52HFDP2R.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as A}from"./chunk-TNKUKNM4.js";import{a as b}from"./chunk-2N4GTHXQ.js";import"./chunk-SOMEQCOS.js";import{a as l}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var Y=new A({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-5YIOZTBI.js")},list:{description:"List available AI providers",load:()=>import("./list-U5OS3WZ4.js")}}});var W=v;var te=async t=>{try{return await l.fs.stat(t),!0}catch{return!1}},oe=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]}],_=async t=>{let e=[];for(let n of oe)for(let o of n.paths)if(await te(`${t}/${o}`)){e.push(n.id);break}return e};var i=async t=>{try{return await l.fs.stat(t),!0}catch{return!1}},H=async(t,e)=>{try{let n=await l.fs.readTextFile(t);return JSON.parse(n)[e]??null}catch{return null}},ne=async t=>{let e=[];return(await i(`${t}/package.json`)||await i(`${t}/deno.json`))&&e.push("typescript"),await i(`${t}/go.mod`)&&e.push("go"),await i(`${t}/Cargo.toml`)&&e.push("rust"),(await i(`${t}/pyproject.toml`)||await i(`${t}/setup.py`))&&e.push("python"),e},re=async t=>{let e=[],n=await H(`${t}/package.json`,"dependencies");return n!==null&&("react"in n&&e.push("react"),"vue"in n&&e.push("vue"),"svelte"in n&&e.push("svelte"),"next"in n&&e.push("nextjs"),"express"in n&&e.push("express"),"hono"in n&&e.push("hono")),e},ie=async t=>{let e=[];return await i(`${t}/.github/workflows`)&&e.push("github-actions"),await i(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await i(`${t}/Jenkinsfile`)&&e.push("jenkins"),await i(`${t}/.circleci`)&&e.push("circleci"),e},ae=async t=>{if(await i(`${t}/deno.json`))return"deno";let e=await H(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},K=async t=>{let[e,n,o,f]=await Promise.all([ne(t),re(t),ie(t),ae(t)]);return{languages:e,frameworks:n,ci:o,testRunner:f}};var at=async t=>{let e=l.process.cwd(),n=G(t),o=R({target:n==="agent"?"non-interactive":"interactive"}),f=z(t),x=le(f,"--concerns"),Q=f.includes("--non-interactive")||n==="agent";if(await N(e)){let s=await J(e);return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${w("sync",s)}\` to regenerate tool files.`),b(void 0)}M(o,"noskills init");let C=u(o,"Scanning project...");C.start();let d=await K(e);C.succeed("Project scanned");for(let s of d.languages)r.step(o,` ${s}`);for(let s of d.frameworks)r.step(o,` ${s}`);for(let s of d.ci)r.step(o,` ${s}`);d.testRunner!==null&&r.step(o,` test runner: ${d.testRunner}`);let B=u(o,"Detecting coding tools...");B.start();let p=await _(e);B.succeed(`${p.length} coding tool(s) detected`);for(let s of p)r.step(o,` ${s}`);let P=u(o,"Detecting AI providers...");P.start();let m=(await W()).filter(s=>s.available).map(s=>s.name);P.succeed(`${m.length} provider(s) detected`);let h=await U(),c;if(x!==null){let s=h.map(a=>a.id);c=x.filter(a=>s.includes(a)).sort((a,g)=>s.indexOf(a)-s.indexOf(g))}else if(Q)c=[];else{let s=h.map(g=>({value:g.id,label:g.name,hint:g.description.slice(0,60)})),a=await T(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});c=$(a)?[]:[...a]}c.length>0?r.success(o,`Concerns: ${c.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id>`.");let k=de(),S=u(o,"Initializing...");S.start(),await O(e);let V=h.filter(s=>c.includes(s.id));for(let s of V)await F(e,s);let y={...D(c,p,m,d),command:k};await L(e,y);let X=I();if(await E(e,X),S.succeed("Scaffolded `.eser/`"),p.length>0){let s=u(o,"Syncing tool files...");s.start();let a=await q(e,p,y);s.succeed(`Synced ${a.length} tool(s)`)}return r.success(o,`Done. ${p.length} tool(s), ${m.length} provider(s), ${c.length} concern(s).`),r.info(o,`Command prefix: ${k}`),j(o,`Start a spec with: ${w('spec new "..."',y)}`),b(void 0)},le=(t,e)=>{if(t===void 0)return null;for(let n of t)if(n.startsWith(`${e}=`))return n.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null},de=()=>{try{let e=l.process.args.join(" ");if(e.includes("jsr:@eser/noskills"))return"deno run jsr:@eser/noskills";if(e.includes("noskills/main.ts"))return"deno run --allow-all ./pkg/@eser/noskills/main.ts";if(e.includes("eser")&&e.includes("nos")&&!e.includes("noskills"))return"eser nos";if(e.includes("eser")&&e.includes("noskills"))return"eser noskills"}catch{}return"npx eser noskills"};export{at as main};
1
+ import{a as G,b as z}from"./chunk-M2ZPJN26.js";import{a as $,b as R,e as T,f as M,g as j,h as r,i as u}from"./chunk-AB4ZUDV6.js";import{b as q}from"./chunk-QEEZKZXM.js";import"./chunk-AGPCY6XP.js";import{a as v}from"./chunk-RVIPYZ7F.js";import{a as U}from"./chunk-6QFROYLO.js";import{a as w}from"./chunk-UXRWSNVZ.js";import{a as I,b as D,f as E,k as J,l as L,n as F,p as O,r as N}from"./chunk-OJUA2UZK.js";import"./chunk-4IFPLK7L.js";import"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as A}from"./chunk-LZSLKXJE.js";import{a as b}from"./chunk-2N4GTHXQ.js";import"./chunk-6C2MLMD6.js";import{a as l}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var Y=new A({description:"AI provider interface \u2014 ask questions, generate content",modules:{ask:{description:"Send a prompt to an AI provider",load:()=>import("./ask-TR4ZPBU5.js")},list:{description:"List available AI providers",load:()=>import("./list-UT3MSC6R.js")}}});var W=v;var te=async t=>{try{return await l.fs.stat(t),!0}catch{return!1}},oe=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]}],_=async t=>{let e=[];for(let n of oe)for(let o of n.paths)if(await te(`${t}/${o}`)){e.push(n.id);break}return e};var i=async t=>{try{return await l.fs.stat(t),!0}catch{return!1}},H=async(t,e)=>{try{let n=await l.fs.readTextFile(t);return JSON.parse(n)[e]??null}catch{return null}},ne=async t=>{let e=[];return(await i(`${t}/package.json`)||await i(`${t}/deno.json`))&&e.push("typescript"),await i(`${t}/go.mod`)&&e.push("go"),await i(`${t}/Cargo.toml`)&&e.push("rust"),(await i(`${t}/pyproject.toml`)||await i(`${t}/setup.py`))&&e.push("python"),e},re=async t=>{let e=[],n=await H(`${t}/package.json`,"dependencies");return n!==null&&("react"in n&&e.push("react"),"vue"in n&&e.push("vue"),"svelte"in n&&e.push("svelte"),"next"in n&&e.push("nextjs"),"express"in n&&e.push("express"),"hono"in n&&e.push("hono")),e},ie=async t=>{let e=[];return await i(`${t}/.github/workflows`)&&e.push("github-actions"),await i(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await i(`${t}/Jenkinsfile`)&&e.push("jenkins"),await i(`${t}/.circleci`)&&e.push("circleci"),e},ae=async t=>{if(await i(`${t}/deno.json`))return"deno";let e=await H(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},K=async t=>{let[e,n,o,f]=await Promise.all([ne(t),re(t),ie(t),ae(t)]);return{languages:e,frameworks:n,ci:o,testRunner:f}};var at=async t=>{let e=l.process.cwd(),n=G(t),o=R({target:n==="agent"?"non-interactive":"interactive"}),f=z(t),x=le(f,"--concerns"),Q=f.includes("--non-interactive")||n==="agent";if(await N(e)){let s=await J(e);return r.warn(o,"noskills is already initialized in this project."),r.info(o,`Run \`${w("sync",s)}\` to regenerate tool files.`),b(void 0)}M(o,"noskills init");let C=u(o,"Scanning project...");C.start();let d=await K(e);C.succeed("Project scanned");for(let s of d.languages)r.step(o,` ${s}`);for(let s of d.frameworks)r.step(o,` ${s}`);for(let s of d.ci)r.step(o,` ${s}`);d.testRunner!==null&&r.step(o,` test runner: ${d.testRunner}`);let B=u(o,"Detecting coding tools...");B.start();let p=await _(e);B.succeed(`${p.length} coding tool(s) detected`);for(let s of p)r.step(o,` ${s}`);let P=u(o,"Detecting AI providers...");P.start();let m=(await W()).filter(s=>s.available).map(s=>s.name);P.succeed(`${m.length} provider(s) detected`);let h=await U(),c;if(x!==null){let s=h.map(a=>a.id);c=x.filter(a=>s.includes(a)).sort((a,g)=>s.indexOf(a)-s.indexOf(g))}else if(Q)c=[];else{let s=h.map(g=>({value:g.id,label:g.name,hint:g.description.slice(0,60)})),a=await T(o,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});c=$(a)?[]:[...a]}c.length>0?r.success(o,`Concerns: ${c.join(", ")}`):r.info(o,"No concerns selected. Add later with `concern add <id>`.");let k=de(),S=u(o,"Initializing...");S.start(),await O(e);let V=h.filter(s=>c.includes(s.id));for(let s of V)await F(e,s);let y={...D(c,p,m,d),command:k};await L(e,y);let X=I();if(await E(e,X),S.succeed("Scaffolded `.eser/`"),p.length>0){let s=u(o,"Syncing tool files...");s.start();let a=await q(e,p,y);s.succeed(`Synced ${a.length} tool(s)`)}return r.success(o,`Done. ${p.length} tool(s), ${m.length} provider(s), ${c.length} concern(s).`),r.info(o,`Command prefix: ${k}`),j(o,`Start a spec with: ${w('spec new "..."',y)}`),b(void 0)},le=(t,e)=>{if(t===void 0)return null;for(let n of t)if(n.startsWith(`${e}=`))return n.slice(e.length+1).split(",").map(o=>o.trim()).filter(Boolean);return null},de=()=>{try{let e=l.process.args.join(" ");if(e.includes("jsr:@eser/noskills"))return"deno run jsr:@eser/noskills";if(e.includes("noskills/main.ts"))return"deno run --allow-all ./pkg/@eser/noskills/main.ts";if(e.includes("eser")&&e.includes("nos")&&!e.includes("noskills"))return"eser nos";if(e.includes("eser")&&e.includes("noskills"))return"eser noskills"}catch{}return"npx eser noskills"};export{at as main};
@@ -1,4 +1,4 @@
1
- import{a as d}from"./chunk-UXRWSNVZ.js";import{d as g,e as x,k as S}from"./chunk-MJVACJ6D.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{a as i}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=async()=>{let n=i.process.stdin.getReader(),e=[];try{for(;;){let{done:o,value:a}=await n.read();if(o||a===void 0)break;e.push(a)}}finally{n.releaseLock()}let t=0,c=new Uint8Array(e.reduce((o,a)=>o+a.length,0));for(let o of e)c.set(o,t),t+=o.length;let s=new TextDecoder().decode(c);try{return JSON.parse(s)}catch{return{}}},R=async n=>{let e=new TextEncoder,t=i.process.stdout.getWriter();await t.write(e.encode(JSON.stringify(n))),t.releaseLock()},I=async n=>{switch(n?.[0]){case"pre-tool-use":return await D();case"stop":return await T();case"post-file-write":return await v();case"post-bash":return await F();default:return r(void 0)}},D=async()=>{let n=await y(),e=n.tool_name??"unknown",t=n.tool_input??{},c=n.cwd??i.process.cwd(),s=await S(c),o={};try{o=await x(c)}catch{return r(void 0)}let a=async u=>{await R({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${u}`}})};if(o.pendingClear===!0)return await a(`Task accepted. You must run \`/clear\` and then \`${d("next",s)}\` before continuing.`),r(void 0);if(e==="Bash"){let u=(t.command??"").trim();if(!(s?.allowGit??!1)){let p=["git add","git commit","git push","git merge","git rebase","git checkout","git stash","git reset","git cherry-pick","git tag","git branch -d","git branch -D","git branch -m","git revert","git am","git mv","git rm"];for(let w of p)if(u.startsWith(w)||u.includes(` && ${w}`)||u.includes(`; ${w}`))return await a("git is read-only for agents. The user controls git. You may use `git log`, `git diff`, `git status`, `git show`, `git blame`."),r(void 0)}return r(void 0)}if(!["Write","Edit","MultiEdit"].includes(e))return r(void 0);let h=t.file_path??t.path??"";if(h.includes(".eser/")||h.includes(".claude/"))return r(void 0);let f=o.phase??"UNKNOWN";if(f==="EXECUTING")return r(void 0);let k={IDLE:`No active spec. Run \`${d("spec new",s)}\``,UNINITIALIZED:`noskills not initialized. Run \`${d("init",s)}\``,DISCOVERY:`Discovery in progress. Run \`${d("next",s)}\` to continue.`,SPEC_DRAFT:`Spec needs review. Run \`${d("approve",s)}\``,SPEC_APPROVED:`Start execution first: \`${d('next --answer="start"',s)}\``,BLOCKED:`Execution blocked. Resolve with \`${d('next --answer="resolution"',s)}\``,DONE:`Spec complete. Start a new one or run \`${d("reset",s)}\``};return await a(k[f]??`Run \`${d("next",s)}\` first.`),r(void 0)},T=async()=>{let n=await y();if(n.stop_hook_active===!0)return r(void 0);let e=n.cwd??i.process.cwd(),t;try{let l=await i.fs.readTextFile(`${e}/${g.stateFile}`);t=JSON.parse(l)}catch{return r(void 0)}if(t.phase!=="EXECUTING")return r(void 0);let c=t.execution??{},s=`${e}/${g.stateDir}/files-changed.jsonl`,o=[];try{let p=(await i.fs.readTextFile(s)).trim().split(`
1
+ import{a as d}from"./chunk-UXRWSNVZ.js";import{d as g,e as x,k as S}from"./chunk-OJUA2UZK.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{a as i}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=async()=>{let n=i.process.stdin.getReader(),e=[];try{for(;;){let{done:o,value:a}=await n.read();if(o||a===void 0)break;e.push(a)}}finally{n.releaseLock()}let t=0,c=new Uint8Array(e.reduce((o,a)=>o+a.length,0));for(let o of e)c.set(o,t),t+=o.length;let s=new TextDecoder().decode(c);try{return JSON.parse(s)}catch{return{}}},R=async n=>{let e=new TextEncoder,t=i.process.stdout.getWriter();await t.write(e.encode(JSON.stringify(n))),t.releaseLock()},I=async n=>{switch(n?.[0]){case"pre-tool-use":return await D();case"stop":return await T();case"post-file-write":return await v();case"post-bash":return await F();default:return r(void 0)}},D=async()=>{let n=await y(),e=n.tool_name??"unknown",t=n.tool_input??{},c=n.cwd??i.process.cwd(),s=await S(c),o={};try{o=await x(c)}catch{return r(void 0)}let a=async u=>{await R({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${u}`}})};if(o.pendingClear===!0)return await a(`Task accepted. You must run \`/clear\` and then \`${d("next",s)}\` before continuing.`),r(void 0);if(e==="Bash"){let u=(t.command??"").trim();if(!(s?.allowGit??!1)){let p=["git add","git commit","git push","git merge","git rebase","git checkout","git stash","git reset","git cherry-pick","git tag","git branch -d","git branch -D","git branch -m","git revert","git am","git mv","git rm"];for(let w of p)if(u.startsWith(w)||u.includes(` && ${w}`)||u.includes(`; ${w}`))return await a("git is read-only for agents. The user controls git. You may use `git log`, `git diff`, `git status`, `git show`, `git blame`."),r(void 0)}return r(void 0)}if(!["Write","Edit","MultiEdit"].includes(e))return r(void 0);let h=t.file_path??t.path??"";if(h.includes(".eser/")||h.includes(".claude/"))return r(void 0);let f=o.phase??"UNKNOWN";if(f==="EXECUTING")return r(void 0);let k={IDLE:`No active spec. Run \`${d("spec new",s)}\``,UNINITIALIZED:`noskills not initialized. Run \`${d("init",s)}\``,DISCOVERY:`Discovery in progress. Run \`${d("next",s)}\` to continue.`,SPEC_DRAFT:`Spec needs review. Run \`${d("approve",s)}\``,SPEC_APPROVED:`Start execution first: \`${d('next --answer="start"',s)}\``,BLOCKED:`Execution blocked. Resolve with \`${d('next --answer="resolution"',s)}\``,DONE:`Spec complete. Start a new one or run \`${d("reset",s)}\``};return await a(k[f]??`Run \`${d("next",s)}\` first.`),r(void 0)},T=async()=>{let n=await y();if(n.stop_hook_active===!0)return r(void 0);let e=n.cwd??i.process.cwd(),t;try{let l=await i.fs.readTextFile(`${e}/${g.stateFile}`);t=JSON.parse(l)}catch{return r(void 0)}if(t.phase!=="EXECUTING")return r(void 0);let c=t.execution??{},s=`${e}/${g.stateDir}/files-changed.jsonl`,o=[];try{let p=(await i.fs.readTextFile(s)).trim().split(`
2
2
  `).filter(Boolean);o=[...new Set(p.map(w=>{try{return JSON.parse(w).file}catch{return null}}).filter(w=>w!==null))]}catch{}let a=[],m="no changes";try{let{execSync:l}=await import("node:child_process");a=l("git diff --name-only",{cwd:e,encoding:"utf-8",timeout:5e3}).trim().split(`
3
3
  `).filter(Boolean);let $=l("git diff --stat",{cwd:e,encoding:"utf-8",timeout:5e3}).trim().split(`
4
4
  `);m=$[$.length-1]??"no changes"}catch{}let h=[...new Set([...o,...a])],f=(c.iteration??0)+1,k=`${e}/${g.stateDir}/iterations`;try{await i.fs.mkdir(k,{recursive:!0}),await i.fs.writeTextFile(`${k}/iteration-${f}.json`,JSON.stringify({iteration:f,files:h,gitStat:m.trim(),timestamp:new Date().toISOString()},null,2)+`
@@ -1,3 +1,3 @@
1
- import{a as S,b as g,d as T,e as m,f,g as y}from"./chunk-G65TSD56.js";import{a as l}from"./chunk-OLM5RTFK.js";import"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var k=class{capabilities=["text_generation","streaming"];provider="kiro";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr),t=await T(s.stdout,this.modelId),d=await s.waitForExit(),i=await u,a=f("kiro",d.code,i);if(a!==null)throw a;return t}async*streamText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr);try{let t=new TextDecoder,d=s.stdout.getReader(),i="",a=await d.read();for(;a.done!==!0;){i+=t.decode(a.value,{stream:!0});let x=i.split(`
1
+ import{a as S,b as g,d as T,e as m,f,g as y}from"./chunk-AT7V3AKV.js";import{a as l}from"./chunk-OLM5RTFK.js";import"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var k=class{capabilities=["text_generation","streaming"];provider="kiro";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr),t=await T(s.stdout,this.modelId),d=await s.waitForExit(),i=await u,a=f("kiro",d.code,i);if(a!==null)throw a;return t}async*streamText(e,r){let o=v(this.config,e),c=y(e.messages,e.system);o.push("--prompt",c);let s=g(this.binary,o,{signal:r}),u=m(s.stderr);try{let t=new TextDecoder,d=s.stdout.getReader(),i="",a=await d.read();for(;a.done!==!0;){i+=t.decode(a.value,{stream:!0});let x=i.split(`
2
2
  `);i=x.pop()??"";for(let _ of x){let p=_.trim();if(p.length!==0){try{let A=JSON.parse(p),w=C(A);if(w!==null){yield w;continue}}catch{}yield{kind:"content_delta",textDelta:p+`
3
3
  `}}}a=await d.read()}d.releaseLock(),i.trim().length>0&&(yield{kind:"content_delta",textDelta:i.trim()});let E=await s.waitForExit(),b=await u,h=f("kiro",E.code,b);h!==null?yield{kind:"error",error:h}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}catch(t){t instanceof l?yield{kind:"error",error:t}:yield{kind:"error",error:new l(t instanceof Error?t.message:String(t),{provider:"kiro",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},O={provider:"kiro",async createModel(n){let e=await S("kiro",n);return new k(e,n)}},v=(n,e)=>{let r=[];r.push("--output","json"),r.push("--model",n.model),e.maxTokens!==void 0&&r.push("--max-tokens",String(e.maxTokens));let o=n.properties?.args;return o!==void 0&&r.push(...o),r},C=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content"||e.type==="text"){let r=e.text??e.content;return r!==void 0?{kind:"content_delta",textDelta:String(r)}:null}return e.type==="done"||e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new l(e.error?.message??e.message??"Unknown Kiro error",{provider:"kiro"})}:null};export{k as KiroModel,O as kiroFactory};
@@ -1 +1 @@
1
- import{a as p}from"./chunk-UWD66JGG.js";import{c as t,d as a,g as l,m as n,o,q as m,r as d}from"./chunk-52HFDP2R.js";import{a as i}from"./chunk-2N4GTHXQ.js";import"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=o({renderer:d.ansi(),sink:m.stdout()});e.writeln(t("AI Providers")),e.writeln("");let r=await p(),v=r.map(s=>[s.available?l("\u25CF"):a("\u25CB"),s.available?t(`${s.name} (${s.alias})`):a(`${s.name} (${s.alias})`),a(s.type),s.available?s.detail:a(s.detail)]);e.writeln(n(["","Provider","Type","Status"],v));let u=r.filter(s=>s.available).length;return e.writeln(a(`${u}/${r.length} providers available`)),await e.close(),i(void 0)};export{$ as main};
1
+ import{a as p}from"./chunk-RVIPYZ7F.js";import{c as t,d as a,g as l,m as n,o,q as m,r as d}from"./chunk-4IFPLK7L.js";import{a as i}from"./chunk-2N4GTHXQ.js";import"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=o({renderer:d.ansi(),sink:m.stdout()});e.writeln(t("AI Providers")),e.writeln("");let r=await p(),v=r.map(s=>[s.available?l("\u25CF"):a("\u25CB"),s.available?t(`${s.name} (${s.alias})`):a(`${s.name} (${s.alias})`),a(s.type),s.available?s.detail:a(s.detail)]);e.writeln(n(["","Provider","Type","Status"],v));let u=r.filter(s=>s.available).length;return e.writeln(a(`${u}/${r.length} providers available`)),await e.close(),i(void 0)};export{$ as main};
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{b as CommandBuilder,a as CommandError,d as exec,c as parseCommand};
1
+ import{a,b,c,d}from"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{b as CommandBuilder,a as CommandError,d as exec,c as parseCommand};
@@ -1,3 +1,3 @@
1
- import{a as _}from"./chunk-QHS53BRV.js";import{a as v}from"./chunk-6XR33H6Q.js";import{a as B,b as H,c as Q,d as z}from"./chunk-O3PI76HM.js";import{a as A}from"./chunk-SBUQXH6U.js";import{a as j,c as b,d as G,f as J,h as W}from"./chunk-OM4QJ24S.js";import{a as P}from"./chunk-LEPZPNTN.js";import{a as q,b as M,d as x}from"./chunk-G2NW625V.js";import{b as L,c as N,d as V}from"./chunk-FAK366X2.js";import"./chunk-D6Q2GR7X.js";import{a as U}from"./chunk-UXRWSNVZ.js";import{d as O,e as E,k as I,o as $,q as y,r as T}from"./chunk-MJVACJ6D.js";import{a as F,b as D}from"./chunk-2N4GTHXQ.js";import{a as h}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var Z=o=>o.split(`
1
+ import{a as _}from"./chunk-5ORUHRWF.js";import{a as v}from"./chunk-7ADGJB4H.js";import{a as B,b as H,c as Q,d as z}from"./chunk-KBNVVXFC.js";import{a as A}from"./chunk-LBOCIPVF.js";import{a as j,c as b,d as G,f as J,h as W}from"./chunk-HLQNHWXS.js";import{a as P}from"./chunk-QEEZKZXM.js";import{a as q,b as M,d as x}from"./chunk-TGA7MX5P.js";import{b as L,c as N,d as V}from"./chunk-I6ISQXVP.js";import"./chunk-6QFROYLO.js";import{a as U}from"./chunk-UXRWSNVZ.js";import{d as O,e as E,k as I,o as $,q as y,r as T}from"./chunk-OJUA2UZK.js";import{a as F,b as D}from"./chunk-2N4GTHXQ.js";import{a as h}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var Z=o=>o.split(`
2
2
  `).map(e=>e.replace(/^[-*]\s+/,"").trim()).filter(e=>e.length>0&&!e.startsWith("#")),ee=async(o,e)=>{let i=[],n=(e.startsWith(o)?e.slice(o.length+1):e).split("/");n.pop();for(let t=n.length;t>=0;t--){let r=`${t===0?o:`${o}/${n.slice(0,t).join("/")}`}/.folder-rules.md`,c=t===0?".":n.slice(0,t).join("/");try{let p=await h.fs.readTextFile(r),g=Z(p);for(let f of g)i.push({folder:c,rule:f})}catch{}}return i},k=async(o,e)=>{let i=new Set,a=[];for(let n of e){let t=await ee(o,n);for(let s of t){let r=`${s.folder}::${s.rule}`;i.has(r)||(i.add(r),a.push(s))}}return a};var ye=async o=>{let e=h.process.cwd(),i=q(o),a=M(o);if(!await T(e)){let l=await I(e);return await x({error:`noskills not initialized. Run: ${U("init",l)}`},i),D({exitCode:1})}let n=null;for(let l of a)l.startsWith("--answer=")&&(n=l.slice(9));let t=await E(e),s=await I(e);if(t.pendingClear&&(t={...t,pendingClear:!1},await y(e,t)),s===null)return await x({error:"No config found"},i),D({exitCode:1});let c=(await $(e)).filter(l=>s.concerns.includes(l.id));if(n!==null){let l=await se(e,t,s,c,n);await y(e,l);let u={...l,lastCalledAt:new Date().toISOString()};await y(e,u);let m=await P(e),d=u.spec!==null?await v(e,u.spec):null,R=await K(e,u),X=await k(e,R),Y=A(u,c,m,s,d,X);return await x(Y,i),F(void 0)}let p={...t,lastCalledAt:new Date().toISOString()};await y(e,p);let g=await P(e),f=p.spec!==null?await v(e,p.spec):null,w=await K(e,p),C=await k(e,w),S=A(p,c,g,s,f,C);return await x(S,i),F(void 0)},se=async(o,e,i,a,n)=>{switch(e.phase){case"DISCOVERY":{let t=null;try{let r=JSON.parse(n);typeof r=="object"&&r!==null&&!Array.isArray(r)&&(t=r)}catch{}let s=e;if(t!==null)for(let[r,c]of Object.entries(t))typeof c=="string"&&c.length>0&&(s=b(s,r,c));else{let r=L(a),c=N(r,s.discovery.answers);if(c===null)return e;s=b(s,c.id,n)}return V(s.discovery.answers)&&(s=G(s)),s}case"SPEC_DRAFT":{if(e.classification===null){let t;try{let r=JSON.parse(n);t={involvesUI:r.involvesUI===!0,involvesPublicAPI:r.involvesPublicAPI===!0,involvesMigration:r.involvesMigration===!0,involvesDataHandling:r.involvesDataHandling===!0}}catch{t={involvesUI:!1,involvesPublicAPI:!1,involvesMigration:!1,involvesDataHandling:!1}}let s={...e,classification:t};try{await _(o,s,a)}catch{}return s}return e}case"SPEC_APPROVED":{let t=J(e);return t.spec!==null&&(await B(o,t.spec,"executing"),await z(o,t.spec,"executing")),t}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let t={...e,execution:{...e.execution,lastProgress:n}};if(i.verifyCommand!==null&&i.verifyCommand!==void 0&&i.verifyCommand.length>0){let s=await ie(o,i.verifyCommand);if(t={...t,execution:{...t.execution,lastVerification:s}},!s.passed)return t}return t={...t,execution:{...t.execution,awaitingStatusReport:!0}},t}return await ne(o,e,n,a)}case"BLOCKED":{let t=e.execution.lastProgress??"Unknown",s={id:`d${e.decisions.length+1}`,question:t.replace(/^BLOCKED:\s*/,""),choice:n,promoted:!1,timestamp:new Date().toISOString()},r=W(e,s);return r=j(r,"EXECUTING"),r={...r,execution:{...r.execution,lastProgress:`Resolved: ${n}`}},r}default:return e}},ne=async(o,e,i,a)=>{let n;try{n=JSON.parse(i)}catch{return{...e,execution:{...e.execution,lastProgress:i,awaitingStatusReport:!1}}}let t=n.completed??[],s=n.remaining??[],r=n.blocked??[],c=[...s,...r],p=e.execution.debt?.unaddressedIterations??0,g=c.length>0?{items:c,fromIteration:e.execution.iteration,unaddressedIterations:1}:null,f=g;if(e.execution.debt!==null&&g!==null){let l=new Set(t.map(d=>d.toLowerCase().trim())),u=e.execution.debt.items.filter(d=>!l.has(d.toLowerCase().trim())),m=[...new Set([...u,...c])];f=m.length>0?{items:m,fromIteration:e.execution.debt.fromIteration,unaddressedIterations:u.length>0?p+1:1}:null}else if(e.execution.debt!==null&&g===null){let l=new Set(t.map(m=>m.toLowerCase().trim())),u=e.execution.debt.items.filter(m=>!l.has(m.toLowerCase().trim()));f=u.length>0?{items:u,fromIteration:e.execution.debt.fromIteration,unaddressedIterations:p+1}:null}let w=t.length>0?`Completed: ${t.join(", ")}`:"Status report submitted",C=e.execution.lastVerification===null||e.execution.lastVerification.passed===!0,S=f===null&&C;if(S&&e.spec!==null){let l=await v(o,e.spec);if(l!==null){let u=e.execution.completedTasks??[],m=new Set(u),d=l.tasks.find(R=>!m.has(R.id));if(d!==void 0)return await H(o,e.spec,d.id),await Q(o,e.spec,d.id,"done"),{...e,pendingClear:!0,execution:{...e.execution,lastProgress:`Task ${d.id} accepted: ${w}`,awaitingStatusReport:!1,debt:f,completedTasks:[...u,d.id]}}}}return{...e,pendingClear:S,execution:{...e.execution,lastProgress:S?w:`Task not accepted \u2014 remaining items must be addressed first. ${w}`,awaitingStatusReport:!1,debt:f}}},ie=async(o,e)=>{try{let{execSync:i}=await import("node:child_process"),a=i(e,{cwd:o,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(a).slice(0,4e3),timestamp:new Date().toISOString()}}catch(i){let a=i,n=((a.stdout??"")+(a.stderr??"")).slice(0,4e3);return a.status!==void 0?{passed:!1,output:n||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${i instanceof Error?i.message:String(i)}`,timestamp:new Date().toISOString()}}},K=async(o,e)=>{let i=[...e.execution.modifiedFiles??[]],a=await re(o);return[...new Set([...i,...a])]},re=async o=>{let e=`${o}/${O.stateDir}/files-changed.jsonl`;try{let a=(await h.fs.readTextFile(e)).trim().split(`
3
3
  `).filter(Boolean),n=[];for(let t of a)try{let s=JSON.parse(t);n.includes(s.file)||n.push(s.file)}catch{}return n}catch{return[]}};export{ye as main};
@@ -0,0 +1 @@
1
+ import{b as F}from"./chunk-T7K64JD5.js";import{b as g,d as E}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";import*as n from"node:fs/promises";import*as R from"node:fs";import*as i from"node:path";import*as v from"node:os";import*as b from"node:child_process";import a from"node:process";import{Buffer as p}from"node:buffer";import{Readable as k,Writable as O}from"node:stream";var S={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!1},x=()=>{let r=e=>({isFile:e.isFile(),isDirectory:e.isDirectory(),isSymlink:e.isSymbolicLink(),size:e.size,mtime:e.mtime,atime:e.atime,birthtime:e.birthtime}),c=(e,t)=>{throw e instanceof Error&&"code"in e&&e.code==="ENOENT"?new g(t):e};return{async readFile(e,t){try{let s=await n.readFile(e,{signal:t?.signal});return new Uint8Array(s)}catch(s){return c(s,e)}},async readTextFile(e,t){try{return await n.readFile(e,{encoding:"utf-8",signal:t?.signal})}catch(s){return c(s,e)}},async writeFile(e,t,s){let d=s?.append?"a":"w";await n.writeFile(e,t,{signal:s?.signal,mode:s?.mode,flag:d})},async writeTextFile(e,t,s){let d=s?.append?"a":"w";await n.writeFile(e,t,{encoding:"utf-8",signal:s?.signal,mode:s?.mode,flag:d})},async exists(e){try{return await n.access(e),!0}catch{return!1}},async stat(e){try{let t=await n.stat(e);return r(t)}catch(t){return c(t,e)}},async lstat(e){try{let t=await n.lstat(e);return r(t)}catch(t){return c(t,e)}},async mkdir(e,t){await n.mkdir(e,{recursive:t?.recursive??!1,mode:t?.mode})},async ensureDir(e){await n.mkdir(e,{recursive:!0})},async remove(e,t){try{await n.rm(e,{recursive:t?.recursive??!1,force:!1})}catch(s){c(s,e)}},async*readDir(e){try{let t=await n.readdir(e,{withFileTypes:!0});for(let s of t)yield{name:s.name,isFile:s.isFile(),isDirectory:s.isDirectory(),isSymlink:s.isSymbolicLink()}}catch(t){c(t,e)}},async copyFile(e,t){await n.copyFile(e,t)},async rename(e,t){await n.rename(e,t)},async makeTempDir(e){let t=e?.dir??v.tmpdir(),s=e?.prefix??"",d=e?.suffix??"",u=await n.mkdtemp(i.join(t,s));if(d){let o=u+d;return await n.rename(u,o),o}return u},async realPath(e){try{return await n.realpath(e)}catch(t){throw t instanceof Error&&"code"in t&&t.code==="ENOENT"?new g(e):t}},watch(e,t){let s=t?.recursive??!0,d=[],u=[],o=[],l=!1,P=m=>{l||(o.length>0?o.shift()({value:m,done:!1}):u.push(m))};for(let m of e)try{let f=R.watch(m,{recursive:s},(h,y)=>{y!==null&&P({kind:h==="rename"?"create":"modify",paths:[i.join(m,y)]})});d.push(f)}catch{}return{close:()=>{l=!0;for(let m of d)m.close();for(let m of o)m({value:void 0,done:!0});o=[]},[Symbol.asyncIterator]:()=>({next:()=>l?Promise.resolve({value:void 0,done:!0}):u.length>0?Promise.resolve({value:u.shift(),done:!1}):new Promise(m=>{o.push(m)})})}},async chmod(e,t){await n.chmod(e,t)},async*walk(e,t){let s=t?.includeDirs??!0,d=t?.includeFiles??!0,u=t?.exts,o=t?.skip,l=async function*(P){let m=await n.readdir(P,{withFileTypes:!0});for(let f of m){let h=i.join(P,f.name);if(o?.some(w=>w.test(h)))continue;let y=f.isSymbolicLink();if(f.isDirectory())s&&(yield{path:h,name:f.name,isFile:!1,isDirectory:!0,isSymlink:y}),yield*l(h);else if(f.isFile()||y){if(!d||u&&!u.some(w=>f.name.endsWith(w.startsWith(".")?w:`.${w}`)))continue;yield{path:h,name:f.name,isFile:f.isFile(),isDirectory:!1,isSymlink:y}}}};yield*l(e)}}},W=()=>({join:i.join,resolve:i.resolve,dirname:i.dirname,basename:i.basename,extname:i.extname,normalize:i.normalize,isAbsolute:i.isAbsolute,relative:i.relative,parse:i.parse,format:i.format,sep:i.sep,delimiter:i.delimiter}),T=()=>({spawn(r,c=[],e){return new Promise((t,s)=>{let d=b.spawn(r,c,{cwd:e?.cwd,env:e?.env?{...a.env,...e.env}:void 0,stdio:F(e),signal:e?.signal}),u=[],o=[];d.stdout?.on("data",l=>u.push(l)),d.stderr?.on("data",l=>o.push(l)),d.on("error",s),d.on("close",l=>{t({success:l===0,code:l??1,stdout:new Uint8Array(p.concat(u)),stderr:new Uint8Array(p.concat(o))})})})},async exec(r,c=[],e){let t=await this.spawn(r,c,e);if(!t.success){let s=new TextDecoder().decode(t.stderr);throw new E(r,t.code,s)}return new TextDecoder().decode(t.stdout).trim()},async execJson(r,c=[],e){let t=await this.exec(r,c,e);return JSON.parse(t)},spawnChild(r,c=[],e){let t=b.spawn(r,c,{cwd:e?.cwd,env:e?.env?{...a.env,...e.env}:void 0,stdio:F(e),signal:e?.signal}),s=[],d=[];t.stdout?.on("data",o=>s.push(o)),t.stderr?.on("data",o=>d.push(o));let u=new Promise((o,l)=>{t.on("error",l),t.on("close",(P,m)=>{o({success:P===0,code:P??1,signal:m??void 0})})});return{pid:t.pid,stdin:t.stdin?O.toWeb(t.stdin):null,stdout:t.stdout?k.toWeb(t.stdout):null,stderr:t.stderr?k.toWeb(t.stderr):null,status:u,output:async()=>{let o=await u;return{success:o.success,code:o.code,stdout:new Uint8Array(p.concat(s)),stderr:new Uint8Array(p.concat(d))}},kill:o=>{t.kill(o)}}}}),A=()=>({get(r){return a.env[r]},set(r,c){a.env[r]=c},delete(r){delete a.env[r]},has(r){return r in a.env},toObject(){let r={};for(let[c,e]of Object.entries(a.env))e!==void 0&&(r[c]=e);return r}}),D=()=>({exit(r){a.exit(r)},setExitCode(r){a.exitCode=r},cwd(){return a.cwd()},chdir(r){a.chdir(r)},hostname(){return v.hostname()},execPath(){return a.execPath},args:a.argv.slice(2),pid:a.pid,stdin:k.toWeb(a.stdin),stdout:O.toWeb(a.stdout),stderr:O.toWeb(a.stderr),isTerminal(r){switch(r){case"stdin":return a.stdin.isTTY===!0;case"stdout":return a.stdout.isTTY===!0;case"stderr":return a.stderr.isTTY===!0}},setStdinRaw(r){a.stdin.setRawMode(r)}}),j=()=>{let r=x(),c=W(),e=T(),t=A(),s=D();return{name:"node",version:a.versions.node,capabilities:S,fs:r,path:c,exec:e,env:t,process:s}};export{S as NODE_CAPABILITIES,j as createNodeRuntime};
@@ -1,3 +1,3 @@
1
- import{c as u}from"./chunk-G65TSD56.js";import{a as i,e as m}from"./chunk-OLM5RTFK.js";import"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var p="http://localhost:11434",d=class{capabilities=["text_generation","streaming","vision"];provider="ollama";modelId;baseUrl;config;constructor(e,o){this.baseUrl=e,this.config=o,this.modelId=o.model}async generateText(e,o){let s=g(this.config,e,!1);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok)throw await f(t);let r=await t.json();return h(r,this.modelId)}catch(t){throw t instanceof i?t:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}async*streamText(e,o){let s=g(this.config,e,!0);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok){yield{kind:"error",error:await f(t)};return}if(t.body===null){yield{kind:"error",error:new i("No response body",{provider:"ollama"})};return}for await(let r of u(t.body)){let l=k(r);l!==null&&(yield l)}}catch(t){t instanceof i?yield{kind:"error",error:t}:yield{kind:"error",error:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},v={provider:"ollama",createModel(n){let e=n.properties?.baseUrl??p;return Promise.resolve(new d(e,n))}},g=(n,e,o)=>{let s=y(e.messages,e.system),t={model:n.model,messages:s,stream:o},r={};return e.temperature!==void 0&&(r.temperature=e.temperature),e.maxTokens!==void 0&&(r.num_predict=e.maxTokens),e.topP!==void 0&&(r.top_p=e.topP),e.stopWords!==void 0&&(r.stop=e.stopWords),Object.keys(r).length>0&&(t.options=r),e.responseFormat!==void 0&&(e.responseFormat.type==="json_schema"?t.format=e.responseFormat.jsonSchema:e.responseFormat.type==="json_object"&&(t.format="json")),t},y=(n,e)=>{let o=[];e!==void 0&&o.push({role:"system",content:e});for(let s of n){if(s.role==="system"){let a=[];for(let c of s.content)c.kind==="text"&&a.push(c.text);o.push({role:"system",content:a.join(`
1
+ import{c as u}from"./chunk-AT7V3AKV.js";import{a as i,e as m}from"./chunk-OLM5RTFK.js";import"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var p="http://localhost:11434",d=class{capabilities=["text_generation","streaming","vision"];provider="ollama";modelId;baseUrl;config;constructor(e,o){this.baseUrl=e,this.config=o,this.modelId=o.model}async generateText(e,o){let s=g(this.config,e,!1);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok)throw await f(t);let r=await t.json();return h(r,this.modelId)}catch(t){throw t instanceof i?t:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}async*streamText(e,o){let s=g(this.config,e,!0);try{let t=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:o});if(!t.ok){yield{kind:"error",error:await f(t)};return}if(t.body===null){yield{kind:"error",error:new i("No response body",{provider:"ollama"})};return}for await(let r of u(t.body)){let l=k(r);l!==null&&(yield l)}}catch(t){t instanceof i?yield{kind:"error",error:t}:yield{kind:"error",error:new i(t instanceof Error?t.message:String(t),{provider:"ollama",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},v={provider:"ollama",createModel(n){let e=n.properties?.baseUrl??p;return Promise.resolve(new d(e,n))}},g=(n,e,o)=>{let s=y(e.messages,e.system),t={model:n.model,messages:s,stream:o},r={};return e.temperature!==void 0&&(r.temperature=e.temperature),e.maxTokens!==void 0&&(r.num_predict=e.maxTokens),e.topP!==void 0&&(r.top_p=e.topP),e.stopWords!==void 0&&(r.stop=e.stopWords),Object.keys(r).length>0&&(t.options=r),e.responseFormat!==void 0&&(e.responseFormat.type==="json_schema"?t.format=e.responseFormat.jsonSchema:e.responseFormat.type==="json_object"&&(t.format="json")),t},y=(n,e)=>{let o=[];e!==void 0&&o.push({role:"system",content:e});for(let s of n){if(s.role==="system"){let a=[];for(let c of s.content)c.kind==="text"&&a.push(c.text);o.push({role:"system",content:a.join(`
2
2
  `)});continue}let t=[],r=[];for(let a of s.content)a.kind==="text"?t.push(a.text):a.kind==="image"&&a.image.url!==void 0&&r.push(a.image.url);let l={role:s.role==="tool"?"user":s.role,content:t.join(`
3
3
  `)};r.length>0&&(l.images=r),o.push(l)}return o},h=(n,e)=>{let o=[];return n.message?.content!==void 0&&o.push({kind:"text",text:n.message.content}),{content:o,stopReason:n.done_reason==="length"?"max_tokens":"end_turn",usage:{inputTokens:n.prompt_eval_count??0,outputTokens:n.eval_count??0,totalTokens:(n.prompt_eval_count??0)+(n.eval_count??0)},modelId:e,rawResponse:n}},k=n=>{if(n===null||typeof n!="object")return null;let e=n;return e.done===!0?{kind:"message_done",stopReason:e.done_reason==="length"?"max_tokens":"end_turn",usage:{inputTokens:e.prompt_eval_count??0,outputTokens:e.eval_count??0,totalTokens:(e.prompt_eval_count??0)+(e.eval_count??0)}}:e.message?.content!==void 0&&e.message.content.length>0?{kind:"content_delta",textDelta:e.message.content}:e.response!==void 0&&e.response.length>0?{kind:"content_delta",textDelta:e.response}:null},f=async n=>{let e;try{e=(await n.json()).error??`Ollama HTTP ${n.status}`}catch{e=`Ollama HTTP ${n.status}: ${n.statusText}`}return m("ollama",n.status,new Error(e))};export{d as OllamaModel,v as ollamaFactory};
@@ -1 +1 @@
1
- import{a as h,b as u,c as S,d as k,e as g,f as m,g as f}from"./chunk-G65TSD56.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-SOMEQCOS.js";import"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming"];provider="opencode";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=w(this.config,e,"json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr),t=await k(s.stdout,this.modelId),p=await s.waitForExit(),a=await l,d=m("opencode",p.code,a);if(d!==null)throw d;return t}async*streamText(e,r){let o=w(this.config,e,"stream-json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr);try{for await(let d of S(s.stdout)){let x=v(d);x!==null&&(yield x)}let t=await s.waitForExit(),p=await l,a=m("opencode",t.code,p);a!==null&&(yield{kind:"error",error:a})}catch(t){t instanceof c?yield{kind:"error",error:t}:yield{kind:"error",error:new c(t instanceof Error?t.message:String(t),{provider:"opencode",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},b={provider:"opencode",async createModel(n){let e=await h("opencode",n);return new y(e,n)}},w=(n,e,r)=>{let o=["--output-format",r];o.push("--model",n.model),e.maxTokens!==void 0&&o.push("--max-tokens",String(e.maxTokens));let i=n.properties?.args;return i!==void 0&&o.push(...i),o},v=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content_block_delta"||e.type==="assistant"){let r=e.delta?.text??e.message?.content?.[0]?.text;return r!==void 0?{kind:"content_delta",textDelta:r}:null}return e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown OpenCode error",{provider:"opencode"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as OpenCodeModel,b as openCodeFactory};
1
+ import{a as h,b as u,c as S,d as k,e as g,f as m,g as f}from"./chunk-AT7V3AKV.js";import{a as c}from"./chunk-OLM5RTFK.js";import"./chunk-6C2MLMD6.js";import"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var y=class{capabilities=["text_generation","streaming"];provider="opencode";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let o=w(this.config,e,"json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr),t=await k(s.stdout,this.modelId),p=await s.waitForExit(),a=await l,d=m("opencode",p.code,a);if(d!==null)throw d;return t}async*streamText(e,r){let o=w(this.config,e,"stream-json"),i=f(e.messages,e.system);o.push("-p",i);let s=u(this.binary,o,{signal:r}),l=g(s.stderr);try{for await(let d of S(s.stdout)){let x=v(d);x!==null&&(yield x)}let t=await s.waitForExit(),p=await l,a=m("opencode",t.code,p);a!==null&&(yield{kind:"error",error:a})}catch(t){t instanceof c?yield{kind:"error",error:t}:yield{kind:"error",error:new c(t instanceof Error?t.message:String(t),{provider:"opencode",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},b={provider:"opencode",async createModel(n){let e=await h("opencode",n);return new y(e,n)}},w=(n,e,r)=>{let o=["--output-format",r];o.push("--model",n.model),e.maxTokens!==void 0&&o.push("--max-tokens",String(e.maxTokens));let i=n.properties?.args;return i!==void 0&&o.push(...i),o},v=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content_block_delta"||e.type==="assistant"){let r=e.delta?.text??e.message?.content?.[0]?.text;return r!==void 0?{kind:"content_delta",textDelta:r}:null}return e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new c(e.error?.message??"Unknown OpenCode error",{provider:"opencode"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as OpenCodeModel,b as openCodeFactory};
@@ -1,4 +1,4 @@
1
- import{a as v,b as k}from"./chunk-XHFYREAD.js";import{a as p,b as w,c as h,h as r}from"./chunk-C2SQE5AG.js";import{c as $,d as c}from"./chunk-MJVACJ6D.js";import"./chunk-52HFDP2R.js";import{a as d,b as g}from"./chunk-2N4GTHXQ.js";import{a as n}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{e as y}from"./chunk-DXB73IDG.js";var x=y($(),1);var M=async i=>{let e=n.process.cwd(),s=v(i),t=w({target:s==="agent"?"non-interactive":"interactive"});if(!k(i).includes("--force")){if(s==="agent")return r.error(t,"Purge requires `--force` flag in agent mode."),g({exitCode:1});let l=await h(t,{message:"This will remove all noskills specs, rules, concerns, and hooks. Continue?"});if(p(l)||l!==!0)return r.info(t,"Aborted."),d(void 0)}return r.step(t,"Purging noskills content..."),await u(`${e}/${c.concernsDir}`,t,"`.eser/concerns/`"),await u(`${e}/${c.specsDir}`,t,"`.eser/specs/`"),await u(`${e}/${c.rulesDir}`,t,"`.eser/rules/`"),await u(`${e}/${c.stateDir}`,t,"`.eser/.state/`"),await C(e,t),await T(e,t),await m(`${e}/.cursorrules`,t,"`.cursorrules`"),await m(`${e}/.windsurfrules`,t,"`.windsurfrules`"),await m(`${e}/.kiro/steering/conventions.md`,t,"`.kiro/steering/conventions.md`"),await m(`${e}/.github/copilot-instructions.md`,t,"`.github/copilot-instructions.md`"),await F(e,t),r.success(t,"Purge complete."),d(void 0)},u=async(i,e,s)=>{try{await n.fs.stat(i);let{rmSync:t}=await import("node:fs");t(i,{recursive:!0,force:!0}),r.step(e,` Removed ${s}`)}catch{}},m=async(i,e,s)=>{try{await n.fs.stat(i);let{unlinkSync:t}=await import("node:fs");t(i),r.step(e,` Removed ${s}`)}catch{}},C=async(i,e)=>{let s=`${i}/${c.manifestFile}`;try{let t=await n.fs.readTextFile(s),o=x.parseDocument(t);o.has("noskills")&&(o.delete("noskills"),await n.fs.writeTextFile(s,o.toString()),r.step(e," Removed noskills section from `manifest.yml`"))}catch{}},T=async(i,e)=>{let s=`${i}/CLAUDE.md`,t="<!-- noskills:start -->",o="<!-- noskills:end -->";try{let a=await n.fs.readTextFile(s),l=a.indexOf(t),f=a.indexOf(o);l!==-1&&f!==-1&&(a=a.slice(0,l).trimEnd()+`
1
+ import{a as v,b as k}from"./chunk-M2ZPJN26.js";import{a as p,b as w,c as h,h as r}from"./chunk-AB4ZUDV6.js";import{c as $,d as c}from"./chunk-OJUA2UZK.js";import"./chunk-4IFPLK7L.js";import{a as d,b as g}from"./chunk-2N4GTHXQ.js";import{a as n}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{e as y}from"./chunk-DXB73IDG.js";var x=y($(),1);var M=async i=>{let e=n.process.cwd(),s=v(i),t=w({target:s==="agent"?"non-interactive":"interactive"});if(!k(i).includes("--force")){if(s==="agent")return r.error(t,"Purge requires `--force` flag in agent mode."),g({exitCode:1});let l=await h(t,{message:"This will remove all noskills specs, rules, concerns, and hooks. Continue?"});if(p(l)||l!==!0)return r.info(t,"Aborted."),d(void 0)}return r.step(t,"Purging noskills content..."),await u(`${e}/${c.concernsDir}`,t,"`.eser/concerns/`"),await u(`${e}/${c.specsDir}`,t,"`.eser/specs/`"),await u(`${e}/${c.rulesDir}`,t,"`.eser/rules/`"),await u(`${e}/${c.stateDir}`,t,"`.eser/.state/`"),await C(e,t),await T(e,t),await m(`${e}/.cursorrules`,t,"`.cursorrules`"),await m(`${e}/.windsurfrules`,t,"`.windsurfrules`"),await m(`${e}/.kiro/steering/conventions.md`,t,"`.kiro/steering/conventions.md`"),await m(`${e}/.github/copilot-instructions.md`,t,"`.github/copilot-instructions.md`"),await F(e,t),r.success(t,"Purge complete."),d(void 0)},u=async(i,e,s)=>{try{await n.fs.stat(i);let{rmSync:t}=await import("node:fs");t(i,{recursive:!0,force:!0}),r.step(e,` Removed ${s}`)}catch{}},m=async(i,e,s)=>{try{await n.fs.stat(i);let{unlinkSync:t}=await import("node:fs");t(i),r.step(e,` Removed ${s}`)}catch{}},C=async(i,e)=>{let s=`${i}/${c.manifestFile}`;try{let t=await n.fs.readTextFile(s),o=x.parseDocument(t);o.has("noskills")&&(o.delete("noskills"),await n.fs.writeTextFile(s,o.toString()),r.step(e," Removed noskills section from `manifest.yml`"))}catch{}},T=async(i,e)=>{let s=`${i}/CLAUDE.md`,t="<!-- noskills:start -->",o="<!-- noskills:end -->";try{let a=await n.fs.readTextFile(s),l=a.indexOf(t),f=a.indexOf(o);l!==-1&&f!==-1&&(a=a.slice(0,l).trimEnd()+`
2
2
  `+a.slice(f+o.length).trimStart(),await n.fs.writeTextFile(s,a.trimEnd()+`
3
3
  `),r.step(e," Removed noskills section from `CLAUDE.md`"))}catch{}},F=async(i,e)=>{let s=`${i}/.claude/settings.json`;try{let t=await n.fs.readTextFile(s),o=JSON.parse(t);o.hooks!==void 0&&(delete o.hooks,await n.fs.writeTextFile(s,JSON.stringify(o,null,2)+`
4
4
  `),r.step(e," Removed hooks from `.claude/settings.json`"))}catch{}};export{M as main};
@@ -1 +1 @@
1
- import{i as u}from"./chunk-OM4QJ24S.js";import{e as c,f as d}from"./chunk-MJVACJ6D.js";import{d as a,g as o,o as m,q as p,r as l}from"./chunk-52HFDP2R.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{a as n}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var N=async w=>{let e=m({renderer:l.ansi(),sink:p.stdout()}),i=n.process.cwd(),s=await c(i);if(s.phase==="IDLE"||s.phase==="UNINITIALIZED")return e.writeln(a("Already idle. Nothing to reset.")),await e.close(),r(void 0);let t=s.spec,f=u(s);return await d(i,f),e.writeln(o("\u2714")," Reset to IDLE."),t!==null&&e.writeln(a(`Spec "${t}" state cleared. Files in .eser/specs/${t}/ preserved.`)),await e.close(),r(void 0)};export{N as main};
1
+ import{i as u}from"./chunk-HLQNHWXS.js";import{e as c,f as d}from"./chunk-OJUA2UZK.js";import{d as a,g as o,o as m,q as p,r as l}from"./chunk-4IFPLK7L.js";import{a as r}from"./chunk-2N4GTHXQ.js";import{a as n}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var N=async w=>{let e=m({renderer:l.ansi(),sink:p.stdout()}),i=n.process.cwd(),s=await c(i);if(s.phase==="IDLE"||s.phase==="UNINITIALIZED")return e.writeln(a("Already idle. Nothing to reset.")),await e.close(),r(void 0);let t=s.spec,f=u(s);return await d(i,f),e.writeln(o("\u2714")," Reset to IDLE."),t!==null&&e.writeln(a(`Spec "${t}" state cleared. Files in .eser/specs/${t}/ preserved.`)),await e.close(),r(void 0)};export{N as main};
@@ -1,2 +1,2 @@
1
- import{a as y,b as k}from"./chunk-LEPZPNTN.js";import{a as g,b as x}from"./chunk-UXRWSNVZ.js";import{d as w,k as c}from"./chunk-MJVACJ6D.js";import{c as p,d as o,f,g as h,o as a,q as l,r as d}from"./chunk-52HFDP2R.js";import{a as u,b as m}from"./chunk-2N4GTHXQ.js";import{a as i}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var L=async s=>{let e=s?.[0];if(e==="add")return await $(s?.slice(1));if(e==="list")return await v();if(e==="promote")return await C(s?.slice(1));let t=await c(i.process.cwd()),n=x(t),r=a({renderer:d.ansi(),sink:l.stdout()});return r.writeln(`Usage: ${n} rule <add "rule text" | list | promote "decision">`),await r.close(),u(void 0)},$=async s=>{let e=a({renderer:d.ansi(),sink:l.stdout()}),t=i.process.cwd(),n=s?.join(" "),r=await c(t);if(n===void 0||n.length===0)return e.writeln(f("Please provide a rule: "),p(`${g('rule add "Use Deno Tests for all tests"',r)}`)),await e.close(),m({exitCode:1});let P=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),A=`${t}/${w.rulesDir}/${P}.md`;return await i.fs.mkdir(`${t}/${w.rulesDir}`,{recursive:!0}),await i.fs.writeTextFile(A,n+`
1
+ import{a as y,b as k}from"./chunk-QEEZKZXM.js";import{a as g,b as x}from"./chunk-UXRWSNVZ.js";import{d as w,k as c}from"./chunk-OJUA2UZK.js";import{c as p,d as o,f,g as h,o as a,q as l,r as d}from"./chunk-4IFPLK7L.js";import{a as u,b as m}from"./chunk-2N4GTHXQ.js";import{a as i}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var L=async s=>{let e=s?.[0];if(e==="add")return await $(s?.slice(1));if(e==="list")return await v();if(e==="promote")return await C(s?.slice(1));let t=await c(i.process.cwd()),n=x(t),r=a({renderer:d.ansi(),sink:l.stdout()});return r.writeln(`Usage: ${n} rule <add "rule text" | list | promote "decision">`),await r.close(),u(void 0)},$=async s=>{let e=a({renderer:d.ansi(),sink:l.stdout()}),t=i.process.cwd(),n=s?.join(" "),r=await c(t);if(n===void 0||n.length===0)return e.writeln(f("Please provide a rule: "),p(`${g('rule add "Use Deno Tests for all tests"',r)}`)),await e.close(),m({exitCode:1});let P=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),A=`${t}/${w.rulesDir}/${P}.md`;return await i.fs.mkdir(`${t}/${w.rulesDir}`,{recursive:!0}),await i.fs.writeTextFile(A,n+`
2
2
  `),e.writeln(h("\u2714")," Rule added: ",o(n)),r!==null&&r.tools.length>0&&(await k(t,r.tools,r),e.writeln(o(" Tool files synced."))),await e.close(),u(void 0)},v=async()=>{let s=a({renderer:d.ansi(),sink:l.stdout()}),e=i.process.cwd(),t=await y(e);s.writeln(p("Rules")),s.writeln("");let n=await c(e);if(t.length===0)s.writeln(o(` No rules yet. Add one with: ${g('rule add "..."',n)}`));else for(let r of t)s.writeln(" ",o("\u2022"),` ${r}`);return await s.close(),u(void 0)},C=async s=>{let e=a({renderer:d.ansi(),sink:l.stdout()}),t=s?.join(" ");return t===void 0||t.length===0?(e.writeln(f("Please provide the decision text to promote.")),await e.close(),m({exitCode:1})):(await e.close(),await $(s))};export{L as main};
@@ -1,3 +1,3 @@
1
- import{a as L}from"./chunk-SBUQXH6U.js";import{a as V,f as B}from"./chunk-OM4QJ24S.js";import{a as D,b as A,d as N}from"./chunk-C2SQE5AG.js";import{a as G}from"./chunk-LEPZPNTN.js";import"./chunk-FAK366X2.js";import"./chunk-D6Q2GR7X.js";import{a as M,b as C}from"./chunk-UXRWSNVZ.js";import{e as x,f as g,k as $,o as F,r as U}from"./chunk-MJVACJ6D.js";import{c as P,d as r,f as u,g as v,h,k as I,o as R,q as O,r as T}from"./chunk-52HFDP2R.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{a as y}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ae=async n=>{let t=R({renderer:T.ansi(),sink:O.stdout()}),e=y.process.cwd(),a=n?.includes("--unattended")??!1,s=W(n,"--max-turns")??10,o=W(n,"--max-iterations")??50;if(!await U(e)){let i=await $(e);return t.writeln(u(`noskills not initialized. Run: ${M("init",i)}`)),await t.close(),w({exitCode:1})}let p=await x(e);if(p.phase!=="EXECUTING"&&p.phase!=="SPEC_APPROVED")return t.writeln(u(`Cannot run from phase: ${p.phase}`)),t.writeln(r("Must be in SPEC_APPROVED or EXECUTING to start.")),await t.close(),w({exitCode:1});if(p.phase==="SPEC_APPROVED"){t.writeln(r("Starting execution from approved spec..."));let i=B(p);await g(e,i)}let c=await $(e);if(c===null)return t.writeln(u("Config not found.")),await t.close(),w({exitCode:1});t.writeln(P(`${C(c)} run`)),t.writeln(r(`Mode: ${a?"unattended":"interactive"}, max-turns: ${s}, max-iterations: ${o}`)),t.writeln("");let m=0,d=0;for(;m<o;){m++;let i=await x(e);if(i.phase==="DONE"){t.writeln(""),t.writeln(v("\u2714")," Spec completed!"),t.writeln(` Iterations: ${i.execution.iteration}`),t.writeln(` Decisions: ${i.decisions.length}`);break}if(i.phase==="BLOCKED"){let l=i.execution.lastProgress??"Unknown";if(t.writeln(""),t.writeln(h("\u26A0")," Execution blocked: ",r(l)),a){await H(e,l,m),t.writeln(r("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=1;break}let E=A(),f=await N(E,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){t.writeln(r("Stopped by user."));break}let k=V(i,"EXECUTING");await g(e,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(i.phase!=="EXECUTING"){t.writeln(u(`Unexpected phase: ${i.phase}. Stopping.`)),d=1;break}i.pendingClear&&await g(e,{...i,pendingClear:!1});let X=(await F(e)).filter(l=>c.concerns.includes(l.id)),_=await G(e),j=L(i,X,_,c),z=q(j,c);t.writeln(I(`\u2500\u2500 Iteration ${m}`),r(` (execution: ${i.execution.iteration}, debt: ${i.execution.debt?.items.length??0})`)),i.execution.lastProgress!==null&&t.writeln(r(` Last: ${i.execution.lastProgress}`)),i.execution.lastVerification?.passed===!1&&t.writeln(u(" Verification failed \u2014 agent will fix")),i.execution.debt!==null&&t.writeln(h(` Debt: ${i.execution.debt.items.length} items`)),t.writeln(r(" Spawning agent..."));try{await(await import("./mod-RWDPEKPY.js")).exec`claude -p ${z} --max-turns ${String(s)} --output-format json`.noThrow().text()}catch{t.writeln(u(" Failed to spawn claude CLI. Is it installed?")),d=1;break}t.writeln(r(" Agent exited. Stop hook captured state."));let b=await x(e);if(c.autoCommit===!0&&c.allowGit!==!1)try{let l=await import("./mod-RWDPEKPY.js");if((await l.exec`git diff --name-only`.noThrow().text()).trim().length>0){await l.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${b.execution.iteration} \u2014 ${b.execution.lastProgress??"progress"}`;await l.exec`git commit -m ${f}`.noThrow().text(),t.writeln(r(" Auto-committed."))}}catch{t.writeln(r(" Auto-commit failed (non-fatal)."))}}return m>=o&&(t.writeln(""),t.writeln(h("\u26A0"),` Max iterations (${o}) reached. Stopping.`),d=2),await t.close(),d!==0?w({exitCode:d}):S(void 0)},q=(n,t)=>{let e=[];if(e.push(n.meta.resumeHint),e.push(""),n.meta.spec!==null&&(e.push(`Working on spec: ${n.meta.spec}`),e.push("")),"instruction"in n&&(e.push(n.instruction),e.push("")),"previousIterationDebt"in n){let s=n.previousIterationDebt;if(s!==void 0){e.push(`DEBT from iteration ${s.fromIteration} (address first):`);for(let o of s.items)e.push(`- ${o}`);e.push("")}}if("statusReportRequired"in n){let s=n.statusReport;if(s!==void 0){e.push("Report against these acceptance criteria:");for(let o of s.criteria)e.push(`- ${o}`);e.push("")}}if("verificationFailed"in n&&n.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in n?n.verificationOutput:"")??""),e.push("")),n.behavioral.rules.length>0){e.push("Rules:");for(let s of n.behavioral.rules)e.push(`- ${s}`);e.push("")}if("context"in n){let s=n.context;if(s.concernReminders.length>0){e.push("Reminders:");for(let o of s.concernReminders)e.push(`- ${o}`);e.push("")}}let a=C(t);return e.push(`When done, report progress: ${a} next --answer="your progress"`),e.push(`If blocked, run: ${a} block "reason"`),e.push(`When all tasks are complete: ${a} done`),e.join(`
1
+ import{a as L}from"./chunk-LBOCIPVF.js";import{a as V,f as B}from"./chunk-HLQNHWXS.js";import{a as D,b as A,d as N}from"./chunk-AB4ZUDV6.js";import{a as G}from"./chunk-QEEZKZXM.js";import"./chunk-I6ISQXVP.js";import"./chunk-6QFROYLO.js";import{a as M,b as C}from"./chunk-UXRWSNVZ.js";import{e as x,f as g,k as $,o as F,r as U}from"./chunk-OJUA2UZK.js";import{c as P,d as r,f as u,g as v,h,k as I,o as R,q as O,r as T}from"./chunk-4IFPLK7L.js";import{a as S,b as w}from"./chunk-2N4GTHXQ.js";import{a as y}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ae=async n=>{let t=R({renderer:T.ansi(),sink:O.stdout()}),e=y.process.cwd(),a=n?.includes("--unattended")??!1,s=W(n,"--max-turns")??10,o=W(n,"--max-iterations")??50;if(!await U(e)){let i=await $(e);return t.writeln(u(`noskills not initialized. Run: ${M("init",i)}`)),await t.close(),w({exitCode:1})}let p=await x(e);if(p.phase!=="EXECUTING"&&p.phase!=="SPEC_APPROVED")return t.writeln(u(`Cannot run from phase: ${p.phase}`)),t.writeln(r("Must be in SPEC_APPROVED or EXECUTING to start.")),await t.close(),w({exitCode:1});if(p.phase==="SPEC_APPROVED"){t.writeln(r("Starting execution from approved spec..."));let i=B(p);await g(e,i)}let c=await $(e);if(c===null)return t.writeln(u("Config not found.")),await t.close(),w({exitCode:1});t.writeln(P(`${C(c)} run`)),t.writeln(r(`Mode: ${a?"unattended":"interactive"}, max-turns: ${s}, max-iterations: ${o}`)),t.writeln("");let m=0,d=0;for(;m<o;){m++;let i=await x(e);if(i.phase==="DONE"){t.writeln(""),t.writeln(v("\u2714")," Spec completed!"),t.writeln(` Iterations: ${i.execution.iteration}`),t.writeln(` Decisions: ${i.decisions.length}`);break}if(i.phase==="BLOCKED"){let l=i.execution.lastProgress??"Unknown";if(t.writeln(""),t.writeln(h("\u26A0")," Execution blocked: ",r(l)),a){await H(e,l,m),t.writeln(r("Logged to .eser/.state/blocked.log. Resolve and re-run.")),d=1;break}let E=A(),f=await N(E,{message:"Enter resolution (or leave empty to stop):"});if(D(f)||f===""){t.writeln(r("Stopped by user."));break}let k=V(i,"EXECUTING");await g(e,{...k,execution:{...k.execution,lastProgress:`Resolved: ${f}`}});continue}if(i.phase!=="EXECUTING"){t.writeln(u(`Unexpected phase: ${i.phase}. Stopping.`)),d=1;break}i.pendingClear&&await g(e,{...i,pendingClear:!1});let X=(await F(e)).filter(l=>c.concerns.includes(l.id)),_=await G(e),j=L(i,X,_,c),z=q(j,c);t.writeln(I(`\u2500\u2500 Iteration ${m}`),r(` (execution: ${i.execution.iteration}, debt: ${i.execution.debt?.items.length??0})`)),i.execution.lastProgress!==null&&t.writeln(r(` Last: ${i.execution.lastProgress}`)),i.execution.lastVerification?.passed===!1&&t.writeln(u(" Verification failed \u2014 agent will fix")),i.execution.debt!==null&&t.writeln(h(` Debt: ${i.execution.debt.items.length} items`)),t.writeln(r(" Spawning agent..."));try{await(await import("./mod-LUIKS5KC.js")).exec`claude -p ${z} --max-turns ${String(s)} --output-format json`.noThrow().text()}catch{t.writeln(u(" Failed to spawn claude CLI. Is it installed?")),d=1;break}t.writeln(r(" Agent exited. Stop hook captured state."));let b=await x(e);if(c.autoCommit===!0&&c.allowGit!==!1)try{let l=await import("./mod-LUIKS5KC.js");if((await l.exec`git diff --name-only`.noThrow().text()).trim().length>0){await l.exec`git add -A`.noThrow().text();let f=`noskills: iteration ${b.execution.iteration} \u2014 ${b.execution.lastProgress??"progress"}`;await l.exec`git commit -m ${f}`.noThrow().text(),t.writeln(r(" Auto-committed."))}}catch{t.writeln(r(" Auto-commit failed (non-fatal)."))}}return m>=o&&(t.writeln(""),t.writeln(h("\u26A0"),` Max iterations (${o}) reached. Stopping.`),d=2),await t.close(),d!==0?w({exitCode:d}):S(void 0)},q=(n,t)=>{let e=[];if(e.push(n.meta.resumeHint),e.push(""),n.meta.spec!==null&&(e.push(`Working on spec: ${n.meta.spec}`),e.push("")),"instruction"in n&&(e.push(n.instruction),e.push("")),"previousIterationDebt"in n){let s=n.previousIterationDebt;if(s!==void 0){e.push(`DEBT from iteration ${s.fromIteration} (address first):`);for(let o of s.items)e.push(`- ${o}`);e.push("")}}if("statusReportRequired"in n){let s=n.statusReport;if(s!==void 0){e.push("Report against these acceptance criteria:");for(let o of s.criteria)e.push(`- ${o}`);e.push("")}}if("verificationFailed"in n&&n.verificationFailed===!0&&(e.push("Test output:"),e.push(("verificationOutput"in n?n.verificationOutput:"")??""),e.push("")),n.behavioral.rules.length>0){e.push("Rules:");for(let s of n.behavioral.rules)e.push(`- ${s}`);e.push("")}if("context"in n){let s=n.context;if(s.concernReminders.length>0){e.push("Reminders:");for(let o of s.concernReminders)e.push(`- ${o}`);e.push("")}}let a=C(t);return e.push(`When done, report progress: ${a} next --answer="your progress"`),e.push(`If blocked, run: ${a} block "reason"`),e.push(`When all tasks are complete: ${a} done`),e.join(`
2
2
  `)},W=(n,t)=>{if(n===void 0)return null;let e=`${t}=`;for(let a of n)if(a.startsWith(e)){let s=parseInt(a.slice(e.length),10);if(!isNaN(s)&&s>0)return s}return null},H=async(n,t,e)=>{let a=`${n}/.eser/.state/blocked.log`,s=`[${new Date().toISOString()}] iteration=${e} reason=${t}
3
3
  `;try{let{appendFileSync:o,mkdirSync:p}=await import("node:fs"),{dirname:c}=await import("node:path");p(c(a),{recursive:!0}),o(a,s)}catch{}};export{ae as main};
@@ -1 +1 @@
1
- import{b as j,i as F}from"./chunk-OM4QJ24S.js";import{a as T,d as U}from"./chunk-G2NW625V.js";import{a as x,b as C}from"./chunk-UXRWSNVZ.js";import{d as S,e as P,f as I,g as A,h as L,i as R,j as O,k,r as z}from"./chunk-MJVACJ6D.js";import{c as d,d as c,f as w,g as $,h as E,k as N,o as y,q as D,r as v}from"./chunk-52HFDP2R.js";import{a as h,b as g}from"./chunk-2N4GTHXQ.js";import{a as l}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ee=async i=>{let e=i?.[0];if(e==="new")return await M(i?.slice(1));if(e==="list")return await B(i?.slice(1));if(e==="switch")return await q(i?.slice(1));let t=await k(l.process.cwd()),n=C(t),r=y({renderer:v.ansi(),sink:D.stdout()});return r.writeln(`Usage: ${n} spec <new "description" | list | switch <name>>`),await r.close(),h(void 0)},M=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=await k(t);if(!await z(t))return e.writeln(w("noskills is not initialized.")," Run: ",d(x("init",n))),await e.close(),g({exitCode:1});let r=null,p=[];if(i!==void 0)for(let f of i)f.startsWith("--name=")?r=f.slice(7):f.startsWith("-")||p.push(f);let m=p.join(" ");if(m.length===0)return e.writeln(w("Please provide a description: "),d(`${C(n)} spec new "photo auto-listing"`)),await e.close(),g({exitCode:1});let a=r??W(m),o=await X(t,a),s=`spec/${o}`,u=await P(t);if(u.phase!=="IDLE"&&u.phase!=="DONE")return e.writeln(w(`Cannot start new spec in phase: ${u.phase}`),c(" \u2014 finish or reset the current spec first.")),await e.close(),g({exitCode:1});let b=j(u.phase==="DONE"?F(u):u,o,s);return await l.fs.mkdir(`${t}/${S.specDir(o)}`,{recursive:!0}),await I(t,b),await R(t,o,b),e.writeln($("\u2714")," Spec started: ",d(o)),e.writeln(" Directory: ",c(S.specDir(o))),e.writeln(" Branch: ",c(s)),e.writeln(" Phase: ",E("DISCOVERY")),e.writeln(""),e.writeln("Run ",d(x("next",n))," to begin discovery questions."),await e.close(),h(void 0)},W=i=>i.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50).replace(/-$/,""),X=async(i,e)=>{let t=`${i}/${S.specsDir}`,n=async r=>{try{return await l.fs.stat(`${t}/${r}`),!0}catch{return!1}};if(!await n(e))return e;for(let r=2;r<=99;r++){let p=`${e}-${r}`;if(!await n(p))return p}return`${e}-${Date.now()}`},B=async i=>{let e=l.process.cwd(),t=T(i),n=await A(e),r=await O(e),p=`${e}/${S.specsDir}`,m=new Set(r.map(s=>s.name)),a=[];for(let s of r)a.push({name:s.name,phase:s.state.phase,iteration:s.state.execution.iteration,active:s.name===n});try{for await(let s of l.fs.readDir(p))s.isDirectory&&!m.has(s.name)&&a.push({name:s.name,phase:"IDLE",iteration:0,active:s.name===n})}catch{}if(t==="json")return await U(a,"json"),h(void 0);let o=y({renderer:v.ansi(),sink:D.stdout()});if(o.writeln(d("Specs")),o.writeln(""),a.length===0)o.writeln(c(" No specs yet."));else for(let s of a){let u=s.active?$("\u25CF"):c("\u25CB"),b=s.active?d(s.name):c(s.name),f=s.phase==="DONE"?$(s.phase):s.phase==="EXECUTING"?N(s.phase):s.phase==="BLOCKED"?w(s.phase):E(s.phase),G=s.phase==="EXECUTING"?c(` iteration ${s.iteration}`):"";o.writeln(" ",u," ",b," ",f,G)}return await o.close(),h(void 0)},q=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=i?.[0],r=await k(t);if(n===void 0||n.length===0)return e.writeln(w("Please provide a spec name: "),d(`${C(r)} spec switch my-feature`)),await e.close(),g({exitCode:1});let p=await A(t),m=await P(t);p!==null&&m.spec!==null&&await R(t,p,m);let a=await L(t,n),o=await l.fs.stat(`${t}/${S.specDir(n)}`).then(()=>!0).catch(()=>!1);return a.phase==="IDLE"&&!o?(e.writeln(w(`Spec "${n}" not found.`)),e.writeln(c(`Run \`${x("spec list",r)}\` to see available specs.`)),await e.close(),g({exitCode:1})):(await I(t,a),e.writeln($("\u2714")," Switched to: ",d(n)," (",N(a.phase),")"),a.phase==="EXECUTING"&&(e.writeln(c(` Iteration: ${a.execution.iteration}`)),a.execution.lastProgress!==null&&e.writeln(c(` Progress: ${a.execution.lastProgress}`))),await e.close(),h(void 0))};export{ee as main};
1
+ import{b as j,i as F}from"./chunk-HLQNHWXS.js";import{a as T,d as U}from"./chunk-TGA7MX5P.js";import{a as x,b as C}from"./chunk-UXRWSNVZ.js";import{d as S,e as P,f as I,g as A,h as L,i as R,j as O,k,r as z}from"./chunk-OJUA2UZK.js";import{c as d,d as c,f as w,g as $,h as E,k as N,o as y,q as D,r as v}from"./chunk-4IFPLK7L.js";import{a as h,b as g}from"./chunk-2N4GTHXQ.js";import{a as l}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var ee=async i=>{let e=i?.[0];if(e==="new")return await M(i?.slice(1));if(e==="list")return await B(i?.slice(1));if(e==="switch")return await q(i?.slice(1));let t=await k(l.process.cwd()),n=C(t),r=y({renderer:v.ansi(),sink:D.stdout()});return r.writeln(`Usage: ${n} spec <new "description" | list | switch <name>>`),await r.close(),h(void 0)},M=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=await k(t);if(!await z(t))return e.writeln(w("noskills is not initialized.")," Run: ",d(x("init",n))),await e.close(),g({exitCode:1});let r=null,p=[];if(i!==void 0)for(let f of i)f.startsWith("--name=")?r=f.slice(7):f.startsWith("-")||p.push(f);let m=p.join(" ");if(m.length===0)return e.writeln(w("Please provide a description: "),d(`${C(n)} spec new "photo auto-listing"`)),await e.close(),g({exitCode:1});let a=r??W(m),o=await X(t,a),s=`spec/${o}`,u=await P(t);if(u.phase!=="IDLE"&&u.phase!=="DONE")return e.writeln(w(`Cannot start new spec in phase: ${u.phase}`),c(" \u2014 finish or reset the current spec first.")),await e.close(),g({exitCode:1});let b=j(u.phase==="DONE"?F(u):u,o,s);return await l.fs.mkdir(`${t}/${S.specDir(o)}`,{recursive:!0}),await I(t,b),await R(t,o,b),e.writeln($("\u2714")," Spec started: ",d(o)),e.writeln(" Directory: ",c(S.specDir(o))),e.writeln(" Branch: ",c(s)),e.writeln(" Phase: ",E("DISCOVERY")),e.writeln(""),e.writeln("Run ",d(x("next",n))," to begin discovery questions."),await e.close(),h(void 0)},W=i=>i.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50).replace(/-$/,""),X=async(i,e)=>{let t=`${i}/${S.specsDir}`,n=async r=>{try{return await l.fs.stat(`${t}/${r}`),!0}catch{return!1}};if(!await n(e))return e;for(let r=2;r<=99;r++){let p=`${e}-${r}`;if(!await n(p))return p}return`${e}-${Date.now()}`},B=async i=>{let e=l.process.cwd(),t=T(i),n=await A(e),r=await O(e),p=`${e}/${S.specsDir}`,m=new Set(r.map(s=>s.name)),a=[];for(let s of r)a.push({name:s.name,phase:s.state.phase,iteration:s.state.execution.iteration,active:s.name===n});try{for await(let s of l.fs.readDir(p))s.isDirectory&&!m.has(s.name)&&a.push({name:s.name,phase:"IDLE",iteration:0,active:s.name===n})}catch{}if(t==="json")return await U(a,"json"),h(void 0);let o=y({renderer:v.ansi(),sink:D.stdout()});if(o.writeln(d("Specs")),o.writeln(""),a.length===0)o.writeln(c(" No specs yet."));else for(let s of a){let u=s.active?$("\u25CF"):c("\u25CB"),b=s.active?d(s.name):c(s.name),f=s.phase==="DONE"?$(s.phase):s.phase==="EXECUTING"?N(s.phase):s.phase==="BLOCKED"?w(s.phase):E(s.phase),G=s.phase==="EXECUTING"?c(` iteration ${s.iteration}`):"";o.writeln(" ",u," ",b," ",f,G)}return await o.close(),h(void 0)},q=async i=>{let e=y({renderer:v.ansi(),sink:D.stdout()}),t=l.process.cwd(),n=i?.[0],r=await k(t);if(n===void 0||n.length===0)return e.writeln(w("Please provide a spec name: "),d(`${C(r)} spec switch my-feature`)),await e.close(),g({exitCode:1});let p=await A(t),m=await P(t);p!==null&&m.spec!==null&&await R(t,p,m);let a=await L(t,n),o=await l.fs.stat(`${t}/${S.specDir(n)}`).then(()=>!0).catch(()=>!1);return a.phase==="IDLE"&&!o?(e.writeln(w(`Spec "${n}" not found.`)),e.writeln(c(`Run \`${x("spec list",r)}\` to see available specs.`)),await e.close(),g({exitCode:1})):(await I(t,a),e.writeln($("\u2714")," Switched to: ",d(n)," (",N(a.phase),")"),a.phase==="EXECUTING"&&(e.writeln(c(` Iteration: ${a.execution.iteration}`)),a.execution.lastProgress!==null&&e.writeln(c(` Progress: ${a.execution.lastProgress}`))),await e.close(),h(void 0))};export{ee as main};
@@ -1 +1 @@
1
- import{a as I,d as w}from"./chunk-G2NW625V.js";import{a as h}from"./chunk-FAK366X2.js";import"./chunk-D6Q2GR7X.js";import{a as f}from"./chunk-UXRWSNVZ.js";import{e as y,k as u,r as D}from"./chunk-MJVACJ6D.js";import{c as i,d as r,f as c,g as b,h as o,k as E,o as p,q as d,r as m}from"./chunk-52HFDP2R.js";import{a as g,b as C}from"./chunk-2N4GTHXQ.js";import{a as x}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var U=async P=>{let n=x.process.cwd(),a=I(P);if(!await D(n)){if(a==="json")await w({error:"noskills is not initialized"},a);else{let s=p({renderer:m.ansi(),sink:d.stdout()}),l=await u(n);s.writeln(c("noskills is not initialized.")," Run: ",i(f("init",l))),await s.close()}return C({exitCode:1})}let e=await y(n),t=await u(n),k={phase:e.phase,spec:e.spec,branch:e.branch,discovery:e.phase==="DISCOVERY"?{answered:e.discovery.answers.length,total:h.length}:void 0,execution:e.phase==="EXECUTING"||e.phase==="BLOCKED"?{iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,debt:e.execution.debt?.items.length??0,verificationPassed:e.execution.lastVerification?.passed??null}:void 0,concerns:t?.concerns??[],tools:t?.tools??[],decisions:e.decisions.length,pendingClear:e.pendingClear};if(a!=="json"){let s=p({renderer:m.ansi(),sink:d.stdout()});s.writeln(i(`${f("status",t)}`)),s.writeln("");let l=e.phase==="DONE"?b(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?E(e.phase):o(e.phase);s.writeln(" Phase: ",l),e.spec!==null&&s.writeln(" Spec: ",i(e.spec)),e.branch!==null&&s.writeln(" Branch: ",e.branch),e.phase==="DISCOVERY"&&s.writeln(` Discovery: ${e.discovery.answers.length}/${h.length} questions answered`),e.phase==="EXECUTING"&&(s.writeln(` Iteration: ${e.execution.iteration}`),e.execution.lastProgress!==null&&s.writeln(" Progress: ",r(e.execution.lastProgress)),e.execution.debt!==null&&s.writeln(o(` Debt: ${e.execution.debt.items.length} items`))),t!==null&&(s.writeln(""),t.concerns.length>0&&s.writeln(" Concerns: ",r(t.concerns.join(", "))),t.tools.length>0&&s.writeln(" Tools: ",r(t.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),e.pendingClear&&(s.writeln(""),s.writeln(o(" \u26A0 Context clear pending \u2014 run `/clear`"))),await s.close()}else await w(k,"json");return g(void 0)};export{U as main};
1
+ import{a as I,d as w}from"./chunk-TGA7MX5P.js";import{a as h}from"./chunk-I6ISQXVP.js";import"./chunk-6QFROYLO.js";import{a as f}from"./chunk-UXRWSNVZ.js";import{e as y,k as u,r as D}from"./chunk-OJUA2UZK.js";import{c as i,d as r,f as c,g as b,h as o,k as E,o as p,q as d,r as m}from"./chunk-4IFPLK7L.js";import{a as g,b as C}from"./chunk-2N4GTHXQ.js";import{a as x}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var U=async P=>{let n=x.process.cwd(),a=I(P);if(!await D(n)){if(a==="json")await w({error:"noskills is not initialized"},a);else{let s=p({renderer:m.ansi(),sink:d.stdout()}),l=await u(n);s.writeln(c("noskills is not initialized.")," Run: ",i(f("init",l))),await s.close()}return C({exitCode:1})}let e=await y(n),t=await u(n),k={phase:e.phase,spec:e.spec,branch:e.branch,discovery:e.phase==="DISCOVERY"?{answered:e.discovery.answers.length,total:h.length}:void 0,execution:e.phase==="EXECUTING"||e.phase==="BLOCKED"?{iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,debt:e.execution.debt?.items.length??0,verificationPassed:e.execution.lastVerification?.passed??null}:void 0,concerns:t?.concerns??[],tools:t?.tools??[],decisions:e.decisions.length,pendingClear:e.pendingClear};if(a!=="json"){let s=p({renderer:m.ansi(),sink:d.stdout()});s.writeln(i(`${f("status",t)}`)),s.writeln("");let l=e.phase==="DONE"?b(e.phase):e.phase==="BLOCKED"?c(e.phase):e.phase==="EXECUTING"?E(e.phase):o(e.phase);s.writeln(" Phase: ",l),e.spec!==null&&s.writeln(" Spec: ",i(e.spec)),e.branch!==null&&s.writeln(" Branch: ",e.branch),e.phase==="DISCOVERY"&&s.writeln(` Discovery: ${e.discovery.answers.length}/${h.length} questions answered`),e.phase==="EXECUTING"&&(s.writeln(` Iteration: ${e.execution.iteration}`),e.execution.lastProgress!==null&&s.writeln(" Progress: ",r(e.execution.lastProgress)),e.execution.debt!==null&&s.writeln(o(` Debt: ${e.execution.debt.items.length} items`))),t!==null&&(s.writeln(""),t.concerns.length>0&&s.writeln(" Concerns: ",r(t.concerns.join(", "))),t.tools.length>0&&s.writeln(" Tools: ",r(t.tools.join(", ")))),e.decisions.length>0&&(s.writeln(""),s.writeln(` Decisions: ${e.decisions.length}`)),e.pendingClear&&(s.writeln(""),s.writeln(o(" \u26A0 Context clear pending \u2014 run `/clear`"))),await s.close()}else await w(k,"json");return g(void 0)};export{U as main};
@@ -1 +1 @@
1
- import{b as g}from"./chunk-LEPZPNTN.js";import{a as w}from"./chunk-UXRWSNVZ.js";import{k as u}from"./chunk-MJVACJ6D.js";import{c as m,d as r,f as c,g as n,o as p,q as d,r as f}from"./chunk-52HFDP2R.js";import{a as o,b as a}from"./chunk-2N4GTHXQ.js";import{a as l}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var v=async h=>{let s=p({renderer:f.ansi(),sink:d.stdout()}),t=l.process.cwd(),e=await u(t);if(e===null)return s.writeln(c("noskills is not initialized.")," Run: ",m(w("init",e))),await s.close(),a({exitCode:1});s.writeln(r("Syncing tool files..."));let i=await g(t,e.tools,e);for(let y of i)s.writeln(" ",n("\u2714"),` ${y}`);return i.length===0&&s.writeln(r(" No tools configured.")),s.writeln(""),s.writeln(n("Done.")),await s.close(),o(void 0)};export{v as main};
1
+ import{b as g}from"./chunk-QEEZKZXM.js";import{a as w}from"./chunk-UXRWSNVZ.js";import{k as u}from"./chunk-OJUA2UZK.js";import{c as m,d as r,f as c,g as n,o as p,q as d,r as f}from"./chunk-4IFPLK7L.js";import{a as o,b as a}from"./chunk-2N4GTHXQ.js";import{a as l}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var v=async h=>{let s=p({renderer:f.ansi(),sink:d.stdout()}),t=l.process.cwd(),e=await u(t);if(e===null)return s.writeln(c("noskills is not initialized.")," Run: ",m(w("init",e))),await s.close(),a({exitCode:1});s.writeln(r("Syncing tool files..."));let i=await g(t,e.tools,e);for(let y of i)s.writeln(" ",n("\u2714"),` ${y}`);return i.length===0&&s.writeln(r(" No tools configured.")),s.writeln(""),s.writeln(n("Done.")),await s.close(),o(void 0)};export{v as main};
@@ -1,4 +1,4 @@
1
- import{a as S,c as E}from"./chunk-6XR33H6Q.js";import{a as C,c as M}from"./chunk-G2NW625V.js";import{e as T,k as y,r as b}from"./chunk-MJVACJ6D.js";import{a as x,b as k}from"./chunk-2N4GTHXQ.js";import{a as m}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var D=async e=>{let s=await T(e),l=await y(e),d=await L(e),o=null,u=null,n=0,c=0;if(s.spec!==null){let i=await S(e,s.spec);if(i!==null){n=i.tasks.length,c=s.execution.completedTasks.length;let a=E(i.tasks,s.execution.completedTasks);a!==null&&(o=a.id,u=a.title)}}let $=null;return s.lastCalledAt!==null&&($=Math.floor((Date.now()-new Date(s.lastCalledAt).getTime())/1e3)),{spec:s.spec,phase:s.phase,iteration:s.execution.iteration,activeTaskId:o,activeTaskTitle:u,totalTasks:n,completedTaskCount:c,lastProgress:s.execution.lastProgress,lastCalledAt:s.lastCalledAt,modifiedFiles:s.execution.modifiedFiles,debt:s.execution.debt,concerns:l?.concerns??[],maxIterations:l?.maxIterationsBeforeRestart??15,awaitingStatusReport:s.execution.awaitingStatusReport,pendingClear:s.pendingClear,verificationPassed:s.execution.lastVerification?.passed??null,decisionsCount:s.decisions.length,discoveryAnswered:s.discovery.answers.length,discoveryTotal:6,trackedFiles:d,timeSinceUpdate:$}},L=async e=>{let s=`${e}/.eser/.state/files-changed.jsonl`;try{let d=(await m.fs.readTextFile(s)).trim().split(`
1
+ import{a as S,c as E}from"./chunk-7ADGJB4H.js";import{a as C,c as M}from"./chunk-TGA7MX5P.js";import{e as T,k as y,r as b}from"./chunk-OJUA2UZK.js";import{a as x,b as k}from"./chunk-2N4GTHXQ.js";import{a as m}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var D=async e=>{let s=await T(e),l=await y(e),d=await L(e),o=null,u=null,n=0,c=0;if(s.spec!==null){let i=await S(e,s.spec);if(i!==null){n=i.tasks.length,c=s.execution.completedTasks.length;let a=E(i.tasks,s.execution.completedTasks);a!==null&&(o=a.id,u=a.title)}}let $=null;return s.lastCalledAt!==null&&($=Math.floor((Date.now()-new Date(s.lastCalledAt).getTime())/1e3)),{spec:s.spec,phase:s.phase,iteration:s.execution.iteration,activeTaskId:o,activeTaskTitle:u,totalTasks:n,completedTaskCount:c,lastProgress:s.execution.lastProgress,lastCalledAt:s.lastCalledAt,modifiedFiles:s.execution.modifiedFiles,debt:s.execution.debt,concerns:l?.concerns??[],maxIterations:l?.maxIterationsBeforeRestart??15,awaitingStatusReport:s.execution.awaitingStatusReport,pendingClear:s.pendingClear,verificationPassed:s.execution.lastVerification?.passed??null,decisionsCount:s.decisions.length,discoveryAnswered:s.discovery.answers.length,discoveryTotal:6,trackedFiles:d,timeSinceUpdate:$}},L=async e=>{let s=`${e}/.eser/.state/files-changed.jsonl`;try{let d=(await m.fs.readTextFile(s)).trim().split(`
2
2
  `).filter(Boolean),o=[];for(let u of d)try{let n=JSON.parse(u);o.includes(n.file)||o.push(n.file)}catch{}return o}catch{return[]}},F="\x1B[2J\x1B[H",I="\x1B[1m",r="\x1B[2m",t="\x1B[0m",f="\x1B[32m",p="\x1B[33m",w="\x1B[31m",P="\x1B[36m",O=e=>{switch(e){case"DONE":return f;case"BLOCKED":return w;case"EXECUTING":return P;default:return p}},A=(e,s,l)=>{if(s===0)return"\u2591".repeat(l);let d=Math.min(e/s,1),o=Math.round(d*l);return"\u2588".repeat(o)+"\u2591".repeat(l-o)},v=e=>e===null?"never":e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:`${Math.floor(e/3600)}h ago`,R=e=>{let s=[],d="\u2500".repeat(52);s.push(`${r}\u256D${d}\u256E${t}`),s.push(`${r}\u2502${t} ${I}noskills watch${t} \u2014 ${e.spec??"no active spec"}${r}${" ".repeat(Math.max(0,34-(e.spec?.length??15)))}\u2502${t}`);let o=O(e.phase);if(s.push(`${r}\u2502${t} Phase: ${o}${e.phase}${t}${" ".repeat(Math.max(0,42-e.phase.length))}${r}\u2502${t}`),e.phase==="DISCOVERY")s.push(`${r}\u2502${t} Discovery: ${e.discoveryAnswered}/${e.discoveryTotal} questions answered${" ".repeat(Math.max(0,14))}${r}\u2502${t}`);else if(e.phase==="SPEC_DRAFT")s.push(`${r}\u2502${t} ${p}Awaiting approval${t}${" ".repeat(Math.max(0,33))}${r}\u2502${t}`);else if(e.phase==="EXECUTING"||e.phase==="BLOCKED"){let n=A(e.completedTaskCount,e.totalTasks,12),c=e.totalTasks>0?Math.round(e.completedTaskCount/e.totalTasks*100):0,$=`${n} ${e.completedTaskCount}/${e.totalTasks} tasks (${c}%)`;if(s.push(`${r}\u2502${t} Progress: ${f}${$}${t}${" ".repeat(Math.max(0,40-$.length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} Iteration: ${e.iteration}${" ".repeat(Math.max(0,38-String(e.iteration).length))}${r}\u2502${t}`),e.activeTaskId!==null){let a=`${e.activeTaskId}${e.activeTaskTitle!==null?` (${e.activeTaskTitle})`:""}`.slice(0,36);s.push(`${r}\u2502${t} Active task: ${P}${a}${t}${" ".repeat(Math.max(0,36-a.length))}${r}\u2502${t}`)}if(e.phase==="BLOCKED"){let i=(e.lastProgress??"unknown").replace(/^BLOCKED:\s*/,"");s.push(`${r}\u2502${t} ${w}BLOCKED: ${i.slice(0,40)}${t}${" ".repeat(Math.max(0,40-i.slice(0,40).length))}${r}\u2502${t}`),s.push(`${r}\u2502${t} ${p}Human input needed${t}${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}}else e.phase==="DONE"&&s.push(`${r}\u2502${t} ${f}Complete!${t} ${e.iteration} iterations, ${e.decisionsCount} decisions${" ".repeat(Math.max(0,17-String(e.iteration).length-String(e.decisionsCount).length))}${r}\u2502${t}`);if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),s.push(`${r}\u2502${t} Last update: ${v(e.timeSinceUpdate)}${" ".repeat(Math.max(0,36-v(e.timeSinceUpdate).length))}${r}\u2502${t}`),e.lastProgress!==null){let n=e.lastProgress.slice(0,48);s.push(`${r}\u2502${t} ${r}${n}${t}${" ".repeat(Math.max(0,50-n.length))}${r}\u2502${t}`)}if(e.awaitingStatusReport&&s.push(`${r}\u2502${t} ${p}Status report pending${t}${" ".repeat(Math.max(0,29))}${r}\u2502${t}`),e.pendingClear&&s.push(`${r}\u2502${t} ${p}/clear pending${t}${" ".repeat(Math.max(0,36))}${r}\u2502${t}`),e.verificationPassed===!1&&s.push(`${r}\u2502${t} ${w}Verification failed${t}${" ".repeat(Math.max(0,31))}${r}\u2502${t}`),s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.debt!==null&&e.debt.items.length>0){s.push(`${r}\u2502${t} Debt: ${e.debt.items.length} item(s)${" ".repeat(Math.max(0,34))}${r}\u2502${t}`);for(let n of e.debt.items.slice(0,3)){let c=n.slice(0,44);s.push(`${r}\u2502${t} \u2514\u2500 ${c}${" ".repeat(Math.max(0,46-c.length))}${r}\u2502${t}`)}e.debt.items.length>3&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${e.debt.items.length-3} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(e.trackedFiles.length>0||e.modifiedFiles.length>0){let n=e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles;s.push(`${r}\u2502${t} Files changed: ${n.length}${" ".repeat(Math.max(0,34-String(n.length).length))}${r}\u2502${t}`);for(let c of n.slice(0,5)){let $=c.length>44?"..."+c.slice(-41):c;s.push(`${r}\u2502${t} \u2514\u2500 ${$}${" ".repeat(Math.max(0,46-$.length))}${r}\u2502${t}`)}n.length>5&&s.push(`${r}\u2502${t} \u2514\u2500 ... and ${n.length-5} more${" ".repeat(Math.max(0,32))}${r}\u2502${t}`)}if(s.push(`${r}\u2502${"".padEnd(52)}\u2502${t}`),e.concerns.length>0){let n=e.concerns.join(", ").slice(0,38);s.push(`${r}\u2502${t} Concerns: ${n}${" ".repeat(Math.max(0,40-n.length))}${r}\u2502${t}`)}let u=e.iteration>=e.maxIterations?`${w}RESTART RECOMMENDED${t}`:`${f}ok${t} (${e.iteration}/${e.maxIterations})`;return s.push(`${r}\u2502${t} Context: ${u}${" ".repeat(Math.max(0,41-u.replace(/\x1b\[[0-9;]*m/g,"").length))}${r}\u2502${t}`),s.push(`${r}\u2570${d}\u256F${t}`),s.push(` ${r}watching .eser/.state/ for changes... (ctrl+c to stop)${t}`),s.join(`
3
3
  `)},W=e=>JSON.stringify({ts:new Date().toISOString(),phase:e.phase,spec:e.spec,iteration:e.iteration,activeTask:e.activeTaskId,tasks:{completed:e.completedTaskCount,total:e.totalTasks},progress:e.lastProgress,debt:e.debt?.items.length??0,filesChanged:e.trackedFiles.length>0?e.trackedFiles:e.modifiedFiles,timeSinceUpdate:e.timeSinceUpdate,pendingClear:e.pendingClear,verificationPassed:e.verificationPassed}),J=async e=>{let s=m.process.cwd(),l=C(e);if(!await b(s)){let i=new TextEncoder,a=m.process.stdout.getWriter();return await a.write(i.encode(`noskills not initialized.
4
4
  `)),a.releaseLock(),k({exitCode:1})}let d=`${s}/.eser/.state`,o="",u=async()=>{let i=await D(s),a=l==="json"?W(i):l==="markdown"?M(i,"markdown"):R(i);if(l==="json"){let g=new TextEncoder,h=m.process.stdout.getWriter();await h.write(g.encode(a+`
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as WORKERD_CAPABILITIES,c as clearEnv,d as createWorkerdRuntime,b as populateEnvFromContext};
1
+ import{a,b,c,d}from"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";export{a as WORKERD_CAPABILITIES,c as clearEnv,d as createWorkerdRuntime,b as populateEnvFromContext};
package/noskills.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as t}from"./chunks/chunk-TNKUKNM4.js";import{c as o}from"./chunks/chunk-2N4GTHXQ.js";import{a as s}from"./chunks/chunk-FPO2JRU3.js";import"./chunks/chunk-SG4G3OOO.js";import"./chunks/chunk-FDZP7B5Y.js";import"./chunks/chunk-ACQUINWH.js";import"./chunks/chunk-DXB73IDG.js";var i=new t({description:"noskills \u2014 state-machine orchestrator for AI agents",modules:{init:{description:"Initialize noskills in project",load:()=>import("./chunks/init-FMAEQACG.js")},status:{description:"Show current state",load:()=>import("./chunks/status-K2DRYXDX.js")},spec:{description:"Manage specs (new, list)",load:()=>import("./chunks/spec-BLGJLET3.js")},next:{description:"Get next instruction for agent",load:()=>import("./chunks/next-WEQWWHMJ.js")},approve:{description:"Approve phase transition",load:()=>import("./chunks/approve-UATWGG53.js")},block:{description:"Mark spec as blocked",load:()=>import("./chunks/block-IDVJLPNV.js")},reset:{description:"Reset current spec state",load:()=>import("./chunks/reset-2II5XIWI.js")},done:{description:"Mark spec execution as complete",load:()=>import("./chunks/done-LOYNEBUX.js")},concern:{description:"Manage concerns (add, remove, list)",load:()=>import("./chunks/concern-JUE2IFQI.js")},run:{description:"Autonomous execution loop (Ralph loop)",load:()=>import("./chunks/run-EP6XJQXK.js")},watch:{description:"Live dashboard for monitoring agent progress",load:()=>import("./chunks/watch-DTNAKL6O.js")},sync:{description:"Regenerate tool-specific files",load:()=>import("./chunks/sync-NR33ZH7R.js")},purge:{description:"Remove all noskills content (specs, rules, concerns, hooks)",load:()=>import("./chunks/purge-AISADFMA.js")},"invoke-hook":{description:"Internal hook handlers (called by agents)",load:()=>import("./chunks/invoke-hook-2VRIZ4VU.js")},rule:{description:"Manage rules (add, list, promote)",load:()=>import("./chunks/rule-3UTOQ32B.js")}}});var r={name:"@eser/noskills",version:"4.1.29",type:"module",exports:{".":"./main.ts","./mod":"./mod.ts","./module":"./module.ts"},dependencies:{"@eser/ai":"workspace:*","@eser/primitives":"workspace:*","@eser/shell":"workspace:*","@eser/standards":"workspace:*","@eser/streams":"workspace:*",yaml:"^2"},devDependencies:{"@std/assert":"npm:@jsr/std__assert@^1.0.16","@std/testing":"npm:@jsr/std__testing@^1.0.16"}};var p=i.toCommand("noskills",r.version),d=async()=>await p.parse();if(import.meta.main){let n=await d();o(n,{ok:()=>{},fail:e=>{e.message!==void 0&&console.error(e.message),s.process.setExitCode(e.exitCode)}})}export{d as main};
2
+ import{a as t}from"./chunks/chunk-LZSLKXJE.js";import{c as o}from"./chunks/chunk-2N4GTHXQ.js";import{a as s}from"./chunks/chunk-HS6FTDDW.js";import"./chunks/chunk-WV3HK5WR.js";import"./chunks/chunk-FDZP7B5Y.js";import"./chunks/chunk-ACQUINWH.js";import"./chunks/chunk-DXB73IDG.js";var i=new t({description:"noskills \u2014 state-machine orchestrator for AI agents",modules:{init:{description:"Initialize noskills in project",load:()=>import("./chunks/init-HS26Q2YL.js")},status:{description:"Show current state",load:()=>import("./chunks/status-B4YAFCOQ.js")},spec:{description:"Manage specs (new, list)",load:()=>import("./chunks/spec-RTBL43T7.js")},next:{description:"Get next instruction for agent",load:()=>import("./chunks/next-ZZAZ6ZVW.js")},approve:{description:"Approve phase transition",load:()=>import("./chunks/approve-5N5LJ2WQ.js")},block:{description:"Mark spec as blocked",load:()=>import("./chunks/block-WWW3MXHP.js")},reset:{description:"Reset current spec state",load:()=>import("./chunks/reset-VZO7YXM6.js")},done:{description:"Mark spec execution as complete",load:()=>import("./chunks/done-IBA3FUE5.js")},concern:{description:"Manage concerns (add, remove, list)",load:()=>import("./chunks/concern-P4L2VWAE.js")},run:{description:"Autonomous execution loop (Ralph loop)",load:()=>import("./chunks/run-LEX6S5D7.js")},watch:{description:"Live dashboard for monitoring agent progress",load:()=>import("./chunks/watch-7DNXJAAQ.js")},sync:{description:"Regenerate tool-specific files",load:()=>import("./chunks/sync-XMUP5YHZ.js")},purge:{description:"Remove all noskills content (specs, rules, concerns, hooks)",load:()=>import("./chunks/purge-FBZME5ZJ.js")},"invoke-hook":{description:"Internal hook handlers (called by agents)",load:()=>import("./chunks/invoke-hook-JZBFLW46.js")},rule:{description:"Manage rules (add, list, promote)",load:()=>import("./chunks/rule-4D2CRBI4.js")}}});var r={name:"@eser/noskills",version:"4.1.30",type:"module",exports:{".":"./main.ts","./mod":"./mod.ts","./module":"./module.ts"},dependencies:{"@eser/ai":"workspace:*","@eser/primitives":"workspace:*","@eser/shell":"workspace:*","@eser/standards":"workspace:*","@eser/streams":"workspace:*",yaml:"^2"},devDependencies:{"@std/assert":"npm:@jsr/std__assert@^1.0.16","@std/testing":"npm:@jsr/std__testing@^1.0.16"}};var p=i.toCommand("noskills",r.version),d=async()=>await p.parse();if(import.meta.main){let n=await d();o(n,{ok:()=>{},fail:e=>{e.message!==void 0&&console.error(e.message),s.process.setExitCode(e.exitCode)}})}export{d as main};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noskills",
3
- "version": "4.1.29",
3
+ "version": "4.1.30",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "noskills": "./noskills.js"
@@ -1 +0,0 @@
1
- import{b as F}from"./chunk-T7K64JD5.js";import{b as v,d as b}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";import*as n from"node:fs/promises";import*as O from"node:fs";import*as o from"node:path";import*as w from"node:os";import m from"node:process";import{Readable as x,Writable as k}from"node:stream";var E={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!1},R=()=>{let s=e=>({isFile:e.isFile(),isDirectory:e.isDirectory(),isSymlink:e.isSymbolicLink(),size:e.size,mtime:e.mtime,atime:e.atime,birthtime:e.birthtime}),a=(e,t)=>{throw e instanceof Error&&"code"in e&&e.code==="ENOENT"?new v(t):e};return{async readFile(e,t){try{let r=await n.readFile(e,{signal:t?.signal});return new Uint8Array(r)}catch(r){return a(r,e)}},async readTextFile(e,t){try{return await n.readFile(e,{encoding:"utf-8",signal:t?.signal})}catch(r){return a(r,e)}},async writeFile(e,t,r){let d=r?.append?"a":"w";await n.writeFile(e,t,{signal:r?.signal,mode:r?.mode,flag:d})},async writeTextFile(e,t,r){let d=r?.append?"a":"w";await n.writeFile(e,t,{encoding:"utf-8",signal:r?.signal,mode:r?.mode,flag:d})},async exists(e){try{return await n.access(e),!0}catch{return!1}},async stat(e){try{let t=await n.stat(e);return s(t)}catch(t){return a(t,e)}},async lstat(e){try{let t=await n.lstat(e);return s(t)}catch(t){return a(t,e)}},async mkdir(e,t){await n.mkdir(e,{recursive:t?.recursive??!1,mode:t?.mode})},async ensureDir(e){await n.mkdir(e,{recursive:!0})},async remove(e,t){try{await n.rm(e,{recursive:t?.recursive??!1,force:!1})}catch(r){a(r,e)}},async*readDir(e){try{let t=await n.readdir(e,{withFileTypes:!0});for(let r of t)yield{name:r.name,isFile:r.isFile(),isDirectory:r.isDirectory(),isSymlink:r.isSymbolicLink()}}catch(t){a(t,e)}},async copyFile(e,t){await n.copyFile(e,t)},async rename(e,t){await n.rename(e,t)},async makeTempDir(e){let t=e?.dir??w.tmpdir(),r=e?.prefix??"",d=e?.suffix??"",i=await n.mkdtemp(o.join(t,r));if(d){let c=i+d;return await n.rename(i,c),c}return i},async realPath(e){try{return await n.realpath(e)}catch(t){throw t instanceof Error&&"code"in t&&t.code==="ENOENT"?new v(e):t}},watch(e,t){let r=t?.recursive??!0,d=[],i=[],c=[],u=!1,h=l=>{u||(c.length>0?c.shift()({value:l,done:!1}):i.push(l))};for(let l of e)try{let P=O.watch(l,{recursive:r},(y,f)=>{f!==null&&h({kind:y==="rename"?"create":"modify",paths:[o.join(l,f)]})});d.push(P)}catch{}return{close:()=>{u=!0;for(let l of d)l.close();for(let l of c)l({value:void 0,done:!0});c=[]},[Symbol.asyncIterator]:()=>({next:()=>u?Promise.resolve({value:void 0,done:!0}):i.length>0?Promise.resolve({value:i.shift(),done:!1}):new Promise(l=>{c.push(l)})})}},async chmod(e,t){await n.chmod(e,t)},async*walk(e,t){let r=t?.includeDirs??!0,d=t?.includeFiles??!0,i=t?.exts,c=t?.skip,u=async function*(h){let l=await n.readdir(h,{withFileTypes:!0});for(let P of l){let y=o.join(h,P.name);if(c?.some(p=>p.test(y)))continue;let f=P.isSymbolicLink();if(P.isDirectory())r&&(yield{path:y,name:P.name,isFile:!1,isDirectory:!0,isSymlink:f}),yield*u(y);else if(P.isFile()||f){if(!d||i&&!i.some(p=>P.name.endsWith(p.startsWith(".")?p:`.${p}`)))continue;yield{path:y,name:P.name,isFile:P.isFile(),isDirectory:!1,isSymlink:f}}}};yield*u(e)}}},S=()=>({join:o.join,resolve:o.resolve,dirname:o.dirname,basename:o.basename,extname:o.extname,normalize:o.normalize,isAbsolute:o.isAbsolute,relative:o.relative,parse:o.parse,format:o.format,sep:o.sep,delimiter:o.delimiter}),g=async s=>{if(!s)return new Uint8Array(0);let a=[],e=s.getReader();try{for(;;){let{done:i,value:c}=await e.read();if(i)break;a.push(c)}}finally{e.releaseLock()}let t=a.reduce((i,c)=>i+c.length,0),r=new Uint8Array(t),d=0;for(let i of a)r.set(i,d),d+=i.length;return r},A=()=>({async spawn(s,a=[],e){let[t,r,d]=F(e),i=Bun.spawn([s,...a],{cwd:e?.cwd,env:e?.env,stdin:t,stdout:r,stderr:d}),[c,u,h]=await Promise.all([i.exited,g(i.stdout),g(i.stderr)]);return{success:c===0,code:c,stdout:u,stderr:h}},async exec(s,a=[],e){let t=await this.spawn(s,a,e);if(!t.success){let r=new TextDecoder().decode(t.stderr);throw new b(s,t.code,r)}return new TextDecoder().decode(t.stdout).trim()},async execJson(s,a=[],e){let t=await this.exec(s,a,e);return JSON.parse(t)},spawnChild(s,a=[],e){let[t,r,d]=F(e),i=Bun.spawn([s,...a],{cwd:e?.cwd,env:e?.env,stdin:t,stdout:r,stderr:d}),c=i.exited.then(u=>({success:u===0,code:u,signal:void 0}));return{pid:i.pid,stdin:i.stdin,stdout:i.stdout,stderr:i.stderr,status:c,output:async()=>{let[u,h,l]=await Promise.all([c,g(i.stdout),g(i.stderr)]);return{success:u.success,code:u.code,stdout:h,stderr:l}},kill:u=>{i.kill(u)}}}}),W=()=>({get(s){return m.env[s]},set(s,a){m.env[s]=a},delete(s){delete m.env[s]},has(s){return s in m.env},toObject(){let s={};for(let[a,e]of Object.entries(m.env))e!==void 0&&(s[a]=e);return s}}),D=()=>({exit(s){m.exit(s)},setExitCode(s){m.exitCode=s},cwd(){return m.cwd()},chdir(s){m.chdir(s)},hostname(){return w.hostname()},execPath(){return m.execPath},args:m.argv.slice(2),pid:m.pid,stdin:x.toWeb(m.stdin),stdout:k.toWeb(m.stdout),stderr:k.toWeb(m.stderr)}),C=()=>{let s=R(),a=S(),e=A(),t=W(),r=D();return{name:"bun",version:Bun.version,capabilities:E,fs:s,path:a,exec:e,env:t,process:r}};export{E as BUN_CAPABILITIES,C as createBunRuntime};
@@ -1 +0,0 @@
1
- import{b as a,c as j,d as l,e as I,f as w,g as c,h as A,i as W,k as T,l as D,n as M,o as q,q as U,r as K}from"./chunk-52HFDP2R.js";var f=Symbol("tui.cancel"),re=e=>e===f,ae=e=>{let t=e?.interaction??(e?.target==="non-interactive"?"non-interactive":"interactive"),n=e?.audience??"human",s=t==="non-interactive"?"non-interactive":"interactive",r=t==="interactive";return{output:e?.output??q({renderer:r?K.ansi():K.plain(),sink:r?U.stdout():U.stderr()}),input:e?.input??(typeof globalThis.Deno<"u"?Deno.stdin.readable:new ReadableStream),target:s,interaction:t,audience:n,stderr:e?.stderr??q({renderer:K.plain(),sink:U.stderr()})}};var g="\u2502",X="\u250C",h="\u2514";var F="\u25CF",H="\u25CB",G="\u25FC",z="\u25FB",k="\u25C6",C="\u25C7",b="\u25A0",J="\u25CF";var N="\u25B2";var Q="\u25C7";var O=async e=>{let t=!1;if(typeof globalThis.Deno<"u")try{Deno.stdin.setRaw(!0),t=!0}catch{}try{return await e()}finally{if(t)try{Deno.stdin.setRaw(!1)}catch{}}},v=e=>{e.write(a("\x1B[?25l"))},R=e=>{e.write(a("\x1B[?25h"))},m=(e,t)=>{t>0&&e.write(a(`\x1B[${t}A\x1B[J`))};var ie=e=>{if(e.length===1&&e[0]===3)return{name:"c",ctrl:!0,meta:!1,shift:!1};if(e.length===1&&e[0]===27)return{name:"escape",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&(e[0]===13||e[0]===10))return{name:"return",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]===9)return{name:"tab",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]===127)return{name:"backspace",ctrl:!1,meta:!1,shift:!1};if(e.length>=3&&e[0]===27&&e[1]===91)switch(e[2]){case 65:return{name:"up",ctrl:!1,meta:!1,shift:!1};case 66:return{name:"down",ctrl:!1,meta:!1,shift:!1};case 67:return{name:"right",ctrl:!1,meta:!1,shift:!1};case 68:return{name:"left",ctrl:!1,meta:!1,shift:!1};case 72:return{name:"home",ctrl:!1,meta:!1,shift:!1};case 70:return{name:"end",ctrl:!1,meta:!1,shift:!1}}if(e.length===1&&e[0]>=1&&e[0]<=26)return{name:String.fromCharCode(e[0]+96),ctrl:!0,meta:!1,shift:!1};if(e.length===1&&e[0]===32)return{name:"space",char:" ",ctrl:!1,meta:!1,shift:!1};if(e.length===1&&e[0]>=33&&e[0]<=126){let t=String.fromCharCode(e[0]);return{name:t,char:t,ctrl:!1,meta:!1,shift:!1}}if(e.length>0&&e[0]>=192){let t=new TextDecoder().decode(e);return{name:t,char:t,ctrl:!1,meta:!1,shift:!1}}return{name:"unknown",ctrl:!1,meta:!1,shift:!1}};async function*E(e,t){let n=e.getReader();try{for(;!t?.aborted;){let{done:s,value:r}=await n.read();if(s||r===void 0)break;yield ie(r)}}finally{n.releaseLock()}}var B=(e,t,n,s)=>{if(s==="done"){let o=n?"Yes":"No";return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${o}`)),1}if(s==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let r=n?I(c(F),a(" Yes")):I(l(H),l(" Yes")),i=n?I(l(H),l(" No")):I(c(F),a(" No"));return e.output.writeln(T(k),a(` ${t}`)),e.output.writeln(l(g),a(" "),r,l(" / "),i),e.output.writeln(l(h)),3},oe=async(e,t)=>{let n=t.initialValue??!0,s=0;v(e.output);try{return await O(async()=>{s=B(e,t.message,n,"active"),await e.output.flush();for await(let r of E(e.input)){if(r.name==="c"&&r.ctrl)return m(e.output,s),B(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="escape")return m(e.output,s),B(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="return")return m(e.output,s),B(e,t.message,n,"done"),await e.output.flush(),n;let i=!1;(r.name==="left"||r.name==="right")&&(n=!n,i=!0),(r.name==="y"||r.name==="Y")&&(n=!0,i=!0),(r.name==="n"||r.name==="N")&&(n=!1,i=!0),i&&(m(e.output,s),s=B(e,t.message,n,"active"),await e.output.flush())}return f})}finally{R(e.output),await e.output.flush()}};var _=(e,t,n,s,r,i)=>{if(i==="done")return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${n}`)),1;if(i==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let o=n.length>0?a(n):s!==void 0?l(s):a(""),d=r!==void 0?A(N):T(k);e.output.writeln(d,a(` ${t}`)),e.output.writeln(l(g),a(" "),o);let y=2;return r!==void 0?(e.output.writeln(l(h),a(" "),A(r)),y=3):(e.output.writeln(l(h)),y=3),y},le=async(e,t)=>{let n=t.initialValue??"",s=n.length,r,i=0;v(e.output);try{return await O(async()=>{i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush();for await(let o of E(e.input)){if(o.name==="c"&&o.ctrl)return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"cancel"),await e.output.flush(),f;if(o.name==="escape")return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"cancel"),await e.output.flush(),f;if(o.name==="return"){if(t.validate!==void 0){let d=t.validate(n);if(d!==void 0){r=d,m(e.output,i),i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush();continue}}return m(e.output,i),_(e,t.message,n,t.placeholder,void 0,"done"),await e.output.flush(),n}if(r=void 0,o.name==="backspace")s>0&&(n=n.slice(0,s-1)+n.slice(s),s--);else if(o.name==="left")s>0&&s--;else if(o.name==="right")s<n.length&&s++;else if(o.name==="home")s=0;else if(o.name==="end")s=n.length;else if(o.char!==void 0)n=n.slice(0,s)+o.char+n.slice(s),s++;else continue;m(e.output,i),i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush()}return f})}finally{R(e.output),await e.output.flush()}};var S=(e,t,n,s,r,i,o)=>{if(o==="done"){let p=[...r].sort((u,L)=>u-L).map(u=>n[u]?.label??"").join(", ");return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${p}`)),1}if(o==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let d=i!==void 0?A(N):T(k);e.output.writeln(d,a(` ${t}`));for(let p=0;p<n.length;p++){let u=n[p],L=p===s,Z=r.has(p),ee=u.disabled===!0,te=Z?c(G):l(z),ne=ee?l(` ${u.label}`):L?a(` ${u.label}`):l(` ${u.label}`),se=u.hint!==void 0?l(` (${u.hint})`):a("");e.output.writeln(l(g),a(" "),te,ne,se)}let y=n.length+2;return i!==void 0?e.output.writeln(l(h),a(" "),A(i)):e.output.writeln(l(h)),y},Y=(e,t,n)=>{let s=e.length,r=t;for(let i=0;i<s;i++)if(r=(r+n+s)%s,e[r]?.disabled!==!0)return r;return t},ue=async(e,t)=>{let n=0,s=new Set;if(t.initialValues!==void 0)for(let o of t.initialValues){let d=t.options.findIndex(y=>y.value===o);d>=0&&s.add(d)}t.options[n]?.disabled===!0&&(n=Y(t.options,n,1));let r=0,i;v(e.output);try{return await O(async()=>{r=S(e,t.message,t.options,n,s,i,"active"),await e.output.flush();for await(let o of E(e.input)){if(o.name==="c"&&o.ctrl)return m(e.output,r),S(e,t.message,t.options,n,s,void 0,"cancel"),await e.output.flush(),f;if(o.name==="escape")return m(e.output,r),S(e,t.message,t.options,n,s,void 0,"cancel"),await e.output.flush(),f;if(o.name==="return"){if(t.required!==!1&&s.size===0){i="Please select at least one option.",m(e.output,r),r=S(e,t.message,t.options,n,s,i,"active"),await e.output.flush();continue}return m(e.output,r),S(e,t.message,t.options,n,s,void 0,"done"),await e.output.flush(),[...s].sort((y,p)=>y-p).map(y=>t.options[y].value)}i=void 0;let d=!1;if((o.name==="up"||o.name==="k")&&(n=Y(t.options,n,-1),d=!0),(o.name==="down"||o.name==="j")&&(n=Y(t.options,n,1),d=!0),o.name==="space"&&t.options[n]?.disabled!==!0&&(s.has(n)?s.delete(n):s.add(n),d=!0),o.name==="a"){let y=t.options.every((p,u)=>p.disabled===!0||s.has(u));for(let p=0;p<t.options.length;p++)t.options[p]?.disabled!==!0&&(y?s.delete(p):s.add(p));d=!0}d&&(m(e.output,r),r=S(e,t.message,t.options,n,s,i,"active"),await e.output.flush())}return f})}finally{R(e.output),await e.output.flush()}};var pe=(e,t)=>{e.output.writeln(D(X),a(" "),j(t)),e.output.writeln(D(g))},de=(e,t)=>{e.output.writeln(D(g)),e.output.writeln(D(h),a(" "),a(t))},me={info:(e,t)=>{e.output.writeln(M("info",t))},success:(e,t)=>{e.output.writeln(M("success",t))},warn:(e,t)=>{e.output.writeln(M("warning",t))},error:(e,t)=>{e.output.writeln(M("error",t))},step:(e,t)=>{e.output.writeln(l(Q),a(" "),l(t))},message:(e,t,n)=>{e.output.writeln(l(n??g),a(" "),a(t))}};var fe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],ye=80,ce=(e,t,n)=>{let s=n?.frames??fe,r=n?.interval??ye,i=t,o=0,d,y=()=>{e.output.write(a(`\r${" ".repeat(i.length+4)}\r`))},p=()=>{d!==void 0&&(clearInterval(d),d=void 0,y())};return{start:u=>{u!==void 0&&(i=u),d=setInterval(()=>{let L=s[o%s.length];e.output.write(a("\r"),T(L??""),a(` ${i}`)),o++},r)},stop:u=>{p(),u!==void 0&&(i=u)},update:u=>{i=u},succeed:u=>{p(),e.output.writeln(c(C),a(` ${u??i}`))},fail:u=>{p(),e.output.writeln(w(b),a(` ${u??i}`))},warn:u=>{p(),e.output.writeln(A(N),a(` ${u??i}`))},info:u=>{p(),e.output.writeln(W(J),a(` ${u??i}`))}}};export{re as a,ae as b,oe as c,le as d,ue as e,pe as f,de as g,me as h,ce as i};