@quikit/quikpilot-runner 9.3.0-rc.86 → 9.3.0-rc.88

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/dist/index.js CHANGED
@@ -16872,7 +16872,7 @@ var require_sourcemap_codec_umd = __commonJS2({
16872
16872
  intToChar[i3] = c;
16873
16873
  charToInt[c] = i3;
16874
16874
  }
16875
- function decodeInteger(reader, relative11) {
16875
+ function decodeInteger(reader, relative12) {
16876
16876
  let value = 0;
16877
16877
  let shift = 0;
16878
16878
  let integer = 0;
@@ -16887,10 +16887,10 @@ var require_sourcemap_codec_umd = __commonJS2({
16887
16887
  if (shouldNegate) {
16888
16888
  value = -2147483648 | -value;
16889
16889
  }
16890
- return relative11 + value;
16890
+ return relative12 + value;
16891
16891
  }
16892
- function encodeInteger(builder, num2, relative11) {
16893
- let delta = num2 - relative11;
16892
+ function encodeInteger(builder, num2, relative12) {
16893
+ let delta = num2 - relative12;
16894
16894
  delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
16895
16895
  do {
16896
16896
  let clamped = delta & 31;
@@ -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 import_node_os2 = require("node:os");
28533
- var import_node_path7 = require("node:path");
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) {
@@ -28624,18 +28624,377 @@ function applyEdits(originalLf, edits) {
28624
28624
  return { ok: true, content: pieces.join(""), editCount: edits.length };
28625
28625
  }
28626
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;
28968
+ }
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;
28982
+ }
28983
+ return { ...env2, ...extra };
28984
+ }
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 import_node_os = require("node:os");
28631
- var import_node_path6 = require("node:path");
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 import_node_path = require("node:path");
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 = import_node_path.posix.normalize(raw).replace(/\/+$/, "");
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: { ...process.env, ...extraEnv }
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,24 @@ 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() });
29104
+ return out2.split("\0").filter(Boolean);
29105
+ }
29106
+ function stagedDeletions() {
29107
+ const out2 = (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "diff", "--cached", "--name-only", "-z", "--no-renames", "--diff-filter=D"], {
29108
+ encoding: "utf8",
29109
+ maxBuffer: LIST_MAX_BUFFER_BYTES,
29110
+ env: gitEnv()
29111
+ });
28744
29112
  return out2.split("\0").filter(Boolean);
28745
29113
  }
