@getcodesentinel/codesentinel 1.26.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,8 +14,8 @@
14
14
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap"
15
15
  rel="stylesheet"
16
16
  />
17
- <script type="module" crossorigin src="./assets/index-DFBRf1W-.js"></script>
18
- <link rel="stylesheet" crossorigin href="./assets/index-DSDox9i_.css">
17
+ <script type="module" crossorigin src="./assets/index-DLN4dPA8.js"></script>
18
+ <link rel="stylesheet" crossorigin href="./assets/index-Cv_yz1bX.css">
19
19
  </head>
20
20
  <body>
21
21
  <div id="root"></div>
package/dist/index.js CHANGED
@@ -2087,6 +2087,36 @@ var structuralModuleAnatomy = (snapshot) => {
2087
2087
  var average = (values) => values.length === 0 ? null : round43(values.reduce((sum, value) => sum + value, 0) / values.length);
2088
2088
  var toPercent = (value) => round43(value * 100);
2089
2089
  var LEGACY_NO_ACTIVE_OWNER_DAYS = 180;
2090
+ var MODULE_KNOWLEDGE_LABEL_PRIORITY = {
2091
+ siloed: 0,
2092
+ sparse: 1,
2093
+ distributed: 2
2094
+ };
2095
+ var fileOwnershipItems = (files) => {
2096
+ const labelPriority = {
2097
+ singleMaintainer: 0,
2098
+ concentrated: 1,
2099
+ shared: 2
2100
+ };
2101
+ return files.filter((file) => file.commitCount > 0 && file.authorDistributionByCommits.length > 0).map((file) => {
2102
+ const ownershipLabel = file.authorDistributionByCommits.length <= 1 ? "singleMaintainer" : file.topAuthorShareByCommits > 0.6 ? "concentrated" : "shared";
2103
+ return {
2104
+ filePath: file.filePath,
2105
+ module: toPosixDirname(file.filePath),
2106
+ commitCount: file.commitCount,
2107
+ churnTotal: file.churnTotal,
2108
+ ownershipLabel,
2109
+ topAuthorShareByCommits: file.topAuthorShareByCommits,
2110
+ busFactorByCommits: file.busFactorByCommits,
2111
+ authorDistributionByCommits: file.authorDistributionByCommits,
2112
+ topAuthorShareByChurn: file.topAuthorShareByChurn,
2113
+ busFactorByChurn: file.busFactorByChurn,
2114
+ authorDistributionByChurn: file.authorDistributionByChurn
2115
+ };
2116
+ }).sort(
2117
+ (a, b) => labelPriority[a.ownershipLabel] - labelPriority[b.ownershipLabel] || b.topAuthorShareByCommits - a.topAuthorShareByCommits || b.commitCount - a.commitCount || a.filePath.localeCompare(b.filePath)
2118
+ );
2119
+ };
2090
2120
  var changeOwnershipSummary = (snapshot) => {
2091
2121
  if (!snapshot.analysis.evolution.available) {
2092
2122
  return {
@@ -2145,7 +2175,9 @@ var changeOwnershipSummary = (snapshot) => {
2145
2175
  topAuthorShareByCommits,
2146
2176
  ownershipLabel
2147
2177
  };
2148
- }).sort((a, b) => b.totalCommits - a.totalCommits || a.module.localeCompare(b.module)).slice(0, 8);
2178
+ }).sort(
2179
+ (a, b) => MODULE_KNOWLEDGE_LABEL_PRIORITY[a.ownershipLabel] - MODULE_KNOWLEDGE_LABEL_PRIORITY[b.ownershipLabel] || b.totalCommits - a.totalCommits || a.module.localeCompare(b.module)
2180
+ ).slice(0, 8);
2149
2181
  const coChangePairs = [...evolution.coupling.pairs].sort(
2150
2182
  (a, b) => b.couplingScore - a.couplingScore || b.coChangeCommits - a.coChangeCommits || a.fileA.localeCompare(b.fileA) || a.fileB.localeCompare(b.fileB)
2151
2183
  ).slice(0, 5).map((pair) => ({
@@ -2171,7 +2203,8 @@ var changeOwnershipSummary = (snapshot) => {
2171
2203
  },
2172
2204
  recentActivity: evolution.recentActivity ?? [],
2173
2205
  coChangePairs,
2174
- moduleKnowledge
2206
+ moduleKnowledge,
2207
+ fileOwnership: fileOwnershipItems(files)
2175
2208
  };
2176
2209
  };
2177
2210
  var riskyDependencies = (snapshot) => {