@loopover/engine 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +661 -0
  3. package/README.md +676 -0
  4. package/dist/advisory/gate-advisory.d.ts +151 -0
  5. package/dist/advisory/gate-advisory.js +512 -0
  6. package/dist/ai-policy-map.d.ts +97 -0
  7. package/dist/ai-policy-map.js +377 -0
  8. package/dist/ams-policy-spec.d.ts +56 -0
  9. package/dist/ams-policy-spec.js +165 -0
  10. package/dist/calibration-dashboard.d.ts +23 -0
  11. package/dist/calibration-dashboard.js +65 -0
  12. package/dist/calibration-trend.d.ts +40 -0
  13. package/dist/calibration-trend.js +60 -0
  14. package/dist/contributor-fit.d.ts +24 -0
  15. package/dist/contributor-fit.js +50 -0
  16. package/dist/discovery-index-contract.d.ts +74 -0
  17. package/dist/discovery-index-contract.js +184 -0
  18. package/dist/discovery-soft-claim.d.ts +35 -0
  19. package/dist/discovery-soft-claim.js +50 -0
  20. package/dist/duplicate-winner.d.ts +57 -0
  21. package/dist/duplicate-winner.js +98 -0
  22. package/dist/feasibility.d.ts +27 -0
  23. package/dist/feasibility.js +86 -0
  24. package/dist/finding-severity-calibration.d.ts +116 -0
  25. package/dist/finding-severity-calibration.js +457 -0
  26. package/dist/fleet-run-manifest.d.ts +41 -0
  27. package/dist/fleet-run-manifest.js +151 -0
  28. package/dist/focus-manifest/guidance.d.ts +21 -0
  29. package/dist/focus-manifest/guidance.js +222 -0
  30. package/dist/focus-manifest.d.ts +826 -0
  31. package/dist/focus-manifest.js +2730 -0
  32. package/dist/gate-verdict-calibration.d.ts +111 -0
  33. package/dist/gate-verdict-calibration.js +411 -0
  34. package/dist/github/constants.d.ts +1 -0
  35. package/dist/github/constants.js +1 -0
  36. package/dist/github/sanitize-public-comment.d.ts +1 -0
  37. package/dist/github/sanitize-public-comment.js +26 -0
  38. package/dist/goal-model.d.ts +7 -0
  39. package/dist/goal-model.js +87 -0
  40. package/dist/governor/action-mode.d.ts +55 -0
  41. package/dist/governor/action-mode.js +74 -0
  42. package/dist/governor/budget-cap.d.ts +49 -0
  43. package/dist/governor/budget-cap.js +34 -0
  44. package/dist/governor/chokepoint.d.ts +58 -0
  45. package/dist/governor/chokepoint.js +269 -0
  46. package/dist/governor/kill-switch.d.ts +38 -0
  47. package/dist/governor/kill-switch.js +62 -0
  48. package/dist/governor/rate-limit.d.ts +40 -0
  49. package/dist/governor/rate-limit.js +63 -0
  50. package/dist/governor/reputation-throttle.d.ts +50 -0
  51. package/dist/governor/reputation-throttle.js +94 -0
  52. package/dist/governor/run-halt.d.ts +39 -0
  53. package/dist/governor/run-halt.js +83 -0
  54. package/dist/governor/self-plagiarism.d.ts +47 -0
  55. package/dist/governor/self-plagiarism.js +200 -0
  56. package/dist/governor/write-rate-limit.d.ts +52 -0
  57. package/dist/governor/write-rate-limit.js +132 -0
  58. package/dist/governor-ledger.d.ts +25 -0
  59. package/dist/governor-ledger.js +91 -0
  60. package/dist/index.d.ts +99 -0
  61. package/dist/index.js +120 -0
  62. package/dist/issue-plan-decomposition.d.ts +18 -0
  63. package/dist/issue-plan-decomposition.js +56 -0
  64. package/dist/issue-rag-query.d.ts +12 -0
  65. package/dist/issue-rag-query.js +35 -0
  66. package/dist/local-scorer.d.ts +34 -0
  67. package/dist/local-scorer.js +36 -0
  68. package/dist/metadata-best-min-score.d.ts +9 -0
  69. package/dist/metadata-best-min-score.js +9 -0
  70. package/dist/metadata-best-pick.d.ts +9 -0
  71. package/dist/metadata-best-pick.js +9 -0
  72. package/dist/metadata-min-score.d.ts +9 -0
  73. package/dist/metadata-min-score.js +13 -0
  74. package/dist/metadata-top-min-score.d.ts +9 -0
  75. package/dist/metadata-top-min-score.js +13 -0
  76. package/dist/metadata-top-pick.d.ts +9 -0
  77. package/dist/metadata-top-pick.js +13 -0
  78. package/dist/miner/acceptance-criteria.d.ts +43 -0
  79. package/dist/miner/acceptance-criteria.js +77 -0
  80. package/dist/miner/agent-sdk-driver.d.ts +39 -0
  81. package/dist/miner/agent-sdk-driver.js +162 -0
  82. package/dist/miner/attempt-log.d.ts +29 -0
  83. package/dist/miner/attempt-log.js +100 -0
  84. package/dist/miner/attempt-metering.d.ts +39 -0
  85. package/dist/miner/attempt-metering.js +67 -0
  86. package/dist/miner/cli-subprocess-driver.d.ts +68 -0
  87. package/dist/miner/cli-subprocess-driver.js +272 -0
  88. package/dist/miner/coding-agent-driver.d.ts +33 -0
  89. package/dist/miner/coding-agent-driver.js +36 -0
  90. package/dist/miner/coding-agent-invoke.d.ts +11 -0
  91. package/dist/miner/coding-agent-invoke.js +80 -0
  92. package/dist/miner/coding-agent-mode.d.ts +25 -0
  93. package/dist/miner/coding-agent-mode.js +43 -0
  94. package/dist/miner/driver-factory.d.ts +82 -0
  95. package/dist/miner/driver-factory.js +169 -0
  96. package/dist/miner/harness-submission-trigger.d.ts +37 -0
  97. package/dist/miner/harness-submission-trigger.js +46 -0
  98. package/dist/miner/iterate-loop.d.ts +97 -0
  99. package/dist/miner/iterate-loop.js +278 -0
  100. package/dist/miner/iterate-policy.d.ts +98 -0
  101. package/dist/miner/iterate-policy.js +98 -0
  102. package/dist/miner/lint-guard.d.ts +50 -0
  103. package/dist/miner/lint-guard.js +68 -0
  104. package/dist/miner/local-write-tools.d.ts +81 -0
  105. package/dist/miner/local-write-tools.js +113 -0
  106. package/dist/miner/loop-reentry-policy.d.ts +36 -0
  107. package/dist/miner/loop-reentry-policy.js +53 -0
  108. package/dist/miner/repo-map.d.ts +51 -0
  109. package/dist/miner/repo-map.js +268 -0
  110. package/dist/miner/self-review-adapter.d.ts +106 -0
  111. package/dist/miner/self-review-adapter.js +83 -0
  112. package/dist/miner/submission-gate.d.ts +40 -0
  113. package/dist/miner/submission-gate.js +89 -0
  114. package/dist/miner/worktree-allocator.d.ts +59 -0
  115. package/dist/miner/worktree-allocator.js +60 -0
  116. package/dist/miner/worktree-pool.d.ts +55 -0
  117. package/dist/miner/worktree-pool.js +65 -0
  118. package/dist/miner-goal-lane-fit.d.ts +18 -0
  119. package/dist/miner-goal-lane-fit.js +76 -0
  120. package/dist/miner-goal-spec.d.ts +139 -0
  121. package/dist/miner-goal-spec.js +281 -0
  122. package/dist/miner-prediction-metrics.d.ts +16 -0
  123. package/dist/miner-prediction-metrics.js +61 -0
  124. package/dist/miner-telemetry.d.ts +32 -0
  125. package/dist/miner-telemetry.js +87 -0
  126. package/dist/objective-anchor.d.ts +125 -0
  127. package/dist/objective-anchor.js +401 -0
  128. package/dist/opportunity-competition.d.ts +6 -0
  129. package/dist/opportunity-competition.js +29 -0
  130. package/dist/opportunity-freshness.d.ts +18 -0
  131. package/dist/opportunity-freshness.js +55 -0
  132. package/dist/opportunity-metadata.d.ts +53 -0
  133. package/dist/opportunity-metadata.js +204 -0
  134. package/dist/opportunity-ranker.d.ts +46 -0
  135. package/dist/opportunity-ranker.js +74 -0
  136. package/dist/pairwise-calibration.d.ts +49 -0
  137. package/dist/pairwise-calibration.js +106 -0
  138. package/dist/phase7-calibration-loop.d.ts +136 -0
  139. package/dist/phase7-calibration-loop.js +437 -0
  140. package/dist/plan-blocked.d.ts +6 -0
  141. package/dist/plan-blocked.js +24 -0
  142. package/dist/plan-completed.d.ts +5 -0
  143. package/dist/plan-completed.js +6 -0
  144. package/dist/plan-completion.d.ts +6 -0
  145. package/dist/plan-completion.js +7 -0
  146. package/dist/plan-empty.d.ts +5 -0
  147. package/dist/plan-empty.js +6 -0
  148. package/dist/plan-export.d.ts +27 -0
  149. package/dist/plan-export.js +86 -0
  150. package/dist/plan-failure.d.ts +5 -0
  151. package/dist/plan-failure.js +6 -0
  152. package/dist/plan-overall-status.d.ts +6 -0
  153. package/dist/plan-overall-status.js +25 -0
  154. package/dist/plan-pending.d.ts +5 -0
  155. package/dist/plan-pending.js +6 -0
  156. package/dist/plan-progress-complete.d.ts +7 -0
  157. package/dist/plan-progress-complete.js +10 -0
  158. package/dist/plan-ready.d.ts +6 -0
  159. package/dist/plan-ready.js +12 -0
  160. package/dist/plan-running.d.ts +5 -0
  161. package/dist/plan-running.js +6 -0
  162. package/dist/plan-skipped.d.ts +5 -0
  163. package/dist/plan-skipped.js +6 -0
  164. package/dist/plan-step-count.d.ts +5 -0
  165. package/dist/plan-step-count.js +6 -0
  166. package/dist/plan-step-stats.d.ts +5 -0
  167. package/dist/plan-step-stats.js +6 -0
  168. package/dist/plan-templates.d.ts +25 -0
  169. package/dist/plan-templates.js +107 -0
  170. package/dist/plan-terminated.d.ts +6 -0
  171. package/dist/plan-terminated.js +9 -0
  172. package/dist/portfolio/non-convergence.d.ts +37 -0
  173. package/dist/portfolio/non-convergence.js +57 -0
  174. package/dist/portfolio/queue.d.ts +30 -0
  175. package/dist/portfolio/queue.js +150 -0
  176. package/dist/predicted-gate.d.ts +103 -0
  177. package/dist/predicted-gate.js +218 -0
  178. package/dist/prompt-packet.d.ts +11 -0
  179. package/dist/prompt-packet.js +34 -0
  180. package/dist/ranked-opportunity-best-min-score.d.ts +8 -0
  181. package/dist/ranked-opportunity-best-min-score.js +9 -0
  182. package/dist/ranked-opportunity-best-pick.d.ts +8 -0
  183. package/dist/ranked-opportunity-best-pick.js +9 -0
  184. package/dist/ranked-opportunity-min-score.d.ts +8 -0
  185. package/dist/ranked-opportunity-min-score.js +13 -0
  186. package/dist/ranked-opportunity-top-min-score.d.ts +8 -0
  187. package/dist/ranked-opportunity-top-min-score.js +13 -0
  188. package/dist/review/advisory-ai-routing-config.d.ts +8 -0
  189. package/dist/review/advisory-ai-routing-config.js +40 -0
  190. package/dist/review/check-names.d.ts +1 -0
  191. package/dist/review/check-names.js +1 -0
  192. package/dist/review/cla-check.d.ts +49 -0
  193. package/dist/review/cla-check.js +71 -0
  194. package/dist/review/diff-file-priority.d.ts +1 -0
  195. package/dist/review/diff-file-priority.js +12 -0
  196. package/dist/review/enrichment-analyzer-names.d.ts +3 -0
  197. package/dist/review/enrichment-analyzer-names.js +63 -0
  198. package/dist/review/guardrail-config.d.ts +10 -0
  199. package/dist/review/guardrail-config.js +62 -0
  200. package/dist/review/linked-issue-hard-rules-config.d.ts +4 -0
  201. package/dist/review/linked-issue-hard-rules-config.js +79 -0
  202. package/dist/review/linked-issue-label-propagation.d.ts +9 -0
  203. package/dist/review/linked-issue-label-propagation.js +114 -0
  204. package/dist/review/pre-merge-checks.d.ts +28 -0
  205. package/dist/review/pre-merge-checks.js +66 -0
  206. package/dist/review/review-thread-findings.d.ts +1 -0
  207. package/dist/review/review-thread-findings.js +1 -0
  208. package/dist/review/safe-url.d.ts +5 -0
  209. package/dist/review/safe-url.js +137 -0
  210. package/dist/review/screenshot-table-gate.d.ts +87 -0
  211. package/dist/review/screenshot-table-gate.js +340 -0
  212. package/dist/review/unlinked-issue-guardrail-config.d.ts +9 -0
  213. package/dist/review/unlinked-issue-guardrail-config.js +44 -0
  214. package/dist/reviewer-consensus-calibration.d.ts +113 -0
  215. package/dist/reviewer-consensus-calibration.js +493 -0
  216. package/dist/reward-risk.d.ts +223 -0
  217. package/dist/reward-risk.js +618 -0
  218. package/dist/scoring/label-match.d.ts +4 -0
  219. package/dist/scoring/label-match.js +145 -0
  220. package/dist/scoring/model.d.ts +31 -0
  221. package/dist/scoring/model.js +157 -0
  222. package/dist/scoring/pending-pr-scenarios.d.ts +44 -0
  223. package/dist/scoring/pending-pr-scenarios.js +145 -0
  224. package/dist/scoring/preview.d.ts +246 -0
  225. package/dist/scoring/preview.js +1108 -0
  226. package/dist/scoring/types.d.ts +131 -0
  227. package/dist/scoring/types.js +7 -0
  228. package/dist/settings/auto-close-exempt.d.ts +10 -0
  229. package/dist/settings/auto-close-exempt.js +58 -0
  230. package/dist/settings/autonomy.d.ts +33 -0
  231. package/dist/settings/autonomy.js +80 -0
  232. package/dist/settings/command-authorization.d.ts +49 -0
  233. package/dist/settings/command-authorization.js +222 -0
  234. package/dist/settings/contributor-blacklist.d.ts +17 -0
  235. package/dist/settings/contributor-blacklist.js +86 -0
  236. package/dist/settings/moderation-rules.d.ts +51 -0
  237. package/dist/settings/moderation-rules.js +104 -0
  238. package/dist/settings/pr-type-label.d.ts +70 -0
  239. package/dist/settings/pr-type-label.js +149 -0
  240. package/dist/signals/change-guardrail.d.ts +49 -0
  241. package/dist/signals/change-guardrail.js +164 -0
  242. package/dist/signals/check-summary.d.ts +9 -0
  243. package/dist/signals/check-summary.js +12 -0
  244. package/dist/signals/contributor-calibration.d.ts +23 -0
  245. package/dist/signals/contributor-calibration.js +47 -0
  246. package/dist/signals/duplicate-winner.d.ts +9 -0
  247. package/dist/signals/duplicate-winner.js +9 -0
  248. package/dist/signals/path-matchers.d.ts +36 -0
  249. package/dist/signals/path-matchers.js +371 -0
  250. package/dist/signals/predicted-gate-engine.d.ts +62 -0
  251. package/dist/signals/predicted-gate-engine.js +895 -0
  252. package/dist/signals/preflight-limits.d.ts +14 -0
  253. package/dist/signals/preflight-limits.js +14 -0
  254. package/dist/signals/slop.d.ts +56 -0
  255. package/dist/signals/slop.js +324 -0
  256. package/dist/signals/test-evidence.d.ts +25 -0
  257. package/dist/signals/test-evidence.js +108 -0
  258. package/dist/subprocess-env.d.ts +23 -0
  259. package/dist/subprocess-env.js +74 -0
  260. package/dist/track-record-summary.d.ts +92 -0
  261. package/dist/track-record-summary.js +301 -0
  262. package/dist/types/manifest-deps-types.d.ts +514 -0
  263. package/dist/types/manifest-deps-types.js +4 -0
  264. package/dist/types/predicted-gate-types.d.ts +338 -0
  265. package/dist/types/predicted-gate-types.js +3 -0
  266. package/dist/types/reward-risk-types.d.ts +319 -0
  267. package/dist/types/reward-risk-types.js +11 -0
  268. package/dist/utils/json.d.ts +1 -0
  269. package/dist/utils/json.js +3 -0
  270. package/dist/version.d.ts +2 -0
  271. package/dist/version.js +3 -0
  272. package/package.json +80 -0
