@descryy/core 0.3.0 → 0.5.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 (362) hide show
  1. package/dist/budget/reply.d.ts +11 -46
  2. package/dist/budget/reply.d.ts.map +1 -1
  3. package/dist/budget/reply.js +10 -39
  4. package/dist/budget/reply.js.map +1 -1
  5. package/dist/budget/size.d.ts +2 -21
  6. package/dist/budget/size.d.ts.map +1 -1
  7. package/dist/budget/size.js +3 -24
  8. package/dist/budget/size.js.map +1 -1
  9. package/dist/capabilities/preconditions.d.ts +7 -68
  10. package/dist/capabilities/preconditions.d.ts.map +1 -1
  11. package/dist/capabilities/preconditions.js +6 -57
  12. package/dist/capabilities/preconditions.js.map +1 -1
  13. package/dist/contracts/engine.d.ts +26 -12
  14. package/dist/contracts/engine.d.ts.map +1 -1
  15. package/dist/contracts/engine.js +28 -11
  16. package/dist/contracts/engine.js.map +1 -1
  17. package/dist/contracts/index.d.ts +1 -1
  18. package/dist/contracts/index.d.ts.map +1 -1
  19. package/dist/contracts/index.js.map +1 -1
  20. package/dist/contracts/orphans.d.ts +28 -77
  21. package/dist/contracts/orphans.d.ts.map +1 -1
  22. package/dist/contracts/orphans.js +124 -94
  23. package/dist/contracts/orphans.js.map +1 -1
  24. package/dist/contracts/paths.d.ts +4 -114
  25. package/dist/contracts/paths.d.ts.map +1 -1
  26. package/dist/contracts/paths.js +7 -140
  27. package/dist/contracts/paths.js.map +1 -1
  28. package/dist/contracts/shapes.d.ts +13 -66
  29. package/dist/contracts/shapes.d.ts.map +1 -1
  30. package/dist/contracts/shapes.js +20 -91
  31. package/dist/contracts/shapes.js.map +1 -1
  32. package/dist/governance/budget.d.ts +12 -48
  33. package/dist/governance/budget.d.ts.map +1 -1
  34. package/dist/governance/budget.js +12 -48
  35. package/dist/governance/budget.js.map +1 -1
  36. package/dist/governance/candidate-boundary.d.ts +4 -32
  37. package/dist/governance/candidate-boundary.d.ts.map +1 -1
  38. package/dist/governance/candidate-boundary.js +4 -32
  39. package/dist/governance/candidate-boundary.js.map +1 -1
  40. package/dist/governance/escalation.d.ts +7 -45
  41. package/dist/governance/escalation.d.ts.map +1 -1
  42. package/dist/governance/escalation.js +7 -45
  43. package/dist/governance/escalation.js.map +1 -1
  44. package/dist/governance/fact-boundary.d.ts +7 -49
  45. package/dist/governance/fact-boundary.d.ts.map +1 -1
  46. package/dist/governance/fact-boundary.js +5 -43
  47. package/dist/governance/fact-boundary.js.map +1 -1
  48. package/dist/governance/finding-funnel.d.ts +11 -72
  49. package/dist/governance/finding-funnel.d.ts.map +1 -1
  50. package/dist/governance/finding-funnel.js +9 -68
  51. package/dist/governance/finding-funnel.js.map +1 -1
  52. package/dist/graph/build.d.ts +13 -75
  53. package/dist/graph/build.d.ts.map +1 -1
  54. package/dist/graph/build.js +0 -0
  55. package/dist/graph/build.js.map +1 -1
  56. package/dist/graph/cross-language.d.ts +4 -43
  57. package/dist/graph/cross-language.d.ts.map +1 -1
  58. package/dist/graph/cross-language.js +9 -77
  59. package/dist/graph/cross-language.js.map +1 -1
  60. package/dist/graph/index.d.ts +1 -1
  61. package/dist/graph/index.d.ts.map +1 -1
  62. package/dist/graph/merge.d.ts +8 -76
  63. package/dist/graph/merge.d.ts.map +1 -1
  64. package/dist/graph/merge.js +27 -77
  65. package/dist/graph/merge.js.map +1 -1
  66. package/dist/graph/observed-tests.d.ts +7 -68
  67. package/dist/graph/observed-tests.d.ts.map +1 -1
  68. package/dist/graph/observed-tests.js +5 -60
  69. package/dist/graph/observed-tests.js.map +1 -1
  70. package/dist/graph/persist.d.ts +2 -25
  71. package/dist/graph/persist.d.ts.map +1 -1
  72. package/dist/graph/persist.js +2 -25
  73. package/dist/graph/persist.js.map +1 -1
  74. package/dist/graph/runtime-confirmation.d.ts +14 -91
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -1
  76. package/dist/graph/runtime-confirmation.js +19 -103
  77. package/dist/graph/runtime-confirmation.js.map +1 -1
  78. package/dist/ledger/mint.d.ts +9 -43
  79. package/dist/ledger/mint.d.ts.map +1 -1
  80. package/dist/ledger/mint.js +15 -65
  81. package/dist/ledger/mint.js.map +1 -1
  82. package/dist/ledger/resolve.d.ts +13 -81
  83. package/dist/ledger/resolve.d.ts.map +1 -1
  84. package/dist/ledger/resolve.js +13 -76
  85. package/dist/ledger/resolve.js.map +1 -1
  86. package/dist/multipr/fingerprint.d.ts +5 -46
  87. package/dist/multipr/fingerprint.d.ts.map +1 -1
  88. package/dist/multipr/fingerprint.js +22 -74
  89. package/dist/multipr/fingerprint.js.map +1 -1
  90. package/dist/multipr/hidden-dependency.d.ts +13 -73
  91. package/dist/multipr/hidden-dependency.d.ts.map +1 -1
  92. package/dist/multipr/hidden-dependency.js +12 -63
  93. package/dist/multipr/hidden-dependency.js.map +1 -1
  94. package/dist/multipr/mechanical.d.ts +25 -160
  95. package/dist/multipr/mechanical.d.ts.map +1 -1
  96. package/dist/multipr/mechanical.js +21 -137
  97. package/dist/multipr/mechanical.js.map +1 -1
  98. package/dist/multipr/migration-heads.d.ts +18 -105
  99. package/dist/multipr/migration-heads.d.ts.map +1 -1
  100. package/dist/multipr/migration-heads.js +15 -84
  101. package/dist/multipr/migration-heads.js.map +1 -1
  102. package/dist/multipr/overlap.d.ts +16 -94
  103. package/dist/multipr/overlap.d.ts.map +1 -1
  104. package/dist/multipr/overlap.js +25 -105
  105. package/dist/multipr/overlap.js.map +1 -1
  106. package/dist/multipr/scope-store.d.ts +15 -80
  107. package/dist/multipr/scope-store.d.ts.map +1 -1
  108. package/dist/multipr/scope-store.js +17 -87
  109. package/dist/multipr/scope-store.js.map +1 -1
  110. package/dist/multipr/superseded.d.ts +10 -95
  111. package/dist/multipr/superseded.d.ts.map +1 -1
  112. package/dist/multipr/superseded.js +7 -60
  113. package/dist/multipr/superseded.js.map +1 -1
  114. package/dist/query/confirmed-facts.d.ts +12 -58
  115. package/dist/query/confirmed-facts.d.ts.map +1 -1
  116. package/dist/query/confirmed-facts.js +8 -47
  117. package/dist/query/confirmed-facts.js.map +1 -1
  118. package/dist/query/declared-value-closure.d.ts +13 -104
  119. package/dist/query/declared-value-closure.d.ts.map +1 -1
  120. package/dist/query/declared-value-closure.js +15 -104
  121. package/dist/query/declared-value-closure.js.map +1 -1
  122. package/dist/query/memory.d.ts +5 -9
  123. package/dist/query/memory.d.ts.map +1 -1
  124. package/dist/query/memory.js +31 -15
  125. package/dist/query/memory.js.map +1 -1
  126. package/dist/query/prominence.d.ts +6 -55
  127. package/dist/query/prominence.d.ts.map +1 -1
  128. package/dist/query/prominence.js +6 -55
  129. package/dist/query/prominence.js.map +1 -1
  130. package/dist/query/provider.d.ts +28 -81
  131. package/dist/query/provider.d.ts.map +1 -1
  132. package/dist/query/provider.js +8 -29
  133. package/dist/query/provider.js.map +1 -1
  134. package/dist/query/queries.d.ts +15 -65
  135. package/dist/query/queries.d.ts.map +1 -1
  136. package/dist/query/queries.js +43 -100
  137. package/dist/query/queries.js.map +1 -1
  138. package/dist/query/refusal-fetch.d.ts +8 -85
  139. package/dist/query/refusal-fetch.d.ts.map +1 -1
  140. package/dist/query/refusal-fetch.js +11 -93
  141. package/dist/query/refusal-fetch.js.map +1 -1
  142. package/dist/query/refusal-questions.d.ts +17 -92
  143. package/dist/query/refusal-questions.d.ts.map +1 -1
  144. package/dist/query/refusal-questions.js +14 -78
  145. package/dist/query/refusal-questions.js.map +1 -1
  146. package/dist/query/resolution-floor.d.ts +3 -23
  147. package/dist/query/resolution-floor.d.ts.map +1 -1
  148. package/dist/query/resolution-floor.js +3 -23
  149. package/dist/query/resolution-floor.js.map +1 -1
  150. package/dist/query/root-cause-score.d.ts +11 -161
  151. package/dist/query/root-cause-score.d.ts.map +1 -1
  152. package/dist/query/root-cause-score.js +6 -137
  153. package/dist/query/root-cause-score.js.map +1 -1
  154. package/dist/query/row-closure-picture.d.ts +5 -67
  155. package/dist/query/row-closure-picture.d.ts.map +1 -1
  156. package/dist/query/row-closure-picture.js +6 -67
  157. package/dist/query/row-closure-picture.js.map +1 -1
  158. package/dist/query/similar-incidents.d.ts +6 -41
  159. package/dist/query/similar-incidents.d.ts.map +1 -1
  160. package/dist/query/similar-incidents.js +15 -69
  161. package/dist/query/similar-incidents.js.map +1 -1
  162. package/dist/query/sqlite.d.ts +3 -7
  163. package/dist/query/sqlite.d.ts.map +1 -1
  164. package/dist/query/sqlite.js +13 -16
  165. package/dist/query/sqlite.js.map +1 -1
  166. package/dist/query/test-coverage.d.ts +5 -45
  167. package/dist/query/test-coverage.d.ts.map +1 -1
  168. package/dist/query/test-coverage.js +10 -53
  169. package/dist/query/test-coverage.js.map +1 -1
  170. package/dist/query/traverse.d.ts +22 -126
  171. package/dist/query/traverse.d.ts.map +1 -1
  172. package/dist/query/traverse.js +0 -0
  173. package/dist/query/traverse.js.map +1 -1
  174. package/dist/query/unresolved.d.ts +19 -164
  175. package/dist/query/unresolved.d.ts.map +1 -1
  176. package/dist/query/unresolved.js +11 -138
  177. package/dist/query/unresolved.js.map +1 -1
  178. package/dist/query/verification-status.d.ts +12 -109
  179. package/dist/query/verification-status.d.ts.map +1 -1
  180. package/dist/query/verification-status.js +9 -99
  181. package/dist/query/verification-status.js.map +1 -1
  182. package/dist/recording/migrate.d.ts +4 -10
  183. package/dist/recording/migrate.d.ts.map +1 -1
  184. package/dist/recording/migrate.js +4 -10
  185. package/dist/recording/migrate.js.map +1 -1
  186. package/dist/recording/reader.d.ts +2 -7
  187. package/dist/recording/reader.d.ts.map +1 -1
  188. package/dist/recording/reader.js +2 -7
  189. package/dist/recording/reader.js.map +1 -1
  190. package/dist/recording/redact.d.ts +6 -57
  191. package/dist/recording/redact.d.ts.map +1 -1
  192. package/dist/recording/redact.js +8 -64
  193. package/dist/recording/redact.js.map +1 -1
  194. package/dist/recording/schema.d.ts +3 -38
  195. package/dist/recording/schema.d.ts.map +1 -1
  196. package/dist/recording/schema.js +3 -38
  197. package/dist/recording/schema.js.map +1 -1
  198. package/dist/recording/writer.d.ts +11 -74
  199. package/dist/recording/writer.d.ts.map +1 -1
  200. package/dist/recording/writer.js +3 -43
  201. package/dist/recording/writer.js.map +1 -1
  202. package/dist/scoping/fanout.d.ts +6 -68
  203. package/dist/scoping/fanout.d.ts.map +1 -1
  204. package/dist/scoping/fanout.js +6 -68
  205. package/dist/scoping/fanout.js.map +1 -1
  206. package/dist/scoping/score.d.ts +20 -70
  207. package/dist/scoping/score.d.ts.map +1 -1
  208. package/dist/scoping/score.js +20 -70
  209. package/dist/scoping/score.js.map +1 -1
  210. package/dist/scoping/tiers.d.ts +4 -16
  211. package/dist/scoping/tiers.d.ts.map +1 -1
  212. package/dist/scoping/tiers.js +4 -16
  213. package/dist/scoping/tiers.js.map +1 -1
  214. package/dist/scoping/traverse.d.ts +3 -25
  215. package/dist/scoping/traverse.d.ts.map +1 -1
  216. package/dist/scoping/traverse.js +14 -49
  217. package/dist/scoping/traverse.js.map +1 -1
  218. package/dist/scoping/weights.d.ts +10 -74
  219. package/dist/scoping/weights.d.ts.map +1 -1
  220. package/dist/scoping/weights.js +14 -86
  221. package/dist/scoping/weights.js.map +1 -1
  222. package/dist/sources/confirmed/incidents.d.ts +5 -35
  223. package/dist/sources/confirmed/incidents.d.ts.map +1 -1
  224. package/dist/sources/confirmed/incidents.js +14 -48
  225. package/dist/sources/confirmed/incidents.js.map +1 -1
  226. package/dist/sources/git/diff.d.ts +71 -65
  227. package/dist/sources/git/diff.d.ts.map +1 -1
  228. package/dist/sources/git/diff.js +136 -83
  229. package/dist/sources/git/diff.js.map +1 -1
  230. package/dist/sources/git/env.d.ts +7 -0
  231. package/dist/sources/git/env.d.ts.map +1 -1
  232. package/dist/sources/git/env.js +10 -11
  233. package/dist/sources/git/env.js.map +1 -1
  234. package/dist/sources/git/history.d.ts +64 -84
  235. package/dist/sources/git/history.d.ts.map +1 -1
  236. package/dist/sources/git/history.js +141 -112
  237. package/dist/sources/git/history.js.map +1 -1
  238. package/dist/sources/git/incidents.d.ts +13 -75
  239. package/dist/sources/git/incidents.d.ts.map +1 -1
  240. package/dist/sources/git/incidents.js +21 -91
  241. package/dist/sources/git/incidents.js.map +1 -1
  242. package/dist/sources/git/index.d.ts +5 -3
  243. package/dist/sources/git/index.d.ts.map +1 -1
  244. package/dist/sources/git/index.js +3 -2
  245. package/dist/sources/git/index.js.map +1 -1
  246. package/dist/sources/git/source.d.ts +9 -79
  247. package/dist/sources/git/source.d.ts.map +1 -1
  248. package/dist/sources/git/source.js +0 -0
  249. package/dist/sources/git/source.js.map +1 -1
  250. package/dist/sources/migrations/across-change.d.ts +94 -0
  251. package/dist/sources/migrations/across-change.d.ts.map +1 -0
  252. package/dist/sources/migrations/across-change.js +278 -0
  253. package/dist/sources/migrations/across-change.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +20 -36
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -1
  256. package/dist/sources/migrations/dialects.js +11 -36
  257. package/dist/sources/migrations/dialects.js.map +1 -1
  258. package/dist/sources/migrations/index.d.ts +3 -1
  259. package/dist/sources/migrations/index.d.ts.map +1 -1
  260. package/dist/sources/migrations/index.js +2 -1
  261. package/dist/sources/migrations/index.js.map +1 -1
  262. package/dist/sources/migrations/read.d.ts +14 -79
  263. package/dist/sources/migrations/read.d.ts.map +1 -1
  264. package/dist/sources/migrations/read.js +14 -89
  265. package/dist/sources/migrations/read.js.map +1 -1
  266. package/dist/sources/workspace/workspace.d.ts +6 -42
  267. package/dist/sources/workspace/workspace.d.ts.map +1 -1
  268. package/dist/sources/workspace/workspace.js +10 -53
  269. package/dist/sources/workspace/workspace.js.map +1 -1
  270. package/dist/store/driver/driver.d.ts +9 -38
  271. package/dist/store/driver/driver.d.ts.map +1 -1
  272. package/dist/store/driver/driver.js +4 -22
  273. package/dist/store/driver/driver.js.map +1 -1
  274. package/dist/store/driver/node-sqlite.d.ts +3 -12
  275. package/dist/store/driver/node-sqlite.d.ts.map +1 -1
  276. package/dist/store/driver/node-sqlite.js +4 -18
  277. package/dist/store/driver/node-sqlite.js.map +1 -1
  278. package/dist/store/index.d.ts +2 -7
  279. package/dist/store/index.d.ts.map +1 -1
  280. package/dist/store/index.js +4 -10
  281. package/dist/store/index.js.map +1 -1
  282. package/dist/store/migrate.d.ts +14 -50
  283. package/dist/store/migrate.d.ts.map +1 -1
  284. package/dist/store/migrate.js +15 -52
  285. package/dist/store/migrate.js.map +1 -1
  286. package/dist/store/reader.d.ts +19 -84
  287. package/dist/store/reader.d.ts.map +1 -1
  288. package/dist/store/reader.js +25 -92
  289. package/dist/store/reader.js.map +1 -1
  290. package/dist/store/schema.d.ts +14 -76
  291. package/dist/store/schema.d.ts.map +1 -1
  292. package/dist/store/schema.js +14 -76
  293. package/dist/store/schema.js.map +1 -1
  294. package/dist/store/writer.d.ts +14 -88
  295. package/dist/store/writer.d.ts.map +1 -1
  296. package/dist/store/writer.js +29 -123
  297. package/dist/store/writer.js.map +1 -1
  298. package/dist/tiers/certify.d.ts +46 -281
  299. package/dist/tiers/certify.d.ts.map +1 -1
  300. package/dist/tiers/certify.js +46 -226
  301. package/dist/tiers/certify.js.map +1 -1
  302. package/dist/tiers/ladder.d.ts +7 -51
  303. package/dist/tiers/ladder.d.ts.map +1 -1
  304. package/dist/tiers/ladder.js +13 -89
  305. package/dist/tiers/ladder.js.map +1 -1
  306. package/dist/validation/attributes.d.ts +47 -0
  307. package/dist/validation/attributes.d.ts.map +1 -0
  308. package/dist/validation/attributes.js +130 -0
  309. package/dist/validation/attributes.js.map +1 -0
  310. package/dist/validation/config-graph.d.ts +7 -56
  311. package/dist/validation/config-graph.d.ts.map +1 -1
  312. package/dist/validation/config-graph.js +15 -61
  313. package/dist/validation/config-graph.js.map +1 -1
  314. package/dist/validation/env.d.ts +53 -2
  315. package/dist/validation/env.d.ts.map +1 -1
  316. package/dist/validation/env.js +99 -4
  317. package/dist/validation/env.js.map +1 -1
  318. package/dist/validation/index.d.ts +5 -1
  319. package/dist/validation/index.d.ts.map +1 -1
  320. package/dist/validation/index.js +3 -1
  321. package/dist/validation/index.js.map +1 -1
  322. package/dist/validation/join-substitution.d.ts +22 -120
  323. package/dist/validation/join-substitution.d.ts.map +1 -1
  324. package/dist/validation/join-substitution.js +13 -90
  325. package/dist/validation/join-substitution.js.map +1 -1
  326. package/dist/validation/migration-integrity.d.ts +72 -0
  327. package/dist/validation/migration-integrity.d.ts.map +1 -0
  328. package/dist/validation/migration-integrity.js +238 -0
  329. package/dist/validation/migration-integrity.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +23 -88
  331. package/dist/validation/migrations.d.ts.map +1 -1
  332. package/dist/validation/migrations.js +20 -79
  333. package/dist/validation/migrations.js.map +1 -1
  334. package/dist/validation/nodes.d.ts +3 -1
  335. package/dist/validation/nodes.d.ts.map +1 -1
  336. package/dist/validation/nodes.js +3 -1
  337. package/dist/validation/nodes.js.map +1 -1
  338. package/dist/validation/rollback.d.ts +10 -73
  339. package/dist/validation/rollback.d.ts.map +1 -1
  340. package/dist/validation/rollback.js +23 -81
  341. package/dist/validation/rollback.js.map +1 -1
  342. package/dist/validation/route-drift.d.ts +9 -62
  343. package/dist/validation/route-drift.d.ts.map +1 -1
  344. package/dist/validation/route-drift.js +7 -52
  345. package/dist/validation/route-drift.js.map +1 -1
  346. package/dist/validation/sources.d.ts +16 -94
  347. package/dist/validation/sources.d.ts.map +1 -1
  348. package/dist/validation/sources.js +51 -147
  349. package/dist/validation/sources.js.map +1 -1
  350. package/dist/worker/pool.d.ts +6 -45
  351. package/dist/worker/pool.d.ts.map +1 -1
  352. package/dist/worker/pool.js +5 -42
  353. package/dist/worker/pool.js.map +1 -1
  354. package/dist/worker/protocol.d.ts +7 -20
  355. package/dist/worker/protocol.d.ts.map +1 -1
  356. package/dist/worker/protocol.js +3 -10
  357. package/dist/worker/protocol.js.map +1 -1
  358. package/dist/worker/traversal.worker.d.ts +2 -21
  359. package/dist/worker/traversal.worker.d.ts.map +1 -1
  360. package/dist/worker/traversal.worker.js +4 -23
  361. package/dist/worker/traversal.worker.js.map +1 -1
  362. package/package.json +11 -2
