@nivora/matrix 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -2
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +2 -2
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/builder/page.js +3 -3
  24. package/.next/server/app/builder/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/guide/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/matrix/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/releases/[id]/page.js +15 -15
  29. package/.next/server/app/releases/[id]/page_client-reference-manifest.js +1 -1
  30. package/.next/server/app/releases/page.js +3 -3
  31. package/.next/server/app/releases/page_client-reference-manifest.js +1 -1
  32. package/.next/server/app/specs/[id]/page.js +2 -2
  33. package/.next/server/app/specs/[id]/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app-paths-manifest.json +2 -2
  35. package/.next/server/pages/404.html +1 -1
  36. package/.next/server/pages/500.html +2 -2
  37. package/.next/server/server-reference-manifest.js +1 -1
  38. package/.next/server/server-reference-manifest.json +1 -1
  39. package/.next/static/chunks/app/builder/{page-29ef0d9ec753466c.js → page-457d01e58c06abbc.js} +3 -3
  40. package/.next/static/chunks/app/releases/[id]/{page-467d1893a4442eed.js → page-615955e11edbace3.js} +1 -1
  41. package/.next/static/chunks/app/releases/page-31f07a510226ca79.js +1 -0
  42. package/.next/static/chunks/app/specs/[id]/page-5ab46a66ff79e42d.js +1 -0
  43. package/bin/cli.js +54 -36
  44. package/package.json +1 -1
  45. package/.next/static/chunks/app/releases/page-6fc2e948b934fbb5.js +0 -1
  46. package/.next/static/chunks/app/specs/[id]/page-b5f2c99269d194c4.js +0 -1
  47. /package/.next/static/{p01ytei1EF9z6WCg6Sbk1 → ELXN4s-taKt0QlqbiK3YP}/_buildManifest.js +0 -0
  48. /package/.next/static/{p01ytei1EF9z6WCg6Sbk1 → ELXN4s-taKt0QlqbiK3YP}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[462],{994:(e,t,a)=>{Promise.resolve().then(a.bind(a,4491))},4491:(e,t,a)=>{"use strict";a.d(t,{BuilderTabs:()=>y});var r=a(5155),l=a(2115);function i({options:e,selected:t,onChange:a,placeholder:i,multi:s=!0,allowCustom:n=!0}){let[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),p=(0,l.useRef)(null),m=e.filter(e=>e.label.toLowerCase().includes(d.toLowerCase())&&(!s||!t.includes(e.value)));return(0,l.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.jsxs)("div",{ref:p,style:{position:"relative",flex:1},children:[s&&t.length>0&&(0,r.jsx)("div",{style:{display:"flex",gap:"0.25rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:t.map(l=>{let i=e.find(e=>e.value===l);return(0,r.jsxs)("span",{className:"badge badge-success",style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[i?.value||l,(0,r.jsx)("button",{onClick:()=>{a(t.filter(e=>e!==l))},style:{background:"none",border:"none",cursor:"pointer",padding:0,fontSize:"1rem",color:"inherit"},children:"\xd7"})]},l)})}),(0,r.jsx)("input",{type:"text",value:s||o?d:(()=>{if(!s&&t.length>0){let a=e.find(e=>e.value===t[0]);return a?.label||t[0]}return""})(),onChange:e=>u(e.target.value),onFocus:()=>c(!0),placeholder:0!==t.length&&s?"Add more...":i,className:"input",style:{width:"100%"}}),o&&(0,r.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"0.25rem",background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"8px",maxHeight:"200px",overflowY:"auto",zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[0===m.length?(0,r.jsx)("div",{style:{padding:"0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem"},children:n?"No matches - type to create":"No matching steps"}):m.slice(0,20).map(e=>(0,r.jsxs)("div",{onClick:()=>{var r;return r=e.value,void(s?a([...t,r]):(a([r]),c(!1)),u(""))},style:{padding:"0.625rem 0.75rem",cursor:"pointer",fontSize:"0.875rem",borderBottom:"1px solid var(--border)",transition:"background 0.15s"},onMouseEnter:e=>e.currentTarget.style.background="var(--bg-hover)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,r.jsx)("div",{style:{fontWeight:500},children:e.value}),e.label!==e.value&&(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginTop:"0.125rem"},children:e.label})]},e.value)),m.length>20&&(0,r.jsxs)("div",{style:{padding:"0.5rem",color:"var(--text-secondary)",fontSize:"0.75rem",textAlign:"center"},children:["+",m.length-20," more..."]})]})]})}var s=a(9339);let n=(0,s.createServerReference)("600d3806d6673dbc2e665d3c2e44546c76b6c23a6e",s.callServer,void 0,s.findSourceMapURL,"saveFS");function o({ursItems:e,riskItems:t,existingFSCount:a,stepsByType:s}){let o,p,m,[h,g]=(0,l.useState)("FS-"+String(a+1).padStart(3,"0")),[x,v]=(0,l.useState)(""),[y,b]=(0,l.useState)(""),[j,f]=(0,l.useState)([""]),[S,C]=(0,l.useState)([]),[k,N]=(0,l.useState)([]),[w,R]=(0,l.useState)([{name:"",steps:[{type:"given",text:""},{type:"when",text:""},{type:"then",text:""}]}]),[B,$]=(0,l.useState)({type:"idle"}),[L,T]=(0,l.useTransition)(),_=(o=[...S.map(e=>`@${e}`),...k.map(e=>`@${e}`)].join(" "),p=j.filter(e=>e.trim()).map(e=>` - ${e}`).join("\n"),m=w.filter(e=>e.name.trim()).map(e=>{let t=e.steps.filter(e=>e.text.trim()).map(e=>` ${u(e.type)} ${e.text}`).join("\n");return` Scenario: ${e.name}
2
- ${t}`}).join("\n\n"),`${o}
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[462],{994:(e,t,a)=>{Promise.resolve().then(a.bind(a,1691))},1691:(e,t,a)=>{"use strict";a.d(t,{BuilderTabs:()=>y});var r=a(5155),l=a(2115);function i({options:e,selected:t,onChange:a,placeholder:i,multi:s=!0,allowCustom:n=!0}){let[c,o]=(0,l.useState)(!1),[d,u]=(0,l.useState)(""),p=(0,l.useRef)(null),m=e.filter(e=>e.label.toLowerCase().includes(d.toLowerCase())&&(!s||!t.includes(e.value)));return(0,l.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.jsxs)("div",{ref:p,style:{position:"relative",flex:1},children:[s&&t.length>0&&(0,r.jsx)("div",{style:{display:"flex",gap:"0.25rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:t.map(l=>{let i=e.find(e=>e.value===l);return(0,r.jsxs)("span",{className:"badge badge-success",style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[i?.value||l,(0,r.jsx)("button",{onClick:()=>{a(t.filter(e=>e!==l))},style:{background:"none",border:"none",cursor:"pointer",padding:0,fontSize:"1rem",color:"inherit"},children:"\xd7"})]},l)})}),(0,r.jsx)("input",{type:"text",value:s||c?d:(()=>{if(!s&&t.length>0){let a=e.find(e=>e.value===t[0]);return a?.label||t[0]}return""})(),onChange:e=>u(e.target.value),onFocus:()=>o(!0),placeholder:0!==t.length&&s?"Add more...":i,className:"input",style:{width:"100%"}}),c&&(0,r.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"0.25rem",background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"8px",maxHeight:"200px",overflowY:"auto",zIndex:100,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[0===m.length?(0,r.jsx)("div",{style:{padding:"0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem"},children:n?"No matches - type to create":"No matching steps"}):m.slice(0,20).map(e=>(0,r.jsxs)("div",{onClick:()=>{var r;return r=e.value,void(s?a([...t,r]):(a([r]),o(!1)),u(""))},style:{padding:"0.625rem 0.75rem",cursor:"pointer",fontSize:"0.875rem",borderBottom:"1px solid var(--border)",transition:"background 0.15s"},onMouseEnter:e=>e.currentTarget.style.background="var(--bg-hover)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,r.jsx)("div",{style:{fontWeight:500},children:e.value}),e.label!==e.value&&(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginTop:"0.125rem"},children:e.label})]},e.value)),m.length>20&&(0,r.jsxs)("div",{style:{padding:"0.5rem",color:"var(--text-secondary)",fontSize:"0.75rem",textAlign:"center"},children:["+",m.length-20," more..."]})]})]})}var s=a(9339);let n=(0,s.createServerReference)("602b68b17c7bc4830486c2776d9e50f224e11cd8ec",s.callServer,void 0,s.findSourceMapURL,"saveFS");function c({ursItems:e,riskItems:t,existingFSCount:a,stepsByType:s}){let c,p,m,[h,g]=(0,l.useState)("FS-"+String(a+1).padStart(3,"0")),[x,v]=(0,l.useState)(""),[y,b]=(0,l.useState)(""),[j,f]=(0,l.useState)([""]),[S,C]=(0,l.useState)([]),[k,N]=(0,l.useState)([]),[w,R]=(0,l.useState)([{name:"",steps:[{type:"given",text:""},{type:"when",text:""},{type:"then",text:""}]}]),[B,$]=(0,l.useState)({type:"idle"}),[L,T]=(0,l.useTransition)(),_=(c=[...S.map(e=>`@${e}`),...k.map(e=>`@${e}`)].join(" "),p=j.filter(e=>e.trim()).map(e=>` - ${e}`).join("\n"),m=w.filter(e=>e.name.trim()).map(e=>{let t=e.steps.filter(e=>e.text.trim()).map(e=>` ${u(e.type)} ${e.text}`).join("\n");return` Scenario: ${e.name}
2
+ ${t}`}).join("\n\n"),`${c}
3
3
  Feature: ${h} ${x}
4
4
  ${y}
5
5
 
@@ -7,4 +7,4 @@ Feature: ${h} ${x}
7
7
  ${p}
8
8
 
9
9
  ${m}
10
- `),z=()=>`${h}-${x.toLowerCase().replace(/\s+/g,"-")}.requirement`;return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1.5rem"},children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDCDD Editor"}),(0,r.jsx)(c,{label:"FS ID",children:(0,r.jsx)("input",{type:"text",value:h,onChange:e=>g(e.target.value),className:"input"})}),(0,r.jsx)(c,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:x,onChange:e=>v(e.target.value),placeholder:"e.g., User Login Authentication",className:"input"})}),(0,r.jsx)(c,{label:"Description",children:(0,r.jsx)("textarea",{value:y,onChange:e=>b(e.target.value),placeholder:"The system shall...",rows:3,className:"input",style:{resize:"vertical"}})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(c,{label:"Link URS",children:(0,r.jsx)(i,{options:e.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:S,onChange:C,placeholder:"Search URS...",multi:!0})}),(0,r.jsx)(c,{label:"Link Risks",children:(0,r.jsx)(i,{options:t.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:k,onChange:N,placeholder:"Search Risks...",multi:!0})})]}),(0,r.jsx)(c,{label:"Requirements",action:{label:"+",onClick:()=>f([...j,""])},children:j.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{var a;let r;return a=e.target.value,void((r=[...j])[t]=a,f(r))},placeholder:`FR-${h.split("-")[1]}.${t+1}: Requirement description`,className:"input",style:{flex:1}}),j.length>1&&(0,r.jsx)("button",{onClick:()=>{f(j.filter((e,a)=>a!==t))},className:"btn-icon",children:"\xd7"})]},t))}),(0,r.jsx)(c,{label:"Test Scenarios",action:{label:"+ Scenario",onClick:()=>{R([...w,{name:"",steps:[{type:"given",text:""},{type:"when",text:""},{type:"then",text:""}]}])}},children:w.map((e,t)=>(0,r.jsx)(d,{scenario:e,index:t,stepsByType:s,onNameChange:e=>{let a;(a=[...w])[t].name=e,R(a)},onStepChange:(e,a)=>{let r;(r=[...w])[t].steps[e].text=a,R(r)},onAddStep:e=>{let a;(a=[...w])[t].steps.push({type:e,text:""}),R(a)},onRemoveStep:e=>{let a;(a=[...w])[t].steps=a[t].steps.filter((t,a)=>a!==e),R(a)},onRemove:()=>{R(w.filter((e,a)=>a!==t))},canRemove:w.length>1},t))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"\uD83D\uDCC4 Preview (.requirement)"}),(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,r.jsx)("button",{onClick:()=>{let e=new Blob([_],{type:"text/plain"}),t=URL.createObjectURL(e),a=document.createElement("a");a.href=t,a.download=z(),a.click(),URL.revokeObjectURL(t)},className:"btn",style:{background:"var(--bg-hover)"},children:"⬇️ Download"}),(0,r.jsx)("button",{onClick:()=>{$({type:"idle"}),T(async()=>{let e=await n(z(),_);e.success?$({type:"success",message:`Saved as ${e.id}`}):$({type:"error",message:e.error})})},className:"btn btn-primary",disabled:L||!x.trim(),children:L?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save to specs/fs/"})]})]}),"idle"!==B.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===B.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===B.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===B.type?"✅":"❌"," ",B.message]}),(0,r.jsx)("pre",{style:{background:"var(--bg-hover)",padding:"1rem",borderRadius:"8px",overflow:"auto",whiteSpace:"pre-wrap",fontFamily:"monospace",fontSize:"0.875rem",lineHeight:1.6,maxHeight:"calc(100vh - 300px)"},children:_})]})]})}function c({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}function d({scenario:e,stepsByType:t,onNameChange:a,onStepChange:l,onAddStep:s,onRemoveStep:n,onRemove:o,canRemove:c}){return(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.75rem"},children:[(0,r.jsx)("input",{type:"text",value:e.name,onChange:e=>a(e.target.value),placeholder:"Scenario name (e.g., Successful login)",className:"input",style:{flex:1,fontWeight:500}}),c&&(0,r.jsx)("button",{onClick:o,className:"btn-icon",children:"\xd7"})]}),e.steps.map((e,a)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem",alignItems:"center"},children:[(0,r.jsx)("span",{style:{minWidth:"50px",fontSize:"0.75rem",fontWeight:600,color:{given:"#a78bfa",when:"#60a5fa",then:"#34d399",and:"#94a3b8",but:"#f472b6"}[e.type]||"var(--text-secondary)",textTransform:"capitalize"},children:e.type}),(0,r.jsx)(i,{options:t[e.type].map(e=>({value:e.replace(/^(Given|When|Then|And|But)\s+/,""),label:e})),selected:e.text?[e.text]:[],onChange:e=>l(a,e[0]||""),placeholder:`Select or type ${e.type} step...`,multi:!1,allowCustom:!1}),(0,r.jsx)("button",{onClick:()=>n(a),className:"btn-icon",children:"\xd7"})]},a)),(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.75rem"},children:["and","but"].map(e=>(0,r.jsxs)("button",{onClick:()=>s(e),className:"btn",style:{padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:["+ ",u(e)]},e))})]})}function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}let p=(0,s.createServerReference)("4053fbbaeee5198306e625ddeb37160b138db1e8f4",s.callServer,void 0,s.findSourceMapURL,"saveURS");function m({existingCount:e}){let[t,a]=(0,l.useState)(""),[i,s]=(0,l.useState)("draft"),[n,o]=(0,l.useState)("high"),[c,d]=(0,l.useState)(""),[u,m]=(0,l.useState)(""),[g,x]=(0,l.useState)(""),[v,y]=(0,l.useState)(""),[b,j]=(0,l.useState)([""]),[f,S]=(0,l.useState)(["GAMP 5"]),[C,k]=(0,l.useState)({type:"idle"}),[N,w]=(0,l.useTransition)();return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"\uD83D\uDCCB New URS"}),(0,r.jsx)("button",{onClick:()=>{k({type:"idle"}),w(async()=>{let e=await p({title:t,status:i,priority:n,owner:c,category:u,business_need:g,intended_use:v,acceptance_criteria:b.filter(e=>e.trim()),regulatory_refs:f.filter(e=>e.trim())});e.success?k({type:"success",message:`Created ${e.id}`}):k({type:"error",message:e.error})})},className:"btn btn-primary",disabled:N||!t.trim()||!c.trim(),children:N?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save"})]}),"idle"!==C.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===C.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===C.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===C.type?"✅":"❌"," ",C.message]}),(0,r.jsx)(h,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:"e.g., User Authentication",className:"input"})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"1rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(h,{label:"Status",children:(0,r.jsxs)("select",{value:i,onChange:e=>s(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"draft",children:"Draft"}),(0,r.jsx)("option",{value:"review",children:"Review"}),(0,r.jsx)("option",{value:"approved",children:"Approved"})]})}),(0,r.jsx)(h,{label:"Priority",children:(0,r.jsxs)("select",{value:n,onChange:e=>o(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"critical",children:"Critical"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"low",children:"Low"})]})}),(0,r.jsx)(h,{label:"Category",children:(0,r.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"e.g., Security",className:"input"})})]}),(0,r.jsx)(h,{label:"Owner",children:(0,r.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"e.g., Product Team",className:"input"})}),(0,r.jsx)(h,{label:"Business Need",children:(0,r.jsx)("textarea",{value:g,onChange:e=>x(e.target.value),placeholder:"Describe why this requirement exists...",rows:4,className:"input",style:{resize:"vertical"}})}),(0,r.jsx)(h,{label:"Intended Use",children:(0,r.jsx)("textarea",{value:v,onChange:e=>y(e.target.value),placeholder:"Describe how this will be used...",rows:3,className:"input",style:{resize:"vertical"}})}),(0,r.jsx)(h,{label:"Acceptance Criteria",action:{label:"+",onClick:()=>j([...b,""])},children:b.map((e,t)=>(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{var a;let r;return a=e.target.value,void((r=[...b])[t]=a,j(r))},placeholder:`Criterion ${t+1}`,className:"input",style:{flex:1}})},t))})]})}function h({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}let g=(0,s.createServerReference)("403409638eb593eaa785d2919a0816535c64a9c9c5",s.callServer,void 0,s.findSourceMapURL,"saveRisk");function x({fsItems:e,existingCount:t}){let[a,s]=(0,l.useState)(""),[n,o]=(0,l.useState)("draft"),[c,d]=(0,l.useState)(""),[u,p]=(0,l.useState)(4),[m,h]=(0,l.useState)("medium"),[x,y]=(0,l.useState)("medium"),[b,j]=(0,l.useState)("medium"),[f,S]=(0,l.useState)("acceptable"),[C,k]=(0,l.useState)([]),[N,w]=(0,l.useState)([{id:"R-001.1",description:"",impact:"medium",probability:"medium"}]),[R,B]=(0,l.useState)([{risk_id:"R-001.1",control:"",test:""}]),[$,L]=(0,l.useState)({type:"idle"}),[T,_]=(0,l.useTransition)(),z=(e,t,a)=>{let r=[...N];r[e]={...r[e],[t]:a},w(r)},U=(e,t,a)=>{let r=[...R];r[e]={...r[e],[t]:a},B(r)};return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"⚠️ New Risk"}),(0,r.jsx)("button",{onClick:()=>{L({type:"idle"}),_(async()=>{let e=await g({title:a,status:n,category:c,gamp_category:u,fs_ids:C,impact:m,probability:x,risk_level:b,risks:N.filter(e=>e.description.trim()).map(e=>({id:e.id,description:e.description,impact:e.impact,probability:e.probability})),mitigations:R.filter(e=>e.control.trim()).map(e=>({risk_id:e.risk_id,control:e.control,test:e.test})),residual_risk:f});e.success?L({type:"success",message:`Created ${e.id}`}):L({type:"error",message:e.error})})},className:"btn btn-primary",disabled:T||!a.trim()||0===C.length,children:T?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save"})]}),"idle"!==$.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===$.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===$.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===$.type?"✅":"❌"," ",$.message]}),(0,r.jsx)(v,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:a,onChange:e=>s(e.target.value),placeholder:"e.g., Authentication Security",className:"input"})}),(0,r.jsx)(v,{label:"Category",children:(0,r.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:"e.g., Security, Data Integrity",className:"input"})}),(0,r.jsx)(v,{label:"Link FS",children:(0,r.jsx)(i,{options:e.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:C,onChange:k,placeholder:"Search FS...",multi:!0})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"0.5rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(v,{label:"Impact",children:(0,r.jsxs)("select",{value:m,onChange:e=>h(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"critical",children:"Critical"})]})}),(0,r.jsx)(v,{label:"Probability",children:(0,r.jsxs)("select",{value:x,onChange:e=>y(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"})]})}),(0,r.jsx)(v,{label:"Risk Level",children:(0,r.jsxs)("select",{value:b,onChange:e=>j(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"critical",children:"Critical"})]})}),(0,r.jsx)(v,{label:"Residual",children:(0,r.jsxs)("select",{value:f,onChange:e=>S(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"acceptable",children:"Acceptable"}),(0,r.jsx)("option",{value:"unacceptable",children:"Unacceptable"}),(0,r.jsx)("option",{value:"pending",children:"Pending"})]})})]}),(0,r.jsx)(v,{label:"Identified Risks",action:{label:"+",onClick:()=>w([...N,{id:`R-001.${N.length+1}`,description:"",impact:"medium",probability:"medium"}])},children:N.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e.id,onChange:e=>z(t,"id",e.target.value),placeholder:"R-001.1",className:"input",style:{width:"80px"}}),(0,r.jsx)("input",{type:"text",value:e.description,onChange:e=>z(t,"description",e.target.value),placeholder:"Risk description",className:"input",style:{flex:1}})]},t))}),(0,r.jsx)(v,{label:"Mitigations",action:{label:"+",onClick:()=>B([...R,{risk_id:"",control:"",test:""}])},children:R.map((e,t)=>(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr 1fr",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e.risk_id,onChange:e=>U(t,"risk_id",e.target.value),placeholder:"R-ID",className:"input"}),(0,r.jsx)("input",{type:"text",value:e.control,onChange:e=>U(t,"control",e.target.value),placeholder:"Control measure",className:"input"}),(0,r.jsx)("input",{type:"text",value:e.test,onChange:e=>U(t,"test",e.target.value),placeholder:"How to test",className:"input"})]},t))})]})}function v({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}function y({ursItems:e,riskItems:t,fsItems:a,counts:i,stepsByType:s}){let[n,c]=(0,l.useState)("fs");return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1.5rem"},children:[{id:"urs",label:"URS",icon:"\uD83D\uDCCB",color:"var(--success)"},{id:"fs",label:"FS",icon:"⚙️",color:"var(--warning)"},{id:"risk",label:"Risk",icon:"⚠️",color:"#f97316"}].map(e=>(0,r.jsxs)("button",{onClick:()=>c(e.id),className:`btn ${n===e.id?"btn-primary":""}`,style:n!==e.id?{background:"var(--bg-hover)"}:{},children:[e.icon," New ",e.label]},e.id))}),"urs"===n&&(0,r.jsx)(m,{existingCount:i.urs}),"fs"===n&&(0,r.jsx)(o,{ursItems:e,riskItems:t,existingFSCount:i.fs,stepsByType:s}),"risk"===n&&(0,r.jsx)(x,{fsItems:a,existingCount:i.risk})]})}},9339:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return i.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return s.findSourceMapURL}};for(var l in r)Object.defineProperty(t,l,{enumerable:!0,get:r[l]});let i=a(7304),s=a(4060),n=a(7197)}},e=>{e.O(0,[441,794,358],()=>e(e.s=994)),_N_E=e.O()}]);
10
+ `),z=()=>`${h}-${x.toLowerCase().replace(/\s+/g,"-")}.requirement`;return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1.5rem"},children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDCDD Editor"}),(0,r.jsx)(o,{label:"FS ID",children:(0,r.jsx)("input",{type:"text",value:h,onChange:e=>g(e.target.value),className:"input"})}),(0,r.jsx)(o,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:x,onChange:e=>v(e.target.value),placeholder:"e.g., User Login Authentication",className:"input"})}),(0,r.jsx)(o,{label:"Description",children:(0,r.jsx)("textarea",{value:y,onChange:e=>b(e.target.value),placeholder:"The system shall...",rows:3,className:"input",style:{resize:"vertical"}})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(o,{label:"Link URS",children:(0,r.jsx)(i,{options:e.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:S,onChange:C,placeholder:"Search URS...",multi:!0})}),(0,r.jsx)(o,{label:"Link Risks",children:(0,r.jsx)(i,{options:t.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:k,onChange:N,placeholder:"Search Risks...",multi:!0})})]}),(0,r.jsx)(o,{label:"Requirements",action:{label:"+",onClick:()=>f([...j,""])},children:j.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{var a;let r;return a=e.target.value,void((r=[...j])[t]=a,f(r))},placeholder:`FR-${h.split("-")[1]}.${t+1}: Requirement description`,className:"input",style:{flex:1}}),j.length>1&&(0,r.jsx)("button",{onClick:()=>{f(j.filter((e,a)=>a!==t))},className:"btn-icon",children:"\xd7"})]},t))}),(0,r.jsx)(o,{label:"Test Scenarios",action:{label:"+ Scenario",onClick:()=>{R([...w,{name:"",steps:[{type:"given",text:""},{type:"when",text:""},{type:"then",text:""}]}])}},children:w.map((e,t)=>(0,r.jsx)(d,{scenario:e,index:t,stepsByType:s,onNameChange:e=>{let a;(a=[...w])[t].name=e,R(a)},onStepChange:(e,a)=>{let r;(r=[...w])[t].steps[e].text=a,R(r)},onAddStep:e=>{let a;(a=[...w])[t].steps.push({type:e,text:""}),R(a)},onRemoveStep:e=>{let a;(a=[...w])[t].steps=a[t].steps.filter((t,a)=>a!==e),R(a)},onRemove:()=>{R(w.filter((e,a)=>a!==t))},canRemove:w.length>1},t))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"\uD83D\uDCC4 Preview (.requirement)"}),(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,r.jsx)("button",{onClick:()=>{let e=new Blob([_],{type:"text/plain"}),t=URL.createObjectURL(e),a=document.createElement("a");a.href=t,a.download=z(),a.click(),URL.revokeObjectURL(t)},className:"btn",style:{background:"var(--bg-hover)"},children:"⬇️ Download"}),(0,r.jsx)("button",{onClick:()=>{$({type:"idle"}),T(async()=>{let e=await n(z(),_);e.success?$({type:"success",message:`Saved as ${e.id}`}):$({type:"error",message:e.error})})},className:"btn btn-primary",disabled:L||!x.trim(),children:L?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save to specs/fs/"})]})]}),"idle"!==B.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===B.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===B.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===B.type?"✅":"❌"," ",B.message]}),(0,r.jsx)("pre",{style:{background:"var(--bg-hover)",padding:"1rem",borderRadius:"8px",overflow:"auto",whiteSpace:"pre-wrap",fontFamily:"monospace",fontSize:"0.875rem",lineHeight:1.6,maxHeight:"calc(100vh - 300px)"},children:_})]})]})}function o({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}function d({scenario:e,stepsByType:t,onNameChange:a,onStepChange:l,onAddStep:s,onRemoveStep:n,onRemove:c,canRemove:o}){return(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.75rem"},children:[(0,r.jsx)("input",{type:"text",value:e.name,onChange:e=>a(e.target.value),placeholder:"Scenario name (e.g., Successful login)",className:"input",style:{flex:1,fontWeight:500}}),o&&(0,r.jsx)("button",{onClick:c,className:"btn-icon",children:"\xd7"})]}),e.steps.map((e,a)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem",alignItems:"center"},children:[(0,r.jsx)("span",{style:{minWidth:"50px",fontSize:"0.75rem",fontWeight:600,color:{given:"#a78bfa",when:"#60a5fa",then:"#34d399",and:"#94a3b8",but:"#f472b6"}[e.type]||"var(--text-secondary)",textTransform:"capitalize"},children:e.type}),(0,r.jsx)(i,{options:t[e.type].map(e=>({value:e.replace(/^(Given|When|Then|And|But)\s+/,""),label:e})),selected:e.text?[e.text]:[],onChange:e=>l(a,e[0]||""),placeholder:`Select or type ${e.type} step...`,multi:!1,allowCustom:!1}),(0,r.jsx)("button",{onClick:()=>n(a),className:"btn-icon",children:"\xd7"})]},a)),(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.75rem"},children:["and","but"].map(e=>(0,r.jsxs)("button",{onClick:()=>s(e),className:"btn",style:{padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:["+ ",u(e)]},e))})]})}function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}let p=(0,s.createServerReference)("4097b73a5fa0783efc8cc3420805f380c539814759",s.callServer,void 0,s.findSourceMapURL,"saveURS");function m({existingCount:e}){let[t,a]=(0,l.useState)(""),[i,s]=(0,l.useState)("draft"),[n,c]=(0,l.useState)("high"),[o,d]=(0,l.useState)(""),[u,m]=(0,l.useState)(""),[g,x]=(0,l.useState)(""),[v,y]=(0,l.useState)(""),[b,j]=(0,l.useState)([""]),[f,S]=(0,l.useState)(["GAMP 5"]),[C,k]=(0,l.useState)({type:"idle"}),[N,w]=(0,l.useTransition)();return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"\uD83D\uDCCB New URS"}),(0,r.jsx)("button",{onClick:()=>{k({type:"idle"}),w(async()=>{let e=await p({title:t,status:i,priority:n,owner:o,category:u,business_need:g,intended_use:v,acceptance_criteria:b.filter(e=>e.trim()),regulatory_refs:f.filter(e=>e.trim())});e.success?k({type:"success",message:`Created ${e.id}`}):k({type:"error",message:e.error})})},className:"btn btn-primary",disabled:N||!t.trim()||!o.trim(),children:N?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save"})]}),"idle"!==C.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===C.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===C.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===C.type?"✅":"❌"," ",C.message]}),(0,r.jsx)(h,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:t,onChange:e=>a(e.target.value),placeholder:"e.g., User Authentication",className:"input"})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"1rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(h,{label:"Status",children:(0,r.jsxs)("select",{value:i,onChange:e=>s(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"draft",children:"Draft"}),(0,r.jsx)("option",{value:"review",children:"Review"}),(0,r.jsx)("option",{value:"approved",children:"Approved"})]})}),(0,r.jsx)(h,{label:"Priority",children:(0,r.jsxs)("select",{value:n,onChange:e=>c(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"critical",children:"Critical"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"low",children:"Low"})]})}),(0,r.jsx)(h,{label:"Category",children:(0,r.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),placeholder:"e.g., Security",className:"input"})})]}),(0,r.jsx)(h,{label:"Owner",children:(0,r.jsx)("input",{type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"e.g., Product Team",className:"input"})}),(0,r.jsx)(h,{label:"Business Need",children:(0,r.jsx)("textarea",{value:g,onChange:e=>x(e.target.value),placeholder:"Describe why this requirement exists...",rows:4,className:"input",style:{resize:"vertical"}})}),(0,r.jsx)(h,{label:"Intended Use",children:(0,r.jsx)("textarea",{value:v,onChange:e=>y(e.target.value),placeholder:"Describe how this will be used...",rows:3,className:"input",style:{resize:"vertical"}})}),(0,r.jsx)(h,{label:"Acceptance Criteria",action:{label:"+",onClick:()=>j([...b,""])},children:b.map((e,t)=>(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{var a;let r;return a=e.target.value,void((r=[...b])[t]=a,j(r))},placeholder:`Criterion ${t+1}`,className:"input",style:{flex:1}})},t))})]})}function h({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}let g=(0,s.createServerReference)("4085694e4b2b14c8b7c44b70ed5c81ac81e286b9d4",s.callServer,void 0,s.findSourceMapURL,"saveRisk");function x({fsItems:e,existingCount:t}){let[a,s]=(0,l.useState)(""),[n,c]=(0,l.useState)("draft"),[o,d]=(0,l.useState)(""),[u,p]=(0,l.useState)(4),[m,h]=(0,l.useState)("medium"),[x,y]=(0,l.useState)("medium"),[b,j]=(0,l.useState)("medium"),[f,S]=(0,l.useState)("acceptable"),[C,k]=(0,l.useState)([]),[N,w]=(0,l.useState)([{id:"R-001.1",description:"",impact:"medium",probability:"medium"}]),[R,B]=(0,l.useState)([{risk_id:"R-001.1",control:"",test:""}]),[$,L]=(0,l.useState)({type:"idle"}),[T,_]=(0,l.useTransition)(),z=(e,t,a)=>{let r=[...N];r[e]={...r[e],[t]:a},w(r)},U=(e,t,a)=>{let r=[...R];r[e]={...r[e],[t]:a},B(r)};return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"⚠️ New Risk"}),(0,r.jsx)("button",{onClick:()=>{L({type:"idle"}),_(async()=>{let e=await g({title:a,status:n,category:o,gamp_category:u,fs_ids:C,impact:m,probability:x,risk_level:b,risks:N.filter(e=>e.description.trim()).map(e=>({id:e.id,description:e.description,impact:e.impact,probability:e.probability})),mitigations:R.filter(e=>e.control.trim()).map(e=>({risk_id:e.risk_id,control:e.control,test:e.test})),residual_risk:f});e.success?L({type:"success",message:`Created ${e.id}`}):L({type:"error",message:e.error})})},className:"btn btn-primary",disabled:T||!a.trim()||0===C.length,children:T?"\uD83D\uDCBE Saving...":"\uD83D\uDCBE Save"})]}),"idle"!==$.type&&(0,r.jsxs)("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",borderRadius:"8px",background:"success"===$.type?"rgba(16, 185, 129, 0.1)":"rgba(239, 68, 68, 0.1)",color:"success"===$.type?"var(--success)":"var(--error)",fontSize:"0.875rem"},children:["success"===$.type?"✅":"❌"," ",$.message]}),(0,r.jsx)(v,{label:"Title",children:(0,r.jsx)("input",{type:"text",value:a,onChange:e=>s(e.target.value),placeholder:"e.g., Authentication Security",className:"input"})}),(0,r.jsx)(v,{label:"Category",children:(0,r.jsx)("input",{type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"e.g., Security, Data Integrity",className:"input"})}),(0,r.jsx)(v,{label:"Link FS",children:(0,r.jsx)(i,{options:e.map(e=>({value:e.id,label:`${e.id} - ${e.title}`})),selected:C,onChange:k,placeholder:"Search FS...",multi:!0})}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"0.5rem",marginBottom:"1.5rem"},children:[(0,r.jsx)(v,{label:"Impact",children:(0,r.jsxs)("select",{value:m,onChange:e=>h(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"critical",children:"Critical"})]})}),(0,r.jsx)(v,{label:"Probability",children:(0,r.jsxs)("select",{value:x,onChange:e=>y(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"})]})}),(0,r.jsx)(v,{label:"Risk Level",children:(0,r.jsxs)("select",{value:b,onChange:e=>j(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"low",children:"Low"}),(0,r.jsx)("option",{value:"medium",children:"Medium"}),(0,r.jsx)("option",{value:"high",children:"High"}),(0,r.jsx)("option",{value:"critical",children:"Critical"})]})}),(0,r.jsx)(v,{label:"Residual",children:(0,r.jsxs)("select",{value:f,onChange:e=>S(e.target.value),className:"input",children:[(0,r.jsx)("option",{value:"acceptable",children:"Acceptable"}),(0,r.jsx)("option",{value:"unacceptable",children:"Unacceptable"}),(0,r.jsx)("option",{value:"pending",children:"Pending"})]})})]}),(0,r.jsx)(v,{label:"Identified Risks",action:{label:"+",onClick:()=>w([...N,{id:`R-001.${N.length+1}`,description:"",impact:"medium",probability:"medium"}])},children:N.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e.id,onChange:e=>z(t,"id",e.target.value),placeholder:"R-001.1",className:"input",style:{width:"80px"}}),(0,r.jsx)("input",{type:"text",value:e.description,onChange:e=>z(t,"description",e.target.value),placeholder:"Risk description",className:"input",style:{flex:1}})]},t))}),(0,r.jsx)(v,{label:"Mitigations",action:{label:"+",onClick:()=>B([...R,{risk_id:"",control:"",test:""}])},children:R.map((e,t)=>(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr 1fr",gap:"0.5rem",marginBottom:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e.risk_id,onChange:e=>U(t,"risk_id",e.target.value),placeholder:"R-ID",className:"input"}),(0,r.jsx)("input",{type:"text",value:e.control,onChange:e=>U(t,"control",e.target.value),placeholder:"Control measure",className:"input"}),(0,r.jsx)("input",{type:"text",value:e.test,onChange:e=>U(t,"test",e.target.value),placeholder:"How to test",className:"input"})]},t))})]})}function v({label:e,children:t,action:a}){return(0,r.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"0.5rem"},children:[(0,r.jsx)("label",{style:{fontWeight:500},children:e}),a&&(0,r.jsx)("button",{onClick:a.onClick,className:"btn",style:{marginLeft:"0.75rem",padding:"0.25rem 0.5rem",fontSize:"0.75rem"},children:a.label})]}),t]})}function y({ursItems:e,riskItems:t,fsItems:a,counts:i,stepsByType:s}){let[n,o]=(0,l.useState)("fs");return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1.5rem"},children:[{id:"urs",label:"URS",icon:"\uD83D\uDCCB",color:"var(--success)"},{id:"fs",label:"FS",icon:"⚙️",color:"var(--warning)"},{id:"risk",label:"Risk",icon:"⚠️",color:"#f97316"}].map(e=>(0,r.jsxs)("button",{onClick:()=>o(e.id),className:`btn ${n===e.id?"btn-primary":""}`,style:n!==e.id?{background:"var(--bg-hover)"}:{},children:[e.icon," New ",e.label]},e.id))}),"urs"===n&&(0,r.jsx)(m,{existingCount:i.urs}),"fs"===n&&(0,r.jsx)(c,{ursItems:e,riskItems:t,existingFSCount:i.fs,stepsByType:s}),"risk"===n&&(0,r.jsx)(x,{fsItems:a,existingCount:i.risk})]})}},9339:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return i.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return s.findSourceMapURL}};for(var l in r)Object.defineProperty(t,l,{enumerable:!0,get:r[l]});let i=a(7304),s=a(4060),n=a(7197)}},e=>{e.O(0,[441,794,358],()=>e(e.s=994)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[41],{2940:(e,t,r)=>{"use strict";r.d(t,{ReleaseDetailClient:()=>h});var s=r(5155),i=r(2115),a=r(8500),l=r.n(a),n=r(9339);let o=(0,n.createServerReference)("6044f37d73f80ced74d04012a4acd2722aa0f5629c",n.callServer,void 0,n.findSourceMapURL,"updateReleaseAction"),d=(0,n.createServerReference)("6087b612d8ae2f92bf9b052a68daaa99ef945e2755",n.callServer,void 0,n.findSourceMapURL,"tagFSToReleaseAction"),c=(0,n.createServerReference)("6044d053c155caff6616ff229bd75461a60befb59b",n.callServer,void 0,n.findSourceMapURL,"untagFSFromReleaseAction"),m=(0,n.createServerReference)("40be6975492692156210167b8e45cfff82ad857711",n.callServer,void 0,n.findSourceMapURL,"createDefectAction");function h({release:e,taggedFS:t,availableFS:r,testRuns:a,defects:n}){let[h,p]=(0,i.useState)(!1),[g,x]=(0,i.useState)(!1),[v,u]=(0,i.useState)([]),[y,f]=(0,i.useState)(null),[j,b]=(0,i.useState)({isOpen:!1}),[S,N]=(0,i.useState)({title:"",description:"",status:"open"}),[C,k]=(0,i.useState)({titleError:!1,descriptionError:!1}),[R,w]=(0,i.useTransition)(),[B,W]=(0,i.useState)({version:e.version,name:e.name,status:e.status,notes:e.notes||""}),_={planning:{bg:"rgba(168, 85, 247, 0.1)",color:"#a855f7"},testing:{bg:"rgba(59, 130, 246, 0.1)",color:"#3b82f6"},released:{bg:"rgba(34, 197, 94, 0.1)",color:"#22c55e"}}[e.status];return(0,s.jsxs)("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"2rem"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem"},children:(0,s.jsx)(l(),{href:"/releases",style:{color:"var(--text-secondary)",textDecoration:"none"},children:"← Back to Releases"})}),(0,s.jsxs)("header",{style:{marginBottom:"2rem"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem"},children:[(0,s.jsxs)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:_.color},children:[" ",e.id," "]}),(0,s.jsxs)("span",{style:{fontSize:"1.25rem",fontWeight:600},children:["v",e.version]}),(0,s.jsx)("span",{className:"badge",style:{background:_.bg,color:_.color,padding:"0.5rem 1rem"},children:e.status}),(0,s.jsx)("button",{onClick:()=>p(!h),className:"btn btn-primary",style:{marginLeft:"auto"},children:h?"Cancel":"✏️ Edit"})]}),(0,s.jsx)("h1",{style:{fontSize:"2rem",fontWeight:700},children:e.name}),(0,s.jsxs)("p",{style:{color:"var(--text-secondary)"},children:["Created ",e.created_at,e.released_at&&` • Released ${e.released_at}`]})]}),h&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Edit Release"}),(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr 1fr",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Version"}),(0,s.jsx)("input",{type:"text",value:B.version,onChange:e=>W({...B,version:e.target.value}),className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Name"}),(0,s.jsx)("input",{type:"text",value:B.name,onChange:e=>W({...B,name:e.target.value}),className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Status"}),(0,s.jsxs)("select",{value:B.status,onChange:e=>W({...B,status:e.target.value}),className:"input",children:[(0,s.jsx)("option",{value:"planning",children:"Planning"}),(0,s.jsx)("option",{value:"testing",children:"Testing"}),(0,s.jsx)("option",{value:"released",children:"Released"})]})]})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Notes"}),(0,s.jsx)("textarea",{value:B.notes,onChange:e=>W({...B,notes:e.target.value}),rows:3,className:"input",style:{resize:"vertical"}})]}),(0,s.jsx)("button",{onClick:()=>{w(async()=>{await o(e.id,B),p(!1)})},className:"btn btn-primary",disabled:R,children:R?"Saving...":"Save Changes"})]}),e.notes&&!h&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"\uD83D\uDCDD Notes"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:e.notes})]}),(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem",borderLeft:"4px solid var(--error)"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,s.jsxs)("h2",{className:"card-title",children:["\uD83D\uDEA8 Defects & Deviations (",n.length,")"]}),(0,s.jsx)("button",{className:"btn",onClick:()=>{b({isOpen:!0,testResultId:void 0,fsId:void 0,scenarioName:void 0}),N({title:"",description:"",status:"open"})},children:"+ Log Defect"})]}),0===n.length?(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No defects logged. Any failed tests must be resolved or logged as a defect."}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:n.map(e=>(0,s.jsxs)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px",borderLeft:"open"===e.status?"3px solid red":"3px solid green"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"0.5rem"},children:[(0,s.jsxs)("div",{style:{fontWeight:600},children:[e.id,": ",e.title]}),(0,s.jsx)("div",{className:"badge",style:{background:"open"===e.status?"rgba(239, 68, 68, 0.1)":"rgba(34, 197, 94, 0.1)",color:"open"===e.status?"var(--error)":"var(--success)"},children:e.status.toUpperCase()})]}),(0,s.jsx)("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:e.description}),e.test_result_id&&(0,s.jsxs)("div",{style:{marginTop:"0.5rem",fontSize:"0.75rem",color:"var(--warning)"},children:["Linked to failed test result #",e.test_result_id]})]},e.id))})]}),(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,s.jsxs)("h2",{className:"card-title",style:{margin:0},children:["⚙️ Features (",t.length,")"]}),(0,s.jsx)("button",{onClick:()=>x(!0),className:"btn",disabled:0===r.length,children:"+ Add Features"})]}),g&&(0,s.jsxs)("div",{style:{marginBottom:"1rem",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsx)("div",{style:{marginBottom:"0.5rem",fontWeight:500},children:"Select features to add:"}),(0,s.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",marginBottom:"1rem"},children:r.map(e=>(0,s.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"},children:[(0,s.jsx)("input",{type:"checkbox",checked:v.includes(e.id),onChange:t=>{t.target.checked?u([...v,e.id]):u(v.filter(t=>t!==e.id))}}),(0,s.jsx)("code",{style:{color:"var(--warning)"},children:e.id}),(0,s.jsx)("span",{children:e.title})]},e.id))}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,s.jsx)("button",{onClick:()=>{x(!1),u([])},className:"btn",children:"Cancel"}),(0,s.jsx)("button",{onClick:()=>{0!==v.length&&w(async()=>{await d(e.id,v),x(!1),u([])})},className:"btn btn-primary",disabled:R||0===v.length,children:R?"Adding...":`Add ${v.length} Feature${1!==v.length?"s":""}`})]})]}),0===t.length?(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No features tagged yet. Add features to track them in this release."}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:t.map(t=>(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",padding:"0.75rem 1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsxs)(l(),{href:`/specs/${t.id}`,style:{flex:1,textDecoration:"none"},children:[(0,s.jsx)("code",{style:{fontWeight:600,color:"var(--warning)",marginRight:"0.75rem"},children:t.id}),(0,s.jsx)("span",{style:{color:"var(--text-primary)"},children:t.title}),(0,s.jsxs)("span",{style:{marginLeft:"0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem"},children:[t.scenario_count," scenarios"]})]}),(0,s.jsx)("button",{onClick:()=>{var r;return r=t.id,void w(async()=>{await c(e.id,r)})},className:"btn",style:{padding:"0.25rem 0.5rem",fontSize:"0.75rem"},disabled:R,children:"\xd7"})]},t.id))})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("h2",{className:"card-title",children:["\uD83E\uDDEA Test Runs (",a.length,")"]}),0===a.length?(0,s.jsxs)("p",{style:{color:"var(--text-secondary)"},children:["No test runs yet. Import Cucumber results: ",(0,s.jsxs)("code",{children:["machine release import-results results.json -r ",e.id]})]}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:a.map(e=>{let t=e.total>0?e.passed/e.total*100:0,r=y===e.id;return(0,s.jsxs)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"},onClick:()=>f(r?null:e.id),children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[e.failed>0?"❌":"✅"," Run #",e.id," ",r?"\uD83D\uDD3D":"▶"]}),(0,s.jsxs)("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)"},children:[e.run_date," • ",e.source]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"1rem",textAlign:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:700,color:"var(--success)"},children:e.passed}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Passed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:700,color:"var(--error)"},children:e.failed}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Failed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontWeight:700,color:100===t?"var(--success)":t>=80?"var(--warning)":"var(--error)"},children:[t.toFixed(0),"%"]}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pass Rate"})]})]})]}),r&&(0,s.jsx)("div",{style:{marginTop:"1rem",paddingTop:"1rem",borderTop:"1px solid var(--border)"},children:(0,s.jsx)("p",{style:{fontStyle:"italic",color:"var(--text-secondary)"},children:"Detailed results view would go here. For now, check the console logs or database for failure details."})})]},e.id)})})]}),j.isOpen&&(0,s.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:(0,s.jsxs)("div",{className:"card",style:{width:"500px",maxWidth:"90%"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Log Defect / Deviation"}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsxs)("label",{style:{display:"block",marginBottom:"0.5rem"},children:["Title ",(0,s.jsx)("span",{style:{color:"var(--error)"},children:"*"})]}),(0,s.jsx)("input",{className:"input",value:S.title,onChange:e=>{N({...S,title:e.target.value}),e.target.value&&k(e=>({...e,titleError:!1}))},placeholder:"Defect summary",style:C.titleError?{borderColor:"var(--error)",boxShadow:"0 0 0 2px rgba(239, 68, 68, 0.2)"}:{}}),C.titleError&&(0,s.jsx)("div",{style:{color:"var(--error)",fontSize:"0.75rem",marginTop:"0.25rem"},children:"Title is required"})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsxs)("label",{style:{display:"block",marginBottom:"0.5rem"},children:["Description & Root Cause ",(0,s.jsx)("span",{style:{color:"var(--error)"},children:"*"})]}),(0,s.jsx)("textarea",{className:"input",rows:5,value:S.description,onChange:e=>{N({...S,description:e.target.value}),e.target.value&&k(e=>({...e,descriptionError:!1}))},placeholder:"Describe the failure, root cause, and why it is acceptable (if deviating) or mitigation plan.",style:C.descriptionError?{borderColor:"var(--error)",boxShadow:"0 0 0 2px rgba(239, 68, 68, 0.2)"}:{}}),C.descriptionError&&(0,s.jsx)("div",{style:{color:"var(--error)",fontSize:"0.75rem",marginTop:"0.25rem"},children:"Description is required"})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",marginBottom:"0.5rem"},children:"Status"}),(0,s.jsxs)("select",{className:"input",value:S.status,onChange:e=>N({...S,status:e.target.value}),children:[(0,s.jsx)("option",{value:"open",children:"Open (Needs Fix)"}),(0,s.jsx)("option",{value:"resolved",children:"Resolved (Fixed)"}),(0,s.jsx)("option",{value:"accepted",children:"Accepted (Permanent Deviation)"})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{b({isOpen:!1}),k({titleError:!1,descriptionError:!1})},children:"Cancel"}),(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>{let t=!S.title.trim(),r=!S.description.trim();t||r?k({titleError:t,descriptionError:r}):w(async()=>{try{await m({releaseId:e.id,testResultId:j.testResultId,title:S.title,description:S.description,status:S.status}),b({isOpen:!1}),N({title:"",description:"",status:"open"})}catch(e){console.error("Failed to create defect:",e),alert("Failed to create defect. Check console for details.")}})},disabled:R,children:R?"Logging...":"Log Defect"})]})]})})]})}},4926:(e,t,r)=>{Promise.resolve().then(r.bind(r,2940))},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={callServer:function(){return a.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var i in s)Object.defineProperty(t,i,{enumerable:!0,get:s[i]});let a=r(7304),l=r(4060),n=r(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=4926)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[41],{2205:(e,t,r)=>{"use strict";r.d(t,{ReleaseDetailClient:()=>h});var s=r(5155),i=r(2115),a=r(8500),l=r.n(a),n=r(9339);let o=(0,n.createServerReference)("60f673513473680a2c9608cd7c6bc4727d04873114",n.callServer,void 0,n.findSourceMapURL,"updateReleaseAction"),d=(0,n.createServerReference)("6073943507f16fd3ae23bdf27abe7daeee92df7f3c",n.callServer,void 0,n.findSourceMapURL,"tagFSToReleaseAction"),c=(0,n.createServerReference)("60742d1941cceba6bbb111a81f7e82f97a972f9bd8",n.callServer,void 0,n.findSourceMapURL,"untagFSFromReleaseAction"),m=(0,n.createServerReference)("40b4542eec3cb06c782d8bcb48e9a6bbe01d6fc701",n.callServer,void 0,n.findSourceMapURL,"createDefectAction");function h({release:e,taggedFS:t,availableFS:r,testRuns:a,defects:n}){let[h,p]=(0,i.useState)(!1),[x,g]=(0,i.useState)(!1),[v,u]=(0,i.useState)([]),[y,j]=(0,i.useState)(null),[f,b]=(0,i.useState)({isOpen:!1}),[S,N]=(0,i.useState)({title:"",description:"",status:"open"}),[C,k]=(0,i.useState)({titleError:!1,descriptionError:!1}),[R,w]=(0,i.useTransition)(),[B,W]=(0,i.useState)({version:e.version,name:e.name,status:e.status,notes:e.notes||""}),_={planning:{bg:"rgba(168, 85, 247, 0.1)",color:"#a855f7"},testing:{bg:"rgba(59, 130, 246, 0.1)",color:"#3b82f6"},released:{bg:"rgba(34, 197, 94, 0.1)",color:"#22c55e"}}[e.status];return(0,s.jsxs)("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"2rem"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem"},children:(0,s.jsx)(l(),{href:"/releases",style:{color:"var(--text-secondary)",textDecoration:"none"},children:"← Back to Releases"})}),(0,s.jsxs)("header",{style:{marginBottom:"2rem"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem"},children:[(0,s.jsxs)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:_.color},children:[" ",e.id," "]}),(0,s.jsxs)("span",{style:{fontSize:"1.25rem",fontWeight:600},children:["v",e.version]}),(0,s.jsx)("span",{className:"badge",style:{background:_.bg,color:_.color,padding:"0.5rem 1rem"},children:e.status}),(0,s.jsx)("button",{onClick:()=>p(!h),className:"btn btn-primary",style:{marginLeft:"auto"},children:h?"Cancel":"✏️ Edit"})]}),(0,s.jsx)("h1",{style:{fontSize:"2rem",fontWeight:700},children:e.name}),(0,s.jsxs)("p",{style:{color:"var(--text-secondary)"},children:["Created ",e.created_at,e.released_at&&` • Released ${e.released_at}`]})]}),h&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Edit Release"}),(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr 1fr",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Version"}),(0,s.jsx)("input",{type:"text",value:B.version,onChange:e=>W({...B,version:e.target.value}),className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Name"}),(0,s.jsx)("input",{type:"text",value:B.name,onChange:e=>W({...B,name:e.target.value}),className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Status"}),(0,s.jsxs)("select",{value:B.status,onChange:e=>W({...B,status:e.target.value}),className:"input",children:[(0,s.jsx)("option",{value:"planning",children:"Planning"}),(0,s.jsx)("option",{value:"testing",children:"Testing"}),(0,s.jsx)("option",{value:"released",children:"Released"})]})]})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Notes"}),(0,s.jsx)("textarea",{value:B.notes,onChange:e=>W({...B,notes:e.target.value}),rows:3,className:"input",style:{resize:"vertical"}})]}),(0,s.jsx)("button",{onClick:()=>{w(async()=>{await o(e.id,B),p(!1)})},className:"btn btn-primary",disabled:R,children:R?"Saving...":"Save Changes"})]}),e.notes&&!h&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"\uD83D\uDCDD Notes"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:e.notes})]}),(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem",borderLeft:"4px solid var(--error)"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,s.jsxs)("h2",{className:"card-title",children:["\uD83D\uDEA8 Defects & Deviations (",n.length,")"]}),(0,s.jsx)("button",{className:"btn",onClick:()=>{b({isOpen:!0,testResultId:void 0,fsId:void 0,scenarioName:void 0}),N({title:"",description:"",status:"open"})},children:"+ Log Defect"})]}),0===n.length?(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No defects logged. Any failed tests must be resolved or logged as a defect."}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:n.map(e=>(0,s.jsxs)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px",borderLeft:"open"===e.status?"3px solid red":"3px solid green"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"0.5rem"},children:[(0,s.jsxs)("div",{style:{fontWeight:600},children:[e.id,": ",e.title]}),(0,s.jsx)("div",{className:"badge",style:{background:"open"===e.status?"rgba(239, 68, 68, 0.1)":"rgba(34, 197, 94, 0.1)",color:"open"===e.status?"var(--error)":"var(--success)"},children:e.status.toUpperCase()})]}),(0,s.jsx)("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:e.description}),e.test_result_id&&(0,s.jsxs)("div",{style:{marginTop:"0.5rem",fontSize:"0.75rem",color:"var(--warning)"},children:["Linked to failed test result #",e.test_result_id]})]},e.id))})]}),(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,s.jsxs)("h2",{className:"card-title",style:{margin:0},children:["⚙️ Features (",t.length,")"]}),(0,s.jsx)("button",{onClick:()=>g(!0),className:"btn",disabled:0===r.length,children:"+ Add Features"})]}),x&&(0,s.jsxs)("div",{style:{marginBottom:"1rem",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsx)("div",{style:{marginBottom:"0.5rem",fontWeight:500},children:"Select features to add:"}),(0,s.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",marginBottom:"1rem"},children:r.map(e=>(0,s.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"},children:[(0,s.jsx)("input",{type:"checkbox",checked:v.includes(e.id),onChange:t=>{t.target.checked?u([...v,e.id]):u(v.filter(t=>t!==e.id))}}),(0,s.jsx)("code",{style:{color:"var(--warning)"},children:e.id}),(0,s.jsx)("span",{children:e.title})]},e.id))}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,s.jsx)("button",{onClick:()=>{g(!1),u([])},className:"btn",children:"Cancel"}),(0,s.jsx)("button",{onClick:()=>{0!==v.length&&w(async()=>{await d(e.id,v),g(!1),u([])})},className:"btn btn-primary",disabled:R||0===v.length,children:R?"Adding...":`Add ${v.length} Feature${1!==v.length?"s":""}`})]})]}),0===t.length?(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No features tagged yet. Add features to track them in this release."}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:t.map(t=>(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",padding:"0.75rem 1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsxs)(l(),{href:`/specs/${t.id}`,style:{flex:1,textDecoration:"none"},children:[(0,s.jsx)("code",{style:{fontWeight:600,color:"var(--warning)",marginRight:"0.75rem"},children:t.id}),(0,s.jsx)("span",{style:{color:"var(--text-primary)"},children:t.title}),(0,s.jsxs)("span",{style:{marginLeft:"0.75rem",color:"var(--text-secondary)",fontSize:"0.875rem"},children:[t.scenario_count," scenarios"]})]}),(0,s.jsx)("button",{onClick:()=>{var r;return r=t.id,void w(async()=>{await c(e.id,r)})},className:"btn",style:{padding:"0.25rem 0.5rem",fontSize:"0.75rem"},disabled:R,children:"\xd7"})]},t.id))})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("h2",{className:"card-title",children:["\uD83E\uDDEA Test Runs (",a.length,")"]}),0===a.length?(0,s.jsxs)("p",{style:{color:"var(--text-secondary)"},children:["No test runs yet. Import Cucumber results: ",(0,s.jsxs)("code",{children:["matrix release import-results results.json -r ",e.id]})]}):(0,s.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:a.map(e=>{let t=e.total>0?e.passed/e.total*100:0,r=y===e.id;return(0,s.jsxs)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"},onClick:()=>j(r?null:e.id),children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[e.failed>0?"❌":"✅"," Run #",e.id," ",r?"\uD83D\uDD3D":"▶"]}),(0,s.jsxs)("div",{style:{fontSize:"0.875rem",color:"var(--text-secondary)"},children:[e.run_date," • ",e.source]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"1rem",textAlign:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:700,color:"var(--success)"},children:e.passed}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Passed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontWeight:700,color:"var(--error)"},children:e.failed}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Failed"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontWeight:700,color:100===t?"var(--success)":t>=80?"var(--warning)":"var(--error)"},children:[t.toFixed(0),"%"]}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pass Rate"})]})]})]}),r&&(0,s.jsx)("div",{style:{marginTop:"1rem",paddingTop:"1rem",borderTop:"1px solid var(--border)"},children:(0,s.jsx)("p",{style:{fontStyle:"italic",color:"var(--text-secondary)"},children:"Detailed results view would go here. For now, check the console logs or database for failure details."})})]},e.id)})})]}),f.isOpen&&(0,s.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:(0,s.jsxs)("div",{className:"card",style:{width:"500px",maxWidth:"90%"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Log Defect / Deviation"}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsxs)("label",{style:{display:"block",marginBottom:"0.5rem"},children:["Title ",(0,s.jsx)("span",{style:{color:"var(--error)"},children:"*"})]}),(0,s.jsx)("input",{className:"input",value:S.title,onChange:e=>{N({...S,title:e.target.value}),e.target.value&&k(e=>({...e,titleError:!1}))},placeholder:"Defect summary",style:C.titleError?{borderColor:"var(--error)",boxShadow:"0 0 0 2px rgba(239, 68, 68, 0.2)"}:{}}),C.titleError&&(0,s.jsx)("div",{style:{color:"var(--error)",fontSize:"0.75rem",marginTop:"0.25rem"},children:"Title is required"})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsxs)("label",{style:{display:"block",marginBottom:"0.5rem"},children:["Description & Root Cause ",(0,s.jsx)("span",{style:{color:"var(--error)"},children:"*"})]}),(0,s.jsx)("textarea",{className:"input",rows:5,value:S.description,onChange:e=>{N({...S,description:e.target.value}),e.target.value&&k(e=>({...e,descriptionError:!1}))},placeholder:"Describe the failure, root cause, and why it is acceptable (if deviating) or mitigation plan.",style:C.descriptionError?{borderColor:"var(--error)",boxShadow:"0 0 0 2px rgba(239, 68, 68, 0.2)"}:{}}),C.descriptionError&&(0,s.jsx)("div",{style:{color:"var(--error)",fontSize:"0.75rem",marginTop:"0.25rem"},children:"Description is required"})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",marginBottom:"0.5rem"},children:"Status"}),(0,s.jsxs)("select",{className:"input",value:S.status,onChange:e=>N({...S,status:e.target.value}),children:[(0,s.jsx)("option",{value:"open",children:"Open (Needs Fix)"}),(0,s.jsx)("option",{value:"resolved",children:"Resolved (Fixed)"}),(0,s.jsx)("option",{value:"accepted",children:"Accepted (Permanent Deviation)"})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[(0,s.jsx)("button",{className:"btn",onClick:()=>{b({isOpen:!1}),k({titleError:!1,descriptionError:!1})},children:"Cancel"}),(0,s.jsx)("button",{className:"btn btn-primary",onClick:()=>{let t=!S.title.trim(),r=!S.description.trim();t||r?k({titleError:t,descriptionError:r}):w(async()=>{try{await m({releaseId:e.id,testResultId:f.testResultId,title:S.title,description:S.description,status:S.status}),b({isOpen:!1}),N({title:"",description:"",status:"open"})}catch(e){console.error("Failed to create defect:",e),alert("Failed to create defect. Check console for details.")}})},disabled:R,children:R?"Logging...":"Log Defect"})]})]})})]})}},4926:(e,t,r)=>{Promise.resolve().then(r.bind(r,2205))},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={callServer:function(){return a.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var i in s)Object.defineProperty(t,i,{enumerable:!0,get:s[i]});let a=r(7304),l=r(4060),n=r(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=4926)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{716:(e,t,r)=>{"use strict";r.d(t,{ReleasesClient:()=>c});var s=r(5155),a=r(2115),l=r(8500),n=r.n(l),i=r(9339);let o=(0,i.createServerReference)("4092a071f35f0d683623641a3d1eaf4632fc7e6de2",i.callServer,void 0,i.findSourceMapURL,"createReleaseAction");function c({releases:e}){let[t,r]=(0,a.useState)(!1),[l,n]=(0,a.useState)(""),[i,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(""),[h,g]=(0,a.useTransition)();return(0,s.jsxs)("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"2rem"},children:[(0,s.jsx)("header",{style:{marginBottom:"2rem"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{style:{fontSize:"2rem",fontWeight:700,marginBottom:"0.5rem"},children:"\uD83D\uDCE6 Releases"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"Manage releases, track test execution, and compare changes"})]}),(0,s.jsx)("button",{onClick:()=>r(!0),className:"btn btn-primary",children:"+ New Release"})]})}),t&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Create New Release"}),(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Version"}),(0,s.jsx)("input",{type:"text",value:l,onChange:e=>n(e.target.value),placeholder:"1.0.0",className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Name"}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>c(e.target.value),placeholder:"Initial Release",className:"input"})]})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Notes (optional)"}),(0,s.jsx)("textarea",{value:m,onChange:e=>x(e.target.value),placeholder:"Release notes...",rows:3,className:"input",style:{resize:"vertical"}})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,s.jsx)("button",{onClick:()=>r(!1),className:"btn",disabled:h,children:"Cancel"}),(0,s.jsx)("button",{onClick:()=>{g(async()=>{await o({version:l,name:i,notes:m||void 0}),r(!1),n(""),c(""),x("")})},className:"btn btn-primary",disabled:h||!l||!i,children:h?"Creating...":"Create Release"})]})]}),0===e.length?(0,s.jsxs)("div",{className:"card",style:{textAlign:"center",padding:"3rem"},children:[(0,s.jsx)("p",{style:{fontSize:"3rem",marginBottom:"1rem"},children:"\uD83D\uDCE6"}),(0,s.jsx)("h2",{style:{marginBottom:"0.5rem"},children:"No Releases Yet"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)",marginBottom:"1rem"},children:"Create your first release to start tracking features and test results."}),(0,s.jsx)("button",{onClick:()=>r(!0),className:"btn btn-primary",children:"Create First Release"})]}):(0,s.jsx)("div",{style:{display:"grid",gap:"1rem"},children:e.map(e=>(0,s.jsx)(d,{release:e},e.id))})]})}function d({release:e}){let t={planning:{bg:"rgba(168, 85, 247, 0.1)",color:"#a855f7"},testing:{bg:"rgba(59, 130, 246, 0.1)",color:"#3b82f6"},released:{bg:"rgba(34, 197, 94, 0.1)",color:"#22c55e"}}[e.status];return(0,s.jsx)(n(),{href:`/releases/${e.id}`,style:{textDecoration:"none"},children:(0,s.jsx)("div",{className:"card",style:{borderLeft:`4px solid ${t.color}`,transition:"transform 0.15s, box-shadow 0.15s",cursor:"pointer"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,s.jsxs)("div",{style:{flex:1},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[(0,s.jsx)("code",{style:{fontSize:"1.25rem",fontWeight:700,color:t.color},children:e.id}),(0,s.jsxs)("span",{style:{fontSize:"1rem",fontWeight:600,color:"var(--text-primary)"},children:["v",e.version]}),(0,s.jsx)("span",{className:"badge",style:{background:t.bg,color:t.color},children:e.status})]}),(0,s.jsx)("h3",{style:{fontSize:"1.125rem",fontWeight:600,marginBottom:"0.5rem",color:"var(--text-primary)"},children:e.name}),(0,s.jsxs)("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)"},children:["Created ",e.created_at,e.released_at&&` • Released ${e.released_at}`]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"1.5rem",textAlign:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--warning)"},children:e.fs_count}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Features"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--accent)"},children:e.test_runs}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Test Runs"})]}),null!==e.latest_pass_rate&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:100===e.latest_pass_rate?"var(--success)":e.latest_pass_rate>=80?"var(--warning)":"var(--error)"},children:[e.latest_pass_rate.toFixed(0),"%"]}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pass Rate"})]})]})]})})})}},5411:(e,t,r)=>{Promise.resolve().then(r.bind(r,716))},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={callServer:function(){return l.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return n.findSourceMapURL}};for(var a in s)Object.defineProperty(t,a,{enumerable:!0,get:s[a]});let l=r(7304),n=r(4060),i=r(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=5411)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[385],{1808:(e,t,a)=>{"use strict";a.d(t,{URSDetailClient:()=>d});var r=a(5155),i=a(2115),s=a(8500),l=a.n(s),n=a(9339);let c=(0,n.createServerReference)("60e3234ec5c547eddf7be276e63badcbff6f693d81",n.callServer,void 0,n.findSourceMapURL,"updateURSAction");function d({urs:e,linkedFS:t,linkedRisks:a}){let[s,n]=(0,i.useState)(!1),[d,p]=(0,i.useTransition)(),[m,h]=(0,i.useState)({title:e.title,status:e.status,priority:e.priority,owner:e.owner,category:e.category,business_need:e.business_need,intended_use:e.intended_use,acceptance_criteria:e.acceptance_criteria}),u=e.title.includes("(Undefined)"),g=({value:e,onChange:t,multiline:a,placeholder:i})=>s?a?(0,r.jsx)("textarea",{value:e,onChange:e=>t(e.target.value),rows:4,className:"input",style:{width:"100%",resize:"vertical"}}):(0,r.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),className:"input",style:{width:"100%"}}):(0,r.jsx)("span",{style:{whiteSpace:"pre-wrap",color:"var(--text-secondary)",fontStyle:e?"normal":"italic"},children:e||i||"Not defined"}),x=({value:e,onChange:t,options:a})=>s?(0,r.jsx)("select",{value:e,onChange:e=>t(e.target.value),className:"input",children:a.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,r.jsx)("span",{style:{textTransform:"capitalize"},children:e});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("header",{className:"page-header",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[(0,r.jsx)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--success)",background:"rgba(16, 185, 129, 0.1)",padding:"0.5rem 1rem",borderRadius:"8px"},children:e.id}),s?(0,r.jsx)(x,{value:m.status,onChange:e=>h({...m,status:e}),options:[{value:"draft",label:"Draft"},{value:"review",label:"Review"},{value:"approved",label:"Approved"}]}):(0,r.jsx)("span",{className:`badge ${"approved"===e.status?"badge-success":"badge-warning"}`,children:m.status}),s?(0,r.jsx)(x,{value:m.priority,onChange:e=>h({...m,priority:e}),options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}]}):(0,r.jsx)("span",{className:"badge",style:{background:"var(--bg-hover)"},children:m.priority}),u&&!s&&(0,r.jsx)("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.2)",color:"var(--error)"},children:"Needs Definition"}),(0,r.jsx)("div",{style:{marginLeft:"auto",display:"flex",gap:"0.5rem"},children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>{h({title:e.title,status:e.status,priority:e.priority,owner:e.owner,category:e.category,business_need:e.business_need,intended_use:e.intended_use,acceptance_criteria:e.acceptance_criteria}),n(!1)},className:"btn",disabled:d,children:"Cancel"}),(0,r.jsx)("button",{onClick:()=>{p(async()=>{await c(e.id,m),n(!1)})},className:"btn btn-primary",disabled:d,children:d?"Saving...":"\uD83D\uDCBE Save"})]}):(0,r.jsx)("button",{onClick:()=>n(!0),className:"btn btn-primary",children:"✏️ Edit"})})]}),s?(0,r.jsx)("input",{type:"text",value:m.title,onChange:e=>h({...m,title:e.target.value}),className:"input",style:{fontSize:"1.5rem",fontWeight:700,width:"100%",marginBottom:"0.5rem"}}):(0,r.jsx)("h1",{className:"page-title",children:m.title}),(0,r.jsxs)("p",{className:"page-subtitle",children:["User Requirement Specification • Owner: ",s?(0,r.jsx)("input",{type:"text",value:m.owner,onChange:e=>h({...m,owner:e.target.value}),className:"input",style:{width:"200px",display:"inline-block"}}):m.owner]})]}),u&&!s&&(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem",background:"rgba(239, 68, 68, 0.1)",borderLeft:"4px solid var(--error)"},children:(0,r.jsxs)("p",{style:{margin:0,color:"var(--error)"},children:["⚠️ This URS was auto-created from FS references. Click ",(0,r.jsx)("strong",{children:"Edit"})," to define its details."]})}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDD17 Traceability"}),(0,r.jsxs)("div",{style:{display:"flex",gap:"2rem",flexWrap:"wrap"},children:[(0,r.jsx)(o,{label:"Functional Specs",count:t.length,color:"var(--warning)"}),(0,r.jsx)(o,{label:"Test Scenarios",count:t.reduce((e,t)=>e+t.scenarios.length,0),color:"var(--accent)"}),(0,r.jsx)(o,{label:"Risk Assessments",count:a.length,color:"#f97316"})]})]}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1.5rem"},children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDCCB Business Need"}),(0,r.jsx)("div",{style:{lineHeight:1.7},children:(0,r.jsx)(g,{value:m.business_need,onChange:e=>h({...m,business_need:e}),multiline:!0,placeholder:"Not defined"})})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83C\uDFAF Intended Use"}),(0,r.jsx)("div",{style:{lineHeight:1.7},children:(0,r.jsx)(g,{value:m.intended_use,onChange:e=>h({...m,intended_use:e}),multiline:!0,placeholder:"Not defined"})})]})]}),(0,r.jsxs)("div",{className:"card",style:{marginTop:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"✅ Acceptance Criteria"}),s&&(0,r.jsx)("button",{onClick:()=>h({...m,acceptance_criteria:[...m.acceptance_criteria,""]}),className:"btn",style:{padding:"0.25rem 0.75rem"},children:"+ Add"})]}),0===m.acceptance_criteria.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No acceptance criteria defined"}):s?(0,r.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:m.acceptance_criteria.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{let a=[...m.acceptance_criteria];a[t]=e.target.value,h({...m,acceptance_criteria:a})},className:"input",style:{flex:1},placeholder:`Criterion ${t+1}`}),(0,r.jsx)("button",{onClick:()=>h({...m,acceptance_criteria:m.acceptance_criteria.filter((e,a)=>a!==t)}),className:"btn",style:{padding:"0.5rem"},children:"\xd7"})]},t))}):(0,r.jsx)("ul",{style:{margin:0,paddingLeft:"1.5rem"},children:m.acceptance_criteria.map((e,t)=>(0,r.jsx)("li",{style:{marginBottom:"0.5rem",color:"var(--text-secondary)"},children:e},t))})]}),(0,r.jsxs)("div",{className:"card",style:{marginTop:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"⚙️ Linked Functional Specifications"}),0===t.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No FS linked yet"}):(0,r.jsx)("div",{style:{display:"grid",gap:"1rem"},children:t.map(e=>(0,r.jsx)(l(),{href:`/specs/${e.id}`,style:{textDecoration:"none"},children:(0,r.jsx)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px",borderLeft:"4px solid var(--warning)"},children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[(0,r.jsx)("code",{style:{fontWeight:600,color:"var(--warning)"},children:e.id}),(0,r.jsx)("span",{style:{color:"var(--text-primary)"},children:e.title}),(0,r.jsxs)("span",{className:"badge badge-success",style:{marginLeft:"auto"},children:[e.scenario_count," tests"]})]})})},e.id))})]})]})}function o({label:e,count:t,color:a}){return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginBottom:"0.25rem"},children:e}),(0,r.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:a},children:t})]})}},4263:(e,t,a)=>{"use strict";a.d(t,{RiskDetailClient:()=>d});var r=a(5155),i=a(2115),s=a(8500),l=a.n(s),n=a(9339);let c=(0,n.createServerReference)("6015a46284ffad0cf003c41c759d12d7bf99f39f67",n.callServer,void 0,n.findSourceMapURL,"updateRiskAction");function d({risk:e,linkedFS:t}){let[a,s]=(0,i.useState)(!1),[n,d]=(0,i.useTransition)(),[m,h]=(0,i.useState)({title:e.title,status:e.status,category:e.category,impact:e.impact,probability:e.probability,risk_level:e.risk_level,residual_risk:e.residual_risk}),u=e.title.includes("(Undefined)");return(0,r.jsxs)("div",{children:[(0,r.jsxs)("header",{className:"page-header",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[(0,r.jsx)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:"#f97316",background:"rgba(249, 115, 22, 0.1)",padding:"0.5rem 1rem",borderRadius:"8px"},children:e.id}),a?(0,r.jsx)(({value:e,onChange:t,options:i})=>a?(0,r.jsx)("select",{value:e,onChange:e=>t(e.target.value),className:"input",children:i.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,r.jsx)("span",{style:{textTransform:"capitalize"},children:e}),{value:m.status,onChange:e=>h({...m,status:e}),options:[{value:"draft",label:"Draft"},{value:"review",label:"Review"},{value:"approved",label:"Approved"}]}):(0,r.jsx)("span",{className:`badge ${"approved"===e.status?"badge-success":"badge-warning"}`,children:m.status}),(0,r.jsx)(p,{level:m.risk_level}),u&&!a&&(0,r.jsx)("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.2)",color:"var(--error)"},children:"Needs Definition"}),(0,r.jsx)("div",{style:{marginLeft:"auto",display:"flex",gap:"0.5rem"},children:a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>{h({title:e.title,status:e.status,category:e.category,impact:e.impact,probability:e.probability,risk_level:e.risk_level,residual_risk:e.residual_risk}),s(!1)},className:"btn",disabled:n,children:"Cancel"}),(0,r.jsx)("button",{onClick:()=>{d(async()=>{await c(e.id,m),s(!1)})},className:"btn btn-primary",disabled:n,children:n?"Saving...":"\uD83D\uDCBE Save"})]}):(0,r.jsx)("button",{onClick:()=>s(!0),className:"btn btn-primary",children:"✏️ Edit"})})]}),a?(0,r.jsx)("input",{type:"text",value:m.title,onChange:e=>h({...m,title:e.target.value}),className:"input",style:{fontSize:"1.5rem",fontWeight:700,width:"100%",marginBottom:"0.5rem"}}):(0,r.jsx)("h1",{className:"page-title",children:m.title}),(0,r.jsxs)("p",{className:"page-subtitle",children:["Risk Assessment • Category: ",a?(0,r.jsx)("input",{type:"text",value:m.category,onChange:e=>h({...m,category:e.target.value}),className:"input",style:{width:"200px",display:"inline-block"}}):m.category," • GAMP Category ",e.gamp_category]})]}),u&&!a&&(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem",background:"rgba(239, 68, 68, 0.1)",borderLeft:"4px solid var(--error)"},children:(0,r.jsxs)("p",{style:{margin:0,color:"var(--error)"},children:["⚠️ This Risk was auto-created from FS references. Click ",(0,r.jsx)("strong",{children:"Edit"})," to define its details."]})}),(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem"},children:(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"1rem"},children:[(0,r.jsx)(o,{label:"Impact",value:m.impact,isEditing:a,onChange:e=>h({...m,impact:e}),options:["low","medium","high","critical"]}),(0,r.jsx)(o,{label:"Probability",value:m.probability,isEditing:a,onChange:e=>h({...m,probability:e}),options:["low","medium","high"]}),(0,r.jsx)(o,{label:"Risk Level",value:m.risk_level,isEditing:a,onChange:e=>h({...m,risk_level:e}),options:["low","medium","high","critical"]}),(0,r.jsx)(o,{label:"Residual Risk",value:m.residual_risk,isEditing:a,onChange:e=>h({...m,residual_risk:e}),options:["acceptable","unacceptable","pending"]})]})}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"⚙️ Linked Functional Specifications"}),(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:t.map(e=>(0,r.jsx)(l(),{href:`/specs/${e.id}`,children:(0,r.jsxs)("span",{className:"badge",style:{background:"rgba(245, 158, 11, 0.15)",color:"var(--warning)",padding:"0.5rem 1rem"},children:[e.id," - ",e.title]})},e.id))})]}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDD34 Identified Risks"}),0===e.risks.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No risks defined yet"}):(0,r.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:e.risks.map((e,t)=>(0,r.jsxs)("div",{style:{padding:"0.75rem 1rem",background:"var(--bg-hover)",borderRadius:"6px",display:"flex",alignItems:"center",gap:"1rem"},children:[(0,r.jsx)("code",{style:{fontWeight:600,color:"#f97316"},children:e.id}),(0,r.jsx)("span",{style:{flex:1,color:"var(--text-secondary)"},children:e.description}),(0,r.jsx)(p,{level:e.impact,small:!0})]},t))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDEE1️ Mitigations"}),0===e.mitigations.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No mitigations defined yet"}):(0,r.jsxs)("table",{className:"table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Risk"}),(0,r.jsx)("th",{children:"Control"}),(0,r.jsx)("th",{children:"Test"})]})}),(0,r.jsx)("tbody",{children:e.mitigations.map((e,t)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsx)("code",{children:e.risk_id})}),(0,r.jsx)("td",{children:e.control}),(0,r.jsx)("td",{style:{color:"var(--text-secondary)"},children:e.test})]},t))})]})]})]})}function o({label:e,value:t,isEditing:a,onChange:i,options:s}){let l=m(t);return(0,r.jsxs)("div",{style:{textAlign:"center",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginBottom:"0.25rem"},children:e}),a?(0,r.jsx)("select",{value:t,onChange:e=>i(e.target.value),className:"input",style:{width:"100%",textAlign:"center"},children:s.map(e=>(0,r.jsx)("option",{value:e,style:{textTransform:"capitalize"},children:e},e))}):(0,r.jsx)("div",{style:{fontSize:"1.25rem",fontWeight:700,color:l,textTransform:"capitalize"},children:t})]})}function p({level:e,small:t}){let a=m(e);return(0,r.jsx)("span",{className:"badge",style:{background:`${a}20`,color:a,padding:t?"0.25rem 0.5rem":"0.5rem 1rem",fontSize:t?"0.75rem":"0.875rem",textTransform:"capitalize"},children:e})}function m(e){switch(e){case"critical":case"unacceptable":return"#dc2626";case"high":return"#f97316";case"medium":case"pending":return"#eab308";case"low":case"acceptable":return"#22c55e";default:return"var(--text-secondary)"}}},6164:(e,t,a)=>{Promise.resolve().then(a.t.bind(a,8500,23)),Promise.resolve().then(a.bind(a,4263)),Promise.resolve().then(a.bind(a,8169)),Promise.resolve().then(a.bind(a,1808))},8169:(e,t,a)=>{"use strict";a.d(t,{ScenarioList:()=>l});var r=a(5155),i=a(2115);function s({scenario:e,isHighlighted:t}){return(0,r.jsxs)("div",{style:{padding:"1rem",background:t?"rgba(96, 165, 250, 0.1)":"var(--bg-hover)",borderRadius:"8px",border:t?"2px solid var(--accent)":"1px solid var(--border)"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.75rem"},children:[(0,r.jsx)("span",{style:{color:"var(--accent)"},children:"\uD83E\uDDEA"}),(0,r.jsx)("span",{style:{fontWeight:600},children:e.name}),e.tags.length>0&&(0,r.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-secondary)"},children:e.tags.join(" ")})]}),(0,r.jsx)("div",{style:{fontFamily:"monospace",fontSize:"0.8125rem",lineHeight:1.6},children:e.steps.map((e,t)=>{var a;return(0,r.jsx)("div",{style:{color:(a=e).startsWith("Given")?"#a78bfa":a.startsWith("When")?"#60a5fa":a.startsWith("Then")?"#34d399":"var(--text-secondary)"},children:e},t)})})]})}function l({scenarios:e,highlightScenario:t}){let a=(0,i.useRef)(null);return(0,i.useEffect)(()=>{t&&a.current&&setTimeout(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"center"})},100)},[t]),(0,r.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:e.map((e,i)=>{let l=t===e.name;return(0,r.jsx)("div",{ref:l?a:void 0,children:(0,r.jsx)(s,{scenario:e,isHighlighted:l})},i)})})}a(8500)},9339:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return s.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var i in r)Object.defineProperty(t,i,{enumerable:!0,get:r[i]});let s=a(7304),l=a(4060),n=a(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=6164)),_N_E=e.O()}]);
package/bin/cli.js CHANGED
@@ -2135,7 +2135,7 @@ __export(exports_database, {
2135
2135
  closeDb: () => closeDb
2136
2136
  });
2137
2137
  import { Database } from "bun:sqlite";
2138
- import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
2138
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
2139
2139
  import { join as join3, dirname as dirname2 } from "path";
2140
2140
  import { fileURLToPath as fileURLToPath2 } from "url";
2141
2141
  function getDbPath() {
@@ -2156,8 +2156,8 @@ function getDb() {
2156
2156
  function initDatabase() {
2157
2157
  if (!db)
2158
2158
  return;
2159
- const schemaPath = join3(__dirname3, "schema.sql");
2160
- const schema = readFileSync2(schemaPath, "utf-8");
2159
+ const schemaPath = join3(__dirname2, "schema.sql");
2160
+ const schema = readFileSync3(schemaPath, "utf-8");
2161
2161
  db.exec(schema);
2162
2162
  }
2163
2163
  function closeDb() {
@@ -2192,9 +2192,9 @@ function getSpecsDir() {
2192
2192
  }
2193
2193
  return join3(process.cwd(), "specs");
2194
2194
  }
2195
- var __dirname3, db = null;
2195
+ var __dirname2, db = null;
2196
2196
  var init_database = __esm(() => {
2197
- __dirname3 = dirname2(fileURLToPath2(import.meta.url));
2197
+ __dirname2 = dirname2(fileURLToPath2(import.meta.url));
2198
2198
  });
2199
2199
 
2200
2200
  // src/lib/database/fs-repo.ts
@@ -3008,7 +3008,7 @@ __export(exports_test_repo, {
3008
3008
  deleteTestRun: () => deleteTestRun,
3009
3009
  createTestRun: () => createTestRun
3010
3010
  });
3011
- import { readFileSync as readFileSync4 } from "fs";
3011
+ import { readFileSync as readFileSync5 } from "fs";
3012
3012
  function loadTestRuns(releaseId) {
3013
3013
  const db2 = getDb();
3014
3014
  return db2.query(`
@@ -3048,7 +3048,7 @@ function createTestRun(releaseId, results) {
3048
3048
  return loadTestRuns(releaseId).find((r) => r.id === runId);
3049
3049
  }
3050
3050
  function importCucumberResults(releaseId, jsonPath) {
3051
- const content = readFileSync4(jsonPath, "utf-8");
3051
+ const content = readFileSync5(jsonPath, "utf-8");
3052
3052
  const cucumberData = JSON.parse(content);
3053
3053
  const results = [];
3054
3054
  for (const feature of cucumberData) {
@@ -3139,7 +3139,7 @@ var DEFAULT_CONFIG = {
3139
3139
  };
3140
3140
  var cachedConfig = null;
3141
3141
  async function loadConfigFile(rootDir) {
3142
- const configPath = join(rootDir, "machine.config.ts");
3142
+ const configPath = join(rootDir, "matrix.config.ts");
3143
3143
  if (!existsSync(configPath)) {
3144
3144
  return {};
3145
3145
  }
@@ -3158,7 +3158,7 @@ function loadPackageJsonConfig(rootDir) {
3158
3158
  }
3159
3159
  try {
3160
3160
  const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
3161
- return pkg.machine || {};
3161
+ return pkg.matrix || {};
3162
3162
  } catch {
3163
3163
  return {};
3164
3164
  }
@@ -3184,14 +3184,38 @@ async function loadConfig(cliOptions = {}) {
3184
3184
  import { spawn, spawnSync } from "child_process";
3185
3185
  import { join as join2, dirname } from "path";
3186
3186
  import { fileURLToPath } from "url";
3187
- import { existsSync as existsSync2 } from "fs";
3188
- var __dirname2 = dirname(fileURLToPath(import.meta.url));
3187
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
3188
+ function findPackageRoot() {
3189
+ const currentFile = fileURLToPath(import.meta.url);
3190
+ let dir = dirname(currentFile);
3191
+ for (let i = 0;i < 10; i++) {
3192
+ if (existsSync2(join2(dir, ".next", "BUILD_ID"))) {
3193
+ return dir;
3194
+ }
3195
+ const pkgPath = join2(dir, "package.json");
3196
+ if (existsSync2(pkgPath)) {
3197
+ try {
3198
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
3199
+ if (pkg.name === "@nivora/matrix") {
3200
+ return dir;
3201
+ }
3202
+ } catch {}
3203
+ }
3204
+ const parent = dirname(dir);
3205
+ if (parent === dir)
3206
+ break;
3207
+ dir = parent;
3208
+ }
3209
+ return dirname(dirname(currentFile));
3210
+ }
3189
3211
  function hasBun() {
3190
3212
  const result = spawnSync("bun", ["--version"], { stdio: "ignore" });
3191
3213
  return result.status === 0;
3192
3214
  }
3193
3215
  async function serveCommand(config) {
3194
- console.log("\uD83D\uDE80 Starting @nivora/machine server...");
3216
+ const packageRoot = findPackageRoot();
3217
+ console.log("\uD83D\uDE80 Starting @nivora/matrix server...");
3218
+ console.log(` Package: ${packageRoot}`);
3195
3219
  console.log(` Specs: ${config.specsDir}`);
3196
3220
  console.log(` Database: ${config.dbPath}`);
3197
3221
  console.log(` Port: ${config.port}`);
@@ -3202,24 +3226,18 @@ async function serveCommand(config) {
3202
3226
  MACHINE_DB_PATH: config.dbPath,
3203
3227
  PORT: String(config.port)
3204
3228
  };
3205
- const packageRoot = join2(__dirname2, "..", "..");
3206
3229
  const hasProductionBuild = existsSync2(join2(packageRoot, ".next", "BUILD_ID"));
3207
3230
  if (hasProductionBuild) {
3208
- const nextBin = join2(packageRoot, "node_modules", ".bin", "next");
3209
- const useLocalNext = existsSync2(nextBin);
3210
- if (useLocalNext) {
3211
- spawn(nextBin, ["start", "-p", String(config.port)], {
3212
- cwd: packageRoot,
3213
- env,
3214
- stdio: "inherit"
3215
- });
3216
- } else {
3217
- spawn("npx", ["next", "start", "-p", String(config.port)], {
3218
- cwd: packageRoot,
3219
- env,
3220
- stdio: "inherit"
3221
- });
3231
+ if (!hasBun()) {
3232
+ console.error("❌ Error: Bun is required to run @nivora/matrix");
3233
+ console.error(" Install Bun: https://bun.sh");
3234
+ process.exit(1);
3222
3235
  }
3236
+ spawn("bun", ["--bun", "next", "start", "-p", String(config.port)], {
3237
+ cwd: packageRoot,
3238
+ env,
3239
+ stdio: "inherit"
3240
+ });
3223
3241
  } else {
3224
3242
  const runtime = hasBun() ? "bun" : "npm";
3225
3243
  spawn(runtime, ["run", "dev"], {
@@ -3231,7 +3249,7 @@ async function serveCommand(config) {
3231
3249
  }
3232
3250
 
3233
3251
  // src/commands/sync.ts
3234
- import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync } from "fs";
3252
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync } from "fs";
3235
3253
  import { join as join4 } from "path";
3236
3254
 
3237
3255
  // src/config.ts
@@ -3265,7 +3283,7 @@ async function syncCommand(config) {
3265
3283
  const fsDir = join4(config.specsDir, "fs");
3266
3284
  if (!existsSync4(fsDir)) {
3267
3285
  console.log(`⚠ No fs/ directory found at ${fsDir}`);
3268
- console.log(" Run `machine init` to create the specs directory structure.");
3286
+ console.log(" Run `matrix init` to create the specs directory structure.");
3269
3287
  closeDb2();
3270
3288
  return;
3271
3289
  }
@@ -3276,7 +3294,7 @@ async function syncCommand(config) {
3276
3294
  const referencedRisks = new Set;
3277
3295
  for (const file of fsFiles) {
3278
3296
  const filePath = join4(fsDir, file);
3279
- const content = readFileSync3(filePath, "utf-8");
3297
+ const content = readFileSync4(filePath, "utf-8");
3280
3298
  const fsData = parseGherkinFS2(content, filePath);
3281
3299
  syncFS2(fsData);
3282
3300
  fsItems.push(fsData);
@@ -3382,8 +3400,8 @@ async function initCommand(config) {
3382
3400
  console.log("");
3383
3401
  console.log("Next steps:");
3384
3402
  console.log(" 1. Edit specs/fs/*.requirement files");
3385
- console.log(" 2. Run `machine sync` to index files");
3386
- console.log(" 3. Run `machine serve` to start the UI");
3403
+ console.log(" 2. Run `matrix sync` to index files");
3404
+ console.log(" 3. Run `matrix serve` to start the UI");
3387
3405
  }
3388
3406
 
3389
3407
  // src/commands/search.ts
@@ -3429,7 +3447,7 @@ async function releaseCommand(config, action, options) {
3429
3447
  case "list": {
3430
3448
  const releases = loadAllReleases2();
3431
3449
  if (releases.length === 0) {
3432
- console.log('No releases found. Create one with: machine release create -v 1.0.0 -n "My Release"');
3450
+ console.log('No releases found. Create one with: matrix release create -v 1.0.0 -n "My Release"');
3433
3451
  return;
3434
3452
  }
3435
3453
  console.log(`\uD83D\uDCE6 Releases:
@@ -3492,7 +3510,7 @@ async function importResultsCommand(config, file, options) {
3492
3510
  const { releaseId } = options;
3493
3511
  if (!releaseId) {
3494
3512
  console.error("❌ Error: --releaseId is required");
3495
- console.log("Usage: machine release import-results <file> --releaseId <id>");
3513
+ console.log("Usage: matrix release import-results <file> --releaseId <id>");
3496
3514
  process.exit(1);
3497
3515
  }
3498
3516
  const filePath = resolve2(process.cwd(), file);
@@ -3576,7 +3594,7 @@ async function testCommand(config, action, options) {
3576
3594
  }
3577
3595
  const runs = loadTestRuns2(releaseId);
3578
3596
  if (runs.length === 0) {
3579
- console.log(`No test runs for ${releaseId}. Import results with: machine test import ./results.json -r ${releaseId}`);
3597
+ console.log(`No test runs for ${releaseId}. Import results with: matrix test import ./results.json -r ${releaseId}`);
3580
3598
  return;
3581
3599
  }
3582
3600
  console.log(`\uD83E\uDDEA Test runs for ${releaseId} v${release.version}:
@@ -3601,7 +3619,7 @@ async function testCommand(config, action, options) {
3601
3619
 
3602
3620
  // bin/cli.ts
3603
3621
  var program2 = new Command;
3604
- program2.name("machine").description("Requirements documentation system with semantic search").version("0.1.0");
3622
+ program2.name("matrix").description("Requirements documentation system with semantic search").version("0.1.0");
3605
3623
  program2.command("serve").description("Start the documentation server").option("-p, --port <port>", "Port to run server on", "3000").option("-s, --specs <dir>", "Specs directory", "./specs").option("-d, --db <path>", "Database path", "./matrix.db").action(async (options) => {
3606
3624
  const config = await loadConfig({
3607
3625
  port: parseInt(options.port, 10),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivora/matrix",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Requirements documentation system with semantic search",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5411:(e,t,r)=>{Promise.resolve().then(r.bind(r,8445))},8445:(e,t,r)=>{"use strict";r.d(t,{ReleasesClient:()=>c});var s=r(5155),a=r(2115),l=r(8500),n=r.n(l),i=r(9339);let o=(0,i.createServerReference)("40390e34c6f8a0229b91e5c4921b9fb399908c7adb",i.callServer,void 0,i.findSourceMapURL,"createReleaseAction");function c({releases:e}){let[t,r]=(0,a.useState)(!1),[l,n]=(0,a.useState)(""),[i,c]=(0,a.useState)(""),[m,x]=(0,a.useState)(""),[h,g]=(0,a.useTransition)();return(0,s.jsxs)("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"2rem"},children:[(0,s.jsx)("header",{style:{marginBottom:"2rem"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{style:{fontSize:"2rem",fontWeight:700,marginBottom:"0.5rem"},children:"\uD83D\uDCE6 Releases"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)"},children:"Manage releases, track test execution, and compare changes"})]}),(0,s.jsx)("button",{onClick:()=>r(!0),className:"btn btn-primary",children:"+ New Release"})]})}),t&&(0,s.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("h2",{className:"card-title",children:"Create New Release"}),(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Version"}),(0,s.jsx)("input",{type:"text",value:l,onChange:e=>n(e.target.value),placeholder:"1.0.0",className:"input"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Name"}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>c(e.target.value),placeholder:"Initial Release",className:"input"})]})]}),(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsx)("label",{style:{display:"block",fontWeight:500,marginBottom:"0.5rem"},children:"Notes (optional)"}),(0,s.jsx)("textarea",{value:m,onChange:e=>x(e.target.value),placeholder:"Release notes...",rows:3,className:"input",style:{resize:"vertical"}})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,s.jsx)("button",{onClick:()=>r(!1),className:"btn",disabled:h,children:"Cancel"}),(0,s.jsx)("button",{onClick:()=>{g(async()=>{await o({version:l,name:i,notes:m||void 0}),r(!1),n(""),c(""),x("")})},className:"btn btn-primary",disabled:h||!l||!i,children:h?"Creating...":"Create Release"})]})]}),0===e.length?(0,s.jsxs)("div",{className:"card",style:{textAlign:"center",padding:"3rem"},children:[(0,s.jsx)("p",{style:{fontSize:"3rem",marginBottom:"1rem"},children:"\uD83D\uDCE6"}),(0,s.jsx)("h2",{style:{marginBottom:"0.5rem"},children:"No Releases Yet"}),(0,s.jsx)("p",{style:{color:"var(--text-secondary)",marginBottom:"1rem"},children:"Create your first release to start tracking features and test results."}),(0,s.jsx)("button",{onClick:()=>r(!0),className:"btn btn-primary",children:"Create First Release"})]}):(0,s.jsx)("div",{style:{display:"grid",gap:"1rem"},children:e.map(e=>(0,s.jsx)(d,{release:e},e.id))})]})}function d({release:e}){let t={planning:{bg:"rgba(168, 85, 247, 0.1)",color:"#a855f7"},testing:{bg:"rgba(59, 130, 246, 0.1)",color:"#3b82f6"},released:{bg:"rgba(34, 197, 94, 0.1)",color:"#22c55e"}}[e.status];return(0,s.jsx)(n(),{href:`/releases/${e.id}`,style:{textDecoration:"none"},children:(0,s.jsx)("div",{className:"card",style:{borderLeft:`4px solid ${t.color}`,transition:"transform 0.15s, box-shadow 0.15s",cursor:"pointer"},children:(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,s.jsxs)("div",{style:{flex:1},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.5rem"},children:[(0,s.jsx)("code",{style:{fontSize:"1.25rem",fontWeight:700,color:t.color},children:e.id}),(0,s.jsxs)("span",{style:{fontSize:"1rem",fontWeight:600,color:"var(--text-primary)"},children:["v",e.version]}),(0,s.jsx)("span",{className:"badge",style:{background:t.bg,color:t.color},children:e.status})]}),(0,s.jsx)("h3",{style:{fontSize:"1.125rem",fontWeight:600,marginBottom:"0.5rem",color:"var(--text-primary)"},children:e.name}),(0,s.jsxs)("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)"},children:["Created ",e.created_at,e.released_at&&` • Released ${e.released_at}`]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"1.5rem",textAlign:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--warning)"},children:e.fs_count}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Features"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--accent)"},children:e.test_runs}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Test Runs"})]}),null!==e.latest_pass_rate&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:100===e.latest_pass_rate?"var(--success)":e.latest_pass_rate>=80?"var(--warning)":"var(--error)"},children:[e.latest_pass_rate.toFixed(0),"%"]}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pass Rate"})]})]})]})})})}},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={callServer:function(){return l.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return n.findSourceMapURL}};for(var a in s)Object.defineProperty(t,a,{enumerable:!0,get:s[a]});let l=r(7304),n=r(4060),i=r(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=5411)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[385],{5507:(e,t,a)=>{"use strict";a.d(t,{RiskDetailClient:()=>d});var r=a(5155),i=a(2115),s=a(8500),l=a.n(s),n=a(9339);let c=(0,n.createServerReference)("6006b5147757be7ff44bdbd037afdf883ea34b681c",n.callServer,void 0,n.findSourceMapURL,"updateRiskAction");function d({risk:e,linkedFS:t}){let[a,s]=(0,i.useState)(!1),[n,d]=(0,i.useTransition)(),[m,h]=(0,i.useState)({title:e.title,status:e.status,category:e.category,impact:e.impact,probability:e.probability,risk_level:e.risk_level,residual_risk:e.residual_risk}),u=e.title.includes("(Undefined)");return(0,r.jsxs)("div",{children:[(0,r.jsxs)("header",{className:"page-header",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[(0,r.jsx)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:"#f97316",background:"rgba(249, 115, 22, 0.1)",padding:"0.5rem 1rem",borderRadius:"8px"},children:e.id}),a?(0,r.jsx)(({value:e,onChange:t,options:i})=>a?(0,r.jsx)("select",{value:e,onChange:e=>t(e.target.value),className:"input",children:i.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,r.jsx)("span",{style:{textTransform:"capitalize"},children:e}),{value:m.status,onChange:e=>h({...m,status:e}),options:[{value:"draft",label:"Draft"},{value:"review",label:"Review"},{value:"approved",label:"Approved"}]}):(0,r.jsx)("span",{className:`badge ${"approved"===e.status?"badge-success":"badge-warning"}`,children:m.status}),(0,r.jsx)(p,{level:m.risk_level}),u&&!a&&(0,r.jsx)("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.2)",color:"var(--error)"},children:"Needs Definition"}),(0,r.jsx)("div",{style:{marginLeft:"auto",display:"flex",gap:"0.5rem"},children:a?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>{h({title:e.title,status:e.status,category:e.category,impact:e.impact,probability:e.probability,risk_level:e.risk_level,residual_risk:e.residual_risk}),s(!1)},className:"btn",disabled:n,children:"Cancel"}),(0,r.jsx)("button",{onClick:()=>{d(async()=>{await c(e.id,m),s(!1)})},className:"btn btn-primary",disabled:n,children:n?"Saving...":"\uD83D\uDCBE Save"})]}):(0,r.jsx)("button",{onClick:()=>s(!0),className:"btn btn-primary",children:"✏️ Edit"})})]}),a?(0,r.jsx)("input",{type:"text",value:m.title,onChange:e=>h({...m,title:e.target.value}),className:"input",style:{fontSize:"1.5rem",fontWeight:700,width:"100%",marginBottom:"0.5rem"}}):(0,r.jsx)("h1",{className:"page-title",children:m.title}),(0,r.jsxs)("p",{className:"page-subtitle",children:["Risk Assessment • Category: ",a?(0,r.jsx)("input",{type:"text",value:m.category,onChange:e=>h({...m,category:e.target.value}),className:"input",style:{width:"200px",display:"inline-block"}}):m.category," • GAMP Category ",e.gamp_category]})]}),u&&!a&&(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem",background:"rgba(239, 68, 68, 0.1)",borderLeft:"4px solid var(--error)"},children:(0,r.jsxs)("p",{style:{margin:0,color:"var(--error)"},children:["⚠️ This Risk was auto-created from FS references. Click ",(0,r.jsx)("strong",{children:"Edit"})," to define its details."]})}),(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem"},children:(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"1rem"},children:[(0,r.jsx)(o,{label:"Impact",value:m.impact,isEditing:a,onChange:e=>h({...m,impact:e}),options:["low","medium","high","critical"]}),(0,r.jsx)(o,{label:"Probability",value:m.probability,isEditing:a,onChange:e=>h({...m,probability:e}),options:["low","medium","high"]}),(0,r.jsx)(o,{label:"Risk Level",value:m.risk_level,isEditing:a,onChange:e=>h({...m,risk_level:e}),options:["low","medium","high","critical"]}),(0,r.jsx)(o,{label:"Residual Risk",value:m.residual_risk,isEditing:a,onChange:e=>h({...m,residual_risk:e}),options:["acceptable","unacceptable","pending"]})]})}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"⚙️ Linked Functional Specifications"}),(0,r.jsx)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:t.map(e=>(0,r.jsx)(l(),{href:`/specs/${e.id}`,children:(0,r.jsxs)("span",{className:"badge",style:{background:"rgba(245, 158, 11, 0.15)",color:"var(--warning)",padding:"0.5rem 1rem"},children:[e.id," - ",e.title]})},e.id))})]}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDD34 Identified Risks"}),0===e.risks.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No risks defined yet"}):(0,r.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:e.risks.map((e,t)=>(0,r.jsxs)("div",{style:{padding:"0.75rem 1rem",background:"var(--bg-hover)",borderRadius:"6px",display:"flex",alignItems:"center",gap:"1rem"},children:[(0,r.jsx)("code",{style:{fontWeight:600,color:"#f97316"},children:e.id}),(0,r.jsx)("span",{style:{flex:1,color:"var(--text-secondary)"},children:e.description}),(0,r.jsx)(p,{level:e.impact,small:!0})]},t))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDEE1️ Mitigations"}),0===e.mitigations.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No mitigations defined yet"}):(0,r.jsxs)("table",{className:"table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Risk"}),(0,r.jsx)("th",{children:"Control"}),(0,r.jsx)("th",{children:"Test"})]})}),(0,r.jsx)("tbody",{children:e.mitigations.map((e,t)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsx)("code",{children:e.risk_id})}),(0,r.jsx)("td",{children:e.control}),(0,r.jsx)("td",{style:{color:"var(--text-secondary)"},children:e.test})]},t))})]})]})]})}function o({label:e,value:t,isEditing:a,onChange:i,options:s}){let l=m(t);return(0,r.jsxs)("div",{style:{textAlign:"center",padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px"},children:[(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginBottom:"0.25rem"},children:e}),a?(0,r.jsx)("select",{value:t,onChange:e=>i(e.target.value),className:"input",style:{width:"100%",textAlign:"center"},children:s.map(e=>(0,r.jsx)("option",{value:e,style:{textTransform:"capitalize"},children:e},e))}):(0,r.jsx)("div",{style:{fontSize:"1.25rem",fontWeight:700,color:l,textTransform:"capitalize"},children:t})]})}function p({level:e,small:t}){let a=m(e);return(0,r.jsx)("span",{className:"badge",style:{background:`${a}20`,color:a,padding:t?"0.25rem 0.5rem":"0.5rem 1rem",fontSize:t?"0.75rem":"0.875rem",textTransform:"capitalize"},children:e})}function m(e){switch(e){case"critical":case"unacceptable":return"#dc2626";case"high":return"#f97316";case"medium":case"pending":return"#eab308";case"low":case"acceptable":return"#22c55e";default:return"var(--text-secondary)"}}},6164:(e,t,a)=>{Promise.resolve().then(a.t.bind(a,8500,23)),Promise.resolve().then(a.bind(a,5507)),Promise.resolve().then(a.bind(a,8169)),Promise.resolve().then(a.bind(a,8384))},8169:(e,t,a)=>{"use strict";a.d(t,{ScenarioList:()=>l});var r=a(5155),i=a(2115);function s({scenario:e,isHighlighted:t}){return(0,r.jsxs)("div",{style:{padding:"1rem",background:t?"rgba(96, 165, 250, 0.1)":"var(--bg-hover)",borderRadius:"8px",border:t?"2px solid var(--accent)":"1px solid var(--border)"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.75rem"},children:[(0,r.jsx)("span",{style:{color:"var(--accent)"},children:"\uD83E\uDDEA"}),(0,r.jsx)("span",{style:{fontWeight:600},children:e.name}),e.tags.length>0&&(0,r.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-secondary)"},children:e.tags.join(" ")})]}),(0,r.jsx)("div",{style:{fontFamily:"monospace",fontSize:"0.8125rem",lineHeight:1.6},children:e.steps.map((e,t)=>{var a;return(0,r.jsx)("div",{style:{color:(a=e).startsWith("Given")?"#a78bfa":a.startsWith("When")?"#60a5fa":a.startsWith("Then")?"#34d399":"var(--text-secondary)"},children:e},t)})})]})}function l({scenarios:e,highlightScenario:t}){let a=(0,i.useRef)(null);return(0,i.useEffect)(()=>{t&&a.current&&setTimeout(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"center"})},100)},[t]),(0,r.jsx)("div",{style:{display:"grid",gap:"0.75rem"},children:e.map((e,i)=>{let l=t===e.name;return(0,r.jsx)("div",{ref:l?a:void 0,children:(0,r.jsx)(s,{scenario:e,isHighlighted:l})},i)})})}a(8500)},8384:(e,t,a)=>{"use strict";a.d(t,{URSDetailClient:()=>d});var r=a(5155),i=a(2115),s=a(8500),l=a.n(s),n=a(9339);let c=(0,n.createServerReference)("6001d939b150c0d179141b174c280871a1034e995a",n.callServer,void 0,n.findSourceMapURL,"updateURSAction");function d({urs:e,linkedFS:t,linkedRisks:a}){let[s,n]=(0,i.useState)(!1),[d,p]=(0,i.useTransition)(),[m,h]=(0,i.useState)({title:e.title,status:e.status,priority:e.priority,owner:e.owner,category:e.category,business_need:e.business_need,intended_use:e.intended_use,acceptance_criteria:e.acceptance_criteria}),u=e.title.includes("(Undefined)"),g=({value:e,onChange:t,multiline:a,placeholder:i})=>s?a?(0,r.jsx)("textarea",{value:e,onChange:e=>t(e.target.value),rows:4,className:"input",style:{width:"100%",resize:"vertical"}}):(0,r.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),className:"input",style:{width:"100%"}}):(0,r.jsx)("span",{style:{whiteSpace:"pre-wrap",color:"var(--text-secondary)",fontStyle:e?"normal":"italic"},children:e||i||"Not defined"}),x=({value:e,onChange:t,options:a})=>s?(0,r.jsx)("select",{value:e,onChange:e=>t(e.target.value),className:"input",children:a.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,r.jsx)("span",{style:{textTransform:"capitalize"},children:e});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("header",{className:"page-header",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[(0,r.jsx)("code",{style:{fontSize:"1.5rem",fontWeight:700,color:"var(--success)",background:"rgba(16, 185, 129, 0.1)",padding:"0.5rem 1rem",borderRadius:"8px"},children:e.id}),s?(0,r.jsx)(x,{value:m.status,onChange:e=>h({...m,status:e}),options:[{value:"draft",label:"Draft"},{value:"review",label:"Review"},{value:"approved",label:"Approved"}]}):(0,r.jsx)("span",{className:`badge ${"approved"===e.status?"badge-success":"badge-warning"}`,children:m.status}),s?(0,r.jsx)(x,{value:m.priority,onChange:e=>h({...m,priority:e}),options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}]}):(0,r.jsx)("span",{className:"badge",style:{background:"var(--bg-hover)"},children:m.priority}),u&&!s&&(0,r.jsx)("span",{className:"badge",style:{background:"rgba(239, 68, 68, 0.2)",color:"var(--error)"},children:"Needs Definition"}),(0,r.jsx)("div",{style:{marginLeft:"auto",display:"flex",gap:"0.5rem"},children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>{h({title:e.title,status:e.status,priority:e.priority,owner:e.owner,category:e.category,business_need:e.business_need,intended_use:e.intended_use,acceptance_criteria:e.acceptance_criteria}),n(!1)},className:"btn",disabled:d,children:"Cancel"}),(0,r.jsx)("button",{onClick:()=>{p(async()=>{await c(e.id,m),n(!1)})},className:"btn btn-primary",disabled:d,children:d?"Saving...":"\uD83D\uDCBE Save"})]}):(0,r.jsx)("button",{onClick:()=>n(!0),className:"btn btn-primary",children:"✏️ Edit"})})]}),s?(0,r.jsx)("input",{type:"text",value:m.title,onChange:e=>h({...m,title:e.target.value}),className:"input",style:{fontSize:"1.5rem",fontWeight:700,width:"100%",marginBottom:"0.5rem"}}):(0,r.jsx)("h1",{className:"page-title",children:m.title}),(0,r.jsxs)("p",{className:"page-subtitle",children:["User Requirement Specification • Owner: ",s?(0,r.jsx)("input",{type:"text",value:m.owner,onChange:e=>h({...m,owner:e.target.value}),className:"input",style:{width:"200px",display:"inline-block"}}):m.owner]})]}),u&&!s&&(0,r.jsx)("div",{className:"card",style:{marginBottom:"1.5rem",background:"rgba(239, 68, 68, 0.1)",borderLeft:"4px solid var(--error)"},children:(0,r.jsxs)("p",{style:{margin:0,color:"var(--error)"},children:["⚠️ This URS was auto-created from FS references. Click ",(0,r.jsx)("strong",{children:"Edit"})," to define its details."]})}),(0,r.jsxs)("div",{className:"card",style:{marginBottom:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDD17 Traceability"}),(0,r.jsxs)("div",{style:{display:"flex",gap:"2rem",flexWrap:"wrap"},children:[(0,r.jsx)(o,{label:"Functional Specs",count:t.length,color:"var(--warning)"}),(0,r.jsx)(o,{label:"Test Scenarios",count:t.reduce((e,t)=>e+t.scenarios.length,0),color:"var(--accent)"}),(0,r.jsx)(o,{label:"Risk Assessments",count:a.length,color:"#f97316"})]})]}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"1.5rem"},children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83D\uDCCB Business Need"}),(0,r.jsx)("div",{style:{lineHeight:1.7},children:(0,r.jsx)(g,{value:m.business_need,onChange:e=>h({...m,business_need:e}),multiline:!0,placeholder:"Not defined"})})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("h2",{className:"card-title",children:"\uD83C\uDFAF Intended Use"}),(0,r.jsx)("div",{style:{lineHeight:1.7},children:(0,r.jsx)(g,{value:m.intended_use,onChange:e=>h({...m,intended_use:e}),multiline:!0,placeholder:"Not defined"})})]})]}),(0,r.jsxs)("div",{className:"card",style:{marginTop:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"},children:[(0,r.jsx)("h2",{className:"card-title",style:{margin:0},children:"✅ Acceptance Criteria"}),s&&(0,r.jsx)("button",{onClick:()=>h({...m,acceptance_criteria:[...m.acceptance_criteria,""]}),className:"btn",style:{padding:"0.25rem 0.75rem"},children:"+ Add"})]}),0===m.acceptance_criteria.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:"No acceptance criteria defined"}):s?(0,r.jsx)("div",{style:{display:"grid",gap:"0.5rem"},children:m.acceptance_criteria.map((e,t)=>(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,r.jsx)("input",{type:"text",value:e,onChange:e=>{let a=[...m.acceptance_criteria];a[t]=e.target.value,h({...m,acceptance_criteria:a})},className:"input",style:{flex:1},placeholder:`Criterion ${t+1}`}),(0,r.jsx)("button",{onClick:()=>h({...m,acceptance_criteria:m.acceptance_criteria.filter((e,a)=>a!==t)}),className:"btn",style:{padding:"0.5rem"},children:"\xd7"})]},t))}):(0,r.jsx)("ul",{style:{margin:0,paddingLeft:"1.5rem"},children:m.acceptance_criteria.map((e,t)=>(0,r.jsx)("li",{style:{marginBottom:"0.5rem",color:"var(--text-secondary)"},children:e},t))})]}),(0,r.jsxs)("div",{className:"card",style:{marginTop:"1.5rem"},children:[(0,r.jsx)("h2",{className:"card-title",children:"⚙️ Linked Functional Specifications"}),0===t.length?(0,r.jsx)("p",{style:{color:"var(--text-secondary)"},children:"No FS linked yet"}):(0,r.jsx)("div",{style:{display:"grid",gap:"1rem"},children:t.map(e=>(0,r.jsx)(l(),{href:`/specs/${e.id}`,style:{textDecoration:"none"},children:(0,r.jsx)("div",{style:{padding:"1rem",background:"var(--bg-hover)",borderRadius:"8px",borderLeft:"4px solid var(--warning)"},children:(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[(0,r.jsx)("code",{style:{fontWeight:600,color:"var(--warning)"},children:e.id}),(0,r.jsx)("span",{style:{color:"var(--text-primary)"},children:e.title}),(0,r.jsxs)("span",{className:"badge badge-success",style:{marginLeft:"auto"},children:[e.scenario_count," tests"]})]})})},e.id))})]})]})}function o({label:e,count:t,color:a}){return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",marginBottom:"0.25rem"},children:e}),(0,r.jsx)("div",{style:{fontSize:"1.5rem",fontWeight:700,color:a},children:t})]})}},9339:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={callServer:function(){return s.callServer},createServerReference:function(){return n.createServerReference},findSourceMapURL:function(){return l.findSourceMapURL}};for(var i in r)Object.defineProperty(t,i,{enumerable:!0,get:r[i]});let s=a(7304),l=a(4060),n=a(7197)}},e=>{e.O(0,[500,441,794,358],()=>e(e.s=6164)),_N_E=e.O()}]);