@robhowley/pi-structured-return 1.8.0 → 1.10.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.
Files changed (97) hide show
  1. package/README.md +84 -73
  2. package/extensions/structured-return/config/project-config.ts +10 -0
  3. package/extensions/structured-return/config/registry.ts +306 -0
  4. package/extensions/structured-return/examples/.pi/machine-readable.json +18 -0
  5. package/extensions/structured-return/examples/.pi/parsers/foo-cli.ts +25 -0
  6. package/extensions/structured-return/{src/index.ts → index.ts} +94 -69
  7. package/extensions/structured-return/{src/parsers → parsers}/ava-text.ts +23 -15
  8. package/extensions/structured-return/{src/parsers → parsers}/bandit-json.ts +17 -15
  9. package/extensions/structured-return/{src/parsers → parsers}/black-text.ts +18 -18
  10. package/extensions/structured-return/{src/parsers → parsers}/cargo-build.ts +19 -14
  11. package/extensions/structured-return/{src/parsers → parsers}/cargo-test.ts +20 -19
  12. package/extensions/structured-return/parsers/checkstyle-xml.ts +183 -0
  13. package/extensions/structured-return/{src/parsers → parsers}/clang-text.ts +15 -13
  14. package/extensions/structured-return/{src/parsers → parsers}/dbt-json.ts +28 -23
  15. package/extensions/structured-return/{src/parsers → parsers}/dotnet-build-text.ts +10 -8
  16. package/extensions/structured-return/{src/parsers → parsers}/eslint-json.ts +15 -9
  17. package/extensions/structured-return/{src/parsers → parsers}/go-test-json.ts +23 -21
  18. package/extensions/structured-return/{src/parsers → parsers}/hadolint-json.ts +18 -12
  19. package/extensions/structured-return/{src/parsers → parsers}/htmlhint-json.ts +15 -13
  20. package/extensions/structured-return/{src/parsers → parsers}/isort-text.ts +18 -18
  21. package/extensions/structured-return/{src/parsers → parsers}/javac-text.ts +14 -12
  22. package/extensions/structured-return/{src/parsers → parsers}/jsonlint-text.ts +16 -14
  23. package/extensions/structured-return/{src/parsers → parsers}/junit-xml.ts +149 -50
  24. package/extensions/structured-return/{src/parsers → parsers}/markdownlint-json.ts +19 -17
  25. package/extensions/structured-return/{src/parsers → parsers}/minitest-text.ts +24 -15
  26. package/extensions/structured-return/{src/parsers → parsers}/mocha-json.ts +17 -10
  27. package/extensions/structured-return/{src/parsers → parsers}/mypy-json.ts +16 -16
  28. package/extensions/structured-return/{src/parsers → parsers}/node-test-text.ts +17 -14
  29. package/extensions/structured-return/{src/parsers → parsers}/npm-audit-json.ts +19 -16
  30. package/extensions/structured-return/{src/parsers → parsers}/prettier-text.ts +21 -17
  31. package/extensions/structured-return/{src/parsers → parsers}/pylint-json.ts +17 -17
  32. package/extensions/structured-return/{src/parsers → parsers}/pyright-json.ts +20 -18
  33. package/extensions/structured-return/{src/parsers → parsers}/rspec-json.ts +14 -14
  34. package/extensions/structured-return/{src/parsers → parsers}/rubocop-json.ts +22 -11
  35. package/extensions/structured-return/{src/parsers → parsers}/ruff-json.ts +7 -7
  36. package/extensions/structured-return/{src/parsers → parsers}/shellcheck-json.ts +14 -14
  37. package/extensions/structured-return/{src/parsers → parsers}/stylelint-json.ts +21 -13
  38. package/extensions/structured-return/{src/parsers → parsers}/swiftc-text.ts +16 -10
  39. package/extensions/structured-return/parsers/tail-fallback.ts +20 -0
  40. package/extensions/structured-return/{src/parsers → parsers}/tidy-text.ts +13 -13
  41. package/extensions/structured-return/{src/parsers → parsers}/tsc-text.ts +11 -11
  42. package/extensions/structured-return/{src/parsers → parsers}/unittest-text.ts +24 -14
  43. package/extensions/structured-return/{src/parsers → parsers}/utils.ts +9 -6
  44. package/extensions/structured-return/{src/parsers → parsers}/vale-json.ts +18 -18
  45. package/extensions/structured-return/{src/parsers → parsers}/vitest-json.ts +14 -14
  46. package/extensions/structured-return/{src/storage → storage}/log-store.ts +5 -5
  47. package/extensions/structured-return/{src/storage → storage}/session-stats.ts +11 -11
  48. package/extensions/structured-return/{src/types.ts → types.ts} +4 -2
  49. package/package.json +27 -43
  50. package/skills/structured-return/SKILL.md +62 -1
  51. package/LICENSE +0 -21
  52. package/extensions/structured-return/src/config/project-config.ts +0 -10
  53. package/extensions/structured-return/src/config/registry.test.ts +0 -171
  54. package/extensions/structured-return/src/config/registry.ts +0 -282
  55. package/extensions/structured-return/src/index.test.ts +0 -220
  56. package/extensions/structured-return/src/parsers/ava-text.test.ts +0 -116
  57. package/extensions/structured-return/src/parsers/bandit-json.test.ts +0 -90
  58. package/extensions/structured-return/src/parsers/black-text.test.ts +0 -67
  59. package/extensions/structured-return/src/parsers/cargo-build.test.ts +0 -170
  60. package/extensions/structured-return/src/parsers/cargo-test.test.ts +0 -191
  61. package/extensions/structured-return/src/parsers/clang-text.test.ts +0 -61
  62. package/extensions/structured-return/src/parsers/dbt-json.test.ts +0 -172
  63. package/extensions/structured-return/src/parsers/dotnet-build-text.test.ts +0 -85
  64. package/extensions/structured-return/src/parsers/eslint-json.test.ts +0 -60
  65. package/extensions/structured-return/src/parsers/go-test-json.test.ts +0 -119
  66. package/extensions/structured-return/src/parsers/hadolint-json.test.ts +0 -73
  67. package/extensions/structured-return/src/parsers/htmlhint-json.test.ts +0 -72
  68. package/extensions/structured-return/src/parsers/isort-text.test.ts +0 -58
  69. package/extensions/structured-return/src/parsers/javac-text.test.ts +0 -75
  70. package/extensions/structured-return/src/parsers/jsonlint-text.test.ts +0 -52
  71. package/extensions/structured-return/src/parsers/junit-xml.test.ts +0 -410
  72. package/extensions/structured-return/src/parsers/markdownlint-json.test.ts +0 -76
  73. package/extensions/structured-return/src/parsers/minitest-text.test.ts +0 -110
  74. package/extensions/structured-return/src/parsers/mocha-json.test.ts +0 -108
  75. package/extensions/structured-return/src/parsers/mypy-json.test.ts +0 -101
  76. package/extensions/structured-return/src/parsers/node-test-text.test.ts +0 -117
  77. package/extensions/structured-return/src/parsers/npm-audit-json.test.ts +0 -83
  78. package/extensions/structured-return/src/parsers/prettier-text.test.ts +0 -76
  79. package/extensions/structured-return/src/parsers/pylint-json.test.ts +0 -120
  80. package/extensions/structured-return/src/parsers/pyright-json.test.ts +0 -112
  81. package/extensions/structured-return/src/parsers/rspec-json.test.ts +0 -126
  82. package/extensions/structured-return/src/parsers/rubocop-json.test.ts +0 -118
  83. package/extensions/structured-return/src/parsers/ruff-json.test.ts +0 -57
  84. package/extensions/structured-return/src/parsers/shellcheck-json.test.ts +0 -110
  85. package/extensions/structured-return/src/parsers/stylelint-json.test.ts +0 -120
  86. package/extensions/structured-return/src/parsers/swiftc-text.test.ts +0 -73
  87. package/extensions/structured-return/src/parsers/tail-fallback.test.ts +0 -41
  88. package/extensions/structured-return/src/parsers/tail-fallback.ts +0 -20
  89. package/extensions/structured-return/src/parsers/tidy-text.test.ts +0 -74
  90. package/extensions/structured-return/src/parsers/tsc-text.test.ts +0 -81
  91. package/extensions/structured-return/src/parsers/unittest-text.test.ts +0 -126
  92. package/extensions/structured-return/src/parsers/vale-json.test.ts +0 -84
  93. package/extensions/structured-return/src/parsers/vitest-json.test.ts +0 -118
  94. package/extensions/structured-return/src/storage/session-stats.test.ts +0 -156
  95. package/extensions/structured-return/tsconfig.json +0 -11
  96. package/extensions/structured-return/vitest.config.ts +0 -9
  97. /package/extensions/structured-return/{src/ui → ui}/widget.ts +0 -0
