@usepipr/runtime 0.3.5 → 0.3.7
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 +2 -0
- package/dist/{commands-C6wfO-y7.d.mts → commands-Bcta0T4L.d.mts} +27 -1
- package/dist/commands-Bcta0T4L.d.mts.map +1 -0
- package/dist/{commands-DCpIxJkz.mjs → commands-DM63Wmy0.mjs} +968 -315
- package/dist/commands-DM63Wmy0.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internal/review-testing.d.mts +18 -0
- package/dist/internal/review-testing.d.mts.map +1 -0
- package/dist/internal/review-testing.mjs +2 -0
- package/dist/internal/testing.d.mts +2 -19
- package/dist/internal/testing.mjs +2 -2
- package/dist/suggested-fix-publication-policy-B5Wwuudp.mjs +206 -0
- package/dist/suggested-fix-publication-policy-B5Wwuudp.mjs.map +1 -0
- package/package.json +7 -3
- package/dist/commands-C6wfO-y7.d.mts.map +0 -1
- package/dist/commands-DCpIxJkz.mjs.map +0 -1
- package/dist/internal/testing.d.mts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PlatformInfo, D as ChangeRequestRef, E as ChangeRequestEventContext, F as supportedOfficialInitAdapters, M as RepositoryRef, N as RuntimeSettings, O as DiffManifest, P as OfficialInitAdapter, S as ActionLogSink, T as PublicationResult, a as runInspectCommand, c as ActionCommandOptions, d as DryRunCommandResult, f as InitCommandOptions, g as RuntimeCommandOptions, h as LocalReviewCommandResult, i as runInitCommand, j as ProviderConfig, k as PiprConfig, l as ActionCommandResult, m as LocalReviewCommandOptions, o as runLocalReviewCommand, p as InspectCommandResult, r as runDryRunCommand, s as runValidateCommand, t as runActionCommand, u as DryRunCommandOptions, w as PublicationError, x as ActionLogRecord } from "./commands-
|
|
1
|
+
import { A as PlatformInfo, D as ChangeRequestRef, E as ChangeRequestEventContext, F as supportedOfficialInitAdapters, M as RepositoryRef, N as RuntimeSettings, O as DiffManifest, P as OfficialInitAdapter, S as ActionLogSink, T as PublicationResult, a as runInspectCommand, c as ActionCommandOptions, d as DryRunCommandResult, f as InitCommandOptions, g as RuntimeCommandOptions, h as LocalReviewCommandResult, i as runInitCommand, j as ProviderConfig, k as PiprConfig, l as ActionCommandResult, m as LocalReviewCommandOptions, o as runLocalReviewCommand, p as InspectCommandResult, r as runDryRunCommand, s as runValidateCommand, t as runActionCommand, u as DryRunCommandOptions, w as PublicationError, x as ActionLogRecord } from "./commands-Bcta0T4L.mjs";
|
|
2
2
|
//#region src/config/recipes/types.d.ts
|
|
3
3
|
type OfficialInitRecipeFile = {
|
|
4
4
|
relativePath: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as runInspectCommand, c as PublicationError,
|
|
1
|
+
import { a as runInspectCommand, c as PublicationError, d as supportedOfficialInitRecipes, i as runInitCommand, l as supportedOfficialInitAdapters, o as runLocalReviewCommand, r as runDryRunCommand, s as runValidateCommand, t as runActionCommand, u as listOfficialInitRecipes } from "./commands-DM63Wmy0.mjs";
|
|
2
2
|
export { PublicationError, listOfficialInitRecipes, runActionCommand, runDryRunCommand, runInitCommand, runInspectCommand, runLocalReviewCommand, runValidateCommand, supportedOfficialInitAdapters, supportedOfficialInitRecipes };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/review/inline-finding-limits.d.ts
|
|
2
|
+
declare const maxInlineFindingBodyCharacters = 700;
|
|
3
|
+
declare const maxInlineFindingBodyLines = 4;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/review/suggested-fix-publication-policy.d.ts
|
|
6
|
+
type SuggestedFixPublicationSelection = {
|
|
7
|
+
side: "RIGHT" | "LEFT";
|
|
8
|
+
kind: "added" | "deleted" | "context" | "mixed";
|
|
9
|
+
rangeStartLine: number;
|
|
10
|
+
startLine: number;
|
|
11
|
+
endLine: number;
|
|
12
|
+
preview?: string;
|
|
13
|
+
suggestedFix: string;
|
|
14
|
+
};
|
|
15
|
+
declare function isPublishableSuggestedFixSelection(selection: SuggestedFixPublicationSelection): boolean;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isPublishableSuggestedFixSelection, maxInlineFindingBodyCharacters, maxInlineFindingBodyLines };
|
|
18
|
+
//# sourceMappingURL=review-testing.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-testing.d.mts","names":[],"sources":["../../src/review/inline-finding-limits.ts","../../src/review/suggested-fix-publication-policy.ts"],"mappings":";cAAa;cACA;;;KCDR;EACH;EACA;EACA;EACA;EACA;EACA;EACA;;iBAWc,mCACd,WAAW"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { n as maxInlineFindingBodyCharacters, r as maxInlineFindingBodyLines, t as isPublishableSuggestedFixSelection } from "../suggested-fix-publication-policy-B5Wwuudp.mjs";
|
|
2
|
+
export { isPublishableSuggestedFixSelection, maxInlineFindingBodyCharacters, maxInlineFindingBodyLines };
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
import { C as GitHubPublicationClient, _ as piBuiltinToolNames, b as piThinkingLevels, l as ActionCommandResult, n as runActionCommandWithDependencies, v as piReadOnlyToolNames, y as piRequiredCliFlags } from "../commands-
|
|
2
|
-
|
|
3
|
-
declare const maxInlineFindingBodyCharacters = 700;
|
|
4
|
-
declare const maxInlineFindingBodyLines = 4;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/review/suggested-fix-publication-policy.d.ts
|
|
7
|
-
type SuggestedFixPublicationSelection = {
|
|
8
|
-
side: "RIGHT" | "LEFT";
|
|
9
|
-
kind: "added" | "deleted" | "context" | "mixed";
|
|
10
|
-
rangeStartLine: number;
|
|
11
|
-
startLine: number;
|
|
12
|
-
endLine: number;
|
|
13
|
-
preview?: string;
|
|
14
|
-
suggestedFix: string;
|
|
15
|
-
};
|
|
16
|
-
declare function isPublishableSuggestedFixSelection(selection: SuggestedFixPublicationSelection): boolean;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { type ActionCommandResult, type GitHubPublicationClient, type SuggestedFixPublicationSelection, isPublishableSuggestedFixSelection, maxInlineFindingBodyCharacters, maxInlineFindingBodyLines, piBuiltinToolNames, piReadOnlyToolNames, piRequiredCliFlags, piThinkingLevels, runActionCommandWithDependencies };
|
|
19
|
-
//# sourceMappingURL=testing.d.mts.map
|
|
1
|
+
import { C as GitHubPublicationClient, _ as piBuiltinToolNames, b as piThinkingLevels, l as ActionCommandResult, n as runActionCommandWithDependencies, v as piReadOnlyToolNames, y as piRequiredCliFlags } from "../commands-Bcta0T4L.mjs";
|
|
2
|
+
export { type ActionCommandResult, type GitHubPublicationClient, piBuiltinToolNames, piReadOnlyToolNames, piRequiredCliFlags, piThinkingLevels, runActionCommandWithDependencies };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { f as piBuiltinToolNames, h as piThinkingLevels, m as piRequiredCliFlags, n as runActionCommandWithDependencies, p as piReadOnlyToolNames } from "../commands-DM63Wmy0.mjs";
|
|
2
|
+
export { piBuiltinToolNames, piReadOnlyToolNames, piRequiredCliFlags, piThinkingLevels, runActionCommandWithDependencies };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
//#region src/review/inline-finding-limits.ts
|
|
2
|
+
const maxInlineFindingBodyCharacters = 700;
|
|
3
|
+
const maxInlineFindingBodyLines = 4;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/review/suggested-fix-publication-policy.ts
|
|
6
|
+
const maxSuggestedFixSelectedLines = 12;
|
|
7
|
+
const maxSuggestedFixReplacementLines = 20;
|
|
8
|
+
const environmentKeyAccessPattern = /\b(?:process|Bun|import\.meta)(?:\s*\.|\s*\?\.)\s*env(?:\s*(?:\.|\?\.)\s*([A-Za-z_][A-Za-z0-9_]*)|\s*\?\.\s*\[\s*["']([A-Za-z_][A-Za-z0-9_]*)["']\s*\]|\s*\[\s*["']([A-Za-z_][A-Za-z0-9_]*)["']\s*\])|\bDeno(?:\s*\.|\s*\?\.)\s*env(?:\s*\.|\s*\?\.)\s*get\s*\(\s*["']([A-Za-z_][A-Za-z0-9_]*)["']\s*\)/g;
|
|
9
|
+
const environmentDestructurePattern = /\{([^{}]*)\}\s*=\s*(?:process|Bun|import\.meta)(?:\s*\.|\s*\?\.)\s*env\b/g;
|
|
10
|
+
const environmentKeyNamePattern = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
11
|
+
function isPublishableSuggestedFixSelection(selection) {
|
|
12
|
+
const suggestedLines = normalizedSuggestedFixLines(selection.suggestedFix);
|
|
13
|
+
const selectedLineCount = selection.endLine - selection.startLine + 1;
|
|
14
|
+
if (selection.side !== "RIGHT" || selection.kind === "deleted" || selectedLineCount > maxSuggestedFixSelectedLines || suggestedLines.length > maxSuggestedFixReplacementLines) return false;
|
|
15
|
+
const originalLines = selectedPreviewLines(selection, selectedLineCount);
|
|
16
|
+
if (!originalLines) return false;
|
|
17
|
+
const structuralEdgePattern = /^([{}[\]()<>]+)[;,]?$/;
|
|
18
|
+
const firstOriginalEdge = originalLines[0]?.trim().match(structuralEdgePattern)?.[1];
|
|
19
|
+
const firstSuggestedEdge = suggestedLines[0]?.trim().match(structuralEdgePattern)?.[1];
|
|
20
|
+
const lastOriginalEdge = originalLines.at(-1)?.trim().match(structuralEdgePattern)?.[1];
|
|
21
|
+
const lastSuggestedEdge = suggestedLines.at(-1)?.trim().match(structuralEdgePattern)?.[1];
|
|
22
|
+
const originalLinesWithoutTrailingBlanks = originalLines.slice(0, lastNonBlankLineIndex(originalLines) + 1);
|
|
23
|
+
const suggestedLinesWithoutTrailingBlanks = suggestedLines.slice(0, lastNonBlankLineIndex(suggestedLines) + 1);
|
|
24
|
+
return (originalLinesWithoutTrailingBlanks.length !== suggestedLinesWithoutTrailingBlanks.length || originalLinesWithoutTrailingBlanks.some((line, index) => line !== suggestedLinesWithoutTrailingBlanks[index])) && !onlyChangesWhitespace(originalLinesWithoutTrailingBlanks, suggestedLinesWithoutTrailingBlanks) && !suggestionIntroducesNewEnvironmentAccess(selection.preview, selection.suggestedFix) && (firstOriginalEdge === void 0 || firstOriginalEdge === firstSuggestedEdge) && (lastOriginalEdge === void 0 || lastOriginalEdge === lastSuggestedEdge) && !hasUnchangedSelectionEdge(originalLines, suggestedLines) && !suggestionIncludesUnselectedContext(selection, selectedLineCount, suggestedLines);
|
|
25
|
+
}
|
|
26
|
+
function normalizedSuggestedFixLines(value) {
|
|
27
|
+
const normalized = value.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
28
|
+
const withoutFinalNewline = normalized.endsWith("\n") ? normalized.slice(0, -1) : normalized;
|
|
29
|
+
return withoutFinalNewline.length === 0 ? [] : withoutFinalNewline.split("\n");
|
|
30
|
+
}
|
|
31
|
+
function selectedPreviewLines(selection, selectedLineCount) {
|
|
32
|
+
if (!selection.preview) return;
|
|
33
|
+
const offset = selection.startLine - selection.rangeStartLine;
|
|
34
|
+
if (offset < 0) return;
|
|
35
|
+
const previewLines = selection.preview.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
36
|
+
if (offset + selectedLineCount > previewLines.length) return;
|
|
37
|
+
return previewLines.slice(offset, offset + selectedLineCount);
|
|
38
|
+
}
|
|
39
|
+
function suggestionIncludesUnselectedContext(selection, selectedLineCount, suggestedLines) {
|
|
40
|
+
if (!selection.preview || suggestedLines.length <= selectedLineCount) return false;
|
|
41
|
+
const offset = selection.startLine - selection.rangeStartLine;
|
|
42
|
+
if (offset < 0) return false;
|
|
43
|
+
const previewLines = selection.preview.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
44
|
+
return [offset > 0 ? previewLines[offset - 1] : void 0, previewLines[offset + selectedLineCount]].filter((line) => Boolean(line?.trim())).some((line) => suggestedLines.includes(line));
|
|
45
|
+
}
|
|
46
|
+
function hasUnchangedSelectionEdge(originalLines, suggestedLines) {
|
|
47
|
+
const firstLineUnchanged = originalLines[0] === suggestedLines[0];
|
|
48
|
+
const lastLineUnchanged = originalLines.at(-1) === suggestedLines.at(-1);
|
|
49
|
+
if (originalLines.length === suggestedLines.length || originalLines.length === 1) return firstLineUnchanged || lastLineUnchanged;
|
|
50
|
+
return firstLineUnchanged && lastLineUnchanged;
|
|
51
|
+
}
|
|
52
|
+
function lastNonBlankLineIndex(lines) {
|
|
53
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) if (lines[index]?.trim() !== "") return index;
|
|
54
|
+
return -1;
|
|
55
|
+
}
|
|
56
|
+
function onlyChangesWhitespace(originalLines, suggestedLines) {
|
|
57
|
+
const original = originalLines.join("\n");
|
|
58
|
+
const suggested = suggestedLines.join("\n");
|
|
59
|
+
const originalScan = scanCodeWhitespace(original);
|
|
60
|
+
const suggestedScan = scanCodeWhitespace(suggested);
|
|
61
|
+
if (originalScan.containsCommentSyntax || suggestedScan.containsCommentSyntax) return false;
|
|
62
|
+
return originalScan.stripped === suggestedScan.stripped;
|
|
63
|
+
}
|
|
64
|
+
function scanCodeWhitespace(value) {
|
|
65
|
+
let result = "";
|
|
66
|
+
const state = {
|
|
67
|
+
literalDelimiter: void 0,
|
|
68
|
+
escaped: false,
|
|
69
|
+
regexCharacterClass: false,
|
|
70
|
+
templateExpressionDepths: []
|
|
71
|
+
};
|
|
72
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
73
|
+
const char = value.charAt(index);
|
|
74
|
+
if (advanceCodeLiteralScan(state, char, value[index + 1])) {
|
|
75
|
+
result += char;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (char === "/" && ["/", "*"].includes(value[index + 1] ?? "")) return {
|
|
79
|
+
stripped: result,
|
|
80
|
+
containsCommentSyntax: true
|
|
81
|
+
};
|
|
82
|
+
if (/\s/.test(char)) {
|
|
83
|
+
const nextNonWhitespace = value.slice(index + 1).match(/\S/)?.[0];
|
|
84
|
+
result += codeTokenSeparator(result.at(-1), nextNonWhitespace);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
advanceTemplateExpressionScan(state, char);
|
|
88
|
+
state.literalDelimiter ??= openingCodeLiteralDelimiter(char, value[index + 1], result);
|
|
89
|
+
state.regexCharacterClass = false;
|
|
90
|
+
result += char;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
stripped: result,
|
|
94
|
+
containsCommentSyntax: false
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function codeTokenSeparator(previousChar, nextChar) {
|
|
98
|
+
if (!previousChar || !nextChar) return "";
|
|
99
|
+
if (/[A-Za-z0-9_$]/.test(previousChar) && /[A-Za-z0-9_$]/.test(nextChar)) return " ";
|
|
100
|
+
return [
|
|
101
|
+
"++",
|
|
102
|
+
"--",
|
|
103
|
+
"//",
|
|
104
|
+
"/*",
|
|
105
|
+
"**",
|
|
106
|
+
"??",
|
|
107
|
+
"?.",
|
|
108
|
+
"=>",
|
|
109
|
+
"==",
|
|
110
|
+
"!=",
|
|
111
|
+
"<=",
|
|
112
|
+
">=",
|
|
113
|
+
"&&",
|
|
114
|
+
"||",
|
|
115
|
+
"<<",
|
|
116
|
+
">>"
|
|
117
|
+
].includes(previousChar + nextChar) ? " " : "";
|
|
118
|
+
}
|
|
119
|
+
function advanceCodeLiteralScan(state, char, nextChar) {
|
|
120
|
+
if (!state.literalDelimiter) return false;
|
|
121
|
+
if (state.escaped) {
|
|
122
|
+
state.escaped = false;
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (char === "\\") {
|
|
126
|
+
state.escaped = true;
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
if (state.literalDelimiter.charCodeAt(0) === 96 && char === "$" && nextChar === "{") {
|
|
130
|
+
state.templateExpressionDepths.push(0);
|
|
131
|
+
state.literalDelimiter = void 0;
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
if (state.literalDelimiter !== "/") {
|
|
135
|
+
if (char === state.literalDelimiter) state.literalDelimiter = void 0;
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
advanceRegexLiteralScan(state, char);
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
function advanceTemplateExpressionScan(state, char) {
|
|
142
|
+
const depthIndex = state.templateExpressionDepths.length - 1;
|
|
143
|
+
const depth = state.templateExpressionDepths[depthIndex];
|
|
144
|
+
if (depth === void 0) return;
|
|
145
|
+
if (char === "{") state.templateExpressionDepths[depthIndex] = depth + 1;
|
|
146
|
+
else if (char === "}") if (depth <= 1) {
|
|
147
|
+
state.templateExpressionDepths.pop();
|
|
148
|
+
state.literalDelimiter = "`";
|
|
149
|
+
} else state.templateExpressionDepths[depthIndex] = depth - 1;
|
|
150
|
+
}
|
|
151
|
+
function advanceRegexLiteralScan(state, char) {
|
|
152
|
+
if (char === "[") state.regexCharacterClass = true;
|
|
153
|
+
else if (char === "]") state.regexCharacterClass = false;
|
|
154
|
+
else if (char === "/" && !state.regexCharacterClass) state.literalDelimiter = void 0;
|
|
155
|
+
}
|
|
156
|
+
function openingCodeLiteralDelimiter(char, nextChar, previousCode) {
|
|
157
|
+
if (char === "\"" || char === "'" || char.charCodeAt(0) === 96) return char;
|
|
158
|
+
return startsRegexLiteral(char, nextChar, previousCode) ? "/" : void 0;
|
|
159
|
+
}
|
|
160
|
+
function startsRegexLiteral(char, nextChar, previousCode) {
|
|
161
|
+
const previousChar = previousCode.at(-1);
|
|
162
|
+
const previousWord = previousCode.split(/[^A-Za-z]+/).at(-1);
|
|
163
|
+
const followsRegexKeyword = [
|
|
164
|
+
"return",
|
|
165
|
+
"throw",
|
|
166
|
+
"case",
|
|
167
|
+
"delete",
|
|
168
|
+
"void",
|
|
169
|
+
"typeof",
|
|
170
|
+
"instanceof",
|
|
171
|
+
"in",
|
|
172
|
+
"of",
|
|
173
|
+
"yield",
|
|
174
|
+
"await"
|
|
175
|
+
].includes(previousWord ?? "");
|
|
176
|
+
return char === "/" && nextChar !== "/" && nextChar !== "*" && (previousChar === void 0 || "([{:;,=!?&|+-*%^~<>)".includes(previousChar) || followsRegexKeyword);
|
|
177
|
+
}
|
|
178
|
+
function suggestionIntroducesNewEnvironmentAccess(preview, suggestedFix) {
|
|
179
|
+
const suggestedKeys = environmentAccessKeys(suggestedFix);
|
|
180
|
+
if (suggestedKeys.size === 0) return false;
|
|
181
|
+
const existingKeys = environmentAccessKeys(preview ?? "");
|
|
182
|
+
return Array.from(suggestedKeys).some((key) => !existingKeys.has(key));
|
|
183
|
+
}
|
|
184
|
+
function environmentAccessKeys(value) {
|
|
185
|
+
const keys = /* @__PURE__ */ new Set();
|
|
186
|
+
for (const match of value.matchAll(environmentKeyAccessPattern)) {
|
|
187
|
+
const key = match[1] ?? match[2] ?? match[3] ?? match[4];
|
|
188
|
+
if (key) keys.add(key);
|
|
189
|
+
}
|
|
190
|
+
for (const match of value.matchAll(environmentDestructurePattern)) addDestructuredEnvironmentKeys(keys, match[1] ?? "");
|
|
191
|
+
return keys;
|
|
192
|
+
}
|
|
193
|
+
function addDestructuredEnvironmentKeys(keys, bindings) {
|
|
194
|
+
for (const binding of bindings.split(",")) {
|
|
195
|
+
const key = destructuredEnvironmentKey(binding);
|
|
196
|
+
if (key) keys.add(key);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function destructuredEnvironmentKey(binding) {
|
|
200
|
+
const key = binding.split(/[:=]/, 1)[0]?.trim().replace(/^["']|["']$/g, "");
|
|
201
|
+
return key && !key.startsWith("...") && environmentKeyNamePattern.test(key) ? key : void 0;
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
export { maxInlineFindingBodyCharacters as n, maxInlineFindingBodyLines as r, isPublishableSuggestedFixSelection as t };
|
|
205
|
+
|
|
206
|
+
//# sourceMappingURL=suggested-fix-publication-policy-B5Wwuudp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggested-fix-publication-policy-B5Wwuudp.mjs","names":[],"sources":["../src/review/inline-finding-limits.ts","../src/review/suggested-fix-publication-policy.ts"],"sourcesContent":["export const maxInlineFindingBodyCharacters = 700;\nexport const maxInlineFindingBodyLines = 4;\n","type SuggestedFixPublicationSelection = {\n side: \"RIGHT\" | \"LEFT\";\n kind: \"added\" | \"deleted\" | \"context\" | \"mixed\";\n rangeStartLine: number;\n startLine: number;\n endLine: number;\n preview?: string;\n suggestedFix: string;\n};\n\nconst maxSuggestedFixSelectedLines = 12;\nconst maxSuggestedFixReplacementLines = 20;\nconst environmentKeyAccessPattern =\n /\\b(?:process|Bun|import\\.meta)(?:\\s*\\.|\\s*\\?\\.)\\s*env(?:\\s*(?:\\.|\\?\\.)\\s*([A-Za-z_][A-Za-z0-9_]*)|\\s*\\?\\.\\s*\\[\\s*[\"']([A-Za-z_][A-Za-z0-9_]*)[\"']\\s*\\]|\\s*\\[\\s*[\"']([A-Za-z_][A-Za-z0-9_]*)[\"']\\s*\\])|\\bDeno(?:\\s*\\.|\\s*\\?\\.)\\s*env(?:\\s*\\.|\\s*\\?\\.)\\s*get\\s*\\(\\s*[\"']([A-Za-z_][A-Za-z0-9_]*)[\"']\\s*\\)/g;\nconst environmentDestructurePattern =\n /\\{([^{}]*)\\}\\s*=\\s*(?:process|Bun|import\\.meta)(?:\\s*\\.|\\s*\\?\\.)\\s*env\\b/g;\nconst environmentKeyNamePattern = /^[A-Za-z_][A-Za-z0-9_]*$/;\n\nexport function isPublishableSuggestedFixSelection(\n selection: SuggestedFixPublicationSelection,\n): boolean {\n const suggestedLines = normalizedSuggestedFixLines(selection.suggestedFix);\n const selectedLineCount = selection.endLine - selection.startLine + 1;\n if (\n selection.side !== \"RIGHT\" ||\n selection.kind === \"deleted\" ||\n selectedLineCount > maxSuggestedFixSelectedLines ||\n suggestedLines.length > maxSuggestedFixReplacementLines\n ) {\n return false;\n }\n\n const originalLines = selectedPreviewLines(selection, selectedLineCount);\n if (!originalLines) {\n return false;\n }\n const structuralEdgePattern = /^([{}[\\]()<>]+)[;,]?$/;\n const firstOriginalEdge = originalLines[0]?.trim().match(structuralEdgePattern)?.[1];\n const firstSuggestedEdge = suggestedLines[0]?.trim().match(structuralEdgePattern)?.[1];\n const lastOriginalEdge = originalLines.at(-1)?.trim().match(structuralEdgePattern)?.[1];\n const lastSuggestedEdge = suggestedLines.at(-1)?.trim().match(structuralEdgePattern)?.[1];\n const originalLinesWithoutTrailingBlanks = originalLines.slice(\n 0,\n lastNonBlankLineIndex(originalLines) + 1,\n );\n const suggestedLinesWithoutTrailingBlanks = suggestedLines.slice(\n 0,\n lastNonBlankLineIndex(suggestedLines) + 1,\n );\n const hasTextChange =\n originalLinesWithoutTrailingBlanks.length !== suggestedLinesWithoutTrailingBlanks.length ||\n originalLinesWithoutTrailingBlanks.some(\n (line, index) => line !== suggestedLinesWithoutTrailingBlanks[index],\n );\n return (\n hasTextChange &&\n !onlyChangesWhitespace(\n originalLinesWithoutTrailingBlanks,\n suggestedLinesWithoutTrailingBlanks,\n ) &&\n !suggestionIntroducesNewEnvironmentAccess(selection.preview, selection.suggestedFix) &&\n (firstOriginalEdge === undefined || firstOriginalEdge === firstSuggestedEdge) &&\n (lastOriginalEdge === undefined || lastOriginalEdge === lastSuggestedEdge) &&\n !hasUnchangedSelectionEdge(originalLines, suggestedLines) &&\n !suggestionIncludesUnselectedContext(selection, selectedLineCount, suggestedLines)\n );\n}\n\nfunction normalizedSuggestedFixLines(value: string): string[] {\n const normalized = value.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n const withoutFinalNewline = normalized.endsWith(\"\\n\") ? normalized.slice(0, -1) : normalized;\n return withoutFinalNewline.length === 0 ? [] : withoutFinalNewline.split(\"\\n\");\n}\n\nfunction selectedPreviewLines(\n selection: SuggestedFixPublicationSelection,\n selectedLineCount: number,\n): string[] | undefined {\n if (!selection.preview) {\n return undefined;\n }\n const offset = selection.startLine - selection.rangeStartLine;\n if (offset < 0) {\n return undefined;\n }\n const previewLines = selection.preview.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\").split(\"\\n\");\n if (offset + selectedLineCount > previewLines.length) {\n return undefined;\n }\n return previewLines.slice(offset, offset + selectedLineCount);\n}\n\nfunction suggestionIncludesUnselectedContext(\n selection: SuggestedFixPublicationSelection,\n selectedLineCount: number,\n suggestedLines: string[],\n): boolean {\n if (!selection.preview || suggestedLines.length <= selectedLineCount) {\n return false;\n }\n const offset = selection.startLine - selection.rangeStartLine;\n if (offset < 0) {\n return false;\n }\n const previewLines = selection.preview.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\").split(\"\\n\");\n const contextLines = [\n offset > 0 ? previewLines[offset - 1] : undefined,\n previewLines[offset + selectedLineCount],\n ].filter((line): line is string => Boolean(line?.trim()));\n return contextLines.some((line) => suggestedLines.includes(line));\n}\n\nfunction hasUnchangedSelectionEdge(originalLines: string[], suggestedLines: string[]): boolean {\n const firstLineUnchanged = originalLines[0] === suggestedLines[0];\n const lastLineUnchanged = originalLines.at(-1) === suggestedLines.at(-1);\n if (originalLines.length === suggestedLines.length || originalLines.length === 1) {\n return firstLineUnchanged || lastLineUnchanged;\n }\n return firstLineUnchanged && lastLineUnchanged;\n}\n\nfunction lastNonBlankLineIndex(lines: string[]): number {\n for (let index = lines.length - 1; index >= 0; index -= 1) {\n if (lines[index]?.trim() !== \"\") {\n return index;\n }\n }\n return -1;\n}\n\nfunction onlyChangesWhitespace(originalLines: string[], suggestedLines: string[]): boolean {\n const original = originalLines.join(\"\\n\");\n const suggested = suggestedLines.join(\"\\n\");\n const originalScan = scanCodeWhitespace(original);\n const suggestedScan = scanCodeWhitespace(suggested);\n if (originalScan.containsCommentSyntax || suggestedScan.containsCommentSyntax) {\n return false;\n }\n return originalScan.stripped === suggestedScan.stripped;\n}\n\nfunction scanCodeWhitespace(value: string): {\n stripped: string;\n containsCommentSyntax: boolean;\n} {\n let result = \"\";\n const state: CodeWhitespaceScanState = {\n literalDelimiter: undefined,\n escaped: false,\n regexCharacterClass: false,\n templateExpressionDepths: [],\n };\n\n for (let index = 0; index < value.length; index += 1) {\n const char = value.charAt(index);\n if (advanceCodeLiteralScan(state, char, value[index + 1])) {\n result += char;\n continue;\n }\n if (char === \"/\" && [\"/\", \"*\"].includes(value[index + 1] ?? \"\")) {\n return { stripped: result, containsCommentSyntax: true };\n }\n if (/\\s/.test(char)) {\n const nextNonWhitespace = value.slice(index + 1).match(/\\S/)?.[0];\n result += codeTokenSeparator(result.at(-1), nextNonWhitespace);\n continue;\n }\n advanceTemplateExpressionScan(state, char);\n state.literalDelimiter ??= openingCodeLiteralDelimiter(char, value[index + 1], result);\n state.regexCharacterClass = false;\n result += char;\n }\n\n return { stripped: result, containsCommentSyntax: false };\n}\n\nfunction codeTokenSeparator(\n previousChar: string | undefined,\n nextChar: string | undefined,\n): string {\n if (!previousChar || !nextChar) {\n return \"\";\n }\n if (/[A-Za-z0-9_$]/.test(previousChar) && /[A-Za-z0-9_$]/.test(nextChar)) {\n return \" \";\n }\n const requiresSeparator = [\n \"++\",\n \"--\",\n \"//\",\n \"/*\",\n \"**\",\n \"??\",\n \"?.\",\n \"=>\",\n \"==\",\n \"!=\",\n \"<=\",\n \">=\",\n \"&&\",\n \"||\",\n \"<<\",\n \">>\",\n ].includes(previousChar + nextChar);\n return requiresSeparator ? \" \" : \"\";\n}\n\ntype CodeWhitespaceScanState = {\n literalDelimiter: string | undefined;\n escaped: boolean;\n regexCharacterClass: boolean;\n templateExpressionDepths: number[];\n};\n\nfunction advanceCodeLiteralScan(\n state: CodeWhitespaceScanState,\n char: string,\n nextChar: string | undefined,\n): boolean {\n if (!state.literalDelimiter) {\n return false;\n }\n if (state.escaped) {\n state.escaped = false;\n return true;\n }\n if (char === \"\\\\\") {\n state.escaped = true;\n return true;\n }\n if (state.literalDelimiter.charCodeAt(0) === 96 && char === \"$\" && nextChar === \"{\") {\n state.templateExpressionDepths.push(0);\n state.literalDelimiter = undefined;\n return true;\n }\n if (state.literalDelimiter !== \"/\") {\n if (char === state.literalDelimiter) {\n state.literalDelimiter = undefined;\n }\n return true;\n }\n advanceRegexLiteralScan(state, char);\n return true;\n}\n\nfunction advanceTemplateExpressionScan(state: CodeWhitespaceScanState, char: string): void {\n const depthIndex = state.templateExpressionDepths.length - 1;\n const depth = state.templateExpressionDepths[depthIndex];\n if (depth === undefined) {\n return;\n }\n if (char === \"{\") {\n state.templateExpressionDepths[depthIndex] = depth + 1;\n } else if (char === \"}\") {\n if (depth <= 1) {\n state.templateExpressionDepths.pop();\n state.literalDelimiter = \"`\";\n } else {\n state.templateExpressionDepths[depthIndex] = depth - 1;\n }\n }\n}\n\nfunction advanceRegexLiteralScan(state: CodeWhitespaceScanState, char: string): void {\n if (char === \"[\") {\n state.regexCharacterClass = true;\n } else if (char === \"]\") {\n state.regexCharacterClass = false;\n } else if (char === \"/\" && !state.regexCharacterClass) {\n state.literalDelimiter = undefined;\n }\n}\n\nfunction openingCodeLiteralDelimiter(\n char: string,\n nextChar: string | undefined,\n previousCode: string,\n): string | undefined {\n if (char === '\"' || char === \"'\" || char.charCodeAt(0) === 96) {\n return char;\n }\n return startsRegexLiteral(char, nextChar, previousCode) ? \"/\" : undefined;\n}\n\nfunction startsRegexLiteral(\n char: string,\n nextChar: string | undefined,\n previousCode: string,\n): boolean {\n const previousChar = previousCode.at(-1);\n const previousWord = previousCode.split(/[^A-Za-z]+/).at(-1);\n const followsRegexKeyword = [\n \"return\",\n \"throw\",\n \"case\",\n \"delete\",\n \"void\",\n \"typeof\",\n \"instanceof\",\n \"in\",\n \"of\",\n \"yield\",\n \"await\",\n ].includes(previousWord ?? \"\");\n return (\n char === \"/\" &&\n nextChar !== \"/\" &&\n nextChar !== \"*\" &&\n (previousChar === undefined ||\n \"([{:;,=!?&|+-*%^~<>)\".includes(previousChar) ||\n followsRegexKeyword)\n );\n}\n\nfunction suggestionIntroducesNewEnvironmentAccess(\n preview: string | undefined,\n suggestedFix: string,\n): boolean {\n const suggestedKeys = environmentAccessKeys(suggestedFix);\n if (suggestedKeys.size === 0) {\n return false;\n }\n const existingKeys = environmentAccessKeys(preview ?? \"\");\n return Array.from(suggestedKeys).some((key) => !existingKeys.has(key));\n}\n\nfunction environmentAccessKeys(value: string): Set<string> {\n const keys = new Set<string>();\n for (const match of value.matchAll(environmentKeyAccessPattern)) {\n const key = match[1] ?? match[2] ?? match[3] ?? match[4];\n if (key) {\n keys.add(key);\n }\n }\n for (const match of value.matchAll(environmentDestructurePattern)) {\n addDestructuredEnvironmentKeys(keys, match[1] ?? \"\");\n }\n return keys;\n}\n\nfunction addDestructuredEnvironmentKeys(keys: Set<string>, bindings: string): void {\n for (const binding of bindings.split(\",\")) {\n const key = destructuredEnvironmentKey(binding);\n if (key) {\n keys.add(key);\n }\n }\n}\n\nfunction destructuredEnvironmentKey(binding: string): string | undefined {\n const key = binding\n .split(/[:=]/, 1)[0]\n ?.trim()\n .replace(/^[\"']|[\"']$/g, \"\");\n return key && !key.startsWith(\"...\") && environmentKeyNamePattern.test(key) ? key : undefined;\n}\n"],"mappings":";AAAA,MAAa,iCAAiC;AAC9C,MAAa,4BAA4B;;;ACSzC,MAAM,+BAA+B;AACrC,MAAM,kCAAkC;AACxC,MAAM,8BACJ;AACF,MAAM,gCACJ;AACF,MAAM,4BAA4B;AAElC,SAAgB,mCACd,WACS;CACT,MAAM,iBAAiB,4BAA4B,UAAU,YAAY;CACzE,MAAM,oBAAoB,UAAU,UAAU,UAAU,YAAY;CACpE,IACE,UAAU,SAAS,WACnB,UAAU,SAAS,aACnB,oBAAoB,gCACpB,eAAe,SAAS,iCAExB,OAAO;CAGT,MAAM,gBAAgB,qBAAqB,WAAW,iBAAiB;CACvE,IAAI,CAAC,eACH,OAAO;CAET,MAAM,wBAAwB;CAC9B,MAAM,oBAAoB,cAAc,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,qBAAqB,CAAC,GAAG;CAClF,MAAM,qBAAqB,eAAe,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,qBAAqB,CAAC,GAAG;CACpF,MAAM,mBAAmB,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AAsB,YAAY;CACxD,IAAI,cAAc,SAAS,GACzB,OAAO;CAET,MAAM,eAAe,sBAAsB,WAAW,EAAE;CACxD,OAAO,MAAM,KAAK,aAAa,CAAC,CAAC,MAAM,QAAQ,CAAC,aAAa,IAAI,GAAG,CAAC;AACvE;AAEA,SAAS,sBAAsB,OAA4B;CACzD,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,SAAS,MAAM,SAAS,2BAA2B,GAAG;EAC/D,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM;EACtD,IAAI,KACF,KAAK,IAAI,GAAG;CAEhB;CACA,KAAK,MAAM,SAAS,MAAM,SAAS,6BAA6B,GAC9D,+BAA+B,MAAM,MAAM,MAAM,EAAE;CAErD,OAAO;AACT;AAEA,SAAS,+BAA+B,MAAmB,UAAwB;CACjF,KAAK,MAAM,WAAW,SAAS,MAAM,GAAG,GAAG;EACzC,MAAM,MAAM,2BAA2B,OAAO;EAC9C,IAAI,KACF,KAAK,IAAI,GAAG;CAEhB;AACF;AAEA,SAAS,2BAA2B,SAAqC;CACvE,MAAM,MAAM,QACT,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE,EAClB,KAAK,CAAC,CACP,QAAQ,gBAAgB,EAAE;CAC7B,OAAO,OAAO,CAAC,IAAI,WAAW,KAAK,KAAK,0BAA0B,KAAK,GAAG,IAAI,MAAM,KAAA;AACtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usepipr/runtime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Runtime package for pipr pull request review automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,13 +30,17 @@
|
|
|
30
30
|
"types": "./dist/internal/testing.d.mts",
|
|
31
31
|
"default": "./dist/internal/testing.mjs"
|
|
32
32
|
},
|
|
33
|
+
"./internal/review-testing": {
|
|
34
|
+
"types": "./dist/internal/review-testing.d.mts",
|
|
35
|
+
"default": "./dist/internal/review-testing.mjs"
|
|
36
|
+
},
|
|
33
37
|
"./runtime-tools-extension": {
|
|
34
38
|
"types": "./dist/pi/runtime-tools-extension.d.mts",
|
|
35
39
|
"default": "./dist/pi/runtime-tools-extension.mjs"
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
"scripts": {
|
|
39
|
-
"build": "tsdown src/index.ts src/internal/testing.ts src/pi/runtime-tools-extension.ts --dts --format esm --out-dir dist",
|
|
43
|
+
"build": "tsdown src/index.ts src/internal/testing.ts src/internal/review-testing.ts src/pi/runtime-tools-extension.ts --dts --format esm --out-dir dist",
|
|
40
44
|
"typecheck": "tsc --noEmit",
|
|
41
45
|
"test": "bun test --timeout 60000",
|
|
42
46
|
"test:config-init": "bun test --timeout 60000 src/config/tests/init.test.ts",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"dependencies": {
|
|
51
55
|
"@octokit/rest": "22.0.1",
|
|
52
56
|
"@types/bun": "1.3.14",
|
|
53
|
-
"@usepipr/sdk": "0.3.
|
|
57
|
+
"@usepipr/sdk": "0.3.7",
|
|
54
58
|
"lodash-es": "4.18.1",
|
|
55
59
|
"picomatch": "4.0.5",
|
|
56
60
|
"typescript": "6.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands-C6wfO-y7.d.mts","names":[],"sources":["../src/config/init.ts","../src/types.ts","../src/config/project.ts","../src/review/prior-state.ts","../src/review/comment.ts","../src/review/publication-result.ts","../src/hosts/types.ts","../src/hosts/github/command.ts","../src/hosts/github/publication-client.ts","../src/shared/logging.ts","../src/pi/contract.ts","../src/review/task/task-output.ts","../src/review/task/task-runtime.ts","../src/action/types.ts","../src/action/commands.ts"],"mappings":";;;;KAsBY;EACV;EACA;EACA;;cAGW;KAED,8BAA8B;;;cCCpC,sBAAoB,EAAA;;;;;;;;;;;;;;cAyBpB,kBAAgB,EAAA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