29114
+ function unstage(paths) {
29115
+ if (paths.length === 0) return;
29116
+ (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "restore", "--staged", "--", ...paths], { encoding: "utf8", env: gitEnv() });
29117
+ }
28746
29118
  function hasStagedChanges() {
28747
29119
  try {
28748
- (0, import_node_child_process.execFileSync)("git", ["diff", "--cached", "--quiet"]);
29120
+ (0, import_node_child_process.execFileSync)("git", [...NO_HOOKS_ARGS, "diff", "--cached", "--quiet"], { env: gitEnv() });
28749
29121
  return false;
28750
29122
  } catch {
28751
29123
  return true;
@@ -28884,7 +29256,7 @@ var GIT_MAX_BUFFER = 32 * 1024 * 1024;
28884
29256
  var MAX_COMMITS_LOOKED_AT = 400;
28885
29257
  var WALK_BUDGET_MS = 25e3;
28886
29258
  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"] });
29259
+ 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
29260
  function parseFileCommits(log) {
28889
29261
  const out2 = [];
28890
29262
  for (const block of log.split("")) {
@@ -36574,7 +36946,7 @@ function setupAdded(input) {
36574
36946
  }
36575
36947
 
36576
36948
  // src/featureTestUpdates.ts
36577
- var import_node_path2 = require("node:path");
36949
+ var import_node_path3 = require("node:path");
36578
36950
  var FEATURE_TEST_UPDATES_KEY = "featureTestUpdates";
36579
36951
  function featureTestUpdatesOn(env2 = process.env) {
36580
36952
  return env2.QUIKPILOT_FEATURE_TEST_UPDATES?.trim().toLowerCase() === "on";
@@ -36593,7 +36965,7 @@ var WEAK_TEST_FOLDER = /(^|\/)(tests?|spec|testutil|testing)\//;
36593
36965
  function isTestSupportPath(path, listing, discovered) {
36594
36966
  if (!listing.includes(path)) return false;
36595
36967
  if (isTestTarget(path, discovered ? new Set(discovered) : null)) return true;
36596
- if (STRONG_TEST_FOLDER.test(path) || import_node_path2.posix.basename(path) === "conftest.py") return true;
36968
+ if (STRONG_TEST_FOLDER.test(path) || import_node_path3.posix.basename(path) === "conftest.py") return true;
36597
36969
  const weak = WEAK_TEST_FOLDER.exec(path);
36598
36970
  if (!weak) return false;
36599
36971
  if (!discovered) return true;
@@ -36606,9 +36978,9 @@ var stripExt = (p) => p.replace(/\.[cm]?[jt]sx?$/i, "");
36606
36978
  var escapeRegExp3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
36607
36979
  function jsNames(spec, from, helper) {
36608
36980
  const target = stripExt(helper);
36609
- const targets = [target, ...import_node_path2.posix.basename(target) === "index" ? [import_node_path2.posix.dirname(target)] : []];
36981
+ const targets = [target, ...import_node_path3.posix.basename(target) === "index" ? [import_node_path3.posix.dirname(target)] : []];
36610
36982
  if (spec.startsWith(".")) {
36611
- const resolved = stripExt(import_node_path2.posix.normalize(import_node_path2.posix.join(import_node_path2.posix.dirname(from), spec)));
36983
+ const resolved = stripExt(import_node_path3.posix.normalize(import_node_path3.posix.join(import_node_path3.posix.dirname(from), spec)));
36612
36984
  return targets.includes(resolved);
36613
36985
  }
36614
36986
  const rest = stripExt(spec.replace(/^[@~#]\//, ""));
@@ -36620,8 +36992,8 @@ function usesHelper(from, text3, helper) {
36620
36992
  if (from === helper) return false;
36621
36993
  if (/\.[cm]?[jt]sx?$/i.test(helper)) return [...text3.matchAll(JS_SPECIFIER)].some((m) => jsNames(m[1], from, helper));
36622
36994
  if (helper.endsWith(".py")) {
36623
- if (import_node_path2.posix.basename(helper) === "conftest.py") {
36624
- const dir = import_node_path2.posix.dirname(helper);
36995
+ if (import_node_path3.posix.basename(helper) === "conftest.py") {
36996
+ const dir = import_node_path3.posix.dirname(helper);
36625
36997
  return dir === "." || from.startsWith(`${dir}/`);
36626
36998
  }
36627
36999
  const dotted = helper.slice(0, -3).split("/").join(".");
@@ -36631,11 +37003,11 @@ function usesHelper(from, text3, helper) {
36631
37003
  });
36632
37004
  }
36633
37005
  if (helper.endsWith(".go")) {
36634
- const dir = import_node_path2.posix.dirname(helper);
36635
- return import_node_path2.posix.dirname(from) === dir || dir !== "." && new RegExp(`"[^"]*(^|/)${escapeRegExp3(dir)}"`).test(text3);
37006
+ const dir = import_node_path3.posix.dirname(helper);
37007
+ return import_node_path3.posix.dirname(from) === dir || dir !== "." && new RegExp(`"[^"]*(^|/)${escapeRegExp3(dir)}"`).test(text3);
36636
37008
  }
36637
37009
  if (helper.endsWith(".java") || helper.endsWith(".kt")) {
36638
- const name2 = import_node_path2.posix.basename(helper).replace(/\.(java|kt)$/, "");
37010
+ const name2 = import_node_path3.posix.basename(helper).replace(/\.(java|kt)$/, "");
36639
37011
  return new RegExp(`\\b${escapeRegExp3(name2)}\\b`).test(text3);
36640
37012
  }
36641
37013
  return false;
@@ -36652,7 +37024,7 @@ function usedByOf(helper, testFiles, read) {
36652
37024
 
36653
37025
  // src/targetingTools.ts
36654
37026
  var import_node_fs2 = require("node:fs");
36655
- var import_node_path4 = require("node:path");
37027
+ var import_node_path5 = require("node:path");
36656
37028
 
36657
37029
  // src/genericDenies.ts
36658
37030
  var OTHER_LOCK_FILES = [
@@ -36719,12 +37091,13 @@ var CREDENTIAL_FILES = [
36719
37091
  "**/*.ppk"
36720
37092
  ];
36721
37093
  var GIT_INTERNALS = [".git/**"];
37094
+ var HOOK_FILES = ["**/.husky/**", "**/.githooks/**", "**/lefthook*.yml", "**/.lefthook*.yml"];
36722
37095
  function withExtra(denied, extra) {
36723
37096
  const have = new Set(denied);
36724
37097
  return [...denied, ...extra.filter((p) => !have.has(p))];
36725
37098
  }
36726
37099
  function writeDenied(denied) {
36727
- return withExtra(denied, [...OTHER_LOCK_FILES, ...CREDENTIAL_FILES, ...GIT_INTERNALS]);
37100
+ return withExtra(denied, [...OTHER_LOCK_FILES, ...CREDENTIAL_FILES, ...GIT_INTERNALS, ...HOOK_FILES]);
36728
37101
  }
36729
37102
  function readDenied(denied) {
36730
37103
  return withExtra(writeDenied(denied), SECRET_SHAPED_FILES);
@@ -36747,159 +37120,6 @@ function isGeneratedText(lf) {
36747
37120
  }
36748
37121
  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
37122
 
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
- });
36901
- }
36902
-
36903
37123
  // src/definitions.ts
36904
37124
  var MAX_NAME_CHARS = 80;
36905
37125
  var MAX_DEFINITIONS = 2e3;
@@ -37068,7 +37288,7 @@ function definitionsOfFile(path, text3) {
37068
37288
  }
37069
37289
 
37070
37290
  // src/importContext.ts
37071
- var import_node_path3 = require("node:path");
37291
+ var import_node_path4 = require("node:path");
37072
37292
  var REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
37073
37293
  "return",
37074
37294
  "typeof",
@@ -37320,14 +37540,14 @@ function resolveImport(fromPath, specifier, listing, mapSpecifier) {
37320
37540
  }
37321
37541
  if (/^(?:@\/|~\/|#|\$|\/)/.test(specifier)) return { kind: "unresolved", reason: "alias" };
37322
37542
  const clean = specifier.replace(/[?#].*$/, "");
37323
- const relative11 = clean === "." || clean === ".." || clean.startsWith("./") || clean.startsWith("../");
37324
- if (!relative11) return { kind: "external" };
37325
- const base = import_node_path3.posix.normalize(import_node_path3.posix.join(import_node_path3.posix.dirname(fromPath), clean));
37326
- if (base === ".." || base.startsWith("../") || import_node_path3.posix.isAbsolute(base)) return { kind: "unresolved", reason: "not found" };
37543
+ const relative12 = clean === "." || clean === ".." || clean.startsWith("./") || clean.startsWith("../");
37544
+ if (!relative12) return { kind: "external" };
37545
+ const base = import_node_path4.posix.normalize(import_node_path4.posix.join(import_node_path4.posix.dirname(fromPath), clean));
37546
+ if (base === ".." || base.startsWith("../") || import_node_path4.posix.isAbsolute(base)) return { kind: "unresolved", reason: "not found" };
37327
37547
  return probeBase(base, listing);
37328
37548
  }
37329
37549
  function probeBase(base, listing) {
37330
- const ext = import_node_path3.posix.extname(base);
37550
+ const ext = import_node_path4.posix.extname(base);
37331
37551
  if (ASSET_EXTS.has(ext.toLowerCase())) return { kind: "unresolved", reason: "asset" };
37332
37552
  const candidates = [];
37333
37553
  if (CODE_EXTS.includes(ext)) {
@@ -38233,16 +38453,16 @@ function createNodeToolFs(rootDir = process.cwd()) {
38233
38453
  return {
38234
38454
  rootReal,
38235
38455
  lstat(rel) {
38236
- const s = (0, import_node_fs2.lstatSync)((0, import_node_path4.join)(rootDir, rel));
38456
+ const s = (0, import_node_fs2.lstatSync)((0, import_node_path5.join)(rootDir, rel));
38237
38457
  return { isSymlink: s.isSymbolicLink(), isFile: s.isFile(), size: s.size };
38238
38458
  },
38239
38459
  realpathInside(rel) {
38240
- const real = (0, import_node_fs2.realpathSync)((0, import_node_path4.join)(rootDir, rel));
38241
- const r = (0, import_node_path4.relative)(rootReal, real);
38242
- return r !== "" && !r.startsWith("..") && !(0, import_node_path4.isAbsolute)(r);
38460
+ const real = (0, import_node_fs2.realpathSync)((0, import_node_path5.join)(rootDir, rel));
38461
+ const r = (0, import_node_path5.relative)(rootReal, real);
38462
+ return r !== "" && !r.startsWith("..") && !(0, import_node_path5.isAbsolute)(r);
38243
38463
  },
38244
38464
  readBytes(rel) {
38245
- return (0, import_node_fs2.readFileSync)((0, import_node_path4.join)(rootDir, rel));
38465
+ return (0, import_node_fs2.readFileSync)((0, import_node_path5.join)(rootDir, rel));
38246
38466
  }
38247
38467
  };
38248
38468
  }
@@ -38633,22 +38853,22 @@ function outsideRootMessage(root) {
38633
38853
 
38634
38854
  // src/workspaceOverlay.ts
38635
38855
  var import_node_fs3 = require("node:fs");
38636
- var import_node_path5 = require("node:path");
38856
+ var import_node_path6 = require("node:path");
38637
38857
  function createNodeWriteFs(rootDir = process.cwd()) {
38638
38858
  const base = createNodeToolFs(rootDir);
38639
38859
  const inside3 = (real) => {
38640
- const r = (0, import_node_path5.relative)(base.rootReal, real);
38641
- return !r.startsWith("..") && !(0, import_node_path5.isAbsolute)(r);
38860
+ const r = (0, import_node_path6.relative)(base.rootReal, real);
38861
+ return !r.startsWith("..") && !(0, import_node_path6.isAbsolute)(r);
38642
38862
  };
38643
38863
  return {
38644
38864
  ...base,
38645
38865
  parentInside(rel) {
38646
- let dir = (0, import_node_path5.dirname)((0, import_node_path5.join)(rootDir, rel));
38866
+ let dir = (0, import_node_path6.dirname)((0, import_node_path6.join)(rootDir, rel));
38647
38867
  for (; ; ) {
38648
38868
  try {
38649
38869
  return inside3((0, import_node_fs3.realpathSync)(dir));
38650
38870
  } catch {
38651
- const up = (0, import_node_path5.dirname)(dir);
38871
+ const up = (0, import_node_path6.dirname)(dir);
38652
38872
  if (up === dir) return false;
38653
38873
  dir = up;
38654
38874
  }
@@ -38656,7 +38876,7 @@ function createNodeWriteFs(rootDir = process.cwd()) {
38656
38876
  },
38657
38877
  exists(rel) {
38658
38878
  try {
38659
- (0, import_node_fs3.lstatSync)((0, import_node_path5.join)(rootDir, rel));
38879
+ (0, import_node_fs3.lstatSync)((0, import_node_path6.join)(rootDir, rel));
38660
38880
  return true;
38661
38881
  } catch {
38662
38882
  return false;
@@ -39332,14 +39552,17 @@ function editOverreach(path, before, after, kept, indexes) {
39332
39552
 
39333
39553
  // src/proposal.ts
39334
39554
  var GIT_MAX_BUFFER2 = 64 * 1024 * 1024;
39335
- var runGit = (args2, opts = {}) => (0, import_node_child_process3.execFileSync)("git", args2, {
39336
- encoding: "utf8",
39337
- ...opts.input !== void 0 ? { input: opts.input } : {},
39338
- env: { ...process.env, ...opts.env },
39339
- ...opts.cwd ? { cwd: opts.cwd } : {},
39340
- maxBuffer: GIT_MAX_BUFFER2,
39341
- stdio: ["pipe", "pipe", "pipe"]
39342
- });
39555
+ var runGit = (args2, opts = {}) => (
39556
+ // QUIKTR-2704: no repository hook can run (update-ref fires reference-transaction), and git gets a minimal environment.
39557
+ (0, import_node_child_process3.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], {
39558
+ encoding: "utf8",
39559
+ ...opts.input !== void 0 ? { input: opts.input } : {},
39560
+ env: gitEnv(opts.env),
39561
+ ...opts.cwd ? { cwd: opts.cwd } : {},
39562
+ maxBuffer: GIT_MAX_BUFFER2,
39563
+ stdio: ["pipe", "pipe", "pipe"]
39564
+ })
39565
+ );
39343
39566
  var BOT_ENV = {
39344
39567
  GIT_AUTHOR_NAME: "quikpilot[bot]",
39345
39568
  GIT_AUTHOR_EMAIL: "quikpilot@users.noreply.github.com",
@@ -39500,9 +39723,9 @@ function createProposalCommit(input) {
39500
39723
  if (files.length === 0) return null;
39501
39724
  const lines = files.flatMap((f) => f.conflicts.map((c) => lineOf2(c, f)));
39502
39725
  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, import_node_path6.join)((0, import_node_os.tmpdir)(), "qp-proposal-"));
39726
+ const dir = (0, import_node_fs4.mkdtempSync)((0, import_node_path7.join)((0, import_node_os2.tmpdir)(), "qp-proposal-"));
39504
39727
  try {
39505
- const env2 = { GIT_INDEX_FILE: (0, import_node_path6.join)(dir, "index"), ...BOT_ENV };
39728
+ const env2 = { GIT_INDEX_FILE: (0, import_node_path7.join)(dir, "index"), ...BOT_ENV };
39506
39729
  const head = git4(["rev-parse", "HEAD"], { cwd }).trim();
39507
39730
  git4(["read-tree", head], { env: env2, cwd });
39508
39731
  for (const f of files) {
@@ -39598,7 +39821,7 @@ function loadApprovedTests(input) {
39598
39821
  }
39599
39822
  const readCurrent = input.readCurrent ?? ((path) => {
39600
39823
  try {
39601
- return (0, import_node_fs5.readFileSync)((0, import_node_path7.join)(cwd ?? process.cwd(), path), "utf8");
39824
+ return (0, import_node_fs5.readFileSync)((0, import_node_path8.join)(cwd ?? process.cwd(), path), "utf8");
39602
39825
  } catch {
39603
39826
  return null;
39604
39827
  }
@@ -39679,13 +39902,15 @@ function setupOverreach(input) {
39679
39902
  return verdict.ok ? null : verdict.why;
39680
39903
  }
39681
39904
  var gitMergeText = ({ ours, base, theirs }) => {
39682
- const dir = (0, import_node_fs5.mkdtempSync)((0, import_node_path7.join)((0, import_node_os2.tmpdir)(), "qp-merge-"));
39905
+ const dir = (0, import_node_fs5.mkdtempSync)((0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "qp-merge-"));
39683
39906
  try {
39684
- (0, import_node_fs5.writeFileSync)((0, import_node_path7.join)(dir, "ours"), ours);
39685
- (0, import_node_fs5.writeFileSync)((0, import_node_path7.join)(dir, "base"), base);
39686
- (0, import_node_fs5.writeFileSync)((0, import_node_path7.join)(dir, "theirs"), theirs);
39687
- return (0, import_node_child_process4.execFileSync)("git", ["merge-file", "-p", (0, import_node_path7.join)(dir, "ours"), (0, import_node_path7.join)(dir, "base"), (0, import_node_path7.join)(dir, "theirs")], {
39907
+ (0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "ours"), ours);
39908
+ (0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "base"), base);
39909
+ (0, import_node_fs5.writeFileSync)((0, import_node_path8.join)(dir, "theirs"), theirs);
39910
+ 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
39911
  encoding: "utf8",
39912
+ env: gitEnv(),
39913
+ // QUIKTR-2704: git never gets the runner's whole environment.
39689
39914
  maxBuffer: 64 * 1024 * 1024,
39690
39915
  stdio: ["ignore", "pipe", "ignore"]
39691
39916
  });
@@ -39699,7 +39924,7 @@ function loadApprovals(input) {
39699
39924
  const warnings = [];
39700
39925
  const readCurrent = input.readCurrent ?? ((path) => {
39701
39926
  try {
39702
- return (0, import_node_fs5.readFileSync)((0, import_node_path7.join)(input.cwd ?? process.cwd(), path), "utf8");
39927
+ return (0, import_node_fs5.readFileSync)((0, import_node_path8.join)(input.cwd ?? process.cwd(), path), "utf8");
39703
39928
  } catch {
39704
39929
  return null;
39705
39930
  }
@@ -39897,199 +40122,6 @@ async function reportBack(params) {
39897
40122
 
39898
40123
  // src/commands.ts
39899
40124
  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
40125
  var withheldLogged = false;
40094
40126
  function repositoryCommandEnv() {
40095
40127
  if (!withheldLogged) {
@@ -40302,11 +40334,11 @@ function gateNoTimeMessage(baselineMs) {
40302
40334
  // src/testPlan.ts
40303
40335
  var import_node_crypto = require("node:crypto");
40304
40336
  var import_node_fs10 = require("node:fs");
40305
- var import_node_os3 = require("node:os");
40306
- var import_node_path13 = require("node:path");
40337
+ var import_node_os4 = require("node:os");
40338
+ var import_node_path14 = require("node:path");
40307
40339
 
40308
40340
  // src/pairedTests.ts
40309
- var import_node_path8 = require("node:path");
40341
+ var import_node_path9 = require("node:path");
40310
40342
  var MAX_TESTS_PER_TARGET = 3;
40311
40343
  var MAX_REVERSE_TEST_CHARS = 24e3;
40312
40344
  var MAX_TEST_FILE_CHARS = 2e5;
@@ -40348,28 +40380,28 @@ var TestCorpus = class {
40348
40380
  }
40349
40381
  };
40350
40382
  function stemOf(path) {
40351
- const base = import_node_path8.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "");
40352
- return base === "index" ? import_node_path8.posix.basename(import_node_path8.posix.dirname(path)) : base;
40383
+ const base = import_node_path9.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "");
40384
+ return base === "index" ? import_node_path9.posix.basename(import_node_path9.posix.dirname(path)) : base;
40353
40385
  }
40354
40386
  function sharedPrefix(a, b) {
40355
- const x = import_node_path8.posix.dirname(a).split("/");
40356
- const y = import_node_path8.posix.dirname(b).split("/");
40387
+ const x = import_node_path9.posix.dirname(a).split("/");
40388
+ const y = import_node_path9.posix.dirname(b).split("/");
40357
40389
  let n = 0;
40358
40390
  while (n < x.length && n < y.length && x[n] === y[n]) n++;
40359
40391
  return n;
40360
40392
  }
40361
40393
  function namesOf(path) {
40362
- const base = import_node_path8.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "").toLowerCase();
40394
+ const base = import_node_path9.posix.basename(path).replace(/\.[cm]?[jt]sx?$/i, "").toLowerCase();
40363
40395
  const names = base.length >= 2 ? [base] : [];
40364
40396
  if (ROUTE_FILE_NAMES.has(base)) {
40365
- const parts2 = import_node_path8.posix.dirname(path).split("/").filter(Boolean);
40397
+ const parts2 = import_node_path9.posix.dirname(path).split("/").filter(Boolean);
40366
40398
  while (parts2.length > 0 && /^[[(]/.test(parts2[parts2.length - 1])) parts2.pop();
40367
40399
  const folder = parts2[parts2.length - 1];
40368
40400
  if (folder && folder.length >= 3) names.push(folder.toLowerCase());
40369
40401
  }
40370
40402
  return names;
40371
40403
  }
40372
- var namedAfter = (test, path) => namesOf(path).some((n) => import_node_path8.posix.basename(test).toLowerCase().startsWith(n));
40404
+ var namedAfter = (test, path) => namesOf(path).some((n) => import_node_path9.posix.basename(test).toLowerCase().startsWith(n));
40373
40405
  function testsImporting(p) {
40374
40406
  if (p.limit <= 0 || (p.isTest ?? isTestTarget)(p.target) || !supportsImportScan(p.target)) return [];
40375
40407
  const stem = stemOf(p.target);
@@ -40383,7 +40415,7 @@ function testsImporting(p) {
40383
40415
  return r.kind === "repo" && r.path === p.target;
40384
40416
  });
40385
40417
  if (!imported) continue;
40386
- hits.push({ path: file.path, named: import_node_path8.posix.basename(file.path).toLowerCase().startsWith(stem.toLowerCase()), near: sharedPrefix(file.path, p.target), size: file.text.length });
40418
+ 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
40419
  }
40388
40420
  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
40421
  return hits.slice(0, p.limit).map((h) => h.path);
@@ -40445,16 +40477,17 @@ function testsThroughOneFile(p) {
40445
40477
  // src/testAdapters.ts
40446
40478
  var import_node_fs9 = require("node:fs");
40447
40479
  var import_node_module = require("node:module");
40448
- var import_node_path11 = require("node:path");
40480
+ var import_node_path12 = require("node:path");
40449
40481
 
40450
40482
  // src/baselineCheck.ts
40451
- var import_node_child_process6 = require("node:child_process");
40483
+ var import_node_child_process7 = require("node:child_process");
40452
40484
  var import_node_fs8 = require("node:fs");
40453
- var import_node_path10 = require("node:path");
40485
+ var import_node_path11 = require("node:path");
40454
40486
 
40455
40487
  // src/quiktest.ts
40488
+ var import_node_child_process6 = require("node:child_process");
40456
40489
  var import_node_fs6 = require("node:fs");
40457
- var import_node_path9 = require("node:path");
40490
+ var import_node_path10 = require("node:path");
40458
40491
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
40459
40492
  var DEPENDENCY_DIRS = /* @__PURE__ */ new Set([
40460
40493
  "node_modules",
@@ -40500,7 +40533,7 @@ function findJUnitReports(cwd = process.cwd(), opts = {}) {
40500
40533
  }
40501
40534
  for (const entry of entries) {
40502
40535
  if (DEPENDENCY_DIRS.has(entry)) continue;
40503
- const full = (0, import_node_path9.join)(dir, entry);
40536
+ const full = (0, import_node_path10.join)(dir, entry);
40504
40537
  let stat;
40505
40538
  try {
40506
40539
  stat = (0, import_node_fs6.statSync)(full);
@@ -40518,6 +40551,34 @@ function findJUnitReports(cwd = process.cwd(), opts = {}) {
40518
40551
  const named2 = (p) => /^junit.*\.xml$/i.test(p.split(/[\\/]/).pop() ?? "") ? 0 : 1;
40519
40552
  return found.sort((a, b) => named2(a) - named2(b) || a.localeCompare(b));
40520
40553
  }
40554
+ function trackedPaths(paths, cwd = process.cwd()) {
40555
+ if (paths.length === 0) return /* @__PURE__ */ new Set();
40556
+ try {
40557
+ const rel = paths.map((p) => (0, import_node_path10.relative)(cwd, p).replace(/\\/g, "/"));
40558
+ const out2 = (0, import_node_child_process6.execFileSync)("git", [...NO_HOOKS_ARGS, "ls-files", "-z", "--", ...rel], {
40559
+ cwd,
40560
+ encoding: "utf8",
40561
+ env: gitEnv(),
40562
+ maxBuffer: 16 * 1024 * 1024,
40563
+ stdio: ["ignore", "pipe", "pipe"]
40564
+ });
40565
+ const tracked = new Set(out2.split("\0").filter(Boolean));
40566
+ return new Set(paths.filter((_, i3) => tracked.has(rel[i3])));
40567
+ } catch (err2) {
40568
+ const said = String(err2.stderr ?? "");
40569
+ return /not a git repository/i.test(said) ? /* @__PURE__ */ new Set() : new Set(paths);
40570
+ }
40571
+ }
40572
+ function runReports(cwd = process.cwd(), opts = {}) {
40573
+ const found = findJUnitReports(cwd, opts);
40574
+ const tracked = trackedPaths(found, cwd);
40575
+ return found.filter((p) => !tracked.has(p));
40576
+ }
40577
+ function removeRunReports(cwd = process.cwd()) {
40578
+ const reports = runReports(cwd);
40579
+ for (const report of reports) (0, import_node_fs6.rmSync)(report, { force: true });
40580
+ return reports.length;
40581
+ }
40521
40582
  function mergeJUnitReports(texts) {
40522
40583
  if (texts.length === 1) return texts[0];
40523
40584
  const inner = texts.map((t) => {
@@ -40541,7 +40602,7 @@ function walkForJUnitByName(dir) {
40541
40602
  }
40542
40603
  for (const entry of entries) {
40543
40604
  if (SKIP_DIRS.has(entry)) continue;
40544
- const full = (0, import_node_path9.join)(dir, entry);
40605
+ const full = (0, import_node_path10.join)(dir, entry);
40545
40606
  let stat;
40546
40607
  try {
40547
40608
  stat = (0, import_node_fs6.statSync)(full);
@@ -40565,11 +40626,11 @@ function firstXmlIn(dir, namePattern) {
40565
40626
  return null;
40566
40627
  }
40567
40628
  const match = entries.find((e) => namePattern.test(e));
40568
- return match ? (0, import_node_path9.join)(dir, match) : null;
40629
+ return match ? (0, import_node_path10.join)(dir, match) : null;
40569
40630
  }
40570
- function readTestReportBytes(cwd = process.cwd()) {
40631
+ function readTestReportBytes(cwd = process.cwd(), opts = {}) {
40571
40632
  try {
40572
- const reports = findJUnitReports(cwd);
40633
+ const reports = runReports(cwd, opts);
40573
40634
  if (reports.length === 0) return null;
40574
40635
  if (reports.length === 1) return (0, import_node_fs6.readFileSync)(reports[0]);
40575
40636
  return Buffer.from(mergeJUnitReports(reports.map((r) => (0, import_node_fs6.readFileSync)(r, "utf8"))), "utf8");
@@ -40578,7 +40639,7 @@ function readTestReportBytes(cwd = process.cwd()) {
40578
40639
  }
40579
40640
  }
40580
40641
  function findJUnitReport(cwd = process.cwd()) {
40581
- return walkForJUnitByName(cwd) ?? findJUnitReports(cwd)[0] ?? firstXmlIn((0, import_node_path9.join)(cwd, "test-results"), /\.xml$/) ?? firstXmlIn((0, import_node_path9.join)(cwd, "reports"), /^junit.*\.xml$/) ?? firstXmlIn((0, import_node_path9.join)(cwd, "target", "surefire-reports"), /\.xml$/);
40642
+ 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
40643
  }
40583
40644
  function buildCiUrl(serverUrl, repository, githubRunId) {
40584
40645
  return `${serverUrl}/${repository}/actions/runs/${githubRunId}`;
@@ -40589,12 +40650,12 @@ function describeUnmatchedAutomationIds(unmatched) {
40589
40650
  return `${unmatched.length} generated test result(s) did not match any test case: ${named2} \u2014 check the automationId format.`;
40590
40651
  }
40591
40652
  async function reportToQuikTest(params) {
40592
- const { resultsUrl, runToken, githubServerUrl, githubRepository, githubRunId, generatedFiles, cwd } = params;
40653
+ const { resultsUrl, runToken, githubServerUrl, githubRepository, githubRunId, generatedFiles, cwd, freshSinceMs } = params;
40593
40654
  if (!resultsUrl) {
40594
40655
  console.log("packet.quikTest is null \u2014 this run has no QuikTest run to report into.");
40595
40656
  return null;
40596
40657
  }
40597
- const reports = findJUnitReports(cwd);
40658
+ const reports = runReports(cwd, { freshSinceMs });
40598
40659
  if (reports.length === 0) {
40599
40660
  console.warn("::warning::QuikPilot found no JUnit report \u2014 no results reported to QuikTest.");
40600
40661
  return null;
@@ -40615,7 +40676,6 @@ async function reportToQuikTest(params) {
40615
40676
  if (!res.ok) {
40616
40677
  throw new Error(`QuikTest report POST failed: ${res.status} ${res.statusText}`);
40617
40678
  }
40618
- for (const report of reports) (0, import_node_fs6.rmSync)(report, { force: true });
40619
40679
  let unmatched = [];
40620
40680
  try {
40621
40681
  const json = await res.json();
@@ -41054,16 +41114,16 @@ function checkableIds(ids, types2) {
41054
41114
  });
41055
41115
  }
41056
41116
  function insideCheckout(cwd, path) {
41057
- const abs = (0, import_node_path10.resolve)(cwd, path);
41058
- const rel = (0, import_node_path10.relative)(cwd, abs);
41059
- return rel === "" || rel.startsWith("..") || (0, import_node_path10.isAbsolute)(rel) ? null : abs;
41117
+ const abs = (0, import_node_path11.resolve)(cwd, path);
41118
+ const rel = (0, import_node_path11.relative)(cwd, abs);
41119
+ return rel === "" || rel.startsWith("..") || (0, import_node_path11.isAbsolute)(rel) ? null : abs;
41060
41120
  }
41061
41121
  function writeForCheck(abs, content) {
41062
41122
  const original = (0, import_node_fs8.existsSync)(abs) ? (0, import_node_fs8.readFileSync)(abs) : null;
41063
41123
  const createdDirs = [];
41064
41124
  if (original === null) {
41065
41125
  const missing = [];
41066
- for (let d = (0, import_node_path10.dirname)(abs); !(0, import_node_fs8.existsSync)(d); d = (0, import_node_path10.dirname)(d)) missing.push(d);
41126
+ 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
41127
  for (const d of missing.reverse()) {
41068
41128
  (0, import_node_fs8.mkdirSync)(d);
41069
41129
  createdDirs.push(d);
@@ -41090,7 +41150,8 @@ function restore(written) {
41090
41150
  }
41091
41151
  function untrackedFiles(cwd) {
41092
41152
  try {
41093
- const out2 = (0, import_node_child_process6.execFileSync)("git", ["ls-files", "--others", "--exclude-standard", "-z"], {
41153
+ const out2 = (0, import_node_child_process7.execFileSync)("git", [...NO_HOOKS_ARGS, "ls-files", "--others", "--exclude-standard", "-z"], {
41154
+ env: gitEnv(),
41094
41155
  cwd,
41095
41156
  encoding: "utf8",
41096
41157
  stdio: ["ignore", "pipe", "ignore"],
@@ -41226,11 +41287,11 @@ var CONFIG_FILES = ["vitest.config.ts", "vitest.config.mts", "vitest.config.cts"
41226
41287
  var WORKSPACE_IN_CONFIG = /\b(?:workspace|projects)\s*:/;
41227
41288
  function defaultResolveVitest(cwd) {
41228
41289
  try {
41229
- const pkgPath = (0, import_node_module.createRequire)((0, import_node_path11.join)(cwd, "package.json")).resolve("vitest/package.json");
41290
+ const pkgPath = (0, import_node_module.createRequire)((0, import_node_path12.join)(cwd, "package.json")).resolve("vitest/package.json");
41230
41291
  const pkg = JSON.parse((0, import_node_fs9.readFileSync)(pkgPath, "utf8"));
41231
41292
  const rel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.vitest;
41232
41293
  if (typeof rel !== "string" || typeof pkg.version !== "string") return null;
41233
- return { bin: forward((0, import_node_path11.join)((0, import_node_path11.dirname)(pkgPath), rel)), version: pkg.version };
41294
+ return { bin: forward((0, import_node_path12.join)((0, import_node_path12.dirname)(pkgPath), rel)), version: pkg.version };
41234
41295
  } catch {
41235
41296
  return null;
41236
41297
  }
@@ -41275,9 +41336,9 @@ function detectAdapter(i3) {
41275
41336
  const parsed = parseTestInvocation(rest);
41276
41337
  if ("off" in parsed) return parsed;
41277
41338
  if (parsed.flags.some((f) => !ALLOWED_FLAG.test(f))) return { off: "extra_flags" };
41278
- const cwd = folder ? import_node_path11.posix.join(forward(i3.root), folder) : forward(i3.root);
41339
+ const cwd = folder ? import_node_path12.posix.join(forward(i3.root), folder) : forward(i3.root);
41279
41340
  if (parsed.viaScript) {
41280
- const pkgText = i3.readText(import_node_path11.posix.join(cwd, "package.json"));
41341
+ const pkgText = i3.readText(import_node_path12.posix.join(cwd, "package.json"));
41281
41342
  let script = "";
41282
41343
  try {
41283
41344
  const scripts = JSON.parse(pkgText ?? "{}").scripts;
@@ -41288,9 +41349,9 @@ function detectAdapter(i3) {
41288
41349
  if (!/\bvitest\b/.test(script)) return { off: "not_vitest" };
41289
41350
  if (!PLAIN_VITEST_SCRIPT.test(script)) return { off: "script_not_plain" };
41290
41351
  }
41291
- if (WORKSPACE_FILES.some((f) => i3.exists(import_node_path11.posix.join(cwd, f)))) return { off: "workspace_config" };
41352
+ if (WORKSPACE_FILES.some((f) => i3.exists(import_node_path12.posix.join(cwd, f)))) return { off: "workspace_config" };
41292
41353
  for (const f of CONFIG_FILES) {
41293
- const text3 = i3.exists(import_node_path11.posix.join(cwd, f)) ? i3.readText(import_node_path11.posix.join(cwd, f)) : null;
41354
+ const text3 = i3.exists(import_node_path12.posix.join(cwd, f)) ? i3.readText(import_node_path12.posix.join(cwd, f)) : null;
41294
41355
  if (text3 !== null && WORKSPACE_IN_CONFIG.test(text3)) return { off: "workspace_config" };
41295
41356
  }
41296
41357
  const found = (i3.resolveVitest ?? defaultResolveVitest)(cwd);
@@ -41313,7 +41374,7 @@ var TEST_FILE_NAME = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
41313
41374
  function forceFullReason(paths, setupFiles = []) {
41314
41375
  for (const raw of paths) {
41315
41376
  const p = forward(raw);
41316
- const base = import_node_path11.posix.basename(p);
41377
+ const base = import_node_path12.posix.basename(p);
41317
41378
  if (base === "package.json" || base === "npm-shrinkwrap.json") return "package_manifest";
41318
41379
  if (/^(?:package-lock\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?)$/.test(base)) return "lock_file";
41319
41380
  if (/^[jt]sconfig(?:\.[\w.-]+)?\.json$/.test(base)) return "ts_config";
@@ -41331,7 +41392,7 @@ function setupFilesOf(configText, folderRel) {
41331
41392
  for (const m of configText.matchAll(list2)) {
41332
41393
  for (const s of (m[1] ?? "").matchAll(/["']([^"']+)["']/g)) {
41333
41394
  const rel = forward(s[1] ?? "").replace(/^\.\//, "");
41334
- if (rel) out2.push(import_node_path11.posix.join(folderRel, rel));
41395
+ if (rel) out2.push(import_node_path12.posix.join(folderRel, rel));
41335
41396
  }
41336
41397
  }
41337
41398
  return out2;
@@ -41366,7 +41427,7 @@ function fsReadingTests(i3) {
41366
41427
  }
41367
41428
 
41368
41429
  // src/tsconfigPaths.ts
41369
- var import_node_path12 = require("node:path");
41430
+ var import_node_path13 = require("node:path");
41370
41431
  var MAX_EXTENDS_DEPTH = 5;
41371
41432
  function parseJsonc(text3) {
41372
41433
  let out2 = "";
@@ -41412,12 +41473,12 @@ function resolveConfig(readText, file, depth, seen) {
41412
41473
  if (typeof text3 !== "string") return null;
41413
41474
  const json = parseJsonc(text3);
41414
41475
  if (!isObject(json)) return null;
41415
- const dir = import_node_path12.posix.dirname(file) === "." ? "" : import_node_path12.posix.dirname(file);
41476
+ const dir = import_node_path13.posix.dirname(file) === "." ? "" : import_node_path13.posix.dirname(file);
41416
41477
  let inherited = { paths: null, pathsDir: dir, baseUrl: null };
41417
41478
  const ext = typeof json.extends === "string" ? [json.extends] : stringList(json.extends);
41418
41479
  for (const e of ext) {
41419
41480
  if (!e.startsWith(".")) continue;
41420
- const parent = resolveConfig(readText, import_node_path12.posix.normalize(import_node_path12.posix.join(dir, e.endsWith(".json") ? e : `${e}.json`)), depth + 1, seen);
41481
+ 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
41482
  if (parent) {
41422
41483
  inherited = {
41423
41484
  paths: parent.paths ?? inherited.paths,
@@ -41427,7 +41488,7 @@ function resolveConfig(readText, file, depth, seen) {
41427
41488
  }
41428
41489
  }
41429
41490
  const co = isObject(json.compilerOptions) ? json.compilerOptions : {};
41430
- const baseUrl = typeof co.baseUrl === "string" ? import_node_path12.posix.normalize(import_node_path12.posix.join(dir, co.baseUrl)) : inherited.baseUrl;
41491
+ const baseUrl = typeof co.baseUrl === "string" ? import_node_path13.posix.normalize(import_node_path13.posix.join(dir, co.baseUrl)) : inherited.baseUrl;
41431
41492
  let paths = inherited.paths;
41432
41493
  let pathsDir = inherited.pathsDir;
41433
41494
  if (isObject(co.paths)) {
@@ -41457,7 +41518,7 @@ function aliasTable(opts) {
41457
41518
  if (!config?.paths) return [];
41458
41519
  const lines = [];
41459
41520
  for (const [key, targets] of Object.entries(config.paths)) {
41460
- const resolved = targets.map((t) => import_node_path12.posix.normalize(import_node_path12.posix.join(config.baseUrl ?? config.pathsDir, t))).filter((p) => p !== ".." && !p.startsWith("../") && !import_node_path12.posix.isAbsolute(p));
41521
+ 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
41522
  if (resolved.length > 0) lines.push(`${key} -> ${resolved.join(", ")}`);
41462
41523
  }
41463
41524
  return lines.sort().slice(0, opts.max ?? 20);
@@ -41484,7 +41545,7 @@ function createAliasMapper(opts) {
41484
41545
  };
41485
41546
  return (fromPath, specifier) => {
41486
41547
  if (specifier.startsWith(".") || specifier.startsWith("/")) return null;
41487
- const dir = import_node_path12.posix.dirname(fromPath) === "." ? "" : import_node_path12.posix.dirname(fromPath);
41548
+ const dir = import_node_path13.posix.dirname(fromPath) === "." ? "" : import_node_path13.posix.dirname(fromPath);
41488
41549
  const config = configFor(dir);
41489
41550
  if (!config?.paths) return null;
41490
41551
  let best = null;
@@ -41495,8 +41556,8 @@ function createAliasMapper(opts) {
41495
41556
  if (!best) return null;
41496
41557
  const bases = [];
41497
41558
  for (const target of config.paths[best.key]) {
41498
- const joined = import_node_path12.posix.normalize(import_node_path12.posix.join(config.baseUrl ?? config.pathsDir, target.replace("*", best.captured)));
41499
- if (joined === ".." || joined.startsWith("../") || import_node_path12.posix.isAbsolute(joined)) continue;
41559
+ const joined = import_node_path13.posix.normalize(import_node_path13.posix.join(config.baseUrl ?? config.pathsDir, target.replace("*", best.captured)));
41560
+ if (joined === ".." || joined.startsWith("../") || import_node_path13.posix.isAbsolute(joined)) continue;
41500
41561
  if (opts.writeRoot !== "" && !matchesPrefix(joined, opts.writeRoot)) continue;
41501
41562
  bases.push(joined === "." ? "" : joined);
41502
41563
  }
@@ -41550,7 +41611,7 @@ function createRelatedPlanner(d) {
41550
41611
  const exists = d.exists ?? import_node_fs10.existsSync;
41551
41612
  const mode = (env2.QUIKPILOT_RELATED_TESTS ?? "").trim().toLowerCase();
41552
41613
  const minMs = minBaselineMs(env2);
41553
- const abs = (rel) => forward2((0, import_node_path13.join)(d.root, rel));
41614
+ const abs = (rel) => forward2((0, import_node_path14.join)(d.root, rel));
41554
41615
  const isTest = testRule(d.discoveredTests ?? null);
41555
41616
  let detected = null;
41556
41617
  let setupFiles = [];
@@ -41562,9 +41623,9 @@ function createRelatedPlanner(d) {
41562
41623
  function detect() {
41563
41624
  const found = detectAdapter({ command: d.command, root: forward2(d.root), readText, exists, resolveVitest: d.resolveVitest });
41564
41625
  if ("adapter" in found) {
41565
- const folder = forward2((0, import_node_path13.relative)(d.root, found.adapter.cwd));
41626
+ const folder = forward2((0, import_node_path14.relative)(d.root, found.adapter.cwd));
41566
41627
  for (const name2 of CONFIG_FILES) {
41567
- const text3 = exists(import_node_path13.posix.join(found.adapter.cwd, name2)) ? readText(import_node_path13.posix.join(found.adapter.cwd, name2)) : null;
41628
+ const text3 = exists(import_node_path14.posix.join(found.adapter.cwd, name2)) ? readText(import_node_path14.posix.join(found.adapter.cwd, name2)) : null;
41568
41629
  if (text3 !== null) setupFiles.push(...setupFilesOf(text3, folder));
41569
41630
  }
41570
41631
  log({ event: "related.adapter", adapter: found.adapter.kind, version: found.adapter.version });
@@ -41620,7 +41681,7 @@ function createRelatedPlanner(d) {
41620
41681
  const testFiles = unique([...changed.filter((p) => isTest(p)), ...importersOf(changed), ...alwaysRun]).slice(0, MAX_FALLBACK_TESTS).map(abs);
41621
41682
  runNumber += 1;
41622
41683
  const stamp = `${process.pid}-${runNumber}`;
41623
- const dir = forward2((d.tmp ?? (() => env2.RUNNER_TEMP?.trim() || (0, import_node_os3.tmpdir)()))());
41684
+ const dir = forward2((d.tmp ?? (() => env2.RUNNER_TEMP?.trim() || (0, import_node_os4.tmpdir)()))());
41624
41685
  const report = `${dir}/qp-related-${stamp}.xml`;
41625
41686
  const fallbackReport = `${dir}/qp-related-${stamp}-files.xml`;
41626
41687
  return {
@@ -41806,7 +41867,7 @@ function spendSoFar() {
41806
41867
 
41807
41868
  // src/codegen.ts
41808
41869
  var import_node_fs11 = require("node:fs");
41809
- var import_node_path14 = require("node:path");
41870
+ var import_node_path15 = require("node:path");
41810
41871
 
41811
41872
  // src/envelope.ts
41812
41873
  var HARD_FAILURE_CODES = /* @__PURE__ */ new Set(["SEMANTIC_MISMATCH", "CONTRACT_REJECTED"]);
@@ -42253,7 +42314,7 @@ async function runCodegen(gateway, targets, workspaceListing, requiredTests, den
42253
42314
  }
42254
42315
  function flushCodegenResults(results) {
42255
42316
  for (const { targetPath, newContent } of results) {
42256
- (0, import_node_fs11.mkdirSync)((0, import_node_path14.dirname)(targetPath), { recursive: true });
42317
+ (0, import_node_fs11.mkdirSync)((0, import_node_path15.dirname)(targetPath), { recursive: true });
42257
42318
  (0, import_node_fs11.writeFileSync)(targetPath, newContent);
42258
42319
  }
42259
42320
  }
@@ -42299,22 +42360,23 @@ function callFunctionEnabled(githubRepository, mode, env2 = process.env) {
42299
42360
 
42300
42361
  // src/callFunctionTool.ts
42301
42362
  var import_node_crypto4 = require("node:crypto");
42302
- var import_node_path18 = require("node:path");
42363
+ var import_node_path19 = require("node:path");
42303
42364
 
42304
42365
  // src/overlayOnDisk.ts
42305
- var import_node_child_process8 = require("node:child_process");
42366
+ var import_node_child_process9 = require("node:child_process");
42306
42367
  var import_node_fs13 = require("node:fs");
42307
- var import_node_path16 = require("node:path");
42368
+ var import_node_path17 = require("node:path");
42308
42369
 
42309
42370
  // src/treeFingerprint.ts
42310
42371
  var import_node_crypto2 = require("node:crypto");
42311
- var import_node_child_process7 = require("node:child_process");
42372
+ var import_node_child_process8 = require("node:child_process");
42312
42373
  var import_node_fs12 = require("node:fs");
42313
- var import_node_path15 = require("node:path");
42374
+ var import_node_path16 = require("node:path");
42314
42375
  var MAX_HASHED_BYTES = 8 * 1024 * 1024;
42315
42376
  function defaultGitStatus(root) {
42316
42377
  try {
42317
- return (0, import_node_child_process7.execFileSync)("git", ["status", "--porcelain=v1", "-z", "--untracked-files=all"], {
42378
+ return (0, import_node_child_process8.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain=v1", "-z", "--untracked-files=all"], {
42379
+ env: gitEnv(),
42318
42380
  cwd: root,
42319
42381
  encoding: "utf8",
42320
42382
  stdio: ["ignore", "pipe", "ignore"],
@@ -42338,7 +42400,7 @@ function parseStatus(raw) {
42338
42400
  return raw.split("\0").filter((t) => t.length > 0).sort();
42339
42401
  }
42340
42402
  function hashOf(root, rel) {
42341
- const abs = (0, import_node_path15.join)(root, rel);
42403
+ const abs = (0, import_node_path16.join)(root, rel);
42342
42404
  let st;
42343
42405
  try {
42344
42406
  st = (0, import_node_fs12.lstatSync)(abs);
@@ -42403,24 +42465,24 @@ var DiskWriteRefused = class extends Error {
42403
42465
  };
42404
42466
  function safeRelativePath(rel) {
42405
42467
  if (typeof rel !== "string" || rel.length === 0 || rel.length > 400 || rel.includes("\0") || rel.includes("\\")) return null;
42406
- if ((0, import_node_path16.isAbsolute)(rel) || /^[A-Za-z]:/.test(rel)) return null;
42468
+ if ((0, import_node_path17.isAbsolute)(rel) || /^[A-Za-z]:/.test(rel)) return null;
42407
42469
  const parts2 = rel.split("/");
42408
42470
  if (parts2.some((p) => p === "" || p === "." || p === "..")) return null;
42409
42471
  return rel;
42410
42472
  }
42411
42473
  function isInside(root, abs) {
42412
- const r = (0, import_node_path16.relative)(root, abs);
42413
- return r !== "" && !r.startsWith("..") && !(0, import_node_path16.isAbsolute)(r);
42474
+ const r = (0, import_node_path17.relative)(root, abs);
42475
+ return r !== "" && !r.startsWith("..") && !(0, import_node_path17.isAbsolute)(r);
42414
42476
  }
42415
42477
  function ancestorInside(realRoot, abs) {
42416
- let dir = (0, import_node_path16.dirname)(abs);
42478
+ let dir = (0, import_node_path17.dirname)(abs);
42417
42479
  for (; ; ) {
42418
42480
  try {
42419
42481
  const real = (0, import_node_fs13.realpathSync)(dir);
42420
- const r = (0, import_node_path16.relative)(realRoot, real);
42421
- return r === "" || !r.startsWith("..") && !(0, import_node_path16.isAbsolute)(r);
42482
+ const r = (0, import_node_path17.relative)(realRoot, real);
42483
+ return r === "" || !r.startsWith("..") && !(0, import_node_path17.isAbsolute)(r);
42422
42484
  } catch {
42423
- const up = (0, import_node_path16.dirname)(dir);
42485
+ const up = (0, import_node_path17.dirname)(dir);
42424
42486
  if (up === dir) return false;
42425
42487
  dir = up;
42426
42488
  }
@@ -42433,7 +42495,7 @@ function applyOverlay(root, files) {
42433
42495
  const restore2 = () => {
42434
42496
  const failed = [];
42435
42497
  for (const w of [...written].reverse()) {
42436
- const rel = (0, import_node_path16.relative)(root, w.abs).split("\\").join("/");
42498
+ const rel = (0, import_node_path17.relative)(root, w.abs).split("\\").join("/");
42437
42499
  try {
42438
42500
  if (w.original !== null) (0, import_node_fs13.writeFileSync)(w.abs, w.original);
42439
42501
  else (0, import_node_fs13.rmSync)(w.abs, { force: true });
@@ -42456,7 +42518,7 @@ function applyOverlay(root, files) {
42456
42518
  if (rel === null) throw new DiskWriteRefused("bad_path");
42457
42519
  if (seen.has(rel)) throw new DiskWriteRefused("duplicate");
42458
42520
  seen.add(rel);
42459
- const abs = (0, import_node_path16.resolve)(root, rel);
42521
+ const abs = (0, import_node_path17.resolve)(root, rel);
42460
42522
  if (!isInside(root, abs) || !ancestorInside(realRoot, abs)) throw new DiskWriteRefused("outside_checkout");
42461
42523
  let original = null;
42462
42524
  try {
@@ -42470,7 +42532,7 @@ function applyOverlay(root, files) {
42470
42532
  const createdDirs = [];
42471
42533
  if (original === null) {
42472
42534
  const missing = [];
42473
- for (let d = (0, import_node_path16.dirname)(abs); !(0, import_node_fs13.existsSync)(d); d = (0, import_node_path16.dirname)(d)) missing.push(d);
42535
+ 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
42536
  for (const d of missing.reverse()) {
42475
42537
  (0, import_node_fs13.mkdirSync)(d);
42476
42538
  createdDirs.push(d);
@@ -42487,7 +42549,7 @@ function applyOverlay(root, files) {
42487
42549
  return { restore: restore2 };
42488
42550
  }
42489
42551
  function git2(root, args2) {
42490
- (0, import_node_child_process8.execFileSync)("git", args2, { cwd: root, stdio: ["ignore", "ignore", "ignore"] });
42552
+ (0, import_node_child_process9.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd: root, stdio: ["ignore", "ignore", "ignore"] });
42491
42553
  }
42492
42554
  function cleanUpAfterRun(root, beforePaths, afterStatus) {
42493
42555
  for (const token of afterStatus) {
@@ -42497,8 +42559,8 @@ function cleanUpAfterRun(root, beforePaths, afterStatus) {
42497
42559
  const code = entryCode(token);
42498
42560
  try {
42499
42561
  if (code === "??") {
42500
- (0, import_node_fs13.rmSync)((0, import_node_path16.join)(root, p), { recursive: true, force: true });
42501
- for (let d = (0, import_node_path16.dirname)((0, import_node_path16.join)(root, p)); d !== root && isInside(root, d); d = (0, import_node_path16.dirname)(d)) {
42562
+ (0, import_node_fs13.rmSync)((0, import_node_path17.join)(root, p), { recursive: true, force: true });
42563
+ 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
42564
  try {
42503
42565
  (0, import_node_fs13.rmdirSync)(d);
42504
42566
  } catch {
@@ -42518,7 +42580,7 @@ function snapshotPreserved(root, paths) {
42518
42580
  const out2 = [];
42519
42581
  for (const rel of paths ?? []) {
42520
42582
  if (safeRelativePath(rel) === null) continue;
42521
- const abs = (0, import_node_path16.resolve)(root, rel);
42583
+ const abs = (0, import_node_path17.resolve)(root, rel);
42522
42584
  try {
42523
42585
  const st = (0, import_node_fs13.lstatSync)(abs);
42524
42586
  if (st.isSymbolicLink() || !st.isFile()) continue;
@@ -42586,7 +42648,7 @@ function undoableFlush(root, results, flush, options = {}) {
42586
42648
  const beforePaths = new Set((before?.status ?? []).filter(isStatusEntry).map(entryPath));
42587
42649
  for (const p of ignore) beforePaths.add(p);
42588
42650
  const originals = rels.map((rel) => {
42589
- const abs = (0, import_node_path16.resolve)(root, rel);
42651
+ const abs = (0, import_node_path17.resolve)(root, rel);
42590
42652
  let original = null;
42591
42653
  try {
42592
42654
  const st = (0, import_node_fs13.lstatSync)(abs);
@@ -42597,7 +42659,7 @@ function undoableFlush(root, results, flush, options = {}) {
42597
42659
  const createdDirs = [];
42598
42660
  if (original === null) {
42599
42661
  const missing = [];
42600
- for (let d = (0, import_node_path16.dirname)(abs); !(0, import_node_fs13.existsSync)(d) && isInside(root, d); d = (0, import_node_path16.dirname)(d)) missing.push(d);
42662
+ 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
42663
  createdDirs.push(...missing.reverse());
42602
42664
  }
42603
42665
  return { rel, abs, original, createdDirs };
@@ -42653,7 +42715,7 @@ function undoableFlush(root, results, flush, options = {}) {
42653
42715
  // src/runTestsTool.ts
42654
42716
  var import_node_crypto3 = require("node:crypto");
42655
42717
  var import_node_fs14 = require("node:fs");
42656
- var import_node_path17 = require("node:path");
42718
+ var import_node_path18 = require("node:path");
42657
42719
  var scrubSecrets2 = (text3) => scrubForModel(text3, [], "code").text;
42658
42720
  var RUN_TESTS_TOOL = "run_tests";
42659
42721
  var MAX_TEST_RUNS = 3;
@@ -42964,7 +43026,7 @@ var RunTestsTool = class {
42964
43026
  const runCommand2 = d.runCommand ?? runTestCommandWithLimit;
42965
43027
  const readSnapshot = d.readSnapshot ?? readTestSnapshot;
42966
43028
  const reportBefore = findReport(d.root);
42967
- const preserve = reportBefore ? [(0, import_node_path17.relative)(d.root, reportBefore).split("\\").join("/")] : [];
43029
+ const preserve = reportBefore ? [(0, import_node_path18.relative)(d.root, reportBefore).split("\\").join("/")] : [];
42968
43030
  const spend = (n) => {
42969
43031
  if (file === void 0) this.runs += n;
42970
43032
  else this.fileRuns += n;
@@ -43315,7 +43377,7 @@ var CallFunctionTool = class {
43315
43377
  const now = d.now ?? Date.now;
43316
43378
  const helper = {
43317
43379
  path: `.quikpilot-call-${(0, import_node_crypto4.randomBytes)(6).toString("hex")}.mjs`,
43318
- content: helperSource({ target: (0, import_node_path18.join)(d.root, parsed.path), exportName: parsed.exportName, args: parsed.callArgs })
43380
+ content: helperSource({ target: (0, import_node_path19.join)(d.root, parsed.path), exportName: parsed.exportName, args: parsed.callArgs })
43319
43381
  };
43320
43382
  const run3 = d.run ?? runCapturedCommand;
43321
43383
  this.calls += 1;
@@ -43325,7 +43387,7 @@ var CallFunctionTool = class {
43325
43387
  captured = await withOverlayOnDisk(
43326
43388
  d.root,
43327
43389
  [...files, helper],
43328
- () => run3([d.nodePath ?? process.execPath, (0, import_node_path18.join)(d.root, helper.path)], { cwd: d.root, timeoutMs: d.timeoutMs ?? CALL_TIMEOUT_MS, maxStdoutBytes: MAX_STDOUT_BYTES }),
43390
+ () => 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
43391
  { ...d.tree }
43330
43392
  );
43331
43393
  } catch (err2) {
@@ -47737,7 +47799,7 @@ function createCodegenWorkspace(args2) {
47737
47799
 
47738
47800
  // src/scratchRunTool.ts
47739
47801
  var import_node_fs15 = require("node:fs");
47740
- var import_node_path19 = require("node:path");
47802
+ var import_node_path20 = require("node:path");
47741
47803
  var RUN_SCRATCH_TOOL = "run_scratch";
47742
47804
  var MAX_SCRATCH_TEXT_CHARS = 2e3;
47743
47805
  var MAX_SCRATCH_CONTENT_CHARS = 8e3;
@@ -47823,10 +47885,10 @@ var ScratchRunTool = class {
47823
47885
  if (matchesDeniedPath(path, d.deniedPaths) !== null) return false;
47824
47886
  if (!testRule(d.discoveredTests)(path)) return false;
47825
47887
  if (d.protectedTestPaths.includes(path) || d.listing.includes(path) || files.some((f) => f.path === path)) return false;
47826
- const abs = (0, import_node_path19.join)(d.root, path);
47888
+ const abs = (0, import_node_path20.join)(d.root, path);
47827
47889
  if ((0, import_node_fs15.existsSync)(abs)) return false;
47828
47890
  try {
47829
- return (0, import_node_fs15.statSync)((0, import_node_path19.dirname)(abs)).isDirectory();
47891
+ return (0, import_node_fs15.statSync)((0, import_node_path20.dirname)(abs)).isDirectory();
47830
47892
  } catch {
47831
47893
  return false;
47832
47894
  }
@@ -47865,7 +47927,7 @@ var ScratchRunTool = class {
47865
47927
  const run3 = d.run ?? runShellCaptured;
47866
47928
  const command = buildSingleFileCommand(fileCommand, parsed.path);
47867
47929
  const reportBefore = (d.findReport ?? findJUnitReport)(d.root);
47868
- const preserve = reportBefore ? [(0, import_node_path19.relative)(d.root, reportBefore).split("\\").join("/")] : [];
47930
+ const preserve = reportBefore ? [(0, import_node_path20.relative)(d.root, reportBefore).split("\\").join("/")] : [];
47869
47931
  this.calls += 1;
47870
47932
  const startedAt = now();
47871
47933
  let ran;
@@ -48315,9 +48377,9 @@ var TargetingHttpError = class extends Error {
48315
48377
  };
48316
48378
 
48317
48379
  // src/dataPathCheck.ts
48318
- var import_node_child_process9 = require("node:child_process");
48380
+ var import_node_child_process10 = require("node:child_process");
48319
48381
  var import_node_fs17 = require("node:fs");
48320
- var import_node_path20 = require("node:path");
48382
+ var import_node_path21 = require("node:path");
48321
48383
 
48322
48384
  // src/scopeCheck.ts
48323
48385
  var import_node_fs16 = require("node:fs");
@@ -48462,7 +48524,7 @@ function addressMatches(route, call) {
48462
48524
  }
48463
48525
  var git3 = (cwd, args2) => {
48464
48526
  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 });
48527
+ return (0, import_node_child_process10.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: GIT_TIMEOUT_MS2, maxBuffer: GIT_MAX_BUFFER3 });
48466
48528
  } catch {
48467
48529
  return "";
48468
48530
  }
@@ -48549,7 +48611,7 @@ function screenLoaders(cwd, screen, read, skip, expired) {
48549
48611
  function readFromCheckout(root) {
48550
48612
  return (path) => {
48551
48613
  try {
48552
- const abs = (0, import_node_path20.join)(root, path);
48614
+ const abs = (0, import_node_path21.join)(root, path);
48553
48615
  const st = (0, import_node_fs17.lstatSync)(abs);
48554
48616
  return st.isSymbolicLink() || !st.isFile() || st.size > MAX_FILE_CHARS2 ? null : (0, import_node_fs17.readFileSync)(abs, "utf8");
48555
48617
  } catch {
@@ -51414,7 +51476,7 @@ function buildCodegenLoopRecord(loop) {
51414
51476
  var import_node_fs18 = require("node:fs");
51415
51477
 
51416
51478
  // src/langReach.ts
51417
- var import_node_path21 = require("node:path");
51479
+ var import_node_path22 = require("node:path");
51418
51480
  var LANGUAGE_BY_EXT = {
51419
51481
  ".go": "go",
51420
51482
  ".py": "python",
@@ -51430,7 +51492,7 @@ var LANGUAGE_BY_EXT = {
51430
51492
  ".swift": "swift"
51431
51493
  };
51432
51494
  function languageOf(path) {
51433
- return LANGUAGE_BY_EXT[import_node_path21.posix.extname(path).toLowerCase()] ?? null;
51495
+ return LANGUAGE_BY_EXT[import_node_path22.posix.extname(path).toLowerCase()] ?? null;
51434
51496
  }
51435
51497
  var MAX_REACH_TESTS = 10;
51436
51498
  var MAX_IMPORT_STEPS = 3;
@@ -51454,14 +51516,14 @@ function lookSymbolsOf(findings) {
51454
51516
  for (const c of findings.callPath) add2(c.path, c.symbol);
51455
51517
  return out2;
51456
51518
  }
51457
- var baseNoExt = (p) => import_node_path21.posix.basename(p).replace(/\.[^.]+$/, "");
51458
- var dirOf = (p) => import_node_path21.posix.dirname(p) === "." ? "" : import_node_path21.posix.dirname(p);
51519
+ var baseNoExt = (p) => import_node_path22.posix.basename(p).replace(/\.[^.]+$/, "");
51520
+ var dirOf = (p) => import_node_path22.posix.dirname(p) === "." ? "" : import_node_path22.posix.dirname(p);
51459
51521
  function testStem(path) {
51460
51522
  return baseNoExt(path).replace(/^test_/i, "").replace(/(_test|_spec)$/i, "").replace(/Tests?$/, "").toLowerCase();
51461
51523
  }
51462
51524
  function codeStem(path) {
51463
51525
  const b = baseNoExt(path);
51464
- if (b === "__init__" || b === "mod" || b === "index") return import_node_path21.posix.basename(dirOf(path)).toLowerCase();
51526
+ if (b === "__init__" || b === "mod" || b === "index") return import_node_path22.posix.basename(dirOf(path)).toLowerCase();
51465
51527
  return b.toLowerCase();
51466
51528
  }
51467
51529
  function sharedPrefix2(a, b) {
@@ -51544,7 +51606,7 @@ function buildIndex(files, readText) {
51544
51606
  }
51545
51607
  }
51546
51608
  let goModule = null;
51547
- const gomod = files.filter((f) => import_node_path21.posix.basename(f) === "go.mod").sort((a, b) => a.length - b.length)[0];
51609
+ const gomod = files.filter((f) => import_node_path22.posix.basename(f) === "go.mod").sort((a, b) => a.length - b.length)[0];
51548
51610
  if (gomod) {
51549
51611
  const m = /^module[ \t]+(\S+)/m.exec(readText(gomod) ?? "");
51550
51612
  if (m) goModule = { root: dirOf(gomod), module: m[1].replace(/^"|"$/g, "") };
@@ -51556,10 +51618,10 @@ function pythonImports(file, text3, ix) {
51556
51618
  const lookup = (dotted) => {
51557
51619
  for (const hit of ix.pyModules.get(dotted) ?? []) if (hit !== file) out2.add(hit);
51558
51620
  };
51559
- const relative11 = (dots, rest) => {
51621
+ const relative12 = (dots, rest) => {
51560
51622
  let base = dirOf(file);
51561
51623
  for (let i3 = 1; i3 < dots; i3++) base = dirOf(base);
51562
- const joined = rest ? import_node_path21.posix.join(base, rest.replace(/\./g, "/")) : base;
51624
+ const joined = rest ? import_node_path22.posix.join(base, rest.replace(/\./g, "/")) : base;
51563
51625
  return [`${joined}.py`, `${joined}/__init__.py`].filter((p) => ix.set.has(p) && p !== file);
51564
51626
  };
51565
51627
  for (const line2 of text3.split("\n")) {
@@ -51569,8 +51631,8 @@ function pythonImports(file, text3, ix) {
51569
51631
  const mod = from[2];
51570
51632
  const names = from[3].replace(/[()\\]/g, "").split(",").map((s) => s.trim().split(/\s+as\s+/)[0].trim()).filter((s) => /^\w+$/.test(s));
51571
51633
  if (dots > 0) {
51572
- for (const p of relative11(dots, mod)) out2.add(p);
51573
- for (const n of names) for (const p of relative11(dots, mod ? `${mod}.${n}` : n)) out2.add(p);
51634
+ for (const p of relative12(dots, mod)) out2.add(p);
51635
+ for (const n of names) for (const p of relative12(dots, mod ? `${mod}.${n}` : n)) out2.add(p);
51574
51636
  } else {
51575
51637
  lookup(mod);
51576
51638
  for (const n of names) lookup(`${mod}.${n}`);
@@ -51599,7 +51661,7 @@ function goImports(file, text3, ix) {
51599
51661
  let dir = null;
51600
51662
  if (ix.goModule && (p === ix.goModule.module || p.startsWith(`${ix.goModule.module}/`))) {
51601
51663
  const rest = p.slice(ix.goModule.module.length).replace(/^\//, "");
51602
- dir = ix.goModule.root ? import_node_path21.posix.join(ix.goModule.root, rest) : rest;
51664
+ dir = ix.goModule.root ? import_node_path22.posix.join(ix.goModule.root, rest) : rest;
51603
51665
  } else {
51604
51666
  const tail2 = p.split("/").slice(-2).join("/");
51605
51667
  for (const d of ix.byDir.keys()) if (d === tail2 || d.endsWith(`/${tail2}`)) {
@@ -51650,7 +51712,7 @@ function importsOf(language, file, text3, ix) {
51650
51712
  if (language === "jvm") return jvmImports(file, text3, ix);
51651
51713
  return [];
51652
51714
  }
51653
- var isPackageInit = (p) => import_node_path21.posix.basename(p) === "__init__.py";
51715
+ var isPackageInit = (p) => import_node_path22.posix.basename(p) === "__init__.py";
51654
51716
  function testsReaching(input) {
51655
51717
  const limit = Math.min(MAX_REACH_TESTS, Math.max(0, input.limit ?? MAX_REACH_TESTS));
51656
51718
  const listing = input.isDenied ? input.listing.filter((p) => !input.isDenied(p)) : [...input.listing];
@@ -51793,8 +51855,8 @@ function pairedTestPaths(codePath, listing, isTest = isTestTarget) {
51793
51855
  const stem = m[1].toLowerCase();
51794
51856
  const dir = dirOf2(codePath);
51795
51857
  const parent = parentOf(dir);
51796
- const join19 = (d, leaf) => d === "" ? leaf : `${d}/${leaf}`;
51797
- const homes = /* @__PURE__ */ new Set([dir, join19(dir, "__tests__"), join19(parent, "__tests__"), join19(parent, "tests"), join19(parent, "test")]);
51858
+ const join20 = (d, leaf) => d === "" ? leaf : `${d}/${leaf}`;
51859
+ const homes = /* @__PURE__ */ new Set([dir, join20(dir, "__tests__"), join20(parent, "__tests__"), join20(parent, "tests"), join20(parent, "test")]);
51798
51860
  const found = [];
51799
51861
  for (const path of listing) {
51800
51862
  if (!homes.has(dirOf2(path))) continue;
@@ -51975,7 +52037,7 @@ function mapModeMessage(phase, reason) {
51975
52037
 
51976
52038
  // src/testsToCheck.ts
51977
52039
  var import_node_fs19 = require("node:fs");
51978
- var import_node_path22 = require("node:path");
52040
+ var import_node_path23 = require("node:path");
51979
52041
  var MAX_TESTS_TO_CHECK = 10;
51980
52042
  var SECOND_HOP_BELOW = 3;
51981
52043
  function testsToCheck(i3) {
@@ -52026,7 +52088,7 @@ function testsToCheck(i3) {
52026
52088
  }
52027
52089
  var readFromRoot = (root) => (rel) => {
52028
52090
  try {
52029
- return (0, import_node_fs19.readFileSync)((0, import_node_path22.join)(root, rel), "utf8");
52091
+ return (0, import_node_fs19.readFileSync)((0, import_node_path23.join)(root, rel), "utf8");
52030
52092
  } catch {
52031
52093
  return null;
52032
52094
  }
@@ -52845,9 +52907,9 @@ async function runVerifyAndFix(p) {
52845
52907
  }
52846
52908
 
52847
52909
  // src/hunkCheck.ts
52848
- var import_node_child_process10 = require("node:child_process");
52910
+ var import_node_child_process11 = require("node:child_process");
52849
52911
  var import_node_fs21 = require("node:fs");
52850
- var import_node_path23 = require("node:path");
52912
+ var import_node_path24 = require("node:path");
52851
52913
  var MAX_REPORTED_HUNKS = 20;
52852
52914
  function toFinding(r) {
52853
52915
  if (r.unnecessary.length === 0) return void 0;
@@ -52874,7 +52936,7 @@ function collectHunkCheckFiles(results, root, readHead = readCommittedText) {
52874
52936
  }
52875
52937
  function readCommittedText(root, path) {
52876
52938
  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 });
52939
+ return (0, import_node_child_process11.execFileSync)("git", [...NO_HOOKS_ARGS, "show", `HEAD:${path}`], { env: gitEnv(), cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 8 * 1024 * 1024 });
52878
52940
  } catch {
52879
52941
  return null;
52880
52942
  }
@@ -52925,7 +52987,7 @@ async function runHunkCheck(input) {
52925
52987
  let slowestRunMs = input.baselineMs ?? 3e4;
52926
52988
  const runOnce = async (c) => {
52927
52989
  const reportBefore = findReport(input.root);
52928
- const preserve = reportBefore ? [(0, import_node_path23.relative)(input.root, reportBefore).split("\\").join("/")] : [];
52990
+ const preserve = reportBefore ? [(0, import_node_path24.relative)(input.root, reportBefore).split("\\").join("/")] : [];
52929
52991
  const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
52930
52992
  const startedWall = Date.now();
52931
52993
  const startedAt = now();
@@ -52961,7 +53023,7 @@ async function runHunkCheck(input) {
52961
53023
  };
52962
53024
  const runRelated = async (c, plan, limitMs) => {
52963
53025
  const reportBefore = findReport(input.root);
52964
- const preserve = reportBefore ? [(0, import_node_path23.relative)(input.root, reportBefore).split("\\").join("/")] : [];
53026
+ const preserve = reportBefore ? [(0, import_node_path24.relative)(input.root, reportBefore).split("\\").join("/")] : [];
52965
53027
  const content = `${c.bom ? "\uFEFF" : ""}${fromLf(revertHunk(c.originalLf, c.currentLf, c.hunk), c.ending)}`;
52966
53028
  const startedAt = now();
52967
53029
  result.relatedRuns += 1;
@@ -53106,7 +53168,7 @@ function healFailureSuffix(heal) {
53106
53168
 
53107
53169
  // src/dependencyCheck.ts
53108
53170
  var import_node_fs22 = require("node:fs");
53109
- var import_node_path24 = require("node:path");
53171
+ var import_node_path25 = require("node:path");
53110
53172
  var SCANNABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
53111
53173
  var IMPORT_RE = /(?:\bimport\b[^'"]*?\bfrom\s*|\bimport\s*\(\s*|\bexport\b[^'"]*?\bfrom\s*|\brequire\s*\(\s*|\bimport\s+)(['"])([^'"]+)\1/g;
53112
53174
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
@@ -53194,8 +53256,8 @@ function dependencyNames(pkg) {
53194
53256
  ]);
53195
53257
  }
53196
53258
  function readDeclaredDependencies(results, workspaceRoot) {
53197
- const packageJsonPath = (0, import_node_path24.join)((0, import_node_path24.resolve)(workspaceRoot ?? "."), "package.json");
53198
- const generated = results.find((r) => (0, import_node_path24.resolve)(r.targetPath) === packageJsonPath);
53259
+ const packageJsonPath = (0, import_node_path25.join)((0, import_node_path25.resolve)(workspaceRoot ?? "."), "package.json");
53260
+ const generated = results.find((r) => (0, import_node_path25.resolve)(r.targetPath) === packageJsonPath);
53199
53261
  let raw;
53200
53262
  if (generated) {
53201
53263
  raw = generated.newContent;
@@ -53265,10 +53327,10 @@ function stripJsonComments(text3) {
53265
53327
  return out2.replace(/,(\s*[}\]])/g, "$1");
53266
53328
  }
53267
53329
  function resolveAliasPrefixes(results, workspaceRoot) {
53268
- const root = (0, import_node_path24.resolve)(workspaceRoot ?? ".");
53330
+ const root = (0, import_node_path25.resolve)(workspaceRoot ?? ".");
53269
53331
  for (const filename of ["tsconfig.json", "jsconfig.json"]) {
53270
- const configPath = (0, import_node_path24.join)(root, filename);
53271
- const generated = results.find((r) => (0, import_node_path24.resolve)(r.targetPath) === configPath);
53332
+ const configPath = (0, import_node_path25.join)(root, filename);
53333
+ const generated = results.find((r) => (0, import_node_path25.resolve)(r.targetPath) === configPath);
53272
53334
  let raw;
53273
53335
  if (generated) {
53274
53336
  raw = generated.newContent;
@@ -53362,7 +53424,7 @@ function exitCodeFailedMessage() {
53362
53424
  var EXIT_CODE_ONLY_NOTE = "The change was checked by the Test command's result only: it passed before and after the change, but no test report was found, so QuikPilot could not see individual tests or confirm that its new tests ran.";
53363
53425
 
53364
53426
  // src/existingRoutes.ts
53365
- var import_node_child_process11 = require("node:child_process");
53427
+ var import_node_child_process12 = require("node:child_process");
53366
53428
  var GREP_TIMEOUT_MS = 1e4;
53367
53429
  var MAX_HIT_LINES = 400;
53368
53430
  var MAX_OUTPUT_BYTES = 4e6;
@@ -53377,7 +53439,8 @@ function routeAlreadyNamed(cwd, mention) {
53377
53439
  const wanted = normalizePath(mention.path);
53378
53440
  let out2;
53379
53441
  try {
53380
- out2 = (0, import_node_child_process11.execFileSync)("git", ["grep", "-I", "-n", "-F", "-e", anchor], {
53442
+ out2 = (0, import_node_child_process12.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-I", "-n", "-F", "-e", anchor], {
53443
+ env: gitEnv(),
53381
53444
  cwd,
53382
53445
  encoding: "utf8",
53383
53446
  stdio: ["ignore", "pipe", "ignore"],
@@ -53670,10 +53733,10 @@ function describeVanishedTests(vanished) {
53670
53733
  }
53671
53734
 
53672
53735
  // src/verifyChange.ts
53673
- var import_node_path25 = require("node:path");
53736
+ var import_node_path26 = require("node:path");
53674
53737
 
53675
53738
  // src/packageUse.ts
53676
- var import_node_child_process12 = require("node:child_process");
53739
+ var import_node_child_process13 = require("node:child_process");
53677
53740
  var PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
53678
53741
  var FILE_TYPES = ["*.ts", "*.tsx", "*.js", "*.jsx", "*.mjs", "*.cjs", "*.mts", "*.cts"];
53679
53742
  var GREP_TIMEOUT_MS2 = 1e4;
@@ -53685,7 +53748,8 @@ function packageImportedInWorkspace(pkg, root, cwd = process.cwd()) {
53685
53748
  if (!PACKAGE_NAME.test(pkg)) return false;
53686
53749
  const pathspecs = FILE_TYPES.map((type) => root ? `:(glob)${root}/**/${type}` : `:(glob)**/${type}`);
53687
53750
  try {
53688
- (0, import_node_child_process12.execFileSync)("git", ["grep", "-q", "-E", "-e", importPattern(pkg), "--", ...pathspecs], {
53751
+ (0, import_node_child_process13.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-q", "-E", "-e", importPattern(pkg), "--", ...pathspecs], {
53752
+ env: gitEnv(),
53689
53753
  cwd,
53690
53754
  stdio: "ignore",
53691
53755
  timeout: GREP_TIMEOUT_MS2
@@ -53732,7 +53796,7 @@ async function verifyChange(ctx, results, undoable) {
53732
53796
  const depCheck = checkImportDependencies(results, readDeclaredDependencies(results, packet.workspaceRoot), resolveAliasPrefixes(results, packet.workspaceRoot), {
53733
53797
  originalOf: (path) => {
53734
53798
  try {
53735
- return (0, import_node_fs24.readFileSync)((0, import_node_path25.join)(cwd, path), "utf8");
53799
+ return (0, import_node_fs24.readFileSync)((0, import_node_path26.join)(cwd, path), "utf8");
53736
53800
  } catch (err2) {
53737
53801
  return err2.code === "ENOENT" ? "" : null;
53738
53802
  }
@@ -53792,7 +53856,7 @@ async function verifyChange(ctx, results, undoable) {
53792
53856
  flushedAt = now();
53793
53857
  if (undoable) {
53794
53858
  const report = findJUnitReport(cwd);
53795
- const ignore = report ? [(0, import_node_path25.relative)(cwd, report).split("\\").join("/")] : [];
53859
+ const ignore = report ? [(0, import_node_path26.relative)(cwd, report).split("\\").join("/")] : [];
53796
53860
  const flush = undoableFlush(cwd, results, flushCodegenResults, { ignore });
53797
53861
  undo = () => flush.undo();
53798
53862
  } else {
@@ -53828,7 +53892,8 @@ async function verifyChange(ctx, results, undoable) {
53828
53892
  return fail(new Error(gateTimeoutMessage(limit, ctx.baselineMs)));
53829
53893
  }
53830
53894
  timing("gate", gateStartedAt, packet.commands.test);
53831
- outputs.finalTestReport = readTestReportBytes();
53895
+ outputs.finalTestStartedAt = gateStartedAt;
53896
+ outputs.finalTestReport = readTestReportBytes(void 0, { freshSinceMs: gateStartedAt });
53832
53897
  outputs.testCount = after.results?.size;
53833
53898
  outputs.vanishedTests = findVanishedTests(baseline, after, ctx.ignoreVanished) ?? void 0;
53834
53899
  if (outputs.vanishedTests) {
@@ -53887,16 +53952,19 @@ async function verifyChange(ctx, results, undoable) {
53887
53952
  var MAX_LEFT_OUT_NAMES2 = 10;
53888
53953
  function checkGuardrail(deniedPaths, writeRoot = "") {
53889
53954
  addAll(writeRoot || void 0);
53955
+ const deleted = stagedDeletions();
53956
+ unstage(deleted);
53957
+ const deletionsLeftOut = { count: deleted.length, names: deleted.filter((p) => matchesDeniedPath(p, readDenied(deniedPaths)) === null).slice(0, MAX_LEFT_OUT_NAMES2) };
53890
53958
  const violations = deniedPaths.flatMap((pattern) => diffCachedNamesMatching(pattern));
53891
53959
  if (violations.length > 0) {
53892
53960
  throw new Error(`QuikPilot touched denied paths:
53893
53961
  ${violations.join("\n")}`);
53894
53962
  }
53895
- if (!writeRoot) return { leftOut: 0, names: [], hidden: 0 };
53963
+ if (!writeRoot) return { leftOut: 0, names: [], hidden: 0, deletionsLeftOut };
53896
53964
  const outside = changedOutside(writeRoot);
53897
53965
  const protectedPatterns = readDenied(deniedPaths);
53898
53966
  const nameable = outside.filter((path) => matchesDeniedPath(path, protectedPatterns) === null);
53899
- return { leftOut: outside.length, names: nameable.slice(0, MAX_LEFT_OUT_NAMES2), hidden: outside.length - nameable.length };
53967
+ return { leftOut: outside.length, names: nameable.slice(0, MAX_LEFT_OUT_NAMES2), hidden: outside.length - nameable.length, deletionsLeftOut };
53900
53968
  }
53901
53969
 
53902
53970
  // src/run.ts
@@ -53958,7 +54026,7 @@ function buildToolsV2Env(i3) {
53958
54026
  }
53959
54027
 
53960
54028
  // src/repoMap.ts
53961
- var import_node_path26 = require("node:path");
54029
+ var import_node_path27 = require("node:path");
53962
54030
  var MAP_BUDGET_TOKENS = 4e3;
53963
54031
  var MAX_FOLDERS = 200;
53964
54032
  var MAX_LANGUAGES = 12;
@@ -54000,7 +54068,7 @@ function guidanceFiles(i3, perFile2, total) {
54000
54068
  function languages2(listing) {
54001
54069
  const counts = /* @__PURE__ */ new Map();
54002
54070
  for (const p of listing) {
54003
- const ext = import_node_path26.posix.extname(p).toLowerCase();
54071
+ const ext = import_node_path27.posix.extname(p).toLowerCase();
54004
54072
  if (ext && ext.length <= 12) counts.set(ext, (counts.get(ext) ?? 0) + 1);
54005
54073
  }
54006
54074
  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 +54084,7 @@ function testFacts(i3) {
54016
54084
  const depth = i3.writeRoot === "" ? 0 : i3.writeRoot.split("/").length;
54017
54085
  for (const t of tests) {
54018
54086
  const parts2 = t.split("/");
54019
- const folder = parts2.length > depth + 1 ? parts2.slice(0, depth + 1).join("/") : import_node_path26.posix.dirname(t);
54087
+ const folder = parts2.length > depth + 1 ? parts2.slice(0, depth + 1).join("/") : import_node_path27.posix.dirname(t);
54020
54088
  byFolder.set(folder, (byFolder.get(folder) ?? 0) + 1);
54021
54089
  }
54022
54090
  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 +54194,7 @@ function buildRepoMap(i3) {
54126
54194
  }
54127
54195
 
54128
54196
  // src/workspacePackages.ts
54129
- var import_node_path27 = require("node:path");
54197
+ var import_node_path28 = require("node:path");
54130
54198
  var MAX_READ_ROOTS = 8;
54131
54199
  function isObject2(x) {
54132
54200
  return typeof x === "object" && x !== null && !Array.isArray(x);
@@ -54188,8 +54256,8 @@ function workspacePackages(readText, packageJsonPaths) {
54188
54256
  const exclude = patterns.filter((p) => p.startsWith("!")).map((p) => globMatcher(p.slice(1)));
54189
54257
  const out2 = [];
54190
54258
  for (const file of packageJsonPaths) {
54191
- if (import_node_path27.posix.basename(file) !== "package.json" || file === "package.json" || file.split("/").includes("node_modules")) continue;
54192
- const folder = import_node_path27.posix.dirname(file);
54259
+ if (import_node_path28.posix.basename(file) !== "package.json" || file === "package.json" || file.split("/").includes("node_modules")) continue;
54260
+ const folder = import_node_path28.posix.dirname(file);
54193
54261
  if (!include.some((re) => re.test(folder)) || exclude.some((re) => re.test(folder))) continue;
54194
54262
  const text3 = readText(file);
54195
54263
  const json = text3 === null ? null : parseJsonc(text3);
@@ -54467,29 +54535,29 @@ function writePhase0Marker(runId) {
54467
54535
  }
54468
54536
 
54469
54537
  // src/failureArtifact.ts
54470
- var import_node_child_process13 = require("node:child_process");
54538
+ var import_node_child_process14 = require("node:child_process");
54471
54539
  var import_node_fs26 = require("node:fs");
54472
- var import_node_path28 = require("node:path");
54540
+ var import_node_path29 = require("node:path");
54473
54541
  var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
54474
54542
  var REPORT_COPY = "final-test-report.xml";
54475
54543
  var MAX_REPORT_BYTES = 5 * 1024 * 1024;
54476
54544
  var MAX_FILES = 200;
54477
- var RUNNER_VERSION = true ? "9.3.0-rc.86" : "dev";
54545
+ var RUNNER_VERSION = true ? "9.3.0-rc.88" : "dev";
54478
54546
  function safeDestination(base, repoPath) {
54479
- if (!repoPath || (0, import_node_path28.isAbsolute)(repoPath)) return null;
54480
- const destination = (0, import_node_path28.resolve)(base, repoPath);
54481
- const rel = (0, import_node_path28.relative)(base, destination);
54482
- if (!rel || rel.startsWith("..") || (0, import_node_path28.isAbsolute)(rel)) return null;
54547
+ if (!repoPath || (0, import_node_path29.isAbsolute)(repoPath)) return null;
54548
+ const destination = (0, import_node_path29.resolve)(base, repoPath);
54549
+ const rel = (0, import_node_path29.relative)(base, destination);
54550
+ if (!rel || rel.startsWith("..") || (0, import_node_path29.isAbsolute)(rel)) return null;
54483
54551
  return destination;
54484
54552
  }
54485
54553
  var BUNDLE_FILE = "quikpilot-change.bundle";
54486
54554
  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();
54555
+ const git4 = (args2) => (0, import_node_child_process14.execFileSync)("git", [...NO_HOOKS_ARGS, ...args2], { env: gitEnv(), cwd: repo, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
54488
54556
  try {
54489
54557
  if (git4(["rev-parse", "--abbrev-ref", "HEAD"]) !== branch) return null;
54490
54558
  if (git4(["diff", "--name-only", "HEAD~1", "HEAD"]) === "") return null;
54491
54559
  const commit2 = git4(["rev-parse", "HEAD"]);
54492
- const file = (0, import_node_path28.join)(folder, BUNDLE_FILE);
54560
+ const file = (0, import_node_path29.join)(folder, BUNDLE_FILE);
54493
54561
  git4(["bundle", "create", file, "HEAD", "^HEAD~1"]);
54494
54562
  let verified = true;
54495
54563
  try {
@@ -54505,7 +54573,7 @@ function keepCommitBundle(repo, folder, branch) {
54505
54573
  function writeFailureArtifact(input) {
54506
54574
  if (input.results.length === 0) return { written: false };
54507
54575
  try {
54508
- const base = (0, import_node_path28.resolve)(input.cwd, FAILURE_ARTIFACT_DIR);
54576
+ const base = (0, import_node_path29.resolve)(input.cwd, FAILURE_ARTIFACT_DIR);
54509
54577
  (0, import_node_fs26.rmSync)(base, { recursive: true, force: true });
54510
54578
  (0, import_node_fs26.mkdirSync)(base, { recursive: true });
54511
54579
  const files = [];
@@ -54516,7 +54584,7 @@ function writeFailureArtifact(input) {
54516
54584
  skipped.push(result.targetPath);
54517
54585
  continue;
54518
54586
  }
54519
- (0, import_node_fs26.mkdirSync)((0, import_node_path28.dirname)(destination), { recursive: true });
54587
+ (0, import_node_fs26.mkdirSync)((0, import_node_path29.dirname)(destination), { recursive: true });
54520
54588
  (0, import_node_fs26.writeFileSync)(destination, result.newContent);
54521
54589
  files.push({ path: result.targetPath, bytes: Buffer.byteLength(result.newContent) });
54522
54590
  }
@@ -54525,7 +54593,7 @@ function writeFailureArtifact(input) {
54525
54593
  if (input.testReport.byteLength > MAX_REPORT_BYTES) {
54526
54594
  testReport = "too-large";
54527
54595
  } else {
54528
- (0, import_node_fs26.writeFileSync)((0, import_node_path28.join)(base, REPORT_COPY), input.testReport);
54596
+ (0, import_node_fs26.writeFileSync)((0, import_node_path29.join)(base, REPORT_COPY), input.testReport);
54529
54597
  testReport = "included";
54530
54598
  }
54531
54599
  }
@@ -54547,8 +54615,8 @@ function writeFailureArtifact(input) {
54547
54615
  bundle
54548
54616
  };
54549
54617
  const text3 = JSON.stringify(manifest, (_key, value) => typeof value === "string" ? scrubSecrets(value, input.secrets) : value, 2);
54550
- (0, import_node_fs26.writeFileSync)((0, import_node_path28.join)(base, "manifest.json"), text3);
54551
- return { written: (0, import_node_fs26.existsSync)((0, import_node_path28.join)(base, "manifest.json")) };
54618
+ (0, import_node_fs26.writeFileSync)((0, import_node_path29.join)(base, "manifest.json"), text3);
54619
+ return { written: (0, import_node_fs26.existsSync)((0, import_node_path29.join)(base, "manifest.json")) };
54552
54620
  } catch (err2) {
54553
54621
  console.warn(`::warning::Could not keep the failed run's files: ${err2 instanceof Error ? err2.message : String(err2)}`);
54554
54622
  return { written: false };
@@ -54556,11 +54624,12 @@ function writeFailureArtifact(input) {
54556
54624
  }
54557
54625
 
54558
54626
  // src/finalChange.ts
54559
- var import_node_child_process14 = require("node:child_process");
54627
+ var import_node_child_process15 = require("node:child_process");
54560
54628
  var import_node_fs27 = require("node:fs");
54561
- var import_node_path29 = require("node:path");
54629
+ var import_node_path30 = require("node:path");
54562
54630
  function statusPaths(root) {
54563
- const status = (0, import_node_child_process14.execFileSync)("git", ["status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
54631
+ const status = (0, import_node_child_process15.execFileSync)("git", [...NO_HOOKS_ARGS, "status", "--porcelain", "-z", "--untracked-files=all", "--no-renames"], {
54632
+ env: gitEnv(),
54564
54633
  cwd: root,
54565
54634
  encoding: "utf8",
54566
54635
  maxBuffer: 64 * 1024 * 1024
@@ -54571,7 +54640,7 @@ function statusPaths(root) {
54571
54640
  }
54572
54641
  var isFileOnDisk = (root, path) => {
54573
54642
  try {
54574
- return (0, import_node_fs27.statSync)((0, import_node_path29.join)(root, path)).isFile();
54643
+ return (0, import_node_fs27.statSync)((0, import_node_path30.join)(root, path)).isFile();
54575
54644
  } catch {
54576
54645
  return false;
54577
54646
  }
@@ -54591,9 +54660,9 @@ function allChangesAgainstBase(root) {
54591
54660
  }
54592
54661
 
54593
54662
  // src/nameEvidence.ts
54594
- var import_node_child_process15 = require("node:child_process");
54663
+ var import_node_child_process16 = require("node:child_process");
54595
54664
  var import_node_fs28 = require("node:fs");
54596
- var import_node_path30 = require("node:path");
54665
+ var import_node_path31 = require("node:path");
54597
54666
 
54598
54667
  // src/migrationNames.ts
54599
54668
  var PART = String.raw`(?:"[^"]+"|\x60[^\x60]+\x60|\[[^\]]+\]|[\w$]+)`;
@@ -54658,7 +54727,8 @@ var escapeRegExp5 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
54658
54727
  function filesNaming(word, ev, readable, denied) {
54659
54728
  let out2;
54660
54729
  try {
54661
- out2 = (0, import_node_child_process15.execFileSync)("git", ["grep", "-l", "-I", "-w", "-F", "-e", word], {
54730
+ out2 = (0, import_node_child_process16.execFileSync)("git", [...NO_HOOKS_ARGS, "grep", "-l", "-I", "-w", "-F", "-e", word], {
54731
+ env: gitEnv(),
54662
54732
  cwd: ev.cwd,
54663
54733
  encoding: "utf8",
54664
54734
  stdio: ["ignore", "pipe", "ignore"],
@@ -54672,7 +54742,7 @@ function filesNaming(word, ev, readable, denied) {
54672
54742
  }
54673
54743
  function fileHasWord(cwd, file, word) {
54674
54744
  try {
54675
- const path = (0, import_node_path30.join)(cwd, file);
54745
+ const path = (0, import_node_path31.join)(cwd, file);
54676
54746
  if ((0, import_node_fs28.statSync)(path).size > MAX_FILE_BYTES2) return false;
54677
54747
  return new RegExp(`(?<![\\w$])${escapeRegExp5(word)}(?![\\w$])`).test((0, import_node_fs28.readFileSync)(path, "utf8"));
54678
54748
  } catch {
@@ -54703,24 +54773,24 @@ var slashes = (p) => p.replace(/\\/g, "/");
54703
54773
  var withoutDotSlash = (p) => p.replace(/^(\.\/)+/, "");
54704
54774
  function relativeToRepository(raw, cwd) {
54705
54775
  const path = withoutDotSlash(slashes(raw.trim()));
54706
- let relative11 = path;
54776
+ let relative12 = path;
54707
54777
  if (path.startsWith("/") || DRIVE_RE.test(path)) {
54708
54778
  const root = slashes(cwd).replace(/\/+$/, "");
54709
54779
  const windows = DRIVE_RE.test(path) || DRIVE_RE.test(root);
54710
54780
  const a = windows ? path.toLowerCase() : path;
54711
54781
  const b = windows ? root.toLowerCase() : root;
54712
54782
  if (!a.startsWith(`${b}/`)) return null;
54713
- relative11 = path.slice(root.length + 1);
54783
+ relative12 = path.slice(root.length + 1);
54714
54784
  }
54715
- return relative11;
54785
+ return relative12;
54716
54786
  }
54717
54787
  function inListing(raw, listing, cwd, workspaceRoot) {
54718
- const relative11 = relativeToRepository(raw, cwd);
54719
- if (relative11 === null) return null;
54720
- if (listing.has(relative11)) return relative11;
54788
+ const relative12 = relativeToRepository(raw, cwd);
54789
+ if (relative12 === null) return null;
54790
+ if (listing.has(relative12)) return relative12;
54721
54791
  if (workspaceRoot) {
54722
54792
  const root = slashes(workspaceRoot).replace(/\/+$/, "");
54723
- const joined = `${root}/${relative11}`;
54793
+ const joined = `${root}/${relative12}`;
54724
54794
  if (listing.has(joined)) return joined;
54725
54795
  }
54726
54796
  return null;
@@ -55410,6 +55480,12 @@ function leftOutNote(root, out2) {
55410
55480
  const head = `${out2.leftOut} changed file${out2.leftOut === 1 ? "" : "s"} outside ${root} ${out2.leftOut === 1 ? "was" : "were"} left out of the pull request`;
55411
55481
  return `${head} (changed while the project's commands ran): ${listed}.`;
55412
55482
  }
55483
+ function deletionsLeftOutNote(out2) {
55484
+ const more = Math.max(0, out2.count - out2.names.length);
55485
+ const listed = out2.names.length > 0 ? `${out2.names.join(", ")}${more > 0 ? ` and ${more} more` : ""}` : `${out2.count} not named`;
55486
+ const one = out2.count === 1;
55487
+ return `${out2.count} file${one ? "" : "s"} in the repository that a command deleted during the run ${one ? "was" : "were"} left out of the pull request (${one ? "it is" : "they are"} not deleted): ${listed}.`;
55488
+ }
55413
55489
  async function run2(env2) {
55414
55490
  const runStartedAt = Date.now();
55415
55491
  let hardFailure = false;
@@ -55429,6 +55505,7 @@ async function run2(env2) {
55429
55505
  let generatedFilePaths = [];
55430
55506
  let generatedResults = [];
55431
55507
  let finalTestReport = null;
55508
+ let finalTestStartedAt;
55432
55509
  let targetingResult;
55433
55510
  let baselineFindings;
55434
55511
  let vanishedTests;
@@ -55858,6 +55935,7 @@ async function run2(env2) {
55858
55935
  unsuppliedInputs = final.outputs.unsuppliedInputs;
55859
55936
  generatedFilePaths = final.outputs.generatedFilePaths;
55860
55937
  finalTestReport = final.outputs.finalTestReport;
55938
+ finalTestStartedAt = final.outputs.finalTestStartedAt;
55861
55939
  vanishedTests = final.outputs.vanishedTests;
55862
55940
  if (fixed2.heal && codegenMode === "loop-tests") codegenOut.loop = mergeHealRecord(codegenOut.loop, fixed2.heal, healCalls);
55863
55941
  if (!final.ok) {
@@ -55968,8 +56046,11 @@ async function run2(env2) {
55968
56046
  githubServerUrl: env2.githubServerUrl,
55969
56047
  githubRepository: env2.githubRepository,
55970
56048
  githubRunId: env2.githubRunId,
55971
- generatedFiles: generatedFilePaths
56049
+ generatedFiles: generatedFilePaths,
56050
+ freshSinceMs: finalTestStartedAt
55972
56051
  });
56052
+ const removedReports = removeRunReports();
56053
+ if (removedReports > 0) console.log(JSON.stringify({ event: "quiktest.reports_removed", count: removedReports }));
55973
56054
  const unmatchedWarning = quikTestReport ? describeUnmatchedAutomationIds(quikTestReport.unmatched) : null;
55974
56055
  if (unmatchedWarning) {
55975
56056
  warnings.push(unmatchedWarning);
@@ -55996,6 +56077,10 @@ async function run2(env2) {
55996
56077
  warnings.push(leftOutNote(scopeRoot, guarded));
55997
56078
  console.log(JSON.stringify({ event: "scope.left_out", count: guarded.leftOut, ...guarded.hidden > 0 ? { hidden: guarded.hidden } : {} }));
55998
56079
  }
56080
+ if (guarded?.deletionsLeftOut && guarded.deletionsLeftOut.count > 0) {
56081
+ warnings.push(deletionsLeftOutNote(guarded.deletionsLeftOut));
56082
+ console.log(JSON.stringify({ event: "commit.deletions_left_out", count: guarded.deletionsLeftOut.count }));
56083
+ }
55999
56084
  const installationToken = await exchangeForInstallationToken(
56000
56085
  env2.installationTokenUrl,
56001
56086
  runToken