@staff0rd/assist 0.142.0 → 0.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,7 @@ Once you have enough context, propose a complete backlog item. Show it to the us
38
38
 
39
39
  Keep phases small (2-4 tasks each). A typical item should have 2-3 phases.
40
40
 
41
- Most phases should NOT have manual checks — prefer automated verification via the `verify` field on tasks. Only add `manualChecks` to a phase when the checks are genuinely difficult to automate (e.g. visual appearance, UX flow, hardware interaction). The last phase should always have at least one manual check to confirm the feature works end-to-end.
41
+ Most phases should NOT have manual checks — prefer automated verification via the `verify` field on tasks. Only add `manualChecks` to a phase when the checks are genuinely difficult to automate (e.g. visual appearance, UX flow, hardware interaction). Do not add a final phase just for end-to-end verification a review phase is auto-appended at runtime.
42
42
 
43
43
  ## Step 4: Iterate
44
44
 
@@ -62,7 +62,7 @@ ${t}</tr>
62
62
  `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
63
63
  `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Le(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let l=this.parser.parseInline(n),a=H0(t);if(a===null)return l;t=a;let i='<a href="'+t+'"';return e&&(i+=' title="'+Le(e)+'"'),i+=">"+l+"</a>",i}image({href:t,title:e,text:n,tokens:l}){l&&(n=this.parser.parseInline(l,this.parser.textRenderer));let a=H0(t);if(a===null)return Le(n);t=a;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${Le(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Le(t.text)}},yf=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},cn=class rf{constructor(e){w(this,"options");w(this,"renderer");w(this,"textRenderer");this.options=e||yl,this.options.renderer=this.options.renderer||new Xc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yf}static parse(e,n){return new rf(n).parse(e)}static parseInline(e,n){return new rf(n).parseInline(e)}parse(e,n=!0){let l="";for(let a=0;a<e.length;a++){let i=e[a];if(this.options.extensions?.renderers?.[i.type]){let c=i,o=this.options.extensions.renderers[c.type].call({parser:this},c);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){l+=o||"";continue}}let u=i;switch(u.type){case"space":{l+=this.renderer.space(u);continue}case"hr":{l+=this.renderer.hr(u);continue}case"heading":{l+=this.renderer.heading(u);continue}case"code":{l+=this.renderer.code(u);continue}case"table":{l+=this.renderer.table(u);continue}case"blockquote":{l+=this.renderer.blockquote(u);continue}case"list":{l+=this.renderer.list(u);continue}case"html":{l+=this.renderer.html(u);continue}case"paragraph":{l+=this.renderer.paragraph(u);continue}case"text":{let c=u,o=this.renderer.text(c);for(;a+1<e.length&&e[a+1].type==="text";)c=e[++a],o+=`
64
64
  `+this.renderer.text(c);n?l+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):l+=o;continue}default:{let c='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return l}parseInline(e,n=this.renderer){let l="";for(let a=0;a<e.length;a++){let i=e[a];if(this.options.extensions?.renderers?.[i.type]){let c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){l+=c||"";continue}}let u=i;switch(u.type){case"escape":{l+=n.text(u);break}case"html":{l+=n.html(u);break}case"link":{l+=n.link(u);break}case"image":{l+=n.image(u);break}case"strong":{l+=n.strong(u);break}case"em":{l+=n.em(u);break}case"codespan":{l+=n.codespan(u);break}case"br":{l+=n.br(u);break}case"del":{l+=n.del(u);break}case"text":{l+=n.text(u);break}default:{let c='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return l}},uf,Gc=(uf=class{constructor(t){w(this,"options");w(this,"block");this.options=t||yl}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?un.lex:un.lexInline}provideParser(){return this.block?cn.parse:cn.parseInline}},w(uf,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),uf),D2=class{constructor(...t){w(this,"defaults",sf());w(this,"options",this.setOptions);w(this,"parse",this.parseMarkdown(!0));w(this,"parseInline",this.parseMarkdown(!1));w(this,"Parser",cn);w(this,"Renderer",Xc);w(this,"TextRenderer",yf);w(this,"Lexer",un);w(this,"Tokenizer",Qc);w(this,"Hooks",Gc);this.use(...t)}walkTokens(t,e){let n=[];for(let l of t)switch(n=n.concat(e.call(this,l)),l.type){case"table":{let a=l;for(let i of a.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of a.rows)for(let u of i)n=n.concat(this.walkTokens(u.tokens,e));break}case"list":{let a=l;n=n.concat(this.walkTokens(a.items,e));break}default:{let a=l;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(i=>{let u=a[i].flat(1/0);n=n.concat(this.walkTokens(u,e))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let l={...n};if(l.async=this.defaults.async||l.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let i=e.renderers[a.name];i?e.renderers[a.name]=function(...u){let c=a.renderer.apply(this,u);return c===!1&&(c=i.apply(this,u)),c}:e.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[a.level];i?i.unshift(a.tokenizer):e[a.level]=[a.tokenizer],a.start&&(a.level==="block"?e.startBlock?e.startBlock.push(a.start):e.startBlock=[a.start]:a.level==="inline"&&(e.startInline?e.startInline.push(a.start):e.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(e.childTokens[a.name]=a.childTokens)}),l.extensions=e),n.renderer){let a=this.defaults.renderer||new Xc(this.defaults);for(let i in n.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let u=i,c=n.renderer[u],o=a[u];a[u]=(...r)=>{let f=c.apply(a,r);return f===!1&&(f=o.apply(a,r)),f||""}}l.renderer=a}if(n.tokenizer){let a=this.defaults.tokenizer||new Qc(this.defaults);for(let i in n.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let u=i,c=n.tokenizer[u],o=a[u];a[u]=(...r)=>{let f=c.apply(a,r);return f===!1&&(f=o.apply(a,r)),f}}l.tokenizer=a}if(n.hooks){let a=this.defaults.hooks||new Gc;for(let i in n.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let u=i,c=n.hooks[u],o=a[u];Gc.passThroughHooks.has(i)?a[u]=r=>{if(this.defaults.async)return Promise.resolve(c.call(a,r)).then(d=>o.call(a,d));let f=c.call(a,r);return o.call(a,f)}:a[u]=(...r)=>{let f=c.apply(a,r);return f===!1&&(f=o.apply(a,r)),f}}l.hooks=a}if(n.walkTokens){let a=this.defaults.walkTokens,i=n.walkTokens;l.walkTokens=function(u){let c=[];return c.push(i.call(this,u)),a&&(c=c.concat(a.call(this,u))),c}}this.defaults={...this.defaults,...l}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return un.lex(t,e??this.defaults)}parser(t,e){return cn.parse(t,e??this.defaults)}parseMarkdown(t){return(n,l)=>{let a={...l},i={...this.defaults,...a},u=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return u(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);let c=i.hooks?i.hooks.provideLexer():t?un.lex:un.lexInline,o=i.hooks?i.hooks.provideParser():t?cn.parse:cn.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(r=>c(r,i)).then(r=>i.hooks?i.hooks.processAllTokens(r):r).then(r=>i.walkTokens?Promise.all(this.walkTokens(r,i.walkTokens)).then(()=>r):r).then(r=>o(r,i)).then(r=>i.hooks?i.hooks.postprocess(r):r).catch(u);try{i.hooks&&(n=i.hooks.preprocess(n));let r=c(n,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let f=o(r,i);return i.hooks&&(f=i.hooks.postprocess(f)),f}catch(r){return u(r)}}}onError(t,e){return n=>{if(n.message+=`
65
- Please report this to https://github.com/markedjs/marked.`,t){let l="<p>An error occurred:</p><pre>"+Le(n.message+"",!0)+"</pre>";return e?Promise.resolve(l):l}if(e)return Promise.reject(n);throw n}}},vl=new D2;function q(t,e){return vl.parse(t,e)}q.options=q.setOptions=function(t){return vl.setOptions(t),q.defaults=vl.defaults,Y0(q.defaults),q};q.getDefaults=sf;q.defaults=yl;q.use=function(...t){return vl.use(...t),q.defaults=vl.defaults,Y0(q.defaults),q};q.walkTokens=function(t,e){return vl.walkTokens(t,e)};q.parseInline=vl.parseInline;q.Parser=cn;q.parser=cn.parse;q.Renderer=Xc;q.TextRenderer=yf;q.Lexer=un;q.lexer=un.lex;q.Tokenizer=Qc;q.Hooks=Gc;q.parse=q;var S3=q.options,E3=q.setOptions,x3=q.use,A3=q.walkTokens,T3=q.parseInline;var R3=cn.parse,_3=un.lex;var W0=A(B(),1),on=A(z(),1);function N2({text:t}){return(0,on.jsx)("div",{className:"border border-gray-200 rounded-md p-3 mt-2 min-h-[60px] bg-gray-50",dangerouslySetInnerHTML:{__html:q.parse(t||"")}})}function P0({value:t,onChange:e}){let[n,l]=(0,W0.useState)(!1);return(0,on.jsxs)(Ut.Root,{className:"mb-4",children:[(0,on.jsxs)(Ut.Label,{className:"block font-medium mb-1 text-sm",children:["Description"," ",(0,on.jsx)("button",{type:"button",className:"text-xs text-blue-600 cursor-pointer ml-2 bg-transparent border-none p-0",onClick:()=>l(!n),children:"(preview)"})]}),(0,on.jsx)(Ut.Control,{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm font-[inherit] min-h-[120px] resize-y",render:(0,on.jsx)("textarea",{}),placeholder:"Markdown supported",value:t,onChange:a=>e(a.target.value)}),n&&(0,on.jsx)(N2,{text:t})]})}var Ui=A(z(),1);function tv({submitLabel:t,onCancel:e}){return(0,Ui.jsxs)("div",{className:"flex gap-2 mt-4",children:[(0,Ui.jsx)("button",{type:"submit",className:"bg-blue-600 hover:bg-blue-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",children:t}),(0,Ui.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:e,children:"Cancel"})]})}async function ev(t,e,n,l,a){let i=e.trim();if(!i)return;let u={type:t,name:i,description:n.trim()||void 0,acceptanceCriteria:l.map(o=>o.trim()).filter(Boolean)};return a?(await Tg(a.id,u),a.id):(await xg(u)).id}function nv(t){return{type:t?.type??"story",name:t?.name??"",description:t?.description??"",ac:t?.acceptanceCriteria??[],title:t?"Edit Item":"Add Item",submitLabel:t?"Save":"Add"}}async function lv(t,e,n,l,a,i,u){t.preventDefault();let c=await ev(e,n,l,a,i);c!==void 0&&u(c)}var ya=A(z(),1);function av({value:t,onChange:e}){return(0,ya.jsxs)(Ut.Root,{className:"mb-4",children:[(0,ya.jsx)(Ut.Label,{className:"block font-medium mb-1 text-sm",children:"Name"}),(0,ya.jsx)(Ut.Control,{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm font-[inherit]",required:!0,placeholder:"Item name",value:t,onChange:n=>e(n.target.value)}),(0,ya.jsx)(Ut.Error,{className:"text-red-500 text-xs mt-1",match:"valueMissing",children:"Name is required."})]})}var Vn=A(z(),1);function iv({value:t,onChange:e}){return(0,Vn.jsxs)("fieldset",{className:"mb-4",children:[(0,Vn.jsx)("legend",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),(0,Vn.jsx)("div",{className:"flex gap-4",children:["story","bug"].map(n=>(0,Vn.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,Vn.jsx)("input",{type:"radio",name:"type",value:n,checked:t===n,onChange:()=>e(n)}),(0,Vn.jsx)("span",{className:"text-sm capitalize",children:n})]},n))})]})}var re=A(z(),1);function Jc({item:t,onSaved:e,onCancel:n}){let l=nv(t),[a,i]=(0,ba.useState)(l.type),[u,c]=(0,ba.useState)(l.name),[o,r]=(0,ba.useState)(l.description),f=(0,ba.useRef)(l.ac);return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(qc,{onClick:n}),(0,re.jsxs)(Fs,{className:"bg-white rounded-lg p-6 border border-gray-200",onSubmit:d=>lv(d,a,u,o,f.current,t,e),children:[(0,re.jsx)("h2",{className:"mb-4",children:l.title}),(0,re.jsx)(iv,{value:a,onChange:i}),(0,re.jsx)(av,{value:u,onChange:c}),(0,re.jsx)(P0,{value:o,onChange:r}),(0,re.jsx)(w0,{initial:l.ac,onChange:d=>{f.current=d}}),(0,re.jsx)(tv,{submitLabel:l.submitLabel,onCancel:n})]})]})}var vt={};function cv(t){return"init"in t}function bf(t){return!!t.write}function uv(t){return"v"in t||"e"in t}function Fc(t){if("e"in t)throw t.e;if((vt.env?vt.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function Ic(t){return typeof t?.then=="function"}function ov(t,e,n){if(!n.p.has(t)){n.p.add(t);let l=()=>n.p.delete(t);e.then(l,l)}}function rv(t,e,n){var l;let a=new Set;for(let i of((l=n.get(t))==null?void 0:l.t)||[])a.add(i);for(let i of e.p)a.add(i);return a}var M2=(t,e,...n)=>e.read(...n),k2=(t,e,...n)=>e.write(...n),w2=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},B2=(t,e,n)=>{var l;return(l=e.onMount)==null?void 0:l.call(e,n)},U2=(t,e)=>{var n;let l=Et(t),a=l[0],i=l[6],u=l[9];if((vt.env?vt.env.MODE:void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let c=a.get(e);return c||(c={d:new Map,p:new Set,n:0},a.set(e,c),(n=i.i)==null||n.call(i,e),u?.(t,e)),c},L2=t=>{let e=Et(t),n=e[1],l=e[3],a=e[4],i=e[5],u=e[6],c=e[13],o=[],r=f=>{try{f()}catch(d){o.push(d)}};do{u.f&&r(u.f);let f=new Set,d=f.add.bind(f);l.forEach(s=>{var p;return(p=n.get(s))==null?void 0:p.l.forEach(d)}),l.clear(),i.forEach(d),i.clear(),a.forEach(d),a.clear(),f.forEach(r),l.size&&c(t)}while(l.size||i.size||a.size);if(o.length)throw new AggregateError(o)},H2=t=>{let e=Et(t),n=e[1],l=e[2],a=e[3],i=e[11],u=e[14],c=e[17],o=[],r=new WeakSet,f=new WeakSet,d=Array.from(a);for(;d.length;){let s=d[d.length-1],p=i(t,s);if(f.has(s)){d.pop();continue}if(r.has(s)){if(l.get(s)===p.n)o.push([s,p]);else if((vt.env?vt.env.MODE:void 0)!=="production"&&l.has(s))throw new Error("[Bug] invalidated atom exists");f.add(s),d.pop();continue}r.add(s);for(let v of rv(s,p,n))r.has(v)||d.push(v)}for(let s=o.length-1;s>=0;--s){let[p,v]=o[s],S=!1;for(let T of v.d.keys())if(T!==p&&a.has(T)){S=!0;break}S&&(u(t,p),c(t,p)),l.delete(p)}},Sf=new WeakSet,V2=(t,e)=>{var n,l;let a=Et(t),i=a[1],u=a[2],c=a[3],o=a[6],r=a[7],f=a[11],d=a[12],s=a[13],p=a[14],v=a[16],S=a[17],T=a[20],h=a[26],m=f(t,e);if(uv(m)){if(i.has(e)&&u.get(e)!==m.n)return m;let N=!1;for(let[Y,I]of m.d)if(p(t,Y).n!==I){N=!0;break}if(!N)return m}let g=!0,y=new Set(m.d.keys()),E=new Map,R=()=>{for(let N of y)E.has(N)||m.d.delete(N)},x=()=>{if(i.has(e)){let N=!c.size;S(t,e),N&&(s(t),d(t))}},_=N=>{var Y;if(N===e){let nt=f(t,N);if(!uv(nt))if(cv(N))T(t,N,N.init);else throw new Error("no atom init");return Fc(nt)}let I=p(t,N);try{return Fc(I)}finally{E.set(N,I.n),m.d.set(N,I.n),Ic(m.v)&&ov(e,m.v,I),i.has(e)&&((Y=i.get(N))==null||Y.t.add(e)),g||x()}},C,O,ut={get signal(){return C||(C=new AbortController),C.signal},get setSelf(){return(vt.env?vt.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(vt.env?vt.env.MODE:void 0)!=="production"&&!bf(e)&&console.warn("setSelf function cannot be used with read-only atom"),!O&&bf(e)&&(O=(...N)=>{if((vt.env?vt.env.MODE:void 0)!=="production"&&g&&console.warn("setSelf function cannot be called in sync"),!g)try{return v(t,e,...N)}finally{s(t),d(t)}}),O}},st=m.n;try{(vt.env?vt.env.MODE:void 0)!=="production"&&Sf.delete(t);let N=r(t,e,_,ut);if((vt.env?vt.env.MODE:void 0)!=="production"&&Sf.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),T(t,e,N),Ic(N)){h(t,N,()=>C?.abort());let Y=()=>{R(),x()};N.then(Y,Y)}else R();return(n=o.r)==null||n.call(o,e),m}catch(N){return delete m.v,m.e=N,++m.n,m}finally{g=!1,st!==m.n&&u.get(e)===st&&(u.set(e,m.n),c.add(e),(l=o.c)==null||l.call(o,e))}},q2=(t,e)=>{let n=Et(t),l=n[1],a=n[2],i=n[11],u=[e];for(;u.length;){let c=u.pop(),o=i(t,c);for(let r of rv(c,o,l)){let f=i(t,r);a.get(r)!==f.n&&(a.set(r,f.n),u.push(r))}}},Y2=(t,e,...n)=>{let l=Et(t),a=l[3],i=l[6],u=l[8],c=l[11],o=l[12],r=l[13],f=l[14],d=l[15],s=l[16],p=l[17],v=l[20],S=!0,T=m=>Fc(f(t,m)),h=(m,...g)=>{var y;let E=c(t,m);try{if(m===e){if(!cv(m))throw new Error("atom not writable");(vt.env?vt.env.MODE:void 0)!=="production"&&Sf.add(t);let R=E.n,x=g[0];v(t,m,x),p(t,m),R!==E.n&&(a.add(m),d(t,m),(y=i.c)==null||y.call(i,m));return}else return s(t,m,...g)}finally{S||(r(t),o(t))}};try{return u(t,e,T,h,...n)}finally{S=!1}},G2=(t,e)=>{var n;let l=Et(t),a=l[1],i=l[3],u=l[6],c=l[11],o=l[15],r=l[18],f=l[19],d=c(t,e),s=a.get(e);if(s){for(let[p,v]of d.d)if(!s.d.has(p)){let S=c(t,p);r(t,p).t.add(e),s.d.add(p),v!==S.n&&(i.add(p),o(t,p),(n=u.c)==null||n.call(u,p))}for(let p of s.d)if(!d.d.has(p)){s.d.delete(p);let v=f(t,p);v?.t.delete(e)}}},j2=(t,e)=>{var n;let l=Et(t),a=l[1],i=l[4],u=l[6],c=l[10],o=l[11],r=l[12],f=l[13],d=l[14],s=l[16],p=l[18],v=o(t,e),S=a.get(e);if(!S){d(t,e);for(let T of v.d.keys())p(t,T).t.add(e);if(S={l:new Set,d:new Set(v.d.keys()),t:new Set},a.set(e,S),bf(e)){let T=()=>{let h=!0,m=(...g)=>{try{return s(t,e,...g)}finally{h||(f(t),r(t))}};try{let g=c(t,e,m);g&&(S.u=()=>{h=!0;try{g()}finally{h=!1}})}finally{h=!1}};i.add(T)}(n=u.m)==null||n.call(u,e)}return S},Q2=(t,e)=>{var n,l;let a=Et(t),i=a[1],u=a[5],c=a[6],o=a[11],r=a[19],f=o(t,e),d=i.get(e);if(!d||d.l.size)return d;let s=!1;for(let p of d.t)if((n=i.get(p))!=null&&n.d.has(e)){s=!0;break}if(!s){d.u&&u.add(d.u),d=void 0,i.delete(e);for(let p of f.d.keys()){let v=r(t,p);v?.t.delete(e)}(l=c.u)==null||l.call(c,e);return}return d},X2=(t,e,n)=>{let l=Et(t),a=l[11],i=l[27],u=a(t,e),c="v"in u,o=u.v;if(Ic(n))for(let r of u.d.keys())ov(e,n,a(t,r));u.v=n,delete u.e,(!c||!Object.is(o,u.v))&&(++u.n,Ic(o)&&i(t,o))},Z2=(t,e)=>{let n=Et(t)[14];return Fc(n(t,e))},K2=(t,e,...n)=>{let l=Et(t),a=l[12],i=l[13],u=l[16];try{return u(t,e,...n)}finally{i(t),a(t)}},J2=(t,e,n)=>{let l=Et(t),a=l[12],i=l[18],u=l[19],o=i(t,e).l;return o.add(n),a(t),()=>{o.delete(n),u(t,e),a(t)}},F2=(t,e,n)=>{let a=Et(t)[25],i=a.get(e);if(!i){i=new Set,a.set(e,i);let u=()=>a.delete(e);e.then(u,u)}i.add(n)},I2=(t,e)=>{let a=Et(t)[25].get(e);a?.forEach(i=>i())},sv=new WeakMap,Et=t=>{let e=sv.get(t);if((vt.env?vt.env.MODE:void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function fv(t){let e=Et(t),n=e[24];return n?n(e):e}function dv(...t){let e={get(l){let a=Et(e)[21];return a(e,l)},set(l,...a){let i=Et(e)[22];return i(e,l,...a)},sub(l,a){let i=Et(e)[23];return i(e,l,a)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},M2,k2,w2,B2,U2,L2,H2,V2,q2,Y2,G2,j2,Q2,X2,Z2,K2,J2,void 0,new WeakMap,F2,I2].map((l,a)=>t[a]||l);return sv.set(e,Object.freeze(n)),e}var $c={},$2=0;function Ef(t,e){let n=`atom${++$2}`,l={toString(){return($c.env?$c.env.MODE:void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?l.read=t:(l.init=t,l.read=W2,l.write=P2),e&&(l.write=e),l}function W2(t){return t(this)}function P2(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}var mv;function pv(){return mv?mv():dv()}var Li;function hv(){return Li||(Li=pv(),($c.env?$c.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Li),globalThis.__JOTAI_DEFAULT_STORE__!==Li&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Li}var kt=A(B(),1);var vv={},tE=(0,kt.createContext)(void 0);function yv(t){let e=(0,kt.useContext)(tE);return t?.store||e||hv()}var Af=t=>typeof t?.then=="function",Tf=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},eE=kt.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(Tf(t),t)}),xf=new WeakMap,gv=(t,e,n)=>{let a=fv(t)[26],i=xf.get(e);return i||(i=new Promise((u,c)=>{let o=e,r=s=>p=>{o===s&&u(p)},f=s=>p=>{o===s&&c(p)},d=()=>{try{let s=n();Af(s)?(xf.set(s,i),o=s,s.then(r(s),f(s)),a(t,s,d)):u(s)}catch(s){c(s)}};e.then(r(e),f(e)),a(t,e,d)}),xf.set(e,i)),i};function Rf(t,e){let{delay:n,unstable_promiseStatus:l=!kt.default.use}=e||{},a=yv(e),[[i,u,c],o]=(0,kt.useReducer)(f=>{let d=a.get(t);return Object.is(f[0],d)&&f[1]===a&&f[2]===t?f:[d,a,t]},void 0,()=>[a.get(t),a,t]),r=i;if((u!==a||c!==t)&&(o(),r=a.get(t)),(0,kt.useEffect)(()=>{let f=a.sub(t,()=>{if(l)try{let d=a.get(t);Af(d)&&Tf(gv(a,d,()=>a.get(t)))}catch{}if(typeof n=="number"){setTimeout(o,n);return}o()});return o(),f},[a,t,n,l]),(0,kt.useDebugValue)(r),Af(r)){let f=gv(a,r,()=>a.get(t));return l&&Tf(f),eE(f)}return r}function nE(t,e){let n=yv(e);return(0,kt.useCallback)((...a)=>{if((vv.env?vv.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...a)},[n,t])}function bv(t,e){return[Rf(t,e),nE(t,e)]}var Sa={},lE=Symbol((Sa.env?Sa.env.MODE:void 0)!=="production"?"RESET":"");var Sv=t=>typeof t?.then=="function";function aE(t=()=>{try{return window.localStorage}catch(n){(Sa.env?Sa.env.MODE:void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let l,a,i={getItem:(o,r)=>{var f,d;let s=v=>{if(v=v||"",l!==v){try{a=JSON.parse(v,e?.reviver)}catch{return r}l=v}return a},p=(d=(f=t())==null?void 0:f.getItem(o))!=null?d:null;return Sv(p)?p.then(s):s(p)},setItem:(o,r)=>{var f;return(f=t())==null?void 0:f.setItem(o,JSON.stringify(r,e?.replacer))},removeItem:o=>{var r;return(r=t())==null?void 0:r.removeItem(o)}},u=o=>(r,f,d)=>o(r,s=>{let p;try{p=JSON.parse(s||"")}catch{p=d}f(p)}),c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(o,r)=>{if(!(t()instanceof window.Storage))return()=>{};let f=d=>{d.storageArea===t()&&d.key===o&&r(d.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),c&&(i.subscribe=u(c)),i}var iE=aE();function Ev(t,e,n=iE,l){let a=l?.getOnInit,i=Ef(a?n.getItem(t,e):e);return(Sa.env?Sa.env.MODE:void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=c=>{c(n.getItem(t,e));let o;return n.subscribe&&(o=n.subscribe(t,c,e)),o},Ef(c=>c(i),(c,o,r)=>{let f=typeof r=="function"?r(c(i)):r;return f===lE?(o(i,e),n.removeItem(t)):Sv(f)?f.then(d=>(o(i,d),n.setItem(t,d))):(o(i,f),n.setItem(t,f))})}var Wc=Ev("backlog-show-completed",!1);var Hi=A(z(),1);function xv(){let[t,e]=bv(Wc);return(0,Hi.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-600 cursor-pointer select-none",children:[(0,Hi.jsx)("button",{type:"button",role:"switch","aria-checked":t,onClick:()=>e(!t),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${t?"bg-blue-600":"bg-gray-300"}`,children:(0,Hi.jsx)("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${t?"translate-x-[18px]":"translate-x-[3px]"}`})}),"Show completed"]})}var bl=A(z(),1),uE={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF"},cE={todo:"text-gray-400","in-progress":"text-amber-500",done:"text-green-500"},oE={story:"bg-blue-100 text-blue-700",bug:"bg-red-100 text-red-700"};function Av({item:t,onSelect:e}){return(0,bl.jsxs)("button",{type:"button",className:"bg-white rounded-lg p-4 mb-2 cursor-pointer border border-gray-200 hover:shadow-md transition-shadow flex items-center gap-3 text-left w-full font-[inherit]",onClick:e,children:[(0,bl.jsx)("span",{className:`text-lg shrink-0 ${cE[t.status]}`,children:uE[t.status]}),(0,bl.jsx)("span",{className:`text-xs font-medium rounded-full px-2 shrink-0 ${oE[t.type]}`,children:t.type}),(0,bl.jsxs)("span",{className:"text-gray-400 text-sm shrink-0",children:["#",t.id]}),(0,bl.jsx)("span",{className:"font-medium",children:t.name})]})}var Ae=A(z(),1);function Tv({items:t,onSelect:e,onAdd:n}){let a=Rf(Wc)?t:t.filter(i=>i.status!=="done");return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)("header",{className:"flex justify-between items-center mb-6",children:[(0,Ae.jsx)("h1",{className:"text-2xl font-semibold",children:"Backlog"}),(0,Ae.jsxs)("div",{className:"flex items-center gap-4",children:[(0,Ae.jsx)(xv,{}),(0,Ae.jsx)("button",{type:"button",className:"bg-blue-600 hover:bg-blue-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:n,children:"+ Add Item"})]})]}),a.length===0?(0,Ae.jsx)("div",{className:"text-center text-gray-400 py-12 px-4",children:"No items in the backlog."}):a.map(i=>(0,Ae.jsx)(Av,{item:i,onSelect:()=>e(i.id)},i.id))]})}var wv=A(B(),1);var qn=A(z(),1);function Rv({onConfirm:t,onCancel:e}){return(0,qn.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,qn.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-sm mx-4",children:[(0,qn.jsx)("p",{className:"text-gray-800 mb-4",children:"Are you sure you want to delete this item?"}),(0,qn.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,qn.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:e,children:"Cancel"}),(0,qn.jsx)("button",{type:"button",className:"bg-red-600 hover:bg-red-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:t,children:"Delete"})]})]})})}var Sl=A(z(),1);function _v({criteria:t}){return t.length===0?null:(0,Sl.jsxs)("div",{className:"mb-4",children:[(0,Sl.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Acceptance Criteria"}),(0,Sl.jsx)("ul",{className:"list-none",children:t.map(e=>(0,Sl.jsxs)("li",{className:"py-1",children:[(0,Sl.jsx)("span",{className:"text-gray-500 mr-2",children:"\u2022"}),e]},e))})]})}var El=A(z(),1);function Cv({checks:t}){return(0,El.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-200",children:[(0,El.jsx)("span",{className:"text-xs uppercase text-gray-400 tracking-wide",children:"Manual Checks"}),(0,El.jsx)("ul",{className:"list-none ml-1 mt-1",children:t.map(e=>(0,El.jsxs)("li",{className:"py-0.5 text-sm text-gray-600",children:[(0,El.jsx)("span",{className:"mr-2",children:"\u2610"}),e]},e))})]})}var Ea=A(z(),1);function zv({tasks:t,marker:e}){return(0,Ea.jsx)("ul",{className:"list-none ml-1 space-y-1",children:t.map(n=>(0,Ea.jsxs)("li",{className:"py-0.5",children:[(0,Ea.jsx)("span",{className:"text-gray-500 mr-2",children:e}),n.task,n.verify&&(0,Ea.jsxs)("span",{className:"ml-2 text-xs text-gray-400",children:["verify: ",n.verify]})]},n.task))})}var Yn=A(z(),1),rE={done:"border-green-300 bg-green-50",current:"border-blue-400 bg-blue-50 ring-2 ring-blue-200",upcoming:"border-gray-200 bg-white"},sE={done:{label:"Done",style:"bg-green-100 text-green-700"},current:{label:"In Progress",style:"bg-blue-100 text-blue-700"},upcoming:{label:"Upcoming",style:"bg-gray-100 text-gray-500"}};function Ov({phase:t,index:e,status:n}){let l=sE[n],a=n==="done"?"\u2713":"\u2022",i=t.manualChecks??[];return(0,Yn.jsxs)("div",{className:`rounded-lg border p-4 ${rE[n]}`,children:[(0,Yn.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Yn.jsxs)("span",{className:"font-medium",children:["Phase ",e+1,": ",t.name]}),(0,Yn.jsx)("span",{className:`inline-block rounded-full px-2 text-xs font-medium ${l.style}`,children:l.label})]}),(0,Yn.jsx)(zv,{tasks:t.tasks,marker:a}),i.length>0&&(0,Yn.jsx)(Cv,{checks:i})]})}var xa=A(z(),1);function fE(t,e){return e===void 0?"upcoming":t<e?"done":t===e?"current":"upcoming"}function Dv({phases:t,currentPhase:e}){return t.length===0?null:(0,xa.jsxs)("div",{className:"mb-4",children:[(0,xa.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Plan"}),(0,xa.jsx)("div",{className:"space-y-3",children:t.map((n,l)=>(0,xa.jsx)(Ov,{phase:n,index:l,status:fE(l,e)},n.name))})]})}var Pc=A(z(),1),Nv={todo:"bg-gray-100 text-gray-500","in-progress":"bg-amber-100 text-amber-800",done:"bg-green-100 text-green-800"},dE=["todo","in-progress","done"];function Mv({current:t,onStatusChange:e}){return e?(0,Pc.jsx)("select",{value:t,onChange:n=>e(n.target.value),className:`rounded-full px-2.5 text-xs font-medium cursor-pointer ${Nv[t]}`,children:dE.map(n=>(0,Pc.jsx)("option",{value:n,children:n},n))}):(0,Pc.jsx)("span",{className:`inline-block rounded-full px-2.5 text-xs font-medium ${Nv[t]}`,children:t})}var se=A(z(),1),mE={story:"bg-blue-100 text-blue-700",bug:"bg-red-100 text-red-700"};function pE({content:t}){return(0,se.jsx)("div",{className:"markdown leading-relaxed",dangerouslySetInnerHTML:{__html:q.parse(t)}})}function kv({item:t,onStatusChange:e}){return(0,se.jsxs)("div",{className:"bg-white rounded-lg p-6 border border-gray-200",children:[(0,se.jsx)("h2",{children:t.name}),(0,se.jsxs)("div",{className:"text-gray-400 text-sm mb-4 flex items-center gap-2",children:["#",t.id,(0,se.jsx)("span",{className:`inline-block rounded-full px-2.5 text-xs font-medium ${mE[t.type]}`,children:t.type}),(0,se.jsx)(Mv,{current:t.status,onStatusChange:e})]}),t.description&&(0,se.jsxs)("div",{className:"mb-4",children:[(0,se.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Description"}),(0,se.jsx)(pE,{content:t.description})]}),(0,se.jsx)(_v,{criteria:t.acceptanceCriteria}),t.plan&&(0,se.jsx)(Dv,{phases:t.plan,currentPhase:t.currentPhase})]})}var Lt=A(z(),1);function hE({itemId:t,onDeleted:e}){let[n,l]=(0,wv.useState)(!1);return(0,Lt.jsxs)(Lt.Fragment,{children:[n&&(0,Lt.jsx)(Rv,{onConfirm:async()=>{await Ag(t),e()},onCancel:()=>l(!1)}),(0,Lt.jsx)("button",{type:"button",className:"bg-red-600 hover:bg-red-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:()=>l(!0),children:"Delete"})]})}function gE({itemId:t,onBack:e,onEdit:n,onDeleted:l}){return(0,Lt.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,Lt.jsx)(qc,{onClick:e}),(0,Lt.jsxs)("div",{className:"flex gap-2",children:[(0,Lt.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:n,children:"Edit"}),(0,Lt.jsx)(hE,{itemId:t,onDeleted:l})]})]})}function Bv({item:t,onBack:e,onEdit:n,onDeleted:l,onStatusChanged:a}){return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(gE,{itemId:t.id,onBack:e,onEdit:n,onDeleted:l}),(0,Lt.jsx)(kv,{item:t,onStatusChange:async i=>{await Rg(t.id,i),a()}})]})}var _f=A(z(),1);function Uv({item:t,view:e,onNavigate:n,onReloadAndNavigate:l}){return e.kind==="edit"?(0,_f.jsx)(Jc,{item:t,onSaved:a=>l({kind:"detail",id:a}),onCancel:()=>n({kind:"detail",id:e.id})}):(0,_f.jsx)(Bv,{item:t,onBack:()=>n({kind:"list"}),onEdit:()=>n({kind:"edit",id:e.id}),onDeleted:()=>l({kind:"list"}),onStatusChanged:()=>l({kind:"detail",id:e.id})})}var to=A(z(),1);function Lv({view:t,items:e,onNavigate:n,onReloadAndNavigate:l}){if(t.kind==="detail"||t.kind==="edit"){let a=e.find(i=>i.id===t.id);return a?(0,to.jsx)(Uv,{item:a,view:t,onNavigate:n,onReloadAndNavigate:l}):null}return t.kind==="add"?(0,to.jsx)(Jc,{onSaved:()=>l({kind:"list"}),onCancel:()=>n({kind:"list"})}):(0,to.jsx)(Tv,{items:e,onSelect:a=>n({kind:"detail",id:a}),onAdd:()=>n({kind:"add"})})}var Cf=A(z(),1);function vE(){let[t,e]=(0,Gn.useState)([]),[n,l]=(0,Gn.useState)({kind:"list"}),a=(0,Gn.useCallback)(async()=>{e(await Eg())},[]);(0,Gn.useEffect)(()=>{a()},[a]);let i=(0,Gn.useCallback)(async u=>{await a(),l(u)},[a]);return(0,Cf.jsx)(Lv,{view:n,items:t,onNavigate:l,onReloadAndNavigate:i})}var Hv=document.getElementById("app");Hv&&(0,Vv.createRoot)(Hv).render((0,Cf.jsx)(vE,{}));})();
65
+ Please report this to https://github.com/markedjs/marked.`,t){let l="<p>An error occurred:</p><pre>"+Le(n.message+"",!0)+"</pre>";return e?Promise.resolve(l):l}if(e)return Promise.reject(n);throw n}}},vl=new D2;function q(t,e){return vl.parse(t,e)}q.options=q.setOptions=function(t){return vl.setOptions(t),q.defaults=vl.defaults,Y0(q.defaults),q};q.getDefaults=sf;q.defaults=yl;q.use=function(...t){return vl.use(...t),q.defaults=vl.defaults,Y0(q.defaults),q};q.walkTokens=function(t,e){return vl.walkTokens(t,e)};q.parseInline=vl.parseInline;q.Parser=cn;q.parser=cn.parse;q.Renderer=Xc;q.TextRenderer=yf;q.Lexer=un;q.lexer=un.lex;q.Tokenizer=Qc;q.Hooks=Gc;q.parse=q;var S3=q.options,E3=q.setOptions,x3=q.use,A3=q.walkTokens,T3=q.parseInline;var R3=cn.parse,_3=un.lex;var W0=A(B(),1),on=A(z(),1);function N2({text:t}){return(0,on.jsx)("div",{className:"border border-gray-200 rounded-md p-3 mt-2 min-h-[60px] bg-gray-50",dangerouslySetInnerHTML:{__html:q.parse(t||"")}})}function P0({value:t,onChange:e}){let[n,l]=(0,W0.useState)(!1);return(0,on.jsxs)(Ut.Root,{className:"mb-4",children:[(0,on.jsxs)(Ut.Label,{className:"block font-medium mb-1 text-sm",children:["Description"," ",(0,on.jsx)("button",{type:"button",className:"text-xs text-blue-600 cursor-pointer ml-2 bg-transparent border-none p-0",onClick:()=>l(!n),children:"(preview)"})]}),(0,on.jsx)(Ut.Control,{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm font-[inherit] min-h-[120px] resize-y",render:(0,on.jsx)("textarea",{}),placeholder:"Markdown supported",value:t,onChange:a=>e(a.target.value)}),n&&(0,on.jsx)(N2,{text:t})]})}var Ui=A(z(),1);function tv({submitLabel:t,onCancel:e}){return(0,Ui.jsxs)("div",{className:"flex gap-2 mt-4",children:[(0,Ui.jsx)("button",{type:"submit",className:"bg-blue-600 hover:bg-blue-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",children:t}),(0,Ui.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:e,children:"Cancel"})]})}async function ev(t,e,n,l,a){let i=e.trim();if(!i)return;let u={type:t,name:i,description:n.trim()||void 0,acceptanceCriteria:l.map(o=>o.trim()).filter(Boolean)};return a?(await Tg(a.id,u),a.id):(await xg(u)).id}function nv(t){return{type:t?.type??"story",name:t?.name??"",description:t?.description??"",ac:t?.acceptanceCriteria??[],title:t?"Edit Item":"Add Item",submitLabel:t?"Save":"Add"}}async function lv(t,e,n,l,a,i,u){t.preventDefault();let c=await ev(e,n,l,a,i);c!==void 0&&u(c)}var ya=A(z(),1);function av({value:t,onChange:e}){return(0,ya.jsxs)(Ut.Root,{className:"mb-4",children:[(0,ya.jsx)(Ut.Label,{className:"block font-medium mb-1 text-sm",children:"Name"}),(0,ya.jsx)(Ut.Control,{className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm font-[inherit]",required:!0,placeholder:"Item name",value:t,onChange:n=>e(n.target.value)}),(0,ya.jsx)(Ut.Error,{className:"text-red-500 text-xs mt-1",match:"valueMissing",children:"Name is required."})]})}var Vn=A(z(),1);function iv({value:t,onChange:e}){return(0,Vn.jsxs)("fieldset",{className:"mb-4",children:[(0,Vn.jsx)("legend",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),(0,Vn.jsx)("div",{className:"flex gap-4",children:["story","bug"].map(n=>(0,Vn.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,Vn.jsx)("input",{type:"radio",name:"type",value:n,checked:t===n,onChange:()=>e(n)}),(0,Vn.jsx)("span",{className:"text-sm capitalize",children:n})]},n))})]})}var re=A(z(),1);function Jc({item:t,onSaved:e,onCancel:n}){let l=nv(t),[a,i]=(0,ba.useState)(l.type),[u,c]=(0,ba.useState)(l.name),[o,r]=(0,ba.useState)(l.description),f=(0,ba.useRef)(l.ac);return(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(qc,{onClick:n}),(0,re.jsxs)(Fs,{className:"bg-white rounded-lg p-6 border border-gray-200",onSubmit:d=>lv(d,a,u,o,f.current,t,e),children:[(0,re.jsx)("h2",{className:"mb-4",children:l.title}),(0,re.jsx)(iv,{value:a,onChange:i}),(0,re.jsx)(av,{value:u,onChange:c}),(0,re.jsx)(P0,{value:o,onChange:r}),(0,re.jsx)(w0,{initial:l.ac,onChange:d=>{f.current=d}}),(0,re.jsx)(tv,{submitLabel:l.submitLabel,onCancel:n})]})]})}var vt={};function cv(t){return"init"in t}function bf(t){return!!t.write}function uv(t){return"v"in t||"e"in t}function Fc(t){if("e"in t)throw t.e;if((vt.env?vt.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function Ic(t){return typeof t?.then=="function"}function ov(t,e,n){if(!n.p.has(t)){n.p.add(t);let l=()=>n.p.delete(t);e.then(l,l)}}function rv(t,e,n){var l;let a=new Set;for(let i of((l=n.get(t))==null?void 0:l.t)||[])a.add(i);for(let i of e.p)a.add(i);return a}var M2=(t,e,...n)=>e.read(...n),k2=(t,e,...n)=>e.write(...n),w2=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},B2=(t,e,n)=>{var l;return(l=e.onMount)==null?void 0:l.call(e,n)},U2=(t,e)=>{var n;let l=Et(t),a=l[0],i=l[6],u=l[9];if((vt.env?vt.env.MODE:void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let c=a.get(e);return c||(c={d:new Map,p:new Set,n:0},a.set(e,c),(n=i.i)==null||n.call(i,e),u?.(t,e)),c},L2=t=>{let e=Et(t),n=e[1],l=e[3],a=e[4],i=e[5],u=e[6],c=e[13],o=[],r=f=>{try{f()}catch(d){o.push(d)}};do{u.f&&r(u.f);let f=new Set,d=f.add.bind(f);l.forEach(s=>{var p;return(p=n.get(s))==null?void 0:p.l.forEach(d)}),l.clear(),i.forEach(d),i.clear(),a.forEach(d),a.clear(),f.forEach(r),l.size&&c(t)}while(l.size||i.size||a.size);if(o.length)throw new AggregateError(o)},H2=t=>{let e=Et(t),n=e[1],l=e[2],a=e[3],i=e[11],u=e[14],c=e[17],o=[],r=new WeakSet,f=new WeakSet,d=Array.from(a);for(;d.length;){let s=d[d.length-1],p=i(t,s);if(f.has(s)){d.pop();continue}if(r.has(s)){if(l.get(s)===p.n)o.push([s,p]);else if((vt.env?vt.env.MODE:void 0)!=="production"&&l.has(s))throw new Error("[Bug] invalidated atom exists");f.add(s),d.pop();continue}r.add(s);for(let v of rv(s,p,n))r.has(v)||d.push(v)}for(let s=o.length-1;s>=0;--s){let[p,v]=o[s],S=!1;for(let T of v.d.keys())if(T!==p&&a.has(T)){S=!0;break}S&&(u(t,p),c(t,p)),l.delete(p)}},Sf=new WeakSet,V2=(t,e)=>{var n,l;let a=Et(t),i=a[1],u=a[2],c=a[3],o=a[6],r=a[7],f=a[11],d=a[12],s=a[13],p=a[14],v=a[16],S=a[17],T=a[20],h=a[26],m=f(t,e);if(uv(m)){if(i.has(e)&&u.get(e)!==m.n)return m;let N=!1;for(let[Y,I]of m.d)if(p(t,Y).n!==I){N=!0;break}if(!N)return m}let g=!0,y=new Set(m.d.keys()),E=new Map,R=()=>{for(let N of y)E.has(N)||m.d.delete(N)},x=()=>{if(i.has(e)){let N=!c.size;S(t,e),N&&(s(t),d(t))}},_=N=>{var Y;if(N===e){let nt=f(t,N);if(!uv(nt))if(cv(N))T(t,N,N.init);else throw new Error("no atom init");return Fc(nt)}let I=p(t,N);try{return Fc(I)}finally{E.set(N,I.n),m.d.set(N,I.n),Ic(m.v)&&ov(e,m.v,I),i.has(e)&&((Y=i.get(N))==null||Y.t.add(e)),g||x()}},C,O,ut={get signal(){return C||(C=new AbortController),C.signal},get setSelf(){return(vt.env?vt.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(vt.env?vt.env.MODE:void 0)!=="production"&&!bf(e)&&console.warn("setSelf function cannot be used with read-only atom"),!O&&bf(e)&&(O=(...N)=>{if((vt.env?vt.env.MODE:void 0)!=="production"&&g&&console.warn("setSelf function cannot be called in sync"),!g)try{return v(t,e,...N)}finally{s(t),d(t)}}),O}},st=m.n;try{(vt.env?vt.env.MODE:void 0)!=="production"&&Sf.delete(t);let N=r(t,e,_,ut);if((vt.env?vt.env.MODE:void 0)!=="production"&&Sf.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),T(t,e,N),Ic(N)){h(t,N,()=>C?.abort());let Y=()=>{R(),x()};N.then(Y,Y)}else R();return(n=o.r)==null||n.call(o,e),m}catch(N){return delete m.v,m.e=N,++m.n,m}finally{g=!1,st!==m.n&&u.get(e)===st&&(u.set(e,m.n),c.add(e),(l=o.c)==null||l.call(o,e))}},q2=(t,e)=>{let n=Et(t),l=n[1],a=n[2],i=n[11],u=[e];for(;u.length;){let c=u.pop(),o=i(t,c);for(let r of rv(c,o,l)){let f=i(t,r);a.get(r)!==f.n&&(a.set(r,f.n),u.push(r))}}},Y2=(t,e,...n)=>{let l=Et(t),a=l[3],i=l[6],u=l[8],c=l[11],o=l[12],r=l[13],f=l[14],d=l[15],s=l[16],p=l[17],v=l[20],S=!0,T=m=>Fc(f(t,m)),h=(m,...g)=>{var y;let E=c(t,m);try{if(m===e){if(!cv(m))throw new Error("atom not writable");(vt.env?vt.env.MODE:void 0)!=="production"&&Sf.add(t);let R=E.n,x=g[0];v(t,m,x),p(t,m),R!==E.n&&(a.add(m),d(t,m),(y=i.c)==null||y.call(i,m));return}else return s(t,m,...g)}finally{S||(r(t),o(t))}};try{return u(t,e,T,h,...n)}finally{S=!1}},G2=(t,e)=>{var n;let l=Et(t),a=l[1],i=l[3],u=l[6],c=l[11],o=l[15],r=l[18],f=l[19],d=c(t,e),s=a.get(e);if(s){for(let[p,v]of d.d)if(!s.d.has(p)){let S=c(t,p);r(t,p).t.add(e),s.d.add(p),v!==S.n&&(i.add(p),o(t,p),(n=u.c)==null||n.call(u,p))}for(let p of s.d)if(!d.d.has(p)){s.d.delete(p);let v=f(t,p);v?.t.delete(e)}}},j2=(t,e)=>{var n;let l=Et(t),a=l[1],i=l[4],u=l[6],c=l[10],o=l[11],r=l[12],f=l[13],d=l[14],s=l[16],p=l[18],v=o(t,e),S=a.get(e);if(!S){d(t,e);for(let T of v.d.keys())p(t,T).t.add(e);if(S={l:new Set,d:new Set(v.d.keys()),t:new Set},a.set(e,S),bf(e)){let T=()=>{let h=!0,m=(...g)=>{try{return s(t,e,...g)}finally{h||(f(t),r(t))}};try{let g=c(t,e,m);g&&(S.u=()=>{h=!0;try{g()}finally{h=!1}})}finally{h=!1}};i.add(T)}(n=u.m)==null||n.call(u,e)}return S},Q2=(t,e)=>{var n,l;let a=Et(t),i=a[1],u=a[5],c=a[6],o=a[11],r=a[19],f=o(t,e),d=i.get(e);if(!d||d.l.size)return d;let s=!1;for(let p of d.t)if((n=i.get(p))!=null&&n.d.has(e)){s=!0;break}if(!s){d.u&&u.add(d.u),d=void 0,i.delete(e);for(let p of f.d.keys()){let v=r(t,p);v?.t.delete(e)}(l=c.u)==null||l.call(c,e);return}return d},X2=(t,e,n)=>{let l=Et(t),a=l[11],i=l[27],u=a(t,e),c="v"in u,o=u.v;if(Ic(n))for(let r of u.d.keys())ov(e,n,a(t,r));u.v=n,delete u.e,(!c||!Object.is(o,u.v))&&(++u.n,Ic(o)&&i(t,o))},Z2=(t,e)=>{let n=Et(t)[14];return Fc(n(t,e))},K2=(t,e,...n)=>{let l=Et(t),a=l[12],i=l[13],u=l[16];try{return u(t,e,...n)}finally{i(t),a(t)}},J2=(t,e,n)=>{let l=Et(t),a=l[12],i=l[18],u=l[19],o=i(t,e).l;return o.add(n),a(t),()=>{o.delete(n),u(t,e),a(t)}},F2=(t,e,n)=>{let a=Et(t)[25],i=a.get(e);if(!i){i=new Set,a.set(e,i);let u=()=>a.delete(e);e.then(u,u)}i.add(n)},I2=(t,e)=>{let a=Et(t)[25].get(e);a?.forEach(i=>i())},sv=new WeakMap,Et=t=>{let e=sv.get(t);if((vt.env?vt.env.MODE:void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function fv(t){let e=Et(t),n=e[24];return n?n(e):e}function dv(...t){let e={get(l){let a=Et(e)[21];return a(e,l)},set(l,...a){let i=Et(e)[22];return i(e,l,...a)},sub(l,a){let i=Et(e)[23];return i(e,l,a)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},M2,k2,w2,B2,U2,L2,H2,V2,q2,Y2,G2,j2,Q2,X2,Z2,K2,J2,void 0,new WeakMap,F2,I2].map((l,a)=>t[a]||l);return sv.set(e,Object.freeze(n)),e}var $c={},$2=0;function Ef(t,e){let n=`atom${++$2}`,l={toString(){return($c.env?$c.env.MODE:void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?l.read=t:(l.init=t,l.read=W2,l.write=P2),e&&(l.write=e),l}function W2(t){return t(this)}function P2(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}var mv;function pv(){return mv?mv():dv()}var Li;function hv(){return Li||(Li=pv(),($c.env?$c.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Li),globalThis.__JOTAI_DEFAULT_STORE__!==Li&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Li}var kt=A(B(),1);var vv={},tE=(0,kt.createContext)(void 0);function yv(t){let e=(0,kt.useContext)(tE);return t?.store||e||hv()}var Af=t=>typeof t?.then=="function",Tf=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},eE=kt.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(Tf(t),t)}),xf=new WeakMap,gv=(t,e,n)=>{let a=fv(t)[26],i=xf.get(e);return i||(i=new Promise((u,c)=>{let o=e,r=s=>p=>{o===s&&u(p)},f=s=>p=>{o===s&&c(p)},d=()=>{try{let s=n();Af(s)?(xf.set(s,i),o=s,s.then(r(s),f(s)),a(t,s,d)):u(s)}catch(s){c(s)}};e.then(r(e),f(e)),a(t,e,d)}),xf.set(e,i)),i};function Rf(t,e){let{delay:n,unstable_promiseStatus:l=!kt.default.use}=e||{},a=yv(e),[[i,u,c],o]=(0,kt.useReducer)(f=>{let d=a.get(t);return Object.is(f[0],d)&&f[1]===a&&f[2]===t?f:[d,a,t]},void 0,()=>[a.get(t),a,t]),r=i;if((u!==a||c!==t)&&(o(),r=a.get(t)),(0,kt.useEffect)(()=>{let f=a.sub(t,()=>{if(l)try{let d=a.get(t);Af(d)&&Tf(gv(a,d,()=>a.get(t)))}catch{}if(typeof n=="number"){setTimeout(o,n);return}o()});return o(),f},[a,t,n,l]),(0,kt.useDebugValue)(r),Af(r)){let f=gv(a,r,()=>a.get(t));return l&&Tf(f),eE(f)}return r}function nE(t,e){let n=yv(e);return(0,kt.useCallback)((...a)=>{if((vv.env?vv.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...a)},[n,t])}function bv(t,e){return[Rf(t,e),nE(t,e)]}var Sa={},lE=Symbol((Sa.env?Sa.env.MODE:void 0)!=="production"?"RESET":"");var Sv=t=>typeof t?.then=="function";function aE(t=()=>{try{return window.localStorage}catch(n){(Sa.env?Sa.env.MODE:void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let l,a,i={getItem:(o,r)=>{var f,d;let s=v=>{if(v=v||"",l!==v){try{a=JSON.parse(v,e?.reviver)}catch{return r}l=v}return a},p=(d=(f=t())==null?void 0:f.getItem(o))!=null?d:null;return Sv(p)?p.then(s):s(p)},setItem:(o,r)=>{var f;return(f=t())==null?void 0:f.setItem(o,JSON.stringify(r,e?.replacer))},removeItem:o=>{var r;return(r=t())==null?void 0:r.removeItem(o)}},u=o=>(r,f,d)=>o(r,s=>{let p;try{p=JSON.parse(s||"")}catch{p=d}f(p)}),c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(o,r)=>{if(!(t()instanceof window.Storage))return()=>{};let f=d=>{d.storageArea===t()&&d.key===o&&r(d.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),c&&(i.subscribe=u(c)),i}var iE=aE();function Ev(t,e,n=iE,l){let a=l?.getOnInit,i=Ef(a?n.getItem(t,e):e);return(Sa.env?Sa.env.MODE:void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=c=>{c(n.getItem(t,e));let o;return n.subscribe&&(o=n.subscribe(t,c,e)),o},Ef(c=>c(i),(c,o,r)=>{let f=typeof r=="function"?r(c(i)):r;return f===lE?(o(i,e),n.removeItem(t)):Sv(f)?f.then(d=>(o(i,d),n.setItem(t,d))):(o(i,f),n.setItem(t,f))})}var Wc=Ev("backlog-show-completed",!1);var Hi=A(z(),1);function xv(){let[t,e]=bv(Wc);return(0,Hi.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-600 cursor-pointer select-none",children:[(0,Hi.jsx)("button",{type:"button",role:"switch","aria-checked":t,onClick:()=>e(!t),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${t?"bg-blue-600":"bg-gray-300"}`,children:(0,Hi.jsx)("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${t?"translate-x-[18px]":"translate-x-[3px]"}`})}),"Show completed"]})}var bl=A(z(),1),uE={todo:"\u25CB","in-progress":"\u25D4",done:"\u25CF"},cE={todo:"text-gray-400","in-progress":"text-amber-500",done:"text-green-500"},oE={story:"bg-blue-100 text-blue-700",bug:"bg-red-100 text-red-700"};function Av({item:t,onSelect:e}){return(0,bl.jsxs)("button",{type:"button",className:"bg-white rounded-lg p-4 mb-2 cursor-pointer border border-gray-200 hover:shadow-md transition-shadow flex items-center gap-3 text-left w-full font-[inherit]",onClick:e,children:[(0,bl.jsx)("span",{className:`text-lg shrink-0 ${cE[t.status]}`,children:uE[t.status]}),(0,bl.jsx)("span",{className:`text-xs font-medium rounded-full px-2 shrink-0 ${oE[t.type]}`,children:t.type}),(0,bl.jsxs)("span",{className:"text-gray-400 text-sm shrink-0",children:["#",t.id]}),(0,bl.jsx)("span",{className:"font-medium",children:t.name})]})}var Ae=A(z(),1);function Tv({items:t,onSelect:e,onAdd:n}){let a=Rf(Wc)?t:t.filter(i=>i.status!=="done");return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)("header",{className:"flex justify-between items-center mb-6",children:[(0,Ae.jsx)("h1",{className:"text-2xl font-semibold",children:"Backlog"}),(0,Ae.jsxs)("div",{className:"flex items-center gap-4",children:[(0,Ae.jsx)(xv,{}),(0,Ae.jsx)("button",{type:"button",className:"bg-blue-600 hover:bg-blue-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:n,children:"+ Add Item"})]})]}),a.length===0?(0,Ae.jsx)("div",{className:"text-center text-gray-400 py-12 px-4",children:"No items in the backlog."}):a.map(i=>(0,Ae.jsx)(Av,{item:i,onSelect:()=>e(i.id)},i.id))]})}var wv=A(B(),1);var qn=A(z(),1);function Rv({onConfirm:t,onCancel:e}){return(0,qn.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,qn.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-sm mx-4",children:[(0,qn.jsx)("p",{className:"text-gray-800 mb-4",children:"Are you sure you want to delete this item?"}),(0,qn.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,qn.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:e,children:"Cancel"}),(0,qn.jsx)("button",{type:"button",className:"bg-red-600 hover:bg-red-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:t,children:"Delete"})]})]})})}var Sl=A(z(),1);function _v({criteria:t}){return t.length===0?null:(0,Sl.jsxs)("div",{className:"mb-4",children:[(0,Sl.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Acceptance Criteria"}),(0,Sl.jsx)("ol",{className:"list-none",children:t.map((e,n)=>(0,Sl.jsxs)("li",{className:"py-1",children:[(0,Sl.jsxs)("span",{className:"text-gray-500 mr-2",children:[n+1,"."]}),e]},e))})]})}var El=A(z(),1);function Cv({checks:t}){return(0,El.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-200",children:[(0,El.jsx)("span",{className:"text-xs uppercase text-gray-400 tracking-wide",children:"Manual Checks"}),(0,El.jsx)("ul",{className:"list-none ml-1 mt-1",children:t.map(e=>(0,El.jsxs)("li",{className:"py-0.5 text-sm text-gray-600",children:[(0,El.jsx)("span",{className:"mr-2",children:"\u2610"}),e]},e))})]})}var Ea=A(z(),1);function zv({tasks:t,marker:e}){return(0,Ea.jsx)("ul",{className:"list-none ml-1 space-y-1",children:t.map(n=>(0,Ea.jsxs)("li",{className:"py-0.5",children:[(0,Ea.jsx)("span",{className:"text-gray-500 mr-2",children:e}),n.task,n.verify&&(0,Ea.jsxs)("span",{className:"ml-2 text-xs text-gray-400",children:["verify: ",n.verify]})]},n.task))})}var Yn=A(z(),1),rE={done:"border-green-300 bg-green-50",current:"border-blue-400 bg-blue-50 ring-2 ring-blue-200",upcoming:"border-gray-200 bg-white"},sE={done:{label:"Done",style:"bg-green-100 text-green-700"},current:{label:"In Progress",style:"bg-blue-100 text-blue-700"},upcoming:{label:"Upcoming",style:"bg-gray-100 text-gray-500"}};function Ov({phase:t,index:e,status:n}){let l=sE[n],a=n==="done"?"\u2713":"\u2022",i=t.manualChecks??[];return(0,Yn.jsxs)("div",{className:`rounded-lg border p-4 ${rE[n]}`,children:[(0,Yn.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,Yn.jsxs)("span",{className:"font-medium",children:["Phase ",e+1,": ",t.name]}),(0,Yn.jsx)("span",{className:`inline-block rounded-full px-2 text-xs font-medium ${l.style}`,children:l.label})]}),(0,Yn.jsx)(zv,{tasks:t.tasks,marker:a}),i.length>0&&(0,Yn.jsx)(Cv,{checks:i})]})}var xa=A(z(),1);function fE(t,e){return e===void 0?"upcoming":t<e?"done":t===e?"current":"upcoming"}function Dv({phases:t,currentPhase:e}){return t.length===0?null:(0,xa.jsxs)("div",{className:"mb-4",children:[(0,xa.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Plan"}),(0,xa.jsx)("div",{className:"space-y-3",children:t.map((n,l)=>(0,xa.jsx)(Ov,{phase:n,index:l,status:fE(l,e)},n.name))})]})}var Pc=A(z(),1),Nv={todo:"bg-gray-100 text-gray-500","in-progress":"bg-amber-100 text-amber-800",done:"bg-green-100 text-green-800"},dE=["todo","in-progress","done"];function Mv({current:t,onStatusChange:e}){return e?(0,Pc.jsx)("select",{value:t,onChange:n=>e(n.target.value),className:`rounded-full px-2.5 text-xs font-medium cursor-pointer ${Nv[t]}`,children:dE.map(n=>(0,Pc.jsx)("option",{value:n,children:n},n))}):(0,Pc.jsx)("span",{className:`inline-block rounded-full px-2.5 text-xs font-medium ${Nv[t]}`,children:t})}var se=A(z(),1),mE={story:"bg-blue-100 text-blue-700",bug:"bg-red-100 text-red-700"};function pE({content:t}){return(0,se.jsx)("div",{className:"markdown leading-relaxed",dangerouslySetInnerHTML:{__html:q.parse(t)}})}function kv({item:t,onStatusChange:e}){return(0,se.jsxs)("div",{className:"bg-white rounded-lg p-6 border border-gray-200",children:[(0,se.jsx)("h2",{children:t.name}),(0,se.jsxs)("div",{className:"text-gray-400 text-sm mb-4 flex items-center gap-2",children:["#",t.id,(0,se.jsx)("span",{className:`inline-block rounded-full px-2.5 text-xs font-medium ${mE[t.type]}`,children:t.type}),(0,se.jsx)(Mv,{current:t.status,onStatusChange:e})]}),t.description&&(0,se.jsxs)("div",{className:"mb-4",children:[(0,se.jsx)("h3",{className:"text-xs uppercase text-gray-500 mb-2 tracking-wide",children:"Description"}),(0,se.jsx)(pE,{content:t.description})]}),(0,se.jsx)(_v,{criteria:t.acceptanceCriteria}),t.plan&&(0,se.jsx)(Dv,{phases:t.plan,currentPhase:t.currentPhase})]})}var Lt=A(z(),1);function hE({itemId:t,onDeleted:e}){let[n,l]=(0,wv.useState)(!1);return(0,Lt.jsxs)(Lt.Fragment,{children:[n&&(0,Lt.jsx)(Rv,{onConfirm:async()=>{await Ag(t),e()},onCancel:()=>l(!1)}),(0,Lt.jsx)("button",{type:"button",className:"bg-red-600 hover:bg-red-700 text-white rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:()=>l(!0),children:"Delete"})]})}function gE({itemId:t,onBack:e,onEdit:n,onDeleted:l}){return(0,Lt.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,Lt.jsx)(qc,{onClick:e}),(0,Lt.jsxs)("div",{className:"flex gap-2",children:[(0,Lt.jsx)("button",{type:"button",className:"bg-gray-200 hover:bg-gray-300 text-gray-800 rounded-md px-4 py-2 text-sm font-medium cursor-pointer",onClick:n,children:"Edit"}),(0,Lt.jsx)(hE,{itemId:t,onDeleted:l})]})]})}function Bv({item:t,onBack:e,onEdit:n,onDeleted:l,onStatusChanged:a}){return(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(gE,{itemId:t.id,onBack:e,onEdit:n,onDeleted:l}),(0,Lt.jsx)(kv,{item:t,onStatusChange:async i=>{await Rg(t.id,i),a()}})]})}var _f=A(z(),1);function Uv({item:t,view:e,onNavigate:n,onReloadAndNavigate:l}){return e.kind==="edit"?(0,_f.jsx)(Jc,{item:t,onSaved:a=>l({kind:"detail",id:a}),onCancel:()=>n({kind:"detail",id:e.id})}):(0,_f.jsx)(Bv,{item:t,onBack:()=>n({kind:"list"}),onEdit:()=>n({kind:"edit",id:e.id}),onDeleted:()=>l({kind:"list"}),onStatusChanged:()=>l({kind:"detail",id:e.id})})}var to=A(z(),1);function Lv({view:t,items:e,onNavigate:n,onReloadAndNavigate:l}){if(t.kind==="detail"||t.kind==="edit"){let a=e.find(i=>i.id===t.id);return a?(0,to.jsx)(Uv,{item:a,view:t,onNavigate:n,onReloadAndNavigate:l}):null}return t.kind==="add"?(0,to.jsx)(Jc,{onSaved:()=>l({kind:"list"}),onCancel:()=>n({kind:"list"})}):(0,to.jsx)(Tv,{items:e,onSelect:a=>n({kind:"detail",id:a}),onAdd:()=>n({kind:"add"})})}var Cf=A(z(),1);function vE(){let[t,e]=(0,Gn.useState)([]),[n,l]=(0,Gn.useState)({kind:"list"}),a=(0,Gn.useCallback)(async()=>{e(await Eg())},[]);(0,Gn.useEffect)(()=>{a()},[a]);let i=(0,Gn.useCallback)(async u=>{await a(),l(u)},[a]);return(0,Cf.jsx)(Lv,{view:n,items:t,onNavigate:l,onReloadAndNavigate:i})}var Hv=document.getElementById("app");Hv&&(0,Vv.createRoot)(Hv).render((0,Cf.jsx)(vE,{}));})();
66
66
  /*! Bundled license information:
67
67
 
68
68
  react/cjs/react.production.js:
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.142.0",
9
+ version: "0.144.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -2565,8 +2565,8 @@ function printVerboseDetails(item) {
2565
2565
  }
2566
2566
  if (item.acceptanceCriteria.length > 0) {
2567
2567
  console.log(` ${chalk30.dim("Acceptance criteria:")}`);
2568
- for (const criterion of item.acceptanceCriteria) {
2569
- console.log(` - ${criterion}`);
2568
+ for (const [i, criterion] of item.acceptanceCriteria.entries()) {
2569
+ console.log(` ${i + 1}. ${criterion}`);
2570
2570
  }
2571
2571
  }
2572
2572
  console.log();
@@ -2609,18 +2609,37 @@ import enquirer6 from "enquirer";
2609
2609
  // src/commands/backlog/run.ts
2610
2610
  import chalk35 from "chalk";
2611
2611
 
2612
- // src/commands/backlog/executePhase.ts
2613
- import chalk34 from "chalk";
2614
-
2615
- // src/commands/backlog/buildPhasePrompt.ts
2616
- function formatTasks(phase) {
2617
- return phase.tasks.map((t) => {
2618
- let line = `- ${t.task}`;
2619
- if (t.verify) line += ` (verify: ${t.verify})`;
2620
- return line;
2621
- }).join("\n");
2612
+ // src/commands/backlog/buildAuthoredPhasePrompt.ts
2613
+ function buildAuthoredPhasePrompt(item, phaseIndex, phase) {
2614
+ const manualChecks = phase.manualChecks ?? [];
2615
+ const needsConfirmation = manualChecks.length > 0;
2616
+ const confirmSuffix = needsConfirmation ? " and the user confirms" : "";
2617
+ return [
2618
+ ...buildContextLines(item, phaseIndex, phase),
2619
+ "",
2620
+ "Focus ONLY on this phase. Do not work on other phases.",
2621
+ "When you have completed all tasks for this phase, run /verify to check your work.",
2622
+ ...buildManualCheckLines(manualChecks),
2623
+ "",
2624
+ `Once verify passes${confirmSuffix}, run: assist backlog phase-done ${item.id} ${phaseIndex}`
2625
+ ].filter((line) => line !== void 0).join("\n");
2622
2626
  }
2623
- function buildManualCheckLines(manualChecks, isLastPhase) {
2627
+ function buildContextLines(item, phaseIndex, phase) {
2628
+ const ac = item.acceptanceCriteria.map((c, i) => `${i + 1}. ${c}`).join("\n");
2629
+ return [
2630
+ `You are implementing phase ${phaseIndex + 1} of backlog item #${item.id}: ${item.name}`,
2631
+ "",
2632
+ item.description ? `Description: ${item.description}` : "",
2633
+ "",
2634
+ "Acceptance criteria:",
2635
+ ac,
2636
+ "",
2637
+ `Phase ${phaseIndex + 1}: ${phase.name}`,
2638
+ "Tasks:",
2639
+ formatTasks(phase)
2640
+ ];
2641
+ }
2642
+ function buildManualCheckLines(manualChecks) {
2624
2643
  if (manualChecks.length > 0) {
2625
2644
  return [
2626
2645
  "",
@@ -2630,47 +2649,66 @@ function buildManualCheckLines(manualChecks, isLastPhase) {
2630
2649
  "Wait for the user to confirm all manual checks pass before proceeding."
2631
2650
  ];
2632
2651
  }
2633
- if (isLastPhase) {
2634
- return [
2635
- "",
2636
- "This is the final phase. Before marking it as done, ask the user to manually verify",
2637
- "that the feature works end-to-end and all acceptance criteria are met.",
2638
- "Wait for the user to confirm before proceeding."
2639
- ];
2640
- }
2641
2652
  return [];
2642
2653
  }
2643
- function buildContextLines(item, phaseIndex, phase) {
2644
- const ac = item.acceptanceCriteria.map((c) => `- ${c}`).join("\n");
2654
+ function formatTasks(phase) {
2655
+ return phase.tasks.map((t) => {
2656
+ let line = `- ${t.task}`;
2657
+ if (t.verify) line += ` (verify: ${t.verify})`;
2658
+ return line;
2659
+ }).join("\n");
2660
+ }
2661
+
2662
+ // src/commands/backlog/buildReviewPrompt.ts
2663
+ function buildReviewPrompt(item, phaseIndex) {
2664
+ const acLines = item.acceptanceCriteria.map((ac, i) => `${i + 1}. ${ac}`).join("\n");
2645
2665
  return [
2646
- `You are implementing phase ${phaseIndex + 1} of backlog item #${item.id}: ${item.name}`,
2666
+ `You are reviewing backlog item #${item.id}: ${item.name}`,
2647
2667
  "",
2648
2668
  item.description ? `Description: ${item.description}` : "",
2649
2669
  "",
2650
- "Acceptance criteria:",
2651
- ac,
2670
+ "This is the auto-generated review phase. Verify each acceptance criterion against the current implementation.",
2671
+ "For each criterion, inspect the code and report PASS or FAIL with a brief explanation:",
2652
2672
  "",
2653
- `Phase ${phaseIndex + 1}: ${phase.name}`,
2654
- "Tasks:",
2655
- formatTasks(phase)
2656
- ];
2657
- }
2658
- function buildPhasePrompt(item, phaseIndex, phase, totalPhases) {
2659
- const isLastPhase = phaseIndex === totalPhases - 1;
2660
- const manualChecks = phase.manualChecks ?? [];
2661
- const needsConfirmation = manualChecks.length > 0 || isLastPhase;
2662
- const confirmSuffix = needsConfirmation ? " and the user confirms" : "";
2663
- return [
2664
- ...buildContextLines(item, phaseIndex, phase),
2673
+ acLines,
2665
2674
  "",
2666
- "Focus ONLY on this phase. Do not work on other phases.",
2667
- "When you have completed all tasks for this phase, run /verify to check your work.",
2668
- ...buildManualCheckLines(manualChecks, isLastPhase),
2675
+ "If any criterion fails, fix the issue and re-verify before proceeding.",
2669
2676
  "",
2670
- `Once verify passes${confirmSuffix}, run: assist backlog phase-done ${item.id} ${phaseIndex}`
2677
+ "After all criteria pass, ask the user to confirm any manual checks",
2678
+ "(e.g. end-to-end behaviour they need to verify themselves).",
2679
+ "Wait for the user to confirm before proceeding.",
2680
+ "",
2681
+ "Once the user confirms:",
2682
+ `1. Run: assist backlog done ${item.id}`,
2683
+ "2. Run: /commit",
2684
+ `3. Run: assist backlog phase-done ${item.id} ${phaseIndex}`
2671
2685
  ].filter((line) => line !== void 0).join("\n");
2672
2686
  }
2673
2687
 
2688
+ // src/commands/backlog/buildPhasePrompt.ts
2689
+ var REVIEW_PHASE_NAME = "Review";
2690
+ function buildPhasePrompt(item, phaseIndex, phase) {
2691
+ if (phase.name === REVIEW_PHASE_NAME) {
2692
+ return buildReviewPrompt(item, phaseIndex);
2693
+ }
2694
+ return buildAuthoredPhasePrompt(item, phaseIndex, phase);
2695
+ }
2696
+
2697
+ // src/commands/backlog/buildReviewPhase.ts
2698
+ function buildReviewPhase() {
2699
+ return {
2700
+ name: REVIEW_PHASE_NAME,
2701
+ tasks: [
2702
+ {
2703
+ task: "Verify acceptance criteria, confirm manual checks, mark done, commit, and signal phase-done."
2704
+ }
2705
+ ]
2706
+ };
2707
+ }
2708
+
2709
+ // src/commands/backlog/executePhase.ts
2710
+ import chalk34 from "chalk";
2711
+
2674
2712
  // src/commands/backlog/resolvePhaseResult.ts
2675
2713
  import { spawnSync as spawnSync2 } from "child_process";
2676
2714
  import { existsSync as existsSync16, unlinkSync as unlinkSync3 } from "fs";
@@ -2700,6 +2738,19 @@ function phaseDone(id, phase) {
2700
2738
  console.log(chalk32.green(`Phase ${phase} of item #${id} marked as complete.`));
2701
2739
  }
2702
2740
 
2741
+ // src/commands/backlog/spawnClaude.ts
2742
+ import { spawn as spawn3 } from "child_process";
2743
+ function spawnClaude(prompt) {
2744
+ const child = spawn3("claude", [prompt], {
2745
+ stdio: "inherit"
2746
+ });
2747
+ const done2 = new Promise((resolve7, reject) => {
2748
+ child.on("close", (code) => resolve7(code ?? 0));
2749
+ child.on("error", reject);
2750
+ });
2751
+ return { child, done: done2 };
2752
+ }
2753
+
2703
2754
  // src/commands/backlog/resolvePhaseResult.ts
2704
2755
  function cleanupMarker() {
2705
2756
  const statusPath = getPhaseStatusPath();
@@ -2724,13 +2775,26 @@ Phase ${phaseIndex + 1} completed. Running verify...`)
2724
2775
  console.log(chalk33.green("Verification passed."));
2725
2776
  return true;
2726
2777
  }
2727
- const { action } = await enquirer5.prompt({
2728
- type: "select",
2729
- name: "action",
2730
- message: "Verification failed. What would you like to do?",
2731
- choices: ["Continue to next phase", "Abort"]
2732
- });
2733
- return action === "Continue to next phase";
2778
+ while (true) {
2779
+ const { action } = await enquirer5.prompt({
2780
+ type: "select",
2781
+ name: "action",
2782
+ message: "Verification failed. What would you like to do?",
2783
+ choices: ["Fix", "Continue to next phase", "Abort"]
2784
+ });
2785
+ if (action === "Fix") {
2786
+ const { done: done2 } = spawnClaude(
2787
+ "Run /verify and fix all failures. Do not move on until every check passes."
2788
+ );
2789
+ await done2;
2790
+ if (runVerify()) {
2791
+ console.log(chalk33.green("Verification passed."));
2792
+ return true;
2793
+ }
2794
+ continue;
2795
+ }
2796
+ return action === "Continue to next phase";
2797
+ }
2734
2798
  }
2735
2799
  async function handleIncompletePhase() {
2736
2800
  const { action } = await enquirer5.prompt({
@@ -2753,19 +2817,6 @@ async function resolvePhaseResult(phaseIndex) {
2753
2817
  return action === "skip" ? 1 : 0;
2754
2818
  }
2755
2819
 
2756
- // src/commands/backlog/spawnClaude.ts
2757
- import { spawn as spawn3 } from "child_process";
2758
- function spawnClaude(prompt) {
2759
- const child = spawn3("claude", [prompt], {
2760
- stdio: "inherit"
2761
- });
2762
- const done2 = new Promise((resolve7, reject) => {
2763
- child.on("close", (code) => resolve7(code ?? 0));
2764
- child.on("error", reject);
2765
- });
2766
- return { child, done: done2 };
2767
- }
2768
-
2769
2820
  // src/commands/backlog/watchForMarker.ts
2770
2821
  import { existsSync as existsSync17, unwatchFile, watchFile } from "fs";
2771
2822
  function watchForMarker(child) {
@@ -2792,7 +2843,7 @@ async function executePhase(item, phaseIndex, phases) {
2792
2843
  )
2793
2844
  );
2794
2845
  const { child, done: done2 } = spawnClaude(
2795
- buildPhasePrompt(item, phaseIndex, phase, phases.length)
2846
+ buildPhasePrompt(item, phaseIndex, phase)
2796
2847
  );
2797
2848
  watchForMarker(child);
2798
2849
  await done2;
@@ -2801,29 +2852,31 @@ async function executePhase(item, phaseIndex, phases) {
2801
2852
  return delta < 0 ? -1 : phaseIndex + delta;
2802
2853
  }
2803
2854
 
2804
- // src/commands/backlog/run.ts
2805
- function validatePlan(item) {
2806
- if (!item.plan || item.plan.length === 0) {
2807
- console.log(
2808
- chalk35.red("Item has no plan. Use /draft to create one with phases.")
2809
- );
2810
- return void 0;
2855
+ // src/commands/backlog/resolvePlan.ts
2856
+ function resolvePlan(item) {
2857
+ if (item.plan && item.plan.length > 0) {
2858
+ return item.plan;
2811
2859
  }
2812
- return item.plan;
2860
+ return [
2861
+ {
2862
+ name: "Implement",
2863
+ tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
2864
+ }
2865
+ ];
2813
2866
  }
2867
+
2868
+ // src/commands/backlog/run.ts
2814
2869
  async function run2(id) {
2815
2870
  const result = loadAndFindItem(id);
2816
2871
  if (!result) return;
2817
2872
  const { item } = result;
2818
- const plan2 = validatePlan(item);
2819
- if (!plan2) return;
2873
+ const plan2 = resolvePlan(item);
2820
2874
  const startPhase = item.currentPhase ?? 0;
2821
- if (startPhase >= plan2.length) {
2875
+ if (startPhase > plan2.length) {
2822
2876
  if (item.status !== "done") setStatus(id, "done");
2823
2877
  console.log(
2824
2878
  chalk35.green(`All phases already complete for #${id}: ${item.name}`)
2825
2879
  );
2826
- console.log(chalk35.dim("Review the changes, then use /commit when ready."));
2827
2880
  return;
2828
2881
  }
2829
2882
  setStatus(id, "in-progress");
@@ -2842,10 +2895,14 @@ async function run2(id) {
2842
2895
  phaseIndex = await executePhase(item, phaseIndex, plan2);
2843
2896
  if (phaseIndex < 0) return;
2844
2897
  }
2845
- setStatus(id, "done");
2898
+ const reviewPhase = buildReviewPhase();
2899
+ const allPhases = [...plan2, reviewPhase];
2900
+ const reviewIndex = plan2.length;
2901
+ const reviewResult = await executePhase(item, reviewIndex, allPhases);
2902
+ if (reviewResult < 0) return;
2903
+ if (item.status !== "done") setStatus(id, "done");
2846
2904
  console.log(chalk35.green(`
2847
2905
  All phases complete for #${id}: ${item.name}`));
2848
- console.log(chalk35.dim("Review the changes, then use /commit when ready."));
2849
2906
  }
2850
2907
 
2851
2908
  // src/commands/backlog/next.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.142.0",
3
+ "version": "0.144.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {