@afaik-lab/weigh 0.0.0-stage → 0.6.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 (349) hide show
  1. package/.env.example +49 -0
  2. package/LICENSE +373 -0
  3. package/README.md +102 -2
  4. package/dist/agent.d.ts +83 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +204 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/ceilings.d.ts +32 -0
  9. package/dist/ceilings.d.ts.map +1 -0
  10. package/dist/ceilings.js +61 -0
  11. package/dist/ceilings.js.map +1 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +530 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/config-cli.d.ts +15 -0
  17. package/dist/config-cli.d.ts.map +1 -0
  18. package/dist/config-cli.js +132 -0
  19. package/dist/config-cli.js.map +1 -0
  20. package/dist/config.d.ts +198 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +373 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/context-cli.d.ts +35 -0
  25. package/dist/context-cli.d.ts.map +1 -0
  26. package/dist/context-cli.js +251 -0
  27. package/dist/context-cli.js.map +1 -0
  28. package/dist/context.d.ts +118 -0
  29. package/dist/context.d.ts.map +1 -0
  30. package/dist/context.js +159 -0
  31. package/dist/context.js.map +1 -0
  32. package/dist/corrections/correction-set.d.ts +67 -0
  33. package/dist/corrections/correction-set.d.ts.map +1 -0
  34. package/dist/corrections/correction-set.js +104 -0
  35. package/dist/corrections/correction-set.js.map +1 -0
  36. package/dist/corrections/correction.d.ts +74 -0
  37. package/dist/corrections/correction.d.ts.map +1 -0
  38. package/dist/corrections/correction.js +154 -0
  39. package/dist/corrections/correction.js.map +1 -0
  40. package/dist/corrections/follow-up.d.ts +69 -0
  41. package/dist/corrections/follow-up.d.ts.map +1 -0
  42. package/dist/corrections/follow-up.js +217 -0
  43. package/dist/corrections/follow-up.js.map +1 -0
  44. package/dist/corrections/index.d.ts +31 -0
  45. package/dist/corrections/index.d.ts.map +1 -0
  46. package/dist/corrections/index.js +31 -0
  47. package/dist/corrections/index.js.map +1 -0
  48. package/dist/corrections/ledger.d.ts +78 -0
  49. package/dist/corrections/ledger.d.ts.map +1 -0
  50. package/dist/corrections/ledger.js +117 -0
  51. package/dist/corrections/ledger.js.map +1 -0
  52. package/dist/corrections/promotion.d.ts +119 -0
  53. package/dist/corrections/promotion.d.ts.map +1 -0
  54. package/dist/corrections/promotion.js +221 -0
  55. package/dist/corrections/promotion.js.map +1 -0
  56. package/dist/corrections/schema.d.ts +125 -0
  57. package/dist/corrections/schema.d.ts.map +1 -0
  58. package/dist/corrections/schema.js +100 -0
  59. package/dist/corrections/schema.js.map +1 -0
  60. package/dist/corrections-cli.d.ts +28 -0
  61. package/dist/corrections-cli.d.ts.map +1 -0
  62. package/dist/corrections-cli.js +157 -0
  63. package/dist/corrections-cli.js.map +1 -0
  64. package/dist/diff.d.ts +105 -0
  65. package/dist/diff.d.ts.map +1 -0
  66. package/dist/diff.js +202 -0
  67. package/dist/diff.js.map +1 -0
  68. package/dist/doctor.d.ts +38 -0
  69. package/dist/doctor.d.ts.map +1 -0
  70. package/dist/doctor.js +197 -0
  71. package/dist/doctor.js.map +1 -0
  72. package/dist/events.d.ts +21 -0
  73. package/dist/events.d.ts.map +1 -0
  74. package/dist/events.js +5 -0
  75. package/dist/events.js.map +1 -0
  76. package/dist/findings.d.ts +510 -0
  77. package/dist/findings.d.ts.map +1 -0
  78. package/dist/findings.js +645 -0
  79. package/dist/findings.js.map +1 -0
  80. package/dist/follow-up-cli.d.ts +88 -0
  81. package/dist/follow-up-cli.d.ts.map +1 -0
  82. package/dist/follow-up-cli.js +208 -0
  83. package/dist/follow-up-cli.js.map +1 -0
  84. package/dist/harness.d.ts +64 -0
  85. package/dist/harness.d.ts.map +1 -0
  86. package/dist/harness.js +71 -0
  87. package/dist/harness.js.map +1 -0
  88. package/dist/help/command-help.d.ts +9 -0
  89. package/dist/help/command-help.d.ts.map +1 -0
  90. package/dist/help/command-help.js +21 -0
  91. package/dist/help/command-help.js.map +1 -0
  92. package/dist/help/commands/answer.d.ts +3 -0
  93. package/dist/help/commands/answer.d.ts.map +1 -0
  94. package/dist/help/commands/answer.js +39 -0
  95. package/dist/help/commands/answer.js.map +1 -0
  96. package/dist/help/commands/config.d.ts +3 -0
  97. package/dist/help/commands/config.d.ts.map +1 -0
  98. package/dist/help/commands/config.js +25 -0
  99. package/dist/help/commands/config.js.map +1 -0
  100. package/dist/help/commands/context.d.ts +3 -0
  101. package/dist/help/commands/context.d.ts.map +1 -0
  102. package/dist/help/commands/context.js +44 -0
  103. package/dist/help/commands/context.js.map +1 -0
  104. package/dist/help/commands/corrections.d.ts +3 -0
  105. package/dist/help/commands/corrections.d.ts.map +1 -0
  106. package/dist/help/commands/corrections.js +30 -0
  107. package/dist/help/commands/corrections.js.map +1 -0
  108. package/dist/help/commands/doctor.d.ts +3 -0
  109. package/dist/help/commands/doctor.d.ts.map +1 -0
  110. package/dist/help/commands/doctor.js +12 -0
  111. package/dist/help/commands/doctor.js.map +1 -0
  112. package/dist/help/commands/index.d.ts +4 -0
  113. package/dist/help/commands/index.d.ts.map +1 -0
  114. package/dist/help/commands/index.js +27 -0
  115. package/dist/help/commands/index.js.map +1 -0
  116. package/dist/help/commands/memory.d.ts +3 -0
  117. package/dist/help/commands/memory.d.ts.map +1 -0
  118. package/dist/help/commands/memory.js +33 -0
  119. package/dist/help/commands/memory.js.map +1 -0
  120. package/dist/help/commands/models.d.ts +3 -0
  121. package/dist/help/commands/models.d.ts.map +1 -0
  122. package/dist/help/commands/models.js +17 -0
  123. package/dist/help/commands/models.js.map +1 -0
  124. package/dist/help/commands/options.d.ts +4 -0
  125. package/dist/help/commands/options.d.ts.map +1 -0
  126. package/dist/help/commands/options.js +13 -0
  127. package/dist/help/commands/options.js.map +1 -0
  128. package/dist/help/commands/review.d.ts +3 -0
  129. package/dist/help/commands/review.d.ts.map +1 -0
  130. package/dist/help/commands/review.js +50 -0
  131. package/dist/help/commands/review.js.map +1 -0
  132. package/dist/help/commands/sessions.d.ts +3 -0
  133. package/dist/help/commands/sessions.d.ts.map +1 -0
  134. package/dist/help/commands/sessions.js +23 -0
  135. package/dist/help/commands/sessions.js.map +1 -0
  136. package/dist/help/commands/show.d.ts +3 -0
  137. package/dist/help/commands/show.d.ts.map +1 -0
  138. package/dist/help/commands/show.js +18 -0
  139. package/dist/help/commands/show.js.map +1 -0
  140. package/dist/help/help.d.ts +16 -0
  141. package/dist/help/help.d.ts.map +1 -0
  142. package/dist/help/help.js +68 -0
  143. package/dist/help/help.js.map +1 -0
  144. package/dist/help/index.d.ts +4 -0
  145. package/dist/help/index.d.ts.map +1 -0
  146. package/dist/help/index.js +7 -0
  147. package/dist/help/index.js.map +1 -0
  148. package/dist/index.d.ts +80 -0
  149. package/dist/index.d.ts.map +1 -0
  150. package/dist/index.js +51 -0
  151. package/dist/index.js.map +1 -0
  152. package/dist/knowledge/block.d.ts +65 -0
  153. package/dist/knowledge/block.d.ts.map +1 -0
  154. package/dist/knowledge/block.js +89 -0
  155. package/dist/knowledge/block.js.map +1 -0
  156. package/dist/knowledge/claim.d.ts +143 -0
  157. package/dist/knowledge/claim.d.ts.map +1 -0
  158. package/dist/knowledge/claim.js +297 -0
  159. package/dist/knowledge/claim.js.map +1 -0
  160. package/dist/knowledge/index.d.ts +32 -0
  161. package/dist/knowledge/index.d.ts.map +1 -0
  162. package/dist/knowledge/index.js +29 -0
  163. package/dist/knowledge/index.js.map +1 -0
  164. package/dist/knowledge/novelty.d.ts +65 -0
  165. package/dist/knowledge/novelty.d.ts.map +1 -0
  166. package/dist/knowledge/novelty.js +94 -0
  167. package/dist/knowledge/novelty.js.map +1 -0
  168. package/dist/knowledge/recall.d.ts +134 -0
  169. package/dist/knowledge/recall.d.ts.map +1 -0
  170. package/dist/knowledge/recall.js +229 -0
  171. package/dist/knowledge/recall.js.map +1 -0
  172. package/dist/knowledge/recalled-claim.d.ts +35 -0
  173. package/dist/knowledge/recalled-claim.d.ts.map +1 -0
  174. package/dist/knowledge/recalled-claim.js +67 -0
  175. package/dist/knowledge/recalled-claim.js.map +1 -0
  176. package/dist/knowledge/recalled.d.ts +70 -0
  177. package/dist/knowledge/recalled.d.ts.map +1 -0
  178. package/dist/knowledge/recalled.js +149 -0
  179. package/dist/knowledge/recalled.js.map +1 -0
  180. package/dist/knowledge/schema.d.ts +83 -0
  181. package/dist/knowledge/schema.d.ts.map +1 -0
  182. package/dist/knowledge/schema.js +96 -0
  183. package/dist/knowledge/schema.js.map +1 -0
  184. package/dist/knowledge/staleness.d.ts +48 -0
  185. package/dist/knowledge/staleness.d.ts.map +1 -0
  186. package/dist/knowledge/staleness.js +85 -0
  187. package/dist/knowledge/staleness.js.map +1 -0
  188. package/dist/knowledge/store.d.ts +100 -0
  189. package/dist/knowledge/store.d.ts.map +1 -0
  190. package/dist/knowledge/store.js +184 -0
  191. package/dist/knowledge/store.js.map +1 -0
  192. package/dist/memory/compose-file.d.ts +14 -0
  193. package/dist/memory/compose-file.d.ts.map +1 -0
  194. package/dist/memory/compose-file.js +25 -0
  195. package/dist/memory/compose-file.js.map +1 -0
  196. package/dist/memory/index.d.ts +43 -0
  197. package/dist/memory/index.d.ts.map +1 -0
  198. package/dist/memory/index.js +119 -0
  199. package/dist/memory/index.js.map +1 -0
  200. package/dist/memory/oss.d.ts +62 -0
  201. package/dist/memory/oss.d.ts.map +1 -0
  202. package/dist/memory/oss.js +230 -0
  203. package/dist/memory/oss.js.map +1 -0
  204. package/dist/memory/platform.d.ts +37 -0
  205. package/dist/memory/platform.d.ts.map +1 -0
  206. package/dist/memory/platform.js +131 -0
  207. package/dist/memory/platform.js.map +1 -0
  208. package/dist/memory/scope.d.ts +49 -0
  209. package/dist/memory/scope.d.ts.map +1 -0
  210. package/dist/memory/scope.js +70 -0
  211. package/dist/memory/scope.js.map +1 -0
  212. package/dist/memory/types.d.ts +113 -0
  213. package/dist/memory/types.d.ts.map +1 -0
  214. package/dist/memory/types.js +18 -0
  215. package/dist/memory/types.js.map +1 -0
  216. package/dist/memory-cli.d.ts +17 -0
  217. package/dist/memory-cli.d.ts.map +1 -0
  218. package/dist/memory-cli.js +107 -0
  219. package/dist/memory-cli.js.map +1 -0
  220. package/dist/models-cli.d.ts +12 -0
  221. package/dist/models-cli.d.ts.map +1 -0
  222. package/dist/models-cli.js +54 -0
  223. package/dist/models-cli.js.map +1 -0
  224. package/dist/models.d.ts +111 -0
  225. package/dist/models.d.ts.map +1 -0
  226. package/dist/models.js +227 -0
  227. package/dist/models.js.map +1 -0
  228. package/dist/paths.d.ts +35 -0
  229. package/dist/paths.d.ts.map +1 -0
  230. package/dist/paths.js +65 -0
  231. package/dist/paths.js.map +1 -0
  232. package/dist/profile.d.ts +28 -0
  233. package/dist/profile.d.ts.map +1 -0
  234. package/dist/profile.js +154 -0
  235. package/dist/profile.js.map +1 -0
  236. package/dist/progress.d.ts +70 -0
  237. package/dist/progress.d.ts.map +1 -0
  238. package/dist/progress.js +132 -0
  239. package/dist/progress.js.map +1 -0
  240. package/dist/quiet.d.ts +2 -0
  241. package/dist/quiet.d.ts.map +1 -0
  242. package/dist/quiet.js +21 -0
  243. package/dist/quiet.js.map +1 -0
  244. package/dist/reconcile/continuation.d.ts +132 -0
  245. package/dist/reconcile/continuation.d.ts.map +1 -0
  246. package/dist/reconcile/continuation.js +306 -0
  247. package/dist/reconcile/continuation.js.map +1 -0
  248. package/dist/reconcile/index.d.ts +26 -0
  249. package/dist/reconcile/index.d.ts.map +1 -0
  250. package/dist/reconcile/index.js +28 -0
  251. package/dist/reconcile/index.js.map +1 -0
  252. package/dist/reconcile/outcome-set.d.ts +53 -0
  253. package/dist/reconcile/outcome-set.d.ts.map +1 -0
  254. package/dist/reconcile/outcome-set.js +124 -0
  255. package/dist/reconcile/outcome-set.js.map +1 -0
  256. package/dist/reconcile/outcome.d.ts +56 -0
  257. package/dist/reconcile/outcome.d.ts.map +1 -0
  258. package/dist/reconcile/outcome.js +60 -0
  259. package/dist/reconcile/outcome.js.map +1 -0
  260. package/dist/reconcile/reconciliation.d.ts +49 -0
  261. package/dist/reconcile/reconciliation.d.ts.map +1 -0
  262. package/dist/reconcile/reconciliation.js +88 -0
  263. package/dist/reconcile/reconciliation.js.map +1 -0
  264. package/dist/reconcile/schema.d.ts +157 -0
  265. package/dist/reconcile/schema.d.ts.map +1 -0
  266. package/dist/reconcile/schema.js +97 -0
  267. package/dist/reconcile/schema.js.map +1 -0
  268. package/dist/record/index.d.ts +23 -0
  269. package/dist/record/index.d.ts.map +1 -0
  270. package/dist/record/index.js +25 -0
  271. package/dist/record/index.js.map +1 -0
  272. package/dist/record/review-record.d.ts +28 -0
  273. package/dist/record/review-record.d.ts.map +1 -0
  274. package/dist/record/review-record.js +78 -0
  275. package/dist/record/review-record.js.map +1 -0
  276. package/dist/record/schema.d.ts +153 -0
  277. package/dist/record/schema.d.ts.map +1 -0
  278. package/dist/record/schema.js +87 -0
  279. package/dist/record/schema.js.map +1 -0
  280. package/dist/record/store.d.ts +83 -0
  281. package/dist/record/store.d.ts.map +1 -0
  282. package/dist/record/store.js +162 -0
  283. package/dist/record/store.js.map +1 -0
  284. package/dist/record/stored-review.d.ts +36 -0
  285. package/dist/record/stored-review.d.ts.map +1 -0
  286. package/dist/record/stored-review.js +90 -0
  287. package/dist/record/stored-review.js.map +1 -0
  288. package/dist/refute.d.ts +318 -0
  289. package/dist/refute.d.ts.map +1 -0
  290. package/dist/refute.js +513 -0
  291. package/dist/refute.js.map +1 -0
  292. package/dist/render.d.ts +212 -0
  293. package/dist/render.d.ts.map +1 -0
  294. package/dist/render.js +544 -0
  295. package/dist/render.js.map +1 -0
  296. package/dist/review-cli.d.ts +181 -0
  297. package/dist/review-cli.d.ts.map +1 -0
  298. package/dist/review-cli.js +598 -0
  299. package/dist/review-cli.js.map +1 -0
  300. package/dist/reviewer.d.ts +297 -0
  301. package/dist/reviewer.d.ts.map +1 -0
  302. package/dist/reviewer.js +580 -0
  303. package/dist/reviewer.js.map +1 -0
  304. package/dist/session-cli.d.ts +17 -0
  305. package/dist/session-cli.d.ts.map +1 -0
  306. package/dist/session-cli.js +62 -0
  307. package/dist/session-cli.js.map +1 -0
  308. package/dist/session.d.ts +36 -0
  309. package/dist/session.d.ts.map +1 -0
  310. package/dist/session.js +105 -0
  311. package/dist/session.js.map +1 -0
  312. package/dist/settings.d.ts +68 -0
  313. package/dist/settings.d.ts.map +1 -0
  314. package/dist/settings.js +175 -0
  315. package/dist/settings.js.map +1 -0
  316. package/dist/show-cli.d.ts +39 -0
  317. package/dist/show-cli.d.ts.map +1 -0
  318. package/dist/show-cli.js +56 -0
  319. package/dist/show-cli.js.map +1 -0
  320. package/dist/stdout.d.ts +28 -0
  321. package/dist/stdout.d.ts.map +1 -0
  322. package/dist/stdout.js +44 -0
  323. package/dist/stdout.js.map +1 -0
  324. package/dist/target.d.ts +58 -0
  325. package/dist/target.d.ts.map +1 -0
  326. package/dist/target.js +96 -0
  327. package/dist/target.js.map +1 -0
  328. package/dist/tools/index.d.ts +93 -0
  329. package/dist/tools/index.d.ts.map +1 -0
  330. package/dist/tools/index.js +146 -0
  331. package/dist/tools/index.js.map +1 -0
  332. package/dist/tools/root.d.ts +62 -0
  333. package/dist/tools/root.d.ts.map +1 -0
  334. package/dist/tools/root.js +51 -0
  335. package/dist/tools/root.js.map +1 -0
  336. package/dist/usage.d.ts +75 -0
  337. package/dist/usage.d.ts.map +1 -0
  338. package/dist/usage.js +100 -0
  339. package/dist/usage.js.map +1 -0
  340. package/dist/version.d.ts +14 -0
  341. package/dist/version.d.ts.map +1 -0
  342. package/dist/version.js +26 -0
  343. package/dist/version.js.map +1 -0
  344. package/dist/workspace.d.ts +48 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/dist/workspace.js +126 -0
  347. package/dist/workspace.js.map +1 -0
  348. package/docker-compose.yml +61 -0
  349. package/package.json +70 -4
