@hawkeyexl/manni 2.0.1 → 2.1.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.
- package/README.md +1 -1
- package/dist/{chunk-PDNSN5UJ.js → chunk-2DC2GSRH.js} +2077 -312
- package/dist/chunk-2DC2GSRH.js.map +1 -0
- package/dist/{chunk-MV2T7XAW.js → chunk-HNPRXGD7.js} +16 -58
- package/dist/chunk-HNPRXGD7.js.map +1 -0
- package/dist/{chunk-QLVNSAHR.js → chunk-UTXTVCBV.js} +156 -547
- package/dist/chunk-UTXTVCBV.js.map +1 -0
- package/dist/cli.js +10 -18
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +4 -3
- package/dist/docmeta.js.map +1 -1
- package/dist/index.d.ts +257 -68
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-MV2T7XAW.js.map +0 -1
- package/dist/chunk-PDNSN5UJ.js.map +0 -1
- package/dist/chunk-QLVNSAHR.js.map +0 -1
package/dist/docmeta.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
buildProgram
|
|
3
|
+
buildProgram
|
|
4
|
+
} from "./chunk-HNPRXGD7.js";
|
|
5
|
+
import {
|
|
4
6
|
runIfMain
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-PDNSN5UJ.js";
|
|
7
|
+
} from "./chunk-2DC2GSRH.js";
|
|
7
8
|
|
|
8
9
|
// src/docmeta.ts
|
|
9
10
|
runIfMain(import.meta.url, () => buildProgram().name("docmeta"));
|
package/dist/docmeta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/docmeta.ts"],"sourcesContent":["/**\n * The `docmeta` bin: the metadata tool under the name it had before it became\n * `manni meta`. Same program, same options, same exit codes, so a script or\n * workflow written against `docmeta …` keeps working. Only the usage line and\n * the stderr prefix say `docmeta`.\n */\nimport { buildProgram } from \"./meta/cli.js\";\nimport { runIfMain } from \"./shared/run.js\";\n\nrunIfMain(import.meta.url, () => buildProgram().name(\"docmeta\"));\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/docmeta.ts"],"sourcesContent":["/**\n * The `docmeta` bin: the metadata tool under the name it had before it became\n * `manni meta`. Same program, same options, same exit codes, so a script or\n * workflow written against `docmeta …` keeps working. Only the usage line and\n * the stderr prefix say `docmeta`.\n */\nimport { buildProgram } from \"./meta/cli.js\";\nimport { runIfMain } from \"./shared/run.js\";\n\nrunIfMain(import.meta.url, () => buildProgram().name(\"docmeta\"));\n"],"mappings":";;;;;;;;;AASA,UAAU,YAAY,KAAK,MAAM,aAAa,EAAE,KAAK,SAAS,CAAC;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -402,6 +402,126 @@ interface ConfigFile {
|
|
|
402
402
|
encryptionKeyPrevious?: string;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
+
/** Lines as an entry writes them: an integer for one line, `"L1-L2"` for several. */
|
|
406
|
+
type LineSpec = number | string;
|
|
407
|
+
/** Page lines as an editor numbers them, 1-based and inclusive. */
|
|
408
|
+
interface PageLines {
|
|
409
|
+
start: number;
|
|
410
|
+
end: number;
|
|
411
|
+
}
|
|
412
|
+
/** A 1-based inclusive range, either end optional: no `start` is the whole text, no `end` one line. */
|
|
413
|
+
interface LineRange {
|
|
414
|
+
start?: number;
|
|
415
|
+
end?: number;
|
|
416
|
+
}
|
|
417
|
+
/** BOM stripped, CRLF folded to LF. */
|
|
418
|
+
declare function normalizeText(text: string): string;
|
|
419
|
+
/** The normalized lines, without the empty element a trailing LF leaves. */
|
|
420
|
+
declare function splitLines(text: string): string[];
|
|
421
|
+
/**
|
|
422
|
+
* The pin of already-joined lines: `sha256-<hex>`, or with `key` the
|
|
423
|
+
* `hmac-sha256-<hex>` keyed pin an encrypted value carries. A plain pin
|
|
424
|
+
* passes `undefined`.
|
|
425
|
+
*/
|
|
426
|
+
declare function hashLines(joined: string, key?: string): string;
|
|
427
|
+
/** Whether a pin is keyed (`hmac-sha256-`), the form an encrypted value carries. */
|
|
428
|
+
declare function isKeyedPin(pin: string): boolean;
|
|
429
|
+
/** The plain pin of a range of lines; undefined when the range falls outside them or ends before it starts. */
|
|
430
|
+
declare function pinOfLines(lines: readonly string[], range: PageLines): string | undefined;
|
|
431
|
+
/** Half-width of the band around the original position the blind move search tries first. */
|
|
432
|
+
declare const MOVE_WINDOW_LINES = 2000;
|
|
433
|
+
/** Default hashing budget for the blind move search, in bytes. */
|
|
434
|
+
declare const MOVE_BUDGET_BYTES: number;
|
|
435
|
+
/** The widest range a move search is attempted for. */
|
|
436
|
+
declare const MAX_RANGE_LINES = 5000;
|
|
437
|
+
interface FindWindowsOptions {
|
|
438
|
+
/** The 1-based start line the range was pinned at: the blind search begins around it. */
|
|
439
|
+
around?: number;
|
|
440
|
+
/** The pinned lines as they were, when known: enables the first-line filter. */
|
|
441
|
+
original?: readonly string[];
|
|
442
|
+
/** Hashing budget for the blind search, in bytes. Default `MOVE_BUDGET_BYTES`. */
|
|
443
|
+
budget?: number;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Pure move search over normalized lines: the 1-based start lines where a
|
|
447
|
+
* window of `length` lines hashes to `pin`. `original` (the pinned lines as
|
|
448
|
+
* they were, when known) enables the first-line filter. `key` keys the hash
|
|
449
|
+
* for a keyed pin and is `undefined` for a plain one.
|
|
450
|
+
*/
|
|
451
|
+
declare function findWindows(lines: readonly string[], length: number, pin: string, key: string | undefined, opts?: FindWindowsOptions): {
|
|
452
|
+
starts: number[];
|
|
453
|
+
truncated: boolean;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* The lines a `LineSpec` names. Undefined for a value that is neither a
|
|
457
|
+
* positive integer nor `"L1-L2"` with `L1 <= L2`.
|
|
458
|
+
*/
|
|
459
|
+
declare function parseLines(spec: LineSpec): PageLines | undefined;
|
|
460
|
+
/** Lines as an entry writes them: the integer for one line, `"L1-L2"` otherwise. */
|
|
461
|
+
declare function lineSpec(lines: PageLines): LineSpec;
|
|
462
|
+
/** Lines as a report spells them: `"9"` or `"9-12"`. */
|
|
463
|
+
declare function spellLines(lines: PageLines): string;
|
|
464
|
+
/** Body lines as file lines: body line 1 is the file line `bodyLine`, the first after the frontmatter. */
|
|
465
|
+
declare function toFileLines(lines: PageLines, bodyLine: number): PageLines;
|
|
466
|
+
/** File lines as body lines. */
|
|
467
|
+
declare function toBodyLines(lines: PageLines, bodyLine: number): PageLines;
|
|
468
|
+
|
|
469
|
+
/** One `provenance` entry as stored: body lines, and the pin over them. */
|
|
470
|
+
interface ProvenanceEntry {
|
|
471
|
+
"generated-by": string;
|
|
472
|
+
lines: LineSpec;
|
|
473
|
+
integrity: string;
|
|
474
|
+
}
|
|
475
|
+
/** A page read for provenance. */
|
|
476
|
+
interface ProvenancePage {
|
|
477
|
+
/** Every normalized line of the file. */
|
|
478
|
+
lines: string[];
|
|
479
|
+
/** The file line body line 1 sits on. */
|
|
480
|
+
bodyLine: number;
|
|
481
|
+
/** The body's lines: `lines` from `bodyLine` on. */
|
|
482
|
+
body: string[];
|
|
483
|
+
/** The well-formed `provenance` entries the frontmatter carries. */
|
|
484
|
+
stamp: ProvenanceEntry[];
|
|
485
|
+
}
|
|
486
|
+
/** Which of 0046's five evidence rules answered for a line. */
|
|
487
|
+
type EvidenceRule = 1 | 2 | 3 | 4 | 5;
|
|
488
|
+
/** A line's evidence: the machine, or none under rule 5, and the blamed sha. */
|
|
489
|
+
interface LineEvidence {
|
|
490
|
+
machine?: string;
|
|
491
|
+
rule: EvidenceRule;
|
|
492
|
+
sha: string;
|
|
493
|
+
}
|
|
494
|
+
/** One derived range: its entry, its body lines, and its first line's evidence. */
|
|
495
|
+
interface DerivedRange {
|
|
496
|
+
entry: ProvenanceEntry;
|
|
497
|
+
span: PageLines;
|
|
498
|
+
evidence: LineEvidence;
|
|
499
|
+
}
|
|
500
|
+
/** A page's derivation: the page, each body line's evidence, and the ranges. */
|
|
501
|
+
interface ProvenanceDerivation {
|
|
502
|
+
page: ProvenancePage;
|
|
503
|
+
evidenceByLine: ReadonlyMap<number, LineEvidence>;
|
|
504
|
+
derived: DerivedRange[];
|
|
505
|
+
}
|
|
506
|
+
/** 0046's comparison verdicts. */
|
|
507
|
+
type ProvenanceStatus = "current" | "moved" | "changed" | "stale" | "unset";
|
|
508
|
+
/** One range of `DerivedField.ranges`, in file lines. */
|
|
509
|
+
interface RangeResult {
|
|
510
|
+
lines: string;
|
|
511
|
+
"generated-by": string;
|
|
512
|
+
integrity: string;
|
|
513
|
+
status: ProvenanceStatus;
|
|
514
|
+
/** `uncommitted`, `blame <sha7>`, or `pin` when only the pin speaks for the range. */
|
|
515
|
+
evidence: string;
|
|
516
|
+
/** What the record said before: on `moved` and `stale` only. */
|
|
517
|
+
from?: {
|
|
518
|
+
lines: string;
|
|
519
|
+
"generated-by": string;
|
|
520
|
+
};
|
|
521
|
+
/** Whether `derive` wrote this range; always false until it does. */
|
|
522
|
+
written: boolean;
|
|
523
|
+
}
|
|
524
|
+
|
|
405
525
|
/**
|
|
406
526
|
* The derived metadata channel: values computed from git history, CODEOWNERS
|
|
407
527
|
* and the review record on GitHub or GitLab rather than written by hand.
|
|
@@ -415,11 +535,11 @@ interface ConfigFile {
|
|
|
415
535
|
* one, and turning the stale comparisons into findings.
|
|
416
536
|
*/
|
|
417
537
|
|
|
418
|
-
/** The
|
|
419
|
-
declare const DERIVABLE_FIELDS: readonly ["created", "last-updated", "authors", "owner", "reviewed-by", "last-reviewed"];
|
|
538
|
+
/** The seven built-in fields, in the order messages list them. */
|
|
539
|
+
declare const DERIVABLE_FIELDS: readonly ["created", "last-updated", "authors", "owner", "reviewed-by", "last-reviewed", "provenance"];
|
|
420
540
|
type BuiltinDerivableField = (typeof DERIVABLE_FIELDS)[number];
|
|
421
541
|
/**
|
|
422
|
-
* A managed field name: one of the
|
|
542
|
+
* A managed field name: one of the seven built-ins, or a key with an entry in
|
|
423
543
|
* `derive.commands`. The config parser guarantees one or the other.
|
|
424
544
|
*/
|
|
425
545
|
type DerivableField = string;
|
|
@@ -500,6 +620,32 @@ interface DeriveInput {
|
|
|
500
620
|
absPath: string;
|
|
501
621
|
content: string;
|
|
502
622
|
extracted: ExtractedMetadata;
|
|
623
|
+
/**
|
|
624
|
+
* Where the page's `provenance` record lives when a manifest owns it
|
|
625
|
+
* (proposal 0046), so evidence rule 2 reads the manifest's blob at each
|
|
626
|
+
* commit rather than the page's frontmatter. Absent: the page's own.
|
|
627
|
+
*/
|
|
628
|
+
provenanceManifest?: ProvenanceManifestRef;
|
|
629
|
+
/**
|
|
630
|
+
* `manni meta derive <path>:L1-L2 --generated-by <name>`: the file lines
|
|
631
|
+
* each target names go to `generatedBy`, committed or not, unless evidence
|
|
632
|
+
* names another machine, and no other uncommitted line does. Ranges that
|
|
633
|
+
* overlap attribute their union. Each target is a positional as typed,
|
|
634
|
+
* which every refusal quotes.
|
|
635
|
+
*/
|
|
636
|
+
attribution?: {
|
|
637
|
+
targets: string[];
|
|
638
|
+
generatedBy: string;
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
/** A manifest that holds one page's `provenance`, as the git source reads it at a commit. */
|
|
642
|
+
interface ProvenanceManifestRef {
|
|
643
|
+
/** The manifest file, absolute. */
|
|
644
|
+
absPath: string;
|
|
645
|
+
/** The page's key there: its path relative to the config directory, or its join value. */
|
|
646
|
+
entry: string;
|
|
647
|
+
/** `path`, or the page field the manifest joins on. */
|
|
648
|
+
join: string;
|
|
503
649
|
}
|
|
504
650
|
/** What a derive run holds constant across every document it visits. */
|
|
505
651
|
interface DeriveContext {
|
|
@@ -518,6 +664,10 @@ interface DeriveContext {
|
|
|
518
664
|
now: () => Date;
|
|
519
665
|
/** The review client for every repository in the run; the built-in `gh` / `glab` clients when absent. */
|
|
520
666
|
reviews?: ReviewClient;
|
|
667
|
+
/** `--generated-by` or `MANNI_GENERATED_BY` (proposal 0046): who uncommitted body lines go to. */
|
|
668
|
+
generatedBy?: string;
|
|
669
|
+
/** `derive.machines`: trailer identities that are machines; `["*[bot]"]` when absent. */
|
|
670
|
+
machines?: readonly string[];
|
|
521
671
|
}
|
|
522
672
|
/**
|
|
523
673
|
* How an asserted value stands against the derived one.
|
|
@@ -542,6 +692,17 @@ interface DerivedField {
|
|
|
542
692
|
status: DerivedStatus;
|
|
543
693
|
/** Whether `derive` wrote the value into the document. */
|
|
544
694
|
written: boolean;
|
|
695
|
+
/**
|
|
696
|
+
* `provenance` only (proposal 0046): one verdict per range, in file lines.
|
|
697
|
+
* The field's own `status` is `current` when every range is, and
|
|
698
|
+
* otherwise `stale`, or `unset` when the page carries no record at all.
|
|
699
|
+
*/
|
|
700
|
+
ranges?: RangeResult[];
|
|
701
|
+
/**
|
|
702
|
+
* `provenance` only: the manifest that holds the page's record, as the run
|
|
703
|
+
* reports it, when one does. `derive` writes there, never into the page.
|
|
704
|
+
*/
|
|
705
|
+
manifest?: string;
|
|
545
706
|
}
|
|
546
707
|
/**
|
|
547
708
|
* The `schema` ref a stale-field finding carries, and so its baseline and
|
|
@@ -708,6 +869,14 @@ interface DeriveConfig {
|
|
|
708
869
|
* is never a built-in field, `$schema`, or a key a manifest owns.
|
|
709
870
|
*/
|
|
710
871
|
commands?: Record<string, DeriveCommandConfig>;
|
|
872
|
+
/**
|
|
873
|
+
* Trailer identities that are machines (proposal 0046), as globs matched
|
|
874
|
+
* case-sensitively against a trailer's name and its email, with literal
|
|
875
|
+
* brackets. A match names a machine for `provenance` and is left out of
|
|
876
|
+
* `authors`. Absent means `["*[bot]"]`, which is 0040's rule; read it
|
|
877
|
+
* through `machinesOf`.
|
|
878
|
+
*/
|
|
879
|
+
machines?: string[];
|
|
711
880
|
}
|
|
712
881
|
/** Defaults for the `fill` command; every key is overridable by a CLI flag. */
|
|
713
882
|
interface FillConfig {
|
|
@@ -1181,6 +1350,17 @@ interface GetFileResult {
|
|
|
1181
1350
|
* one. A run carrying any `error` exits 1.
|
|
1182
1351
|
*/
|
|
1183
1352
|
error?: string;
|
|
1353
|
+
/**
|
|
1354
|
+
* `provenance` only (proposal 0046), present when it was requested and the
|
|
1355
|
+
* file parsed. `bodyLine` is the file line body line 1 sits on, which the
|
|
1356
|
+
* record's body lines are shown against. `current` is whether the record
|
|
1357
|
+
* agrees with git as `validate` judges it, range by range; absent when
|
|
1358
|
+
* nothing was derived.
|
|
1359
|
+
*/
|
|
1360
|
+
provenance?: {
|
|
1361
|
+
bodyLine: number;
|
|
1362
|
+
current?: boolean;
|
|
1363
|
+
};
|
|
1184
1364
|
}
|
|
1185
1365
|
declare function runGet(opts: GetOptions): Promise<GetFileResult[]>;
|
|
1186
1366
|
|
|
@@ -1599,6 +1779,46 @@ interface FilledField {
|
|
|
1599
1779
|
*/
|
|
1600
1780
|
encrypted?: boolean;
|
|
1601
1781
|
}
|
|
1782
|
+
/**
|
|
1783
|
+
* One `meta-provenance` entry as `fill` writes it (proposal 0046): the model,
|
|
1784
|
+
* the JSON Pointers of the fields it proposed, escaped per RFC 6901, and the
|
|
1785
|
+
* confidence each was written at. Keys are the page's own spelling, so the
|
|
1786
|
+
* JSON report shows exactly what landed in the document. An entry `fill`
|
|
1787
|
+
* merged into keeps whatever else it held.
|
|
1788
|
+
*/
|
|
1789
|
+
interface MetaProvenanceEntry {
|
|
1790
|
+
"generated-by": string;
|
|
1791
|
+
fields: string[];
|
|
1792
|
+
confidence: Record<string, number>;
|
|
1793
|
+
[other: string]: unknown;
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* What became of this file's `meta-provenance` entry. It is never a failure:
|
|
1797
|
+
* neither outcome changes the summary or the exit code.
|
|
1798
|
+
*/
|
|
1799
|
+
type MetaProvenanceReport = {
|
|
1800
|
+
written: true;
|
|
1801
|
+
entry: MetaProvenanceEntry;
|
|
1802
|
+
}
|
|
1803
|
+
/** The page's schemas, checked with the entry in place, reject it. */
|
|
1804
|
+
| {
|
|
1805
|
+
written: false;
|
|
1806
|
+
skipReason: "schema-mismatch";
|
|
1807
|
+
}
|
|
1808
|
+
/** A manifest in one of the page's collections owns the key. */
|
|
1809
|
+
| {
|
|
1810
|
+
written: false;
|
|
1811
|
+
skipReason: "manifest-owned";
|
|
1812
|
+
manifest: string;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* The format's writer cannot hold a list of entries (an HTML or XML
|
|
1816
|
+
* attribute holds one line), so the fields were written without it.
|
|
1817
|
+
*/
|
|
1818
|
+
| {
|
|
1819
|
+
written: false;
|
|
1820
|
+
skipReason: "unwritable";
|
|
1821
|
+
};
|
|
1602
1822
|
interface FillFileResult {
|
|
1603
1823
|
file: string;
|
|
1604
1824
|
format: string;
|
|
@@ -1610,6 +1830,12 @@ interface FillFileResult {
|
|
|
1610
1830
|
error?: string;
|
|
1611
1831
|
/** The filled document. Populated only when the caller asks for it. */
|
|
1612
1832
|
content?: string;
|
|
1833
|
+
/**
|
|
1834
|
+
* The `meta-provenance` entry recording the fields this run wrote
|
|
1835
|
+
* (proposal 0046). Absent when no field was written; reported, not written,
|
|
1836
|
+
* under `--dry-run`.
|
|
1837
|
+
*/
|
|
1838
|
+
metaProvenance?: MetaProvenanceReport;
|
|
1613
1839
|
}
|
|
1614
1840
|
interface FillSummary {
|
|
1615
1841
|
files: number;
|
|
@@ -1765,6 +1991,12 @@ interface DeriveOptions {
|
|
|
1765
1991
|
* `process.env`; tests pass their own.
|
|
1766
1992
|
*/
|
|
1767
1993
|
env?: NodeJS.ProcessEnv;
|
|
1994
|
+
/**
|
|
1995
|
+
* `--generated-by <name>` (proposal 0046): the machine uncommitted body
|
|
1996
|
+
* lines go to, or the lines a `<path>:L1-L2` positional names. Absent reads
|
|
1997
|
+
* `MANNI_GENERATED_BY` from `env`; an empty value is unset either way.
|
|
1998
|
+
*/
|
|
1999
|
+
generatedBy?: string;
|
|
1768
2000
|
}
|
|
1769
2001
|
interface DeriveFileResult {
|
|
1770
2002
|
file: string;
|
|
@@ -1792,6 +2024,12 @@ interface DeriveSummary {
|
|
|
1792
2024
|
changed: number;
|
|
1793
2025
|
/** Fields whose write reached the disk: always 0 under `dryRun` and `check`. */
|
|
1794
2026
|
written: number;
|
|
2027
|
+
/**
|
|
2028
|
+
* `provenance` ranges whose write reached the disk (proposal 0046): always
|
|
2029
|
+
* 0 under `dryRun` and `check`. Present only when the run derives
|
|
2030
|
+
* `provenance`.
|
|
2031
|
+
*/
|
|
2032
|
+
ranges?: number;
|
|
1795
2033
|
stale: number;
|
|
1796
2034
|
unset: number;
|
|
1797
2035
|
unknown: number;
|
|
@@ -2297,6 +2535,12 @@ interface DeriveResult {
|
|
|
2297
2535
|
* not point at. Absent means not applicable here, never unavailable.
|
|
2298
2536
|
*/
|
|
2299
2537
|
sources: Partial<Record<DeriveSource, SourceStatus$1>>;
|
|
2538
|
+
/**
|
|
2539
|
+
* The provenance derivation per input label (proposal 0046), for the
|
|
2540
|
+
* comparison with a page's stamp: present only when `provenance` was
|
|
2541
|
+
* requested and the git source answered.
|
|
2542
|
+
*/
|
|
2543
|
+
provenance?: ReadonlyMap<string, ProvenanceDerivation>;
|
|
2300
2544
|
}
|
|
2301
2545
|
/**
|
|
2302
2546
|
* Which sources can state a field, in precedence order: the built-in table
|
|
@@ -3008,8 +3252,7 @@ interface SourceRange {
|
|
|
3008
3252
|
start?: number;
|
|
3009
3253
|
end?: number;
|
|
3010
3254
|
}
|
|
3011
|
-
|
|
3012
|
-
type LineSpec = number | string;
|
|
3255
|
+
|
|
3013
3256
|
/** The page text a citation supports. */
|
|
3014
3257
|
interface CitationClaim {
|
|
3015
3258
|
/** Body lines: counted from the first line after the frontmatter. Absent when a marker anchors the entry. */
|
|
@@ -3344,11 +3587,6 @@ interface CheckRun {
|
|
|
3344
3587
|
warnings: number;
|
|
3345
3588
|
notices: number;
|
|
3346
3589
|
}
|
|
3347
|
-
/** Page lines as an editor numbers them, 1-based and inclusive. */
|
|
3348
|
-
interface PageLines {
|
|
3349
|
-
start: number;
|
|
3350
|
-
end: number;
|
|
3351
|
-
}
|
|
3352
3590
|
interface AddOptions {
|
|
3353
3591
|
page: string;
|
|
3354
3592
|
/** The claim's lines as an editor numbers them (`page:L`, `page:L1-L2`). Absent: a bare pin. */
|
|
@@ -3596,16 +3834,6 @@ declare const SRC_PATTERN: RegExp;
|
|
|
3596
3834
|
declare function parseSrc(src: string): SourceRange;
|
|
3597
3835
|
/** The canonical spelling: `path:L` for one line, `path:L1-L2` otherwise. */
|
|
3598
3836
|
declare function formatSrc(range: SourceRange): string;
|
|
3599
|
-
/**
|
|
3600
|
-
* The lines an entry's `lines` names. Undefined for a value that is neither
|
|
3601
|
-
* a positive integer nor `"L1-L2"` with `L1 <= L2`: the schema refuses the
|
|
3602
|
-
* first, and `readPage` reports the second.
|
|
3603
|
-
*/
|
|
3604
|
-
declare function parseLines(spec: LineSpec): PageLines | undefined;
|
|
3605
|
-
/** Lines as an entry writes them: the integer for one line, `"L1-L2"` otherwise. */
|
|
3606
|
-
declare function lineSpec(lines: PageLines): LineSpec;
|
|
3607
|
-
/** Lines as a report spells them: `"9"` or `"9-12"`. */
|
|
3608
|
-
declare function spellLines(lines: PageLines): string;
|
|
3609
3837
|
/** An entry's source as a range. Its lines must already be valid (see `parseLines`). */
|
|
3610
3838
|
declare function sourceRange(source: CitationSource): SourceRange;
|
|
3611
3839
|
/** An entry's source spelled as one string, `path:L1-L2`, the way the command line takes it. */
|
|
@@ -3613,31 +3841,19 @@ declare function spellSource(source: CitationSource): string;
|
|
|
3613
3841
|
/** A range's lines as an entry writes them; undefined for a whole file. */
|
|
3614
3842
|
declare function rangeLines(range: SourceRange): LineSpec | undefined;
|
|
3615
3843
|
|
|
3616
|
-
/** BOM stripped, CRLF folded to LF. */
|
|
3617
|
-
declare function normalizeText(text: string): string;
|
|
3618
|
-
/** The normalized lines, without the empty element a trailing LF leaves. */
|
|
3619
|
-
declare function splitLines(text: string): string[];
|
|
3620
3844
|
/**
|
|
3621
|
-
* The
|
|
3622
|
-
*
|
|
3845
|
+
* The hashing rule, as cite uses it. The engine is `src/shared/pin.ts`, shared
|
|
3846
|
+
* with meta; this module keeps cite's import path and its error contract: a
|
|
3847
|
+
* range past the end of the text throws `CiteError`.
|
|
3623
3848
|
*/
|
|
3624
|
-
|
|
3625
|
-
start?: number;
|
|
3626
|
-
end?: number;
|
|
3627
|
-
}, label?: string): string;
|
|
3628
|
-
/** The pin of the cited lines: plain, or the keyed pin under `key` when one is given. */
|
|
3629
|
-
declare function hashRange(text: string, range?: {
|
|
3630
|
-
start?: number;
|
|
3631
|
-
end?: number;
|
|
3632
|
-
}, key?: string): string;
|
|
3849
|
+
|
|
3633
3850
|
/**
|
|
3634
|
-
* The
|
|
3635
|
-
*
|
|
3636
|
-
* passes `undefined`.
|
|
3851
|
+
* The cited lines joined by LF. Throws `CiteError` when the range runs past
|
|
3852
|
+
* the end of the text (`<path> has N lines; line M is out of range`).
|
|
3637
3853
|
*/
|
|
3638
|
-
declare function
|
|
3639
|
-
/**
|
|
3640
|
-
declare function
|
|
3854
|
+
declare function sliceLines(lines: readonly string[], range?: LineRange, label?: string): string;
|
|
3855
|
+
/** The pin of the cited lines: plain, or the keyed pin under `key` when one is given. Throws `CiteError` past the end. */
|
|
3856
|
+
declare function hashRange(text: string, range?: LineRange, key?: string): string;
|
|
3641
3857
|
|
|
3642
3858
|
/**
|
|
3643
3859
|
* How a citation reads on a terminal. A pin is sixty-four hex digits and a
|
|
@@ -3801,12 +4017,6 @@ declare function offsetOfLine(content: string, line: number): number;
|
|
|
3801
4017
|
declare function normalizeWhitespace(text: string): string;
|
|
3802
4018
|
/** `true` when the block's normalized text equals the cited lines under the hashing rule. */
|
|
3803
4019
|
declare function blockMatches(blockText: string, citedJoined: string): boolean;
|
|
3804
|
-
/** Body lines as file lines: body line 1 is the first line after the frontmatter. */
|
|
3805
|
-
declare function toFileLines(lines: PageLines, bodyLine: number): PageLines;
|
|
3806
|
-
/** File lines as body lines. */
|
|
3807
|
-
declare function toBodyLines(lines: PageLines, bodyLine: number): PageLines;
|
|
3808
|
-
/** The pin of a page range, under the claim rule: always plain. */
|
|
3809
|
-
declare function pinOfLines(lines: readonly string[], range: PageLines): string | undefined;
|
|
3810
4020
|
/** The first file line of a classified claim: where its findings sit. */
|
|
3811
4021
|
declare function claimLine(claim: ClaimEnd): number | undefined;
|
|
3812
4022
|
/**
|
|
@@ -3877,9 +4087,6 @@ declare function noGit(): GitClient;
|
|
|
3877
4087
|
* `moved`, not `never-true`; the search sees the file as it is.
|
|
3878
4088
|
*/
|
|
3879
4089
|
|
|
3880
|
-
declare const MOVE_WINDOW_LINES = 2000;
|
|
3881
|
-
declare const MOVE_BUDGET_BYTES: number;
|
|
3882
|
-
declare const MAX_RANGE_LINES = 5000;
|
|
3883
4090
|
interface ClassifyOptions {
|
|
3884
4091
|
root: string;
|
|
3885
4092
|
index: SourceIndex;
|
|
@@ -3890,24 +4097,6 @@ interface ClassifyOptions {
|
|
|
3890
4097
|
/** Hashing budget for the blind move search, in bytes. Default `MOVE_BUDGET_BYTES`. */
|
|
3891
4098
|
budget?: number;
|
|
3892
4099
|
}
|
|
3893
|
-
interface FindWindowsOptions {
|
|
3894
|
-
/** The 1-based start line the range was pinned at: the blind search begins around it. */
|
|
3895
|
-
around?: number;
|
|
3896
|
-
/** The cited lines at the commit, when git could show them: enables the first-line filter. */
|
|
3897
|
-
original?: readonly string[];
|
|
3898
|
-
/** Hashing budget for the blind search, in bytes. Default `MOVE_BUDGET_BYTES`. */
|
|
3899
|
-
budget?: number;
|
|
3900
|
-
}
|
|
3901
|
-
/**
|
|
3902
|
-
* Pure move search over normalized lines: the 1-based start lines where a
|
|
3903
|
-
* window of `length` lines hashes to `pin`. `original` (the cited lines at the
|
|
3904
|
-
* commit, when known) enables the first-line filter. `key` keys the hash for
|
|
3905
|
-
* an encrypted source's pin and is `undefined` for a plain one.
|
|
3906
|
-
*/
|
|
3907
|
-
declare function findWindows(lines: readonly string[], length: number, pin: string, key: string | undefined, opts?: FindWindowsOptions): {
|
|
3908
|
-
starts: number[];
|
|
3909
|
-
truncated: boolean;
|
|
3910
|
-
};
|
|
3911
4100
|
/**
|
|
3912
4101
|
* What git could say about the pin at the recorded commit. `unknown` is a
|
|
3913
4102
|
* file at the commit too large to search under the budget with the pin found
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
reencryptMetadata,
|
|
6
6
|
runKeyRotate,
|
|
7
7
|
runKeySet
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UTXTVCBV.js";
|
|
9
9
|
import {
|
|
10
10
|
BinMissing,
|
|
11
11
|
COMMON_FORMATS,
|
|
@@ -125,7 +125,7 @@ import {
|
|
|
125
125
|
valueOf,
|
|
126
126
|
vendorFileName,
|
|
127
127
|
writeFileAtomic
|
|
128
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-2DC2GSRH.js";
|
|
129
129
|
|
|
130
130
|
// src/key/index.ts
|
|
131
131
|
var key_exports = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hawkeyexl/manni",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "One command line for documentation that is meant to be checked. `manni meta` validates the presence and format of document metadata (Markdown frontmatter and more) against JSON Schema, built for CI. Formerly docmeta.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|