@hawkeyexl/manni 2.10.0 → 2.10.2
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.
- package/README.md +1 -1
- package/dist/{chunk-FHRU3GN6.js → chunk-4HKOQIJL.js} +77 -4
- package/dist/chunk-4HKOQIJL.js.map +1 -0
- package/dist/{chunk-XXNHE2IW.js → chunk-H5ZFSHG2.js} +2 -2
- package/dist/{chunk-ROAPSWWB.js → chunk-KJLPOY2I.js} +2 -2
- package/dist/{chunk-ROAPSWWB.js.map → chunk-KJLPOY2I.js.map} +1 -1
- package/dist/cli.js +15 -8
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-FHRU3GN6.js.map +0 -1
- /package/dist/{chunk-XXNHE2IW.js.map → chunk-H5ZFSHG2.js.map} +0 -0
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
withValueAt,
|
|
76
76
|
writeEncryptionKey,
|
|
77
77
|
writeFileAtomic
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-KJLPOY2I.js";
|
|
79
79
|
|
|
80
80
|
// src/meta/core/reencrypt.ts
|
|
81
81
|
import { extname } from "node:path";
|
|
@@ -3488,6 +3488,15 @@ async function commitFor(opts) {
|
|
|
3488
3488
|
if (client === void 0 || !await client.available()) return void 0;
|
|
3489
3489
|
return await client.head() ?? void 0;
|
|
3490
3490
|
}
|
|
3491
|
+
async function assertCommitHolds(opts, commit, path, range, pin, key) {
|
|
3492
|
+
const client = opts.gitClient;
|
|
3493
|
+
if (client === void 0 || !await client.available()) return;
|
|
3494
|
+
const history = await historyOf(client, commit, path, range, pin, key, void 0);
|
|
3495
|
+
if (history.kind !== "never-true") return;
|
|
3496
|
+
throw new CiteError(
|
|
3497
|
+
`${opts.src} is not committed: ${commit.slice(0, 7)} does not contain those lines. Commit the source, or use --no-commit-sha.`
|
|
3498
|
+
);
|
|
3499
|
+
}
|
|
3491
3500
|
function refusalFor(reason, path, encrypted) {
|
|
3492
3501
|
switch (reason) {
|
|
3493
3502
|
case "untracked":
|
|
@@ -3521,7 +3530,11 @@ async function mintCitation(opts) {
|
|
|
3521
3530
|
const file = pinKey !== void 0 && !range.encrypted ? encryptSourcePath(read.resolvedPath, pinKey) : range.path;
|
|
3522
3531
|
const lines = rangeLines(range);
|
|
3523
3532
|
const commitSha = await commitFor(opts);
|
|
3524
|
-
const
|
|
3533
|
+
const integrity = hashLines(joined, pinKey);
|
|
3534
|
+
if (commitSha !== void 0) {
|
|
3535
|
+
await assertCommitHolds(opts, commitSha, read.resolvedPath, range, integrity, pinKey);
|
|
3536
|
+
}
|
|
3537
|
+
const source = { file, integrity };
|
|
3525
3538
|
const ordered = {
|
|
3526
3539
|
file: source.file,
|
|
3527
3540
|
...lines === void 0 ? {} : { lines },
|
|
@@ -4505,8 +4518,11 @@ function settles(plan) {
|
|
|
4505
4518
|
// refusal prints, so it is not also reported as skipped.
|
|
4506
4519
|
case "claim-replaced":
|
|
4507
4520
|
return "claim-changed";
|
|
4508
|
-
// A shifted entry was `current`, so it had no finding to settle.
|
|
4521
|
+
// A shifted entry was `current`, so it had no finding to settle. A
|
|
4522
|
+
// re-committed one was `current` too: `check` never reported it, which is
|
|
4523
|
+
// why the repair is asked for rather than offered.
|
|
4509
4524
|
case "claim-shifted":
|
|
4525
|
+
case "source-recommitted":
|
|
4510
4526
|
return "";
|
|
4511
4527
|
}
|
|
4512
4528
|
}
|
|
@@ -4544,6 +4560,8 @@ function apply2(content, format, plan) {
|
|
|
4544
4560
|
}
|
|
4545
4561
|
return out;
|
|
4546
4562
|
}
|
|
4563
|
+
case "source-recommitted":
|
|
4564
|
+
return spliceEntryField(content, format, index, ["source", "commit-sha"], plan.commitSha);
|
|
4547
4565
|
case "claim-accepted": {
|
|
4548
4566
|
let out = spliceEntryField(content, format, index, ["claim", "integrity"], plan.pin);
|
|
4549
4567
|
if (plan.lines !== void 0) {
|
|
@@ -4612,6 +4630,12 @@ function applyToEntry(entry, plan) {
|
|
|
4612
4630
|
if (plan.commitSha !== void 0) source["commit-sha"] = plan.commitSha;
|
|
4613
4631
|
return true;
|
|
4614
4632
|
}
|
|
4633
|
+
case "source-recommitted": {
|
|
4634
|
+
const source = end("source");
|
|
4635
|
+
if (source === void 0) return false;
|
|
4636
|
+
source["commit-sha"] = plan.commitSha;
|
|
4637
|
+
return true;
|
|
4638
|
+
}
|
|
4615
4639
|
case "claim-accepted": {
|
|
4616
4640
|
const claim = end("claim");
|
|
4617
4641
|
if (claim === void 0) return false;
|
|
@@ -4728,6 +4752,19 @@ function rewriteOf(plan) {
|
|
|
4728
4752
|
from: source.src,
|
|
4729
4753
|
to: plan.to
|
|
4730
4754
|
};
|
|
4755
|
+
case "source-recommitted":
|
|
4756
|
+
return {
|
|
4757
|
+
...base,
|
|
4758
|
+
end: "source",
|
|
4759
|
+
reason: "recommitted",
|
|
4760
|
+
// The source itself held. Only its date was wrong.
|
|
4761
|
+
status: "current",
|
|
4762
|
+
from: plan.from,
|
|
4763
|
+
to: plan.commitSha,
|
|
4764
|
+
fromCommit: plan.from,
|
|
4765
|
+
toCommit: plan.commitSha,
|
|
4766
|
+
src: source.src
|
|
4767
|
+
};
|
|
4731
4768
|
case "claim-accepted": {
|
|
4732
4769
|
const was = citation.claim?.integrity ?? "";
|
|
4733
4770
|
const out = {
|
|
@@ -4927,6 +4964,26 @@ async function runUpdate(opts) {
|
|
|
4927
4964
|
const writes = new WrittenFiles();
|
|
4928
4965
|
const only = opts.only !== void 0 && opts.only.length > 0 ? new Set(opts.only) : void 0;
|
|
4929
4966
|
const accept = opts.accept === true;
|
|
4967
|
+
const recommit = opts.recommit === true;
|
|
4968
|
+
if (recommit && !await git.available()) {
|
|
4969
|
+
throw new CiteError(
|
|
4970
|
+
"--recommit needs git to verify recorded commits, and git is not available here."
|
|
4971
|
+
);
|
|
4972
|
+
}
|
|
4973
|
+
const recommitFor = async (result) => {
|
|
4974
|
+
const recorded = result.citation.source["commit-sha"];
|
|
4975
|
+
const path = result.source.resolvedPath;
|
|
4976
|
+
if (recorded === void 0 || path === void 0) return void 0;
|
|
4977
|
+
const range = sourceRange(result.citation.source);
|
|
4978
|
+
const pin = result.citation.source.integrity;
|
|
4979
|
+
const key = range.encrypted ? run3.key : void 0;
|
|
4980
|
+
const was = await historyOf(git, recorded, path, range, pin, key, void 0);
|
|
4981
|
+
if (was.kind !== "never-true") return void 0;
|
|
4982
|
+
const head = await git.head();
|
|
4983
|
+
if (head === null || head === recorded) return void 0;
|
|
4984
|
+
const now = await historyOf(git, head, path, range, pin, key, void 0);
|
|
4985
|
+
return now.kind === "original" ? head : void 0;
|
|
4986
|
+
};
|
|
4930
4987
|
const plansFor = async (result, entry, page, lines, lineNow, declined) => {
|
|
4931
4988
|
const out = [];
|
|
4932
4989
|
const claim = result.claim;
|
|
@@ -5018,6 +5075,17 @@ async function runUpdate(opts) {
|
|
|
5018
5075
|
}
|
|
5019
5076
|
}
|
|
5020
5077
|
}
|
|
5078
|
+
if (recommit && result.source.status === "current") {
|
|
5079
|
+
const to = await recommitFor(result);
|
|
5080
|
+
if (to !== void 0) {
|
|
5081
|
+
out.push({
|
|
5082
|
+
kind: "source-recommitted",
|
|
5083
|
+
result,
|
|
5084
|
+
from: result.citation.source["commit-sha"] ?? "",
|
|
5085
|
+
commitSha: to
|
|
5086
|
+
});
|
|
5087
|
+
}
|
|
5088
|
+
}
|
|
5021
5089
|
if (!accept) return out;
|
|
5022
5090
|
if (claim !== null && claim.status === "changed" && entry !== void 0 && result.anchor !== "marker") {
|
|
5023
5091
|
const held = claim.fileLines === void 0 ? void 0 : parseLines(claim.fileLines);
|
|
@@ -5753,6 +5821,11 @@ function rewriteLine(rewrite) {
|
|
|
5753
5821
|
if (rewrite.end === "marker") {
|
|
5754
5822
|
return `marker line ${rewrite.from} -> ${rewrite.to} (misplaced)`;
|
|
5755
5823
|
}
|
|
5824
|
+
if (rewrite.reason === "recommitted") {
|
|
5825
|
+
const from = shortCommit(rewrite.fromCommit ?? "");
|
|
5826
|
+
const to = shortCommit(rewrite.toCommit ?? "");
|
|
5827
|
+
return `source ${shortSrc(rewrite.src ?? "")} commit ${from} -> ${to} (did not contain the pinned lines)`;
|
|
5828
|
+
}
|
|
5756
5829
|
if (rewrite.reason === "shifted") {
|
|
5757
5830
|
return `claim ${word} ${rewrite.from} -> ${rewrite.to} (shifted by a marker)`;
|
|
5758
5831
|
}
|
|
@@ -6413,4 +6486,4 @@ export {
|
|
|
6413
6486
|
runKeyRotate,
|
|
6414
6487
|
runKeySet
|
|
6415
6488
|
};
|
|
6416
|
-
//# sourceMappingURL=chunk-
|
|
6489
|
+
//# sourceMappingURL=chunk-4HKOQIJL.js.map
|