@kb-labs/quality-entry 2.118.2 → 2.119.0-canary.cee505c72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widgets/117.js +10 -3
- package/dist/widgets/165.js +1 -1
- package/dist/widgets/370.js +1 -1
- package/dist/widgets/{62.js → 421.js} +2 -2
- package/dist/widgets/46.js +1 -1
- package/dist/widgets/50.js +1 -1
- package/dist/widgets/546.js +1 -1
- package/dist/widgets/669.js +1 -1
- package/dist/widgets/775.js +1 -1
- package/dist/widgets/78.js +1 -1
- package/dist/widgets/875.js +5 -5
- package/dist/widgets/__federation_expose_QualityOverview.js +1 -1
- package/dist/widgets/mf-manifest.json +19 -19
- package/dist/widgets/mf-stats.json +23 -23
- package/dist/widgets/remoteEntry.js +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[15],{6026(e,n){var l=Symbol.for("react.transitional.element");function t(e,n,t){var i=null;if(void 0!==t&&(i=""+t),void 0!==n.key&&(i=""+n.key),"key"in n)for(var r in t={},n)"key"!==r&&(t[r]=n[r]);else t=n;return{$$typeof:l,type:e,key:i,ref:void 0!==(n=t.ref)?n:null,props:t}}n.Fragment=Symbol.for("react.fragment"),n.jsx=t,n.jsxs=t},4552(e,n,l){e.exports=l(6026)},9586(e,n,l){l.r(n),l.d(n,{default:()=>U});var t=l(4552),i=l(92),r=l(5155),a=l(4519);function s(e){switch(e){case"A":return"green";case"B":return"blue";case"C":return"orange";case"D":return"red";case"F":return"volcano";default:return"default"}}function o(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return 0===e?null:(0,t.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f",fontSize:12,marginLeft:4},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var c=[{key:"architecture",label:"Architecture",icon:"ApartmentOutlined"},{key:"typescript",label:"TypeScript",icon:"CodeOutlined"},{key:"deadCode",label:"Dead Code",icon:"DeleteOutlined"},{key:"depHygiene",label:"Dep Hygiene",icon:"NodeIndexOutlined"},{key:"testCoverage",label:"Test Coverage",icon:"CheckCircleOutlined"}];function d(){var e,n,l,i,d,u,p,g,y=(0,a.useData)("/v1/plugins/quality/stats"),h=y.data,f=y.isLoading,x=(0,a.useData)("/v1/plugins/quality/health"),m=x.data,v=x.isLoading,j=(0,a.useData)("/v1/plugins/quality/history"),I=j.data,b=j.isLoading;if(f||v||b)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var k=null==I?void 0:I.delta,U=null!=(n=null==I||null==(g=I.latest)?void 0:g.dimensions)?n:null==m?void 0:m.dimensions;return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{title:"Health Score",style:{marginBottom:24},children:(0,t.jsxs)(r.UIRow,{gutter:32,align:"middle",children:[(0,t.jsxs)(r.UICol,{span:8,style:{textAlign:"center"},children:[(0,t.jsx)(r.UIProgress,{type:"circle",percent:null!=(l=null==m?void 0:m.score)?l:0,size:160,status:(e=null==m?void 0:m.score)?e>=80?"success":e<60?"exception":"normal":"normal"}),(0,t.jsxs)("div",{style:{marginTop:12},children:[(0,t.jsxs)(r.UITag,{color:s(null==m?void 0:m.grade),style:{fontSize:16,padding:"4px 12px"},children:["Grade ",null!=(i=null==m?void 0:m.grade)?i:"—"]}),k&&(0,t.jsxs)("div",{style:{marginTop:8,color:"#8c8c8c",fontSize:13},children:[o(k.score)," vs previous snapshot"]})]})]}),(0,t.jsx)(r.UICol,{span:16,children:(0,t.jsx)(r.UIRow,{gutter:[16,16],children:c.map(function(e){var n,l,i,a,o,c=e.key,d=e.label,u=e.icon,p=U?U[c]:void 0;return(0,t.jsx)(r.UICol,{span:12,children:(0,t.jsxs)(r.UICard,{size:"small",style:{borderRadius:8},children:[(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:u}),(0,t.jsx)("span",{style:{fontWeight:500},children:d}),(0,t.jsx)(r.UITag,{color:s(null==p?void 0:p.grade),children:null!=(n=null==p?void 0:p.grade)?n:"—"})]}),(0,t.jsx)(r.UIProgress,{percent:null!=(l=null==p?void 0:p.score)?l:0,size:"small",showInfo:!1,strokeColor:(null!=(i=null==p?void 0:p.score)?i:0)>=80?"#52c41a":(null!=(a=null==p?void 0:p.score)?a:0)>=60?"#faad14":"#ff4d4f",style:{marginTop:8}}),(0,t.jsxs)("div",{style:{fontSize:12,color:"#8c8c8c",marginTop:4},children:[null!=(o=null==p?void 0:p.score)?o:0,"/100"]})]})},c)})})})]})}),k&&(0,t.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"LineChartOutlined"}),message:"Changes since last snapshot",description:(0,t.jsx)(r.UIRow,{gutter:16,style:{marginTop:8},children:[{label:"Layering violations",value:-k.layeringViolations,invert:!0},{label:"Any count",value:-k.anyCount,invert:!0},{label:"Unused files",value:-k.unusedFiles,invert:!0},{label:"Unused deps",value:-k.unusedDeps,invert:!0},{label:"Avg instability",value:-k.avgInstability,invert:!0}].map(function(e){var n=e.label,l=e.value,i=e.invert;return(0,t.jsxs)(r.UICol,{children:[(0,t.jsxs)("span",{style:{color:"#8c8c8c"},children:[n,": "]}),o(l,i),0===l&&(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"—"})]},n)})}),style:{marginBottom:24}}),(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"Packages",value:null!=(d=null==h?void 0:h.packages)?d:0},{label:"Lines of Code",value:null!=(u=null==h?void 0:h.loc)?u:0},{label:"Total Size",value:null!=(p=null==h?void 0:h.size)?p:"N/A"}].map(function(e,n){return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em"},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})})]})}var u=[{title:"Package",dataIndex:"name",key:"name",render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})},ellipsis:!0},{title:"Ca (afferent)",dataIndex:"afferent",key:"afferent",width:110,sorter:function(e,n){return e.afferent-n.afferent}},{title:"Ce (efferent)",dataIndex:"efferent",key:"efferent",width:110,sorter:function(e,n){return e.efferent-n.efferent}},{title:"Instability",dataIndex:"instability",key:"instability",width:110,defaultSortOrder:"descend",sorter:function(e,n){return e.instability-n.instability},render:function(e){return(0,t.jsx)(r.UITag,{color:e>=.8?"#ff4d4f":e>=.6?"#faad14":e>=.4?"#1677ff":"#52c41a",children:e.toFixed(2)})}}],p=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:11},children:e.replace(/^.*\/src\//,"src/")})}},{title:"From",key:"from",width:180,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{children:n.fromPackage}),(0,t.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.fromLayer]})]})}},{title:"To",key:"to",width:180,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:"red",children:n.toPackage}),(0,t.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.toLayer]})]})}},{title:"Import",dataIndex:"importSpecifier",key:"importSpecifier",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:11},children:e})}}];function g(){var e,n,l,i,s,o,c,d=(0,a.useData)("/v1/plugins/quality/coupling"),g=d.data,y=d.isLoading,h=(0,a.useData)("/v1/plugins/quality/layers"),f=h.data,x=h.isLoading;if(y||x)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:10,style:{padding:"24px 0"}});var m=(null!=(e=null==f?void 0:f.totalViolations)?e:0)>0;return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},style:{marginBottom:24},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"Layering Violations",value:null!=(n=null==f?void 0:f.totalViolations)?n:0,color:m?"#ff4d4f":"#52c41a"},{label:"Avg Instability",value:(null!=(l=null==g?void 0:g.avgInstability)?l:0).toFixed(2)},{label:"Affected Packages",value:null!=(i=null==f||null==(c=f.affectedPackages)?void 0:c.length)?i:0}].map(function(e,n){return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",color:e.color},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})}),m&&(0,t.jsx)(r.UIAlert,{variant:"error",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"WarningOutlined"}),message:"".concat(f.totalViolations," layering violation").concat(f.totalViolations>1?"s":""," detected"),description:"Lower-layer packages are importing from higher-layer packages, breaking the dependency rules.",style:{marginBottom:16}}),(0,t.jsx)(r.UICard,{title:"Layering Violations",style:{marginBottom:24},children:m?(0,t.jsx)(r.UITable,{dataSource:null!=(s=null==f?void 0:f.violations)?s:[],columns:p,rowKey:function(e){return"".concat(e.file,":").concat(e.importSpecifier)},size:"small",pagination:{pageSize:20}}):(0,t.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No layering violations — architecture is clean"})}),(0,t.jsx)(r.UICard,{title:"Package Coupling (Ca/Ce/Instability)",children:(0,t.jsx)(r.UITable,{dataSource:null!=(o=null==g?void 0:g.packages)?o:[],columns:u,rowKey:"name",size:"small",pagination:{pageSize:30}})})]})}var y=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}}],h=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Symbol",dataIndex:"symbol",key:"symbol",width:200,render:function(e){return(0,t.jsx)(r.UITag,{children:(0,t.jsx)("code",{children:e})})}}],f=[{title:"Package",dataIndex:"package",key:"package",render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Workspace",dataIndex:"workspace",key:"workspace",width:220,render:function(e){return(0,t.jsx)(r.UITag,{children:e})}}];function x(){var e,n,l,i,s,o,c,d,u,p,g,x,m,v=(0,a.useData)("/v1/plugins/quality/dead-code"),j=v.data,I=v.isLoading,b=(0,a.useData)("/v1/plugins/quality/health"),k=b.data,U=b.isLoading;if(I||U)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var S=null!=(e=null==k||null==(u=k.dimensions)||null==(d=u.typescript)?void 0:d.details)?e:[],C=null!=(n=null==k||null==(g=k.dimensions)||null==(p=g.typescript)?void 0:p.score)?n:100,w=null!=(l=null==k||null==(m=k.dimensions)||null==(x=m.typescript)?void 0:x.grade)?l:"A",z=(null!=(i=null==j?void 0:j.unusedFiles)?i:[]).map(function(e){return{key:e,file:e}}),T=(null!=(s=null==j?void 0:j.unusedExports)?s:[]).map(function(e){return{key:"".concat(e.file,":").concat(e.symbol),file:e.file,symbol:e.symbol}}),A=(null!=(o=null==j?void 0:j.unusedDependencies)?o:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}}),D=(null!=(c=null==j?void 0:j.unlistedDependencies)?c:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}});return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},style:{marginBottom:24},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"TypeScript Score",value:"".concat(C,"/100"),tag:w},{label:"Unused Files",value:z.length,color:z.length>0?"#ff4d4f":"#52c41a"},{label:"Unused Exports",value:T.length,color:T.length>0?"#faad14":"#52c41a"},{label:"Dep Issues",value:A.length+D.length,color:A.length+D.length>0?"#faad14":"#52c41a"}].map(function(e,n){var l;return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[e.tag&&(0,t.jsx)(r.UITag,{color:null!=(l=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[e.tag])?l:"default",children:e.tag}),(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",color:e.color},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})}),S.length>0&&(0,t.jsx)(r.UICard,{title:"TypeScript Health",style:{marginBottom:24},children:S.map(function(e,n){return(0,t.jsx)(r.UIAlert,{variant:C<60?"error":C<80?"warning":"info",showIcon:!0,message:e,style:{marginBottom:8}},n)})}),z.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"FileUnknownOutlined"}),(0,t.jsx)("span",{children:"Unused Files"}),(0,t.jsx)(r.UITag,{color:"red",children:z.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:z,columns:y,size:"small",pagination:{pageSize:20}})}),T.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"ExportOutlined"}),(0,t.jsx)("span",{children:"Unused Exports"}),(0,t.jsx)(r.UITag,{color:"orange",children:T.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:T,columns:h,size:"small",pagination:{pageSize:20}})}),A.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"NodeCollapseOutlined"}),(0,t.jsx)("span",{children:"Unused Dependencies"}),(0,t.jsx)(r.UITag,{color:"orange",children:A.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:A,columns:f,size:"small",pagination:{pageSize:20}})}),D.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"WarningOutlined"}),(0,t.jsx)("span",{children:"Unlisted Dependencies"}),(0,t.jsx)(r.UITag,{color:"red",children:D.length})]}),children:(0,t.jsx)(r.UITable,{dataSource:D,columns:f,size:"small",pagination:{pageSize:20}})}),0===z.length&&0===T.length&&0===A.length&&0===D.length&&(0,t.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No dead code detected — codebase is clean"})]})}function m(e){var n;return null!=(n=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[null!=e?e:""])?n:"default"}function v(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return 0===e?(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"—"}):(0,t.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f"},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var j=[{title:"Date",dataIndex:"timestamp",key:"timestamp",width:170,render:function(e){return new Date(e).toLocaleString()}},{title:"Score",dataIndex:"score",key:"score",width:80,sorter:function(e,n){return e.score-n.score}},{title:"Grade",dataIndex:"grade",key:"grade",width:70,render:function(e){return(0,t.jsx)(r.UITag,{color:m(e),children:e})}},{title:"Architecture",key:"arch",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.architecture.grade),style:{fontSize:11},children:n.dimensions.architecture.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.architecture.score})]})}},{title:"TypeScript",key:"ts",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.typescript.grade),style:{fontSize:11},children:n.dimensions.typescript.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.typescript.score})]})}},{title:"Dead Code",key:"dc",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.deadCode.grade),style:{fontSize:11},children:n.dimensions.deadCode.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.deadCode.score})]})}},{title:"Violations",key:"violations",width:95,render:function(e,n){return(0,t.jsx)("span",{style:{color:n.counters.layeringViolations>0?"#ff4d4f":"#52c41a"},children:n.counters.layeringViolations})}},{title:"Any",key:"any",width:70,render:function(e,n){return n.counters.anyCount}},{title:"Unused",key:"unused",width:80,render:function(e,n){return n.counters.unusedFiles}},{title:"Branch",key:"branch",width:120,ellipsis:!0,render:function(e,n){return(0,t.jsx)("code",{style:{fontSize:11},children:n.git.branch||"—"})}},{title:"Commit",key:"commit",width:90,render:function(e,n){return(0,t.jsx)("code",{style:{fontSize:11},children:n.git.commit?n.git.commit.slice(0,7):"—"})}}];function I(){var e,n=(0,a.useData)("/v1/plugins/quality/history"),l=n.data,i=n.isLoading,s=n.refetch,o=(0,a.useMutateData)("/v1/plugins/quality/snapshot"),c=(0,a.useNotification)();if(i)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var d=null!=(e=null==l?void 0:l.snapshots)?e:[],u=null==l?void 0:l.delta,p=u&&Object.values(u).some(function(e){return 0!==e});return(0,t.jsxs)("div",{children:[u&&(0,t.jsx)(r.UICard,{title:"Changes since last snapshot",style:{marginBottom:24},children:p?(0,t.jsxs)("div",{style:{display:"flex",gap:32,flexWrap:"wrap"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Score "}),v(u.score,!1)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Violations "}),v(u.layeringViolations)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Any count "}),v(u.anyCount)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Ts-ignore "}),v(u.tsIgnoreCount)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused files "}),v(u.unusedFiles)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused deps "}),v(u.unusedDeps)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Avg instability "}),v(parseFloat(u.avgInstability.toFixed(2)))]})]}):(0,t.jsx)("span",{style:{color:"#8c8c8c",fontSize:13},children:"No changes since last snapshot"})}),(0,t.jsx)(r.UICard,{title:"Snapshot History (".concat(d.length,")"),extra:(0,t.jsx)(r.UIButton,{size:"small",icon:(0,t.jsx)(r.UIIcon,{name:"CameraOutlined"}),loading:o.isLoading,onClick:function(){o.mutate({},{onSuccess:function(){c.success("Snapshot saved"),s()},onError:function(e){var n;c.error("Failed: ".concat((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)?e.message:String(e)))}})},children:"Save Snapshot"}),children:0===d.length?(0,t.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"InfoCircleOutlined"}),message:"No snapshots yet",description:'Run "kb quality snapshot" or click "Save Snapshot" to start tracking trends.'}):(0,t.jsx)(r.UITable,{dataSource:d.slice().reverse(),columns:j,rowKey:"id",size:"small",pagination:{pageSize:20},scroll:{x:1200}})})]})}function b(e,n){(null==n||n>e.length)&&(n=e.length);for(var l=0,t=Array(n);l<n;l++)t[l]=e[l];return t}function k(){var e,n,l,s,o=function(e){if(Array.isArray(e))return e}(e=i.useState())||function(e){var n,l,t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i=[],r=!0,a=!1;try{for(t=t.call(e);!(r=(n=t.next()).done)&&(i.push(n.value),2!==i.length);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==t.return||t.return()}finally{if(a)throw l}}return i}}(e)||function(e){if(e){if("string"==typeof e)return b(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=o[0],d=o[1],u=c?"/v1/plugins/quality/build-order?package=".concat(encodeURIComponent(c)):"/v1/plugins/quality/build-order",p=(0,a.useData)(u),g=p.data,y=p.isLoading,h=p.isError;if((0,a.useData)("/v1/plugins/quality/cycles").data,y)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:6,style:{padding:"24px 0"}});if(h)return(0,t.jsx)(r.UIAlert,{message:"Failed to load build order",variant:"error",showIcon:!0});var f=[{title:"Layer",dataIndex:"layer",key:"layer",width:100,render:function(e){return(0,t.jsxs)(r.UITag,{color:"blue",children:["Layer ",e]})}},{title:"Packages (can build in parallel)",dataIndex:"packages",key:"packages",render:function(e){return(0,t.jsx)(r.UISpace,{wrap:!0,children:e.map(function(e){return(0,t.jsx)(r.UITag,{children:e},e)})})}}],x=null==g?void 0:g.layers.map(function(e,n){return{layer:n+1,packages:e,key:n}});return(0,t.jsxs)("div",{children:[(null==g?void 0:g.hasCircular)&&(0,t.jsx)(r.UIAlert,{message:"Circular Dependencies Detected!",description:"Found ".concat(g.circular.length," circular dependency cycles. Build order may not be correct."),variant:"error",showIcon:!0,style:{marginBottom:24}}),(0,t.jsx)(r.UICard,{title:"Filter",style:{marginBottom:24},children:(0,t.jsx)(r.UISelect,{style:{width:400},placeholder:"Select package to see its build dependencies",value:c,onChange:function(e){return d(e)},allowClear:!0,showSearch:!0,options:null!=(n=null==g?void 0:g.sorted.map(function(e){return{label:e,value:e}}))?n:[]})}),(0,t.jsx)(r.UICard,{title:"Build Layers (".concat(null!=(l=null==g?void 0:g.layerCount)?l:0," layers, ").concat(null!=(s=null==g?void 0:g.packageCount)?s:0," packages)"),style:{marginBottom:24},children:(0,t.jsx)(r.UITable,{dataSource:null!=x?x:[],columns:f,pagination:!1,expandable:{expandedRowRender:function(e){return(0,t.jsxs)("div",{style:{padding:"8px 0"},children:[(0,t.jsx)("strong",{children:"Packages in this layer:"}),(0,t.jsx)("div",{style:{marginTop:8},children:e.packages.map(function(e){return(0,t.jsx)(r.UITag,{style:{marginBottom:4},children:e},e)})})]})}}})}),(null==g?void 0:g.hasCircular)&&(0,t.jsx)(r.UICard,{title:"Circular Dependencies (".concat(g.circular.length,")"),children:g.circular.map(function(e,n){return(0,t.jsx)(r.UIAlert,{message:"Cycle ".concat(n+1),description:e.join(" → "),variant:"warning",showIcon:!0,style:{marginBottom:12}},n)})})]})}function U(){var e=(0,t.jsx)(r.UITabs,{syncUrl:"search",items:[{key:"overview",label:"Overview",children:(0,t.jsx)(d,{})},{key:"architecture",label:"Architecture",children:(0,t.jsx)(g,{})},{key:"debt",label:"Debt",children:(0,t.jsx)(x,{})},{key:"history",label:"History",children:(0,t.jsx)(I,{})},{key:"build-order",label:"Build Order",children:(0,t.jsx)(k,{})}]});return(0,t.jsx)(r.UIPage,{children:(0,t.jsx)(r.UIPageHeader,{title:"Quality",description:"Code health, architecture analysis, and trend tracking",tabs:e})})}}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[15],{6026(e,n){var l=Symbol.for("react.transitional.element");function t(e,n,t){var i=null;if(void 0!==t&&(i=""+t),void 0!==n.key&&(i=""+n.key),"key"in n)for(var r in t={},n)"key"!==r&&(t[r]=n[r]);else t=n;return{$$typeof:l,type:e,key:i,ref:void 0!==(n=t.ref)?n:null,props:t}}n.Fragment=Symbol.for("react.fragment"),n.jsx=t,n.jsxs=t},4552(e,n,l){e.exports=l(6026)},9586(e,n,l){l.r(n),l.d(n,{default:()=>U});var t=l(4552),i=l(1913),r=l(1198),a=l(6188);function s(e){switch(e){case"A":return"green";case"B":return"blue";case"C":return"orange";case"D":return"red";case"F":return"volcano";default:return"default"}}function o(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return 0===e?null:(0,t.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f",fontSize:12,marginLeft:4},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var c=[{key:"architecture",label:"Architecture",icon:"ApartmentOutlined"},{key:"typescript",label:"TypeScript",icon:"CodeOutlined"},{key:"deadCode",label:"Dead Code",icon:"DeleteOutlined"},{key:"depHygiene",label:"Dep Hygiene",icon:"NodeIndexOutlined"},{key:"testCoverage",label:"Test Coverage",icon:"CheckCircleOutlined"}];function d(){var e,n,l,i,d,u,p,g,y=(0,a.useData)("/v1/plugins/quality/stats"),h=y.data,f=y.isLoading,x=(0,a.useData)("/v1/plugins/quality/health"),m=x.data,v=x.isLoading,j=(0,a.useData)("/v1/plugins/quality/history"),I=j.data,b=j.isLoading;if(f||v||b)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var k=null==I?void 0:I.delta,U=null!=(n=null==I||null==(g=I.latest)?void 0:g.dimensions)?n:null==m?void 0:m.dimensions;return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{title:"Health Score",style:{marginBottom:24},children:(0,t.jsxs)(r.UIRow,{gutter:32,align:"middle",children:[(0,t.jsxs)(r.UICol,{span:8,style:{textAlign:"center"},children:[(0,t.jsx)(r.UIProgress,{type:"circle",percent:null!=(l=null==m?void 0:m.score)?l:0,size:160,status:(e=null==m?void 0:m.score)?e>=80?"success":e<60?"exception":"normal":"normal"}),(0,t.jsxs)("div",{style:{marginTop:12},children:[(0,t.jsxs)(r.UITag,{color:s(null==m?void 0:m.grade),style:{fontSize:16,padding:"4px 12px"},children:["Grade ",null!=(i=null==m?void 0:m.grade)?i:"—"]}),k&&(0,t.jsxs)("div",{style:{marginTop:8,color:"#8c8c8c",fontSize:13},children:[o(k.score)," vs previous snapshot"]})]})]}),(0,t.jsx)(r.UICol,{span:16,children:(0,t.jsx)(r.UIRow,{gutter:[16,16],children:c.map(function(e){var n,l,i,a,o,c=e.key,d=e.label,u=e.icon,p=U?U[c]:void 0;return(0,t.jsx)(r.UICol,{span:12,children:(0,t.jsxs)(r.UICard,{size:"small",style:{borderRadius:8},children:[(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:u}),(0,t.jsx)("span",{style:{fontWeight:500},children:d}),(0,t.jsx)(r.UITag,{color:s(null==p?void 0:p.grade),children:null!=(n=null==p?void 0:p.grade)?n:"—"})]}),(0,t.jsx)(r.UIProgress,{percent:null!=(l=null==p?void 0:p.score)?l:0,size:"small",showInfo:!1,strokeColor:(null!=(i=null==p?void 0:p.score)?i:0)>=80?"#52c41a":(null!=(a=null==p?void 0:p.score)?a:0)>=60?"#faad14":"#ff4d4f",style:{marginTop:8}}),(0,t.jsxs)("div",{style:{fontSize:12,color:"#8c8c8c",marginTop:4},children:[null!=(o=null==p?void 0:p.score)?o:0,"/100"]})]})},c)})})})]})}),k&&(0,t.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"LineChartOutlined"}),message:"Changes since last snapshot",description:(0,t.jsx)(r.UIRow,{gutter:16,style:{marginTop:8},children:[{label:"Layering violations",value:-k.layeringViolations,invert:!0},{label:"Any count",value:-k.anyCount,invert:!0},{label:"Unused files",value:-k.unusedFiles,invert:!0},{label:"Unused deps",value:-k.unusedDeps,invert:!0},{label:"Avg instability",value:-k.avgInstability,invert:!0}].map(function(e){var n=e.label,l=e.value,i=e.invert;return(0,t.jsxs)(r.UICol,{children:[(0,t.jsxs)("span",{style:{color:"#8c8c8c"},children:[n,": "]}),o(l,i),0===l&&(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"—"})]},n)})}),style:{marginBottom:24}}),(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"Packages",value:null!=(d=null==h?void 0:h.packages)?d:0},{label:"Lines of Code",value:null!=(u=null==h?void 0:h.loc)?u:0},{label:"Total Size",value:null!=(p=null==h?void 0:h.size)?p:"N/A"}].map(function(e,n){return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em"},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})})]})}var u=[{title:"Package",dataIndex:"name",key:"name",render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})},ellipsis:!0},{title:"Ca (afferent)",dataIndex:"afferent",key:"afferent",width:110,sorter:function(e,n){return e.afferent-n.afferent}},{title:"Ce (efferent)",dataIndex:"efferent",key:"efferent",width:110,sorter:function(e,n){return e.efferent-n.efferent}},{title:"Instability",dataIndex:"instability",key:"instability",width:110,defaultSortOrder:"descend",sorter:function(e,n){return e.instability-n.instability},render:function(e){return(0,t.jsx)(r.UITag,{color:e>=.8?"#ff4d4f":e>=.6?"#faad14":e>=.4?"#1677ff":"#52c41a",children:e.toFixed(2)})}}],p=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:11},children:e.replace(/^.*\/src\//,"src/")})}},{title:"From",key:"from",width:180,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{children:n.fromPackage}),(0,t.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.fromLayer]})]})}},{title:"To",key:"to",width:180,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:"red",children:n.toPackage}),(0,t.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.toLayer]})]})}},{title:"Import",dataIndex:"importSpecifier",key:"importSpecifier",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:11},children:e})}}];function g(){var e,n,l,i,s,o,c,d=(0,a.useData)("/v1/plugins/quality/coupling"),g=d.data,y=d.isLoading,h=(0,a.useData)("/v1/plugins/quality/layers"),f=h.data,x=h.isLoading;if(y||x)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:10,style:{padding:"24px 0"}});var m=(null!=(e=null==f?void 0:f.totalViolations)?e:0)>0;return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},style:{marginBottom:24},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"Layering Violations",value:null!=(n=null==f?void 0:f.totalViolations)?n:0,color:m?"#ff4d4f":"#52c41a"},{label:"Avg Instability",value:(null!=(l=null==g?void 0:g.avgInstability)?l:0).toFixed(2)},{label:"Affected Packages",value:null!=(i=null==f||null==(c=f.affectedPackages)?void 0:c.length)?i:0}].map(function(e,n){return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",color:e.color},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})}),m&&(0,t.jsx)(r.UIAlert,{variant:"error",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"WarningOutlined"}),message:"".concat(f.totalViolations," layering violation").concat(f.totalViolations>1?"s":""," detected"),description:"Lower-layer packages are importing from higher-layer packages, breaking the dependency rules.",style:{marginBottom:16}}),(0,t.jsx)(r.UICard,{title:"Layering Violations",style:{marginBottom:24},children:m?(0,t.jsx)(r.UITable,{dataSource:null!=(s=null==f?void 0:f.violations)?s:[],columns:p,rowKey:function(e){return"".concat(e.file,":").concat(e.importSpecifier)},size:"small",pagination:{pageSize:20}}):(0,t.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No layering violations — architecture is clean"})}),(0,t.jsx)(r.UICard,{title:"Package Coupling (Ca/Ce/Instability)",children:(0,t.jsx)(r.UITable,{dataSource:null!=(o=null==g?void 0:g.packages)?o:[],columns:u,rowKey:"name",size:"small",pagination:{pageSize:30}})})]})}var y=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}}],h=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Symbol",dataIndex:"symbol",key:"symbol",width:200,render:function(e){return(0,t.jsx)(r.UITag,{children:(0,t.jsx)("code",{children:e})})}}],f=[{title:"Package",dataIndex:"package",key:"package",render:function(e){return(0,t.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Workspace",dataIndex:"workspace",key:"workspace",width:220,render:function(e){return(0,t.jsx)(r.UITag,{children:e})}}];function x(){var e,n,l,i,s,o,c,d,u,p,g,x,m,v=(0,a.useData)("/v1/plugins/quality/dead-code"),j=v.data,I=v.isLoading,b=(0,a.useData)("/v1/plugins/quality/health"),k=b.data,U=b.isLoading;if(I||U)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var S=null!=(e=null==k||null==(u=k.dimensions)||null==(d=u.typescript)?void 0:d.details)?e:[],C=null!=(n=null==k||null==(g=k.dimensions)||null==(p=g.typescript)?void 0:p.score)?n:100,w=null!=(l=null==k||null==(m=k.dimensions)||null==(x=m.typescript)?void 0:x.grade)?l:"A",z=(null!=(i=null==j?void 0:j.unusedFiles)?i:[]).map(function(e){return{key:e,file:e}}),T=(null!=(s=null==j?void 0:j.unusedExports)?s:[]).map(function(e){return{key:"".concat(e.file,":").concat(e.symbol),file:e.file,symbol:e.symbol}}),A=(null!=(o=null==j?void 0:j.unusedDependencies)?o:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}}),D=(null!=(c=null==j?void 0:j.unlistedDependencies)?c:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}});return(0,t.jsxs)("div",{children:[(0,t.jsx)(r.UICard,{styles:{body:{padding:"18px 24px"}},style:{marginBottom:24},children:(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:24,flexWrap:"wrap"},children:[{label:"TypeScript Score",value:"".concat(C,"/100"),tag:w},{label:"Unused Files",value:z.length,color:z.length>0?"#ff4d4f":"#52c41a"},{label:"Unused Exports",value:T.length,color:T.length>0?"#faad14":"#52c41a"},{label:"Dep Issues",value:A.length+D.length,color:A.length+D.length>0?"#faad14":"#52c41a"}].map(function(e,n){var l;return(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:24},children:[n>0&&(0,t.jsx)("span",{style:{width:1,alignSelf:"stretch",background:"var(--border-primary)"}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[e.tag&&(0,t.jsx)(r.UITag,{color:null!=(l=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[e.tag])?l:"default",children:e.tag}),(0,t.jsx)("span",{style:{fontSize:20,fontWeight:700,fontFamily:"var(--font-heading)",fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",color:e.color},children:e.value}),(0,t.jsx)("span",{style:{fontSize:13,color:"var(--text-tertiary)"},children:e.label})]})]},e.label)})})}),S.length>0&&(0,t.jsx)(r.UICard,{title:"TypeScript Health",style:{marginBottom:24},children:S.map(function(e,n){return(0,t.jsx)(r.UIAlert,{variant:C<60?"error":C<80?"warning":"info",showIcon:!0,message:e,style:{marginBottom:8}},n)})}),z.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"FileUnknownOutlined"}),(0,t.jsx)("span",{children:"Unused Files"}),(0,t.jsx)(r.UITag,{color:"red",children:z.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:z,columns:y,size:"small",pagination:{pageSize:20}})}),T.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"ExportOutlined"}),(0,t.jsx)("span",{children:"Unused Exports"}),(0,t.jsx)(r.UITag,{color:"orange",children:T.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:T,columns:h,size:"small",pagination:{pageSize:20}})}),A.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"NodeCollapseOutlined"}),(0,t.jsx)("span",{children:"Unused Dependencies"}),(0,t.jsx)(r.UITag,{color:"orange",children:A.length})]}),style:{marginBottom:16},children:(0,t.jsx)(r.UITable,{dataSource:A,columns:f,size:"small",pagination:{pageSize:20}})}),D.length>0&&(0,t.jsx)(r.UICard,{title:(0,t.jsxs)(r.UISpace,{children:[(0,t.jsx)(r.UIIcon,{name:"WarningOutlined"}),(0,t.jsx)("span",{children:"Unlisted Dependencies"}),(0,t.jsx)(r.UITag,{color:"red",children:D.length})]}),children:(0,t.jsx)(r.UITable,{dataSource:D,columns:f,size:"small",pagination:{pageSize:20}})}),0===z.length&&0===T.length&&0===A.length&&0===D.length&&(0,t.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No dead code detected — codebase is clean"})]})}function m(e){var n;return null!=(n=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[null!=e?e:""])?n:"default"}function v(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return 0===e?(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"—"}):(0,t.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f"},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var j=[{title:"Date",dataIndex:"timestamp",key:"timestamp",width:170,render:function(e){return new Date(e).toLocaleString()}},{title:"Score",dataIndex:"score",key:"score",width:80,sorter:function(e,n){return e.score-n.score}},{title:"Grade",dataIndex:"grade",key:"grade",width:70,render:function(e){return(0,t.jsx)(r.UITag,{color:m(e),children:e})}},{title:"Architecture",key:"arch",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.architecture.grade),style:{fontSize:11},children:n.dimensions.architecture.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.architecture.score})]})}},{title:"TypeScript",key:"ts",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.typescript.grade),style:{fontSize:11},children:n.dimensions.typescript.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.typescript.score})]})}},{title:"Dead Code",key:"dc",width:110,render:function(e,n){return(0,t.jsxs)(r.UISpace,{size:4,children:[(0,t.jsx)(r.UITag,{color:m(n.dimensions.deadCode.grade),style:{fontSize:11},children:n.dimensions.deadCode.grade}),(0,t.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.deadCode.score})]})}},{title:"Violations",key:"violations",width:95,render:function(e,n){return(0,t.jsx)("span",{style:{color:n.counters.layeringViolations>0?"#ff4d4f":"#52c41a"},children:n.counters.layeringViolations})}},{title:"Any",key:"any",width:70,render:function(e,n){return n.counters.anyCount}},{title:"Unused",key:"unused",width:80,render:function(e,n){return n.counters.unusedFiles}},{title:"Branch",key:"branch",width:120,ellipsis:!0,render:function(e,n){return(0,t.jsx)("code",{style:{fontSize:11},children:n.git.branch||"—"})}},{title:"Commit",key:"commit",width:90,render:function(e,n){return(0,t.jsx)("code",{style:{fontSize:11},children:n.git.commit?n.git.commit.slice(0,7):"—"})}}];function I(){var e,n=(0,a.useData)("/v1/plugins/quality/history"),l=n.data,i=n.isLoading,s=n.refetch,o=(0,a.useMutateData)("/v1/plugins/quality/snapshot"),c=(0,a.useNotification)();if(i)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var d=null!=(e=null==l?void 0:l.snapshots)?e:[],u=null==l?void 0:l.delta,p=u&&Object.values(u).some(function(e){return 0!==e});return(0,t.jsxs)("div",{children:[u&&(0,t.jsx)(r.UICard,{title:"Changes since last snapshot",style:{marginBottom:24},children:p?(0,t.jsxs)("div",{style:{display:"flex",gap:32,flexWrap:"wrap"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Score "}),v(u.score,!1)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Violations "}),v(u.layeringViolations)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Any count "}),v(u.anyCount)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Ts-ignore "}),v(u.tsIgnoreCount)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused files "}),v(u.unusedFiles)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused deps "}),v(u.unusedDeps)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{style:{color:"#8c8c8c"},children:"Avg instability "}),v(parseFloat(u.avgInstability.toFixed(2)))]})]}):(0,t.jsx)("span",{style:{color:"#8c8c8c",fontSize:13},children:"No changes since last snapshot"})}),(0,t.jsx)(r.UICard,{title:"Snapshot History (".concat(d.length,")"),extra:(0,t.jsx)(r.UIButton,{size:"small",icon:(0,t.jsx)(r.UIIcon,{name:"CameraOutlined"}),loading:o.isLoading,onClick:function(){o.mutate({},{onSuccess:function(){c.success("Snapshot saved"),s()},onError:function(e){var n;c.error("Failed: ".concat((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)?e.message:String(e)))}})},children:"Save Snapshot"}),children:0===d.length?(0,t.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,t.jsx)(r.UIIcon,{name:"InfoCircleOutlined"}),message:"No snapshots yet",description:'Run "kb quality snapshot" or click "Save Snapshot" to start tracking trends.'}):(0,t.jsx)(r.UITable,{dataSource:d.slice().reverse(),columns:j,rowKey:"id",size:"small",pagination:{pageSize:20},scroll:{x:1200}})})]})}function b(e,n){(null==n||n>e.length)&&(n=e.length);for(var l=0,t=Array(n);l<n;l++)t[l]=e[l];return t}function k(){var e,n,l,s,o=function(e){if(Array.isArray(e))return e}(e=i.useState())||function(e){var n,l,t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i=[],r=!0,a=!1;try{for(t=t.call(e);!(r=(n=t.next()).done)&&(i.push(n.value),2!==i.length);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==t.return||t.return()}finally{if(a)throw l}}return i}}(e)||function(e){if(e){if("string"==typeof e)return b(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=o[0],d=o[1],u=c?"/v1/plugins/quality/build-order?package=".concat(encodeURIComponent(c)):"/v1/plugins/quality/build-order",p=(0,a.useData)(u),g=p.data,y=p.isLoading,h=p.isError;if((0,a.useData)("/v1/plugins/quality/cycles").data,y)return(0,t.jsx)(r.UISkeleton,{active:!0,lines:6,style:{padding:"24px 0"}});if(h)return(0,t.jsx)(r.UIAlert,{message:"Failed to load build order",variant:"error",showIcon:!0});var f=[{title:"Layer",dataIndex:"layer",key:"layer",width:100,render:function(e){return(0,t.jsxs)(r.UITag,{color:"blue",children:["Layer ",e]})}},{title:"Packages (can build in parallel)",dataIndex:"packages",key:"packages",render:function(e){return(0,t.jsx)(r.UISpace,{wrap:!0,children:e.map(function(e){return(0,t.jsx)(r.UITag,{children:e},e)})})}}],x=null==g?void 0:g.layers.map(function(e,n){return{layer:n+1,packages:e,key:n}});return(0,t.jsxs)("div",{children:[(null==g?void 0:g.hasCircular)&&(0,t.jsx)(r.UIAlert,{message:"Circular Dependencies Detected!",description:"Found ".concat(g.circular.length," circular dependency cycles. Build order may not be correct."),variant:"error",showIcon:!0,style:{marginBottom:24}}),(0,t.jsx)(r.UICard,{title:"Filter",style:{marginBottom:24},children:(0,t.jsx)(r.UISelect,{style:{width:400},placeholder:"Select package to see its build dependencies",value:c,onChange:function(e){return d(e)},allowClear:!0,showSearch:!0,options:null!=(n=null==g?void 0:g.sorted.map(function(e){return{label:e,value:e}}))?n:[]})}),(0,t.jsx)(r.UICard,{title:"Build Layers (".concat(null!=(l=null==g?void 0:g.layerCount)?l:0," layers, ").concat(null!=(s=null==g?void 0:g.packageCount)?s:0," packages)"),style:{marginBottom:24},children:(0,t.jsx)(r.UITable,{dataSource:null!=x?x:[],columns:f,pagination:!1,expandable:{expandedRowRender:function(e){return(0,t.jsxs)("div",{style:{padding:"8px 0"},children:[(0,t.jsx)("strong",{children:"Packages in this layer:"}),(0,t.jsx)("div",{style:{marginTop:8},children:e.packages.map(function(e){return(0,t.jsx)(r.UITag,{style:{marginBottom:4},children:e},e)})})]})}}})}),(null==g?void 0:g.hasCircular)&&(0,t.jsx)(r.UICard,{title:"Circular Dependencies (".concat(g.circular.length,")"),children:g.circular.map(function(e,n){return(0,t.jsx)(r.UIAlert,{message:"Cycle ".concat(n+1),description:e.join(" → "),variant:"warning",showIcon:!0,style:{marginBottom:12}},n)})})]})}function U(){var e=(0,t.jsx)(r.UITabs,{syncUrl:"search",items:[{key:"overview",label:"Overview",children:(0,t.jsx)(d,{})},{key:"architecture",label:"Architecture",children:(0,t.jsx)(g,{})},{key:"debt",label:"Debt",children:(0,t.jsx)(x,{})},{key:"history",label:"History",children:(0,t.jsx)(I,{})},{key:"build-order",label:"Build Order",children:(0,t.jsx)(k,{})}]});return(0,t.jsx)(r.UIPage,{children:(0,t.jsx)(r.UIPageHeader,{title:"Quality",description:"Code health, architecture analysis, and trend tracking",tabs:e})})}}}]);
|
|
@@ -25,16 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"shared": [
|
|
27
27
|
{
|
|
28
|
-
"id": "qualityPlugin
|
|
29
|
-
"name": "
|
|
30
|
-
"version": "
|
|
28
|
+
"id": "qualityPlugin:react-router-dom",
|
|
29
|
+
"name": "react-router-dom",
|
|
30
|
+
"version": "7.18.1",
|
|
31
31
|
"singleton": true,
|
|
32
|
-
"requiredVersion": "^
|
|
32
|
+
"requiredVersion": "^7.0.0",
|
|
33
33
|
"assets": {
|
|
34
34
|
"js": {
|
|
35
35
|
"sync": [
|
|
36
|
-
"
|
|
37
|
-
"669.js"
|
|
36
|
+
"875.js"
|
|
38
37
|
],
|
|
39
38
|
"async": []
|
|
40
39
|
},
|
|
@@ -114,7 +113,7 @@
|
|
|
114
113
|
"sync": [
|
|
115
114
|
"117.js",
|
|
116
115
|
"326.js",
|
|
117
|
-
"
|
|
116
|
+
"421.js",
|
|
118
117
|
"648.js"
|
|
119
118
|
],
|
|
120
119
|
"async": []
|
|
@@ -126,15 +125,16 @@
|
|
|
126
125
|
}
|
|
127
126
|
},
|
|
128
127
|
{
|
|
129
|
-
"id": "qualityPlugin:react",
|
|
130
|
-
"name": "react",
|
|
128
|
+
"id": "qualityPlugin:react-dom",
|
|
129
|
+
"name": "react-dom",
|
|
131
130
|
"version": "19.2.5",
|
|
132
131
|
"singleton": true,
|
|
133
132
|
"requiredVersion": "^19.0.0",
|
|
134
133
|
"assets": {
|
|
135
134
|
"js": {
|
|
136
135
|
"sync": [
|
|
137
|
-
"
|
|
136
|
+
"165.js",
|
|
137
|
+
"546.js"
|
|
138
138
|
],
|
|
139
139
|
"async": []
|
|
140
140
|
},
|
|
@@ -145,16 +145,15 @@
|
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
"id": "qualityPlugin:react
|
|
149
|
-
"name": "react
|
|
148
|
+
"id": "qualityPlugin:react",
|
|
149
|
+
"name": "react",
|
|
150
150
|
"version": "19.2.5",
|
|
151
151
|
"singleton": true,
|
|
152
152
|
"requiredVersion": "^19.0.0",
|
|
153
153
|
"assets": {
|
|
154
154
|
"js": {
|
|
155
155
|
"sync": [
|
|
156
|
-
"
|
|
157
|
-
"546.js"
|
|
156
|
+
"405.js"
|
|
158
157
|
],
|
|
159
158
|
"async": []
|
|
160
159
|
},
|
|
@@ -185,15 +184,16 @@
|
|
|
185
184
|
}
|
|
186
185
|
},
|
|
187
186
|
{
|
|
188
|
-
"id": "qualityPlugin
|
|
189
|
-
"name": "
|
|
190
|
-
"version": "
|
|
187
|
+
"id": "qualityPlugin:@kb-labs/studio-event-bus",
|
|
188
|
+
"name": "@kb-labs/studio-event-bus",
|
|
189
|
+
"version": "2.118.2",
|
|
191
190
|
"singleton": true,
|
|
192
|
-
"requiredVersion": "^
|
|
191
|
+
"requiredVersion": "^2.0.0",
|
|
193
192
|
"assets": {
|
|
194
193
|
"js": {
|
|
195
194
|
"sync": [
|
|
196
|
-
"
|
|
195
|
+
"50.js",
|
|
196
|
+
"669.js"
|
|
197
197
|
],
|
|
198
198
|
"async": []
|
|
199
199
|
},
|
|
@@ -25,16 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"shared": [
|
|
27
27
|
{
|
|
28
|
-
"id": "qualityPlugin
|
|
29
|
-
"name": "
|
|
30
|
-
"version": "
|
|
31
|
-
"requiredVersion": "^
|
|
28
|
+
"id": "qualityPlugin:react-router-dom",
|
|
29
|
+
"name": "react-router-dom",
|
|
30
|
+
"version": "7.18.1",
|
|
31
|
+
"requiredVersion": "^7.0.0",
|
|
32
32
|
"singleton": true,
|
|
33
33
|
"assets": {
|
|
34
34
|
"js": {
|
|
35
35
|
"sync": [
|
|
36
|
-
"
|
|
37
|
-
"669.js"
|
|
36
|
+
"875.js"
|
|
38
37
|
],
|
|
39
38
|
"async": []
|
|
40
39
|
},
|
|
@@ -122,7 +121,7 @@
|
|
|
122
121
|
"sync": [
|
|
123
122
|
"117.js",
|
|
124
123
|
"326.js",
|
|
125
|
-
"
|
|
124
|
+
"421.js",
|
|
126
125
|
"648.js"
|
|
127
126
|
],
|
|
128
127
|
"async": []
|
|
@@ -136,15 +135,16 @@
|
|
|
136
135
|
"usedExports": []
|
|
137
136
|
},
|
|
138
137
|
{
|
|
139
|
-
"id": "qualityPlugin:react",
|
|
140
|
-
"name": "react",
|
|
138
|
+
"id": "qualityPlugin:react-dom",
|
|
139
|
+
"name": "react-dom",
|
|
141
140
|
"version": "19.2.5",
|
|
142
141
|
"requiredVersion": "^19.0.0",
|
|
143
142
|
"singleton": true,
|
|
144
143
|
"assets": {
|
|
145
144
|
"js": {
|
|
146
145
|
"sync": [
|
|
147
|
-
"
|
|
146
|
+
"165.js",
|
|
147
|
+
"546.js"
|
|
148
148
|
],
|
|
149
149
|
"async": []
|
|
150
150
|
},
|
|
@@ -153,22 +153,19 @@
|
|
|
153
153
|
"async": []
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
|
-
"usedIn": [
|
|
157
|
-
"src/studio/pages/QualityOverview.tsx"
|
|
158
|
-
],
|
|
156
|
+
"usedIn": [],
|
|
159
157
|
"usedExports": []
|
|
160
158
|
},
|
|
161
159
|
{
|
|
162
|
-
"id": "qualityPlugin:react
|
|
163
|
-
"name": "react
|
|
160
|
+
"id": "qualityPlugin:react",
|
|
161
|
+
"name": "react",
|
|
164
162
|
"version": "19.2.5",
|
|
165
163
|
"requiredVersion": "^19.0.0",
|
|
166
164
|
"singleton": true,
|
|
167
165
|
"assets": {
|
|
168
166
|
"js": {
|
|
169
167
|
"sync": [
|
|
170
|
-
"
|
|
171
|
-
"546.js"
|
|
168
|
+
"405.js"
|
|
172
169
|
],
|
|
173
170
|
"async": []
|
|
174
171
|
},
|
|
@@ -177,7 +174,9 @@
|
|
|
177
174
|
"async": []
|
|
178
175
|
}
|
|
179
176
|
},
|
|
180
|
-
"usedIn": [
|
|
177
|
+
"usedIn": [
|
|
178
|
+
"src/studio/pages/QualityOverview.tsx"
|
|
179
|
+
],
|
|
181
180
|
"usedExports": []
|
|
182
181
|
},
|
|
183
182
|
{
|
|
@@ -203,15 +202,16 @@
|
|
|
203
202
|
"usedExports": []
|
|
204
203
|
},
|
|
205
204
|
{
|
|
206
|
-
"id": "qualityPlugin
|
|
207
|
-
"name": "
|
|
208
|
-
"version": "
|
|
209
|
-
"requiredVersion": "^
|
|
205
|
+
"id": "qualityPlugin:@kb-labs/studio-event-bus",
|
|
206
|
+
"name": "@kb-labs/studio-event-bus",
|
|
207
|
+
"version": "2.118.2",
|
|
208
|
+
"requiredVersion": "^2.0.0",
|
|
210
209
|
"singleton": true,
|
|
211
210
|
"assets": {
|
|
212
211
|
"js": {
|
|
213
212
|
"sync": [
|
|
214
|
-
"
|
|
213
|
+
"50.js",
|
|
214
|
+
"669.js"
|
|
215
215
|
],
|
|
216
216
|
"async": []
|
|
217
217
|
},
|