@hawkeyexl/manni 4.10.0 → 4.12.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/batch-EFSFG6GC.js +46 -0
- package/dist/build-NIO3UIWJ.js +36 -0
- package/dist/calibrate-6VO7URRV.js +41 -0
- package/dist/capture-NMBVJO3C.js +38 -0
- package/dist/check-SHOYX2B5.js +30 -0
- package/dist/check-XMJKH3KV.js +34 -0
- package/dist/{check-NLL4NRYA.js → check-Y62BJNC4.js} +35 -31
- package/dist/{check-NLL4NRYA.js.map → check-Y62BJNC4.js.map} +1 -1
- package/dist/{check-7B77ZD2N.js → check-ZMO3ZLMW.js} +19 -15
- package/dist/{chunk-PK7EKJ5T.js → chunk-24AJK2RG.js} +5 -10
- package/dist/chunk-24AJK2RG.js.map +1 -0
- package/dist/chunk-2OZF2VUB.js +164 -0
- package/dist/chunk-2OZF2VUB.js.map +1 -0
- package/dist/chunk-2UJZXVHR.js +1868 -0
- package/dist/chunk-2UJZXVHR.js.map +1 -0
- package/dist/{chunk-DNZUBCGZ.js → chunk-3BRJCQPY.js} +36 -7
- package/dist/chunk-3BRJCQPY.js.map +1 -0
- package/dist/{chunk-D2UW3ZCK.js → chunk-42VFJOAF.js} +13 -11
- package/dist/{chunk-D2UW3ZCK.js.map → chunk-42VFJOAF.js.map} +1 -1
- package/dist/{chunk-LQZQ5KGG.js → chunk-4Q24OYI3.js} +7 -7
- package/dist/{chunk-XU73V5XT.js → chunk-4WJTURRO.js} +15 -15
- package/dist/{chunk-WN47MNSK.js → chunk-5SID2SVL.js} +4 -4
- package/dist/{chunk-5REEVKGH.js → chunk-AANUY4BH.js} +2 -2
- package/dist/chunk-ANPIIYRH.js +2272 -0
- package/dist/chunk-ANPIIYRH.js.map +1 -0
- package/dist/{chunk-RZVCWX5R.js → chunk-AYVKN3PG.js} +4 -4
- package/dist/{chunk-2UCC26MO.js → chunk-CH6IOGXV.js} +9 -9
- package/dist/{chunk-RODZ7MB7.js → chunk-D5Z6B4M7.js} +6 -6
- package/dist/{chunk-IJ62BB2T.js → chunk-D6SELXQ2.js} +7 -7
- package/dist/{chunk-2JV7C4YV.js → chunk-DDILEF5F.js} +890 -1399
- package/dist/chunk-DDILEF5F.js.map +1 -0
- package/dist/{chunk-3E2X2RBU.js → chunk-DGRLHDM4.js} +9 -9
- package/dist/{chunk-2BV4FBC7.js → chunk-DHGB4JBG.js} +4 -3
- package/dist/chunk-DHGB4JBG.js.map +1 -0
- package/dist/{chunk-6LR73NMO.js → chunk-DLU5FCFT.js} +30 -28
- package/dist/chunk-DLU5FCFT.js.map +1 -0
- package/dist/chunk-DSWKBZWW.js +16 -0
- package/dist/chunk-DSWKBZWW.js.map +1 -0
- package/dist/{chunk-BD7IXBWE.js → chunk-F564FHMQ.js} +8 -8
- package/dist/{chunk-ABHG6I3G.js → chunk-FKAZUZQU.js} +469 -85
- package/dist/chunk-FKAZUZQU.js.map +1 -0
- package/dist/{chunk-DFCQ6BMI.js → chunk-G3MBUL5M.js} +4 -4
- package/dist/{chunk-SUTMSDQ2.js → chunk-GQ3KRY3B.js} +3 -3
- package/dist/chunk-HDPN46JP.js +393 -0
- package/dist/chunk-HDPN46JP.js.map +1 -0
- package/dist/{chunk-EAUIQADY.js → chunk-IQQAJROD.js} +6 -6
- package/dist/{chunk-ZHRPH52H.js → chunk-IZXN3WI6.js} +2 -2
- package/dist/{chunk-NCPWXHDO.js → chunk-JEUFYSFQ.js} +4 -4
- package/dist/{chunk-G6FNWRAI.js → chunk-JSSM7VVV.js} +4 -4
- package/dist/{chunk-CCWMACJL.js → chunk-KFGZPVFA.js} +229 -821
- package/dist/chunk-KFGZPVFA.js.map +1 -0
- package/dist/{chunk-H26VDFDS.js → chunk-KGFSPJLD.js} +2 -2
- package/dist/{chunk-AO5TSDKT.js → chunk-KMORGMCW.js} +7 -7
- package/dist/{chunk-WQWKYAAK.js → chunk-NUQF5F5J.js} +2 -2
- package/dist/{chunk-2YJ5H5E6.js → chunk-NZ6KSHFD.js} +23 -21
- package/dist/{chunk-2YJ5H5E6.js.map → chunk-NZ6KSHFD.js.map} +1 -1
- package/dist/{chunk-7Y3N4Y72.js → chunk-OHUDZRLK.js} +3 -3
- package/dist/{chunk-GCKHSBEN.js → chunk-OKMTUAWO.js} +4 -4
- package/dist/{chunk-6M5VJOC2.js → chunk-OTJOBZJ5.js} +167 -166
- package/dist/chunk-OTJOBZJ5.js.map +1 -0
- package/dist/{chunk-2W34HX2U.js → chunk-PS257NIU.js} +288 -373
- package/dist/chunk-PS257NIU.js.map +1 -0
- package/dist/chunk-QDC7JPFG.js +685 -0
- package/dist/chunk-QDC7JPFG.js.map +1 -0
- package/dist/chunk-QEAGL4V5.js +3185 -0
- package/dist/chunk-QEAGL4V5.js.map +1 -0
- package/dist/{chunk-GB2XPITA.js → chunk-QMY57PVW.js} +2 -2
- package/dist/{chunk-55GMOVKW.js → chunk-QNDDPXFR.js} +2 -2
- package/dist/{chunk-GXN7RRHR.js → chunk-QSIXNTRV.js} +4 -4
- package/dist/{chunk-G7XD4QH5.js → chunk-RGLFV4KO.js} +11372 -10218
- package/dist/chunk-RGLFV4KO.js.map +1 -0
- package/dist/{chunk-QBVP3SQP.js → chunk-SGR7ZAVE.js} +13 -7
- package/dist/chunk-SGR7ZAVE.js.map +1 -0
- package/dist/{chunk-KBG463UK.js → chunk-SMHAYK6I.js} +2409 -5243
- package/dist/chunk-SMHAYK6I.js.map +1 -0
- package/dist/{chunk-XG6PVB5S.js → chunk-SSQZB5SQ.js} +1 -11
- package/dist/chunk-SSQZB5SQ.js.map +1 -0
- package/dist/{chunk-GDLHTI5R.js → chunk-STPGIKPY.js} +8 -2
- package/dist/chunk-STPGIKPY.js.map +1 -0
- package/dist/{chunk-QJRQ4BRC.js → chunk-U22TOL5Y.js} +17 -17
- package/dist/{chunk-NGTVREIH.js → chunk-U6IHLEWT.js} +2 -2
- package/dist/{chunk-Z5YHMRLF.js → chunk-UUCCV3SI.js} +2 -2
- package/dist/{chunk-ZXXFP2LA.js → chunk-UXMCHBOJ.js} +2 -2
- package/dist/{chunk-VZVEP2OZ.js → chunk-VFAKGIDG.js} +2 -2
- package/dist/{chunk-QCHVR4ZM.js → chunk-VM7VAFJW.js} +33 -7
- package/dist/chunk-VM7VAFJW.js.map +1 -0
- package/dist/{chunk-VQK4VHLF.js → chunk-YQV75FIL.js} +2 -2
- package/dist/chunk-YUTVAMWW.js +2 -0
- package/dist/chunk-ZPLVANY2.js +15 -0
- package/dist/chunk-ZPLVANY2.js.map +1 -0
- package/dist/{cli-BIIUKPTE.js → cli-4CR7QIOK.js} +26 -22
- package/dist/{cli-BIIUKPTE.js.map → cli-4CR7QIOK.js.map} +1 -1
- package/dist/{cli-V2DI3K2R.js → cli-6R4W3HAH.js} +37 -33
- package/dist/{cli-V2DI3K2R.js.map → cli-6R4W3HAH.js.map} +1 -1
- package/dist/{cli-HO62TOM2.js → cli-BOMA2FMP.js} +14 -11
- package/dist/{cli-EH3I4IUX.js → cli-EDQPQOCE.js} +47 -41
- package/dist/cli-EDQPQOCE.js.map +1 -0
- package/dist/{cli-P2X7PNY6.js → cli-GBF76EXT.js} +25 -20
- package/dist/{cli-P2X7PNY6.js.map → cli-GBF76EXT.js.map} +1 -1
- package/dist/{cli-4YYC6LCY.js → cli-MQYCF3SR.js} +27 -23
- package/dist/{cli-4YYC6LCY.js.map → cli-MQYCF3SR.js.map} +1 -1
- package/dist/{cli-UETKXHJN.js → cli-OJKFXQOM.js} +9 -9
- package/dist/{cli-LWST5FQH.js → cli-PHZAO4LZ.js} +4 -4
- package/dist/{cli-TELPAMJO.js → cli-PTKFFNOW.js} +59 -35
- package/dist/cli-PTKFFNOW.js.map +1 -0
- package/dist/{cli-SGVFZOAW.js → cli-UW2K5Z5J.js} +34 -29
- package/dist/{cli-SGVFZOAW.js.map → cli-UW2K5Z5J.js.map} +1 -1
- package/dist/cli-XXTNPPKB.js +83 -0
- package/dist/cli-XXTNPPKB.js.map +1 -0
- package/dist/cli.js +24 -12
- package/dist/cli.js.map +1 -1
- package/dist/{config-TYXYQK3I.js → config-JJW75SBX.js} +5 -5
- package/dist/docmeta.js +13 -10
- package/dist/docmeta.js.map +1 -1
- package/dist/github-6VQKSB67.js +35 -0
- package/dist/github-RBSEM7ZK.js +30 -0
- package/dist/graph/runtime.d.ts +4 -1
- package/dist/graph/runtime.js +20 -9
- package/dist/graph/runtime.js.map +1 -1
- package/dist/{host-6GURH5HE.js → host-YSTYO5DX.js} +3 -3
- package/dist/index.d.ts +1214 -940
- package/dist/index.js +190 -160
- package/dist/index.js.map +1 -1
- package/dist/{json-QR4G35KA.js → json-PU2HLHDQ.js} +18 -14
- package/dist/labels-SJNSOPBI.js +73 -0
- package/dist/labels-SJNSOPBI.js.map +1 -0
- package/dist/lint-KIVTHLGU.js +34 -0
- package/dist/list-RDEJDDJF.js +32 -0
- package/dist/list-SUTDWL2J.js +35 -0
- package/dist/{page-FSXDXCDD.js → page-UMAA3NCM.js} +18 -13
- package/dist/{prepare-UPIBTFNS.js → prepare-3I3LOXXD.js} +24 -20
- package/dist/{prepare-UPIBTFNS.js.map → prepare-3I3LOXXD.js.map} +1 -1
- package/dist/{pretty-4IONWSEP.js → pretty-ANLRHU4O.js} +18 -14
- package/dist/{pretty-R4BQD2VH.js → pretty-Q3ZFKOR7.js} +18 -14
- package/dist/{provider-527CO4DM.js → provider-LBX4IXGX.js} +3 -3
- package/dist/{release-3D5PK6M7.js → release-VV3UTKE5.js} +3 -3
- package/dist/{reporters-M6LJ2IYU.js → reporters-26H3N2KW.js} +3 -3
- package/dist/{reporters-DHO2BXAD.js → reporters-ILT36CIH.js} +7 -7
- package/dist/{reporters-FPP6JNDP.js → reporters-PNDLWT6K.js} +16 -12
- package/dist/run-QXCK33Z4.js +37 -0
- package/dist/{term-ASM4LVYC.js → term-D2N7UN4P.js} +981 -138
- package/dist/term-D2N7UN4P.js.map +1 -0
- package/dist/validate-BRUCOT2O.js +19 -0
- package/dist/validate-BRUCOT2O.js.map +1 -0
- package/package.json +3 -2
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/shapes/graph/shapes-1.1.0.ttl +785 -0
- package/dist/batch-6NICDKRE.js +0 -41
- package/dist/build-3KP2K3XN.js +0 -32
- package/dist/calibrate-LUA3DWKD.js +0 -36
- package/dist/capture-NETOHCB4.js +0 -34
- package/dist/check-E4QCB7LS.js +0 -20
- package/dist/check-PTECPIIB.js +0 -26
- package/dist/chunk-2BV4FBC7.js.map +0 -1
- package/dist/chunk-2JV7C4YV.js.map +0 -1
- package/dist/chunk-2W34HX2U.js.map +0 -1
- package/dist/chunk-4DLF5SA4.js +0 -392
- package/dist/chunk-4DLF5SA4.js.map +0 -1
- package/dist/chunk-6AGESHHM.js +0 -387
- package/dist/chunk-6AGESHHM.js.map +0 -1
- package/dist/chunk-6LR73NMO.js.map +0 -1
- package/dist/chunk-6M5VJOC2.js.map +0 -1
- package/dist/chunk-ABHG6I3G.js.map +0 -1
- package/dist/chunk-CCWMACJL.js.map +0 -1
- package/dist/chunk-DNZUBCGZ.js.map +0 -1
- package/dist/chunk-G7XD4QH5.js.map +0 -1
- package/dist/chunk-GDLHTI5R.js.map +0 -1
- package/dist/chunk-KBG463UK.js.map +0 -1
- package/dist/chunk-PK7EKJ5T.js.map +0 -1
- package/dist/chunk-QBVP3SQP.js.map +0 -1
- package/dist/chunk-QCHVR4ZM.js.map +0 -1
- package/dist/chunk-VVVKBUBO.js +0 -818
- package/dist/chunk-VVVKBUBO.js.map +0 -1
- package/dist/chunk-XG6PVB5S.js.map +0 -1
- package/dist/cli-EH3I4IUX.js.map +0 -1
- package/dist/cli-TELPAMJO.js.map +0 -1
- package/dist/github-ESK45CEZ.js +0 -26
- package/dist/github-WER7JUTN.js +0 -31
- package/dist/lint-QTI7XK2A.js +0 -30
- package/dist/list-JO4G3TS3.js +0 -30
- package/dist/list-O2MJUP5V.js +0 -28
- package/dist/run-YH5Z7RJ7.js +0 -32
- package/dist/term-ASM4LVYC.js.map +0 -1
- package/dist/validate-7JI3H57P.js +0 -17
- /package/dist/{batch-6NICDKRE.js.map → batch-EFSFG6GC.js.map} +0 -0
- /package/dist/{build-3KP2K3XN.js.map → build-NIO3UIWJ.js.map} +0 -0
- /package/dist/{calibrate-LUA3DWKD.js.map → calibrate-6VO7URRV.js.map} +0 -0
- /package/dist/{capture-NETOHCB4.js.map → capture-NMBVJO3C.js.map} +0 -0
- /package/dist/{check-7B77ZD2N.js.map → check-SHOYX2B5.js.map} +0 -0
- /package/dist/{check-E4QCB7LS.js.map → check-XMJKH3KV.js.map} +0 -0
- /package/dist/{check-PTECPIIB.js.map → check-ZMO3ZLMW.js.map} +0 -0
- /package/dist/{chunk-LQZQ5KGG.js.map → chunk-4Q24OYI3.js.map} +0 -0
- /package/dist/{chunk-XU73V5XT.js.map → chunk-4WJTURRO.js.map} +0 -0
- /package/dist/{chunk-WN47MNSK.js.map → chunk-5SID2SVL.js.map} +0 -0
- /package/dist/{chunk-5REEVKGH.js.map → chunk-AANUY4BH.js.map} +0 -0
- /package/dist/{chunk-RZVCWX5R.js.map → chunk-AYVKN3PG.js.map} +0 -0
- /package/dist/{chunk-2UCC26MO.js.map → chunk-CH6IOGXV.js.map} +0 -0
- /package/dist/{chunk-RODZ7MB7.js.map → chunk-D5Z6B4M7.js.map} +0 -0
- /package/dist/{chunk-IJ62BB2T.js.map → chunk-D6SELXQ2.js.map} +0 -0
- /package/dist/{chunk-3E2X2RBU.js.map → chunk-DGRLHDM4.js.map} +0 -0
- /package/dist/{chunk-BD7IXBWE.js.map → chunk-F564FHMQ.js.map} +0 -0
- /package/dist/{chunk-DFCQ6BMI.js.map → chunk-G3MBUL5M.js.map} +0 -0
- /package/dist/{chunk-SUTMSDQ2.js.map → chunk-GQ3KRY3B.js.map} +0 -0
- /package/dist/{chunk-EAUIQADY.js.map → chunk-IQQAJROD.js.map} +0 -0
- /package/dist/{chunk-ZHRPH52H.js.map → chunk-IZXN3WI6.js.map} +0 -0
- /package/dist/{chunk-NCPWXHDO.js.map → chunk-JEUFYSFQ.js.map} +0 -0
- /package/dist/{chunk-G6FNWRAI.js.map → chunk-JSSM7VVV.js.map} +0 -0
- /package/dist/{chunk-H26VDFDS.js.map → chunk-KGFSPJLD.js.map} +0 -0
- /package/dist/{chunk-AO5TSDKT.js.map → chunk-KMORGMCW.js.map} +0 -0
- /package/dist/{chunk-WQWKYAAK.js.map → chunk-NUQF5F5J.js.map} +0 -0
- /package/dist/{chunk-7Y3N4Y72.js.map → chunk-OHUDZRLK.js.map} +0 -0
- /package/dist/{chunk-GCKHSBEN.js.map → chunk-OKMTUAWO.js.map} +0 -0
- /package/dist/{chunk-GB2XPITA.js.map → chunk-QMY57PVW.js.map} +0 -0
- /package/dist/{chunk-55GMOVKW.js.map → chunk-QNDDPXFR.js.map} +0 -0
- /package/dist/{chunk-GXN7RRHR.js.map → chunk-QSIXNTRV.js.map} +0 -0
- /package/dist/{chunk-QJRQ4BRC.js.map → chunk-U22TOL5Y.js.map} +0 -0
- /package/dist/{chunk-NGTVREIH.js.map → chunk-U6IHLEWT.js.map} +0 -0
- /package/dist/{chunk-Z5YHMRLF.js.map → chunk-UUCCV3SI.js.map} +0 -0
- /package/dist/{chunk-ZXXFP2LA.js.map → chunk-UXMCHBOJ.js.map} +0 -0
- /package/dist/{chunk-VZVEP2OZ.js.map → chunk-VFAKGIDG.js.map} +0 -0
- /package/dist/{chunk-VQK4VHLF.js.map → chunk-YQV75FIL.js.map} +0 -0
- /package/dist/{cli-HO62TOM2.js.map → chunk-YUTVAMWW.js.map} +0 -0
- /package/dist/{config-TYXYQK3I.js.map → cli-BOMA2FMP.js.map} +0 -0
- /package/dist/{cli-UETKXHJN.js.map → cli-OJKFXQOM.js.map} +0 -0
- /package/dist/{cli-LWST5FQH.js.map → cli-PHZAO4LZ.js.map} +0 -0
- /package/dist/{github-ESK45CEZ.js.map → config-JJW75SBX.js.map} +0 -0
- /package/dist/{github-WER7JUTN.js.map → github-6VQKSB67.js.map} +0 -0
- /package/dist/{host-6GURH5HE.js.map → github-RBSEM7ZK.js.map} +0 -0
- /package/dist/{json-QR4G35KA.js.map → host-YSTYO5DX.js.map} +0 -0
- /package/dist/{lint-QTI7XK2A.js.map → json-PU2HLHDQ.js.map} +0 -0
- /package/dist/{list-JO4G3TS3.js.map → lint-KIVTHLGU.js.map} +0 -0
- /package/dist/{list-O2MJUP5V.js.map → list-RDEJDDJF.js.map} +0 -0
- /package/dist/{page-FSXDXCDD.js.map → list-SUTDWL2J.js.map} +0 -0
- /package/dist/{pretty-4IONWSEP.js.map → page-UMAA3NCM.js.map} +0 -0
- /package/dist/{pretty-R4BQD2VH.js.map → pretty-ANLRHU4O.js.map} +0 -0
- /package/dist/{provider-527CO4DM.js.map → pretty-Q3ZFKOR7.js.map} +0 -0
- /package/dist/{reporters-DHO2BXAD.js.map → provider-LBX4IXGX.js.map} +0 -0
- /package/dist/{release-3D5PK6M7.js.map → release-VV3UTKE5.js.map} +0 -0
- /package/dist/{reporters-FPP6JNDP.js.map → reporters-26H3N2KW.js.map} +0 -0
- /package/dist/{reporters-M6LJ2IYU.js.map → reporters-ILT36CIH.js.map} +0 -0
- /package/dist/{run-YH5Z7RJ7.js.map → reporters-PNDLWT6K.js.map} +0 -0
- /package/dist/{validate-7JI3H57P.js.map → run-QXCK33Z4.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/docevals/cli.ts"],"sourcesContent":["/**\n * The docevals program. Named `docevals` because that is where it is mounted\n * (`manni docevals …`); `src/cli.ts` adds it to the umbrella and runs it.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport { collect, configOption } from \"../shared/cli-options.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport type { DocumentInputOptions } from \"./core/discover.js\";\nimport { colorFor, palette } from \"../shared/color.js\";\nimport { DocevalsError } from \"./types.js\";\nimport { allowExecutionMessage, isExecutionGrant } from \"../shared/execution.js\";\nimport { runList, renderList } from \"./commands/list.js\";\nimport { runRun } from \"./commands/run.js\";\nimport { runGenerate } from \"./commands/generate.js\";\nimport { runFill, renderFill } from \"./commands/fill.js\";\nimport { runPromote } from \"./commands/promote.js\";\nimport { listReviews, renderReviews, runReview } from \"./commands/review.js\";\nimport {\n runCalibrate,\n renderCalibration,\n seedGoldenCases,\n} from \"./commands/calibrate.js\";\nimport { runInit } from \"./commands/init.js\";\nimport {\n render,\n parseFormat,\n REPORT_FORMATS,\n SUMMARY_FORMATS,\n type ReportFormat,\n type SummaryFormat,\n} from \"./reporters/index.js\";\n\n/**\n * Whether `command`'s output gets colour: the family's rule, read off this\n * domain's `--no-color`. Exported for the tests that pin it.\n */\nexport { colorFor };\n\nexport function buildProgram(): Command {\n const program = new Command();\n\n program\n .name(\"docevals\")\n .description(\n \"Deterministic and LLM-as-judge evals for documentation pages, driven by frontmatter.\",\n )\n .version(pkg.version)\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand calling\n // `process.exit(1)` on a parse error, which is a usage error owed exit 2.\n .exitOverride();\n\n /**\n * Repeatable execution grant, validated on the way in.\n *\n * An unknown value is a usage error rather than a silent no-op (ADR 01007, the\n * same rule `--format` follows): a mistyped grant that quietly granted nothing\n * would skip every command eval and still exit 0, which reads as \"the corpus\n * is clean\" rather than \"you misspelled a flag\".\n */\n function collectGrant(value: string, previous: string[]): string[] {\n if (!isExecutionGrant(value)) {\n fail(new DocevalsError(allowExecutionMessage(value)));\n }\n return [...previous, value];\n }\n\n function parseIntArg(name: string) {\n return (value: string): number => {\n const n = Number.parseInt(value, 10);\n if (Number.isNaN(n) || n < 1) {\n fail(new DocevalsError(`${name} must be a positive integer, got \"${value}\"`));\n }\n return n;\n };\n }\n\n /**\n * Repeatable single-value option, e.g. `--eval a --eval b`.\n *\n * NOT commander's variadic `<name...>`: a variadic consumes every following\n * non-option token, so `run --eval fresh-enough docs/guide.md` parsed the glob\n * as a second eval name and left `globs` empty — silently widening the run to\n * the whole configured corpus, which is the opposite of what selection is for.\n */\n function collectArg(value: string, previous: string[]): string[] {\n return [...previous, value];\n }\n\n function parseFloatArg(name: string) {\n return (value: string): number => {\n const n = Number.parseFloat(value);\n if (Number.isNaN(n) || n < 0) {\n fail(new DocevalsError(`${name} must be a non-negative number, got \"${value}\"`));\n }\n return n;\n };\n }\n\n /**\n * Commander argument parser for `-f/--format` (ADR 01007). Routes through\n * `fail()` for the same reason the numeric parsers do: commander only special-\n * cases InvalidArgumentError, so any other exception escapes `program.parse()`\n * uncaught — a stack trace and exit 1, when a bad flag owes exit 2.\n */\n function parseFormatArg<T extends string>(name: string, allowed: readonly T[]) {\n return (value: string): T => {\n try {\n return parseFormat(value, allowed, name);\n } catch (e) {\n fail(e);\n }\n };\n }\n\n /**\n * The document-set surface every verb that reads pages shares (proposal\n * 0041): positional `[paths...]`, `--collection` and `--exclude` (each one\n * value per occurrence), and `-c`/`--no-config`. Declared once so the five\n * verbs cannot drift apart on a name or a description.\n */\n function documentInputs(command: Command, verb: string): Command {\n return command\n .argument(\n \"[paths...]\",\n `Files, directories, or globs to ${verb} (default: the configured collections)`,\n )\n .option(\n \"--collection <name>\",\n \"Configured collection to read (repeatable)\",\n collect,\n [],\n )\n .option(\"--exclude <glob>\", \"Glob to exclude (repeatable)\", collect, [])\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n }\n\n /** The shared options as the command cores take them. */\n function documentOptions(opts: {\n collection?: string[];\n exclude?: string[];\n config?: string | boolean;\n }): DocumentInputOptions {\n const { configPath, noConfig } = configOption(opts.config);\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n ...(opts.exclude === undefined ? {} : { exclude: opts.exclude }),\n };\n }\n\n documentInputs(\n program\n .command(\"list\")\n .description(\"Show the resolved eval plan per page without running anything\"),\n \"list\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${SUMMARY_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", SUMMARY_FORMATS),\n \"pretty\" as SummaryFormat,\n )\n .option(\"--eval <name>\", \"Show only this eval (repeatable)\", collectArg, [])\n .option(\"--suite <name>\", \"Show only evals in this suite\")\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n format: SummaryFormat;\n eval?: string[];\n suite?: string;\n },\n command: Command,\n ) => {\n try {\n const run = await runList(paths, {\n ...documentOptions(opts),\n format: opts.format,\n evalNames: opts.eval,\n suite: opts.suite,\n });\n console.log(\n renderList(run, opts.format, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = run.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program.command(\"run\").description(\"Run evals against documentation pages\"),\n \"evaluate\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${REPORT_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", REPORT_FORMATS),\n \"pretty\" as ReportFormat,\n )\n .option(\"--deterministic-only\", \"Run only command/tool graders, skip the AI judge\")\n .option(\"--ai-only\", \"Run only AI-judged evals, skip deterministic graders\")\n .option(\n // `<kind>`, not `<kind...>`: a variadic option greedily eats the\n // positional `[paths...]` that follow it, so `--allow-execution\n // frontmatter-commands docs/**` would silently swallow the glob and run\n // over the default file set instead. Repeat the flag to grant twice.\n \"--allow-execution <kind>\",\n \"Run only these execution grants (repeatable): frontmatter-commands\",\n collectGrant,\n [],\n )\n .option(\"--no-execution\", \"Clear every execution grant for this run\")\n .option(\"--no-generate\", \"Do not generate scripts for command evals missing a command\")\n .option(\"--no-cache\", \"Bypass the judge response cache\")\n .option(\"--fail-on-review\", \"Exit 1 when any eval lands in the human-review zone\")\n .option(\"--provider <name>\", \"Judge provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--runs <n>\", \"Ensemble runs per eval\", parseIntArg(\"--runs\"))\n .option(\n \"--chunk-chars <n>\",\n \"Characters of page per judge call; longer pages are read in parts\",\n parseIntArg(\"--chunk-chars\"),\n )\n .option(\n \"--eval <name>\",\n \"Run only this eval (repeatable); suite targets are not evaluated on a filtered run\",\n collectArg,\n [],\n )\n .option(\"--suite <name>\", \"Run only evals in this suite\")\n .option(\n \"--since <ref>\",\n \"Evaluate only pages whose file or eval manifest changed between this git ref and HEAD\",\n )\n .option(\n \"--newer-than <duration>\",\n \"Evaluate only pages whose file or eval manifest changed within this window, \" +\n \"such as 30m, 24h, 7d or 2w; in CI, prefer --since\",\n )\n .option(\n \"--max-turns <n>\",\n \"Stop after this many ensemble runs (a cached ensemble costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\n \"--baseline [path]\",\n \"Fail only on findings a recorded baseline does not already hold\",\n )\n .option(\"--no-baseline\", \"Ignore the configured baseline for this run\")\n .option(\n \"--write-baseline [path]\",\n \"Record this run's findings as the baseline; without a path, the configured one\",\n )\n .action(async (paths: string[], opts: Record<string, unknown>, command: Command) => {\n try {\n const report = await runRun(paths, {\n ...documentOptions({\n config: opts.config as string | boolean | undefined,\n collection: opts.collection as string[] | undefined,\n exclude: opts.exclude as string[] | undefined,\n }),\n // parseFormatArg validated this at parse time; the cast only re-narrows\n // from the `unknown` that the Record-typed options bag erases it to.\n format: opts.format as ReportFormat,\n deterministicOnly: opts.deterministicOnly as boolean | undefined,\n aiOnly: opts.aiOnly as boolean | undefined,\n // Commander's default is `[]`, which is \"no flag\", not \"run nothing\":\n // only a list someone typed narrows the run.\n allowExecution:\n (opts.allowExecution as string[]).length > 0\n ? (opts.allowExecution as string[])\n : undefined,\n execution: opts.execution as boolean | undefined,\n generate: opts.generate as boolean | undefined,\n cache: opts.cache as boolean | undefined,\n failOnReview: opts.failOnReview as boolean | undefined,\n provider: opts.provider as string | undefined,\n model: opts.model as string | undefined,\n local: opts.local as boolean | undefined,\n runs: opts.runs as number | undefined,\n chunkChars: opts.chunkChars as number | undefined,\n maxTurns: opts.maxTurns as number | undefined,\n evalNames: opts.eval as string[] | undefined,\n suite: opts.suite as string | undefined,\n since: opts.since as string | undefined,\n newerThan: opts.newerThan as string | undefined,\n // commander collapses `--baseline` to true and `--no-baseline` to\n // false on the same key; a string is an explicit path.\n baseline: opts.baseline as string | boolean | undefined,\n writeBaseline: opts.writeBaseline as string | boolean | undefined,\n toolVersion: pkg.version,\n });\n console.log(\n render(report, opts.format as ReportFormat, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program\n .command(\"generate\")\n .description(\n \"Generate check scripts for command evals with a plain-language assertion but no command\",\n ),\n \"read\",\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n provider?: string;\n model?: string;\n local?: boolean;\n },\n command: Command,\n ) => {\n try {\n const pc = palette(colorFor(command, process.stdout.isTTY));\n const result = await runGenerate(paths, {\n ...documentOptions(opts),\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n if (result.targets === 0) {\n console.log(\"Nothing to generate — every command eval has a command.\");\n return;\n }\n console.log(\n `Generated ${result.generatedPaths.length}/${result.targets} check script(s):`,\n );\n for (const p of result.generatedPaths) console.log(` ${p}`);\n // Evals whose command reference had nowhere to go (proposal 0047).\n for (const r of result.refusals) console.log(pc.red(` ${r.message}`));\n if (result.generatedPaths.length < result.targets) {\n process.exitCode = 1;\n }\n } catch (e) {\n fail(e);\n }\n },\n );\n\n documentInputs(\n program\n .command(\"fill\")\n .description(\n \"Propose frontmatter evals for pages with an LLM; writes proposals at or above the confidence threshold\",\n ),\n \"fill\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${SUMMARY_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", SUMMARY_FORMATS),\n \"pretty\" as SummaryFormat,\n )\n .option(\"--dry-run\", \"Report proposals without writing frontmatter\")\n .option(\n \"--confidence <n>\",\n \"Minimum confidence to write (0-1, default: config fill.confidenceThreshold)\",\n parseFloatArg(\"--confidence\"),\n )\n .option(\n \"--max-turns <n>\",\n \"Stop after this many inference calls (a cached page costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\"--no-cache\", \"Bypass the fill proposal cache\")\n .option(\n \"--chunk-chars <n>\",\n \"Characters of page per fill call; longer pages are proposed in parts\",\n parseIntArg(\"--chunk-chars\"),\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(async (paths: string[], opts: Record<string, unknown>, command: Command) => {\n try {\n const confidence = opts.confidence as number | undefined;\n if (confidence !== undefined && confidence > 1) {\n fail(new DocevalsError(`--confidence must be between 0 and 1, got ${confidence}`));\n }\n const report = await runFill(paths, {\n ...documentOptions({\n config: opts.config as string | boolean | undefined,\n collection: opts.collection as string[] | undefined,\n exclude: opts.exclude as string[] | undefined,\n }),\n dryRun: opts.dryRun as boolean | undefined,\n confidence,\n maxTurns: opts.maxTurns as number | undefined,\n noCache: opts.cache === false ? true : undefined,\n provider: opts.provider as string | undefined,\n model: opts.model as string | undefined,\n local: opts.local as boolean | undefined,\n // P1 (proposal 0047): offered only on a terminal, where there is\n // someone to answer. Off one the evals go to the page and the W1\n // line says so.\n confirm: terminalConfirm(),\n onNotice: notice,\n onRelocated: (result) => {\n const manifests = result.manifests.map((m) => m.file).join(\", \");\n notice(\n `moved ${String(result.summary.moved)} value(s) into ${manifests}.`,\n );\n },\n });\n // As in `run`: parseFormatArg validated this at parse time, and the cast\n // only re-narrows from the `unknown` the Record-typed options bag erases\n // it to. renderFill guards itself regardless.\n console.log(\n renderFill(report, opts.format as SummaryFormat, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program\n .command(\"promote\")\n .description(\n \"Find ai-graded evals expressible as deterministic checks; --write converts them\",\n ),\n \"read\",\n )\n .option(\"--write\", \"Apply promotions (write scripts and rewrite evals)\")\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n write?: boolean;\n provider?: string;\n model?: string;\n local?: boolean;\n },\n command: Command,\n ) => {\n try {\n const pc = palette(colorFor(command, process.stdout.isTTY));\n const proposals = await runPromote(paths, {\n ...documentOptions(opts),\n write: opts.write,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n if (proposals.length === 0) {\n console.log(\"No ai-graded evals found.\");\n return;\n }\n for (const p of proposals) {\n const tag = p.promotable\n ? p.applied\n ? pc.green(\"promoted\")\n : pc.cyan(\"promotable\")\n : pc.dim(\"keep-ai\");\n const script = p.scriptPath ? pc.dim(` -> ${p.scriptPath}`) : \"\";\n console.log(`${tag} ${p.evalName} (${p.source}, ${p.file})${script}`);\n console.log(pc.dim(` ${p.rationale}`));\n // Promotable, and nowhere to write it (proposal 0047).\n if (p.error !== undefined) console.log(pc.red(` ${p.error}`));\n }\n if (!opts.write && proposals.some((p) => p.promotable)) {\n console.log(pc.cyan(\"\\nRe-run with --write to apply promotions.\"));\n }\n } catch (e) {\n fail(e);\n }\n },\n );\n\n program\n .command(\"calibrate\")\n .description(\n \"Measure judge agreement against a human-verified golden set (.manni/docevals/golden/*.yaml)\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--golden <dir>\", \"Golden set directory\", \".manni/docevals/golden\")\n .option(\n \"--seed\",\n \"Write golden candidates from recorded reviews and exit; judges nothing, needs no provider\",\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--runs <n>\", \"Ensemble runs per case\", parseIntArg(\"--runs\"))\n .option(\n \"--max-turns <n>\",\n \"Stop after this many ensemble runs (a cached ensemble costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\"--no-cache\", \"Bypass the judge response cache\")\n .action(\n async (opts: {\n config?: string;\n golden?: string;\n seed?: boolean;\n provider?: string;\n model?: string;\n local?: boolean;\n runs?: number;\n maxTurns?: number;\n cache?: boolean;\n }, command: Command) => {\n try {\n const color = colorFor(command, process.stdout.isTTY);\n const pc = palette(color);\n if (opts.seed) {\n // No `config`: reviews.yaml and the golden directory both resolve\n // against the working directory, not the config's, so passing it\n // would imply an influence it does not have.\n const seeded = seedGoldenCases({ golden: opts.golden });\n if (seeded.total === 0) {\n console.log(\n \"No recorded reviews to seed from — run `manni docevals review <file> <eval> <pass|fail>` first.\",\n );\n return;\n }\n // The lead number is what moved, not the file's size: `total`\n // counts cases already confirmed and left alone, so leading with it\n // read as \"wrote 8 candidates\" on a re-seed that wrote none.\n const changed = seeded.added + seeded.updated;\n console.log(\n changed === 0\n ? `No new reviews to seed — ${seeded.total} golden case(s) already in ${seeded.path}.`\n : `Wrote ${changed} golden candidate(s) to ${seeded.path} ` +\n `(${seeded.added} new, ${seeded.updated} updated; ${seeded.total} total).`,\n );\n if (seeded.unreviewed > 0) {\n console.log(\n pc.yellow(\n `${seeded.unreviewed} case(s) are \\`reviewed: false\\`. Read them and set ` +\n \"`reviewed: true` — a golden set assembled without a human is not one.\",\n ),\n );\n }\n return;\n }\n const report = await runCalibrate({\n config: opts.config,\n golden: opts.golden,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n runs: opts.runs,\n maxTurns: opts.maxTurns,\n noCache: opts.cache === false,\n });\n console.log(renderCalibration(report, { color }));\n // Both conditions: the judge has to agree enough, AND the set has to\n // have been measured. A stale golden file whose pages were renamed\n // used to certify on whatever still resolved.\n process.exitCode =\n report.meetsThreshold &&\n report.unjudged === 0 &&\n report.balanced\n ? 0\n : 1;\n } catch (e) {\n fail(e);\n }\n },\n );\n\n program\n .command(\"init\")\n .description(\"Create a starter manni.config.yaml in the current directory\")\n .action(() => {\n try {\n console.log(`Created ${runInit()}`);\n } catch (e) {\n fail(e);\n }\n });\n\n program\n .command(\"review\")\n .description(\n \"Record a human verdict for an eval in the human-review zone (or list recorded reviews)\",\n )\n .argument(\"[file]\", \"Page path\")\n .argument(\"[eval]\", \"Eval name\")\n .argument(\"[verdict]\", \"pass | fail\")\n .option(\"--reviewer <name>\", \"Reviewer name recorded with the verdict\")\n .option(\"--note <text>\", \"Optional note\")\n .action(\n (\n file: string | undefined,\n evalName: string | undefined,\n verdict: string | undefined,\n opts: { reviewer?: string; note?: string },\n command: Command,\n ) => {\n try {\n if (!file) {\n console.log(\n renderReviews(listReviews(), {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n return;\n }\n if (!evalName || !verdict) {\n throw new DocevalsError(\n \"Usage: manni docevals review <file> <eval> <pass|fail>\",\n );\n }\n const entry = runReview(file, evalName, verdict, opts);\n console.log(\n `Recorded ${entry.verdict} for ${entry.evalName} on ${entry.file}`,\n );\n } catch (e) {\n fail(e);\n }\n },\n );\n\n return program;\n}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WAAK,CAAC;AAAA,IACR;AAAA,EACF,CAAC;AAEH,UACG,QAAQ,QAAQ,EAChB;AAAA,IACC;AAAA,EACF,EACC,SAAS,UAAU,WAAW,EAC9B,SAAS,UAAU,WAAW,EAC9B,SAAS,aAAa,aAAa,EACnC,OAAO,qBAAqB,yCAAyC,EACrE,OAAO,iBAAiB,eAAe,EACvC;AAAA,IACC,CACE,MACA,UACA,SACA,MACA,YACG;AACH,UAAI;AACF,YAAI,CAAC,MAAM;AACT,kBAAQ;AAAA,YACN,cAAc,YAAY,GAAG;AAAA,cAC3B,OAAO,SAAS,SAAS,QAAQ,OAAO,KAAK;AAAA,YAC/C,CAAC;AAAA,UACH;AACA;AAAA,QACF;AACA,YAAI,CAAC,YAAY,CAAC,SAAS;AACzB,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,cAAM,QAAQ,UAAU,MAAM,UAAU,SAAS,IAAI;AACrD,gBAAQ;AAAA,UACN,YAAY,MAAM,OAAO,QAAQ,MAAM,QAAQ,OAAO,MAAM,IAAI;AAAA,QAClE;AAAA,MACF,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/docevals/cli.ts"],"sourcesContent":["/**\n * The docevals program. Named `docevals` because that is where it is mounted\n * (`manni docevals …`); `src/cli.ts` adds it to the umbrella and runs it.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport { collect, configOption } from \"../shared/cli-options.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport type { DocumentInputOptions } from \"./core/discover.js\";\nimport { colorFor, palette } from \"../shared/color.js\";\nimport { DocevalsError } from \"./types.js\";\nimport { allowExecutionMessage, isExecutionGrant } from \"../shared/execution.js\";\nimport { runList, renderList } from \"./commands/list.js\";\nimport { runRun } from \"./commands/run.js\";\nimport { runGenerate } from \"./commands/generate.js\";\nimport { runFill, renderFill } from \"./commands/fill.js\";\nimport { runPromote } from \"./commands/promote.js\";\nimport { listReviews, renderReviews, runReview } from \"./commands/review.js\";\nimport {\n runCalibrate,\n renderCalibration,\n seedGoldenCases,\n} from \"./commands/calibrate.js\";\nimport { runInit } from \"./commands/init.js\";\nimport {\n render,\n parseFormat,\n REPORT_FORMATS,\n SUMMARY_FORMATS,\n type ReportFormat,\n type SummaryFormat,\n} from \"./reporters/index.js\";\n\n/**\n * Whether `command`'s output gets colour: the family's rule, read off this\n * domain's `--no-color`. Exported for the tests that pin it.\n */\nexport { colorFor };\n\nexport function buildProgram(): Command {\n const program = new Command();\n\n program\n .name(\"docevals\")\n .description(\n \"Deterministic and LLM-as-judge evals for documentation pages, driven by frontmatter.\",\n )\n .version(pkg.version)\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand calling\n // `process.exit(1)` on a parse error, which is a usage error owed exit 2.\n .exitOverride();\n\n /**\n * Repeatable execution grant, validated on the way in.\n *\n * An unknown value is a usage error rather than a silent no-op (ADR 01007, the\n * same rule `--format` follows): a mistyped grant that quietly granted nothing\n * would skip every command eval and still exit 0, which reads as \"the corpus\n * is clean\" rather than \"you misspelled a flag\".\n */\n function collectGrant(value: string, previous: string[]): string[] {\n if (!isExecutionGrant(value)) {\n fail(new DocevalsError(allowExecutionMessage(value)));\n }\n return [...previous, value];\n }\n\n function parseIntArg(name: string) {\n return (value: string): number => {\n const n = Number.parseInt(value, 10);\n if (Number.isNaN(n) || n < 1) {\n fail(new DocevalsError(`${name} must be a positive integer, got \"${value}\"`));\n }\n return n;\n };\n }\n\n /**\n * Repeatable single-value option, e.g. `--eval a --eval b`.\n *\n * NOT commander's variadic `<name...>`: a variadic consumes every following\n * non-option token, so `run --eval fresh-enough docs/guide.md` parsed the glob\n * as a second eval name and left `globs` empty — silently widening the run to\n * the whole configured corpus, which is the opposite of what selection is for.\n */\n function collectArg(value: string, previous: string[]): string[] {\n return [...previous, value];\n }\n\n function parseFloatArg(name: string) {\n return (value: string): number => {\n const n = Number.parseFloat(value);\n if (Number.isNaN(n) || n < 0) {\n fail(new DocevalsError(`${name} must be a non-negative number, got \"${value}\"`));\n }\n return n;\n };\n }\n\n /**\n * Commander argument parser for `-f/--format` (ADR 01007). Routes through\n * `fail()` for the same reason the numeric parsers do: commander only special-\n * cases InvalidArgumentError, so any other exception escapes `program.parse()`\n * uncaught — a stack trace and exit 1, when a bad flag owes exit 2.\n */\n function parseFormatArg<T extends string>(name: string, allowed: readonly T[]) {\n return (value: string): T => {\n try {\n return parseFormat(value, allowed, name);\n } catch (e) {\n fail(e);\n }\n };\n }\n\n /**\n * The document-set surface every verb that reads pages shares (proposal\n * 0041): positional `[paths...]`, `--collection` and `--exclude` (each one\n * value per occurrence), and `-c`/`--no-config`. Declared once so the five\n * verbs cannot drift apart on a name or a description.\n */\n function documentInputs(command: Command, verb: string): Command {\n return command\n .argument(\n \"[paths...]\",\n `Files, directories, or globs to ${verb} (default: the configured collections)`,\n )\n .option(\n \"--collection <name>\",\n \"Configured collection to read (repeatable)\",\n collect,\n [],\n )\n .option(\"--exclude <glob>\", \"Glob to exclude (repeatable)\", collect, [])\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--no-config\", \"Ignore any discovered config file\");\n }\n\n /** The shared options as the command cores take them. */\n function documentOptions(opts: {\n collection?: string[];\n exclude?: string[];\n config?: string | boolean;\n }): DocumentInputOptions {\n const { configPath, noConfig } = configOption(opts.config);\n return {\n ...(configPath === undefined ? {} : { config: configPath }),\n ...(noConfig === true ? { noConfig } : {}),\n ...(opts.collection === undefined ? {} : { collection: opts.collection }),\n ...(opts.exclude === undefined ? {} : { exclude: opts.exclude }),\n };\n }\n\n documentInputs(\n program\n .command(\"list\")\n .description(\"Show the resolved eval plan per page without running anything\"),\n \"list\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${SUMMARY_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", SUMMARY_FORMATS),\n \"pretty\" as SummaryFormat,\n )\n .option(\"--eval <name>\", \"Show only this eval (repeatable)\", collectArg, [])\n .option(\"--suite <name>\", \"Show only evals in this suite\")\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n format: SummaryFormat;\n eval?: string[];\n suite?: string;\n },\n command: Command,\n ) => {\n try {\n const run = await runList(paths, {\n ...documentOptions(opts),\n format: opts.format,\n evalNames: opts.eval,\n suite: opts.suite,\n });\n console.log(\n renderList(run, opts.format, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = run.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program.command(\"run\").description(\"Run evals against documentation pages\"),\n \"evaluate\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${REPORT_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", REPORT_FORMATS),\n \"pretty\" as ReportFormat,\n )\n .option(\"--deterministic-only\", \"Run only command/tool graders, skip the AI judge\")\n .option(\"--ai-only\", \"Run only AI-judged evals, skip deterministic graders\")\n .option(\n // `<kind>`, not `<kind...>`: a variadic option greedily eats the\n // positional `[paths...]` that follow it, so `--allow-execution\n // frontmatter-commands docs/**` would silently swallow the glob and run\n // over the default file set instead. Repeat the flag to grant twice.\n \"--allow-execution <kind>\",\n \"Run only these execution grants (repeatable): frontmatter-commands\",\n collectGrant,\n [],\n )\n .option(\"--no-execution\", \"Clear every execution grant for this run\")\n .option(\"--no-generate\", \"Do not generate scripts for command evals missing a command\")\n .option(\"--no-cache\", \"Bypass the judge response cache\")\n .option(\"--fail-on-review\", \"Exit 1 when any eval lands in the human-review zone\")\n .option(\"--provider <name>\", \"Judge provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--runs <n>\", \"Ensemble runs per eval\", parseIntArg(\"--runs\"))\n .option(\n \"--chunk-chars <n>\",\n \"Characters of page per judge call; longer pages are read in parts\",\n parseIntArg(\"--chunk-chars\"),\n )\n .option(\n \"--eval <name>\",\n \"Run only this eval (repeatable); suite targets are not evaluated on a filtered run\",\n collectArg,\n [],\n )\n .option(\"--suite <name>\", \"Run only evals in this suite\")\n .option(\n \"--since <ref>\",\n \"Evaluate only pages whose file or eval manifest changed between this git ref and HEAD\",\n )\n .option(\n \"--newer-than <duration>\",\n \"Evaluate only pages whose file or eval manifest changed within this window, \" +\n \"such as 30m, 24h, 7d or 2w; in CI, prefer --since\",\n )\n .option(\n \"--max-turns <n>\",\n \"Stop after this many ensemble runs (a cached ensemble costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\n \"--baseline [path]\",\n \"Fail only on findings a recorded baseline does not already hold\",\n )\n .option(\"--no-baseline\", \"Ignore the configured baseline for this run\")\n .option(\n \"--write-baseline [path]\",\n \"Record this run's findings as the baseline; without a path, the configured one\",\n )\n .action(async (paths: string[], opts: Record<string, unknown>, command: Command) => {\n try {\n const report = await runRun(paths, {\n ...documentOptions({\n config: opts.config as string | boolean | undefined,\n collection: opts.collection as string[] | undefined,\n exclude: opts.exclude as string[] | undefined,\n }),\n // parseFormatArg validated this at parse time; the cast only re-narrows\n // from the `unknown` that the Record-typed options bag erases it to.\n format: opts.format as ReportFormat,\n deterministicOnly: opts.deterministicOnly as boolean | undefined,\n aiOnly: opts.aiOnly as boolean | undefined,\n // Commander's default is `[]`, which is \"no flag\", not \"run nothing\":\n // only a list someone typed narrows the run.\n allowExecution:\n (opts.allowExecution as string[]).length > 0\n ? (opts.allowExecution as string[])\n : undefined,\n execution: opts.execution as boolean | undefined,\n generate: opts.generate as boolean | undefined,\n cache: opts.cache as boolean | undefined,\n failOnReview: opts.failOnReview as boolean | undefined,\n provider: opts.provider as string | undefined,\n model: opts.model as string | undefined,\n local: opts.local as boolean | undefined,\n runs: opts.runs as number | undefined,\n chunkChars: opts.chunkChars as number | undefined,\n maxTurns: opts.maxTurns as number | undefined,\n evalNames: opts.eval as string[] | undefined,\n suite: opts.suite as string | undefined,\n since: opts.since as string | undefined,\n newerThan: opts.newerThan as string | undefined,\n // commander collapses `--baseline` to true and `--no-baseline` to\n // false on the same key; a string is an explicit path.\n baseline: opts.baseline as string | boolean | undefined,\n writeBaseline: opts.writeBaseline as string | boolean | undefined,\n toolVersion: pkg.version,\n });\n console.log(\n render(report, opts.format as ReportFormat, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program\n .command(\"generate\")\n .description(\n \"Generate check scripts for command evals with a plain-language assertion but no command\",\n ),\n \"read\",\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n provider?: string;\n model?: string;\n local?: boolean;\n },\n command: Command,\n ) => {\n try {\n const pc = palette(colorFor(command, process.stdout.isTTY));\n const result = await runGenerate(paths, {\n ...documentOptions(opts),\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n if (result.targets === 0) {\n console.log(\"Nothing to generate — every command eval has a command.\");\n return;\n }\n console.log(\n `Generated ${result.generatedPaths.length}/${result.targets} check script(s):`,\n );\n for (const p of result.generatedPaths) console.log(` ${p}`);\n // Evals whose command reference had nowhere to go (proposal 0047).\n for (const r of result.refusals) console.log(pc.red(` ${r.message}`));\n if (result.generatedPaths.length < result.targets) {\n process.exitCode = 1;\n }\n } catch (e) {\n fail(e);\n }\n },\n );\n\n documentInputs(\n program\n .command(\"fill\")\n .description(\n \"Propose frontmatter evals for pages with an LLM; writes proposals at or above the confidence threshold\",\n ),\n \"fill\",\n )\n .option(\n \"-f, --format <format>\",\n `Output format: ${SUMMARY_FORMATS.join(\" | \")}`,\n parseFormatArg(\"--format\", SUMMARY_FORMATS),\n \"pretty\" as SummaryFormat,\n )\n .option(\"--dry-run\", \"Report proposals without writing frontmatter\")\n .option(\n \"--confidence <n>\",\n \"Minimum confidence to write (0-1, default: config fill.confidenceThreshold)\",\n parseFloatArg(\"--confidence\"),\n )\n .option(\n \"--max-turns <n>\",\n \"Stop after this many inference calls (a cached page costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\"--no-cache\", \"Bypass the fill proposal cache\")\n .option(\n \"--chunk-chars <n>\",\n \"Characters of page per fill call; longer pages are proposed in parts\",\n parseIntArg(\"--chunk-chars\"),\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(async (paths: string[], opts: Record<string, unknown>, command: Command) => {\n try {\n const confidence = opts.confidence as number | undefined;\n if (confidence !== undefined && confidence > 1) {\n fail(new DocevalsError(`--confidence must be between 0 and 1, got ${confidence}`));\n }\n const report = await runFill(paths, {\n ...documentOptions({\n config: opts.config as string | boolean | undefined,\n collection: opts.collection as string[] | undefined,\n exclude: opts.exclude as string[] | undefined,\n }),\n dryRun: opts.dryRun as boolean | undefined,\n confidence,\n maxTurns: opts.maxTurns as number | undefined,\n noCache: opts.cache === false ? true : undefined,\n provider: opts.provider as string | undefined,\n model: opts.model as string | undefined,\n local: opts.local as boolean | undefined,\n // P1 (proposal 0047): offered only on a terminal, where there is\n // someone to answer. Off one the evals go to the page and the W1\n // line says so.\n confirm: terminalConfirm(),\n onNotice: notice,\n onRelocated: (result) => {\n const manifests = result.manifests.map((m) => m.file).join(\", \");\n notice(\n `moved ${String(result.summary.moved)} value(s) into ${manifests}.`,\n );\n },\n });\n // As in `run`: parseFormatArg validated this at parse time, and the cast\n // only re-narrows from the `unknown` the Record-typed options bag erases\n // it to. renderFill guards itself regardless.\n console.log(\n renderFill(report, opts.format as SummaryFormat, {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n process.exitCode = report.exitCode;\n } catch (e) {\n fail(e);\n }\n });\n\n documentInputs(\n program\n .command(\"promote\")\n .description(\n \"Find ai-graded evals expressible as deterministic checks; --write converts them\",\n ),\n \"read\",\n )\n .option(\"--write\", \"Apply promotions (write scripts and rewrite evals)\")\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .action(\n async (\n paths: string[],\n opts: {\n config?: string | boolean;\n collection?: string[];\n exclude?: string[];\n write?: boolean;\n provider?: string;\n model?: string;\n local?: boolean;\n },\n command: Command,\n ) => {\n try {\n const pc = palette(colorFor(command, process.stdout.isTTY));\n const proposals = await runPromote(paths, {\n ...documentOptions(opts),\n write: opts.write,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n });\n if (proposals.length === 0) {\n console.log(\"No ai-graded evals found.\");\n return;\n }\n for (const p of proposals) {\n const tag = p.promotable\n ? p.applied\n ? pc.green(\"promoted\")\n : pc.cyan(\"promotable\")\n : pc.dim(\"keep-ai\");\n const script = p.scriptPath ? pc.dim(` -> ${p.scriptPath}`) : \"\";\n console.log(`${tag} ${p.evalName} (${p.source}, ${p.file})${script}`);\n console.log(pc.dim(` ${p.rationale}`));\n // Promotable, and nowhere to write it (proposal 0047).\n if (p.error !== undefined) console.log(pc.red(` ${p.error}`));\n }\n if (!opts.write && proposals.some((p) => p.promotable)) {\n console.log(pc.cyan(\"\\nRe-run with --write to apply promotions.\"));\n }\n } catch (e) {\n fail(e);\n }\n },\n );\n\n program\n .command(\"calibrate\")\n .description(\n \"Measure judge agreement against a human-verified golden set (.manni/docevals/golden/*.yaml)\",\n )\n .option(\"-c, --config <path>\", \"Path to manni.config.yaml\")\n .option(\"--golden <dir>\", \"Golden set directory\", \".manni/docevals/golden\")\n .option(\n \"--seed\",\n \"Write golden candidates from recorded reviews and exit; judges nothing, needs no provider\",\n )\n .option(\"--provider <name>\", \"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp\")\n .option(\"--model <model>\", \"Model override; needs a named provider, from here or config\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--runs <n>\", \"Ensemble runs per case\", parseIntArg(\"--runs\"))\n .option(\n \"--max-turns <n>\",\n \"Stop after this many ensemble runs (a cached ensemble costs none)\",\n parseIntArg(\"--max-turns\"),\n )\n .option(\"--no-cache\", \"Bypass the judge response cache\")\n .action(\n async (opts: {\n config?: string;\n golden?: string;\n seed?: boolean;\n provider?: string;\n model?: string;\n local?: boolean;\n runs?: number;\n maxTurns?: number;\n cache?: boolean;\n }, command: Command) => {\n try {\n const color = colorFor(command, process.stdout.isTTY);\n const pc = palette(color);\n if (opts.seed) {\n // No `config`: reviews.yaml and the golden directory both resolve\n // against the working directory, not the config's, so passing it\n // would imply an influence it does not have.\n const seeded = seedGoldenCases({ golden: opts.golden });\n if (seeded.total === 0) {\n console.log(\n \"No recorded reviews to seed from — run `manni docevals review <file> <eval> <pass|fail>` first.\",\n );\n return;\n }\n // The lead number is what moved, not the file's size: `total`\n // counts cases already confirmed and left alone, so leading with it\n // read as \"wrote 8 candidates\" on a re-seed that wrote none.\n const changed = seeded.added + seeded.updated;\n console.log(\n changed === 0\n ? `No new reviews to seed — ${seeded.total} golden case(s) already in ${seeded.path}.`\n : `Wrote ${changed} golden candidate(s) to ${seeded.path} ` +\n `(${seeded.added} new, ${seeded.updated} updated; ${seeded.total} total).`,\n );\n if (seeded.unreviewed > 0) {\n console.log(\n pc.yellow(\n `${seeded.unreviewed} case(s) are \\`reviewed: false\\`. Read them and set ` +\n \"`reviewed: true` — a golden set assembled without a human is not one.\",\n ),\n );\n }\n return;\n }\n const report = await runCalibrate({\n config: opts.config,\n golden: opts.golden,\n provider: opts.provider,\n model: opts.model,\n local: opts.local,\n runs: opts.runs,\n maxTurns: opts.maxTurns,\n noCache: opts.cache === false,\n });\n console.log(renderCalibration(report, { color }));\n // Both conditions: the judge has to agree enough, AND the set has to\n // have been measured. A stale golden file whose pages were renamed\n // used to certify on whatever still resolved.\n process.exitCode =\n report.meetsThreshold &&\n report.unjudged === 0 &&\n report.balanced\n ? 0\n : 1;\n } catch (e) {\n fail(e);\n }\n },\n );\n\n program\n .command(\"init\")\n .description(\"Create a starter manni.config.yaml in the current directory\")\n .action(() => {\n try {\n console.log(`Created ${runInit()}`);\n } catch (e) {\n fail(e);\n }\n });\n\n program\n .command(\"review\")\n .description(\n \"Record a human verdict for an eval in the human-review zone (or list recorded reviews)\",\n )\n .argument(\"[file]\", \"Page path\")\n .argument(\"[eval]\", \"Eval name\")\n .argument(\"[verdict]\", \"pass | fail\")\n .option(\"--reviewer <name>\", \"Reviewer name recorded with the verdict\")\n .option(\"--note <text>\", \"Optional note\")\n .action(\n (\n file: string | undefined,\n evalName: string | undefined,\n verdict: string | undefined,\n opts: { reviewer?: string; note?: string },\n command: Command,\n ) => {\n try {\n if (!file) {\n console.log(\n renderReviews(listReviews(), {\n color: colorFor(command, process.stdout.isTTY),\n }),\n );\n return;\n }\n if (!evalName || !verdict) {\n throw new DocevalsError(\n \"Usage: manni docevals review <file> <eval> <pass|fail>\",\n );\n }\n const entry = runReview(file, evalName, verdict, opts);\n console.log(\n `Recorded ${entry.verdict} for ${entry.evalName} on ${entry.file}`,\n );\n } catch (e) {\n fail(e);\n }\n },\n );\n\n return program;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EACC,SAAS,UAAU,WAAW,EAC9B,SAAS,UAAU,WAAW,EAC9B,SAAS,aAAa,aAAa,EACnC,OAAO,qBAAqB,yCAAyC,EACrE,OAAO,iBAAiB,eAAe,EACvC;AAAA,IACC,CACE,MACA,UACA,SACA,MACA,YACG;AACH,UAAI;AACF,YAAI,CAAC,MAAM;AACT,kBAAQ;AAAA,YACN,cAAc,YAAY,GAAG;AAAA,cAC3B,OAAO,SAAS,SAAS,QAAQ,OAAO,KAAK;AAAA,YAC/C,CAAC;AAAA,UACH;AACA;AAAA,QACF;AACA,YAAI,CAAC,YAAY,CAAC,SAAS;AACzB,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,cAAM,QAAQ,UAAU,MAAM,UAAU,SAAS,IAAI;AACrD,gBAAQ;AAAA,UACN,YAAY,MAAM,OAAO,QAAQ,MAAM,QAAQ,OAAO,MAAM,IAAI;AAAA,QAClE;AAAA,MACF,SAAS,GAAG;AACV,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT;","names":[]}
|
|
@@ -3,43 +3,47 @@ import {
|
|
|
3
3
|
KeyError,
|
|
4
4
|
runKeyRotate,
|
|
5
5
|
runKeySet
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-U22TOL5Y.js";
|
|
7
|
+
import "./chunk-CH6IOGXV.js";
|
|
8
|
+
import "./chunk-DGRLHDM4.js";
|
|
9
|
+
import "./chunk-GQ3KRY3B.js";
|
|
10
|
+
import "./chunk-OHUDZRLK.js";
|
|
11
|
+
import "./chunk-AYVKN3PG.js";
|
|
12
|
+
import "./chunk-24AJK2RG.js";
|
|
12
13
|
import "./chunk-PCE7QHXJ.js";
|
|
13
|
-
import "./chunk-77AINBYM.js";
|
|
14
|
-
import "./chunk-PK7EKJ5T.js";
|
|
15
14
|
import "./chunk-IKEWBMCN.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-YUTVAMWW.js";
|
|
16
|
+
import "./chunk-JSSM7VVV.js";
|
|
17
|
+
import "./chunk-PS257NIU.js";
|
|
18
|
+
import "./chunk-2OZF2VUB.js";
|
|
19
|
+
import {
|
|
20
|
+
COMMON_FORMAT_LIST
|
|
21
|
+
} from "./chunk-SGR7ZAVE.js";
|
|
22
|
+
import "./chunk-QEAGL4V5.js";
|
|
18
23
|
import {
|
|
19
24
|
collect,
|
|
20
25
|
explicitFalse,
|
|
21
26
|
splitList
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
fail
|
|
29
|
-
} from "./chunk-YEUYKR62.js";
|
|
27
|
+
} from "./chunk-SMHAYK6I.js";
|
|
28
|
+
import "./chunk-DSWKBZWW.js";
|
|
29
|
+
import "./chunk-RGLFV4KO.js";
|
|
30
|
+
import "./chunk-77AINBYM.js";
|
|
31
|
+
import "./chunk-MNH7QO4Z.js";
|
|
30
32
|
import {
|
|
31
33
|
palette,
|
|
32
34
|
shouldColor
|
|
33
35
|
} from "./chunk-RNVYGWIC.js";
|
|
34
|
-
import
|
|
35
|
-
|
|
36
|
+
import {
|
|
37
|
+
fail
|
|
38
|
+
} from "./chunk-YEUYKR62.js";
|
|
39
|
+
import "./chunk-OTJOBZJ5.js";
|
|
36
40
|
import {
|
|
37
41
|
notice
|
|
38
42
|
} from "./chunk-HX44GB4Z.js";
|
|
39
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-VM7VAFJW.js";
|
|
40
44
|
import {
|
|
41
45
|
package_default
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-DHGB4JBG.js";
|
|
43
47
|
import "./chunk-OWBRDNRZ.js";
|
|
44
48
|
import "./chunk-G3T47CFV.js";
|
|
45
49
|
import "./chunk-2H7UOFLK.js";
|
|
@@ -228,4 +232,4 @@ function buildProgram() {
|
|
|
228
232
|
export {
|
|
229
233
|
buildProgram
|
|
230
234
|
};
|
|
231
|
-
//# sourceMappingURL=cli-
|
|
235
|
+
//# sourceMappingURL=cli-MQYCF3SR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/key/cli.ts","../src/key/reporters/json.ts","../src/key/reporters/pretty.ts"],"sourcesContent":["/**\n * The `key` domain's commander program. Mounted by `src/cli.ts` under\n * `manni key`; no entry point of its own. Proposal 0045 extends 0034's\n * grammar: a domain is a tool, or a family resource with verbs. `key` is the\n * second kind, with two verbs, `set` and `rotate`, and no default subcommand.\n *\n * clig.dev as every tool has it: the report to stdout, diagnostics to stderr,\n * colour only on a TTY and never under `NO_COLOR`/`--no-color`, exit `0` done,\n * `1` a value that could not be re-encrypted, `2` operational/usage. Nothing\n * this program prints is ever a key.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport { collect, explicitFalse, splitList } from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport { COMMON_FORMAT_LIST } from \"../meta/internal.js\";\nimport { runKeyRotate } from \"./commands/rotate.js\";\nimport { runKeySet } from \"./commands/set.js\";\nimport { KeyError } from \"./errors.js\";\nimport { renderRotateJson } from \"./reporters/json.js\";\nimport { BASELINE_NOTICE, renderRotatePretty, setMessage } from \"./reporters/pretty.js\";\n\nconst ROTATE_FORMATS = [\"pretty\", \"json\"] as const;\ntype RotateFormat = (typeof ROTATE_FORMATS)[number];\n\nfunction isRotateFormat(value: string): value is RotateFormat {\n return (ROTATE_FORMATS as readonly string[]).includes(value);\n}\n\n/** What commander hands `set`'s action. */\ninterface SetCliOptions {\n /** `-c, --config <path>`. */\n config?: string;\n dryRun?: boolean;\n}\n\n/**\n * What commander hands `rotate`'s action. The `--no-<thing>` flags are\n * `boolean` and never `undefined`: commander supplies `true` when the flag is\n * absent, so only the explicit `false` travels to the core (`explicitFalse`).\n */\ninterface RotateCliOptions {\n to?: string;\n /** `--collection <name>`, repeatable; commander's default value is `[]`. */\n collection: string[];\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable; commander's default value is `[]`. */\n exclude: string[];\n as?: string;\n config?: string;\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n gitignore: boolean;\n root?: string;\n dryRun?: boolean;\n /** `-f, --format <format>`. Always a string: the declaration has a default. */\n format: string;\n}\n\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"key\")\n .description(\"Set and rotate the family key that encrypted values are encrypted with.\")\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)`.\n .exitOverride();\n\n /** This domain's `--no-color`, wherever the domain is mounted. */\n const color = (): boolean =>\n shouldColor({ noColor: program.opts().color === false, isTTY: process.stdout.isTTY });\n\n program\n .command(\"set\")\n .description(\"Write the family encryption key to manni.config.yaml; generate one when no value is given\")\n .argument(\"[value]\", \"the key, at least 32 hex or base64url characters (default: 64 random hex)\")\n .option(\n \"-c, --config <path>\",\n \"the config file to write (default: the nearest manni.config.yaml, else a new one at the git root)\",\n )\n .option(\"--dry-run\", \"say what would be written; write nothing\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni key set # generate 256 bits into manni.config.yaml\",\n \" manni key set --dry-run # name the file, write nothing\",\n \" manni key set -c ops/manni.config.yaml 0123456789abcdef0123456789abcdef\",\n ].join(\"\\n\"),\n )\n .action(async (value: string | undefined, options: SetCliOptions) => {\n try {\n const result = await runKeySet({\n value,\n configPath: options.config,\n dryRun: Boolean(options.dryRun),\n onNotice: notice,\n });\n process.stdout.write(`${setMessage(result)}\\n`);\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"rotate\")\n .description(\"Re-encrypt every encrypted value under a new key, then write the key\")\n .argument(\"[paths...]\", \"files, directories, or globs (default: every collection)\")\n .option(\n \"--to <value>\",\n \"the new key (default: 64 random hex); required for a narrowed run and a key from MANNI_ENCRYPTION_KEY\",\n )\n .option(\"--collection <name>\", \"configured collection to run over; repeatable\", collect, [])\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"include files .gitignore covers\")\n .option(\n \"--root <dir>\",\n \"directory cited sources resolve from (default: cite.root from config, else the git root)\",\n )\n .option(\"--dry-run\", \"print what would change; write nothing\")\n .option(\"-f, --format <format>\", `output: ${ROTATE_FORMATS.join(\" | \")}`, \"pretty\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni key rotate # every collection, then the key\",\n \" manni key rotate --dry-run # see every change first\",\n ' manni key rotate --collection site --to \"$NEW_KEY\" # part of the family',\n ' MANNI_ENCRYPTION_KEY=… manni key rotate --to \"$NEW_KEY\"',\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RotateCliOptions) => {\n try {\n const format = options.format;\n if (!isRotateFormat(format)) {\n throw new KeyError(`Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`);\n }\n const result = await runKeyRotate({\n inputs: paths,\n collection: options.collection,\n to: options.to,\n exts: options.ext ? splitList(options.ext) : undefined,\n exclude: options.exclude,\n as: options.as,\n configPath: options.config,\n // `undefined` rather than `false` when absent.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n root: options.root,\n dryRun: Boolean(options.dryRun),\n onNotice: notice,\n });\n if (format === \"json\") {\n process.stdout.write(`${renderRotateJson(result)}\\n`);\n // stdout is the JSON's; the notice is a diagnostic.\n if (result.baselineStale) notice(BASELINE_NOTICE);\n } else {\n process.stdout.write(`${renderRotatePretty(result, { color: color() })}\\n`);\n }\n process.exitCode = result.exitCode;\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n","/**\n * JSON output for `key rotate`: every page and every local external-metadata\n * manifest with something encrypted in it, each value's full ciphertext\n * before and after, and the counts. The key is never in it.\n */\nimport type { KeyRotateResult } from \"../types.js\";\n\nexport function renderRotateJson(result: KeyRotateResult): string {\n return JSON.stringify(\n {\n pages: result.pages,\n manifests: result.manifests,\n reencrypted: result.reencrypted,\n skipped: result.skipped,\n keyWritten: result.keyWritten,\n },\n null,\n 2,\n );\n}\n","/**\n * Pretty output for `key set` and `key rotate`. A ciphertext is shown as `~`\n * and its first four characters, then `…`, with a citation's line suffix\n * after it: `~AQx7…`, `~AQm4…:2`. The full values are in `-f json`; the key\n * is in neither. Colour via `shouldColor`; never under `--no-color`/`NO_COLOR`.\n */\nimport { palette } from \"../../shared/color.js\";\nimport type { KeyRotateResult, KeySetResult, RotatedValue, SkippedValue } from \"../types.js\";\n\nexport interface PrettyOptions {\n color: boolean;\n}\n\n/** Said at the end of a writing rotation when a citation baseline exists. */\nexport const BASELINE_NOTICE =\n \"The citation baseline fingerprints id-less encrypted citations by their pin; re-record it with `manni cite check --write-baseline`.\";\n\nconst NARROWED =\n \"Key not written: this run covered part of the family. Finish with a whole run under the same key: `manni key rotate --to <the same value>`.\";\nconst FROM_ENV =\n \"Key not written: it comes from MANNI_ENCRYPTION_KEY. Update the secret to the value you passed.\";\n\nconst plural = (n: number, one: string, many = `${one}s`): string =>\n `${String(n)} ${n === 1 ? one : many}`;\n\n/** What `set` says: the file, never the key. */\nexport function setMessage(result: KeySetResult): string {\n return result.dryRun\n ? `Would write encryptionKey to ${result.source}.`\n : `Encryption key written to ${result.source}.`;\n}\n\n/** `~AQx7…`, and a citation's line suffix after it: `~AQm4…:2`. */\nexport function shortCiphertext(value: string): string {\n // base64url has no `:`, so the first one starts the line suffix.\n const colon = value.indexOf(\":\");\n const token = colon === -1 ? value : value.slice(0, colon);\n const suffix = colon === -1 ? \"\" : value.slice(colon);\n return `${token.slice(0, 5)}…${suffix}`;\n}\n\n/** A metadata value by its pointer; a citation by its id, else where it sits. */\nfunction nameOf(row: RotatedValue | SkippedValue): string {\n if (row.kind === \"metadata\") return row.pointer;\n if (row.id !== undefined) return row.id;\n if (row.index !== undefined) return `/citations/${String(row.index)}`;\n return `line ${String(row.line ?? 0)}`;\n}\n\nfunction closing(result: KeyRotateResult): string | undefined {\n switch (result.outcome) {\n case \"written\":\n return result.configSource === undefined\n ? undefined\n : `Encryption key written to ${result.configSource}.`;\n case \"finished\":\n // Said before the counts: the key was written by the run that stopped.\n return undefined;\n case \"narrowed\":\n return NARROWED;\n case \"env\":\n return FROM_ENV;\n case \"skipped\":\n return result.skipped === 1\n ? \"Key not written: 1 value could not be re-encrypted. Fix it and rotate again.\"\n : `Key not written: ${String(result.skipped)} values could not be re-encrypted. Fix them and rotate again.`;\n case \"dry-run\":\n return \"Dry run: nothing written.\";\n }\n}\n\nexport function renderRotatePretty(result: KeyRotateResult, opts: PrettyOptions): string {\n const c = palette(opts.color);\n const lines: string[] = [];\n for (const page of result.pages) {\n for (const row of page.rewritten) {\n // A metadata value has no line suffix; two spaces keep its arrow in the\n // column a `:L` suffix would take.\n const gap = row.kind === \"metadata\" ? \" \" : \" \";\n lines.push(\n `${page.file}: ${nameOf(row)} ${c.dim(shortCiphertext(row.from))}${gap}-> ${shortCiphertext(row.to)}`,\n );\n }\n for (const row of page.skipped) {\n lines.push(`${page.file}: ${nameOf(row)} ${c.red(\"skipped:\")} ${row.message}`);\n }\n }\n // A manifest value is named by the entry it belongs to and the pointer\n // inside it, so one line says which document's private half moved.\n for (const manifest of result.manifests) {\n for (const row of manifest.rewritten) {\n lines.push(\n `${manifest.file}: ${row.entry}${row.pointer} ${c.dim(shortCiphertext(row.from))} -> ${shortCiphertext(row.to)}`,\n );\n }\n for (const row of manifest.skipped) {\n lines.push(\n `${manifest.file}: ${row.entry}${row.pointer} ${c.red(\"skipped:\")} ${row.message}`,\n );\n }\n }\n if (result.outcome === \"finished\" && result.configSource !== undefined) {\n lines.push(`Finished the interrupted rotation in ${result.configSource}.`);\n }\n const files =\n result.pages.filter((page) => page.rewritten.length > 0).length +\n result.manifests.filter((manifest) => manifest.rewritten.length > 0).length;\n lines.push(\n `${plural(result.reencrypted, \"value\")} re-encrypted in ${plural(files, \"file\")}, ${String(result.skipped)} skipped`,\n );\n const last = closing(result);\n if (last !== undefined) lines.push(result.outcome === \"skipped\" ? c.red(last) : last);\n if (result.baselineStale) lines.push(BASELINE_NOTICE);\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACJjB,SAAS,iBAAiB,QAAiC;AAChE,SAAO,KAAK;AAAA,IACV;AAAA,MACE,OAAO,OAAO;AAAA,MACd,WAAW,OAAO;AAAA,MAClB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACLO,IAAM,kBACX;AAEF,IAAM,WACJ;AACF,IAAM,WACJ;AAEF,IAAM,SAAS,CAAC,GAAW,KAAa,OAAO,GAAG,GAAG,QACnD,GAAG,OAAO,CAAC,CAAC,IAAI,MAAM,IAAI,MAAM,IAAI;AAG/B,SAAS,WAAW,QAA8B;AACvD,SAAO,OAAO,SACV,gCAAgC,OAAO,MAAM,MAC7C,6BAA6B,OAAO,MAAM;AAChD;AAGO,SAAS,gBAAgB,OAAuB;AAErD,QAAM,QAA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T;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/key/cli.ts","../src/key/reporters/json.ts","../src/key/reporters/pretty.ts"],"sourcesContent":["/**\n * The `key` domain's commander program. Mounted by `src/cli.ts` under\n * `manni key`; no entry point of its own. Proposal 0045 extends 0034's\n * grammar: a domain is a tool, or a family resource with verbs. `key` is the\n * second kind, with two verbs, `set` and `rotate`, and no default subcommand.\n *\n * clig.dev as every tool has it: the report to stdout, diagnostics to stderr,\n * colour only on a TTY and never under `NO_COLOR`/`--no-color`, exit `0` done,\n * `1` a value that could not be re-encrypted, `2` operational/usage. Nothing\n * this program prints is ever a key.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport { collect, explicitFalse, splitList } from \"../shared/cli-options.js\";\nimport { shouldColor } from \"../shared/color.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice } from \"../shared/warn.js\";\nimport { COMMON_FORMAT_LIST } from \"../meta/internal.js\";\nimport { runKeyRotate } from \"./commands/rotate.js\";\nimport { runKeySet } from \"./commands/set.js\";\nimport { KeyError } from \"./errors.js\";\nimport { renderRotateJson } from \"./reporters/json.js\";\nimport { BASELINE_NOTICE, renderRotatePretty, setMessage } from \"./reporters/pretty.js\";\n\nconst ROTATE_FORMATS = [\"pretty\", \"json\"] as const;\ntype RotateFormat = (typeof ROTATE_FORMATS)[number];\n\nfunction isRotateFormat(value: string): value is RotateFormat {\n return (ROTATE_FORMATS as readonly string[]).includes(value);\n}\n\n/** What commander hands `set`'s action. */\ninterface SetCliOptions {\n /** `-c, --config <path>`. */\n config?: string;\n dryRun?: boolean;\n}\n\n/**\n * What commander hands `rotate`'s action. The `--no-<thing>` flags are\n * `boolean` and never `undefined`: commander supplies `true` when the flag is\n * absent, so only the explicit `false` travels to the core (`explicitFalse`).\n */\ninterface RotateCliOptions {\n to?: string;\n /** `--collection <name>`, repeatable; commander's default value is `[]`. */\n collection: string[];\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable; commander's default value is `[]`. */\n exclude: string[];\n as?: string;\n config?: string;\n allowEmpty?: boolean;\n /** `--no-gitignore`. */\n gitignore: boolean;\n root?: string;\n dryRun?: boolean;\n /** `-f, --format <format>`. Always a string: the declaration has a default. */\n format: string;\n}\n\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"key\")\n .description(\"Set and rotate the family key that encrypted values are encrypted with.\")\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen: the message that precedes it\n // already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` by value at subcommand-creation time, so an\n // `exitOverride()` installed afterwards leaves every subcommand still\n // calling `process.exit(1)`.\n .exitOverride();\n\n /** This domain's `--no-color`, wherever the domain is mounted. */\n const color = (): boolean =>\n shouldColor({ noColor: program.opts().color === false, isTTY: process.stdout.isTTY });\n\n program\n .command(\"set\")\n .description(\"Write the family encryption key to manni.config.yaml; generate one when no value is given\")\n .argument(\"[value]\", \"the key, at least 32 hex or base64url characters (default: 64 random hex)\")\n .option(\n \"-c, --config <path>\",\n \"the config file to write (default: the nearest manni.config.yaml, else a new one at the git root)\",\n )\n .option(\"--dry-run\", \"say what would be written; write nothing\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni key set # generate 256 bits into manni.config.yaml\",\n \" manni key set --dry-run # name the file, write nothing\",\n \" manni key set -c ops/manni.config.yaml 0123456789abcdef0123456789abcdef\",\n ].join(\"\\n\"),\n )\n .action(async (value: string | undefined, options: SetCliOptions) => {\n try {\n const result = await runKeySet({\n value,\n configPath: options.config,\n dryRun: Boolean(options.dryRun),\n onNotice: notice,\n });\n process.stdout.write(`${setMessage(result)}\\n`);\n process.exitCode = 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"rotate\")\n .description(\"Re-encrypt every encrypted value under a new key, then write the key\")\n .argument(\"[paths...]\", \"files, directories, or globs (default: every collection)\")\n .option(\n \"--to <value>\",\n \"the new key (default: 64 random hex); required for a narrowed run and a key from MANNI_ENCRYPTION_KEY\",\n )\n .option(\"--collection <name>\", \"configured collection to run over; repeatable\", collect, [])\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format for every input\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"include files .gitignore covers\")\n .option(\n \"--root <dir>\",\n \"directory cited sources resolve from (default: cite.root from config, else the git root)\",\n )\n .option(\"--dry-run\", \"print what would change; write nothing\")\n .option(\"-f, --format <format>\", `output: ${ROTATE_FORMATS.join(\" | \")}`, \"pretty\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni key rotate # every collection, then the key\",\n \" manni key rotate --dry-run # see every change first\",\n ' manni key rotate --collection site --to \"$NEW_KEY\" # part of the family',\n ' MANNI_ENCRYPTION_KEY=… manni key rotate --to \"$NEW_KEY\"',\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RotateCliOptions) => {\n try {\n const format = options.format;\n if (!isRotateFormat(format)) {\n throw new KeyError(`Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`);\n }\n const result = await runKeyRotate({\n inputs: paths,\n collection: options.collection,\n to: options.to,\n exts: options.ext ? splitList(options.ext) : undefined,\n exclude: options.exclude,\n as: options.as,\n configPath: options.config,\n // `undefined` rather than `false` when absent.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n root: options.root,\n dryRun: Boolean(options.dryRun),\n onNotice: notice,\n });\n if (format === \"json\") {\n process.stdout.write(`${renderRotateJson(result)}\\n`);\n // stdout is the JSON's; the notice is a diagnostic.\n if (result.baselineStale) notice(BASELINE_NOTICE);\n } else {\n process.stdout.write(`${renderRotatePretty(result, { color: color() })}\\n`);\n }\n process.exitCode = result.exitCode;\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n","/**\n * JSON output for `key rotate`: every page and every local external-metadata\n * manifest with something encrypted in it, each value's full ciphertext\n * before and after, and the counts. The key is never in it.\n */\nimport type { KeyRotateResult } from \"../types.js\";\n\nexport function renderRotateJson(result: KeyRotateResult): string {\n return JSON.stringify(\n {\n pages: result.pages,\n manifests: result.manifests,\n reencrypted: result.reencrypted,\n skipped: result.skipped,\n keyWritten: result.keyWritten,\n },\n null,\n 2,\n );\n}\n","/**\n * Pretty output for `key set` and `key rotate`. A ciphertext is shown as `~`\n * and its first four characters, then `…`, with a citation's line suffix\n * after it: `~AQx7…`, `~AQm4…:2`. The full values are in `-f json`; the key\n * is in neither. Colour via `shouldColor`; never under `--no-color`/`NO_COLOR`.\n */\nimport { palette } from \"../../shared/color.js\";\nimport type { KeyRotateResult, KeySetResult, RotatedValue, SkippedValue } from \"../types.js\";\n\nexport interface PrettyOptions {\n color: boolean;\n}\n\n/** Said at the end of a writing rotation when a citation baseline exists. */\nexport const BASELINE_NOTICE =\n \"The citation baseline fingerprints id-less encrypted citations by their pin; re-record it with `manni cite check --write-baseline`.\";\n\nconst NARROWED =\n \"Key not written: this run covered part of the family. Finish with a whole run under the same key: `manni key rotate --to <the same value>`.\";\nconst FROM_ENV =\n \"Key not written: it comes from MANNI_ENCRYPTION_KEY. Update the secret to the value you passed.\";\n\nconst plural = (n: number, one: string, many = `${one}s`): string =>\n `${String(n)} ${n === 1 ? one : many}`;\n\n/** What `set` says: the file, never the key. */\nexport function setMessage(result: KeySetResult): string {\n return result.dryRun\n ? `Would write encryptionKey to ${result.source}.`\n : `Encryption key written to ${result.source}.`;\n}\n\n/** `~AQx7…`, and a citation's line suffix after it: `~AQm4…:2`. */\nexport function shortCiphertext(value: string): string {\n // base64url has no `:`, so the first one starts the line suffix.\n const colon = value.indexOf(\":\");\n const token = colon === -1 ? value : value.slice(0, colon);\n const suffix = colon === -1 ? \"\" : value.slice(colon);\n return `${token.slice(0, 5)}…${suffix}`;\n}\n\n/** A metadata value by its pointer; a citation by its id, else where it sits. */\nfunction nameOf(row: RotatedValue | SkippedValue): string {\n if (row.kind === \"metadata\") return row.pointer;\n if (row.id !== undefined) return row.id;\n if (row.index !== undefined) return `/citations/${String(row.index)}`;\n return `line ${String(row.line ?? 0)}`;\n}\n\nfunction closing(result: KeyRotateResult): string | undefined {\n switch (result.outcome) {\n case \"written\":\n return result.configSource === undefined\n ? undefined\n : `Encryption key written to ${result.configSource}.`;\n case \"finished\":\n // Said before the counts: the key was written by the run that stopped.\n return undefined;\n case \"narrowed\":\n return NARROWED;\n case \"env\":\n return FROM_ENV;\n case \"skipped\":\n return result.skipped === 1\n ? \"Key not written: 1 value could not be re-encrypted. Fix it and rotate again.\"\n : `Key not written: ${String(result.skipped)} values could not be re-encrypted. Fix them and rotate again.`;\n case \"dry-run\":\n return \"Dry run: nothing written.\";\n }\n}\n\nexport function renderRotatePretty(result: KeyRotateResult, opts: PrettyOptions): string {\n const c = palette(opts.color);\n const lines: string[] = [];\n for (const page of result.pages) {\n for (const row of page.rewritten) {\n // A metadata value has no line suffix; two spaces keep its arrow in the\n // column a `:L` suffix would take.\n const gap = row.kind === \"metadata\" ? \" \" : \" \";\n lines.push(\n `${page.file}: ${nameOf(row)} ${c.dim(shortCiphertext(row.from))}${gap}-> ${shortCiphertext(row.to)}`,\n );\n }\n for (const row of page.skipped) {\n lines.push(`${page.file}: ${nameOf(row)} ${c.red(\"skipped:\")} ${row.message}`);\n }\n }\n // A manifest value is named by the entry it belongs to and the pointer\n // inside it, so one line says which document's private half moved.\n for (const manifest of result.manifests) {\n for (const row of manifest.rewritten) {\n lines.push(\n `${manifest.file}: ${row.entry}${row.pointer} ${c.dim(shortCiphertext(row.from))} -> ${shortCiphertext(row.to)}`,\n );\n }\n for (const row of manifest.skipped) {\n lines.push(\n `${manifest.file}: ${row.entry}${row.pointer} ${c.red(\"skipped:\")} ${row.message}`,\n );\n }\n }\n if (result.outcome === \"finished\" && result.configSource !== undefined) {\n lines.push(`Finished the interrupted rotation in ${result.configSource}.`);\n }\n const files =\n result.pages.filter((page) => page.rewritten.length > 0).length +\n result.manifests.filter((manifest) => manifest.rewritten.length > 0).length;\n lines.push(\n `${plural(result.reencrypted, \"value\")} re-encrypted in ${plural(files, \"file\")}, ${String(result.skipped)} skipped`,\n );\n const last = closing(result);\n if (last !== undefined) lines.push(result.outcome === \"skipped\" ? c.red(last) : last);\n if (result.baselineStale) lines.push(BASELINE_NOTICE);\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAe;;;ACJjB,SAAS,iBAAiB,QAAiC;AAChE,SAAO,KAAK;AAAA,IACV;AAAA,MACE,OAAO,OAAO;AAAA,MACd,WAAW,OAAO;AAAA,MAClB,aAAa,OAAO;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,YAAY,OAAO;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACLO,IAAM,kBACX;AAEF,IAAM,WACJ;AACF,IAAM,WACJ;AAEF,IAAM,SAAS,CAAC,GAAW,KAAa,OAAO,GAAG,GAAG,QACnD,GAAG,OAAO,CAAC,CAAC,IAAI,MAAM,IAAI,MAAM,IAAI;AAG/B,SAAS,WAAW,QAA8B;AACvD,SAAO,OAAO,SACV,gCAAgC,OAAO,MAAM,MAC7C,6BAA6B,OAAO,MAAM;AAChD;AAGO,SAAS,gBAAgB,OAAuB;AAErD,QAAM,QAAQ,MAAM,QAAQ,GAAG;AAC/B,QAAM,QAAQ,UAAU,KAAK,QAAQ,MAAM,MAAM,GAAG,KAAK;AACzD,QAAM,SAAS,UAAU,KAAK,KAAK,MAAM,MAAM,KAAK;AACpD,SAAO,GAAG,MAAM,MAAM,GAAG,CAAC,CAAC,SAAI,MAAM;AACvC;AAGA,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./chunk-MNH7QO4Z.js";
|
|
11
12
|
import {
|
|
12
13
|
palette,
|
|
13
14
|
shouldColor
|
|
14
15
|
} from "./chunk-RNVYGWIC.js";
|
|
15
16
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "./chunk-MNH7QO4Z.js";
|
|
17
|
+
fail
|
|
18
|
+
} from "./chunk-YEUYKR62.js";
|
|
19
19
|
import {
|
|
20
20
|
FAMILY_CONFIG_NAMES,
|
|
21
21
|
findConfigFile,
|
|
22
22
|
matchesFileGlob,
|
|
23
23
|
readConfigFile,
|
|
24
24
|
selectCollections
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-OTJOBZJ5.js";
|
|
26
26
|
import "./chunk-HX44GB4Z.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-VM7VAFJW.js";
|
|
28
28
|
import {
|
|
29
29
|
package_default
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-DHGB4JBG.js";
|
|
31
31
|
import {
|
|
32
32
|
programName
|
|
33
33
|
} from "./chunk-OWBRDNRZ.js";
|
|
@@ -1202,4 +1202,4 @@ export {
|
|
|
1202
1202
|
resolveCrawl,
|
|
1203
1203
|
resolveMaxPages
|
|
1204
1204
|
};
|
|
1205
|
-
//# sourceMappingURL=cli-
|
|
1205
|
+
//# sourceMappingURL=cli-OJKFXQOM.js.map
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
findConfigFileSync,
|
|
11
11
|
readConfigFileSync,
|
|
12
12
|
searchPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OTJOBZJ5.js";
|
|
14
14
|
import {
|
|
15
15
|
notice,
|
|
16
16
|
warn
|
|
17
17
|
} from "./chunk-HX44GB4Z.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-VM7VAFJW.js";
|
|
19
19
|
import {
|
|
20
20
|
package_default
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-DHGB4JBG.js";
|
|
22
22
|
import "./chunk-OWBRDNRZ.js";
|
|
23
23
|
import {
|
|
24
24
|
ToolError,
|
|
@@ -836,4 +836,4 @@ function buildProgram() {
|
|
|
836
836
|
export {
|
|
837
837
|
buildProgram
|
|
838
838
|
};
|
|
839
|
-
//# sourceMappingURL=cli-
|
|
839
|
+
//# sourceMappingURL=cli-PHZAO4LZ.js.map
|
|
@@ -2,68 +2,73 @@
|
|
|
2
2
|
import {
|
|
3
3
|
renderCheck,
|
|
4
4
|
runCheck
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3BRJCQPY.js";
|
|
6
6
|
import {
|
|
7
7
|
EXPORT_TARGETS,
|
|
8
|
-
SEARCH_MODES,
|
|
9
8
|
renderEmbed,
|
|
10
9
|
renderFill,
|
|
11
10
|
renderQuery,
|
|
12
|
-
renderSearch,
|
|
13
11
|
renderStats,
|
|
14
12
|
renderTraverse,
|
|
15
13
|
runEmbed,
|
|
16
14
|
runExport,
|
|
17
15
|
runFill,
|
|
18
16
|
runQuery,
|
|
19
|
-
runSearch,
|
|
20
17
|
runStats,
|
|
21
18
|
runTraverse
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DDILEF5F.js";
|
|
23
20
|
import {
|
|
24
|
-
DEFAULT_EXTENSIONS,
|
|
25
|
-
STDIN,
|
|
26
|
-
assertInputFormat,
|
|
27
21
|
runBuild
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import
|
|
22
|
+
} from "./chunk-KFGZPVFA.js";
|
|
23
|
+
import {
|
|
24
|
+
SEARCH_MODES,
|
|
25
|
+
renderSearch,
|
|
26
|
+
runSearch
|
|
27
|
+
} from "./chunk-ANPIIYRH.js";
|
|
30
28
|
import {
|
|
31
29
|
ALL_FILL_FIELDS,
|
|
32
30
|
CONFIG_SECTION,
|
|
33
31
|
DEFAULT_CONFIG_FILENAME,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
DEFAULT_EXTENSIONS,
|
|
33
|
+
GraphError,
|
|
34
|
+
STDIN,
|
|
35
|
+
assertInputFormat
|
|
36
|
+
} from "./chunk-2UJZXVHR.js";
|
|
37
37
|
import "./chunk-TIUTIOFB.js";
|
|
38
|
+
import "./chunk-IZXN3WI6.js";
|
|
38
39
|
import "./chunk-YGFIQ6Y5.js";
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-YUTVAMWW.js";
|
|
41
|
+
import "./chunk-JSSM7VVV.js";
|
|
42
|
+
import "./chunk-PS257NIU.js";
|
|
43
|
+
import "./chunk-2OZF2VUB.js";
|
|
44
|
+
import "./chunk-SGR7ZAVE.js";
|
|
45
|
+
import "./chunk-QEAGL4V5.js";
|
|
41
46
|
import {
|
|
42
47
|
collect,
|
|
43
48
|
configOption,
|
|
44
49
|
readStdin,
|
|
45
50
|
splitList,
|
|
46
51
|
writeTextAtomic
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import
|
|
51
|
-
fail
|
|
52
|
-
} from "./chunk-YEUYKR62.js";
|
|
52
|
+
} from "./chunk-SMHAYK6I.js";
|
|
53
|
+
import "./chunk-DSWKBZWW.js";
|
|
54
|
+
import "./chunk-RGLFV4KO.js";
|
|
55
|
+
import "./chunk-MNH7QO4Z.js";
|
|
53
56
|
import {
|
|
54
57
|
shouldColor
|
|
55
58
|
} from "./chunk-RNVYGWIC.js";
|
|
56
|
-
import
|
|
57
|
-
|
|
59
|
+
import {
|
|
60
|
+
fail
|
|
61
|
+
} from "./chunk-YEUYKR62.js";
|
|
62
|
+
import "./chunk-OTJOBZJ5.js";
|
|
58
63
|
import {
|
|
59
64
|
warn
|
|
60
65
|
} from "./chunk-HX44GB4Z.js";
|
|
61
66
|
import {
|
|
62
67
|
LOCAL_FLAG_HELP
|
|
63
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-VM7VAFJW.js";
|
|
64
69
|
import {
|
|
65
70
|
package_default
|
|
66
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-DHGB4JBG.js";
|
|
67
72
|
import "./chunk-OWBRDNRZ.js";
|
|
68
73
|
import {
|
|
69
74
|
errorMessage
|
|
@@ -116,7 +121,7 @@ out: graph/graph.ttl
|
|
|
116
121
|
|
|
117
122
|
# What to derive triples from. Remove entries to opt out.
|
|
118
123
|
build:
|
|
119
|
-
derive: [frontmatter, sections, links, tags, images, code, provenance]
|
|
124
|
+
derive: [frontmatter, sections, links, tags, images, code, provenance, terms]
|
|
120
125
|
|
|
121
126
|
# PROV-O settings. Git history is detected, not switched: per-file dates and
|
|
122
127
|
# author agents, rename -> prov:wasRevisionOf, and the build activity's HEAD
|
|
@@ -134,7 +139,7 @@ provenance:
|
|
|
134
139
|
# stewardship people fields (owner, stakeholders, reviewed-by) out.
|
|
135
140
|
|
|
136
141
|
# SHACL shapes \`manni graph check\` validates the built graph against. Default:
|
|
137
|
-
# the shapes contract bundled with manni (shapes/graph/shapes-1.
|
|
142
|
+
# the shapes contract bundled with manni (shapes/graph/shapes-1.1.0.ttl).
|
|
138
143
|
# check:
|
|
139
144
|
# shapes: ["./my-shapes.ttl"]
|
|
140
145
|
|
|
@@ -153,7 +158,7 @@ provenance:
|
|
|
153
158
|
# provider: anthropic # auto | anthropic | openai | claude-cli | llama-cpp
|
|
154
159
|
# model: claude-sonnet-4-5 # the provider's default when omitted
|
|
155
160
|
|
|
156
|
-
# LLM settings for \`manni graph fill\` (SKOS frontmatter proposals).
|
|
161
|
+
# LLM settings for \`manni graph fill\` (SKOS frontmatter proposals and sample questions).
|
|
157
162
|
fill:
|
|
158
163
|
temperature: 0
|
|
159
164
|
# Stop after this many inference calls. One page is one turn, and a cached
|
|
@@ -172,6 +177,13 @@ fill:
|
|
|
172
177
|
# Also propose per-section metadata. Off by default: it costs more output per
|
|
173
178
|
# call, and section metadata is explicit-only, so review it as carefully.
|
|
174
179
|
sections: false
|
|
180
|
+
# Sample questions: draft until a page has perPage, each pinned to the lines
|
|
181
|
+
# that answer it. A question request sends at most chunkChars of a page.
|
|
182
|
+
questions:
|
|
183
|
+
perPage: 3
|
|
184
|
+
chunkChars: 12000
|
|
185
|
+
# Send nothing off this machine: only a local model already downloaded.
|
|
186
|
+
offline: false
|
|
175
187
|
|
|
176
188
|
# Local embeddings for semantic search (\`manni graph embed\`). Needs the optional
|
|
177
189
|
# peer: npm install @huggingface/transformers
|
|
@@ -346,8 +358,10 @@ function buildProgram() {
|
|
|
346
358
|
out: opts.out
|
|
347
359
|
});
|
|
348
360
|
for (const warning of result.warnings) warn(warning);
|
|
361
|
+
const { total, fromTermbase } = result.concepts;
|
|
362
|
+
const termbase = fromTermbase > 0 ? ` (${fromTermbase} from the termbase)` : "";
|
|
349
363
|
console.log(
|
|
350
|
-
`Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples)`
|
|
364
|
+
`Wrote ${result.outPath} (${result.docs} docs, ${result.quads} triples, ${total} concepts${termbase})`
|
|
351
365
|
);
|
|
352
366
|
} catch (e) {
|
|
353
367
|
fail(e);
|
|
@@ -380,7 +394,7 @@ function buildProgram() {
|
|
|
380
394
|
);
|
|
381
395
|
documentInputs(
|
|
382
396
|
program.command("fill").description(
|
|
383
|
-
"Propose `graph:`
|
|
397
|
+
"Propose `graph:` fields and sample questions with an LLM, gated by confidence, and write them back"
|
|
384
398
|
),
|
|
385
399
|
"fill"
|
|
386
400
|
).option(
|
|
@@ -404,7 +418,14 @@ function buildProgram() {
|
|
|
404
418
|
).option(
|
|
405
419
|
"--provider <name>",
|
|
406
420
|
"Provider: auto (default) | anthropic | openai | claude-cli | llama-cpp"
|
|
407
|
-
).option("--model <model>", "Model override; needs a named provider, from here or config").option("--local", LOCAL_FLAG_HELP).
|
|
421
|
+
).option("--model <model>", "Model override; needs a named provider, from here or config").option("--local", LOCAL_FLAG_HELP).option(
|
|
422
|
+
"--offline",
|
|
423
|
+
"no network egress: only a model already downloaded, never a remote provider"
|
|
424
|
+
).option(
|
|
425
|
+
"--chunk-chars <n>",
|
|
426
|
+
"characters of page per question request (default: config, then 12000)",
|
|
427
|
+
countOption("--chunk-chars")
|
|
428
|
+
).action(async (paths, opts) => {
|
|
408
429
|
try {
|
|
409
430
|
const report = await runFill({
|
|
410
431
|
paths,
|
|
@@ -420,7 +441,9 @@ function buildProgram() {
|
|
|
420
441
|
fields: opts.fields,
|
|
421
442
|
provider: opts.provider,
|
|
422
443
|
model: opts.model,
|
|
423
|
-
local: opts.local
|
|
444
|
+
local: opts.local,
|
|
445
|
+
offline: opts.offline,
|
|
446
|
+
chunkChars: opts.chunkChars
|
|
424
447
|
});
|
|
425
448
|
for (const warning of report.warnings) warn(warning);
|
|
426
449
|
const rendered = renderFill(report, opts.format);
|
|
@@ -594,7 +617,7 @@ function buildProgram() {
|
|
|
594
617
|
}
|
|
595
618
|
);
|
|
596
619
|
program.command("export").description(
|
|
597
|
-
"Reserialize the built graph into a consumer format (jsonld file, iirds package, or
|
|
620
|
+
"Reserialize the built graph into a consumer format (jsonld file, iirds package, search index, or question set)"
|
|
598
621
|
).argument("<target>", `What to write: ${EXPORT_TARGETS.join(" | ")}`).option("-c, --config <path>", "Path to manni.config.yaml").option("--no-config", "Ignore any discovered config file").option("-g, --graph <path>", "Graph .ttl path (default: config out)").option(
|
|
599
622
|
"-o, --out <path>",
|
|
600
623
|
"Output path (default: the graph path with the target's extension)"
|
|
@@ -613,8 +636,9 @@ function buildProgram() {
|
|
|
613
636
|
out: opts.out
|
|
614
637
|
});
|
|
615
638
|
for (const warning of result.warnings) warn(warning);
|
|
639
|
+
const noun = result.format === "questions" ? "question" : "node";
|
|
616
640
|
console.log(
|
|
617
|
-
`Wrote ${result.nodes}
|
|
641
|
+
`Wrote ${result.nodes} ${noun}${result.nodes === 1 ? "" : "s"} to ${result.outPath}`
|
|
618
642
|
);
|
|
619
643
|
} catch (e) {
|
|
620
644
|
fail(e);
|
|
@@ -627,4 +651,4 @@ export {
|
|
|
627
651
|
buildProgram,
|
|
628
652
|
colorFor
|
|
629
653
|
};
|
|
630
|
-
//# sourceMappingURL=cli-
|
|
654
|
+
//# sourceMappingURL=cli-PTKFFNOW.js.map
|