@capagents/forgeqe 3.0.9 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_USE.md +35 -22
- package/bin/bundle.js +3 -3
- package/bin/forgeqe.js +3 -3
- package/bin/license.js +1 -1
- package/dist/docs-site/CREDITS.md +11 -4
- package/dist/docs-site/LICENSE.dm-sans.txt +93 -0
- package/dist/docs-site/LICENSE.jetbrains-mono.txt +93 -0
- package/dist/docs-site/app-look.css +62 -0
- package/dist/docs-site/architecture-map/arch-fill.js +56 -0
- package/dist/docs-site/architecture-map/arch-theme.css +203 -0
- package/dist/docs-site/architecture-map/arch.css +0 -5
- package/dist/docs-site/architecture-map/index.html +57 -43
- package/dist/docs-site/docs/app-theme.css +166 -0
- package/dist/docs-site/docs/architecture/index.html +14 -11
- package/dist/docs-site/docs/containers/index.html +14 -11
- package/dist/docs-site/docs/cost-architecture/index.html +14 -11
- package/dist/docs-site/docs/custom-agents-first-run/index.html +14 -11
- package/dist/docs-site/docs/desktop/index.html +14 -11
- package/dist/docs-site/docs/desktop-ci/index.html +14 -11
- package/dist/docs-site/docs/docs.css +0 -7
- package/dist/docs-site/docs/evidence/index.html +14 -11
- package/dist/docs-site/docs/feature-test-prompts/index.html +14 -11
- package/dist/docs-site/docs/graphify/index.html +14 -11
- package/dist/docs-site/docs/guardrails/index.html +14 -11
- package/dist/docs-site/docs/index.html +96 -40
- package/dist/docs-site/docs/mobile/index.html +56 -18
- package/dist/docs-site/docs/model-routing/index.html +14 -11
- package/dist/docs-site/docs/product-graph/index.html +14 -11
- package/dist/docs-site/docs/product-knowledge/index.html +14 -11
- package/dist/docs-site/docs/product-views/index.html +14 -11
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +14 -11
- package/dist/docs-site/img/wordmark.webp +0 -0
- package/dist/docs-site/site-header.css +0 -5
- package/dist/forgeqe.js +2225 -1867
- package/dist/template.html +14 -14
- package/dist/web/assets/{AgentWork-BhepbEeU.js → AgentWork-DwAI0_Of.js} +1 -1
- package/dist/web/assets/ApiTests-C0vFSHmM.js +10 -0
- package/dist/web/assets/Browse-5jfdtRc5.js +2 -0
- package/dist/web/assets/Chat-B3uhI94O.js +3 -0
- package/dist/web/assets/{CommandPalette-DMAmXPq1.js → CommandPalette-D2J4nf5y.js} +1 -1
- package/dist/web/assets/{Compare-DJNSrM2v.js → Compare-CN75w1p9.js} +1 -1
- package/dist/web/assets/{Cost-CEOZgbPs.js → Cost-QoxyjR95.js} +1 -1
- package/dist/web/assets/{Data-COFRpcJn.js → Data-BAvkcBVt.js} +4 -4
- package/dist/web/assets/Desktop-BXdOIalN.js +1 -0
- package/dist/web/assets/DesktopReview-Bl2SrPP0.js +1 -0
- package/dist/web/assets/{Evidence-DTrdEz3M.js → Evidence-BJ_I52CD.js} +1 -1
- package/dist/web/assets/{Explore-DDXgQj5Q.js → Explore-D9AuyTip.js} +2 -2
- package/dist/web/assets/Features-CusGMDR9.js +1 -0
- package/dist/web/assets/Flags-CycGFuUP.js +2 -0
- package/dist/web/assets/Flaky-BcSzJogN.js +1 -0
- package/dist/web/assets/Impact-CJHnyZ21.js +3 -0
- package/dist/web/assets/Jobs-4xcFzEFo.js +5 -0
- package/dist/web/assets/KindPage-BielEIej.js +6 -0
- package/dist/web/assets/Migration-NwanKpJg.js +2 -0
- package/dist/web/assets/PageAgent-CNw4NXva.js +1 -0
- package/dist/web/assets/Product-DS3LJZ4P.js +7 -0
- package/dist/web/assets/Production-D3zsyNIS.js +1 -0
- package/dist/web/assets/{Quality-DgNo4H0u.js → Quality-Ctj2YpC4.js} +1 -1
- package/dist/web/assets/{Readiness--GiTxFZo.js → Readiness-DGcRr_co.js} +1 -1
- package/dist/web/assets/Record-Cc-wGe_Y.js +1 -0
- package/dist/web/assets/Regression-DcsbrRa1.js +5 -0
- package/dist/web/assets/{Reports-C-NSlVAn.js → Reports-BkCn0-Sf.js} +2 -2
- package/dist/web/assets/Response-BP0UwQcW.js +9 -0
- package/dist/web/assets/Responsive-C8U7dumd.js +3 -0
- package/dist/web/assets/{RunDiff-CIdQD95y.js → RunDiff-BhABuhF_.js} +1 -1
- package/dist/web/assets/Runs-OwdWEYBv.js +2 -0
- package/dist/web/assets/Steps-BvzbQyoD.js +2 -0
- package/dist/web/assets/{TestCases-D-ZRb2N7.js → TestCases-CLq_6JA5.js} +1 -1
- package/dist/web/assets/{TestData-kXWCn7uZ.js → TestData-B0oKAhp6.js} +2 -2
- package/dist/web/assets/TestDebt-8NLQ5YV_.js +1 -0
- package/dist/web/assets/TestManagement-2LYQ7vsN.js +1 -0
- package/dist/web/assets/Tosca-DfvMpPTG.js +3 -0
- package/dist/web/assets/{WhatsNew-DpJWNec7.js → WhatsNew-BGFNGwqN.js} +1 -1
- package/dist/web/assets/families-DYlN5v0i.js +1 -0
- package/dist/web/assets/filters-faaSnoIq.js +1 -0
- package/dist/web/assets/{fold-BRxvbN9r.js → fold-CUjwWAK3.js} +1 -1
- package/dist/web/assets/frame-BLPdAXUq.js +13 -0
- package/dist/web/assets/head-CsTxBsO0.js +1 -0
- package/dist/web/assets/index-CxiCvGZq.js +78 -0
- package/dist/web/assets/index-dOIsrzhD.css +2 -0
- package/dist/web/assets/line-icons-CwZWt93L.js +1 -0
- package/dist/web/assets/logos-dGuc1jIM.js +1 -0
- package/dist/web/assets/{markdown-CWisJbSJ.js → markdown-BI3F-SJ1.js} +5 -5
- package/dist/web/assets/paletteCommands-QJiCuUEr.js +1 -0
- package/dist/web/assets/parts-CdF1f7yS.js +1 -0
- package/dist/web/assets/{productParts-BxdHuSBa.js → productParts-hNLD9fN0.js} +1 -1
- package/dist/web/assets/qualityParts-CT25lBWU.js +1 -0
- package/dist/web/assets/{recordTest-CcplpTS6.js → recordTest-P792aBUt.js} +1 -1
- package/dist/web/index.html +6 -6
- package/docs/ForgeQE-Client-Overview.pdf +0 -0
- package/docs/ForgeQE-Installation-Guide.pdf +0 -0
- package/docs/MOBILE.md +42 -7
- package/docs/user-guide.html +65 -12
- package/package.json +1 -1
- package/prompts/brain.md +1 -0
- package/prompts/responsive-review.md +38 -0
- package/prompts/responsive-split.md +40 -0
- package/prompts/responsive.md +42 -0
- package/py/forgeqe_data/connect.py +3 -1
- package/py/forgeqe_data/flows.py +1 -1
- package/py/forgeqe_data/service.py +1 -1
- package/py/forgeqe_data/streams.py +1 -1
- package/py/forgeqe_data/testdata.py +1 -1
- package/py/forgeqe_desktop/replay.py +43 -1
- package/py/forgeqe_desktop/service.py +2 -0
- package/py/forgeqe_desktop/workflow.py +77 -15
- package/py/forgeqe_engine/brand.py +1 -1
- package/py/forgeqe_engine/browser.py +2 -1
- package/py/forgeqe_engine/diagnostics.py +1 -1
- package/py/forgeqe_engine/memory.py +2 -1
- package/py/forgeqe_engine/neutral_log.py +1 -1
- package/py/forgeqe_engine/otp.py +127 -12
- package/py/forgeqe_engine/pwlaunch.mjs +1 -1
- package/py/forgeqe_engine/recordsession.py +13 -3
- package/py/forgeqe_engine/webrecord.py +20 -0
- package/py/forgeqe_mobile/appium_driver.py +225 -10
- package/py/forgeqe_mobile/locators.py +277 -0
- package/py/forgeqe_mobile/maestro.py +28 -1
- package/py/forgeqe_mobile/magiclink.py +79 -0
- package/py/forgeqe_mobile/record.py +284 -67
- package/py/forgeqe_mobile/service.py +9 -0
- package/py/forgeqe_mobile/webview.py +142 -0
- package/py/forgeqe_tosca/ntir.py +45 -6
- package/dist/docs-site/LICENSE.ubuntu.txt +0 -96
- package/dist/docs-site/img/icons/api.svg +0 -1
- package/dist/docs-site/img/icons/architecture.svg +0 -1
- package/dist/docs-site/img/icons/branch.svg +0 -1
- package/dist/docs-site/img/icons/browser-agent.svg +0 -1
- package/dist/docs-site/img/icons/case.svg +0 -1
- package/dist/docs-site/img/icons/container.svg +0 -1
- package/dist/docs-site/img/icons/context-engine.svg +0 -1
- package/dist/docs-site/img/icons/desktop.svg +0 -1
- package/dist/docs-site/img/icons/download.svg +0 -1
- package/dist/docs-site/img/icons/explorer.svg +0 -1
- package/dist/docs-site/img/icons/feature.svg +0 -1
- package/dist/docs-site/img/icons/healer.svg +0 -1
- package/dist/docs-site/img/icons/knowledge-base.svg +0 -1
- package/dist/docs-site/img/icons/mail.svg +0 -1
- package/dist/docs-site/img/icons/mobile.svg +0 -1
- package/dist/docs-site/img/icons/model.svg +0 -1
- package/dist/docs-site/img/icons/network.svg +0 -1
- package/dist/docs-site/img/icons/orchestrator.svg +0 -1
- package/dist/docs-site/img/icons/plug.svg +0 -1
- package/dist/docs-site/img/icons/pr-reviewer.svg +0 -1
- package/dist/docs-site/img/icons/replay.svg +0 -1
- package/dist/docs-site/img/icons/report.svg +0 -1
- package/dist/docs-site/img/icons/result.svg +0 -1
- package/dist/docs-site/img/icons/rule.svg +0 -1
- package/dist/docs-site/img/icons/scribe.svg +0 -1
- package/dist/docs-site/img/icons/shield.svg +0 -1
- package/dist/docs-site/img/icons/specs.svg +0 -1
- package/dist/docs-site/img/icons/speed.svg +0 -1
- package/dist/docs-site/img/icons/stories.svg +0 -1
- package/dist/docs-site/img/icons/terminal.svg +0 -1
- package/dist/docs-site/img/icons/test-finder.svg +0 -1
- package/dist/docs-site/img/icons/visual.svg +0 -1
- package/dist/docs-site/img/icons/web.svg +0 -1
- package/dist/docs-site/img/icons/wikis.svg +0 -1
- package/dist/web/assets/Agent-MlW7cfAm.js +0 -7
- package/dist/web/assets/ApiTests-mxUkUZvv.js +0 -10
- package/dist/web/assets/Browse-DENLuv4C.js +0 -2
- package/dist/web/assets/Chat-jxak1jci.js +0 -3
- package/dist/web/assets/Desktop-DGNdy7iS.js +0 -1
- package/dist/web/assets/DesktopReview-SdAwvi9y.js +0 -1
- package/dist/web/assets/Features-BM5iXhOR.js +0 -1
- package/dist/web/assets/Flags-CkKp4bbv.js +0 -2
- package/dist/web/assets/Flaky-BqUHVLao.js +0 -1
- package/dist/web/assets/Impact-CA6s3POt.js +0 -3
- package/dist/web/assets/Jobs-B59p1qvn.js +0 -5
- package/dist/web/assets/KindPage-DPADNnwH.js +0 -6
- package/dist/web/assets/Migration-DtynahwR.js +0 -2
- package/dist/web/assets/PageAgent-CB8HtdGd.js +0 -1
- package/dist/web/assets/Product-wWMz2Nnk.js +0 -7
- package/dist/web/assets/Production-Nst6__N7.js +0 -1
- package/dist/web/assets/Record-a4whC1jV.js +0 -1
- package/dist/web/assets/Regression-hesOlN4G.js +0 -5
- package/dist/web/assets/RelationGraph-C3Re0M1N.js +0 -1
- package/dist/web/assets/Response-CzX2rQEZ.js +0 -9
- package/dist/web/assets/Runs-DIDCOhbK.js +0 -2
- package/dist/web/assets/Steps-BOWDBzu4.js +0 -2
- package/dist/web/assets/TestDebt-BvP3w7ye.js +0 -1
- package/dist/web/assets/TestManagement-CphGo9DZ.js +0 -1
- package/dist/web/assets/Tosca-dhFuqYxV.js +0 -3
- package/dist/web/assets/agentTabs-BO5l3zw2.js +0 -1
- package/dist/web/assets/dataParts-DeUdfjjv.js +0 -3
- package/dist/web/assets/diff-D1_Qo2h1.js +0 -2
- package/dist/web/assets/families-DWilSDct.js +0 -1
- package/dist/web/assets/filters-CVzIOjPG.js +0 -1
- package/dist/web/assets/frame-VTMu7MoC.js +0 -13
- package/dist/web/assets/index-CKRa-K2y.css +0 -2
- package/dist/web/assets/index-nuLrB-Rb.js +0 -69
- package/dist/web/assets/line-icons-C_amZ5-o.js +0 -1
- package/dist/web/assets/logos-J6txZkKc.js +0 -1
- package/dist/web/assets/paletteCommands-BmYmp6YY.js +0 -1
- package/dist/web/assets/parts-CDBCk_Xz.js +0 -1
- package/dist/web/assets/qualityParts-CGKSK9Dq.js +0 -1
- package/dist/web/assets/rows-yPc39hV7.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$t as e,At as t,Br as n,E as r,Ft as i,Gn as a,Ln as o,Lr as s,M as c,N as l,Nr as u,O as d,Pr as f,R as p,W as m,a as ee,b as h,ct as g,fn as _,k as v,on as y,or as b,p as x,pr as S,rr as C,sr as w,st as T,tr as te,v as E,xt as D,yt as O,zn as ne}from"./line-icons-CwZWt93L.js";import{$t as re,B as ie,H as k,V as A,c as j,f as ae,g as M,i as oe,l as se,n as ce,o as le,p as N,st as ue,t as de,u as fe,z as pe,zt as me}from"./filters-faaSnoIq.js";import{Bt as he,F as P,Fn as ge,Kt as _e,N as ve,at as ye,bn as be,bt as xe,it as Se,o as Ce,ot as we,rt as F,t as Te,v as Ee,x as De}from"./frame-BLPdAXUq.js";import{i as Oe,n as I,r as L}from"./markdown-BI3F-SJ1.js";import{G as ke,L as Ae,R as je}from"./index-CxiCvGZq.js";import{r as Me,t as Ne}from"./Response-BP0UwQcW.js";import{n as Pe}from"./families-DYlN5v0i.js";var R=n(s(),1),z=re(),B={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Fe={execution:D,report:T,coding:m,chat:_};function Ie({kind:e}){let t=Fe[e];return(0,z.jsx)(M,{icon:t,size:14,className:`flex-none text-muted`})}var Le={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},V=e=>Le[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Re={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},ze=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function H({title:e,icon:t,children:n,aside:r,className:i}){return(0,z.jsxs)(`section`,{className:A(`flex flex-col gap-4 border-t border-line-soft pt-6`,i),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,z.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Be({path:e,label:t=`Report`}){let[n,r]=(0,R.useState)(``);return(0,z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(pe,{"data-tip":`Open the report`,onClick:async()=>r(await fe(e)),children:[(0,z.jsx)(g,{"aria-hidden":`true`}),t]}),n&&(0,z.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function U({items:e,first:t,render:n}){let[i,a]=(0,R.useState)(!1);return(0,z.jsxs)(z.Fragment,{children:[(i?e:e.slice(0,t)).map(n),e.length>t&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(!i),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[i?(0,z.jsx)(v,{size:14,"aria-hidden":`true`}):(0,z.jsx)(r,{size:14,"aria-hidden":`true`}),i?`Less`:`All (${e.length})`]})]})}function Ve({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,z.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,z.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,z.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,z.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function He({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Re[e.scope]||e.scope,ze(e.ms),e.tokens?`${P(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,z.jsx)(Be,{path:e.report})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsxs)(`span`,{className:`text-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,z.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,z.jsxs)(j,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,z.jsxs)(j,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,z.jsxs)(j,{tone:`warn`,children:[e.counts.other,` other`]}),(0,z.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,z.jsx)(Ve,{c:e.counts}),e.cases.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(U,{items:[...e.cases].sort((e,t)=>Number(V(t.status).tone===`fail`)-Number(V(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-4 border-t border-line-soft py-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,z.jsx)(j,{tone:V(e.status).tone,children:V(e.status).label})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,z.jsx)(`span`,{className:`mr-2 font-mono text-[13px] text-muted`,children:e.id}),e.title,e.device&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,z.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,z.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:ze(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,z.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,z.jsx)(I,{path:e.folder})]})]})}function Ue({list:e,className:t}){let n=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,z.jsx)(H,{...t?{className:t}:{},title:`Execution summary`,icon:(0,z.jsx)(M,{icon:D,size:18}),aside:e.length>1?(0,z.jsxs)(`span`,{className:`text-sm text-muted`,children:[k(e.length,`run`),` · `,n.passed,` of `,n.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,z.jsx)(He,{e},`${e.folder||e.title}-${t}`)):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function We({list:e,className:t}){return(0,z.jsxs)(H,{...t?{className:t}:{},title:`Report summary`,icon:(0,z.jsx)(M,{icon:T,size:18}),children:[e.length===0&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,z.jsx)(Be,{path:e.path})]}),e.stats&&(0,z.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,z.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,z.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,z.jsx)(`dd`,{className:`m-0 text-[20px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,z.jsx)(Ge,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Ge({text:e,height:t=220}){let[n,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(!0),[s,c]=(0,R.useState)(t),l=(0,R.useRef)(null);return(0,R.useLayoutEffect)(()=>{l.current&&!n&&o(l.current.scrollHeight>t+8)},[e,t,n]),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{ref:l,style:s===void 0?void 0:{maxHeight:s},onTransitionEnd:e=>e.target===e.currentTarget&&n&&c(void 0),className:A(`transition-[max-height] duration-200 ease-out`,s!==void 0&&`relative overflow-hidden`),children:[(0,z.jsx)(L,{text:e,className:A(`text-sm`,Oe)}),!n&&a&&(0,z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||a)&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=l.current?.scrollHeight??t;if(i(!n),_e())return c(n?t:void 0);c(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(t)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[n?(0,z.jsx)(v,{size:14,"aria-hidden":`true`}):(0,z.jsx)(r,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ke(e){let t=e.join(`
|
|
2
|
+
`),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function qe({e}){let[t,n]=(0,R.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,z.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-2 text-sm`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,z.jsx)(d,{size:16,"aria-hidden":`true`,className:A(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:r}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(I,{path:e.path})}),(0,z.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,z.jsx)(he,{open:t,className:`pb-4 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,z.jsx)(L,{text:Ke(e.diffs),className:Oe}):null})]})}var Je={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ye({c:e,files:t,className:n}){let r=e.edits.reduce((e,t)=>e+t.added,0),i=e.edits.reduce((e,t)=>e+t.removed,0),a=e.tests.filter(e=>!e.ok).length,o=e.reviews.at(-1),s=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,z.jsxs)(H,{...n?{className:n}:{},title:`Code changes`,icon:(0,z.jsx)(M,{icon:m,size:18}),aside:e.edits.length?(0,z.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[k(e.edits.length,`file`),` · `,(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,r]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,i]})]}):s.length?(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:k(s.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,i=t.status===`error`||t.status===`failed`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,z.jsx)(D,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:i?`text-fail`:`text-warn`}),(0,z.jsx)(`span`,{className:`text-[16px] font-semibold`,children:r?`Test written`:i?`Test not finished`:V(t.status).label}),(0,z.jsx)(j,{tone:r?`pass`:i?`fail`:`warn`,children:V(t.status).label}),e.tests.length>0&&(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[k(e.tests.length,`test run`),a?` (${a} failed)`:``,e.reviews.length?` · ${k(e.reviews.length,`review`)}`:``]})]}),(0,z.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-4`,children:[t.testFile&&(0,z.jsx)(W,{label:`Test`,children:(0,z.jsx)(I,{path:t.testFile})}),t.command&&(0,z.jsx)(W,{label:`Run it`,children:(0,z.jsx)(Me,{text:t.command})}),(t.review||o)&&(0,z.jsx)(W,{label:`Review`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(j,{tone:(t.review??o).approved?`pass`:`warn`,children:(t.review??o).approved?`Approved`:`Changes asked`})}),(t.review?.summary||o?.summary)&&(0,z.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||o?.summary})]})}),t.notes&&(0,z.jsx)(W,{label:`Notes`,children:(0,z.jsx)(L,{text:t.notes,className:A(`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`,`[&_p]:max-w-none [&_ul]:max-w-none [&_ol]:max-w-none [&_blockquote]:max-w-none [&_h1]:max-w-none [&_h2]:max-w-none [&_h3]:max-w-none [&_h4]:max-w-none [&_h5]:max-w-none [&_h6]:max-w-none`)})})]}),t.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(U,{items:e.edits,first:8,render:e=>(0,z.jsx)(qe,{e},e.path)})})]}),s.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:s.map(e=>(0,z.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-4 border-t border-line-soft text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:Je[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(I,{path:e.path})})]},e.path))}),(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!s.length&&!e.results.length&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Xe({final:e,answer:t,className:n}){let r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,z.jsxs)(H,{...n?{className:n}:{},title:`Final message`,icon:(0,z.jsx)(O,{size:18,"aria-hidden":`true`}),aside:(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,z.jsx)(Ge,{text:i?`${o}text\n${e.text}\n${o}`:De(e.text),height:420}),r.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,z.jsx)(I,{path:e},e))]})]})}var Ze={rule:{icon:x,label:`Rulebook`},decision:{icon:t,label:`Test decisions`},memory:{icon:E,label:`Page memory`},replay:{icon:o,label:`Replays`},model:{icon:te,label:`Model`},skill:{icon:i,label:`Skills`}};function Qe({list:t,className:n}){let r=Object.keys(Ze).filter(e=>t.some(t=>t.kind===e));return(0,z.jsx)(H,{...n?{className:n}:{},title:`Learnings`,icon:(0,z.jsx)(M,{icon:e,size:18}),aside:t.length?(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[t.length,` from this session`]}):void 0,children:t.length===0?(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-4`,children:r.map(e=>{let{icon:n,label:r}=Ze[e];return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,z.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-[13px] font-medium text-muted`,children:[(0,z.jsx)(M,{icon:n,size:14}),r]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.filter(t=>t.kind===e).map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,z.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},e)})})})}function $e({run:e,className:t}){let n=[],r=t?{className:t}:{};return(e.executions.length||e.kind===`execution`)&&n.push({kind:`execution`,node:(0,z.jsx)(Ue,{list:e.executions,...r},`e`)}),(e.reports.length||e.kind===`report`)&&n.push({kind:`report`,node:(0,z.jsx)(We,{list:e.reports,...r},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&n.push({kind:`coding`,node:(0,z.jsx)(Ye,{c:e.coding,files:e.files,...r},`c`)}),n.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,z.jsx)(z.Fragment,{children:n.map(e=>e.node)})}var G={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},et={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},tt=e=>et[e]||e.charAt(0).toUpperCase()+e.slice(1),K=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function nt(e){let[t,n]=(0,R.useState)(Date.now());return(0,R.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function rt({r:e}){return e.origin.kind===`web`?(0,z.jsxs)(`a`,{href:N(`chats`,e.origin.chat),className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(M,{icon:_,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,z.jsxs)(`a`,{href:N(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(M,{icon:h,size:14}),`Job`]}):(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted`,children:[(0,z.jsx)(M,{icon:S,size:14}),`Terminal`]})}var it=e=>G[e].label;function at({status:e}){let t=G[e].label;return e===`running`?(0,z.jsx)(y,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,z.jsx)(c,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,z.jsx)(p,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,z.jsx)(l,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function ot(e){return/^forgeqe(-|$)|^engine$/.test(e)?ge(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t,stacked:n=!1}){return n?(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]}):(0,z.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`h3`,{className:`m-0 mb-1 text-[13px] font-semibold`,children:e}),t]})}var st=8,ct=e=>e===`write`?`Written`:e===`edit`?`Edited`:e===`delete`?`Deleted`:e?e.charAt(0).toUpperCase()+e.slice(1):`Changed`;function lt({run:e,now:t,running:n,events:r}){let i=G[e.status],a=e.executions.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0}),o=e.coding?.results.at(-1),s=e.coding?.tests.length??0,c=e.coding?.tests.filter(e=>!e.ok).length??0,l=e.coding?.edits??[],u=l.reduce((e,t)=>e+t.added,0),d=l.reduce((e,t)=>e+t.removed,0),f=l.length||e.files.filter(e=>e.action&&e.action!==`read`).length;return(0,z.jsxs)(Se,{label:`How this run went`,children:[(0,z.jsx)(F,{compact:!0,label:`Outcome`,value:i.label,tone:i.tone===`fail`?`text-fail`:i.tone===`pass`?`text-pass`:void 0,...o?.attempts?{note:`attempt ${o.attempts}${o.maxAttempts?` of ${o.maxAttempts}`:``}`}:{}}),(0,z.jsx)(F,{label:n?`Running for`:`Took`,value:J(q(e,t)),...r?{note:k(r,`event`)}:{}}),a.total>0&&(0,z.jsx)(F,{label:`Cases`,value:`${a.passed}/${a.total}`,...a.failed?{tone:`text-fail`}:a.passed===a.total?{tone:`text-pass`}:{},note:`passed`}),s>0&&(0,z.jsx)(F,{label:`Test runs`,value:s,...c?{note:`${c} failed`}:{}}),f>0&&(0,z.jsx)(F,{label:`Files changed`,value:f,...u+d?{note:`+${u} −${d}`}:{}}),Y(e)>0&&(0,z.jsx)(F,{label:`Tokens`,value:P(Y(e)),note:`${P(e.usage.input)} in · ${P(e.usage.output)} out`})]})}var ut={rerun:ne,write_test:b,investigate:a,fix_test:u},dt={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function ft({actions:e}){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await ue.start(e.prompt,{});location.hash=N(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,z.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,z.jsxs)(pe,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,z.jsx)(M,{icon:ut[e.kind],size:16,className:`flex-none`}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:dt[e.kind]}),e.note&&(0,z.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var pt=e=>`\`${e.replace(/`/g,``)}\``,mt=[`summary`,`conversation`,`activity`,`details`],ht=e=>mt.find(t=>t===e)??`summary`;function gt({name:e,tab:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),c=ht(t),l=t=>location.hash=t===`summary`?N(`runs`,encodeURIComponent(e)):N(`runs`,encodeURIComponent(e),t),u=(0,R.useCallback)(()=>{me.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,R.useEffect)(u,[u]);let d=n?.status===`running`;(0,R.useEffect)(()=>{if(!d)return;let e=setInterval(u,2e3);return()=>clearInterval(e)},[u,d]);let p=nt(d),m=(0,R.useMemo)(()=>(n?.events??[]).map(Ee).filter(e=>!!e),[n?.events]),h=async()=>{s(!0),a(``);try{await me.cancel(e),u()}catch(e){a(e.message)}finally{s(!1)}},g=(0,z.jsxs)(`a`,{href:N(`runs`),className:`inline-flex items-center gap-2 text-sm`,children:[(0,z.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g,i?(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let _=G[n.status],v=!n.replies.length,y=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0||n.files.length>0,b=[{id:`summary`,label:`Summary`},{id:`conversation`,label:v?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:m.length||void 0},{id:`details`,label:`Details`}],x=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),S=n.outputs.filter(e=>!x.has(e.path)),w=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null,T=S.length>0||n.files.length>0?`@3xl:col-span-3`:`@3xl:col-span-4`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-4`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,z.jsx)(`h2`,{className:`m-0 min-w-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,z.jsx)(j,{tone:_.tone,children:_.label})]}),(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(Ie,{kind:n.kind}),B[n.kind]]}),`· `,(0,z.jsx)(rt,{r:n}),`· `,K(n.startedAt),` · `,d?`running for `:`took `,J(q(n,p)),` · `,P(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,z.jsxs)(pe,{variant:`danger`,disabled:o,"data-tip":n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void h(),children:[n.cancel===`chat`?(0,z.jsx)(C,{fill:`currentColor`,"aria-hidden":`true`}):(0,z.jsx)(f,{"aria-hidden":`true`}),o?`Stopping…`:n.cancel===`chat`?`Stop`:`Cancel`]})]}),i&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,z.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!d&&(0,z.jsx)(ft,{actions:n.actions??[]}),(0,z.jsx)(we,{prefix:`run`,label:`This run`,className:`mb-0`,current:c,onPick:l,tabs:b}),(0,z.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${c}`,"aria-labelledby":`run-${c}`,className:`flex min-w-0 flex-col gap-6`,children:[c===`summary`&&(0,z.jsxs)(z.Fragment,{children:[y&&(0,z.jsx)(lt,{run:n,now:p,running:d,events:m.length}),(0,z.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:[n.final&&(0,z.jsx)(Xe,{final:n.final,answer:n.answer,className:T}),(0,z.jsx)($e,{run:n,className:T}),S.length>0&&(0,z.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,z.jsx)(Q,{title:`What it produced (${S.length})`,children:S.map(e=>(0,z.jsx)(Z,{label:e.label,stacked:!0,children:(0,z.jsx)(I,{path:e.path,children:e.path.split(`/`).pop()})},e.path))})}),n.files.length>0&&(0,z.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,z.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:(0,z.jsx)(U,{items:[...n.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)),first:st,render:e=>(0,z.jsx)(Z,{label:ct(e.action),stacked:!0,children:e.action===`delete`?(0,z.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path.split(`/`).pop()}):(0,z.jsx)(I,{path:e.path,children:e.path.split(`/`).pop()})},e.path)})})}),n.learnings.length>0&&(0,z.jsx)(Qe,{list:n.learnings,className:`@3xl:col-span-4`})]}),!y&&(0,z.jsx)(se,{className:`py-4`,children:d?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),c===`conversation`&&(v?(0,z.jsx)(L,{text:pt(n.prompt),className:`text-sm [&_p]:my-0`}):(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2 text-sm max-w-[85%]`,children:(0,z.jsx)(L,{text:e.ask,className:`[&_p]:my-1`})}),e.text&&(0,z.jsx)(L,{text:De(e.text),className:`text-sm`}),e.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),c===`activity`&&(n.archived?(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,z.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):m.length?(0,z.jsx)(Ne,{timeline:!0,lines:m,start:n.startedAt,live:d,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),c===`details`&&(0,z.jsxs)(_t,{children:[(0,z.jsxs)(Q,{title:`Numbers`,children:[(0,z.jsx)(Z,{label:d?`Running for`:`Took`,children:J(q(n,p))}),(0,z.jsx)(Z,{label:`Tokens`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{children:[P(Y(n)),` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`· `,ve(n.usage)]})]}),(n.byAgent?.length??0)>1&&(0,z.jsx)(`span`,{className:`flex flex-col gap-1 text-[13px]`,children:n.byAgent.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:ot(e.agent)}),(0,z.jsx)(`span`,{className:`text-muted tabular-nums`,children:P(e.input+e.output)})]},e.agent))})]})}),(0,z.jsxs)(Z,{label:`Context`,children:[n.context?P(n.context.tokens):`–`,w!==null&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` of `,P(n.context.limit),` (`,w,`%)`]})]}),(0,z.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`in `,k(n.turns,`turn`)]})]})]}),(0,z.jsxs)(Q,{title:`Session`,children:[(0,z.jsx)(Z,{label:`Started by`,children:(0,z.jsx)(rt,{r:n})}),(0,z.jsx)(Z,{label:`Command`,children:tt(n.command)}),(0,z.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,z.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,z.jsx)(`span`,{className:`flex flex-col gap-1`,children:n.agents.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:ot(e.name)}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:k(e.calls,`call`)})]},e.name))}):(0,z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,z.jsxs)(Z,{label:`Log`,children:[n.archived?(0,z.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,z.jsx)(I,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,z.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,z.jsxs)(Q,{title:`Job`,children:[(0,z.jsx)(Z,{label:`Job`,children:(0,z.jsx)(`a`,{href:N(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,z.jsx)(Z,{label:`Runs`,children:(0,z.jsx)(L,{text:pt(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,z.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${K(n.job.nextAt)}`:``]}),n.job.run&&(0,z.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,z.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,z.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,z.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,z.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}function _t({children:e}){let t=R.Children.toArray(e).filter(Boolean),n=t.length%2==1;return(0,z.jsx)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:t.map((e,r)=>(0,z.jsx)(`section`,{className:A(`flex min-w-0 flex-col border-t border-line-soft pt-6`,n&&r===t.length-1?`@3xl:col-span-4`:`@3xl:col-span-2`),children:e},r))})}var $=25;function vt({runs:e}){let t=nt(e.some(e=>e.status===`running`)),[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(`all`),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(0);(0,R.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,ee=n.toLowerCase().split(/\s+/).filter(Boolean),h=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&ee.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),g={all:h.length,running:h.filter(e=>e.status===`running`).length,failed:h.filter(e=>e.status===`failed`).length},v=i===`all`?h:h.filter(e=>e.status===i),y=Math.max(1,Math.ceil(v.length/$)),b=Math.min(f,y-1),x=v.slice(b*$,b*$+$),S=e.filter(e=>e.status!==`running`&&!X(e)),C=S.filter(e=>e.status===`failed`).length,T=S.length?S.reduce((e,n)=>e+q(n,t),0)/S.length:NaN,te=e.reduce((e,t)=>e+Y(t),0),E=[...new Set(e.map(e=>e.kind))],D=[...new Set(e.map(e=>e.origin.kind))],O={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,z.jsx)(se,{icon:w,title:`No runs yet`,action:(0,z.jsxs)(`a`,{className:ie({size:`sm`}),href:N(),"data-tip":`Start a chat`,children:[(0,z.jsx)(_,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:A(`tabular-nums`,C?`text-fail`:`text-ink`),children:C}),` failed`,S.length?` (${Math.round(C/S.length*100)}%)`:``]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:P(te)}),` tokens`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(T))}),` on average`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(oe,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,z.jsx)(de,{items:[{id:`all`,label:`All`,n:g.all},{id:`running`,label:`Running`,n:g.running},{id:`failed`,label:`Failed`,n:g.failed,alert:!0}],value:i,onChange:a}),E.length>1&&(0,z.jsxs)(le,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,z.jsx)(`option`,{value:``,children:`Any kind`}),E.map(e=>(0,z.jsx)(`option`,{value:e,children:B[e]},e))]}),D.length>1&&(0,z.jsxs)(le,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,z.jsx)(`option`,{value:``,children:`Started anywhere`}),D.map(e=>(0,z.jsx)(`option`,{value:e,children:O[e]||e},e))]})]}),(0,z.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,z.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,z.jsx)(`span`,{className:`w-4`}),(0,z.jsx)(`span`,{children:`Run`}),(0,z.jsx)(`span`,{children:`Kind`}),(0,z.jsx)(`span`,{children:`Started by`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,z.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,z.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-2`,children:[x.length===0&&(0,z.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),x.map((e,n)=>{let r=je(e.startedAt);return(0,z.jsxs)(`li`,{className:`contents`,children:[(n===0||je(x[n-1].startedAt)!==r)&&(0,z.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,z.jsxs)(`a`,{href:N(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,z.jsx)(at,{status:e.status}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,z.jsx)(`span`,{className:`truncate text-[13px] text-fail`,children:e.error}):(0,z.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[B[e.kind],O[e.origin.kind],J(q(e,t)),`${P(Y(e))} tokens`].join(` · `)})]}),(0,z.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-2 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,z.jsx)(Ie,{kind:e.kind}),B[e.kind]]}),(0,z.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:O[e.origin.kind]||e.origin.kind}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,t))}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:P(Y(e))}),(0,z.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":K(e.startedAt),children:Ae(e.startedAt)})]})]},e.name)})]}),(0,z.jsx)(ce,{page:b,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${k(m,`empty session`)}`:`${k(m,`empty session`)} hidden`})]})})]})]})}function yt({sub:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),a=(0,R.useCallback)(()=>{me.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,R.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,R.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ae(s):``;return(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,z.jsx)(Ce,{}),(0,z.jsx)(`main`,{className:A(Te,`@container flex-auto gap-4`),children:l?(0,z.jsx)(gt,{name:l,tab:c},l):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ke,{}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,z.jsx)(xe,{pixel:be.runs,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,z.jsx)(ye,{label:`Runs and reports`,links:Pe,current:`runs`})]}),(0,z.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,z.jsx)(vt,{runs:t})]})})]})}export{yt as Runs,at as StatusIcon,X as empty,ht as runTab,it as statusLabel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Br as e,Lr as t,at as n}from"./line-icons-CwZWt93L.js";import{$t as r,B as i,Jt as a,V as o,c as s,i as c,l,n as u,p as d}from"./filters-faaSnoIq.js";import{o as f,t as p}from"./markdown-BI3F-SJ1.js";import{C as m,b as h,f as g,g as _,l as v,x as y}from"./logos-dGuc1jIM.js";var b=e(t(),1),x=r(),S=(e,t)=>t?d(`tosca`,e,`compare`,encodeURIComponent(t)):d(`tosca`,e,`compare`),C=50,w={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function T({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,x.jsx)(`ul`,{className:o(`m-0 flex list-none flex-col p-0`,i>0&&`ml-4 border-l border-line-soft pl-4`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,x.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,x.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[w[e.role||`folder`]||`Folder`,`: `,(0,x.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,x.jsx)(T,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,x.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,x.jsxs)(`span`,{className:`text-[13px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,x.jsx)(`code`,{className:`font-mono text-[13px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,x.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,x.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,x.jsx)(`span`,{className:`ml-4 text-[13px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,x.jsx)(T,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let s=e.id?t.get(e.id):void 0,c=s?v[s]:void 0;return(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:o(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,x.jsx)(`span`,{role:`img`,"aria-label":c?.label||`Not converted yet`,"data-tip":c?.label||`Not converted yet`,className:o(`mt-2 size-2 flex-none rounded-full`,c?.dot||`bg-line`)}),(0,x.jsx)(`span`,{className:`w-9 flex-none font-mono text-[13px] text-muted`,children:e.id}),(0,x.jsxs)(`span`,{className:o(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[m(e),e.tosca?.step&&(0,x.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function E(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&E(n[e],t);if(r)return r}}}function D({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,a=i.split(`
|
|
2
|
+
`),s=(0,b.useMemo)(()=>i?f(i,r?.lang||`plaintext`):null,[i,r?.lang]),c=(0,b.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),l=(0,b.useRef)(null);(0,b.useEffect)(()=>{l.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,c.size]);let u=Math.min(...c);return(0,x.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,x.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-4`,children:[(0,x.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?y({kind:`test`,engine:n}):`Converted test`}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[13px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,x.jsx)(p,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,x.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[13px] leading-[1.6]`,children:[(0,x.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-4 text-right text-muted select-none`,children:a.map((e,t)=>(0,x.jsx)(`span`,{ref:t===u?l:void 0,className:o(`block px-4`,c.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,x.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-4 py-4`,children:(0,x.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,x.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,x.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:c.size?`${t} is done on line ${[...c].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function O({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,x.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-4 text-[13px]`,children:[(0,x.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,x.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,x.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,x.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`w-14 flex-none text-[13px] text-muted`,children:e.strategy}),(0,x.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,x.jsx)(s,{tone:`warn`,children:`Fragile`})]},t))}):(0,x.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function k({id:e,plan:t,result:r,initial:s,full:d,onPick:f}){let p=t.cases.filter(e=>e.included),[m,v]=(0,b.useState)(``),[y,w]=(0,b.useState)(s||p[0]?.id||``),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(``);(0,b.useEffect)(()=>{y&&(P(``),a.case(e,y).then(A,e=>P(e.message)))},[e,y,r?.units.length,r?.status]),(0,b.useEffect)(()=>{M(``),y&&f?.(y)},[y]);let F=new Map((k?.fidelity||[]).map(e=>[e.id,e.status])),I=p.filter(e=>!m||e.name.toLowerCase().includes(m.toLowerCase())),[L,R]=(0,b.useState)(0);(0,b.useEffect)(()=>R(0),[m]),(0,b.useEffect)(()=>{let e=I.findIndex(e=>e.id===y);e>=0&&Math.floor(e/C)!==L&&R(Math.floor(e/C))},[y]);let z=I.slice(L*C,L*C+C),B=e=>r?.units.find(t=>t.kind===`test`&&t.case===e);if(!p.length)return(0,x.jsx)(l,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let V=(0,x.jsxs)(`div`,{className:o(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,d?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,x.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-4 @5xl:max-h-none`,children:[(0,x.jsxs)(`div`,{className:`flex flex-col gap-1 px-1`,children:[(0,x.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,x.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[p.filter(e=>B(e.id)?.status===`converted`).length,` converted · `,p.some(e=>B(e.id)?.status===`written`)?`${p.filter(e=>B(e.id)?.status===`written`).length} written · `:``,p.filter(e=>[`failed`,`blocked`].includes(B(e.id)?.status||``)).length,` failed · `,h(p.length,`test case`)]})]}),(0,x.jsx)(c,{id:`find-a-case`,label:`Find a test case`,value:m,onChange:v,className:`max-w-none flex-none`}),(0,x.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-1 overflow-y-auto p-0`,children:[z.map(e=>{let t=B(e.id);return(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,"aria-pressed":y===e.id,onClick:()=>w(e.id),className:o(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-2 text-left text-[13px]`,y===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,x.jsx)(`span`,{role:`img`,"aria-label":t?_[t.status].label:`Waiting`,className:o(`mt-2 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,x.jsxs)(`span`,{className:`block text-[13px] text-muted`,children:[h(e.steps,`step`),` · `,h(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!z.length&&(0,x.jsx)(`li`,{className:`px-2 py-4 text-[13px] text-muted`,children:`No test case matches.`})]}),I.length>C&&(0,x.jsx)(u,{page:L,size:C,total:I.length,onPage:R,label:`Test case pages`})]}),(0,x.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-4 overflow-hidden`,children:[N&&(0,x.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:N}),(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,x.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,x.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:k?.name}),k&&t.cases.find(e=>e.id===y)&&(0,x.jsx)(`span`,{className:`text-[13px] text-muted`,children:g[t.cases.find(e=>e.id===y).route]||``})]}),(0,x.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:k?(0,x.jsx)(T,{nodes:k.body,status:F,pick:j,onPick:e=>M(e.id||``)}):N?(0,x.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,x.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},k?.case||``),k&&(k.env.length>0||k.warnings.length>0)&&(0,x.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-4 py-2 text-[13px] text-ink-2`,children:[k.env.length>0&&(0,x.jsxs)(`span`,{children:[`Environment variables: `,k.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),k.warnings.slice(0,3).map(e=>(0,x.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),k&&(0,x.jsx)(O,{view:k,node:E(k.body,j)})]}),k?(0,x.jsx)(D,{view:k,pick:j,engine:t.units.find(e=>e.kind===`test`&&e.case===k.case)?.engine},k.case):(0,x.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:N?`Nothing to show.`:`Loading…`})]});return d?V:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`flex justify-end`,children:(0,x.jsxs)(`a`,{href:S(e,y),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:i({variant:`ghost`,size:`sm`}),children:[(0,x.jsx)(n,{"aria-hidden":`true`}),`Open in a new tab`]})}),V]})}export{S as n,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ir as e,Lt as t,Nr as n,at as r,nn as i,o as a,ot as o,tn as s,w as c,yr as l,z as u,zr as d}from"./line-icons-C_amZ5-o.js";import{$t as f,Kt as p,V as m,a as h,et as g,f as _,g as v,l as y,p as b,t as x,z as S}from"./filters-CVzIOjPG.js";import{$ as C,X as w,Z as T,bn as E,bt as D,o as O,t as k,tt as A}from"./frame-VTMu7MoC.js";import{s as j}from"./markdown-CWisJbSJ.js";import{_ as M,r as N,s as P}from"./index-nuLrB-Rb.js";var F=d(e(),1),I=f(),L=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],R=e=>L.some(t=>t.id===e),z=e=>e&&j(e)===`web`?e:void 0,B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>`${e.kind}:${e.id}`;function H(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${B((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function U(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function W(){let[e,t]=(0,F.useState)(L.map(e=>e.id)),[n,r]=(0,F.useState)(``);return(0,F.useEffect)(()=>{g.settings().then(e=>{let n=e.config.sources??{},r=L.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:L.filter(t=>e.includes(t.id)),error:n}}function G({id:e,icon:t,title:n,children:r}){return(0,I.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-4`,children:[(0,I.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,I.jsx)(v,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function K({view:e,onApplied:a,onError:d}){let[f,h]=(0,F.useState)([]),[g,_]=(0,F.useState)(null),[v,y]=(0,F.useState)(!1),[b,x]=(0,F.useState)(null),E=e.story.id,D=e.proposals.filter(e=>f.includes(V(e))),O=async()=>{let t=D.map(e=>U(e,E));y(!0);try{let n=await p.preview(e.system,E,t);_({lines:n.lines,changes:t}),d(``)}catch(e){d(e.message)}finally{y(!1)}},k=async()=>{if(g){y(!0);try{let t=await p.apply(e.system,E,g.changes);x({applied:t.applied,failed:t.failed}),_(null),h([]),d(``),a()}catch(e){d(e.message)}finally{y(!1)}}},j=z(e.story.url);return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,I.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[E,(0,I.jsx)(r,{size:14,"aria-hidden":`true`})]}):(0,I.jsx)(`span`,{children:E}),e.story.title&&(0,I.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,I.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,N(e.changed.when),`.`]})]}),(0,I.jsx)(G,{id:`cases-h`,icon:s,title:`Linked cases`,children:(0,I.jsx)(w,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Case`}),(0,I.jsx)(`th`,{className:C,children:`Title`}),(0,I.jsx)(`th`,{className:m(C,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{className:C,children:`State`})]}),children:e.cases.map(e=>{let t=z(e.url);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`whitespace-nowrap`),children:t?(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(r,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:m(T,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:m(T,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(l,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,I.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,N(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(G,{id:`criteria-h`,icon:u,title:`Acceptance criteria`,children:(0,I.jsx)(w,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Criterion`}),(0,I.jsx)(`th`,{className:C,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:m(T,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(G,{id:`proposals-h`,icon:i,title:`Proposed changes`,children:[(0,I.jsx)(w,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v||!D.length||!!g,"data-tip":`Review ${B(D.length,`change`)}`,onClick:()=>void O(),children:[(0,I.jsx)(o,{"aria-hidden":`true`}),`Review (`,D.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:m(C,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{className:C,children:`Change`}),(0,I.jsx)(`th`,{className:C,children:`Existing case`}),(0,I.jsx)(`th`,{className:C,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:T,children:(0,I.jsx)(P,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:f.includes(t),disabled:v||!!g,onCheckedChange:e=>h(e?[...f,t]:f.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:m(T,`whitespace-nowrap font-medium`),children:[H(e),e.link&&e.kind!==`link`&&(0,I.jsx)(`span`,{className:`block text-[13px] font-normal text-muted`,children:`and link it`})]}),(0,I.jsxs)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:[(0,I.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,I.jsx)(`td`,{className:m(T,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),g&&(0,I.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-4 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,B(g.changes.length,`change`),` to `,L.find(t=>t.id===e.system)?.label,`?`]}),(0,I.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:g.lines.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v,onClick:()=>void k(),children:[(0,I.jsx)(c,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(S,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(n,{"aria-hidden":`true`}),`Cancel`]})]})]}),b&&b.applied.length>0&&(0,I.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,b.applied.join(`, `)]}),b&&b.failed.length>0&&(0,I.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,b.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,I.jsx)(G,{id:`changes-h`,icon:t,title:`Recent changes`,children:e.changes.length?(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:e.changes.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function q({sub:e}){let{systems:t,error:n}=W(),r=e?e.indexOf(`/`):-1,i=r>0?e.slice(0,r):e,o=R(i)?i:void 0,c=o&&r>0?_(e.slice(r+1)):``,[l,u]=(0,F.useState)(o??`azure_devops`),[d,f]=(0,F.useState)(c),[g,v]=(0,F.useState)(null),[C,w]=(0,F.useState)(``),[T,A]=(0,F.useState)(!1);(0,F.useEffect)(()=>{o&&u(o),f(c)},[o,c]),(0,F.useEffect)(()=>{!o&&t.length&&!t.some(e=>e.id===l)&&u(t[0].id)},[t,l,o]);let j=(0,F.useCallback)(()=>{!o||!c?v(null):(A(!0),p.view(o,c).then(e=>{v(e),w(``),A(!1)},e=>{w(e.message),A(!1)}))},[o,c]);return(0,F.useEffect)(()=>v(null),[o,c]),(0,F.useEffect)(j,[j]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(O,{}),(0,I.jsxs)(`main`,{className:m(k,`@container flex-auto gap-4`),children:[(0,I.jsx)(M,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(D,{pixel:E[`test-cases`],size:`lg`}),(0,I.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,I.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,I.jsx)(`a`,{href:b(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:b(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=b(`test-cases`,l,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-4`,children:[(0,I.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,I.jsx)(x,{items:t,value:l,onChange:u})}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,I.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,I.jsx)(h,{value:d,maxLength:120,spellCheck:!1,placeholder:l===`azure_devops`?`1234`:l===`qtest`?`5678`:l===`testrail`?`R12`:`SHOP-12`,onChange:e=>f(e.target.value)})]}),(0,I.jsxs)(S,{type:`submit`,variant:`primary`,disabled:!d.trim()||T,"data-tip":`Open the story's test cases`,children:[(0,I.jsx)(a,{"aria-hidden":`true`}),`Open`]})]})]}),[n,C].filter(Boolean).map(e=>(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),T&&(0,I.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),g&&(0,I.jsx)(K,{view:g,onApplied:j,onError:w},`${g.system}:${g.story.id}`),!c&&!g&&(0,I.jsx)(y,{icon:s,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{q as TestCases};
|
|
1
|
+
import{Br as e,Lr as t,Pr as n,Rt as r,at as i,br as a,nn as o,o as s,ot as c,rn as l,w as u,z as d}from"./line-icons-CwZWt93L.js";import{$t as f,Kt as p,V as m,a as h,et as g,f as _,g as v,l as y,p as b,t as x,z as S}from"./filters-faaSnoIq.js";import{$ as C,X as w,Z as T,bn as E,bt as D,o as O,t as k,tt as A}from"./frame-BLPdAXUq.js";import{s as j}from"./markdown-BI3F-SJ1.js";import{G as M,L as N,j as P}from"./index-CxiCvGZq.js";var F=e(t(),1),I=f(),L=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],R=e=>L.some(t=>t.id===e),z=e=>e&&j(e)===`web`?e:void 0,B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>`${e.kind}:${e.id}`;function H(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${B((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function U(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function W(){let[e,t]=(0,F.useState)(L.map(e=>e.id)),[n,r]=(0,F.useState)(``);return(0,F.useEffect)(()=>{g.settings().then(e=>{let n=e.config.sources??{},r=L.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:L.filter(t=>e.includes(t.id)),error:n}}function G({id:e,icon:t,title:n,children:r}){return(0,I.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-4`,children:[(0,I.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,I.jsx)(v,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function K({view:e,onApplied:t,onError:s}){let[f,h]=(0,F.useState)([]),[g,_]=(0,F.useState)(null),[v,y]=(0,F.useState)(!1),[b,x]=(0,F.useState)(null),E=e.story.id,D=e.proposals.filter(e=>f.includes(V(e))),O=async()=>{let t=D.map(e=>U(e,E));y(!0);try{let n=await p.preview(e.system,E,t);_({lines:n.lines,changes:t}),s(``)}catch(e){s(e.message)}finally{y(!1)}},k=async()=>{if(g){y(!0);try{let n=await p.apply(e.system,E,g.changes);x({applied:n.applied,failed:n.failed}),_(null),h([]),s(``),t()}catch(e){s(e.message)}finally{y(!1)}}},j=z(e.story.url);return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,I.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[E,(0,I.jsx)(i,{size:14,"aria-hidden":`true`})]}):(0,I.jsx)(`span`,{children:E}),e.story.title&&(0,I.jsx)(`span`,{className:`font-normal text-ink-2`,children:e.story.title})]}),e.changed&&(0,I.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(e.changed.when).toLocaleString(),children:[`The story's `,e.changed.field,` changed `,N(e.changed.when),`.`]})]}),(0,I.jsx)(G,{id:`cases-h`,icon:o,title:`Linked cases`,children:(0,I.jsx)(w,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Case`}),(0,I.jsx)(`th`,{className:C,children:`Title`}),(0,I.jsx)(`th`,{className:m(C,`text-right`),children:`Steps`}),(0,I.jsx)(`th`,{className:C,children:`State`})]}),children:e.cases.map(e=>{let t=z(e.url);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`whitespace-nowrap`),children:t?(0,I.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,I.jsx)(i,{size:12,"aria-hidden":`true`})]}):e.id}),(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.title}),(0,I.jsx)(`td`,{className:m(T,`text-right tabular-nums`),children:e.steps}),(0,I.jsx)(`td`,{className:m(T,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(a,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,I.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,N(e.changed)]}):`–`})]},e.id)})})}),(0,I.jsx)(G,{id:`criteria-h`,icon:d,title:`Acceptance criteria`,children:(0,I.jsx)(w,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:C,children:`Criterion`}),(0,I.jsx)(`th`,{className:C,children:`Cases`})]}),children:e.criteria.map((e,t)=>(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:e.text}),(0,I.jsx)(`td`,{className:m(T,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,I.jsxs)(G,{id:`proposals-h`,icon:l,title:`Proposed changes`,children:[(0,I.jsx)(w,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v||!D.length||!!g,"data-tip":`Review ${B(D.length,`change`)}`,onClick:()=>void O(),children:[(0,I.jsx)(c,{"aria-hidden":`true`}),`Review (`,D.length,`)`]}),head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`th`,{className:m(C,`w-10`),children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,I.jsx)(`th`,{className:C,children:`Change`}),(0,I.jsx)(`th`,{className:C,children:`Existing case`}),(0,I.jsx)(`th`,{className:C,children:`The agent wrote`})]}),children:e.proposals.map(e=>{let t=V(e);return(0,I.jsxs)(`tr`,{className:A,children:[(0,I.jsx)(`td`,{className:T,children:(0,I.jsx)(P,{"aria-label":`${H(e)}: ${e.id} ${e.title}`,checked:f.includes(t),disabled:v||!!g,onCheckedChange:e=>h(e?[...f,t]:f.filter(e=>e!==t))})}),(0,I.jsxs)(`td`,{className:m(T,`whitespace-nowrap font-medium`),children:[H(e),e.link&&e.kind!==`link`&&(0,I.jsx)(`span`,{className:`block text-[13px] font-normal text-muted`,children:`and link it`})]}),(0,I.jsxs)(`td`,{className:m(T,`[overflow-wrap:anywhere]`),children:[(0,I.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,I.jsx)(`td`,{className:m(T,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),g&&(0,I.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-4 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,B(g.changes.length,`change`),` to `,L.find(t=>t.id===e.system)?.label,`?`]}),(0,I.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-6 text-ink-2`,children:g.lines.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(S,{size:`sm`,variant:`primary`,disabled:v,onClick:()=>void k(),children:[(0,I.jsx)(u,{"aria-hidden":`true`}),`Apply`]}),(0,I.jsxs)(S,{size:`sm`,disabled:v,onClick:()=>_(null),children:[(0,I.jsx)(n,{"aria-hidden":`true`}),`Cancel`]})]})]}),b&&b.applied.length>0&&(0,I.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,b.applied.join(`, `)]}),b&&b.failed.length>0&&(0,I.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,b.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,I.jsx)(G,{id:`changes-h`,icon:r,title:`Recent changes`,children:e.changes.length?(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:e.changes.map((e,t)=>(0,I.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),e.notes.map((e,t)=>(0,I.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function q({sub:e}){let{systems:t,error:n}=W(),r=e?e.indexOf(`/`):-1,i=r>0?e.slice(0,r):e,a=R(i)?i:void 0,c=a&&r>0?_(e.slice(r+1)):``,[l,u]=(0,F.useState)(a??`azure_devops`),[d,f]=(0,F.useState)(c),[g,v]=(0,F.useState)(null),[C,w]=(0,F.useState)(``),[T,A]=(0,F.useState)(!1);(0,F.useEffect)(()=>{a&&u(a),f(c)},[a,c]),(0,F.useEffect)(()=>{!a&&t.length&&!t.some(e=>e.id===l)&&u(t[0].id)},[t,l,a]);let j=(0,F.useCallback)(()=>{!a||!c?v(null):(A(!0),p.view(a,c).then(e=>{v(e),w(``),A(!1)},e=>{w(e.message),A(!1)}))},[a,c]);return(0,F.useEffect)(()=>v(null),[a,c]),(0,F.useEffect)(j,[j]),(0,I.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,I.jsx)(O,{}),(0,I.jsxs)(`main`,{className:m(k,`@container flex-auto gap-4`),children:[(0,I.jsx)(M,{}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,I.jsx)(D,{pixel:E[`test-cases`],size:`lg`}),(0,I.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,I.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,I.jsx)(`a`,{href:b(`regression`),children:`Regression`}),`; their results on `,(0,I.jsx)(`a`,{href:b(`runs`),children:`Runs`}),`.`]}),(0,I.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=b(`test-cases`,l,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-4`,children:[(0,I.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-2`,children:(0,I.jsx)(x,{items:t,value:l,onChange:u})}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,I.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,I.jsx)(h,{value:d,maxLength:120,spellCheck:!1,placeholder:l===`azure_devops`?`1234`:l===`qtest`?`5678`:l===`testrail`?`R12`:`SHOP-12`,onChange:e=>f(e.target.value)})]}),(0,I.jsxs)(S,{type:`submit`,variant:`primary`,disabled:!d.trim()||T,"data-tip":`Open the story's test cases`,children:[(0,I.jsx)(s,{"aria-hidden":`true`}),`Open`]})]})]}),[n,C].filter(Boolean).map(e=>(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),T&&(0,I.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),g&&(0,I.jsx)(K,{view:g,onApplied:j,onError:w},`${g.system}:${g.story.id}`),!c&&!g&&(0,I.jsx)(y,{icon:o,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{q as TestCases};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,
|
|
2
|
-
`)})]}):null,t&&e.name&&(0,X.jsx)(`div`,{children:(0,X.jsxs)(D,{size:`sm`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,X.jsx)(n,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:n,busy:r,act:i}){let[s,c]=(0,Y.useState)(`all`),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(``),v=n??[],b=(0,Y.useMemo)(()=>[...new Set(v.map(e=>e.requester))].sort(),[n]),x=(0,Y.useMemo)(()=>[...new Set(v.map(e=>e.database).filter(Boolean))].sort(),[n]),T=v.filter(e=>!e.ok).length,D=v.filter(e=>(s===`all`||s===`ok`===e.ok)&&(!l||e.requester===l)&&(!d||e.database===d)),M=new Set(e.requests.map(e=>e.name));return n===null?(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):v.length?(0,X.jsx)(A,{label:`Requests`,resetKey:`${s}|${l}|${d}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(E,{value:s,onChange:c,items:[{id:`all`,label:`All`,n:v.length},{id:`ok`,label:`Answered`,n:v.length-T},{id:`failed`,label:`Failed`,n:T,alert:!0}]}),b.length>1&&(0,X.jsxs)(C,{size:`sm`,"aria-label":`Who asked`,value:l,onChange:e=>u(e.target.value),className:`w-[180px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Anyone`}),b.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),x.length>1&&(0,X.jsxs)(C,{size:`sm`,"aria-label":`Database`,value:d,onChange:e=>p(e.target.value),className:`w-[160px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Any database`}),x.map(e=>(0,X.jsx)(`option`,{children:e},e))]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:_(O,`w-9`),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,X.jsx)(`th`,{className:_(O,`w-[110px]`),children:`When`}),(0,X.jsx)(`th`,{className:_(O,`w-[150px]`),children:`Who asked`}),(0,X.jsx)(`th`,{className:O,children:`What for`}),(0,X.jsx)(`th`,{className:_(O,`w-[110px]`),children:`Database`}),(0,X.jsx)(`th`,{className:_(O,`w-[140px]`),children:`Answer`}),(0,X.jsx)(`th`,{className:_(P,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:D.map(e=>{let n=m===e.id;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`tr`,{className:_(F,n&&`bg-surface-muted`),onClick:()=>g(n?``:e.id),children:[(0,X.jsx)(`td`,{className:_(j,`pr-0`),children:(0,X.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":n?`Close the request`:`Open the request`,onClick:t=>(t.stopPropagation(),g(n?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:n?(0,X.jsx)(t,{size:16,"aria-hidden":`true`}):(0,X.jsx)(a,{size:16,"aria-hidden":`true`})})}),(0,X.jsx)(`td`,{className:_(j,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:R(e.at)}),(0,X.jsx)(`td`,{className:_(j,`truncate`),"data-tip":e.requester,children:e.requester}),(0,X.jsxs)(`td`,{className:_(j,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,X.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,X.jsx)(`td`,{className:_(j,`truncate`),"data-tip":e.database,children:e.database||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:_(j,`whitespace-nowrap`),children:(0,X.jsx)(y,{tone:e.ok?`pass`:`fail`,children:e.ok?W[e.kind||``]||`Answered`:`Failed`})}),(0,X.jsx)(`td`,{className:k,children:e.ok?ne(e):``})]}),n&&(0,X.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,X.jsx)(`td`,{colSpan:7,className:_(`px-4 py-2`,`max-w-0`),children:(0,X.jsx)(re,{e,kept:!!e.name&&M.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,X.jsx)(S,{icon:f,title:`No test data asked for yet`,action:(0,X.jsxs)(`a`,{href:w(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:_(h({size:`sm`}),`no-underline`),children:[(0,X.jsx)(o,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function ie({view:e,job:t,busy:r,act:i,onNote:a}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,X.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,X.jsx)(B,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,X.jsx)(q,{r:s,onNote:a})]}),e.requests.length===0?(0,X.jsxs)(S,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,X.jsx)(`a`,{href:w(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,X.jsx)(K,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,W[e.kind],e.rows?` · ${g(e.rows,`row`)}`:``,e.created?` · ${R(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,X.jsx)(D,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>i(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,X.jsx)(n,{"aria-hidden":`true`})})]},e.name)})]})}function ae({view:t,job:n,busy:r,act:a,onNote:s}){let[u,d]=(0,Y.useState)(t.specs[0]??``),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(``),[_,y]=(0,Y.useState)(`csv`),[b,E]=(0,Y.useState)(!1),O={spec:u,...p?{db:p}:{},...h?{seed:h}:{}},k=n&&!n.running?n:null,A=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===u?k.result:void 0,j=t.databases.find(e=>e.name===p),M=async()=>{try{let{id:e}=await T.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=w(`chats`,e)}catch(e){s(e.message)}};return(0,X.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(x,{icon:f,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,X.jsxs)(D,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,X.jsx)(o,{"aria-hidden":`true`}),`Chat`]})]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),t.specs.length===0?(0,X.jsx)(S,{className:`py-4`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-sm font-medium`,children:[`Spec`,(0,X.jsx)(C,{value:u,onChange:e=>d(e.target.value),children:t.specs.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-sm font-medium`,children:[`Database`,(0,X.jsxs)(C,{value:p,onChange:e=>m(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`The spec's own`}),t.databases.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,X.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-sm font-medium`,children:[`Seed`,(0,X.jsx)(v,{value:h,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(D,{variant:b?void 0:`primary`,disabled:r||!u,onClick:()=>a(`gen`,O),children:[(0,X.jsx)(l,{"aria-hidden":`true`}),`Preview`]}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsxs)(D,{disabled:r||!u,onClick:()=>a(`gen`,{...O,mode:`files`,format:_}),"data-tip":`Write files (${_})`,children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`Export`]}),(0,X.jsx)(C,{"aria-label":`File format`,value:_,onChange:e=>y(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(D,{disabled:r||!u||!j?.writable,"data-tip":j?.writable?`Insert into ${j.name}`:`Pick a writable database to insert into`,onClick:()=>E(!0),children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Insert`]})]}),b&&j&&(0,X.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-4 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,u,` into `,j.name,`?`]}),(0,X.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{variant:`primary`,onClick:()=>{E(!1),a(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Insert`]}),(0,X.jsxs)(D,{onClick:()=>E(!1),"data-tip":`Don't insert`,children:[(0,X.jsx)(i,{"aria-hidden":`true`}),`Cancel`]})]})]}),A&&!A.ok&&(0,X.jsx)(B,{text:A.error||`It did not make the data.`}),A?.ok&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A.batch&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:A.batch}),`.`]}),A.files?.length?(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,A.files.map(e=>(0,X.jsx)(G,{file:e,onNote:s},e))]}):null,(0,X.jsx)(H,{r:A})]})]})]})}function oe({view:e,job:t,busy:n,act:r}){let i=e.databases.filter(e=>e.writable),[a,o]=(0,Y.useState)(i[0]?.name??``),[c,f]=(0,Y.useState)(``),p=t&&!t.running?t:null,m=p?.kind===`batches`?(Array.isArray(p.result)?p.result.flatMap(e=>e.batches||[]):p.result?.batches)??[]:null;return(0,X.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(x,{icon:u,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),i.length===0?(0,X.jsx)(S,{className:`py-4`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(C,{"aria-label":`Database`,value:a,onChange:e=>o(e.target.value),className:`w-[220px]`,children:i.map(e=>(0,X.jsx)(`option`,{children:e.name},e.name))}),(0,X.jsxs)(D,{disabled:n||!a,onClick:()=>r(`batches`,{db:a}),"data-tip":`List batches`,children:[(0,X.jsx)(l,{"aria-hidden":`true`}),`Show`]})]}),m&&m.length===0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,p?.target,`.`]}),m&&m.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:m.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:R(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),c===e.batch?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,p?.target,`?`]}),(0,X.jsxs)(D,{variant:`danger`,size:`sm`,onClick:()=>{f(``),r(`clean`,{db:p?.target,batch:e.batch,confirmed:!0})},children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Remove`]}),(0,X.jsxs)(D,{size:`sm`,onClick:()=>f(``),children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Keep`]})]}):(0,X.jsx)(D,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>f(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,X.jsx)(s,{"aria-hidden":`true`})})]},e.batch))}),p?.kind===`clean`&&p.result?.ok&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(p.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function se({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:s}=V(),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(``),f=Z.includes(e)?e:`requests`,p=s&&!s.running?s.endedAt:``;(0,Y.useEffect)(()=>{b.log().then(l,e=>d(e.message))},[p]);let m=(c||[]).filter(e=>!e.ok).length,v=new Set((c||[]).map(e=>e.requester)).size,y={requests:`Requests${c?` (${c.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,X.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,X.jsx)(ee,{}),(0,X.jsxs)(`main`,{className:_(I,`@container flex-auto gap-4`),children:[(0,X.jsx)(L,{href:w(`data`,`databases`),label:`All databases`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(N,{pixel:M[`test-data`],size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test data`}),t&&(0,X.jsx)(te,{label:`Test data`,className:`mb-0`,current:f,onPick:e=>location.hash=w(`test-data`,e),tabs:Z.map(e=>({id:e,label:y[e]}))}),(0,X.jsx)(`span`,{className:`flex-auto`}),(0,X.jsxs)(`a`,{href:w(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:_(h(),`no-underline`),children:[(0,X.jsx)(o,{"aria-hidden":`true`}),`Ask`]})]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what Miner sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),c&&c.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[g(c.length,`request`),` · `,g(v,`asker`),` · `,(0,X.jsxs)(`span`,{className:m?`text-fail`:``,children:[m,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||u)&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||u}),!t&&!n&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,X.jsxs)(X.Fragment,{children:[s&&(s.running?Q[s.kind]!==void 0:Q[s.kind]===f)&&(0,X.jsx)(z,{job:s,onStop:a}),(0,X.jsxs)(`div`,{role:`tabpanel`,id:`panel-${f}`,"aria-labelledby":`tab-${f}`,children:[f===`requests`&&(0,X.jsx)($,{view:t,log:c,busy:r,act:i}),f===`kept`&&(0,X.jsx)(ie,{view:t,job:s,busy:r,act:i,onNote:d}),f===`specs`&&(0,X.jsx)(ae,{view:t,job:s,busy:r,act:i,onNote:d}),f===`batches`&&(0,X.jsx)(oe,{view:t,job:s,busy:r,act:i})]})]})]})]})}export{$ as Requests,se as TestData};
|
|
1
|
+
import{$ as e,Br as t,E as n,In as r,Lr as i,O as a,Pr as o,_r as s,fn as c,nr as l,nt as u,ot as d,w as f,xt as p}from"./line-icons-CwZWt93L.js";import{$t as m,B as h,H as g,V as _,a as v,c as y,dt as b,g as x,l as S,o as C,p as w,st as T,t as E,z as D}from"./filters-faaSnoIq.js";import{$ as O,Q as k,X as A,Z as j,bn as M,bt as N,et as P,nt as F,o as ee,ot as te,t as I}from"./frame-BLPdAXUq.js";import{C as L,D as R,L as z,S as B,T as V,W as H,b as U,k as W,v as G,w as K,x as q,y as J}from"./index-CxiCvGZq.js";var Y=t(i(),1),X=m(),Z=[`requests`,`kept`,`specs`,`batches`],Q={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},ne=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function re({e,kept:t,busy:n,act:i}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,X.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,X.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,X.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,X.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked Miner for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,X.jsxs)(X.Fragment,{children:[` · `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.name})]}):null]}),e.why&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,X.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,X.jsx)(V,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,X.jsx)(R,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,X.jsx)(J,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,X.jsx)(J,{label:`INSERT script`,children:e.script_preview.join(`
|
|
2
|
+
`)})]}):null,t&&e.name&&(0,X.jsx)(`div`,{children:(0,X.jsxs)(D,{size:`sm`,disabled:n,onClick:()=>i(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Refresh`]})})]})}function $({view:e,log:t,busy:r,act:i}){let[o,s]=(0,Y.useState)(`all`),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(``),v=t??[],b=(0,Y.useMemo)(()=>[...new Set(v.map(e=>e.requester))].sort(),[t]),x=(0,Y.useMemo)(()=>[...new Set(v.map(e=>e.database).filter(Boolean))].sort(),[t]),T=v.filter(e=>!e.ok).length,D=v.filter(e=>(o===`all`||o===`ok`===e.ok)&&(!l||e.requester===l)&&(!d||e.database===d)),M=new Set(e.requests.map(e=>e.name));return t===null?(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):v.length?(0,X.jsx)(A,{label:`Requests`,resetKey:`${o}|${l}|${d}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(E,{value:o,onChange:s,items:[{id:`all`,label:`All`,n:v.length},{id:`ok`,label:`Answered`,n:v.length-T},{id:`failed`,label:`Failed`,n:T,alert:!0}]}),b.length>1&&(0,X.jsxs)(C,{size:`sm`,"aria-label":`Who asked`,value:l,onChange:e=>u(e.target.value),className:`w-[180px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Anyone`}),b.map(e=>(0,X.jsx)(`option`,{children:e},e))]}),x.length>1&&(0,X.jsxs)(C,{size:`sm`,"aria-label":`Database`,value:d,onChange:e=>f(e.target.value),className:`w-[160px]`,children:[(0,X.jsx)(`option`,{value:``,children:`Any database`}),x.map(e=>(0,X.jsx)(`option`,{children:e},e))]})]}),head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{className:_(O,`w-9`),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,X.jsx)(`th`,{className:_(O,`w-[110px]`),children:`When`}),(0,X.jsx)(`th`,{className:_(O,`w-[150px]`),children:`Who asked`}),(0,X.jsx)(`th`,{className:O,children:`What for`}),(0,X.jsx)(`th`,{className:_(O,`w-[110px]`),children:`Database`}),(0,X.jsx)(`th`,{className:_(O,`w-[140px]`),children:`Answer`}),(0,X.jsx)(`th`,{className:_(P,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:D.map(e=>{let t=m===e.id;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`tr`,{className:_(F,t&&`bg-surface-muted`),onClick:()=>g(t?``:e.id),children:[(0,X.jsx)(`td`,{className:_(j,`pr-0`),children:(0,X.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Close the request`:`Open the request`,onClick:n=>(n.stopPropagation(),g(t?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:t?(0,X.jsx)(n,{size:16,"aria-hidden":`true`}):(0,X.jsx)(a,{size:16,"aria-hidden":`true`})})}),(0,X.jsx)(`td`,{className:_(j,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:z(e.at)}),(0,X.jsx)(`td`,{className:_(j,`truncate`),"data-tip":e.requester,children:e.requester}),(0,X.jsxs)(`td`,{className:_(j,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,X.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,X.jsx)(`td`,{className:_(j,`truncate`),"data-tip":e.database,children:e.database||(0,X.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:_(j,`whitespace-nowrap`),children:(0,X.jsx)(y,{tone:e.ok?`pass`:`fail`,children:e.ok?L[e.kind||``]||`Answered`:`Failed`})}),(0,X.jsx)(`td`,{className:k,children:e.ok?ne(e):``})]}),t&&(0,X.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,X.jsx)(`td`,{colSpan:7,className:_(`px-4 py-2`,`max-w-0`),children:(0,X.jsx)(re,{e,kept:!!e.name&&M.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,X.jsx)(S,{icon:p,title:`No test data asked for yet`,action:(0,X.jsxs)(`a`,{href:w(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:_(h({size:`sm`}),`no-underline`),children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function ie({view:e,job:t,busy:n,act:i,onNote:a}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,X.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,X.jsx)(V,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,X.jsx)(G,{r:s,onNote:a})]}),e.requests.length===0?(0,X.jsxs)(S,{className:`py-4`,children:[`No kept requests yet. Each request Miner answers is kept here; `,(0,X.jsx)(`a`,{href:w(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,X.jsx)(K,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,L[e.kind],e.rows?` · ${g(e.rows,`row`)}`:``,e.created?` · ${z(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,X.jsx)(D,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>i(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,X.jsx)(r,{"aria-hidden":`true`})})]},e.name)})]})}function ae({view:t,job:n,busy:r,act:i,onNote:a}){let[s,l]=(0,Y.useState)(t.specs[0]??``),[f,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(``),[_,y]=(0,Y.useState)(`csv`),[b,E]=(0,Y.useState)(!1),O={spec:s,...f?{db:f}:{},...h?{seed:h}:{}},k=n&&!n.running?n:null,A=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===s?k.result:void 0,j=t.databases.find(e=>e.name===f),M=async()=>{try{let{id:e}=await T.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=w(`chats`,e)}catch(e){a(e.message)}};return(0,X.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,X.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(x,{icon:p,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,X.jsxs)(D,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`Chat`]})]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),t.specs.length===0?(0,X.jsx)(S,{className:`py-4`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-[14px] card border p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-2 text-sm font-medium`,children:[`Spec`,(0,X.jsx)(C,{value:s,onChange:e=>l(e.target.value),children:t.specs.map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-2 text-sm font-medium`,children:[`Database`,(0,X.jsxs)(C,{value:f,onChange:e=>m(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`The spec's own`}),t.databases.map(e=>(0,X.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,X.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-2 text-sm font-medium`,children:[`Seed`,(0,X.jsx)(v,{value:h,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(D,{variant:b?void 0:`primary`,disabled:r||!s,onClick:()=>i(`gen`,O),children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Preview`]}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsxs)(D,{disabled:r||!s,onClick:()=>i(`gen`,{...O,mode:`files`,format:_}),"data-tip":`Write files (${_})`,children:[(0,X.jsx)(u,{"aria-hidden":`true`}),`Export`]}),(0,X.jsx)(C,{"aria-label":`File format`,value:_,onChange:e=>y(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,X.jsx)(`option`,{children:e},e))})]}),(0,X.jsxs)(D,{disabled:r||!s||!j?.writable,"data-tip":j?.writable?`Insert into ${j.name}`:`Pick a writable database to insert into`,onClick:()=>E(!0),children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Insert`]})]}),b&&j&&(0,X.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-4 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,s,` into `,j.name,`?`]}),(0,X.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(D,{variant:`primary`,onClick:()=>{E(!1),i(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,X.jsx)(e,{"aria-hidden":`true`}),`Insert`]}),(0,X.jsxs)(D,{onClick:()=>E(!1),"data-tip":`Don't insert`,children:[(0,X.jsx)(o,{"aria-hidden":`true`}),`Cancel`]})]})]}),A&&!A.ok&&(0,X.jsx)(V,{text:A.error||`It did not make the data.`}),A?.ok&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A.batch&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:A.batch}),`.`]}),A.files?.length?(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,A.files.map(e=>(0,X.jsx)(U,{file:e,onNote:a},e))]}):null,(0,X.jsx)(q,{r:A})]})]})]})}function oe({view:e,job:t,busy:n,act:r}){let i=e.databases.filter(e=>e.writable),[a,o]=(0,Y.useState)(i[0]?.name??``),[c,u]=(0,Y.useState)(``),p=t&&!t.running?t:null,m=p?.kind===`batches`?(Array.isArray(p.result)?p.result.flatMap(e=>e.batches||[]):p.result?.batches)??[]:null;return(0,X.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,X.jsx)(x,{icon:l,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),i.length===0?(0,X.jsx)(S,{className:`py-4`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(C,{"aria-label":`Database`,value:a,onChange:e=>o(e.target.value),className:`w-[220px]`,children:i.map(e=>(0,X.jsx)(`option`,{children:e.name},e.name))}),(0,X.jsxs)(D,{disabled:n||!a,onClick:()=>r(`batches`,{db:a}),"data-tip":`List batches`,children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Show`]})]}),m&&m.length===0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,p?.target,`.`]}),m&&m.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:m.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,X.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:z(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),c===e.batch?(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,p?.target,`?`]}),(0,X.jsxs)(D,{variant:`danger`,size:`sm`,onClick:()=>{u(``),r(`clean`,{db:p?.target,batch:e.batch,confirmed:!0})},children:[(0,X.jsx)(s,{"aria-hidden":`true`}),`Remove`]}),(0,X.jsxs)(D,{size:`sm`,onClick:()=>u(``),children:[(0,X.jsx)(f,{"aria-hidden":`true`}),`Keep`]})]}):(0,X.jsx)(D,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,X.jsx)(s,{"aria-hidden":`true`})})]},e.batch))}),p?.kind===`clean`&&p.result?.ok&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-4 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(p.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function se({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=W(),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(``),f=Z.includes(e)?e:`requests`,p=o&&!o.running?o.endedAt:``;(0,Y.useEffect)(()=>{b.log().then(l,e=>d(e.message))},[p]);let m=(s||[]).filter(e=>!e.ok).length,v=new Set((s||[]).map(e=>e.requester)).size,y={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,X.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,X.jsx)(ee,{}),(0,X.jsxs)(`main`,{className:_(I,`@container flex-auto gap-4`),children:[(0,X.jsx)(H,{href:w(`data`,`databases`),label:`All databases`}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(N,{pixel:M[`test-data`],size:`lg`}),(0,X.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test data`}),t&&(0,X.jsx)(te,{label:`Test data`,className:`mb-0`,current:f,onPick:e=>location.hash=w(`test-data`,e),tabs:Z.map(e=>({id:e,label:y[e]}))}),(0,X.jsx)(`span`,{className:`flex-auto`}),(0,X.jsxs)(`a`,{href:w(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:_(h(),`no-underline`),children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`Ask`]})]}),(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what Miner sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[g(s.length,`request`),` · `,g(v,`asker`),` · `,(0,X.jsxs)(`span`,{className:m?`text-fail`:``,children:[m,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||u)&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||u}),!t&&!n&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,X.jsxs)(X.Fragment,{children:[o&&(o.running?Q[o.kind]!==void 0:Q[o.kind]===f)&&(0,X.jsx)(B,{job:o,onStop:a}),(0,X.jsxs)(`div`,{role:`tabpanel`,id:`panel-${f}`,"aria-labelledby":`tab-${f}`,children:[f===`requests`&&(0,X.jsx)($,{view:t,log:s,busy:r,act:i}),f===`kept`&&(0,X.jsx)(ie,{view:t,job:o,busy:r,act:i,onNote:d}),f===`specs`&&(0,X.jsx)(ae,{view:t,job:o,busy:r,act:i,onNote:d}),f===`batches`&&(0,X.jsx)(oe,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{$ as Requests,se as TestData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Br as e,In as t,Lr as n,M as r,N as i,R as a,Sr as o,Y as s,br as c,nn as ee,o as l,or as te}from"./line-icons-CwZWt93L.js";import{$t as u,B as d,V as f,a as p,l as m,o as h,ot as g,p as _,st as v,t as y,z as b}from"./filters-faaSnoIq.js";import{X as x,bn as ne,bt as S,o as C,t as re}from"./frame-BLPdAXUq.js";import{G as ie,L as w}from"./index-CxiCvGZq.js";import{_ as T,o as E}from"./qualityParts-CT25lBWU.js";var D=e(n(),1),O={view:()=>g(`GET`,`/api/testdebt`),refresh:()=>g(`POST`,`/api/testdebt/refresh`,{}),readCases:(e,t)=>g(`POST`,`/api/testdebt/cases`,{source:e,scope:t})},k=u(),A=[`untested`,`signal`,`duplicates`,`cases`],j={endpoint:`Endpoint`,screen:`Screen`,file:`Code file`},M={test:`Test`,recording:`Recording`,case:`Test case`},N={azure_devops:`Azure DevOps`,jira:`Jira`,xray:`Xray`,testrail:`TestRail`,zephyr:`Zephyr Scale`,qtest:`qTest`,other:`Other`},P={azure_devops:`plan=12/suite=34`,testrail:`run=7`,zephyr:`cycle=SHOP-R12`,qtest:`cycle=12`,xray:`plan=SHOP-100`},F=e=>`${Math.round(e*100)}%`,I=e=>A.includes(e)?e:`untested`;function L({part:e,what:t,action:n}){return(0,k.jsxs)(m,{icon:c,title:e.state===`empty`?`No ${t} yet`:`${t[0].toUpperCase()}${t.slice(1)}: not connected`,action:(0,k.jsxs)(`a`,{className:d({size:`sm`}),href:n.to,"data-tip":`Open ${n.label}`,children:[(0,k.jsx)(l,{"aria-hidden":`true`}),n.label]}),children:[`To see this list, set `,e.set,`.`]})}function R({text:e,tip:t}){return(0,k.jsx)(`span`,{"data-tip":t??e,className:`block truncate`,children:e})}function z({sub:e}){let[n,c]=(0,D.useState)(null),[u,g]=(0,D.useState)(``),[A,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(``),H=I(e),[U,W]=(0,D.useState)(`all`),[G,ae]=(0,D.useState)(`manual`),[oe,se]=(0,D.useState)(``),[K,ce]=(0,D.useState)(``);(0,D.useEffect)(()=>{O.view().then(e=>{c(e),g(``)},e=>g(e.message))},[]);let q=(0,D.useCallback)(async(e,t)=>{z(!0),V(``);try{c(await e()),g(``),t&&V(t)}catch(e){g(e.message)}finally{z(!1)}},[]),le=async e=>{if(e){z(!0);try{let{id:t}=await v.start(e,{});location.hash=_(`chats`,t)}catch(e){g(e.message),z(!1)}}},J=(e,t)=>(0,k.jsx)(b,{size:`icon`,variant:`icon`,className:`size-8`,disabled:A||!e,onClick:()=>void le(e),"aria-label":`Draft a test for this ${t} in a chat`,"data-tip":e?`Draft a test for this ${t} in a chat`:`Its id or file is not of a plain shape, so no chat request names it: open it where it lives instead.`,children:(0,k.jsx)(te,{"aria-hidden":`true`})}),Y=n?.sources.filter(e=>e.connected&&e.id!==`jira`)??[],X=oe||Y[0]?.id||``,Z=n?.cases.filter(e=>!e.automated).length??0,ue=n?.areas.filter(e=>U===`all`||e.kind===U)??[],de=n?.cases.filter(e=>G===`all`||(G===`manual`?!e.automated:e.automated))??[],Q=`py-2 pr-4 text-right tabular-nums`,$={untested:(n?.areas.length??0)+(n?.rules.length??0),signal:(n?.quiet.length??0)+(n?.gone.length??0),duplicates:n?.duplicates.length??0,cases:Z};return(0,k.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,k.jsx)(C,{}),(0,k.jsxs)(`main`,{className:f(re,`@container flex-auto gap-4`),children:[(0,k.jsx)(ie,{}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,k.jsx)(S,{pixel:ne[`test-debt`],size:`lg`}),(0,k.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test debt`}),n&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[13px] text-muted`,children:[(0,k.jsxs)(`span`,{"data-tip":T(n.at),children:[`Worked out `,w(n.at)]}),(0,k.jsxs)(b,{size:`sm`,disabled:A,onClick:()=>void q(O.refresh,`Worked out again.`),children:[(0,k.jsx)(t,{"aria-hidden":`true`}),`Refresh`]})]})]}),(0,k.jsxs)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:[`What no test checks yet, and tests that tell little: code and business rules no test reaches in the `,(0,k.jsx)(`a`,{href:_(`product`),children:`product graph`}),`, tests that passed every one of their last 30 runs or whose file is gone from `,n?.repo&&n.repo!==`.`?(0,k.jsx)(`code`,{className:`font-mono text-[13px]`,children:n.repo}):`the test repository`,`, tests that read alike, and each test case with whether it is automated. It only reads; Draft the test asks in a chat, and nothing changes until you agree there.`]}),u&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:u}),!n&&!u&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),B&&(0,k.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:B}),n&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-6 @xl:divide-x @xl:divide-line-soft`,children:[(0,k.jsx)(E,{label:`Untested code`,value:n.graph.state===`ok`?n.areas.length:`–`,tone:n.areas.length?`text-warn`:void 0,sub:n.graph.state===`ok`?`of ${n.graph.checked} areas`:`graph not built`}),(0,k.jsx)(E,{label:`Untested rules`,value:n.rules.length,tone:n.rules.length?`text-warn`:void 0,sub:`of ${n.graph.rulesChecked} rules`}),(0,k.jsx)(E,{label:`Never fail`,value:n.quiet.length,sub:`30 passes in a row`}),(0,k.jsx)(E,{label:`Code gone`,value:n.gone.length,tone:n.gone.length?`text-fail`:void 0,sub:`of ${n.files.count} files listed`}),(0,k.jsx)(E,{label:`Near-duplicates`,value:n.duplicates.length,sub:`from ${F(n.threshold)} alike`}),(0,k.jsx)(E,{label:`Not automated`,value:Z,tone:Z?`text-warn`:void 0,sub:`of ${n.cases.length} test cases`})]}),(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(y,{items:[{id:`untested`,label:`Untested code and rules`,n:$.untested},{id:`signal`,label:`Low-signal tests`,n:$.signal},{id:`duplicates`,label:`Near-duplicates`,n:$.duplicates},{id:`cases`,label:`Test cases`,n:$.cases}],value:H,onChange:e=>location.hash=_(`test-debt`,e)})}),n.notes.map(e=>(0,k.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:e},e)),H===`untested`&&(0,k.jsxs)(k.Fragment,{children:[n.graph.state===`ok`?(0,k.jsx)(x,{label:`Code no test reaches`,placeholder:`Find an endpoint, screen or file`,resetKey:U,empty:n.areas.length?`Nothing matches.`:`Every endpoint, screen and code file the graph holds is reached by a test.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(y,{items:[{id:`all`,label:`All`,n:n.areas.length},...[`endpoint`,`screen`,`file`].map(e=>({id:e,label:`${j[e]}s`,n:n.areas.filter(t=>t.kind===e).length}))],value:U,onChange:W})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[34%]`),children:`Code`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Used by`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:ue.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(i,{size:15,"aria-label":`No test reaches it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.name,tip:`${e.name} · ${e.known===`observed`?`read in the code`:`worked out from the code`}`})]})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:j[e.kind]}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:f(Q,`hidden text-muted @2xl:table-cell`),children:e.users}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,j[e.kind].toLowerCase())})]},e.id))}):(0,k.jsx)(L,{part:n.graph,what:`product graph`,action:{label:`Product`,to:_(`product`)}}),(0,k.jsx)(x,{label:`Business rules no test checks`,placeholder:`Find a rule`,empty:n.graph.rulesChecked?`Every business rule found is checked by a test.`:`No business rules found: the product graph's rules come from the code; the knowledge folder's from a business-rules.md file.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[46%]`),children:`Rule`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`From`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Where`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Closest test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.rules.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(i,{size:15,"aria-label":`No test checks it`,className:`flex-none text-warn`}),(0,k.jsx)(R,{text:e.text,tip:e.endpoint?`${e.text} · checked by ${e.endpoint}`:e.text})]})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`text-[13px] whitespace-nowrap`),"data-tip":e.from===`graph`?`Found in the code by forgeqe knowledge build`:`A rule of the knowledge folder, matched to tests by its words`,children:e.from===`graph`?`Code`:`Knowledge`}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden max-w-0 font-mono text-[13px] text-ink-2 @xl:table-cell`),children:(0,k.jsx)(R,{text:e.where})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.nearest?(0,k.jsx)(R,{text:`${e.nearest.name} (${F(e.nearest.score)})`,tip:`${F(e.nearest.score)} of the rule's words are in ${e.nearest.name}`}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`rule`)})]},e.id))})]}),H===`signal`&&(n.history.state===`ok`?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(x,{label:`Tests that never fail`,placeholder:`Find a test`,empty:`No test has passed 30 runs in a row without a failure or a retry.`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Passes`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Since`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.quiet.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(r,{size:15,"aria-label":`Always passed`,className:`flex-none text-muted`}),(0,k.jsx)(R,{text:e.name,tip:e.file?`${e.name} · ${e.file}`:e.name})]})}),(0,k.jsx)(`td`,{className:f(Q,`text-muted`),children:e.runs}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.since?T(e.since):void 0,children:e.since?w(e.since):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))}),(0,k.jsx)(x,{label:`Tests whose file is gone`,placeholder:`Find a test or file`,empty:`Every test file the history names is in the test repository (${n.files.count} files, listed by ${n.files.by===`git`?`git`:`walking the folder`}).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[40%]`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`File`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Last run`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.gone.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(a,{size:15,"aria-label":`Its file is gone`,className:`flex-none text-fail`}),(0,k.jsx)(R,{text:e.name})]})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0 font-mono text-[13px] text-ink-2`),children:(0,k.jsx)(R,{text:e.file})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),"data-tip":e.last?T(e.last):void 0,children:e.last?w(e.last):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`test`)})]},e.key))})]}):(0,k.jsx)(L,{part:n.history,what:`test history`,action:{label:`Regression`,to:_(`regression`)}})),H===`duplicates`&&(0,k.jsx)(x,{label:`Tests that read alike`,placeholder:`Find a test, recording or case`,empty:`No two tests, recordings or test cases share ${F(n.threshold)} of their words (${n.compared} pairs compared).`,head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-right text-[13px] font-medium whitespace-nowrap text-muted`,children:`Alike`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`First`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[30%]`),children:`Second`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Shared words`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:n.duplicates.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(Q,`pl-4`,e.score>=.85?`text-warn`:`text-muted`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,k.jsx)(s,{size:14,"aria-hidden":`true`}),F(e.score)]})}),[e.a,e.b].map((e,t)=>(0,k.jsxs)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:[(0,k.jsx)(R,{text:e.name,tip:`${M[e.kind]}: ${e.name}${e.where?` · ${e.where}`:``}`}),(0,k.jsx)(`span`,{className:`block text-[13px] text-muted`,children:M[e.kind]})]},t)),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,k.jsx)(R,{text:e.shared.join(`, `)})}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:J(e.draft,`pair`)})]},`${e.a.kind}:${e.a.key}|${e.b.kind}:${e.b.key}`))}),H===`cases`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsx)(`span`,{className:`text-[13px] font-medium`,children:`Test management`}),(0,k.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:n.sources.map(e=>(0,k.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[e.connected?(0,k.jsx)(r,{size:15,"aria-label":`Connected`,className:`flex-none text-pass`}):(0,k.jsx)(i,{size:15,"aria-label":`Not connected`,className:`flex-none text-muted`}),(0,k.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,k.jsx)(`span`,{className:`text-ink-2`,children:e.connected?e.scopes.length?e.scopes.map(e=>`${e.scope}: ${e.cases} read ${w(e.at)}`).join(` · `):e.id===`jira`?`connected: its cases show once ForgeQE has indexed or automated them`:`connected`:`not connected: set ${e.set}`})]},e.id))})]}),Y.length>0&&(0,k.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),X&&q(()=>O.readCases(X,K.trim()),`Test cases read.`)},children:[(0,k.jsx)(h,{size:`sm`,"aria-label":`Source`,value:X,onChange:e=>se(e.target.value),children:Y.map(e=>(0,k.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,k.jsx)(p,{size:`sm`,"aria-label":`Scope`,placeholder:X&&X!==`jira`?P[X]:``,value:K,maxLength:80,onChange:e=>ce(e.target.value),className:`w-full max-w-[240px] flex-[0_1_240px]`}),(0,k.jsxs)(b,{size:`sm`,type:`submit`,disabled:A||!K.trim(),"data-tip":`Read the test cases`,children:[(0,k.jsx)(o,{"aria-hidden":`true`}),`Import`]})]}),n.cases.length?(0,k.jsx)(x,{label:`Test cases`,placeholder:`Find a test case by id or title`,resetKey:G,empty:`Nothing matches.`,tools:(0,k.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,k.jsx)(y,{items:[{id:`manual`,label:`Not automated`,n:Z,alert:!0},{id:`automated`,label:`Automated`,n:n.cases.length-Z},{id:`all`,label:`All`,n:n.cases.length}],value:G,onChange:ae})}),head:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Case`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`w-[36%]`),children:`Title`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Source`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:`Automated`}),(0,k.jsx)(`th`,{className:f(`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`Test`}),(0,k.jsx)(`th`,{className:`px-4 py-2 text-left text-[13px] font-medium whitespace-nowrap text-muted`,children:(0,k.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:de.map(e=>(0,k.jsxs)(`tr`,{className:`border-t border-line-soft hover:bg-surface-muted`,children:[(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`font-mono text-[13px] whitespace-nowrap`),children:/^https?:\/\//i.test(e.url)?(0,k.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer noopener`,children:e.id}):e.id}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`max-w-0`),children:(0,k.jsx)(R,{text:e.title||`–`})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden text-[13px] whitespace-nowrap @xl:table-cell`),"data-tip":`From ${e.scope}`,children:N[e.source]}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`text-[13px] whitespace-nowrap`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2`,"data-tip":e.how===`mapping`?`Its test is in the automated tests' mapping`:e.how===`name`?`A test in the history names its id`:`No automated test names it`,children:[e.automated?(0,k.jsx)(r,{size:15,"aria-hidden":`true`,className:`text-pass`}):(0,k.jsx)(i,{size:15,"aria-hidden":`true`,className:`text-muted`}),e.automated?`Yes`:`No`]})}),(0,k.jsx)(`td`,{className:f(`px-4 py-2`,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:e.test?(0,k.jsx)(R,{text:e.test,tip:e.file?`${e.test} · ${e.file}`:e.test}):`–`}),(0,k.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:!e.automated&&J(e.draft,`test case`)})]},`${e.source}|${e.id}`))}):(0,k.jsx)(m,{icon:ee,title:`No test cases yet`,action:(0,k.jsxs)(`a`,{className:d({size:`sm`}),href:_(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,k.jsx)(l,{"aria-hidden":`true`}),`Settings`]}),children:`Test cases show here from ForgeQE's case index, the automated tests' mapping (.forgeqe/test-cases.json), and the plans, runs or cycles you read above from a connected source.`})]})]})]})]})}export{z as TestDebt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Br as e,Gn as t,In as n,Lr as r,M as i,Mr as a,N as o,P as s,Pr as c,R as l,Sr as u,U as d,Yt as f,_r as p,a as m,at as h,b as g,br as _,cr as v,fr as y,it as ee,jn as b,m as x,nn as S,o as C,qn as w,rr as te,tn as T,tr as E,w as D,zn as O}from"./line-icons-CwZWt93L.js";import{$t as ne,B as re,V as k,a as A,c as j,f as ie,h as ae,l as M,o as N,ot as P,p as F,st as I,t as oe,z as L}from"./filters-faaSnoIq.js";import{$ as R,Q as z,Vt as B,X as V,Z as H,bn as se,bt as ce,et as U,it as le,n as ue,nt as W,o as de,ot as fe,rt as G}from"./frame-BLPdAXUq.js";import{G as pe,L as K,j as q}from"./index-CxiCvGZq.js";import{_ as me}from"./qualityParts-CT25lBWU.js";import{t as he}from"./AgentWork-DwAI0_Of.js";var J=e(r(),1),Y={view:()=>P(`GET`,`/api/testmgmt`),cases:()=>P(`GET`,`/api/testmgmt/cases`),case:e=>P(`GET`,`/api/testmgmt/case/${encodeURIComponent(e).replace(/%3A/gi,`:`)}`),sync:()=>P(`POST`,`/api/testmgmt/sync`),schedule:()=>P(`GET`,`/api/testmgmt/schedule`),setSchedule:e=>P(`POST`,`/api/testmgmt/schedule`,e),gaps:()=>P(`GET`,`/api/testmgmt/gaps`),tags:()=>P(`GET`,`/api/testmgmt/tags`),tag:(e,t=!1)=>P(`POST`,`/api/testmgmt/tags`,{...e,...t?{confirmed:!0}:{}}),suites:()=>P(`GET`,`/api/testmgmt/suites`),suite:e=>P(`GET`,`/api/testmgmt/suites/${encodeURIComponent(e)}`),buildSuite:(e,t)=>P(`POST`,`/api/testmgmt/suites/agent`,{request:e,...t?{open:t}:{}}),saveSuite:e=>P(`POST`,`/api/testmgmt/suites`,e),deleteSuite:e=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/delete`,{confirmed:!0}),runSuite:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/run`,{...t,...n?{confirmed:!0}:{}}),run:(e,t,n=!1)=>P(`POST`,`/api/testmgmt/run`,{keys:e,...t?{env:t}:{},...n?{confirmed:!0}:{}}),job:()=>P(`GET`,`/api/testmgmt/job`),writeBack:(e,t,n,r)=>P(`POST`,`/api/testmgmt/writeback/${e}`,{keys:t,...r?{tags:r}:{},...n?{digest:n}:{}}),suiteTracker:(e,t,n)=>P(`POST`,`/api/testmgmt/suites/${encodeURIComponent(e)}/tracker`,{...t?{target:t}:{},...n?{digest:n}:{}}),stop:()=>P(`POST`,`/api/testmgmt/stop`),tests:()=>P(`GET`,`/api/testmgmt/tests`),discoveryPlan:()=>P(`GET`,`/api/testmgmt/discover`),discover:e=>P(`POST`,`/api/testmgmt/discover`,{digest:e}),link:e=>P(`POST`,`/api/testmgmt/links`,{changes:e}),setMain:(e,t)=>P(`POST`,`/api/testmgmt/links/main`,{case:e,test:t}),proposeLinks:(e=[])=>P(`POST`,`/api/testmgmt/links/propose`,{keys:e}),ask:(e,t,n,r)=>P(`POST`,`/api/testmgmt/ask`,{intent:e,keys:t,...n?{words:n}:{},...r?.length?{stories:r}:{}}),readStories:e=>P(`POST`,`/api/testmgmt/stories`,{scope:e})},ge={automated:`Automated`,not_automated:`Not automated`,pending:`Pending`,known_defect:`Known defect`,needs_attention:`Needs attention`},_e={mapping:`ForgeQE's mapping`,manual:`Linked by a person`,attribute:`Its marker or attribute names the case`,tracker:`The case's system names it`,agent:`Linked by the mapping agent`,name:`The case's id is in its name or tags`},ve={framework:`Listed by its framework`,code:`Read from the code`,runs:`Known from runs`},X={passed:`Passed`,failed:`Failed`,blocked:`Blocked`,not_run:`Not run`},Z=ne();function ye({title:e,about:t,onClose:n,children:r,footer:i}){return(0,Z.jsxs)(`aside`,{"aria-label":e,className:`flex w-full flex-none flex-col border-t border-line-soft bg-surface-muted xl:sticky xl:top-0 xl:h-(--screen) xl:w-[320px] 2xl:w-[380px] xl:border-t-0 xl:border-l`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line-soft px-6 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[20px] font-semibold`,children:e}),(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t})]}),n&&(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Close the ${e}`,"data-tip":`Close`,onClick:n,children:(0,Z.jsx)(c,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 py-6`,children:r}),i&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft px-6 py-4`,children:i})]})}function be({title:e,about:t,looking:n,context:r,suggestions:i,placeholder:a,onClose:o}){let[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(!1),_=async(e,t,n,r,i)=>{f(!0),m(``);try{let{request:a}=await Y.ask(e,t,r,i),{id:o}=await I.start(a,{});c({id:o,said:n}),g(!1),u(``)}catch(e){m(e.message)}finally{f(!1)}};return(0,Z.jsxs)(ye,{title:e,about:t,onClose:o,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>(0,Z.jsxs)(L,{size:`sm`,disabled:d||!!e.disabled,"data-tip":e.disabled??e.label,onClick:()=>void _(e.intent,e.keys,e.label,void 0,e.stories),children:[(0,Z.jsx)(e.icon,{"aria-hidden":`true`}),e.label]},e.label))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),l.trim()&&_(`ask`,i[0]?.keys.slice(0,50)??[],l.trim(),l.trim())},children:[(0,Z.jsxs)(`label`,{className:`sr-only`,htmlFor:`tm-agent-words`,children:[`Message the `,e]}),(0,Z.jsx)(`textarea`,{id:`tm-agent-words`,rows:2,maxLength:1e3,value:l,placeholder:a,onChange:e=>u(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:d||!l.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(w,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,Z.jsx)(ae,{state:d||s&&!h?`thinking`:`working`,px:96,label:d?`Starting`:s&&!h?`Working`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:s?h?`Done. Ask again, or open the chat.`:`Working on it…`:n}),r.length>0&&(0,Z.jsx)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:r.map(e=>(0,Z.jsx)(`span`,{className:`rounded-[8px] border border-line bg-bg px-2 text-[13px] text-ink-2`,children:e},e))}),s&&(0,Z.jsx)(`p`,{className:`m-0 text-[16px] leading-relaxed text-ink-2`,children:s.said})]}),p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:p}),s?(0,Z.jsx)(he,{id:s.id,label:`The ${e} at work`,onEnd:()=>g(!0)},s.id):(0,Z.jsxs)(`p`,{className:k(`m-0 text-center text-[13px] text-muted`),children:[`Pick what to do below, or say it in your own words. It works in a chat you can open: `,(0,Z.jsx)(`a`,{href:F(`chats`),children:`Chats`}),`.`]})]})}var xe={automation:`Mark automated in their tracker`,tags:`Write ForgeQE's tags to their tracker`,untag:`Take ForgeQE's tags off in their tracker`},Se={automation:`Each case's tracker records its automated test: Azure DevOps' Associated Automation, or the automated label on a Jira or Xray test. Only cases whose test ForgeQE knows, from its mapping or a link, are marked.`,tags:`ForgeQE's own tags are added to each case's tags in Azure DevOps, or its labels in Jira. Tags the case already has stay; nothing is taken away.`,untag:`ForgeQE's own tags are taken off each case's tags in Azure DevOps, or its labels in Jira. Only a tag ForgeQE keeps for the case is taken off; the tracker's other tags stay.`},Ce=e=>e.system===`azure_devops`?`Azure DevOps plan ${e.plan}`:`Xray Test Set in ${e.project}`,we=e=>e.system===`azure_devops`?`ado:${e.plan}`:`xray:${e.project}`,Te=e=>e?.url&&/^https:\/\//i.test(e.url)?e.url:void 0,Ee=e=>e.system===`azure_devops`?`Azure DevOps suite ${e.suite} in plan ${e.plan}`:`Xray Test Set ${e.key}`;function De({plan:e,outcome:t}){let n=new Map((t?.failed??[]).map(e=>[e.key,e.error])),r=new Set((t?.done??[]).map(e=>e.key)),a=(e,t,a=!1)=>(0,Z.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r.has(e.key)&&(0,Z.jsx)(i,{size:14,"aria-label":`Written`,className:`flex-none text-pass`}),n.has(e.key)&&(0,Z.jsx)(l,{size:14,"aria-label":`Refused`,className:`flex-none text-fail`}),e.key!==`suite`&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.key.replace(/^[a-z_]+:/,``)}),(0,Z.jsx)(`span`,{className:a?`text-muted`:`text-ink-2`,children:e.what})]}),n.has(e.key)&&(0,Z.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:n.get(e.key)})]},`${e.key}-${t}`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[e.changes.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map((e,t)=>a(e,t))}):(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:`Nothing to write: the trackers already say so.`}),e.skipped.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-muted`,children:[`Left out: `,e.skipped.length]}),(0,Z.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col p-0`,children:e.skipped.map((e,t)=>a(e,t,!0))})]})]})}function Oe(e,t,n){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{i(null),o(null),c(``),e&&e().then(e=>i(e??null),e=>c(e.message))},[e]),{plan:r,outcome:a,error:s,busy:l,go:async()=>{if(r){u(!0),c(``);try{let e=await t(r.digest);e&&(o(e),n(`Wrote ${e.done.length}${e.failed.length?`; the tracker refused ${e.failed.length}`:``}.`))}catch(e){c(e.message)}finally{u(!1)}}}}}function ke({kind:e,keys:t,tags:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(null);(0,J.useEffect)(()=>o(e?()=>()=>Y.writeBack(e,t,void 0,n).then(e=>e.plan):null),[e,t,n]);let s=Oe(a,r=>Y.writeBack(e,t,r,n).then(e=>e.outcome),i);return(0,Z.jsx)(B,{open:!!e,onClose:r,title:e?xe[e]:``,description:e?Se[e]:``,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:r,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),s.outcome?`Close`:`Cancel`]}),!s.outcome&&(0,Z.jsxs)(L,{variant:`primary`,disabled:s.busy||!s.plan?.changes.length,onClick:()=>void s.go(),"data-tip":`Write these changes`,children:[e===`untag`?(0,Z.jsx)(ee,{"aria-hidden":`true`}):(0,Z.jsx)(u,{"aria-hidden":`true`}),s.busy?`Writing…`:`${e===`untag`?`Take off`:`Write`} ${s.plan?.changes.length??``}`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[!s.plan&&!s.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Working out what would change…`}),s.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s.error}),s.plan&&(0,Z.jsx)(De,{plan:s.plan,outcome:s.outcome})]})})}function Ae({open:e,suite:t,targets:n,onClose:r,onDone:i}){let[a,o]=(0,J.useState)(``),s=t.tracker?void 0:n.find(e=>we(e)===(a||(n[0]?we(n[0]):``))),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>u(e&&(t.tracker||s)?()=>()=>Y.suiteTracker(t.id,s).then(e=>e.plan):null),[e,t.id,t.tracker,s&&we(s)]);let d=Oe(l,e=>Y.suiteTracker(t.id,s,e).then(e=>e.outcome),i),f=t.tracker;return(0,Z.jsx)(B,{open:e,onClose:r,title:f?`Keep ${t.name} in step`:`Keep ${t.name} in a tracker`,description:f?`It is ${Ee(f)}. Cases the suite gained are added there, and cases it lost are taken out.`:`The suite is made in the tracker with its cases, so the team sees it there. Later, Keep in step makes it match the suite again.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:r,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),d.outcome?`Close`:`Cancel`]}),!d.outcome&&(0,Z.jsxs)(L,{variant:`primary`,disabled:d.busy||!d.plan?.changes.length,onClick:()=>void d.go(),children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),d.busy?`Writing…`:f?`Keep in step`:`Make it there`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[!f&&(n.length?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Where`,(0,Z.jsx)(N,{value:s?we(s):``,onChange:e=>o(e.target.value),children:n.map(e=>(0,Z.jsx)(`option`,{value:we(e),children:Ce(e)},we(e)))})]}):(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This suite's cases are in no connected Azure DevOps plan or Xray project. Connect one in Settings › Integrations.`})),(f||s)&&!d.plan&&!d.error&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Working out what would change…`}),d.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:d.error}),d.plan&&(0,Z.jsx)(De,{plan:d.plan,outcome:d.outcome}),d.outcome&&!d.outcome.failed.length&&(0,Z.jsx)(j,{tone:`pass`,children:`Done`})]})})}var je={automated:i,not_automated:o,pending:s,known_defect:_,needs_attention:_},Me={passed:`pass`,failed:`fail`,blocked:`warn`,not_run:`neutral`};function Q({text:e,tip:t,className:n}){return(0,Z.jsx)(`span`,{"data-tip":t??e,className:k(`block truncate`,n),children:e})}function Ne({a:e}){let t=je[e];return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[13px] whitespace-nowrap`,children:[(0,Z.jsx)(t,{size:15,"aria-hidden":`true`,className:k(`flex-none`,e===`automated`?`text-pass`:e===`known_defect`?`text-fail`:e===`not_automated`?`text-muted`:`text-warn`)}),ge[e]]})}function Pe({o:e}){return(0,Z.jsx)(j,{tone:Me[e],icon:e!==`not_run`,children:X[e]})}function Fe({runs:e}){return e.length?(0,Z.jsx)(`span`,{role:`img`,"aria-label":`Last runs: ${e.map(e=>e===`p`?`passed`:`failed`).join(`, `)}`,className:`inline-flex items-end gap-1`,children:e.map((e,t)=>(0,Z.jsx)(`span`,{className:k(`inline-block h-4 w-2 rounded-[2px]`,e===`p`?`bg-pass`:`bg-fail`)},t))}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}function Ie({tags:e,max:t=3}){return e.length?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[e.slice(0,t).map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] bg-surface-strong px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(y,{size:11,"aria-hidden":`true`}),e]},e)),e.length>t&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,"data-tip":e.slice(t).join(`, `),children:[`+`,e.length-t]})]}):null}function Le({points:e,label:t,format:n=e=>String(e),height:r=160}){if(e.length<2)return(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`The trend starts after a second day of numbers: each visit of Test management keeps the day's.`});let i=r,a=Math.min(...e.map(e=>e.y)),o=Math.max(...e.map(e=>e.y)),s=Math.max(0,a-(o-a||1)*.2),c=o+(o-a||1)*.2,l=t=>8+t*584/(e.length-1),u=e=>i-20-(e-s)/(c-s||1)*(i-36),d=e.map((e,t)=>`${l(t).toFixed(1)},${u(e.y).toFixed(1)}`),f=e.at(-1);return(0,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-1`,children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 600 ${i}`,role:`img`,"aria-label":`${t}: from ${n(e[0].y)} on ${e[0].x} to ${n(f.y)} on ${f.x}`,className:`h-auto w-full text-accent`,children:[[.25,.5,.75].map(e=>(0,Z.jsx)(`line`,{x1:`0`,x2:600,y1:(i-20)*e+4,y2:(i-20)*e+4,className:`stroke-line-soft`,strokeWidth:`1`},e)),(0,Z.jsx)(`path`,{d:`M${d.join(` L`)} L${l(e.length-1)},${i-20} L${l(0)},${i-20} Z`,fill:`currentColor`,fillOpacity:`0.1`}),(0,Z.jsx)(`polyline`,{points:d.join(` `),fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,Z.jsx)(`circle`,{cx:l(e.length-1),cy:u(f.y),r:`4`,fill:`currentColor`,className:`stroke-bg`,strokeWidth:`2`})]}),(0,Z.jsxs)(`figcaption`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0].x}),(0,Z.jsxs)(`span`,{className:`font-medium text-ink`,children:[n(f.y),` now`]}),(0,Z.jsx)(`span`,{children:f.x})]})]})}function Re({items:e,series:t,label:n}){let r=Math.max(1,...e.flatMap(e=>e.values));return(0,Z.jsxs)(`figure`,{className:`m-0 flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-4 text-[13px] text-ink-2`,children:t.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:k(`inline-block size-[10px] rounded-[3px]`,e.className),"aria-hidden":`true`}),e.name]},e.name))}),(0,Z.jsx)(`div`,{role:`img`,"aria-label":`${n}: ${e.map(e=>`${e.x} ${e.values.join(` and `)}`).join(`; `)}`,className:`flex h-[140px] items-end gap-2 border-b border-line`,children:e.map(e=>(0,Z.jsx)(`span`,{className:`flex h-full flex-1 items-end justify-center gap-1`,"data-tip":`${e.x}: ${e.values.map((e,n)=>`${t[n]?.name.toLowerCase()} ${e}`).join(`, `)}`,children:e.values.map((e,n)=>(0,Z.jsx)(`span`,{className:k(`w-full max-w-[14px] rounded-t-[4px]`,t[n]?.className),style:{height:`${Math.max(e?3:0,e/r*100)}%`}},n))},e.x))}),(0,Z.jsxs)(`span`,{className:`flex justify-between text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{children:e[0]?.x}),(0,Z.jsx)(`span`,{children:e.at(-1)?.x})]})]})}function ze({label:e,part:t,whole:n,className:r=`bg-accent`}){let i=n?Math.round(t/n*100):0;return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr_auto] items-center gap-4 text-[13px]`,children:[(0,Z.jsx)(Q,{text:e,className:`text-ink-2`}),(0,Z.jsx)(`span`,{className:`h-2 overflow-hidden rounded-full bg-surface-strong`,role:`img`,"aria-label":`${e}: ${t} of ${n}`,children:(0,Z.jsx)(`span`,{className:k(`block h-full rounded-full`,r),style:{width:`${i}%`}})}),(0,Z.jsxs)(`span`,{className:`w-[86px] text-right tabular-nums text-ink-2`,children:[t,` of `,n]})]})}function Be({open:e,onClose:t,title:n,preview:r,onStarted:i}){let[a,o]=(0,J.useState)(null),[s,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(d(null),p(``),Y.suites().then(e=>{o({list:e.environments,...e.active?{active:e.active}:{}}),l(e.active&&e.environments.includes(e.active)?e.active:e.environments[0]??``)},e=>p(e.message)))},[e]),(0,J.useEffect)(()=>{e&&a!==null&&r(s||void 0,!1).then(e=>{d(e.preview??null),p(``)},e=>p(e.message))},[e,s,a]);let g=async()=>{h(!0);try{await r(s||void 0,!0),i(),t()}catch(e){p(e.message)}finally{h(!1)}};return(0,Z.jsx)(B,{open:e,onClose:t,title:n,description:`ForgeQE runs these with forgeqe suite, on the environment you pick here. Results go to Runs and back to each case's system, as your settings say.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:t,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:m||!u,onClick:()=>void g(),"data-tip":`Start the run`,children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Run `,u?u.cases:``]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[a&&a.list.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Environment`,(0,Z.jsx)(N,{value:s,onChange:e=>l(e.target.value),children:a.list.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))})]}),u&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 text-ink-2`,children:[u.cases,` test case`,u.cases===1?``:`s`,` on `,u.env??`the active environment`,`.`]}),f&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:f})]})})}var Ve=e=>e.lastRun.outcome===`failed`||e.lastRun.outcome===`blocked`,He=e=>F(`test-management`,`cases`,encodeURIComponent(e));function Ue({cases:e,onChanged:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),m=()=>Y.tests().then(e=>{i(e),o(``)},e=>o(e.message));(0,J.useEffect)(()=>{m()},[]),(0,J.useEffect)(()=>{if(!r?.busy)return;let e=setInterval(()=>void m(),3e3);return()=>clearInterval(e)},[r?.busy]),Ge(r?.busy??null,()=>n(`Done: the tests and their links are up to date.`));let h=(0,J.useMemo)(()=>new Map(e.map(e=>[e.key,e])),[e]);if(a)return(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:a});if(!r)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=r.tests.filter(e=>e.uid),_={all:g.length,unlinked:g.filter(e=>!e.cases.length).length,linked:g.filter(e=>e.cases.length).length,code:g.filter(e=>e.via===`code`).length},v=g.filter(e=>s===`all`||(s===`unlinked`?!e.cases.length:s===`linked`?e.cases.length>0:e.via===`code`)),y=async()=>{try{n(`The mapping agent is looking at ${(await Y.proposeLinks()).cases} cases with no test.`),m()}catch(e){n(e.message)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(L,{variant:`primary`,onClick:()=>u(!0),disabled:!!r.busy,children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),`Discover tests`]}),(0,Z.jsxs)(L,{onClick:()=>void y(),disabled:!!r.busy||!g.length,"data-tip":`The mapping agent links cases that have no test to the tests that check them`,children:[(0,Z.jsx)(E,{"aria-hidden":`true`}),`Link with the agent`]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[r.busy?r.busy.what===`discover`?`Discovering tests, started ${K(r.busy.started)}…`:`The mapping agent is at work, started ${K(r.busy.started)}…`:r.discovery?`Discovered ${K(r.discovery.at)}.`:`Not discovered yet: these are read from the code.`,r.proposed>0&&` ${r.proposed} link${r.proposed===1?``:`s`} proposed, waiting on the cases' pages.`]})]}),r.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:r.error}),r.discovery&&r.discovery.projects.length>0&&(0,Z.jsx)(Ke,{projects:r.discovery.projects}),g.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(oe,{items:[{id:`all`,label:`All`,n:_.all},{id:`unlinked`,label:`No test case`,n:_.unlinked},{id:`linked`,label:`Linked`,n:_.linked},{id:`code`,label:`Read from the code`,n:_.code,tip:`Their framework was not asked, or could not list them`}],value:s,onChange:c})}),(0,Z.jsx)(V,{label:`Automated tests`,placeholder:`Find a test by id, name, file or tag`,resetKey:s,empty:`No test matches.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[45%]`),children:`Test`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Framework`}),(0,Z.jsx)(`th`,{className:R,children:`Test cases`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @3xl:table-cell`),children:`Tags`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:v.map(t=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:k(H,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.nativeId??t.name}),(0,Z.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:t.uid}),t.file&&(0,Z.jsxs)(`span`,{className:`truncate font-mono`,children:[t.file,t.line?`:${t.line}`:``]}),t.flaky&&(0,Z.jsx)(j,{tone:`warn`,children:`Flaky`})]})]}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] @2xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Z.jsxs)(`span`,{children:[We[t.framework??`code`],t.framework===`gherkin`?`, ${t.runner??`no runner found`}`:``]}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:ve[t.via??`runs`]})]})}),(0,Z.jsx)(`td`,{className:k(H,`text-[13px]`),children:t.cases.length?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2`,children:[t.cases.slice(0,4).map(e=>(0,Z.jsx)(`a`,{href:He(e),className:`font-mono`,"data-tip":h.get(e)?.title,children:h.get(e)?.id??e},e)),t.cases.length>4&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`+`,t.cases.length-4]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,Z.jsx)(`td`,{className:k(H,`hidden @3xl:table-cell`),children:(0,Z.jsx)(Ie,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:k(H,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Fe,{runs:t.runs})}),(0,Z.jsx)(`td`,{className:k(H,`text-right`),children:(0,Z.jsxs)(L,{size:`sm`,onClick:()=>p(t),"aria-label":`Link ${t.name} to a test case`,disabled:!e.length,children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Link`]})})]},t.uid))})]}):(0,Z.jsx)(M,{icon:d,title:`No automated test found yet`,children:`Discover tests asks each test project's framework (pytest, .NET, Playwright, Vitest, Jest, Mocha, Robot Framework) for its tests. Set the automation repository in Settings › Code first.`}),(0,Z.jsx)(qe,{open:l,onClose:()=>u(!1),onStarted:()=>{u(!1),n(`Discovering tests: each project's framework lists its tests.`),m()}}),(0,Z.jsx)(Je,{open:!!f,title:`Link to a test case`,description:f?`Pick the test case ${f.name} checks. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`:void 0,items:e.filter(e=>!f?.cases.includes(e.key)).map(e=>({id:e.key,label:e.title,sub:e.id})),onClose:()=>p(null),onPick:async e=>{f?.uid&&(await Y.link([{case:e,test:f.uid,action:`link`}]),p(null),n(`Linked ${f.uid} to ${h.get(e)?.id??e}.`),m())}})]})}var We={pytest:`pytest`,dotnet:`.NET`,playwright:`Playwright`,jest:`Jest`,vitest:`Vitest`,mocha:`Mocha`,robot:`Robot Framework`,gherkin:`Gherkin`,code:`Code`};function Ge(e,t){let[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{e?r(!0):n&&(r(!1),t())},[e]),n}function Ke({projects:e}){return(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2`,children:[e.ok?(0,Z.jsx)(i,{size:14,"aria-label":`Listed`,className:`mt-1 flex-none text-pass`}):(0,Z.jsx)(_,{size:14,"aria-label":`Not listed`,className:`mt-1 flex-none text-warn`}),(0,Z.jsxs)(`span`,{children:[e.label,` in `,e.dir?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.dir}):`the repository's root`,`: `,e.ok?`${e.tests} test${e.tests===1?``:`s`}`:`not listed by its framework, read from the code`,e.error&&(0,Z.jsx)(`span`,{className:`block text-muted [overflow-wrap:anywhere]`,children:e.error})]})]},`${e.framework}-${e.dir}-${t}`))})}function qe({open:e,onClose:t,onStarted:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(i(null),o(``),Y.discoveryPlan().then(i,e=>o(e.message)))},[e]);let l=async()=>{if(r){c(!0);try{await Y.discover(r.digest),n()}catch(e){o(e.message)}finally{c(!1)}}};return(0,Z.jsx)(B,{open:e,onClose:t,title:`Discover tests`,description:`Each test project's framework lists its tests, as a test explorer asks it. This runs the repository's code (pytest imports conftest.py, .NET builds the project) with no secret of ForgeQE's, so look at what will run first.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{onClick:t,children:`Cancel`}),(0,Z.jsxs)(L,{variant:`primary`,onClick:()=>void l(),disabled:!r||s,children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Discover`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 text-[13px]`,children:[a&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:a}),!r&&!a&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-muted`,children:`Finding the test projects…`}),r&&!r.steps.length&&(0,Z.jsx)(`p`,{className:`m-0 text-ink-2`,children:`No test project was found whose framework can be asked. Gherkin features and the code are still read.`}),r&&r.steps.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:r.steps.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{children:[We[e.project.framework],` in `,e.project.dir?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.project.dir}):`the repository's root`]}),(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})]},t))})]})})}function Je({open:e,title:t,description:n,items:r,onClose:i,onPick:a}){let[o,s]=(0,J.useState)(``),[c,u]=(0,J.useState)(``);(0,J.useEffect)(()=>s(``),[e]);let d=async e=>{u(e),s(``);try{await a(e)}catch(e){s(e.message)}finally{u(``)}};return(0,Z.jsx)(B,{open:e,onClose:i,title:t,description:n,wide:!0,footer:(0,Z.jsx)(L,{onClick:i,children:`Close`}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o&&(0,Z.jsxs)(`p`,{role:`alert`,className:`m-0 flex items-center gap-2 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(l,{size:14,"aria-hidden":`true`}),o]}),(0,Z.jsx)(V,{label:t,placeholder:`Find by id or words`,resetKey:String(e),empty:`Nothing to pick.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:R,children:`Name`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Pick`})})]}),children:r.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:k(H,`max-w-0`),children:[(0,Z.jsx)(Q,{text:e.label}),e.sub&&(0,Z.jsx)(`span`,{className:`block truncate font-mono text-[13px] text-muted`,children:e.sub})]}),(0,Z.jsx)(`td`,{className:k(H,`w-24 text-right`),children:(0,Z.jsxs)(L,{size:`sm`,onClick:()=>void d(e.id),disabled:!!c,children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Link`]})})]},e.id))})]})})}var Ye=e=>e&&/^https:\/\//i.test(e)?e:void 0;function Xe({caseKey:e,onRun:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{r(null),Y.case(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);let d=(0,Z.jsxs)(`a`,{href:F(`test-management`,`cases`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(m,{size:14,"aria-hidden":`true`}),`Test cases`]});if(i)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:i})]});if(!n)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let p=n.case,g=Ye(p.url);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[d,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_420px] flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:p.id}),` · `,p.plans.join(`, `)||`Not in a synced plan`]}),(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:p.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[p.priority&&(0,Z.jsxs)(j,{tone:p.priority===1?`fail`:p.priority===2?`warn`:`neutral`,icon:!1,children:[`Priority `,p.priority]}),p.state&&(0,Z.jsx)(j,{tone:`neutral`,children:p.state}),(0,Z.jsx)(Ne,{a:p.automation}),p.origin===`forgeqe`&&(0,Z.jsxs)(j,{tone:`running`,icon:!1,children:[(0,Z.jsx)(E,{size:12,"aria-hidden":`true`}),`Written by ForgeQE`,p.createdAt?` ${K(p.createdAt)}`:``]})]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[g&&(0,Z.jsxs)(`a`,{className:re(),href:g,target:`_blank`,rel:`noreferrer noopener`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Open in its system`]}),p.how!==`none`&&p.how!==`tracker`&&!!p.test?.file&&p.trackerAutomated!==!0&&(0,Z.jsxs)(L,{onClick:()=>s(`automation`),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Mark automated in its system`]}),p.ownTags.some(e=>!p.trackerTags.includes(e))&&(0,Z.jsxs)(L,{onClick:()=>s(`tags`),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Write tags to its system`]}),p.ownTags.some(e=>p.trackerTags.includes(e))&&(0,Z.jsxs)(L,{onClick:()=>s(`untag`),children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Take tags off in its system`]}),(0,Z.jsxs)(L,{variant:`primary`,onClick:()=>t([p.key]),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Run`]})]})]}),(0,Z.jsx)(ke,{kind:o,keys:[p.key],onClose:()=>s(null),onDone:t=>(l(t),void Y.case(e).then(r,()=>{}))}),c&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2`,children:c}),(p.stale||p.drift)&&(0,Z.jsxs)(`p`,{role:`status`,className:`m-0 flex items-start gap-2 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px] text-warn`,children:[(0,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,Z.jsxs)(`span`,{children:[p.stale&&`Its steps changed in its system after its test was written: the next run updates the test. `,p.drift&&(p.trackerAutomated?`Its system marks it automated, but ForgeQE knows no test for it.`:`ForgeQE has a test for it, but its system does not mark it automated.`)]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsx)(V,{label:`Steps`,search:!1,empty:`Its system holds no steps for it, or it is not in a synced plan.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-10`),children:`#`}),(0,Z.jsx)(`th`,{className:R,children:`Action`}),(0,Z.jsx)(`th`,{className:R,children:`Expected result`})]}),children:n.steps.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,Z.jsx)(`td`,{className:k(H,`text-[13px] text-muted tabular-nums`),children:t+1}),(0,Z.jsx)(`td`,{className:k(H,`text-[13px] [overflow-wrap:anywhere]`),children:e.action}),(0,Z.jsx)(`td`,{className:k(H,`text-[13px] text-ink-2 [overflow-wrap:anywhere]`),children:e.expected??`–`})]},t))}),(0,Z.jsx)(Ze,{detail:n,onChanged:t=>(l(t),void Y.case(e).then(r,()=>{}))})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Details`}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[96px_1fr] gap-x-4 gap-y-2`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Last run`}),(0,Z.jsxs)(`dd`,{className:`m-0 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Pe,{o:p.lastRun.outcome}),p.lastRun.at&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[K(p.lastRun.at),p.lastRun.by===`tracker`?`, in its system`:``]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Suite`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:p.suite??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Area`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:p.group??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Stories`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:p.stories.join(`, `)||`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Tags`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:p.tags.length?(0,Z.jsx)(Ie,{tags:p.tags,max:10}):`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Steps`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:p.steps})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(f,{size:16,"aria-hidden":`true`}),`In suites and packs`]}),n.suites.length||p.packs.length?(0,Z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:[n.suites.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:F(`test-management`,`suites`,e.id),children:e.name})},e.id)),p.packs.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:F(`regression`,e),children:[`Pack `,e]})},e))]}):(0,Z.jsx)(`p`,{className:`m-0 text-muted`,children:`In no suite or regression pack.`})]}),n.changes.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`What ForgeQE did`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:n.changes.map((e,t)=>(0,Z.jsxs)(`li`,{className:`[overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.at)}),` `,e.action,e.story?` for ${e.story}`:``,e.reason?`: ${e.reason}`:``]},t))})]})]})]})]})}function Ze({detail:e,onChanged:t}){let n=e.case,[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{(n.proposed.length||a)&&Y.tests().then(e=>i(e.tests),()=>{})},[n.proposed.length,a]);let u=new Map((r??[]).filter(e=>e.uid).map(e=>[e.uid,e])),f=async(e,r,i)=>{l(``);try{await Y.link([{case:n.key,test:e,action:r}]),t(i)}catch(e){l(e.message)}},p=async e=>{l(``);try{t(`${e} is the main test now${(await Y.setMain(n.key,e)).mapped?`, and ForgeQE's mapping records it`:``}. Mark automated writes it to the tracker.`)}catch(e){l(e.message)}},m=async()=>{l(``);try{await Y.proposeLinks([n.key]),t(`The mapping agent is looking for this case's tests. Open the case again in a moment.`)}catch(e){l(e.message)}};return(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-[16px] font-semibold`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`}),`Automated tests`]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>o(!0),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Link a test`]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>void m(),"data-tip":`The mapping agent picks the tests that check this case`,children:[(0,Z.jsx)(E,{"aria-hidden":`true`}),`Ask the agent`]})]}),s&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),n.tests.length?(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:n.tests.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-start gap-2 border-t border-line-soft py-2 first:border-t-0`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 [overflow-wrap:anywhere]`,children:[e.name,e.main&&n.tests.length>1&&(0,Z.jsx)(`span`,{"data-tip":`What its tracker records as its automated test, and what a run reuses first`,children:(0,Z.jsx)(j,{tone:`pass`,icon:!1,children:`Main test`})})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[13px] text-muted`,children:[e.uid&&(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.uid}),e.file&&(0,Z.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:e.file})]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[_e[e.how],e.why&&e.why!==_e[e.how]?`: ${e.why}`:``]})]}),e.uid&&n.tests.length>1&&!e.main&&(0,Z.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void p(e.uid),"aria-label":`Make ${e.name} the main test`,"data-tip":`Its tracker records this one as the case's automated test`,children:[(0,Z.jsx)(v,{"aria-hidden":`true`}),`Make main`]}),e.uid&&e.how!==`mapping`&&(0,Z.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void f(e.uid,`unlink`,`Unlinked ${e.uid}. It is not linked again by itself.`),"aria-label":`Unlink ${e.name}`,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Unlink`]})]},e.uid??e.key))}):n.test?(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[120px_1fr] gap-x-4 gap-y-2 text-[13px]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Test`}),(0,Z.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:n.test.name}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`File`}),(0,Z.jsx)(`dd`,{className:`m-0 font-mono [overflow-wrap:anywhere]`,children:n.test.file??`–`}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Known from`}),(0,Z.jsx)(`dd`,{className:`m-0`,children:n.how===`none`?`–`:_e[n.how]})]}):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No automated test is linked. Link one, ask the agent, or ask the agent on the right to automate it.`}),(n.tests.length>0||n.test)&&(0,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[`Last runs `,(0,Z.jsx)(Fe,{runs:e.test?.runs??n.runs})]}),n.proposed.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Proposed by the mapping agent`}),n.proposed.map(e=>{let t=u.get(e.test);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t?.name??e.test}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.test}),e.confidence?` · ${e.confidence} confidence`:``,e.why?` · ${e.why}`:``]})]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>void f(e.test,`accept`,`Linked ${e.test}.`),children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),`Accept`]}),(0,Z.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>void f(e.test,`refuse`,`Refused ${e.test}.`),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Refuse`]})]},e.test)})]}),(0,Z.jsx)(Je,{open:a,title:`Link a test`,description:`Pick a test that checks ${n.id}. It is kept in .forgeqe/testmgmt/links.json, shared with the team.`,items:(r??[]).filter(e=>e.uid&&!n.tests.some(t=>t.uid===e.uid)).map(e=>({id:e.uid,label:e.name,sub:`${e.uid}${e.file?` · ${e.file}`:``}`})),onClose:()=>o(!1),onPick:async e=>{await Y.link([{case:n.key,test:e,action:`link`}]),o(!1),t(`Linked ${e}.`)}})]})}var Qe=[{id:`all`,label:`All`,icon:S,test:()=>!0},{id:`not_automated`,label:`Not automated`,icon:o,test:e=>e.automation===`not_automated`},{id:`failing`,label:`Failing`,icon:l,test:Ve,alert:!0},{id:`pending`,label:`Pending`,icon:s,test:e=>e.automation===`pending`},{id:`generated`,label:`Generated by ForgeQE`,icon:E,test:e=>e.origin===`forgeqe`},{id:`stale`,label:`Steps changed`,icon:_,test:e=>e.stale},{id:`drift`,label:`Tracker disagrees`,icon:_,test:e=>e.drift}],$=``,$e=e=>[...new Set(e.filter(e=>!!e))].sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}));function et({cases:e,tests:t=0,selected:n,onSelect:r,onRun:i,onChanged:a}){let[o,s]=(0,J.useState)(`all`),[l,d]=(0,J.useState)($),[p,m]=(0,J.useState)($),[h,g]=(0,J.useState)($),[_,v]=(0,J.useState)($),[ee,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(!1),[w,te]=(0,J.useState)(null),T=(0,J.useMemo)(()=>$e(e.flatMap(e=>e.plans)),[e]),D=(0,J.useMemo)(()=>$e(e.map(e=>e.suite)),[e]),O=(0,J.useMemo)(()=>$e(e.flatMap(e=>e.tags)),[e]),ne=e.filter(e=>(!l||e.plans.includes(l))&&(!p||e.suite===p)&&(!h||String(e.priority??``)===h)&&(!_||e.tags.includes(_))),re=Qe.find(e=>e.id===o),A=ne.filter(re.test),j=new Set(n),ie=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e)),ae=A.length>0&&A.every(e=>j.has(e.key));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.length>0&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-4 py-2 text-[13px] text-accent-fg`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[n.length,` selected`]}),(0,Z.jsxs)(L,{size:`sm`,variant:`ghost`,onClick:()=>r([]),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Clear`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>x(!0),children:[(0,Z.jsx)(y,{"aria-hidden":`true`}),`Tag`]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>C(!0),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Make a suite`]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>te(`automation`),"data-tip":`Mark the picked cases automated in their tracker`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Mark automated`]}),(0,Z.jsxs)(L,{size:`sm`,onClick:()=>te(`tags`),"data-tip":`Write ForgeQE's tags to their tracker`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),`Write tags`]}),(0,Z.jsxs)(L,{size:`sm`,variant:`primary`,onClick:()=>i(n),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Run `,n.length]})]}),(0,Z.jsx)(V,{label:`Test cases`,placeholder:`Find a case by id, title, tag or test`,resetKey:`${o}|${l}|${p}|${h}|${_}`,empty:e.length?`Nothing matches.`:t?`No test cases yet. The repository's ${t} automated test${t===1?` is`:`s are`} on the Automated tab.`:`No test cases yet.`,tools:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(oe,{items:Qe.map(e=>({id:e.id,label:e.label,icon:e.icon,n:ne.filter(e.test).length,...e.alert?{alert:!0}:{}})),value:o,onChange:s})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>1&&(0,Z.jsxs)(N,{size:`sm`,"aria-label":`Plan`,value:l,onChange:e=>d(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every plan`}),T.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),D.length>0&&(0,Z.jsxs)(N,{size:`sm`,"aria-label":`Suite`,value:p,onChange:e=>m(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Every suite`}),D.map(e=>(0,Z.jsx)(`option`,{children:e},e))]}),(0,Z.jsxs)(N,{size:`sm`,"aria-label":`Priority`,value:h,onChange:e=>g(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any priority`}),[`1`,`2`,`3`,`4`].map(e=>(0,Z.jsxs)(`option`,{value:e,children:[`Priority `,e]},e))]}),O.length>0&&(0,Z.jsxs)(N,{size:`sm`,"aria-label":`Tag`,value:_,onChange:e=>v(e.target.value),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:$,children:`Any tag`}),O.map(e=>(0,Z.jsx)(`option`,{children:e},e))]})]})]}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:ae,onCheckedChange:e=>r(e?$e([...n,...A.map(e=>e.key)]):n.filter(e=>!A.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{className:R,children:`Test case`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Suite`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{className:R,children:`Automation`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @4xl:table-cell`),children:`Last runs`}),(0,Z.jsx)(`th`,{className:R,children:`Last run`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:A.map(e=>(0,Z.jsxs)(`tr`,{className:k(`border-t border-line-soft align-top hover:bg-surface-muted`,j.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:j.has(e.key),onCheckedChange:t=>ie(e.key,t)})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsxs)(`a`,{href:He(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.origin===`forgeqe`&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"data-tip":`ForgeQE wrote this case`,children:[(0,Z.jsx)(E,{size:12,"aria-hidden":`true`}),`ForgeQE`]}),e.stories[0]&&(0,Z.jsx)(`span`,{children:e.stories[0]}),(0,Z.jsx)(Ie,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:k(H,`hidden max-w-0 text-[13px] text-ink-2 @2xl:table-cell`),children:(0,Z.jsx)(Q,{text:e.suite??e.plans[0]??`–`})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsxs)(`td`,{className:H,children:[(0,Z.jsx)(Ne,{a:e.automation}),e.stale&&(0,Z.jsx)(`span`,{className:`mt-1 block text-[13px] text-warn`,children:`Steps changed`})]}),(0,Z.jsx)(`td`,{className:k(H,`hidden @4xl:table-cell`),children:(0,Z.jsx)(Fe,{runs:e.runs})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(`span`,{"data-tip":e.lastRun.at?`${K(e.lastRun.at)}${e.lastRun.by===`tracker`?`, in its system`:``}`:void 0,children:(0,Z.jsx)(Pe,{o:e.lastRun.outcome})})}),(0,Z.jsx)(`td`,{className:k(H,`text-right whitespace-nowrap`),children:(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":Ve(e)?`Run again`:`Run`,onClick:()=>i([e.key]),children:(0,Z.jsx)(b,{"aria-hidden":`true`})})})]},e.key))}),(0,Z.jsx)(ke,{kind:w,keys:n,onClose:()=>te(null),onDone:e=>a(e)}),(0,Z.jsx)(tt,{open:ee,keys:n,onClose:()=>x(!1),onDone:e=>a(e)}),(0,Z.jsx)(nt,{open:S,keys:n,onClose:()=>C(!1),onDone:e=>a(e)})]})}function tt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),p=async()=>{f(!0),u(``);try{let e={[o?`remove`:`add`]:[i.trim()],cases:t};await Y.tag(e);let s=await Y.tag(e,!0);r(`${o?`Removed`:`Added`} the tag ${i.trim()} ${o?`from`:`on`} ${s.changed??0} case${s.changed===1?``:`s`}.`),a(``),n()}catch(e){u(e.message)}finally{f(!1)}};return(0,Z.jsx)(B,{open:e,onClose:n,title:`Tag ${t.length} test case${t.length===1?``:`s`}`,description:`ForgeQE keeps its tags in .forgeqe/testmgmt/tags.json, shared with the team through the repository. The case's own tags in its system do not change.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:n,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:d||!i.trim(),onClick:()=>void p(),children:[(0,Z.jsx)(y,{"aria-hidden":`true`}),o?`Remove`:`Add`,` tag`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Tag`,(0,Z.jsx)(A,{value:i,maxLength:40,placeholder:`smoke, release-24.11`,onChange:e=>a(e.target.value)})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(q,{checked:o,onCheckedChange:s}),`Remove it instead`]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}function nt({open:e,keys:t,onClose:n,onDone:r}){let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),s(``);try{let{suite:e}=await Y.saveSuite({name:i.trim(),groups:[],exclude:[],picked:t});r(`Made the suite ${e.name}.`),a(``),n(),location.hash=F(`test-management`,`suites`,e.id)}catch(e){s(e.message)}finally{u(!1)}};return(0,Z.jsx)(B,{open:e,onClose:n,title:`A suite of ${t.length} test case${t.length===1?``:`s`}`,description:`Kept in .forgeqe/testmgmt/suites.json. For a suite that keeps up as plans change, ask the Suite agent on Suites.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:n,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:l||!i.trim(),onClick:()=>void d(),children:[(0,Z.jsx)(f,{"aria-hidden":`true`}),`Make the suite`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Name`,(0,Z.jsx)(A,{value:i,maxLength:80,placeholder:`Saved cards`,onChange:e=>a(e.target.value)})]}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:o})]})})}var rt=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString([],{month:`short`,day:`numeric`,timeZone:`UTC`}),it=(e,t)=>t?Math.round(e/t*100):0;function at(e,t,n){if(e.length<2)return;let r=e.at(-1),i=new Date(`${r.day}T00:00:00Z`).getTime()-6048e5,a=[...e].reverse().find(e=>new Date(`${e.day}T00:00:00Z`).getTime()<=i)??e[0],o=t(r)-t(a);return{text:`${o>0?`+`:``}${o}`,dir:o>0?`up`:o<0?`down`:`same`,...n===void 0||o===0?{}:{good:o>0===n},against:`since ${rt(a.day)}`}}function ot({view:e,onRunSuite:t}){let n=e.summary;if(!n.cases&&!e.plans.length&&n.tests)return(0,Z.jsx)(M,{icon:d,title:`${n.tests} automated test${n.tests===1?``:`s`} found, no test case yet`,action:(0,Z.jsxs)(`a`,{className:re({size:`sm`}),href:F(`test-management`,`tests`),"data-tip":`Open the Automated tab`,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`See the tests`]}),children:`These are the tests in the automation repository's code. Add a test plan in Settings › Integrations (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest) to see the test cases they cover, which are automated and which are not.`});if(!n.cases&&!e.plans.length)return(0,Z.jsx)(M,{icon:S,title:`No test plans connected yet`,action:(0,Z.jsxs)(`a`,{className:re({size:`sm`}),href:F(`settings`,`integrations`),"data-tip":`Open Settings, Integrations`,children:[(0,Z.jsx)(C,{"aria-hidden":`true`}),`Settings`]}),children:`Add a test plan under Test plans in Test management, in your test case system's settings (Azure DevOps, Xray, TestRail, Zephyr Scale or qTest). Its cases show here with their automation, runs and gaps. Cases ForgeQE wrote or automated show here already.`});let r=e.trend;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(le,{label:`Headline numbers`,children:[(0,Z.jsx)(G,{label:`Test cases`,icon:S,value:n.cases,change:at(r,e=>e.cases,void 0),note:`${e.plans.length} plan${e.plans.length===1?``:`s`}`}),(0,Z.jsx)(G,{label:`Automated`,icon:i,value:`${n.automated} · ${it(n.automated,n.cases)}%`,change:at(r,e=>e.automated,!0),note:`${n.newlyAutomated} newly this week`}),(0,Z.jsx)(G,{label:`Not automated`,icon:o,value:n.notAutomated,change:at(r,e=>e.notAutomated,!1)}),(0,Z.jsx)(G,{label:`Pending`,icon:s,value:n.pending,tone:n.pending?`text-warn`:void 0,change:at(r,e=>e.pending,!1),note:`in Design or not ready`}),(0,Z.jsx)(G,{label:`Failing`,icon:l,value:n.failing,tone:n.failing?`text-fail`:void 0,change:at(r,e=>e.failing,!1),note:`their last run`}),(0,Z.jsx)(G,{label:`Generated by ForgeQE`,icon:E,value:n.generated,change:at(r,e=>e.generated,!0)})]}),(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automation coverage`}),(0,Z.jsx)(Le,{label:`Share of test cases automated`,points:r.map(e=>({x:rt(e.day),y:it(e.automated,e.cases)})),format:e=>`${e}%`})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Generated and automated, by week`}),(0,Z.jsx)(Re,{label:`Test cases generated and automated each week`,series:[{name:`Generated`,className:`bg-accent-line`},{name:`Automated`,className:`bg-accent`}],items:e.weekly.map(e=>({x:rt(e.week),values:[e.generated,e.automated]}))})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Last run of every case`}),(0,Z.jsxs)(`div`,{role:`img`,"aria-label":`Passed ${n.cases-n.failing-n.neverRun}, failing ${n.failing}, not run ${n.neverRun}`,className:`flex h-3 gap-1 overflow-hidden rounded-full`,children:[(0,Z.jsx)(`span`,{className:`bg-pass`,style:{flex:n.cases-n.failing-n.neverRun}}),(0,Z.jsx)(`span`,{className:`bg-fail`,style:{flex:n.failing}}),(0,Z.jsx)(`span`,{className:`bg-line-strong`,style:{flex:n.neverRun}})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-4 text-[13px]`,children:[(0,Z.jsx)(`a`,{href:F(`test-management`,`cases`),className:`no-underline`,children:(0,Z.jsxs)(j,{tone:`pass`,children:[`Passed `,n.cases-n.failing-n.neverRun]})}),(0,Z.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(j,{tone:`fail`,children:[`Failing `,n.failing]})}),(0,Z.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`no-underline`,children:(0,Z.jsxs)(j,{tone:`neutral`,children:[`Not run `,n.neverRun]})})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline justify-between gap-4`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Automated, by suite`}),(0,Z.jsx)(`a`,{href:F(`test-management`,`gaps`),className:`text-[13px]`,children:`Find gaps`})]}),e.coverage.length?e.coverage.slice(0,8).map(e=>(0,Z.jsx)(ze,{label:e.suite,part:e.automated,whole:e.cases},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No suites yet.`})]})]}),(0,Z.jsx)(V,{label:`Suites`,placeholder:`Find a suite`,empty:`No suites yet: ask the Suite agent for one on Suites.`,search:e.suites.length>8,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:R,children:`Suite`}),(0,Z.jsx)(`th`,{className:U,children:`Cases`}),(0,Z.jsx)(`th`,{className:R,children:`Last run`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.suites.map(e=>(0,Z.jsxs)(`tr`,{className:W,onClick:()=>location.hash=F(`test-management`,`suites`,e.id),children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(`a`,{href:F(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium`,children:e.name})}),(0,Z.jsx)(`td`,{className:z,children:e.cases}),(0,Z.jsx)(`td`,{className:H,children:e.last?(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,Z.jsxs)(j,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:`${H} text-right whitespace-nowrap`,onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})}),(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Z.jsx)(b,{"aria-hidden":`true`})})]})]},e.id))}),(0,Z.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(d,{size:14,"aria-hidden":`true`}),n.tests,` automated tests known, `,n.testsWithoutCase,` with no test case behind them.`]})]})}var st=e=>e&&/^https:\/\//i.test(e)?e:void 0;function ct({id:e,title:t,url:n}){let r=st(n);return(0,Z.jsxs)(`span`,{className:`flex min-w-[220px] flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:t}),r?(0,Z.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-[13px] text-accent-fg`,children:e}):(0,Z.jsx)(`span`,{className:`font-mono text-[13px] text-accent-fg`,children:e})]})}var lt={azure_devops:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`iteration`,label:`Iteration path`,placeholder:`Shop\\Release 3`},{key:`area`,label:`Area path`,placeholder:`Shop\\Checkout`},{key:`parent`,label:`Epic or feature`,placeholder:`1234`,number:!0},{key:`ids`,label:`Work item ids`,placeholder:`101, 102`,list:`numbers`},{key:`project`,label:`Project`,placeholder:`When Settings names none`}],jira:[{key:`sprint`,label:`Sprint`,placeholder:`current, or Sprint 24`},{key:`fixVersion`,label:`Fix version`,placeholder:`2.4.0`},{key:`epic`,label:`Epic`,placeholder:`SHOP-12`},{key:`keys`,label:`Story keys`,placeholder:`SHOP-101, SHOP-102`,list:`keys`},{key:`project`,label:`Project key`,placeholder:`SHOP`}],qtest:[{key:`module`,label:`Requirements module`,placeholder:`Module id, e.g. 1203`,number:!0},{key:`ids`,label:`Requirement ids`,placeholder:`5101, 5102`,list:`numbers`}]};function ut(e,t){let n={system:e};for(let r of lt[e]){let i=(t[r.key]??``).trim();i&&(r.list===`numbers`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(Number):r.list===`keys`?n[r.key]=i.split(/[\s,]+/).filter(Boolean).map(e=>e.toUpperCase()):r.number?n[r.key]=Number(i):n[r.key]=r.key===`project`&&e===`jira`?i.toUpperCase():i)}return n}var dt=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>e!==`system`).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]));function ft({gaps:e,onRead:t}){let[r,i]=(0,J.useState)(e.live?.system??`azure_devops`),[a,o]=(0,J.useState)(dt(e.live)),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``);(0,J.useEffect)(()=>{e.live&&(i(e.live.system),o(dt(e.live)))},[e.live]);let d=async()=>{c(!0),u(``);try{await Y.readStories(ut(r,a)),t()}catch(e){u(e.message)}finally{c(!1)}};return(0,Z.jsxs)(`form`,{className:`card flex flex-col gap-4 rounded-[14px] border p-4`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:`Stories in`}),(0,Z.jsxs)(N,{size:`sm`,value:r,onChange:e=>(i(e.target.value),o({})),className:`w-auto`,children:[(0,Z.jsx)(`option`,{value:`azure_devops`,children:`Azure DevOps`}),(0,Z.jsx)(`option`,{value:`jira`,children:`Jira (also Xray and Zephyr Scale)`}),(0,Z.jsx)(`option`,{value:`qtest`,children:`qTest requirements`})]})]}),lt[r].map(e=>(0,Z.jsxs)(`label`,{className:`flex min-w-[140px] flex-[1_1_140px] flex-col gap-1 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,Z.jsx)(A,{size:`sm`,value:a[e.key]??``,maxLength:e.list?2e3:200,placeholder:e.placeholder,onChange:t=>o({...a,[e.key]:t.target.value})})]},e.key)),(0,Z.jsxs)(L,{size:`sm`,variant:`primary`,type:`submit`,disabled:s||!lt[r].some(e=>e.key!==`project`&&(a[e.key]??``).trim()),children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),s?`Reading…`:`Read stories`]})]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:l})]})}function pt({kind:e,gaps:t,picked:n=[],onPick:r=()=>{},onRead:i=()=>{}}){let a=(0,Z.jsx)(ft,{gaps:t,onRead:i});if(!t.report)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a,(0,Z.jsx)(M,{icon:x,title:`No stories read yet`,children:`Say which stories to read: a sprint, an iteration, an area, an epic or the ids. ForgeQE reads each story with its test cases and acceptance criteria from the tracker, as Release readiness does, and reads them again with every sync.`})]});let o=(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.report.id===`live`?`Read from the tracker${t.report.at?` ${K(t.report.at)}`:``}: ${t.report.scope}`:`From the readiness report of ${t.report.scope||t.report.id}`,` (`,t.stories,` stor`,t.stories===1?`y`:`ies`,`).`,e===`stories`&&n.length>0&&` ${n.length} picked for the Gap agent's "Cases for stories".`]}),s=new Set(t.noCase.map(e=>e.id)),c=new Set(n.filter(e=>s.has(e)));return e===`stories`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(V,{label:`Stories with no test case`,placeholder:`Find a story`,empty:`Every story of the release has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Pick every story shown`,checked:t.noCase.length>0&&t.noCase.every(e=>c.has(e.id)),onCheckedChange:e=>r(e?t.noCase.map(e=>e.id).slice(0,50):[])})}),(0,Z.jsx)(`th`,{className:k(R,`w-[55%]`),children:`Story`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Type`}),(0,Z.jsx)(`th`,{className:R,children:`State`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Area`})]}),children:t.noCase.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(q,{"aria-label":`Pick ${e.id}`,checked:c.has(e.id),onCheckedChange:t=>r(t?[...c,e.id].slice(0,50):[...c].filter(t=>t!==e.id))})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(ct,{id:e.id,title:e.title,url:e.url})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] @2xl:table-cell`),children:e.type||`–`}),(0,Z.jsx)(`td`,{className:H,children:e.state?(0,Z.jsx)(j,{tone:`neutral`,icon:!1,children:e.state}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] @2xl:table-cell [overflow-wrap:anywhere]`),children:e.area||`–`})]},e.id))})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o,(0,Z.jsx)(V,{label:`Acceptance criteria no test case covers`,placeholder:`Find a criterion`,empty:`Every traced acceptance criterion has a test case.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[55%]`),children:`Criterion`}),(0,Z.jsx)(`th`,{className:R,children:`Story`})]}),children:t.criteria.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:k(H,`[overflow-wrap:anywhere]`),children:e.text}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(ct,{id:e.story,title:e.storyTitle,url:e.url})})]},`${e.story}-${t}`))})]})}var mt=[{id:`stories`,label:`Stories with no case`,icon:x},{id:`criteria`,label:`Criteria not covered`,icon:S}],ht=[{id:`not_automated`,label:`Not automated`,icon:o},{id:`pending`,label:`Pending`,icon:s},{id:`never_run`,label:`Never run`,icon:o},{id:`failing`,label:`Failing`,icon:l,alert:!0},{id:`stale`,label:`Steps changed`,icon:_},{id:`drift`,label:`Tracker disagrees`,icon:_},{id:`no_case`,label:`Tests with no case`,icon:d}];function gt({gaps:e,cases:t,tests:n,selected:r,onSelect:i,onRun:a,pickedStories:o=[],onPickStories:s=()=>{},onStoriesRead:c=()=>{}}){let[l,u]=(0,J.useState)(t.length||!n.length?`not_automated`:`no_case`),d=new Map(t.map(e=>[e.key,e])),f=new Map(e.ranked.map(e=>[e.key,e.why])),p=l===`no_case`||l===`stories`||l===`criteria`?[]:l===`not_automated`?e.ranked.map(e=>e.key):e.lists[l],m=e.stories??{stories:0,noCase:[],criteria:[]},h={stories:m.noCase.length,criteria:m.criteria.length},g=p.map(e=>d.get(e)).filter(e=>!!e),_=new Set(r),v=(e,t)=>i(t?[...r,e]:r.filter(t=>t!==e));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-6 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(oe,{items:[...ht.map(t=>({id:t.id,label:t.label,icon:t.icon,n:e.counts[t.id],...t.alert?{alert:!0}:{}})),...mt.map(e=>({id:e.id,label:e.label,icon:e.icon,n:h[e.id],tip:m.report?m.report.id===`live`?`Read from the tracker: ${m.report.scope}`:`From the readiness report of ${m.report.scope||m.report.id}`:`Read the release's stories from the tracker first`}))],value:l,onChange:e=>u(e)})}),l===`not_automated`&&g.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-[13px] text-ink-2`,children:[`Highest value first: priority, failing when run, in a pack, tagged smoke.`,(0,Z.jsx)(L,{size:`sm`,onClick:()=>i(g.slice(0,20).map(e=>e.key)),children:`Pick the top 20`})]})]}),(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-4 rounded-[14px] border p-6`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[16px] font-semibold`,children:`Not automated, by suite`}),e.bySuite.length?e.bySuite.slice(0,8).map(e=>(0,Z.jsx)(ze,{label:e.suite,part:e.notAutomated+e.pending,whole:e.cases,className:`bg-warn`},e.suite)):(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Nothing left to automate.`})]})]}),l===`stories`||l===`criteria`?(0,Z.jsx)(pt,{kind:l,gaps:m,picked:o,onPick:s,onRead:c}):l===`no_case`?(0,Z.jsx)(V,{label:`Tests with no test case`,placeholder:`Find a test`,empty:`Every test ForgeQE knows has a test case behind it.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[55%]`),children:`Test`}),(0,Z.jsx)(`th`,{className:R,children:`Tags`}),(0,Z.jsx)(`th`,{className:R,children:`Last runs`})]}),children:e.testsWithoutCase.map(e=>{let t=n.find(t=>t.key===e);return t?(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsxs)(`td`,{className:k(H,`max-w-0`),children:[(0,Z.jsx)(Q,{text:t.name,tip:t.file?`${t.name} · ${t.file}`:t.name}),t.flaky&&(0,Z.jsx)(j,{tone:`warn`,className:`mt-1`,children:`Flaky`})]}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(Ie,{tags:t.tags})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(Fe,{runs:t.runs})})]},e):null})}):(0,Z.jsx)(V,{label:ht.find(e=>e.id===l).label,placeholder:`Find a case`,resetKey:l,empty:`No gap of this kind.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-10`),children:(0,Z.jsx)(q,{"aria-label":`Select every case shown`,checked:g.length>0&&g.every(e=>_.has(e.key)),onCheckedChange:e=>i(e?[...new Set([...r,...g.map(e=>e.key)])]:r.filter(e=>!g.some(t=>t.key===e)))})}),(0,Z.jsx)(`th`,{className:R,children:`Test case`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Priority`}),(0,Z.jsx)(`th`,{className:R,children:l===`not_automated`?`Why it matters`:`Automation`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Last run`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:g.map(e=>(0,Z.jsxs)(`tr`,{className:k(`border-t border-line-soft align-top hover:bg-surface-muted`,_.has(e.key)&&`bg-accent-soft hover:bg-accent-soft`),children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(q,{"aria-label":`Select ${e.id}`,checked:_.has(e.key),onCheckedChange:t=>v(e.key,t)})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsxs)(`a`,{href:He(e.key),className:`flex min-w-[220px] flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.id}),e.suite&&(0,Z.jsx)(`span`,{children:e.suite}),(0,Z.jsx)(Ie,{tags:e.tags,max:2})]})]})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] @2xl:table-cell`),children:e.priority?`P${e.priority}`:`–`}),(0,Z.jsx)(`td`,{className:H,children:l===`not_automated`?(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-1`,children:[(f.get(e.key)??[]).map(e=>(0,Z.jsx)(j,{tone:`running`,icon:!1,children:e},e)),!(f.get(e.key)??[]).length&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})]}):(0,Z.jsx)(Ne,{a:e.automation})}),(0,Z.jsx)(`td`,{className:k(H,`hidden @2xl:table-cell`),children:(0,Z.jsx)(Pe,{o:e.lastRun.outcome})}),(0,Z.jsx)(`td`,{className:k(H,`text-right`),children:(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.id}`,"data-tip":`Run`,onClick:()=>a([e.key]),children:(0,Z.jsx)(b,{"aria-hidden":`true`})})})]},e.key))})]})}var _t=e=>e.from===`report`?`From the run's own report`:`From each case's latest result since the run started (its report is not written yet)`,vt={system:`system`,plan:`plan`,suite:`suite`,priority:`priority`,state:`state`,automation:`automation`,tag:`tag`,last_run:`last run`,origin:`origin`,stale:`steps changed`,in_pack:`in pack`};function yt({suites:e,onRun:t}){return e.length?(0,Z.jsx)(V,{label:`Suites`,placeholder:`Find a suite`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[40%]`),children:`Suite`}),(0,Z.jsx)(`th`,{className:U,children:`Cases`}),(0,Z.jsx)(`th`,{className:k(U,`hidden @xl:table-cell`),children:`Automated`}),(0,Z.jsx)(`th`,{className:R,children:`Last run`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:e.map(e=>(0,Z.jsxs)(`tr`,{className:W,onClick:()=>location.hash=F(`test-management`,`suites`,e.id),children:[(0,Z.jsxs)(`td`,{className:k(H,`max-w-0`),children:[(0,Z.jsxs)(`a`,{href:F(`test-management`,`suites`,e.id),onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 font-medium`,children:[e.built===`agent`?(0,Z.jsx)(E,{size:14,"aria-hidden":`true`,className:`flex-none`}):(0,Z.jsx)(f,{size:14,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(Q,{text:e.name})]}),e.description&&(0,Z.jsx)(Q,{text:e.description,className:`mt-1 text-[13px] text-muted`})]}),(0,Z.jsx)(`td`,{className:z,children:e.cases}),(0,Z.jsxs)(`td`,{className:k(z,`hidden @xl:table-cell`),children:[e.cases?Math.round(e.automated/e.cases*100):0,`%`]}),(0,Z.jsx)(`td`,{className:H,children:e.last?(0,Z.jsxs)(`span`,{className:`flex flex-col items-start gap-1 text-[13px]`,"data-tip":_t(e.last),children:[(0,Z.jsxs)(j,{tone:e.last.failed?`fail`:`pass`,children:[e.last.passed,` passed`,e.last.failed?`, ${e.last.failed} failed`:``]}),(0,Z.jsx)(`span`,{className:`text-muted`,children:K(e.last.at)})]}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not run`})}),(0,Z.jsxs)(`td`,{className:k(H,`text-right whitespace-nowrap`),onClick:e=>e.stopPropagation(),children:[!!e.last?.failed&&(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Rerun the failed cases of ${e.name}`,"data-tip":`Rerun failed`,onClick:()=>t(e.id,`failed`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})}),(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Run ${e.name}`,"data-tip":`Run`,onClick:()=>t(e.id),children:(0,Z.jsx)(b,{"aria-hidden":`true`})})]})]},e.id))}):(0,Z.jsx)(M,{icon:f,title:`No suites yet`,children:`Tell the Suite agent on the right what the suite is for, such as “regression for the payments suite, P1 and anything failing lately”. It picks the cases from your plans, tags and runs.`})}function bt({id:e,onRun:t,onDeleted:n}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``),[s,l]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1);(0,J.useEffect)(()=>{i(null),Y.suite(e).then(e=>{i(e),o(``)},e=>o(e.message))},[e]);let h=(0,Z.jsxs)(`a`,{href:F(`test-management`,`suites`),className:`inline-flex w-fit items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(m,{size:14,"aria-hidden":`true`}),`All suites`]});if(a)return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail`,children:a})]});if(!r)return(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`});let g=r.suite,_=r.members.filter(e=>e.case.lastRun.outcome===`failed`||e.case.lastRun.outcome===`blocked`).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.name}),g.description&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:g.description}),g.tracker&&(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[`Kept as`,` `,Te(g.tracker)?(0,Z.jsx)(`a`,{href:Te(g.tracker),target:`_blank`,rel:`noreferrer noopener`,children:Ee(g.tracker)}):Ee(g.tracker)]})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(g.tracker||r.targets.length>0)&&(0,Z.jsxs)(L,{onClick:()=>f(!0),children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),g.tracker?`Keep in step`:`Keep in tracker`]}),(0,Z.jsxs)(L,{variant:`danger`,onClick:()=>l(!0),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Delete`]}),_>0&&(0,Z.jsxs)(L,{onClick:()=>t(g.id,`failed`),children:[(0,Z.jsx)(O,{"aria-hidden":`true`}),`Rerun `,_,` failed`]}),(0,Z.jsxs)(L,{variant:`primary`,onClick:()=>t(g.id),children:[(0,Z.jsx)(b,{"aria-hidden":`true`}),`Run suite`]})]})]}),(0,Z.jsxs)(le,{label:`The suite`,children:[(0,Z.jsx)(G,{compact:!0,label:`Cases`,value:g.cases,note:`${g.automated} automated`}),(0,Z.jsx)(G,{compact:!0,label:`Last run`,value:g.last?`${g.last.passed} passed`:`Not run`,tone:g.last?.failed?`text-fail`:void 0,note:g.last?`${g.last.failed} failed · ${K(g.last.at)}${g.last.from===`report`?``:` · so far`}`:void 0}),(0,Z.jsx)(G,{compact:!0,label:`Runs on`,value:g.env??`Active`,note:g.runs.length?`${g.runs.length} run${g.runs.length===1?``:`s`}`:`never run`}),(0,Z.jsx)(G,{compact:!0,label:`Built`,value:g.built===`agent`?`Suite agent`:g.built===`rules`?`Rules`:`Picked`,note:`updated ${K(g.updatedAt)}`})]}),g.groupsCount.length>0&&(0,Z.jsxs)(`section`,{className:`card flex flex-col gap-2 rounded-[14px] border p-6 text-[13px]`,children:[(0,Z.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:`Why these cases`}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:g.groupsCount.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted`,children:g.groups[t]?.rules.map(e=>`${vt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(` and `)}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label))})]}),(0,Z.jsx)(V,{label:`Cases`,placeholder:`Find a case`,empty:`No case meets the suite's rules now.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[45%]`),children:`Test case`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @xl:table-cell`),children:`Why it is in`}),(0,Z.jsx)(`th`,{className:R,children:`Automation`}),(0,Z.jsx)(`th`,{className:R,children:`Last run`})]}),children:r.members.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:k(H,`max-w-0`),children:(0,Z.jsxs)(`a`,{href:He(e.case.key),className:`flex min-w-0 flex-col gap-1 text-ink no-underline`,children:[(0,Z.jsx)(Q,{text:e.case.title,className:`font-medium`}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Ie,{tags:e.case.tags})]})]})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:e.group}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(Ne,{a:e.case.automation})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(Pe,{o:e.case.lastRun.outcome})})]},e.case.key))}),(0,Z.jsx)(Ae,{open:d,suite:g,targets:r.targets,onClose:()=>f(!1),onDone:()=>void Y.suite(e).then(i,()=>{})}),(0,Z.jsx)(B,{open:s,onClose:()=>l(!1),title:`Delete ${g.name}?`,description:`The suite goes from .forgeqe/testmgmt/suites.json. Its cases and their runs stay.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:()=>l(!1),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(L,{variant:`destructive`,onClick:()=>void Y.deleteSuite(g.id).then(()=>{l(!1),n()},e=>o(e.message)),children:[(0,Z.jsx)(p,{"aria-hidden":`true`}),`Delete`]})]}),children:(0,Z.jsx)(`p`,{className:`m-0 pt-4 text-[13px] text-ink-2`,children:`Runs already made are kept in Runs.`})})]})}function xt({open:e,onSaved:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),u=[...n].reverse().find(e=>`built`in e)?.built,d=n.filter(e=>`you`in e).map(e=>e.you).join(`. `),f=async t=>{let n=t.trim();if(n){s(!0),l(``),r(e=>[...e,{you:n}]),a(``);try{let t=await Y.buildSuite(d?`${d}. ${n}`:n,e?.id);r(e=>[...e,{built:t}])}catch(e){l(e.message)}finally{s(!1)}}},p=async n=>{if(u){s(!0);try{let{suite:i}=await Y.saveSuite({...n&&e?{id:e.id}:{},name:n&&e?e.name:u.name,description:u.summary,groups:u.groups,exclude:u.exclude,built:`agent`});r([]),t(i)}catch(e){l(e.message)}finally{s(!1)}}};return(0,Z.jsxs)(ye,{title:`Suite agent`,about:`Builds and changes suites from your plans, tags and runs.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(e?[`Leave out cases that are not automated`,`Add everything failing lately`,`Only priority 1 and 2`]:[`Smoke suite`,`P1 cases that failed lately`,`Everything not automated in one suite`]).map(e=>(0,Z.jsx)(L,{size:`sm`,disabled:o,onClick:()=>void f(e),children:e},e))}),(0,Z.jsxs)(`form`,{className:`flex items-end gap-2`,onSubmit:e=>{e.preventDefault(),f(i)},children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`tm-suite-words`,children:`Tell the Suite agent what the suite is for`}),(0,Z.jsx)(`textarea`,{id:`tm-suite-words`,rows:2,maxLength:1e3,value:i,placeholder:e?`Change ${e.name}, or ask about it`:`Describe the suite you need, e.g. regression for Payments under 30 minutes`,onChange:e=>a(e.target.value),className:`min-h-11 flex-1 resize-none rounded-[10px] border border-line bg-bg px-4 py-2 text-[13px] text-ink outline-none focus:border-accent`}),(0,Z.jsx)(L,{size:`icon`,variant:`primary`,type:`submit`,disabled:o||!i.trim(),"aria-label":`Send`,"data-tip":`Send`,children:(0,Z.jsx)(w,{"aria-hidden":`true`})})]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,Z.jsx)(ae,{state:o?`thinking`:`working`,px:96,label:o?`Building the suite`:`Ready`}),(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:o?`Building the suite…`:e?`Looking at ${e.name}.`:`Ready. Say what the suite is for.`})]}),n.map((e,t)=>`you`in e?(0,Z.jsx)(`p`,{className:`m-0 text-center text-[16px] leading-relaxed text-ink-2`,children:e.you},t):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`p`,{className:`m-0 text-center text-[20px] leading-snug`,children:[e.built.name,`: `,e.built.cases,` case`,e.built.cases===1?``:`s`,`, `,e.built.automated,` automated.`]}),e.built.summary&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-ink-2`,children:e.built.summary}),e.built.note&&(0,Z.jsx)(`p`,{className:`m-0 text-center text-[13px] text-muted`,children:e.built.note}),(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[e.built.perGroup.map(e=>(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,"data-tip":e.why,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.cases})]},e.label)),e.built.exclude.length>0&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`Leaves out: `,e.built.exclude.map(e=>`${vt[e.field]} ${e.op===`is`?`is`:`is not`} ${e.value}`).join(`, `)]})]}),e.built.question&&t===n.length-1&&(0,Z.jsxs)(`div`,{className:`card flex flex-col gap-2 rounded-[14px] border bg-bg p-4 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.built.question.text}),e.built.question.options.map(e=>(0,Z.jsx)(L,{size:`sm`,disabled:o,onClick:()=>void f(e),className:`justify-start`,children:e},e))]}),e.built.sample.length>0&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,children:e.built.sample.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-none font-mono text-accent-fg`,children:e.case.id}),(0,Z.jsx)(Q,{text:e.case.title,className:`min-w-0 text-ink-2`})]},e.case.key))})]},t)),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),u&&(0,Z.jsxs)(`span`,{className:`flex flex-wrap justify-center gap-2`,children:[e&&(0,Z.jsxs)(L,{disabled:o,onClick:()=>void p(!0),children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),`Update `,e.name]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:o,onClick:()=>void p(!1),children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),`Save `,e?`as a new suite`:`suite`]})]})]})}var St=[{id:`off`,label:`Off`,icon:o},{id:`hourly`,label:`Every hour`,icon:n},{id:`daily`,label:`Daily`,icon:g}];function Ct(e){return!e||e.every===`off`?`Sync: off`:e.every===`hourly`?`Sync: hourly`:e.every===`daily`?`Sync: daily ${e.at}`:`Sync: custom`}function wt({disabled:e}){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(null);return(0,J.useEffect)(()=>{Y.schedule().then(e=>i(e.schedule),()=>{})},[]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{size:`sm`,disabled:e,onClick:()=>n(!0),"data-tip":r?.nextAt?`Next sync ${me(r.nextAt)}`:`Set when the plans are synced`,children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),Ct(r)]}),(0,Z.jsx)(Tt,{open:t,onClose:()=>n(!1),now:r,onSaved:i})]})}function Tt({open:e,onClose:t,now:n,onSaved:r}){let[i,a]=(0,J.useState)(`off`),[o,s]=(0,J.useState)(`06:00`),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1);(0,J.useEffect)(()=>{e&&(u(``),g(!!n&&n.every!==`off`&&n.every!==`custom`&&!!n.discover),Y.discoveryPlan().then(m,()=>m(null)),a(n&&n.every!==`custom`?n.every:`off`),n?.every===`daily`&&s(n.at))},[e,n]);let _=async()=>{f(!0);try{let e=h&&p&&i!==`off`?{discover:p.digest}:{};r((await Y.setSchedule(i===`daily`?{every:i,at:o,...e}:i===`hourly`?{every:i,...e}:{every:i})).schedule),t()}catch(e){u(e.message)}finally{f(!1)}};return(0,Z.jsx)(B,{open:e,onClose:t,title:`Sync on a schedule`,description:`ForgeQE reads every case of the connected test plans again, as Sync does, and the stories Gaps read, in the jobs service (forgeqe testmgmt sync). It can also discover the tests first. It runs while this computer is on.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:t,children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Cancel`]}),(0,Z.jsxs)(L,{variant:`primary`,disabled:d||i===`daily`&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(o),onClick:()=>void _(),children:[(0,Z.jsx)(D,{"aria-hidden":`true`}),`Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4 text-[13px]`,children:[(0,Z.jsx)(`div`,{role:`group`,"aria-label":`When to sync`,className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(oe,{items:St.map(e=>({id:e.id,label:e.label,icon:e.icon})),value:i,onChange:a})}),i===`daily`&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-2 font-medium`,children:[`Time (this computer's clock)`,(0,Z.jsx)(A,{type:`time`,step:60,value:o,onChange:e=>s(e.target.value)})]}),i!==`off`&&p&&p.steps.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(q,{checked:h,onCheckedChange:e=>g(e===!0),"aria-label":`Also discover the tests`}),(0,Z.jsx)(`span`,{children:`Also discover the tests first. This runs the repository's code with these commands, with no secret of ForgeQE's. If the test projects change, the schedule stops discovering until you confirm again.`})]}),h&&(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:p.steps.map((e,t)=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`rounded-[8px] bg-surface-strong px-2 py-1 font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.command})},t))})]}),n?.every===`custom`&&(0,Z.jsxs)(`p`,{className:`m-0 text-warn`,children:[`The sync job was changed outside this page (`,n.text,`). Saving here replaces it.`]}),n?.enabled===!1&&(0,Z.jsx)(`p`,{className:`m-0 text-warn`,children:`The sync job is disabled in the jobs service.`}),n?.last&&(0,Z.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`Last scheduled sync `,me(n.last.at),`: `,n.last.status.replace(`_`,` `),`.`]}),l&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-fail [overflow-wrap:anywhere]`,children:l})]})})}var Et={forgeqe:{label:`ForgeQE`,icon:E},script:{label:`Tests`,icon:d}},Dt=e=>Et[e]??{label:e===`azure_devops`?`Azure DevOps`:e===`jira`?`Jira`:e,icon:a},Ot=e=>e!==`forgeqe`&&e!==`script`,kt=[];function At({tags:e,cases:t=[],onChanged:n}){let[r,i]=(0,J.useState)(`all`),[o,s]=(0,J.useState)(null),c=e=>e.system===`azure_devops`||e.system===`jira`,l=e=>t.filter(t=>t.ownTags.includes(e)&&!t.trackerTags.includes(e)&&c(t)).map(e=>e.key),f=e=>t.filter(t=>t.ownTags.includes(e)&&t.trackerTags.includes(e)&&c(t)).map(e=>e.key),p=e.tags.filter(e=>r===`all`||(r===`out`?e.outOfStep>0:r===`tracker`?e.from.some(Ot):e.from.includes(r))),m=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(le,{label:`Tags`,children:[(0,Z.jsx)(G,{compact:!0,label:`Tags in use`,icon:y,value:e.tags.length}),(0,Z.jsx)(G,{compact:!0,label:`Test cases with a tag`,value:m(e.casesTagged,e.cases),note:`${e.casesTagged} of ${e.cases}`}),(0,Z.jsx)(G,{compact:!0,label:`Tests with a tag`,value:m(e.testsTagged,e.tests),note:`${e.testsTagged} of ${e.tests}`}),(0,Z.jsx)(G,{compact:!0,label:`Out of step`,icon:_,value:e.tags.filter(e=>e.outOfStep).length,tone:e.tags.some(e=>e.outOfStep)?`text-warn`:void 0,note:`a case's tag its test lacks`})]}),(0,Z.jsx)(V,{label:`Tags`,placeholder:`Find a tag`,resetKey:r,empty:e.tags.length?`Nothing matches.`:`No tags yet: tag cases in Test cases, or in their system.`,tools:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,Z.jsx)(oe,{items:[{id:`all`,label:`All`,n:e.tags.length},{id:`tracker`,label:`From their systems`,icon:a,n:e.tags.filter(e=>e.from.some(Ot)).length},{id:`script`,label:`From tests`,icon:d,n:e.tags.filter(e=>e.from.includes(`script`)).length},{id:`forgeqe`,label:`ForgeQE's`,icon:E,n:e.tags.filter(e=>e.from.includes(`forgeqe`)).length},{id:`out`,label:`Out of step`,icon:_,n:e.tags.filter(e=>e.outOfStep).length,alert:!0}],value:r,onChange:i})}),head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:k(R,`w-[28%]`),children:`Tag`}),(0,Z.jsx)(`th`,{className:R,children:`Comes from`}),(0,Z.jsx)(`th`,{className:U,children:`Test cases`}),(0,Z.jsx)(`th`,{className:U,children:`Tests`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @xl:table-cell`),children:`Out of step`}),(0,Z.jsx)(`th`,{className:k(R,`hidden @2xl:table-cell`),children:`Used by suites`}),(0,Z.jsx)(`th`,{className:R,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:p.map(e=>(0,Z.jsxs)(`tr`,{className:`border-t border-line-soft align-top hover:bg-surface-muted`,children:[(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-[6px] bg-surface-strong px-2 text-[13px] font-medium`,children:[(0,Z.jsx)(y,{size:12,"aria-hidden":`true`}),e.name]})}),(0,Z.jsx)(`td`,{className:H,children:(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.from.map(e=>{let t=Dt(e);return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-[6px] border border-line px-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(t.icon,{size:12,"aria-hidden":`true`}),t.label]},e)})})}),(0,Z.jsx)(`td`,{className:z,children:e.cases}),(0,Z.jsx)(`td`,{className:z,children:e.tests}),(0,Z.jsx)(`td`,{className:k(H,`hidden @xl:table-cell`),children:e.outOfStep?(0,Z.jsx)(j,{tone:`warn`,children:e.outOfStep}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`–`})}),(0,Z.jsx)(`td`,{className:k(H,`hidden text-[13px] text-ink-2 @2xl:table-cell`),children:e.suites.join(`, `)||`–`}),(0,Z.jsxs)(`td`,{className:k(H,`text-right`),children:[l(e.name).length>0&&(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Write the tag ${e.name} to the trackers of ${l(e.name).length} cases`,"data-tip":`Write to the trackers of ${l(e.name).length} cases`,onClick:()=>s({kind:`tags`,keys:l(e.name)}),children:(0,Z.jsx)(u,{"aria-hidden":`true`})}),f(e.name).length>0&&(0,Z.jsx)(L,{size:`icon-sm`,variant:`icon`,"aria-label":`Take the tag ${e.name} off in the trackers of ${f(e.name).length} cases`,"data-tip":`Take off in the trackers of ${f(e.name).length} cases`,onClick:()=>s({kind:`untag`,keys:f(e.name),tags:[e.name]}),children:(0,Z.jsx)(ee,{"aria-hidden":`true`})})]})]},e.name))}),(0,Z.jsx)(ke,{kind:o?.kind??null,keys:o?.keys??kt,tags:o?.tags,onClose:()=>s(null),onDone:e=>n?.(e)})]})}var jt=[`dashboard`,`cases`,`tests`,`gaps`,`suites`,`tags`];function Mt({sub:e}){let t=(e??``).split(`/`).filter(Boolean),r=jt.includes(t[0])?t[0]:`dashboard`,i=r===`cases`&&t[1]?ie(t[1]):void 0,a=r===`suites`&&t[1]?ie(t[1]):void 0,[o,s]=(0,J.useState)(null),[c,u]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)([]),[g,_]=(0,J.useState)(null),[v,ee]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(``),[T,D]=(0,J.useState)(``),[O,ne]=(0,J.useState)(!1),[re,A]=(0,J.useState)([]),[ae,M]=(0,J.useState)(null),[N,P]=(0,J.useState)(!0),I=(0,J.useCallback)(async()=>{try{let[e,t]=await Promise.all([Y.view(),Y.cases()]);s(e),u(t),ee(e.suites),S(e.job),w(``)}catch(e){w(e.message)}},[]);(0,J.useEffect)(()=>{I()},[I]),(0,J.useEffect)(()=>{r===`gaps`&&Y.gaps().then(p,e=>w(e.message)),r===`tags`&&Y.tags().then(_,e=>w(e.message)),r===`suites`&&Y.suites().then(e=>ee(e.suites),e=>w(e.message))},[r,o]),(0,J.useEffect)(()=>{if(!x?.running)return;let e=setInterval(()=>{Y.job().then(e=>{S(e.job),e.job?.running||I()},()=>{})},2e3);return()=>clearInterval(e)},[x?.running,I]);let oe=async()=>{ne(!0),D(``);try{let e=await Y.sync(),t=e.plans.filter(e=>e.error);D(t.length?t.map(e=>`${e.label}: ${e.error}`).join(` · `):`Synced ${e.plans.map(e=>`${e.label} (${e.cases} cases)`).join(`, `)}.`),await I()}catch(e){w(e.message)}finally{ne(!1)}},R=e=>M({title:`Run ${e.length} test case${e.length===1?``:`s`}`,go:(t,n)=>Y.run(e,t,n)}),z=(e,t)=>{let n=v?.find(t=>t.id===e)??o?.suites.find(t=>t.id===e);M({title:`${t?`Rerun the failed cases of`:`Run`} ${n?.name??`the suite`}`,go:(n,r)=>Y.runSuite(e,{...n?{env:n}:{},...t?{only:t}:{}},r)})},B=()=>{D(`The run started: it shows here while it runs, and in Runs.`),Y.job().then(e=>S(e.job),()=>{})},V=e=>{D(e),A([]),I()},H=new Map((c?.cases??[]).map(e=>[e.key,e])),U=re.filter(e=>H.has(e)),le=e=>e.map(e=>H.get(e).id),W=U.filter(e=>[`failed`,`blocked`].includes(H.get(e).lastRun.outcome)),G=U.filter(e=>H.get(e).automation!==`automated`),q=[{intent:`automate`,label:G.length?`Automate ${G.length}`:`Automate`,icon:d,keys:G.slice(0,50),...G.length?{}:{disabled:`Pick test cases that are not automated`}},{intent:`investigate`,label:W.length?`Why ${W.length} fail`:`Why they fail`,icon:l,keys:W.slice(0,50),...W.length?{}:{disabled:`Pick failing test cases`}},{intent:`tag`,label:`Suggest tags`,icon:y,keys:U.slice(0,50),...U.length?{}:{disabled:`Pick test cases in the list first`}},{intent:`tag_tests`,label:`Write tags into tests`,icon:d,keys:U.filter(e=>H.get(e).tests.length>0&&H.get(e).tags.length>0).slice(0,50),...U.filter(e=>H.get(e).tests.length>0&&H.get(e).tags.length>0).length?{}:{disabled:`Pick tagged cases that have a linked test`}}],he=(f?.ranked??[]).slice(0,20).map(e=>e.key),ge=[{intent:`automate`,label:U.length?`Automate ${U.length}`:`Automate the top ${he.length}`,icon:d,keys:(U.length?U:he).slice(0,50),...U.length||he.length?{}:{disabled:`Nothing left to automate`}},{intent:`investigate`,label:`Why the failing fail`,icon:l,keys:(f?.lists.failing??[]).slice(0,50),...f?.lists.failing.length?{}:{disabled:`Nothing is failing`}},{intent:`cases_for_stories`,label:m.length?`Cases for ${m.length} stor${m.length===1?`y`:`ies`}`:`Cases for stories with none`,icon:E,keys:[],stories:(m.length?m:(f?.stories?.noCase??[]).map(e=>e.id)).slice(0,50),...m.length||f?.stories?.noCase.length?{}:{disabled:`Read the release's stories in Gaps, Stories with no case, first`}}],_e=a?v?.find(e=>e.id===a):void 0,ve=(0,Z.jsxs)(`main`,{className:k(ue,`@container flex-auto gap-4`),children:[(0,Z.jsx)(pe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(ce,{pixel:se[`test-management`],size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Test management`}),o&&(0,Z.jsx)(fe,{label:`Test management`,className:`mb-0`,current:r,onPick:e=>location.hash=F(`test-management`,e),tabs:[{id:`dashboard`,label:`Dashboard`},{id:`cases`,label:`Test cases`,n:o.summary.cases},{id:`tests`,label:`Automated`,n:o.summary.tests},{id:`gaps`,label:`Gaps`,n:o.summary.notAutomated+o.summary.pending+o.summary.failing},{id:`suites`,label:`Suites`,n:o.suites.length},{id:`tags`,label:`Tags`}]}),o&&(0,Z.jsxs)(`span`,{className:`ml-auto flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[o.plans.length>0&&(0,Z.jsxs)(`span`,{"data-tip":o.plans.map(e=>`${e.label}: ${e.cases} cases${e.at?`, synced ${me(e.at)}`:``}`).join(` · `),children:[o.plans.length,` plan`,o.plans.length===1?``:`s`,o.plans[0]?.at?`, synced ${K(o.plans.map(e=>e.at??``).sort()[0])}`:`, not synced yet`]}),o.plans.length>0&&(0,Z.jsxs)(L,{size:`sm`,disabled:O,onClick:()=>void oe(),"data-tip":`Read every case of the connected plans again`,children:[(0,Z.jsx)(n,{"aria-hidden":`true`}),O?`Syncing…`:`Sync`]}),(o.plans.length>0||o.summary.tests>0)&&(0,Z.jsx)(wt,{disabled:O}),(r===`cases`||r===`gaps`||r===`suites`)&&!N&&(0,Z.jsxs)(L,{size:`sm`,onClick:()=>P(!0),children:[(0,Z.jsx)(E,{"aria-hidden":`true`}),r===`suites`?`Suite agent`:`Agent`]})]})]}),C&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:C}),!o&&!C&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),T&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:T}),o&&o.refused.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`Not read, as their system does not write a plan that way: `,o.refused.join(` · `),`. Fix them in Settings › Integrations.`]}),x&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 rounded-[12px] border border-line px-4 py-2 text-[13px]`,children:[(0,Z.jsx)(j,{tone:x.running?`running`:x.exitCode===0?`pass`:`fail`,children:x.running?`Running`:x.exitCode===0?`Finished`:`Stopped`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink-2`,"data-tip":x.command,children:x.lines.at(-1)??x.command}),x.running?(0,Z.jsxs)(L,{size:`sm`,variant:`danger`,onClick:()=>void Y.stop().then(e=>S(e.job)),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Stop`]}):(0,Z.jsx)(`a`,{href:F(`runs`),className:`text-[13px]`,children:`Runs`})]}),o&&(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,className:`flex flex-col gap-4`,children:[r===`dashboard`&&(0,Z.jsx)(ot,{view:o,onRunSuite:z}),r===`cases`&&(i?(0,Z.jsx)(Xe,{caseKey:i,onRun:R}):c&&(0,Z.jsx)(et,{cases:c.cases,tests:c.tests.length,selected:U,onSelect:A,onRun:R,onChanged:V})),r===`tests`&&c&&(0,Z.jsx)(Ue,{cases:c.cases,onChanged:V}),r===`gaps`&&(f&&c?(0,Z.jsx)(gt,{gaps:f,cases:c.cases,tests:c.tests,selected:U,onSelect:A,onRun:R,pickedStories:m,onPickStories:h,onStoriesRead:()=>(h([]),void I())}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`})),r===`suites`&&(a?(0,Z.jsx)(bt,{id:a,onRun:z,onDeleted:()=>(location.hash=F(`test-management`,`suites`),void I())},a):v&&(0,Z.jsx)(yt,{suites:v,onRun:z})),r===`tags`&&(g?(0,Z.jsx)(At,{tags:g,cases:c?.cases,onChanged:V}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}))]})}),(0,Z.jsx)(Be,{open:!!ae,onClose:()=>M(null),title:ae?.title??`Run`,preview:(e,t)=>ae.go(e,t),onStarted:B})]}),X=i?H.get(i):void 0;return(0,Z.jsxs)(`div`,{className:`@container flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(de,{}),(0,Z.jsxs)(`div`,{className:`flex flex-auto flex-col xl:flex-row`,children:[(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-auto flex-col`,children:ve}),o&&N&&r===`cases`&&(0,Z.jsx)(be,{title:`Test case agent`,about:`Automates, runs and tags the cases you pick.`,looking:X?`Looking at ${X.id}.`:U.length?`Looking at the ${U.length} cases you picked.`:`Looking at ${o.summary.cases} test cases. Pick some in the list.`,context:X?[X.id,...X.plans.slice(0,1)]:U.length?le(U).slice(0,4):[],suggestions:X?[{intent:X.automation===`automated`?`run`:`automate`,label:X.automation===`automated`?`Run it and explain`:`Automate it`,icon:X.automation===`automated`?b:d,keys:[X.key]},{intent:`investigate`,label:`Why it fails`,icon:l,keys:[X.key],...[`failed`,`blocked`].includes(X.lastRun.outcome)?{}:{disabled:`Its last run did not fail`}},{intent:`tag`,label:`Suggest tags`,icon:y,keys:[X.key]}]:q,placeholder:`Ask about these cases, or say what to do`,onClose:()=>P(!1)},i??`list`),o&&N&&r===`gaps`&&(0,Z.jsx)(be,{title:`Gap agent`,about:`Finds what to close first and closes it with you.`,looking:`Looking at ${o.summary.notAutomated} cases not automated, ${o.summary.pending} pending and ${o.summary.failing} failing.`,context:U.length?le(U).slice(0,4):[],suggestions:ge,placeholder:`What should we close first?`,onClose:()=>P(!1)}),o&&N&&r===`suites`&&(0,Z.jsx)(xt,{open:_e,onSaved:e=>{D(`Saved the suite ${e.name}.`),I(),location.hash=F(`test-management`,`suites`,e.id)}})]})]})}export{Mt as TestManagement};
|