token-goat 2.8.3 → 2.8.6
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 -17
- package/dist/{token-goat-chunk-6ODZ6PZK.mjs → token-goat-chunk-2JZ66BBE.mjs} +216 -72
- package/dist/{token-goat-chunk-PWVXXPCC.mjs → token-goat-chunk-DK4VLLYB.mjs} +563 -155
- package/dist/{token-goat-chunk-EFF2XCLB.mjs → token-goat-chunk-GUNYAGOZ.mjs} +175 -56
- package/dist/{token-goat-chunk-VAGPOZHO.mjs → token-goat-chunk-L2XHDICZ.mjs} +2 -2
- package/dist/{token-goat-chunk-DP3NNGGV.mjs → token-goat-chunk-LJEETTER.mjs} +5 -5
- package/dist/{token-goat-chunk-NKNCHJ4H.mjs → token-goat-chunk-MA5237JN.mjs} +327 -169
- package/dist/{token-goat-chunk-4OM2Q2SX.mjs → token-goat-chunk-SHN4UTL4.mjs} +5 -5
- package/dist/{token-goat-chunk-4HIMCBYK.mjs → token-goat-chunk-TELKICYU.mjs} +55 -6
- package/dist/{token-goat-chunk-222VPFP2.mjs → token-goat-chunk-U7M2LTGP.mjs} +1100 -269
- package/dist/{token-goat-chunk-TX4JFJTD.mjs → token-goat-chunk-XAWIELXH.mjs} +216 -105
- package/dist/{token-goat-chunk-C5IL6MJH.mjs → token-goat-chunk-ZIPBLIUZ.mjs} +6 -5
- package/dist/token-goat-hook.mjs +5 -5
- package/dist/token-goat.core.mjs +5 -5
- package/package.json +3 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
redactSecrets,
|
|
6
6
|
resolveIndexPath,
|
|
7
7
|
stripAnsiCodes
|
|
8
|
-
} from "./token-goat-chunk-
|
|
8
|
+
} from "./token-goat-chunk-2JZ66BBE.mjs";
|
|
9
9
|
|
|
10
10
|
// src/tool_filters/helpers.ts
|
|
11
11
|
import * as fs from "node:fs";
|
|
@@ -1484,6 +1484,13 @@ var _CLINE_WANTS_EXECUTE_RE = /^\s*Cline\s+wants\s+to\s+(?:execute|run|write|rea
|
|
|
1484
1484
|
var _CODEX_SEPARATOR_RE = /^-{4,}$/;
|
|
1485
1485
|
var _CODEX_MODEL_RE = /^model\s*:\s*(?<model>\S+)/i;
|
|
1486
1486
|
var _CODEX_TOKENS_USED_RE = /^tokens used$/i;
|
|
1487
|
+
var _CODEX_TOKEN_COUNT_RE = /^\d[\d,]*$/;
|
|
1488
|
+
function _trimBlankEdges(input) {
|
|
1489
|
+
let out = input;
|
|
1490
|
+
while (out.length && !(out[0] ?? "").trim()) out = out.slice(1);
|
|
1491
|
+
while (out.length && !(out[out.length - 1] ?? "").trim()) out = out.slice(0, -1);
|
|
1492
|
+
return out;
|
|
1493
|
+
}
|
|
1487
1494
|
var ghCopilotFilter = makeAiCliFilter({
|
|
1488
1495
|
name: "gh-copilot",
|
|
1489
1496
|
binaries: ["gh"],
|
|
@@ -1679,34 +1686,42 @@ var CodexExecFilter = class extends ToolFilter {
|
|
|
1679
1686
|
break;
|
|
1680
1687
|
}
|
|
1681
1688
|
}
|
|
1682
|
-
let lastCodexIdx = null;
|
|
1683
|
-
for (let i = secondSepIdx + 1; i < lines.length; i++) {
|
|
1684
|
-
if ((lines[i] ?? "").trim().toLowerCase() === "codex") lastCodexIdx = i;
|
|
1685
|
-
}
|
|
1686
|
-
if (lastCodexIdx === null) return combined;
|
|
1687
1689
|
let tokensLineIdx = null;
|
|
1690
|
+
let countLineIdx = null;
|
|
1688
1691
|
let tokensCount = "?";
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
}
|
|
1692
|
+
for (let i = lines.length - 1; i > secondSepIdx; i--) {
|
|
1693
|
+
if (!_CODEX_TOKENS_USED_RE.test((lines[i] ?? "").trim())) continue;
|
|
1694
|
+
for (let j = i + 1; j < Math.min(i + 3, lines.length); j++) {
|
|
1695
|
+
const candidate = (lines[j] ?? "").trim();
|
|
1696
|
+
if (!candidate) continue;
|
|
1697
|
+
if (_CODEX_TOKEN_COUNT_RE.test(candidate)) {
|
|
1698
|
+
tokensLineIdx = i;
|
|
1699
|
+
countLineIdx = j;
|
|
1700
|
+
tokensCount = candidate;
|
|
1699
1701
|
}
|
|
1700
1702
|
break;
|
|
1701
1703
|
}
|
|
1704
|
+
if (tokensLineIdx !== null) break;
|
|
1705
|
+
}
|
|
1706
|
+
let answerLines = null;
|
|
1707
|
+
let droppedTurns = 0;
|
|
1708
|
+
if (countLineIdx !== null) {
|
|
1709
|
+
const echo = _trimBlankEdges(lines.slice(countLineIdx + 1));
|
|
1710
|
+
if (echo.length) answerLines = echo;
|
|
1702
1711
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1712
|
+
if (answerLines === null) {
|
|
1713
|
+
const scanEnd = tokensLineIdx !== null ? tokensLineIdx : lines.length;
|
|
1714
|
+
const labelIdxs = [];
|
|
1715
|
+
for (let i = secondSepIdx + 1; i < scanEnd; i++) {
|
|
1716
|
+
if ((lines[i] ?? "").trim().toLowerCase() === "codex") labelIdxs.push(i);
|
|
1717
|
+
}
|
|
1718
|
+
const lastCodexIdx = labelIdxs.length ? labelIdxs[labelIdxs.length - 1] : null;
|
|
1719
|
+
if (lastCodexIdx === null) return combined;
|
|
1720
|
+
droppedTurns = labelIdxs.length - 1;
|
|
1721
|
+
answerLines = _trimBlankEdges(lines.slice(lastCodexIdx + 1, scanEnd));
|
|
1708
1722
|
}
|
|
1709
|
-
const
|
|
1723
|
+
const dropped = droppedTurns > 0 ? `, ${droppedTurns} earlier turn(s) dropped` : "";
|
|
1724
|
+
const summary = `[codex: model=${model}, tokens=${tokensCount}${dropped}]`;
|
|
1710
1725
|
return this.finalize([summary, ...answerLines]);
|
|
1711
1726
|
}
|
|
1712
1727
|
};
|
|
@@ -3245,6 +3260,7 @@ var _BANDIT_CODE_SCANNED_RE = /^Code scanned:/;
|
|
|
3245
3260
|
var _BANDIT_TOTAL_ISSUES_RE = /^Total issues \(by/;
|
|
3246
3261
|
var _BANDIT_STAT_LINE_RE = /^\s+\|?\s*\d/;
|
|
3247
3262
|
var _BANDIT_TESTING_RE = /^testing\s/;
|
|
3263
|
+
var _BANDIT_SEPARATOR_RE = /^-{10,}\s*$/;
|
|
3248
3264
|
var _TRIVY_LOG_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[^\s]*\s+(?:INFO|WARN|DEBUG|ERROR)\s/;
|
|
3249
3265
|
var _TRIVY_TABLE_SEP_RE = /^[+|-]+$/;
|
|
3250
3266
|
var _TRIVY_TABLE_ROW_RE = /^\|/;
|
|
@@ -3252,7 +3268,7 @@ var _TRIVY_TOTAL_RE = /^Total:\s*\d+/i;
|
|
|
3252
3268
|
var _TRIVY_NO_VULN_RE = /no\s+vulnerabilit/i;
|
|
3253
3269
|
var _TRIVY_TARGET_RE = /^(?:[-=]+\s+)?(?:Python|Ruby|Node\.js|Go|Java|PHP|Rust|OS Packages|Alpine|Debian|Ubuntu|RHEL|CentOS|npm|pip|gem|cargo|pom\.xml|Gemfile\.lock|requirements|package-lock|yarn\.lock|composer\.lock|go\.sum|Cargo\.lock|\S+\s+\()/i;
|
|
3254
3270
|
var _SNYK_TESTING_RE = /^Testing\s/i;
|
|
3255
|
-
var _SNYK_TREE_LINE_RE =
|
|
3271
|
+
var _SNYK_TREE_LINE_RE = /^\s*(?:[├└│]|[|\\`][-\s])/;
|
|
3256
3272
|
var _SNYK_VULN_HEADER_RE = /(?:✗|x|X)?\s*(?:Critical|High|Medium|Low|Info)\s+severity/i;
|
|
3257
3273
|
var _SNYK_MORE_ABOUT_RE = /^\s*(?:More about this vulnerability|https?:\/\/\S+)/i;
|
|
3258
3274
|
var _SNYK_SUMMARY_RE = /(?:✔|✗|Tested\s+\d+|unique vulnerabilities|no vulnerable paths|issues found)/i;
|
|
@@ -3443,6 +3459,7 @@ var GhRunLogFilter = class extends ToolFilter {
|
|
|
3443
3459
|
const flushGroup = () => {
|
|
3444
3460
|
if (!groupLines.length) return;
|
|
3445
3461
|
if (groupHasFailure || groupLines.length <= GROUP_COLLAPSE_THRESHOLD) {
|
|
3462
|
+
if (groupName) kept.push(`[group: ${groupName}]`);
|
|
3446
3463
|
kept.push(...groupLines);
|
|
3447
3464
|
} else {
|
|
3448
3465
|
kept.push(`[group: ${groupName} \u2014 ${groupLines.length} lines collapsed by token-goat]`);
|
|
@@ -3658,16 +3675,22 @@ var BanditFilter = class extends ToolFilter {
|
|
|
3658
3675
|
let inIssue = false;
|
|
3659
3676
|
let currentSeverity = "";
|
|
3660
3677
|
let issueBuf = [];
|
|
3678
|
+
let dropTrailingSeparator = false;
|
|
3661
3679
|
const flushIssue = () => {
|
|
3662
3680
|
const sev = currentSeverity.toUpperCase();
|
|
3663
3681
|
if (sev === "HIGH" || sev === "MEDIUM") {
|
|
3664
3682
|
kept.push(...issueBuf);
|
|
3665
3683
|
} else {
|
|
3666
3684
|
lowDropped++;
|
|
3685
|
+
dropTrailingSeparator = true;
|
|
3667
3686
|
}
|
|
3668
3687
|
};
|
|
3669
3688
|
let inStatsBlock = false;
|
|
3670
3689
|
for (const line of lines) {
|
|
3690
|
+
if (dropTrailingSeparator) {
|
|
3691
|
+
dropTrailingSeparator = false;
|
|
3692
|
+
if (_BANDIT_SEPARATOR_RE.test(line)) continue;
|
|
3693
|
+
}
|
|
3671
3694
|
if (_BANDIT_TESTING_RE.test(line)) continue;
|
|
3672
3695
|
if (_BANDIT_CODE_SCANNED_RE.test(line) || _BANDIT_TOTAL_ISSUES_RE.test(line)) {
|
|
3673
3696
|
if (inIssue) {
|
|
@@ -4024,6 +4047,7 @@ var _TF_STILL_RE = /^[a-z0-9_.[\]"-]+: Still (?:creating|modifying|destroying)\.
|
|
|
4024
4047
|
var _TF_APPLY_COMPLETE_RE = /^Apply complete! Resources:/;
|
|
4025
4048
|
var _TF_RESOURCE_COMPLETE_RE = /^[a-z0-9_.[\]"-]+: (?:Creation|Destruction|Modifications?) complete/i;
|
|
4026
4049
|
var _TF_PLAN_ATTR_DIFF_RE = /^\s+[~+-]\s+\S/;
|
|
4050
|
+
var _TF_PLAN_ACTION_HDR_RE = /^\s*#\s+\S+\s+(?:will be|must be|has been|has moved|will no longer be)\b/;
|
|
4027
4051
|
var _TF_KNOWN_AFTER_APPLY_RE = /\(known after apply\)/;
|
|
4028
4052
|
var _TF_INIT_PROVIDER_RE = /^\s*-\s+(?:Finding|Installing|Installed|Downloading|Locking)\s+\S+/i;
|
|
4029
4053
|
var _TF_SHOW_RESOURCE_HDR_RE = /^# (?:(?:module\.[^.\s]+\.)?[a-z][a-z0-9_]+\.[a-zA-Z0-9_.[\]-]+):$/;
|
|
@@ -4144,10 +4168,14 @@ ${stderr.replace(/\s+$/, "")}` : stderr;
|
|
|
4144
4168
|
}
|
|
4145
4169
|
let finalKept;
|
|
4146
4170
|
if (summaryLine !== null) {
|
|
4147
|
-
const tailLines = kept.filter((ln) => !_TF_REFRESH_RE.test(ln));
|
|
4148
|
-
finalKept = [summaryLine];
|
|
4171
|
+
const tailLines = kept.filter((ln) => !_TF_REFRESH_RE.test(ln) && ln !== summaryLine);
|
|
4149
4172
|
const tailStart = Math.max(0, tailLines.length - 20);
|
|
4150
|
-
|
|
4173
|
+
const head = tailLines.slice(0, tailStart);
|
|
4174
|
+
const headActions = head.filter((ln) => _TF_PLAN_ACTION_HDR_RE.test(ln));
|
|
4175
|
+
finalKept = [summaryLine, ...headActions];
|
|
4176
|
+
const omitted = head.length - headActions.length;
|
|
4177
|
+
if (omitted > 0) finalKept.push(`[token-goat: ${omitted} plan detail lines omitted]`);
|
|
4178
|
+
finalKept.push(...tailLines.slice(tailStart));
|
|
4151
4179
|
} else {
|
|
4152
4180
|
finalKept = kept;
|
|
4153
4181
|
}
|
|
@@ -8936,17 +8964,26 @@ var EnvFilter = class extends ToolFilter {
|
|
|
8936
8964
|
if (totalVars <= ENV_PASSTHROUGH_THRESHOLD) return merged;
|
|
8937
8965
|
const kept = [];
|
|
8938
8966
|
let suppressed = 0;
|
|
8967
|
+
let inSuppressedValue = false;
|
|
8939
8968
|
for (const line of lines) {
|
|
8940
8969
|
const m = ENV_LINE_RE.exec(line);
|
|
8941
8970
|
if (!m) {
|
|
8971
|
+
if (line === "---") {
|
|
8972
|
+
inSuppressedValue = false;
|
|
8973
|
+
kept.push(line);
|
|
8974
|
+
continue;
|
|
8975
|
+
}
|
|
8976
|
+
if (inSuppressedValue) continue;
|
|
8942
8977
|
kept.push(line);
|
|
8943
8978
|
continue;
|
|
8944
8979
|
}
|
|
8945
8980
|
const varName = m[1];
|
|
8946
8981
|
if (ENV_KEEP_VARS.has(varName) || ENV_KEEP_PREFIXES.some((p) => varName.startsWith(p))) {
|
|
8947
8982
|
kept.push(line);
|
|
8983
|
+
inSuppressedValue = false;
|
|
8948
8984
|
} else {
|
|
8949
8985
|
suppressed++;
|
|
8986
|
+
inSuppressedValue = true;
|
|
8950
8987
|
}
|
|
8951
8988
|
}
|
|
8952
8989
|
if (suppressed) {
|
|
@@ -9471,17 +9508,26 @@ function _compressKubectlDescribe(text) {
|
|
|
9471
9508
|
}
|
|
9472
9509
|
if (stripped.startsWith("Events:")) {
|
|
9473
9510
|
kept.push("");
|
|
9474
|
-
kept.push("
|
|
9475
|
-
const
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9511
|
+
kept.push(line.replace(/\s+$/, ""));
|
|
9512
|
+
const eventIndent = line.length - line.trimStart().length;
|
|
9513
|
+
const eventLines = [];
|
|
9514
|
+
i++;
|
|
9515
|
+
while (i < lines.length) {
|
|
9516
|
+
const nxt = lines[i];
|
|
9517
|
+
if (nxt.trim()) {
|
|
9518
|
+
const nxtIndent = nxt.length - nxt.trimStart().length;
|
|
9519
|
+
if (nxtIndent <= eventIndent) break;
|
|
9520
|
+
eventLines.push(nxt);
|
|
9482
9521
|
}
|
|
9522
|
+
i++;
|
|
9483
9523
|
}
|
|
9484
|
-
|
|
9524
|
+
if (eventLines.length > 10) {
|
|
9525
|
+
kept.push(` [token-goat: ${eventLines.length - 10} earlier events elided]`);
|
|
9526
|
+
kept.push(...eventLines.slice(-10));
|
|
9527
|
+
} else {
|
|
9528
|
+
kept.push(...eventLines);
|
|
9529
|
+
}
|
|
9530
|
+
continue;
|
|
9485
9531
|
}
|
|
9486
9532
|
if (_KEY_PREFIXES.some((pfx) => stripped.startsWith(pfx))) {
|
|
9487
9533
|
kept.push(line);
|
|
@@ -10918,7 +10964,12 @@ var _RUFF_SUCCESS_RE = /^(?:All checks passed!|No errors found\.?)\s*$/;
|
|
|
10918
10964
|
var _RUFF_FORMAT_REFORMATTED_RE = /^reformatted\s+\S/;
|
|
10919
10965
|
var _RUFF_FORMAT_WOULD_REFORMAT_RE = /^would reformat\s+\S/i;
|
|
10920
10966
|
var _RUFF_CONTEXT_LINE_RE = /^\s*(?:\d+\s*)?\|/;
|
|
10921
|
-
var _RUFF_HELP_LINE_RE = /^\s
|
|
10967
|
+
var _RUFF_HELP_LINE_RE = /^\s*(?:=\s*)?help:/i;
|
|
10968
|
+
var _RUFF_FULL_HEADER_RE = /^(?<code>[A-Z]+\d+)(?:\s+\[\*\])?\s+\S/;
|
|
10969
|
+
var _RUFF_FULL_LOCATION_RE = /^\s*-->\s*(?<file>.+?):\d+:\d+\s*$/;
|
|
10970
|
+
function _isRuffFullHeader(lines, i) {
|
|
10971
|
+
return _RUFF_FULL_HEADER_RE.test(lines[i] ?? "") && _RUFF_FULL_LOCATION_RE.test(lines[i + 1] ?? "");
|
|
10972
|
+
}
|
|
10922
10973
|
var RuffFilter = class extends ToolFilter {
|
|
10923
10974
|
name = "ruff";
|
|
10924
10975
|
binaries = /* @__PURE__ */ new Set(["ruff"]);
|
|
@@ -10955,23 +11006,45 @@ var RuffFilter = class extends ToolFilter {
|
|
|
10955
11006
|
const bucket = byCode.get(code) ?? [];
|
|
10956
11007
|
bucket.push({ file, text });
|
|
10957
11008
|
byCode.set(code, bucket);
|
|
10958
|
-
indexed.push({ kind: "viol", code, file, text });
|
|
11009
|
+
indexed.push({ kind: "viol", code, file, text, headerLines: 1 });
|
|
11010
|
+
continue;
|
|
11011
|
+
}
|
|
11012
|
+
const fullHeader = _RUFF_FULL_HEADER_RE.exec(line);
|
|
11013
|
+
const fullLoc = fullHeader?.groups ? _RUFF_FULL_LOCATION_RE.exec(lines[i + 1] ?? "") : null;
|
|
11014
|
+
if (fullHeader?.groups && fullLoc?.groups) {
|
|
11015
|
+
const code = fullHeader.groups["code"];
|
|
11016
|
+
const file = fullLoc.groups["file"];
|
|
11017
|
+
const text = [line, lines[i + 1]];
|
|
11018
|
+
i += 2;
|
|
11019
|
+
while (i < lines.length && lines[i].trim() !== "" && !_RUFF_FOOTER_RE.test(lines[i]) && !_isRuffFullHeader(lines, i)) {
|
|
11020
|
+
text.push(lines[i]);
|
|
11021
|
+
i++;
|
|
11022
|
+
}
|
|
11023
|
+
const bucket = byCode.get(code) ?? [];
|
|
11024
|
+
bucket.push({ file, text });
|
|
11025
|
+
byCode.set(code, bucket);
|
|
11026
|
+
indexed.push({ kind: "viol", code, file, text, headerLines: 2 });
|
|
10959
11027
|
} else {
|
|
10960
11028
|
indexed.push({ kind: "other", line });
|
|
10961
11029
|
i++;
|
|
10962
11030
|
}
|
|
10963
11031
|
}
|
|
10964
11032
|
const summarised = /* @__PURE__ */ new Map();
|
|
11033
|
+
const contextCollapsed = /* @__PURE__ */ new Set();
|
|
10965
11034
|
for (const [code, entries] of byCode) {
|
|
10966
11035
|
const files = new Set(entries.map((e) => e.file));
|
|
10967
11036
|
if (entries.length >= 3 && files.size >= 2) {
|
|
10968
11037
|
const example = entries[0].text[0];
|
|
10969
11038
|
summarised.set(code, `${code}: ${entries.length} occurrences in ${files.size} files (example: ${example})`);
|
|
11039
|
+
} else if (entries.length >= 3 && entries.some((e) => e.text.length > 1)) {
|
|
11040
|
+
contextCollapsed.add(code);
|
|
10970
11041
|
}
|
|
10971
11042
|
}
|
|
10972
11043
|
const out = [];
|
|
10973
11044
|
const emittedSummary = /* @__PURE__ */ new Set();
|
|
10974
11045
|
const footerLines = [];
|
|
11046
|
+
const seenPerCode = /* @__PURE__ */ new Map();
|
|
11047
|
+
let contextBlocksDropped = 0;
|
|
10975
11048
|
for (const seg of indexed) {
|
|
10976
11049
|
if (seg.kind === "footer") {
|
|
10977
11050
|
footerLines.push(seg.line);
|
|
@@ -10986,11 +11059,27 @@ var RuffFilter = class extends ToolFilter {
|
|
|
10986
11059
|
out.push(summarised.get(seg.code));
|
|
10987
11060
|
emittedSummary.add(seg.code);
|
|
10988
11061
|
}
|
|
11062
|
+
} else if (contextCollapsed.has(seg.code)) {
|
|
11063
|
+
const seen = seenPerCode.get(seg.code) ?? 0;
|
|
11064
|
+
seenPerCode.set(seg.code, seen + 1);
|
|
11065
|
+
if (seen === 0 || seg.text.length <= seg.headerLines) {
|
|
11066
|
+
out.push(...seg.text);
|
|
11067
|
+
} else {
|
|
11068
|
+
out.push(...seg.text.slice(0, seg.headerLines));
|
|
11069
|
+
contextBlocksDropped++;
|
|
11070
|
+
}
|
|
10989
11071
|
} else {
|
|
10990
11072
|
out.push(...seg.text);
|
|
10991
11073
|
}
|
|
10992
11074
|
}
|
|
10993
11075
|
out.push(...footerLines);
|
|
11076
|
+
const notes = [];
|
|
11077
|
+
maybeNote(
|
|
11078
|
+
notes,
|
|
11079
|
+
contextBlocksDropped,
|
|
11080
|
+
`dropped ${contextBlocksDropped} repeated source-context blocks (locations kept)`
|
|
11081
|
+
);
|
|
11082
|
+
this.emitNotes(out, notes);
|
|
10994
11083
|
return squeezeBlankLines(out.join("\n"));
|
|
10995
11084
|
}
|
|
10996
11085
|
_compressFormat(merged, exitCode) {
|
|
@@ -11343,6 +11432,7 @@ var MypyFilter = class extends ToolFilter {
|
|
|
11343
11432
|
var _GOLANGCI_ISSUE_RE = /^(?<file>[^:\s][^:]*\.go):(?<line>\d+)(?::\d+)?:\s+(?<msg>.+?)\s+\((?<linter>[^)]+)\)\s*$/;
|
|
11344
11433
|
var _GOLANGCI_SUMMARY_RE = /^(?:Found \d+ issues?\.|Issues? found\.|Run with --fix)|^(?:ERRO\s|WARN\s)/i;
|
|
11345
11434
|
var _GOLANGCI_NOISE_RE = /^(?:golangci-lint\s+version|time=|level=(?:info|debug)|msg="(?:Running|Starting|Finishing))/i;
|
|
11435
|
+
var _GOLANGCI_CARET_RE = /^\s*\^[~^]*\s*$/;
|
|
11346
11436
|
var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
11347
11437
|
name = "golangci-lint";
|
|
11348
11438
|
binaries = /* @__PURE__ */ new Set(["golangci-lint"]);
|
|
@@ -11360,7 +11450,9 @@ var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
|
11360
11450
|
const kept = [];
|
|
11361
11451
|
let noiseDropped = 0;
|
|
11362
11452
|
let issuesCollapsed = 0;
|
|
11363
|
-
|
|
11453
|
+
let contextDropped = 0;
|
|
11454
|
+
for (let i = 0; i < lines.length; i++) {
|
|
11455
|
+
const line = lines[i];
|
|
11364
11456
|
if (_GOLANGCI_NOISE_RE.test(line)) {
|
|
11365
11457
|
noiseDropped++;
|
|
11366
11458
|
continue;
|
|
@@ -11371,6 +11463,17 @@ var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
|
11371
11463
|
}
|
|
11372
11464
|
const m = _GOLANGCI_ISSUE_RE.exec(line);
|
|
11373
11465
|
if (m?.groups) {
|
|
11466
|
+
const next = lines[i + 1] ?? "";
|
|
11467
|
+
let source = null;
|
|
11468
|
+
let caret = null;
|
|
11469
|
+
if (!_GOLANGCI_ISSUE_RE.test(next) && !_GOLANGCI_SUMMARY_RE.test(next) && _GOLANGCI_CARET_RE.test(lines[i + 2] ?? "")) {
|
|
11470
|
+
source = next;
|
|
11471
|
+
caret = lines[i + 2];
|
|
11472
|
+
i += 2;
|
|
11473
|
+
} else if (_GOLANGCI_CARET_RE.test(next)) {
|
|
11474
|
+
caret = next;
|
|
11475
|
+
i += 1;
|
|
11476
|
+
}
|
|
11374
11477
|
const filePath = m.groups["file"];
|
|
11375
11478
|
const linter = m.groups["linter"];
|
|
11376
11479
|
const key = `${filePath}\0${linter}`;
|
|
@@ -11378,9 +11481,15 @@ var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
|
11378
11481
|
issueCounts.set(key, count + 1);
|
|
11379
11482
|
if (count < _GolangciLintFilter._KEEP_FIRST_N) {
|
|
11380
11483
|
kept.push(line);
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11484
|
+
if (source !== null) contextDropped++;
|
|
11485
|
+
if (caret !== null) contextDropped++;
|
|
11486
|
+
} else {
|
|
11487
|
+
if (count === _GolangciLintFilter._KEEP_FIRST_N) {
|
|
11488
|
+
kept.push(`[token-goat: __placeholder__${filePath}__${linter}__]`);
|
|
11489
|
+
issuesCollapsed++;
|
|
11490
|
+
}
|
|
11491
|
+
if (source !== null) contextDropped++;
|
|
11492
|
+
if (caret !== null) contextDropped++;
|
|
11384
11493
|
}
|
|
11385
11494
|
continue;
|
|
11386
11495
|
}
|
|
@@ -11402,6 +11511,7 @@ var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
|
11402
11511
|
}
|
|
11403
11512
|
const notes = [];
|
|
11404
11513
|
maybeNote(notes, noiseDropped, `dropped ${noiseDropped} structured-log noise lines`);
|
|
11514
|
+
maybeNote(notes, contextDropped, `dropped ${contextDropped} redundant source-context/caret lines`);
|
|
11405
11515
|
if (issuesCollapsed) {
|
|
11406
11516
|
const totalIssues = [...issueCounts.values()].reduce((a, b) => a + b, 0);
|
|
11407
11517
|
const keptIssues = [...issueCounts.values()].reduce(
|
|
@@ -11418,7 +11528,8 @@ var GolangciLintFilter = class _GolangciLintFilter extends ToolFilter {
|
|
|
11418
11528
|
};
|
|
11419
11529
|
var _PYLINT_MODULE_RE = /^\*{10,}\s+Module\s/;
|
|
11420
11530
|
var _PYLINT_ISSUE_RE = /^[^\s].*:\d+:\d+:\s+[CWEFR]\d{4}/;
|
|
11421
|
-
var _PYLINT_CODE_RE = /\s([CWEFR]\d{4})\s/;
|
|
11531
|
+
var _PYLINT_CODE_RE = /\s([CWEFR]\d{4})(?=[\s:]|$)/;
|
|
11532
|
+
var _PYLINT_SYMBOL_RE = /\(([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\)\s*$/;
|
|
11422
11533
|
var _PYLINT_RATING_RE = /^Your code has been rated at/;
|
|
11423
11534
|
var _PYLINT_SEPARATOR_RE = /^-{10,}$/;
|
|
11424
11535
|
var _PYLINT_CONFIG_RE = /^(?:Using config file|Loading plugin|No config file found)/;
|
|
@@ -11432,6 +11543,7 @@ var PylintFilter = class _PylintFilter extends ToolFilter {
|
|
|
11432
11543
|
const kept = [];
|
|
11433
11544
|
const codeCounts = /* @__PURE__ */ new Map();
|
|
11434
11545
|
const pendingPlaceholders = [];
|
|
11546
|
+
const codeSymbols = /* @__PURE__ */ new Map();
|
|
11435
11547
|
let deduplicated = 0;
|
|
11436
11548
|
let droppedSeparators = 0;
|
|
11437
11549
|
let droppedConfig = 0;
|
|
@@ -11463,6 +11575,8 @@ var PylintFilter = class _PylintFilter extends ToolFilter {
|
|
|
11463
11575
|
const code = m ? m[1] : "__unknown__";
|
|
11464
11576
|
const severity = code[0] ?? "?";
|
|
11465
11577
|
const key = `${currentModule ?? ""}\0${code}`;
|
|
11578
|
+
const symM = _PYLINT_SYMBOL_RE.exec(line);
|
|
11579
|
+
if (symM && !codeSymbols.has(key)) codeSymbols.set(key, symM[1]);
|
|
11466
11580
|
const count = codeCounts.get(key) ?? 0;
|
|
11467
11581
|
codeCounts.set(key, count + 1);
|
|
11468
11582
|
const alwaysKeep = severity === "E" || severity === "F";
|
|
@@ -11475,12 +11589,11 @@ var PylintFilter = class _PylintFilter extends ToolFilter {
|
|
|
11475
11589
|
moduleHasKeptIssue = true;
|
|
11476
11590
|
} else {
|
|
11477
11591
|
if (count === _PylintFilter._KEEP_PER_CODE) {
|
|
11478
|
-
const codeName = code.slice(1);
|
|
11479
11592
|
if (pendingModule !== null) {
|
|
11480
11593
|
kept.push(pendingModule);
|
|
11481
11594
|
pendingModule = null;
|
|
11482
11595
|
}
|
|
11483
|
-
pendingPlaceholders.push({ index: kept.length, code,
|
|
11596
|
+
pendingPlaceholders.push({ index: kept.length, code, key });
|
|
11484
11597
|
kept.push("");
|
|
11485
11598
|
moduleHasKeptIssue = true;
|
|
11486
11599
|
}
|
|
@@ -11495,14 +11608,16 @@ var PylintFilter = class _PylintFilter extends ToolFilter {
|
|
|
11495
11608
|
}
|
|
11496
11609
|
kept.push(line);
|
|
11497
11610
|
}
|
|
11498
|
-
for (const { index, code,
|
|
11611
|
+
for (const { index, code, key } of pendingPlaceholders) {
|
|
11499
11612
|
const elided = (codeCounts.get(key) ?? 0) - _PylintFilter._KEEP_PER_CODE;
|
|
11500
|
-
|
|
11613
|
+
const symbol = codeSymbols.get(key);
|
|
11614
|
+
const label = symbol !== void 0 ? `${code} (${symbol})` : code;
|
|
11615
|
+
kept[index] = `[token-goat: +${elided} more ${label}; disable via TOKEN_GOAT_BASH_COMPRESS]`;
|
|
11501
11616
|
}
|
|
11502
11617
|
const notes = [];
|
|
11503
|
-
maybeNote(notes, deduplicated, `deduplicated ${deduplicated} repeated-code issue
|
|
11504
|
-
maybeNote(notes, droppedSeparators, `dropped ${droppedSeparators} separator
|
|
11505
|
-
maybeNote(notes, droppedConfig, `dropped ${droppedConfig} config-loading
|
|
11618
|
+
maybeNote(notes, deduplicated, `deduplicated ${deduplicated} repeated-code issue line${plural(deduplicated)}`);
|
|
11619
|
+
maybeNote(notes, droppedSeparators, `dropped ${droppedSeparators} separator line${plural(droppedSeparators)}`);
|
|
11620
|
+
maybeNote(notes, droppedConfig, `dropped ${droppedConfig} config-loading line${plural(droppedConfig)}`);
|
|
11506
11621
|
this.emitNotes(kept, notes);
|
|
11507
11622
|
return this.finalize(kept);
|
|
11508
11623
|
}
|
|
@@ -11711,7 +11826,7 @@ var LinterFilter = class extends ToolFilter {
|
|
|
11711
11826
|
return _compressEslintStanza(merged);
|
|
11712
11827
|
}
|
|
11713
11828
|
};
|
|
11714
|
-
var _KTLINT_ISSUE_RE = /^(.+\.
|
|
11829
|
+
var _KTLINT_ISSUE_RE = /^(.+\.kts?):(\d+):(\d+):\s+(?:(error|warning):\s+)?(.+)\s+\(([^)]+)\)$/i;
|
|
11715
11830
|
var _KTLINT_CHECKSTYLE_TAG_RE = /^\s*<(?:\?xml|checkstyle|file)\b/i;
|
|
11716
11831
|
var _KTLINT_CHECKSTYLE_ERROR_RE = /^\s*<error\b.*\bsource="([^"]+)"/i;
|
|
11717
11832
|
var _KTLINT_SUMMARY_RE = /^\s*(?:\d+\s+lint\s+error|ktlint\s+\d+\.\d+|Kotlin\s+style\s+guide|No\s+lint\s+errors|Resolving|Checking|Formatting)/i;
|
|
@@ -11750,7 +11865,7 @@ var KtlintFilter = class _KtlintFilter extends ToolFilter {
|
|
|
11750
11865
|
kept.push(line);
|
|
11751
11866
|
} else {
|
|
11752
11867
|
if (count === _KtlintFilter._KEEP_PER_RULE + 1) {
|
|
11753
|
-
pendingPlaceholders.push({ index: kept.length, rule, suffix: "violations" });
|
|
11868
|
+
pendingPlaceholders.push({ index: kept.length, rule, suffix: "violations", indent: " " });
|
|
11754
11869
|
kept.push("");
|
|
11755
11870
|
}
|
|
11756
11871
|
deduplicated++;
|
|
@@ -11759,7 +11874,7 @@ var KtlintFilter = class _KtlintFilter extends ToolFilter {
|
|
|
11759
11874
|
}
|
|
11760
11875
|
const m = _KTLINT_ISSUE_RE.exec(line);
|
|
11761
11876
|
if (m) {
|
|
11762
|
-
const severity = m[4].toLowerCase();
|
|
11877
|
+
const severity = (m[4] ?? "").toLowerCase();
|
|
11763
11878
|
const rule = m[6];
|
|
11764
11879
|
const count = (ruleCounts.get(rule) ?? 0) + 1;
|
|
11765
11880
|
ruleCounts.set(rule, count);
|
|
@@ -11768,7 +11883,12 @@ var KtlintFilter = class _KtlintFilter extends ToolFilter {
|
|
|
11768
11883
|
kept.push(line);
|
|
11769
11884
|
} else {
|
|
11770
11885
|
if (count === _KtlintFilter._KEEP_PER_RULE + 1) {
|
|
11771
|
-
pendingPlaceholders.push({
|
|
11886
|
+
pendingPlaceholders.push({
|
|
11887
|
+
index: kept.length,
|
|
11888
|
+
rule,
|
|
11889
|
+
suffix: severity === "warning" ? "warnings" : "violations",
|
|
11890
|
+
indent: ""
|
|
11891
|
+
});
|
|
11772
11892
|
kept.push("");
|
|
11773
11893
|
}
|
|
11774
11894
|
deduplicated++;
|
|
@@ -11781,9 +11901,8 @@ var KtlintFilter = class _KtlintFilter extends ToolFilter {
|
|
|
11781
11901
|
}
|
|
11782
11902
|
kept.push(line);
|
|
11783
11903
|
}
|
|
11784
|
-
for (const { index, rule, suffix } of pendingPlaceholders) {
|
|
11904
|
+
for (const { index, rule, suffix, indent } of pendingPlaceholders) {
|
|
11785
11905
|
const elided = (ruleCounts.get(rule) ?? 0) - _KtlintFilter._KEEP_PER_RULE;
|
|
11786
|
-
const indent = suffix === "violations" ? " " : "";
|
|
11787
11906
|
kept[index] = `${indent}[token-goat: +${elided} more ${rule} ${suffix}; disable via TOKEN_GOAT_BASH_COMPRESS for full list]`;
|
|
11788
11907
|
}
|
|
11789
11908
|
const notes = [];
|
|
@@ -12092,7 +12211,7 @@ var CppcheckFilter = class extends ToolFilter {
|
|
|
12092
12211
|
};
|
|
12093
12212
|
var _CLANG_TIDY_WARNINGS_GENERATED_RE = /^\d+\s+warning(?:s)?\s+generated\./;
|
|
12094
12213
|
var _CLANG_TIDY_PROCESSING_RE = /^clang-tidy:\s+Processing\s+\d+/i;
|
|
12095
|
-
var _CLANG_TIDY_DIAG_RE = /^.+\.(?:c|cpp|cxx|cc|h|hpp|hxx):\d+:\d+:\s+(?:error|warning|note|remark):/;
|
|
12214
|
+
var _CLANG_TIDY_DIAG_RE = /^.+\.(?:c|cpp|cxx|cc|h|hpp|hxx|cuh|cu|tcc|inl|mm|m):\d+:\d+:\s+(?:error|warning|note|remark):/;
|
|
12096
12215
|
var _CLANG_TIDY_NOTE_RE = /^.+:\d+:\d+:\s+note:/;
|
|
12097
12216
|
var _CLANG_TIDY_CONTEXT_RE = /^\s+(?:\^[~^]*|~+)\s*$|^\s{4,}\S/;
|
|
12098
12217
|
var _CLANG_TIDY_INCLUDE_RE = /^In\s+file\s+included\s+from\s+/;
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
selectFilter,
|
|
11
11
|
shlexSplit,
|
|
12
12
|
wrappedShell
|
|
13
|
-
} from "./token-goat-chunk-
|
|
13
|
+
} from "./token-goat-chunk-GUNYAGOZ.mjs";
|
|
14
14
|
import {
|
|
15
15
|
loadConfig,
|
|
16
16
|
recordStat
|
|
17
|
-
} from "./token-goat-chunk-
|
|
17
|
+
} from "./token-goat-chunk-2JZ66BBE.mjs";
|
|
18
18
|
import "./token-goat-chunk-AO2QD2AG.mjs";
|
|
19
19
|
import "./token-goat-chunk-AEX54RUZ.mjs";
|
|
20
20
|
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
buildEvent,
|
|
5
5
|
relay,
|
|
6
6
|
relayInProcess
|
|
7
|
-
} from "./token-goat-chunk-
|
|
7
|
+
} from "./token-goat-chunk-MA5237JN.mjs";
|
|
8
8
|
import {
|
|
9
9
|
MAX_STDIN_BYTES,
|
|
10
10
|
readStdinJson
|
|
11
|
-
} from "./token-goat-chunk-
|
|
12
|
-
import "./token-goat-chunk-
|
|
13
|
-
import "./token-goat-chunk-
|
|
14
|
-
import "./token-goat-chunk-
|
|
11
|
+
} from "./token-goat-chunk-TELKICYU.mjs";
|
|
12
|
+
import "./token-goat-chunk-DK4VLLYB.mjs";
|
|
13
|
+
import "./token-goat-chunk-GUNYAGOZ.mjs";
|
|
14
|
+
import "./token-goat-chunk-2JZ66BBE.mjs";
|
|
15
15
|
import "./token-goat-chunk-AO2QD2AG.mjs";
|
|
16
16
|
import "./token-goat-chunk-AEX54RUZ.mjs";
|
|
17
17
|
export {
|