dsh-codebase-chat 0.21.0 → 0.22.0
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/README.md +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1523,6 +1523,91 @@ function formatHealthReport(r, lang = "fr") {
|
|
|
1523
1523
|
for (const h of r.hotspots.slice(0, 10)) out.push(` ${h.file} \u2014 score ${h.score}`);
|
|
1524
1524
|
return out.join("\n");
|
|
1525
1525
|
}
|
|
1526
|
+
var GRADE_ICON = { A: "\u{1F7E2}", B: "\u{1F535}", C: "\u{1F7E1}", D: "\u{1F7E0}", E: "\u{1F534}" };
|
|
1527
|
+
function scoreBar(score) {
|
|
1528
|
+
const filled = Math.round(score / 10);
|
|
1529
|
+
return "\u2588".repeat(filled) + "\u2591".repeat(10 - filled);
|
|
1530
|
+
}
|
|
1531
|
+
function formatHealthReportMd(r, lang = "fr") {
|
|
1532
|
+
const t2 = lang === "en" ? {
|
|
1533
|
+
title: "Static analysis",
|
|
1534
|
+
files: "files analyzed",
|
|
1535
|
+
edges: "local imports",
|
|
1536
|
+
cycles: "Circular dependencies",
|
|
1537
|
+
none: "None",
|
|
1538
|
+
unusedFiles: "Unused files (candidates)",
|
|
1539
|
+
unusedExports: "Unused exports (candidates)",
|
|
1540
|
+
dupes: "Duplicate code blocks",
|
|
1541
|
+
hotspots: "Complexity hotspots",
|
|
1542
|
+
score: "Health score",
|
|
1543
|
+
noteUnused: "_candidates \u2014 entry points and framework conventions excluded_",
|
|
1544
|
+
colFile: "File",
|
|
1545
|
+
colSymbol: "Symbol",
|
|
1546
|
+
colSize: "Size",
|
|
1547
|
+
colFiles: "Files",
|
|
1548
|
+
colScore: "Score",
|
|
1549
|
+
more: (n) => `_\u2026and ${n} more_`
|
|
1550
|
+
} : {
|
|
1551
|
+
title: "Analyse statique",
|
|
1552
|
+
files: "fichiers analys\xE9s",
|
|
1553
|
+
edges: "imports locaux",
|
|
1554
|
+
cycles: "D\xE9pendances circulaires",
|
|
1555
|
+
none: "Aucune",
|
|
1556
|
+
unusedFiles: "Fichiers inutilis\xE9s (candidats)",
|
|
1557
|
+
unusedExports: "Exports inutilis\xE9s (candidats)",
|
|
1558
|
+
dupes: "Blocs de code dupliqu\xE9s",
|
|
1559
|
+
hotspots: "Hotspots de complexit\xE9",
|
|
1560
|
+
score: "Score de sant\xE9",
|
|
1561
|
+
noteUnused: "_candidats \u2014 points d\u2019entr\xE9e et conventions exclus_",
|
|
1562
|
+
colFile: "Fichier",
|
|
1563
|
+
colSymbol: "Symbole",
|
|
1564
|
+
colSize: "Taille",
|
|
1565
|
+
colFiles: "Fichiers",
|
|
1566
|
+
colScore: "Score",
|
|
1567
|
+
more: (n) => `_\u2026et ${n} autres_`
|
|
1568
|
+
};
|
|
1569
|
+
const out = [];
|
|
1570
|
+
out.push(`## ${GRADE_ICON[r.grade]} ${t2.title} \u2014 \`${basename(r.projectPath)}\``);
|
|
1571
|
+
out.push("");
|
|
1572
|
+
out.push(`**${t2.score} : ${scoreBar(r.score)} ${r.score}/100 (${r.grade})** \xB7 ${r.analyzedFiles} ${t2.files} \xB7 ${r.importEdges} ${t2.edges}`);
|
|
1573
|
+
out.push("");
|
|
1574
|
+
out.push(`### ${t2.cycles} \u2014 ${r.cycles.length}`);
|
|
1575
|
+
if (r.cycles.length === 0) out.push(t2.none);
|
|
1576
|
+
else for (const c of r.cycles.slice(0, 10)) out.push(`- \`${c.path.join("` \u2192 `")}\``);
|
|
1577
|
+
if (r.cycles.length > 10) out.push(t2.more(r.cycles.length - 10));
|
|
1578
|
+
out.push("");
|
|
1579
|
+
out.push(`### ${t2.unusedFiles} \u2014 ${r.unusedFiles.length}`);
|
|
1580
|
+
out.push(t2.noteUnused);
|
|
1581
|
+
if (r.unusedFiles.length) {
|
|
1582
|
+
out.push("", `| ${t2.colFile} |`, "|---|---|");
|
|
1583
|
+
for (const f of r.unusedFiles.slice(0, 15)) out.push(`| \`${f}\` |`);
|
|
1584
|
+
if (r.unusedFiles.length > 15) out.push(`| ${t2.more(r.unusedFiles.length - 15)} |`);
|
|
1585
|
+
}
|
|
1586
|
+
out.push("");
|
|
1587
|
+
out.push(`### ${t2.unusedExports} \u2014 ${r.unusedExports.length}`);
|
|
1588
|
+
if (r.unusedExports.length) {
|
|
1589
|
+
out.push("", `| ${t2.colFile} | ${t2.colSymbol} |`, "|---|---|");
|
|
1590
|
+
for (const e of r.unusedExports.slice(0, 15)) out.push(`| \`${e.file}:${e.line}\` | \`${e.name}\` |`);
|
|
1591
|
+
if (r.unusedExports.length > 15) out.push(`| ${t2.more(r.unusedExports.length - 15)} | |`);
|
|
1592
|
+
} else out.push(t2.none);
|
|
1593
|
+
out.push("");
|
|
1594
|
+
out.push(`### ${t2.dupes} \u2014 ${r.duplicates.length}`);
|
|
1595
|
+
if (r.duplicates.length) {
|
|
1596
|
+
out.push("", `| ${t2.colSize} | ${t2.colFiles} |`, "|---|---|");
|
|
1597
|
+
for (const d of r.duplicates.slice(0, 8)) {
|
|
1598
|
+
out.push(`| ${d.lines} \xD7 ${d.files.length} | ${d.files.map((f) => `\`${f}\``).join(", ")} |`);
|
|
1599
|
+
}
|
|
1600
|
+
if (r.duplicates.length > 8) out.push(`| ${t2.more(r.duplicates.length - 8)} | |`);
|
|
1601
|
+
} else out.push(t2.none);
|
|
1602
|
+
out.push("");
|
|
1603
|
+
out.push(`### ${t2.hotspots} \u2014 ${r.hotspots.length}`);
|
|
1604
|
+
if (r.hotspots.length) {
|
|
1605
|
+
out.push("", `| ${t2.colFile} | ${t2.colScore} |`, "|---|---|");
|
|
1606
|
+
for (const h of r.hotspots.slice(0, 10)) out.push(`| \`${h.file}\` | **${h.score}** |`);
|
|
1607
|
+
if (r.hotspots.length > 10) out.push(`| ${t2.more(r.hotspots.length - 10)} | |`);
|
|
1608
|
+
} else out.push(t2.none);
|
|
1609
|
+
return out.join("\n");
|
|
1610
|
+
}
|
|
1526
1611
|
export {
|
|
1527
1612
|
CONFIG_FILE,
|
|
1528
1613
|
analyzeProject,
|
|
@@ -1538,6 +1623,7 @@ export {
|
|
|
1538
1623
|
extractChunks,
|
|
1539
1624
|
findProjectRoot,
|
|
1540
1625
|
formatHealthReport,
|
|
1626
|
+
formatHealthReportMd,
|
|
1541
1627
|
getEmbedding,
|
|
1542
1628
|
getEmbeddings,
|
|
1543
1629
|
getExtractor,
|