@comity-dev/validate 0.2.3 → 0.4.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 +23 -4
- package/dist/bin/comity-validate.d.ts +1 -1
- package/dist/bin/comity-validate.js +9 -4
- package/dist/discover.d.ts +28 -0
- package/dist/discover.js +127 -1
- package/dist/engines/declaration-dependencies.d.ts +29 -0
- package/dist/engines/declaration-dependencies.js +439 -0
- package/dist/engines/packed-surface.d.ts +22 -0
- package/dist/engines/packed-surface.js +654 -0
- package/dist/exit-codes.d.ts +1 -1
- package/dist/exit-codes.js +1 -1
- package/dist/format.d.ts +4 -0
- package/dist/format.js +5 -0
- package/dist/run.d.ts +4 -0
- package/dist/run.js +32 -1
- package/package.json +4 -4
package/dist/format.js
CHANGED
|
@@ -6,6 +6,8 @@ const CATEGORY_LABELS = {
|
|
|
6
6
|
eslint: "Source rules (ESLint)",
|
|
7
7
|
semgrep: "Structural patterns (Semgrep)",
|
|
8
8
|
adapterPeers: "Adapter peers",
|
|
9
|
+
declarations: "Declarations",
|
|
10
|
+
packedSurface: "Packed surface",
|
|
9
11
|
};
|
|
10
12
|
function statusBadge(cat) {
|
|
11
13
|
switch (cat.status) {
|
|
@@ -67,6 +69,9 @@ export function formatSummary(result) {
|
|
|
67
69
|
cat.status === "NOT-APPLICABLE") {
|
|
68
70
|
lines.push(` ${label}: ${cat.reason ?? cat.status}`);
|
|
69
71
|
}
|
|
72
|
+
else if (cat.status === "PASS" && cat.reason) {
|
|
73
|
+
lines.push(` ${label}: ${cat.reason}`);
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
lines.push("");
|
|
72
77
|
lines.push(`Result: ${overallResult(result)}`);
|
package/dist/run.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export interface RunResult {
|
|
|
45
45
|
semgrep: CategoryResult;
|
|
46
46
|
/** Adapter peers validation results */
|
|
47
47
|
adapterPeers: CategoryResult;
|
|
48
|
+
/** Published declaration dependency validation results */
|
|
49
|
+
declarations: CategoryResult;
|
|
50
|
+
/** Packed-surface tarball validation results */
|
|
51
|
+
packedSurface: CategoryResult;
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
/**
|
package/dist/run.js
CHANGED
|
@@ -2,8 +2,10 @@ import { dirname, resolve } from "node:path";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { discoverRepository } from "./discover.js";
|
|
4
4
|
import { runAdapterPeers } from "./engines/adapter-peers.js";
|
|
5
|
+
import { runDeclarationDependencies } from "./engines/declaration-dependencies.js";
|
|
5
6
|
import { runDepcruise } from "./engines/depcruise.js";
|
|
6
7
|
import { runEslint } from "./engines/eslint.js";
|
|
8
|
+
import { runPackedSurface } from "./engines/packed-surface.js";
|
|
7
9
|
import { runSchema } from "./engines/schema.js";
|
|
8
10
|
import { runSemgrep } from "./engines/semgrep.js";
|
|
9
11
|
import { ExitCode } from "./exit-codes.js";
|
|
@@ -115,6 +117,24 @@ export async function runValidation(options) {
|
|
|
115
117
|
else {
|
|
116
118
|
adapterResult = emptyEngineResult("adapter-peers engine skipped");
|
|
117
119
|
}
|
|
120
|
+
let declarationResult;
|
|
121
|
+
if (!only ||
|
|
122
|
+
only === "declarations" ||
|
|
123
|
+
only === "declaration-dependencies") {
|
|
124
|
+
declarationResult = runDeclarationDependencies(repo);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
declarationResult = emptyEngineResult("declarations engine skipped");
|
|
128
|
+
}
|
|
129
|
+
let packedSurfaceResult;
|
|
130
|
+
if (only === "packed-surface") {
|
|
131
|
+
packedSurfaceResult = runPackedSurface(repo);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
packedSurfaceResult = emptyEngineResult(only
|
|
135
|
+
? "packed-surface engine skipped"
|
|
136
|
+
: "packed-surface engine requires explicit --only=packed-surface");
|
|
137
|
+
}
|
|
118
138
|
const violations = [];
|
|
119
139
|
for (const r of [
|
|
120
140
|
schemaResult,
|
|
@@ -122,12 +142,21 @@ export async function runValidation(options) {
|
|
|
122
142
|
eslintResult,
|
|
123
143
|
semgrepResult,
|
|
124
144
|
adapterResult,
|
|
145
|
+
declarationResult,
|
|
146
|
+
packedSurfaceResult,
|
|
125
147
|
]) {
|
|
126
148
|
if (Array.isArray(r.findings)) {
|
|
127
149
|
violations.push(...r.findings);
|
|
128
150
|
}
|
|
129
151
|
}
|
|
130
|
-
const allExecuted = [
|
|
152
|
+
const allExecuted = [
|
|
153
|
+
depResult,
|
|
154
|
+
eslintResult,
|
|
155
|
+
semgrepResult,
|
|
156
|
+
adapterResult,
|
|
157
|
+
declarationResult,
|
|
158
|
+
packedSurfaceResult,
|
|
159
|
+
];
|
|
131
160
|
const allPassed = allExecuted.every(categoryIsAcceptable) &&
|
|
132
161
|
categoryIsAcceptable(metaResult) &&
|
|
133
162
|
categoryIsAcceptable(configResult);
|
|
@@ -142,6 +171,8 @@ export async function runValidation(options) {
|
|
|
142
171
|
eslint: categoryOf(eslintResult),
|
|
143
172
|
semgrep: categoryOf(semgrepResult),
|
|
144
173
|
adapterPeers: categoryOf(adapterResult),
|
|
174
|
+
declarations: categoryOf(declarationResult),
|
|
175
|
+
packedSurface: categoryOf(packedSurfaceResult),
|
|
145
176
|
},
|
|
146
177
|
};
|
|
147
178
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comity-dev/validate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Thin orchestrator over Comity shared validation tooling. Development tooling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@comity-dev/semgrep-rules": "0.2.3",
|
|
38
38
|
"@typescript-eslint/parser": "^8.69.0",
|
|
39
39
|
"dependency-cruiser": "^16.10.4",
|
|
40
|
-
"eslint": "^9.39.5"
|
|
40
|
+
"eslint": "^9.39.5",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@types/node": "^24.13.3"
|
|
44
|
-
"typescript": "^5.9.3"
|
|
44
|
+
"@types/node": "^24.13.3"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|