package/dist/render.js ADDED
@@ -0,0 +1,544 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ /** How a status reads on the page. `open` is a sentence, not a state name. */
5
+ const RECONCILED_LABEL = {
6
+ open: 'still open',
7
+ superseded: 'superseded',
8
+ unverified: 'unverified',
9
+ fixed: 'fixed',
10
+ };
11
+ /** Below this share of changed files read, a recommendation is qualified. */
12
+ const LOW_COVERAGE = 0.5;
13
+ /** Widest line we will produce, regardless of how wide the terminal is. */
14
+ const MAX_WIDTH = 96;
15
+ const MIN_WIDTH = 48;
16
+ /**
17
+ * ANSI styling, or nothing at all.
18
+ *
19
+ * Every method is a no-op on a plain palette, so callers never branch on
20
+ * whether colour is in play — the decision is made once, here.
21
+ */
22
+ export class Palette {
23
+ _enabled;
24
+ constructor(_enabled) {
25
+ this._enabled = _enabled;
26
+ }
27
+ /**
28
+ * Colour when a human is watching and has not asked us not to.
29
+ *
30
+ * NO_COLOR is honoured whatever its value, per the convention; FORCE_COLOR
31
+ * wins over a non-TTY so `weigh review | less -R` still has colour when
32
+ * asked for.
33
+ */
34
+ static for(stream, env = process.env) {
35
+ if (env.NO_COLOR !== undefined)
36
+ return new Palette(false);
37
+ if (env.FORCE_COLOR !== undefined && env.FORCE_COLOR !== '0')
38
+ return new Palette(true);
39
+ return new Palette(Boolean(stream.isTTY));
40
+ }
41
+ static plain() {
42
+ return new Palette(false);
43
+ }
44
+ _wrap(code, text) {
45
+ return this._enabled ? `\u001b[${code}m${text}\u001b[0m` : text;
46
+ }
47
+ bold(text) {
48
+ return this._wrap('1', text);
49
+ }
50
+ dim(text) {
51
+ return this._wrap('2', text);
52
+ }
53
+ path(text) {
54
+ return this._wrap('36', text);
55
+ }
56
+ good(text) {
57
+ return this._wrap('32', text);
58
+ }
59
+ /** The recommendation, in the colour of what it recommends. */
60
+ verdict(level, text) {
61
+ const code = { block: '1;31', needs_work: '1;33', approve: '1;32' };
62
+ return this._wrap(code[level], text);
63
+ }
64
+ /** Consequence, not decoration: the colour is the severity. */
65
+ severity(severity, text) {
66
+ const code = {
67
+ critical: '1;31',
68
+ high: '31',
69
+ medium: '33',
70
+ low: '34',
71
+ nit: '2',
72
+ };
73
+ return this._wrap(code[severity], text);
74
+ }
75
+ }
76
+ /**
77
+ * Greedy pack of pre-formed segments.
78
+ *
79
+ * A footer row is several facts joined by a separator, not prose. Folding it
80
+ * on spaces puts the break inside "2,171 out"; folding it on the separator
81
+ * keeps each fact whole.
82
+ */
83
+ export function packSegments(segments, width, separator = ' · ') {
84
+ // A continued line ends with the separator, so it has to leave room for one
85
+ // — the width was checked before that was appended, which put the line one
86
+ // or two columns over whenever the break landed exactly on the boundary.
87
+ // Only the last line, which is never continued, may use the full width.
88
+ const trailing = separator.trimEnd();
89
+ const lines = [];
90
+ let line = '';
91
+ segments.forEach((segment, i) => {
92
+ const candidate = line === '' ? segment : line + separator + segment;
93
+ const budget = i === segments.length - 1 ? width : width - trailing.length;
94
+ if (line !== '' && candidate.length > budget) {
95
+ lines.push(line + trailing);
96
+ line = segment;
97
+ }
98
+ else
99
+ line = candidate;
100
+ });
101
+ if (line)
102
+ lines.push(line);
103
+ return lines;
104
+ }
105
+ /** Greedy wrap. Words longer than the width are left alone rather than cut. */
106
+ export function wrap(text, width) {
107
+ const lines = [];
108
+ for (const paragraph of text.split(/\n{2,}/)) {
109
+ const words = paragraph.split(/\s+/).filter(Boolean);
110
+ if (words.length === 0)
111
+ continue;
112
+ let line = '';
113
+ for (const word of words) {
114
+ if (line === '')
115
+ line = word;
116
+ else if (line.length + 1 + word.length <= width)
117
+ line += ` ${word}`;
118
+ else {
119
+ lines.push(line);
120
+ line = word;
121
+ }
122
+ }
123
+ if (line)
124
+ lines.push(line);
125
+ lines.push('');
126
+ }
127
+ if (lines[lines.length - 1] === '')
128
+ lines.pop();
129
+ return lines;
130
+ }
131
+ /** Trims to fit, keeping the end — the tail of a path is what identifies it. */
132
+ export function ellipsise(text, width, keep = 'head') {
133
+ if (text.length <= width)
134
+ return text;
135
+ if (width <= 1)
136
+ return '…';
137
+ return keep === 'head' ? text.slice(0, width - 1) + '…' : '…' + text.slice(text.length - width + 1);
138
+ }
139
+ /**
140
+ * Lays out one review.
141
+ *
142
+ * Width and palette are fixed at construction so every method below can treat
143
+ * them as settled — the alternative is threading a "should I colour this"
144
+ * question through every call that formats a string.
145
+ */
146
+ export class ReviewRenderer {
147
+ _palette;
148
+ _width;
149
+ constructor(_palette, columns) {
150
+ this._palette = _palette;
151
+ this._width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, columns ?? 80));
152
+ }
153
+ static for(stream) {
154
+ return new ReviewRenderer(Palette.for(stream), stream.columns);
155
+ }
156
+ review(summary, groups, verdict, footer,
157
+ /** What a refute pass took out, listed after what survived it. */
158
+ suppressed = [],
159
+ /** This review against the last one, when there was a last one. */
160
+ reconciled) {
161
+ // Numbered once, here, so the index and the detail below cannot disagree
162
+ // about which finding is #3.
163
+ const numbered = [];
164
+ for (const findings of groups.values())
165
+ for (const finding of findings)
166
+ numbered.push([numbered.length + 1, finding]);
167
+ const out = [this._banner(verdict, numbered.length, groups, footer), ''];
168
+ if (summary.trim()) {
169
+ out.push(...wrap(summary.trim(), this._width));
170
+ // The summary was written by the first call, about findings the second
171
+ // one has since taken away. It may argue for something no longer in
172
+ // the report, and nothing else on the page says so.
173
+ const dropped = footer.refuted?.dropped ?? 0;
174
+ if (dropped > 0) {
175
+ out.push(this._palette.dim(`Written before a second pass removed ${dropped} finding${dropped === 1 ? '' : 's'}.`));
176
+ }
177
+ out.push('');
178
+ }
179
+ if (numbered.length === 0) {
180
+ out.push(this._palette.good('No findings.'), '');
181
+ }
182
+ else {
183
+ // The headline, lifted out of the summary prose. The first finding is
184
+ // the most severe by construction, and a reader who stops after one line
185
+ // should be looking at the right one.
186
+ out.push(...this._headline(numbered[0][1], numbered[0][0]), '');
187
+ // An index earns its space once there is more than one thing to index.
188
+ if (numbered.length > 1)
189
+ out.push(...this._index(numbered), '');
190
+ for (const [severity, findings] of groups) {
191
+ out.push(this._severityHeading(severity, findings.length), '');
192
+ for (const finding of findings) {
193
+ const n = numbered.find(([, f]) => f === finding)[0];
194
+ out.push(...this._finding(finding, n), '');
195
+ }
196
+ }
197
+ }
198
+ if (suppressed.length)
199
+ out.push(...this._suppressed(suppressed), '');
200
+ if (reconciled)
201
+ out.push(...this._reconciled(reconciled, numbered), '');
202
+ out.push(...this._footer(footer, verdict));
203
+ return out.join('\n') + '\n';
204
+ }
205
+ /**
206
+ * What a second pass took out, and what it rested on.
207
+ *
208
+ * Last, and shorter than a finding: these are not being reported, they are
209
+ * being accounted for. But they are shown, because a finding that vanishes
210
+ * between the review and the report is indistinguishable from one that was
211
+ * never written — and a reader who cannot see the kill cannot disagree with
212
+ * it. The ground and the reason are the whole point of the section; a line
213
+ * saying only "2 dropped" would be worse than saying nothing.
214
+ */
215
+ _suppressed(suppressed) {
216
+ const indent = ' ';
217
+ const body = this._width - indent.length;
218
+ // "not reported" rather than "dropped". These now arrive from three
219
+ // places: a refute pass that argued one away, a confidence floor that
220
+ // withheld one without arguing at all, and a human who answered this
221
+ // finding and said not to raise it again. The ground on each line says
222
+ // which one, and the reason beside it says in whose words.
223
+ const lines = [this._heading('suppressed', `${suppressed.length} not reported`), ''];
224
+ suppressed.forEach((suppression, i) => {
225
+ if (i > 0)
226
+ lines.push('');
227
+ const { finding } = suppression;
228
+ lines.push(`${indent}${this._palette.path(`${finding.path}:${finding.line}`)}`);
229
+ for (const line of wrap(finding.title, body))
230
+ lines.push(indent + line);
231
+ // Two dim runs, not one. The ground and the fingerprint are short facts
232
+ // and pack together; the reason is a sentence and has to wrap.
233
+ // `packSegments` only ever breaks between segments, so a reason longer
234
+ // than the measure hangs over the right margin and leaves its separator
235
+ // dangling at the end of the line.
236
+ for (const line of packSegments([suppression.ground, finding.id], body)) {
237
+ lines.push(indent + this._palette.dim(line));
238
+ }
239
+ for (const line of wrap(suppression.reason ?? 'No reason given.', body)) {
240
+ lines.push(line ? indent + this._palette.dim(line) : '');
241
+ }
242
+ });
243
+ return lines;
244
+ }
245
+ /**
246
+ * This review against the last one.
247
+ *
248
+ * After the findings, because what is wrong now comes before what used to be
249
+ * wrong — but before the footer, because this is about the code and the
250
+ * footer is about the run. Each line carries the reason behind its status: a
251
+ * bare "fixed" is a claim, and the reader has to be able to disagree with it.
252
+ *
253
+ * The pointer is the number in *this* report, taken from the same numbering
254
+ * the index uses, so "still open → #2" and "#2" below cannot disagree about
255
+ * which finding they mean.
256
+ */
257
+ _reconciled(reconciled, numbered) {
258
+ const indent = ' ';
259
+ const label = Math.max(...Object.values(RECONCILED_LABEL).map((l) => l.length));
260
+ const gutter = indent.length + label + 2;
261
+ const outcomes = reconciled.ordered();
262
+ const lines = [this._heading('since the last review', reconciled.describe()), ''];
263
+ // The last review reported nothing, so there is nothing to have become of
264
+ // anything. A heading over an empty space reads as a bug, and the fact
265
+ // itself is worth a line: a clean review before this one is context for
266
+ // whatever is above.
267
+ if (outcomes.length === 0) {
268
+ const said = reconciled.fresh.length
269
+ ? 'The last review reported no findings, so every finding above is new.'
270
+ : 'The last review reported no findings.';
271
+ for (const line of wrap(said, this._width - indent.length)) {
272
+ lines.push(indent + this._palette.dim(line));
273
+ }
274
+ return lines;
275
+ }
276
+ // Sized to the paths it actually holds, not to the widest one allowed. A
277
+ // fixed column pads a short path out to 34 and charges the title for it.
278
+ const locationWidth = Math.min(34, Math.max(...outcomes.map((o) => `${o.finding.path}:${o.finding.line}`.length)));
279
+ for (const outcome of outcomes) {
280
+ const { finding } = outcome;
281
+ const pointer = this._pointer(outcome, numbered);
282
+ const where = ellipsise(`${finding.path}:${finding.line}`, locationWidth, 'tail');
283
+ const title = ellipsise(finding.title, Math.max(8, this._width - gutter - locationWidth - 2 - pointer.length));
284
+ lines.push(indent +
285
+ this._status(outcome, RECONCILED_LABEL[outcome.status].padEnd(label)) +
286
+ ' ' +
287
+ this._palette.path(where.padEnd(locationWidth)) +
288
+ ' ' +
289
+ title +
290
+ (pointer ? this._palette.dim(pointer) : ''));
291
+ for (const line of wrap(outcome.reason, this._width - gutter)) {
292
+ lines.push(' '.repeat(gutter) + this._palette.dim(line));
293
+ }
294
+ }
295
+ return lines;
296
+ }
297
+ /** ` → #2`, when this run reported the same problem and numbered it. */
298
+ _pointer(outcome, numbered) {
299
+ const restated = outcome.restatedAs;
300
+ if (!restated)
301
+ return '';
302
+ const entry = numbered.find(([, f]) => f.id === restated.id);
303
+ return entry ? ` → #${entry[0]}` : '';
304
+ }
305
+ /**
306
+ * A status, coloured by what it means for the reader.
307
+ *
308
+ * A fix is good news and reads as it. Anything still standing is painted by
309
+ * the finding's own severity, because that is what it costs to leave. An
310
+ * `unverified` is dim: it is the absence of an answer, and colouring it would
311
+ * give it a weight it has not earned.
312
+ */
313
+ _status(outcome, text) {
314
+ if (outcome.status === 'fixed')
315
+ return this._palette.good(text);
316
+ if (outcome.status === 'unverified')
317
+ return this._palette.dim(text);
318
+ return this._palette.severity(outcome.finding.severity, text);
319
+ }
320
+ /** `BLOCK · 1 high, 2 medium` — the recommendation, and what it rests on. */
321
+ _banner(verdict, total, groups, footer) {
322
+ const counts = [...groups].map(([severity, findings]) => `${findings.length} ${severity}`).join(', ');
323
+ // "nothing to fix" is a claim about the code. A run that stopped early has
324
+ // not earned it — all it can say is that it reported nothing.
325
+ const tail = total > 0 ? counts : verdict.complete ? 'nothing to fix' : 'nothing reported';
326
+ // Painted by level normally, and as a warning when the run did not finish
327
+ // — an unfinished review coloured green is the mistake this guards.
328
+ const head = verdict.complete
329
+ ? this._palette.verdict(verdict.level, verdict.label)
330
+ : this._palette.verdict('needs_work', verdict.label);
331
+ const lines = [`${head} ${this._palette.dim(tail)}`];
332
+ // Saying so is the point: a reader who disagrees needs to know the
333
+ // recommendation was not the one the reviewer gave.
334
+ if (verdict.raised) {
335
+ lines.push(this._palette.dim(` raised from "${verdict.reported}" — the findings below do not support it`));
336
+ }
337
+ // Named from the level it came down from, not from what the model said:
338
+ // a verdict can be lowered from `block` and still sit above a `reported`
339
+ // of `approve`, and both lines are then true at once.
340
+ if (verdict.loweredFrom) {
341
+ lines.push(this._palette.dim(` lowered from "${verdict.loweredFrom}" — a second pass removed the findings it rested on`));
342
+ }
343
+ // A recommendation is only as good as what was read to reach it, and an
344
+ // approval is where that matters most — it is the answer that ends the
345
+ // conversation. The coverage line in the footer says the same thing, but
346
+ // by then the reader has already taken the verdict at face value.
347
+ if (footer.coverageRatio < LOW_COVERAGE) {
348
+ lines.push(this._palette.dim(` ${footer.coverage} — thin ground for a recommendation`));
349
+ }
350
+ return lines.join('\n');
351
+ }
352
+ /** The one finding to read first, set apart from the prose. */
353
+ _headline(finding, n) {
354
+ const marker = this._palette.severity(finding.severity, '▸');
355
+ const lines = [`${marker} ${this._palette.bold(`#${n}`)} ${this._palette.bold(finding.title)}`];
356
+ for (const line of wrap(`${finding.path}:${finding.line}`, this._width - 2)) {
357
+ lines.push(` ${this._palette.path(line)}`);
358
+ }
359
+ return lines;
360
+ }
361
+ /**
362
+ * Every finding on one screen, before any of them is argued.
363
+ *
364
+ * A reader deciding whether to read the detail wants the shape of the review
365
+ * first: how many, how bad, and where.
366
+ */
367
+ _index(numbered) {
368
+ // Never narrower than its own heading: a column labelled "sev" is a column
369
+ // nobody reads twice.
370
+ const severityWidth = Math.max(...numbered.map(([, f]) => f.severity.length), 'severity'.length);
371
+ const gutterWidth = Math.max(...numbered.map(([n]) => `${n}`.length));
372
+ // The location gets whatever a title needs least, within reason: a path
373
+ // truncated to nothing is not a location anyone can act on.
374
+ const fixed = gutterWidth + 2 + severityWidth + 2;
375
+ const locationWidth = Math.max(16, Math.min(34, this._width - fixed - 24));
376
+ const titleWidth = this._width - fixed - locationWidth - 2;
377
+ const header = this._palette.dim(`${'#'.padStart(gutterWidth)} ${'severity'.padEnd(severityWidth)} ${'location'.padEnd(locationWidth)} finding`);
378
+ const rows = numbered.map(([n, finding]) => {
379
+ const gutter = this._palette.dim(`${n}`.padStart(gutterWidth));
380
+ const severity = this._palette.severity(finding.severity, finding.severity.padEnd(severityWidth));
381
+ const where = ellipsise(`${finding.path}:${finding.line}`, locationWidth, 'tail');
382
+ const title = ellipsise(finding.title, titleWidth);
383
+ return `${gutter} ${severity} ${this._palette.path(where.padEnd(locationWidth))} ${title}`;
384
+ });
385
+ return [header, ...rows];
386
+ }
387
+ /** `── high ──────────────── 2 findings ──`, severity-coloured. */
388
+ _severityHeading(severity, count) {
389
+ return this._heading(severity, `${count} finding${count === 1 ? '' : 's'}`, (text) => this._palette.severity(severity, text));
390
+ }
391
+ /** A rule with a label at one end and a count at the other. */
392
+ _heading(label, tail, paint = (t) => this._palette.dim(t)) {
393
+ const head = `── ${label} `;
394
+ const fill = Math.max(2, this._width - head.length - tail.length - 4);
395
+ return paint(this._palette.bold(head)) + this._palette.dim('─'.repeat(fill)) + this._palette.dim(` ${tail} ──`);
396
+ }
397
+ /**
398
+ * One finding: a numbered location line, the claim, the evidence, the fix.
399
+ *
400
+ * The number is how a finding is referred to afterwards — "#3 is
401
+ * intentional" has to mean the same thing here and in a PR comment — so it
402
+ * sits in the margin where it can be found without reading.
403
+ */
404
+ _finding(finding, n) {
405
+ const gutter = `${n}`.padStart(2);
406
+ const indent = ' '.repeat(6);
407
+ const body = this._width - indent.length;
408
+ const lines = [];
409
+ lines.push(` ${this._palette.bold(gutter)} ${this._palette.path(`${finding.path}:${finding.line}`)}`, `${indent}${this._palette.bold(finding.title)}`, '');
410
+ for (const line of wrap(finding.body.trim(), body))
411
+ lines.push(line ? indent + line : '');
412
+ for (const cited of finding.evidence) {
413
+ lines.push('', `${indent}${this._palette.dim(`${cited.path}:${cited.line}`)}`);
414
+ for (const snippet of cited.snippet.replace(/\t/g, ' ').split('\n')) {
415
+ lines.push(`${indent}${this._palette.dim('│ ')}${snippet.trimEnd()}`);
416
+ }
417
+ }
418
+ if (finding.suggestion) {
419
+ lines.push('');
420
+ const wrapped = wrap(finding.suggestion.trim(), body - 5);
421
+ wrapped.forEach((line, i) => {
422
+ lines.push(line ? `${indent}${i === 0 ? this._palette.good('fix ') : ' '}${line}` : '');
423
+ });
424
+ }
425
+ // The fingerprint is shown because it is the finding's name across runs.
426
+ // When P3 starts suppressing what has already been answered, a fingerprint
427
+ // that moved is the first thing anyone will want to see.
428
+ lines.push('');
429
+ const meta = `${finding.category} · confidence ${finding.confidence.toFixed(2)} · ${finding.id}`;
430
+ for (const line of wrap(meta, body))
431
+ lines.push(`${indent}${this._palette.dim(line)}`);
432
+ return lines;
433
+ }
434
+ /**
435
+ * One line on the second pass, or nothing when there was not one.
436
+ *
437
+ * A pass that failed says so here rather than in `stopped`, which is about
438
+ * the review. The two failures mean different things: a stopped review has
439
+ * findings it never looked for, while a stopped refute pass has findings it
440
+ * never argued with — the first is a gap in the answer, the second is only
441
+ * a second opinion that did not arrive.
442
+ */
443
+ /**
444
+ * One line on the confidence floor, or nothing when it withheld nothing.
445
+ *
446
+ * Silent when the floor is 0 or everything cleared it — a row saying "0
447
+ * withheld" on every clean review is noise, and the floor is a number the
448
+ * user set, so they already know it is there.
449
+ */
450
+ _withheld(withheld) {
451
+ if (!withheld?.count)
452
+ return '';
453
+ const findings = `${withheld.count} finding${withheld.count === 1 ? '' : 's'}`;
454
+ return `${findings} below the ${withheld.floor.toFixed(2)} confidence floor · listed above`;
455
+ }
456
+ _refuted(refuted) {
457
+ if (!refuted)
458
+ return '';
459
+ const total = refuted.dropped + refuted.kept;
460
+ // An empty review has nothing for a second pass to argue with, and no
461
+ // call was made. "kept all 0" reads as a pass that did some work.
462
+ // Said beside the result rather than folded into it: a continuation's
463
+ // carried findings were never put to this pass, so they are neither kept
464
+ // nor dropped by it.
465
+ const carried = refuted.carried ? [`${refuted.carried} from the last review not re-checked`] : [];
466
+ if (total === 0 && !refuted.stopped) {
467
+ return carried.length ? ['nothing new to check', ...carried].join(' · ') : 'nothing to rule on';
468
+ }
469
+ // The detail already reads as "it …", so it needs no prefix — one would
470
+ // have produced "did not finish · the review itself did not finish" on
471
+ // the pass that never started. Joined on the footer's own separator so a
472
+ // narrow terminal folds between facts rather than through one.
473
+ if (refuted.stopped)
474
+ return [refuted.stopped, 'nothing dropped'].join(' · ');
475
+ if (refuted.dropped === 0)
476
+ return [`a second pass kept all ${total}`, ...carried].join(' · ');
477
+ return [`a second pass dropped ${refuted.dropped} of ${total}`, 'listed above', ...carried].join(' · ');
478
+ }
479
+ _footer(f, verdict) {
480
+ const cached = f.cachedTokens ? ` (${f.cachedTokens.toLocaleString()} cached)` : '';
481
+ const tokens = `${f.inputTokens.toLocaleString()} in${cached} / ${f.outputTokens.toLocaleString()} out`;
482
+ // Absent rather than zero when the server reported no cost accounting —
483
+ // a displayed $0.0000 would read as "this was free". Labelled, because the
484
+ // SDK prices every run at API rates, and on a subscription login that is
485
+ // what the run would have cost rather than what anyone paid.
486
+ const cost = f.cost !== undefined ? `$${f.cost.toFixed(4)} at API prices` : 'cost unreported';
487
+ const rows = [
488
+ // Repeated from the banner, which has scrolled out of sight by the time
489
+ // a long report reaches its footer — and the footer is what gets pasted.
490
+ ['verdict', verdict.label],
491
+ ['coverage', f.coverage],
492
+ // Beside coverage, because the pair is what the review had in front of
493
+ // it: the code it opened, and what it already knew.
494
+ ['recalled', f.recalled ?? ''],
495
+ [
496
+ 'run',
497
+ [
498
+ // Effort beside the model that spent it: the two together are what
499
+ // a cost or a depth of reading has to be read against.
500
+ f.effort ? `${f.model} · ${f.effort} effort` : f.model,
501
+ `${f.modelCalls} call(s)`,
502
+ tokens,
503
+ cost,
504
+ `${(f.durationMs / 1000).toFixed(1)}s`,
505
+ ].join(' · '),
506
+ ],
507
+ // Only when it did stop, and above `reported` — what a review is worth
508
+ // depends first on whether it finished.
509
+ ['stopped', f.stopped ?? ''],
510
+ // Before `refuted`, because it happens first: the floor is the reviewer's
511
+ // bar on its own output, and the pass is a second opinion on what clears it.
512
+ ['withheld', this._withheld(f.withheld)],
513
+ ['refuted', this._refuted(f.refuted)],
514
+ [
515
+ 'reported',
516
+ `via ${f.channel === 'structured'
517
+ ? 'the review schema'
518
+ : f.channel === 'none'
519
+ ? 'nothing — the run stopped before it reported'
520
+ : 'recovered prose'}${
521
+ // A run that was sent back and still came up short read what it read
522
+ // under protest. That is worth knowing before trusting the verdict.
523
+ f.nudges ? ` · sent back ${f.nudges === 1 ? 'once' : `${f.nudges} times`} for coverage` : ''}`,
524
+ ],
525
+ ['reviewed', `${f.base} ${f.baseSha.slice(0, 8)} → ${f.head}`],
526
+ ['continued', f.continued ?? ''],
527
+ // Last, and a whole path: it is the one line here meant to be copied
528
+ // rather than read, so it is not folded into the run line beside the
529
+ // numbers.
530
+ ['saved', f.saved ?? ''],
531
+ ].filter(([, value]) => value !== '');
532
+ // Wrapped with a hanging indent like everything else: the run line is the
533
+ // longest thing Weigh prints, and a terminal narrower than it would fold
534
+ // it mid-number where the label column gives no clue what it belongs to.
535
+ const gutter = 11;
536
+ return rows.flatMap(([label, value]) => {
537
+ const lines = value.includes(' · ')
538
+ ? packSegments(value.split(' · '), this._width - gutter)
539
+ : wrap(value, this._width - gutter);
540
+ return lines.map((line, i) => this._palette.dim(`${(i === 0 ? label : '').padEnd(gutter)}${line}`));
541
+ });
542
+ }
543
+ }
544
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAc5D,8EAA8E;AAC9E,MAAM,gBAAgB,GAAqC;IACzD,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,6EAA6E;AAC7E,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,2EAA2E;AAC3E,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAA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