@vibgrate/cli 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseline-AENFLFQT.js +9 -0
- package/dist/chunk-AMOJCCF5.js +71 -0
- package/dist/chunk-DLRBJYO6.js +1077 -0
- package/dist/chunk-OHAVLM6P.js +29 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +377 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +18 -0
- package/package.json +57 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/formatters/markdown.ts
|
|
2
|
+
function formatMarkdown(artifact) {
|
|
3
|
+
const lines = [];
|
|
4
|
+
lines.push("# Vibgrate Drift Report");
|
|
5
|
+
lines.push("");
|
|
6
|
+
lines.push(`| Metric | Value |`);
|
|
7
|
+
lines.push(`|--------|-------|`);
|
|
8
|
+
lines.push(`| **Drift Score** | ${artifact.drift.score}/100 |`);
|
|
9
|
+
lines.push(`| **Risk Level** | ${artifact.drift.riskLevel.toUpperCase()} |`);
|
|
10
|
+
lines.push(`| **Projects** | ${artifact.projects.length} |`);
|
|
11
|
+
lines.push(`| **Scanned** | ${artifact.timestamp} |`);
|
|
12
|
+
if (artifact.vcs) {
|
|
13
|
+
lines.push(`| **VCS** | ${artifact.vcs.type} |`);
|
|
14
|
+
if (artifact.vcs.branch) lines.push(`| **Branch** | ${artifact.vcs.branch} |`);
|
|
15
|
+
if (artifact.vcs.sha) lines.push(`| **Commit** | \`${artifact.vcs.shortSha}\` |`);
|
|
16
|
+
}
|
|
17
|
+
lines.push("");
|
|
18
|
+
lines.push("## Score Breakdown");
|
|
19
|
+
lines.push("");
|
|
20
|
+
lines.push(`| Component | Score |`);
|
|
21
|
+
lines.push(`|-----------|-------|`);
|
|
22
|
+
lines.push(`| Runtime | ${artifact.drift.components.runtimeScore} |`);
|
|
23
|
+
lines.push(`| Frameworks | ${artifact.drift.components.frameworkScore} |`);
|
|
24
|
+
lines.push(`| Dependencies | ${artifact.drift.components.dependencyScore} |`);
|
|
25
|
+
lines.push(`| EOL Risk | ${artifact.drift.components.eolScore} |`);
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push("## Projects");
|
|
28
|
+
lines.push("");
|
|
29
|
+
for (const project of artifact.projects) {
|
|
30
|
+
lines.push(`### ${project.name} (${project.type})`);
|
|
31
|
+
lines.push("");
|
|
32
|
+
if (project.runtime) {
|
|
33
|
+
const lag = project.runtimeMajorsBehind !== void 0 && project.runtimeMajorsBehind > 0 ? ` \u2014 ${project.runtimeMajorsBehind} major(s) behind` : " \u2014 current";
|
|
34
|
+
lines.push(`- **Runtime:** ${project.runtime}${lag}`);
|
|
35
|
+
}
|
|
36
|
+
if (project.frameworks.length > 0) {
|
|
37
|
+
lines.push("- **Frameworks:**");
|
|
38
|
+
for (const fw of project.frameworks) {
|
|
39
|
+
const lag = fw.majorsBehind !== null ? fw.majorsBehind === 0 ? "current" : `${fw.majorsBehind} behind` : "unknown";
|
|
40
|
+
lines.push(` - ${fw.name}: ${fw.currentVersion ?? "?"} \u2192 ${fw.latestVersion ?? "?"} (${lag})`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const b = project.dependencyAgeBuckets;
|
|
44
|
+
const total = b.current + b.oneBehind + b.twoPlusBehind + b.unknown;
|
|
45
|
+
if (total > 0) {
|
|
46
|
+
lines.push(`- **Dependencies:** ${b.current} current, ${b.oneBehind} 1-behind, ${b.twoPlusBehind} 2+ behind, ${b.unknown} unknown`);
|
|
47
|
+
}
|
|
48
|
+
lines.push("");
|
|
49
|
+
}
|
|
50
|
+
if (artifact.findings.length > 0) {
|
|
51
|
+
lines.push("## Findings");
|
|
52
|
+
lines.push("");
|
|
53
|
+
lines.push(`| Level | Rule | Message | Location |`);
|
|
54
|
+
lines.push(`|-------|------|---------|----------|`);
|
|
55
|
+
for (const f of artifact.findings) {
|
|
56
|
+
const emoji = f.level === "error" ? "\u{1F534}" : f.level === "warning" ? "\u{1F7E1}" : "\u{1F535}";
|
|
57
|
+
lines.push(`| ${emoji} ${f.level} | ${f.ruleId} | ${f.message} | ${f.location} |`);
|
|
58
|
+
}
|
|
59
|
+
lines.push("");
|
|
60
|
+
}
|
|
61
|
+
if (artifact.delta !== void 0) {
|
|
62
|
+
const dir = artifact.delta > 0 ? "\u{1F4C8}" : artifact.delta < 0 ? "\u{1F4C9}" : "\u27A1\uFE0F";
|
|
63
|
+
lines.push(`## Drift Delta: ${dir} ${artifact.delta > 0 ? "+" : ""}${artifact.delta} vs baseline`);
|
|
64
|
+
lines.push("");
|
|
65
|
+
}
|
|
66
|
+
return lines.join("\n");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
formatMarkdown
|
|
71
|
+
};
|