@hawkeyexl/manni 4.3.1 → 4.4.1
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 +9 -1
- package/dist/batch-GFNLTGOH.js +36 -0
- package/dist/build-COYIQ25L.js +31 -0
- package/dist/calibrate-MDBLJKEE.js +31 -0
- package/dist/capture-LRML2PKV.js +32 -0
- package/dist/check-ASPIHA6B.js +40 -0
- package/dist/check-ASPIHA6B.js.map +1 -0
- package/dist/check-EDLBYL5N.js +27 -0
- package/dist/check-EDLBYL5N.js.map +1 -0
- package/dist/check-HYNGXYJV.js +18 -0
- package/dist/check-HYNGXYJV.js.map +1 -0
- package/dist/chunk-2B7ZNTPV.js +230 -0
- package/dist/chunk-2B7ZNTPV.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-37LP5HMZ.js +1042 -0
- package/dist/chunk-37LP5HMZ.js.map +1 -0
- package/dist/chunk-3VK37OR2.js +2957 -0
- package/dist/chunk-3VK37OR2.js.map +1 -0
- package/dist/chunk-4IUC2MNL.js +2165 -0
- package/dist/chunk-4IUC2MNL.js.map +1 -0
- package/dist/{chunk-3R23C5DT.js → chunk-4TSWU2SU.js} +2 -14
- package/dist/chunk-4TSWU2SU.js.map +1 -0
- package/dist/chunk-57NEQRVO.js +10921 -0
- package/dist/chunk-57NEQRVO.js.map +1 -0
- package/dist/chunk-6JSSEWBG.js +6737 -0
- package/dist/chunk-6JSSEWBG.js.map +1 -0
- package/dist/chunk-6OYEI2VV.js +88 -0
- package/dist/chunk-6OYEI2VV.js.map +1 -0
- package/dist/chunk-77AINBYM.js +19 -0
- package/dist/chunk-77AINBYM.js.map +1 -0
- package/dist/chunk-7UKO3ASZ.js +54 -0
- package/dist/chunk-7UKO3ASZ.js.map +1 -0
- package/dist/chunk-A5ULMVHQ.js +164 -0
- package/dist/chunk-A5ULMVHQ.js.map +1 -0
- package/dist/chunk-C4SQM22E.js +299 -0
- package/dist/chunk-C4SQM22E.js.map +1 -0
- package/dist/chunk-CK7SKVHR.js +1042 -0
- package/dist/chunk-CK7SKVHR.js.map +1 -0
- package/dist/{chunk-G5CM2VGQ.js → chunk-DXNZS72W.js} +8 -94
- package/dist/chunk-DXNZS72W.js.map +1 -0
- package/dist/chunk-EPH54CAY.js +374 -0
- package/dist/chunk-EPH54CAY.js.map +1 -0
- package/dist/{chunk-KJR7OVDX.js → chunk-FBEQCK47.js} +56 -137
- package/dist/chunk-FBEQCK47.js.map +1 -0
- package/dist/{chunk-IOYXPBCL.js → chunk-G3T47CFV.js} +1 -7
- package/dist/{chunk-IOYXPBCL.js.map → chunk-G3T47CFV.js.map} +1 -1
- package/dist/chunk-GCQRPUSB.js +1287 -0
- package/dist/chunk-GCQRPUSB.js.map +1 -0
- package/dist/chunk-GLP5PSXB.js +72 -0
- package/dist/chunk-GLP5PSXB.js.map +1 -0
- package/dist/chunk-I2AH3CJJ.js +1192 -0
- package/dist/chunk-I2AH3CJJ.js.map +1 -0
- package/dist/chunk-IDV6HJCB.js +388 -0
- package/dist/chunk-IDV6HJCB.js.map +1 -0
- package/dist/chunk-IKEWBMCN.js +98 -0
- package/dist/chunk-IKEWBMCN.js.map +1 -0
- package/dist/chunk-JCDXE76J.js +52 -0
- package/dist/chunk-JCDXE76J.js.map +1 -0
- package/dist/chunk-JXLTXMJ7.js +455 -0
- package/dist/chunk-JXLTXMJ7.js.map +1 -0
- package/dist/chunk-LJ2RDH3F.js +49 -0
- package/dist/chunk-LJ2RDH3F.js.map +1 -0
- package/dist/chunk-M2JCK5F6.js +805 -0
- package/dist/chunk-M2JCK5F6.js.map +1 -0
- package/dist/chunk-M3W7J6MU.js +4398 -0
- package/dist/chunk-M3W7J6MU.js.map +1 -0
- package/dist/chunk-MMTSSTG7.js +23 -0
- package/dist/chunk-MMTSSTG7.js.map +1 -0
- package/dist/chunk-MNH7QO4Z.js +15 -0
- package/dist/chunk-MNH7QO4Z.js.map +1 -0
- package/dist/chunk-MWJLZMBL.js +934 -0
- package/dist/chunk-MWJLZMBL.js.map +1 -0
- package/dist/chunk-MYMBCTDE.js +387 -0
- package/dist/chunk-MYMBCTDE.js.map +1 -0
- package/dist/chunk-NCPWXHDO.js +683 -0
- package/dist/chunk-NCPWXHDO.js.map +1 -0
- package/dist/chunk-NLXTXE5Y.js +1661 -0
- package/dist/chunk-NLXTXE5Y.js.map +1 -0
- package/dist/{chunk-CFDUZRM2.js → chunk-NXV7WE2D.js} +32 -240
- package/dist/chunk-NXV7WE2D.js.map +1 -0
- package/dist/chunk-OWBRDNRZ.js +16 -0
- package/dist/chunk-OWBRDNRZ.js.map +1 -0
- package/dist/{chunk-KTSJ2ZHA.js → chunk-PAU352SV.js} +5 -3
- package/dist/{chunk-KTSJ2ZHA.js.map → chunk-PAU352SV.js.map} +1 -1
- package/dist/chunk-PCE7QHXJ.js +68 -0
- package/dist/chunk-PCE7QHXJ.js.map +1 -0
- package/dist/chunk-PIKOVN6W.js +1651 -0
- package/dist/chunk-PIKOVN6W.js.map +1 -0
- package/dist/chunk-PNPQTHBT.js +17 -0
- package/dist/chunk-PNPQTHBT.js.map +1 -0
- package/dist/chunk-PU6DFJMY.js +1975 -0
- package/dist/chunk-PU6DFJMY.js.map +1 -0
- package/dist/chunk-Q35YIDBV.js +1202 -0
- package/dist/chunk-Q35YIDBV.js.map +1 -0
- package/dist/{chunk-5HNHEUD5.js → chunk-QQUKGCAJ.js} +3 -3
- package/dist/chunk-QRWGPQKO.js +198 -0
- package/dist/chunk-QRWGPQKO.js.map +1 -0
- package/dist/{chunk-UBMMXS2Y.js → chunk-QZ6LRSNV.js} +69 -48
- package/dist/{chunk-UBMMXS2Y.js.map → chunk-QZ6LRSNV.js.map} +1 -1
- package/dist/chunk-RL5XWQOL.js +3872 -0
- package/dist/chunk-RL5XWQOL.js.map +1 -0
- package/dist/chunk-RNVYGWIC.js +30 -0
- package/dist/chunk-RNVYGWIC.js.map +1 -0
- package/dist/chunk-SE4JN5XN.js +19 -0
- package/dist/chunk-SE4JN5XN.js.map +1 -0
- package/dist/chunk-SKSDRUUK.js +622 -0
- package/dist/chunk-SKSDRUUK.js.map +1 -0
- package/dist/chunk-TIUTIOFB.js +25 -0
- package/dist/chunk-TIUTIOFB.js.map +1 -0
- package/dist/chunk-TK3FC4RF.js +3090 -0
- package/dist/chunk-TK3FC4RF.js.map +1 -0
- package/dist/chunk-TU2WUBVZ.js +2 -0
- package/dist/chunk-TU2WUBVZ.js.map +1 -0
- package/dist/chunk-TZOYZK2E.js +98 -0
- package/dist/chunk-TZOYZK2E.js.map +1 -0
- package/dist/chunk-UJCVAWP7.js +178 -0
- package/dist/chunk-UJCVAWP7.js.map +1 -0
- package/dist/chunk-UKZNLVJW.js +17 -0
- package/dist/chunk-UKZNLVJW.js.map +1 -0
- package/dist/{chunk-HAPTXWU2.js → chunk-UQISLDAV.js} +4 -4
- package/dist/chunk-WB3QM6PP.js +5440 -0
- package/dist/chunk-WB3QM6PP.js.map +1 -0
- package/dist/chunk-YB4IBW3M.js +96 -0
- package/dist/chunk-YB4IBW3M.js.map +1 -0
- package/dist/chunk-YEUYKR62.js +72 -0
- package/dist/chunk-YEUYKR62.js.map +1 -0
- package/dist/chunk-YJOGUXGP.js +634 -0
- package/dist/chunk-YJOGUXGP.js.map +1 -0
- package/dist/chunk-YNHZHSSM.js +41 -0
- package/dist/chunk-YNHZHSSM.js.map +1 -0
- package/dist/chunk-YTURO7SI.js +979 -0
- package/dist/chunk-YTURO7SI.js.map +1 -0
- package/dist/chunk-ZXRAE55H.js +31 -0
- package/dist/chunk-ZXRAE55H.js.map +1 -0
- package/dist/cli-3BIBYHFK.js +473 -0
- package/dist/cli-3BIBYHFK.js.map +1 -0
- package/dist/cli-673OTRGE.js +28 -0
- package/dist/cli-673OTRGE.js.map +1 -0
- package/dist/cli-6HIDIFVT.js +1203 -0
- package/dist/cli-6HIDIFVT.js.map +1 -0
- package/dist/cli-6UB5N6CU.js +232 -0
- package/dist/cli-6UB5N6CU.js.map +1 -0
- package/dist/cli-LFP5ZGYS.js +346 -0
- package/dist/cli-LFP5ZGYS.js.map +1 -0
- package/dist/cli-MN7PYMBI.js +552 -0
- package/dist/cli-MN7PYMBI.js.map +1 -0
- package/dist/cli-PYPX6O6E.js +739 -0
- package/dist/cli-PYPX6O6E.js.map +1 -0
- package/dist/cli-RPM5PELX.js +626 -0
- package/dist/cli-RPM5PELX.js.map +1 -0
- package/dist/cli-VI7VHWNZ.js +423 -0
- package/dist/cli-VI7VHWNZ.js.map +1 -0
- package/dist/cli.d.ts +12 -2
- package/dist/cli.js +109 -7661
- package/dist/cli.js.map +1 -1
- package/dist/docmeta.js +15 -3
- package/dist/docmeta.js.map +1 -1
- package/dist/github-6QMYOHC3.js +27 -0
- package/dist/github-6QMYOHC3.js.map +1 -0
- package/dist/github-SXPGP5DB.js +32 -0
- package/dist/github-SXPGP5DB.js.map +1 -0
- package/dist/index.d.ts +65 -3
- package/dist/index.js +407 -337
- package/dist/index.js.map +1 -1
- package/dist/json-7WV7KL6H.js +17 -0
- package/dist/json-7WV7KL6H.js.map +1 -0
- package/dist/json-SY7KLNC7.js +35 -0
- package/dist/json-SY7KLNC7.js.map +1 -0
- package/dist/lint-ASMJLLPA.js +28 -0
- package/dist/lint-ASMJLLPA.js.map +1 -0
- package/dist/list-KZNVTNVC.js +31 -0
- package/dist/list-KZNVTNVC.js.map +1 -0
- package/dist/list-Q57YTFUQ.js +29 -0
- package/dist/list-Q57YTFUQ.js.map +1 -0
- package/dist/page-KSGV5RD4.js +41 -0
- package/dist/page-KSGV5RD4.js.map +1 -0
- package/dist/picker-3XF36MJF.js +14 -0
- package/dist/picker-3XF36MJF.js.map +1 -0
- package/dist/pretty-A5EGTN35.js +37 -0
- package/dist/pretty-A5EGTN35.js.map +1 -0
- package/dist/pretty-CXSDXNAS.js +43 -0
- package/dist/pretty-CXSDXNAS.js.map +1 -0
- package/dist/reporters-HUY7UXFS.js +42 -0
- package/dist/reporters-HUY7UXFS.js.map +1 -0
- package/dist/reporters-K2VUKSAK.js +71 -0
- package/dist/reporters-K2VUKSAK.js.map +1 -0
- package/dist/reporters-M6LJ2IYU.js +21 -0
- package/dist/reporters-M6LJ2IYU.js.map +1 -0
- package/dist/run-3DYJNRIG.js +33 -0
- package/dist/run-3DYJNRIG.js.map +1 -0
- package/dist/term-BIQUPMOR.js +1592 -0
- package/dist/term-BIQUPMOR.js.map +1 -0
- package/dist/types-Y6TXHM7M.js +10 -0
- package/dist/types-Y6TXHM7M.js.map +1 -0
- package/dist/validate-53RKM2XG.js +16 -0
- package/dist/validate-53RKM2XG.js.map +1 -0
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +9 -0
- package/plugin/manni/hooks/hooks.json +69 -0
- package/plugin/manni/hooks/manni.mjs +157 -0
- package/plugin/manni/skills/check/SKILL.md +20 -0
- package/plugin/manni/skills/evals/SKILL.md +27 -0
- package/plugin/manni/skills/fix/SKILL.md +56 -0
- package/plugin/manni/skills/setup/SKILL.md +41 -0
- package/dist/batch-A5HZKYIW.js +0 -18
- package/dist/calibrate-S5K6QHUY.js +0 -13
- package/dist/capture-OZEZDABQ.js +0 -15
- package/dist/chunk-3R23C5DT.js.map +0 -1
- package/dist/chunk-CFDUZRM2.js.map +0 -1
- package/dist/chunk-G5CM2VGQ.js.map +0 -1
- package/dist/chunk-KJR7OVDX.js.map +0 -1
- package/dist/chunk-V4KUVE47.js +0 -27170
- package/dist/chunk-V4KUVE47.js.map +0 -1
- package/dist/chunk-ZQBTK3DO.js +0 -26518
- package/dist/chunk-ZQBTK3DO.js.map +0 -1
- package/dist/picker-6HRMETE7.js +0 -12
- package/plugin/tracevals/.claude-plugin/plugin.json +0 -9
- package/plugin/tracevals/hooks/hooks.json +0 -17
- /package/dist/{batch-A5HZKYIW.js.map → batch-GFNLTGOH.js.map} +0 -0
- /package/dist/{calibrate-S5K6QHUY.js.map → build-COYIQ25L.js.map} +0 -0
- /package/dist/{capture-OZEZDABQ.js.map → calibrate-MDBLJKEE.js.map} +0 -0
- /package/dist/{picker-6HRMETE7.js.map → capture-LRML2PKV.js.map} +0 -0
- /package/dist/{chunk-5HNHEUD5.js.map → chunk-QQUKGCAJ.js.map} +0 -0
- /package/dist/{chunk-HAPTXWU2.js.map → chunk-UQISLDAV.js.map} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
applySelection,
|
|
4
|
+
assertRegisteredGraders,
|
|
5
|
+
discoverPages,
|
|
6
|
+
documentSet,
|
|
7
|
+
loadRunConfig,
|
|
8
|
+
resolvePages,
|
|
9
|
+
runConfigOptions,
|
|
10
|
+
withExternalMetadata
|
|
11
|
+
} from "./chunk-3VK37OR2.js";
|
|
12
|
+
import {
|
|
13
|
+
SUMMARY_FORMATS,
|
|
14
|
+
parseFormat
|
|
15
|
+
} from "./chunk-ZXRAE55H.js";
|
|
16
|
+
import {
|
|
17
|
+
palette
|
|
18
|
+
} from "./chunk-RNVYGWIC.js";
|
|
19
|
+
|
|
20
|
+
// src/docevals/commands/list.ts
|
|
21
|
+
async function runList(paths, options = {}) {
|
|
22
|
+
const cwd = options.cwd ?? process.cwd();
|
|
23
|
+
const config = loadRunConfig(runConfigOptions(paths, options), cwd);
|
|
24
|
+
const pages = await withExternalMetadata(
|
|
25
|
+
discoverPages(config, documentSet(paths, options, "list"), cwd),
|
|
26
|
+
config,
|
|
27
|
+
cwd
|
|
28
|
+
);
|
|
29
|
+
const plans = resolvePages(pages, config);
|
|
30
|
+
assertRegisteredGraders(plans, config);
|
|
31
|
+
applySelection(plans, config, options, false);
|
|
32
|
+
const hasErrors = plans.some(
|
|
33
|
+
(p) => p.problems.some((pr) => pr.level === "error")
|
|
34
|
+
);
|
|
35
|
+
return { plans, exitCode: hasErrors ? 1 : 0 };
|
|
36
|
+
}
|
|
37
|
+
function renderList(run, format, opts = {}) {
|
|
38
|
+
parseFormat(format, SUMMARY_FORMATS, "format");
|
|
39
|
+
if (format === "json") {
|
|
40
|
+
return JSON.stringify(
|
|
41
|
+
run.plans.map((p) => ({
|
|
42
|
+
file: p.page.file,
|
|
43
|
+
skip: p.skip,
|
|
44
|
+
suite: p.suite,
|
|
45
|
+
evals: p.evals.map((e) => ({
|
|
46
|
+
name: e.name,
|
|
47
|
+
suite: e.suite,
|
|
48
|
+
type: e.type,
|
|
49
|
+
grader: e.grader,
|
|
50
|
+
source: e.source,
|
|
51
|
+
skip: e.skip,
|
|
52
|
+
hasCommand: e.command != null,
|
|
53
|
+
assertion: e.assertion
|
|
54
|
+
})),
|
|
55
|
+
problems: p.problems
|
|
56
|
+
})),
|
|
57
|
+
null,
|
|
58
|
+
2
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const pc = palette(opts.color === true);
|
|
62
|
+
const lines = [];
|
|
63
|
+
for (const plan of run.plans) {
|
|
64
|
+
const suite = plan.suite ? pc.dim(` (suite: ${plan.suite})`) : "";
|
|
65
|
+
const skip = plan.skip ? pc.yellow(" [skipped]") : "";
|
|
66
|
+
lines.push(`${pc.bold(plan.page.file)}${suite}${skip}`);
|
|
67
|
+
if (plan.evals.length === 0 && plan.problems.length === 0) {
|
|
68
|
+
lines.push(pc.dim(" no evals"));
|
|
69
|
+
}
|
|
70
|
+
for (const e of plan.evals) {
|
|
71
|
+
const bits = [
|
|
72
|
+
pc.cyan(e.grader),
|
|
73
|
+
e.type,
|
|
74
|
+
e.source === "page" ? "page" : "config"
|
|
75
|
+
];
|
|
76
|
+
if (e.grader === "command" && !e.command) bits.push(pc.yellow("needs generation"));
|
|
77
|
+
if (e.skip) bits.push(pc.yellow("skip"));
|
|
78
|
+
lines.push(` - ${e.name} ${pc.dim(`[${bits.join(", ")}]`)}`);
|
|
79
|
+
}
|
|
80
|
+
for (const pr of plan.problems) {
|
|
81
|
+
const tag = pr.level === "error" ? pc.red("error") : pc.yellow("warn");
|
|
82
|
+
const line = pr.line != null ? pc.dim(`:${pr.line}`) : "";
|
|
83
|
+
lines.push(` ${tag}${line} ${pr.message}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const total = run.plans.reduce((n, p) => n + p.evals.length, 0);
|
|
87
|
+
lines.push("");
|
|
88
|
+
lines.push(pc.dim(`${run.plans.length} pages, ${total} evals resolved`));
|
|
89
|
+
return lines.join("\n");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
runList,
|
|
94
|
+
renderList
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=chunk-YB4IBW3M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/docevals/commands/list.ts"],"sourcesContent":["/**\n * `manni docevals list` — dry-run: show the resolved eval plan for each discovered\n * page without executing anything. The fastest way to debug suite/frontmatter\n * resolution.\n */\nimport { palette } from \"../../shared/color.js\";\nimport type { ColorOptions } from \"../reporters/pretty.js\";\nimport { loadRunConfig } from \"../core/config.js\";\nimport {\n discoverPages,\n documentSet,\n runConfigOptions,\n type DocumentInputOptions,\n} from \"../core/discover.js\";\nimport { withExternalMetadata } from \"../core/external.js\";\nimport { resolvePages, type ResolvedPagePlan } from \"../core/resolve.js\";\nimport { applySelection } from \"../core/engine.js\";\nimport { assertRegisteredGraders } from \"../core/feasibility.js\";\nimport {\n parseFormat,\n SUMMARY_FORMATS,\n type SummaryFormat,\n} from \"../reporters/format.js\";\n\nexport interface ListOptions extends DocumentInputOptions {\n format?: SummaryFormat;\n /** Show only these evals by name (ADR 01018). */\n evalNames?: string[];\n /** Show only evals in this suite. */\n suite?: string;\n cwd?: string;\n}\n\nexport interface ListRun {\n plans: ResolvedPagePlan[];\n /** 0 = clean, 1 = resolution errors present. */\n exitCode: 0 | 1;\n}\n\n/**\n * Asynchronous because a page's evals may not be in the page: an owning\n * manifest is a file to read (proposal 0037). `list` and `run` have to answer\n * the same question about the same corpus, so it reads them the same way.\n */\nexport async function runList(\n paths: string[],\n options: ListOptions = {},\n): Promise<ListRun> {\n const cwd = options.cwd ?? process.cwd();\n const config = loadRunConfig(runConfigOptions(paths, options), cwd);\n const pages = await withExternalMetadata(\n discoverPages(config, documentSet(paths, options, \"list\"), cwd),\n config,\n cwd,\n );\n const plans = resolvePages(pages, config);\n assertRegisteredGraders(plans, config);\n // `false`: list executes nothing, so an eval that resolves but is skipped is\n // a legitimate answer here — and this is the command `run`'s empty-match\n // error tells the user to reach for.\n applySelection(plans, config, options, false);\n const hasErrors = plans.some((p) =>\n p.problems.some((pr) => pr.level === \"error\"),\n );\n return { plans, exitCode: hasErrors ? 1 : 0 };\n}\n\nexport function renderList(\n run: ListRun,\n format: SummaryFormat,\n opts: ColorOptions = {},\n): string {\n // Exported from src/index.ts, so library callers reach this without the CLI\n // parser in front. Falling through to the pretty renderer is the silent\n // degradation ADR 01007 removes; it is no less silent off the CLI path.\n parseFormat(format, SUMMARY_FORMATS, \"format\");\n if (format === \"json\") {\n return JSON.stringify(\n run.plans.map((p) => ({\n file: p.page.file,\n skip: p.skip,\n suite: p.suite,\n evals: p.evals.map((e) => ({\n name: e.name,\n suite: e.suite,\n type: e.type,\n grader: e.grader,\n source: e.source,\n skip: e.skip,\n hasCommand: e.command != null,\n assertion: e.assertion,\n })),\n problems: p.problems,\n })),\n null,\n 2,\n );\n }\n\n const pc = palette(opts.color === true);\n const lines: string[] = [];\n for (const plan of run.plans) {\n const suite = plan.suite ? pc.dim(` (suite: ${plan.suite})`) : \"\";\n const skip = plan.skip ? pc.yellow(\" [skipped]\") : \"\";\n lines.push(`${pc.bold(plan.page.file)}${suite}${skip}`);\n if (plan.evals.length === 0 && plan.problems.length === 0) {\n lines.push(pc.dim(\" no evals\"));\n }\n for (const e of plan.evals) {\n const bits = [\n pc.cyan(e.grader),\n e.type,\n e.source === \"page\" ? \"page\" : \"config\",\n ];\n if (e.grader === \"command\" && !e.command) bits.push(pc.yellow(\"needs generation\"));\n if (e.skip) bits.push(pc.yellow(\"skip\"));\n lines.push(` - ${e.name} ${pc.dim(`[${bits.join(\", \")}]`)}`);\n }\n for (const pr of plan.problems) {\n const tag = pr.level === \"error\" ? pc.red(\"error\") : pc.yellow(\"warn\");\n const line = pr.line != null ? pc.dim(`:${pr.line}`) : \"\";\n lines.push(` ${tag}${line} ${pr.message}`);\n }\n }\n const total = run.plans.reduce((n, p) => n + p.evals.length, 0);\n lines.push(\"\");\n lines.push(pc.dim(`${run.plans.length} pages, ${total} evals resolved`));\n return lines.join(\"\\n\");\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
programName,
|
|
4
|
+
setProgramName
|
|
5
|
+
} from "./chunk-OWBRDNRZ.js";
|
|
6
|
+
import {
|
|
7
|
+
ToolError,
|
|
8
|
+
errorMessage
|
|
9
|
+
} from "./chunk-G3T47CFV.js";
|
|
10
|
+
|
|
11
|
+
// src/shared/run.ts
|
|
12
|
+
import { realpathSync } from "node:fs";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { CommanderError } from "commander";
|
|
15
|
+
function fail(err) {
|
|
16
|
+
const msg = err instanceof ToolError ? err.message : `Unexpected error: ${errorMessage(err)}`;
|
|
17
|
+
const prefix = programName();
|
|
18
|
+
for (const line of msg.replace(/\n+$/, "").split("\n")) {
|
|
19
|
+
process.stderr.write(`${prefix}: ${line}
|
|
20
|
+
`);
|
|
21
|
+
}
|
|
22
|
+
process.exit(2);
|
|
23
|
+
}
|
|
24
|
+
var STDIN_LINES_MARKER = "\0";
|
|
25
|
+
var STDIN_WITH_LINES = /^-(:[1-9][0-9]*(?:-[1-9][0-9]*)?)$/;
|
|
26
|
+
function normalizeStdinArgv(argv) {
|
|
27
|
+
return argv.map((arg) => {
|
|
28
|
+
const lines = STDIN_WITH_LINES.exec(arg)?.[1];
|
|
29
|
+
return lines === void 0 ? arg : `${STDIN_LINES_MARKER}${lines}`;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function runProgram(program, argv = process.argv) {
|
|
33
|
+
setProgramName(program.name());
|
|
34
|
+
try {
|
|
35
|
+
await program.parseAsync(normalizeStdinArgv(argv));
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (err instanceof CommanderError) {
|
|
38
|
+
process.exitCode = err.exitCode === 0 ? 0 : 2;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function isMainModule(moduleUrl) {
|
|
45
|
+
const entry = process.argv[1];
|
|
46
|
+
if (!entry) return false;
|
|
47
|
+
try {
|
|
48
|
+
return realpathSync(entry) === fileURLToPath(moduleUrl);
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function endOutputOnClosedReader(streams = [process.stdout, process.stderr]) {
|
|
54
|
+
for (const stream of streams) {
|
|
55
|
+
stream.on("error", (err) => {
|
|
56
|
+
if (err.code === "EPIPE") return;
|
|
57
|
+
throw err;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function runIfMain(moduleUrl, build) {
|
|
62
|
+
if (!isMainModule(moduleUrl)) return;
|
|
63
|
+
endOutputOnClosedReader();
|
|
64
|
+
Promise.resolve(build()).then(runProgram).catch(fail);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
fail,
|
|
69
|
+
STDIN_LINES_MARKER,
|
|
70
|
+
runIfMain
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-YEUYKR62.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/run.ts"],"sourcesContent":["/**\n * Running a commander program as a bin.\n *\n * Every entry point (`manni`, and `docmeta` for existing scripts) is the same\n * three lines: build the program, parse, and turn what escapes into an exit\n * code. Keeping that here means the exit-code contract (0 ok, 1 findings, 2\n * operational/usage) is written once, and the stderr prefix follows the bin\n * that was actually run.\n */\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { CommanderError, type Command } from \"commander\";\nimport { ToolError, errorMessage } from \"./errors.js\";\nimport { programName, setProgramName } from \"./program-name.js\";\n\n/**\n * Report an operational error on stderr and exit 2.\n *\n * Almost every message is one line. A few name a list the user has to fix in\n * one pass — every seed an `--exclude` pattern contradicts, say — and carry a\n * `\\n` between the lines. Each line gets the prefix, so a second line reads\n * like a message from the tool rather than like wrapped output.\n */\nexport function fail(err: unknown): never {\n const msg =\n err instanceof ToolError\n ? err.message\n : `Unexpected error: ${errorMessage(err)}`;\n const prefix = programName();\n // A trailing newline is the message's own, not a line of its own. Splitting\n // without dropping it would end the run on a bare `manni: `, which is what\n // an unexpected error carrying a library's newline-terminated message would\n // have printed.\n for (const line of msg.replace(/\\n+$/, \"\").split(\"\\n\")) {\n process.stderr.write(`${prefix}: ${line}\\n`);\n }\n process.exit(2);\n}\n\n/**\n * The marker a normalized stdin-with-lines argument carries in place of its\n * `-`. It is a NUL, which no path and no option can hold, and it never\n * reaches a message: a page read from stdin is labelled `<stdin>`.\n */\nexport const STDIN_LINES_MARKER = \"\\u0000\";\n\n/** `-:9`, `-:14-18`: stdin, and the lines of it a command was pointed at. */\nconst STDIN_WITH_LINES = /^-(:[1-9][0-9]*(?:-[1-9][0-9]*)?)$/;\n\n/**\n * Rewrite `-:L` so commander reads it as an operand.\n *\n * `-` is stdin in every command of the family, so `-:9` is stdin and a line\n * range, the form `cite add` takes its claim's lines in. Commander tells an\n * option from an operand lexically, by the leading `-`, and would reject the\n * token as an unknown option before any command saw it. The rewrite is here,\n * once, rather than in the one command that reads the form today: the rule\n * is about what `-` means to the family, not about that command.\n */\nexport function normalizeStdinArgv(argv: readonly string[]): string[] {\n return argv.map((arg) => {\n const lines = STDIN_WITH_LINES.exec(arg)?.[1];\n return lines === undefined ? arg : `${STDIN_LINES_MARKER}${lines}`;\n });\n}\n\nexport async function runProgram(\n program: Command,\n argv: string[] = process.argv,\n): Promise<void> {\n setProgramName(program.name());\n try {\n await program.parseAsync(normalizeStdinArgv(argv));\n } catch (err) {\n // `exitOverride()` makes commander throw on every terminating condition,\n // including the successful ones. Branch on `err.exitCode`, not on a list of\n // code strings: `--help` is `commander.helpDisplayed`, `-V` is\n // `commander.version`, and `help get` is a third code, `commander.help` —\n // all carrying exitCode 0, and a hand-written list would eventually miss\n // one and turn a success into a usage error.\n if (err instanceof CommanderError) {\n // Say nothing. `Command.error()` has already written the message and the\n // after-error hint; `fail()` would add \"Unexpected error: …\" on top,\n // because a CommanderError is not a ToolError.\n //\n // `process.exitCode`, not `process.exit()`: Node does not flush queued\n // async stderr writes on `process.exit`, which truncates the very message\n // the user needs.\n process.exitCode = err.exitCode === 0 ? 0 : 2;\n return;\n }\n throw err;\n }\n}\n\n/**\n * Whether `moduleUrl` is the file Node was asked to run.\n *\n * Pass the entry file's own `import.meta.url`. After bundling, shared code\n * lands in a chunk whose URL is never argv[1], so this cannot read\n * `import.meta.url` itself.\n */\nexport function isMainModule(moduleUrl: string): boolean {\n const entry = process.argv[1];\n if (!entry) return false;\n try {\n return realpathSync(entry) === fileURLToPath(moduleUrl);\n } catch {\n return false;\n }\n}\n\n/**\n * Treat a closed reader on stdout or stderr as the end of output.\n *\n * `manni cite check | head -1` closes the pipe while the command is still\n * writing, and the next write fails with EPIPE. Node emits that as an `error`\n * event on the stream, and with no listener it is thrown as an uncaught\n * exception: a stack trace and exit 1 from a command that did nothing wrong.\n *\n * The listener swallows EPIPE and nothing else, so any other stream error\n * still surfaces the way it did. The command then runs to completion and exits\n * with its own code rather than a fixed 0: `set -o pipefail; manni meta\n * validate | head` must still fail when validation does. Writes after the\n * pipe closed go nowhere, which is what the reader asked for.\n */\nexport function endOutputOnClosedReader(\n streams: readonly NodeJS.EventEmitter[] = [process.stdout, process.stderr],\n): void {\n for (const stream of streams) {\n stream.on(\"error\", (err: NodeJS.ErrnoException) => {\n if (err.code === \"EPIPE\") return;\n throw err;\n });\n }\n}\n\n/** Run `build()` as a bin when `moduleUrl` is the entry, and not when imported. */\nexport function runIfMain(\n moduleUrl: string,\n build: () => Command | Promise<Command>,\n): void {\n if (!isMainModule(moduleUrl)) return;\n endOutputOnClosedReader();\n Promise.resolve(build()).then(runProgram).catch(fail);\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,sBAAoC;AAYtC,SAAS,KAAK,KAAqB;AACxC,QAAM,MACJ,eAAe,YACX,IAAI,UACJ,qBAAqB,aAAa,GAAG,CAAC;AAC5C,QAAM,SAAS,YAAY;AAK3B,aAAW,QAAQ,IAAI,QAAQ,QAAQ,EAAE,EAAE,MAAM,IAAI,GAAG;AACtD,YAAQ,OAAO,MAAM,GAAG,MAAM,KAAK,IAAI;AAAA,CAAI;AAAA,EAC7C;AACA,UAAQ,KAAK,CAAC;AAChB;AAOO,IAAM,qBAAqB;AAGlC,IAAM,mBAAmB;AAYlB,SAAS,mBAAmB,MAAmC;AACpE,SAAO,KAAK,IAAI,CAAC,QAAQ;AACvB,UAAM,QAAQ,iBAAiB,KAAK,GAAG,IAAI,CAAC;AAC5C,WAAO,UAAU,SAAY,MAAM,GAAG,kBAAkB,GAAG,KAAK;AAAA,EAClE,CAAC;AACH;AAEA,eAAsB,WACpB,SACA,OAAiB,QAAQ,MACV;AACf,iBAAe,QAAQ,KAAK,CAAC;AAC7B,MAAI;AACF,UAAM,QAAQ,WAAW,mBAAmB,IAAI,CAAC;AAAA,EACnD,SAAS,KAAK;AAOZ,QAAI,eAAe,gBAAgB;AAQjC,cAAQ,WAAW,IAAI,aAAa,IAAI,IAAI;AAC5C;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACF;AASO,SAAS,aAAa,WAA4B;AACvD,QAAM,QAAQ,QAAQ,KAAK,CAAC;AAC5B,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI;AACF,WAAO,aAAa,KAAK,MAAM,cAAc,SAAS;AAAA,EACxD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAgBO,SAAS,wBACd,UAA0C,CAAC,QAAQ,QAAQ,QAAQ,MAAM,GACnE;AACN,aAAW,UAAU,SAAS;AAC5B,WAAO,GAAG,SAAS,CAAC,QAA+B;AACjD,UAAI,IAAI,SAAS,QAAS;AAC1B,YAAM;AAAA,IACR,CAAC;AAAA,EACH;AACF;AAGO,SAAS,UACd,WACA,OACM;AACN,MAAI,CAAC,aAAa,SAAS,EAAG;AAC9B,0BAAwB;AACxB,UAAQ,QAAQ,MAAM,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,IAAI;AACtD;","names":[]}
|