@autotelic/jig-cli 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +169 -2
- package/bin/jig.js +23 -0
- package/dist/baseline.d.ts +8 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +30 -0
- package/dist/baseline.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +342 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +50 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +145 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +32 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +59 -0
- package/dist/config.js.map +1 -0
- package/dist/engines.d.ts +85 -0
- package/dist/engines.d.ts.map +1 -0
- package/dist/engines.js +575 -0
- package/dist/engines.js.map +1 -0
- package/dist/exec.d.ts +16 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +13 -0
- package/dist/exec.js.map +1 -0
- package/dist/gate.d.ts +46 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +82 -0
- package/dist/gate.js.map +1 -0
- package/dist/git.d.ts +5 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +39 -0
- package/dist/git.js.map +1 -0
- package/dist/gitattributes.d.ts +27 -0
- package/dist/gitattributes.d.ts.map +1 -0
- package/dist/gitattributes.js +63 -0
- package/dist/gitattributes.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +163 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +1855 -0
- package/dist/init.js.map +1 -0
- package/dist/menu.d.ts +82 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +388 -0
- package/dist/menu.js.map +1 -0
- package/dist/opencode.d.ts +66 -0
- package/dist/opencode.d.ts.map +1 -0
- package/dist/opencode.js +392 -0
- package/dist/opencode.js.map +1 -0
- package/dist/package-json.d.ts +13 -0
- package/dist/package-json.d.ts.map +1 -0
- package/dist/package-json.js +33 -0
- package/dist/package-json.js.map +1 -0
- package/dist/projections.d.ts +140 -0
- package/dist/projections.d.ts.map +1 -0
- package/dist/projections.js +186 -0
- package/dist/projections.js.map +1 -0
- package/dist/render.d.ts +21 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +131 -0
- package/dist/render.js.map +1 -0
- package/dist/room.d.ts +16 -0
- package/dist/room.d.ts.map +1 -0
- package/dist/room.js +56 -0
- package/dist/room.js.map +1 -0
- package/dist/run.d.ts +10 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +18 -0
- package/dist/run.js.map +1 -0
- package/extensions/jig.ts +465 -0
- package/package.json +78 -3
- package/skills/feedback-loop/SKILL.md +14 -0
- package/skills/intercom-setup/SKILL.md +20 -0
- package/skills/project-run/SKILL.md +18 -0
- package/skills/room/SKILL.md +17 -0
package/dist/engines.js
ADDED
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { countsOf, decodePanel, decodeRepair, isRecord, str as stringOf, } from "@autotelic/protocol";
|
|
5
|
+
import { exec } from "./exec.js";
|
|
6
|
+
/** The args each known engine is invoked with. Overridable only by editing the id map. */
|
|
7
|
+
const DEFAULT_ARGS = {
|
|
8
|
+
joggle: ["check", "--format", "json"],
|
|
9
|
+
};
|
|
10
|
+
/** The engine's default args, then whatever the project configured on top. */
|
|
11
|
+
export const argsFor = (engine) => [
|
|
12
|
+
...(engine.id === "cutlist"
|
|
13
|
+
? ["build", "--check"]
|
|
14
|
+
: engine.kind === "oxlint-plugin"
|
|
15
|
+
? ["--format", "json"]
|
|
16
|
+
: (DEFAULT_ARGS[engine.id] ?? [])),
|
|
17
|
+
// `config` names the engine's own config file, relative to the root. Only the oxlint kind
|
|
18
|
+
// has a flag `jig` can write for it; cutlist and joggle discover theirs by convention, so
|
|
19
|
+
// for them the field is a pointer for a reader and never an argument.
|
|
20
|
+
...(engine.kind === "oxlint-plugin" && engine.config !== undefined
|
|
21
|
+
? ["--config", engine.config]
|
|
22
|
+
: []),
|
|
23
|
+
...(engine.args ?? []),
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* The command `jig` spawns for an engine.
|
|
27
|
+
*
|
|
28
|
+
* `PATH` is ambient: it belongs to whoever invoked `jig`, so a global install can silently
|
|
29
|
+
* shadow the version this project pinned. When the project has its own `node_modules/.bin`
|
|
30
|
+
* copy, that one wins; otherwise the bare command is left for `PATH` to resolve.
|
|
31
|
+
*/
|
|
32
|
+
export const resolveEngineCommand = ({ root, command, }) => {
|
|
33
|
+
const local = join(root, "node_modules", ".bin", command);
|
|
34
|
+
return existsSync(local) ? local : command;
|
|
35
|
+
};
|
|
36
|
+
const recordAt = (value) => isRecord(value) ? value : undefined;
|
|
37
|
+
const numberOr = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
38
|
+
/** oxlint speaks `error | warning | advice`; the protocol speaks `error | warn | info`. */
|
|
39
|
+
const severityOf = (value) => {
|
|
40
|
+
if (value === "error")
|
|
41
|
+
return "error";
|
|
42
|
+
if (value === "info" || value === "notice" || value === "advice")
|
|
43
|
+
return "info";
|
|
44
|
+
return "warn";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* oxlint names a rule `plugin(rule)` in `code` — `eslint(no-unused-vars)`,
|
|
48
|
+
* `plumb-ui(no-raw-html-layout)`. The report keeps `engine` and `ruleId` apart, so a code
|
|
49
|
+
* whose plugin is the engine itself must not repeat it: on engine `plumb`,
|
|
50
|
+
* `plumb(no-raw-html-layout)` is ruleId `no-raw-html-layout`, while
|
|
51
|
+
* `plumb-ui(no-raw-html-layout)` keeps the sub-plugin as a namespace. Without this,
|
|
52
|
+
* `${engine}/${ruleId}` reads `plumb/plumb(no-raw-html-layout)`.
|
|
53
|
+
*
|
|
54
|
+
* A bare code that already carries the engine's own prefix is the same mistake in a
|
|
55
|
+
* different spelling, because a tool that reports whole findings names its rules the way
|
|
56
|
+
* its reports do: `joggle` emits `joggle/import-cycle`, and the report would read
|
|
57
|
+
* `joggle/joggle/import-cycle` — a name no document uses and `explain` cannot find.
|
|
58
|
+
*/
|
|
59
|
+
const RULE_CODE = /^([A-Za-z][\w-]*)\((.+)\)$/u;
|
|
60
|
+
const ruleIdOf = ({ code, engine }) => {
|
|
61
|
+
const match = RULE_CODE.exec(code);
|
|
62
|
+
if (match === null) {
|
|
63
|
+
const prefix = `${engine}/`;
|
|
64
|
+
return code.startsWith(prefix) ? code.slice(prefix.length) : code;
|
|
65
|
+
}
|
|
66
|
+
const plugin = match[1] ?? "";
|
|
67
|
+
const rule = match[2] ?? code;
|
|
68
|
+
return plugin === engine ? rule : `${plugin}/${rule}`;
|
|
69
|
+
};
|
|
70
|
+
/* The severity vocabularies each inbound encoding speaks, mapped to the protocol's three. */
|
|
71
|
+
/** GitHub workflow commands: error | warning | notice. */
|
|
72
|
+
const githubSeverity = (value) => {
|
|
73
|
+
if (value === "error")
|
|
74
|
+
return "error";
|
|
75
|
+
if (value === "notice")
|
|
76
|
+
return "info";
|
|
77
|
+
return "warn";
|
|
78
|
+
};
|
|
79
|
+
/** SARIF: error | warning | note | none. */
|
|
80
|
+
const sarifSeverity = (value) => {
|
|
81
|
+
if (value === "error")
|
|
82
|
+
return "error";
|
|
83
|
+
if (value === "note" || value === "none")
|
|
84
|
+
return "info";
|
|
85
|
+
return "warn";
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Code Climate / GitLab: info | minor | major | critical | blocker. This is the inverse of
|
|
89
|
+
* the outward projection, so `error → major → error` and `warn → minor → warn` round-trip.
|
|
90
|
+
* (`oxlint` chooses `major` for its own warnings; that loss is oxlint's, not the mapping's.)
|
|
91
|
+
*/
|
|
92
|
+
const codeClimateSeverity = (value) => {
|
|
93
|
+
if (value === "info")
|
|
94
|
+
return "info";
|
|
95
|
+
if (value === "minor")
|
|
96
|
+
return "warn";
|
|
97
|
+
return "error";
|
|
98
|
+
};
|
|
99
|
+
/** A path as the report wants it: repository-relative when it sits under the root. */
|
|
100
|
+
const relativeTo = ({ file, root }) => file.startsWith(`${root}/`) ? file.slice(root.length + 1) : file;
|
|
101
|
+
/** oxlint puts the position in the first label's span; a report document puts it inline. */
|
|
102
|
+
const locationOf = (entry, root) => {
|
|
103
|
+
const location = recordAt(entry.location);
|
|
104
|
+
if (location !== undefined) {
|
|
105
|
+
return {
|
|
106
|
+
file: relativeTo({
|
|
107
|
+
file: stringOf(location.file) ?? stringOf(entry.filename) ?? "<unknown>",
|
|
108
|
+
root,
|
|
109
|
+
}),
|
|
110
|
+
line: numberOr(location.line, 1),
|
|
111
|
+
column: numberOr(location.column, 1),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const labels = entry.labels;
|
|
115
|
+
const span = recordAt(recordAt(Array.isArray(labels) ? labels[0] : undefined)?.span);
|
|
116
|
+
return {
|
|
117
|
+
file: relativeTo({
|
|
118
|
+
file: stringOf(entry.filename) ?? stringOf(entry.file) ?? "<unknown>",
|
|
119
|
+
root,
|
|
120
|
+
}),
|
|
121
|
+
line: numberOr(span?.line, 1),
|
|
122
|
+
column: numberOr(span?.column, 1),
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const MOVES = ["contract", "combine", "expand"];
|
|
126
|
+
/** A move outside the closed set is no move: the reader will not invent one. */
|
|
127
|
+
const moveOf = (value) => typeof value === "string" && MOVES.includes(value)
|
|
128
|
+
? value
|
|
129
|
+
: undefined;
|
|
130
|
+
/** Map one engine finding to a protocol diagnostic, or drop it when it is not one. */
|
|
131
|
+
export const normalize = (raw, context) => {
|
|
132
|
+
const { engine, root } = context;
|
|
133
|
+
const entry = recordAt(raw);
|
|
134
|
+
const message = stringOf(entry?.message) ?? stringOf(entry?.text);
|
|
135
|
+
if (entry === undefined || message === undefined)
|
|
136
|
+
return undefined;
|
|
137
|
+
const help = stringOf(entry.help);
|
|
138
|
+
const identity = stringOf(entry.identity);
|
|
139
|
+
const docsUrl = stringOf(entry.url) ?? stringOf(entry.docsUrl);
|
|
140
|
+
const move = moveOf(entry.move);
|
|
141
|
+
const score = numberOr(entry.score, Number.NaN);
|
|
142
|
+
const confidence = numberOr(entry.confidence, Number.NaN);
|
|
143
|
+
// A repair that does not decode degrades to the finding's sentence, never to a dropped
|
|
144
|
+
// finding: the message is the part a reader can act on, and losing it to a bad cascade
|
|
145
|
+
// would turn a real finding into silence.
|
|
146
|
+
const repair = entry.repair === undefined ? undefined : decodeRepair(entry.repair);
|
|
147
|
+
// The panel is explanatory, so an unreadable one is omitted rather than dropping the
|
|
148
|
+
// finding: the message is the part a reader can act on.
|
|
149
|
+
const panel = entry.panel === undefined ? undefined : decodePanel(entry.panel);
|
|
150
|
+
return {
|
|
151
|
+
engine,
|
|
152
|
+
ruleId: ruleIdOf({
|
|
153
|
+
code: stringOf(entry.ruleId) ?? stringOf(entry.code) ?? stringOf(entry.rule) ?? "unknown",
|
|
154
|
+
engine,
|
|
155
|
+
}),
|
|
156
|
+
severity: severityOf(entry.severity),
|
|
157
|
+
message,
|
|
158
|
+
location: locationOf(entry, root),
|
|
159
|
+
...(help === undefined ? {} : { help }),
|
|
160
|
+
...(identity === undefined ? {} : { identity }),
|
|
161
|
+
...(docsUrl === undefined ? {} : { docsUrl }),
|
|
162
|
+
...(typeof entry.judged === "boolean" ? { judged: entry.judged } : {}),
|
|
163
|
+
...(typeof entry.fixable === "boolean" ? { fixable: entry.fixable } : {}),
|
|
164
|
+
...(move === undefined ? {} : { move }),
|
|
165
|
+
...(Number.isFinite(score) ? { score } : {}),
|
|
166
|
+
...(Number.isFinite(confidence) ? { confidence } : {}),
|
|
167
|
+
...(repair === undefined ? {} : { repair }),
|
|
168
|
+
...(panel === undefined ? {} : { panel }),
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
const defined = (value) => value !== undefined;
|
|
172
|
+
const arrayOfRecords = (value) => {
|
|
173
|
+
if (!Array.isArray(value))
|
|
174
|
+
return undefined;
|
|
175
|
+
const out = [];
|
|
176
|
+
for (const element of value) {
|
|
177
|
+
const entry = recordAt(element);
|
|
178
|
+
if (entry === undefined)
|
|
179
|
+
return undefined;
|
|
180
|
+
out.push(entry);
|
|
181
|
+
}
|
|
182
|
+
return out;
|
|
183
|
+
};
|
|
184
|
+
/* SARIF 2.1.0: what `oxlint --format sarif`, and most static-analysis tools, emit. */
|
|
185
|
+
const sarifLocation = (result, root) => {
|
|
186
|
+
const locations = result.locations;
|
|
187
|
+
const physical = recordAt(recordAt(Array.isArray(locations) ? locations[0] : undefined)?.physicalLocation);
|
|
188
|
+
const uri = stringOf(recordAt(physical?.artifactLocation)?.uri);
|
|
189
|
+
if (uri === undefined)
|
|
190
|
+
return undefined;
|
|
191
|
+
const region = recordAt(physical?.region);
|
|
192
|
+
const line = numberOr(region?.startLine, 1);
|
|
193
|
+
const column = numberOr(region?.startColumn, 1);
|
|
194
|
+
const endLine = typeof region?.endLine === "number" ? region.endLine : undefined;
|
|
195
|
+
const endColumn = typeof region?.endColumn === "number" ? region.endColumn : undefined;
|
|
196
|
+
return {
|
|
197
|
+
file: relativeTo({ file: uri.replace(/^file:\/\//u, ""), root }),
|
|
198
|
+
line,
|
|
199
|
+
column,
|
|
200
|
+
...(endLine === undefined ? {} : { endLine }),
|
|
201
|
+
...(endColumn === undefined ? {} : { endColumn }),
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const parseSarif = (doc, context) => {
|
|
205
|
+
const { engine, root } = context;
|
|
206
|
+
const runs = arrayOfRecords(doc.runs);
|
|
207
|
+
if (runs === undefined)
|
|
208
|
+
return undefined;
|
|
209
|
+
const out = [];
|
|
210
|
+
for (const run of runs) {
|
|
211
|
+
const results = arrayOfRecords(run.results);
|
|
212
|
+
if (results === undefined)
|
|
213
|
+
return undefined;
|
|
214
|
+
for (const result of results) {
|
|
215
|
+
const message = stringOf(recordAt(result.message)?.text);
|
|
216
|
+
const ruleId = stringOf(result.ruleId);
|
|
217
|
+
const location = sarifLocation(result, root);
|
|
218
|
+
if (message === undefined || ruleId === undefined || location === undefined)
|
|
219
|
+
return undefined;
|
|
220
|
+
out.push({
|
|
221
|
+
engine,
|
|
222
|
+
ruleId: ruleIdOf({ code: ruleId, engine }),
|
|
223
|
+
severity: sarifSeverity(result.level),
|
|
224
|
+
message,
|
|
225
|
+
location,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return out;
|
|
230
|
+
};
|
|
231
|
+
/* Code Climate / GitLab Code Quality: the JSON array `oxlint --format gitlab` emits. */
|
|
232
|
+
const parseCodeClimate = (doc, context) => {
|
|
233
|
+
const { engine, root } = context;
|
|
234
|
+
const issues = arrayOfRecords(doc);
|
|
235
|
+
if (issues === undefined)
|
|
236
|
+
return undefined;
|
|
237
|
+
const out = [];
|
|
238
|
+
for (const issue of issues) {
|
|
239
|
+
const location = recordAt(issue.location);
|
|
240
|
+
const lines = recordAt(location?.lines);
|
|
241
|
+
const description = stringOf(issue.description);
|
|
242
|
+
const check = stringOf(issue.check_name);
|
|
243
|
+
const path = stringOf(location?.path);
|
|
244
|
+
if (description === undefined || check === undefined || path === undefined)
|
|
245
|
+
return undefined;
|
|
246
|
+
const begin = numberOr(lines?.begin, 1);
|
|
247
|
+
const end = typeof lines?.end === "number" ? lines.end : undefined;
|
|
248
|
+
const identity = stringOf(issue.fingerprint);
|
|
249
|
+
out.push({
|
|
250
|
+
engine,
|
|
251
|
+
ruleId: ruleIdOf({ code: check, engine }),
|
|
252
|
+
severity: codeClimateSeverity(issue.severity),
|
|
253
|
+
message: description,
|
|
254
|
+
...(identity === undefined ? {} : { identity }),
|
|
255
|
+
location: {
|
|
256
|
+
file: relativeTo({ file: path, root }),
|
|
257
|
+
line: begin,
|
|
258
|
+
column: 1,
|
|
259
|
+
...(end === undefined ? {} : { endLine: end }),
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return out;
|
|
264
|
+
};
|
|
265
|
+
/* GitHub Actions workflow commands: what `oxlint --format github` emits. */
|
|
266
|
+
const GITHUB_ANNOTATION = /^::(?<level>error|warning|notice)\s+(?<props>.+?)::(?<message>.*)$/u;
|
|
267
|
+
/** oxlint repeats the position at the head of the message; the location field already has it. */
|
|
268
|
+
const stripGithubPrefix = ({ message, file, line, column, }) => {
|
|
269
|
+
const prefix = `${file}:${line}:${column}: `;
|
|
270
|
+
return message.startsWith(prefix) ? message.slice(prefix.length) : message;
|
|
271
|
+
};
|
|
272
|
+
const parseGithub = (text, context) => {
|
|
273
|
+
const { engine, root } = context;
|
|
274
|
+
const lines = text
|
|
275
|
+
.split("\n")
|
|
276
|
+
.map((line) => line.trim())
|
|
277
|
+
.filter((line) => line.startsWith("::"));
|
|
278
|
+
if (lines.length === 0)
|
|
279
|
+
return undefined;
|
|
280
|
+
const out = [];
|
|
281
|
+
for (const line of lines) {
|
|
282
|
+
const match = GITHUB_ANNOTATION.exec(line);
|
|
283
|
+
if (match === null)
|
|
284
|
+
return undefined;
|
|
285
|
+
const properties = new Map();
|
|
286
|
+
for (const pair of (match.groups?.props ?? "").split(",")) {
|
|
287
|
+
const equals = pair.indexOf("=");
|
|
288
|
+
if (equals > 0)
|
|
289
|
+
properties.set(pair.slice(0, equals).trim(), pair.slice(equals + 1).trim());
|
|
290
|
+
}
|
|
291
|
+
const file = properties.get("file");
|
|
292
|
+
if (file === undefined)
|
|
293
|
+
return undefined;
|
|
294
|
+
const lineNumber = numberOr(Number(properties.get("line")), 1);
|
|
295
|
+
const column = numberOr(Number(properties.get("col")), 1);
|
|
296
|
+
const endLine = properties.has("endLine")
|
|
297
|
+
? numberOr(Number(properties.get("endLine")), lineNumber)
|
|
298
|
+
: undefined;
|
|
299
|
+
const endColumn = properties.has("endColumn")
|
|
300
|
+
? numberOr(Number(properties.get("endColumn")), column)
|
|
301
|
+
: undefined;
|
|
302
|
+
out.push({
|
|
303
|
+
engine,
|
|
304
|
+
ruleId: ruleIdOf({ code: properties.get("title") ?? "unknown", engine }),
|
|
305
|
+
severity: githubSeverity(match.groups?.level),
|
|
306
|
+
message: stripGithubPrefix({
|
|
307
|
+
message: match.groups?.message ?? "",
|
|
308
|
+
file,
|
|
309
|
+
line: lineNumber,
|
|
310
|
+
column,
|
|
311
|
+
}),
|
|
312
|
+
location: {
|
|
313
|
+
file: relativeTo({ file, root }),
|
|
314
|
+
line: lineNumber,
|
|
315
|
+
column,
|
|
316
|
+
...(endLine === undefined ? {} : { endLine }),
|
|
317
|
+
...(endColumn === undefined ? {} : { endColumn }),
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return out;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Read an engine's stdout as diagnostics.
|
|
325
|
+
*
|
|
326
|
+
* jig asks oxlint for `--format json`, but it may be handed an engine it did not
|
|
327
|
+
* configure, so it accepts the structured encodings that carry the same information:
|
|
328
|
+
*
|
|
329
|
+
* - a whole-document JSON report (`{ diagnostics: [...] }`, oxlint and
|
|
330
|
+
* `joggle check --format json`);
|
|
331
|
+
* - SARIF 2.1.0 (`runs[].results`), the OASIS interchange;
|
|
332
|
+
* - a Code Climate / GitLab array, which is also what we project out;
|
|
333
|
+
* - GitHub Actions annotations (`::warning file=…::…`);
|
|
334
|
+
* - JSONL, one finding per line, what a runner streams.
|
|
335
|
+
*
|
|
336
|
+
* XML (checkstyle, junit) and human text are NOT read: inventing a parser for them would
|
|
337
|
+
* be guessing. `undefined` means "jig could not read this", so the caller says so out loud
|
|
338
|
+
* rather than reporting a clean run.
|
|
339
|
+
*/
|
|
340
|
+
export const parseEngineOutput = (stdout, context) => {
|
|
341
|
+
const trimmed = stdout.trim();
|
|
342
|
+
if (trimmed === "")
|
|
343
|
+
return [];
|
|
344
|
+
if (trimmed.startsWith("::"))
|
|
345
|
+
return parseGithub(trimmed, context);
|
|
346
|
+
if (trimmed.startsWith("[")) {
|
|
347
|
+
try {
|
|
348
|
+
const codeClimate = parseCodeClimate(JSON.parse(trimmed), context);
|
|
349
|
+
if (codeClimate !== undefined)
|
|
350
|
+
return codeClimate;
|
|
351
|
+
}
|
|
352
|
+
catch {
|
|
353
|
+
// Not a JSON array; a JSONL stream also contains `[` only inside lines, so fall through.
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (trimmed.startsWith("{")) {
|
|
357
|
+
try {
|
|
358
|
+
const entry = recordAt(JSON.parse(trimmed));
|
|
359
|
+
if (Array.isArray(entry?.diagnostics)) {
|
|
360
|
+
return entry.diagnostics.map((raw) => normalize(raw, context)).filter(defined);
|
|
361
|
+
}
|
|
362
|
+
if (entry !== undefined && Array.isArray(entry.runs)) {
|
|
363
|
+
const sarif = parseSarif(entry, context);
|
|
364
|
+
if (sarif !== undefined)
|
|
365
|
+
return sarif;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
// Not a whole document; a JSONL stream also starts with `{`, so fall through.
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const lines = trimmed
|
|
373
|
+
.split("\n")
|
|
374
|
+
.map((line) => line.trim())
|
|
375
|
+
.filter((line) => line.length > 0);
|
|
376
|
+
if (lines.length > 0 && lines.every((line) => line.startsWith("{"))) {
|
|
377
|
+
const parsed = [];
|
|
378
|
+
for (const line of lines) {
|
|
379
|
+
try {
|
|
380
|
+
parsed.push(normalize(JSON.parse(line), context));
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
return undefined;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return parsed.filter(defined);
|
|
387
|
+
}
|
|
388
|
+
return undefined;
|
|
389
|
+
};
|
|
390
|
+
/** `cutlist build --check` speaks exit codes, not diagnostics: a non-zero exit is one. */
|
|
391
|
+
const cutlistDiagnostics = ({ code, stdout, stderr }) => {
|
|
392
|
+
if (code === 0)
|
|
393
|
+
return [];
|
|
394
|
+
const detail = (stdout.trim() === "" ? stderr : stdout).trim().split("\n")[0] ?? "";
|
|
395
|
+
return [
|
|
396
|
+
{
|
|
397
|
+
engine: "cutlist",
|
|
398
|
+
ruleId: "stale-catalog",
|
|
399
|
+
severity: "error",
|
|
400
|
+
message: detail === "" ? "the committed catalog is stale" : detail,
|
|
401
|
+
help: "Run `cutlist build` and commit the result.",
|
|
402
|
+
location: { file: "cutlist.config.json", line: 1, column: 1 },
|
|
403
|
+
},
|
|
404
|
+
];
|
|
405
|
+
};
|
|
406
|
+
/** An engine whose output jig cannot read, said out loud rather than passed over. */
|
|
407
|
+
const unparsed = ({ id, code, stdout, stderr, }) => {
|
|
408
|
+
const output = (stderr.trim() === "" ? stdout : stderr).trim();
|
|
409
|
+
// A silent, successful exit is a real "no findings". A silent FAILURE is not: the engine
|
|
410
|
+
// said something (on stderr) or said nothing and died, and either way nothing was looked at.
|
|
411
|
+
if (output === "" && code === 0)
|
|
412
|
+
return [];
|
|
413
|
+
return [
|
|
414
|
+
{
|
|
415
|
+
engine: id,
|
|
416
|
+
ruleId: "unparsed-output",
|
|
417
|
+
severity: "info",
|
|
418
|
+
message: output === ""
|
|
419
|
+
? `${id} exited ${code} without output`
|
|
420
|
+
: `jig could not parse ${id} output (exit ${code})`,
|
|
421
|
+
...(output === "" ? {} : { help: output.slice(0, 400) }),
|
|
422
|
+
location: { file: `${id}.config`, line: 1, column: 1 },
|
|
423
|
+
},
|
|
424
|
+
];
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* What one engine's run amounts to.
|
|
428
|
+
*
|
|
429
|
+
* The load-bearing case is the one that used to slip through: a process that exits non-zero
|
|
430
|
+
* having printed nothing jig can read is NOT "no findings". `parseEngineOutput("")` answers
|
|
431
|
+
* `[]`, and `[]` is indistinguishable from a clean run, so an engine that died before
|
|
432
|
+
* printing — or printed only to stderr — was reported as looked-at-and-clean. The exit code
|
|
433
|
+
* is the only thing that tells the two apart, so it is consulted here and not only inside
|
|
434
|
+
* `unparsed`. Findings an engine did print still win: a linter exits non-zero *because* it
|
|
435
|
+
* found something.
|
|
436
|
+
*/
|
|
437
|
+
export const engineDiagnostics = ({ id, output, root, }) => {
|
|
438
|
+
const { code, stdout, stderr } = output;
|
|
439
|
+
if (id === "cutlist")
|
|
440
|
+
return cutlistDiagnostics(output);
|
|
441
|
+
const parsed = parseEngineOutput(stdout, { engine: id, root });
|
|
442
|
+
if (parsed !== undefined && (parsed.length > 0 || code === 0))
|
|
443
|
+
return parsed;
|
|
444
|
+
return unparsed({ id, code, stdout, stderr });
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* The stages that mean no judgement happened, as opposed to a judgement that said no.
|
|
448
|
+
*
|
|
449
|
+
* `declined` is the model looking and finding nothing; `gated` is a judgement below the
|
|
450
|
+
* threshold. Both are answers. `unreadable`/`no_evidence`/`budget` are candidates nobody
|
|
451
|
+
* judged, and folding them into "0 findings" is the lie the invariant forbids.
|
|
452
|
+
*/
|
|
453
|
+
const UNJUDGED_STAGES = new Set(["unreadable", "no_evidence", "budget"]);
|
|
454
|
+
/**
|
|
455
|
+
* Read an engine's own summary, when its encoding has one.
|
|
456
|
+
*
|
|
457
|
+
* joggle's document carries `summary.drops` — every candidate it considered and did not
|
|
458
|
+
* report, by stage — plus a `replayed` flag and the rules it skipped. This is the material
|
|
459
|
+
* that must reach the report: without it, a replayed engine that judged nothing prints
|
|
460
|
+
* exactly like a fresh engine that found nothing.
|
|
461
|
+
*/
|
|
462
|
+
export const engineProvenance = (stdout) => {
|
|
463
|
+
const trimmed = stdout.trim();
|
|
464
|
+
if (!trimmed.startsWith("{"))
|
|
465
|
+
return { status: "ran" };
|
|
466
|
+
let doc;
|
|
467
|
+
try {
|
|
468
|
+
doc = recordAt(JSON.parse(trimmed));
|
|
469
|
+
}
|
|
470
|
+
catch {
|
|
471
|
+
return { status: "ran" };
|
|
472
|
+
}
|
|
473
|
+
const summary = recordAt(doc?.summary);
|
|
474
|
+
if (summary === undefined)
|
|
475
|
+
return { status: "ran" };
|
|
476
|
+
const byStage = new Map();
|
|
477
|
+
if (Array.isArray(summary.drops)) {
|
|
478
|
+
for (const raw of summary.drops) {
|
|
479
|
+
const stage = stringOf(recordAt(raw)?.stage);
|
|
480
|
+
if (stage === undefined)
|
|
481
|
+
continue;
|
|
482
|
+
byStage.set(stage, (byStage.get(stage) ?? 0) + 1);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const drops = [...byStage.entries()]
|
|
486
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
487
|
+
.map(([stage, count]) => ({ stage, count }));
|
|
488
|
+
const unjudged = drops
|
|
489
|
+
.filter((drop) => UNJUDGED_STAGES.has(drop.stage))
|
|
490
|
+
.reduce((total, drop) => total + drop.count, 0);
|
|
491
|
+
const skipped = Array.isArray(summary.skipped) ? summary.skipped.length : 0;
|
|
492
|
+
// joggle reports a coverage gap as a note, not a finding: a tsconfig can declare
|
|
493
|
+
// content mappers for formats its parser cannot index. The note is the engine's
|
|
494
|
+
// census, so it travels with the engine rather than being re-derived here.
|
|
495
|
+
const coverage = (Array.isArray(summary.notes) ? summary.notes : [])
|
|
496
|
+
.map((raw) => stringOf(recordAt(raw)?.reason))
|
|
497
|
+
.find((reason) => reason !== undefined && reason.includes("content mappers"));
|
|
498
|
+
const annotations = [
|
|
499
|
+
...(skipped === 0 ? [] : [`${skipped} rule${skipped === 1 ? "" : "s"} skipped`]),
|
|
500
|
+
...(coverage === undefined ? [] : [coverage]),
|
|
501
|
+
];
|
|
502
|
+
const note = annotations.length === 0 ? undefined : annotations.join("; ");
|
|
503
|
+
return {
|
|
504
|
+
status: summary.replayed === true ? "replayed" : "ran",
|
|
505
|
+
...(unjudged === 0 ? {} : { unjudged }),
|
|
506
|
+
...(drops.length === 0 ? {} : { drops }),
|
|
507
|
+
...(note === undefined ? {} : { note }),
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
const summarize = (id, diagnostics, durationMs, extra = {}) => {
|
|
511
|
+
const counts = countsOf(diagnostics);
|
|
512
|
+
const provenance = extra.provenance;
|
|
513
|
+
// An engine whose output jig could not read is `errored`, not `ran`: it exited, but
|
|
514
|
+
// nothing was looked at, and the status has to agree with the unparsed-output finding.
|
|
515
|
+
const status = provenance?.status ??
|
|
516
|
+
(diagnostics.some((diagnostic) => diagnostic.ruleId === `${id}/unparsed-output`)
|
|
517
|
+
? "errored"
|
|
518
|
+
: "ran");
|
|
519
|
+
const note = extra.note ?? provenance?.note;
|
|
520
|
+
return {
|
|
521
|
+
id,
|
|
522
|
+
diagnostics: diagnostics.length,
|
|
523
|
+
error: counts.error,
|
|
524
|
+
warn: counts.warn,
|
|
525
|
+
info: counts.info,
|
|
526
|
+
durationMs,
|
|
527
|
+
status,
|
|
528
|
+
...(note === undefined ? {} : { note }),
|
|
529
|
+
...(provenance?.unjudged === undefined ? {} : { unjudged: provenance.unjudged }),
|
|
530
|
+
...(provenance?.drops === undefined ? {} : { drops: provenance.drops }),
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
/** Run one engine and reduce its output to diagnostics. It never fails the run. */
|
|
534
|
+
export const runEngine = (root, engine) => Effect.gen(function* () {
|
|
535
|
+
const started = Date.now();
|
|
536
|
+
const id = engine.id;
|
|
537
|
+
if (engine.kind === "internal") {
|
|
538
|
+
return {
|
|
539
|
+
id,
|
|
540
|
+
summary: summarize(id, [], Date.now() - started, {
|
|
541
|
+
note: "internal engines are host-owned, not process-run",
|
|
542
|
+
provenance: { status: "skipped" },
|
|
543
|
+
}),
|
|
544
|
+
diagnostics: [],
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
const binary = engine.command ?? id;
|
|
548
|
+
const command = resolveEngineCommand({ root, command: binary });
|
|
549
|
+
const outcome = yield* Effect.match(exec({ binary: command, args: argsFor(engine), cwd: root }), {
|
|
550
|
+
onFailure: (message) => ({ ok: false, message }),
|
|
551
|
+
onSuccess: (value) => ({ ok: true, value }),
|
|
552
|
+
});
|
|
553
|
+
if (!outcome.ok) {
|
|
554
|
+
return {
|
|
555
|
+
id,
|
|
556
|
+
summary: summarize(id, [], Date.now() - started, {
|
|
557
|
+
note: `${binary} could not run: ${outcome.message}`,
|
|
558
|
+
provenance: { status: "errored" },
|
|
559
|
+
}),
|
|
560
|
+
diagnostics: [],
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const { stdout, stderr, code } = outcome.value;
|
|
564
|
+
const diagnostics = engineDiagnostics({ id, output: { code, stdout, stderr }, root });
|
|
565
|
+
return {
|
|
566
|
+
id,
|
|
567
|
+
summary: summarize(id, diagnostics, Date.now() - started, {
|
|
568
|
+
provenance: engineProvenance(stdout),
|
|
569
|
+
}),
|
|
570
|
+
diagnostics,
|
|
571
|
+
};
|
|
572
|
+
});
|
|
573
|
+
/** Every enabled engine, run concurrently. */
|
|
574
|
+
export const runEngines = (root, engines) => Effect.forEach(engines.filter((engine) => engine.enabled !== false), (engine) => runEngine(root, engine), { concurrency: "unbounded" });
|
|
575
|
+
//# sourceMappingURL=engines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engines.js","sourceRoot":"","sources":["../src/engines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,QAAQ,GAShB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAkC,MAAM,WAAW,CAAA;AA2BhE,0FAA0F;AAC1F,MAAM,YAAY,GAAoD;IACpE,MAAM,EAAE,CAAC,OAAO,EAAE,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M,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,EACnC,EAAE,WAAW,EAAE,WAAW,EAAE,CAC7B,CAAA"}
|
package/dist/exec.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { ChildProcessSpawner } from "effect/process";
|
|
3
|
+
/** The spawner service, under the name `effect/process` exports it as. */
|
|
4
|
+
export type Spawner = ChildProcessSpawner.ChildProcessSpawner;
|
|
5
|
+
export interface ExecOutcome {
|
|
6
|
+
readonly stdout: string;
|
|
7
|
+
readonly stderr: string;
|
|
8
|
+
readonly code: number;
|
|
9
|
+
}
|
|
10
|
+
/** Run a binary and collect its streams and exit code. The error channel is a message. */
|
|
11
|
+
export declare const exec: ({ binary, args, cwd, }: {
|
|
12
|
+
readonly binary: string;
|
|
13
|
+
readonly args: ReadonlyArray<string>;
|
|
14
|
+
readonly cwd: string;
|
|
15
|
+
}) => Effect.Effect<ExecOutcome, string, Spawner>;
|
|
16
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,0EAA0E;AAC1E,MAAM,MAAM,OAAO,GAAG,mBAAmB,CAAC,mBAAmB,CAAA;AAY7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,0FAA0F;AAC1F,eAAO,MAAM,IAAI,2BAId;IACD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB,KAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAcgD,CAAA"}
|
package/dist/exec.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effect, Stream } from "effect";
|
|
2
|
+
import { ChildProcess } from "effect/process";
|
|
3
|
+
/** Run a binary and collect its streams and exit code. The error channel is a message. */
|
|
4
|
+
export const exec = ({ binary, args, cwd, }) => Effect.scoped(Effect.gen(function* () {
|
|
5
|
+
const handle = yield* ChildProcess.make(binary, [...args], { cwd });
|
|
6
|
+
const [stdout, stderr, exitCode] = yield* Effect.all([
|
|
7
|
+
handle.stdout.pipe(Stream.decodeText(), Stream.mkString),
|
|
8
|
+
handle.stderr.pipe(Stream.decodeText(), Stream.mkString),
|
|
9
|
+
handle.exitCode,
|
|
10
|
+
], { concurrency: "unbounded" });
|
|
11
|
+
return { stdout, stderr, code: Number(exitCode) };
|
|
12
|
+
})).pipe(Effect.mapError((cause) => (cause instanceof Error ? cause.message : String(cause))));
|
|
13
|
+
//# sourceMappingURL=exec.js.map
|
package/dist/exec.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAsB7C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,MAAM,EACN,IAAI,EACJ,GAAG,GAKJ,EAA+C,EAAE,CAChD,MAAM,CAAC,MAAM,CACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,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