@hawkeyexl/manni 2.3.6 → 2.3.8

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.
@@ -61,7 +61,7 @@ import {
61
61
  supportedExtensions,
62
62
  terminalConfirm,
63
63
  toJsonText
64
- } from "./chunk-UUXTFBWD.js";
64
+ } from "./chunk-EYD2RYKV.js";
65
65
 
66
66
  // src/meta/cli.ts
67
67
  import { existsSync } from "node:fs";
@@ -1517,4 +1517,4 @@ export {
1517
1517
  reportConfig,
1518
1518
  buildProgram
1519
1519
  };
1520
- //# sourceMappingURL=chunk-3TVBXXJD.js.map
1520
+ //# sourceMappingURL=chunk-L73SKPCW.js.map
@@ -70,7 +70,7 @@ import {
70
70
  withValueAt,
71
71
  writeEncryptionKey,
72
72
  writeFileAtomic
73
- } from "./chunk-UUXTFBWD.js";
73
+ } from "./chunk-EYD2RYKV.js";
74
74
 
75
75
  // src/meta/core/reencrypt.ts
76
76
  import { extname } from "node:path";
@@ -2997,6 +2997,12 @@ async function runAdd(opts) {
2997
2997
  `${at2} runs past the ${holding.kind} at ${spellAt(holding)}. A marker anchors one paragraph.`
2998
2998
  );
2999
2999
  }
3000
+ const unitWide = tooWide({ start: holding.start, end: holding.end });
3001
+ if (unitWide !== void 0) {
3002
+ throw new CiteError(
3003
+ `${at2} is in a ${holding.kind} at ${spellAt(holding)} that ${unitWide}. A marker anchors the whole ${holding.kind}.`
3004
+ );
3005
+ }
3000
3006
  shifted = shiftedEntries(page.citations, holding.start, page.bodyLine, label);
3001
3007
  const statement = markerIndent(content, holding.start, format, page.bodyLine) + formatStatement(format, { kind: "ref", id: opts.id ?? "" });
3002
3008
  const insertAt = offsetOfLine(content, holding.start);
@@ -3213,6 +3219,9 @@ function rewriteOf(plan) {
3213
3219
  at: plan.unit.lines.start,
3214
3220
  text: normalizeWhitespace(plan.unit.text.join("\n"))
3215
3221
  };
3222
+ if (plan.result.anchor === "marker" && plan.result.markerLine !== void 0) {
3223
+ out.markerLine = plan.result.markerLine;
3224
+ }
3216
3225
  return out;
3217
3226
  }