@@ -1,65 +1,11 @@
1
1
  /**
2
- * Scoring configuration for diff scoping — §12.4.
3
- *
4
- * ## The one number in the architecture that cannot be used as written
5
- *
6
- * §12.3's worked example decays a `CALLS` edge by **×1.0** on its first hop and
7
- * by **×0.95** on its third. The 0.95 is the usable one; 1.0 is not, for two
8
- * independent reasons:
9
- *
10
- * 1. **It breaks the premise of the whole engine.** §12.2 argues that hop count
11
- * is a poor proxy for importance and that expansion must stop on *score*. An
12
- * edge weight of 1.0 means a `CALLS` chain never decays — every node reachable
13
- * by calls scores exactly 1.0 forever, so the stopping rule degenerates into
14
- * "stop when the budget runs out", which is hop-count scoping wearing a
15
- * different name.
16
- * 2. **It does not terminate.** With `EdgeConfidence` at 1.0 for an R3 edge, the
17
- * hop factor is exactly 1.0, and on a `CALLS` cycle the traversal never ends.
18
- * DEC-028 requires the factor to be strictly inside (0, 1).
19
- *
20
- * The defaults below therefore use 0.95, and §12.3's stated outcome still holds:
21
- * the payment gateway three hops out survives and `logger.ts` two hops out is
22
- * dropped. That test discriminates on the *shape* of the decay, not on whether
23
- * the first hop was 1.00 or 0.95.
24
- *
25
- * ## Three parts of the architecture cannot all be true — and the resolution
26
- *
27
- * Writing this file surfaced a genuine inconsistency between §12.3, §12.4 and
28
- * §12.7. Any two can hold; all three cannot.
29
- *
30
- * - **§12.3** needs *high* weights. Its worked example decays `CALLS` and
31
- * `PROPAGATES_TO` at ~0.95 so a three-hop chain still scores 0.90.
32
- * - **§12.7** tiers on *absolute* thresholds — tier 2 above 0.7, tier 4 below
33
- * 0.3 — which are only meaningful if a few hops of a strong edge stay high.
34
- * Scale the weights down for headroom and the payment gateway §12.3 calls
35
- * critical lands in tier 4, "dropped under budget pressure".
36
- * - **§12.4** multiplies by `ChangeCouplingFactor` and
37
- * `IncidentCorrelationFactor` *at every hop*, and both are boosts above 1.0.
38
- * A weight of 0.95 with any coupling above 1.053 makes the hop factor exceed
39
- * 1.0, at which point the score stops decaying and a cycle never terminates.
40
- *
41
- * **Resolution: the history factors adjust a node's score once, they do not
42
- * compound per hop.** Path decay is the product of `edgeWeight × confidence`
43
- * over the hops, strictly below 1 at every step, so termination is structural.
44
- * Coupling and incident are then applied to the node's final score.
45
- *
46
- * This keeps §12.3's numbers exactly, keeps §12.7's thresholds meaningful, and
47
- * keeps §12.4's terms doing the work they were introduced for. It is also more
48
- * defensible than the literal formula: compounding a node's incident history at
49
- * every hop of a path that merely *passes through* it counts the same evidence
50
- * repeatedly, which the multiplicative form does silently. See DEC-037.
2
+ * Diff-scoping weights (§12.4). §12.3's worked example uses ×1.0 for a CALLS hop, which is unusable: it never decays and doesn't terminate on a cycle. DEC-028 requires the edge factor strictly inside (0, 1); defaults use 0.95.
3
+ * §12.3 (high weights), §12.7 (absolute tier thresholds) and §12.4 (per-hop coupling/incident boosts) can't all hold at once — resolved by applying coupling/incident once to a node's final score, not per hop, so path decay stays structurally below 1 and terminates (DEC-037).
51
4
  */
