@hawkeyexl/manni 4.3.1 → 4.4.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 (224) hide show
  1. package/README.md +9 -1
  2. package/dist/batch-DFRCLY77.js +36 -0
  3. package/dist/build-Q5C6SX5J.js +31 -0
  4. package/dist/calibrate-XQILKXS3.js +31 -0
  5. package/dist/capture-JQMOC3BW.js +32 -0
  6. package/dist/check-HYNGXYJV.js +18 -0
  7. package/dist/check-HYNGXYJV.js.map +1 -0
  8. package/dist/check-NFZQLJKN.js +27 -0
  9. package/dist/check-NFZQLJKN.js.map +1 -0
  10. package/dist/check-U54XV6BP.js +40 -0
  11. package/dist/check-U54XV6BP.js.map +1 -0
  12. package/dist/chunk-252LNOEG.js +622 -0
  13. package/dist/chunk-252LNOEG.js.map +1 -0
  14. package/dist/chunk-2H7UOFLK.js +11 -0
  15. package/dist/chunk-2H7UOFLK.js.map +1 -0
  16. package/dist/chunk-2U3ORT6D.js +230 -0
  17. package/dist/chunk-2U3ORT6D.js.map +1 -0
  18. package/dist/chunk-3AFUD75K.js +23 -0
  19. package/dist/chunk-3AFUD75K.js.map +1 -0
  20. package/dist/{chunk-3R23C5DT.js → chunk-4TSWU2SU.js} +2 -14
  21. package/dist/chunk-4TSWU2SU.js.map +1 -0
  22. package/dist/chunk-5KHIFVD2.js +1192 -0
  23. package/dist/chunk-5KHIFVD2.js.map +1 -0
  24. package/dist/chunk-5YXBLLAC.js +2165 -0
  25. package/dist/chunk-5YXBLLAC.js.map +1 -0
  26. package/dist/chunk-644JVKJ4.js +3872 -0
  27. package/dist/chunk-644JVKJ4.js.map +1 -0
  28. package/dist/chunk-6OYEI2VV.js +88 -0
  29. package/dist/chunk-6OYEI2VV.js.map +1 -0
  30. package/dist/chunk-77AINBYM.js +19 -0
  31. package/dist/chunk-77AINBYM.js.map +1 -0
  32. package/dist/chunk-77HX34KD.js +1287 -0
  33. package/dist/chunk-77HX34KD.js.map +1 -0
  34. package/dist/{chunk-CFDUZRM2.js → chunk-7QMCHA4N.js} +32 -240
  35. package/dist/chunk-7QMCHA4N.js.map +1 -0
  36. package/dist/chunk-BUXDLRDT.js +455 -0
  37. package/dist/chunk-BUXDLRDT.js.map +1 -0
  38. package/dist/chunk-C6OH6CNF.js +388 -0
  39. package/dist/chunk-C6OH6CNF.js.map +1 -0
  40. package/dist/chunk-CK7SKVHR.js +1042 -0
  41. package/dist/chunk-CK7SKVHR.js.map +1 -0
  42. package/dist/chunk-CYWHFSRT.js +6737 -0
  43. package/dist/chunk-CYWHFSRT.js.map +1 -0
  44. package/dist/chunk-ERMSO34F.js +17 -0
  45. package/dist/chunk-ERMSO34F.js.map +1 -0
  46. package/dist/{chunk-IOYXPBCL.js → chunk-G3T47CFV.js} +1 -7
  47. package/dist/{chunk-IOYXPBCL.js.map → chunk-G3T47CFV.js.map} +1 -1
  48. package/dist/chunk-G7NJSREW.js +979 -0
  49. package/dist/chunk-G7NJSREW.js.map +1 -0
  50. package/dist/chunk-GLP5PSXB.js +72 -0
  51. package/dist/chunk-GLP5PSXB.js.map +1 -0
  52. package/dist/chunk-H2DLH2JI.js +198 -0
  53. package/dist/chunk-H2DLH2JI.js.map +1 -0
  54. package/dist/chunk-H6FZ66XR.js +634 -0
  55. package/dist/chunk-H6FZ66XR.js.map +1 -0
  56. package/dist/{chunk-KJR7OVDX.js → chunk-IEQHSCZG.js} +56 -137
  57. package/dist/chunk-IEQHSCZG.js.map +1 -0
  58. package/dist/chunk-IKEWBMCN.js +98 -0
  59. package/dist/chunk-IKEWBMCN.js.map +1 -0
  60. package/dist/chunk-JOHKIAVH.js +5440 -0
  61. package/dist/chunk-JOHKIAVH.js.map +1 -0
  62. package/dist/chunk-JVTNMVYU.js +10921 -0
  63. package/dist/chunk-JVTNMVYU.js.map +1 -0
  64. package/dist/chunk-K3D6FPV6.js +164 -0
  65. package/dist/chunk-K3D6FPV6.js.map +1 -0
  66. package/dist/{chunk-UBMMXS2Y.js → chunk-KCGV52AM.js} +69 -48
  67. package/dist/{chunk-UBMMXS2Y.js.map → chunk-KCGV52AM.js.map} +1 -1
  68. package/dist/chunk-LAKAWRV5.js +1651 -0
  69. package/dist/chunk-LAKAWRV5.js.map +1 -0
  70. package/dist/chunk-LJ2RDH3F.js +49 -0
  71. package/dist/chunk-LJ2RDH3F.js.map +1 -0
  72. package/dist/chunk-M2JCK5F6.js +805 -0
  73. package/dist/chunk-M2JCK5F6.js.map +1 -0
  74. package/dist/chunk-MNH7QO4Z.js +15 -0
  75. package/dist/chunk-MNH7QO4Z.js.map +1 -0
  76. package/dist/{chunk-HAPTXWU2.js → chunk-MYC3O5EJ.js} +4 -4
  77. package/dist/chunk-MYMBCTDE.js +387 -0
  78. package/dist/chunk-MYMBCTDE.js.map +1 -0
  79. package/dist/chunk-NCPWXHDO.js +683 -0
  80. package/dist/chunk-NCPWXHDO.js.map +1 -0
  81. package/dist/chunk-NWZ2SLYL.js +2957 -0
  82. package/dist/chunk-NWZ2SLYL.js.map +1 -0
  83. package/dist/chunk-OBFENF3U.js +934 -0
  84. package/dist/chunk-OBFENF3U.js.map +1 -0
  85. package/dist/chunk-OWBRDNRZ.js +16 -0
  86. package/dist/chunk-OWBRDNRZ.js.map +1 -0
  87. package/dist/{chunk-KTSJ2ZHA.js → chunk-PAU352SV.js} +5 -3
  88. package/dist/{chunk-KTSJ2ZHA.js.map → chunk-PAU352SV.js.map} +1 -1
  89. package/dist/chunk-PCE7QHXJ.js +68 -0
  90. package/dist/chunk-PCE7QHXJ.js.map +1 -0
  91. package/dist/chunk-PCHZY2I7.js +299 -0
  92. package/dist/chunk-PCHZY2I7.js.map +1 -0
  93. package/dist/chunk-PHF3D7ER.js +1042 -0
  94. package/dist/chunk-PHF3D7ER.js.map +1 -0
  95. package/dist/chunk-Q35YIDBV.js +1202 -0
  96. package/dist/chunk-Q35YIDBV.js.map +1 -0
  97. package/dist/chunk-RLR4TKUZ.js +4398 -0
  98. package/dist/chunk-RLR4TKUZ.js.map +1 -0
  99. package/dist/chunk-RNVYGWIC.js +30 -0
  100. package/dist/chunk-RNVYGWIC.js.map +1 -0
  101. package/dist/chunk-SE4JN5XN.js +19 -0
  102. package/dist/chunk-SE4JN5XN.js.map +1 -0
  103. package/dist/chunk-TIUTIOFB.js +25 -0
  104. package/dist/chunk-TIUTIOFB.js.map +1 -0
  105. package/dist/chunk-TU2WUBVZ.js +2 -0
  106. package/dist/chunk-TU2WUBVZ.js.map +1 -0
  107. package/dist/chunk-TZOYZK2E.js +98 -0
  108. package/dist/chunk-TZOYZK2E.js.map +1 -0
  109. package/dist/chunk-UKZNLVJW.js +17 -0
  110. package/dist/chunk-UKZNLVJW.js.map +1 -0
  111. package/dist/chunk-UZC7LDAQ.js +178 -0
  112. package/dist/chunk-UZC7LDAQ.js.map +1 -0
  113. package/dist/chunk-V46OILVC.js +3090 -0
  114. package/dist/chunk-V46OILVC.js.map +1 -0
  115. package/dist/chunk-WQE54PNH.js +1975 -0
  116. package/dist/chunk-WQE54PNH.js.map +1 -0
  117. package/dist/chunk-X3BPBDGQ.js +52 -0
  118. package/dist/chunk-X3BPBDGQ.js.map +1 -0
  119. package/dist/chunk-XSLV76YK.js +54 -0
  120. package/dist/chunk-XSLV76YK.js.map +1 -0
  121. package/dist/{chunk-5HNHEUD5.js → chunk-XYLUCIKQ.js} +3 -3
  122. package/dist/chunk-YEUYKR62.js +72 -0
  123. package/dist/chunk-YEUYKR62.js.map +1 -0
  124. package/dist/{chunk-G5CM2VGQ.js → chunk-YFQBFNQS.js} +8 -94
  125. package/dist/chunk-YFQBFNQS.js.map +1 -0
  126. package/dist/chunk-YIL4XLLJ.js +1661 -0
  127. package/dist/chunk-YIL4XLLJ.js.map +1 -0
  128. package/dist/chunk-YNHZHSSM.js +41 -0
  129. package/dist/chunk-YNHZHSSM.js.map +1 -0
  130. package/dist/chunk-YTCZRLTU.js +96 -0
  131. package/dist/chunk-YTCZRLTU.js.map +1 -0
  132. package/dist/chunk-YYBFZLAJ.js +374 -0
  133. package/dist/chunk-YYBFZLAJ.js.map +1 -0
  134. package/dist/chunk-ZXRAE55H.js +31 -0
  135. package/dist/chunk-ZXRAE55H.js.map +1 -0
  136. package/dist/cli-2QPR2OZG.js +232 -0
  137. package/dist/cli-2QPR2OZG.js.map +1 -0
  138. package/dist/cli-4IOPGZHR.js +1203 -0
  139. package/dist/cli-4IOPGZHR.js.map +1 -0
  140. package/dist/cli-5FL73WHA.js +346 -0
  141. package/dist/cli-5FL73WHA.js.map +1 -0
  142. package/dist/cli-C262QOWM.js +739 -0
  143. package/dist/cli-C262QOWM.js.map +1 -0
  144. package/dist/cli-LJLLIQB2.js +423 -0
  145. package/dist/cli-LJLLIQB2.js.map +1 -0
  146. package/dist/cli-OFPZ5MAS.js +626 -0
  147. package/dist/cli-OFPZ5MAS.js.map +1 -0
  148. package/dist/cli-SHSMSRQY.js +28 -0
  149. package/dist/cli-SHSMSRQY.js.map +1 -0
  150. package/dist/cli-SRHFUZHA.js +473 -0
  151. package/dist/cli-SRHFUZHA.js.map +1 -0
  152. package/dist/cli-URZQXL4K.js +552 -0
  153. package/dist/cli-URZQXL4K.js.map +1 -0
  154. package/dist/cli.d.ts +12 -2
  155. package/dist/cli.js +109 -7661
  156. package/dist/cli.js.map +1 -1
  157. package/dist/docmeta.js +15 -3
  158. package/dist/docmeta.js.map +1 -1
  159. package/dist/github-FE6KCNYJ.js +27 -0
  160. package/dist/github-FE6KCNYJ.js.map +1 -0
  161. package/dist/github-QXL3VMK2.js +32 -0
  162. package/dist/github-QXL3VMK2.js.map +1 -0
  163. package/dist/index.d.ts +65 -3
  164. package/dist/index.js +407 -337
  165. package/dist/index.js.map +1 -1
  166. package/dist/json-7WV7KL6H.js +17 -0
  167. package/dist/json-7WV7KL6H.js.map +1 -0
  168. package/dist/json-SGZ6ZRFD.js +35 -0
  169. package/dist/json-SGZ6ZRFD.js.map +1 -0
  170. package/dist/lint-DL4LJRAY.js +28 -0
  171. package/dist/lint-DL4LJRAY.js.map +1 -0
  172. package/dist/list-6BAXTZUM.js +29 -0
  173. package/dist/list-6BAXTZUM.js.map +1 -0
  174. package/dist/list-7BKNYPSB.js +31 -0
  175. package/dist/list-7BKNYPSB.js.map +1 -0
  176. package/dist/page-3U2GCFNE.js +41 -0
  177. package/dist/page-3U2GCFNE.js.map +1 -0
  178. package/dist/picker-3XF36MJF.js +14 -0
  179. package/dist/picker-3XF36MJF.js.map +1 -0
  180. package/dist/pretty-2H57QVTY.js +43 -0
  181. package/dist/pretty-2H57QVTY.js.map +1 -0
  182. package/dist/pretty-N6DO4OOL.js +37 -0
  183. package/dist/pretty-N6DO4OOL.js.map +1 -0
  184. package/dist/reporters-M6LJ2IYU.js +21 -0
  185. package/dist/reporters-M6LJ2IYU.js.map +1 -0
  186. package/dist/reporters-N6GHXSS7.js +42 -0
  187. package/dist/reporters-N6GHXSS7.js.map +1 -0
  188. package/dist/reporters-UCNEV7PH.js +71 -0
  189. package/dist/reporters-UCNEV7PH.js.map +1 -0
  190. package/dist/run-XZDAREJE.js +33 -0
  191. package/dist/run-XZDAREJE.js.map +1 -0
  192. package/dist/term-5ICGKPC3.js +1592 -0
  193. package/dist/term-5ICGKPC3.js.map +1 -0
  194. package/dist/types-Y6TXHM7M.js +10 -0
  195. package/dist/types-Y6TXHM7M.js.map +1 -0
  196. package/dist/validate-GQRM77YN.js +16 -0
  197. package/dist/validate-GQRM77YN.js.map +1 -0
  198. package/package.json +1 -1
  199. package/plugin/manni/.claude-plugin/plugin.json +9 -0
  200. package/plugin/manni/hooks/hooks.json +52 -0
  201. package/plugin/manni/skills/check/SKILL.md +20 -0
  202. package/plugin/manni/skills/evals/SKILL.md +27 -0
  203. package/plugin/manni/skills/fix/SKILL.md +56 -0
  204. package/plugin/manni/skills/setup/SKILL.md +41 -0
  205. package/dist/batch-A5HZKYIW.js +0 -18
  206. package/dist/calibrate-S5K6QHUY.js +0 -13
  207. package/dist/capture-OZEZDABQ.js +0 -15
  208. package/dist/chunk-3R23C5DT.js.map +0 -1
  209. package/dist/chunk-CFDUZRM2.js.map +0 -1
  210. package/dist/chunk-G5CM2VGQ.js.map +0 -1
  211. package/dist/chunk-KJR7OVDX.js.map +0 -1
  212. package/dist/chunk-V4KUVE47.js +0 -27170
  213. package/dist/chunk-V4KUVE47.js.map +0 -1
  214. package/dist/chunk-ZQBTK3DO.js +0 -26518
  215. package/dist/chunk-ZQBTK3DO.js.map +0 -1
  216. package/dist/picker-6HRMETE7.js +0 -12
  217. package/plugin/tracevals/.claude-plugin/plugin.json +0 -9
  218. package/plugin/tracevals/hooks/hooks.json +0 -17
  219. /package/dist/{batch-A5HZKYIW.js.map → batch-DFRCLY77.js.map} +0 -0
  220. /package/dist/{calibrate-S5K6QHUY.js.map → build-Q5C6SX5J.js.map} +0 -0
  221. /package/dist/{capture-OZEZDABQ.js.map → calibrate-XQILKXS3.js.map} +0 -0
  222. /package/dist/{picker-6HRMETE7.js.map → capture-JQMOC3BW.js.map} +0 -0
  223. /package/dist/{chunk-HAPTXWU2.js.map → chunk-MYC3O5EJ.js.map} +0 -0
  224. /package/dist/{chunk-5HNHEUD5.js.map → chunk-XYLUCIKQ.js.map} +0 -0
@@ -0,0 +1,622 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ANY_FENCE,
4
+ MAX_MARKERS_PER_PAGE,
5
+ RULE_ID_PREFIX,
6
+ anchoredLines,
7
+ fenceAround,
8
+ fenceSpanAt,
9
+ isBoundLine,
10
+ isMarkerLine,
11
+ isTableRow,
12
+ isTableSeparator,
13
+ lineAt,
14
+ offsetOfLine,
15
+ paragraphAfter,
16
+ parseSrc,
17
+ ruleId
18
+ } from "./chunk-G7NJSREW.js";
19
+ import {
20
+ findWindows,
21
+ hashLines,
22
+ parseLines,
23
+ pinOfLines,
24
+ spellLines,
25
+ toBodyLines,
26
+ toFileLines
27
+ } from "./chunk-RLR4TKUZ.js";
28
+ import {
29
+ isErrorSeverity
30
+ } from "./chunk-JVTNMVYU.js";
31
+
32
+ // src/cite/core/spell.ts
33
+ function shortPin(integrity) {
34
+ const m = /^((?:hmac-)?sha256-)([0-9a-f]{8})/i.exec(integrity);
35
+ const prefix = m?.[1];
36
+ const digits = m?.[2];
37
+ if (prefix === void 0 || digits === void 0) return integrity;
38
+ return `${prefix}${digits}\u2026`;
39
+ }
40
+ function shortCommit(commit) {
41
+ return commit.slice(0, 7);
42
+ }
43
+ function shortSrc(src) {
44
+ if (!src.startsWith("~")) return src;
45
+ const colon = src.indexOf(":");
46
+ const token = colon === -1 ? src : src.slice(0, colon);
47
+ const lines = colon === -1 ? "" : src.slice(colon);
48
+ return token.length <= 5 ? src : `${token.slice(0, 5)}\u2026${lines}`;
49
+ }
50
+ var LINE_WIDTH = 60;
51
+ function shortLine(text) {
52
+ const one = text.replace(/\s+/g, " ").trim();
53
+ return one.length <= LINE_WIDTH ? one : `${one.slice(0, LINE_WIDTH)}\u2026`;
54
+ }
55
+ function spellAt(lines) {
56
+ return lines.start === lines.end ? `line ${String(lines.start)}` : `lines ${String(lines.start)}-${String(lines.end)}`;
57
+ }
58
+ function listOf(values) {
59
+ if (values.length <= 1) return values.join("");
60
+ return `${values.slice(0, -1).join(", ")} and ${values[values.length - 1] ?? ""}`;
61
+ }
62
+
63
+ // src/cite/core/adapt.ts
64
+ import { isAbsolute } from "node:path";
65
+
66
+ // src/cite/core/reanchor.ts
67
+ function isUnitText(line, format) {
68
+ if (line === void 0) return false;
69
+ if (line.trim() === "") return false;
70
+ if (ANY_FENCE.test(line)) return false;
71
+ if (isMarkerLine(line, format)) return false;
72
+ return !isBoundLine(line, format);
73
+ }
74
+ function markerAt(lines, n, format) {
75
+ const line = lines[n - 1];
76
+ return line !== void 0 && isMarkerLine(line, format);
77
+ }
78
+ function markerRunAt(lines, line, format, bodyLine) {
79
+ let start = line;
80
+ while (start - 1 >= bodyLine && markerAt(lines, start - 1, format)) start--;
81
+ let end = line;
82
+ while (end + 1 <= lines.length && markerAt(lines, end + 1, format)) end++;
83
+ return { start, end };
84
+ }
85
+ function splitUnit(lines, run, format, bodyLine) {
86
+ if (run.start - 1 < bodyLine) return void 0;
87
+ if (!isUnitText(lines[run.start - 2], format)) return void 0;
88
+ if (!isUnitText(lines[run.end], format)) return void 0;
89
+ let start = run.start - 1;
90
+ while (start - 1 >= bodyLine && isUnitText(lines[start - 2], format)) start--;
91
+ let end = run.end + 1;
92
+ while (end + 1 <= lines.length && isUnitText(lines[end], format)) end++;
93
+ return { start, end };
94
+ }
95
+ function pre43Span(lines, markerLine) {
96
+ const start = markerLine + 1;
97
+ const first = lines[start - 1];
98
+ if (first === void 0 || first.trim() === "" || ANY_FENCE.test(first)) return void 0;
99
+ let end = start;
100
+ while (end + 1 <= lines.length) {
101
+ const next = lines[end];
102
+ if (next === void 0 || next.trim() === "" || ANY_FENCE.test(next)) break;
103
+ end++;
104
+ }
105
+ return { start, end };
106
+ }
107
+ function runLength(run) {
108
+ return run.end - run.start + 1;
109
+ }
110
+ function misplacedMarkerAt(page, lines, line, entry) {
111
+ if (!markerAt(lines, line, page.format)) return void 0;
112
+ const run = markerRunAt(lines, line, page.format, page.bodyLine);
113
+ const unit = splitUnit(lines, run, page.format, page.bodyLine);
114
+ if (unit === void 0) return void 0;
115
+ const order = line - run.start;
116
+ const quote = entry?.citation.quote === true;
117
+ const marker = entry?.marker;
118
+ const blockAt = quote && marker !== void 0 ? anchoredLines(page.content, marker.end, page.format, true)?.start : void 0;
119
+ const out = blockAt === void 0 ? { line, run, order, unit, place: unit.start, block: false, to: unit.start + order } : {
120
+ line,
121
+ run,
122
+ order,
123
+ unit,
124
+ place: blockAt,
125
+ block: true,
126
+ to: blockAt - runLength(run) + order
127
+ };
128
+ if (entry !== void 0) out.entry = entry;
129
+ return out;
130
+ }
131
+ function misplacedMarkers(page, lines) {
132
+ const out = [];
133
+ for (const statement of page.statements.slice(0, MAX_MARKERS_PER_PAGE)) {
134
+ const entry = page.citations.find((c) => c.marker?.line === statement.line);
135
+ const found = misplacedMarkerAt(page, lines, statement.line, entry);
136
+ if (found !== void 0) out.push(found);
137
+ }
138
+ return out;
139
+ }
140
+ function movedUnit(misplaced) {
141
+ return { start: misplaced.unit.start + runLength(misplaced.run), end: misplaced.unit.end };
142
+ }
143
+ function unitText(lines, misplaced) {
144
+ const { unit, run } = misplaced;
145
+ const out = [];
146
+ for (let n = unit.start; n <= unit.end; n++) {
147
+ if (n >= run.start && n <= run.end) continue;
148
+ const line = lines[n - 1];
149
+ if (line !== void 0) out.push(line);
150
+ }
151
+ return out;
152
+ }
153
+ function splitKeepingEol(content) {
154
+ const parts = content.match(/[^\n]*\n|[^\n]+$/g) ?? [];
155
+ const texts = [];
156
+ const eols = [];
157
+ for (const part of parts) {
158
+ const eol = /\r?\n$/.exec(part)?.[0] ?? "";
159
+ texts.push(part.slice(0, part.length - eol.length));
160
+ eols.push(eol);
161
+ }
162
+ return { texts, eols };
163
+ }
164
+ function applyMarkerMoves(content, moves, indentAt) {
165
+ const { texts, eols } = splitKeepingEol(content);
166
+ const moving = new Set(moves.map((move) => move.from));
167
+ const inserts = /* @__PURE__ */ new Map();
168
+ for (const move of moves) {
169
+ const list = inserts.get(move.place) ?? [];
170
+ list.push(move.from);
171
+ inserts.set(move.place, list);
172
+ }
173
+ const order = [];
174
+ for (let n = 1; n <= texts.length; n++) {
175
+ for (const from of inserts.get(n) ?? []) order.push(from);
176
+ if (!moving.has(n)) order.push(n);
177
+ }
178
+ const moved = /* @__PURE__ */ new Map();
179
+ for (const move of moves) {
180
+ moved.set(move.from, indentAt(move.place) + (texts[move.from - 1] ?? "").trim());
181
+ }
182
+ const at2 = /* @__PURE__ */ new Map();
183
+ order.forEach((old, index) => at2.set(old, index + 1));
184
+ const out = order.map((old, index) => (moved.get(old) ?? texts[old - 1] ?? "") + (eols[index] ?? "")).join("");
185
+ return { content: out, line: (old) => at2.get(old) ?? old };
186
+ }
187
+ function pinOf(lines, span) {
188
+ if (span.start < 1 || span.end > lines.length || span.end < span.start) return void 0;
189
+ return hashLines(lines.slice(span.start - 1, span.end).join("\n"));
190
+ }
191
+ function markerClaimEnd(page, entry, lines, misplaced) {
192
+ const { citation, marker } = entry;
193
+ const pin = citation.claim?.integrity;
194
+ const quote = citation.quote === true;
195
+ if (marker === void 0 || pin === void 0) return { status: "changed" };
196
+ const current = anchoredLines(page.content, marker.end, page.format, quote);
197
+ if (current === void 0) return { status: "changed" };
198
+ const claimAt = (span, status, to) => {
199
+ const end = { fileLines: spellLines(span), status };
200
+ if (to !== void 0) {
201
+ end.newLines = spellLines(to);
202
+ end.newFileLines = end.newLines;
203
+ }
204
+ if (status === "changed") end.text = lines.slice(span.start - 1, Math.min(span.end, lines.length));
205
+ return end;
206
+ };
207
+ if (quote) {
208
+ return claimAt(current, pinOf(lines, current) === pin ? "current" : "changed");
209
+ }
210
+ if (misplaced !== void 0) {
211
+ const to = movedUnit(misplaced);
212
+ if (hashLines(unitText(lines, misplaced).join("\n")) === pin) return claimAt(to, "current");
213
+ if (pinOf(lines, current) === pin) return claimAt(current, "moved", to);
214
+ const pre432 = pre43Span(lines, marker.line);
215
+ if (pre432 !== void 0 && pinOf(lines, pre432) === pin) return claimAt(pre432, "moved", to);
216
+ return claimAt(current, "changed");
217
+ }
218
+ if (pinOf(lines, current) === pin) return claimAt(current, "current");
219
+ const pre43 = pre43Span(lines, marker.line);
220
+ if (pre43 !== void 0 && pinOf(lines, pre43) === pin) return claimAt(pre43, "moved", current);
221
+ return claimAt(current, "changed");
222
+ }
223
+
224
+ // src/cite/core/claims.ts
225
+ function normalizeWhitespace(text) {
226
+ return text.replace(/\s+/g, " ").trim();
227
+ }
228
+ function normalizeBlock(text) {
229
+ let out = text.charCodeAt(0) === 65279 ? text.slice(1) : text;
230
+ out = out.replace(/\r\n/g, "\n");
231
+ return out.endsWith("\n") ? out.slice(0, -1) : out;
232
+ }
233
+ function blockMatches(blockText, citedJoined) {
234
+ return normalizeBlock(blockText) === normalizeBlock(citedJoined);
235
+ }
236
+ function textAt(lines, range) {
237
+ return lines.slice(range.start - 1, Math.min(range.end, lines.length));
238
+ }
239
+ function claimLine(claim) {
240
+ const at2 = claim.fileLines === void 0 ? void 0 : parseLines(claim.fileLines);
241
+ return at2?.start;
242
+ }
243
+ function claimLineNow(claim) {
244
+ const spec = claim.newFileLines ?? claim.candidateFileLines?.[0] ?? claim.fileLines;
245
+ const at2 = spec === void 0 ? void 0 : parseLines(spec);
246
+ return at2?.start;
247
+ }
248
+ function claimLinesNow(claim) {
249
+ const spec = claim.newFileLines ?? claim.candidateFileLines?.[0] ?? claim.fileLines;
250
+ return spec === void 0 ? void 0 : parseLines(spec);
251
+ }
252
+ function claimEnd(page, entry, lines, misplaced) {
253
+ const { citation, marker } = entry;
254
+ const claim = citation.claim;
255
+ if (claim === void 0) return null;
256
+ const body = page.bodyLine;
257
+ if (claim.lines !== void 0) {
258
+ const recorded = parseLines(claim.lines);
259
+ if (recorded === void 0) return { status: "skipped" };
260
+ const file = toFileLines(recorded, body);
261
+ const end = {
262
+ lines: spellLines(recorded),
263
+ fileLines: spellLines(file),
264
+ status: "changed"
265
+ };
266
+ if (marker !== void 0) return { ...end, status: "skipped" };
267
+ if (pinOfLines(lines, file) === claim.integrity) return { ...end, status: "current" };
268
+ const width = recorded.end - recorded.start + 1;
269
+ const found = findWindows(lines.slice(body - 1), width, claim.integrity, void 0, {
270
+ around: recorded.start
271
+ });
272
+ const spans = found.starts.map((start) => ({ start, end: start + width - 1 }));
273
+ const [only] = spans;
274
+ if (spans.length === 1 && only !== void 0) {
275
+ return {
276
+ ...end,
277
+ status: "moved",
278
+ newLines: spellLines(only),
279
+ newFileLines: spellLines(toFileLines(only, body))
280
+ };
281
+ }
282
+ if (spans.length > 1) {
283
+ return {
284
+ ...end,
285
+ status: "moved-ambiguous",
286
+ candidates: spans.map(spellLines),
287
+ candidateFileLines: spans.map((span) => spellLines(toFileLines(span, body)))
288
+ };
289
+ }
290
+ return { ...end, text: textAt(lines, file) };
291
+ }
292
+ if (marker !== void 0) {
293
+ return markerClaimEnd(
294
+ page,
295
+ entry,
296
+ lines,
297
+ misplaced ?? misplacedMarkerAt(page, lines, marker.line, entry)
298
+ );
299
+ }
300
+ return { status: "changed" };
301
+ }
302
+ function otherClaimSpans(lines, pageLines, pin, bodyLine) {
303
+ const width = pageLines.end - pageLines.start + 1;
304
+ const found = findWindows(lines.slice(bodyLine - 1), width, pin, void 0, {
305
+ around: toBodyLines(pageLines, bodyLine).start
306
+ });
307
+ return found.starts.map((start) => toFileLines({ start, end: start + width - 1 }, bodyLine)).filter((span) => span.start !== pageLines.start);
308
+ }
309
+ var NAMED_SPANS = 3;
310
+ function spellElsewhere(spans) {
311
+ const first = spans[0];
312
+ const noun = spans.length === 1 && first !== void 0 && first.start === first.end ? "line" : "lines";
313
+ const named2 = spans.slice(0, NAMED_SPANS).map((span) => spellLines(span));
314
+ const rest = spans.length - named2.length;
315
+ if (rest > 0) return `${noun} ${named2.join(", ")} and ${String(rest)} more`;
316
+ const last = named2.pop() ?? "";
317
+ return named2.length === 0 ? `${noun} ${last}` : `${noun} ${named2.join(", ")} and ${last}`;
318
+ }
319
+ function spanOf(line, recorded) {
320
+ const width = recorded === void 0 ? 1 : Math.max(1, recorded.end - recorded.start + 1);
321
+ return { start: line, end: line + width - 1 };
322
+ }
323
+ function rowsAt(line, lines, recorded, named2) {
324
+ const end = spanOf(line, recorded).end;
325
+ if (end > lines.length) return "table-short";
326
+ for (let n = line; n <= end; n++) {
327
+ if (!isTableRow(lines[n - 1] ?? "")) return "table-short";
328
+ }
329
+ const text = lines.slice(line - 1, end);
330
+ if (!named2 && text.every((row) => isTableSeparator(row))) return "table-rule";
331
+ return { lines: { start: line, end }, kind: "paragraph", text };
332
+ }
333
+ function unitOrWhy(page, line, lines, recorded, named2 = false) {
334
+ if (line < page.bodyLine || line > lines.length) return "outside";
335
+ const own = lines[line - 1] ?? "";
336
+ if (own.trim() === "") return "blank";
337
+ const marker = isMarkerLine(own, page.format);
338
+ if (marker && !named2) return "marker";
339
+ const block = fenceSpanAt(page.content, line, page.format);
340
+ if (block !== void 0) {
341
+ return { lines: block, kind: "block", text: lines.slice(block.start - 1, block.end) };
342
+ }
343
+ const around = fenceAround(page.content, page.bodyOffset, line, page.format);
344
+ if (around !== void 0) {
345
+ const span2 = spanOf(line, recorded);
346
+ return span2.end < around.end ? { lines: span2, kind: "fenced-lines", text: lines.slice(span2.start - 1, span2.end) } : "fence-crossed";
347
+ }
348
+ if (isTableRow(own)) return rowsAt(line, lines, recorded, named2);
349
+ const paragraph = paragraphAfter(
350
+ page.content,
351
+ offsetOfLine(page.content, line),
352
+ marker ? void 0 : page.format
353
+ );
354
+ if (paragraph === void 0 || paragraph.line !== line) return "not-a-paragraph";
355
+ const span = { start: line, end: lineAt(page.content, paragraph.end) };
356
+ return { lines: span, kind: "paragraph", text: lines.slice(span.start - 1, span.end) };
357
+ }
358
+ function unitAt(page, line, lines, recorded, named2 = false) {
359
+ const found = unitOrWhy(page, line, lines, recorded, named2);
360
+ return typeof found === "string" ? void 0 : found;
361
+ }
362
+ function noUnitAt(page, line, lines, recorded, named2 = false) {
363
+ const found = unitOrWhy(page, line, lines, recorded, named2);
364
+ return typeof found === "string" ? found : void 0;
365
+ }
366
+ function markerUnit(page, entry, lines) {
367
+ const { marker, citation } = entry;
368
+ if (marker === void 0) return void 0;
369
+ const span = anchoredLines(page.content, marker.end, page.format, citation.quote === true);
370
+ if (span === void 0 || span.end > lines.length) return void 0;
371
+ return {
372
+ lines: span,
373
+ kind: citation.quote === true ? "block" : "paragraph",
374
+ text: lines.slice(span.start - 1, span.end)
375
+ };
376
+ }
377
+
378
+ // src/cite/core/adapt.ts
379
+ function short(commit) {
380
+ return commit.slice(0, 7);
381
+ }
382
+ function plural(n, noun) {
383
+ return `${String(n)} ${noun}${n === 1 ? "" : "s"}`;
384
+ }
385
+ function citesEncrypted(src) {
386
+ try {
387
+ return parseSrc(src).encrypted;
388
+ } catch {
389
+ return false;
390
+ }
391
+ }
392
+ function missingMessage(source) {
393
+ if (!citesEncrypted(source.src)) return "missing";
394
+ switch (source.missingReason) {
395
+ case "no-key":
396
+ return "missing (no encryption key is available to decrypt it)";
397
+ case "undecryptable":
398
+ return "missing (does not decrypt under the current key)";
399
+ case "untracked":
400
+ return "missing (no tracked file matches; wrong --root?)";
401
+ case "unreadable":
402
+ case void 0:
403
+ return "missing";
404
+ }
405
+ }
406
+ function messageFor(source) {
407
+ switch (source.status) {
408
+ case "current":
409
+ return "current";
410
+ case "skipped":
411
+ return "skipped";
412
+ case "moved":
413
+ return `moved -> ${shortSrc(source.newSrc ?? "?")}`;
414
+ case "moved-ambiguous": {
415
+ const candidates = source.candidates ?? [];
416
+ return `moved, ${plural(candidates.length, "candidate")} (${candidates.map(shortSrc).join(", ")}); widen the range`;
417
+ }
418
+ case "changed": {
419
+ const span = source.newLines === void 0 ? "" : `; now at lines ${source.newLines}`;
420
+ if (source.commitSha === void 0) return `changed${span}`;
421
+ const at2 = short(source.commitSha);
422
+ if (source.historyAvailable === false) {
423
+ return `changed (history unavailable: commit ${at2} not found; fetch-depth: 0)`;
424
+ }
425
+ if (source.commitsSince === void 0) return `changed since ${at2}${span}`;
426
+ return `changed since ${at2}, ${plural(source.commitsSince.length, "commit")}${span}`;
427
+ }
428
+ case "never-true":
429
+ return source.commitSha === void 0 ? "never true: the pin does not match at the recorded commit" : `never true: the pin does not match at ${short(source.commitSha)}`;
430
+ case "missing":
431
+ return missingMessage(source);
432
+ }
433
+ }
434
+ function named(id, text) {
435
+ return id === void 0 ? text : `${id}: ${text}`;
436
+ }
437
+ function at(spec) {
438
+ return spec.includes("-") ? `lines ${spec}` : `line ${spec}`;
439
+ }
440
+ function claimMessageFor(result) {
441
+ const claim = result.claim;
442
+ const id = result.citation.id;
443
+ if (claim === null) return "";
444
+ const where = claim.fileLines ?? (result.markerLine === void 0 ? void 0 : String(result.markerLine));
445
+ switch (claim.status) {
446
+ case "moved":
447
+ return named(
448
+ id,
449
+ `the claim moved from ${at(where ?? "?")} to ${at(claim.newFileLines ?? "?")}.`
450
+ );
451
+ case "moved-ambiguous":
452
+ return named(
453
+ id,
454
+ `the claim at ${at(where ?? "?")} now appears at lines ${listOf(claim.candidateFileLines ?? [])}.`
455
+ );
456
+ case "reanchored": {
457
+ const since = claim.commitSha === void 0 ? "" : ` since ${short(claim.commitSha)}`;
458
+ const to = claim.newFileLines === void 0 ? "" : `, to ${at(claim.newFileLines)}`;
459
+ return named(
460
+ id,
461
+ `the claim at ${at(where ?? "?")} was reanchored${since}${to}. Its words are unchanged.`
462
+ );
463
+ }
464
+ case "changed":
465
+ if (where === void 0) {
466
+ return named(
467
+ id,
468
+ "the claim has no lines and no marker names the entry, so its pin anchors nothing."
469
+ );
470
+ }
471
+ return named(id, `the claim at ${at(where)} has ${claimChange(claim)}`);
472
+ case "current":
473
+ case "skipped":
474
+ return "";
475
+ }
476
+ }
477
+ function claimChange(claim) {
478
+ if (claim.historyAvailable === false) {
479
+ return "changed since it was pinned (history unavailable; fetch-depth: 0).";
480
+ }
481
+ if (claim.commitSha === void 0) return "changed since it was pinned.";
482
+ const at2 = short(claim.commitSha);
483
+ const since = claim.commitsSince ?? [];
484
+ const count = since.length === 0 ? "uncommitted" : plural(since.length, "commit");
485
+ return `changed since ${at2}, ${count}.`;
486
+ }
487
+ function misplacedMessageFor(id, marker) {
488
+ const place = marker.block ? `above the block at line ${String(marker.place)}` : `above line ${String(marker.place)}`;
489
+ return named(
490
+ id,
491
+ `the marker at line ${String(marker.line)} splits the paragraph at ${at(marker.unit)}. Its place is ${place}.`
492
+ );
493
+ }
494
+ function sourceRuleOf(status) {
495
+ if (status === "skipped" || status === "current") return void 0;
496
+ return `source-${status}`;
497
+ }
498
+ function claimRuleOf(claim) {
499
+ const status = claim.status;
500
+ if (status === "skipped" || status === "current") return void 0;
501
+ return `claim-${status}`;
502
+ }
503
+ function entrySite(result) {
504
+ const site = {};
505
+ if (result.origin.line !== void 0) site.line = result.origin.line;
506
+ if (result.origin.kind === "manifest") site.file = result.origin.file;
507
+ return site;
508
+ }
509
+ function anchorSite(result) {
510
+ if (result.anchorLine !== void 0) return { line: result.anchorLine };
511
+ return entrySite(result);
512
+ }
513
+ function findingsFor(results, severity) {
514
+ const out = [];
515
+ const push = (result, rule, message, site, extra) => {
516
+ const level = severity[rule];
517
+ if (level === "off") return;
518
+ const finding = {
519
+ rule,
520
+ ruleId: ruleId(rule),
521
+ severity: level,
522
+ message,
523
+ src: result.source.src,
524
+ index: result.origin.index
525
+ };
526
+ if (site.line !== void 0) finding.line = site.line;
527
+ if (site.file !== void 0) finding.file = site.file;
528
+ if (result.citation.id !== void 0) finding.id = result.citation.id;
529
+ if (extra?.newSrc !== void 0) finding.newSrc = extra.newSrc;
530
+ out.push(finding);
531
+ };
532
+ for (const result of results) {
533
+ const claim = result.claim;
534
+ if (claim !== null) {
535
+ const rule2 = claimRuleOf(claim);
536
+ if (rule2 !== void 0) {
537
+ const site = claimLine(claim) === void 0 && result.markerLine === void 0 ? entrySite(result) : { line: claimLine(claim) ?? result.markerLine };
538
+ push(result, rule2, claimMessageFor(result), site);
539
+ }
540
+ }
541
+ const rule = sourceRuleOf(result.source.status);
542
+ if (rule === void 0) continue;
543
+ const extra = result.source.newSrc === void 0 ? void 0 : { newSrc: result.source.newSrc };
544
+ push(result, rule, messageFor(result.source), anchorSite(result), extra);
545
+ }
546
+ return out;
547
+ }
548
+ function integrityFor(finding, results) {
549
+ if (finding.index === void 0) return void 0;
550
+ return results.find((r) => r.origin.index === finding.index)?.citation.source.integrity;
551
+ }
552
+ function errorSite(finding) {
553
+ if (finding.file === void 0) {
554
+ return finding.line === void 0 ? {} : { line: finding.line };
555
+ }
556
+ if (finding.file.startsWith("../") || isAbsolute(finding.file)) return {};
557
+ return {
558
+ file: finding.file,
559
+ ...finding.line === void 0 ? {} : { line: finding.line }
560
+ };
561
+ }
562
+ function toValidationResult(report) {
563
+ const errors = report.findings.map((finding) => {
564
+ const error = {
565
+ schema: RULE_ID_PREFIX,
566
+ instancePath: finding.index === void 0 ? "" : `/citations/${String(finding.index)}`,
567
+ message: finding.message,
568
+ keyword: finding.rule,
569
+ severity: finding.severity
570
+ };
571
+ const subject = finding.id ?? integrityFor(finding, report.citations);
572
+ if (subject !== void 0) error.subject = subject;
573
+ const site = errorSite(finding);
574
+ if (site.file !== void 0) error.file = site.file;
575
+ if (site.line !== void 0) error.line = site.line;
576
+ return error;
577
+ });
578
+ return {
579
+ file: report.file,
580
+ format: report.format,
581
+ ok: !errors.some(isErrorSeverity),
582
+ schemas: [RULE_ID_PREFIX],
583
+ errors
584
+ };
585
+ }
586
+
587
+ export {
588
+ isUnitText,
589
+ markerRunAt,
590
+ splitUnit,
591
+ pre43Span,
592
+ misplacedMarkerAt,
593
+ misplacedMarkers,
594
+ movedUnit,
595
+ unitText,
596
+ applyMarkerMoves,
597
+ markerClaimEnd,
598
+ normalizeWhitespace,
599
+ blockMatches,
600
+ claimLine,
601
+ claimLineNow,
602
+ claimLinesNow,
603
+ claimEnd,
604
+ otherClaimSpans,
605
+ spellElsewhere,
606
+ unitAt,
607
+ noUnitAt,
608
+ markerUnit,
609
+ shortPin,
610
+ shortCommit,
611
+ shortSrc,
612
+ shortLine,
613
+ spellAt,
614
+ listOf,
615
+ messageFor,
616
+ claimMessageFor,
617
+ misplacedMessageFor,
618
+ findingsFor,
619
+ errorSite,
620
+ toValidationResult
621
+ };
622
+ //# sourceMappingURL=chunk-252LNOEG.js.map