github-issue-tower-defence-management 1.98.1 → 1.98.2

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.
@@ -14,8 +14,6 @@ on:
14
14
  jobs:
15
15
  close-manual-pr:
16
16
  runs-on: ubuntu-latest
17
- permissions:
18
- contents: read
19
17
  steps:
20
18
  - uses: step-security/harden-runner@v2
21
19
  with:
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.98.2](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.98.1...v1.98.2) (2026-06-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **console:** remove the Back to list button from the console detail view ([#936](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/936)) ([d21726c](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/commit/d21726c1c2ae6ee09bdefec370fa9ba7ad9d6a02))
7
+
1
8
  ## [1.98.1](https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/compare/v1.98.0...v1.98.1) (2026-06-24)
2
9
 
3
10
 
@@ -98,4 +98,4 @@ Please report this to https://github.com/markedjs/marked.`,i){const f="<p>An err
98
98
  `)}),d+=1,c=[])};for(const S of i){if(f===null&&/^```mermaid\s*$/.test(S.trim())){h(),f=[];continue}if(f!==null){if(S.trim()==="```"){o.push({kind:"mermaid",key:`mermaid:${d}`,code:f.join(`
99
99
  `)}),d+=1,f=null;continue}f.push(S);continue}c.push(S)}return f!==null&&c.push("```mermaid",...f),h(),o},fb="https://cdn.jsdelivr.net/npm/mermaid@10.9.6/dist/mermaid.min.js";let ou=null,Xh=0;const Qh=s=>(s.initialize({startOnLoad:!1,securityLevel:"strict",theme:"dark",themeVariables:{background:"#0d1117",primaryColor:"#161b22",primaryTextColor:"#e6edf3",primaryBorderColor:"#30363d",lineColor:"#8b949e",fontSize:"14px"}}),s),db=()=>ou!==null?ou:window.mermaid!==void 0?(ou=Promise.resolve(Qh(window.mermaid)),ou):(ou=new Promise((s,i)=>{const o=document.createElement("script");o.src=fb,o.async=!0,o.onload=()=>{if(window.mermaid===void 0){i(new Error("mermaid failed to load"));return}s(Qh(window.mermaid))},o.onerror=()=>i(new Error("mermaid script failed to load")),document.head.appendChild(o)}),ou),mb=async s=>{const i=await db();Xh+=1;const o=`console-mermaid-${Xh}`,{svg:c}=await i.render(o,s);return up.sanitize(c,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["foreignObject"]})},hb=({code:s})=>{const[i,o]=G.useState({status:"loading"}),c=G.useRef(null);return G.useEffect(()=>{let f=!1;return o({status:"loading"}),mb(s).then(d=>{f||o({status:"ready",svg:d})}).catch(d=>{f||o({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>{f=!0}},[s]),G.useEffect(()=>{const f=c.current;f!==null&&(f.innerHTML=i.status==="ready"?i.svg:"")},[i]),i.status==="loading"?E.jsx("div",{className:"console-mermaid-loading",children:"Rendering diagram..."}):i.status==="error"?E.jsxs("div",{className:"console-mermaid",children:[E.jsxs("div",{className:"console-mermaid-error",children:["Mermaid render error: ",i.message]}),E.jsx("pre",{className:"console-mermaid-source",children:E.jsx("code",{children:s})})]}):E.jsx("div",{ref:c,className:"console-mermaid-rendered"})},pb=({source:s,buildImageProxyUrl:i})=>{const o=G.useMemo(()=>{const f=ob(s);return i===void 0?f:Jy(f,i)},[s,i]),c=G.useRef(null);return G.useEffect(()=>{const f=c.current;f!==null&&(f.innerHTML=o)},[o]),E.jsx("div",{ref:c,className:"console-markdown"})},Ic=({body:s,buildImageProxyUrl:i})=>{const o=G.useMemo(()=>rb(s),[s]);return s.trim()===""?E.jsx("p",{className:"console-markdown-empty",children:"No description provided."}):E.jsx("div",{className:"console-markdown-view",children:o.map(c=>c.kind==="mermaid"?E.jsx(hb,{code:c.code},c.key):E.jsx(pb,{source:c.source,buildImageProxyUrl:i},c.key))})},gb=({isPr:s,now:i,onSubmit:o})=>{const[c,f]=G.useState(!s),[d,h]=G.useState(""),[S,g]=G.useState({kind:"idle"}),[T,z]=G.useState([]),R=async()=>{const C=d.trim();if(!(C.length===0||S.kind==="posting")){g({kind:"posting"});try{const H=await o(C);z(I=>[...I,H]),h(""),g({kind:"idle"})}catch(H){g({kind:"error",message:H instanceof Error?H.message:"failed to post"})}}};return E.jsxs("div",{className:"console-composer",children:[E.jsx("button",{type:"button",className:"console-composer-toggle","aria-expanded":c,onClick:()=>f(C=>!C),children:c?"✕ Cancel":"💬 Add a comment"}),T.length>0&&E.jsx("div",{className:"console-composer-posted",children:T.map(C=>E.jsxs("article",{className:"console-comment",children:[E.jsxs("header",{className:"console-comment-header",title:Sr(C.createdAt),children:[E.jsx("span",{className:"console-comment-author",children:C.author===""?"you":C.author}),E.jsx("span",{className:"console-comment-time",children:bi(C.createdAt,i)})]}),E.jsx(Ic,{body:C.body})]},`${C.author}:${C.createdAt}:${C.body}`))}),c&&E.jsxs("div",{className:"console-composer-form",children:[E.jsx("textarea",{className:"console-composer-input",rows:3,placeholder:"Leave a comment…",value:d,onChange:C=>h(C.target.value)}),E.jsxs("div",{className:"console-composer-row",children:[E.jsx("button",{type:"button",className:"console-composer-submit",disabled:S.kind==="posting",onClick:()=>{R()},children:"Comment"}),S.kind==="posting"&&E.jsx("span",{className:"console-composer-status",children:"Posting…"}),S.kind==="error"&&E.jsxs("span",{role:"alert",className:"console-composer-status console-composer-error",children:["Failed: ",S.message]})]})]})]})},ra=({title:s,count:i=null,defaultCollapsed:o=!1,headerAction:c,children:f})=>{const[d,h]=G.useState(o),S=i===null?s:`${s} (${i})`;return E.jsxs("section",{className:"console-panel",children:[E.jsxs("header",{className:"console-panel-header",children:[E.jsxs("button",{type:"button",className:"console-panel-toggle","aria-expanded":!d,onClick:()=>h(g=>!g),children:[E.jsx("span",{className:"console-panel-caret",children:d?"▸":"▾"}),E.jsx("span",{className:"console-panel-title",children:S})]}),c!==void 0&&E.jsx("div",{className:"console-panel-action",children:c})]}),!d&&E.jsx("div",{className:"console-panel-body",children:f})]})},yb=s=>{switch(s){case"added":return{label:"A",color:"#3fb950"};case"modified":return{label:"M",color:"#d29922"};case"removed":return{label:"D",color:"#f85149"};case"renamed":return{label:"R",color:"#a371f7"};case"changed":return{label:"M",color:"#d29922"};default:return{label:"?",color:"#8b949e"}}},bb=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,vb=s=>{const i=[];let o=0,c=0;for(const f of s.split(`
100
100
  `)){if(f.startsWith("@@")){const d=f.match(bb);d!==null&&(o=Number(d[1]),c=Number(d[2])),i.push({kind:"hunk",oldLineNumber:null,newLineNumber:null,content:f});continue}if(f.startsWith("+")){i.push({kind:"add",oldLineNumber:null,newLineNumber:c,content:f}),c+=1;continue}if(f.startsWith("-")){i.push({kind:"del",oldLineNumber:o,newLineNumber:null,content:f}),o+=1;continue}i.push({kind:"ctx",oldLineNumber:o,newLineNumber:c,content:f}),o+=1,c+=1}return i},Sb=({patch:s})=>{if(s===null||s==="")return E.jsx("p",{className:"console-file-diff-empty",children:"(no diff / binary or too large)"});const i=vb(s);return E.jsx("table",{className:"console-file-diff",children:E.jsx("tbody",{children:i.map(o=>E.jsxs("tr",{className:`console-diff-row console-diff-${o.kind}`,children:[E.jsx("td",{className:"console-diff-ln",children:o.oldLineNumber??""}),E.jsx("td",{className:"console-diff-ln",children:o.newLineNumber??""}),E.jsx("td",{className:"console-diff-code",children:o.content})]},`${o.kind}:${o.oldLineNumber??"x"}:${o.newLineNumber??"x"}:${o.content}`))})})},Tb=({file:s})=>{const[i,o]=G.useState(!1),c=yb(s.status);return E.jsxs("li",{className:"console-file",children:[E.jsxs("button",{type:"button",className:"console-file-row","aria-expanded":i,onClick:()=>o(f=>!f),children:[E.jsx("span",{className:"console-file-caret",children:i?"▾":"▸"}),E.jsx("span",{className:"console-file-badge",style:{color:c.color,borderColor:c.color},children:c.label}),E.jsx("span",{className:"console-file-path",children:s.path}),E.jsxs("span",{className:"console-file-stat console-file-add",children:["+",s.additions]}),E.jsxs("span",{className:"console-file-stat console-file-del",children:["-",s.deletions]})]}),i&&E.jsx(Sb,{patch:s.patch})]})},yp=({files:s,isLoading:i,error:o})=>o!==null?E.jsxs("p",{role:"alert",className:"console-files-error",children:["Failed to load changed files: ",o]}):i?E.jsx("p",{className:"console-files-loading",children:"Loading changed files..."}):s.length===0?E.jsx("p",{className:"console-files-empty",children:"No changed files."}):E.jsx("ul",{className:"console-files",children:s.map(c=>E.jsx(Tb,{file:c},c.path))}),Eb=({comments:s,isLoading:i,error:o,now:c,buildImageProxyUrl:f})=>{const[d,h]=G.useState(!1);if(o!==null)return E.jsxs("p",{role:"alert",className:"console-comment-error",children:["Failed to load comments: ",o]});if(i)return E.jsx("p",{className:"console-comment-loading",children:"Loading comments..."});if(s.length===0)return E.jsx("p",{className:"console-comment-empty",children:"No comments."});const S=d?s:s.slice(-1);return E.jsxs("div",{className:"console-comment-list",children:[!d&&s.length>1&&E.jsxs("button",{type:"button",className:"console-comment-show-all",onClick:()=>h(!0),children:["Show all ",s.length]}),S.map(g=>E.jsxs("article",{className:"console-comment",children:[E.jsxs("header",{className:"console-comment-header",children:[E.jsx("span",{className:"console-comment-author",children:g.author}),E.jsx("span",{className:"console-comment-time",children:bi(g.createdAt,c)})]}),E.jsx(Ic,{body:g.body,buildImageProxyUrl:f})]},`${g.author}:${g.createdAt}:${g.body}`))]})},Ab=s=>s.slice(0,7),_b=s=>s.split(`
101
- `)[0],bp=({commits:s,isLoading:i,error:o,now:c})=>o!==null?E.jsxs("p",{role:"alert",className:"console-commits-error",children:["Failed to load commits: ",o]}):i?E.jsx("p",{className:"console-commits-loading",children:"Loading commits..."}):s.length===0?E.jsx("p",{className:"console-commits-empty",children:"No commits."}):E.jsx("ul",{className:"console-commits",children:s.map(f=>E.jsxs("li",{className:"console-commit",children:[E.jsx("span",{className:"console-commit-message",children:_b(f.message)}),E.jsx("span",{className:"console-commit-sha",children:Ab(f.sha)}),E.jsx("span",{className:"console-commit-author",children:f.author}),E.jsx("span",{className:"console-commit-time",children:bi(f.authoredAt,c)})]},f.sha))}),xb=({pullRequest:s,body:i,bodyIsLoading:o,files:c,filesAreLoading:f,filesError:d,commits:h,commitsAreLoading:S,commitsError:g,now:T,buildImageProxyUrl:z})=>{const R=s.summary,C=f||d!==null?null:c.length,H=S||g!==null?null:h.length;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"console-pr-header",children:[E.jsx("a",{href:s.url,className:"console-pr-section-title",target:"_blank",rel:"noopener noreferrer",children:(R==null?void 0:R.title)??s.url}),s.isDraft&&E.jsx("span",{className:"console-pr-section-state",children:"draft"}),E.jsxs("div",{className:"console-pr-statbar",children:[s.branchName!==null&&E.jsx("span",{className:"console-pr-branch",children:s.branchName}),R!==null&&E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"console-pr-add",children:["+",R.additions]}),E.jsxs("span",{className:"console-pr-del",children:["-",R.deletions]}),E.jsxs("span",{className:"console-pr-files-count",children:[R.changedFiles," files"]})]})]})]}),E.jsx(ra,{title:"Description",defaultCollapsed:!0,children:o?E.jsx("p",{className:"console-pr-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:(R==null?void 0:R.body)??i,buildImageProxyUrl:z})}),E.jsx(ra,{title:"Changed files",count:C,children:E.jsx(yp,{files:c,isLoading:f,error:d})}),E.jsx(ra,{title:"Commits",count:H,defaultCollapsed:!0,children:E.jsx(bp,{commits:h,isLoading:S,error:g,now:T})})]})},Nb=({item:s,storyName:i,storyColorEnum:o,overlayStatus:c,state:f,body:d,bodyIsLoading:h,bodyError:S,comments:g,commentsAreLoading:T,commentsError:z,files:R,filesAreLoading:C,filesError:H,commits:I,commitsAreLoading:F,commitsError:K,relatedPullRequests:ct,now:J,commentComposer:bt,operationBar:st,buildImageProxyUrl:Nt})=>{const gt=(f==null?void 0:f.state)??"open",tt=(f==null?void 0:f.merged)??!1,Mt=!s.isPr&&gt==="closed"?"Closed":null,Pt=yi(o),te=c?yi(c.color):null,pe=C||H!==null?null:R.length,Bt=T||z!==null?null:g.length,Me=F||K!==null?null:I.length;return E.jsxs("article",{className:"console-detail",children:[i!==null&&E.jsx("div",{className:"console-detail-story",children:E.jsxs("span",{className:"console-storytag",children:[E.jsx("span",{className:"console-story-dot",style:{backgroundColor:Pt.dot}}),i]})}),c!==null&&te!==null&&E.jsx("span",{className:"console-detail-status-chip",style:{color:te.fg,borderColor:te.border,backgroundColor:te.bg},children:c.name}),E.jsxs("h2",{className:"console-detail-title",children:[E.jsx(Fh,{isPr:s.isPr,state:gt,merged:tt,isDraft:!1,stateReason:""}),E.jsx("span",{className:"console-detail-title-text",children:s.title}),E.jsx("span",{className:"console-detail-number",children:s.isPr?`PR #${s.number}`:`#${s.number}`}),Mt!==null&&E.jsx("span",{className:"console-detail-closed-label",children:Mt})]}),E.jsxs("div",{className:"console-detail-subbar",children:[E.jsx("a",{href:s.url,className:"console-detail-link",target:"_blank",rel:"noopener noreferrer",children:s.isPr?`PR #${s.number}`:`Issue #${s.number}`}),E.jsx("span",{className:"console-detail-repo",children:s.repo}),E.jsx("span",{className:"console-detail-pill",children:s.isPr?"PR":"Issue"})]}),s.labels.length>0&&E.jsx("div",{className:"console-detail-labels",children:s.labels.map(Ht=>E.jsx("span",{className:"console-label-chip",children:Ht},Ht))}),E.jsxs("div",{className:"console-detail-createdat",title:Sr(s.createdAt),children:["opened ",bi(s.createdAt,J)]}),E.jsx(ra,{title:"Description",headerAction:E.jsx("a",{href:s.url,className:"console-panel-open-link",target:"_blank",rel:"noopener noreferrer",children:"open"}),children:S!==null?E.jsxs("p",{role:"alert",className:"console-detail-body-error",children:["Failed to load description: ",S]}):h?E.jsx("p",{className:"console-detail-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:d,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Changed files",count:pe,children:E.jsx(yp,{files:R,isLoading:C,error:H})}),E.jsx(ra,{title:"Comments",count:Bt,defaultCollapsed:s.isPr,children:E.jsx(Eb,{comments:g,isLoading:T,error:z,now:J,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Commits",count:Me,defaultCollapsed:!0,children:E.jsx(bp,{commits:I,isLoading:F,error:K,now:J})}),!s.isPr&&ct.map(Ht=>{var $t;return E.jsx(xb,{pullRequest:Ht.pullRequest,body:(($t=Ht.pullRequest.summary)==null?void 0:$t.body)??"",bodyIsLoading:!1,files:Ht.files,filesAreLoading:Ht.filesAreLoading,filesError:Ht.filesError,commits:Ht.commits,commitsAreLoading:Ht.commitsAreLoading,commitsError:Ht.commitsError,now:J,buildImageProxyUrl:Nt},Ht.pullRequest.url)}),bt,E.jsx("div",{className:"console-actionbar",children:st})]})},Ob=({onClose:s})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close_not_planned"),children:"Close as not planned"}),E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close"),children:"Close"})]}),zb=({isTodoByHuman:s,onSetNextActionDate:i})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1day"),children:"+1 day"}),E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1week"),children:s?"+1 week and skip":"+1 week"})]}),Rb=[{action:"unnecessary",label:"Unnecessary",variant:"unneeded"},{action:"totally_wrong",label:"Totally wrong",variant:"wrong"},{action:"request_changes",label:"Reject",variant:"reject"},{action:"approve",label:"Approve",variant:"approve"}],Mb=({onReview:s})=>E.jsx("div",{className:"console-op-group console-op-group-review",children:Rb.map(i=>E.jsx("button",{type:"button",className:`console-op-button console-op-button-${i.variant}`,onClick:()=>s(i.action),children:i.label},i.action))}),Cb=(s,i)=>{const o=i.toLowerCase();return s.find(c=>c.name.toLowerCase()===o)??null},Db=({statusOptions:s,onSetStatus:i,onSetInTmuxByHuman:o})=>{const c=gy.map(f=>({name:f,option:Cb(s,f)})).filter(f=>f.option!==null);return c.length===0?null:E.jsx("div",{className:"console-op-group",children:c.map(({name:f,option:d})=>{const h=yi(d.color),S=f===yy;return E.jsx("button",{type:"button",className:"console-op-button",style:{color:h.fg,borderColor:h.border,backgroundColor:h.bg},onClick:()=>S?o(d):i(d),children:d.name},d.id)})})},Ub=s=>s.name.toLowerCase().includes("no story"),wb=({storyOptions:s,onSetStory:i})=>{const o=s.filter(c=>!Ub(c));return o.length===0?null:E.jsx("div",{className:"console-op-group console-op-group-stories",children:o.map(c=>{const f=yi(c.color);return E.jsx("button",{type:"button",className:"console-op-button",style:{color:f.fg,borderColor:f.border,backgroundColor:f.bg},onClick:()=>i(c),children:c.name},c.id)})})},Lb=({tab:s,item:i,hasPullRequest:o,statusOptions:c,storyOptions:f,handlers:d})=>{const h=s==="triage",S=!i.isPr;return E.jsxs("div",{className:"console-operation-bar",children:[o&&E.jsx(Mb,{onReview:d.onReview}),E.jsx(zb,{isTodoByHuman:by(s),onSetNextActionDate:d.onSetNextActionDate}),h&&E.jsx(wb,{storyOptions:f,onSetStory:d.onSetStory}),E.jsx(Db,{statusOptions:c,onSetStatus:d.onSetStatus,onSetInTmuxByHuman:d.onSetInTmuxByHuman}),S&&E.jsx(Ob,{onClose:d.onClose})]})},ru=(s,i,o,c)=>{const f=i!==null?s.peek(i):void 0,[d,h]=G.useState(f??c),[S,g]=G.useState(i!==null&&f===void 0),[T,z]=G.useState(null);return G.useEffect(()=>{if(i===null||o===null)return;const R=s.peek(i);if(R!==void 0){h(R),g(!1),z(null);return}let C=!1;return g(!0),z(null),s.load(i,o).then(H=>{C||(h(H),g(!1))}).catch(H=>{C||(z(H instanceof Error?H.message:String(H)),g(!1))}),()=>{C=!0}},[s,i,o]),{data:d,isLoading:S,error:T}},jb=[],Vh=[],Kh=[],Hb=[],kb={state:"open",merged:!1,isPullRequest:!1},Bb=(s,i)=>{const o=i!==null?`${i.repo}#${i.number}`:null,c=i!==null?i.url:null,f=(i==null?void 0:i.isPr)??!1,d=ru(s.body,o,c,""),h=ru(s.state,o,c,kb),S=ru(s.comments,o,c,jb),g=ru(s.files,f?o:null,f?c:null,Vh),T=ru(s.commits,f?o:null,f?c:null,Kh),z=ru(s.relatedPrs,f?null:o,f?null:c,Hb),[R,C]=G.useState([]);return G.useEffect(()=>{if(f||z.data.length===0){C([]);return}let H=!1;const I=z.data.map(K=>({pullRequest:K,files:Vh,filesAreLoading:!0,filesError:null,commits:Kh,commitsAreLoading:!0,commitsError:null}));C(I);const F=(K,ct)=>{H||C(J=>J.map(bt=>bt.pullRequest.url===K?{...bt,...ct}:bt))};for(const K of z.data){const ct=K.url;s.files.load(ct,K.url).then(J=>F(K.url,{files:J,filesAreLoading:!1})).catch(J=>F(K.url,{filesAreLoading:!1,filesError:J instanceof Error?J.message:String(J)})),s.commits.load(ct,K.url).then(J=>F(K.url,{commits:J,commitsAreLoading:!1})).catch(J=>F(K.url,{commitsAreLoading:!1,commitsError:J instanceof Error?J.message:String(J)}))}return()=>{H=!0}},[s,f,z.data]),{state:h.data,body:d.data,bodyIsLoading:d.isLoading,bodyError:d.error,comments:S.data,commentsAreLoading:S.isLoading,commentsError:S.error,files:g.data,filesAreLoading:g.isLoading,filesError:g.error,commits:T.data,commitsAreLoading:T.isLoading,commitsError:T.error,relatedPullRequests:R}},qb=({tab:s,item:i,caches:o,operations:c,statusOptions:f,storyOptions:d,storyColors:h,storyName:S,overlayStatus:g,now:T,onQueueAction:z})=>{const R=Bb(o,i),{token:C}=Jc(),H=G.useCallback(J=>Ky(J,C),[C]),I=i.isPr||R.relatedPullRequests.length>0,F={onReview:J=>{var st;const bt=i.isPr?i.url:((st=R.relatedPullRequests[0])==null?void 0:st.pullRequest.url)??i.url;z({kind:{type:"review",action:J},item:i,commit:()=>{c.reviewPullRequest(i,bt,J)}})},onSetNextActionDate:J=>{z({kind:{type:"next_action_date",action:J},item:i,commit:()=>{c.setNextActionDate(i,J)}})},onSetStory:J=>{z({kind:{type:"set_story",optionName:J.name},item:i,commit:()=>{c.setStory(i,J)}})},onSetStatus:J=>{z({kind:{type:"set_status",optionName:J.name},item:i,commit:()=>{c.setStatus(i,J)}})},onSetInTmuxByHuman:J=>{z({kind:{type:"set_in_tmux_by_human",optionName:J.name},item:i,commit:()=>{c.setInTmuxByHuman(i,J)}})},onClose:J=>{z({kind:{type:"close",action:J},item:i,commit:()=>{c.closeIssue(i,J)}})}},K=S??(i.story.trim()!==""?i.story:null),ct=K!==null?Jh(h,K):null;return E.jsx(Nb,{item:i,storyName:K,storyColorEnum:ct,overlayStatus:g,state:R.state,body:R.body,bodyIsLoading:R.bodyIsLoading,bodyError:R.bodyError,comments:R.comments,commentsAreLoading:R.commentsAreLoading,commentsError:R.commentsError,files:R.files,filesAreLoading:R.filesAreLoading,filesError:R.filesError,commits:R.commits,commitsAreLoading:R.commitsAreLoading,commitsError:R.commitsError,relatedPullRequests:R.relatedPullRequests,now:T,buildImageProxyUrl:H,commentComposer:E.jsx(gb,{isPr:i.isPr,now:T,onSubmit:J=>c.addComment(i,J)}),operationBar:E.jsx(Lb,{tab:s,item:i,hasPullRequest:I,statusOptions:f,storyOptions:d,handlers:F})})},Yb=()=>{const s={};for(const i of hl)s[i.name]=0;return s},Gb="console",Zb=()=>{const s=Cy(),{snapshots:i,isLoading:o,error:c}=qy(s),f=my(s),{activeTab:d,selectedItemKey:h,openItem:S,closeItem:g,selectTab:T}=f,z=Ry(s??Gb),R=oy(),C=xy(s,d,z),H=F0(),I=Date.now(),F=G.useMemo(()=>{const k=Yb();for(const X of hl){const vt=i[X.name];vt!==null&&(k[X.name]=vy(vt.items,z.overlay))}return k},[i,z.overlay]),K=i[d],ct=G.useMemo(()=>K===null?[]:Sy(K.items,z.overlay),[K,z.overlay]),J=G.useMemo(()=>ct.map(k=>Wl(k)),[ct]),bt=G.useMemo(()=>k0(ct,z.overlay),[ct,z.overlay]),st=(K==null?void 0:K.storyColors)??{},Nt=(K==null?void 0:K.statusOptions)??[],gt=(K==null?void 0:K.storyOptions)??[],tt=(K==null?void 0:K.generatedAt)??null,Mt=G.useMemo(()=>h===null||K===null?null:K.items.find(k=>k.projectItemId===h)??null,[h,K]),Pt=F[d],te=G.useRef({tab:d,count:Pt});G.useEffect(()=>{const k=te.current;if(te.current={tab:d,count:Pt},k.tab===d&&k.count>0&&Pt===0){const X=Xy(d,F);X!==null&&(T(X),g())}},[d,Pt,F,T,g]);const pe=(()=>{if(Mt===null)return null;const k=z.overlay[Wl(Mt)];return(k==null?void 0:k.status)??null})(),Bt=Mt!==null?mr(Mt,z.overlay):null,Me=G.useCallback(k=>{const X=Yy(J,k);X!==null?S(X):g()},[J,S,g]),Ht=G.useCallback(k=>{const X=Wl(k.item);H.enqueue({message:$0(k.kind,k.item,d),color:K0(k.kind),commit:k.commit,advance:()=>{J0(k.kind,d)&&Me(X)}})},[H,d,Me]),$t=G.useCallback(k=>{if(h===null||k===null)return;const X=k==="next"?Gy(J,h):Zy(J,h);X!==null&&S(X)},[h,J,S]),D=jy($t);return E.jsxs("main",{className:"console-app",children:[H.pending!==null&&E.jsx(X0,{message:H.pending.message,color:H.pending.color,remainingSeconds:H.pending.remainingSeconds,progress:H.pending.progress,onUndo:H.undo}),E.jsx(j0,{activeTab:d,counts:F,pjcode:s,generatedAt:tt,tabHref:f.tabHref,onSelectTab:f.selectTab}),Mt===null?E.jsx(Z0,{rows:bt,storyColors:st,activeItemId:null,now:I,isLoading:o,error:c,onSelectItem:k=>f.openItem(k.projectItemId)}):E.jsxs("div",{className:"console-detail-screen",ref:D,children:[E.jsx("button",{type:"button",className:"console-back-button",onClick:g,children:"← Back to list"}),E.jsx(qb,{tab:d,item:Mt,caches:R,operations:C,statusOptions:Nt,storyOptions:gt,storyColors:st,storyName:Bt,overlayStatus:pe,now:I,onQueueAction:Ht})]})]})},vp=document.getElementById("root");if(vp===null)throw new Error("Root container #root not found");w0.createRoot(vp).render(E.jsx(G.StrictMode,{children:E.jsx(Zb,{})}));
101
+ `)[0],bp=({commits:s,isLoading:i,error:o,now:c})=>o!==null?E.jsxs("p",{role:"alert",className:"console-commits-error",children:["Failed to load commits: ",o]}):i?E.jsx("p",{className:"console-commits-loading",children:"Loading commits..."}):s.length===0?E.jsx("p",{className:"console-commits-empty",children:"No commits."}):E.jsx("ul",{className:"console-commits",children:s.map(f=>E.jsxs("li",{className:"console-commit",children:[E.jsx("span",{className:"console-commit-message",children:_b(f.message)}),E.jsx("span",{className:"console-commit-sha",children:Ab(f.sha)}),E.jsx("span",{className:"console-commit-author",children:f.author}),E.jsx("span",{className:"console-commit-time",children:bi(f.authoredAt,c)})]},f.sha))}),xb=({pullRequest:s,body:i,bodyIsLoading:o,files:c,filesAreLoading:f,filesError:d,commits:h,commitsAreLoading:S,commitsError:g,now:T,buildImageProxyUrl:z})=>{const R=s.summary,C=f||d!==null?null:c.length,H=S||g!==null?null:h.length;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"console-pr-header",children:[E.jsx("a",{href:s.url,className:"console-pr-section-title",target:"_blank",rel:"noopener noreferrer",children:(R==null?void 0:R.title)??s.url}),s.isDraft&&E.jsx("span",{className:"console-pr-section-state",children:"draft"}),E.jsxs("div",{className:"console-pr-statbar",children:[s.branchName!==null&&E.jsx("span",{className:"console-pr-branch",children:s.branchName}),R!==null&&E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"console-pr-add",children:["+",R.additions]}),E.jsxs("span",{className:"console-pr-del",children:["-",R.deletions]}),E.jsxs("span",{className:"console-pr-files-count",children:[R.changedFiles," files"]})]})]})]}),E.jsx(ra,{title:"Description",defaultCollapsed:!0,children:o?E.jsx("p",{className:"console-pr-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:(R==null?void 0:R.body)??i,buildImageProxyUrl:z})}),E.jsx(ra,{title:"Changed files",count:C,children:E.jsx(yp,{files:c,isLoading:f,error:d})}),E.jsx(ra,{title:"Commits",count:H,defaultCollapsed:!0,children:E.jsx(bp,{commits:h,isLoading:S,error:g,now:T})})]})},Nb=({item:s,storyName:i,storyColorEnum:o,overlayStatus:c,state:f,body:d,bodyIsLoading:h,bodyError:S,comments:g,commentsAreLoading:T,commentsError:z,files:R,filesAreLoading:C,filesError:H,commits:I,commitsAreLoading:F,commitsError:K,relatedPullRequests:ct,now:J,commentComposer:bt,operationBar:st,buildImageProxyUrl:Nt})=>{const gt=(f==null?void 0:f.state)??"open",tt=(f==null?void 0:f.merged)??!1,Mt=!s.isPr&&gt==="closed"?"Closed":null,Pt=yi(o),te=c?yi(c.color):null,pe=C||H!==null?null:R.length,Bt=T||z!==null?null:g.length,Me=F||K!==null?null:I.length;return E.jsxs("article",{className:"console-detail",children:[i!==null&&E.jsx("div",{className:"console-detail-story",children:E.jsxs("span",{className:"console-storytag",children:[E.jsx("span",{className:"console-story-dot",style:{backgroundColor:Pt.dot}}),i]})}),c!==null&&te!==null&&E.jsx("span",{className:"console-detail-status-chip",style:{color:te.fg,borderColor:te.border,backgroundColor:te.bg},children:c.name}),E.jsxs("h2",{className:"console-detail-title",children:[E.jsx(Fh,{isPr:s.isPr,state:gt,merged:tt,isDraft:!1,stateReason:""}),E.jsx("span",{className:"console-detail-title-text",children:s.title}),E.jsx("span",{className:"console-detail-number",children:s.isPr?`PR #${s.number}`:`#${s.number}`}),Mt!==null&&E.jsx("span",{className:"console-detail-closed-label",children:Mt})]}),E.jsxs("div",{className:"console-detail-subbar",children:[E.jsx("a",{href:s.url,className:"console-detail-link",target:"_blank",rel:"noopener noreferrer",children:s.isPr?`PR #${s.number}`:`Issue #${s.number}`}),E.jsx("span",{className:"console-detail-repo",children:s.repo}),E.jsx("span",{className:"console-detail-pill",children:s.isPr?"PR":"Issue"})]}),s.labels.length>0&&E.jsx("div",{className:"console-detail-labels",children:s.labels.map(Ht=>E.jsx("span",{className:"console-label-chip",children:Ht},Ht))}),E.jsxs("div",{className:"console-detail-createdat",title:Sr(s.createdAt),children:["opened ",bi(s.createdAt,J)]}),E.jsx(ra,{title:"Description",headerAction:E.jsx("a",{href:s.url,className:"console-panel-open-link",target:"_blank",rel:"noopener noreferrer",children:"open"}),children:S!==null?E.jsxs("p",{role:"alert",className:"console-detail-body-error",children:["Failed to load description: ",S]}):h?E.jsx("p",{className:"console-detail-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:d,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Changed files",count:pe,children:E.jsx(yp,{files:R,isLoading:C,error:H})}),E.jsx(ra,{title:"Comments",count:Bt,defaultCollapsed:s.isPr,children:E.jsx(Eb,{comments:g,isLoading:T,error:z,now:J,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Commits",count:Me,defaultCollapsed:!0,children:E.jsx(bp,{commits:I,isLoading:F,error:K,now:J})}),!s.isPr&&ct.map(Ht=>{var $t;return E.jsx(xb,{pullRequest:Ht.pullRequest,body:(($t=Ht.pullRequest.summary)==null?void 0:$t.body)??"",bodyIsLoading:!1,files:Ht.files,filesAreLoading:Ht.filesAreLoading,filesError:Ht.filesError,commits:Ht.commits,commitsAreLoading:Ht.commitsAreLoading,commitsError:Ht.commitsError,now:J,buildImageProxyUrl:Nt},Ht.pullRequest.url)}),bt,E.jsx("div",{className:"console-actionbar",children:st})]})},Ob=({onClose:s})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close_not_planned"),children:"Close as not planned"}),E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close"),children:"Close"})]}),zb=({isTodoByHuman:s,onSetNextActionDate:i})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1day"),children:"+1 day"}),E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1week"),children:s?"+1 week and skip":"+1 week"})]}),Rb=[{action:"unnecessary",label:"Unnecessary",variant:"unneeded"},{action:"totally_wrong",label:"Totally wrong",variant:"wrong"},{action:"request_changes",label:"Reject",variant:"reject"},{action:"approve",label:"Approve",variant:"approve"}],Mb=({onReview:s})=>E.jsx("div",{className:"console-op-group console-op-group-review",children:Rb.map(i=>E.jsx("button",{type:"button",className:`console-op-button console-op-button-${i.variant}`,onClick:()=>s(i.action),children:i.label},i.action))}),Cb=(s,i)=>{const o=i.toLowerCase();return s.find(c=>c.name.toLowerCase()===o)??null},Db=({statusOptions:s,onSetStatus:i,onSetInTmuxByHuman:o})=>{const c=gy.map(f=>({name:f,option:Cb(s,f)})).filter(f=>f.option!==null);return c.length===0?null:E.jsx("div",{className:"console-op-group",children:c.map(({name:f,option:d})=>{const h=yi(d.color),S=f===yy;return E.jsx("button",{type:"button",className:"console-op-button",style:{color:h.fg,borderColor:h.border,backgroundColor:h.bg},onClick:()=>S?o(d):i(d),children:d.name},d.id)})})},Ub=s=>s.name.toLowerCase().includes("no story"),wb=({storyOptions:s,onSetStory:i})=>{const o=s.filter(c=>!Ub(c));return o.length===0?null:E.jsx("div",{className:"console-op-group console-op-group-stories",children:o.map(c=>{const f=yi(c.color);return E.jsx("button",{type:"button",className:"console-op-button",style:{color:f.fg,borderColor:f.border,backgroundColor:f.bg},onClick:()=>i(c),children:c.name},c.id)})})},Lb=({tab:s,item:i,hasPullRequest:o,statusOptions:c,storyOptions:f,handlers:d})=>{const h=s==="triage",S=!i.isPr;return E.jsxs("div",{className:"console-operation-bar",children:[o&&E.jsx(Mb,{onReview:d.onReview}),E.jsx(zb,{isTodoByHuman:by(s),onSetNextActionDate:d.onSetNextActionDate}),h&&E.jsx(wb,{storyOptions:f,onSetStory:d.onSetStory}),E.jsx(Db,{statusOptions:c,onSetStatus:d.onSetStatus,onSetInTmuxByHuman:d.onSetInTmuxByHuman}),S&&E.jsx(Ob,{onClose:d.onClose})]})},ru=(s,i,o,c)=>{const f=i!==null?s.peek(i):void 0,[d,h]=G.useState(f??c),[S,g]=G.useState(i!==null&&f===void 0),[T,z]=G.useState(null);return G.useEffect(()=>{if(i===null||o===null)return;const R=s.peek(i);if(R!==void 0){h(R),g(!1),z(null);return}let C=!1;return g(!0),z(null),s.load(i,o).then(H=>{C||(h(H),g(!1))}).catch(H=>{C||(z(H instanceof Error?H.message:String(H)),g(!1))}),()=>{C=!0}},[s,i,o]),{data:d,isLoading:S,error:T}},jb=[],Vh=[],Kh=[],Hb=[],kb={state:"open",merged:!1,isPullRequest:!1},Bb=(s,i)=>{const o=i!==null?`${i.repo}#${i.number}`:null,c=i!==null?i.url:null,f=(i==null?void 0:i.isPr)??!1,d=ru(s.body,o,c,""),h=ru(s.state,o,c,kb),S=ru(s.comments,o,c,jb),g=ru(s.files,f?o:null,f?c:null,Vh),T=ru(s.commits,f?o:null,f?c:null,Kh),z=ru(s.relatedPrs,f?null:o,f?null:c,Hb),[R,C]=G.useState([]);return G.useEffect(()=>{if(f||z.data.length===0){C([]);return}let H=!1;const I=z.data.map(K=>({pullRequest:K,files:Vh,filesAreLoading:!0,filesError:null,commits:Kh,commitsAreLoading:!0,commitsError:null}));C(I);const F=(K,ct)=>{H||C(J=>J.map(bt=>bt.pullRequest.url===K?{...bt,...ct}:bt))};for(const K of z.data){const ct=K.url;s.files.load(ct,K.url).then(J=>F(K.url,{files:J,filesAreLoading:!1})).catch(J=>F(K.url,{filesAreLoading:!1,filesError:J instanceof Error?J.message:String(J)})),s.commits.load(ct,K.url).then(J=>F(K.url,{commits:J,commitsAreLoading:!1})).catch(J=>F(K.url,{commitsAreLoading:!1,commitsError:J instanceof Error?J.message:String(J)}))}return()=>{H=!0}},[s,f,z.data]),{state:h.data,body:d.data,bodyIsLoading:d.isLoading,bodyError:d.error,comments:S.data,commentsAreLoading:S.isLoading,commentsError:S.error,files:g.data,filesAreLoading:g.isLoading,filesError:g.error,commits:T.data,commitsAreLoading:T.isLoading,commitsError:T.error,relatedPullRequests:R}},qb=({tab:s,item:i,caches:o,operations:c,statusOptions:f,storyOptions:d,storyColors:h,storyName:S,overlayStatus:g,now:T,onQueueAction:z})=>{const R=Bb(o,i),{token:C}=Jc(),H=G.useCallback(J=>Ky(J,C),[C]),I=i.isPr||R.relatedPullRequests.length>0,F={onReview:J=>{var st;const bt=i.isPr?i.url:((st=R.relatedPullRequests[0])==null?void 0:st.pullRequest.url)??i.url;z({kind:{type:"review",action:J},item:i,commit:()=>{c.reviewPullRequest(i,bt,J)}})},onSetNextActionDate:J=>{z({kind:{type:"next_action_date",action:J},item:i,commit:()=>{c.setNextActionDate(i,J)}})},onSetStory:J=>{z({kind:{type:"set_story",optionName:J.name},item:i,commit:()=>{c.setStory(i,J)}})},onSetStatus:J=>{z({kind:{type:"set_status",optionName:J.name},item:i,commit:()=>{c.setStatus(i,J)}})},onSetInTmuxByHuman:J=>{z({kind:{type:"set_in_tmux_by_human",optionName:J.name},item:i,commit:()=>{c.setInTmuxByHuman(i,J)}})},onClose:J=>{z({kind:{type:"close",action:J},item:i,commit:()=>{c.closeIssue(i,J)}})}},K=S??(i.story.trim()!==""?i.story:null),ct=K!==null?Jh(h,K):null;return E.jsx(Nb,{item:i,storyName:K,storyColorEnum:ct,overlayStatus:g,state:R.state,body:R.body,bodyIsLoading:R.bodyIsLoading,bodyError:R.bodyError,comments:R.comments,commentsAreLoading:R.commentsAreLoading,commentsError:R.commentsError,files:R.files,filesAreLoading:R.filesAreLoading,filesError:R.filesError,commits:R.commits,commitsAreLoading:R.commitsAreLoading,commitsError:R.commitsError,relatedPullRequests:R.relatedPullRequests,now:T,buildImageProxyUrl:H,commentComposer:E.jsx(gb,{isPr:i.isPr,now:T,onSubmit:J=>c.addComment(i,J)}),operationBar:E.jsx(Lb,{tab:s,item:i,hasPullRequest:I,statusOptions:f,storyOptions:d,handlers:F})})},Yb=()=>{const s={};for(const i of hl)s[i.name]=0;return s},Gb="console",Zb=()=>{const s=Cy(),{snapshots:i,isLoading:o,error:c}=qy(s),f=my(s),{activeTab:d,selectedItemKey:h,openItem:S,closeItem:g,selectTab:T}=f,z=Ry(s??Gb),R=oy(),C=xy(s,d,z),H=F0(),I=Date.now(),F=G.useMemo(()=>{const k=Yb();for(const X of hl){const vt=i[X.name];vt!==null&&(k[X.name]=vy(vt.items,z.overlay))}return k},[i,z.overlay]),K=i[d],ct=G.useMemo(()=>K===null?[]:Sy(K.items,z.overlay),[K,z.overlay]),J=G.useMemo(()=>ct.map(k=>Wl(k)),[ct]),bt=G.useMemo(()=>k0(ct,z.overlay),[ct,z.overlay]),st=(K==null?void 0:K.storyColors)??{},Nt=(K==null?void 0:K.statusOptions)??[],gt=(K==null?void 0:K.storyOptions)??[],tt=(K==null?void 0:K.generatedAt)??null,Mt=G.useMemo(()=>h===null||K===null?null:K.items.find(k=>k.projectItemId===h)??null,[h,K]),Pt=F[d],te=G.useRef({tab:d,count:Pt});G.useEffect(()=>{const k=te.current;if(te.current={tab:d,count:Pt},k.tab===d&&k.count>0&&Pt===0){const X=Xy(d,F);X!==null&&(T(X),g())}},[d,Pt,F,T,g]);const pe=(()=>{if(Mt===null)return null;const k=z.overlay[Wl(Mt)];return(k==null?void 0:k.status)??null})(),Bt=Mt!==null?mr(Mt,z.overlay):null,Me=G.useCallback(k=>{const X=Yy(J,k);X!==null?S(X):g()},[J,S,g]),Ht=G.useCallback(k=>{const X=Wl(k.item);H.enqueue({message:$0(k.kind,k.item,d),color:K0(k.kind),commit:k.commit,advance:()=>{J0(k.kind,d)&&Me(X)}})},[H,d,Me]),$t=G.useCallback(k=>{if(h===null||k===null)return;const X=k==="next"?Gy(J,h):Zy(J,h);X!==null&&S(X)},[h,J,S]),D=jy($t);return E.jsxs("main",{className:"console-app",children:[H.pending!==null&&E.jsx(X0,{message:H.pending.message,color:H.pending.color,remainingSeconds:H.pending.remainingSeconds,progress:H.pending.progress,onUndo:H.undo}),E.jsx(j0,{activeTab:d,counts:F,pjcode:s,generatedAt:tt,tabHref:f.tabHref,onSelectTab:f.selectTab}),Mt===null?E.jsx(Z0,{rows:bt,storyColors:st,activeItemId:null,now:I,isLoading:o,error:c,onSelectItem:k=>f.openItem(k.projectItemId)}):E.jsx("div",{className:"console-detail-screen",ref:D,children:E.jsx(qb,{tab:d,item:Mt,caches:R,operations:C,statusOptions:Nt,storyOptions:gt,storyColors:st,storyName:Bt,overlayStatus:pe,now:I,onQueueAction:Ht})})]})},vp=document.getElementById("root");if(vp===null)throw new Error("Root container #root not found");w0.createRoot(vp).render(E.jsx(G.StrictMode,{children:E.jsx(Zb,{})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>TDPM Console</title>
7
- <script type="module" crossorigin src="/assets/index-DR2UiWOI.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-WT-I47yz.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CzVHU81K.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "1.98.1",
3
+ "version": "1.98.2",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -68,7 +68,7 @@ test('processing tabs drives auto-advance and keeps emptied badges at zero', asy
68
68
  ).click();