52
5
  import { EDGE_TYPES } from "@descryy/ir";
53
6
  import { DEFAULT_FANOUT_BUCKETS, maxAttenuation } from "./fanout.js";
54
- /**
55
- * Default weights.
56
- *
57
- * **Tuning, not architecture.** §12 is marked `DECIDED, TUNING OPEN` and §32
58
- * items 1 and 4 list edge weights as values to set from real traversal data.
59
- * These are starting points chosen to reproduce §12.3's example, and the three
60
- * that matter are the ones that example names: `CALLS`, `PROPAGATES_TO` and
61
- * `IMPORTS`.
62
- */
7
+ /** Default weights — tuning, not architecture (§12 `DECIDED, TUNING OPEN`, §32
8
+ * items 1/4). Starting points chosen to reproduce §12.3's example. */
63
9
  export const DEFAULT_EDGE_WEIGHTS = {
64
10
  // Structural: a change here really does reach the other side.
65
11
  CALLS: 0.95,
@@ -69,21 +15,15 @@ export const DEFAULT_EDGE_WEIGHTS = {
69
15
  RETURNS: 0.85,
70
16
  WRITES: 0.8,
71
17
  READS: 0.75,
72
- // A shape dependency is structural and real — change the type and the
73
- // declaration that embeds it may stop compiling — but it is weaker than a
74
- // call: the dependant names the type, it does not execute anything. Placed
75
- // between READS and IMPLEMENTS, and provisional like every other value here.
18
+ // Shape dependency: structural but weaker than a call (names the type, doesn't execute it).
76
19
  USES_TYPE: 0.7,
77
20
  IMPLEMENTS: 0.7,
78
21
  INHERITS: 0.7,
79
- // §12.3's example: an import is a weak signal and must decay fast, or
80
- // `logger.ts` survives and the engine reports noise as impact.
22
+ // §12.3's example: must decay fast or `logger.ts` survives as noise.
81
23
  IMPORTS: 0.4,
82
- // Tests are reached deliberately by the test-discovery query rather than by
83
- // impact decay, so this only needs to be non-zero.
24
+ // Reached deliberately by test-discovery, not impact decay — just needs non-zero.
84
25
  TESTS: 0.5,
85
- // History, not structure. Everything from the git source is R0 and capped at
86
- // 0.5 confidence already (DEC-019); a low weight keeps it as a hint.
26
+ // History not structure; R0, already capped at 0.5 confidence (DEC-019) — low weight keeps it a hint.
87
27
  CHANGES_WITH: 0.35,
88
28
  INCIDENT_CORRELATED: 0.3,
89
29
  FIXED_BY: 0.3,
@@ -94,21 +34,14 @@ export const DEFAULT_SCOPING_CONFIG = {
94
34
  maxCouplingFactor: 1.3,
95
35
  maxIncidentFactor: 1.2,
96
36
  maxScore: 1,
97
- // §12.3's example drops `logger.ts` at 0.16 and keeps `utils.ts` at 0.40, so
98
- // the prune point sits between them. Above it, §12.7's tier 4 (below 0.3) is
99
- // kept but is the first thing budget pressure discards.
37
+ // Between §12.3's dropped logger.ts (0.16) and kept utils.ts (0.40).
100
38
  threshold: 0.2,
101
39
  };
102
40
  export class ScopingConfigError extends Error {
103
41
  name = "ScopingConfigError";
104
42
  }
105
- /**
106
- * Refuse a configuration that could fail to terminate — DEC-028's config-load half.
107
- *
108
- * The check is per edge type because the failure is: one type's weight, boosted
109
- * to its declared maxima, reaching 1.0. A global average would hide exactly the
110
- * case that matters.
111
- */
43
+ /** Refuses a config that could fail to terminate (DEC-028's config-load half).
44
+ * Checked per edge type — a global average would hide one type reaching 1.0. */
112
45
  export function validateScopingConfig(config) {
113
46
  if (!(config.maxScore > 0) || config.maxScore > 1) {
114
47
  throw new ScopingConfigError(`maxScore must be within (0, 1]; got ${config.maxScore}`);
@@ -120,7 +53,7 @@ export function validateScopingConfig(config) {
120
53
  if (!(config.threshold > 0) || config.threshold >= 1) {
121
54
  throw new ScopingConfigError(`threshold must be within (0, 1); got ${config.threshold}`);
122
55
  }
123
- // DEC-067's table, checked before it can reach the termination assertion.
56
+ // DEC-067's table, checked before the termination assertion.
124
57
  const buckets = config.fanOutBuckets;
125
58
  if (buckets.length === 0) {
126
59
  throw new ScopingConfigError("fanOutBuckets must not be empty; use a single open bucket to disable attenuation");
@@ -140,13 +73,8 @@ export function validateScopingConfig(config) {
140
73
  if (buckets[buckets.length - 1].upTo !== Number.POSITIVE_INFINITY) {
141
74
  throw new ScopingConfigError(`the last fan-out bucket must be open (upTo: Infinity), or a node above ${previous} falls in no bucket`);
142
75
  }
143
- // DEC-028's config-load half, widened by DEC-067. Because history factors no
144
- // longer compound per hop, the requirement is on the weight alone — and
145
- // `maxConfidence` is 1.0 by definition, so a weight of 1.0 is exactly the
146
- // non-terminating case. Attenuation multiplies into the same product, so a
147
- // multiplier above 1.0 would make a weight that decays on its own stop
148
- // decaying in transit. DEC-067 requires this check to widen *before* such a
149
- // value ships, so it is written now while every multiplier is still <= 1.
76
+ // DEC-028's config-load half, widened by DEC-067: weight × maxAttenuation ×
77
+ // maxConfidence(1.0) must stay < 1, since history factors no longer compound per hop.
150
78
  const largest = maxAttenuation(buckets);
151
79
  const offenders = [];
152
80
  for (const type of EDGE_TYPES) {
@@ -1 +1 @@
1
- {"version":3,"file":"weights.js","sourceRoot":"","sources":["../../src/scoping/weights.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAqB,MAAM,aAAa,C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AC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,GAAG,OAAO,IAAI,CAAC,EAAE,CAAC;YAC3C,SAAS,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,CAC1B,wFAAwF;YACtF,mDAAmD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc;YACrF,wFAAwF;YACxF,4CAA4C;YAC5C,wFAAwF;YACxF,iBAAiB,CACpB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,38 +1,8 @@
1
- /**
2
- * The `IRSource` that projects developer-confirmed incidents into the graph.
3
- *
4
- * ## Why a source, and not a direct write
5
- *
6
- * A `ConfirmedIncident` lives in `.descry/config.json` because it is testimony
7
- * — a developer fixed something and said so, and no commit records that they
8
- * said it (see the type's own doc). But a store is derived data: DEC-017 drops
9
- * every derived table on a schema change and rebuilds from source. So a
10
- * confirmed incident written *only* into the graph would survive until the next
11
- * IR-version bump and then vanish, which is the failure the EARNED partition
12
- * exists to prevent — arriving through a writer that simply did not think about
13
- * it.
14
- *
15
- * Making this a source solves it by construction. The file is the record; the
16
- * graph is a projection of the record; every `analyze` re-projects. There is no
17
- * migration to write and no earned table to extend, and the same discipline
18
- * every other producer in this system already follows applies unchanged: a
19
- * batch in, `writeBatch` out, invalidation by producer id.
20
- *
21
- * ## Identity
22
- *
23
- * The `INCIDENT` node keys on `confirmed:<confirmedAt>:<summary>` — the moment
24
- * the developer said it, plus what they said. Deliberately **not** the file set:
25
- * node ids never contain a path (renames churn them and silently destroy
26
- * incident links), and a developer correcting the file list of an incident they
27
- * already recorded is editing one incident rather than creating a second.
28
- *
29
- * ## What it does not do
30
- *
31
- * It mints no `FIX_PATTERN` unless the record names a fixing commit, and it
32
- * never infers one from HEAD. "The developer confirmed an incident" and "the
33
- * developer confirmed which commit fixed it" are separate claims, and only the
34
- * second one licenses a `FIXED_BY` edge.
35
- */
1
+ /** IRSource projecting developer-confirmed incidents (`.descry/config.json`)
2
+ * into the graph. A source, not a direct write: a store is derived data
3
+ * (DEC-017 drops it on schema bump), so a direct write would silently
4
+ * vanish. `INCIDENT` keys on `confirmed:<at>:<summary>`, never the file
5
+ * set (no paths in node ids). Mints `FIX_PATTERN` only when a commit is named — never inferred from HEAD. */
36
6
  import { type ConfirmedIncident, type IdentityScope, type IRSource } from "@descryy/ir";
37
7
  export declare const CONFIRMED_INCIDENT_SOURCE_ID = "confirmed-incidents";
38
8
  export declare const CONFIRMED_INCIDENT_SOURCE_VERSION = "0.1.0";
@@ -1 +1 @@
1
- {"version":3,"file":"incidents.d.ts","sourceRoot":"","sources":["../../../src/sources/confirmed/incidents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAIlB,KAAK,QAAQ,EAEd,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAClE,eAAO,MAAM,iCAAiC,UAAU,CAAC;AAGzD,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAE7F;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,QAAQ,CA0I/F"}
1
+ {"version":3,"file":"incidents.d.ts","sourceRoot":"","sources":["../../../src/sources/confirmed/incidents.ts"],"names":[],"mappings":"AAAA;;;;8GAI8G;AAE9G,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAIlB,KAAK,QAAQ,EAEd,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAClE,eAAO,MAAM,iCAAiC,UAAU,CAAC;AAGzD,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAE7F;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,QAAQ,CAsI/F"}
@@ -1,38 +1,8 @@
1
- /**
2
- * The `IRSource` that projects developer-confirmed incidents into the graph.
3
- *
4
- * ## Why a source, and not a direct write
5
- *
6
- * A `ConfirmedIncident` lives in `.descry/config.json` because it is testimony
7
- * — a developer fixed something and said so, and no commit records that they
8
- * said it (see the type's own doc). But a store is derived data: DEC-017 drops
9
- * every derived table on a schema change and rebuilds from source. So a
10
- * confirmed incident written *only* into the graph would survive until the next
11
- * IR-version bump and then vanish, which is the failure the EARNED partition
12
- * exists to prevent — arriving through a writer that simply did not think about
13
- * it.
14
- *
15
- * Making this a source solves it by construction. The file is the record; the
16
- * graph is a projection of the record; every `analyze` re-projects. There is no
17
- * migration to write and no earned table to extend, and the same discipline
18
- * every other producer in this system already follows applies unchanged: a
19
- * batch in, `writeBatch` out, invalidation by producer id.
20
- *
21
- * ## Identity
22
- *
23
- * The `INCIDENT` node keys on `confirmed:<confirmedAt>:<summary>` — the moment
24
- * the developer said it, plus what they said. Deliberately **not** the file set:
25
- * node ids never contain a path (renames churn them and silently destroy
26
- * incident links), and a developer correcting the file list of an incident they
27
- * already recorded is editing one incident rather than creating a second.
28
- *
29
- * ## What it does not do
30
- *
31
- * It mints no `FIX_PATTERN` unless the record names a fixing commit, and it
32
- * never infers one from HEAD. "The developer confirmed an incident" and "the
33
- * developer confirmed which commit fixed it" are separate claims, and only the
34
- * second one licenses a `FIXED_BY` edge.
35
- */
1
+ /** IRSource projecting developer-confirmed incidents (`.descry/config.json`)
2
+ * into the graph. A source, not a direct write: a store is derived data
3
+ * (DEC-017 drops it on schema bump), so a direct write would silently
4
+ * vanish. `INCIDENT` keys on `confirmed:<at>:<summary>`, never the file
5
+ * set (no paths in node ids). Mints `FIX_PATTERN` only when a commit is named — never inferred from HEAD. */
36
6
  import { fileQsp, nodeId, } from "@descryy/ir";
37
7
  export const CONFIRMED_INCIDENT_SOURCE_ID = "confirmed-incidents";
38
8
  export const CONFIRMED_INCIDENT_SOURCE_VERSION = "0.1.0";
@@ -50,9 +20,8 @@ export function createConfirmedIncidentSource(options) {
50
20
  // INCIDENT and FIX_PATTERN are workspace-scoped (DEC-054), FILE is
51
21
  // repo-scoped, and `scopeOf` picks between them per type.
52
22
  const scope = { repo, workspace: ctx.root.workspace };
53
- // A record for another repository is not this batch's business. The
54
- // structural refusal `applyConfirmedFacts` makes for the same reason:
55
- // never an inference about a second case.
23
+ // A record for another repo is not this batch's business — same
24
+ // structural refusal `applyConfirmedFacts` makes: never infer across cases.
56
25
  const mine = options.incidents.filter((i) => i.repo === repo);
57
26
  const nodes = [];
58
27
  const edges = [];
@@ -69,9 +38,8 @@ export function createConfirmedIncidentSource(options) {
69
38
  name: path.split("/").pop() ?? path,
70
39
  file: path,
71
40
  range: null,
72
- // A developer naming a path says nothing about what language it is
73
- // written in, and guessing from the extension would be a language
74
- // decision made where none may be made (DEC-026).
41
+ // A path says nothing about language; guessing from extension would
42
+ // be a language decision made where none may be made (DEC-026).
75
43
  language: null,
76
44
  producedBy: PRODUCED_BY,
77
45
  resolution: 0,
@@ -90,9 +58,8 @@ export function createConfirmedIncidentSource(options) {
90
58
  producedBy: PRODUCED_BY,
91
59
  resolution: 0,
92
60
  attrs: {
93
- // The record's own shape decides this, never the caller: a run id
94
- // is present exactly when a run witnessed the failure, and absent
95
- // exactly when a person asserted it.
61
+ // The record's own shape decides this: a run id present means a
62
+ // run witnessed it, absent means a person asserted it.
96
63
  detectedVia: incident.observedInRun === undefined ? "developer-confirmed" : "runtime-observed",
97
64
  ...(incident.observedInRun === undefined ? {} : { observedInRun: incident.observedInRun }),
98
65
  confirmedBy: incident.confirmedBy,
@@ -158,10 +125,9 @@ export function createConfirmedIncidentSource(options) {
158
125
  producedBy: PRODUCED_BY,
159
126
  sourceFiles,
160
127
  skippedFiles: [],
161
- // R0. A person's sentence is not a resolution level at all — the
162
- // reliability consequence lives in `humanAsserted` (DEC-223), a second
163
- // and independent ceiling, and slotting testimony into the R0–R4 ladder
164
- // to express it would be the overclaim that ladder exists to prevent.
128
+ // R0: a person's sentence isn't a resolution level. The reliability
129
+ // consequence lives in `humanAsserted` (DEC-223), a separate ceiling —
130
+ // slotting testimony into R0-R4 would be the overclaim the ladder prevents.
165
131
  reachedResolution: 0,
166
132
  nodes,
167
133
  edges,
@@ -1 +1 @@
1
- {"version":3,"file":"incidents.js","sourceRoot":"","sources":["../../../src/sources/confirmed/incidents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,GASP,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AAClE,MAAM,CAAC,MAAM,iCAAiC,GAAG,OAAO,CAAC;AACzD,MAAM,WAAW,GAAG,GAAG,4BAA4B,IAAI,iCAAiC,EAAE,CAAC;AAQ3F,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,KAAoB,EAAE,QAA2B;IACnF,OAAO,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,QAAQ,CAAC,WAAW,IAAI,Q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,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAE7F,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,IAAI;gBACJ,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;gBACxE,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS;gBAC7B,UAAU,EAAE,WAAW;gBACvB,WAAW;gBACX,YAAY,EAAE,EAAE;gBAChB,oEAAoE;gBACpE,uEAAuE;gBACvE,4EAA4E;gBAC5E,iBAAiB,EAAE,CAAC;gBACpB,KAAK;gBACL,KAAK;gBACL,UAAU;aACX,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,48 +1,9 @@
1
1
  /**
2
- * `gitDiff` — a live textual diff between two refs. §18's `get_git_diff`.
3
- *
4
- * `changedFiles` (`history.ts`) already answers "which files changed" — a
5
- * bare path list. This answers "what changed in them" — per-file status and
6
- * line counts always, plus the actual unified-diff patch text when it is
7
- * cheap enough to hand to a model. §4's own worry ("the client's context
8
- * window is not yours to spend") is the reason a patch is never returned
9
- * unconditionally: a single large file rewrite can be tens of thousands of
10
- * tokens, and a caller that wanted only "did this file change and how much"
11
- * pays that cost with no way to decline it. `patchOmittedReason` names why,
12
- * rather than silently shrinking the reply — the empty-denominator rule
13
- * applies to a dropped patch exactly as it does to a dropped finding.
14
- *
15
- * Two size caps here, because one of them bounds nothing on its own:
16
- * `maxPatchBytes` per file, and `maxTotalPatchBytes` across every patch in the
17
- * reply. The second exists because a real 48-file branch diff, with 44 patches
18
- * each *under* the per-file cap, summed to 229KB and hard-failed the call —
19
- * the reply never reached the caller at all, which is the one failure mode a
20
- * disclosure cannot repair after the fact.
21
- *
22
- * And a third above this file, for the same reason one level out: the same
23
- * diff re-run with `maxTotalPatchBytes` correctly enforced still failed, at
24
- * 84,516 characters, because these two caps bound patch text and a reply is
25
- * not only patch text. `MAX_REPLY_BYTES` and `ToolAnswer.fitToBudget` in the
26
- * MCP layer bound the serialized reply itself. Nothing here needs to know
27
- * about that; it is noted because "the aggregate cap is enforced" was once
28
- * mistaken for "the call now succeeds," and they are different claims.
29
- *
30
- * One `git diff` invocation for every file at once, not one per file — a
31
- * PR touching fifty files would otherwise spawn fifty processes. The output
32
- * is a concatenation of per-file blocks, each beginning with a line
33
- * `diff --git a/<path> b/<path>`; parsing splits on that boundary and reads
34
- * the more specific `rename from`/`rename to`/`new file mode`/
35
- * `deleted file mode`/`Binary files … differ`/`---`/`+++` lines within each
36
- * block, which are unambiguous where the `diff --git` header line alone is
37
- * not (a path containing the literal substring `" b/"` defeats that header's
38
- * own regex — an accepted, narrow gap, not a silent one, since every other
39
- * line used here does not share it).
40
- */
41
- /**
42
- * The stable prefix of `patchOmittedReason` when the *total* budget, not the
43
- * per-file cap, is what withheld a patch. Exported so a caller can tell the
44
- * two apart without matching on prose it does not own.
2
+ * §18's `get_git_diff`: live diff, patch text only when cheap — `patchOmittedReason` names why otherwise.
3
+ * Two caps here (`maxPatchBytes` per file, `maxTotalPatchBytes` total) plus a third in the MCP layer
4
+ * (`MAX_REPLY_BYTES`) — measured real failures at 229KB and 84,516 chars before these existed.
45
5
  */
6
+ /** Stable prefix of `patchOmittedReason` when the total budget, not the per-file cap, withheld a patch. */
46
7
  export declare const TOTAL_PATCH_BUDGET_REASON_PREFIX = "the reply's total patch budget";
47
8
  export interface GitDiffFile {
48
9
  /** Path as it is known after the change (the only path for A/M/D). */
@@ -64,35 +25,80 @@ export interface GitDiffOptions {
64
25
  readonly files?: readonly string[];
65
26
  /** A file's patch is omitted (stats are still reported) above this many bytes. Default 20,000. */
66
27
  readonly maxPatchBytes?: number;
67
- /**
68
- * The cap on the sum of all returned patches. Files past it keep their
69
- * stats and name the budget as the reason. Default 40,000.
70
- */
28
+ /** Cap on the sum of all returned patches; files past it keep their stats. Default 40,000. */
71
29
  readonly maxTotalPatchBytes?: number;
72
30
  }
73
- /**
74
- * `base...head` (three dots), matching `changedFiles`'s own reasoning: two
75
- * dots would include everything changed on `base` since the branch point,
76
- * misattributing someone else's history to this diff.
77
- */
31
+ /** `base...head` (three dots) — two dots would include everything changed on `base` since the branch point. */
78
32
  export declare function gitDiff(cwd: string, base: string, head?: string, options?: GitDiffOptions): Promise<readonly GitDiffFile[]>;
79
33
  export interface GitWorkingTreeDiffOptions extends GitDiffOptions {
80
- /**
81
- * `"unstaged"` (default) — the working tree against the index (`git diff -M`),
82
- * i.e. edits not yet `git add`-ed.
83
- * `"staged"` — the index against `HEAD` (`git diff -M --cached`), i.e. what
84
- * a commit right now would contain.
85
- * `"all"` — the working tree against `HEAD` (`git diff -M HEAD`), staged and
86
- * unstaged combined — everything not yet committed.
87
- */
34
+ /** `"unstaged"` (default): tree vs. index. `"staged"`: index vs. HEAD. `"all"`: tree vs. HEAD (both). */
88
35
  readonly scope?: "unstaged" | "staged" | "all";
89
36
  }
90
37
  /**
91
- * The working-tree counterpart to {@link gitDiff}: a live diff against
92
- * uncommitted state, which no two-revision form of `git diff` can express
93
- * (`HEAD...HEAD` is empty by construction). Reuses the exact same block
94
- * parser, rename detection and patch cap `gitDiff` does — see
95
- * `DEC-NEXT-working-tree-diff-in-core` for why a second parser was rejected.
38
+ * Working-tree counterpart to {@link gitDiff}: a live diff against uncommitted state, which no
39
+ * two-revision `git diff` form can express. Reuses the same parser (`DEC-NEXT-working-tree-diff-in-core`).
96
40
  */
97
41
  export declare function gitWorkingTreeDiff(cwd: string, options?: GitWorkingTreeDiffOptions): Promise<readonly GitDiffFile[]>;
42
+ export interface GitWorkingTreeChangeOptions extends GitWorkingTreeDiffOptions {
43
+ /**
44
+ * Include files git has never seen, as new-file patches.
45
+ *
46
+ * **Off by default**, so no existing caller changes behaviour by upgrading,
47
+ * and because it is a different question: the three scopes above all ask
48
+ * about files git already tracks.
49
+ */
50
+ readonly includeUntracked?: boolean;
51
+ /** Cap on untracked files diffed. The real count is reported regardless. */
52
+ readonly maxUntracked?: number;
53
+ /**
54
+ * Directory prefixes whose contents are not the change under review.
55
+ *
56
+ * The same argument as `--exclude-standard`, for state a `.gitignore` does not
57
+ * happen to cover. Descry writes its own graph database inside the repository
58
+ * and nothing gitignores it, so the first working-tree answer on a fresh
59
+ * checkout listed that database and its two SQLite sidecars as the
60
+ * developer's uncommitted change — three files they did not write, at the top
61
+ * of an answer about what they did.
62
+ *
63
+ * Matched as a path prefix at a segment boundary, so `.descry` excludes
64
+ * `.descry/graph.db` and not `src/.descryfile.ts`.
65
+ */
66
+ readonly exclude?: readonly string[];
67
+ }
68
+ export interface GitWorkingTreeChange {
69
+ readonly files: readonly GitDiffFile[];
70
+ /** Untracked files found, before any cap. */
71
+ readonly untrackedTotal: number;
72
+ /** True when the cap kept some of them out of `files`. */
73
+ readonly untrackedTruncated: boolean;
74
+ }
75
+ /**
76
+ * The working tree as a change set, including files git has never seen.
77
+ *
78
+ * ## Why untracked needs its own mechanism
79
+ *
80
+ * No form of `git diff` reports an untracked file. `git diff HEAD` compares
81
+ * against what the index and `HEAD` hold, and a file git has never seen is in
82
+ * neither — so a working-tree mode built on the scopes above alone still misses
83
+ * the most common shape of work in progress: a new file, written, not yet
84
+ * added. That is exactly the case this was built for.
85
+ *
86
+ * ## `--no-index` rather than `add -N`
87
+ *
88
+ * The usual trick is `git add -N` to give the file an intent-to-add entry, then
89
+ * diff normally. **It writes to the index**, and a read tool that mutates the
90
+ * caller's repository to answer a question is not a read tool — it would also
91
+ * race any real `git add` the developer runs while it works.
92
+ *
93
+ * `git diff --no-index -- /dev/null <path>` needs no index and emits exactly the
94
+ * `new file mode` block the shared parser already handles, with the real path.
95
+ * It exits non-zero when the files differ, which for this call is always, so a
96
+ * non-zero exit here is the success case and is read for its stdout.
97
+ *
98
+ * ## `--exclude-standard` is load-bearing
99
+ *
100
+ * Without it the first answer on any real repository is a dependency directory
101
+ * reported as the developer's uncommitted work.
102
+ */
103
+ export declare function gitWorkingTreeChange(cwd: string, options?: GitWorkingTreeChangeOptions): Promise<GitWorkingTreeChange>;
98
104
  //# sourceMappingURL=diff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/sources/git/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AA2CH;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,mCAAmC,CAAC;AAEjF,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,kGAAkG;IAClG,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,CAA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