noskills 4.1.29 → 4.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{approve-UATWGG53.js → approve-5N5LJ2WQ.js} +1 -1
- package/chunks/{ask-5YIOZTBI.js → ask-TR4ZPBU5.js} +1 -1
- package/chunks/{block-IDVJLPNV.js → block-WWW3MXHP.js} +1 -1
- package/chunks/{browser-XCMD2IZQ.js → browser-JYFQKVFU.js} +1 -1
- package/chunks/bun-KVGAHBUF.js +1 -0
- package/chunks/{chunk-52HFDP2R.js → chunk-4IFPLK7L.js} +1 -1
- package/chunks/{chunk-QHS53BRV.js → chunk-5ORUHRWF.js} +1 -1
- package/chunks/{chunk-SOMEQCOS.js → chunk-6C2MLMD6.js} +1 -1
- package/chunks/{chunk-6XR33H6Q.js → chunk-7ADGJB4H.js} +1 -1
- package/chunks/chunk-AB4ZUDV6.js +1 -0
- package/chunks/{chunk-G65TSD56.js → chunk-AT7V3AKV.js} +1 -1
- package/chunks/{chunk-FAK366X2.js → chunk-BLHOTPRB.js} +1 -1
- package/chunks/{chunk-OM4QJ24S.js → chunk-HLQNHWXS.js} +1 -1
- package/chunks/{chunk-FPO2JRU3.js → chunk-HS6FTDDW.js} +1 -1
- package/chunks/{chunk-O3PI76HM.js → chunk-KBNVVXFC.js} +1 -1
- package/chunks/{chunk-TNKUKNM4.js → chunk-LZSLKXJE.js} +1 -1
- package/chunks/{chunk-XHFYREAD.js → chunk-M2ZPJN26.js} +1 -1
- package/chunks/{chunk-MJVACJ6D.js → chunk-OJUA2UZK.js} +1 -1
- package/chunks/chunk-PSXXTDLU.js +1 -0
- package/chunks/{chunk-LEPZPNTN.js → chunk-QEEZKZXM.js} +1 -1
- package/chunks/{chunk-UWD66JGG.js → chunk-RVIPYZ7F.js} +1 -1
- package/chunks/{chunk-SBUQXH6U.js → chunk-S5PUIY3F.js} +1 -1
- package/chunks/{chunk-G2NW625V.js → chunk-TGA7MX5P.js} +1 -1
- package/chunks/{chunk-SG4G3OOO.js → chunk-WV3HK5WR.js} +1 -1
- package/chunks/{claude-code-Z7LYZDY5.js → claude-code-3XV3QOZJ.js} +1 -1
- package/chunks/{concern-JUE2IFQI.js → concern-NGOU3XMP.js} +1 -1
- package/chunks/{deno-H6NPLC5O.js → deno-5VR3ZY4Z.js} +1 -1
- package/chunks/{done-LOYNEBUX.js → done-IBA3FUE5.js} +1 -1
- package/chunks/{init-FMAEQACG.js → init-CPEFD2I3.js} +1 -1
- package/chunks/{invoke-hook-2VRIZ4VU.js → invoke-hook-JZBFLW46.js} +1 -1
- package/chunks/{kiro-C7DKUCGL.js → kiro-IXVNKPRT.js} +1 -1
- package/chunks/{list-U5OS3WZ4.js → list-UT3MSC6R.js} +1 -1
- package/chunks/{mod-RWDPEKPY.js → mod-LUIKS5KC.js} +1 -1
- package/chunks/{next-WEQWWHMJ.js → next-YNV7OZHT.js} +1 -1
- package/chunks/node-MZTU6BAB.js +1 -0
- package/chunks/{ollama-HRLYSKFN.js → ollama-K4QCYLVL.js} +1 -1
- package/chunks/{opencode-QKZUHQHY.js → opencode-QBVD5FAD.js} +1 -1
- package/chunks/{purge-AISADFMA.js → purge-FBZME5ZJ.js} +1 -1
- package/chunks/{reset-2II5XIWI.js → reset-VZO7YXM6.js} +1 -1
- package/chunks/{rule-3UTOQ32B.js → rule-4D2CRBI4.js} +1 -1
- package/chunks/{run-EP6XJQXK.js → run-OVIPWV6U.js} +1 -1
- package/chunks/{spec-BLGJLET3.js → spec-RTBL43T7.js} +1 -1
- package/chunks/{status-K2DRYXDX.js → status-NFBLYJLR.js} +1 -1
- package/chunks/{sync-NR33ZH7R.js → sync-XMUP5YHZ.js} +1 -1
- package/chunks/{watch-DTNAKL6O.js → watch-7DNXJAAQ.js} +1 -1
- package/chunks/{workerd-LKKH32SO.js → workerd-QUMEG65S.js} +1 -1
- package/noskills.js +1 -1
- package/package.json +1 -1
- package/chunks/bun-YFFBDKUJ.js +0 -1
- package/chunks/chunk-C2SQE5AG.js +0 -1
- package/chunks/chunk-D6Q2GR7X.js +0 -1
- package/chunks/node-SMAAGOR3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-5ORUHRWF.js";import"./chunk-7ADGJB4H.js";import{a as P,d as R}from"./chunk-KBNVVXFC.js";import{e as y}from"./chunk-HLQNHWXS.js";import{a as p}from"./chunk-UXRWSNVZ.js";import{e as h,f as S,k as g,o as v}from"./chunk-OJUA2UZK.js";import{c as n,d as c,f as l,g as m,k as d,o as f,q as u,r as w}from"./chunk-4IFPLK7L.js";import{a as i}from"./chunk-2N4GTHXQ.js";import{a as o}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async E=>{let r=f({renderer:w.ansi(),sink:u.stdout()}),s=o.process.cwd(),e=await h(s),a=await g(s);if(e.phase==="SPEC_DRAFT"){if(e.classification===null&&e.spec!==null){let A=(await v(s)).filter(D=>a?.concerns.includes(D.id)??!1);try{await C(s,e,A)}catch{}}let t=y(e);await S(s,t),t.spec!==null&&(await P(s,t.spec,"approved"),await R(s,t.spec,"approved")),r.writeln(m("\u2714")," Spec approved. Phase: ",d("SPEC_APPROVED")),r.writeln("When ready, run ",n(`${p('next --answer="start"',a)}`)," to begin execution.")}else e.phase==="DISCOVERY"&&e.discovery.completed?(r.writeln(c("Discovery complete. Spec draft already generated.")),r.writeln("Review the spec and run ",n(p("approve",a))," again when in SPEC_DRAFT phase.")):r.writeln(l(`Cannot approve in phase: ${e.phase}`));return await r.close(),i(void 0)};export{$ as main};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Ee,b as Ie}from"./chunk-AGPCY6XP.js";import{a as te,b as C,c as M,d as G,f as L,g as Ae,h as be,j as ke,k as re,l as Pe,o as ne,p as Re,q as oe,r as _e}from"./chunk-52HFDP2R.js";import{a as Fe}from"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as Le,b as D}from"./chunk-2N4GTHXQ.js";import{d as ie}from"./chunk-SOMEQCOS.js";import{a as T}from"./chunk-FPO2JRU3.js";import"./chunk-SG4G3OOO.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{d as ee}from"./chunk-DXB73IDG.js";var Ne=e=>({rawMessage:e.rawMessage??e.message,args:e.args??[],datetime:e.datetime??new Date,properties:e.properties??{},context:e.context??{},...e});var d=e=>typeof e=="string"?e.split(".").filter(Boolean):e,V=(e,t=".")=>e.join(t),w=e=>e.join("\0");var Oe=(e,t)=>e.length<t.length?!1:t.every((r,n)=>e[n]===r);var De=(e,t)=>{let r=[];for(let n of t.values()){let i=d(n.category);Oe(e,i)&&r.push(n)}return r.sort((n,i)=>{let o=d(n.category).length;return d(i.category).length-o}),r};var j=(e,t)=>{let r=typeof t=="string"?[t]:t;return[...e,...r]};var K={};ee(K,{configure:()=>Tt,configureSync:()=>Ct,getEffectiveConfig:()=>ue,getFilterNames:()=>Rt,getLoggerCategories:()=>_t,getRegistryState:()=>St,getSinkNames:()=>Pt,isConfigured:()=>ht,registerFilter:()=>At,registerLogger:()=>kt,registerLoggerCacheClear:()=>le,registerSink:()=>wt,reset:()=>ze,resetSync:()=>Ke,unregisterFilter:()=>bt,unregisterSink:()=>Lt});var g={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},Me={[g.Trace]:"Trace",[g.Debug]:"Debug",[g.Info]:"Info",[g.Notice]:"Notice",[g.Warning]:"Warning",[g.Error]:"Error",[g.Critical]:"Critical",[g.Alert]:"Alert",[g.Emergency]:"Emergency"};var $,z,pt=()=>{if($===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&($=new e)}catch{}return $},mt=()=>{if(z===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(z=new e)}catch{}return z},Ge,Ve,R=e=>{Ge=e},se=e=>{Ve=e},ge=()=>{$=void 0,z=void 0},dt=()=>Ge??pt(),yt=()=>Ve??mt();var je=()=>{let e=dt();return e?e.getStore()??{}:{}};var xt=()=>{let e=yt();return e?e.getStore()??[]:[]},$e=e=>{let t=xt();return t.length===0?e:j(t,e)};var ce=null,le=e=>{ce=e},u=null,y=new Map,St=()=>u,ht=()=>u!==null,Tt=async e=>{(e.reset||u===null)&&await ze(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},Ct=e=>{(e.reset||u===null)&&Ke(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},ze=async()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.dispose=="function"?await t.dispose():typeof t[Symbol.asyncDispose]=="function"&&await t[Symbol.asyncDispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},Ke=()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.disposeSync=="function"?t.disposeSync():typeof t[Symbol.dispose]=="function"&&t[Symbol.dispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},ue=e=>{let t=w(e),r=y.get(t);if(r)return r;let n={sinks:[],filters:[],lowestLevel:g.Info};if(!u)return n;let i=De(e,u.loggers),o=new Set,a=new Set,l=!1;for(let s of i){if(s.sinks&&s.sinks.length>0){s.parentSinks==="override"&&o.clear();for(let c of s.sinks)o.add(c)}if(s.filters)for(let c of s.filters)a.add(c);!l&&s.lowestLevel!==void 0&&(n.lowestLevel=s.lowestLevel,l=!0)}for(let s of o){let c=u.sinks.get(s);c&&n.sinks.push(c)}for(let s of a){let c=u.filters.get(s);c&&n.filters.push(c)}return y.set(t,n),n},wt=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.sinks.set(e,t),y.clear()},Lt=e=>{u&&(u.sinks.delete(e),y.clear())},At=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.filters.set(e,t),y.clear()},bt=e=>{u&&(u.filters.delete(e),y.clear())},kt=e=>{if(!u)throw new Error("Logging not configured. Call configure() first.");let t=d(e.category),r=w(t);u.loggers.set(r,{...e,category:t}),y.clear()},Pt=()=>u?Array.from(u.sinks.keys()):[],Rt=()=>u?Array.from(u.filters.keys()):[],_t=()=>u?Array.from(u.loggers.values()).map(e=>d(e.category)):[];var W={};ee(W,{DEFAULT_LEVEL:()=>Ft,Logger:()=>_,clearLoggerCache:()=>We,current:()=>It,getLogger:()=>Et});var Ft=g.Info,_=class e{category;parent;#e;#t=null;constructor(t,r=null,n={}){this.category=d(t),this.parent=r,this.#e=n}#r(){return this.#t===null&&(this.#t=ue(this.category)),this.#t}getChild(t){let r=j(this.category,d(t));return new e(r,this,this.#e)}with(t){return new e(this.category,this.parent,{...this.#e,...t})}get loggerName(){return V(this.category)}asString(t,r=!1){return typeof t=="string"?r?`"${t}"`:t:t===null||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"||typeof t>"u"||typeof t=="symbol"?String(t):t instanceof Error?t.stack:t!==null&&typeof t=="object"?Array.isArray(t)?JSON.stringify(t):`{${Object.entries(t).map(([n,i])=>`"${n}":${this.asString(i,!0)}`).join(",")}}`:"undefined"}async log(t,r,...n){let i=this.#r();if(t<i.lowestLevel)return r instanceof Function?void 0:r;let o,a;r instanceof Function?(o=r(),a=this.asString(o)):a=this.asString(r);let l=je(),s=Ne({message:a,rawMessage:a,args:n,datetime:new Date,severity:t,category:this.category,properties:this.#e,context:l});for(let c of i.filters)if(!c(s))return r instanceof Function?o:r;return i.sinks.length>0&&await Promise.all(i.sinks.map(c=>c(s))),r instanceof Function?o:r}debug(t,...r){return this.log(g.Debug,t,...r)}info(t,...r){return this.log(g.Info,t,...r)}warn(t,...r){return this.log(g.Warning,t,...r)}error(t,...r){return this.log(g.Error,t,...r)}critical(t,...r){return this.log(g.Critical,t,...r)}emergency(t,...r){return this.log(g.Emergency,t,...r)}alert(t,...r){return this.log(g.Alert,t,...r)}notice(t,...r){return this.log(g.Notice,t,...r)}trace(t,...r){return this.log(g.Trace,t,...r)}},fe=new Map,Et=e=>{let t=$e(d(e)),r=w(t),n=fe.get(r);return n||(n=new _(t),fe.set(r,n)),n},We=()=>{fe.clear()};le(We);var It=new _(["default"]);var B={};ee(B,{fingersCrossedSink:()=>Kt,getBufferedSink:()=>zt,getOutputSink:()=>jt,getRecordCollectorSink:()=>Ue,getTestSink:()=>Wt,withFilter:()=>$t});var Nt={[g.Trace]:"TRCE",[g.Debug]:"DBUG",[g.Info]:"INFO",[g.Notice]:"NOTC",[g.Warning]:"WARN",[g.Error]:"ERRO",[g.Critical]:"CRIT",[g.Alert]:"ALRT",[g.Emergency]:"EMRG"};var Ot=(e,t)=>{if(t==="none")return"";if(typeof t=="function")return t(e);let r=e.toISOString(),n=r.slice(0,10),i=r.slice(11,19),o=r.slice(19);switch(t){case"rfc3339":return r;case"date-time-timezone":case void 0:return`${n} ${i}${o}`;case"date-time":return`${n} ${i}`;case"time-timezone":return`${i}${o}`;case"time":return i;case"date":return n}},Dt=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Mt=(e,t)=>{let r={...t,...e},n=Object.entries(r);return n.length===0?"":" "+n.map(([i,o])=>{let a=typeof o=="string"?o:Dt(o);return`${i}=${a}`}).join(" ")};var Gt=(e,t)=>{switch(e){case g.Trace:return G(ke(t));case g.Debug:return Pe(t);case g.Info:return Ae(t);case g.Notice:return re(t);case g.Warning:return be(t);case g.Error:return L(t);case g.Critical:return M(L(t));case g.Alert:return M(L(t));case g.Emergency:return M(L(t));default:return C(t)}},Be=e=>{let t=Ot(e.datetime,"date-time-timezone"),r=Nt[e.severity]??"????",n=e.category.length>0?V(e.category):"",i=Mt(e.properties,e.context),o=[];return t&&o.push(G(t),C(" ")),o.push(Gt(e.severity,r),C(" ")),n&&o.push(re(`[${n}]`),C(" ")),e.severity>=g.Error?o.push(L(e.message)):o.push(C(e.message)),i.trim()&&o.push(C(" "),G(i.trim())),o};var jt=(e,t)=>{let r=t?.formatter??Be;return n=>{let i=r(n);e.writeln(...i)}},$t=(e,t)=>r=>{if(t(r))return e(r)},zt=(e,t={})=>{let{maxSize:r=100,flushIntervalMs:n=5e3}=t,i=[],o=null,a=async()=>{if(i.length===0)return;let c=i;i=[],o&&(clearTimeout(o),o=null),await Promise.all(c.map(p=>e(p)))},l=()=>{o===null&&(o=setTimeout(()=>{o=null,a().catch(()=>{})},n))},s=async c=>{i.push(c),i.length>=r?await a():l()};return s.flush=a,s},Kt=(e,t={})=>{let{triggerLevel:r=17,maxBufferSize:n=1e3}=t,i=[],o=!1,a=async()=>{let c=i;i=[],o=!0,await Promise.all(c.map(p=>e(p)))},l=()=>{i=[],o=!1},s=async c=>{if(o){await e(c);return}if(c.severity>=r){i.push(c),await a();return}i.push(c),i.length>n&&i.shift()};return s.flush=a,s.clear=l,s},Ue=()=>{let e=[];return{sink:r=>{e.push(r)},records:e}},Wt=Ue;var Ye=typeof globalThis=="object"?globalThis:global;var v="1.9.0";var Xe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ut(e){var t=new Set([e]),r=new Set,n=e.match(Xe);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(s){return s===e};function o(l){return r.add(l),!1}function a(l){return t.add(l),!0}return function(s){if(t.has(s))return!0;if(r.has(s))return!1;var c=s.match(Xe);if(!c)return o(s);var p={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return p.prerelease!=null||i.major!==p.major?o(s):i.major===0?i.minor===p.minor&&i.patch<=p.patch?a(s):o(s):i.minor<=p.minor?a(s):o(s)}}var qe=Ut(v);var Yt=v.split(".")[0],F=Symbol.for("opentelemetry.js.api."+Yt),E=Ye;function A(e,t,r,n){var i;n===void 0&&(n=!1);var o=E[F]=(i=E[F])!==null&&i!==void 0?i:{version:v};if(!n&&o[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(o.version!==v){var a=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+e+" does not match previously registered API v"+v);return r.error(a.stack||a.message),!1}return o[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+v+"."),!0}function S(e){var t,r,n=(t=E[F])===null||t===void 0?void 0:t.version;if(!(!n||!qe(n)))return(r=E[F])===null||r===void 0?void 0:r[e]}function b(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+v+".");var r=E[F];r&&delete r[e]}var Xt=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},qt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},He=function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("verbose",this._namespace,t)},e}();function I(e,t,r){var n=S("diag");if(n)return r.unshift(t),n[e].apply(n,qt([],Xt(r),!1))}var m;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(m||(m={}));function Je(e,t){e<m.NONE?e=m.NONE:e>m.ALL&&(e=m.ALL),t=t||{};function r(n,i){var o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var Ht=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Jt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Qt="diag",k=function(){function e(){function t(i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var l=S("diag");if(l)return l[i].apply(l,Jt([],Ht(o),!1))}}var r=this,n=function(i,o){var a,l,s;if(o===void 0&&(o={logLevel:m.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=c.stack)!==null&&a!==void 0?a:c.message),!1}typeof o=="number"&&(o={logLevel:o});var p=S("diag"),f=Je((l=o.logLevel)!==null&&l!==void 0?l:m.INFO,i);if(p&&!o.suppressOverrideMessage){var x=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+x),f.warn("Current logger will overwrite one already registered from "+x)}return A("diag",f,r,!0)};r.setLogger=n,r.disable=function(){b(Qt,r)},r.createComponentLogger=function(i){return new He(i)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}();function Qe(e){return Symbol.for(e)}var Zt=function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new e(r._currentContext);return i._currentContext.delete(n),i}}return e}(),Ze=new Zt;var er=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},tr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},et=function(){function e(){}return e.prototype.active=function(){return Ze},e.prototype.with=function(t,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,tr([n],er(i),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}();var rr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},nr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},pe="context",or=new et,U=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return A(pe,t,k.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return(i=this._getContextManager()).with.apply(i,nr([t,r,n],rr(o),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return S(pe)||or},e.prototype.disable=function(){this._getContextManager().disable(),b(pe,k.instance())},e}();var Y;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Y||(Y={}));var me="0000000000000000",de="00000000000000000000000000000000",tt={traceId:de,spanId:me,traceFlags:Y.NONE};var h=function(){function e(t){t===void 0&&(t=tt),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e}();var ye=Qe("OpenTelemetry Context Key SPAN");function X(e){return e.getValue(ye)||void 0}function rt(){return X(U.getInstance().active())}function N(e,t){return e.setValue(ye,t)}function nt(e){return e.deleteValue(ye)}function ot(e,t){return N(e,new h(t))}function q(e){var t;return(t=X(e))===null||t===void 0?void 0:t.spanContext()}var ir=/^([0-9a-f]{32})$/i,ar=/^[0-9a-f]{16}$/i;function sr(e){return ir.test(e)&&e!==de}function gr(e){return ar.test(e)&&e!==me}function H(e){return sr(e.traceId)&&gr(e.spanId)}function it(e){return new h(e)}var xe=U.getInstance(),J=function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=xe.active());var i=!!r?.root;if(i)return new h;var o=n&&q(n);return cr(o)&&H(o)?new h(o):new h},e.prototype.startActiveSpan=function(t,r,n,i){var o,a,l;if(!(arguments.length<2)){arguments.length===2?l=r:arguments.length===3?(o=r,l=n):(o=r,a=n,l=i);var s=a??xe.active(),c=this.startSpan(t,o,s),p=N(s,c);return xe.with(p,l,void 0,c)}},e}();function cr(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var lr=new J,at=function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):lr},e}();var st=function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new J},e}();var ur=new st,ve=function(){function e(){}return e.prototype.getTracer=function(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new at(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ur},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)},e}();var Se="trace",gt=function(){function e(){this._proxyTracerProvider=new ve,this.wrapSpanContext=it,this.isSpanContextValid=H,this.deleteSpan=nt,this.getSpan=X,this.getActiveSpan=rt,this.getSpanContext=q,this.setSpan=N,this.setSpanContext=ot}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=A(Se,this._proxyTracerProvider,k.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return S(Se)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){b(Se,k.instance()),this._proxyTracerProvider=new ve},e}();var he=gt.getInstance();var Yn=he.getTracer("@eser/logging");var Te=(e,t,r)=>{let n=e.streamText(t,r);return{name:`ai-text/${e.provider}/${e.modelId}`,readable:new ReadableStream({async start(i){try{for await(let o of n)o.kind==="content_delta"&&i.enqueue(te(o.textDelta));i.close()}catch(o){i.error(o)}}})}};var dr={cc:"claude-code",ol:"ollama",oc:"opencode",oai:"openai",ant:"anthropic",gem:"gemini",vtx:"vertexai"},yr={"claude-code":"Claude Code",ollama:"Ollama",opencode:"OpenCode",kiro:"Kiro",anthropic:"Anthropic API",openai:"OpenAI API",gemini:"Gemini API",vertexai:"Vertex AI"},xr=e=>dr[e]??e,vr=async e=>{if(e){let t=T.process.stderr.getWriter(),r=ne({renderer:_e.ansi(),sink:oe.writable(new WritableStream({async write(n){await t.write(new TextEncoder().encode(String(n.data)))},close(){t.releaseLock()}}))});await K.configure({sinks:{stderr:B.getOutputSink(r)},loggers:[{category:["ai"],lowestLevel:g.Debug,sinks:["stderr"]}]})}return W.getLogger(["ai","ask"])},Sr=async e=>{await e.info("Auto-detecting AI provider...");try{if(await ie`which claude`.noThrow().code()===0)return await e.info("Claude Code detected."),"claude-code"}catch{}try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await e.info("Ollama detected at localhost:11434."),"ollama"}catch{}try{if(await ie`which opencode`.noThrow().code()===0)return await e.info("OpenCode detected."),"opencode"}catch{}if(T.capabilities.env){if(T.env.has("ANTHROPIC_API_KEY"))return await e.info("Anthropic API key detected."),"anthropic";if(T.env.has("OPENAI_API_KEY"))return await e.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / OPENAI_API_KEY.")},hr=async e=>{switch(e){case"claude-code":return(await import("./claude-code-Z7LYZDY5.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-HRLYSKFN.js")).ollamaFactory;case"opencode":return(await import("./opencode-QKZUHQHY.js")).openCodeFactory;case"kiro":return(await import("./kiro-C7DKUCGL.js")).kiroFactory;case"anthropic":return(await import("./anthropic-GKH6HH6J.js")).anthropicFactory;case"openai":return(await import("./openai-ZNKOR4CD.js")).openaiFactory;case"gemini":return(await import("./gemini-Z57NY6WY.js")).geminiFactory;case"vertexai":return(await import("./vertexai-WVENJL2F.js")).vertexaiFactory;default:throw new Error(`Unknown provider: ${e}`)}},lo=async e=>{let t=e??[],r=null,n=null,i=null,o=!1,a=!1,l=[],s=0;for(;s<t.length;){let f=t[s];if(f==="-p"||f==="--provider"){r=t[s+1]??null,s+=2;continue}if(f==="-m"||f==="--model"){n=t[s+1]??null,s+=2;continue}if(f==="--max-tokens"){let x=t[s+1];x!==void 0&&(i=Number(x)),s+=2;continue}if(f==="--json"){o=!0,s+=1;continue}if(f==="-v"||f==="--verbose"){a=!0,s+=1;continue}f.startsWith("-")||l.push(f),s+=1}let c=l.join(" ");if(c.length===0)return D({message:'Usage: ai ask "your prompt" [-p provider] [-m model] [--verbose]',exitCode:1});let p=await vr(a);try{let f=r!==null?xr(r):await Sr(p),x=yr[f]??f,Ce=n??Lr(f);await p.info(`Using ${x} (${Ce})`);let lt=await hr(f),Q=new Ie({factories:[lt]});await Q.addModel("default",{provider:f,model:Ce});let Z=Q.getDefault();if(Z===null)return D({message:"Failed to initialize model",exitCode:1});let we=[Fe("user",c)];if(await p.info(`Sending prompt (${c.length} chars)...`),o){let O=await Z.generateText({messages:we,maxTokens:i??void 0});await p.info(`Response received (${Ee(O).length} chars)`);let P=ne({sink:oe.stdout()});P.writeln(JSON.stringify(O,null,2)),await P.close()}else{let O=Te(Z,{messages:we,maxTokens:i??void 0});await Re().from(O).to(wr()).run();let P=T.process.stdout.getWriter();await P.write(new TextEncoder().encode(`
|
|
1
|
+
import{a as Ee,b as Ie}from"./chunk-AGPCY6XP.js";import{a as te,b as C,c as M,d as G,f as L,g as Ae,h as be,j as ke,k as re,l as Pe,o as ne,p as Re,q as oe,r as _e}from"./chunk-4IFPLK7L.js";import{a as Fe}from"./chunk-5MN3MWQN.js";import"./chunk-OLM5RTFK.js";import{a as Le,b as D}from"./chunk-2N4GTHXQ.js";import{d as ie}from"./chunk-6C2MLMD6.js";import{a as T}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import{d as ee}from"./chunk-DXB73IDG.js";var Ne=e=>({rawMessage:e.rawMessage??e.message,args:e.args??[],datetime:e.datetime??new Date,properties:e.properties??{},context:e.context??{},...e});var d=e=>typeof e=="string"?e.split(".").filter(Boolean):e,V=(e,t=".")=>e.join(t),w=e=>e.join("\0");var Oe=(e,t)=>e.length<t.length?!1:t.every((r,n)=>e[n]===r);var De=(e,t)=>{let r=[];for(let n of t.values()){let i=d(n.category);Oe(e,i)&&r.push(n)}return r.sort((n,i)=>{let o=d(n.category).length;return d(i.category).length-o}),r};var j=(e,t)=>{let r=typeof t=="string"?[t]:t;return[...e,...r]};var K={};ee(K,{configure:()=>Tt,configureSync:()=>Ct,getEffectiveConfig:()=>ue,getFilterNames:()=>Rt,getLoggerCategories:()=>_t,getRegistryState:()=>St,getSinkNames:()=>Pt,isConfigured:()=>ht,registerFilter:()=>At,registerLogger:()=>kt,registerLoggerCacheClear:()=>le,registerSink:()=>wt,reset:()=>ze,resetSync:()=>Ke,unregisterFilter:()=>bt,unregisterSink:()=>Lt});var g={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},Me={[g.Trace]:"Trace",[g.Debug]:"Debug",[g.Info]:"Info",[g.Notice]:"Notice",[g.Warning]:"Warning",[g.Error]:"Error",[g.Critical]:"Critical",[g.Alert]:"Alert",[g.Emergency]:"Emergency"};var $,z,pt=()=>{if($===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&($=new e)}catch{}return $},mt=()=>{if(z===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(z=new e)}catch{}return z},Ge,Ve,R=e=>{Ge=e},se=e=>{Ve=e},ge=()=>{$=void 0,z=void 0},dt=()=>Ge??pt(),yt=()=>Ve??mt();var je=()=>{let e=dt();return e?e.getStore()??{}:{}};var xt=()=>{let e=yt();return e?e.getStore()??[]:[]},$e=e=>{let t=xt();return t.length===0?e:j(t,e)};var ce=null,le=e=>{ce=e},u=null,y=new Map,St=()=>u,ht=()=>u!==null,Tt=async e=>{(e.reset||u===null)&&await ze(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},Ct=e=>{(e.reset||u===null)&&Ke(),u={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=w(r);u.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&R(e.contextLocalStorage),y.clear()},ze=async()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.dispose=="function"?await t.dispose():typeof t[Symbol.asyncDispose]=="function"&&await t[Symbol.asyncDispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},Ke=()=>{if(u)for(let e of u.sinks.values()){let t=e;typeof t.disposeSync=="function"?t.disposeSync():typeof t[Symbol.dispose]=="function"&&t[Symbol.dispose]()}u=null,y.clear(),ce?.(),R(void 0),se(void 0),ge()},ue=e=>{let t=w(e),r=y.get(t);if(r)return r;let n={sinks:[],filters:[],lowestLevel:g.Info};if(!u)return n;let i=De(e,u.loggers),o=new Set,a=new Set,l=!1;for(let s of i){if(s.sinks&&s.sinks.length>0){s.parentSinks==="override"&&o.clear();for(let c of s.sinks)o.add(c)}if(s.filters)for(let c of s.filters)a.add(c);!l&&s.lowestLevel!==void 0&&(n.lowestLevel=s.lowestLevel,l=!0)}for(let s of o){let c=u.sinks.get(s);c&&n.sinks.push(c)}for(let s of a){let c=u.filters.get(s);c&&n.filters.push(c)}return y.set(t,n),n},wt=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.sinks.set(e,t),y.clear()},Lt=e=>{u&&(u.sinks.delete(e),y.clear())},At=(e,t)=>{if(!u)throw new Error("Logging not configured. Call configure() first.");u.filters.set(e,t),y.clear()},bt=e=>{u&&(u.filters.delete(e),y.clear())},kt=e=>{if(!u)throw new Error("Logging not configured. Call configure() first.");let t=d(e.category),r=w(t);u.loggers.set(r,{...e,category:t}),y.clear()},Pt=()=>u?Array.from(u.sinks.keys()):[],Rt=()=>u?Array.from(u.filters.keys()):[],_t=()=>u?Array.from(u.loggers.values()).map(e=>d(e.category)):[];var W={};ee(W,{DEFAULT_LEVEL:()=>Ft,Logger:()=>_,clearLoggerCache:()=>We,current:()=>It,getLogger:()=>Et});var Ft=g.Info,_=class e{category;parent;#e;#t=null;constructor(t,r=null,n={}){this.category=d(t),this.parent=r,this.#e=n}#r(){return this.#t===null&&(this.#t=ue(this.category)),this.#t}getChild(t){let r=j(this.category,d(t));return new e(r,this,this.#e)}with(t){return new e(this.category,this.parent,{...this.#e,...t})}get loggerName(){return V(this.category)}asString(t,r=!1){return typeof t=="string"?r?`"${t}"`:t:t===null||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"||typeof t>"u"||typeof t=="symbol"?String(t):t instanceof Error?t.stack:t!==null&&typeof t=="object"?Array.isArray(t)?JSON.stringify(t):`{${Object.entries(t).map(([n,i])=>`"${n}":${this.asString(i,!0)}`).join(",")}}`:"undefined"}async log(t,r,...n){let i=this.#r();if(t<i.lowestLevel)return r instanceof Function?void 0:r;let o,a;r instanceof Function?(o=r(),a=this.asString(o)):a=this.asString(r);let l=je(),s=Ne({message:a,rawMessage:a,args:n,datetime:new Date,severity:t,category:this.category,properties:this.#e,context:l});for(let c of i.filters)if(!c(s))return r instanceof Function?o:r;return i.sinks.length>0&&await Promise.all(i.sinks.map(c=>c(s))),r instanceof Function?o:r}debug(t,...r){return this.log(g.Debug,t,...r)}info(t,...r){return this.log(g.Info,t,...r)}warn(t,...r){return this.log(g.Warning,t,...r)}error(t,...r){return this.log(g.Error,t,...r)}critical(t,...r){return this.log(g.Critical,t,...r)}emergency(t,...r){return this.log(g.Emergency,t,...r)}alert(t,...r){return this.log(g.Alert,t,...r)}notice(t,...r){return this.log(g.Notice,t,...r)}trace(t,...r){return this.log(g.Trace,t,...r)}},fe=new Map,Et=e=>{let t=$e(d(e)),r=w(t),n=fe.get(r);return n||(n=new _(t),fe.set(r,n)),n},We=()=>{fe.clear()};le(We);var It=new _(["default"]);var B={};ee(B,{fingersCrossedSink:()=>Kt,getBufferedSink:()=>zt,getOutputSink:()=>jt,getRecordCollectorSink:()=>Ue,getTestSink:()=>Wt,withFilter:()=>$t});var Nt={[g.Trace]:"TRCE",[g.Debug]:"DBUG",[g.Info]:"INFO",[g.Notice]:"NOTC",[g.Warning]:"WARN",[g.Error]:"ERRO",[g.Critical]:"CRIT",[g.Alert]:"ALRT",[g.Emergency]:"EMRG"};var Ot=(e,t)=>{if(t==="none")return"";if(typeof t=="function")return t(e);let r=e.toISOString(),n=r.slice(0,10),i=r.slice(11,19),o=r.slice(19);switch(t){case"rfc3339":return r;case"date-time-timezone":case void 0:return`${n} ${i}${o}`;case"date-time":return`${n} ${i}`;case"time-timezone":return`${i}${o}`;case"time":return i;case"date":return n}},Dt=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Mt=(e,t)=>{let r={...t,...e},n=Object.entries(r);return n.length===0?"":" "+n.map(([i,o])=>{let a=typeof o=="string"?o:Dt(o);return`${i}=${a}`}).join(" ")};var Gt=(e,t)=>{switch(e){case g.Trace:return G(ke(t));case g.Debug:return Pe(t);case g.Info:return Ae(t);case g.Notice:return re(t);case g.Warning:return be(t);case g.Error:return L(t);case g.Critical:return M(L(t));case g.Alert:return M(L(t));case g.Emergency:return M(L(t));default:return C(t)}},Be=e=>{let t=Ot(e.datetime,"date-time-timezone"),r=Nt[e.severity]??"????",n=e.category.length>0?V(e.category):"",i=Mt(e.properties,e.context),o=[];return t&&o.push(G(t),C(" ")),o.push(Gt(e.severity,r),C(" ")),n&&o.push(re(`[${n}]`),C(" ")),e.severity>=g.Error?o.push(L(e.message)):o.push(C(e.message)),i.trim()&&o.push(C(" "),G(i.trim())),o};var jt=(e,t)=>{let r=t?.formatter??Be;return n=>{let i=r(n);e.writeln(...i)}},$t=(e,t)=>r=>{if(t(r))return e(r)},zt=(e,t={})=>{let{maxSize:r=100,flushIntervalMs:n=5e3}=t,i=[],o=null,a=async()=>{if(i.length===0)return;let c=i;i=[],o&&(clearTimeout(o),o=null),await Promise.all(c.map(p=>e(p)))},l=()=>{o===null&&(o=setTimeout(()=>{o=null,a().catch(()=>{})},n))},s=async c=>{i.push(c),i.length>=r?await a():l()};return s.flush=a,s},Kt=(e,t={})=>{let{triggerLevel:r=17,maxBufferSize:n=1e3}=t,i=[],o=!1,a=async()=>{let c=i;i=[],o=!0,await Promise.all(c.map(p=>e(p)))},l=()=>{i=[],o=!1},s=async c=>{if(o){await e(c);return}if(c.severity>=r){i.push(c),await a();return}i.push(c),i.length>n&&i.shift()};return s.flush=a,s.clear=l,s},Ue=()=>{let e=[];return{sink:r=>{e.push(r)},records:e}},Wt=Ue;var Ye=typeof globalThis=="object"?globalThis:global;var v="1.9.0";var Xe=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Ut(e){var t=new Set([e]),r=new Set,n=e.match(Xe);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(s){return s===e};function o(l){return r.add(l),!1}function a(l){return t.add(l),!0}return function(s){if(t.has(s))return!0;if(r.has(s))return!1;var c=s.match(Xe);if(!c)return o(s);var p={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return p.prerelease!=null||i.major!==p.major?o(s):i.major===0?i.minor===p.minor&&i.patch<=p.patch?a(s):o(s):i.minor<=p.minor?a(s):o(s)}}var qe=Ut(v);var Yt=v.split(".")[0],F=Symbol.for("opentelemetry.js.api."+Yt),E=Ye;function A(e,t,r,n){var i;n===void 0&&(n=!1);var o=E[F]=(i=E[F])!==null&&i!==void 0?i:{version:v};if(!n&&o[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(o.version!==v){var a=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+e+" does not match previously registered API v"+v);return r.error(a.stack||a.message),!1}return o[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+v+"."),!0}function S(e){var t,r,n=(t=E[F])===null||t===void 0?void 0:t.version;if(!(!n||!qe(n)))return(r=E[F])===null||r===void 0?void 0:r[e]}function b(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+v+".");var r=E[F];r&&delete r[e]}var Xt=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},qt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},He=function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return I("verbose",this._namespace,t)},e}();function I(e,t,r){var n=S("diag");if(n)return r.unshift(t),n[e].apply(n,qt([],Xt(r),!1))}var m;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(m||(m={}));function Je(e,t){e<m.NONE?e=m.NONE:e>m.ALL&&(e=m.ALL),t=t||{};function r(n,i){var o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var Ht=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},Jt=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Qt="diag",k=function(){function e(){function t(i){return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var l=S("diag");if(l)return l[i].apply(l,Jt([],Ht(o),!1))}}var r=this,n=function(i,o){var a,l,s;if(o===void 0&&(o={logLevel:m.INFO}),i===r){var c=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=c.stack)!==null&&a!==void 0?a:c.message),!1}typeof o=="number"&&(o={logLevel:o});var p=S("diag"),f=Je((l=o.logLevel)!==null&&l!==void 0?l:m.INFO,i);if(p&&!o.suppressOverrideMessage){var x=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+x),f.warn("Current logger will overwrite one already registered from "+x)}return A("diag",f,r,!0)};r.setLogger=n,r.disable=function(){b(Qt,r)},r.createComponentLogger=function(i){return new He(i)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}();function Qe(e){return Symbol.for(e)}var Zt=function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=function(n){var i=new e(r._currentContext);return i._currentContext.delete(n),i}}return e}(),Ze=new Zt;var er=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},tr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},et=function(){function e(){}return e.prototype.active=function(){return Ze},e.prototype.with=function(t,r,n){for(var i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return r.call.apply(r,tr([n],er(i),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}();var rr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},nr=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},pe="context",or=new et,U=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return A(pe,t,k.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return(i=this._getContextManager()).with.apply(i,nr([t,r,n],rr(o),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return S(pe)||or},e.prototype.disable=function(){this._getContextManager().disable(),b(pe,k.instance())},e}();var Y;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Y||(Y={}));var me="0000000000000000",de="00000000000000000000000000000000",tt={traceId:de,spanId:me,traceFlags:Y.NONE};var h=function(){function e(t){t===void 0&&(t=tt),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e}();var ye=Qe("OpenTelemetry Context Key SPAN");function X(e){return e.getValue(ye)||void 0}function rt(){return X(U.getInstance().active())}function N(e,t){return e.setValue(ye,t)}function nt(e){return e.deleteValue(ye)}function ot(e,t){return N(e,new h(t))}function q(e){var t;return(t=X(e))===null||t===void 0?void 0:t.spanContext()}var ir=/^([0-9a-f]{32})$/i,ar=/^[0-9a-f]{16}$/i;function sr(e){return ir.test(e)&&e!==de}function gr(e){return ar.test(e)&&e!==me}function H(e){return sr(e.traceId)&&gr(e.spanId)}function it(e){return new h(e)}var xe=U.getInstance(),J=function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=xe.active());var i=!!r?.root;if(i)return new h;var o=n&&q(n);return cr(o)&&H(o)?new h(o):new h},e.prototype.startActiveSpan=function(t,r,n,i){var o,a,l;if(!(arguments.length<2)){arguments.length===2?l=r:arguments.length===3?(o=r,l=n):(o=r,a=n,l=i);var s=a??xe.active(),c=this.startSpan(t,o,s),p=N(s,c);return xe.with(p,l,void 0,c)}},e}();function cr(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var lr=new J,at=function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,i){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):lr},e}();var st=function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new J},e}();var ur=new st,ve=function(){function e(){}return e.prototype.getTracer=function(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new at(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:ur},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)},e}();var Se="trace",gt=function(){function e(){this._proxyTracerProvider=new ve,this.wrapSpanContext=it,this.isSpanContextValid=H,this.deleteSpan=nt,this.getSpan=X,this.getActiveSpan=rt,this.getSpanContext=q,this.setSpan=N,this.setSpanContext=ot}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=A(Se,this._proxyTracerProvider,k.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return S(Se)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){b(Se,k.instance()),this._proxyTracerProvider=new ve},e}();var he=gt.getInstance();var Yn=he.getTracer("@eser/logging");var Te=(e,t,r)=>{let n=e.streamText(t,r);return{name:`ai-text/${e.provider}/${e.modelId}`,readable:new ReadableStream({async start(i){try{for await(let o of n)o.kind==="content_delta"&&i.enqueue(te(o.textDelta));i.close()}catch(o){i.error(o)}}})}};var dr={cc:"claude-code",ol:"ollama",oc:"opencode",oai:"openai",ant:"anthropic",gem:"gemini",vtx:"vertexai"},yr={"claude-code":"Claude Code",ollama:"Ollama",opencode:"OpenCode",kiro:"Kiro",anthropic:"Anthropic API",openai:"OpenAI API",gemini:"Gemini API",vertexai:"Vertex AI"},xr=e=>dr[e]??e,vr=async e=>{if(e){let t=T.process.stderr.getWriter(),r=ne({renderer:_e.ansi(),sink:oe.writable(new WritableStream({async write(n){await t.write(new TextEncoder().encode(String(n.data)))},close(){t.releaseLock()}}))});await K.configure({sinks:{stderr:B.getOutputSink(r)},loggers:[{category:["ai"],lowestLevel:g.Debug,sinks:["stderr"]}]})}return W.getLogger(["ai","ask"])},Sr=async e=>{await e.info("Auto-detecting AI provider...");try{if(await ie`which claude`.noThrow().code()===0)return await e.info("Claude Code detected."),"claude-code"}catch{}try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await e.info("Ollama detected at localhost:11434."),"ollama"}catch{}try{if(await ie`which opencode`.noThrow().code()===0)return await e.info("OpenCode detected."),"opencode"}catch{}if(T.capabilities.env){if(T.env.has("ANTHROPIC_API_KEY"))return await e.info("Anthropic API key detected."),"anthropic";if(T.env.has("OPENAI_API_KEY"))return await e.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / OPENAI_API_KEY.")},hr=async e=>{switch(e){case"claude-code":return(await import("./claude-code-3XV3QOZJ.js")).claudeCodeFactory;case"ollama":return(await import("./ollama-K4QCYLVL.js")).ollamaFactory;case"opencode":return(await import("./opencode-QBVD5FAD.js")).openCodeFactory;case"kiro":return(await import("./kiro-IXVNKPRT.js")).kiroFactory;case"anthropic":return(await import("./anthropic-GKH6HH6J.js")).anthropicFactory;case"openai":return(await import("./openai-ZNKOR4CD.js")).openaiFactory;case"gemini":return(await import("./gemini-Z57NY6WY.js")).geminiFactory;case"vertexai":return(await import("./vertexai-WVENJL2F.js")).vertexaiFactory;default:throw new Error(`Unknown provider: ${e}`)}},lo=async e=>{let t=e??[],r=null,n=null,i=null,o=!1,a=!1,l=[],s=0;for(;s<t.length;){let f=t[s];if(f==="-p"||f==="--provider"){r=t[s+1]??null,s+=2;continue}if(f==="-m"||f==="--model"){n=t[s+1]??null,s+=2;continue}if(f==="--max-tokens"){let x=t[s+1];x!==void 0&&(i=Number(x)),s+=2;continue}if(f==="--json"){o=!0,s+=1;continue}if(f==="-v"||f==="--verbose"){a=!0,s+=1;continue}f.startsWith("-")||l.push(f),s+=1}let c=l.join(" ");if(c.length===0)return D({message:'Usage: ai ask "your prompt" [-p provider] [-m model] [--verbose]',exitCode:1});let p=await vr(a);try{let f=r!==null?xr(r):await Sr(p),x=yr[f]??f,Ce=n??Lr(f);await p.info(`Using ${x} (${Ce})`);let lt=await hr(f),Q=new Ie({factories:[lt]});await Q.addModel("default",{provider:f,model:Ce});let Z=Q.getDefault();if(Z===null)return D({message:"Failed to initialize model",exitCode:1});let we=[Fe("user",c)];if(await p.info(`Sending prompt (${c.length} chars)...`),o){let O=await Z.generateText({messages:we,maxTokens:i??void 0});await p.info(`Response received (${Ee(O).length} chars)`);let P=ne({sink:oe.stdout()});P.writeln(JSON.stringify(O,null,2)),await P.close()}else{let O=Te(Z,{messages:we,maxTokens:i??void 0});await Re().from(O).to(wr()).run();let P=T.process.stdout.getWriter();await P.write(new TextEncoder().encode(`
|
|
2
2
|
`)),P.releaseLock()}return await Q.close(),Le(void 0)}catch(f){let x=f instanceof Error?f.message:String(f);return await p.error(x),a&&f instanceof Error&&f.cause!==void 0&&await p.debug(`Cause: ${String(f.cause)}`),D({message:x,exitCode:1})}},Tr=12,Cr=e=>new Promise(t=>setTimeout(t,e)),wr=(e=Tr)=>{let t=new TextEncoder;return{name:"typewriter",writable:new WritableStream({async write(r){let n=String(r.data),i=T.process.stdout.getWriter();for(let o of n)await i.write(t.encode(o)),await Cr(e);i.releaseLock()}})}},Lr=e=>{switch(e){case"claude-code":return"claude-sonnet-4-20250514";case"ollama":return"llama3";case"opencode":return"default";case"kiro":return"default";case"anthropic":return"claude-sonnet-4-20250514";case"openai":return"gpt-4o";case"gemini":return"gemini-2.0-flash";case"vertexai":return"gemini-2.0-flash";default:return"default"}};export{lo as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as k}from"./chunk-
|
|
1
|
+
import{g as k}from"./chunk-HLQNHWXS.js";import{a as g}from"./chunk-UXRWSNVZ.js";import{e as w,f,k as h}from"./chunk-OJUA2UZK.js";import{c as i,d as m,f as l,h as c,o as p,q as d,r as u}from"./chunk-4IFPLK7L.js";import{a as o,b as n}from"./chunk-2N4GTHXQ.js";import{a}from"./chunk-HS6FTDDW.js";import"./chunk-WV3HK5WR.js";import"./chunk-FDZP7B5Y.js";import"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var $=async b=>{let e=p({renderer:u.ansi(),sink:d.stdout()}),s=a.process.cwd(),r=b?.join(" ")??"No reason given",t=await w(s),x=await h(s);if(t.phase!=="EXECUTING")return e.writeln(l(`Cannot block in phase: ${t.phase}`)),await e.close(),n({exitCode:1});let y=k(t,r);return await f(s,y),e.writeln(c("\u26A0")," Spec blocked: ",m(r)),e.writeln("Resolve with: ",i(`${g('next --answer="resolution"',x)}`)),await e.close(),o(void 0)};export{$ as main};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s}from"./chunk-FDZP7B5Y.js";import{a as r}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var o={fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},t=e=>()=>{throw new r(e,"browser")},n=()=>{let e=t("fs");return{readFile:e,readTextFile:e,writeFile:e,writeTextFile:e,exists:e,stat:e,lstat:e,mkdir:e,ensureDir:e,remove:e,readDir:e,copyFile:e,rename:e,makeTempDir:e,realPath:e,watch:e,walk:e,chmod:e}},i=()=>{let e=t("exec");return{spawn:e,exec:e,execJson:e,spawnChild:e}},a=()=>{let e=t("process");return{exit:e,setExitCode:e,cwd:e,chdir:e,hostname:e,execPath:e,get args(){throw new r("process","browser")},get pid(){throw new r("process","browser")},get stdin(){throw new r("process","browser")},get stdout(){throw new r("process","browser")},get stderr(){throw new r("process","browser")}}},c=()=>({get:()=>{},set:()=>{},delete:()=>{},has:()=>!1,toObject:()=>({})}),l=()=>({name:"browser",version:globalThis.navigator?.userAgent??"unknown",capabilities:o,fs:n(),path:s,exec:i(),env:c(),process:a()});export{o as BROWSER_CAPABILITIES,l as createBrowserRuntime};
|
|
1
|
+
import{b as s}from"./chunk-FDZP7B5Y.js";import{a as r}from"./chunk-ACQUINWH.js";import"./chunk-DXB73IDG.js";var o={fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},t=e=>()=>{throw new r(e,"browser")},n=()=>{let e=t("fs");return{readFile:e,readTextFile:e,writeFile:e,writeTextFile:e,exists:e,stat:e,lstat:e,mkdir:e,ensureDir:e,remove:e,readDir:e,copyFile:e,rename:e,makeTempDir:e,realPath:e,watch:e,walk:e,chmod:e}},i=()=>{let e=t("exec");return{spawn:e,exec:e,execJson:e,spawnChild:e}},a=()=>{let e=t("process");return{exit:e,setExitCode:e,cwd:e,chdir:e,hostname:e,execPath:e,get args(){throw new r("process","browser")},get pid(){throw new r("process","browser")},get stdin(){throw new r("process","browser")},get stdout(){throw new r("process","browser")},get stderr(){throw new r("process","browser")},isTerminal(){return!1},setStdinRaw(){throw new r("process","browser")}}},c=()=>({get:()=>{},set:()=>{},delete:()=>{},has:()=>!1,toObject:()=>({})}),l=()=>({name:"browser",version:globalThis.navigator?.userAgent??"unknown",capabilities:o,fs:n(),path:s,exec:i(),env:c(),process:a()});export{o as BROWSER_CAPABILITIES,l as createBrowserRuntime};
|
|
@@ -0,0 +1 @@
|
|
|
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 d from"node:process";import{Readable as x,Writable as k}from"node:stream";var R={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!1},E=()=>{let r=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 s=await n.readFile(e,{signal:t?.signal});return new Uint8Array(s)}catch(s){return a(s,e)}},async readTextFile(e,t){try{return await n.readFile(e,{encoding:"utf-8",signal:t?.signal})}catch(s){return a(s,e)}},async writeFile(e,t,s){let u=s?.append?"a":"w";await n.writeFile(e,t,{signal:s?.signal,mode:s?.mode,flag:u})},async writeTextFile(e,t,s){let u=s?.append?"a":"w";await n.writeFile(e,t,{encoding:"utf-8",signal:s?.signal,mode:s?.mode,flag:u})},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 a(t,e)}},async lstat(e){try{let t=await n.lstat(e);return r(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(s){a(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){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(),s=e?.prefix??"",u=e?.suffix??"",i=await n.mkdtemp(o.join(t,s));if(u){let c=i+u;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 s=t?.recursive??!0,u=[],i=[],c=[],l=!1,P=m=>{l||(c.length>0?c.shift()({value:m,done:!1}):i.push(m))};for(let m of e)try{let h=O.watch(m,{recursive:s},(y,f)=>{f!==null&&P({kind:y==="rename"?"create":"modify",paths:[o.join(m,f)]})});u.push(h)}catch{}return{close:()=>{l=!0;for(let m of u)m.close();for(let m of c)m({value:void 0,done:!0});c=[]},[Symbol.asyncIterator]:()=>({next:()=>l?Promise.resolve({value:void 0,done:!0}):i.length>0?Promise.resolve({value:i.shift(),done:!1}):new Promise(m=>{c.push(m)})})}},async chmod(e,t){await n.chmod(e,t)},async*walk(e,t){let s=t?.includeDirs??!0,u=t?.includeFiles??!0,i=t?.exts,c=t?.skip,l=async function*(P){let m=await n.readdir(P,{withFileTypes:!0});for(let h of m){let y=o.join(P,h.name);if(c?.some(p=>p.test(y)))continue;let f=h.isSymbolicLink();if(h.isDirectory())s&&(yield{path:y,name:h.name,isFile:!1,isDirectory:!0,isSymlink:f}),yield*l(y);else if(h.isFile()||f){if(!u||i&&!i.some(p=>h.name.endsWith(p.startsWith(".")?p:`.${p}`)))continue;yield{path:y,name:h.name,isFile:h.isFile(),isDirectory:!1,isSymlink:f}}}};yield*l(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 r=>{if(!r)return new Uint8Array(0);let a=[],e=r.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),s=new Uint8Array(t),u=0;for(let i of a)s.set(i,u),u+=i.length;return s},A=()=>({async spawn(r,a=[],e){let[t,s,u]=F(e),i=Bun.spawn([r,...a],{cwd:e?.cwd,env:e?.env,stdin:t,stdout:s,stderr:u}),[c,l,P]=await Promise.all([i.exited,g(i.stdout),g(i.stderr)]);return{success:c===0,code:c,stdout:l,stderr:P}},async exec(r,a=[],e){let t=await this.spawn(r,a,e);if(!t.success){let s=new TextDecoder().decode(t.stderr);throw new b(r,t.code,s)}return new TextDecoder().decode(t.stdout).trim()},async execJson(r,a=[],e){let t=await this.exec(r,a,e);return JSON.parse(t)},spawnChild(r,a=[],e){let[t,s,u]=F(e),i=Bun.spawn([r,...a],{cwd:e?.cwd,env:e?.env,stdin:t,stdout:s,stderr:u}),c=i.exited.then(l=>({success:l===0,code:l,signal:void 0}));return{pid:i.pid,stdin:i.stdin,stdout:i.stdout,stderr:i.stderr,status:c,output:async()=>{let[l,P,m]=await Promise.all([c,g(i.stdout),g(i.stderr)]);return{success:l.success,code:l.code,stdout:P,stderr:m}},kill:l=>{i.kill(l)}}}}),T=()=>({get(r){return d.env[r]},set(r,a){d.env[r]=a},delete(r){delete d.env[r]},has(r){return r in d.env},toObject(){let r={};for(let[a,e]of Object.entries(d.env))e!==void 0&&(r[a]=e);return r}}),W=()=>({exit(r){d.exit(r)},setExitCode(r){d.exitCode=r},cwd(){return d.cwd()},chdir(r){d.chdir(r)},hostname(){return w.hostname()},execPath(){return d.execPath},args:d.argv.slice(2),pid:d.pid,stdin:x.toWeb(d.stdin),stdout:k.toWeb(d.stdout),stderr:k.toWeb(d.stderr),isTerminal(r){switch(r){case"stdin":return d.stdin.isTTY===!0;case"stdout":return d.stdout.isTTY===!0;case"stderr":return d.stderr.isTTY===!0}},setStdinRaw(r){d.stdin.setRawMode(r)}}),M=()=>{let r=E(),a=S(),e=A(),t=T(),s=W();return{name:"bun",version:Bun.version,capabilities:R,fs:r,path:a,exec:e,env:t,process:s}};export{R as BUN_CAPABILITIES,M as createBunRuntime};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-HS6FTDDW.js";import{d as G}from"./chunk-DXB73IDG.js";var y=e=>e.map(n=>typeof n=="string"?X(n):n),X=e=>({kind:"text",value:e}),se=(...e)=>({kind:"bold",children:y(e)}),le=(...e)=>({kind:"dim",children:y(e)});var pe=(...e)=>({kind:"group",children:y(e)});var g=(e,...n)=>({kind:"color",color:e,children:y(n)}),ue=(...e)=>g("red",...e),de=(...e)=>g("green",...e),ce=(...e)=>g("yellow",...e),me=(...e)=>g("blue",...e),ye=(...e)=>g("magenta",...e),he=(...e)=>g("cyan",...e),fe=(...e)=>g("gray",...e);var ke=(e,n)=>({kind:"table",headers:y(e),rows:n.map(r=>y(r))});var Se=(e,...n)=>({kind:"alert",level:e,children:y(n)}),h=e=>{switch(e.kind){case"text":return e.value.length;case"newline":return 1;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.reduce((n,r)=>n+h(r),0);case"code-block":return e.value.length;case"table":case"list":return 0;case"gauge":{let n=e.width??20,r=e.label?` ${e.label}`:"";return n+` ${e.percent}%`.length+r.length}case"separator":return 0;case"alert":return 2+e.children.reduce((n,r)=>n+h(r),0)}};var w=(e,n)=>{let r=typeof e=="string"?"text":e instanceof Uint8Array?"bytes":"structured";return{data:e,meta:{timestamp:Date.now(),kind:r,channel:"stdout",...n}}};var E=e=>{switch(e.kind){case"text":return e.value;case"newline":return`
|
|
2
2
|
`;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return e.children.map(E).join("");case"code-block":return e.value.split(`
|
|
3
3
|
`).map(n=>` ${n}`).join(`
|
|
4
4
|
`)+`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-7ADGJB4H.js";import{d}from"./chunk-OJUA2UZK.js";import{a as l}from"./chunk-HS6FTDDW.js";var h=c=>{let n=c.split(/\n/).flatMap(i=>i.trim().length>0?[i.trim()]:[]);return n.length>1?n:c.split(/\.\s+|;\s+/).map(i=>i.trim()).filter(i=>i.length>5)},v=c=>{let n=[],i=c.find(t=>t.questionId==="ambition");if(i!==void 0){let t=i.answer,e=t.match(/10[- ]?star[:\s]+(.+)/i),r=e!==null?e[1].trim():t.length>120?t.slice(0,120)+"...":t,p=r.charAt(0).toUpperCase()+r.slice(1);n.push(p)}let o=c.find(t=>t.questionId==="verification");if(o!==void 0){let t=h(o.answer);for(let e of t){let r=e.toLowerCase();r.startsWith("run ")||r.startsWith("check ")?n.push(`Test: ${e}`):n.push(e)}}return n.length===0&&n.push("_Tasks need to be defined before execution. Add tasks manually or run discovery with more detail._"),n},w=(c,n)=>{let i={};if(n===null){for(let o of c.specSections)i[o]=!1;return i}for(let o of c.specSections){let t=o.toLowerCase();t.includes("design")||t.includes("mobile")||t.includes("layout")||t.includes("interaction")?i[o]=n.involvesUI:t.includes("contributor")||t.includes("public api")||t.includes("api surface")?i[o]=n.involvesPublicAPI:t.includes("migration")||t.includes("deprecation")||t.includes("backward")||t.includes("compatibility")?i[o]=n.involvesMigration:t.includes("audit")||t.includes("access control")||t.includes("data handling")?i[o]=n.involvesDataHandling:i[o]=!0}return i},g=(c,n,i,o,t)=>{let e=[];e.push(`# Spec: ${c}`),e.push(""),e.push("## Status: draft"),e.push(""),i.length>0&&(e.push(`## Concerns: ${i.map(s=>s.id).join(", ")}`),e.push("")),e.push("## Discovery Answers"),e.push("");for(let s of n)e.push(`### ${s.questionId}`),e.push(""),e.push(s.answer),e.push("");for(let s of i)if(s.specSections.length>0){let a=w(s,t??null);for(let f of s.specSections)a[f]!==!1&&(e.push(`## ${f} (${s.id})`),e.push(""),e.push("_To be addressed during execution._"),e.push(""))}if(o.length>0){e.push("## Decisions"),e.push(""),e.push("| # | Decision | Choice | Promoted |"),e.push("|---|----------|--------|----------|");for(let s=0;s<o.length;s++){let a=o[s];e.push(`| ${s+1} | ${a.question} | ${a.choice} | ${a.promoted?"yes":"no"} |`)}e.push("")}let r=n.find(s=>s.questionId==="scope_boundary");if(r!==void 0){e.push("## Out of Scope"),e.push("");let s=h(r.answer);for(let a of s)e.push(`- ${a}`);e.push("")}let p=v(n);e.push("## Tasks"),e.push("");for(let s=0;s<p.length;s++)e.push(`- [ ] task-${s+1}: ${p[s]}`);e.push("");let u=n.find(s=>s.questionId==="verification");if(e.push("## Verification"),e.push(""),u!==void 0){let s=h(u.answer);for(let a of s)e.push(`- ${a}`)}else e.push("_To be defined._");return e.push(""),e.join(`
|
|
2
2
|
`)};var k=async(c,n,i)=>{if(n.spec===null)throw new Error("No active spec");let o=`${c}/${d.specDir(n.spec)}`,t=`${c}/${d.specFile(n.spec)}`;await l.fs.mkdir(o,{recursive:!0});let e=g(n.spec,n.discovery.answers,i,n.decisions,n.classification);await l.fs.writeTextFile(t,e);let r=m(n.spec,e),p=`${o}/progress.json`,u={spec:n.spec,status:"draft",tasks:r.tasks.map(s=>({id:s.id,title:s.title,status:"pending"})),decisions:n.decisions.map(s=>({question:s.question,choice:s.choice,promoted:s.promoted})),debt:[],updatedAt:new Date().toISOString()};return await l.fs.writeTextFile(p,JSON.stringify(u,null,2)+`
|
|
3
3
|
`),t};export{k as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as l}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-HS6FTDDW.js";var a=class extends Error{constructor(e,n,s,o){super(e);this.command=n;this.code=s;this.stderr=o;this.name="CommandError"}};var u=new TextDecoder,c=class r{#e;#r;#t;constructor(t,e=[],n={}){this.#e=t,this.#r=e,this.#t={throwOnError:!0,stdout:"piped",stderr:"piped",...n}}cwd(t){return new r(this.#e,this.#r,{...this.#t,cwd:t})}env(t,e){let n=this.#t.env??{},s;return typeof t=="string"&&e!==void 0?s={...n,[t]:e}:t!==null&&typeof t=="object"?s={...n,...t}:s=n,new r(this.#e,this.#r,{...this.#t,env:s})}stdin(t){return new r(this.#e,this.#r,{...this.#t,stdin:t})}stdout(t){return new r(this.#e,this.#r,{...this.#t,stdout:t})}stderr(t){return new r(this.#e,this.#r,{...this.#t,stderr:t})}timeout(t){return new r(this.#e,this.#r,{...this.#t,timeout:t})}noThrow(){return new r(this.#e,this.#r,{...this.#t,throwOnError:!1})}quiet(){return new r(this.#e,this.#r,{...this.#t,stdout:"null",stderr:"null"})}printCommand(){let t=[this.#e,...this.#r].join(" ");return console.log(`$ ${t}`),this}async spawn(){let{runtime:t}=l,e=await t.exec.spawn(this.#e,this.#r,{cwd:this.#t.cwd,env:this.#t.env,stdin:this.#t.stdin,stdout:this.#t.stdout,stderr:this.#t.stderr});if(!e.success&&this.#t.throwOnError===!0){let n=u.decode(e.stderr);throw new a(`Command failed with exit code ${e.code}: ${this.#e}`,this.#e,e.code,n)}return e}async text(t="stdout"){let e=await this.spawn();switch(t){case"stdout":return u.decode(e.stdout).trim();case"stderr":return u.decode(e.stderr).trim();case"combined":return(u.decode(e.stdout)+u.decode(e.stderr)).trim()}}async json(){let t=await this.text();return JSON.parse(t)}async lines(){let t=await this.text();return t===""?[]:t.split(`
|
|
2
2
|
`)}async bytes(){return(await this.spawn()).stdout}async code(){return(await this.noThrow().spawn()).code}pipe(t){return new p([this,t])}child(){let{runtime:t}=l;return t.exec.spawnChild(this.#e,this.#r,{cwd:this.#t.cwd,env:this.#t.env,stdin:this.#t.stdin??"piped",stdout:this.#t.stdout??"piped",stderr:this.#t.stderr??"piped"})}},p=class r{#e;constructor(t){this.#e=t}pipe(t){return new r([...this.#e,t])}async text(){let t="";for(let e of this.#e){let n=await e.spawn();t=u.decode(n.stdout)}return t.trim()}async lines(){let t=await this.text();return t===""?[]:t.split(`
|
|
3
3
|
`)}};var h=(r,t)=>{let e=[];for(let s=0;s<r.length;s++){let o=r[s];if(o!==void 0&&e.push(o),s<t.length){let i=t[s];Array.isArray(i)?e.push(i.map(m=>w(String(m))).join(" ")):i!=null&&e.push(w(String(i)))}}let n=e.join("").trim();return f(n)},w=r=>/[\s"'\\$`]/.test(r)?`'${r.replace(/'/g,"'\\''")}'`:r,f=r=>{let t=[],e="",n=!1,s=!1,o=!1;for(let m=0;m<r.length;m++){let d=r[m];if(o){e+=d,o=!1;continue}if(d==="\\"){o=!0;continue}if(d==="'"&&!s){n=!n;continue}if(d==='"'&&!n){s=!s;continue}if(d===" "&&!n&&!s){e.length>0&&(t.push(e),e="");continue}e+=d}e.length>0&&t.push(e);let i=t[0];return i===void 0?["",[]]:[i,t.slice(1)]};var g=(r,...t)=>{let[e,n]=h(r,t);return new c(e,n)};export{a,c as b,h as c,g as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-HS6FTDDW.js";var f=async(n,r)=>{let e=`${n}/.eser/specs/${r}/spec.md`,t;try{t=await c.fs.readTextFile(e)}catch{return null}return d(r,t)},d=(n,r)=>{let e=[],t=[],o=[],i="";for(let l of r.split(`
|
|
2
2
|
`)){let s=l.trim();if(s.startsWith("## ")){i=s.slice(3).trim().toLowerCase();continue}if(i.startsWith("tasks")){let a=s.match(/^-\s*\[[ x]\]\s*(task-\d+):\s*(.+)$/i);a!==null&&e.push({id:a[1],title:a[2].trim()})}i.startsWith("out of scope")&&s.startsWith("- ")&&t.push(s.slice(2).trim()),i.startsWith("verification")&&s.startsWith("- ")&&o.push(s.slice(2).trim())}return{name:n,tasks:e,outOfScope:t,verification:o}},u=(n,r)=>{let e=new Set(r);for(let t of n)if(!e.has(t.id))return t;return null};export{f as a,d as b,u as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as a,c as W,d as l,e as M,f as w,g as c,h as x,i as X,k as T,l as $,n as D,o as j,q as K,r as F}from"./chunk-4IFPLK7L.js";import{a as A}from"./chunk-HS6FTDDW.js";var f=Symbol("tui.cancel"),ae=e=>e===f,ie=()=>{try{return A.process.stdin}catch{return new ReadableStream}},oe=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??j({renderer:r?F.ansi():F.plain(),sink:r?K.stdout():K.stderr()}),input:e?.input??ie(),target:s,interaction:t,audience:n,stderr:e?.stderr??j({renderer:F.plain(),sink:K.stderr()})}};var g="\u2502",G="\u250C",h="\u2514";var H="\u25CF",q="\u25CB",z="\u25FC",J="\u25FB",P="\u25C6",C="\u25C7",b="\u25A0",Q="\u25CF";var N="\u25B2";var Z="\u25C7";var v=async e=>{let t=!1;if(A.capabilities.stdin&&A.process.isTerminal("stdin"))try{A.process.setStdinRaw(!0),t=!0}catch{}try{return await e()}finally{if(t)try{A.process.setStdinRaw(!1)}catch{}}},R=e=>{e.write(a("\x1B[?25l"))},E=e=>{e.write(a("\x1B[?25h"))},m=(e,t)=>{t>0&&e.write(a(`\x1B[${t}A\x1B[J`))};var le=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*k(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 le(r)}}finally{n.releaseLock()}}var U=(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?M(c(H),a(" Yes")):M(l(q),l(" Yes")),i=n?M(l(q),l(" No")):M(c(H),a(" No"));return e.output.writeln(T(P),a(` ${t}`)),e.output.writeln(l(g),a(" "),r,l(" / "),i),e.output.writeln(l(h)),3},pe=async(e,t)=>{let n=t.initialValue??!0,s=0;R(e.output);try{return await v(async()=>{s=U(e,t.message,n,"active"),await e.output.flush();for await(let r of k(e.input)){if(r.name==="c"&&r.ctrl)return m(e.output,s),U(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="escape")return m(e.output,s),U(e,t.message,n,"cancel"),await e.output.flush(),f;if(r.name==="return")return m(e.output,s),U(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=U(e,t.message,n,"active"),await e.output.flush())}return f})}finally{E(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?x(N):T(P);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(" "),x(r)),y=3):(e.output.writeln(l(h)),y=3),y},ue=async(e,t)=>{let n=t.initialValue??"",s=n.length,r,i=0;R(e.output);try{return await v(async()=>{i=_(e,t.message,n,t.placeholder,r,"active"),await e.output.flush();for await(let o of k(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{E(e.output),await e.output.flush()}};var L=(e,t,n,s,r,i,o)=>{if(o==="done"){let u=[...r].sort((p,I)=>p-I).map(p=>n[p]?.label??"").join(", ");return e.output.writeln(c(C),a(` ${t}`),l(` \xB7 ${u}`)),1}if(o==="cancel")return e.output.writeln(w(b),a(` ${t}`)),1;let d=i!==void 0?x(N):T(P);e.output.writeln(d,a(` ${t}`));for(let u=0;u<n.length;u++){let p=n[u],I=u===s,ee=r.has(u),te=p.disabled===!0,ne=ee?c(z):l(J),se=te?l(` ${p.label}`):I?a(` ${p.label}`):l(` ${p.label}`),re=p.hint!==void 0?l(` (${p.hint})`):a("");e.output.writeln(l(g),a(" "),ne,se,re)}let y=n.length+2;return i!==void 0?e.output.writeln(l(h),a(" "),x(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},de=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;R(e.output);try{return await v(async()=>{r=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush();for await(let o of k(e.input)){if(o.name==="c"&&o.ctrl)return m(e.output,r),L(e,t.message,t.options,n,s,void 0,"cancel"),await e.output.flush(),f;if(o.name==="escape")return m(e.output,r),L(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=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush();continue}return m(e.output,r),L(e,t.message,t.options,n,s,void 0,"done"),await e.output.flush(),[...s].sort((y,u)=>y-u).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((u,p)=>u.disabled===!0||s.has(p));for(let u=0;u<t.options.length;u++)t.options[u]?.disabled!==!0&&(y?s.delete(u):s.add(u));d=!0}d&&(m(e.output,r),r=L(e,t.message,t.options,n,s,i,"active"),await e.output.flush())}return f})}finally{E(e.output),await e.output.flush()}};var me=(e,t)=>{e.output.writeln($(G),a(" "),W(t)),e.output.writeln($(g))},fe=(e,t)=>{e.output.writeln($(g)),e.output.writeln($(h),a(" "),a(t))},ye={info:(e,t)=>{e.output.writeln(D("info",t))},success:(e,t)=>{e.output.writeln(D("success",t))},warn:(e,t)=>{e.output.writeln(D("warning",t))},error:(e,t)=>{e.output.writeln(D("error",t))},step:(e,t)=>{e.output.writeln(l(Z),a(" "),l(t))},message:(e,t,n)=>{e.output.writeln(l(n??g),a(" "),a(t))}};var ce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],ge=80,he=(e,t,n)=>{let s=n?.frames??ce,r=n?.interval??ge,i=t,o=0,d,y=()=>{e.output.write(a(`\r${" ".repeat(i.length+4)}\r`))},u=()=>{d!==void 0&&(clearInterval(d),d=void 0,y())};return{start:p=>{p!==void 0&&(i=p),d=setInterval(()=>{let I=s[o%s.length];e.output.write(a("\r"),T(I??""),a(` ${i}`)),o++},r)},stop:p=>{u(),p!==void 0&&(i=p)},update:p=>{i=p},succeed:p=>{u(),e.output.writeln(c(C),a(` ${p??i}`))},fail:p=>{u(),e.output.writeln(w(b),a(` ${p??i}`))},warn:p=>{u(),e.output.writeln(x(N),a(` ${p??i}`))},info:p=>{u(),e.output.writeln(X(Q),a(` ${p??i}`))}}};export{ae as a,oe as b,pe as c,ue as d,de as e,me as f,fe as g,ye as h,he as i};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as i}from"./chunk-OLM5RTFK.js";import{b as d,d as c}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-OLM5RTFK.js";import{b as d,d as c}from"./chunk-6C2MLMD6.js";var y=async(r,t)=>{let e=t.properties?.binPath;if(e!==void 0)return e;try{let n=await c`which ${r}`.noThrow().text();if(n.length>0)return n}catch{}throw new i(`Binary "${r}" not found. Set properties.binPath in config or ensure it is on PATH.`,{provider:r})},f=(r,t,e)=>{let s=new d(r,[...t],{stdin:"null",stdout:"piped",stderr:"piped",cwd:e?.cwd,env:e?.env}).child();if(e?.signal!==void 0){let o=e.signal;o.aborted?s.kill("SIGTERM"):o.addEventListener("abort",()=>{s.kill("SIGTERM")},{once:!0})}return{stdout:s.stdout,stderr:s.stderr,waitForExit:async()=>{let o=await s.status;return{code:o.code,success:o.success}},kill:o=>{s.kill(o??"SIGTERM")}}},a=new TextDecoder;async function*m(r){let t=r.getReader(),e="";try{let n=await t.read();for(;n.done!==!0;){e+=a.decode(n.value,{stream:!0});let o=e.split(`
|
|
2
2
|
`);e=o.pop()??"";for(let u of o){let l=u.trim();if(l.length!==0)try{yield JSON.parse(l)}catch{}}n=await t.read()}let s=e.trim();if(s.length>0)try{yield JSON.parse(s)}catch{}}finally{t.releaseLock()}}var h=async(r,t)=>{let e=r.getReader(),n=[],s=await e.read();for(;s.done!==!0;)n.push(a.decode(s.value,{stream:!0})),s=await e.read();return e.releaseLock(),{content:[{kind:"text",text:n.join("").trim()}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:t}},w=async r=>{let t=r.getReader(),e=[],n=await t.read();for(;n.done!==!0;)e.push(a.decode(n.value,{stream:!0})),n=await t.read();return t.releaseLock(),e.join("").trim()},x=(r,t,e)=>{if(t===0)return null;let n=e.length>0?`${r} exited with code ${t}: ${e}`:`${r} exited with code ${t}`;return t===1?new i(n,{provider:r}):t===126||t===127?new i(`${r} binary not found or not executable (exit code ${t})`,{provider:r}):new i(n,{provider:r})},b=(r,t)=>{let e=[];t!==void 0&&(e.push(t),e.push(""));for(let n of r)for(let s of n.content)s.kind==="text"&&e.push(s.text);return e.join(`
|
|
3
3
|
`)};export{y as a,f as b,m as c,h as d,w as e,x as f,b as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-PSXXTDLU.js";var n=[{id:"status_quo",text:"What does the user do today without this feature?",concerns:["product:status_quo","eng:replace_scope","qa:regression_risk"]},{id:"ambition",text:"Describe the 1-star and 10-star versions.",concerns:["product:scope_direction","eng:complexity_tier","qa:test_depth"]},{id:"reversibility",text:"Does this change involve an irreversible decision?",concerns:["product:one_way_door","eng:migration_strategy","qa:verification_stringency"]},{id:"user_impact",text:"Does this change affect existing users' behavior?",concerns:["product:breaking_change","eng:backward_compat","qa:regression_tests"]},{id:"verification",text:"How do you verify this works correctly?",concerns:["product:success_metric","eng:test_strategy","qa:acceptance_criteria"]},{id:"scope_boundary",text:"What should this feature NOT do?",concerns:["product:focus","eng:out_of_scope","qa:negative_tests"]}],a=t=>n.map(e=>({...e,extras:o(t,e.id)})),c=(t,e)=>{let r=new Set(e.map(s=>s.questionId));for(let s of t)if(!r.has(s.id))return s;return null},d=t=>{let e=new Set(t.map(r=>r.questionId));return n.every(r=>e.has(r.id))};export{n as a,a as b,c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as i}from"./chunk-
|
|
1
|
+
import{d as i}from"./chunk-OJUA2UZK.js";var n={UNINITIALIZED:["IDLE"],IDLE:["DISCOVERY"],DISCOVERY:["SPEC_DRAFT"],SPEC_DRAFT:["SPEC_APPROVED"],SPEC_APPROVED:["EXECUTING"],EXECUTING:["DONE","BLOCKED"],BLOCKED:["EXECUTING"],DONE:["IDLE"]},c=(e,s)=>n[e].includes(s),t=(e,s)=>{if(!c(e,s))throw new Error(`Invalid phase transition: ${e} \u2192 ${s}. Allowed: ${n[e].join(", ")}`)},h=(e,s)=>(t(e.phase,s),{...e,phase:s}),d=(e,s,a)=>(t(e.phase,"DISCOVERY"),{...e,phase:"DISCOVERY",spec:s,branch:a,discovery:{answers:[],completed:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]},decisions:[]}),E=(e,s,a)=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot add discovery answer in phase: ${e.phase}`);let o=[...e.discovery.answers.filter(r=>r.questionId!==s),{questionId:s,answer:a}];return{...e,discovery:{answers:o,completed:e.discovery.completed}}},u=e=>{if(e.phase!=="DISCOVERY")throw new Error(`Cannot complete discovery in phase: ${e.phase}`);return{...e,phase:"SPEC_DRAFT",discovery:{...e.discovery,completed:!0},specState:{path:i.specFile(e.spec),status:"draft"}}},m=e=>(t(e.phase,"SPEC_APPROVED"),{...e,phase:"SPEC_APPROVED",specState:{...e.specState,status:"approved"}}),S=e=>(t(e.phase,"EXECUTING"),{...e,phase:"EXECUTING",discovery:{answers:[],completed:!0},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]}});var D=(e,s)=>(t(e.phase,"BLOCKED"),{...e,phase:"BLOCKED",execution:{...e.execution,lastProgress:`BLOCKED: ${s}`}}),C=(e,s)=>({...e,decisions:[...e.decisions,s]}),F=e=>({...e,phase:"IDLE",spec:null,branch:null,discovery:{answers:[],completed:!1},specState:{path:null,status:"none"},execution:{iteration:0,lastProgress:null,modifiedFiles:[],lastVerification:null,awaitingStatusReport:!1,debt:null,completedTasks:[]},decisions:[],pendingClear:!1,classification:null});export{h as a,d as b,E as c,u as d,m as e,S as f,D as g,C as h,F as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as I,c as D}from"./chunk-
|
|
1
|
+
import{b as I,c as D}from"./chunk-WV3HK5WR.js";import{a as N,b as f}from"./chunk-FDZP7B5Y.js";import{a as m,b as T,c as A,d as S}from"./chunk-ACQUINWH.js";import{d as Y}from"./chunk-DXB73IDG.js";var J={};Y(J,{AlreadyExistsError:()=>A,NotFoundError:()=>T,ProcessError:()=>S,RuntimeCapabilityError:()=>m,buildCommand:()=>P,clearWorkerdEnv:()=>D,createRuntime:()=>G,current:()=>xe,detectExecutionContext:()=>V,detectInvoker:()=>C,detectRuntime:()=>a,getArch:()=>y,getCliCommand:()=>q,getHomedir:()=>R,getPlatform:()=>u,getPlatformInfo:()=>U,getRuntimeVersion:()=>M,getTmpdir:()=>v,isBrowser:()=>W,isCommandInPath:()=>c,isEdge:()=>B,isRuntime:()=>_,isServer:()=>j,populateEnvFromContext:()=>I,posixPath:()=>f,resolvePathDirs:()=>b,runtime:()=>o,searchFileHierarchy:()=>$,toPosix:()=>N});var i=globalThis,Z=()=>typeof i.caches<"u"&&typeof i.Request<"u"&&typeof i.Response<"u"&&typeof i.window>"u"&&typeof i.document>"u",ee=()=>typeof i.window<"u"||typeof i.document<"u",a=()=>{if(typeof globalThis>"u")return"unknown";if(typeof i.Bun<"u")return"bun";if(typeof i.Deno<"u")return"deno";let e=i.process;return e?.versions?.node&&!e?.versions?.bun?"node":Z()?"workerd":ee()?"browser":"unknown"},ne={deno:()=>i.Deno?.version?.deno??"unknown",bun:()=>i.Bun?.version??"unknown",node:()=>i.process?.versions?.node??"unknown",workerd:()=>"unknown",browser:()=>i.navigator?.userAgent??"unknown",unknown:()=>"unknown"},M=()=>ne[a()](),_=e=>a()===e,W=()=>a()==="browser",te=new Set(["deno","node","bun"]),j=()=>te.has(a()),B=()=>a()==="workerd";var oe=e=>{if(typeof Deno<"u"&&Deno.env?.get)return Deno.env.get(e);let n=globalThis.process;if(n?.env)return n.env[e]},x=(...e)=>{for(let n of e){let t=oe(n);if(t!==void 0)return t}},g=e=>{try{let n=globalThis.require;if(n instanceof Function)return n(e)}catch{}},w=()=>globalThis.process,h=()=>globalThis.navigator;var H={darwin:"darwin",linux:"linux",windows:"windows",win32:"windows"},u=()=>{if(typeof Deno<"u"&&Deno.build?.os)return H[Deno.build.os]??"linux";let e=w();if(e?.platform)return H[e.platform]??"linux";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("mac"))return"darwin";if(t.includes("win"))return"windows";if(t.includes("linux"))return"linux"}return"linux"},L={x86_64:"amd64",x64:"amd64",aarch64:"arm64",arm64:"arm64"},y=()=>{if(typeof Deno<"u"&&Deno.build?.arch)return L[Deno.build.arch]??"amd64";let e=w();if(e?.arch)return L[e.arch]??"amd64";let n=h();if(n?.userAgent){let t=n.userAgent.toLowerCase();if(t.includes("arm64")||t.includes("aarch64"))return"arm64"}return"amd64"},R=()=>{let e=x("HOME","USERPROFILE");if(e)return e;let n=g("os");return n?.homedir?n.homedir():u()==="windows"?"C:\\Users\\Default":"/home"},v=()=>{let e=x("TMPDIR","TMP","TEMP");if(e)return e;let n=g("os");return n?.tmpdir?n.tmpdir():u()==="windows"?"C:\\Windows\\Temp":"/tmp"},U=()=>({platform:u(),arch:y(),homedir:R(),tmpdir:v()});var $=async(e,n,t={})=>{let{searchParents:r=!1}=t,s=e;for(;;){for(let l of n){let p=o.path.join(s,l);if(await o.fs.exists(p)&&(await o.fs.stat(p)).isFile)return p}if(!r)break;let d=o.path.dirname(s);if(d===s)break;s=d}};var b=(e,n)=>{let t=n==="windows"?";":":";return e.split(t).filter(r=>r.length>0)},C=(e,n,t,r,s)=>{if(t)return{invoker:"binary",mode:"installed"};if(n==="bun")return e.BUN_INSTALL!==void 0?{invoker:"bun",mode:"installed"}:{invoker:"bunx",mode:"on-demand"};if(n==="node"){let d=e.npm_execpath??"";return d.includes("npx")?{invoker:"npx",mode:"on-demand"}:d.includes("pnpm")?{invoker:"pnpx",mode:"on-demand"}:(e.npm_config_user_agent??"").includes("pnpm")?{invoker:"pnpm",mode:"installed"}:{invoker:"npm",mode:"installed"}}return n==="deno"?r!==void 0&&(r.startsWith("jsr:")||r.startsWith("https:"))?{invoker:"deno",mode:"on-demand"}:s===!0?{invoker:"dev",mode:"dev"}:{invoker:"deno",mode:"installed"}:{invoker:"unknown",mode:"installed"}},P=(e,n,t)=>e==="npx"?`npx ${t.npmPackage}`:e==="pnpx"?`pnpx ${t.npmPackage}`:e==="bunx"?`bunx ${t.npmPackage}`:e==="deno"&&n==="on-demand"?`deno run --allow-all jsr:${t.jsrPackage}`:e==="dev"?t.devCommand:t.command,c=async e=>{let n=u(),t=n==="windows"?`${e}.exe`:e,r=o.env.get("PATH")??"",s=b(r,n);for(let d of s)try{return await o.fs.stat(o.path.join(d,t)),!0}catch{continue}return!1},q=async e=>await c(e.command)?e.command:await c("npx")?`npx ${e.npmPackage}`:await c("pnpx")?`pnpx ${e.npmPackage}`:await c("bunx")?`bunx ${e.npmPackage}`:await c("deno")?`deno run --allow-all jsr:${e.jsrPackage}`:e.command,V=async e=>{let n=import.meta.filename===void 0,t=a(),r=import.meta.url,s={BUN_INSTALL:o.env.get("BUN_INSTALL"),npm_execpath:o.env.get("npm_execpath"),npm_config_user_agent:o.env.get("npm_config_user_agent")},d=!1;if(t==="deno"&&r.startsWith("file://"))try{let z=o.process.cwd(),Q=o.path.join(z,"deno.json"),X=await o.fs.readTextFile(Q),F=JSON.parse(X).tasks;F!==void 0&&"cli"in F&&(d=!0)}catch{}let{invoker:l,mode:p}=C(s,t,n,r,d),E=n?"compiled":["deno","node","bun"].includes(t)?t:"deno",O=P(l,p,e),K=await c(e.command);return{runtime:E,mode:p,invoker:l,command:O,isInPath:K}};var k=(e,n)=>()=>{throw new m(e,n)},se=e=>{let n=k("fs",e);return{readFile:n,readTextFile:n,writeFile:n,writeTextFile:n,exists:n,stat:n,lstat:n,mkdir:n,ensureDir:n,remove:n,readDir:n,copyFile:n,rename:n,makeTempDir:n,realPath:n,watch:n,walk:n,chmod:n}},ae=e=>{let n=k("exec",e);return{spawn:n,exec:n,execJson:n,spawnChild:n}},de=e=>{let n=k("process",e);return{exit:n,setExitCode:n,cwd:n,chdir:n,hostname:n,execPath:n,get args(){throw new m("process",e)},get pid(){throw new m("process",e)},get stdin(){throw new m("process",e)},get stdout(){throw new m("process",e)},get stderr(){throw new m("process",e)},isTerminal(){return!1},setStdinRaw(){throw new m("process",e)}}},me=()=>({get:()=>{},set:()=>{},delete:()=>{},has:()=>!1,toObject:()=>({})}),ce=e=>({name:e,version:"unknown",capabilities:{fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},fs:se(e),path:f,exec:ae(e),env:me(),process:de(e)}),ue={deno:async()=>(await import("./deno-5VR3ZY4Z.js")).createDenoRuntime(),node:async()=>(await import("./node-MZTU6BAB.js")).createNodeRuntime(),bun:async()=>(await import("./bun-KVGAHBUF.js")).createBunRuntime(),workerd:async()=>(await import("./workerd-QUMEG65S.js")).createWorkerdRuntime(),browser:async()=>(await import("./browser-JYFQKVFU.js")).createBrowserRuntime()},pe=["fs","exec","env","path","process"],le=e=>e!==void 0&&pe.some(n=>e[n]!==void 0),fe=(e,n,t)=>({name:e.name,version:e.version,capabilities:t,fs:n.fs??e.fs,path:n.path??e.path,exec:n.exec??e.exec,env:n.env??e.env,process:n.process??e.process}),G=async e=>{let n=a(),t=ue[n],r=t!==void 0?await t():ce(n),s=e?.capabilities?{...r.capabilities,...e.capabilities}:r.capabilities;return e!==void 0&&le(e)?fe(r,e,s):e?.capabilities?{...r,capabilities:s}:r},o=await G(),xe=o;export{o as a,J as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{d as o}from"./chunk-
|
|
1
|
+
import{d as o}from"./chunk-OJUA2UZK.js";import{a as e}from"./chunk-HS6FTDDW.js";var d=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s);t=t.replace(/^## Status: .+$/m,`## Status: ${n}`),await e.fs.writeTextFile(s,t)}catch{}},u=async(r,i,n)=>{let s=`${r}/${o.specFile(i)}`;try{let t=await e.fs.readTextFile(s),a=new RegExp(`^(- )\\[ \\]( ${n}:.*)$`,"m");t=t.replace(a,"$1[x]$2"),await e.fs.writeTextFile(s,t)}catch{}},w=async(r,i,n,s)=>{let t=`${r}/${o.specDir(i)}/progress.json`;try{let a=await e.fs.readTextFile(t),c=JSON.parse(a);for(let p of c.tasks)p.id===n&&(p.status=s);c.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(t,JSON.stringify(c,null,2)+`
|
|
2
2
|
`)}catch{}},f=async(r,i,n)=>{let s=`${r}/${o.specDir(i)}/progress.json`;try{let t=await e.fs.readTextFile(s),a=JSON.parse(t);a.status=n,a.updatedAt=new Date().toISOString(),await e.fs.writeTextFile(s,JSON.stringify(a,null,2)+`
|
|
3
3
|
`)}catch{}};export{d as a,u as b,w as c,f as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{a as B}from"./chunk-
|
|
1
|
+
import{a as M,b as H}from"./chunk-2N4GTHXQ.js";import{a as B}from"./chunk-HS6FTDDW.js";var de=/^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s,ce=/[A-Za-z]/,fe=/-?\d+(\.\d*)?(e-?\d+)?$/,ue=/^(-|--)[^-]/,ge=/=(?<value>.+)/,me=/^--[^=]+$/,pe=/\W/,he=/\S/;function T(n){return he.test(n)&&Number.isFinite(Number(n))}function V(n,e){return e==="constructor"&&typeof n[e]=="function"||e==="__proto__"}function k(n,e,t,o=!1){e=[...e];let s=e.pop();for(let r of e){if(V(n,r))return;n=n[r]??={}}if(!V(n,s)){if(o){let r=n[s];if(Array.isArray(r)){r.push(t);return}t=r?[r,t]:[t]}n[s]=t}}function N(n,e){for(let t of e){let o=n[t];if(!Object.hasOwn(n,t))return!1;n=o}return!0}function X(n,e,t){let o=n.get(t);if(o===void 0)return!1;for(let s of o)if(e.has(s))return!0;return!1}function v(n){return n==="true"||n==="false"}function j(n){return n!=="false"}function L(n,e){let{"--":t=!1,alias:o={},boolean:s=!1,default:r={},stopEarly:i=!1,string:d=[],collect:m=[],negatable:p=[],unknown:S=l=>l}=e??{},h=new Map,$=new Set,C=new Set,x=new Set,b=new Set,g=!1;if(o)for(let[l,a]of Object.entries(o)){if(a===void 0)throw new TypeError("Alias value must be defined");let c=Array.isArray(a)?a:[a];h.set(l,new Set(c)),c.forEach(O=>h.set(O,new Set([l,...c.filter(E=>E!==O)])))}if(s)if(typeof s=="boolean")g=s;else{let l=Array.isArray(s)?s:[s];for(let a of l.filter(Boolean))$.add(a),h.get(a)?.forEach(c=>{$.add(c)})}if(d){let l=Array.isArray(d)?d:[d];for(let a of l.filter(Boolean))C.add(a),h.get(a)?.forEach(c=>C.add(c))}if(m){let l=Array.isArray(m)?m:[m];for(let a of l.filter(Boolean))x.add(a),h.get(a)?.forEach(c=>x.add(c))}if(p){let l=Array.isArray(p)?p:[p];for(let a of l.filter(Boolean))b.add(a),h.get(a)?.forEach(c=>b.add(c))}let u={_:[]};function y(l,a,c,O){if(!$.has(l)&&!C.has(l)&&!h.has(l)&&!x.has(l)&&!(g&&me.test(c))&&S?.(c,l,a)===!1)return;typeof a=="string"&&!C.has(l)&&(a=T(a)?Number(a):a);let E=O&&x.has(l);k(u,l.split("."),a,E),h.get(l)?.forEach(f=>{k(u,f.split("."),a,E)})}let R=[],D=n.indexOf("--");D!==-1&&(R=n.slice(D+1),n=n.slice(0,D));e:for(let l=0;l<n.length;l++){let a=n[l],c=a.match(de)?.groups;if(c){let{doubleDash:O,negated:E}=c,f=c.key,F=c.value;if(O){if(F!=null){$.has(f)&&(F=j(F)),y(f,F,a,!0);continue}if(E){if(b.has(f)){y(f,!1,a,!1);continue}f=`no-${f}`}let _=n[l+1];if(_){if(!$.has(f)&&!g&&!_.startsWith("-")&&(!h.has(f)||!X(h,$,f))){F=_,l++,y(f,F,a,!0);continue}if(v(_)){F=j(_),l++,y(f,F,a,!0);continue}}F=C.has(f)?"":!0,y(f,F,a,!0);continue}let z=a.slice(1,-1).split("");for(let[_,A]of z.entries()){let w=a.slice(_+2);if(w==="-"){y(A,w,a,!0);continue}if(w==="="){y(A,"",a,!0);continue e}if(ce.test(A)){let W=ge.exec(w)?.groups;if(W){y(A,W.value,a,!0);continue e}if(fe.test(w)){y(A,w,a,!0);continue e}}if(z[_+1]?.match(pe)){y(A,a.slice(_+2),a,!0);continue e}y(A,C.has(A)?"":!0,a,!0)}if(f=a.slice(-1),f==="-")continue;let P=n[l+1];if(P){if(!ue.test(P)&&!$.has(f)&&(!h.has(f)||!X(h,$,f))){y(f,P,a,!0),l++;continue}if(v(P)){let _=j(P);y(f,_,a,!0),l++;continue}}y(f,C.has(f)?"":!0,a,!0);continue}if(S?.(a)!==!1&&u._.push(C.has("_")||!T(a)?a:Number(a)),i){u._.push(...n.slice(l+1));break}}for(let[l,a]of Object.entries(r)){let c=l.split(".");N(u,c)||(k(u,c,a),h.get(l)?.forEach(O=>k(u,O.split("."),a)))}for(let l of $.keys()){let a=l.split(".");if(!N(u,a)){let c=x.has(l)?[]:!1;k(u,a,c)}}for(let l of C.keys()){let a=l.split(".");!N(u,a)&&x.has(l)&&k(u,a,[])}return t?u["--"]=R:u._.push(...R),u}var I=n=>{let e=[],t=[],o={},s={};for(let r of n)r.type==="boolean"?e.push(r.name):t.push(r.name),r.short!==void 0&&(o[r.short]=r.name),r.default!==void 0&&(s[r.name]=r.default);return{boolean:e,string:t,alias:o,default:s}},ye=n=>n!=null&&n.constructor===String,$e={boolean:n=>!!n,number:n=>ye(n)?Number(n):n,string:n=>String(n),"string[]":n=>Array.isArray(n)?n.map(String):[String(n)]},Ce=(n,e)=>{if(n!==void 0)return $e[e]?.(n)??n},q=(n,e)=>{let t={};for(let o of e){let s=n[o.name];t[o.name]=Ce(s,o.type)}return t};var Y=(n,e)=>{let t=[];for(let o of e)if(o.required===!0){let s=n[o.name];(s===void 0||s===""||s===!1)&&t.push(`Required flag --${o.name} is missing`)}return t};var Z=(n,e)=>n+" ".repeat(Math.max(0,e-n.length)),be=n=>{let e=n.short!==void 0?`-${n.short}, `:"",t=n.type!=="boolean"?` <${n.type}>`:"";return`${e}--${n.name}${t}`},_e=(n,e)=>[n.description!==void 0?`${e} - ${n.description}`:e,""],Fe=(n,e)=>{if(n.usage!==void 0)return["Usage:",` ${n.usage}`,""];let t=n.children.length>0?" <command>":"",o=n.flags.length>0?" [options]":"";return["Usage:",` ${e}${t}${o}`,""]},xe=n=>{if(n.length===0)return[];let e=s=>s.aliases!==void 0&&s.aliases.length>0?`${s.name}, ${s.aliases.join(", ")}`:s.name,t=Math.max(...n.map(s=>e(s).length));return["Commands:",...n.map(s=>` ${Z(e(s),t+2)}${s.description??""}`),""]},Oe=n=>{if(n.length===0)return[];let e=n.map(s=>({flag:be(s),desc:s.description})),t=Math.max(...e.map(s=>s.flag.length));return["Options:",...e.map(({flag:s,desc:r})=>` ${Z(s,t+2)}${r}`),""]},Ae=n=>n?.length?["Examples:",...n.map(e=>` ${e}`),""]:[],J=(n,e)=>{let t=e.join(" "),o=[..._e(n,t),...Fe(n,t),...xe(n.children),...Oe(n.flags),...Ae(n.examples)];return n.children.length>0&&o.push(`Run '${t} <command> --help' for more information on a command.`),o.join(`
|
|
2
2
|
`)};var K=n=>{let e=[];for(let t of n)e.push(`--${t.name}`),t.short!==void 0&&e.push(`-${t.short}`);return e.join(" ")},Q=(n,e)=>{if(n.children===void 0||n.children.length===0)return"";let t=n.children.map(i=>i.name).join(" "),o=n.flags!==void 0?K(n.flags):"",s=[t,o].filter(i=>i.length>0).join(" "),r=` ${e})
|
|
3
3
|
`;r+=` COMPREPLY=( $(compgen -W "${s}" -- "\${cur}") )
|
|
4
4
|
`,r+=` return 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as o}from"./chunk-HS6FTDDW.js";var s=["CLAUDE_CODE","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_SESSION_ID","CURSOR_SESSION","CURSOR","KIRO_SESSION","KIRO","WINDSURF_SESSION","GITHUB_COPILOT"],n=()=>{for(let t of s){let e=o.env.get(t);if(e!==void 0&&e!=="")return"agent"}return"human"};var E=(t,e)=>{if(t!==void 0)for(let i of t){if(i==="--agent")return"agent";if(i==="--human")return"human"}let r=e?.agentMode;return r===!0?"agent":r===!1?"human":n()};var I=t=>t===void 0?[]:t.filter(e=>e!=="--agent"&&e!=="--human"&&e!=="--non-interactive");export{E as a,I as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as T}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-HS6FTDDW.js";import{a as tt,c as y,e as Ta}from"./chunk-DXB73IDG.js";var q=y($=>{"use strict";var ts=Symbol.for("yaml.alias"),Bi=Symbol.for("yaml.document"),st=Symbol.for("yaml.map"),Fi=Symbol.for("yaml.pair"),ss=Symbol.for("yaml.scalar"),it=Symbol.for("yaml.seq"),R=Symbol.for("yaml.node.type"),Ca=s=>!!s&&typeof s=="object"&&s[R]===ts,Ia=s=>!!s&&typeof s=="object"&&s[R]===Bi,Pa=s=>!!s&&typeof s=="object"&&s[R]===st,$a=s=>!!s&&typeof s=="object"&&s[R]===Fi,Ki=s=>!!s&&typeof s=="object"&&s[R]===ss,Ma=s=>!!s&&typeof s=="object"&&s[R]===it;function ji(s){if(s&&typeof s=="object")switch(s[R]){case st:case it:return!0}return!1}function Da(s){if(s&&typeof s=="object")switch(s[R]){case ts:case st:case ss:case it:return!0}return!1}var _a=s=>(Ki(s)||ji(s))&&!!s.anchor;$.ALIAS=ts;$.DOC=Bi;$.MAP=st;$.NODE_TYPE=R;$.PAIR=Fi;$.SCALAR=ss;$.SEQ=it;$.hasAnchor=_a;$.isAlias=Ca;$.isCollection=ji;$.isDocument=Ia;$.isMap=Pa;$.isNode=Da;$.isPair=$a;$.isScalar=Ki;$.isSeq=Ma});var ve=y(is=>{"use strict";var P=q(),M=Symbol("break visit"),Ri=Symbol("skip children"),K=Symbol("remove node");function nt(s,e){let t=Ui(e);P.isDocument(s)?ce(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):ce(null,s,t,Object.freeze([]))}nt.BREAK=M;nt.SKIP=Ri;nt.REMOVE=K;function ce(s,e,t,i){let n=Yi(s,e,t,i);if(P.isNode(n)||P.isPair(n))return xi(s,i,n),ce(s,n,t,i);if(typeof n!="symbol"){if(P.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let a=ce(r,e.items[r],t,i);if(typeof a=="number")r=a-1;else{if(a===M)return M;a===K&&(e.items.splice(r,1),r-=1)}}}else if(P.isPair(e)){i=Object.freeze(i.concat(e));let r=ce("key",e.key,t,i);if(r===M)return M;r===K&&(e.key=null);let a=ce("value",e.value,t,i);if(a===M)return M;a===K&&(e.value=null)}}return n}async function rt(s,e){let t=Ui(e);P.isDocument(s)?await fe(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):await fe(null,s,t,Object.freeze([]))}rt.BREAK=M;rt.SKIP=Ri;rt.REMOVE=K;async function fe(s,e,t,i){let n=await Yi(s,e,t,i);if(P.isNode(n)||P.isPair(n))return xi(s,i,n),fe(s,n,t,i);if(typeof n!="symbol"){if(P.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let a=await fe(r,e.items[r],t,i);if(typeof a=="number")r=a-1;else{if(a===M)return M;a===K&&(e.items.splice(r,1),r-=1)}}}else if(P.isPair(e)){i=Object.freeze(i.concat(e));let r=await fe("key",e.key,t,i);if(r===M)return M;r===K&&(e.key=null);let a=await fe("value",e.value,t,i);if(a===M)return M;a===K&&(e.value=null)}}return n}function Ui(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Yi(s,e,t,i){if(typeof t=="function")return t(s,e,i);if(P.isMap(e))return t.Map?.(s,e,i);if(P.isSeq(e))return t.Seq?.(s,e,i);if(P.isPair(e))return t.Pair?.(s,e,i);if(P.isScalar(e))return t.Scalar?.(s,e,i);if(P.isAlias(e))return t.Alias?.(s,e,i)}function xi(s,e,t){let i=e[e.length-1];if(P.isCollection(i))i.items[s]=t;else if(P.isPair(i))s==="key"?i.key=t:i.value=t;else if(P.isDocument(i))i.contents=t;else{let n=P.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}is.visit=nt;is.visitAsync=rt});var ns=y(Vi=>{"use strict";var Ji=q(),Ba=ve(),Fa={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ka=s=>s.replace(/[!,[\]{}]/g,e=>Fa[e]),ke=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,a]=i;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let a=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,a),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let a=e.slice(2,-1);return a==="!"||a==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),a)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(a){return t(String(a)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+Ka(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Ji.isNode(e.contents)){let r={};Ba.visit(e.contents,(a,o)=>{Ji.isNode(o)&&o.tag&&(r[o.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,a]of i)r==="!!"&&a==="tag:yaml.org,2002:"||(!e||n.some(o=>o.startsWith(a)))&&t.push(`%TAG ${r} ${a}`);return t.join(`
|
|
2
2
|
`)}};ke.defaultYaml={explicit:!1,version:"1.2"};ke.defaultTags={"!!":"tag:yaml.org,2002:"};Vi.Directives=ke});var at=y(Ne=>{"use strict";var Gi=q(),ja=ve();function Ra(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Wi(s){let e=new Set;return ja.visit(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function Qi(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}function Ua(s,e){let t=[],i=new Map,n=null;return{onAnchor:r=>{t.push(r),n??(n=Wi(s));let a=Qi(e,n);return n.add(a),a},setAnchors:()=>{for(let r of t){let a=i.get(r);if(typeof a=="object"&&a.anchor&&(Gi.isScalar(a.node)||Gi.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=r,o}}},sourceObjects:i}}Ne.anchorIsValid=Ra;Ne.anchorNames=Wi;Ne.createNodeAnchors=Ua;Ne.findNewAnchor=Qi});var rs=y(Hi=>{"use strict";function Ae(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let a=i[n],o=Ae(s,i,String(n),a);o===void 0?delete i[n]:o!==a&&(i[n]=o)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=Ae(s,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Ae(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=Ae(s,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}return s.call(e,t,i)}Hi.applyReviver=Ae});var J=y(zi=>{"use strict";var Ya=q();function Xi(s,e,t){if(Array.isArray(s))return s.map((i,n)=>Xi(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!Ya.hasAnchor(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}zi.toJS=Xi});var ot=y(en=>{"use strict";var xa=rs(),Zi=q(),Ja=J(),as=class{constructor(e){Object.defineProperty(this,Zi.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Zi.isDocument(e))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},o=Ja.toJS(this,"",a);if(typeof n=="function")for(let{count:l,res:c}of a.anchors.values())n(c,l);return typeof r=="function"?xa.applyReviver(r,{"":o},"",o):o}};en.NodeBase=as});var qe=y(tn=>{"use strict";var Va=at(),Ga=ve(),ue=q(),Wa=ot(),Qa=J(),os=class extends Wa.NodeBase{constructor(e){super(ue.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],Ga.visit(e,{Node:(r,a)=>{(ue.isAlias(a)||ue.hasAnchor(a))&&i.push(a)}}),t&&(t.aliasResolveCache=i));let n;for(let r of i){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,a=this.resolve(n,t);if(!a){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=i.get(a);if(o||(Qa.toJS(a,null,t),o=i.get(a)),o?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=lt(n,a,i)),o.count*o.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(Va.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function lt(s,e,t){if(ue.isAlias(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(ue.isCollection(e)){let i=0;for(let n of e.items){let r=lt(s,n,t);r>i&&(i=r)}return i}else if(ue.isPair(e)){let i=lt(s,e.key,t),n=lt(s,e.value,t);return Math.max(i,n)}return 1}tn.Alias=os});var L=y(ls=>{"use strict";var Ha=q(),Xa=ot(),za=J(),Za=s=>!s||typeof s!="function"&&typeof s!="object",V=class extends Xa.NodeBase{constructor(e){super(Ha.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:za.toJS(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED="BLOCK_FOLDED";V.BLOCK_LITERAL="BLOCK_LITERAL";V.PLAIN="PLAIN";V.QUOTE_DOUBLE="QUOTE_DOUBLE";V.QUOTE_SINGLE="QUOTE_SINGLE";ls.Scalar=V;ls.isScalarValue=Za});var Oe=y(nn=>{"use strict";var eo=qe(),te=q(),sn=L(),to="tag:yaml.org,2002:";function so(s,e,t){if(e){let i=t.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(i=>i.identify?.(s)&&!i.format)}function io(s,e,t){if(te.isDocument(s)&&(s=s.contents),te.isNode(s))return s;if(te.isPair(s)){let f=t.schema[te.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:a,sourceObjects:o}=t,l;if(i&&s&&typeof s=="object"){if(l=o.get(s),l)return l.anchor??(l.anchor=n(s)),new eo.Alias(l.anchor);l={anchor:null,node:null},o.set(s,l)}e?.startsWith("!!")&&(e=to+e.slice(2));let c=so(s,e,a.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new sn.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?a[te.MAP]:Symbol.iterator in Object(s)?a[te.SEQ]:a[te.MAP]}r&&(r(c),delete t.onTagObj);let d=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new sn.Scalar(s);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}nn.createNode=io});var ft=y(ct=>{"use strict";var no=Oe(),j=q(),ro=ot();function cs(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let a=[];a[r]=i,i=a}else i=new Map([[r,i]])}return no.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var rn=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,fs=class extends ro.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>j.isNode(i)||j.isPair(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(rn(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(j.isCollection(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,cs(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(j.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&j.isScalar(r)?r.value:r:j.isCollection(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j.isPair(t))return!1;let i=t.value;return i==null||e&&j.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return j.isCollection(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(j.isCollection(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,cs(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ct.Collection=fs;ct.collectionFromPath=cs;ct.isEmptyPath=rn});var Ee=y(ut=>{"use strict";var ao=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function us(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var oo=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?us(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s={id:"open-source",name:"Open Source",description:"Community-driven, inclusive, well-documented. Prioritize contributor experience, avoid exclusionary patterns, default to permissive choices.",extras:[{questionId:"status_quo",text:"Is this workaround common in the community?"},{questionId:"user_impact",text:"Does this make contribution harder?"}],specSections:["Contributor Guide","Public API Surface"],reminders:["Endpoint should be documented in API docs","Consider contributor experience for new patterns","Default to permissive, well-documented choices"],acceptanceCriteria:["Public API documented","Changes reflected in README or API docs","No exclusionary patterns introduced"]};var r={id:"beautiful-product",name:"Beautiful Product",description:"Design and UX are first-class. Agent critiques UI/UX like a passionate designer. Empty states, error states, loading states, mobile layout \u2014 nothing ships unspecified.",extras:[{questionId:"status_quo",text:"How painful is the current experience?"},{questionId:"ambition",text:"In the 10-star version, what does the user feel?"}],specSections:["Design States (empty, loading, error, success)","Mobile Layout","Interaction Design"],reminders:["Loading state and error state must be designed, not placeholder","No AI slop \u2014 every UI element is intentional","Empty states need clear CTAs with examples"],acceptanceCriteria:["All UI states designed (empty, loading, error, success)","Mobile layout considered","No placeholder or skeleton UI left unfinished"]};var a={id:"long-lived",name:"Long-Lived",description:"Built to last. Stability, maintainability, and backward compatibility matter. Every shortcut needs justification. Favor boring technology.",extras:[{questionId:"reversibility",text:"Will this decision still be correct in 2 years?"},{questionId:"scope_boundary",text:"What technical debt would this introduce?"}],specSections:["Migration & Deprecation","Backward Compatibility"],reminders:["Favor boring technology over shiny new tools","Every shortcut needs explicit justification","Consider maintenance burden for new dependencies"],acceptanceCriteria:["Backward compatibility preserved","Migration path documented if breaking","No unnecessary new dependencies"]};var c={id:"move-fast",name:"Move Fast",description:"Optimize for shipping speed. Acceptable trade-offs on polish. Good enough is good enough. Reduce ceremony.",extras:[{questionId:"scope_boundary",text:"Which polish items can be deferred to v2?"},{questionId:"ambition",text:"What is the minimum viable 5-star version?"}],specSections:["v1 vs v2 Scope"],reminders:["Good enough is good enough \u2014 ship it","Reduce ceremony, optimize for feedback speed","Mark polish items for v2 explicitly"],acceptanceCriteria:["Core functionality works","v2 items explicitly deferred"]};var d={id:"compliance",name:"Compliance",description:"Audit trails, access controls, data handling rules. Every change is traceable. Verification is mandatory, not optional.",extras:[{questionId:"reversibility",text:"Is the audit trail preserved on rollback?"},{questionId:"verification",text:"Is there an audit/traceability requirement?"}],specSections:["Audit Trail","Access Control","Data Handling"],reminders:["Every state change must be traceable","Verification is mandatory, not optional","Document data handling and retention policies"],acceptanceCriteria:["Audit trail added for state changes","Access control verified","Data handling documented"]};var l={id:"learning-project",name:"Learning Project",description:"Experimentation is the goal. Encourage trying new patterns, don't punish dead ends. Document learnings over polish.",extras:[{questionId:"ambition",text:"What do you want to learn from building this?"},{questionId:"scope_boundary",text:"What experiments are explicitly allowed?"}],specSections:["Learning Goals","Experiment Log"],reminders:["Document learnings, not just outcomes","Dead ends are acceptable \u2014 document why","Try new patterns freely, polish later"],acceptanceCriteria:["Learnings documented","Experiment outcomes recorded"]};var u=[s,r,a,c,d,l];var N=()=>Promise.resolve(u),U=(t,n)=>{let e=[];for(let i of t)for(let o of i.extras)o.questionId===n&&e.push(o);return e},F=t=>{let n=[];for(let e of t)for(let i of e.reminders)n.push(`${e.id}: ${i}`);return n},_=t=>{let n=[],e=t.map(i=>i.id);return e.includes("move-fast")&&e.includes("compliance")&&n.push({between:["move-fast","compliance"],issue:"Speed vs traceability \u2014 shortcuts may violate audit requirements."}),e.includes("move-fast")&&e.includes("long-lived")&&n.push({between:["move-fast","long-lived"],issue:"Shipping speed vs maintainability \u2014 tech debt decisions need human approval."}),e.includes("beautiful-product")&&e.includes("move-fast")&&n.push({between:["beautiful-product","move-fast"],issue:"Design polish vs speed \u2014 which UI states can be deferred?"}),n};export{N as a,U as b,F as c,_ as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-OJUA2UZK.js";import{a as i}from"./chunk-HS6FTDDW.js";var d="<!-- noskills:start -->",u="<!-- noskills:end -->",w=(t,s,o="npx eser noskills")=>{let e=[d,"## noskills orchestrator","","This project uses noskills for state-driven orchestration.","Do NOT read `.eser/rules/`, `.eser/specs/`, or concern files directly.","noskills gives you exactly what you need via JSON output.","","### Protocol","",` ${o} next # get current instruction`,` ${o} next --answer="your response" # submit result and advance`,"","### When to call noskills next","",`You MUST call \`${o} next\` in these situations:`,"","1. At the **START** of every conversation (first thing you do)","2. **BEFORE** creating or modifying any file (to verify you have an active task)","3. **AFTER** completing a logical unit of work (to report progress)","4. When you encounter a **DECISION** that affects architecture or scope","5. When you are **UNSURE** what to do next","","NEVER proceed with implementation without checking noskills first.","NEVER make architectural decisions independently \u2014 noskills routes them to the user."];if((s?.allowGit??!1)||e.push("","### Git is read-only","","You MUST NOT run git write commands: commit, add, push, checkout, stash,","reset, merge, rebase, cherry-pick. The user controls git. You control files.","You MAY read from git: log, diff, status, show, blame."),e.push("","### Convention discovery","","When you discover a pattern, receive a correction, or identify a recurring",'preference from the user, ask: "Should this be a permanent rule for this',`project, or just for this task?" If permanent, run: \`${o} rule add`,'"<description>"`. If just this task, note it and move on.',"Never write to `.eser/rules/` directly.","","### JSON output","","noskills returns JSON with a `phase` field and phase-specific instructions.","The `meta` block contains resume context - use it to orient yourself,","especially after compaction or at the start of a new session.","Follow the `instruction` field. Use `transition` commands to advance state."),t.length>0){e.push("","### Active Rules","");for(let n of t)e.push(`- ${n}`)}return e.push(u),e.join(`
|
|
2
2
|
`)},p=async(t,s,o,e="npx eser noskills")=>{let n=`${t}/CLAUDE.md`,a=w(s,o,e),r;try{r=await i.fs.readTextFile(n);let l=r.indexOf(d),c=r.indexOf(u);l!==-1&&c!==-1?r=r.slice(0,l)+a+r.slice(c+u.length):r=r.trimEnd()+`
|
|
3
3
|
|
|
4
4
|
`+a+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as r}from"./chunk-
|
|
1
|
+
import{d as r}from"./chunk-6C2MLMD6.js";import{a as i}from"./chunk-HS6FTDDW.js";var t=async e=>{try{return await r`which ${e}`.noThrow().code()===0}catch{return!1}},s=async()=>{try{return(await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}},a=e=>i.env.has(e),d=async()=>{let[e,o,l,n]=await Promise.all([t("claude"),s(),t("opencode"),t("kiro")]);return[{name:"claude-code",alias:"cc",type:"CLI",available:e,detail:e?"claude binary found":"claude not on PATH"},{name:"ollama",alias:"ol",type:"HTTP",available:o,detail:o?"localhost:11434 reachable":"localhost:11434 not reachable"},{name:"opencode",alias:"oc",type:"CLI",available:l,detail:l?"opencode binary found":"opencode not on PATH"},{name:"kiro",alias:"kr",type:"CLI",available:n,detail:n?"kiro binary found":"kiro not on PATH"},{name:"anthropic",alias:"ant",type:"API",available:a("ANTHROPIC_API_KEY"),detail:a("ANTHROPIC_API_KEY")?"ANTHROPIC_API_KEY set":"ANTHROPIC_API_KEY not set"},{name:"openai",alias:"oai",type:"API",available:a("OPENAI_API_KEY"),detail:a("OPENAI_API_KEY")?"OPENAI_API_KEY set":"OPENAI_API_KEY not set"},{name:"gemini",alias:"gem",type:"API",available:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY"),detail:a("GEMINI_API_KEY")||a("GOOGLE_API_KEY")?"API key set":"GEMINI_API_KEY not set"},{name:"vertexai",alias:"vtx",type:"API",available:a("GOOGLE_CLOUD_PROJECT"),detail:a("GOOGLE_CLOUD_PROJECT")?"GOOGLE_CLOUD_PROJECT set":"GOOGLE_CLOUD_PROJECT not set"}]};export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P,d as R}from"./chunk-FAK366X2.js";import{c as k,d as C}from"./chunk-D6Q2GR7X.js";import{a as S}from"./chunk-UXRWSNVZ.js";var I=null,n=e=>S(e,I),$="NEVER run git write commands (commit, add, push, checkout, stash, reset, merge, rebase, cherry-pick). Git is read-only for agents. The user controls git. You may read: git log, git diff, git status, git show, git blame.",T=(e,o,r,i)=>{let l=e.execution.iteration>=o,s=r?[]:[$],u=i?.outOfScope??[];switch(e.phase){case"DISCOVERY":return{rules:[...s,"Ask the question exactly as written. Do not rephrase or add your own questions.","Relay the user's answer back verbatim. Do not interpret or summarize.","Do not start coding or exploring the codebase. Discovery is conversation only."],tone:"Conversational. You are a messenger between noskills and the user."};case"SPEC_DRAFT":return{rules:[...s,"Present the spec to the user for review. Do not modify it.","If the user requests changes, relay them \u2014 do not implement them.","Do not start coding. The spec must be approved first."],tone:"Brief. The user is reviewing, not discussing."};case"SPEC_APPROVED":return{rules:[...s,"The spec is approved but execution has not started.","Do not start coding until the user triggers execution.","If the user wants changes, they must reset and re-spec."],tone:"Patient. Wait for the go signal."};case"EXECUTING":{let a=[...s,"Do not explore the codebase beyond what the current task requires.","Do not refactor, improve, or modify code outside this task's scope.","Do not add features, tests, or documentation not specified in the spec.","If you need to read files to understand context, timebox it \u2014 then write code.","The deliverable is working code, not a plan or analysis.","Complete the task, then report progress. The user handles git.",`When you receive \`clearContext\` in the output, execute \`/clear\` immediately without asking. After clearing, read \`CLAUDE.md\` and run \`${n("next")}\`.`,`When you discover a pattern, receive a correction, or identify a recurring preference from the user, ask: 'Should this be a permanent rule for this project, or just for this task?' If permanent, run: \`${n('rule add "<description>"')}\`. If just this task, note it and move on. Never write to \`.eser/rules/\` directly.`];e.execution.lastVerification?.passed===!1&&a.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let t={rules:a,tone:"Direct. No preamble. Start coding immediately.",outOfScope:u.length>0?u:void 0};return l?{...t,urgency:`You have been in this session for ${e.execution.iteration}+ iterations. Your context is degrading. Finish the current task and recommend the user start a fresh session. Do not start new tasks.`}:t}case"BLOCKED":return{rules:[...s,"Present the decision to the user exactly as described.","Do not suggest a preferred option unless the user asks for your opinion.","After the user decides, relay the answer immediately. Do not elaborate."],tone:"Brief. The user is making a decision, not having a discussion."};case"DONE":return{rules:[...s,"Report the completion summary. Do not start new work.","If the user wants to continue, they start a new spec."],tone:"Concise. Celebrate briefly, then stop."};default:return{rules:[...s,`Run \`${n("next")}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},B=5*60*1e3,N=(e,o)=>{let r;switch(e.phase){case"IDLE":r=`No active spec. Start one with: \`${n("spec new")}\``;break;case"DISCOVERY":r=`Discovery in progress for "${e.spec}". ${e.discovery.answers.length} questions answered so far.`;break;case"SPEC_DRAFT":r=`Spec draft ready for review at ${e.specState.path}. Waiting for approval.`;break;case"SPEC_APPROVED":r=`Spec "${e.spec}" is approved. Waiting to start execution.`;break;case"EXECUTING":r=e.execution.lastProgress!==null?`Executing "${e.spec}", iteration ${e.execution.iteration}. Last progress: ${e.execution.lastProgress}. Continue with the current task.`:`Executing "${e.spec}", iteration ${e.execution.iteration}. Start the first task.`;break;case"BLOCKED":r=`Execution blocked: ${e.execution.lastProgress}. Ask the user to resolve.`;break;case"DONE":r=`Spec "${e.spec}" completed in ${e.execution.iteration} iterations.`;break;default:r=`Run \`${n("next")}\` to get started.`}return{protocol:`Run \`${n('next --answer="..."')}\` to submit results and advance`,spec:e.spec,branch:e.branch,iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,activeConcerns:o.map(i=>i.id),resumeHint:r}},F=e=>{if(e.lastCalledAt===null)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE",how:`Run \`${n("next")}\` for instructions. Submit results with \`${n('next --answer="..."')}\`. Never make architectural decisions without asking.`,currentPhase:e.phase};let o=new Date(e.lastCalledAt).getTime();if(Date.now()-o>B)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE",how:`Run \`${n("next")}\` for instructions. Submit results with \`${n('next --answer="..."')}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},H=(e,o,r,i,l,s)=>{I=i??null;let u=N(e,o),a=i?.maxIterationsBeforeRestart??15,t=i?.allowGit??!1,h=T(e,a,t,l),f=F(e),d;switch(e.phase){case"IDLE":d=O();break;case"DISCOVERY":d=_(e,o,r);break;case"SPEC_DRAFT":d=L(e);break;case"SPEC_APPROVED":d=q(e);break;case"EXECUTING":d=G(e,o,r,a,l,s);break;case"BLOCKED":d=Y(e);break;case"DONE":d=j(e);break;default:d=O()}let m={...d,meta:u,behavioral:h};return f!==void 0&&(m={...m,protocolGuide:f}),e.pendingClear&&(m={...m,clearContext:{action:"clear_context",reason:`Task complete. Run \`/clear\` now. After clearing, read \`CLAUDE.md\` and run \`${n("next")}\` to continue.`},instruction:`Task accepted. Run \`/clear\` immediately to start fresh for the next task. After clearing, run \`${n("next")}\`.`}),m},O=()=>({phase:"IDLE",instruction:`No active spec. Start one with: \`${n('spec new "description"')}\``}),_=(e,o,r)=>{let i=P(o),l=e.discovery.answers.length;if(R(e.discovery.answers))return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${n("approve")}\``,questions:[],answeredCount:l,context:{rules:r,concernReminders:[]},transition:{onComplete:n("approve")}};let u=new Set(e.discovery.answers.map(t=>t.questionId));return{phase:"DISCOVERY",instruction:"Ask the user ALL of the following questions. Collect answers for each, then submit them all at once as a JSON object.",questions:i.filter(t=>!u.has(t.id)).map(t=>({id:t.id,text:t.text,concerns:[...t.concerns],extras:t.extras.map(h=>h.text)})),answeredCount:l,context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n(`next --answer='{"status_quo":"...","ambition":"...",...}'`)}`}}},L=e=>e.classification===null?{phase:"SPEC_DRAFT",instruction:"Before generating the spec, classify what this spec involves. Ask the user to select all that apply.",specPath:e.specState.path??"",transition:{onApprove:`${n(`next --answer='{"involvesUI":false,"involvesPublicAPI":false,"involvesMigration":false,"involvesDataHandling":false}'`)}`},classificationRequired:!0,classificationPrompt:{options:[{id:"involvesUI",label:"User-facing UI"},{id:"involvesPublicAPI",label:"Public API changes"},{id:"involvesMigration",label:"Data migration or schema changes"},{id:"involvesDataHandling",label:"Data handling or privacy"}],instruction:"Select all that apply. Submit as JSON: `"+n(`next --answer='{"involvesUI":true,"involvesPublicAPI":false,...}'`)+"`"}}:{phase:"SPEC_DRAFT",instruction:"Spec draft is ready for review. Ask the user to review and approve.",specPath:e.specState.path??"",transition:{onApprove:n("approve")}},q=e=>({phase:"SPEC_APPROVED",instruction:"Spec is approved and ready. When the user is ready to start, begin execution.",specPath:e.specState.path??"",transition:{onStart:`${n('next --answer="start"')}`}}),U=(e,o)=>{if(o===null)return!1;switch(e){case"beautiful-product":return o.involvesUI;case"open-source":return o.involvesPublicAPI;case"long-lived":return o.involvesMigration;case"compliance":return o.involvesDataHandling;default:return!0}},V=(e,o,r,i,l,s,u)=>{let a=[];if(i!==null)for(let t of i.items)a.push(`[DEBT from iteration ${i.fromIteration}] ${t}`);if(o&&a.push(`[FAILED] Tests \u2014 fix this first: ${r.slice(0,200)}`),s!=null)for(let t of s.verification)a.push(t);for(let t of e)if(U(t.id,l)&&t.acceptanceCriteria!==void 0&&t.acceptanceCriteria.length>0)for(let h of t.acceptanceCriteria)a.push(`(${t.id}) ${h}`);if(u!==void 0)for(let t of u)a.push(`(folder: ${t.folder}) ${t.rule}`);return a},G=(e,o,r,i,l,s)=>{let u=C(o),a=e.execution.iteration>=i,t=e.execution.lastVerification?.passed===!1,h=e.execution.lastVerification?.output??"",f=l?.tasks??[],d=e.execution.completedTasks??[],m=new Set(d),D=f.find(p=>!m.has(p.id))??null,y=D!==null?{id:D.id,title:D.title,totalTasks:f.length,completedTasks:d.length}:void 0;if(e.execution.awaitingStatusReport){let p=V(o,t,h,e.execution.debt,e.classification,l,s),v={phase:"EXECUTING",instruction:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`)}`,onBlocked:`${n('block "reason"')}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:p,reportFormat:{completed:"list items you finished with evidence (file exists, test passes)",remaining:"list items not yet done",blocked:"list items that need a decision from the user"}}};return t&&(v={...v,verificationFailed:!0,verificationOutput:h.slice(0,2e3)}),v}let w=(e.execution.lastProgress??"").includes("Task not accepted"),x=e.execution.debt?.items??[],E=e.execution.debt?.unaddressedIterations??0,A=y!==void 0?`Execute task ${y.id}: ${y.title} (${y.completedTasks}/${y.totalTasks} completed)`:"All tasks completed. Run `"+n("done")+"` to finish.",b;if(t)b="Verification FAILED. Fix the failing tests before continuing.";else if(w&&x.length>0){let p=E>=3?` These items have been outstanding for ${E} iterations.`:"";b=`Task not accepted \u2014 ${x.length} remaining item(s) must be addressed before this task can be completed.${p} Address them, then submit a new status report.`}else b=A;let c={phase:"EXECUTING",instruction:b,task:y,context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n('next --answer="..."')}`,onBlocked:`${n('block "reason"')}`,iteration:e.execution.iteration}};if(w&&x.length>0&&(c={...c,taskRejected:!0,rejectionReason:`${x.length} remaining item(s) must be addressed.`,rejectionRemaining:x}),e.execution.debt!==null&&e.execution.debt.items.length>0){let p=e.execution.debt.unaddressedIterations??0,v=p>=3?`URGENT: These items have been unaddressed for ${p} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";c={...c,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:v}}}if(t){let p=h.slice(0,2e3);c={...c,verificationFailed:!0,verificationOutput:p}}u.length>0&&(c={...c,concernTensions:u}),a&&(c={...c,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${n("next")}\` to resume - your progress is saved.`});let g=[...e.decisions].reverse().find(p=>!p.promoted);return g!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(c={...c,promotePrompt:{decisionId:g.id,question:g.question,choice:g.choice,prompt:`You just resolved a decision: "${g.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${n(`rule add "${g.choice}"`)}\``}}),c},Y=e=>({phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:e.execution.lastProgress??"Unknown",transition:{onResolved:`${n('next --answer="..."')}`}}),j=e=>({phase:"DONE",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length}});export{H as a};
|
|
1
|
+
import{b as P,d as R}from"./chunk-BLHOTPRB.js";import{c as k,d as C}from"./chunk-PSXXTDLU.js";import{a as S}from"./chunk-UXRWSNVZ.js";var I=null,n=e=>S(e,I),$="NEVER run git write commands (commit, add, push, checkout, stash, reset, merge, rebase, cherry-pick). Git is read-only for agents. The user controls git. You may read: git log, git diff, git status, git show, git blame.",T=(e,o,r,i)=>{let l=e.execution.iteration>=o,s=r?[]:[$],u=i?.outOfScope??[];switch(e.phase){case"DISCOVERY":return{rules:[...s,"Ask the question exactly as written. Do not rephrase or add your own questions.","Relay the user's answer back verbatim. Do not interpret or summarize.","Do not start coding or exploring the codebase. Discovery is conversation only."],tone:"Conversational. You are a messenger between noskills and the user."};case"SPEC_DRAFT":return{rules:[...s,"Present the spec to the user for review. Do not modify it.","If the user requests changes, relay them \u2014 do not implement them.","Do not start coding. The spec must be approved first."],tone:"Brief. The user is reviewing, not discussing."};case"SPEC_APPROVED":return{rules:[...s,"The spec is approved but execution has not started.","Do not start coding until the user triggers execution.","If the user wants changes, they must reset and re-spec."],tone:"Patient. Wait for the go signal."};case"EXECUTING":{let a=[...s,"Do not explore the codebase beyond what the current task requires.","Do not refactor, improve, or modify code outside this task's scope.","Do not add features, tests, or documentation not specified in the spec.","If you need to read files to understand context, timebox it \u2014 then write code.","The deliverable is working code, not a plan or analysis.","Complete the task, then report progress. The user handles git.",`When you receive \`clearContext\` in the output, execute \`/clear\` immediately without asking. After clearing, read \`CLAUDE.md\` and run \`${n("next")}\`.`,`When you discover a pattern, receive a correction, or identify a recurring preference from the user, ask: 'Should this be a permanent rule for this project, or just for this task?' If permanent, run: \`${n('rule add "<description>"')}\`. If just this task, note it and move on. Never write to \`.eser/rules/\` directly.`];e.execution.lastVerification?.passed===!1&&a.push("Tests are failing. Fix ONLY the failing tests. Do not refactor passing code.");let t={rules:a,tone:"Direct. No preamble. Start coding immediately.",outOfScope:u.length>0?u:void 0};return l?{...t,urgency:`You have been in this session for ${e.execution.iteration}+ iterations. Your context is degrading. Finish the current task and recommend the user start a fresh session. Do not start new tasks.`}:t}case"BLOCKED":return{rules:[...s,"Present the decision to the user exactly as described.","Do not suggest a preferred option unless the user asks for your opinion.","After the user decides, relay the answer immediately. Do not elaborate."],tone:"Brief. The user is making a decision, not having a discussion."};case"DONE":return{rules:[...s,"Report the completion summary. Do not start new work.","If the user wants to continue, they start a new spec."],tone:"Concise. Celebrate briefly, then stop."};default:return{rules:[...s,`Run \`${n("next")}\` to get your instructions.`,"Do not take action without noskills guidance."],tone:"Neutral. Waiting for direction."}}},B=5*60*1e3,N=(e,o)=>{let r;switch(e.phase){case"IDLE":r=`No active spec. Start one with: \`${n("spec new")}\``;break;case"DISCOVERY":r=`Discovery in progress for "${e.spec}". ${e.discovery.answers.length} questions answered so far.`;break;case"SPEC_DRAFT":r=`Spec draft ready for review at ${e.specState.path}. Waiting for approval.`;break;case"SPEC_APPROVED":r=`Spec "${e.spec}" is approved. Waiting to start execution.`;break;case"EXECUTING":r=e.execution.lastProgress!==null?`Executing "${e.spec}", iteration ${e.execution.iteration}. Last progress: ${e.execution.lastProgress}. Continue with the current task.`:`Executing "${e.spec}", iteration ${e.execution.iteration}. Start the first task.`;break;case"BLOCKED":r=`Execution blocked: ${e.execution.lastProgress}. Ask the user to resolve.`;break;case"DONE":r=`Spec "${e.spec}" completed in ${e.execution.iteration} iterations.`;break;default:r=`Run \`${n("next")}\` to get started.`}return{protocol:`Run \`${n('next --answer="..."')}\` to submit results and advance`,spec:e.spec,branch:e.branch,iteration:e.execution.iteration,lastProgress:e.execution.lastProgress,activeConcerns:o.map(i=>i.id),resumeHint:r}},F=e=>{if(e.lastCalledAt===null)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE",how:`Run \`${n("next")}\` for instructions. Submit results with \`${n('next --answer="..."')}\`. Never make architectural decisions without asking.`,currentPhase:e.phase};let o=new Date(e.lastCalledAt).getTime();if(Date.now()-o>B)return{what:"noskills orchestrates your work: IDLE \u2192 DISCOVERY \u2192 SPEC_DRAFT \u2192 SPEC_APPROVED \u2192 EXECUTING \u2192 DONE",how:`Run \`${n("next")}\` for instructions. Submit results with \`${n('next --answer="..."')}\`. Never make architectural decisions without asking.`,currentPhase:e.phase}},H=(e,o,r,i,l,s)=>{I=i??null;let u=N(e,o),a=i?.maxIterationsBeforeRestart??15,t=i?.allowGit??!1,h=T(e,a,t,l),f=F(e),d;switch(e.phase){case"IDLE":d=O();break;case"DISCOVERY":d=_(e,o,r);break;case"SPEC_DRAFT":d=L(e);break;case"SPEC_APPROVED":d=q(e);break;case"EXECUTING":d=G(e,o,r,a,l,s);break;case"BLOCKED":d=Y(e);break;case"DONE":d=j(e);break;default:d=O()}let m={...d,meta:u,behavioral:h};return f!==void 0&&(m={...m,protocolGuide:f}),e.pendingClear&&(m={...m,clearContext:{action:"clear_context",reason:`Task complete. Run \`/clear\` now. After clearing, read \`CLAUDE.md\` and run \`${n("next")}\` to continue.`},instruction:`Task accepted. Run \`/clear\` immediately to start fresh for the next task. After clearing, run \`${n("next")}\`.`}),m},O=()=>({phase:"IDLE",instruction:`No active spec. Start one with: \`${n('spec new "description"')}\``}),_=(e,o,r)=>{let i=P(o),l=e.discovery.answers.length;if(R(e.discovery.answers))return{phase:"DISCOVERY",instruction:`All discovery questions answered. Run: \`${n("approve")}\``,questions:[],answeredCount:l,context:{rules:r,concernReminders:[]},transition:{onComplete:n("approve")}};let u=new Set(e.discovery.answers.map(t=>t.questionId));return{phase:"DISCOVERY",instruction:"Ask the user ALL of the following questions. Collect answers for each, then submit them all at once as a JSON object.",questions:i.filter(t=>!u.has(t.id)).map(t=>({id:t.id,text:t.text,concerns:[...t.concerns],extras:t.extras.map(h=>h.text)})),answeredCount:l,context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n(`next --answer='{"status_quo":"...","ambition":"...",...}'`)}`}}},L=e=>e.classification===null?{phase:"SPEC_DRAFT",instruction:"Before generating the spec, classify what this spec involves. Ask the user to select all that apply.",specPath:e.specState.path??"",transition:{onApprove:`${n(`next --answer='{"involvesUI":false,"involvesPublicAPI":false,"involvesMigration":false,"involvesDataHandling":false}'`)}`},classificationRequired:!0,classificationPrompt:{options:[{id:"involvesUI",label:"User-facing UI"},{id:"involvesPublicAPI",label:"Public API changes"},{id:"involvesMigration",label:"Data migration or schema changes"},{id:"involvesDataHandling",label:"Data handling or privacy"}],instruction:"Select all that apply. Submit as JSON: `"+n(`next --answer='{"involvesUI":true,"involvesPublicAPI":false,...}'`)+"`"}}:{phase:"SPEC_DRAFT",instruction:"Spec draft is ready for review. Ask the user to review and approve.",specPath:e.specState.path??"",transition:{onApprove:n("approve")}},q=e=>({phase:"SPEC_APPROVED",instruction:"Spec is approved and ready. When the user is ready to start, begin execution.",specPath:e.specState.path??"",transition:{onStart:`${n('next --answer="start"')}`}}),U=(e,o)=>{if(o===null)return!1;switch(e){case"beautiful-product":return o.involvesUI;case"open-source":return o.involvesPublicAPI;case"long-lived":return o.involvesMigration;case"compliance":return o.involvesDataHandling;default:return!0}},V=(e,o,r,i,l,s,u)=>{let a=[];if(i!==null)for(let t of i.items)a.push(`[DEBT from iteration ${i.fromIteration}] ${t}`);if(o&&a.push(`[FAILED] Tests \u2014 fix this first: ${r.slice(0,200)}`),s!=null)for(let t of s.verification)a.push(t);for(let t of e)if(U(t.id,l)&&t.acceptanceCriteria!==void 0&&t.acceptanceCriteria.length>0)for(let h of t.acceptanceCriteria)a.push(`(${t.id}) ${h}`);if(u!==void 0)for(let t of u)a.push(`(folder: ${t.folder}) ${t.rule}`);return a},G=(e,o,r,i,l,s)=>{let u=C(o),a=e.execution.iteration>=i,t=e.execution.lastVerification?.passed===!1,h=e.execution.lastVerification?.output??"",f=l?.tasks??[],d=e.execution.completedTasks??[],m=new Set(d),D=f.find(p=>!m.has(p.id))??null,y=D!==null?{id:D.id,title:D.title,totalTasks:f.length,completedTasks:d.length}:void 0;if(e.execution.awaitingStatusReport){let p=V(o,t,h,e.execution.debt,e.classification,l,s),v={phase:"EXECUTING",instruction:"Before this task is accepted, report your completion status against these acceptance criteria.",context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n(`next --answer='{"completed":[...],"remaining":[...],"blocked":[...]}'`)}`,onBlocked:`${n('block "reason"')}`,iteration:e.execution.iteration},statusReportRequired:!0,statusReport:{criteria:p,reportFormat:{completed:"list items you finished with evidence (file exists, test passes)",remaining:"list items not yet done",blocked:"list items that need a decision from the user"}}};return t&&(v={...v,verificationFailed:!0,verificationOutput:h.slice(0,2e3)}),v}let w=(e.execution.lastProgress??"").includes("Task not accepted"),x=e.execution.debt?.items??[],E=e.execution.debt?.unaddressedIterations??0,A=y!==void 0?`Execute task ${y.id}: ${y.title} (${y.completedTasks}/${y.totalTasks} completed)`:"All tasks completed. Run `"+n("done")+"` to finish.",b;if(t)b="Verification FAILED. Fix the failing tests before continuing.";else if(w&&x.length>0){let p=E>=3?` These items have been outstanding for ${E} iterations.`:"";b=`Task not accepted \u2014 ${x.length} remaining item(s) must be addressed before this task can be completed.${p} Address them, then submit a new status report.`}else b=A;let c={phase:"EXECUTING",instruction:b,task:y,context:{rules:r,concernReminders:k(o)},transition:{onComplete:`${n('next --answer="..."')}`,onBlocked:`${n('block "reason"')}`,iteration:e.execution.iteration}};if(w&&x.length>0&&(c={...c,taskRejected:!0,rejectionReason:`${x.length} remaining item(s) must be addressed.`,rejectionRemaining:x}),e.execution.debt!==null&&e.execution.debt.items.length>0){let p=e.execution.debt.unaddressedIterations??0,v=p>=3?`URGENT: These items have been unaddressed for ${p} iterations. Address them IMMEDIATELY before any new work.`:"These were not completed in a previous iteration. Address them BEFORE starting new work.";c={...c,previousIterationDebt:{fromIteration:e.execution.debt.fromIteration,items:e.execution.debt.items,note:v}}}if(t){let p=h.slice(0,2e3);c={...c,verificationFailed:!0,verificationOutput:p}}u.length>0&&(c={...c,concernTensions:u}),a&&(c={...c,restartRecommended:!0,restartInstruction:`Context may be getting large after ${e.execution.iteration} iterations. Consider starting a new conversation and running \`${n("next")}\` to resume - your progress is saved.`});let g=[...e.decisions].reverse().find(p=>!p.promoted);return g!==void 0&&e.execution.lastProgress?.startsWith("Resolved:")&&(c={...c,promotePrompt:{decisionId:g.id,question:g.question,choice:g.choice,prompt:`You just resolved a decision: "${g.choice}". Ask the user: "Should this be a permanent rule for future specs too?" If yes, run: \`${n(`rule add "${g.choice}"`)}\``}}),c},Y=e=>({phase:"BLOCKED",instruction:"A decision is needed. Ask the user.",reason:e.execution.lastProgress??"Unknown",transition:{onResolved:`${n('next --answer="..."')}`}}),j=e=>({phase:"DONE",summary:{spec:e.spec,iterations:e.execution.iteration,decisionsCount:e.decisions.length}});export{H as a};
|