69
69
  await processSelectedItemViaStatus(page);
70
70
  await expect(tabBadge(page, 'Triage')).toHaveText('1', { timeout: 8000 });
71
- await page.locator('.console-back-button').click();
71
+ await tabByLabel(page, 'Triage').click();
72
72
 
73
73
  await itemRowByText(
74
74
  page,
@@ -410,8 +410,7 @@ describe('ConsolePage auto-advance tab', () => {
410
410
  });
411
411
 
412
412
  fireEvent.click(getByText('Add serveConsole subcommand'));
413
- expect(await findByText('← Back to list')).toBeInTheDocument();
414
- fireEvent.click(getByText('Approve'));
413
+ fireEvent.click(await findByText('Approve'));
415
414
 
416
415
  act(() => {
417
416
  jest.advanceTimersByTime(5100);
@@ -222,13 +222,6 @@ export const ConsolePage = () => {
222
222
  />
223
223
  ) : (
224
224
  <div className="console-detail-screen" ref={detailScreenRef}>
225
- <button
226
- type="button"
227
- className="console-back-button"
228
- onClick={closeItem}
229
- >
230
- ← Back to list
231
- </button>
232
225
  <ConsoleItemDetailContainer
233
226
  tab={activeTab}
234
227
  item={selectedItem}
@@ -98,4 +98,4 @@ Please report this to https://github.com/markedjs/marked.`,i){const f="<p>An err
98
98
  `)}),d+=1,c=[])};for(const S of i){if(f===null&&/^```mermaid\s*$/.test(S.trim())){h(),f=[];continue}if(f!==null){if(S.trim()==="```"){o.push({kind:"mermaid",key:`mermaid:${d}`,code:f.join(`
99
99
  `)}),d+=1,f=null;continue}f.push(S);continue}c.push(S)}return f!==null&&c.push("```mermaid",...f),h(),o},fb="https://cdn.jsdelivr.net/npm/mermaid@10.9.6/dist/mermaid.min.js";let ou=null,Xh=0;const Qh=s=>(s.initialize({startOnLoad:!1,securityLevel:"strict",theme:"dark",themeVariables:{background:"#0d1117",primaryColor:"#161b22",primaryTextColor:"#e6edf3",primaryBorderColor:"#30363d",lineColor:"#8b949e",fontSize:"14px"}}),s),db=()=>ou!==null?ou:window.mermaid!==void 0?(ou=Promise.resolve(Qh(window.mermaid)),ou):(ou=new Promise((s,i)=>{const o=document.createElement("script");o.src=fb,o.async=!0,o.onload=()=>{if(window.mermaid===void 0){i(new Error("mermaid failed to load"));return}s(Qh(window.mermaid))},o.onerror=()=>i(new Error("mermaid script failed to load")),document.head.appendChild(o)}),ou),mb=async s=>{const i=await db();Xh+=1;const o=`console-mermaid-${Xh}`,{svg:c}=await i.render(o,s);return up.sanitize(c,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["foreignObject"]})},hb=({code:s})=>{const[i,o]=G.useState({status:"loading"}),c=G.useRef(null);return G.useEffect(()=>{let f=!1;return o({status:"loading"}),mb(s).then(d=>{f||o({status:"ready",svg:d})}).catch(d=>{f||o({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>{f=!0}},[s]),G.useEffect(()=>{const f=c.current;f!==null&&(f.innerHTML=i.status==="ready"?i.svg:"")},[i]),i.status==="loading"?E.jsx("div",{className:"console-mermaid-loading",children:"Rendering diagram..."}):i.status==="error"?E.jsxs("div",{className:"console-mermaid",children:[E.jsxs("div",{className:"console-mermaid-error",children:["Mermaid render error: ",i.message]}),E.jsx("pre",{className:"console-mermaid-source",children:E.jsx("code",{children:s})})]}):E.jsx("div",{ref:c,className:"console-mermaid-rendered"})},pb=({source:s,buildImageProxyUrl:i})=>{const o=G.useMemo(()=>{const f=ob(s);return i===void 0?f:Jy(f,i)},[s,i]),c=G.useRef(null);return G.useEffect(()=>{const f=c.current;f!==null&&(f.innerHTML=o)},[o]),E.jsx("div",{ref:c,className:"console-markdown"})},Ic=({body:s,buildImageProxyUrl:i})=>{const o=G.useMemo(()=>rb(s),[s]);return s.trim()===""?E.jsx("p",{className:"console-markdown-empty",children:"No description provided."}):E.jsx("div",{className:"console-markdown-view",children:o.map(c=>c.kind==="mermaid"?E.jsx(hb,{code:c.code},c.key):E.jsx(pb,{source:c.source,buildImageProxyUrl:i},c.key))})},gb=({isPr:s,now:i,onSubmit:o})=>{const[c,f]=G.useState(!s),[d,h]=G.useState(""),[S,g]=G.useState({kind:"idle"}),[T,z]=G.useState([]),R=async()=>{const C=d.trim();if(!(C.length===0||S.kind==="posting")){g({kind:"posting"});try{const H=await o(C);z(I=>[...I,H]),h(""),g({kind:"idle"})}catch(H){g({kind:"error",message:H instanceof Error?H.message:"failed to post"})}}};return E.jsxs("div",{className:"console-composer",children:[E.jsx("button",{type:"button",className:"console-composer-toggle","aria-expanded":c,onClick:()=>f(C=>!C),children:c?"✕ Cancel":"💬 Add a comment"}),T.length>0&&E.jsx("div",{className:"console-composer-posted",children:T.map(C=>E.jsxs("article",{className:"console-comment",children:[E.jsxs("header",{className:"console-comment-header",title:Sr(C.createdAt),children:[E.jsx("span",{className:"console-comment-author",children:C.author===""?"you":C.author}),E.jsx("span",{className:"console-comment-time",children:bi(C.createdAt,i)})]}),E.jsx(Ic,{body:C.body})]},`${C.author}:${C.createdAt}:${C.body}`))}),c&&E.jsxs("div",{className:"console-composer-form",children:[E.jsx("textarea",{className:"console-composer-input",rows:3,placeholder:"Leave a comment…",value:d,onChange:C=>h(C.target.value)}),E.jsxs("div",{className:"console-composer-row",children:[E.jsx("button",{type:"button",className:"console-composer-submit",disabled:S.kind==="posting",onClick:()=>{R()},children:"Comment"}),S.kind==="posting"&&E.jsx("span",{className:"console-composer-status",children:"Posting…"}),S.kind==="error"&&E.jsxs("span",{role:"alert",className:"console-composer-status console-composer-error",children:["Failed: ",S.message]})]})]})]})},ra=({title:s,count:i=null,defaultCollapsed:o=!1,headerAction:c,children:f})=>{const[d,h]=G.useState(o),S=i===null?s:`${s} (${i})`;return E.jsxs("section",{className:"console-panel",children:[E.jsxs("header",{className:"console-panel-header",children:[E.jsxs("button",{type:"button",className:"console-panel-toggle","aria-expanded":!d,onClick:()=>h(g=>!g),children:[E.jsx("span",{className:"console-panel-caret",children:d?"▸":"▾"}),E.jsx("span",{className:"console-panel-title",children:S})]}),c!==void 0&&E.jsx("div",{className:"console-panel-action",children:c})]}),!d&&E.jsx("div",{className:"console-panel-body",children:f})]})},yb=s=>{switch(s){case"added":return{label:"A",color:"#3fb950"};case"modified":return{label:"M",color:"#d29922"};case"removed":return{label:"D",color:"#f85149"};case"renamed":return{label:"R",color:"#a371f7"};case"changed":return{label:"M",color:"#d29922"};default:return{label:"?",color:"#8b949e"}}},bb=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,vb=s=>{const i=[];let o=0,c=0;for(const f of s.split(`
100
100
  `)){if(f.startsWith("@@")){const d=f.match(bb);d!==null&&(o=Number(d[1]),c=Number(d[2])),i.push({kind:"hunk",oldLineNumber:null,newLineNumber:null,content:f});continue}if(f.startsWith("+")){i.push({kind:"add",oldLineNumber:null,newLineNumber:c,content:f}),c+=1;continue}if(f.startsWith("-")){i.push({kind:"del",oldLineNumber:o,newLineNumber:null,content:f}),o+=1;continue}i.push({kind:"ctx",oldLineNumber:o,newLineNumber:c,content:f}),o+=1,c+=1}return i},Sb=({patch:s})=>{if(s===null||s==="")return E.jsx("p",{className:"console-file-diff-empty",children:"(no diff / binary or too large)"});const i=vb(s);return E.jsx("table",{className:"console-file-diff",children:E.jsx("tbody",{children:i.map(o=>E.jsxs("tr",{className:`console-diff-row console-diff-${o.kind}`,children:[E.jsx("td",{className:"console-diff-ln",children:o.oldLineNumber??""}),E.jsx("td",{className:"console-diff-ln",children:o.newLineNumber??""}),E.jsx("td",{className:"console-diff-code",children:o.content})]},`${o.kind}:${o.oldLineNumber??"x"}:${o.newLineNumber??"x"}:${o.content}`))})})},Tb=({file:s})=>{const[i,o]=G.useState(!1),c=yb(s.status);return E.jsxs("li",{className:"console-file",children:[E.jsxs("button",{type:"button",className:"console-file-row","aria-expanded":i,onClick:()=>o(f=>!f),children:[E.jsx("span",{className:"console-file-caret",children:i?"▾":"▸"}),E.jsx("span",{className:"console-file-badge",style:{color:c.color,borderColor:c.color},children:c.label}),E.jsx("span",{className:"console-file-path",children:s.path}),E.jsxs("span",{className:"console-file-stat console-file-add",children:["+",s.additions]}),E.jsxs("span",{className:"console-file-stat console-file-del",children:["-",s.deletions]})]}),i&&E.jsx(Sb,{patch:s.patch})]})},yp=({files:s,isLoading:i,error:o})=>o!==null?E.jsxs("p",{role:"alert",className:"console-files-error",children:["Failed to load changed files: ",o]}):i?E.jsx("p",{className:"console-files-loading",children:"Loading changed files..."}):s.length===0?E.jsx("p",{className:"console-files-empty",children:"No changed files."}):E.jsx("ul",{className:"console-files",children:s.map(c=>E.jsx(Tb,{file:c},c.path))}),Eb=({comments:s,isLoading:i,error:o,now:c,buildImageProxyUrl:f})=>{const[d,h]=G.useState(!1);if(o!==null)return E.jsxs("p",{role:"alert",className:"console-comment-error",children:["Failed to load comments: ",o]});if(i)return E.jsx("p",{className:"console-comment-loading",children:"Loading comments..."});if(s.length===0)return E.jsx("p",{className:"console-comment-empty",children:"No comments."});const S=d?s:s.slice(-1);return E.jsxs("div",{className:"console-comment-list",children:[!d&&s.length>1&&E.jsxs("button",{type:"button",className:"console-comment-show-all",onClick:()=>h(!0),children:["Show all ",s.length]}),S.map(g=>E.jsxs("article",{className:"console-comment",children:[E.jsxs("header",{className:"console-comment-header",children:[E.jsx("span",{className:"console-comment-author",children:g.author}),E.jsx("span",{className:"console-comment-time",children:bi(g.createdAt,c)})]}),E.jsx(Ic,{body:g.body,buildImageProxyUrl:f})]},`${g.author}:${g.createdAt}:${g.body}`))]})},Ab=s=>s.slice(0,7),_b=s=>s.split(`
101
- `)[0],bp=({commits:s,isLoading:i,error:o,now:c})=>o!==null?E.jsxs("p",{role:"alert",className:"console-commits-error",children:["Failed to load commits: ",o]}):i?E.jsx("p",{className:"console-commits-loading",children:"Loading commits..."}):s.length===0?E.jsx("p",{className:"console-commits-empty",children:"No commits."}):E.jsx("ul",{className:"console-commits",children:s.map(f=>E.jsxs("li",{className:"console-commit",children:[E.jsx("span",{className:"console-commit-message",children:_b(f.message)}),E.jsx("span",{className:"console-commit-sha",children:Ab(f.sha)}),E.jsx("span",{className:"console-commit-author",children:f.author}),E.jsx("span",{className:"console-commit-time",children:bi(f.authoredAt,c)})]},f.sha))}),xb=({pullRequest:s,body:i,bodyIsLoading:o,files:c,filesAreLoading:f,filesError:d,commits:h,commitsAreLoading:S,commitsError:g,now:T,buildImageProxyUrl:z})=>{const R=s.summary,C=f||d!==null?null:c.length,H=S||g!==null?null:h.length;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"console-pr-header",children:[E.jsx("a",{href:s.url,className:"console-pr-section-title",target:"_blank",rel:"noopener noreferrer",children:(R==null?void 0:R.title)??s.url}),s.isDraft&&E.jsx("span",{className:"console-pr-section-state",children:"draft"}),E.jsxs("div",{className:"console-pr-statbar",children:[s.branchName!==null&&E.jsx("span",{className:"console-pr-branch",children:s.branchName}),R!==null&&E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"console-pr-add",children:["+",R.additions]}),E.jsxs("span",{className:"console-pr-del",children:["-",R.deletions]}),E.jsxs("span",{className:"console-pr-files-count",children:[R.changedFiles," files"]})]})]})]}),E.jsx(ra,{title:"Description",defaultCollapsed:!0,children:o?E.jsx("p",{className:"console-pr-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:(R==null?void 0:R.body)??i,buildImageProxyUrl:z})}),E.jsx(ra,{title:"Changed files",count:C,children:E.jsx(yp,{files:c,isLoading:f,error:d})}),E.jsx(ra,{title:"Commits",count:H,defaultCollapsed:!0,children:E.jsx(bp,{commits:h,isLoading:S,error:g,now:T})})]})},Nb=({item:s,storyName:i,storyColorEnum:o,overlayStatus:c,state:f,body:d,bodyIsLoading:h,bodyError:S,comments:g,commentsAreLoading:T,commentsError:z,files:R,filesAreLoading:C,filesError:H,commits:I,commitsAreLoading:F,commitsError:K,relatedPullRequests:ct,now:J,commentComposer:bt,operationBar:st,buildImageProxyUrl:Nt})=>{const gt=(f==null?void 0:f.state)??"open",tt=(f==null?void 0:f.merged)??!1,Mt=!s.isPr&&gt==="closed"?"Closed":null,Pt=yi(o),te=c?yi(c.color):null,pe=C||H!==null?null:R.length,Bt=T||z!==null?null:g.length,Me=F||K!==null?null:I.length;return E.jsxs("article",{className:"console-detail",children:[i!==null&&E.jsx("div",{className:"console-detail-story",children:E.jsxs("span",{className:"console-storytag",children:[E.jsx("span",{className:"console-story-dot",style:{backgroundColor:Pt.dot}}),i]})}),c!==null&&te!==null&&E.jsx("span",{className:"console-detail-status-chip",style:{color:te.fg,borderColor:te.border,backgroundColor:te.bg},children:c.name}),E.jsxs("h2",{className:"console-detail-title",children:[E.jsx(Fh,{isPr:s.isPr,state:gt,merged:tt,isDraft:!1,stateReason:""}),E.jsx("span",{className:"console-detail-title-text",children:s.title}),E.jsx("span",{className:"console-detail-number",children:s.isPr?`PR #${s.number}`:`#${s.number}`}),Mt!==null&&E.jsx("span",{className:"console-detail-closed-label",children:Mt})]}),E.jsxs("div",{className:"console-detail-subbar",children:[E.jsx("a",{href:s.url,className:"console-detail-link",target:"_blank",rel:"noopener noreferrer",children:s.isPr?`PR #${s.number}`:`Issue #${s.number}`}),E.jsx("span",{className:"console-detail-repo",children:s.repo}),E.jsx("span",{className:"console-detail-pill",children:s.isPr?"PR":"Issue"})]}),s.labels.length>0&&E.jsx("div",{className:"console-detail-labels",children:s.labels.map(Ht=>E.jsx("span",{className:"console-label-chip",children:Ht},Ht))}),E.jsxs("div",{className:"console-detail-createdat",title:Sr(s.createdAt),children:["opened ",bi(s.createdAt,J)]}),E.jsx(ra,{title:"Description",headerAction:E.jsx("a",{href:s.url,className:"console-panel-open-link",target:"_blank",rel:"noopener noreferrer",children:"open"}),children:S!==null?E.jsxs("p",{role:"alert",className:"console-detail-body-error",children:["Failed to load description: ",S]}):h?E.jsx("p",{className:"console-detail-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:d,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Changed files",count:pe,children:E.jsx(yp,{files:R,isLoading:C,error:H})}),E.jsx(ra,{title:"Comments",count:Bt,defaultCollapsed:s.isPr,children:E.jsx(Eb,{comments:g,isLoading:T,error:z,now:J,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Commits",count:Me,defaultCollapsed:!0,children:E.jsx(bp,{commits:I,isLoading:F,error:K,now:J})}),!s.isPr&&ct.map(Ht=>{var $t;return E.jsx(xb,{pullRequest:Ht.pullRequest,body:(($t=Ht.pullRequest.summary)==null?void 0:$t.body)??"",bodyIsLoading:!1,files:Ht.files,filesAreLoading:Ht.filesAreLoading,filesError:Ht.filesError,commits:Ht.commits,commitsAreLoading:Ht.commitsAreLoading,commitsError:Ht.commitsError,now:J,buildImageProxyUrl:Nt},Ht.pullRequest.url)}),bt,E.jsx("div",{className:"console-actionbar",children:st})]})},Ob=({onClose:s})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close_not_planned"),children:"Close as not planned"}),E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close"),children:"Close"})]}),zb=({isTodoByHuman:s,onSetNextActionDate:i})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1day"),children:"+1 day"}),E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1week"),children:s?"+1 week and skip":"+1 week"})]}),Rb=[{action:"unnecessary",label:"Unnecessary",variant:"unneeded"},{action:"totally_wrong",label:"Totally wrong",variant:"wrong"},{action:"request_changes",label:"Reject",variant:"reject"},{action:"approve",label:"Approve",variant:"approve"}],Mb=({onReview:s})=>E.jsx("div",{className:"console-op-group console-op-group-review",children:Rb.map(i=>E.jsx("button",{type:"button",className:`console-op-button console-op-button-${i.variant}`,onClick:()=>s(i.action),children:i.label},i.action))}),Cb=(s,i)=>{const o=i.toLowerCase();return s.find(c=>c.name.toLowerCase()===o)??null},Db=({statusOptions:s,onSetStatus:i,onSetInTmuxByHuman:o})=>{const c=gy.map(f=>({name:f,option:Cb(s,f)})).filter(f=>f.option!==null);return c.length===0?null:E.jsx("div",{className:"console-op-group",children:c.map(({name:f,option:d})=>{const h=yi(d.color),S=f===yy;return E.jsx("button",{type:"button",className:"console-op-button",style:{color:h.fg,borderColor:h.border,backgroundColor:h.bg},onClick:()=>S?o(d):i(d),children:d.name},d.id)})})},Ub=s=>s.name.toLowerCase().includes("no story"),wb=({storyOptions:s,onSetStory:i})=>{const o=s.filter(c=>!Ub(c));return o.length===0?null:E.jsx("div",{className:"console-op-group console-op-group-stories",children:o.map(c=>{const f=yi(c.color);return E.jsx("button",{type:"button",className:"console-op-button",style:{color:f.fg,borderColor:f.border,backgroundColor:f.bg},onClick:()=>i(c),children:c.name},c.id)})})},Lb=({tab:s,item:i,hasPullRequest:o,statusOptions:c,storyOptions:f,handlers:d})=>{const h=s==="triage",S=!i.isPr;return E.jsxs("div",{className:"console-operation-bar",children:[o&&E.jsx(Mb,{onReview:d.onReview}),E.jsx(zb,{isTodoByHuman:by(s),onSetNextActionDate:d.onSetNextActionDate}),h&&E.jsx(wb,{storyOptions:f,onSetStory:d.onSetStory}),E.jsx(Db,{statusOptions:c,onSetStatus:d.onSetStatus,onSetInTmuxByHuman:d.onSetInTmuxByHuman}),S&&E.jsx(Ob,{onClose:d.onClose})]})},ru=(s,i,o,c)=>{const f=i!==null?s.peek(i):void 0,[d,h]=G.useState(f??c),[S,g]=G.useState(i!==null&&f===void 0),[T,z]=G.useState(null);return G.useEffect(()=>{if(i===null||o===null)return;const R=s.peek(i);if(R!==void 0){h(R),g(!1),z(null);return}let C=!1;return g(!0),z(null),s.load(i,o).then(H=>{C||(h(H),g(!1))}).catch(H=>{C||(z(H instanceof Error?H.message:String(H)),g(!1))}),()=>{C=!0}},[s,i,o]),{data:d,isLoading:S,error:T}},jb=[],Vh=[],Kh=[],Hb=[],kb={state:"open",merged:!1,isPullRequest:!1},Bb=(s,i)=>{const o=i!==null?`${i.repo}#${i.number}`:null,c=i!==null?i.url:null,f=(i==null?void 0:i.isPr)??!1,d=ru(s.body,o,c,""),h=ru(s.state,o,c,kb),S=ru(s.comments,o,c,jb),g=ru(s.files,f?o:null,f?c:null,Vh),T=ru(s.commits,f?o:null,f?c:null,Kh),z=ru(s.relatedPrs,f?null:o,f?null:c,Hb),[R,C]=G.useState([]);return G.useEffect(()=>{if(f||z.data.length===0){C([]);return}let H=!1;const I=z.data.map(K=>({pullRequest:K,files:Vh,filesAreLoading:!0,filesError:null,commits:Kh,commitsAreLoading:!0,commitsError:null}));C(I);const F=(K,ct)=>{H||C(J=>J.map(bt=>bt.pullRequest.url===K?{...bt,...ct}:bt))};for(const K of z.data){const ct=K.url;s.files.load(ct,K.url).then(J=>F(K.url,{files:J,filesAreLoading:!1})).catch(J=>F(K.url,{filesAreLoading:!1,filesError:J instanceof Error?J.message:String(J)})),s.commits.load(ct,K.url).then(J=>F(K.url,{commits:J,commitsAreLoading:!1})).catch(J=>F(K.url,{commitsAreLoading:!1,commitsError:J instanceof Error?J.message:String(J)}))}return()=>{H=!0}},[s,f,z.data]),{state:h.data,body:d.data,bodyIsLoading:d.isLoading,bodyError:d.error,comments:S.data,commentsAreLoading:S.isLoading,commentsError:S.error,files:g.data,filesAreLoading:g.isLoading,filesError:g.error,commits:T.data,commitsAreLoading:T.isLoading,commitsError:T.error,relatedPullRequests:R}},qb=({tab:s,item:i,caches:o,operations:c,statusOptions:f,storyOptions:d,storyColors:h,storyName:S,overlayStatus:g,now:T,onQueueAction:z})=>{const R=Bb(o,i),{token:C}=Jc(),H=G.useCallback(J=>Ky(J,C),[C]),I=i.isPr||R.relatedPullRequests.length>0,F={onReview:J=>{var st;const bt=i.isPr?i.url:((st=R.relatedPullRequests[0])==null?void 0:st.pullRequest.url)??i.url;z({kind:{type:"review",action:J},item:i,commit:()=>{c.reviewPullRequest(i,bt,J)}})},onSetNextActionDate:J=>{z({kind:{type:"next_action_date",action:J},item:i,commit:()=>{c.setNextActionDate(i,J)}})},onSetStory:J=>{z({kind:{type:"set_story",optionName:J.name},item:i,commit:()=>{c.setStory(i,J)}})},onSetStatus:J=>{z({kind:{type:"set_status",optionName:J.name},item:i,commit:()=>{c.setStatus(i,J)}})},onSetInTmuxByHuman:J=>{z({kind:{type:"set_in_tmux_by_human",optionName:J.name},item:i,commit:()=>{c.setInTmuxByHuman(i,J)}})},onClose:J=>{z({kind:{type:"close",action:J},item:i,commit:()=>{c.closeIssue(i,J)}})}},K=S??(i.story.trim()!==""?i.story:null),ct=K!==null?Jh(h,K):null;return E.jsx(Nb,{item:i,storyName:K,storyColorEnum:ct,overlayStatus:g,state:R.state,body:R.body,bodyIsLoading:R.bodyIsLoading,bodyError:R.bodyError,comments:R.comments,commentsAreLoading:R.commentsAreLoading,commentsError:R.commentsError,files:R.files,filesAreLoading:R.filesAreLoading,filesError:R.filesError,commits:R.commits,commitsAreLoading:R.commitsAreLoading,commitsError:R.commitsError,relatedPullRequests:R.relatedPullRequests,now:T,buildImageProxyUrl:H,commentComposer:E.jsx(gb,{isPr:i.isPr,now:T,onSubmit:J=>c.addComment(i,J)}),operationBar:E.jsx(Lb,{tab:s,item:i,hasPullRequest:I,statusOptions:f,storyOptions:d,handlers:F})})},Yb=()=>{const s={};for(const i of hl)s[i.name]=0;return s},Gb="console",Zb=()=>{const s=Cy(),{snapshots:i,isLoading:o,error:c}=qy(s),f=my(s),{activeTab:d,selectedItemKey:h,openItem:S,closeItem:g,selectTab:T}=f,z=Ry(s??Gb),R=oy(),C=xy(s,d,z),H=F0(),I=Date.now(),F=G.useMemo(()=>{const k=Yb();for(const X of hl){const vt=i[X.name];vt!==null&&(k[X.name]=vy(vt.items,z.overlay))}return k},[i,z.overlay]),K=i[d],ct=G.useMemo(()=>K===null?[]:Sy(K.items,z.overlay),[K,z.overlay]),J=G.useMemo(()=>ct.map(k=>Wl(k)),[ct]),bt=G.useMemo(()=>k0(ct,z.overlay),[ct,z.overlay]),st=(K==null?void 0:K.storyColors)??{},Nt=(K==null?void 0:K.statusOptions)??[],gt=(K==null?void 0:K.storyOptions)??[],tt=(K==null?void 0:K.generatedAt)??null,Mt=G.useMemo(()=>h===null||K===null?null:K.items.find(k=>k.projectItemId===h)??null,[h,K]),Pt=F[d],te=G.useRef({tab:d,count:Pt});G.useEffect(()=>{const k=te.current;if(te.current={tab:d,count:Pt},k.tab===d&&k.count>0&&Pt===0){const X=Xy(d,F);X!==null&&(T(X),g())}},[d,Pt,F,T,g]);const pe=(()=>{if(Mt===null)return null;const k=z.overlay[Wl(Mt)];return(k==null?void 0:k.status)??null})(),Bt=Mt!==null?mr(Mt,z.overlay):null,Me=G.useCallback(k=>{const X=Yy(J,k);X!==null?S(X):g()},[J,S,g]),Ht=G.useCallback(k=>{const X=Wl(k.item);H.enqueue({message:$0(k.kind,k.item,d),color:K0(k.kind),commit:k.commit,advance:()=>{J0(k.kind,d)&&Me(X)}})},[H,d,Me]),$t=G.useCallback(k=>{if(h===null||k===null)return;const X=k==="next"?Gy(J,h):Zy(J,h);X!==null&&S(X)},[h,J,S]),D=jy($t);return E.jsxs("main",{className:"console-app",children:[H.pending!==null&&E.jsx(X0,{message:H.pending.message,color:H.pending.color,remainingSeconds:H.pending.remainingSeconds,progress:H.pending.progress,onUndo:H.undo}),E.jsx(j0,{activeTab:d,counts:F,pjcode:s,generatedAt:tt,tabHref:f.tabHref,onSelectTab:f.selectTab}),Mt===null?E.jsx(Z0,{rows:bt,storyColors:st,activeItemId:null,now:I,isLoading:o,error:c,onSelectItem:k=>f.openItem(k.projectItemId)}):E.jsxs("div",{className:"console-detail-screen",ref:D,children:[E.jsx("button",{type:"button",className:"console-back-button",onClick:g,children:"← Back to list"}),E.jsx(qb,{tab:d,item:Mt,caches:R,operations:C,statusOptions:Nt,storyOptions:gt,storyColors:st,storyName:Bt,overlayStatus:pe,now:I,onQueueAction:Ht})]})]})},vp=document.getElementById("root");if(vp===null)throw new Error("Root container #root not found");w0.createRoot(vp).render(E.jsx(G.StrictMode,{children:E.jsx(Zb,{})}));
101
+ `)[0],bp=({commits:s,isLoading:i,error:o,now:c})=>o!==null?E.jsxs("p",{role:"alert",className:"console-commits-error",children:["Failed to load commits: ",o]}):i?E.jsx("p",{className:"console-commits-loading",children:"Loading commits..."}):s.length===0?E.jsx("p",{className:"console-commits-empty",children:"No commits."}):E.jsx("ul",{className:"console-commits",children:s.map(f=>E.jsxs("li",{className:"console-commit",children:[E.jsx("span",{className:"console-commit-message",children:_b(f.message)}),E.jsx("span",{className:"console-commit-sha",children:Ab(f.sha)}),E.jsx("span",{className:"console-commit-author",children:f.author}),E.jsx("span",{className:"console-commit-time",children:bi(f.authoredAt,c)})]},f.sha))}),xb=({pullRequest:s,body:i,bodyIsLoading:o,files:c,filesAreLoading:f,filesError:d,commits:h,commitsAreLoading:S,commitsError:g,now:T,buildImageProxyUrl:z})=>{const R=s.summary,C=f||d!==null?null:c.length,H=S||g!==null?null:h.length;return E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"console-pr-header",children:[E.jsx("a",{href:s.url,className:"console-pr-section-title",target:"_blank",rel:"noopener noreferrer",children:(R==null?void 0:R.title)??s.url}),s.isDraft&&E.jsx("span",{className:"console-pr-section-state",children:"draft"}),E.jsxs("div",{className:"console-pr-statbar",children:[s.branchName!==null&&E.jsx("span",{className:"console-pr-branch",children:s.branchName}),R!==null&&E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"console-pr-add",children:["+",R.additions]}),E.jsxs("span",{className:"console-pr-del",children:["-",R.deletions]}),E.jsxs("span",{className:"console-pr-files-count",children:[R.changedFiles," files"]})]})]})]}),E.jsx(ra,{title:"Description",defaultCollapsed:!0,children:o?E.jsx("p",{className:"console-pr-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:(R==null?void 0:R.body)??i,buildImageProxyUrl:z})}),E.jsx(ra,{title:"Changed files",count:C,children:E.jsx(yp,{files:c,isLoading:f,error:d})}),E.jsx(ra,{title:"Commits",count:H,defaultCollapsed:!0,children:E.jsx(bp,{commits:h,isLoading:S,error:g,now:T})})]})},Nb=({item:s,storyName:i,storyColorEnum:o,overlayStatus:c,state:f,body:d,bodyIsLoading:h,bodyError:S,comments:g,commentsAreLoading:T,commentsError:z,files:R,filesAreLoading:C,filesError:H,commits:I,commitsAreLoading:F,commitsError:K,relatedPullRequests:ct,now:J,commentComposer:bt,operationBar:st,buildImageProxyUrl:Nt})=>{const gt=(f==null?void 0:f.state)??"open",tt=(f==null?void 0:f.merged)??!1,Mt=!s.isPr&&gt==="closed"?"Closed":null,Pt=yi(o),te=c?yi(c.color):null,pe=C||H!==null?null:R.length,Bt=T||z!==null?null:g.length,Me=F||K!==null?null:I.length;return E.jsxs("article",{className:"console-detail",children:[i!==null&&E.jsx("div",{className:"console-detail-story",children:E.jsxs("span",{className:"console-storytag",children:[E.jsx("span",{className:"console-story-dot",style:{backgroundColor:Pt.dot}}),i]})}),c!==null&&te!==null&&E.jsx("span",{className:"console-detail-status-chip",style:{color:te.fg,borderColor:te.border,backgroundColor:te.bg},children:c.name}),E.jsxs("h2",{className:"console-detail-title",children:[E.jsx(Fh,{isPr:s.isPr,state:gt,merged:tt,isDraft:!1,stateReason:""}),E.jsx("span",{className:"console-detail-title-text",children:s.title}),E.jsx("span",{className:"console-detail-number",children:s.isPr?`PR #${s.number}`:`#${s.number}`}),Mt!==null&&E.jsx("span",{className:"console-detail-closed-label",children:Mt})]}),E.jsxs("div",{className:"console-detail-subbar",children:[E.jsx("a",{href:s.url,className:"console-detail-link",target:"_blank",rel:"noopener noreferrer",children:s.isPr?`PR #${s.number}`:`Issue #${s.number}`}),E.jsx("span",{className:"console-detail-repo",children:s.repo}),E.jsx("span",{className:"console-detail-pill",children:s.isPr?"PR":"Issue"})]}),s.labels.length>0&&E.jsx("div",{className:"console-detail-labels",children:s.labels.map(Ht=>E.jsx("span",{className:"console-label-chip",children:Ht},Ht))}),E.jsxs("div",{className:"console-detail-createdat",title:Sr(s.createdAt),children:["opened ",bi(s.createdAt,J)]}),E.jsx(ra,{title:"Description",headerAction:E.jsx("a",{href:s.url,className:"console-panel-open-link",target:"_blank",rel:"noopener noreferrer",children:"open"}),children:S!==null?E.jsxs("p",{role:"alert",className:"console-detail-body-error",children:["Failed to load description: ",S]}):h?E.jsx("p",{className:"console-detail-body-loading",children:"Loading description..."}):E.jsx(Ic,{body:d,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Changed files",count:pe,children:E.jsx(yp,{files:R,isLoading:C,error:H})}),E.jsx(ra,{title:"Comments",count:Bt,defaultCollapsed:s.isPr,children:E.jsx(Eb,{comments:g,isLoading:T,error:z,now:J,buildImageProxyUrl:Nt})}),s.isPr&&E.jsx(ra,{title:"Commits",count:Me,defaultCollapsed:!0,children:E.jsx(bp,{commits:I,isLoading:F,error:K,now:J})}),!s.isPr&&ct.map(Ht=>{var $t;return E.jsx(xb,{pullRequest:Ht.pullRequest,body:(($t=Ht.pullRequest.summary)==null?void 0:$t.body)??"",bodyIsLoading:!1,files:Ht.files,filesAreLoading:Ht.filesAreLoading,filesError:Ht.filesError,commits:Ht.commits,commitsAreLoading:Ht.commitsAreLoading,commitsError:Ht.commitsError,now:J,buildImageProxyUrl:Nt},Ht.pullRequest.url)}),bt,E.jsx("div",{className:"console-actionbar",children:st})]})},Ob=({onClose:s})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close_not_planned"),children:"Close as not planned"}),E.jsx("button",{type:"button",className:"console-op-button",onClick:()=>s("close"),children:"Close"})]}),zb=({isTodoByHuman:s,onSetNextActionDate:i})=>E.jsxs("div",{className:"console-op-group",children:[E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1day"),children:"+1 day"}),E.jsx("button",{type:"button",className:"console-op-button console-op-button-snooze",onClick:()=>i("snooze_1week"),children:s?"+1 week and skip":"+1 week"})]}),Rb=[{action:"unnecessary",label:"Unnecessary",variant:"unneeded"},{action:"totally_wrong",label:"Totally wrong",variant:"wrong"},{action:"request_changes",label:"Reject",variant:"reject"},{action:"approve",label:"Approve",variant:"approve"}],Mb=({onReview:s})=>E.jsx("div",{className:"console-op-group console-op-group-review",children:Rb.map(i=>E.jsx("button",{type:"button",className:`console-op-button console-op-button-${i.variant}`,onClick:()=>s(i.action),children:i.label},i.action))}),Cb=(s,i)=>{const o=i.toLowerCase();return s.find(c=>c.name.toLowerCase()===o)??null},Db=({statusOptions:s,onSetStatus:i,onSetInTmuxByHuman:o})=>{const c=gy.map(f=>({name:f,option:Cb(s,f)})).filter(f=>f.option!==null);return c.length===0?null:E.jsx("div",{className:"console-op-group",children:c.map(({name:f,option:d})=>{const h=yi(d.color),S=f===yy;return E.jsx("button",{type:"button",className:"console-op-button",style:{color:h.fg,borderColor:h.border,backgroundColor:h.bg},onClick:()=>S?o(d):i(d),children:d.name},d.id)})})},Ub=s=>s.name.toLowerCase().includes("no story"),wb=({storyOptions:s,onSetStory:i})=>{const o=s.filter(c=>!Ub(c));return o.length===0?null:E.jsx("div",{className:"console-op-group console-op-group-stories",children:o.map(c=>{const f=yi(c.color);return E.jsx("button",{type:"button",className:"console-op-button",style:{color:f.fg,borderColor:f.border,backgroundColor:f.bg},onClick:()=>i(c),children:c.name},c.id)})})},Lb=({tab:s,item:i,hasPullRequest:o,statusOptions:c,storyOptions:f,handlers:d})=>{const h=s==="triage",S=!i.isPr;return E.jsxs("div",{className:"console-operation-bar",children:[o&&E.jsx(Mb,{onReview:d.onReview}),E.jsx(zb,{isTodoByHuman:by(s),onSetNextActionDate:d.onSetNextActionDate}),h&&E.jsx(wb,{storyOptions:f,onSetStory:d.onSetStory}),E.jsx(Db,{statusOptions:c,onSetStatus:d.onSetStatus,onSetInTmuxByHuman:d.onSetInTmuxByHuman}),S&&E.jsx(Ob,{onClose:d.onClose})]})},ru=(s,i,o,c)=>{const f=i!==null?s.peek(i):void 0,[d,h]=G.useState(f??c),[S,g]=G.useState(i!==null&&f===void 0),[T,z]=G.useState(null);return G.useEffect(()=>{if(i===null||o===null)return;const R=s.peek(i);if(R!==void 0){h(R),g(!1),z(null);return}let C=!1;return g(!0),z(null),s.load(i,o).then(H=>{C||(h(H),g(!1))}).catch(H=>{C||(z(H instanceof Error?H.message:String(H)),g(!1))}),()=>{C=!0}},[s,i,o]),{data:d,isLoading:S,error:T}},jb=[],Vh=[],Kh=[],Hb=[],kb={state:"open",merged:!1,isPullRequest:!1},Bb=(s,i)=>{const o=i!==null?`${i.repo}#${i.number}`:null,c=i!==null?i.url:null,f=(i==null?void 0:i.isPr)??!1,d=ru(s.body,o,c,""),h=ru(s.state,o,c,kb),S=ru(s.comments,o,c,jb),g=ru(s.files,f?o:null,f?c:null,Vh),T=ru(s.commits,f?o:null,f?c:null,Kh),z=ru(s.relatedPrs,f?null:o,f?null:c,Hb),[R,C]=G.useState([]);return G.useEffect(()=>{if(f||z.data.length===0){C([]);return}let H=!1;const I=z.data.map(K=>({pullRequest:K,files:Vh,filesAreLoading:!0,filesError:null,commits:Kh,commitsAreLoading:!0,commitsError:null}));C(I);const F=(K,ct)=>{H||C(J=>J.map(bt=>bt.pullRequest.url===K?{...bt,...ct}:bt))};for(const K of z.data){const ct=K.url;s.files.load(ct,K.url).then(J=>F(K.url,{files:J,filesAreLoading:!1})).catch(J=>F(K.url,{filesAreLoading:!1,filesError:J instanceof Error?J.message:String(J)})),s.commits.load(ct,K.url).then(J=>F(K.url,{commits:J,commitsAreLoading:!1})).catch(J=>F(K.url,{commitsAreLoading:!1,commitsError:J instanceof Error?J.message:String(J)}))}return()=>{H=!0}},[s,f,z.data]),{state:h.data,body:d.data,bodyIsLoading:d.isLoading,bodyError:d.error,comments:S.data,commentsAreLoading:S.isLoading,commentsError:S.error,files:g.data,filesAreLoading:g.isLoading,filesError:g.error,commits:T.data,commitsAreLoading:T.isLoading,commitsError:T.error,relatedPullRequests:R}},qb=({tab:s,item:i,caches:o,operations:c,statusOptions:f,storyOptions:d,storyColors:h,storyName:S,overlayStatus:g,now:T,onQueueAction:z})=>{const R=Bb(o,i),{token:C}=Jc(),H=G.useCallback(J=>Ky(J,C),[C]),I=i.isPr||R.relatedPullRequests.length>0,F={onReview:J=>{var st;const bt=i.isPr?i.url:((st=R.relatedPullRequests[0])==null?void 0:st.pullRequest.url)??i.url;z({kind:{type:"review",action:J},item:i,commit:()=>{c.reviewPullRequest(i,bt,J)}})},onSetNextActionDate:J=>{z({kind:{type:"next_action_date",action:J},item:i,commit:()=>{c.setNextActionDate(i,J)}})},onSetStory:J=>{z({kind:{type:"set_story",optionName:J.name},item:i,commit:()=>{c.setStory(i,J)}})},onSetStatus:J=>{z({kind:{type:"set_status",optionName:J.name},item:i,commit:()=>{c.setStatus(i,J)}})},onSetInTmuxByHuman:J=>{z({kind:{type:"set_in_tmux_by_human",optionName:J.name},item:i,commit:()=>{c.setInTmuxByHuman(i,J)}})},onClose:J=>{z({kind:{type:"close",action:J},item:i,commit:()=>{c.closeIssue(i,J)}})}},K=S??(i.story.trim()!==""?i.story:null),ct=K!==null?Jh(h,K):null;return E.jsx(Nb,{item:i,storyName:K,storyColorEnum:ct,overlayStatus:g,state:R.state,body:R.body,bodyIsLoading:R.bodyIsLoading,bodyError:R.bodyError,comments:R.comments,commentsAreLoading:R.commentsAreLoading,commentsError:R.commentsError,files:R.files,filesAreLoading:R.filesAreLoading,filesError:R.filesError,commits:R.commits,commitsAreLoading:R.commitsAreLoading,commitsError:R.commitsError,relatedPullRequests:R.relatedPullRequests,now:T,buildImageProxyUrl:H,commentComposer:E.jsx(gb,{isPr:i.isPr,now:T,onSubmit:J=>c.addComment(i,J)}),operationBar:E.jsx(Lb,{tab:s,item:i,hasPullRequest:I,statusOptions:f,storyOptions:d,handlers:F})})},Yb=()=>{const s={};for(const i of hl)s[i.name]=0;return s},Gb="console",Zb=()=>{const s=Cy(),{snapshots:i,isLoading:o,error:c}=qy(s),f=my(s),{activeTab:d,selectedItemKey:h,openItem:S,closeItem:g,selectTab:T}=f,z=Ry(s??Gb),R=oy(),C=xy(s,d,z),H=F0(),I=Date.now(),F=G.useMemo(()=>{const k=Yb();for(const X of hl){const vt=i[X.name];vt!==null&&(k[X.name]=vy(vt.items,z.overlay))}return k},[i,z.overlay]),K=i[d],ct=G.useMemo(()=>K===null?[]:Sy(K.items,z.overlay),[K,z.overlay]),J=G.useMemo(()=>ct.map(k=>Wl(k)),[ct]),bt=G.useMemo(()=>k0(ct,z.overlay),[ct,z.overlay]),st=(K==null?void 0:K.storyColors)??{},Nt=(K==null?void 0:K.statusOptions)??[],gt=(K==null?void 0:K.storyOptions)??[],tt=(K==null?void 0:K.generatedAt)??null,Mt=G.useMemo(()=>h===null||K===null?null:K.items.find(k=>k.projectItemId===h)??null,[h,K]),Pt=F[d],te=G.useRef({tab:d,count:Pt});G.useEffect(()=>{const k=te.current;if(te.current={tab:d,count:Pt},k.tab===d&&k.count>0&&Pt===0){const X=Xy(d,F);X!==null&&(T(X),g())}},[d,Pt,F,T,g]);const pe=(()=>{if(Mt===null)return null;const k=z.overlay[Wl(Mt)];return(k==null?void 0:k.status)??null})(),Bt=Mt!==null?mr(Mt,z.overlay):null,Me=G.useCallback(k=>{const X=Yy(J,k);X!==null?S(X):g()},[J,S,g]),Ht=G.useCallback(k=>{const X=Wl(k.item);H.enqueue({message:$0(k.kind,k.item,d),color:K0(k.kind),commit:k.commit,advance:()=>{J0(k.kind,d)&&Me(X)}})},[H,d,Me]),$t=G.useCallback(k=>{if(h===null||k===null)return;const X=k==="next"?Gy(J,h):Zy(J,h);X!==null&&S(X)},[h,J,S]),D=jy($t);return E.jsxs("main",{className:"console-app",children:[H.pending!==null&&E.jsx(X0,{message:H.pending.message,color:H.pending.color,remainingSeconds:H.pending.remainingSeconds,progress:H.pending.progress,onUndo:H.undo}),E.jsx(j0,{activeTab:d,counts:F,pjcode:s,generatedAt:tt,tabHref:f.tabHref,onSelectTab:f.selectTab}),Mt===null?E.jsx(Z0,{rows:bt,storyColors:st,activeItemId:null,now:I,isLoading:o,error:c,onSelectItem:k=>f.openItem(k.projectItemId)}):E.jsx("div",{className:"console-detail-screen",ref:D,children:E.jsx(qb,{tab:d,item:Mt,caches:R,operations:C,statusOptions:Nt,storyOptions:gt,storyColors:st,storyName:Bt,overlayStatus:pe,now:I,onQueueAction:Ht})})]})},vp=document.getElementById("root");if(vp===null)throw new Error("Root container #root not found");w0.createRoot(vp).render(E.jsx(G.StrictMode,{children:E.jsx(Zb,{})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>TDPM Console</title>
7
- <script type="module" crossorigin src="/assets/index-DR2UiWOI.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-WT-I47yz.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CzVHU81K.css">
9
9
  </head>
10
10
  <body>