@@ -0,0 +1,371 @@
1
+ import { isCodeFile, isTestPath } from "./test-evidence.js";
2
+ // Pure, deterministic path matchers for slop classification (#561), extracted to
3
+ // `@loopover/engine` (#4252) so the published gittensory-mcp/gittensory-miner CLIs can depend on
4
+ // the same source instead of hand-porting it. Siblings to `isTestFile` / `isTestPath`: they identify changed
5
+ // files that are NOT genuine hand-authored effort — machine-generated output, vendored/imported third-party
6
+ // code, minified bundles, dependency lockfiles, and docs — so slop signals can tell a padded diff from real
7
+ // work. Path-only and side-effect-free. This file is the canonical implementation; `src/signals/path-matchers.ts`
8
+ // is a thin re-export shim over it (imported via relative source path, not the published package, to match
9
+ // this repo's existing engine-consumption convention — see e.g. `src/signals/test-evidence.ts` — and to avoid
10
+ // depending on the engine package's built `dist/` output, which is not guaranteed to exist yet when
11
+ // `typecheck`/`test:coverage` run in CI).
12
+ /** Keep local scoring aligned with slop/test-evidence matchers (#561 / #1046). */
13
+ export function isTestFile(file) {
14
+ return isTestPath(file);
15
+ }
16
+ // isCodeFile is the single source of truth the published gittensory-mcp/gittensory-miner CLIs also
17
+ // depend on — defined once in test-evidence.ts alongside the isSourcePath/isTestPath pair it composes,
18
+ // re-exported here so this file's existing callers don't change.
19
+ export { isCodeFile };
20
+ function normalize(path) {
21
+ return String(path ?? "")
22
+ .replace(/\\/g, "/")
23
+ .toLowerCase();
24
+ }
25
+ function normalizeForMatch(path) {
26
+ const norm = normalize(path);
27
+ const slash = norm.lastIndexOf("/");
28
+ const base = slash >= 0 ? norm.slice(slash + 1) : norm;
29
+ const dot = base.lastIndexOf(".");
30
+ const ext = dot > 0 ? base.slice(dot + 1) : "";
31
+ return { norm, base, ext };
32
+ }
33
+ function isGeneratedFileFrom(parts) {
34
+ const { norm, base } = parts;
35
+ return (/(^|\/)(__generated__|generated)\//.test(norm) ||
36
+ /\.(generated|gen)\.[^/]+$/.test(norm) ||
37
+ // protoc output: Go/TS/JS plugins emit `.pb.{go,ts,js}`, the reference C++ plugin emits
38
+ // `.pb.cc` / `.pb.h`, the Swift plugin emits `.pb.swift`, the Dart plugin emits `.pb.dart`,
39
+ // the Kotlin plugin emits `.pb.kt`, the Java plugin emits `.pb.java`, the C# plugin emits `.pb.cs`, the Rust plugin emits `.pb.rs`,
40
+ // the Elixir plugin emits `.pb.ex`, the Erlang gpb plugin emits `.pb.erl` / `.pb.hrl`, the Crystal
41
+ // plugin emits `.pb.cr`, the Haskell plugin emits `.pb.hs`, the Scala plugin emits `.pb.scala`, the Rust
42
+ // plugin emits `.pb.rs` (and prost/tonic also emit underscore `*_pb.rs` / `*_grpc_pb.rs` siblings), and the Objective-C plugin emits
43
+ // `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs. Swift gRPC emits sibling `.grpc.swift`
44
+ // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs; grpc-java emits
45
+ // sibling `*Grpc.java` service stubs; grpc-dotnet emits sibling `*Grpc.cs` service stubs; the Dart
46
+ // gRPC plugin emits sibling `.pbgrpc.dart` service stubs.
47
+ // `.pb.dart`/`.pb.kt`/`.pb.cs` (the `.pb` infix keeps hand-written sources from matching).
48
+ /\.pb\.(go|ts|js|cc|h|swift|dart|kt|cs|rs|ex|erl|hrl|cr|hs|scala|java)$/.test(norm) ||
49
+ /\.grpc\.swift$/.test(norm) ||
50
+ /grpckt\.kt$/.test(norm) ||
51
+ /grpc\.java$/.test(norm) ||
52
+ /grpc\.cs$/.test(norm) ||
53
+ /\.pbgrpc\.dart$/.test(norm) ||
54
+ /\.pbobjc\.(h|m)$/.test(norm) ||
55
+ /\.pbrpc\.(h|m)$/.test(norm) ||
56
+ // Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling
57
+ // `*_pb2_grpc.py[i]` service stubs, which are the same machine-generated output.
58
+ /_pb2(_grpc)?\.pyi?$/.test(norm) ||
59
+ // Ruby protobuf: message stubs are `*_pb.rb`; the gRPC plugin emits sibling `*_services_pb.rb`.
60
+ /_pb\.rb$/.test(norm) ||
61
+ // PHP protobuf: message stubs are `*_pb.php`; the gRPC plugin emits sibling `*_grpc_pb.php`
62
+ // and grpc-php service stubs (`*Grpc.php`, `*GrpcStub.php`).
63
+ /_pb\.php$/.test(norm) ||
64
+ /grpc\.php$/.test(norm) ||
65
+ /grpcstub\.php$/i.test(norm) ||
66
+ // Nim protobuf: message stubs are `*_pb.nim`.
67
+ /_pb\.nim$/.test(norm) ||
68
+ // Lua protobuf: message stubs are `*_pb.lua`.
69
+ /_pb\.lua$/.test(norm) ||
70
+ // Perl protobuf: message stubs are `*_pb.pm`.
71
+ /_pb\.pm$/.test(norm) ||
72
+ // Rust prost/tonic underscore stubs: `*_pb.rs` message output; tonic gRPC emits sibling `*_grpc_pb.rs`.
73
+ /_pb\.rs$/.test(norm) ||
74
+ /_grpc_pb\.rs$/.test(norm) ||
75
+ // JavaScript/TypeScript grpc-node protobuf: message stubs are `*_pb.{js,ts,d.ts}`; gRPC emits
76
+ // sibling `*_grpc_pb.{js,ts,d.ts}` service stubs (underscore form, not `.pb.js`).
77
+ /_pb\.(js|ts)$/.test(norm) ||
78
+ /_pb\.d\.ts$/.test(norm) ||
79
+ // Dart codegen: build_runner (`.g.dart`), freezed (`.freezed.dart`), and
80
+ // retrofit/injectable (`.gr.dart`) all emit generated part files.
81
+ /\.(g|freezed|gr)\.dart$/.test(norm) ||
82
+ // C# codegen: WinForms/WPF designer partials (`.designer.cs`) and XAML/T4 output (`.g.cs`).
83
+ /\.(designer|g)\.cs$/.test(norm) ||
84
+ // Source maps for bundler/front-end output across JS/TS, frameworks, stylesheets, HTML, SVG, and WASM.
85
+ // `.mjs`/`.cjs` are already recognized code extensions (isCodeFile), so their bundlers'
86
+ // `.mjs.map` / `.cjs.map` maps are generated output too — the same as `.js.map`.
87
+ /\.(js|jsx|mjs|cjs|ts|tsx|mts|cts|vue|svelte|astro|mdx|scss|sass|less|html|svg|css|wasm)\.map$/.test(norm) ||
88
+ base === "worker-configuration.d.ts");
89
+ }
90
+ function isVendoredFileFrom(parts) {
91
+ // bower_components (Bower) and jspm_packages (JSPM) are installed-dependency
92
+ // directories — the same vendored case as node_modules, not contributor source.
93
+ return /(^|\/)(vendor|vendored|third_party|third-party|node_modules|bower_components|jspm_packages)\//.test(parts.norm);
94
+ }
95
+ function isLockfileFrom(parts) {
96
+ return LOCKFILE_NAMES.has(parts.base);
97
+ }
98
+ function isMinifiedFileFrom(parts) {
99
+ return /\.min\.[a-z0-9]+$/.test(parts.norm);
100
+ }
101
+ function isDocsFileFrom(parts) {
102
+ return /(^|\/)docs?\//.test(parts.norm) || DOCS_EXTENSIONS.has(parts.ext);
103
+ }
104
+ function isDependencyManifestFileFrom(parts) {
105
+ return DEPENDENCY_MANIFEST_NAMES.has(parts.base);
106
+ }
107
+ function isConfigFileFrom(parts) {
108
+ const { norm, base } = parts;
109
+ if (CONFIG_FILE_NAMES.has(base))
110
+ return true;
111
+ if (CONFIG_FILE_PREFIXES.some((prefix) => base.startsWith(prefix)))
112
+ return true;
113
+ if (/(^|\/)\.github\/workflows\/[^/]+\.(ya?ml)$/.test(norm))
114
+ return true;
115
+ if (/(^|\/)\.circleci\/config\.ya?ml$/.test(norm))
116
+ return true;
117
+ if (/\.(config|rc)\.[a-z0-9]+$/i.test(base))
118
+ return true;
119
+ // `.stylelintrc`-style: dot-prefixed name with no extension after "rc"; `custom.rc`: dotted rc extension.
120
+ return base.endsWith(".rc") || /^\.[^.]+rc$/i.test(base);
121
+ }
122
+ const LOCKFILE_NAMES = new Set([
123
+ "package-lock.json",
124
+ "npm-shrinkwrap.json",
125
+ "yarn.lock",
126
+ "pnpm-lock.yaml",
127
+ "bun.lock",
128
+ "bun.lockb",
129
+ "cargo.lock",
130
+ "poetry.lock",
131
+ "pipfile.lock",
132
+ "composer.lock",
133
+ "gemfile.lock",
134
+ "go.sum",
135
+ "go.work.sum",
136
+ "uv.lock",
137
+ "packages.lock.json",
138
+ "flake.lock",
139
+ "deno.lock",
140
+ "pubspec.lock",
141
+ "podfile.lock",
142
+ "mix.lock",
143
+ "package.resolved",
144
+ "gradle.lockfile",
145
+ "pdm.lock",
146
+ "conan.lock",
147
+ "pixi.lock",
148
+ // More ecosystems' resolved-dependency lockfiles, siblings to the above: a
149
+ // committed lockfile is generated, not hand-authored contributor effort.
150
+ "cartfile.resolved", // Carthage (Swift/Obj-C)
151
+ "gopkg.lock", // dep (legacy Go)
152
+ "shard.lock", // Shards (Crystal)
153
+ "rebar.lock", // rebar3 (Erlang)
154
+ "renv.lock", // renv (R)
155
+ "chart.lock", // Helm charts
156
+ ]);
157
+ const DEPENDENCY_MANIFEST_NAMES = new Set([
158
+ "package.json",
159
+ "cargo.toml",
160
+ "go.mod",
161
+ "requirements.txt",
162
+ "pyproject.toml",
163
+ "pipfile",
164
+ "gemfile",
165
+ "composer.json",
166
+ "build.gradle",
167
+ "build.gradle.kts",
168
+ "pom.xml",
169
+ "deno.json",
170
+ "deno.jsonc",
171
+ "pubspec.yaml",
172
+ "mix.exs",
173
+ "go.work",
174
+ // Swift Package Manager + CocoaPods manifests. Their lockfiles
175
+ // (package.resolved, podfile.lock) are already recognized above, so the
176
+ // manifests they resolve belong in the same dependency-manifest category.
177
+ "package.swift",
178
+ "podfile",
179
+ // Conan (C/C++) manifests — conan.lock is already recognized above, so the
180
+ // manifests it resolves belong here for the same reason as the Swift/CocoaPods
181
+ // pair. Conan accepts either the classic .txt or the Python-based recipe.
182
+ "conanfile.txt",
183
+ "conanfile.py",
184
+ // sbt (Scala/JVM) build definition — the JVM ecosystem is already represented
185
+ // by build.gradle(.kts) and pom.xml; build.sbt is sbt's dependency manifest.
186
+ "build.sbt",
187
+ // setuptools (Python) manifests — the Python ecosystem is already represented
188
+ // by requirements.txt/pyproject.toml/pipfile; setup.py/setup.cfg are the
189
+ // classic setuptools packaging manifests.
190
+ "setup.py",
191
+ "setup.cfg",
192
+ // Crystal (shards) + Erlang (rebar3) manifests — their lockfiles (shard.lock,
193
+ // rebar.lock) are already recognized above, so the manifests they resolve
194
+ // belong here for the same reason as the Conan/Swift/CocoaPods pairs.
195
+ "shard.yml",
196
+ "rebar.config",
197
+ // Further well-known dependency manifests for ecosystems not yet represented.
198
+ "elm.json", // Elm
199
+ "deps.edn", // Clojure (tools.deps)
200
+ "project.clj", // Clojure (Leiningen)
201
+ "environment.yml", // conda
202
+ ]);
203
+ const DOCS_EXTENSIONS = new Set(["md", "mdx", "markdown", "rst", "adoc", "asciidoc"]);
204
+ // Exact basenames (lowercased) that are unambiguously build/CI config files regardless of directory.
205
+ const CONFIG_FILE_NAMES = new Set([
206
+ "dockerfile",
207
+ "makefile",
208
+ ".editorconfig",
209
+ ".nvmrc",
210
+ ".node-version",
211
+ ".npmrc",
212
+ ".python-version",
213
+ ".ruby-version",
214
+ ".browserslistrc",
215
+ // Monorepo / task-runner config (Turborepo, Nx, Lerna).
216
+ "turbo.json",
217
+ "nx.json",
218
+ "lerna.json",
219
+ "pnpm-workspace.yaml",
220
+ // Linter / formatter config that does not follow the `.eslintrc` / `*.config.*` shapes (Biome).
221
+ "biome.json",
222
+ "biome.jsonc",
223
+ // VCS and build ignore/attribute config (siblings to the existing Dockerfile entry).
224
+ ".gitignore",
225
+ ".gitattributes",
226
+ ".dockerignore",
227
+ // Further tool ignore-files, siblings to .gitignore/.dockerignore above. (The
228
+ // .eslintignore/.prettierignore variants are already covered by the .eslint/
229
+ // .prettier prefixes.)
230
+ ".npmignore",
231
+ ".stylelintignore",
232
+ ".vercelignore",
233
+ ".helmignore",
234
+ ".gcloudignore",
235
+ // Dependency automation and local toolchain version pins.
236
+ "renovate.json",
237
+ "dependabot.yml",
238
+ ".tool-versions",
239
+ "mise.toml",
240
+ "lefthook.yml",
241
+ "lefthook.yaml",
242
+ ".pre-commit-config.yaml",
243
+ ".gitleaks.toml",
244
+ // Coverage service config.
245
+ ".codecov.yml",
246
+ ".codecov.yaml",
247
+ "codecov.yml",
248
+ "codecov.yaml",
249
+ // Task-runner config.
250
+ "taskfile.yml",
251
+ "taskfile.yaml",
252
+ "justfile",
253
+ // Docker Compose deploy config.
254
+ "docker-compose.yml",
255
+ "docker-compose.yaml",
256
+ "compose.yml",
257
+ "compose.yaml",
258
+ "docker-compose.override.yml",
259
+ "docker-compose.override.yaml",
260
+ "compose.override.yml",
261
+ "compose.override.yaml",
262
+ // Hosted deploy config.
263
+ "caddyfile",
264
+ "netlify.toml",
265
+ "vercel.json",
266
+ "railway.json",
267
+ "render.yaml",
268
+ "fly.toml",
269
+ "skaffold.yaml",
270
+ "earthfile",
271
+ "procfile",
272
+ // Hosted CI pipeline definitions (single-file basenames).
273
+ ".gitlab-ci.yml",
274
+ "jenkinsfile",
275
+ "azure-pipelines.yml",
276
+ "buf.yaml",
277
+ "buf.gen.yaml",
278
+ // Native/C++ build system definitions (siblings to Makefile/Dockerfile above).
279
+ "cmakelists.txt",
280
+ "meson.build",
281
+ "build.bazel",
282
+ "module.bazel",
283
+ ]);
284
+ // Filename prefixes that identify build, lint, test-runner, and environment config files.
285
+ const CONFIG_FILE_PREFIXES = [
286
+ "tsconfig",
287
+ "jsconfig",
288
+ "jest.config",
289
+ "vitest.config",
290
+ "vite.config",
291
+ "webpack.config",
292
+ "rollup.config",
293
+ "postcss.config",
294
+ "tailwind.config",
295
+ "next.config",
296
+ ".env",
297
+ ".eslint",
298
+ ".prettier",
299
+ ".babel",
300
+ // Cloudflare Workers deploy config (`wrangler.toml`, `wrangler.jsonc`, `wrangler.vitest.jsonc`).
301
+ // The trailing dot keeps unrelated names like `wranglers-guide.md` from matching.
302
+ "wrangler.",
303
+ ];
304
+ /** Machine-generated output (codegen, protobuf, source maps, typegen). */
305
+ export function isGeneratedFile(path) {
306
+ return isGeneratedFileFrom(normalizeForMatch(path));
307
+ }
308
+ /** Third-party / imported code that lives in the repo but is not the contributor's work. */
309
+ export function isVendoredFile(path) {
310
+ return isVendoredFileFrom(normalizeForMatch(path));
311
+ }
312
+ /** Dependency lockfiles (resolved trees), e.g. `package-lock.json`, `go.sum`, `Cargo.lock`. */
313
+ export function isLockfile(path) {
314
+ return isLockfileFrom(normalizeForMatch(path));
315
+ }
316
+ /** Minified bundles, e.g. `app.min.js`, `styles.min.css`. */
317
+ export function isMinifiedFile(path) {
318
+ return isMinifiedFileFrom(normalizeForMatch(path));
319
+ }
320
+ /** Documentation files (by extension or a top-level `docs/` directory). */
321
+ export function isDocsFile(path) {
322
+ return isDocsFileFrom(normalizeForMatch(path));
323
+ }
324
+ /** Dependency manifests (declare dependencies), e.g. `package.json`, `go.mod`, `pyproject.toml`. */
325
+ export function isDependencyManifestFile(path) {
326
+ return isDependencyManifestFileFrom(normalizeForMatch(path));
327
+ }
328
+ /**
329
+ * Build, lint, test-runner, monorepo, deploy, and environment configuration files. Distinct from
330
+ * dependency manifests (which declare external dependencies) and source code. Config-only diffs are
331
+ * lower-effort than genuine source changes, so slop signals can weight them differently (#561).
332
+ */
333
+ export function isConfigFile(path) {
334
+ return isConfigFileFrom(normalizeForMatch(path));
335
+ }
336
+ /**
337
+ * Files that masquerade as substantive source/work but are machine-produced or imported — the set a
338
+ * padded diff inflates its size with. Lockfiles, dependency manifests, and docs are legitimate change
339
+ * categories and are deliberately excluded here (they have their own matchers for reuse).
340
+ */
341
+ export function isNonSubstantivePaddingFile(path) {
342
+ return isMinifiedFile(path) || isGeneratedFile(path) || isVendoredFile(path);
343
+ }
344
+ /**
345
+ * Classify a changed file into a single category. Non-substantive padding categories
346
+ * (minified/generated/vendored) take precedence so they are never miscounted as substantive source
347
+ * or test effort; lockfiles and dependency manifests are recognized before generic docs/source.
348
+ * Normalises the path once and threads the pre-computed parts through every `isX` matcher.
349
+ */
350
+ export function classifyChangedFile(path) {
351
+ const parts = normalizeForMatch(path);
352
+ if (isMinifiedFileFrom(parts))
353
+ return "minified";
354
+ if (isGeneratedFileFrom(parts))
355
+ return "generated";
356
+ if (isVendoredFileFrom(parts))
357
+ return "vendored";
358
+ if (isLockfileFrom(parts))
359
+ return "lockfile";
360
+ if (isDependencyManifestFileFrom(parts))
361
+ return "dependency_manifest";
362
+ if (isConfigFileFrom(parts))
363
+ return "config";
364
+ if (isTestFile(path) || isTestPath(path))
365
+ return "test";
366
+ if (isDocsFileFrom(parts))
367
+ return "docs";
368
+ if (isCodeFile(path))
369
+ return "source";
370
+ return "other";
371
+ }
@@ -0,0 +1,62 @@
1
+ import type { BountyLifecycle, BountyRecord, CollisionCluster, CollisionItem, CollisionReport, IssueQualityReport, IssueRecord, LaneAdvice, PreflightInput, PreflightResult, PublicReadinessScore, PullRequestRecord, QueueHealth, QueueSignalCounts, RecentMergedPullRequestRecord, RepositoryRecord } from "../types/predicted-gate-types.js";
2
+ export type { IssueQualityReport, CollisionReport, CollisionCluster } from "../types/predicted-gate-types.js";
3
+ export declare function buildLaneAdvice(repo: RepositoryRecord | null, fullName: string): LaneAdvice;
4
+ export declare function buildCollisionReport(repoFullName: string, issues: IssueRecord[], pullRequests: PullRequestRecord[], recentMergedPullRequests?: RecentMergedPullRequestRecord[]): CollisionReport;
5
+ export declare function itemSharesPlannedLinkedIssue(item: CollisionItem, plannedLinkedIssues: number[]): boolean;
6
+ export declare function buildQueueHealth(repo: RepositoryRecord | null, issues: IssueRecord[], pullRequests: PullRequestRecord[], collisions: CollisionReport, countOverrides?: QueueSignalCounts): QueueHealth;
7
+ export declare function buildPreflightResult(input: PreflightInput, repo: RepositoryRecord | null, issues: IssueRecord[], pullRequests: PullRequestRecord[], bounties?: BountyRecord[], issueQuality?: IssueQualityReport | null | undefined, registryEverSynced?: boolean): PreflightResult;
8
+ export declare const BOUNTY_STALE_DAYS = 45;
9
+ export declare function bountyIssueKey(repoFullName: string, issueNumber: number): string;
10
+ export declare function indexBountiesByIssue(bounties: BountyRecord[]): Map<string, BountyRecord>;
11
+ export declare function classifyBountyLifecycle(bounty: BountyRecord, issue: IssueRecord | null): BountyLifecycle;
12
+ export declare function isHistoricalBountyLifecycle(lifecycle: BountyLifecycle): boolean;
13
+ export declare function buildPublicReadinessScore(args: {
14
+ pr: PullRequestRecord;
15
+ preflight: PreflightResult;
16
+ queueHealth: QueueHealth;
17
+ linkedDuplicatePrs?: number[] | undefined;
18
+ scopedOverlapCount?: number | undefined;
19
+ }): PublicReadinessScore;
20
+ /** Deduplicated union of PR-specific collision clusters and preflight overlap clusters. */
21
+ export declare function unionScopedOverlapClusters(report: CollisionReport, pr: PullRequestRecord, preflightCollisions: CollisionCluster[]): CollisionCluster[];
22
+ declare function changeScopeEvidence(pr: PullRequestRecord, reviewBurden: PreflightResult["reviewBurden"]): string;
23
+ declare function reviewLoadComponentScore(reviewBurden: PreflightResult["reviewBurden"]): number;
24
+ declare function validationComponent(pr: PullRequestRecord, preflight: PreflightResult): {
25
+ score: number;
26
+ evidence: string;
27
+ action: string;
28
+ };
29
+ declare function queuePressureComponent(queueHealth: QueueHealth): {
30
+ score: number;
31
+ max: 10;
32
+ evidence: string;
33
+ action: string;
34
+ };
35
+ declare function queuePressureOpenPullRequestScore(openPullRequests: number): number;
36
+ export declare function hasClearNoIssueRationale(pr: Pick<PullRequestRecord, "title" | "body">): boolean;
37
+ export type CollisionTerms = {
38
+ terms: Set<string>;
39
+ size: number;
40
+ };
41
+ export declare function termOverlap(left: CollisionTerms, right: CollisionTerms): {
42
+ score: number;
43
+ shared: number;
44
+ };
45
+ declare function truncateText(value: string, maxChars: number): string;
46
+ export declare function tokenize(value: string): string[];
47
+ declare function extractLinkedIssueNumbers(text: string, repoFullName: string): number[];
48
+ /** True when two changed-file lists share at least one path that isn't a lockfile/generated/vendor artifact
49
+ * (diffFilePriority's least-useful-to-review bucket) — a shared package-lock.json or dist/ output is touched
50
+ * incidentally by unrelated PRs and is not evidence of a real collision. */
51
+ declare function sharesMeaningfulFile(left: string[] | undefined, right: string[] | undefined): boolean;
52
+ /** @internal Exported for unit tests of predicted-gate engine helpers. */
53
+ export declare const predictedGateEngineInternals: {
54
+ sharesMeaningfulFile: typeof sharesMeaningfulFile;
55
+ truncateText: typeof truncateText;
56
+ extractLinkedIssueNumbers: typeof extractLinkedIssueNumbers;
57
+ changeScopeEvidence: typeof changeScopeEvidence;
58
+ reviewLoadComponentScore: typeof reviewLoadComponentScore;
59
+ validationComponent: typeof validationComponent;
60
+ queuePressureComponent: typeof queuePressureComponent;
61
+ queuePressureOpenPullRequestScore: typeof queuePressureOpenPullRequestScore;
62
+ };