3218
3227
  case "source-accepted": {
@@ -3239,7 +3248,7 @@ async function runUpdate(opts) {
3239
3248
  const manifests = new ManifestSet();
3240
3249
  const only = opts.only !== void 0 && opts.only.length > 0 ? new Set(opts.only) : void 0;
3241
3250
  const accept = opts.accept === true;
3242
- const plansFor = async (result, entry, page, lines) => {
3251
+ const plansFor = async (result, entry, page, lines, declined) => {
3243
3252
  const out = [];
3244
3253
  const claim = result.claim;
3245
3254
  if (claim !== null && claim.status === "moved" && claim.newLines !== void 0) {
@@ -3268,7 +3277,10 @@ async function runUpdate(opts) {
3268
3277
  })();
3269
3278
  const wantsBlock = entry.citation.quote === true;
3270
3279
  const pin = unit === void 0 ? void 0 : pinOfLines(lines, unit.lines);
3271
- if (unit !== void 0 && pin !== void 0 && (!wantsBlock || unit.kind === "block")) {
3280
+ const wide = unit === void 0 ? void 0 : tooWide(unit.lines);
3281
+ if (unit !== void 0 && wide !== void 0) {
3282
+ declined.set(result.origin.index, `Not re-pinned: the ${unit.kind} ${wide}.`);
3283
+ } else if (unit !== void 0 && pin !== void 0 && (!wantsBlock || unit.kind === "block")) {
3272
3284
  const plan = { kind: "claim-accepted", result, unit, pin };
3273
3285
  if (entry.citation.claim?.lines !== void 0) {
3274
3286
  const body = toBodyLines(unit.lines, page.bodyLine);
@@ -3311,6 +3323,7 @@ async function runUpdate(opts) {
3311
3323
  const lines = splitLines(content);
3312
3324
  const rewritten2 = [];
3313
3325
  const settled = /* @__PURE__ */ new Set();
3326
+ const declined = /* @__PURE__ */ new Map();
3314
3327
  let after = content;
3315
3328
  const owner = setup.sidecar?.owner;
3316
3329
  const entries = setup.sidecar?.citations === void 0 ? void 0 : JSON.parse(JSON.stringify(setup.sidecar.citations.map((c) => c.entry)));
@@ -3320,7 +3333,7 @@ async function runUpdate(opts) {
3320
3333
  continue;
3321
3334
  }
3322
3335
  const entry = page.citations.find((c) => c.origin.index === result.origin.index);
3323
- for (const plan of await plansFor(result, entry, page, lines)) {
3336
+ for (const plan of await plansFor(result, entry, page, lines, declined)) {
3324
3337
  if (result.origin.kind === "manifest") {
3325
3338
  if (entries === void 0 || !applyToEntry(entries[result.origin.index], plan)) continue;
3326
3339
  manifestDirty = true;
@@ -3341,7 +3354,10 @@ async function runUpdate(opts) {
3341
3354
  }
3342
3355
  const skipped2 = report.findings.filter(
3343
3356
  (finding2) => (only === void 0 || finding2.id !== void 0 && only.has(finding2.id)) && !settled.has(`${String(finding2.index ?? -1)}\0${finding2.rule}`)
3344
- );
3357
+ ).map((finding2) => {
3358
+ const why = finding2.rule === "claim-changed" && finding2.index !== void 0 ? declined.get(finding2.index) : void 0;
3359
+ return why === void 0 ? finding2 : { ...finding2, message: `${finding2.message} ${why}` };
3360
+ });
3345
3361
  const diff = after === content ? "" : unifiedDiff(label, content, after);
3346
3362
  const written = after !== content && path !== void 0 && opts.dryRun !== true;
3347
3363
  if (written) await writeFileAtomic(path, after);
@@ -3600,6 +3616,22 @@ function claimLines(result, dim) {
3600
3616
  if (more > 0) out.push(dim(` \u2026 (${plural2(more, "more line")})`));
3601
3617
  return out;
3602
3618
  }
3619
+ function anchorSortLine(result) {
3620
+ if (result.anchor === "marker" && result.markerLine !== void 0) return result.markerLine;
3621
+ const first = result.claim?.fileLines?.split("-")[0];
3622
+ if (first === void 0) return void 0;
3623
+ const line = Number.parseInt(first, 10);
3624
+ return Number.isNaN(line) ? void 0 : line;
3625
+ }
3626
+ function rowOrder(citations) {
3627
+ return [...citations].sort((a, b) => {
3628
+ const left = anchorSortLine(a);
3629
+ const right = anchorSortLine(b);
3630
+ if (left === void 0) return right === void 0 ? 0 : 1;
3631
+ if (right === void 0) return -1;
3632
+ return left - right;
3633
+ });
3634
+ }
3603
3635
  function padTo(text, width, plain) {
3604
3636
  return width <= plain ? text : text + " ".repeat(width - plain);
3605
3637
  }
@@ -3628,7 +3660,7 @@ function renderCheckPretty(run3, opts) {
3628
3660
  const isBaselined = new Set(baselined2);
3629
3661
  const placed = /* @__PURE__ */ new Set();
3630
3662
  const rows = [];
3631
- for (const result of page.citations) {
3663
+ for (const result of rowOrder(page.citations)) {
3632
3664
  const own = page.findings.filter((f) => belongsTo(f, result) && !placed.has(f));
3633
3665
  for (const finding2 of own) placed.add(finding2);
3634
3666
  const live = own.filter((f) => !isBaselined.has(f));
@@ -3701,7 +3733,8 @@ function rewriteLine(rewrite) {
3701
3733
  return rewrite.end === "claim" ? `claim ${word} ${rewrite.from} -> ${rewrite.to} (moved)` : `source ${shortSrc(rewrite.from)} -> ${shortSrc(rewrite.to)} (moved)`;
3702
3734
  }
3703
3735
  if (rewrite.end === "claim") {
3704
- return `claim at line ${String(rewrite.at ?? 0)} re-pinned (${status}; now "${rewrite.text ?? ""}")`;
3736
+ const where = rewrite.markerLine === void 0 ? `line ${String(rewrite.at ?? 0)}` : `marker line ${String(rewrite.markerLine)}`;
3737
+ return `claim at ${where} re-pinned (${status}; now "${rewrite.text ?? ""}")`;
3705
3738
  }
3706
3739
  const at2 = rewrite.commitSha === void 0 ? "" : ` at ${shortCommit(rewrite.commitSha)}`;
3707
3740
  return `source ${shortSrc(rewrite.src ?? "")} re-pinned${at2} (${status}; ${shortPin(rewrite.from)} -> ${shortPin(rewrite.to)})`;
@@ -3781,7 +3814,11 @@ function renderCheckJson(run3) {
3781
3814
  return JSON.stringify({ summary: run3.summary, pages: run3.pages.map(publicPage) }, null, 2);
3782
3815
  }
3783
3816
  function renderUpdateJson(run3) {
3784
- return JSON.stringify(run3, null, 2);
3817
+ const pages = run3.pages.map((page) => ({
3818
+ ...page,
3819
+ rewritten: page.rewritten.map(({ markerLine: _pretty, ...rewrite }) => rewrite)
3820
+ }));
3821
+ return JSON.stringify({ ...run3, pages }, null, 2);
3785
3822
  }
3786
3823
 
3787
3824
  // src/cite/reporters/github.ts
@@ -4265,4 +4302,4 @@ export {
4265
4302
  runKeyRotate,
4266
4303
  runKeySet
4267
4304
  };
4268
- //# sourceMappingURL=chunk-CGE2SVW7.js.map
4305
+ //# sourceMappingURL=chunk-TIZE6GXU.js.map