@quikit/quikpilot-runner 9.3.0-rc.86 → 9.3.0-rc.87
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/index.js +632 -606
- package/dist/index.js.map +3 -3
- package/package.json +30 -30
package/dist/index.js
CHANGED
|
@@ -28529,8 +28529,8 @@ function readRunnerEnv(env2 = process.env) {
|
|
|
28529
28529
|
// src/approvedTests.ts
|
|
28530
28530
|
var import_node_child_process4 = require("node:child_process");
|
|
28531
28531
|
var import_node_fs5 = require("node:fs");
|
|
28532
|
-
var
|
|
28533
|
-
var
|
|
28532
|
+
var import_node_os3 = require("node:os");
|
|
28533
|
+
var import_node_path8 = require("node:path");
|
|
28534
28534
|
|
|
28535
28535
|
// src/editsApply.ts
|
|
28536
28536
|
function detectLineEnding(text3) {
|
|
@@ -28555,87 +28555,446 @@ function occurrences(haystack, needle) {
|
|
|
28555
28555
|
}
|
|
28556
28556
|
return found;
|
|
28557
28557
|
}
|
|
28558
|
-
function applyEdits(originalLf, edits) {
|
|
28559
|
-
if (!Array.isArray(edits) || edits.length === 0) {
|
|
28560
|
-
return {
|
|
28561
|
-
ok: false,
|
|
28562
|
-
editCount: 0,
|
|
28563
|
-
refusals: [{ kind: "no_edits", edits: [], matchCount: null, message: "the response carried no edits" }]
|
|
28564
|
-
};
|
|
28565
|
-
}
|
|
28566
|
-
const refusals = [];
|
|
28567
|
-
const ranges = [];
|
|
28568
|
-
edits.forEach((edit, index) => {
|
|
28569
|
-
const number = index + 1;
|
|
28570
|
-
const record2 = edit !== null && typeof edit === "object" ? edit : null;
|
|
28571
|
-
const find = record2?.find;
|
|
28572
|
-
const replace = record2?.replace;
|
|
28573
|
-
if (typeof find !== "string" || typeof replace !== "string") {
|
|
28574
|
-
refusals.push({
|
|
28575
|
-
kind: "empty",
|
|
28576
|
-
edits: [number],
|
|
28577
|
-
matchCount: null,
|
|
28578
|
-
message: `edit ${number} is missing a string find or replace`
|
|
28579
|
-
});
|
|
28580
|
-
return;
|
|
28581
|
-
}
|
|
28582
|
-
if (find === "") {
|
|
28583
|
-
refusals.push({ kind: "empty", edits: [number], matchCount: null, message: `edit ${number} has an empty anchor` });
|
|
28584
|
-
return;
|
|
28585
|
-
}
|
|
28586
|
-
const starts = occurrences(originalLf, find);
|
|
28587
|
-
if (starts.length === 0) {
|
|
28588
|
-
refusals.push({ kind: "no_match", edits: [number], matchCount: 0, message: `edit ${number}: the anchor matched nothing` });
|
|
28589
|
-
} else if (starts.length > 1) {
|
|
28590
|
-
refusals.push({
|
|
28591
|
-
kind: "ambiguous",
|
|
28592
|
-
edits: [number],
|
|
28593
|
-
matchCount: starts.length,
|
|
28594
|
-
matchStarts: starts.slice(0, MAX_MATCH_STARTS),
|
|
28595
|
-
message: `edit ${number}: the anchor matched ${starts.length} times`
|
|
28596
|
-
});
|
|
28597
|
-
} else {
|
|
28598
|
-
ranges.push({ start: starts[0], end: starts[0] + find.length, number, replace });
|
|
28599
|
-
}
|
|
28600
|
-
});
|
|
28601
|
-
for (let i3 = 0; i3 < ranges.length; i3++) {
|
|
28602
|
-
for (let j = i3 + 1; j < ranges.length; j++) {
|
|
28603
|
-
const a = ranges[i3];
|
|
28604
|
-
const b = ranges[j];
|
|
28605
|
-
if (a.start < b.end && b.start < a.end) {
|
|
28606
|
-
const [first, second] = a.number < b.number ? [a.number, b.number] : [b.number, a.number];
|
|
28607
|
-
refusals.push({
|
|
28608
|
-
kind: "overlap",
|
|
28609
|
-
edits: [first, second],
|
|
28610
|
-
matchCount: null,
|
|
28611
|
-
message: `edits ${first} and ${second} overlap`
|
|
28612
|
-
});
|
|
28613
|
-
}
|
|
28614
|
-
}
|
|
28558
|
+
function applyEdits(originalLf, edits) {
|
|
28559
|
+
if (!Array.isArray(edits) || edits.length === 0) {
|
|
28560
|
+
return {
|
|
28561
|
+
ok: false,
|
|
28562
|
+
editCount: 0,
|
|
28563
|
+
refusals: [{ kind: "no_edits", edits: [], matchCount: null, message: "the response carried no edits" }]
|
|
28564
|
+
};
|
|
28565
|
+
}
|
|
28566
|
+
const refusals = [];
|
|
28567
|
+
const ranges = [];
|
|
28568
|
+
edits.forEach((edit, index) => {
|
|
28569
|
+
const number = index + 1;
|
|
28570
|
+
const record2 = edit !== null && typeof edit === "object" ? edit : null;
|
|
28571
|
+
const find = record2?.find;
|
|
28572
|
+
const replace = record2?.replace;
|
|
28573
|
+
if (typeof find !== "string" || typeof replace !== "string") {
|
|
28574
|
+
refusals.push({
|
|
28575
|
+
kind: "empty",
|
|
28576
|
+
edits: [number],
|
|
28577
|
+
matchCount: null,
|
|
28578
|
+
message: `edit ${number} is missing a string find or replace`
|
|
28579
|
+
});
|
|
28580
|
+
return;
|
|
28581
|
+
}
|
|
28582
|
+
if (find === "") {
|
|
28583
|
+
refusals.push({ kind: "empty", edits: [number], matchCount: null, message: `edit ${number} has an empty anchor` });
|
|
28584
|
+
return;
|
|
28585
|
+
}
|
|
28586
|
+
const starts = occurrences(originalLf, find);
|
|
28587
|
+
if (starts.length === 0) {
|
|
28588
|
+
refusals.push({ kind: "no_match", edits: [number], matchCount: 0, message: `edit ${number}: the anchor matched nothing` });
|
|
28589
|
+
} else if (starts.length > 1) {
|
|
28590
|
+
refusals.push({
|
|
28591
|
+
kind: "ambiguous",
|
|
28592
|
+
edits: [number],
|
|
28593
|
+
matchCount: starts.length,
|
|
28594
|
+
matchStarts: starts.slice(0, MAX_MATCH_STARTS),
|
|
28595
|
+
message: `edit ${number}: the anchor matched ${starts.length} times`
|
|
28596
|
+
});
|
|
28597
|
+
} else {
|
|
28598
|
+
ranges.push({ start: starts[0], end: starts[0] + find.length, number, replace });
|
|
28599
|
+
}
|
|
28600
|
+
});
|
|
28601
|
+
for (let i3 = 0; i3 < ranges.length; i3++) {
|
|
28602
|
+
for (let j = i3 + 1; j < ranges.length; j++) {
|
|
28603
|
+
const a = ranges[i3];
|
|
28604
|
+
const b = ranges[j];
|
|
28605
|
+
if (a.start < b.end && b.start < a.end) {
|
|
28606
|
+
const [first, second] = a.number < b.number ? [a.number, b.number] : [b.number, a.number];
|
|
28607
|
+
refusals.push({
|
|
28608
|
+
kind: "overlap",
|
|
28609
|
+
edits: [first, second],
|
|
28610
|
+
matchCount: null,
|
|
28611
|
+
message: `edits ${first} and ${second} overlap`
|
|
28612
|
+
});
|
|
28613
|
+
}
|
|
28614
|
+
}
|
|
28615
|
+
}
|
|
28616
|
+
if (refusals.length > 0) return { ok: false, refusals, editCount: edits.length };
|
|
28617
|
+
const pieces = [];
|
|
28618
|
+
let cursor = 0;
|
|
28619
|
+
for (const range of [...ranges].sort((x, y) => x.start - y.start)) {
|
|
28620
|
+
pieces.push(originalLf.slice(cursor, range.start), range.replace);
|
|
28621
|
+
cursor = range.end;
|
|
28622
|
+
}
|
|
28623
|
+
pieces.push(originalLf.slice(cursor));
|
|
28624
|
+
return { ok: true, content: pieces.join(""), editCount: edits.length };
|
|
28625
|
+
}
|
|
28626
|
+
|
|
28627
|
+
// src/gitSafety.ts
|
|
28628
|
+
var import_node_os = require("node:os");
|
|
28629
|
+
var import_node_path = require("node:path");
|
|
28630
|
+
|
|
28631
|
+
// src/runtimeReplyError.ts
|
|
28632
|
+
var RuntimeReplyError = class extends Error {
|
|
28633
|
+
summary;
|
|
28634
|
+
constructor(message, summary) {
|
|
28635
|
+
super(message);
|
|
28636
|
+
this.name = "RuntimeReplyError";
|
|
28637
|
+
this.summary = summary;
|
|
28638
|
+
}
|
|
28639
|
+
};
|
|
28640
|
+
|
|
28641
|
+
// src/failureReason.ts
|
|
28642
|
+
var MAX_FAILURE_REASON = 1e3;
|
|
28643
|
+
var MIN_SECRET_LENGTH = 8;
|
|
28644
|
+
var CREDENTIAL_PATTERNS = [
|
|
28645
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,
|
|
28646
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}/g,
|
|
28647
|
+
/x-access-token:[^@\s'"]+/gi,
|
|
28648
|
+
// Only the header form ("Authorization: basic <token>"), or a bearer value that contains a digit: a bare
|
|
28649
|
+
// "basic authentication" or "bearer of the news" is prose, not a credential.
|
|
28650
|
+
/\bauthorization:\s*(?:basic|bearer|token)\s+[^\s'"]{8,}/gi,
|
|
28651
|
+
/\bbearer\s+(?=[A-Za-z0-9._~+/=-]*\d)[A-Za-z0-9._~+/=-]{12,}/gi,
|
|
28652
|
+
// A signed JWT is three dot-separated segments; QuikPilot's own run token is an encrypted JWT (alg dir) of five, the
|
|
28653
|
+
// second one empty. The run token is also matched by exact value, but one that has expired or rotated is not the
|
|
28654
|
+
// current value, so its shape has to catch it.
|
|
28655
|
+
/\beyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){2,4}/g
|
|
28656
|
+
];
|
|
28657
|
+
function failureSummary(err2) {
|
|
28658
|
+
if (err2 instanceof RuntimeReplyError) return err2.summary;
|
|
28659
|
+
return err2 instanceof Error ? err2.message : String(err2);
|
|
28660
|
+
}
|
|
28661
|
+
function scrubSecrets(message, secrets = []) {
|
|
28662
|
+
let text3 = message;
|
|
28663
|
+
for (const secret of secrets) {
|
|
28664
|
+
if (secret.length >= MIN_SECRET_LENGTH) text3 = text3.split(secret).join("***");
|
|
28665
|
+
}
|
|
28666
|
+
for (const pattern of CREDENTIAL_PATTERNS) text3 = text3.replace(pattern, "***");
|
|
28667
|
+
return text3;
|
|
28668
|
+
}
|
|
28669
|
+
function describeFailureReason(message, secrets = []) {
|
|
28670
|
+
let text3 = scrubSecrets(message, secrets);
|
|
28671
|
+
text3 = text3.replace(/\s*\n\s*/g, " | ").trim();
|
|
28672
|
+
return text3.length > MAX_FAILURE_REASON ? `${text3.slice(0, MAX_FAILURE_REASON)}\u2026` : text3;
|
|
28673
|
+
}
|
|
28674
|
+
|
|
28675
|
+
// src/scrubForModel.ts
|
|
28676
|
+
var REDACTION_WORDS = ["credential", "private_key", "cloud_key", "url_credentials", "assigned_secret"];
|
|
28677
|
+
function emptyRedactionCounts() {
|
|
28678
|
+
return { credential: 0, private_key: 0, cloud_key: 0, url_credentials: 0, assigned_secret: 0 };
|
|
28679
|
+
}
|
|
28680
|
+
function nonZero(counts) {
|
|
28681
|
+
const out2 = {};
|
|
28682
|
+
for (const w of REDACTION_WORDS) if (counts[w] > 0) out2[w] = counts[w];
|
|
28683
|
+
return out2;
|
|
28684
|
+
}
|
|
28685
|
+
function addRedactionCounts(into, more) {
|
|
28686
|
+
for (const word of REDACTION_WORDS) into[word] += more[word];
|
|
28687
|
+
}
|
|
28688
|
+
var NAMES = "password|passwd|pwd|secret|token|api[_-]?key|access_key|private_key|credential";
|
|
28689
|
+
var PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY-----|$)/g;
|
|
28690
|
+
var CLOUD_KEYS = [
|
|
28691
|
+
/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g,
|
|
28692
|
+
/\bxox[abeprs]-[A-Za-z0-9-]{10,}/g,
|
|
28693
|
+
/\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g,
|
|
28694
|
+
/\bAIza[0-9A-Za-z_-]{35}/g,
|
|
28695
|
+
// QUIKTR-1703: package-registry and container-registry tokens, which have a shape of their own (npm automation tokens, PyPI API tokens,
|
|
28696
|
+
// GitLab personal access tokens, Docker Hub personal access tokens).
|
|
28697
|
+
/\bnpm_[A-Za-z0-9]{30,}\b/g,
|
|
28698
|
+
/\bpypi-[A-Za-z0-9_-]{30,}/g,
|
|
28699
|
+
/\bglpat-[A-Za-z0-9_-]{20,}/g,
|
|
28700
|
+
/\bdckr_pat_[A-Za-z0-9_-]{20,}/g
|
|
28701
|
+
];
|
|
28702
|
+
var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi;
|
|
28703
|
+
var ASSIGNED_QUOTED = new RegExp(`((?<![\\w.-])[\\w.-]{0,40}(?:${NAMES})[\\w.-]{0,40}["']?\\s*[:=]\\s*)(["'])[^"'\\s]{8,}\\2`, "gi");
|
|
28704
|
+
var ASSIGNED_ENV = new RegExp(
|
|
28705
|
+
`^((?:\\d+\\t)?\\s*(?:export\\s+)?[A-Z0-9_]*(?:${NAMES.toUpperCase().replace(/\[_-\]\?/g, "_?")})[A-Z0-9_]*[ \\t]*=[ \\t]*)(?!["'])\\S{8,}`,
|
|
28706
|
+
"gm"
|
|
28707
|
+
);
|
|
28708
|
+
var NAMES_CONFIG = `${NAMES}|passphrase|access[_-]?key|account[_-]?key|_auth(?![a-z])`;
|
|
28709
|
+
var CONFIG_REFERENCE = "(?!\\$\\{|\\$\\(|%\\(|%[A-Za-z_]+%|\\{\\{|\\*\\*\\*)";
|
|
28710
|
+
var CONFIG_PLAIN = "(?!(?:true|false|null|none|yes|no|on|off|\\d{1,3})[ \\t]*(?:[#;]|$))";
|
|
28711
|
+
var CONFIG_QUOTED = new RegExp(
|
|
28712
|
+
`((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}["']?[ \\t]*[:=][ \\t]*)(["'])${CONFIG_REFERENCE}[^"'\\r\\n]+\\2`,
|
|
28713
|
+
"gi"
|
|
28714
|
+
);
|
|
28715
|
+
var CONFIG_UNQUOTED = new RegExp(
|
|
28716
|
+
`((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}[ \\t]*[:=][ \\t]*)${CONFIG_REFERENCE}(?!["'])${CONFIG_PLAIN}[^\\s#;][^\\r\\n]*$`,
|
|
28717
|
+
"gim"
|
|
28718
|
+
);
|
|
28719
|
+
var CONFIG_INLINE = /(?<![\w.-])((?:password|passwd|pwd|passphrase|secret|accountkey|sharedaccesskey|access[_-]?key)[ \t]*=[ \t]*)(?!\$\{|["']|\*\*\*)[^;&"'\s<]+/gi;
|
|
28720
|
+
var CONFIG_XML_ELEMENT = /<([\w.:-]*(?:password|passwd|pwd|passphrase|secret|token|api-?key|access-?key|credential)[\w.:-]*)((?:\s[^>]*)?)>(?![ \t\r\n]*(?:\$\{|\*\*\*))([^<]*\S[^<]*)<\/\1>/gi;
|
|
28721
|
+
var CONFIG_XML_ATTRIBUTE = /(key[ \t]*=[ \t]*["'][^"']*(?:password|token|secret|api-?key)[^"']*["'][ \t]+value[ \t]*=[ \t]*["'])(?!\$\{|\*\*\*)[^"']+(["'])/gi;
|
|
28722
|
+
var CONFIG_FILE = /(^|\/)\.env(\.[^/]*)?$|\.env$|\.(?:properties|ini|cfg|conf|config|toml|ya?ml|xml)$|(^|\/)(?:appsettings|config|settings|secrets|credentials)[^/]*\.json$/i;
|
|
28723
|
+
var TRANSLATION_FILE = /(^|\/)(?:locales?|i18n|l10n|lang|languages|translations?|messages)\/|(^|\/)(?:messages|labels|strings|bundle)[\w-]*\.properties$|_[a-z]{2}(?:_[A-Z]{2})?\.properties$/;
|
|
28724
|
+
function isConfigPath(path) {
|
|
28725
|
+
return CONFIG_FILE.test(path) && !TRANSLATION_FILE.test(path);
|
|
28726
|
+
}
|
|
28727
|
+
function modeForPath(path, base) {
|
|
28728
|
+
return path !== void 0 && isConfigPath(path) ? "config" : base;
|
|
28729
|
+
}
|
|
28730
|
+
function configPathInDiff(text3) {
|
|
28731
|
+
for (const m of text3.matchAll(/^\+\+\+ b\/(.+)$/gm)) if (isConfigPath(m[1])) return m[1];
|
|
28732
|
+
return void 0;
|
|
28733
|
+
}
|
|
28734
|
+
function replaceCounting(text3, pattern, replacement, onHit) {
|
|
28735
|
+
return text3.replace(pattern, (...args2) => {
|
|
28736
|
+
onHit();
|
|
28737
|
+
return typeof replacement === "function" ? replacement(...args2) : replacement;
|
|
28738
|
+
});
|
|
28739
|
+
}
|
|
28740
|
+
function scrubForModel(input, secrets = [], mode = "look") {
|
|
28741
|
+
const counts = emptyRedactionCounts();
|
|
28742
|
+
let text3 = input;
|
|
28743
|
+
text3 = replaceCounting(text3, PRIVATE_KEY, "***", () => counts.private_key += 1);
|
|
28744
|
+
for (const secret of secrets) {
|
|
28745
|
+
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
28746
|
+
const parts2 = text3.split(secret);
|
|
28747
|
+
if (parts2.length > 1) {
|
|
28748
|
+
counts.credential += parts2.length - 1;
|
|
28749
|
+
text3 = parts2.join("***");
|
|
28750
|
+
}
|
|
28751
|
+
}
|
|
28752
|
+
for (const pattern of CREDENTIAL_PATTERNS) text3 = replaceCounting(text3, pattern, "***", () => counts.credential += 1);
|
|
28753
|
+
for (const pattern of CLOUD_KEYS) text3 = replaceCounting(text3, pattern, "***", () => counts.cloud_key += 1);
|
|
28754
|
+
text3 = replaceCounting(text3, URL_CREDENTIALS, (_all, scheme) => `${scheme}***@`, () => counts.url_credentials += 1);
|
|
28755
|
+
if (mode === "look" || mode === "config") {
|
|
28756
|
+
text3 = replaceCounting(text3, ASSIGNED_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, () => counts.assigned_secret += 1);
|
|
28757
|
+
text3 = replaceCounting(text3, ASSIGNED_ENV, (_all, name2) => `${name2}***`, () => counts.assigned_secret += 1);
|
|
28758
|
+
}
|
|
28759
|
+
if (mode === "config") {
|
|
28760
|
+
const hit = () => counts.assigned_secret += 1;
|
|
28761
|
+
text3 = replaceCounting(text3, CONFIG_XML_ELEMENT, (_all, tag, attrs) => `<${tag}${attrs}>***</${tag}>`, hit);
|
|
28762
|
+
text3 = replaceCounting(text3, CONFIG_XML_ATTRIBUTE, (_all, head, quote) => `${head}***${quote}`, hit);
|
|
28763
|
+
text3 = replaceCounting(text3, CONFIG_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, hit);
|
|
28764
|
+
text3 = replaceCounting(text3, CONFIG_INLINE, (_all, name2) => `${name2}***`, hit);
|
|
28765
|
+
text3 = replaceCounting(text3, CONFIG_UNQUOTED, (_all, name2) => `${name2}***`, hit);
|
|
28766
|
+
}
|
|
28767
|
+
return { text: text3, counts };
|
|
28768
|
+
}
|
|
28769
|
+
function makeCodeScrubber(secrets, onHits) {
|
|
28770
|
+
return (text3, path) => {
|
|
28771
|
+
const r = scrubForModel(text3, secrets, modeForPath(path, "code"));
|
|
28772
|
+
if (onHits && REDACTION_WORDS.some((w) => r.counts[w] > 0)) onHits(r.counts);
|
|
28773
|
+
return r.text;
|
|
28774
|
+
};
|
|
28775
|
+
}
|
|
28776
|
+
function scrubEntriesForModel(entries, secrets, keep) {
|
|
28777
|
+
return entries.map((e) => {
|
|
28778
|
+
if (keep && "path" in e && keep.has(e.path)) return e;
|
|
28779
|
+
const path = "path" in e && typeof e.path === "string" ? e.path : void 0;
|
|
28780
|
+
return { ...e, content: scrubForModel(e.content, secrets, modeForPath(path, "code")).text };
|
|
28781
|
+
});
|
|
28782
|
+
}
|
|
28783
|
+
|
|
28784
|
+
// src/commandEnv.ts
|
|
28785
|
+
var ALLOWED_NAMES = /* @__PURE__ */ new Set([
|
|
28786
|
+
// Identity, locale and scratch space.
|
|
28787
|
+
"PATH",
|
|
28788
|
+
"Path",
|
|
28789
|
+
"HOME",
|
|
28790
|
+
"USER",
|
|
28791
|
+
"USERNAME",
|
|
28792
|
+
"LOGNAME",
|
|
28793
|
+
"SHELL",
|
|
28794
|
+
"HOSTNAME",
|
|
28795
|
+
"TMPDIR",
|
|
28796
|
+
"TMP",
|
|
28797
|
+
"TEMP",
|
|
28798
|
+
"TZ",
|
|
28799
|
+
"LANG",
|
|
28800
|
+
"LANGUAGE",
|
|
28801
|
+
"TERM",
|
|
28802
|
+
"COLORTERM",
|
|
28803
|
+
"NO_COLOR",
|
|
28804
|
+
"FORCE_COLOR",
|
|
28805
|
+
"DISPLAY",
|
|
28806
|
+
"CI",
|
|
28807
|
+
// Windows system variables, for the developer machine.
|
|
28808
|
+
"SystemRoot",
|
|
28809
|
+
"SYSTEMROOT",
|
|
28810
|
+
"windir",
|
|
28811
|
+
"COMSPEC",
|
|
28812
|
+
"PATHEXT",
|
|
28813
|
+
"USERPROFILE",
|
|
28814
|
+
"APPDATA",
|
|
28815
|
+
"LOCALAPPDATA",
|
|
28816
|
+
// Network settings a hosted or self-hosted runner may rely on.
|
|
28817
|
+
"HTTP_PROXY",
|
|
28818
|
+
"HTTPS_PROXY",
|
|
28819
|
+
"NO_PROXY",
|
|
28820
|
+
"ALL_PROXY",
|
|
28821
|
+
"http_proxy",
|
|
28822
|
+
"https_proxy",
|
|
28823
|
+
"no_proxy",
|
|
28824
|
+
"all_proxy",
|
|
28825
|
+
"SSL_CERT_FILE",
|
|
28826
|
+
"SSL_CERT_DIR",
|
|
28827
|
+
"NODE_EXTRA_CA_CERTS",
|
|
28828
|
+
"REQUESTS_CA_BUNDLE",
|
|
28829
|
+
"CURL_CA_BUNDLE",
|
|
28830
|
+
// Toolchain locations the setup-* actions and the runner image export.
|
|
28831
|
+
"NODE_OPTIONS",
|
|
28832
|
+
"NODE_PATH",
|
|
28833
|
+
"NVM_DIR",
|
|
28834
|
+
"ImageOS",
|
|
28835
|
+
"ImageVersion",
|
|
28836
|
+
"AGENT_TOOLSDIRECTORY",
|
|
28837
|
+
"CONDA",
|
|
28838
|
+
"pythonLocation",
|
|
28839
|
+
"PKG_CONFIG_PATH",
|
|
28840
|
+
"LD_LIBRARY_PATH",
|
|
28841
|
+
"CARGO_HOME",
|
|
28842
|
+
"RUSTUP_HOME",
|
|
28843
|
+
"GOPATH",
|
|
28844
|
+
"GOMODCACHE",
|
|
28845
|
+
"GOCACHE",
|
|
28846
|
+
"GOFLAGS",
|
|
28847
|
+
"JAVA_HOME",
|
|
28848
|
+
"GRADLE_HOME",
|
|
28849
|
+
"GRADLE_USER_HOME",
|
|
28850
|
+
"MAVEN_HOME",
|
|
28851
|
+
"M2_HOME",
|
|
28852
|
+
"ANDROID_HOME",
|
|
28853
|
+
"ANDROID_SDK_ROOT",
|
|
28854
|
+
"GEM_HOME",
|
|
28855
|
+
"GEM_PATH",
|
|
28856
|
+
"BUNDLE_PATH",
|
|
28857
|
+
"PIPX_HOME",
|
|
28858
|
+
"PIPX_BIN_DIR",
|
|
28859
|
+
"POETRY_HOME",
|
|
28860
|
+
// QUIKTR-1699: PHP projects (Composer, set up by shivammathur/setup-php).
|
|
28861
|
+
"COMPOSER_HOME",
|
|
28862
|
+
"COMPOSER_CACHE_DIR",
|
|
28863
|
+
"COMPOSER_NO_INTERACTION",
|
|
28864
|
+
"PHP_INI_SCAN_DIR",
|
|
28865
|
+
"PNPM_HOME",
|
|
28866
|
+
"BUN_INSTALL",
|
|
28867
|
+
"DENO_INSTALL",
|
|
28868
|
+
"DENO_DIR",
|
|
28869
|
+
"VOLTA_HOME",
|
|
28870
|
+
"COREPACK_HOME",
|
|
28871
|
+
"PYENV_ROOT",
|
|
28872
|
+
"RBENV_ROOT",
|
|
28873
|
+
// QUIKTR-1703: settings a project's own steps export for its tests and that carry no secret: where Go, Python, .NET and Rust look for
|
|
28874
|
+
// things and how they behave. A path, a flag, a pattern list; never a login (those are withheld by name below).
|
|
28875
|
+
"GOPRIVATE",
|
|
28876
|
+
"GONOSUMDB",
|
|
28877
|
+
"GONOSUMCHECK",
|
|
28878
|
+
"GOSUMDB",
|
|
28879
|
+
"GOTOOLCHAIN",
|
|
28880
|
+
"GOOS",
|
|
28881
|
+
"GOARCH",
|
|
28882
|
+
"CGO_ENABLED",
|
|
28883
|
+
"VIRTUAL_ENV",
|
|
28884
|
+
"PYTHONPATH",
|
|
28885
|
+
"PYTHONDONTWRITEBYTECODE",
|
|
28886
|
+
"PYTHONUNBUFFERED",
|
|
28887
|
+
"PYTHONHASHSEED",
|
|
28888
|
+
"PIP_CACHE_DIR",
|
|
28889
|
+
"PIP_NO_INPUT",
|
|
28890
|
+
"PIP_DISABLE_PIP_VERSION_CHECK",
|
|
28891
|
+
"UV_CACHE_DIR",
|
|
28892
|
+
"UV_PYTHON",
|
|
28893
|
+
"NODE_ENV",
|
|
28894
|
+
"NUGET_PACKAGES",
|
|
28895
|
+
"NUGET_HTTP_CACHE_PATH",
|
|
28896
|
+
"CARGO_TARGET_DIR",
|
|
28897
|
+
"CARGO_INCREMENTAL",
|
|
28898
|
+
"RUST_BACKTRACE",
|
|
28899
|
+
"RUST_LOG",
|
|
28900
|
+
// ... and these, which CAN carry a login inside their value (a registry address with `user:pass@`, a Java option `-D...password=`):
|
|
28901
|
+
// kept only when the value is clean (`valueIsClean`).
|
|
28902
|
+
"GOPROXY",
|
|
28903
|
+
"PIP_INDEX_URL",
|
|
28904
|
+
"PIP_EXTRA_INDEX_URL",
|
|
28905
|
+
"UV_INDEX_URL",
|
|
28906
|
+
"UV_DEFAULT_INDEX",
|
|
28907
|
+
"MAVEN_OPTS",
|
|
28908
|
+
"JAVA_TOOL_OPTIONS",
|
|
28909
|
+
"JAVA_OPTS",
|
|
28910
|
+
"GRADLE_OPTS",
|
|
28911
|
+
"RUSTFLAGS"
|
|
28912
|
+
]);
|
|
28913
|
+
var VALUE_CHECKED_NAMES = /* @__PURE__ */ new Set([
|
|
28914
|
+
"GOPROXY",
|
|
28915
|
+
"PIP_INDEX_URL",
|
|
28916
|
+
"PIP_EXTRA_INDEX_URL",
|
|
28917
|
+
"UV_INDEX_URL",
|
|
28918
|
+
"UV_DEFAULT_INDEX",
|
|
28919
|
+
"MAVEN_OPTS",
|
|
28920
|
+
"JAVA_TOOL_OPTIONS",
|
|
28921
|
+
"JAVA_OPTS",
|
|
28922
|
+
"GRADLE_OPTS",
|
|
28923
|
+
"RUSTFLAGS"
|
|
28924
|
+
]);
|
|
28925
|
+
var OPTION_WITH_LOGIN = /(?:^|\s)(?:-D|--)[\w.-]*(?:password|passwd|pwd|token|secret|credential|api[_-]?key|passphrase)[\w.-]*[= ]/i;
|
|
28926
|
+
function valueIsClean(value) {
|
|
28927
|
+
if (OPTION_WITH_LOGIN.test(value)) return false;
|
|
28928
|
+
const counts = scrubForModel(value, [], "code").counts;
|
|
28929
|
+
return REDACTION_WORDS.every((word) => counts[word] === 0);
|
|
28930
|
+
}
|
|
28931
|
+
var ALLOWED_PREFIXES = [
|
|
28932
|
+
"LC_",
|
|
28933
|
+
"RUNNER_",
|
|
28934
|
+
"GITHUB_",
|
|
28935
|
+
"JAVA_HOME_",
|
|
28936
|
+
"GOROOT",
|
|
28937
|
+
"ANDROID_NDK",
|
|
28938
|
+
"Python",
|
|
28939
|
+
// Python_ROOT_DIR, Python2_ROOT_DIR, Python3_ROOT_DIR
|
|
28940
|
+
"XDG_",
|
|
28941
|
+
"DOTNET_",
|
|
28942
|
+
"VCPKG_",
|
|
28943
|
+
"npm_config_",
|
|
28944
|
+
"NPM_CONFIG_"
|
|
28945
|
+
];
|
|
28946
|
+
var ALWAYS_WITHHELD = /* @__PURE__ */ new Set([
|
|
28947
|
+
"GITHUB_TOKEN",
|
|
28948
|
+
"GITHUB_ENV",
|
|
28949
|
+
"GITHUB_PATH",
|
|
28950
|
+
"GITHUB_OUTPUT",
|
|
28951
|
+
"GITHUB_STATE",
|
|
28952
|
+
"GITHUB_STEP_SUMMARY"
|
|
28953
|
+
]);
|
|
28954
|
+
var CREDENTIAL_NAME = /(token|secret|password|passwd|credential|private_?key|api_?key|(?:^|_)auth(?:$|_))/i;
|
|
28955
|
+
function isAllowed(name2) {
|
|
28956
|
+
if (ALWAYS_WITHHELD.has(name2) || CREDENTIAL_NAME.test(name2)) return false;
|
|
28957
|
+
if (ALLOWED_NAMES.has(name2)) return true;
|
|
28958
|
+
return ALLOWED_PREFIXES.some((prefix) => name2.startsWith(prefix));
|
|
28959
|
+
}
|
|
28960
|
+
function keeps(name2, value) {
|
|
28961
|
+
return isAllowed(name2) && (!VALUE_CHECKED_NAMES.has(name2) || valueIsClean(value));
|
|
28962
|
+
}
|
|
28963
|
+
function commandEnv(source = process.env) {
|
|
28964
|
+
const out2 = {};
|
|
28965
|
+
for (const [name2, value] of Object.entries(source)) {
|
|
28966
|
+
if (value === void 0) continue;
|
|
28967
|
+
if (keeps(name2, value)) out2[name2] = value;
|
|
28615
28968
|
}
|
|
28616
|
-
|
|
28617
|
-
|
|
28618
|
-
|
|
28619
|
-
|
|
28620
|
-
|
|
28621
|
-
|
|
28969
|
+
return out2;
|
|
28970
|
+
}
|
|
28971
|
+
function withheldNames(source = process.env) {
|
|
28972
|
+
return Object.entries(source).filter(([name2, value]) => value !== void 0 && !keeps(name2, value)).map(([name2]) => name2).sort();
|
|
28973
|
+
}
|
|
28974
|
+
|
|
28975
|
+
// src/gitSafety.ts
|
|
28976
|
+
var NO_HOOKS_DIR = (0, import_node_path.join)((0, import_node_os.tmpdir)(), "quikpilot-no-git-hooks-never-created");
|
|
28977
|
+
var NO_HOOKS_ARGS = ["-c", `core.hooksPath=${NO_HOOKS_DIR}`];
|
|
28978
|
+
function gitEnv(extra = {}, source = process.env) {
|
|
28979
|
+
const env2 = commandEnv(source);
|
|
28980
|
+
for (const [name2, value] of Object.entries(source)) {
|
|
28981
|
+
if (value !== void 0 && name2.startsWith("GIT_")) env2[name2] = value;
|
|
28622
28982
|
}
|
|
28623
|
-
|
|
28624
|
-
return { ok: true, content: pieces.join(""), editCount: edits.length };
|
|
28983
|
+
return { ...env2, ...extra };
|
|
28625
28984
|
}
|
|
28626
28985
|
|
|
28627
28986
|
// src/proposal.ts
|
|
28628
28987
|
var import_node_child_process3 = require("node:child_process");
|
|
28629
28988
|
var import_node_fs4 = require("node:fs");
|
|
28630
|
-
var
|
|
28631
|
-
var
|
|
28989
|
+
var import_node_os2 = require("node:os");
|
|
28990
|
+
var import_node_path7 = require("node:path");
|
|
28632
28991
|
|
|
28633
28992
|
// src/git.ts
|
|
28634
28993
|
var import_node_child_process = require("node:child_process");
|
|
28635
28994
|
var import_node_fs = require("node:fs");
|
|
28636
28995
|
|
|
28637
28996
|
// src/targetingPaths.ts
|
|
28638
|
-
var
|
|
28997
|
+
var import_node_path2 = require("node:path");
|
|
28639
28998
|
|
|
28640
28999
|
// src/deniedPaths.ts
|
|
28641
29000
|
function globToRegExp(pattern) {
|
|
@@ -28685,7 +29044,7 @@ function normaliseToolPath(raw, options = {}) {
|
|
|
28685
29044
|
if (raw.includes("\\")) return { ok: false, reason: "path_invalid" };
|
|
28686
29045
|
if (raw.startsWith("/") || /^[A-Za-z]:/.test(raw)) return { ok: false, reason: "path_invalid" };
|
|
28687
29046
|
if (raw.split("/").includes("..")) return { ok: false, reason: "outside_workspace" };
|
|
28688
|
-
const normalised =
|
|
29047
|
+
const normalised = import_node_path2.posix.normalize(raw).replace(/\/+$/, "");
|
|
28689
29048
|
if (normalised === "" || normalised === ".") {
|
|
28690
29049
|
return allowRoot ? { ok: true, path: "" } : { ok: false, reason: "path_invalid" };
|
|
28691
29050
|
}
|
|
@@ -28701,9 +29060,9 @@ function buildVisibleListing(listing, deniedPaths) {
|
|
|
28701
29060
|
|
|
28702
29061
|
// src/git.ts
|
|
28703
29062
|
function git(args2, extraEnv = {}) {
|
|
28704
|
-
return (0, import_node_child_process.execFileSync)("git", args2, {
|
|
29063
|
+
return (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], {
|
|
28705
29064
|
encoding: "utf8",
|
|
28706
|
-
env:
|
|
29065
|
+
env: gitEnv(extraEnv)
|
|
28707
29066
|
}).trim();
|
|
28708
29067
|
}
|
|
28709
29068
|
function headCommit() {
|
|
@@ -28729,8 +29088,9 @@ function addAll(scope) {
|
|
|
28729
29088
|
}
|
|
28730
29089
|
}
|
|
28731
29090
|
function changedOutside(scope) {
|
|
28732
|
-
const out2 = (0, import_node_child_process.execFileSync)("git", ["status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
|
|
29091
|
+
const out2 = (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
|
|
28733
29092
|
encoding: "utf8",
|
|
29093
|
+
env: gitEnv(),
|
|
28734
29094
|
maxBuffer: 64 * 1024 * 1024
|
|
28735
29095
|
});
|
|
28736
29096
|
return out2.split("\0").filter((entry) => entry.length > 3).map((entry) => entry.slice(3)).filter((path) => !matchesPrefix(path, scope) && !matchesPrefix(path, RUNNER_OWN_FOLDER));
|
|
@@ -28740,12 +29100,12 @@ function diffCachedNamesMatching(pattern) {
|
|
|
28740
29100
|
return out2 ? out2.split("\n").filter(Boolean) : [];
|
|
28741
29101
|
}
|
|
28742
29102
|
function listFiles(pathspec) {
|
|
28743
|
-
const out2 = (0, import_node_child_process.execFileSync)("git", ["ls-files", "-z", "--", pathspec], { encoding: "utf8", maxBuffer: LIST_MAX_BUFFER_BYTES });
|
|
29103
|
+
const out2 = (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "ls-files", "-z", "--", pathspec], { encoding: "utf8", maxBuffer: LIST_MAX_BUFFER_BYTES, env: gitEnv() });
|
|
28744
29104
|
return out2.split("\0").filter(Boolean);
|
|
28745
29105
|
}
|
|
28746
29106
|
function hasStagedChanges() {
|
|
28747
29107
|
try {
|
|
28748
|
-
(0, import_node_child_process.execFileSync)("git", ["diff", "--cached", "--quiet"]);
|
|
29108
|
+
(0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "diff", "--cached", "--quiet"], { env: gitEnv() });
|
|
28749
29109
|
return false;
|
|
28750
29110
|
} catch {
|
|
28751
29111
|
return true;
|
|
@@ -28884,7 +29244,7 @@ var GIT_MAX_BUFFER = 32 * 1024 * 1024;
|
|
|
28884
29244
|
var MAX_COMMITS_LOOKED_AT = 400;
|
|
28885
29245
|
var WALK_BUDGET_MS = 25e3;
|
|
28886
29246
|
var SHA = /^[0-9a-f]{40}$/;
|
|
28887
|
-
var readGit = (args2) => (0, import_node_child_process2.execFileSync)("git", args2, { encoding: "utf8", timeout: GIT_TIMEOUT_MS, maxBuffer: GIT_MAX_BUFFER, stdio: ["ignore", "pipe", "ignore"] });
|
|
29247
|
+
var readGit = (args2) => (0, import_node_child_process2.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), encoding: "utf8", timeout: GIT_TIMEOUT_MS, maxBuffer: GIT_MAX_BUFFER, stdio: ["ignore", "pipe", "ignore"] });
|
|
28888
29248
|
function parseFileCommits(log) {
|
|
28889
29249
|
const out2 = [];
|
|
28890
29250
|
for (const block of log.split("")) {
|
|
@@ -36574,7 +36934,7 @@ function setupAdded(input) {
|
|
|
36574
36934
|
}
|
|
36575
36935
|
|
|
36576
36936
|
// src/featureTestUpdates.ts
|
|
36577
|
-
var
|
|
36937
|
+
var import_node_path3 = require("node:path");
|
|
36578
36938
|
var FEATURE_TEST_UPDATES_KEY = "featureTestUpdates";
|
|
36579
36939
|
function featureTestUpdatesOn(env2 = process.env) {
|
|
36580
36940
|
return env2.QUIKPILOT_FEATURE_TEST_UPDATES?.trim().toLowerCase() === "on";
|
|
@@ -36593,7 +36953,7 @@ var WEAK_TEST_FOLDER = /(^|\/)(tests?|spec|testutil|testing)\//;
|
|
|
36593
36953
|
function isTestSupportPath(path, listing, discovered) {
|
|
36594
36954
|
if (!listing.includes(path)) return false;
|
|
36595
36955
|
if (isTestTarget(path, discovered ? new Set(discovered) : null)) return true;
|
|
36596
|
-
if (STRONG_TEST_FOLDER.test(path) ||
|
|
36956
|
+
if (STRONG_TEST_FOLDER.test(path) || import_node_path3.posix.basename(path) === "conftest.py") return true;
|
|
36597
36957
|
const weak = WEAK_TEST_FOLDER.exec(path);
|
|
36598
36958
|
if (!weak) return false;
|
|
36599
36959
|
if (!discovered) return true;
|
|
@@ -36606,9 +36966,9 @@ var stripExt = (p) => p.replace(/\.[cm]?[jt]sx?$/i, "");
|
|
|
36606
36966
|
var escapeRegExp3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36607
36967
|
function jsNames(spec, from, helper) {
|
|
36608
36968
|
const target = stripExt(helper);
|
|
36609
|
-
const targets = [target, ...
|
|
36969
|
+
const targets = [target, ...import_node_path3.posix.basename(target) === "index" ? [import_node_path3.posix.dirname(target)] : []];
|
|
36610
36970
|
if (spec.startsWith(".")) {
|
|
36611
|
-
const resolved = stripExt(
|
|
36971
|
+
const resolved = stripExt(import_node_path3.posix.normalize(import_node_path3.posix.join(import_node_path3.posix.dirname(from), spec)));
|
|
36612
36972
|
return targets.includes(resolved);
|
|
36613
36973
|
}
|
|
36614
36974
|
const rest = stripExt(spec.replace(/^[@~#]\//, ""));
|
|
@@ -36620,8 +36980,8 @@ function usesHelper(from, text3, helper) {
|
|
|
36620
36980
|
if (from === helper) return false;
|
|
36621
36981
|
if (/\.[cm]?[jt]sx?$/i.test(helper)) return [...text3.matchAll(JS_SPECIFIER)].some((m) => jsNames(m[1], from, helper));
|
|
36622
36982
|
if (helper.endsWith(".py")) {
|
|
36623
|
-
if (
|
|
36624
|
-
const dir =
|
|
36983
|
+
if (import_node_path3.posix.basename(helper) === "conftest.py") {
|
|
36984
|
+
const dir = import_node_path3.posix.dirname(helper);
|
|
36625
36985
|
return dir === "." || from.startsWith(`${dir}/`);
|
|
36626
36986
|
}
|
|
36627
36987
|
const dotted = helper.slice(0, -3).split("/").join(".");
|
|
@@ -36631,11 +36991,11 @@ function usesHelper(from, text3, helper) {
|
|
|
36631
36991
|
});
|
|
36632
36992
|
}
|
|
36633
36993
|
if (helper.endsWith(".go")) {
|
|
36634
|
-
const dir =
|
|
36635
|
-
return
|
|
36994
|
+
const dir = import_node_path3.posix.dirname(helper);
|
|
36995
|
+
return import_node_path3.posix.dirname(from) === dir || dir !== "." && new RegExp(`"[^"]*(^|/)${escapeRegExp3(dir)}"`).test(text3);
|
|
36636
36996
|
}
|
|
36637
36997
|
if (helper.endsWith(".java") || helper.endsWith(".kt")) {
|
|
36638
|
-
const name2 =
|
|
36998
|
+
const name2 = import_node_path3.posix.basename(helper).replace(/\.(java|kt)$/, "");
|
|
36639
36999
|
return new RegExp(`\\b${escapeRegExp3(name2)}\\b`).test(text3);
|
|
36640
37000
|
}
|
|
36641
37001
|
return false;
|
|
@@ -36652,7 +37012,7 @@ function usedByOf(helper, testFiles, read) {
|
|
|
36652
37012
|
|
|
36653
37013
|
// src/targetingTools.ts
|
|
36654
37014
|
var import_node_fs2 = require("node:fs");
|
|
36655
|
-
var
|
|
37015
|
+
var import_node_path5 = require("node:path");
|
|
36656
37016
|
|
|
36657
37017
|
// src/genericDenies.ts
|
|
36658
37018
|
var OTHER_LOCK_FILES = [
|
|
@@ -36719,12 +37079,13 @@ var CREDENTIAL_FILES = [
|
|
|
36719
37079
|
"**/*.ppk"
|
|
36720
37080
|
];
|
|
36721
37081
|
var GIT_INTERNALS = [".git/**"];
|
|
37082
|
+
var HOOK_FILES = ["**/.husky/**", "**/.githooks/**", "**/lefthook*.yml", "**/.lefthook*.yml"];
|
|
36722
37083
|
function withExtra(denied, extra) {
|
|
36723
37084
|
const have = new Set(denied);
|
|
36724
37085
|
return [...denied, ...extra.filter((p) => !have.has(p))];
|
|
36725
37086
|
}
|
|
36726
37087
|
function writeDenied(denied) {
|
|
36727
|
-
return withExtra(denied, [...OTHER_LOCK_FILES, ...CREDENTIAL_FILES, ...GIT_INTERNALS]);
|
|
37088
|
+
return withExtra(denied, [...OTHER_LOCK_FILES, ...CREDENTIAL_FILES, ...GIT_INTERNALS, ...HOOK_FILES]);
|
|
36728
37089
|
}
|
|
36729
37090
|
function readDenied(denied) {
|
|
36730
37091
|
return withExtra(writeDenied(denied), SECRET_SHAPED_FILES);
|
|
@@ -36735,170 +37096,17 @@ function listingForWire(listing, deniedPaths) {
|
|
|
36735
37096
|
}
|
|
36736
37097
|
var NON_TEXT_EXTENSION_RE = /\.(png|jpe?g|gif|webp|avif|ico|icns|bmp|tiff?|psd|mp[34]|m4a|mov|avi|webm|mkv|wav|ogg|flac|woff2?|ttf|otf|eot|pdf|zip|gz|tgz|bz2|xz|7z|rar|jar|war|wasm|exe|dll|so|dylib|pyc|class|o|a|sqlite3?|db)$/i;
|
|
36737
37098
|
function isGeneratedText(lf) {
|
|
36738
|
-
let start3 = 0;
|
|
36739
|
-
for (let line2 = 0; line2 < 5 && start3 <= lf.length; line2++) {
|
|
36740
|
-
const end = lf.indexOf("\n", start3);
|
|
36741
|
-
const text3 = end === -1 ? lf.slice(start3) : lf.slice(start3, end);
|
|
36742
|
-
if (text3.includes("@generated") || text3.includes("DO NOT EDIT")) return true;
|
|
36743
|
-
if (end === -1) break;
|
|
36744
|
-
start3 = end + 1;
|
|
36745
|
-
}
|
|
36746
|
-
return false;
|
|
36747
|
-
}
|
|
36748
|
-
var GENERATED_FILE_MESSAGE = "This file is generated (its first lines say so), so a change here would be overwritten. Change the file it is generated from instead.";
|
|
36749
|
-
|
|
36750
|
-
// src/runtimeReplyError.ts
|
|
36751
|
-
var RuntimeReplyError = class extends Error {
|
|
36752
|
-
summary;
|
|
36753
|
-
constructor(message, summary) {
|
|
36754
|
-
super(message);
|
|
36755
|
-
this.name = "RuntimeReplyError";
|
|
36756
|
-
this.summary = summary;
|
|
36757
|
-
}
|
|
36758
|
-
};
|
|
36759
|
-
|
|
36760
|
-
// src/failureReason.ts
|
|
36761
|
-
var MAX_FAILURE_REASON = 1e3;
|
|
36762
|
-
var MIN_SECRET_LENGTH = 8;
|
|
36763
|
-
var CREDENTIAL_PATTERNS = [
|
|
36764
|
-
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,
|
|
36765
|
-
/\bgithub_pat_[A-Za-z0-9_]{20,}/g,
|
|
36766
|
-
/x-access-token:[^@\s'"]+/gi,
|
|
36767
|
-
// Only the header form ("Authorization: basic <token>"), or a bearer value that contains a digit: a bare
|
|
36768
|
-
// "basic authentication" or "bearer of the news" is prose, not a credential.
|
|
36769
|
-
/\bauthorization:\s*(?:basic|bearer|token)\s+[^\s'"]{8,}/gi,
|
|
36770
|
-
/\bbearer\s+(?=[A-Za-z0-9._~+/=-]*\d)[A-Za-z0-9._~+/=-]{12,}/gi,
|
|
36771
|
-
// A signed JWT is three dot-separated segments; QuikPilot's own run token is an encrypted JWT (alg dir) of five, the
|
|
36772
|
-
// second one empty. The run token is also matched by exact value, but one that has expired or rotated is not the
|
|
36773
|
-
// current value, so its shape has to catch it.
|
|
36774
|
-
/\beyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){2,4}/g
|
|
36775
|
-
];
|
|
36776
|
-
function failureSummary(err2) {
|
|
36777
|
-
if (err2 instanceof RuntimeReplyError) return err2.summary;
|
|
36778
|
-
return err2 instanceof Error ? err2.message : String(err2);
|
|
36779
|
-
}
|
|
36780
|
-
function scrubSecrets(message, secrets = []) {
|
|
36781
|
-
let text3 = message;
|
|
36782
|
-
for (const secret of secrets) {
|
|
36783
|
-
if (secret.length >= MIN_SECRET_LENGTH) text3 = text3.split(secret).join("***");
|
|
36784
|
-
}
|
|
36785
|
-
for (const pattern of CREDENTIAL_PATTERNS) text3 = text3.replace(pattern, "***");
|
|
36786
|
-
return text3;
|
|
36787
|
-
}
|
|
36788
|
-
function describeFailureReason(message, secrets = []) {
|
|
36789
|
-
let text3 = scrubSecrets(message, secrets);
|
|
36790
|
-
text3 = text3.replace(/\s*\n\s*/g, " | ").trim();
|
|
36791
|
-
return text3.length > MAX_FAILURE_REASON ? `${text3.slice(0, MAX_FAILURE_REASON)}\u2026` : text3;
|
|
36792
|
-
}
|
|
36793
|
-
|
|
36794
|
-
// src/scrubForModel.ts
|
|
36795
|
-
var REDACTION_WORDS = ["credential", "private_key", "cloud_key", "url_credentials", "assigned_secret"];
|
|
36796
|
-
function emptyRedactionCounts() {
|
|
36797
|
-
return { credential: 0, private_key: 0, cloud_key: 0, url_credentials: 0, assigned_secret: 0 };
|
|
36798
|
-
}
|
|
36799
|
-
function nonZero(counts) {
|
|
36800
|
-
const out2 = {};
|
|
36801
|
-
for (const w of REDACTION_WORDS) if (counts[w] > 0) out2[w] = counts[w];
|
|
36802
|
-
return out2;
|
|
36803
|
-
}
|
|
36804
|
-
function addRedactionCounts(into, more) {
|
|
36805
|
-
for (const word of REDACTION_WORDS) into[word] += more[word];
|
|
36806
|
-
}
|
|
36807
|
-
var NAMES = "password|passwd|pwd|secret|token|api[_-]?key|access_key|private_key|credential";
|
|
36808
|
-
var PRIVATE_KEY = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY-----|$)/g;
|
|
36809
|
-
var CLOUD_KEYS = [
|
|
36810
|
-
/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g,
|
|
36811
|
-
/\bxox[abeprs]-[A-Za-z0-9-]{10,}/g,
|
|
36812
|
-
/\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g,
|
|
36813
|
-
/\bAIza[0-9A-Za-z_-]{35}/g,
|
|
36814
|
-
// QUIKTR-1703: package-registry and container-registry tokens, which have a shape of their own (npm automation tokens, PyPI API tokens,
|
|
36815
|
-
// GitLab personal access tokens, Docker Hub personal access tokens).
|
|
36816
|
-
/\bnpm_[A-Za-z0-9]{30,}\b/g,
|
|
36817
|
-
/\bpypi-[A-Za-z0-9_-]{30,}/g,
|
|
36818
|
-
/\bglpat-[A-Za-z0-9_-]{20,}/g,
|
|
36819
|
-
/\bdckr_pat_[A-Za-z0-9_-]{20,}/g
|
|
36820
|
-
];
|
|
36821
|
-
var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi;
|
|
36822
|
-
var ASSIGNED_QUOTED = new RegExp(`((?<![\\w.-])[\\w.-]{0,40}(?:${NAMES})[\\w.-]{0,40}["']?\\s*[:=]\\s*)(["'])[^"'\\s]{8,}\\2`, "gi");
|
|
36823
|
-
var ASSIGNED_ENV = new RegExp(
|
|
36824
|
-
`^((?:\\d+\\t)?\\s*(?:export\\s+)?[A-Z0-9_]*(?:${NAMES.toUpperCase().replace(/\[_-\]\?/g, "_?")})[A-Z0-9_]*[ \\t]*=[ \\t]*)(?!["'])\\S{8,}`,
|
|
36825
|
-
"gm"
|
|
36826
|
-
);
|
|
36827
|
-
var NAMES_CONFIG = `${NAMES}|passphrase|access[_-]?key|account[_-]?key|_auth(?![a-z])`;
|
|
36828
|
-
var CONFIG_REFERENCE = "(?!\\$\\{|\\$\\(|%\\(|%[A-Za-z_]+%|\\{\\{|\\*\\*\\*)";
|
|
36829
|
-
var CONFIG_PLAIN = "(?!(?:true|false|null|none|yes|no|on|off|\\d{1,3})[ \\t]*(?:[#;]|$))";
|
|
36830
|
-
var CONFIG_QUOTED = new RegExp(
|
|
36831
|
-
`((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}["']?[ \\t]*[:=][ \\t]*)(["'])${CONFIG_REFERENCE}[^"'\\r\\n]+\\2`,
|
|
36832
|
-
"gi"
|
|
36833
|
-
);
|
|
36834
|
-
var CONFIG_UNQUOTED = new RegExp(
|
|
36835
|
-
`((?<![\\w.-])[\\w.-]{0,60}(?:${NAMES_CONFIG})[\\w.-]{0,40}[ \\t]*[:=][ \\t]*)${CONFIG_REFERENCE}(?!["'])${CONFIG_PLAIN}[^\\s#;][^\\r\\n]*$`,
|
|
36836
|
-
"gim"
|
|
36837
|
-
);
|
|
36838
|
-
var CONFIG_INLINE = /(?<![\w.-])((?:password|passwd|pwd|passphrase|secret|accountkey|sharedaccesskey|access[_-]?key)[ \t]*=[ \t]*)(?!\$\{|["']|\*\*\*)[^;&"'\s<]+/gi;
|
|
36839
|
-
var CONFIG_XML_ELEMENT = /<([\w.:-]*(?:password|passwd|pwd|passphrase|secret|token|api-?key|access-?key|credential)[\w.:-]*)((?:\s[^>]*)?)>(?![ \t\r\n]*(?:\$\{|\*\*\*))([^<]*\S[^<]*)<\/\1>/gi;
|
|
36840
|
-
var CONFIG_XML_ATTRIBUTE = /(key[ \t]*=[ \t]*["'][^"']*(?:password|token|secret|api-?key)[^"']*["'][ \t]+value[ \t]*=[ \t]*["'])(?!\$\{|\*\*\*)[^"']+(["'])/gi;
|
|
36841
|
-
var CONFIG_FILE = /(^|\/)\.env(\.[^/]*)?$|\.env$|\.(?:properties|ini|cfg|conf|config|toml|ya?ml|xml)$|(^|\/)(?:appsettings|config|settings|secrets|credentials)[^/]*\.json$/i;
|
|
36842
|
-
var TRANSLATION_FILE = /(^|\/)(?:locales?|i18n|l10n|lang|languages|translations?|messages)\/|(^|\/)(?:messages|labels|strings|bundle)[\w-]*\.properties$|_[a-z]{2}(?:_[A-Z]{2})?\.properties$/;
|
|
36843
|
-
function isConfigPath(path) {
|
|
36844
|
-
return CONFIG_FILE.test(path) && !TRANSLATION_FILE.test(path);
|
|
36845
|
-
}
|
|
36846
|
-
function modeForPath(path, base) {
|
|
36847
|
-
return path !== void 0 && isConfigPath(path) ? "config" : base;
|
|
36848
|
-
}
|
|
36849
|
-
function configPathInDiff(text3) {
|
|
36850
|
-
for (const m of text3.matchAll(/^\+\+\+ b\/(.+)$/gm)) if (isConfigPath(m[1])) return m[1];
|
|
36851
|
-
return void 0;
|
|
36852
|
-
}
|
|
36853
|
-
function replaceCounting(text3, pattern, replacement, onHit) {
|
|
36854
|
-
return text3.replace(pattern, (...args2) => {
|
|
36855
|
-
onHit();
|
|
36856
|
-
return typeof replacement === "function" ? replacement(...args2) : replacement;
|
|
36857
|
-
});
|
|
36858
|
-
}
|
|
36859
|
-
function scrubForModel(input, secrets = [], mode = "look") {
|
|
36860
|
-
const counts = emptyRedactionCounts();
|
|
36861
|
-
let text3 = input;
|
|
36862
|
-
text3 = replaceCounting(text3, PRIVATE_KEY, "***", () => counts.private_key += 1);
|
|
36863
|
-
for (const secret of secrets) {
|
|
36864
|
-
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
36865
|
-
const parts2 = text3.split(secret);
|
|
36866
|
-
if (parts2.length > 1) {
|
|
36867
|
-
counts.credential += parts2.length - 1;
|
|
36868
|
-
text3 = parts2.join("***");
|
|
36869
|
-
}
|
|
36870
|
-
}
|
|
36871
|
-
for (const pattern of CREDENTIAL_PATTERNS) text3 = replaceCounting(text3, pattern, "***", () => counts.credential += 1);
|
|
36872
|
-
for (const pattern of CLOUD_KEYS) text3 = replaceCounting(text3, pattern, "***", () => counts.cloud_key += 1);
|
|
36873
|
-
text3 = replaceCounting(text3, URL_CREDENTIALS, (_all, scheme) => `${scheme}***@`, () => counts.url_credentials += 1);
|
|
36874
|
-
if (mode === "look" || mode === "config") {
|
|
36875
|
-
text3 = replaceCounting(text3, ASSIGNED_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, () => counts.assigned_secret += 1);
|
|
36876
|
-
text3 = replaceCounting(text3, ASSIGNED_ENV, (_all, name2) => `${name2}***`, () => counts.assigned_secret += 1);
|
|
36877
|
-
}
|
|
36878
|
-
if (mode === "config") {
|
|
36879
|
-
const hit = () => counts.assigned_secret += 1;
|
|
36880
|
-
text3 = replaceCounting(text3, CONFIG_XML_ELEMENT, (_all, tag, attrs) => `<${tag}${attrs}>***</${tag}>`, hit);
|
|
36881
|
-
text3 = replaceCounting(text3, CONFIG_XML_ATTRIBUTE, (_all, head, quote) => `${head}***${quote}`, hit);
|
|
36882
|
-
text3 = replaceCounting(text3, CONFIG_QUOTED, (_all, name2, quote) => `${name2}${quote}***${quote}`, hit);
|
|
36883
|
-
text3 = replaceCounting(text3, CONFIG_INLINE, (_all, name2) => `${name2}***`, hit);
|
|
36884
|
-
text3 = replaceCounting(text3, CONFIG_UNQUOTED, (_all, name2) => `${name2}***`, hit);
|
|
36885
|
-
}
|
|
36886
|
-
return { text: text3, counts };
|
|
36887
|
-
}
|
|
36888
|
-
function makeCodeScrubber(secrets, onHits) {
|
|
36889
|
-
return (text3, path) => {
|
|
36890
|
-
const r = scrubForModel(text3, secrets, modeForPath(path, "code"));
|
|
36891
|
-
if (onHits && REDACTION_WORDS.some((w) => r.counts[w] > 0)) onHits(r.counts);
|
|
36892
|
-
return r.text;
|
|
36893
|
-
};
|
|
36894
|
-
}
|
|
36895
|
-
function scrubEntriesForModel(entries, secrets, keep) {
|
|
36896
|
-
return entries.map((e) => {
|
|
36897
|
-
if (keep && "path" in e && keep.has(e.path)) return e;
|
|
36898
|
-
const path = "path" in e && typeof e.path === "string" ? e.path : void 0;
|
|
36899
|
-
return { ...e, content: scrubForModel(e.content, secrets, modeForPath(path, "code")).text };
|
|
36900
|
-
});
|
|
37099
|
+
let start3 = 0;
|
|
37100
|
+
for (let line2 = 0; line2 < 5 && start3 <= lf.length; line2++) {
|
|
37101
|
+
const end = lf.indexOf("\n", start3);
|
|
37102
|
+
const text3 = end === -1 ? lf.slice(start3) : lf.slice(start3, end);
|
|
37103
|
+
if (text3.includes("@generated") || text3.includes("DO NOT EDIT")) return true;
|
|
37104
|
+
if (end === -1) break;
|
|
37105
|
+
start3 = end + 1;
|
|
37106
|
+
}
|
|
37107
|
+
return false;
|
|
36901
37108
|
}
|
|
37109
|
+
var GENERATED_FILE_MESSAGE = "This file is generated (its first lines say so), so a change here would be overwritten. Change the file it is generated from instead.";
|
|
36902
37110
|
|
|
36903
37111
|
// src/definitions.ts
|
|
36904
37112
|
var MAX_NAME_CHARS = 80;
|
|
@@ -37068,7 +37276,7 @@ function definitionsOfFile(path, text3) {
|
|
|
37068
37276
|
}
|
|
37069
37277
|
|
|
37070
37278
|
// src/importContext.ts
|
|
37071
|
-
var
|
|
37279
|
+
var import_node_path4 = require("node:path");
|
|
37072
37280
|
var REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
37073
37281
|
"return",
|
|
37074
37282
|
"typeof",
|
|
@@ -37322,12 +37530,12 @@ function resolveImport(fromPath, specifier, listing, mapSpecifier) {
|
|
|
37322
37530
|
const clean = specifier.replace(/[?#].*$/, "");
|
|
37323
37531
|
const relative11 = clean === "." || clean === ".." || clean.startsWith("./") || clean.startsWith("../");
|
|
37324
37532
|
if (!relative11) return { kind: "external" };
|
|
37325
|
-
const base =
|
|
37326
|
-
if (base === ".." || base.startsWith("../") ||
|
|
37533
|
+
const base = import_node_path4.posix.normalize(import_node_path4.posix.join(import_node_path4.posix.dirname(fromPath), clean));
|
|
37534
|
+
if (base === ".." || base.startsWith("../") || import_node_path4.posix.isAbsolute(base)) return { kind: "unresolved", reason: "not found" };
|
|
37327
37535
|
return probeBase(base, listing);
|
|
37328
37536
|
}
|
|
37329
37537
|
function probeBase(base, listing) {
|
|
37330
|
-
const ext =
|
|
37538
|
+
const ext = import_node_path4.posix.extname(base);
|
|
37331
37539
|
if (ASSET_EXTS.has(ext.toLowerCase())) return { kind: "unresolved", reason: "asset" };
|
|
37332
37540
|
const candidates = [];
|
|
37333
37541
|
if (CODE_EXTS.includes(ext)) {
|
|
@@ -38233,16 +38441,16 @@ function createNodeToolFs(rootDir = process.cwd()) {
|
|
|
38233
38441
|
return {
|
|
38234
38442
|
rootReal,
|
|
38235
38443
|
lstat(rel) {
|
|
38236
|
-
const s = (0, import_node_fs2.lstatSync)((0,
|
|
38444
|
+
const s = (0, import_node_fs2.lstatSync)((0, import_node_path5.join)(rootDir, rel));
|
|
38237
38445
|
return { isSymlink: s.isSymbolicLink(), isFile: s.isFile(), size: s.size };
|
|
38238
38446
|
},
|
|
38239
38447
|
realpathInside(rel) {
|
|
38240
|
-
const real = (0, import_node_fs2.realpathSync)((0,
|
|
38241
|
-
const r = (0,
|
|
38242
|
-
return r !== "" && !r.startsWith("..") && !(0,
|
|
38448
|
+
const real = (0, import_node_fs2.realpathSync)((0, import_node_path5.join)(rootDir, rel));
|
|
38449
|
+
const r = (0, import_node_path5.relative)(rootReal, real);
|
|
38450
|
+
return r !== "" && !r.startsWith("..") && !(0, import_node_path5.isAbsolute)(r);
|
|
38243
38451
|
},
|
|
38244
38452
|
readBytes(rel) {
|
|
38245
|
-
return (0, import_node_fs2.readFileSync)((0,
|
|
38453
|
+
return (0, import_node_fs2.readFileSync)((0, import_node_path5.join)(rootDir, rel));
|
|
38246
38454
|
}
|
|
38247
38455
|
};
|
|
38248
38456
|
}
|
|
@@ -38633,22 +38841,22 @@ function outsideRootMessage(root) {
|
|
|
38633
38841
|
|
|
38634
38842
|
// src/workspaceOverlay.ts
|
|
38635
38843
|
var import_node_fs3 = require("node:fs");
|
|
38636
|
-
var
|
|
38844
|
+
var import_node_path6 = require("node:path");
|
|
38637
38845
|
function createNodeWriteFs(rootDir = process.cwd()) {
|
|
38638
38846
|
const base = createNodeToolFs(rootDir);
|
|
38639
38847
|
const inside3 = (real) => {
|
|
38640
|
-
const r = (0,
|
|
38641
|
-
return !r.startsWith("..") && !(0,
|
|
38848
|
+
const r = (0, import_node_path6.relative)(base.rootReal, real);
|
|
38849
|
+
return !r.startsWith("..") && !(0, import_node_path6.isAbsolute)(r);
|
|
38642
38850
|
};
|
|
38643
38851
|
return {
|
|
38644
38852
|
...base,
|
|
38645
38853
|
parentInside(rel) {
|
|
38646
|
-
let dir = (0,
|
|
38854
|
+
let dir = (0, import_node_path6.dirname)((0, import_node_path6.join)(rootDir, rel));
|
|
38647
38855
|
for (; ; ) {
|
|
38648
38856
|
try {
|
|
38649
38857
|
return inside3((0, import_node_fs3.realpathSync)(dir));
|
|
38650
38858
|
} catch {
|
|
38651
|
-
const up = (0,
|
|
38859
|
+
const up = (0, import_node_path6.dirname)(dir);
|
|
38652
38860
|
if (up === dir) return false;
|
|
38653
38861
|
dir = up;
|
|
38654
38862
|
}
|
|
@@ -38656,7 +38864,7 @@ function createNodeWriteFs(rootDir = process.cwd()) {
|
|
|
38656
38864
|
},
|
|
38657
38865
|
exists(rel) {
|
|
38658
38866
|
try {
|
|
38659
|
-
(0, import_node_fs3.lstatSync)((0,
|
|
38867
|
+
(0, import_node_fs3.lstatSync)((0, import_node_path6.join)(rootDir, rel));
|
|
38660
38868
|
return true;
|
|
38661
38869
|
} catch {
|
|
38662
38870
|
return false;
|
|
@@ -39332,14 +39540,17 @@ function editOverreach(path, before, after, kept, indexes) {
|
|
|
39332
39540
|
|
|
39333
39541
|
// src/proposal.ts
|
|
39334
39542
|
var GIT_MAX_BUFFER2 = 64 * 1024 * 1024;
|
|
39335
|
-
var runGit = (args2, opts = {}) => (
|
|
39336
|
-
|
|
39337
|
-
|
|
39338
|
-
|
|
39339
|
-
|
|
39340
|
-
|
|
39341
|
-
|
|
39342
|
-
|
|
39543
|
+
var runGit = (args2, opts = {}) => (
|
|
39544
|
+
// QUIKTR-2704: no repository hook can run (update-ref fires reference-transaction), and git gets a minimal environment.
|
|
39545
|
+
(0, import_node_child_process3.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], {
|
|
39546
|
+
encoding: "utf8",
|
|
39547
|
+
...opts.input !== void 0 ? { input: opts.input } : {},
|
|
39548
|
+
env: gitEnv(opts.env),
|
|
39549
|
+
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
39550
|
+
maxBuffer: GIT_MAX_BUFFER2,
|
|
39551
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
39552
|
+
})
|
|
39553
|
+
);
|
|
39343
39554
|
var BOT_ENV = {
|
|
39344
39555
|
GIT_AUTHOR_NAME: "quikpilot[bot]",
|
|
39345
39556
|
GIT_AUTHOR_EMAIL: "quikpilot@users.noreply.github.com",
|
|
@@ -39500,9 +39711,9 @@ function createProposalCommit(input) {
|
|
|
39500
39711
|
if (files.length === 0) return null;
|
|
39501
39712
|
const lines = files.flatMap((f) => f.conflicts.map((c) => lineOf2(c, f)));
|
|
39502
39713
|
const setupFor = files.flatMap((f) => f.conflicts.map((c) => c.fixes && c.fixes.length > 0 ? c.fixes.slice(0, MAX_SETUP_FOR).map((x) => ({ path: x.path, line: x.line })) : void 0));
|
|
39503
|
-
const dir = (0, import_node_fs4.mkdtempSync)((0,
|
|
39714
|
+
const dir = (0, import_node_fs4.mkdtempSync)((0, import_node_path7.join)((0, import_node_os2.tmpdir)(), "qp-proposal-"));
|
|
39504
39715
|
try {
|
|
39505
|
-
const env2 = { GIT_INDEX_FILE: (0,
|
|
39716
|
+
const env2 = { GIT_INDEX_FILE: (0, import_node_path7.join)(dir, "index"), ...BOT_ENV };
|
|
39506
39717
|
const head = git4(["rev-parse", "HEAD"], { cwd }).trim();
|
|
39507
39718
|
git4(["read-tree", head], { env: env2, cwd });
|
|
39508
39719
|
for (const f of files) {
|
|
@@ -39598,7 +39809,7 @@ function loadApprovedTests(input) {
|
|
|
39598
39809
|
}
|
|
39599
39810
|
const readCurrent = input.readCurrent ?? ((path) => {
|
|
39600
39811
|
try {
|
|
39601
|
-
return (0, import_node_fs5.readFileSync)((0,
|
|
39812
|
+
return (0, import_node_fs5.readFileSync)((0, import_node_path8.join)(cwd ?? process.cwd(), path), "utf8");
|
|
39602
39813
|
} catch {
|
|
39603
39814
|
return null;
|
|
39604
39815
|
}
|
|
@@ -39679,13 +39890,15 @@ function setupOverreach(input) {
|
|
|
39679
39890
|
return verdict.ok ? null : verdict.why;
|
|
39680
39891
|
}
|
|
39681
39892
|
var gitMergeText = ({ ours, base, theirs }) => {
|
|
39682
|
-
const dir = (0, import_node_fs5.mkdtempSync)((0,
|
|
39893
|
+
const dir = (0, import_node_fs5.mkdtempSync)((0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "qp-merge-"));
|
|
39683
39894
|
try {
|
|
39684
|
-
(0, import_node_fs5.writeFileSync)((0,
|
|
39685
|
-
(0, import_node_fs5.writeFileSync)((0,
|
|
39686
|
-
(0, import_node_fs5.writeFileSync)((0,
|
|
39687
|
-
return (0, import_node_child_process4.execFileSync)("git", ["merge-file", "-p", (0,
|
|
39895
|
+
(0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "ours"), ours);
|
|
39896
|
+
(0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "base"), base);
|
|
39897
|
+
(0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "theirs"), theirs);
|
|
39898
|
+
return (0, import_node_child_process4.execFileSync)("git", [...NO_HOOKS_ARGS, "merge-file", "-p", (0, import_node_path8.join)(dir, "ours"), (0, import_node_path8.join)(dir, "base"), (0, import_node_path8.join)(dir, "theirs")], {
|
|
39688
39899
|
encoding: "utf8",
|
|
39900
|
+
env: gitEnv(),
|
|
39901
|
+
// QUIKTR-2704: git never gets the runner's whole environment.
|
|
39689
39902
|
maxBuffer: 64 * 1024 * 1024,
|
|
39690
39903
|
stdio: ["ignore", "pipe", "ignore"]
|
|
39691
39904
|
});
|
|
@@ -39699,7 +39912,7 @@ function loadApprovals(input) {
|
|
|
39699
39912
|
const warnings = [];
|
|
39700
39913
|
const readCurrent = input.readCurrent ?? ((path) => {
|
|
39701
39914
|
try {
|
|
39702
|
-
return (0, import_node_fs5.readFileSync)((0,
|
|
39915
|
+
return (0, import_node_fs5.readFileSync)((0, import_node_path8.join)(input.cwd ?? process.cwd(), path), "utf8");
|
|
39703
39916
|
} catch {
|
|
39704
39917
|
return null;
|
|
39705
39918
|
}
|
|
@@ -39897,199 +40110,6 @@ async function reportBack(params) {
|
|
|
39897
40110
|
|
|
39898
40111
|
// src/commands.ts
|
|
39899
40112
|
var import_node_child_process5 = require("node:child_process");
|
|
39900
|
-
|
|
39901
|
-
// src/commandEnv.ts
|
|
39902
|
-
var ALLOWED_NAMES = /* @__PURE__ */ new Set([
|
|
39903
|
-
// Identity, locale and scratch space.
|
|
39904
|
-
"PATH",
|
|
39905
|
-
"Path",
|
|
39906
|
-
"HOME",
|
|
39907
|
-
"USER",
|
|
39908
|
-
"USERNAME",
|
|
39909
|
-
"LOGNAME",
|
|
39910
|
-
"SHELL",
|
|
39911
|
-
"HOSTNAME",
|
|
39912
|
-
"TMPDIR",
|
|
39913
|
-
"TMP",
|
|
39914
|
-
"TEMP",
|
|
39915
|
-
"TZ",
|
|
39916
|
-
"LANG",
|
|
39917
|
-
"LANGUAGE",
|
|
39918
|
-
"TERM",
|
|
39919
|
-
"COLORTERM",
|
|
39920
|
-
"NO_COLOR",
|
|
39921
|
-
"FORCE_COLOR",
|
|
39922
|
-
"DISPLAY",
|
|
39923
|
-
"CI",
|
|
39924
|
-
// Windows system variables, for the developer machine.
|
|
39925
|
-
"SystemRoot",
|
|
39926
|
-
"SYSTEMROOT",
|
|
39927
|
-
"windir",
|
|
39928
|
-
"COMSPEC",
|
|
39929
|
-
"PATHEXT",
|
|
39930
|
-
"USERPROFILE",
|
|
39931
|
-
"APPDATA",
|
|
39932
|
-
"LOCALAPPDATA",
|
|
39933
|
-
// Network settings a hosted or self-hosted runner may rely on.
|
|
39934
|
-
"HTTP_PROXY",
|
|
39935
|
-
"HTTPS_PROXY",
|
|
39936
|
-
"NO_PROXY",
|
|
39937
|
-
"ALL_PROXY",
|
|
39938
|
-
"http_proxy",
|
|
39939
|
-
"https_proxy",
|
|
39940
|
-
"no_proxy",
|
|
39941
|
-
"all_proxy",
|
|
39942
|
-
"SSL_CERT_FILE",
|
|
39943
|
-
"SSL_CERT_DIR",
|
|
39944
|
-
"NODE_EXTRA_CA_CERTS",
|
|
39945
|
-
"REQUESTS_CA_BUNDLE",
|
|
39946
|
-
"CURL_CA_BUNDLE",
|
|
39947
|
-
// Toolchain locations the setup-* actions and the runner image export.
|
|
39948
|
-
"NODE_OPTIONS",
|
|
39949
|
-
"NODE_PATH",
|
|
39950
|
-
"NVM_DIR",
|
|
39951
|
-
"ImageOS",
|
|
39952
|
-
"ImageVersion",
|
|
39953
|
-
"AGENT_TOOLSDIRECTORY",
|
|
39954
|
-
"CONDA",
|
|
39955
|
-
"pythonLocation",
|
|
39956
|
-
"PKG_CONFIG_PATH",
|
|
39957
|
-
"LD_LIBRARY_PATH",
|
|
39958
|
-
"CARGO_HOME",
|
|
39959
|
-
"RUSTUP_HOME",
|
|
39960
|
-
"GOPATH",
|
|
39961
|
-
"GOMODCACHE",
|
|
39962
|
-
"GOCACHE",
|
|
39963
|
-
"GOFLAGS",
|
|
39964
|
-
"JAVA_HOME",
|
|
39965
|
-
"GRADLE_HOME",
|
|
39966
|
-
"GRADLE_USER_HOME",
|
|
39967
|
-
"MAVEN_HOME",
|
|
39968
|
-
"M2_HOME",
|
|
39969
|
-
"ANDROID_HOME",
|
|
39970
|
-
"ANDROID_SDK_ROOT",
|
|
39971
|
-
"GEM_HOME",
|
|
39972
|
-
"GEM_PATH",
|
|
39973
|
-
"BUNDLE_PATH",
|
|
39974
|
-
"PIPX_HOME",
|
|
39975
|
-
"PIPX_BIN_DIR",
|
|
39976
|
-
"POETRY_HOME",
|
|
39977
|
-
// QUIKTR-1699: PHP projects (Composer, set up by shivammathur/setup-php).
|
|
39978
|
-
"COMPOSER_HOME",
|
|
39979
|
-
"COMPOSER_CACHE_DIR",
|
|
39980
|
-
"COMPOSER_NO_INTERACTION",
|
|
39981
|
-
"PHP_INI_SCAN_DIR",
|
|
39982
|
-
"PNPM_HOME",
|
|
39983
|
-
"BUN_INSTALL",
|
|
39984
|
-
"DENO_INSTALL",
|
|
39985
|
-
"DENO_DIR",
|
|
39986
|
-
"VOLTA_HOME",
|
|
39987
|
-
"COREPACK_HOME",
|
|
39988
|
-
"PYENV_ROOT",
|
|
39989
|
-
"RBENV_ROOT",
|
|
39990
|
-
// QUIKTR-1703: settings a project's own steps export for its tests and that carry no secret: where Go, Python, .NET and Rust look for
|
|
39991
|
-
// things and how they behave. A path, a flag, a pattern list; never a login (those are withheld by name below).
|
|
39992
|
-
"GOPRIVATE",
|
|
39993
|
-
"GONOSUMDB",
|
|
39994
|
-
"GONOSUMCHECK",
|
|
39995
|
-
"GOSUMDB",
|
|
39996
|
-
"GOTOOLCHAIN",
|
|
39997
|
-
"GOOS",
|
|
39998
|
-
"GOARCH",
|
|
39999
|
-
"CGO_ENABLED",
|
|
40000
|
-
"VIRTUAL_ENV",
|
|
40001
|
-
"PYTHONPATH",
|
|
40002
|
-
"PYTHONDONTWRITEBYTECODE",
|
|
40003
|
-
"PYTHONUNBUFFERED",
|
|
40004
|
-
"PYTHONHASHSEED",
|
|
40005
|
-
"PIP_CACHE_DIR",
|
|
40006
|
-
"PIP_NO_INPUT",
|
|
40007
|
-
"PIP_DISABLE_PIP_VERSION_CHECK",
|
|
40008
|
-
"UV_CACHE_DIR",
|
|
40009
|
-
"UV_PYTHON",
|
|
40010
|
-
"NODE_ENV",
|
|
40011
|
-
"NUGET_PACKAGES",
|
|
40012
|
-
"NUGET_HTTP_CACHE_PATH",
|
|
40013
|
-
"CARGO_TARGET_DIR",
|
|
40014
|
-
"CARGO_INCREMENTAL",
|
|
40015
|
-
"RUST_BACKTRACE",
|
|
40016
|
-
"RUST_LOG",
|
|
40017
|
-
// ... and these, which CAN carry a login inside their value (a registry address with `user:pass@`, a Java option `-D...password=`):
|
|
40018
|
-
// kept only when the value is clean (`valueIsClean`).
|
|
40019
|
-
"GOPROXY",
|
|
40020
|
-
"PIP_INDEX_URL",
|
|
40021
|
-
"PIP_EXTRA_INDEX_URL",
|
|
40022
|
-
"UV_INDEX_URL",
|
|
40023
|
-
"UV_DEFAULT_INDEX",
|
|
40024
|
-
"MAVEN_OPTS",
|
|
40025
|
-
"JAVA_TOOL_OPTIONS",
|
|
40026
|
-
"JAVA_OPTS",
|
|
40027
|
-
"GRADLE_OPTS",
|
|
40028
|
-
"RUSTFLAGS"
|
|
40029
|
-
]);
|
|
40030
|
-
var VALUE_CHECKED_NAMES = /* @__PURE__ */ new Set([
|
|
40031
|
-
"GOPROXY",
|
|
40032
|
-
"PIP_INDEX_URL",
|
|
40033
|
-
"PIP_EXTRA_INDEX_URL",
|
|
40034
|
-
"UV_INDEX_URL",
|
|
40035
|
-
"UV_DEFAULT_INDEX",
|
|
40036
|
-
"MAVEN_OPTS",
|
|
40037
|
-
"JAVA_TOOL_OPTIONS",
|
|
40038
|
-
"JAVA_OPTS",
|
|
40039
|
-
"GRADLE_OPTS",
|
|
40040
|
-
"RUSTFLAGS"
|
|
40041
|
-
]);
|
|
40042
|
-
var OPTION_WITH_LOGIN = /(?:^|\s)(?:-D|--)[\w.-]*(?:password|passwd|pwd|token|secret|credential|api[_-]?key|passphrase)[\w.-]*[= ]/i;
|
|
40043
|
-
function valueIsClean(value) {
|
|
40044
|
-
if (OPTION_WITH_LOGIN.test(value)) return false;
|
|
40045
|
-
const counts = scrubForModel(value, [], "code").counts;
|
|
40046
|
-
return REDACTION_WORDS.every((word) => counts[word] === 0);
|
|
40047
|
-
}
|
|
40048
|
-
var ALLOWED_PREFIXES = [
|
|
40049
|
-
"LC_",
|
|
40050
|
-
"RUNNER_",
|
|
40051
|
-
"GITHUB_",
|
|
40052
|
-
"JAVA_HOME_",
|
|
40053
|
-
"GOROOT",
|
|
40054
|
-
"ANDROID_NDK",
|
|
40055
|
-
"Python",
|
|
40056
|
-
// Python_ROOT_DIR, Python2_ROOT_DIR, Python3_ROOT_DIR
|
|
40057
|
-
"XDG_",
|
|
40058
|
-
"DOTNET_",
|
|
40059
|
-
"VCPKG_",
|
|
40060
|
-
"npm_config_",
|
|
40061
|
-
"NPM_CONFIG_"
|
|
40062
|
-
];
|
|
40063
|
-
var ALWAYS_WITHHELD = /* @__PURE__ */ new Set([
|
|
40064
|
-
"GITHUB_TOKEN",
|
|
40065
|
-
"GITHUB_ENV",
|
|
40066
|
-
"GITHUB_PATH",
|
|
40067
|
-
"GITHUB_OUTPUT",
|
|
40068
|
-
"GITHUB_STATE",
|
|
40069
|
-
"GITHUB_STEP_SUMMARY"
|
|
40070
|
-
]);
|
|
40071
|
-
var CREDENTIAL_NAME = /(token|secret|password|passwd|credential|private_?key|api_?key|(?:^|_)auth(?:$|_))/i;
|
|
40072
|
-
function isAllowed(name2) {
|
|
40073
|
-
if (ALWAYS_WITHHELD.has(name2) || CREDENTIAL_NAME.test(name2)) return false;
|
|
40074
|
-
if (ALLOWED_NAMES.has(name2)) return true;
|
|
40075
|
-
return ALLOWED_PREFIXES.some((prefix) => name2.startsWith(prefix));
|
|
40076
|
-
}
|
|
40077
|
-
function keeps(name2, value) {
|
|
40078
|
-
return isAllowed(name2) && (!VALUE_CHECKED_NAMES.has(name2) || valueIsClean(value));
|
|
40079
|
-
}
|
|
40080
|
-
function commandEnv(source = process.env) {
|
|
40081
|
-
const out2 = {};
|
|
40082
|
-
for (const [name2, value] of Object.entries(source)) {
|
|
40083
|
-
if (value === void 0) continue;
|
|
40084
|
-
if (keeps(name2, value)) out2[name2] = value;
|
|
40085
|
-
}
|
|
40086
|
-
return out2;
|
|
40087
|
-
}
|
|
40088
|
-
function withheldNames(source = process.env) {
|
|
40089
|
-
return Object.entries(source).filter(([name2, value]) => value !== void 0 && !keeps(name2, value)).map(([name2]) => name2).sort();
|
|
40090
|
-
}
|
|
40091
|
-
|
|
40092
|
-
// src/commands.ts
|
|
40093
40113
|
var withheldLogged = false;
|
|
40094
40114
|
function repositoryCommandEnv() {
|
|
40095
40115
|
if (!withheldLogged) {
|
|
@@ -40302,11 +40322,11 @@ function gateNoTimeMessage(baselineMs) {
|
|
|
40302
40322
|
// src/testPlan.ts
|
|
40303
40323
|
var import_node_crypto = require("node:crypto");
|
|
40304
40324
|
var import_node_fs10 = require("node:fs");
|
|
40305
|
-
var
|
|
40306
|
-
var
|
|
40325
|
+
var import_node_os4 = require("node:os");
|
|
40326
|
+
var import_node_path14 = require("node:path");
|
|
40307
40327
|
|
|
40308
40328
|
// src/pairedTests.ts
|
|
40309
|
-
var
|
|
40329
|
+
var import_node_path9 = require("node:path");
|
|
40310
40330
|
var MAX_TESTS_PER_TARGET = 3;
|
|
40311
40331
|
var MAX_REVERSE_TEST_CHARS = 24e3;
|
|
40312
40332
|
var MAX_TEST_FILE_CHARS = 2e5;
|
|
@@ -40348,28 +40368,28 @@ var TestCorpus = class {
|
|
|
40348
40368
|
}
|
|
40349
40369
|
};
|
|
40350
40370
|
function stemOf(path) {
|
|
40351
|
-
const base =
|
|
40352
|
-
return base === "index" ?
|
|
40371
|
+
const base = import_node_path9.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "");
|
|
40372
|
+
return base === "index" ? import_node_path9.posix.basename(import_node_path9.posix.dirname(path)) : base;
|
|
40353
40373
|
}
|
|
40354
40374
|
function sharedPrefix(a, b) {
|
|
40355
|
-
const x =
|
|
40356
|
-
const y =
|
|
40375
|
+
const x = import_node_path9.posix.dirname(a).split("/");
|
|
40376
|
+
const y = import_node_path9.posix.dirname(b).split("/");
|
|
40357
40377
|
let n = 0;
|
|
40358
40378
|
while (n < x.length && n < y.length && x[n] === y[n]) n++;
|
|
40359
40379
|
return n;
|
|
40360
40380
|
}
|
|
40361
40381
|
function namesOf(path) {
|
|
40362
|
-
const base =
|
|
40382
|
+
const base = import_node_path9.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "").toLowerCase();
|
|
40363
40383
|
const names = base.length >= 2 ? [base] : [];
|
|
40364
40384
|
if (ROUTE_FILE_NAMES.has(base)) {
|
|
40365
|
-
const parts2 =
|
|
40385
|
+
const parts2 = import_node_path9.posix.dirname(path).split("/").filter(Boolean);
|
|
40366
40386
|
while (parts2.length > 0 && /^[[(]/.test(parts2[parts2.length - 1])) parts2.pop();
|
|
40367
40387
|
const folder = parts2[parts2.length - 1];
|
|
40368
40388
|
if (folder && folder.length >= 3) names.push(folder.toLowerCase());
|
|
40369
40389
|
}
|
|
40370
40390
|
return names;
|
|
40371
40391
|
}
|
|
40372
|
-
var namedAfter = (test, path) => namesOf(path).some((n) =>
|
|
40392
|
+
var namedAfter = (test, path) => namesOf(path).some((n) => import_node_path9.posix.basename(test).toLowerCase().startsWith(n));
|
|
40373
40393
|
function testsImporting(p) {
|
|
40374
40394
|
if (p.limit <= 0 || (p.isTest ?? isTestTarget)(p.target) || !supportsImportScan(p.target)) return [];
|
|
40375
40395
|
const stem = stemOf(p.target);
|
|
@@ -40383,7 +40403,7 @@ function testsImporting(p) {
|
|
|
40383
40403
|
return r.kind === "repo" && r.path === p.target;
|
|
40384
40404
|
});
|
|
40385
40405
|
if (!imported) continue;
|
|
40386
|
-
hits.push({ path: file.path, named:
|
|
40406
|
+
hits.push({ path: file.path, named: import_node_path9.posix.basename(file.path).toLowerCase().startsWith(stem.toLowerCase()), near: sharedPrefix(file.path, p.target), size: file.text.length });
|
|
40387
40407
|
}
|
|
40388
40408
|
hits.sort((a, b) => Number(b.named) - Number(a.named) || b.near - a.near || a.size - b.size || (a.path < b.path ? -1 : 1));
|
|
40389
40409
|
return hits.slice(0, p.limit).map((h) => h.path);
|
|
@@ -40445,16 +40465,16 @@ function testsThroughOneFile(p) {
|
|
|
40445
40465
|
// src/testAdapters.ts
|
|
40446
40466
|
var import_node_fs9 = require("node:fs");
|
|
40447
40467
|
var import_node_module = require("node:module");
|
|
40448
|
-
var
|
|
40468
|
+
var import_node_path12 = require("node:path");
|
|
40449
40469
|
|
|
40450
40470
|
// src/baselineCheck.ts
|
|
40451
40471
|
var import_node_child_process6 = require("node:child_process");
|
|
40452
40472
|
var import_node_fs8 = require("node:fs");
|
|
40453
|
-
var
|
|
40473
|
+
var import_node_path11 = require("node:path");
|
|
40454
40474
|
|
|
40455
40475
|
// src/quiktest.ts
|
|
40456
40476
|
var import_node_fs6 = require("node:fs");
|
|
40457
|
-
var
|
|
40477
|
+
var import_node_path10 = require("node:path");
|
|
40458
40478
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
|
|
40459
40479
|
var DEPENDENCY_DIRS = /* @__PURE__ */ new Set([
|
|
40460
40480
|
"node_modules",
|
|
@@ -40500,7 +40520,7 @@ function findJUnitReports(cwd = process.cwd(), opts = {}) {
|
|
|
40500
40520
|
}
|
|
40501
40521
|
for (const entry of entries) {
|
|
40502
40522
|
if (DEPENDENCY_DIRS.has(entry)) continue;
|
|
40503
|
-
const full = (0,
|
|
40523
|
+
const full = (0, import_node_path10.join)(dir, entry);
|
|
40504
40524
|
let stat;
|
|
40505
40525
|
try {
|
|
40506
40526
|
stat = (0, import_node_fs6.statSync)(full);
|
|
@@ -40541,7 +40561,7 @@ function walkForJUnitByName(dir) {
|
|
|
40541
40561
|
}
|
|
40542
40562
|
for (const entry of entries) {
|
|
40543
40563
|
if (SKIP_DIRS.has(entry)) continue;
|
|
40544
|
-
const full = (0,
|
|
40564
|
+
const full = (0, import_node_path10.join)(dir, entry);
|
|
40545
40565
|
let stat;
|
|
40546
40566
|
try {
|
|
40547
40567
|
stat = (0, import_node_fs6.statSync)(full);
|
|
@@ -40565,7 +40585,7 @@ function firstXmlIn(dir, namePattern) {
|
|
|
40565
40585
|
return null;
|
|
40566
40586
|
}
|
|
40567
40587
|
const match = entries.find((e) => namePattern.test(e));
|
|
40568
|
-
return match ? (0,
|
|
40588
|
+
return match ? (0, import_node_path10.join)(dir, match) : null;
|
|
40569
40589
|
}
|
|
40570
40590
|
function readTestReportBytes(cwd = process.cwd()) {
|
|
40571
40591
|
try {
|
|
@@ -40578,7 +40598,7 @@ function readTestReportBytes(cwd = process.cwd()) {
|
|
|
40578
40598
|
}
|
|
40579
40599
|
}
|
|
40580
40600
|
function findJUnitReport(cwd = process.cwd()) {
|
|
40581
|
-
return walkForJUnitByName(cwd) ?? findJUnitReports(cwd)[0] ?? firstXmlIn((0,
|
|
40601
|
+
return walkForJUnitByName(cwd) ?? findJUnitReports(cwd)[0] ?? firstXmlIn((0, import_node_path10.join)(cwd, "test-results"), /\.xml$/) ?? firstXmlIn((0, import_node_path10.join)(cwd, "reports"), /^junit.*\.xml$/) ?? firstXmlIn((0, import_node_path10.join)(cwd, "target", "surefire-reports"), /\.xml$/);
|
|
40582
40602
|
}
|
|
40583
40603
|
function buildCiUrl(serverUrl, repository, githubRunId) {
|
|
40584
40604
|
return `${serverUrl}/${repository}/actions/runs/${githubRunId}`;
|
|
@@ -41054,16 +41074,16 @@ function checkableIds(ids, types2) {
|
|
|
41054
41074
|
});
|
|
41055
41075
|
}
|
|
41056
41076
|
function insideCheckout(cwd, path) {
|
|
41057
|
-
const abs = (0,
|
|
41058
|
-
const rel = (0,
|
|
41059
|
-
return rel === "" || rel.startsWith("..") || (0,
|
|
41077
|
+
const abs = (0, import_node_path11.resolve)(cwd, path);
|
|
41078
|
+
const rel = (0, import_node_path11.relative)(cwd, abs);
|
|
41079
|
+
return rel === "" || rel.startsWith("..") || (0, import_node_path11.isAbsolute)(rel) ? null : abs;
|
|
41060
41080
|
}
|
|
41061
41081
|
function writeForCheck(abs, content) {
|
|
41062
41082
|
const original = (0, import_node_fs8.existsSync)(abs) ? (0, import_node_fs8.readFileSync)(abs) : null;
|
|
41063
41083
|
const createdDirs = [];
|
|
41064
41084
|
if (original === null) {
|
|
41065
41085
|
const missing = [];
|
|
41066
|
-
for (let d = (0,
|
|
41086
|
+
for (let d = (0, import_node_path11.dirname)(abs); !(0, import_node_fs8.existsSync)(d); d = (0, import_node_path11.dirname)(d)) missing.push(d);
|
|
41067
41087
|
for (const d of missing.reverse()) {
|
|
41068
41088
|
(0, import_node_fs8.mkdirSync)(d);
|
|
41069
41089
|
createdDirs.push(d);
|
|
@@ -41090,7 +41110,8 @@ function restore(written) {
|
|
|
41090
41110
|
}
|
|
41091
41111
|
function untrackedFiles(cwd) {
|
|
41092
41112
|
try {
|
|
41093
|
-
const out2 = (0, import_node_child_process6.execFileSync)("git", ["ls-files", "--others", "--exclude-standard", "-z"], {
|
|
41113
|
+
const out2 = (0, import_node_child_process6.execFileSync)("git", [...NO_HOOKS_ARGS, "ls-files", "--others", "--exclude-standard", "-z"], {
|
|
41114
|
+
env: gitEnv(),
|
|
41094
41115
|
cwd,
|
|
41095
41116
|
encoding: "utf8",
|
|
41096
41117
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -41226,11 +41247,11 @@ var CONFIG_FILES = ["vitest.config.ts", "vitest.config.mts", "vitest.config.cts"
|
|
|
41226
41247
|
var WORKSPACE_IN_CONFIG = /\b(?:workspace|projects)\s*:/;
|
|
41227
41248
|
function defaultResolveVitest(cwd) {
|
|
41228
41249
|
try {
|
|
41229
|
-
const pkgPath = (0, import_node_module.createRequire)((0,
|
|
41250
|
+
const pkgPath = (0, import_node_module.createRequire)((0, import_node_path12.join)(cwd, "package.json")).resolve("vitest/package.json");
|
|
41230
41251
|
const pkg = JSON.parse((0, import_node_fs9.readFileSync)(pkgPath, "utf8"));
|
|
41231
41252
|
const rel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.vitest;
|
|
41232
41253
|
if (typeof rel !== "string" || typeof pkg.version !== "string") return null;
|
|
41233
|
-
return { bin: forward((0,
|
|
41254
|
+
return { bin: forward((0, import_node_path12.join)((0, import_node_path12.dirname)(pkgPath), rel)), version: pkg.version };
|
|
41234
41255
|
} catch {
|
|
41235
41256
|
return null;
|
|
41236
41257
|
}
|
|
@@ -41275,9 +41296,9 @@ function detectAdapter(i3) {
|
|
|
41275
41296
|
const parsed = parseTestInvocation(rest);
|
|
41276
41297
|
if ("off" in parsed) return parsed;
|
|
41277
41298
|
if (parsed.flags.some((f) => !ALLOWED_FLAG.test(f))) return { off: "extra_flags" };
|
|
41278
|
-
const cwd = folder ?
|
|
41299
|
+
const cwd = folder ? import_node_path12.posix.join(forward(i3.root), folder) : forward(i3.root);
|
|
41279
41300
|
if (parsed.viaScript) {
|
|
41280
|
-
const pkgText = i3.readText(
|
|
41301
|
+
const pkgText = i3.readText(import_node_path12.posix.join(cwd, "package.json"));
|
|
41281
41302
|
let script = "";
|
|
41282
41303
|
try {
|
|
41283
41304
|
const scripts = JSON.parse(pkgText ?? "{}").scripts;
|
|
@@ -41288,9 +41309,9 @@ function detectAdapter(i3) {
|
|
|
41288
41309
|
if (!/\bvitest\b/.test(script)) return { off: "not_vitest" };
|
|
41289
41310
|
if (!PLAIN_VITEST_SCRIPT.test(script)) return { off: "script_not_plain" };
|
|
41290
41311
|
}
|
|
41291
|
-
if (WORKSPACE_FILES.some((f) => i3.exists(
|
|
41312
|
+
if (WORKSPACE_FILES.some((f) => i3.exists(import_node_path12.posix.join(cwd, f)))) return { off: "workspace_config" };
|
|
41292
41313
|
for (const f of CONFIG_FILES) {
|
|
41293
|
-
const text3 = i3.exists(
|
|
41314
|
+
const text3 = i3.exists(import_node_path12.posix.join(cwd, f)) ? i3.readText(import_node_path12.posix.join(cwd, f)) : null;
|
|
41294
41315
|
if (text3 !== null && WORKSPACE_IN_CONFIG.test(text3)) return { off: "workspace_config" };
|
|
41295
41316
|
}
|
|
41296
41317
|
const found = (i3.resolveVitest ?? defaultResolveVitest)(cwd);
|
|
@@ -41313,7 +41334,7 @@ var TEST_FILE_NAME = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
|
|
|
41313
41334
|
function forceFullReason(paths, setupFiles = []) {
|
|
41314
41335
|
for (const raw of paths) {
|
|
41315
41336
|
const p = forward(raw);
|
|
41316
|
-
const base =
|
|
41337
|
+
const base = import_node_path12.posix.basename(p);
|
|
41317
41338
|
if (base === "package.json" || base === "npm-shrinkwrap.json") return "package_manifest";
|
|
41318
41339
|
if (/^(?:package-lock\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?)$/.test(base)) return "lock_file";
|
|
41319
41340
|
if (/^[jt]sconfig(?:\.[\w.-]+)?\.json$/.test(base)) return "ts_config";
|
|
@@ -41331,7 +41352,7 @@ function setupFilesOf(configText, folderRel) {
|
|
|
41331
41352
|
for (const m of configText.matchAll(list2)) {
|
|
41332
41353
|
for (const s of (m[1] ?? "").matchAll(/["']([^"']+)["']/g)) {
|
|
41333
41354
|
const rel = forward(s[1] ?? "").replace(/^\.\//, "");
|
|
41334
|
-
if (rel) out2.push(
|
|
41355
|
+
if (rel) out2.push(import_node_path12.posix.join(folderRel, rel));
|
|
41335
41356
|
}
|
|
41336
41357
|
}
|
|
41337
41358
|
return out2;
|
|
@@ -41366,7 +41387,7 @@ function fsReadingTests(i3) {
|
|
|
41366
41387
|
}
|
|
41367
41388
|
|
|
41368
41389
|
// src/tsconfigPaths.ts
|
|
41369
|
-
var
|
|
41390
|
+
var import_node_path13 = require("node:path");
|
|
41370
41391
|
var MAX_EXTENDS_DEPTH = 5;
|
|
41371
41392
|
function parseJsonc(text3) {
|
|
41372
41393
|
let out2 = "";
|
|
@@ -41412,12 +41433,12 @@ function resolveConfig(readText, file, depth, seen) {
|
|
|
41412
41433
|
if (typeof text3 !== "string") return null;
|
|
41413
41434
|
const json = parseJsonc(text3);
|
|
41414
41435
|
if (!isObject(json)) return null;
|
|
41415
|
-
const dir =
|
|
41436
|
+
const dir = import_node_path13.posix.dirname(file) === "." ? "" : import_node_path13.posix.dirname(file);
|
|
41416
41437
|
let inherited = { paths: null, pathsDir: dir, baseUrl: null };
|
|
41417
41438
|
const ext = typeof json.extends === "string" ? [json.extends] : stringList(json.extends);
|
|
41418
41439
|
for (const e of ext) {
|
|
41419
41440
|
if (!e.startsWith(".")) continue;
|
|
41420
|
-
const parent = resolveConfig(readText,
|
|
41441
|
+
const parent = resolveConfig(readText, import_node_path13.posix.normalize(import_node_path13.posix.join(dir, e.endsWith(".json") ? e : `${e}.json`)), depth + 1, seen);
|
|
41421
41442
|
if (parent) {
|
|
41422
41443
|
inherited = {
|
|
41423
41444
|
paths: parent.paths ?? inherited.paths,
|
|
@@ -41427,7 +41448,7 @@ function resolveConfig(readText, file, depth, seen) {
|
|
|
41427
41448
|
}
|
|
41428
41449
|
}
|
|
41429
41450
|
const co = isObject(json.compilerOptions) ? json.compilerOptions : {};
|
|
41430
|
-
const baseUrl = typeof co.baseUrl === "string" ?
|
|
41451
|
+
const baseUrl = typeof co.baseUrl === "string" ? import_node_path13.posix.normalize(import_node_path13.posix.join(dir, co.baseUrl)) : inherited.baseUrl;
|
|
41431
41452
|
let paths = inherited.paths;
|
|
41432
41453
|
let pathsDir = inherited.pathsDir;
|
|
41433
41454
|
if (isObject(co.paths)) {
|
|
@@ -41457,7 +41478,7 @@ function aliasTable(opts) {
|
|
|
41457
41478
|
if (!config?.paths) return [];
|
|
41458
41479
|
const lines = [];
|
|
41459
41480
|
for (const [key, targets] of Object.entries(config.paths)) {
|
|
41460
|
-
const resolved = targets.map((t) =>
|
|
41481
|
+
const resolved = targets.map((t) => import_node_path13.posix.normalize(import_node_path13.posix.join(config.baseUrl ?? config.pathsDir, t))).filter((p) => p !== ".." && !p.startsWith("../") && !import_node_path13.posix.isAbsolute(p));
|
|
41461
41482
|
if (resolved.length > 0) lines.push(`${key} -> ${resolved.join(", ")}`);
|
|
41462
41483
|
}
|
|
41463
41484
|
return lines.sort().slice(0, opts.max ?? 20);
|
|
@@ -41484,7 +41505,7 @@ function createAliasMapper(opts) {
|
|
|
41484
41505
|
};
|
|
41485
41506
|
return (fromPath, specifier) => {
|
|
41486
41507
|
if (specifier.startsWith(".") || specifier.startsWith("/")) return null;
|
|
41487
|
-
const dir =
|
|
41508
|
+
const dir = import_node_path13.posix.dirname(fromPath) === "." ? "" : import_node_path13.posix.dirname(fromPath);
|
|
41488
41509
|
const config = configFor(dir);
|
|
41489
41510
|
if (!config?.paths) return null;
|
|
41490
41511
|
let best = null;
|
|
@@ -41495,8 +41516,8 @@ function createAliasMapper(opts) {
|
|
|
41495
41516
|
if (!best) return null;
|
|
41496
41517
|
const bases = [];
|
|
41497
41518
|
for (const target of config.paths[best.key]) {
|
|
41498
|
-
const joined =
|
|
41499
|
-
if (joined === ".." || joined.startsWith("../") ||
|
|
41519
|
+
const joined = import_node_path13.posix.normalize(import_node_path13.posix.join(config.baseUrl ?? config.pathsDir, target.replace("*", best.captured)));
|
|
41520
|
+
if (joined === ".." || joined.startsWith("../") || import_node_path13.posix.isAbsolute(joined)) continue;
|
|
41500
41521
|
if (opts.writeRoot !== "" && !matchesPrefix(joined, opts.writeRoot)) continue;
|
|
41501
41522
|
bases.push(joined === "." ? "" : joined);
|
|
41502
41523
|
}
|
|
@@ -41550,7 +41571,7 @@ function createRelatedPlanner(d) {
|
|
|
41550
41571
|
const exists = d.exists ?? import_node_fs10.existsSync;
|
|
41551
41572
|
const mode = (env2.QUIKPILOT_RELATED_TESTS ?? "").trim().toLowerCase();
|
|
41552
41573
|
const minMs = minBaselineMs(env2);
|
|
41553
|
-
const abs = (rel) => forward2((0,
|
|
41574
|
+
const abs = (rel) => forward2((0, import_node_path14.join)(d.root, rel));
|
|
41554
41575
|
const isTest = testRule(d.discoveredTests ?? null);
|
|
41555
41576
|
let detected = null;
|
|
41556
41577
|
let setupFiles = [];
|
|
@@ -41562,9 +41583,9 @@ function createRelatedPlanner(d) {
|
|
|
41562
41583
|
function detect() {
|
|
41563
41584
|
const found = detectAdapter({ command: d.command, root: forward2(d.root), readText, exists, resolveVitest: d.resolveVitest });
|
|
41564
41585
|
if ("adapter" in found) {
|
|
41565
|
-
const folder = forward2((0,
|
|
41586
|
+
const folder = forward2((0, import_node_path14.relative)(d.root, found.adapter.cwd));
|
|
41566
41587
|
for (const name2 of CONFIG_FILES) {
|
|
41567
|
-
const text3 = exists(
|
|
41588
|
+
const text3 = exists(import_node_path14.posix.join(found.adapter.cwd, name2)) ? readText(import_node_path14.posix.join(found.adapter.cwd, name2)) : null;
|
|
41568
41589
|
if (text3 !== null) setupFiles.push(...setupFilesOf(text3, folder));
|
|
41569
41590
|
}
|
|
41570
41591
|
log({ event: "related.adapter", adapter: found.adapter.kind, version: found.adapter.version });
|
|
@@ -41620,7 +41641,7 @@ function createRelatedPlanner(d) {
|
|
|
41620
41641
|
const testFiles = unique([...changed.filter((p) => isTest(p)), ...importersOf(changed), ...alwaysRun]).slice(0, MAX_FALLBACK_TESTS).map(abs);
|
|
41621
41642
|
runNumber += 1;
|
|
41622
41643
|
const stamp = `${process.pid}-${runNumber}`;
|
|
41623
|
-
const dir = forward2((d.tmp ?? (() => env2.RUNNER_TEMP?.trim() || (0,
|
|
41644
|
+
const dir = forward2((d.tmp ?? (() => env2.RUNNER_TEMP?.trim() || (0, import_node_os4.tmpdir)()))());
|
|
41624
41645
|
const report = `${dir}/qp-related-${stamp}.xml`;
|
|
41625
41646
|
const fallbackReport = `${dir}/qp-related-${stamp}-files.xml`;
|
|
41626
41647
|
return {
|
|
@@ -41806,7 +41827,7 @@ function spendSoFar() {
|
|
|
41806
41827
|
|
|
41807
41828
|
// src/codegen.ts
|
|
41808
41829
|
var import_node_fs11 = require("node:fs");
|
|
41809
|
-
var
|
|
41830
|
+
var import_node_path15 = require("node:path");
|
|
41810
41831
|
|
|
41811
41832
|
// src/envelope.ts
|
|
41812
41833
|
var HARD_FAILURE_CODES = /* @__PURE__ */ new Set(["SEMANTIC_MISMATCH", "CONTRACT_REJECTED"]);
|
|
@@ -42253,7 +42274,7 @@ async function runCodegen(gateway, targets, workspaceListing, requiredTests, den
|
|
|
42253
42274
|
}
|
|
42254
42275
|
function flushCodegenResults(results) {
|
|
42255
42276
|
for (const { targetPath, newContent } of results) {
|
|
42256
|
-
(0, import_node_fs11.mkdirSync)((0,
|
|
42277
|
+
(0, import_node_fs11.mkdirSync)((0, import_node_path15.dirname)(targetPath), { recursive: true });
|
|
42257
42278
|
(0, import_node_fs11.writeFileSync)(targetPath, newContent);
|
|
42258
42279
|
}
|
|
42259
42280
|
}
|
|
@@ -42299,22 +42320,23 @@ function callFunctionEnabled(githubRepository, mode, env2 = process.env) {
|
|
|
42299
42320
|
|
|
42300
42321
|
// src/callFunctionTool.ts
|
|
42301
42322
|
var import_node_crypto4 = require("node:crypto");
|
|
42302
|
-
var
|
|
42323
|
+
var import_node_path19 = require("node:path");
|
|
42303
42324
|
|
|
42304
42325
|
// src/overlayOnDisk.ts
|
|
42305
42326
|
var import_node_child_process8 = require("node:child_process");
|
|
42306
42327
|
var import_node_fs13 = require("node:fs");
|
|
42307
|
-
var
|
|
42328
|
+
var import_node_path17 = require("node:path");
|
|
42308
42329
|
|
|
42309
42330
|
// src/treeFingerprint.ts
|
|
42310
42331
|
var import_node_crypto2 = require("node:crypto");
|
|
42311
42332
|
var import_node_child_process7 = require("node:child_process");
|
|
42312
42333
|
var import_node_fs12 = require("node:fs");
|
|
42313
|
-
var
|
|
42334
|
+
var import_node_path16 = require("node:path");
|
|
42314
42335
|
var MAX_HASHED_BYTES = 8 * 1024 * 1024;
|
|
42315
42336
|
function defaultGitStatus(root) {
|
|
42316
42337
|
try {
|
|
42317
|
-
return (0, import_node_child_process7.execFileSync)("git", ["status", "--porcelain=v1", "-z", "--untracked-files=all"], {
|
|
42338
|
+
return (0, import_node_child_process7.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain=v1", "-z", "--untracked-files=all"], {
|
|
42339
|
+
env: gitEnv(),
|
|
42318
42340
|
cwd: root,
|
|
42319
42341
|
encoding: "utf8",
|
|
42320
42342
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -42338,7 +42360,7 @@ function parseStatus(raw) {
|
|
|
42338
42360
|
return raw.split("\0").filter((t) => t.length > 0).sort();
|
|
42339
42361
|
}
|
|
42340
42362
|
function hashOf(root, rel) {
|
|
42341
|
-
const abs = (0,
|
|
42363
|
+
const abs = (0, import_node_path16.join)(root, rel);
|
|
42342
42364
|
let st;
|
|
42343
42365
|
try {
|
|
42344
42366
|
st = (0, import_node_fs12.lstatSync)(abs);
|
|
@@ -42403,24 +42425,24 @@ var DiskWriteRefused = class extends Error {
|
|
|
42403
42425
|
};
|
|
42404
42426
|
function safeRelativePath(rel) {
|
|
42405
42427
|
if (typeof rel !== "string" || rel.length === 0 || rel.length > 400 || rel.includes("\0") || rel.includes("\\")) return null;
|
|
42406
|
-
if ((0,
|
|
42428
|
+
if ((0, import_node_path17.isAbsolute)(rel) || /^[A-Za-z]:/.test(rel)) return null;
|
|
42407
42429
|
const parts2 = rel.split("/");
|
|
42408
42430
|
if (parts2.some((p) => p === "" || p === "." || p === "..")) return null;
|
|
42409
42431
|
return rel;
|
|
42410
42432
|
}
|
|
42411
42433
|
function isInside(root, abs) {
|
|
42412
|
-
const r = (0,
|
|
42413
|
-
return r !== "" && !r.startsWith("..") && !(0,
|
|
42434
|
+
const r = (0, import_node_path17.relative)(root, abs);
|
|
42435
|
+
return r !== "" && !r.startsWith("..") && !(0, import_node_path17.isAbsolute)(r);
|
|
42414
42436
|
}
|
|
42415
42437
|
function ancestorInside(realRoot, abs) {
|
|
42416
|
-
let dir = (0,
|
|
42438
|
+
let dir = (0, import_node_path17.dirname)(abs);
|
|
42417
42439
|
for (; ; ) {
|
|
42418
42440
|
try {
|
|
42419
42441
|
const real = (0, import_node_fs13.realpathSync)(dir);
|
|
42420
|
-
const r = (0,
|
|
42421
|
-
return r === "" || !r.startsWith("..") && !(0,
|
|
42442
|
+
const r = (0, import_node_path17.relative)(realRoot, real);
|
|
42443
|
+
return r === "" || !r.startsWith("..") && !(0, import_node_path17.isAbsolute)(r);
|
|
42422
42444
|
} catch {
|
|
42423
|
-
const up = (0,
|
|
42445
|
+
const up = (0, import_node_path17.dirname)(dir);
|
|
42424
42446
|
if (up === dir) return false;
|
|
42425
42447
|
dir = up;
|
|
42426
42448
|
}
|
|
@@ -42433,7 +42455,7 @@ function applyOverlay(root, files) {
|
|
|
42433
42455
|
const restore2 = () => {
|
|
42434
42456
|
const failed = [];
|
|
42435
42457
|
for (const w of [...written].reverse()) {
|
|
42436
|
-
const rel = (0,
|
|
42458
|
+
const rel = (0, import_node_path17.relative)(root, w.abs).split("\\").join("/");
|
|
42437
42459
|
try {
|
|
42438
42460
|
if (w.original !== null) (0, import_node_fs13.writeFileSync)(w.abs, w.original);
|
|
42439
42461
|
else (0, import_node_fs13.rmSync)(w.abs, { force: true });
|
|
@@ -42456,7 +42478,7 @@ function applyOverlay(root, files) {
|
|
|
42456
42478
|
if (rel === null) throw new DiskWriteRefused("bad_path");
|
|
42457
42479
|
if (seen.has(rel)) throw new DiskWriteRefused("duplicate");
|
|
42458
42480
|
seen.add(rel);
|
|
42459
|
-
const abs = (0,
|
|
42481
|
+
const abs = (0, import_node_path17.resolve)(root, rel);
|
|
42460
42482
|
if (!isInside(root, abs) || !ancestorInside(realRoot, abs)) throw new DiskWriteRefused("outside_checkout");
|
|
42461
42483
|
let original = null;
|
|
42462
42484
|
try {
|
|
@@ -42470,7 +42492,7 @@ function applyOverlay(root, files) {
|
|
|
42470
42492
|
const createdDirs = [];
|
|
42471
42493
|
if (original === null) {
|
|
42472
42494
|
const missing = [];
|
|
42473
|
-
for (let d = (0,
|
|
42495
|
+
for (let d = (0, import_node_path17.dirname)(abs); !(0, import_node_fs13.existsSync)(d); d = (0, import_node_path17.dirname)(d)) missing.push(d);
|
|
42474
42496
|
for (const d of missing.reverse()) {
|
|
42475
42497
|
(0, import_node_fs13.mkdirSync)(d);
|
|
42476
42498
|
createdDirs.push(d);
|
|
@@ -42487,7 +42509,7 @@ function applyOverlay(root, files) {
|
|
|
42487
42509
|
return { restore: restore2 };
|
|
42488
42510
|
}
|
|
42489
42511
|
function git2(root, args2) {
|
|
42490
|
-
(0, import_node_child_process8.execFileSync)("git", args2, { cwd: root, stdio: ["ignore", "ignore", "ignore"] });
|
|
42512
|
+
(0, import_node_child_process8.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd: root, stdio: ["ignore", "ignore", "ignore"] });
|
|
42491
42513
|
}
|
|
42492
42514
|
function cleanUpAfterRun(root, beforePaths, afterStatus) {
|
|
42493
42515
|
for (const token of afterStatus) {
|
|
@@ -42497,8 +42519,8 @@ function cleanUpAfterRun(root, beforePaths, afterStatus) {
|
|
|
42497
42519
|
const code = entryCode(token);
|
|
42498
42520
|
try {
|
|
42499
42521
|
if (code === "??") {
|
|
42500
|
-
(0, import_node_fs13.rmSync)((0,
|
|
42501
|
-
for (let d = (0,
|
|
42522
|
+
(0, import_node_fs13.rmSync)((0, import_node_path17.join)(root, p), { recursive: true, force: true });
|
|
42523
|
+
for (let d = (0, import_node_path17.dirname)((0, import_node_path17.join)(root, p)); d !== root && isInside(root, d); d = (0, import_node_path17.dirname)(d)) {
|
|
42502
42524
|
try {
|
|
42503
42525
|
(0, import_node_fs13.rmdirSync)(d);
|
|
42504
42526
|
} catch {
|
|
@@ -42518,7 +42540,7 @@ function snapshotPreserved(root, paths) {
|
|
|
42518
42540
|
const out2 = [];
|
|
42519
42541
|
for (const rel of paths ?? []) {
|
|
42520
42542
|
if (safeRelativePath(rel) === null) continue;
|
|
42521
|
-
const abs = (0,
|
|
42543
|
+
const abs = (0, import_node_path17.resolve)(root, rel);
|
|
42522
42544
|
try {
|
|
42523
42545
|
const st = (0, import_node_fs13.lstatSync)(abs);
|
|
42524
42546
|
if (st.isSymbolicLink() || !st.isFile()) continue;
|
|
@@ -42586,7 +42608,7 @@ function undoableFlush(root, results, flush, options = {}) {
|
|
|
42586
42608
|
const beforePaths = new Set((before?.status ?? []).filter(isStatusEntry).map(entryPath));
|
|
42587
42609
|
for (const p of ignore) beforePaths.add(p);
|
|
42588
42610
|
const originals = rels.map((rel) => {
|
|
42589
|
-
const abs = (0,
|
|
42611
|
+
const abs = (0, import_node_path17.resolve)(root, rel);
|
|
42590
42612
|
let original = null;
|
|
42591
42613
|
try {
|
|
42592
42614
|
const st = (0, import_node_fs13.lstatSync)(abs);
|
|
@@ -42597,7 +42619,7 @@ function undoableFlush(root, results, flush, options = {}) {
|
|
|
42597
42619
|
const createdDirs = [];
|
|
42598
42620
|
if (original === null) {
|
|
42599
42621
|
const missing = [];
|
|
42600
|
-
for (let d = (0,
|
|
42622
|
+
for (let d = (0, import_node_path17.dirname)(abs); !(0, import_node_fs13.existsSync)(d) && isInside(root, d); d = (0, import_node_path17.dirname)(d)) missing.push(d);
|
|
42601
42623
|
createdDirs.push(...missing.reverse());
|
|
42602
42624
|
}
|
|
42603
42625
|
return { rel, abs, original, createdDirs };
|
|
@@ -42653,7 +42675,7 @@ function undoableFlush(root, results, flush, options = {}) {
|
|
|
42653
42675
|
// src/runTestsTool.ts
|
|
42654
42676
|
var import_node_crypto3 = require("node:crypto");
|
|
42655
42677
|
var import_node_fs14 = require("node:fs");
|
|
42656
|
-
var
|
|
42678
|
+
var import_node_path18 = require("node:path");
|
|
42657
42679
|
var scrubSecrets2 = (text3) => scrubForModel(text3, [], "code").text;
|
|
42658
42680
|
var RUN_TESTS_TOOL = "run_tests";
|
|
42659
42681
|
var MAX_TEST_RUNS = 3;
|
|
@@ -42964,7 +42986,7 @@ var RunTestsTool = class {
|
|
|
42964
42986
|
const runCommand2 = d.runCommand ?? runTestCommandWithLimit;
|
|
42965
42987
|
const readSnapshot = d.readSnapshot ?? readTestSnapshot;
|
|
42966
42988
|
const reportBefore = findReport(d.root);
|
|
42967
|
-
const preserve = reportBefore ? [(0,
|
|
42989
|
+
const preserve = reportBefore ? [(0, import_node_path18.relative)(d.root, reportBefore).split("\\").join("/")] : [];
|
|
42968
42990
|
const spend = (n) => {
|
|
42969
42991
|
if (file === void 0) this.runs += n;
|
|
42970
42992
|
else this.fileRuns += n;
|
|
@@ -43315,7 +43337,7 @@ var CallFunctionTool = class {
|
|
|
43315
43337
|
const now = d.now ?? Date.now;
|
|
43316
43338
|
const helper = {
|
|
43317
43339
|
path: `.quikpilot-call-${(0, import_node_crypto4.randomBytes)(6).toString("hex")}.mjs`,
|
|
43318
|
-
content: helperSource({ target: (0,
|
|
43340
|
+
content: helperSource({ target: (0, import_node_path19.join)(d.root, parsed.path), exportName: parsed.exportName, args: parsed.callArgs })
|
|
43319
43341
|
};
|
|
43320
43342
|
const run3 = d.run ?? runCapturedCommand;
|
|
43321
43343
|
this.calls += 1;
|
|
@@ -43325,7 +43347,7 @@ var CallFunctionTool = class {
|
|
|
43325
43347
|
captured = await withOverlayOnDisk(
|
|
43326
43348
|
d.root,
|
|
43327
43349
|
[...files, helper],
|
|
43328
|
-
() => run3([d.nodePath ?? process.execPath, (0,
|
|
43350
|
+
() => run3([d.nodePath ?? process.execPath, (0, import_node_path19.join)(d.root, helper.path)], { cwd: d.root, timeoutMs: d.timeoutMs ?? CALL_TIMEOUT_MS, maxStdoutBytes: MAX_STDOUT_BYTES }),
|
|
43329
43351
|
{ ...d.tree }
|
|
43330
43352
|
);
|
|
43331
43353
|
} catch (err2) {
|
|
@@ -47737,7 +47759,7 @@ function createCodegenWorkspace(args2) {
|
|
|
47737
47759
|
|
|
47738
47760
|
// src/scratchRunTool.ts
|
|
47739
47761
|
var import_node_fs15 = require("node:fs");
|
|
47740
|
-
var
|
|
47762
|
+
var import_node_path20 = require("node:path");
|
|
47741
47763
|
var RUN_SCRATCH_TOOL = "run_scratch";
|
|
47742
47764
|
var MAX_SCRATCH_TEXT_CHARS = 2e3;
|
|
47743
47765
|
var MAX_SCRATCH_CONTENT_CHARS = 8e3;
|
|
@@ -47823,10 +47845,10 @@ var ScratchRunTool = class {
|
|
|
47823
47845
|
if (matchesDeniedPath(path, d.deniedPaths) !== null) return false;
|
|
47824
47846
|
if (!testRule(d.discoveredTests)(path)) return false;
|
|
47825
47847
|
if (d.protectedTestPaths.includes(path) || d.listing.includes(path) || files.some((f) => f.path === path)) return false;
|
|
47826
|
-
const abs = (0,
|
|
47848
|
+
const abs = (0, import_node_path20.join)(d.root, path);
|
|
47827
47849
|
if ((0, import_node_fs15.existsSync)(abs)) return false;
|
|
47828
47850
|
try {
|
|
47829
|
-
return (0, import_node_fs15.statSync)((0,
|
|
47851
|
+
return (0, import_node_fs15.statSync)((0, import_node_path20.dirname)(abs)).isDirectory();
|
|
47830
47852
|
} catch {
|
|
47831
47853
|
return false;
|
|
47832
47854
|
}
|
|
@@ -47865,7 +47887,7 @@ var ScratchRunTool = class {
|
|
|
47865
47887
|
const run3 = d.run ?? runShellCaptured;
|
|
47866
47888
|
const command = buildSingleFileCommand(fileCommand, parsed.path);
|
|
47867
47889
|
const reportBefore = (d.findReport ?? findJUnitReport)(d.root);
|
|
47868
|
-
const preserve = reportBefore ? [(0,
|
|
47890
|
+
const preserve = reportBefore ? [(0, import_node_path20.relative)(d.root, reportBefore).split("\\").join("/")] : [];
|
|
47869
47891
|
this.calls += 1;
|
|
47870
47892
|
const startedAt = now();
|
|
47871
47893
|
let ran;
|
|
@@ -48317,7 +48339,7 @@ var TargetingHttpError = class extends Error {
|
|
|
48317
48339
|
// src/dataPathCheck.ts
|
|
48318
48340
|
var import_node_child_process9 = require("node:child_process");
|
|
48319
48341
|
var import_node_fs17 = require("node:fs");
|
|
48320
|
-
var
|
|
48342
|
+
var import_node_path21 = require("node:path");
|
|
48321
48343
|
|
|
48322
48344
|
// src/scopeCheck.ts
|
|
48323
48345
|
var import_node_fs16 = require("node:fs");
|
|
@@ -48462,7 +48484,7 @@ function addressMatches(route, call) {
|
|
|
48462
48484
|
}
|
|
48463
48485
|
var git3 = (cwd, args2) => {
|
|
48464
48486
|
try {
|
|
48465
|
-
return (0, import_node_child_process9.execFileSync)("git", args2, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: GIT_TIMEOUT_MS2, maxBuffer: GIT_MAX_BUFFER3 });
|
|
48487
|
+
return (0, import_node_child_process9.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: GIT_TIMEOUT_MS2, maxBuffer: GIT_MAX_BUFFER3 });
|
|
48466
48488
|
} catch {
|
|
48467
48489
|
return "";
|
|
48468
48490
|
}
|
|
@@ -48549,7 +48571,7 @@ function screenLoaders(cwd, screen, read, skip, expired) {
|
|
|
48549
48571
|
function readFromCheckout(root) {
|
|
48550
48572
|
return (path) => {
|
|
48551
48573
|
try {
|
|
48552
|
-
const abs = (0,
|
|
48574
|
+
const abs = (0, import_node_path21.join)(root, path);
|
|
48553
48575
|
const st = (0, import_node_fs17.lstatSync)(abs);
|
|
48554
48576
|
return st.isSymbolicLink() || !st.isFile() || st.size > MAX_FILE_CHARS2 ? null : (0, import_node_fs17.readFileSync)(abs, "utf8");
|
|
48555
48577
|
} catch {
|
|
@@ -51414,7 +51436,7 @@ function buildCodegenLoopRecord(loop) {
|
|
|
51414
51436
|
var import_node_fs18 = require("node:fs");
|
|
51415
51437
|
|
|
51416
51438
|
// src/langReach.ts
|
|
51417
|
-
var
|
|
51439
|
+
var import_node_path22 = require("node:path");
|
|
51418
51440
|
var LANGUAGE_BY_EXT = {
|
|
51419
51441
|
".go": "go",
|
|
51420
51442
|
".py": "python",
|
|
@@ -51430,7 +51452,7 @@ var LANGUAGE_BY_EXT = {
|
|
|
51430
51452
|
".swift": "swift"
|
|
51431
51453
|
};
|
|
51432
51454
|
function languageOf(path) {
|
|
51433
|
-
return LANGUAGE_BY_EXT[
|
|
51455
|
+
return LANGUAGE_BY_EXT[import_node_path22.posix.extname(path).toLowerCase()] ?? null;
|
|
51434
51456
|
}
|
|
51435
51457
|
var MAX_REACH_TESTS = 10;
|
|
51436
51458
|
var MAX_IMPORT_STEPS = 3;
|
|
@@ -51454,14 +51476,14 @@ function lookSymbolsOf(findings) {
|
|
|
51454
51476
|
for (const c of findings.callPath) add2(c.path, c.symbol);
|
|
51455
51477
|
return out2;
|
|
51456
51478
|
}
|
|
51457
|
-
var baseNoExt = (p) =>
|
|
51458
|
-
var dirOf = (p) =>
|
|
51479
|
+
var baseNoExt = (p) => import_node_path22.posix.basename(p).replace(/\.[^.]+$/, "");
|
|
51480
|
+
var dirOf = (p) => import_node_path22.posix.dirname(p) === "." ? "" : import_node_path22.posix.dirname(p);
|
|
51459
51481
|
function testStem(path) {
|
|
51460
51482
|
return baseNoExt(path).replace(/^test_/i, "").replace(/(_test|_spec)$/i, "").replace(/Tests?$/, "").toLowerCase();
|
|
51461
51483
|
}
|
|
51462
51484
|
function codeStem(path) {
|
|
51463
51485
|
const b = baseNoExt(path);
|
|
51464
|
-
if (b === "__init__" || b === "mod" || b === "index") return
|
|
51486
|
+
if (b === "__init__" || b === "mod" || b === "index") return import_node_path22.posix.basename(dirOf(path)).toLowerCase();
|
|
51465
51487
|
return b.toLowerCase();
|
|
51466
51488
|
}
|
|
51467
51489
|
function sharedPrefix2(a, b) {
|
|
@@ -51544,7 +51566,7 @@ function buildIndex(files, readText) {
|
|
|
51544
51566
|
}
|
|
51545
51567
|
}
|
|
51546
51568
|
let goModule = null;
|
|
51547
|
-
const gomod = files.filter((f) =>
|
|
51569
|
+
const gomod = files.filter((f) => import_node_path22.posix.basename(f) === "go.mod").sort((a, b) => a.length - b.length)[0];
|
|
51548
51570
|
if (gomod) {
|
|
51549
51571
|
const m = /^module[ \t]+(\S+)/m.exec(readText(gomod) ?? "");
|
|
51550
51572
|
if (m) goModule = { root: dirOf(gomod), module: m[1].replace(/^"|"$/g, "") };
|
|
@@ -51559,7 +51581,7 @@ function pythonImports(file, text3, ix) {
|
|
|
51559
51581
|
const relative11 = (dots, rest) => {
|
|
51560
51582
|
let base = dirOf(file);
|
|
51561
51583
|
for (let i3 = 1; i3 < dots; i3++) base = dirOf(base);
|
|
51562
|
-
const joined = rest ?
|
|
51584
|
+
const joined = rest ? import_node_path22.posix.join(base, rest.replace(/\./g, "/")) : base;
|
|
51563
51585
|
return [`${joined}.py`, `${joined}/__init__.py`].filter((p) => ix.set.has(p) && p !== file);
|
|
51564
51586
|
};
|
|
51565
51587
|
for (const line2 of text3.split("\n")) {
|
|
@@ -51599,7 +51621,7 @@ function goImports(file, text3, ix) {
|
|
|
51599
51621
|
let dir = null;
|
|
51600
51622
|
if (ix.goModule && (p === ix.goModule.module || p.startsWith(`${ix.goModule.module}/`))) {
|
|
51601
51623
|
const rest = p.slice(ix.goModule.module.length).replace(/^\//, "");
|
|
51602
|
-
dir = ix.goModule.root ?
|
|
51624
|
+
dir = ix.goModule.root ? import_node_path22.posix.join(ix.goModule.root, rest) : rest;
|
|
51603
51625
|
} else {
|
|
51604
51626
|
const tail2 = p.split("/").slice(-2).join("/");
|
|
51605
51627
|
for (const d of ix.byDir.keys()) if (d === tail2 || d.endsWith(`/${tail2}`)) {
|
|
@@ -51650,7 +51672,7 @@ function importsOf(language, file, text3, ix) {
|
|
|
51650
51672
|
if (language === "jvm") return jvmImports(file, text3, ix);
|
|
51651
51673
|
return [];
|
|
51652
51674
|
}
|
|
51653
|
-
var isPackageInit = (p) =>
|
|
51675
|
+
var isPackageInit = (p) => import_node_path22.posix.basename(p) === "__init__.py";
|
|
51654
51676
|
function testsReaching(input) {
|
|
51655
51677
|
const limit = Math.min(MAX_REACH_TESTS, Math.max(0, input.limit ?? MAX_REACH_TESTS));
|
|
51656
51678
|
const listing = input.isDenied ? input.listing.filter((p) => !input.isDenied(p)) : [...input.listing];
|
|
@@ -51793,8 +51815,8 @@ function pairedTestPaths(codePath, listing, isTest = isTestTarget) {
|
|
|
51793
51815
|
const stem = m[1].toLowerCase();
|
|
51794
51816
|
const dir = dirOf2(codePath);
|
|
51795
51817
|
const parent = parentOf(dir);
|
|
51796
|
-
const
|
|
51797
|
-
const homes = /* @__PURE__ */ new Set([dir,
|
|
51818
|
+
const join20 = (d, leaf) => d === "" ? leaf : `${d}/${leaf}`;
|
|
51819
|
+
const homes = /* @__PURE__ */ new Set([dir, join20(dir, "__tests__"), join20(parent, "__tests__"), join20(parent, "tests"), join20(parent, "test")]);
|
|
51798
51820
|
const found = [];
|
|
51799
51821
|
for (const path of listing) {
|
|
51800
51822
|
if (!homes.has(dirOf2(path))) continue;
|
|
@@ -51975,7 +51997,7 @@ function mapModeMessage(phase, reason) {
|
|
|
51975
51997
|
|
|
51976
51998
|
// src/testsToCheck.ts
|
|
51977
51999
|
var import_node_fs19 = require("node:fs");
|
|
51978
|
-
var
|
|
52000
|
+
var import_node_path23 = require("node:path");
|
|
51979
52001
|
var MAX_TESTS_TO_CHECK = 10;
|
|
51980
52002
|
var SECOND_HOP_BELOW = 3;
|
|
51981
52003
|
function testsToCheck(i3) {
|
|
@@ -52026,7 +52048,7 @@ function testsToCheck(i3) {
|
|
|
52026
52048
|
}
|
|
52027
52049
|
var readFromRoot = (root) => (rel) => {
|
|
52028
52050
|
try {
|
|
52029
|
-
return (0, import_node_fs19.readFileSync)((0,
|
|
52051
|
+
return (0, import_node_fs19.readFileSync)((0, import_node_path23.join)(root, rel), "utf8");
|
|
52030
52052
|
} catch {
|
|
52031
52053
|
return null;
|
|
52032
52054
|
}
|
|
@@ -52847,7 +52869,7 @@ async function runVerifyAndFix(p) {
|
|
|
52847
52869
|
// src/hunkCheck.ts
|
|
52848
52870
|
var import_node_child_process10 = require("node:child_process");
|
|
52849
52871
|
var import_node_fs21 = require("node:fs");
|
|
52850
|
-
var
|
|
52872
|
+
var import_node_path24 = require("node:path");
|
|
52851
52873
|
var MAX_REPORTED_HUNKS = 20;
|
|
52852
52874
|
function toFinding(r) {
|
|
52853
52875
|
if (r.unnecessary.length === 0) return void 0;
|
|
@@ -52874,7 +52896,7 @@ function collectHunkCheckFiles(results, root, readHead = readCommittedText) {
|
|
|
52874
52896
|
}
|
|
52875
52897
|
function readCommittedText(root, path) {
|
|
52876
52898
|
try {
|
|
52877
|
-
return (0, import_node_child_process10.execFileSync)("git", ["show", `HEAD:${path}`], { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 8 * 1024 * 1024 });
|
|
52899
|
+
return (0, import_node_child_process10.execFileSync)("git", [...NO_HOOKS_ARGS, "show", `HEAD:${path}`], { env: gitEnv(), cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 8 * 1024 * 1024 });
|
|
52878
52900
|
} catch {
|
|
52879
52901
|
return null;
|
|
52880
52902
|
}
|
|
@@ -52925,7 +52947,7 @@ async function runHunkCheck(input) {
|
|
|
52925
52947
|
let slowestRunMs = input.baselineMs ?? 3e4;
|
|
52926
52948
|
const runOnce = async (c) => {
|
|
52927
52949
|
const reportBefore = findReport(input.root);
|
|
52928
|
-
const preserve = reportBefore ? [(0,
|
|
52950
|
+
const preserve = reportBefore ? [(0, import_node_path24.relative)(input.root, reportBefore).split("\\").join("/")] : [];
|
|
52929
52951
|
const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
|
|
52930
52952
|
const startedWall = Date.now();
|
|
52931
52953
|
const startedAt = now();
|
|
@@ -52961,7 +52983,7 @@ async function runHunkCheck(input) {
|
|
|
52961
52983
|
};
|
|
52962
52984
|
const runRelated = async (c, plan, limitMs) => {
|
|
52963
52985
|
const reportBefore = findReport(input.root);
|
|
52964
|
-
const preserve = reportBefore ? [(0,
|
|
52986
|
+
const preserve = reportBefore ? [(0, import_node_path24.relative)(input.root, reportBefore).split("\\").join("/")] : [];
|
|
52965
52987
|
const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
|
|
52966
52988
|
const startedAt = now();
|
|
52967
52989
|
result.relatedRuns += 1;
|
|
@@ -53106,7 +53128,7 @@ function healFailureSuffix(heal) {
|
|
|
53106
53128
|
|
|
53107
53129
|
// src/dependencyCheck.ts
|
|
53108
53130
|
var import_node_fs22 = require("node:fs");
|
|
53109
|
-
var
|
|
53131
|
+
var import_node_path25 = require("node:path");
|
|
53110
53132
|
var SCANNABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
|
|
53111
53133
|
var IMPORT_RE = /(?:\bimport\b[^'"]*?\bfrom\s*|\bimport\s*\(\s*|\bexport\b[^'"]*?\bfrom\s*|\brequire\s*\(\s*|\bimport\s+)(['"])([^'"]+)\1/g;
|
|
53112
53134
|
var NODE_BUILTINS = /* @__PURE__ */ new Set([
|
|
@@ -53194,8 +53216,8 @@ function dependencyNames(pkg) {
|
|
|
53194
53216
|
]);
|
|
53195
53217
|
}
|
|
53196
53218
|
function readDeclaredDependencies(results, workspaceRoot) {
|
|
53197
|
-
const packageJsonPath = (0,
|
|
53198
|
-
const generated = results.find((r) => (0,
|
|
53219
|
+
const packageJsonPath = (0, import_node_path25.join)((0, import_node_path25.resolve)(workspaceRoot ?? "."), "package.json");
|
|
53220
|
+
const generated = results.find((r) => (0, import_node_path25.resolve)(r.targetPath) === packageJsonPath);
|
|
53199
53221
|
let raw;
|
|
53200
53222
|
if (generated) {
|
|
53201
53223
|
raw = generated.newContent;
|
|
@@ -53265,10 +53287,10 @@ function stripJsonComments(text3) {
|
|
|
53265
53287
|
return out2.replace(/,(\s*[}\]])/g, "$1");
|
|
53266
53288
|
}
|
|
53267
53289
|
function resolveAliasPrefixes(results, workspaceRoot) {
|
|
53268
|
-
const root = (0,
|
|
53290
|
+
const root = (0, import_node_path25.resolve)(workspaceRoot ?? ".");
|
|
53269
53291
|
for (const filename of ["tsconfig.json", "jsconfig.json"]) {
|
|
53270
|
-
const configPath = (0,
|
|
53271
|
-
const generated = results.find((r) => (0,
|
|
53292
|
+
const configPath = (0, import_node_path25.join)(root, filename);
|
|
53293
|
+
const generated = results.find((r) => (0, import_node_path25.resolve)(r.targetPath) === configPath);
|
|
53272
53294
|
let raw;
|
|
53273
53295
|
if (generated) {
|
|
53274
53296
|
raw = generated.newContent;
|
|
@@ -53377,7 +53399,8 @@ function routeAlreadyNamed(cwd, mention) {
|
|
|
53377
53399
|
const wanted = normalizePath(mention.path);
|
|
53378
53400
|
let out2;
|
|
53379
53401
|
try {
|
|
53380
|
-
out2 = (0, import_node_child_process11.execFileSync)("git", ["grep", "-I", "-n", "-F", "-e", anchor], {
|
|
53402
|
+
out2 = (0, import_node_child_process11.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-I", "-n", "-F", "-e", anchor], {
|
|
53403
|
+
env: gitEnv(),
|
|
53381
53404
|
cwd,
|
|
53382
53405
|
encoding: "utf8",
|
|
53383
53406
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -53670,7 +53693,7 @@ function describeVanishedTests(vanished) {
|
|
|
53670
53693
|
}
|
|
53671
53694
|
|
|
53672
53695
|
// src/verifyChange.ts
|
|
53673
|
-
var
|
|
53696
|
+
var import_node_path26 = require("node:path");
|
|
53674
53697
|
|
|
53675
53698
|
// src/packageUse.ts
|
|
53676
53699
|
var import_node_child_process12 = require("node:child_process");
|
|
@@ -53685,7 +53708,8 @@ function packageImportedInWorkspace(pkg, root, cwd = process.cwd()) {
|
|
|
53685
53708
|
if (!PACKAGE_NAME.test(pkg)) return false;
|
|
53686
53709
|
const pathspecs = FILE_TYPES.map((type) => root ? `:(glob)${root}/**/${type}` : `:(glob)**/${type}`);
|
|
53687
53710
|
try {
|
|
53688
|
-
(0, import_node_child_process12.execFileSync)("git", ["grep", "-q", "-E", "-e", importPattern(pkg), "--", ...pathspecs], {
|
|
53711
|
+
(0, import_node_child_process12.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-q", "-E", "-e", importPattern(pkg), "--", ...pathspecs], {
|
|
53712
|
+
env: gitEnv(),
|
|
53689
53713
|
cwd,
|
|
53690
53714
|
stdio: "ignore",
|
|
53691
53715
|
timeout: GREP_TIMEOUT_MS2
|
|
@@ -53732,7 +53756,7 @@ async function verifyChange(ctx, results, undoable) {
|
|
|
53732
53756
|
const depCheck = checkImportDependencies(results, readDeclaredDependencies(results, packet.workspaceRoot), resolveAliasPrefixes(results, packet.workspaceRoot), {
|
|
53733
53757
|
originalOf: (path) => {
|
|
53734
53758
|
try {
|
|
53735
|
-
return (0, import_node_fs24.readFileSync)((0,
|
|
53759
|
+
return (0, import_node_fs24.readFileSync)((0, import_node_path26.join)(cwd, path), "utf8");
|
|
53736
53760
|
} catch (err2) {
|
|
53737
53761
|
return err2.code === "ENOENT" ? "" : null;
|
|
53738
53762
|
}
|
|
@@ -53792,7 +53816,7 @@ async function verifyChange(ctx, results, undoable) {
|
|
|
53792
53816
|
flushedAt = now();
|
|
53793
53817
|
if (undoable) {
|
|
53794
53818
|
const report = findJUnitReport(cwd);
|
|
53795
|
-
const ignore = report ? [(0,
|
|
53819
|
+
const ignore = report ? [(0, import_node_path26.relative)(cwd, report).split("\\").join("/")] : [];
|
|
53796
53820
|
const flush = undoableFlush(cwd, results, flushCodegenResults, { ignore });
|
|
53797
53821
|
undo = () => flush.undo();
|
|
53798
53822
|
} else {
|
|
@@ -53958,7 +53982,7 @@ function buildToolsV2Env(i3) {
|
|
|
53958
53982
|
}
|
|
53959
53983
|
|
|
53960
53984
|
// src/repoMap.ts
|
|
53961
|
-
var
|
|
53985
|
+
var import_node_path27 = require("node:path");
|
|
53962
53986
|
var MAP_BUDGET_TOKENS = 4e3;
|
|
53963
53987
|
var MAX_FOLDERS = 200;
|
|
53964
53988
|
var MAX_LANGUAGES = 12;
|
|
@@ -54000,7 +54024,7 @@ function guidanceFiles(i3, perFile2, total) {
|
|
|
54000
54024
|
function languages2(listing) {
|
|
54001
54025
|
const counts = /* @__PURE__ */ new Map();
|
|
54002
54026
|
for (const p of listing) {
|
|
54003
|
-
const ext =
|
|
54027
|
+
const ext = import_node_path27.posix.extname(p).toLowerCase();
|
|
54004
54028
|
if (ext && ext.length <= 12) counts.set(ext, (counts.get(ext) ?? 0) + 1);
|
|
54005
54029
|
}
|
|
54006
54030
|
return [...counts.entries()].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)).slice(0, MAX_LANGUAGES).map(([ext, n]) => `${ext} ${n}`);
|
|
@@ -54016,7 +54040,7 @@ function testFacts(i3) {
|
|
|
54016
54040
|
const depth = i3.writeRoot === "" ? 0 : i3.writeRoot.split("/").length;
|
|
54017
54041
|
for (const t of tests) {
|
|
54018
54042
|
const parts2 = t.split("/");
|
|
54019
|
-
const folder = parts2.length > depth + 1 ? parts2.slice(0, depth + 1).join("/") :
|
|
54043
|
+
const folder = parts2.length > depth + 1 ? parts2.slice(0, depth + 1).join("/") : import_node_path27.posix.dirname(t);
|
|
54020
54044
|
byFolder.set(folder, (byFolder.get(folder) ?? 0) + 1);
|
|
54021
54045
|
}
|
|
54022
54046
|
for (const [folder, n] of [...byFolder.entries()].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1)).slice(0, 3)) {
|
|
@@ -54126,7 +54150,7 @@ function buildRepoMap(i3) {
|
|
|
54126
54150
|
}
|
|
54127
54151
|
|
|
54128
54152
|
// src/workspacePackages.ts
|
|
54129
|
-
var
|
|
54153
|
+
var import_node_path28 = require("node:path");
|
|
54130
54154
|
var MAX_READ_ROOTS = 8;
|
|
54131
54155
|
function isObject2(x) {
|
|
54132
54156
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
@@ -54188,8 +54212,8 @@ function workspacePackages(readText, packageJsonPaths) {
|
|
|
54188
54212
|
const exclude = patterns.filter((p) => p.startsWith("!")).map((p) => globMatcher(p.slice(1)));
|
|
54189
54213
|
const out2 = [];
|
|
54190
54214
|
for (const file of packageJsonPaths) {
|
|
54191
|
-
if (
|
|
54192
|
-
const folder =
|
|
54215
|
+
if (import_node_path28.posix.basename(file) !== "package.json" || file === "package.json" || file.split("/").includes("node_modules")) continue;
|
|
54216
|
+
const folder = import_node_path28.posix.dirname(file);
|
|
54193
54217
|
if (!include.some((re) => re.test(folder)) || exclude.some((re) => re.test(folder))) continue;
|
|
54194
54218
|
const text3 = readText(file);
|
|
54195
54219
|
const json = text3 === null ? null : parseJsonc(text3);
|
|
@@ -54469,27 +54493,27 @@ function writePhase0Marker(runId) {
|
|
|
54469
54493
|
// src/failureArtifact.ts
|
|
54470
54494
|
var import_node_child_process13 = require("node:child_process");
|
|
54471
54495
|
var import_node_fs26 = require("node:fs");
|
|
54472
|
-
var
|
|
54496
|
+
var import_node_path29 = require("node:path");
|
|
54473
54497
|
var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
54474
54498
|
var REPORT_COPY = "final-test-report.xml";
|
|
54475
54499
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
54476
54500
|
var MAX_FILES = 200;
|
|
54477
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
54501
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.87" : "dev";
|
|
54478
54502
|
function safeDestination(base, repoPath) {
|
|
54479
|
-
if (!repoPath || (0,
|
|
54480
|
-
const destination = (0,
|
|
54481
|
-
const rel = (0,
|
|
54482
|
-
if (!rel || rel.startsWith("..") || (0,
|
|
54503
|
+
if (!repoPath || (0, import_node_path29.isAbsolute)(repoPath)) return null;
|
|
54504
|
+
const destination = (0, import_node_path29.resolve)(base, repoPath);
|
|
54505
|
+
const rel = (0, import_node_path29.relative)(base, destination);
|
|
54506
|
+
if (!rel || rel.startsWith("..") || (0, import_node_path29.isAbsolute)(rel)) return null;
|
|
54483
54507
|
return destination;
|
|
54484
54508
|
}
|
|
54485
54509
|
var BUNDLE_FILE = "quikpilot-change.bundle";
|
|
54486
54510
|
function keepCommitBundle(repo, folder, branch) {
|
|
54487
|
-
const git4 = (args2) => (0, import_node_child_process13.execFileSync)("git", args2, { cwd: repo, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
54511
|
+
const git4 = (args2) => (0, import_node_child_process13.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd: repo, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
54488
54512
|
try {
|
|
54489
54513
|
if (git4(["rev-parse", "--abbrev-ref", "HEAD"]) !== branch) return null;
|
|
54490
54514
|
if (git4(["diff", "--name-only", "HEAD~1", "HEAD"]) === "") return null;
|
|
54491
54515
|
const commit2 = git4(["rev-parse", "HEAD"]);
|
|
54492
|
-
const file = (0,
|
|
54516
|
+
const file = (0, import_node_path29.join)(folder, BUNDLE_FILE);
|
|
54493
54517
|
git4(["bundle", "create", file, "HEAD", "^HEAD~1"]);
|
|
54494
54518
|
let verified = true;
|
|
54495
54519
|
try {
|
|
@@ -54505,7 +54529,7 @@ function keepCommitBundle(repo, folder, branch) {
|
|
|
54505
54529
|
function writeFailureArtifact(input) {
|
|
54506
54530
|
if (input.results.length === 0) return { written: false };
|
|
54507
54531
|
try {
|
|
54508
|
-
const base = (0,
|
|
54532
|
+
const base = (0, import_node_path29.resolve)(input.cwd, FAILURE_ARTIFACT_DIR);
|
|
54509
54533
|
(0, import_node_fs26.rmSync)(base, { recursive: true, force: true });
|
|
54510
54534
|
(0, import_node_fs26.mkdirSync)(base, { recursive: true });
|
|
54511
54535
|
const files = [];
|
|
@@ -54516,7 +54540,7 @@ function writeFailureArtifact(input) {
|
|
|
54516
54540
|
skipped.push(result.targetPath);
|
|
54517
54541
|
continue;
|
|
54518
54542
|
}
|
|
54519
|
-
(0, import_node_fs26.mkdirSync)((0,
|
|
54543
|
+
(0, import_node_fs26.mkdirSync)((0, import_node_path29.dirname)(destination), { recursive: true });
|
|
54520
54544
|
(0, import_node_fs26.writeFileSync)(destination, result.newContent);
|
|
54521
54545
|
files.push({ path: result.targetPath, bytes: Buffer.byteLength(result.newContent) });
|
|
54522
54546
|
}
|
|
@@ -54525,7 +54549,7 @@ function writeFailureArtifact(input) {
|
|
|
54525
54549
|
if (input.testReport.byteLength > MAX_REPORT_BYTES) {
|
|
54526
54550
|
testReport = "too-large";
|
|
54527
54551
|
} else {
|
|
54528
|
-
(0, import_node_fs26.writeFileSync)((0,
|
|
54552
|
+
(0, import_node_fs26.writeFileSync)((0, import_node_path29.join)(base, REPORT_COPY), input.testReport);
|
|
54529
54553
|
testReport = "included";
|
|
54530
54554
|
}
|
|
54531
54555
|
}
|
|
@@ -54547,8 +54571,8 @@ function writeFailureArtifact(input) {
|
|
|
54547
54571
|
bundle
|
|
54548
54572
|
};
|
|
54549
54573
|
const text3 = JSON.stringify(manifest, (_key, value) => typeof value === "string" ? scrubSecrets(value, input.secrets) : value, 2);
|
|
54550
|
-
(0, import_node_fs26.writeFileSync)((0,
|
|
54551
|
-
return { written: (0, import_node_fs26.existsSync)((0,
|
|
54574
|
+
(0, import_node_fs26.writeFileSync)((0, import_node_path29.join)(base, "manifest.json"), text3);
|
|
54575
|
+
return { written: (0, import_node_fs26.existsSync)((0, import_node_path29.join)(base, "manifest.json")) };
|
|
54552
54576
|
} catch (err2) {
|
|
54553
54577
|
console.warn(`::warning::Could not keep the failed run's files: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
54554
54578
|
return { written: false };
|
|
@@ -54558,9 +54582,10 @@ function writeFailureArtifact(input) {
|
|
|
54558
54582
|
// src/finalChange.ts
|
|
54559
54583
|
var import_node_child_process14 = require("node:child_process");
|
|
54560
54584
|
var import_node_fs27 = require("node:fs");
|
|
54561
|
-
var
|
|
54585
|
+
var import_node_path30 = require("node:path");
|
|
54562
54586
|
function statusPaths(root) {
|
|
54563
|
-
const status = (0, import_node_child_process14.execFileSync)("git", ["status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
|
|
54587
|
+
const status = (0, import_node_child_process14.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
|
|
54588
|
+
env: gitEnv(),
|
|
54564
54589
|
cwd: root,
|
|
54565
54590
|
encoding: "utf8",
|
|
54566
54591
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -54571,7 +54596,7 @@ function statusPaths(root) {
|
|
|
54571
54596
|
}
|
|
54572
54597
|
var isFileOnDisk = (root, path) => {
|
|
54573
54598
|
try {
|
|
54574
|
-
return (0, import_node_fs27.statSync)((0,
|
|
54599
|
+
return (0, import_node_fs27.statSync)((0, import_node_path30.join)(root, path)).isFile();
|
|
54575
54600
|
} catch {
|
|
54576
54601
|
return false;
|
|
54577
54602
|
}
|
|
@@ -54593,7 +54618,7 @@ function allChangesAgainstBase(root) {
|
|
|
54593
54618
|
// src/nameEvidence.ts
|
|
54594
54619
|
var import_node_child_process15 = require("node:child_process");
|
|
54595
54620
|
var import_node_fs28 = require("node:fs");
|
|
54596
|
-
var
|
|
54621
|
+
var import_node_path31 = require("node:path");
|
|
54597
54622
|
|
|
54598
54623
|
// src/migrationNames.ts
|
|
54599
54624
|
var PART = String.raw`(?:"[^"]+"|\x60[^\x60]+\x60|\[[^\]]+\]|[\w$]+)`;
|
|
@@ -54658,7 +54683,8 @@ var escapeRegExp5 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
|
54658
54683
|
function filesNaming(word, ev, readable, denied) {
|
|
54659
54684
|
let out2;
|
|
54660
54685
|
try {
|
|
54661
|
-
out2 = (0, import_node_child_process15.execFileSync)("git", ["grep", "-l", "-I", "-w", "-F", "-e", word], {
|
|
54686
|
+
out2 = (0, import_node_child_process15.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-l", "-I", "-w", "-F", "-e", word], {
|
|
54687
|
+
env: gitEnv(),
|
|
54662
54688
|
cwd: ev.cwd,
|
|
54663
54689
|
encoding: "utf8",
|
|
54664
54690
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -54672,7 +54698,7 @@ function filesNaming(word, ev, readable, denied) {
|
|
|
54672
54698
|
}
|
|
54673
54699
|
function fileHasWord(cwd, file, word) {
|
|
54674
54700
|
try {
|
|
54675
|
-
const path = (0,
|
|
54701
|
+
const path = (0, import_node_path31.join)(cwd, file);
|
|
54676
54702
|
if ((0, import_node_fs28.statSync)(path).size > MAX_FILE_BYTES2) return false;
|
|
54677
54703
|
return new RegExp(`(?<![\\w$])${escapeRegExp5(word)}(?![\\w$])`).test((0, import_node_fs28.readFileSync)(path, "utf8"));
|
|
54678
54704
|
} catch {
|