@ipation/specbridge 1.0.3 → 1.0.5
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/CHANGELOG.md +68 -0
- package/dist/cli.js +154 -140
- package/dist/cli.js.map +1 -1
- package/dist/index.js +31 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1363,7 +1363,7 @@ var ErrorsAnalyzer = class {
|
|
|
1363
1363
|
rule: `Custom error classes should extend ${customBaseName}`,
|
|
1364
1364
|
severity: "medium",
|
|
1365
1365
|
scope: "src/**/*.ts",
|
|
1366
|
-
verifier: "
|
|
1366
|
+
verifier: "errors"
|
|
1367
1367
|
}
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
@@ -1460,7 +1460,7 @@ var ErrorsAnalyzer = class {
|
|
|
1460
1460
|
rule: "Throw custom error classes instead of generic Error",
|
|
1461
1461
|
severity: "medium",
|
|
1462
1462
|
scope: "src/**/*.ts",
|
|
1463
|
-
verifier: "
|
|
1463
|
+
verifier: "errors"
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
}
|
|
@@ -2034,9 +2034,11 @@ var VerificationEngine = class {
|
|
|
2034
2034
|
let passed = 0;
|
|
2035
2035
|
let failed = 0;
|
|
2036
2036
|
const skipped = 0;
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2037
|
+
let timeoutHandle = null;
|
|
2038
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
2039
|
+
timeoutHandle = setTimeout(() => resolve("timeout"), timeout);
|
|
2040
|
+
timeoutHandle.unref();
|
|
2041
|
+
});
|
|
2040
2042
|
const verificationPromise = this.verifyFiles(
|
|
2041
2043
|
filesToVerify,
|
|
2042
2044
|
decisions,
|
|
@@ -2052,17 +2054,25 @@ var VerificationEngine = class {
|
|
|
2052
2054
|
}
|
|
2053
2055
|
}
|
|
2054
2056
|
);
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2057
|
+
let result;
|
|
2058
|
+
try {
|
|
2059
|
+
result = await Promise.race([verificationPromise, timeoutPromise]);
|
|
2060
|
+
if (result === "timeout") {
|
|
2061
|
+
return {
|
|
2062
|
+
success: false,
|
|
2063
|
+
violations: allViolations,
|
|
2064
|
+
checked,
|
|
2065
|
+
passed,
|
|
2066
|
+
failed,
|
|
2067
|
+
skipped: filesToVerify.length - checked,
|
|
2068
|
+
duration: timeout
|
|
2069
|
+
};
|
|
2070
|
+
}
|
|
2071
|
+
} finally {
|
|
2072
|
+
if (timeoutHandle) {
|
|
2073
|
+
clearTimeout(timeoutHandle);
|
|
2074
|
+
timeoutHandle = null;
|
|
2075
|
+
}
|
|
2066
2076
|
}
|
|
2067
2077
|
const hasBlockingViolations = allViolations.some((v) => {
|
|
2068
2078
|
if (level === "commit") {
|
|
@@ -2757,7 +2767,7 @@ function formatMarkdownReport(report) {
|
|
|
2757
2767
|
lines.push("| Decision | Status | Constraints | Violations | Compliance |");
|
|
2758
2768
|
lines.push("|----------|--------|-------------|------------|------------|");
|
|
2759
2769
|
for (const dec of report.byDecision) {
|
|
2760
|
-
const complianceEmoji = dec.compliance >= 90 ? "" : dec.compliance >= 70 ? "" : "";
|
|
2770
|
+
const complianceEmoji = dec.compliance >= 90 ? "\u2705" : dec.compliance >= 70 ? "\u26A0\uFE0F" : "\u274C";
|
|
2761
2771
|
lines.push(
|
|
2762
2772
|
`| ${dec.title} | ${dec.status} | ${dec.constraints} | ${dec.violations} | ${complianceEmoji} ${dec.compliance}% |`
|
|
2763
2773
|
);
|
|
@@ -2766,15 +2776,15 @@ function formatMarkdownReport(report) {
|
|
|
2766
2776
|
}
|
|
2767
2777
|
lines.push("---");
|
|
2768
2778
|
lines.push("");
|
|
2769
|
-
lines.push("*Generated by [SpecBridge](https://github.com/
|
|
2779
|
+
lines.push("*Generated by [SpecBridge](https://github.com/nouatzi/specbridge)*");
|
|
2770
2780
|
return lines.join("\n");
|
|
2771
2781
|
}
|
|
2772
2782
|
function formatProgressBar(percentage) {
|
|
2773
2783
|
const width = 20;
|
|
2774
2784
|
const filled = Math.round(percentage / 100 * width);
|
|
2775
2785
|
const empty = width - filled;
|
|
2776
|
-
const filledChar = "";
|
|
2777
|
-
const emptyChar = "";
|
|
2786
|
+
const filledChar = "\u2588";
|
|
2787
|
+
const emptyChar = "\u2591";
|
|
2778
2788
|
return `\`${filledChar.repeat(filled)}${emptyChar.repeat(empty)}\` ${percentage}%`;
|
|
2779
2789
|
}
|
|
2780
2790
|
|
|
@@ -2834,7 +2844,7 @@ function formatContextAsMarkdown(context) {
|
|
|
2834
2844
|
lines.push("### Constraints");
|
|
2835
2845
|
lines.push("");
|
|
2836
2846
|
for (const constraint of decision.constraints) {
|
|
2837
|
-
const typeEmoji = constraint.type === "invariant" ? "" : constraint.type === "convention" ? "" : "";
|
|
2847
|
+
const typeEmoji = constraint.type === "invariant" ? "\u{1F512}" : constraint.type === "convention" ? "\u{1F4CB}" : "\u{1F4A1}";
|
|
2838
2848
|
const severityBadge = `[${constraint.severity.toUpperCase()}]`;
|
|
2839
2849
|
lines.push(`- ${typeEmoji} **${severityBadge}** ${constraint.rule}`);
|
|
2840
2850
|
}
|