@@ -1,6 +1,6 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  interface MarkdownlintItem {
6
6
  fileName: string;
@@ -11,14 +11,14 @@ interface MarkdownlintItem {
11
11
  }
12
12
 
13
13
  const parser: ParserModule = {
14
- id: "markdownlint-json",
14
+ id: 'markdownlint-json',
15
15
  async parse(ctx) {
16
16
  const stdout = safeReadFile(ctx.stdoutPath).trim();
17
17
  if (!stdout) {
18
18
  return {
19
- tool: "markdownlint",
20
- status: "pass",
21
- summary: "no lint errors",
19
+ tool: 'markdownlint',
20
+ status: 'pass',
21
+ summary: 'no lint errors',
22
22
  failures: [],
23
23
  logPath: ctx.logPath,
24
24
  };
@@ -29,18 +29,18 @@ const parser: ParserModule = {
29
29
  items = JSON.parse(stdout);
30
30
  } catch {
31
31
  return {
32
- tool: "markdownlint",
33
- status: "error",
34
- summary: "failed to parse markdownlint JSON output",
32
+ tool: 'markdownlint',
33
+ status: 'error',
34
+ summary: 'failed to parse markdownlint JSON output',
35
35
  logPath: ctx.logPath,
36
36
  };
37
37
  }
38
38
 
39
39
  if (!Array.isArray(items) || items.length === 0) {
40
40
  return {
41
- tool: "markdownlint",
42
- status: "pass",
43
- summary: "no lint errors",
41
+ tool: 'markdownlint',
42
+ status: 'pass',
43
+ summary: 'no lint errors',
44
44
  failures: [],
45
45
  logPath: ctx.logPath,
46
46
  };
@@ -50,7 +50,9 @@ const parser: ParserModule = {
50
50
  const relPath = path.relative(ctx.cwd, item.fileName);
51
51
  // Use the short MD code (first rule name, e.g. "MD041")
52
52
  const rule = item.ruleNames[0];
53
- const message = item.errorDetail ? `${item.ruleDescription}: ${item.errorDetail}` : item.ruleDescription;
53
+ const message = item.errorDetail
54
+ ? `${item.ruleDescription}: ${item.errorDetail}`
55
+ : item.ruleDescription;
54
56
  return {
55
57
  id: `${relPath}:${item.lineNumber}:${rule}`,
56
58
  file: relPath,
@@ -61,9 +63,9 @@ const parser: ParserModule = {
61
63
  });
62
64
 
63
65
  return {
64
- tool: "markdownlint",
65
- status: "fail",
66
- summary: `${failures.length} lint error${failures.length !== 1 ? "s" : ""}`,
66
+ tool: 'markdownlint',
67
+ status: 'fail',
68
+ summary: `${failures.length} lint error${failures.length !== 1 ? 's' : ''}`,
67
69
  failures,
68
70
  logPath: ctx.logPath,
69
71
  };
@@ -1,20 +1,27 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  /**
6
6
  * Parses minitest's default text output. No flags or reporters required —
7
7
  * works with plain `ruby test/my_test.rb` or `bundle exec ruby test/my_test.rb`.
8
8
  */
9
9
  const parser: ParserModule = {
10
- id: "minitest-text",
10
+ id: 'minitest-text',
11
11
  async parse(ctx) {
12
12
  const output = safeReadFile(ctx.stdoutPath);
13
13
 
14
14
  // "3 runs, 2 assertions, 1 failures, 1 errors, 0 skips"
15
- const summaryMatch = output.match(/(\d+) runs?, \d+ assertions?, (\d+) failures?, (\d+) errors?, (\d+) skips?/);
15
+ const summaryMatch = output.match(
16
+ /(\d+) runs?, \d+ assertions?, (\d+) failures?, (\d+) errors?, (\d+) skips?/,
17
+ );
16
18
  if (!summaryMatch) {
17
- return { tool: "minitest", status: "error", summary: "no minitest output found", logPath: ctx.logPath };
19
+ return {
20
+ tool: 'minitest',
21
+ status: 'error',
22
+ summary: 'no minitest output found',
23
+ logPath: ctx.logPath,
24
+ };
18
25
  }
19
26
 
20
27
  const totalRuns = parseInt(summaryMatch[1], 10);
@@ -27,8 +34,8 @@ const parser: ParserModule = {
27
34
  const failures = parseBlocks(output, ctx.cwd);
28
35
 
29
36
  return {
30
- tool: "minitest",
31
- status: totalFailed > 0 ? "fail" : "pass",
37
+ tool: 'minitest',
38
+ status: totalFailed > 0 ? 'fail' : 'pass',
32
39
  summary: totalFailed > 0 ? `${totalFailed} failed, ${passed} passed` : `${passed} passed`,
33
40
  failures,
34
41
  logPath: ctx.logPath,
@@ -40,7 +47,7 @@ export default parser;
40
47
 
41
48
  function parseBlocks(output: string, cwd: string): ParsedFailure[] {
42
49
  const failures: ParsedFailure[] = [];
43
- const lines = output.split("\n");
50
+ const lines = output.split('\n');
44
51
  let i = 0;
45
52
 
46
53
  while (i < lines.length) {
@@ -53,7 +60,7 @@ function parseBlocks(output: string, cwd: string): ParsedFailure[] {
53
60
  const type = headerMatch[1];
54
61
  i++;
55
62
 
56
- if (type === "Failure") {
63
+ if (type === 'Failure') {
57
64
  // "ClassName#method [file:line]:"
58
65
  const nameMatch = lines[i]?.match(/^(.+?)\s+\[(.+):(\d+)\]:$/);
59
66
  if (nameMatch) {
@@ -61,7 +68,7 @@ function parseBlocks(output: string, cwd: string): ParsedFailure[] {
61
68
  i++;
62
69
  // Message lines until blank line
63
70
  const msgLines: string[] = [];
64
- while (i < lines.length && lines[i].trim() !== "") {
71
+ while (i < lines.length && lines[i].trim() !== '') {
65
72
  msgLines.push(lines[i].trim());
66
73
  i++;
67
74
  }
@@ -69,7 +76,7 @@ function parseBlocks(output: string, cwd: string): ParsedFailure[] {
69
76
  id,
70
77
  file: path.relative(cwd, path.resolve(cwd, rawFile)),
71
78
  line: parseInt(lineStr, 10),
72
- message: msgLines.filter(Boolean).join(" / ") || undefined,
79
+ message: msgLines.filter(Boolean).join(' / ') || undefined,
73
80
  });
74
81
  }
75
82
  } else {
@@ -79,15 +86,17 @@ function parseBlocks(output: string, cwd: string): ParsedFailure[] {
79
86
  const id = nameMatch[1];
80
87
  i++;
81
88
  // "ExceptionClass: message"
82
- const exceptionLine = lines[i]?.trim() ?? "";
83
- const colonIdx = exceptionLine.indexOf(": ");
89
+ const exceptionLine = lines[i]?.trim() ?? '';
90
+ const colonIdx = exceptionLine.indexOf(': ');
84
91
  const message = colonIdx !== -1 ? exceptionLine.slice(colonIdx + 2) : exceptionLine;
85
92
  i++;
86
93
  // First backtrace line: " file.rb:line:in 'method'"
87
94
  const backtraceMatch = lines[i]?.match(/^\s+(.+\.rb):(\d+):/);
88
95
  failures.push({
89
96
  id,
90
- file: backtraceMatch ? path.relative(cwd, path.resolve(cwd, backtraceMatch[1])) : undefined,
97
+ file: backtraceMatch
98
+ ? path.relative(cwd, path.resolve(cwd, backtraceMatch[1]))
99
+ : undefined,
91
100
  line: backtraceMatch ? parseInt(backtraceMatch[2], 10) : undefined,
92
101
  message: message || undefined,
93
102
  });
@@ -1,6 +1,6 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { extractJsStackLocation, safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { extractJsStackLocation, safeReadFile } from './utils';
4
4
 
5
5
  interface MochaErr {
6
6
  message?: string;
@@ -30,28 +30,35 @@ function buildMessage(err: MochaErr): string {
30
30
  return `expected ${err.expected}, got ${err.actual}`;
31
31
  }
32
32
  // First line of message, stripped of newlines
33
- const firstLine = (err.message ?? "test failed").split("\n")[0].trim();
33
+ const firstLine = (err.message ?? 'test failed').split('\n')[0].trim();
34
34
  return firstLine;
35
35
  }
36
36
 
37
37
  const parser: ParserModule = {
38
- id: "mocha-json",
38
+ id: 'mocha-json',
39
39
  async parse(ctx) {
40
40
  const stdout = safeReadFile(ctx.stdoutPath).trim();
41
41
  if (!stdout) {
42
- return { tool: "mocha", status: "error", summary: "no output", logPath: ctx.logPath };
42
+ return { tool: 'mocha', status: 'error', summary: 'no output', logPath: ctx.logPath };
43
43
  }
44
44
 
45
45
  let report: MochaReport;
46
46
  try {
47
47
  report = JSON.parse(stdout) as MochaReport;
48
48
  } catch {
49
- return { tool: "mocha", status: "error", summary: "failed to parse mocha JSON output", logPath: ctx.logPath };
49
+ return {
50
+ tool: 'mocha',
51
+ status: 'error',
52
+ summary: 'failed to parse mocha JSON output',
53
+ logPath: ctx.logPath,
54
+ };
50
55
  }
51
56
 
52
57
  const failures: ParsedFailure[] = report.failures.map((test) => {
53
58
  const loc = extractJsStackLocation(test.err.stack);
54
- const relFile = loc.file ? path.relative(ctx.cwd, path.resolve(ctx.cwd, loc.file)) : undefined;
59
+ const relFile = loc.file
60
+ ? path.relative(ctx.cwd, path.resolve(ctx.cwd, loc.file))
61
+ : undefined;
55
62
  return {
56
63
  id: test.fullTitle,
57
64
  file: relFile,
@@ -65,8 +72,8 @@ const parser: ParserModule = {
65
72
  const passed = report.stats.passes;
66
73
 
67
74
  return {
68
- tool: "mocha",
69
- status: failed > 0 ? "fail" : "pass",
75
+ tool: 'mocha',
76
+ status: failed > 0 ? 'fail' : 'pass',
70
77
  summary: failed > 0 ? `${failed} failed, ${passed} passed` : `${passed} passed`,
71
78
  failures,
72
79
  logPath: ctx.logPath,
@@ -1,6 +1,6 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  interface MypyItem {
6
6
  file: string;
@@ -9,26 +9,26 @@ interface MypyItem {
9
9
  message: string;
10
10
  hint: string | null;
11
11
  code: string | null;
12
- severity: "error" | "note";
12
+ severity: 'error' | 'note';
13
13
  }
14
14
 
15
15
  const parser: ParserModule = {
16
- id: "mypy-json",
16
+ id: 'mypy-json',
17
17
  async parse(ctx) {
18
18
  // mypy --output json writes JSON diagnostics to stderr (stdout gets the human summary).
19
19
  const stderr = safeReadFile(ctx.stderrPath).trim();
20
20
  if (!stderr) {
21
21
  return {
22
- tool: "mypy",
23
- status: "pass",
24
- summary: "no type errors",
22
+ tool: 'mypy',
23
+ status: 'pass',
24
+ summary: 'no type errors',
25
25
  failures: [],
26
26
  logPath: ctx.logPath,
27
27
  };
28
28
  }
29
29
 
30
30
  const items: MypyItem[] = [];
31
- for (const line of stderr.split("\n")) {
31
+ for (const line of stderr.split('\n')) {
32
32
  const trimmed = line.trim();
33
33
  if (!trimmed) continue;
34
34
  try {
@@ -38,13 +38,13 @@ const parser: ParserModule = {
38
38
  }
39
39
  }
40
40
 
41
- const errors = items.filter((item) => item.severity === "error");
41
+ const errors = items.filter((item) => item.severity === 'error');
42
42
  // Build a map of notes keyed by normalized relative path:line so lookups
43
43
  // match regardless of whether mypy emits absolute or relative paths.
44
44
  const relPathOf = (f: string) => (path.isAbsolute(f) ? path.relative(ctx.cwd, f) : f);
45
45
  const notesByLocation = new Map<string, string[]>();
46
46
  for (const item of items) {
47
- if (item.severity === "note") {
47
+ if (item.severity === 'note') {
48
48
  const key = `${relPathOf(item.file)}:${item.line}`;
49
49
  const notes = notesByLocation.get(key) ?? [];
50
50
  notes.push(item.message);
@@ -56,10 +56,10 @@ const parser: ParserModule = {
56
56
  const relPath = relPathOf(item.file);
57
57
  const key = `${relPath}:${item.line}`;
58
58
  const notes = notesByLocation.get(key);
59
- const hint = item.hint ?? (notes ? notes.join("; ") : undefined);
59
+ const hint = item.hint ?? (notes ? notes.join('; ') : undefined);
60
60
  const message = hint ? `${item.message} (${hint})` : item.message;
61
61
  return {
62
- id: `${relPath}:${item.line}:${item.code ?? "error"}`,
62
+ id: `${relPath}:${item.line}:${item.code ?? 'error'}`,
63
63
  file: relPath,
64
64
  line: item.line,
65
65
  message,
@@ -68,9 +68,9 @@ const parser: ParserModule = {
68
68
  });
69
69
 
70
70
  return {
71
- tool: "mypy",
72
- status: failures.length > 0 ? "fail" : "pass",
73
- summary: failures.length > 0 ? `${failures.length} type errors` : "no type errors",
71
+ tool: 'mypy',
72
+ status: failures.length > 0 ? 'fail' : 'pass',
73
+ summary: failures.length > 0 ? `${failures.length} type errors` : 'no type errors',
74
74
  failures,
75
75
  logPath: ctx.logPath,
76
76
  };
@@ -1,6 +1,6 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  // Summary lines: ℹ pass 1, ℹ fail 2
6
6
  const SUMMARY_PASS = /^ℹ pass (\d+)/m;
@@ -10,14 +10,14 @@ const SUMMARY_FAIL = /^ℹ fail (\d+)/m;
10
10
  const TEST_AT_LINE = /^test at (.+?):(\d+):\d+/;
11
11
 
12
12
  const parser: ParserModule = {
13
- id: "node-test-text",
13
+ id: 'node-test-text',
14
14
  async parse(ctx) {
15
15
  const combined = safeReadFile(ctx.stdoutPath) + safeReadFile(ctx.stderrPath);
16
16
  if (!combined.trim()) {
17
17
  return {
18
- tool: "node:test",
19
- status: "pass",
20
- summary: "no tests found",
18
+ tool: 'node:test',
19
+ status: 'pass',
20
+ summary: 'no tests found',
21
21
  failures: [],
22
22
  logPath: ctx.logPath,
23
23
  };
@@ -29,7 +29,7 @@ const parser: ParserModule = {
29
29
  const failed = failMatch ? parseInt(failMatch[1], 10) : 0;
30
30
 
31
31
  // Parse the "failing tests:" section
32
- const failingSection = combined.split("✖ failing tests:")[1] ?? "";
32
+ const failingSection = combined.split('✖ failing tests:')[1] ?? '';
33
33
  const failures: ParsedFailure[] = [];
34
34
 
35
35
  if (failingSection) {
@@ -47,12 +47,14 @@ const parser: ParserModule = {
47
47
  line = parseInt(atMatch[2], 10);
48
48
  }
49
49
 
50
- const name = nameMatch ? nameMatch[1] : "unknown test";
50
+ const name = nameMatch ? nameMatch[1] : 'unknown test';
51
51
 
52
52
  // Extract meaningful error message — try specific patterns first, then generic
53
53
  let message = name;
54
54
  const strictMatch = block.match(/Expected values to be strictly equal:\s*\n\s*\n\s*(.+)/);
55
- const falsyMatch = block.match(/The expression evaluated to a falsy value:\s*\n\s*\n\s*(.+)/);
55
+ const falsyMatch = block.match(
56
+ /The expression evaluated to a falsy value:\s*\n\s*\n\s*(.+)/,
57
+ );
56
58
  if (strictMatch) {
57
59
  message = `Expected values to be strictly equal: ${strictMatch[1].trim()}`;
58
60
  } else if (falsyMatch) {
@@ -60,7 +62,8 @@ const parser: ParserModule = {
60
62
  } else {
61
63
  // Match any Error type (AssertionError, TypeError, ReferenceError, etc.)
62
64
  const errorMatch = block.match(/^\s+(\w*Error\b.*?)$/m);
63
- if (errorMatch) message = errorMatch[1].replace(/\s*\[ERR_\w+\]:\s*/, ": ").replace(/^\w+Error: /, "");
65
+ if (errorMatch)
66
+ message = errorMatch[1].replace(/\s*\[ERR_\w+\]:\s*/, ': ').replace(/^\w+Error: /, '');
64
67
  }
65
68
 
66
69
  failures.push({
@@ -75,11 +78,11 @@ const parser: ParserModule = {
75
78
  const parts: string[] = [];
76
79
  if (failed > 0) parts.push(`${failed} failed`);
77
80
  if (passed > 0) parts.push(`${passed} passed`);
78
- const summary = parts.join(", ") || "tests completed";
81
+ const summary = parts.join(', ') || 'tests completed';
79
82
 
80
83
  return {
81
- tool: "node:test",
82
- status: failed > 0 ? "fail" : "pass",
84
+ tool: 'node:test',
85
+ status: failed > 0 ? 'fail' : 'pass',
83
86
  summary,
84
87
  failures,
85
88
  logPath: ctx.logPath,
@@ -1,5 +1,5 @@
1
- import type { ParserModule, ParsedFailure } from "../types";
2
- import { safeReadFile } from "./utils";
1
+ import type { ParserModule, ParsedFailure } from '../types';
2
+ import { safeReadFile } from './utils';
3
3
 
4
4
  interface NpmAuditVia {
5
5
  title?: string;
@@ -24,14 +24,14 @@ interface NpmAuditReport {
24
24
  }
25
25
 
26
26
  const parser: ParserModule = {
27
- id: "npm-audit-json",
27
+ id: 'npm-audit-json',
28
28
  async parse(ctx) {
29
29
  const stdout = safeReadFile(ctx.stdoutPath).trim();
30
30
  if (!stdout) {
31
31
  return {
32
- tool: "npm audit",
33
- status: "pass",
34
- summary: "no vulnerabilities found",
32
+ tool: 'npm audit',
33
+ status: 'pass',
34
+ summary: 'no vulnerabilities found',
35
35
  failures: [],
36
36
  logPath: ctx.logPath,
37
37
  };
@@ -42,9 +42,9 @@ const parser: ParserModule = {
42
42
  report = JSON.parse(stdout);
43
43
  } catch {
44
44
  return {
45
- tool: "npm audit",
46
- status: "error",
47
- summary: "failed to parse npm audit JSON output",
45
+ tool: 'npm audit',
46
+ status: 'error',
47
+ summary: 'failed to parse npm audit JSON output',
48
48
  logPath: ctx.logPath,
49
49
  };
50
50
  }
@@ -54,8 +54,11 @@ const parser: ParserModule = {
54
54
 
55
55
  for (const [pkg, vuln] of Object.entries(vulns)) {
56
56
  // Extract advisory titles from 'via' (skip string refs to other packages)
57
- const titles = vuln.via.filter((v): v is NpmAuditVia => typeof v !== "string" && !!v.title).map((v) => v.title!);
58
- const message = titles.length > 0 ? titles.join("; ") : `${vuln.severity} severity vulnerability`;
57
+ const titles = vuln.via
58
+ .filter((v): v is NpmAuditVia => typeof v !== 'string' && !!v.title)
59
+ .map((v) => v.title!);
60
+ const message =
61
+ titles.length > 0 ? titles.join('; ') : `${vuln.severity} severity vulnerability`;
59
62
  failures.push({
60
63
  id: pkg,
61
64
  file: pkg,
@@ -66,18 +69,18 @@ const parser: ParserModule = {
66
69
 
67
70
  // Build severity summary from metadata
68
71
  const meta = report.metadata?.vulnerabilities ?? {};
69
- const sevParts = ["critical", "high", "moderate", "low", "info"]
72
+ const sevParts = ['critical', 'high', 'moderate', 'low', 'info']
70
73
  .filter((s) => meta[s])
71
74
  .map((s) => `${meta[s]} ${s}`);
72
75
  const total = meta.total ?? failures.length;
73
76
  const summary =
74
77
  total > 0
75
- ? `${total} vulnerabilit${total !== 1 ? "ies" : "y"} (${sevParts.join(", ")})`
76
- : "no vulnerabilities found";
78
+ ? `${total} vulnerabilit${total !== 1 ? 'ies' : 'y'} (${sevParts.join(', ')})`
79
+ : 'no vulnerabilities found';
77
80
 
78
81
  return {
79
- tool: "npm audit",
80
- status: total > 0 ? "fail" : "pass",
82
+ tool: 'npm audit',
83
+ status: total > 0 ? 'fail' : 'pass',
81
84
  summary,
82
85
  failures,
83
86
  logPath: ctx.logPath,
@@ -1,26 +1,26 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  // [warn] /path/to/file — but not summary lines like "[warn] Code style issues..."
6
6
  const WARN_LINE = /^\[warn\] (.+)$/;
7
7
  const SUMMARY_PREFIX = /^Code style issues|^Run Prettier/;
8
8
 
9
9
  const parser: ParserModule = {
10
- id: "prettier-text",
10
+ id: 'prettier-text',
11
11
  async parse(ctx) {
12
- const combined = (safeReadFile(ctx.stdoutPath) + "\n" + safeReadFile(ctx.stderrPath)).trim();
12
+ const combined = (safeReadFile(ctx.stdoutPath) + '\n' + safeReadFile(ctx.stderrPath)).trim();
13
13
  if (!combined) {
14
14
  return {
15
- tool: "prettier",
16
- status: "pass",
17
- summary: "all files formatted",
15
+ tool: 'prettier',
16
+ status: 'pass',
17
+ summary: 'all files formatted',
18
18
  failures: [],
19
19
  logPath: ctx.logPath,
20
20
  };
21
21
  }
22
22
 
23
- const lines = combined.split("\n");
23
+ const lines = combined.split('\n');
24
24
  const failures: ParsedFailure[] = [];
25
25
 
26
26
  for (const line of lines) {
@@ -30,17 +30,17 @@ const parser: ParserModule = {
30
30
  failures.push({
31
31
  id: relPath,
32
32
  file: relPath,
33
- message: "needs formatting",
33
+ message: 'needs formatting',
34
34
  });
35
35
  }
36
36
  }
37
37
 
38
38
  // All done, no warnings
39
- if (failures.length === 0 && combined.includes("All matched files use Prettier code style")) {
39
+ if (failures.length === 0 && combined.includes('All matched files use Prettier code style')) {
40
40
  return {
41
- tool: "prettier",
42
- status: "pass",
43
- summary: "all files formatted",
41
+ tool: 'prettier',
42
+ status: 'pass',
43
+ summary: 'all files formatted',
44
44
  failures: [],
45
45
  logPath: ctx.logPath,
46
46
  };
@@ -48,11 +48,15 @@ const parser: ParserModule = {
48
48
 
49
49
  const n = failures.length;
50
50
  const summary =
51
- n > 0 ? (n === 1 ? "1 file has formatting issues" : `${n} files have formatting issues`) : "all files formatted";
51
+ n > 0
52
+ ? n === 1
53
+ ? '1 file has formatting issues'
54
+ : `${n} files have formatting issues`
55
+ : 'all files formatted';
52
56
 
53
57
  return {
54
- tool: "prettier",
55
- status: n > 0 ? "fail" : "pass",
58
+ tool: 'prettier',
59
+ status: n > 0 ? 'fail' : 'pass',
56
60
  summary,
57
61
  failures,
58
62
  logPath: ctx.logPath,
@@ -1,6 +1,6 @@
1
- import path from "node:path";
2
- import type { ParserModule, ParsedFailure } from "../types";
3
- import { safeReadFile } from "./utils";
1
+ import path from 'node:path';
2
+ import type { ParserModule, ParsedFailure } from '../types';
3
+ import { safeReadFile } from './utils';
4
4
 
5
5
  interface PylintItem {
6
6
  type: string;
@@ -11,18 +11,18 @@ interface PylintItem {
11
11
  path: string;
12
12
  symbol: string;
13
13
  message: string;
14
- "message-id": string;
14
+ 'message-id': string;
15
15
  }
16
16
 
17
17
  const parser: ParserModule = {
18
- id: "pylint-json",
18
+ id: 'pylint-json',
19
19
  async parse(ctx) {
20
20
  const stdout = safeReadFile(ctx.stdoutPath).trim();
21
- if (!stdout || stdout === "[]") {
21
+ if (!stdout || stdout === '[]') {
22
22
  return {
23
- tool: "pylint",
24
- status: "pass",
25
- summary: "no lint errors",
23
+ tool: 'pylint',
24
+ status: 'pass',
25
+ summary: 'no lint errors',
26
26
  failures: [],
27
27
  logPath: ctx.logPath,
28
28
  };
@@ -33,9 +33,9 @@ const parser: ParserModule = {
33
33
  items = JSON.parse(stdout) as PylintItem[];
34
34
  } catch {
35
35
  return {
36
- tool: "pylint",
37
- status: "error",
38
- summary: "failed to parse pylint JSON output",
36
+ tool: 'pylint',
37
+ status: 'error',
38
+ summary: 'failed to parse pylint JSON output',
39
39
  logPath: ctx.logPath,
40
40
  };
41
41
  }
@@ -43,18 +43,18 @@ const parser: ParserModule = {
43
43
  const failures: ParsedFailure[] = items.map((item) => {
44
44
  const relPath = path.isAbsolute(item.path) ? path.relative(ctx.cwd, item.path) : item.path;
45
45
  return {
46
- id: `${relPath}:${item.line}:${item["message-id"]}`,
46
+ id: `${relPath}:${item.line}:${item['message-id']}`,
47
47
  file: relPath,
48
48
  line: item.line,
49
49
  message: item.message,
50
- rule: `${item["message-id"]}(${item.symbol})`,
50
+ rule: `${item['message-id']}(${item.symbol})`,
51
51
  };
52
52
  });
53
53
 
54
54
  return {
55
- tool: "pylint",
56
- status: failures.length > 0 ? "fail" : "pass",
57
- summary: failures.length > 0 ? `${failures.length} lint errors` : "no lint errors",
55
+ tool: 'pylint',
56
+ status: failures.length > 0 ? 'fail' : 'pass',
57
+ summary: failures.length > 0 ? `${failures.length} lint errors` : 'no lint errors',
58
58
  failures,
59
59
  logPath: ctx.logPath,
60
60
  };