@hawkeyexl/manni 2.3.7 → 2.3.9

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.
@@ -70,7 +70,7 @@ import {
70
70
  withValueAt,
71
71
  writeEncryptionKey,
72
72
  writeFileAtomic
73
- } from "./chunk-D5FTEP3H.js";
73
+ } from "./chunk-LC4H35XX.js";
74
74
 
75
75
  // src/meta/core/reencrypt.ts
76
76
  import { extname } from "node:path";
@@ -2594,7 +2594,8 @@ async function resolveCiteRun(opts) {
2594
2594
  const cwd = resolve2(opts.cwd);
2595
2595
  const env = opts.env ?? process.env;
2596
2596
  const wanted = opts.collection ?? [];
2597
- if (wanted.length > 0 && opts.inputs.some((input) => input !== STDIN)) {
2597
+ const typedInputs = opts.inputs.filter((input) => input !== STDIN);
2598
+ if (wanted.length > 0 && typedInputs.length > 0) {
2598
2599
  throw new CiteError(
2599
2600
  "--collection selects a configured collection; it cannot be combined with paths."
2600
2601
  );
@@ -2607,9 +2608,10 @@ async function resolveCiteRun(opts) {
2607
2608
  if (loaded) opts.onConfigLoaded?.({ path: loaded.path, dir: loaded.dir });
2608
2609
  const config = loaded ? loaded.config : null;
2609
2610
  const collections = loaded ? selectCollections(loaded.collections, wanted, loaded.source, (message) => new CiteError(message)) : [];
2610
- const fromCollections = opts.inputs.length === 0;
2611
- const inputs = fromCollections ? collections.flatMap((c) => c.paths) : opts.inputs;
2612
- const base = fromCollections && inputs.length > 0 && loaded ? loaded.dir : cwd;
2611
+ const fromCollections = wanted.length > 0 || opts.inputs.length === 0;
2612
+ const collectionPaths = fromCollections ? collections.flatMap((c) => c.paths) : [];
2613
+ const inputs = fromCollections ? [...opts.inputs, ...collectionPaths] : opts.inputs;
2614
+ const base = collectionPaths.length > 0 && loaded ? loaded.dir : cwd;
2613
2615
  let root;
2614
2616
  if (opts.root !== void 0) {
2615
2617
  root = resolve2(cwd, opts.root);
@@ -2997,6 +2999,12 @@ async function runAdd(opts) {
2997
2999
  `${at2} runs past the ${holding.kind} at ${spellAt(holding)}. A marker anchors one paragraph.`
2998
3000
  );
2999
3001
  }
3002
+ const unitWide = tooWide({ start: holding.start, end: holding.end });
3003
+ if (unitWide !== void 0) {
3004
+ throw new CiteError(
3005
+ `${at2} is in a ${holding.kind} at ${spellAt(holding)} that ${unitWide}. A marker anchors the whole ${holding.kind}.`
3006
+ );
3007
+ }
3000
3008
  shifted = shiftedEntries(page.citations, holding.start, page.bodyLine, label);
3001
3009
  const statement = markerIndent(content, holding.start, format, page.bodyLine) + formatStatement(format, { kind: "ref", id: opts.id ?? "" });
3002
3010
  const insertAt = offsetOfLine(content, holding.start);
@@ -3242,7 +3250,7 @@ async function runUpdate(opts) {
3242
3250
  const manifests = new ManifestSet();
3243
3251
  const only = opts.only !== void 0 && opts.only.length > 0 ? new Set(opts.only) : void 0;
3244
3252
  const accept = opts.accept === true;
3245
- const plansFor = async (result, entry, page, lines) => {
3253
+ const plansFor = async (result, entry, page, lines, declined) => {
3246
3254
  const out = [];
3247
3255
  const claim = result.claim;
3248
3256
  if (claim !== null && claim.status === "moved" && claim.newLines !== void 0) {
@@ -3271,7 +3279,10 @@ async function runUpdate(opts) {
3271
3279
  })();
3272
3280
  const wantsBlock = entry.citation.quote === true;
3273
3281
  const pin = unit === void 0 ? void 0 : pinOfLines(lines, unit.lines);
3274
- if (unit !== void 0 && pin !== void 0 && (!wantsBlock || unit.kind === "block")) {
3282
+ const wide = unit === void 0 ? void 0 : tooWide(unit.lines);
3283
+ if (unit !== void 0 && wide !== void 0) {
3284
+ declined.set(result.origin.index, `Not re-pinned: the ${unit.kind} ${wide}.`);
3285
+ } else if (unit !== void 0 && pin !== void 0 && (!wantsBlock || unit.kind === "block")) {
3275
3286
  const plan = { kind: "claim-accepted", result, unit, pin };
3276
3287
  if (entry.citation.claim?.lines !== void 0) {
3277
3288
  const body = toBodyLines(unit.lines, page.bodyLine);
@@ -3314,6 +3325,7 @@ async function runUpdate(opts) {
3314
3325
  const lines = splitLines(content);
3315
3326
  const rewritten2 = [];
3316
3327
  const settled = /* @__PURE__ */ new Set();
3328
+ const declined = /* @__PURE__ */ new Map();
3317
3329
  let after = content;
3318
3330
  const owner = setup.sidecar?.owner;
3319
3331
  const entries = setup.sidecar?.citations === void 0 ? void 0 : JSON.parse(JSON.stringify(setup.sidecar.citations.map((c) => c.entry)));
@@ -3323,7 +3335,7 @@ async function runUpdate(opts) {
3323
3335
  continue;
3324
3336
  }
3325
3337
  const entry = page.citations.find((c) => c.origin.index === result.origin.index);
3326
- for (const plan of await plansFor(result, entry, page, lines)) {
3338
+ for (const plan of await plansFor(result, entry, page, lines, declined)) {
3327
3339
  if (result.origin.kind === "manifest") {
3328
3340
  if (entries === void 0 || !applyToEntry(entries[result.origin.index], plan)) continue;
3329
3341
  manifestDirty = true;
@@ -3344,7 +3356,10 @@ async function runUpdate(opts) {
3344
3356
  }
3345
3357
  const skipped2 = report.findings.filter(
3346
3358
  (finding2) => (only === void 0 || finding2.id !== void 0 && only.has(finding2.id)) && !settled.has(`${String(finding2.index ?? -1)}\0${finding2.rule}`)
3347
- );
3359
+ ).map((finding2) => {
3360
+ const why = finding2.rule === "claim-changed" && finding2.index !== void 0 ? declined.get(finding2.index) : void 0;
3361
+ return why === void 0 ? finding2 : { ...finding2, message: `${finding2.message} ${why}` };
3362
+ });
3348
3363
  const diff = after === content ? "" : unifiedDiff(label, content, after);
3349
3364
  const written = after !== content && path !== void 0 && opts.dryRun !== true;
3350
3365
  if (written) await writeFileAtomic(path, after);
@@ -3818,7 +3833,7 @@ var NAMES_ITS_SUBJECT = /* @__PURE__ */ new Set([
3818
3833
  "marker-repeated",
3819
3834
  "anchor-invalid"
3820
3835
  ]);
3821
- function annotationMessage(finding2) {
3836
+ function findingMessage(finding2) {
3822
3837
  const subject = finding2.id ?? finding2.src;
3823
3838
  if (subject === void 0) return finding2.message;
3824
3839
  if (NAMES_ITS_SUBJECT.has(finding2.rule)) return finding2.message;
@@ -3836,7 +3851,7 @@ function renderCheckGithub(run3) {
3836
3851
  if (site.line !== void 0) params.push(`line=${String(site.line)}`);
3837
3852
  params.push(`title=${escapeWorkflowCommandProperty(finding2.ruleId)}`);
3838
3853
  lines.push(
3839
- `::${finding2.severity} ${params.join(",")}::${escapeWorkflowCommandMessage(annotationMessage(finding2))}`
3854
+ `::${finding2.severity} ${params.join(",")}::${escapeWorkflowCommandMessage(findingMessage(finding2))}`
3840
3855
  );
3841
3856
  }
3842
3857
  });
@@ -4272,8 +4287,11 @@ export {
4272
4287
  codeEndAt,
4273
4288
  CiteError,
4274
4289
  asCiteError,
4290
+ RULE_ID_PREFIX,
4291
+ isCiteRule,
4275
4292
  spellSource,
4276
4293
  runAdd,
4294
+ errorSite,
4277
4295
  runCheck,
4278
4296
  runUpdate,
4279
4297
  shortPin,
@@ -4281,6 +4299,7 @@ export {
4281
4299
  shortSrc,
4282
4300
  renderCheckPretty,
4283
4301
  renderUpdatePretty,
4302
+ findingMessage,
4284
4303
  renderCheckGithub,
4285
4304
  renderCheckJson,
4286
4305
  renderUpdateJson,
@@ -4289,4 +4308,4 @@ export {
4289
4308
  runKeyRotate,
4290
4309
  runKeySet
4291
4310
  };
4292
- //# sourceMappingURL=chunk-Y2XNDEM6.js.map
4311
+ //# sourceMappingURL=chunk-YSI2VNKE.js.map