@hawkeyexl/manni 2.3.10 → 2.5.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-LORLZO3J.js → chunk-3V4EIH7H.js} +1690 -759
- package/dist/chunk-3V4EIH7H.js.map +1 -0
- package/dist/{chunk-TNT3ZROC.js → chunk-SXYSP33V.js} +3 -2
- package/dist/chunk-SXYSP33V.js.map +1 -0
- package/dist/{chunk-WXBLVCOZ.js → chunk-XCZJ25OT.js} +2 -2
- package/dist/cli.js +87 -3
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +2 -2
- package/dist/index.d.ts +320 -12
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-LORLZO3J.js.map +0 -1
- package/dist/chunk-TNT3ZROC.js.map +0 -1
- /package/dist/{chunk-WXBLVCOZ.js.map → chunk-XCZJ25OT.js.map} +0 -0
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
supportedExtensions,
|
|
62
62
|
terminalConfirm,
|
|
63
63
|
toJsonText
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-SXYSP33V.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-
|
|
1520
|
+
//# sourceMappingURL=chunk-XCZJ25OT.js.map
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
readStdin,
|
|
8
8
|
reportConfig,
|
|
9
9
|
splitList
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XCZJ25OT.js";
|
|
11
11
|
import {
|
|
12
12
|
CiteError,
|
|
13
13
|
KeyError,
|
|
@@ -25,19 +25,22 @@ import {
|
|
|
25
25
|
renderCheckGithub,
|
|
26
26
|
renderCheckJson,
|
|
27
27
|
renderCheckPretty,
|
|
28
|
+
renderRemoveJson,
|
|
29
|
+
renderRemovePretty,
|
|
28
30
|
renderUpdateJson,
|
|
29
31
|
renderUpdatePretty,
|
|
30
32
|
runAdd,
|
|
31
33
|
runCheck,
|
|
32
34
|
runKeyRotate,
|
|
33
35
|
runKeySet,
|
|
36
|
+
runRemove,
|
|
34
37
|
runUpdate,
|
|
35
38
|
shortCommit,
|
|
36
39
|
shortLine,
|
|
37
40
|
shortPin,
|
|
38
41
|
shortSrc,
|
|
39
42
|
spellSource
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-3V4EIH7H.js";
|
|
41
44
|
import {
|
|
42
45
|
COMMON_FORMAT_LIST,
|
|
43
46
|
OMITTED_WHEN_CLEAN,
|
|
@@ -75,7 +78,7 @@ import {
|
|
|
75
78
|
splitPageArgument,
|
|
76
79
|
terminalConfirm,
|
|
77
80
|
valeConfigPath
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-SXYSP33V.js";
|
|
79
82
|
|
|
80
83
|
// src/cli.ts
|
|
81
84
|
import { Command as Command5 } from "commander";
|
|
@@ -1007,6 +1010,7 @@ var RULE_DESCRIPTIONS = {
|
|
|
1007
1010
|
"marker-orphan": "A marker names an id no citation has.",
|
|
1008
1011
|
"marker-invalid": "A marker is malformed, or the page has too many markers.",
|
|
1009
1012
|
"marker-repeated": "Two markers name the same citation id.",
|
|
1013
|
+
"marker-misplaced": "A marker line sits inside the paragraph it anchors, and splits it.",
|
|
1010
1014
|
"anchor-invalid": "A citation's anchor cannot work.",
|
|
1011
1015
|
"entry-invalid": "A citation entry is malformed.",
|
|
1012
1016
|
"quote-drift": "A quoted block no longer reproduces its source."
|
|
@@ -1057,6 +1061,7 @@ function renderCheckJunit(run) {
|
|
|
1057
1061
|
|
|
1058
1062
|
// src/cite/cli.ts
|
|
1059
1063
|
var UPDATE_FORMATS = ["pretty", "json"];
|
|
1064
|
+
var REMOVE_FORMATS = UPDATE_FORMATS;
|
|
1060
1065
|
function colorFor(command, isTTY, env) {
|
|
1061
1066
|
const noColor = colorOwner(command).opts().color === false;
|
|
1062
1067
|
return shouldColor({ noColor, isTTY, env });
|
|
@@ -1070,6 +1075,9 @@ function colorOwner(command) {
|
|
|
1070
1075
|
function isUpdateFormat(value) {
|
|
1071
1076
|
return UPDATE_FORMATS.includes(value);
|
|
1072
1077
|
}
|
|
1078
|
+
function isRemoveFormat(value) {
|
|
1079
|
+
return REMOVE_FORMATS.includes(value);
|
|
1080
|
+
}
|
|
1073
1081
|
function splitPageArgument2(arg) {
|
|
1074
1082
|
return asCiteError(() => splitPageArgument(arg));
|
|
1075
1083
|
}
|
|
@@ -1358,6 +1366,82 @@ function buildProgram3() {
|
|
|
1358
1366
|
fail(err);
|
|
1359
1367
|
}
|
|
1360
1368
|
});
|
|
1369
|
+
program.command("remove").description("Remove the named citations from the given pages, markers and all").argument(
|
|
1370
|
+
"[paths...]",
|
|
1371
|
+
"files, directories, or globs to remove from (use - for stdin)"
|
|
1372
|
+
).option(
|
|
1373
|
+
"--collection <name>",
|
|
1374
|
+
"configured collection to run over; repeatable",
|
|
1375
|
+
collect,
|
|
1376
|
+
[]
|
|
1377
|
+
).option("--ext <list>", "comma-separated extensions for directory walks").option("--exclude <glob>", "glob to exclude; repeatable", collect, []).option("--as <format>", "force an input format for every input").option("-c, --config <path>", "path to a manni config file").option("--no-config", "ignore any discovered config file").option("--allow-empty", "treat zero matched files as success").option("--no-gitignore", "remove from files .gitignore covers").option(
|
|
1378
|
+
"--only <id>",
|
|
1379
|
+
"the entry to remove, by id or by pointer (/citations/N); required, and repeatable",
|
|
1380
|
+
collect,
|
|
1381
|
+
[]
|
|
1382
|
+
).option("--dry-run", "print the diffs and the report; write nothing").option(
|
|
1383
|
+
"-f, --format <format>",
|
|
1384
|
+
`output: ${REMOVE_FORMATS.join(" | ")}`,
|
|
1385
|
+
"pretty"
|
|
1386
|
+
).addHelpText(
|
|
1387
|
+
"after",
|
|
1388
|
+
[
|
|
1389
|
+
"",
|
|
1390
|
+
"Examples:",
|
|
1391
|
+
" manni cite remove docs/limits.md --only fetch-timeout",
|
|
1392
|
+
" manni cite remove docs/ --only fetch-timeout --only retries --dry-run",
|
|
1393
|
+
" manni cite remove --collection site --only /citations/3 -f json"
|
|
1394
|
+
].join("\n")
|
|
1395
|
+
).action(async (paths, options, command) => {
|
|
1396
|
+
try {
|
|
1397
|
+
const format = options.format;
|
|
1398
|
+
if (!isRemoveFormat(format)) {
|
|
1399
|
+
throw new CiteError(
|
|
1400
|
+
`Unknown --format "${format}". Use ${COMMON_FORMAT_LIST}.`
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
const exts = options.ext ? splitList(options.ext) : void 0;
|
|
1404
|
+
const usingStdin = paths.includes(STDIN_TOKEN);
|
|
1405
|
+
const stdinContent = usingStdin ? await readStdin() : void 0;
|
|
1406
|
+
const dryRun = Boolean(options.dryRun);
|
|
1407
|
+
const pageToStdout = usingStdin && !dryRun;
|
|
1408
|
+
const cwd = process.cwd();
|
|
1409
|
+
const run = await runRemove({
|
|
1410
|
+
inputs: paths,
|
|
1411
|
+
collection: options.collection,
|
|
1412
|
+
exts,
|
|
1413
|
+
exclude: options.exclude,
|
|
1414
|
+
as: options.as,
|
|
1415
|
+
...configOption(options.config),
|
|
1416
|
+
onConfigLoaded: reportConfig(format === "pretty" && !pageToStdout, cwd),
|
|
1417
|
+
stdinContent,
|
|
1418
|
+
allowEmpty: options.allowEmpty ? true : void 0,
|
|
1419
|
+
respectGitignore: explicitFalse(options.gitignore),
|
|
1420
|
+
onNotice: notice,
|
|
1421
|
+
only: options.only,
|
|
1422
|
+
dryRun
|
|
1423
|
+
});
|
|
1424
|
+
const text2 = format === "json" ? renderRemoveJson(run) : renderRemovePretty(run, {
|
|
1425
|
+
color: colorFor(command, process.stdout.isTTY),
|
|
1426
|
+
// The diffs are the point of a dry run; a real run prints
|
|
1427
|
+
// what it removed and leaves the file to say the rest.
|
|
1428
|
+
showDiff: dryRun,
|
|
1429
|
+
dryRun
|
|
1430
|
+
});
|
|
1431
|
+
const stdinPage = pageToStdout ? run.pages.find((page) => page.content !== void 0) : void 0;
|
|
1432
|
+
if (stdinPage?.content !== void 0) {
|
|
1433
|
+
process.stdout.write(stdinPage.content);
|
|
1434
|
+
process.stderr.write(`${text2}
|
|
1435
|
+
`);
|
|
1436
|
+
} else {
|
|
1437
|
+
process.stdout.write(`${text2}
|
|
1438
|
+
`);
|
|
1439
|
+
}
|
|
1440
|
+
process.exitCode = 0;
|
|
1441
|
+
} catch (err) {
|
|
1442
|
+
fail(err);
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1361
1445
|
return program;
|
|
1362
1446
|
}
|
|
1363
1447
|
|