@unbrained/pm-cli 2026.6.24 → 2026.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -0
- package/CHANGELOG.md +113 -1
- package/CONTRIBUTING.md +30 -0
- package/README.md +16 -3
- package/dist/cli/bootstrap-args.js +89 -79
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/commander-usage.js +3 -3
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/aggregate.js +8 -7
- package/dist/cli/commands/aggregate.js.map +1 -1
- package/dist/cli/commands/calendar.js +63 -62
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/close.d.ts +2 -4
- package/dist/cli/commands/close.js +5 -17
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/completion.js +158 -9
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.d.ts +1 -1
- package/dist/cli/commands/config.js +2 -2
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/context.d.ts +31 -4
- package/dist/cli/commands/context.js +33 -10
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.js +48 -8
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.d.ts +1 -6
- package/dist/cli/commands/create.js +491 -587
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/extension/bundled-catalog.js +59 -46
- package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
- package/dist/cli/commands/extension/describe.d.ts +15 -0
- package/dist/cli/commands/extension/describe.js +48 -2
- package/dist/cli/commands/extension/describe.js.map +1 -1
- package/dist/cli/commands/extension/doctor.js +129 -75
- package/dist/cli/commands/extension/doctor.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.js +37 -7
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/extension/managed-state.js +101 -57
- package/dist/cli/commands/extension/managed-state.js.map +1 -1
- package/dist/cli/commands/extension/scaffold.d.ts +38 -8
- package/dist/cli/commands/extension/scaffold.js +1956 -242
- package/dist/cli/commands/extension/scaffold.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +28 -3
- package/dist/cli/commands/extension.js +1181 -880
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/index.d.ts +3 -1
- package/dist/cli/commands/index.js +5 -3
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/item-filter-options.d.ts +63 -0
- package/dist/cli/commands/item-filter-options.js +10 -0
- package/dist/cli/commands/item-filter-options.js.map +1 -0
- package/dist/cli/commands/legacy-none-tokens.d.ts +14 -0
- package/dist/cli/commands/legacy-none-tokens.js +31 -2
- package/dist/cli/commands/legacy-none-tokens.js.map +1 -1
- package/dist/cli/commands/linked-artifacts.d.ts +7 -0
- package/dist/cli/commands/linked-artifacts.js +12 -2
- package/dist/cli/commands/linked-artifacts.js.map +1 -1
- package/dist/cli/commands/list-filter-shared.js +55 -48
- package/dist/cli/commands/list-filter-shared.js.map +1 -1
- package/dist/cli/commands/list.d.ts +16 -39
- package/dist/cli/commands/list.js +127 -118
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/next.d.ts +98 -0
- package/dist/cli/commands/next.js +304 -0
- package/dist/cli/commands/next.js.map +1 -0
- package/dist/cli/commands/profile.d.ts +208 -0
- package/dist/cli/commands/profile.js +418 -0
- package/dist/cli/commands/profile.js.map +1 -0
- package/dist/cli/commands/repeatable-metadata-parsers.js +12 -13
- package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +7 -0
- package/dist/cli/commands/schema.js +9 -3
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/search.d.ts +2 -39
- package/dist/cli/commands/search.js +196 -172
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/shared-unset-fields.d.ts +30 -0
- package/dist/cli/commands/shared-unset-fields.js +161 -0
- package/dist/cli/commands/shared-unset-fields.js.map +1 -0
- package/dist/cli/commands/stats.js +15 -3
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/test.js +115 -125
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update.d.ts +1 -6
- package/dist/cli/commands/update.js +37 -232
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/validate.js +20 -5
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/extension-command-options.js +48 -21
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/help-content.js +26 -2
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.js +3 -3
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.js +27 -12
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +42 -3
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +86 -2
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-setup.js +67 -6
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +9 -1
- package/dist/cli/registration-helpers.js +149 -123
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/chunks/activity-AW6XVFH6.js +16 -0
- package/dist/cli-bundle/chunks/{activity-N7RVTLBQ.js → activity-DBLQVIP6.js} +9 -11
- package/dist/cli-bundle/chunks/{aggregate-63NWNIBR.js → aggregate-JTEF4BP7.js} +17 -18
- package/dist/cli-bundle/chunks/aggregate-JTEF4BP7.js.map +1 -0
- package/dist/cli-bundle/chunks/{aggregate-YHCYX2EV.js → aggregate-SDF7DUOD.js} +16 -17
- package/dist/cli-bundle/chunks/aggregate-SDF7DUOD.js.map +7 -0
- package/dist/cli-bundle/chunks/{append-VLQQDHMJ.js → append-LOVPGVPT.js} +8 -10
- package/dist/cli-bundle/chunks/{append-VLQQDHMJ.js.map → append-LOVPGVPT.js.map} +1 -1
- package/dist/cli-bundle/chunks/{append-PUKREFV5.js → append-QCFJSDFL.js} +10 -12
- package/dist/cli-bundle/chunks/{append-PUKREFV5.js.map → append-QCFJSDFL.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-ABYCA5VX.js → chunk-22WKIL3H.js} +9 -11
- package/dist/cli-bundle/chunks/{chunk-ABYCA5VX.js.map → chunk-22WKIL3H.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-A66VYUOV.js → chunk-2466X6E4.js} +9 -11
- package/dist/cli-bundle/chunks/{chunk-A66VYUOV.js.map → chunk-2466X6E4.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-F32L4HR6.js → chunk-27BXPBAY.js} +3 -3
- package/dist/cli-bundle/chunks/{schema-QO5I4FBL.js → chunk-2D4HATP2.js} +136 -66
- package/dist/cli-bundle/chunks/chunk-2D4HATP2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-J7I4C5ZB.js → chunk-3J6JRJ3I.js} +153 -125
- package/dist/cli-bundle/chunks/chunk-3J6JRJ3I.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-OHDQNKJB.js → chunk-3K2M5OYU.js} +106 -34
- package/dist/cli-bundle/chunks/chunk-3K2M5OYU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-XVYKWZNL.js → chunk-3S2KT7NG.js} +127 -127
- package/dist/cli-bundle/chunks/chunk-3S2KT7NG.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5BBEWX6C.js → chunk-3VGN2UWE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N5B6WZC5.js → chunk-3XZCOZ5J.js} +115 -123
- package/dist/cli-bundle/chunks/chunk-3XZCOZ5J.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-4A3BJ675.js +799 -0
- package/dist/cli-bundle/chunks/chunk-4A3BJ675.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +87 -0
- package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HZF5RLKX.js → chunk-4DSGXSBL.js} +5 -7
- package/dist/cli-bundle/chunks/{chunk-HZF5RLKX.js.map → chunk-4DSGXSBL.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-JV27C7OZ.js → chunk-4DUVCVLZ.js} +4 -6
- package/dist/cli-bundle/chunks/{chunk-JV27C7OZ.js.map → chunk-4DUVCVLZ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-IAP5KYBQ.js → chunk-4XOIEKSD.js} +563 -506
- package/dist/cli-bundle/chunks/chunk-4XOIEKSD.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-5LB7UGKE.js → chunk-55SNVXRQ.js} +79 -82
- package/dist/cli-bundle/chunks/chunk-55SNVXRQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-BFFO3AIB.js → chunk-5CGRF3L5.js} +128 -128
- package/dist/cli-bundle/chunks/chunk-5CGRF3L5.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JKL6HRMV.js → chunk-5QFDBI4F.js} +1260 -1046
- package/dist/cli-bundle/chunks/chunk-5QFDBI4F.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-LU36E6GU.js → chunk-64HNBBFQ.js} +8 -12
- package/dist/cli-bundle/chunks/{chunk-LU36E6GU.js.map → chunk-64HNBBFQ.js.map} +1 -1
- package/dist/cli-bundle/chunks/chunk-6AQZPVHQ.js +2444 -0
- package/dist/cli-bundle/chunks/chunk-6AQZPVHQ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-7M2HAZEB.js +17 -0
- package/dist/cli-bundle/chunks/chunk-7M2HAZEB.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VSAABFGQ.js → chunk-7R4QEMZZ.js} +1490 -734
- package/dist/cli-bundle/chunks/chunk-7R4QEMZZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-M6TUBOGW.js → chunk-A7FPBAQS.js} +19 -12
- package/dist/cli-bundle/chunks/chunk-A7FPBAQS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GQYJEEFX.js → chunk-AVEE5EHK.js} +53 -54
- package/dist/cli-bundle/chunks/chunk-AVEE5EHK.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-FMWW2JDU.js → chunk-AXIDKKAT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TIM4OD74.js → chunk-BDTISOSD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-C4C3EJCJ.js → chunk-BHO33VBQ.js} +509 -363
- package/dist/cli-bundle/chunks/chunk-BHO33VBQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6W3Y65PL.js → chunk-BZCEN4JA.js} +198 -177
- package/dist/cli-bundle/chunks/chunk-BZCEN4JA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RRP6D345.js → chunk-CF7RL6FR.js} +12 -16
- package/dist/cli-bundle/chunks/{chunk-RRP6D345.js.map → chunk-CF7RL6FR.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-HC2S36NB.js → chunk-CWFNTKQJ.js} +154 -126
- package/dist/cli-bundle/chunks/chunk-CWFNTKQJ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-CZVISY5A.js +87 -0
- package/dist/cli-bundle/chunks/chunk-CZVISY5A.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-CZIFFMZI.js → chunk-DDPTYJIM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AYPQUFCX.js → chunk-EJUDVUYZ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-EOGBMLCE.js → chunk-EVMTBV6V.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-RAWA3Y7O.js → chunk-FFMQB7WR.js} +199 -178
- package/dist/cli-bundle/chunks/chunk-FFMQB7WR.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CG3KP6I5.js → chunk-G7I7DEZA.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-MEXZ5XUM.js → chunk-GJ326ZKX.js} +53 -54
- package/dist/cli-bundle/chunks/chunk-GJ326ZKX.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-HPPFYYOV.js +119 -0
- package/dist/cli-bundle/chunks/chunk-HPPFYYOV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-OF7V47P3.js → chunk-HXTQJXWT.js} +2172 -2146
- package/dist/cli-bundle/chunks/chunk-HXTQJXWT.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-F4BNR2IN.js → chunk-HYTGA6GI.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-2WCYE3IF.js → chunk-HZZEHPRG.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-IBMFIKVS.js +14 -0
- package/dist/cli-bundle/chunks/chunk-IBMFIKVS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-YV2OSAMS.js → chunk-IJYK2T43.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4XDGYFHL.js → chunk-IPYBJWTE.js} +10 -14
- package/dist/cli-bundle/chunks/{chunk-4XDGYFHL.js.map → chunk-IPYBJWTE.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-6EBNFQOR.js → chunk-IZBR4NRW.js} +10 -14
- package/dist/cli-bundle/chunks/{chunk-6EBNFQOR.js.map → chunk-IZBR4NRW.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-VFJYVXHL.js → chunk-JLM7BHI7.js} +7 -9
- package/dist/cli-bundle/chunks/{chunk-VFJYVXHL.js.map → chunk-JLM7BHI7.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-6EL7SW5C.js → chunk-JMP4E6D7.js} +114 -122
- package/dist/cli-bundle/chunks/chunk-JMP4E6D7.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-QOUOMPHO.js → chunk-JPECA746.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KJZOSF7J.js → chunk-JSU5P7VS.js} +100 -35
- package/dist/cli-bundle/chunks/chunk-JSU5P7VS.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-55VEOYI3.js → chunk-JWXRETDF.js} +79 -82
- package/dist/cli-bundle/chunks/chunk-JWXRETDF.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OQ2E64FH.js → chunk-KNPEF7QG.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-3BKH2CL3.js → chunk-L5OEFZQG.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-DTABLLVE.js → chunk-LB6TP6MC.js} +5 -7
- package/dist/cli-bundle/chunks/{chunk-DTABLLVE.js.map → chunk-LB6TP6MC.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TSI32UEL.js → chunk-MAUKX7JC.js} +6 -8
- package/dist/cli-bundle/chunks/{chunk-TSI32UEL.js.map → chunk-MAUKX7JC.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-SMXSDY7J.js → chunk-MDPEOIGN.js} +2221 -2172
- package/dist/cli-bundle/chunks/chunk-MDPEOIGN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5S4ZGDB2.js → chunk-N74UMG5H.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IXAZI443.js → chunk-NFDPYAIP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SKC4UTRP.js → chunk-NKZAN7BD.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-NOLPZMSV.js +116 -0
- package/dist/cli-bundle/chunks/chunk-NOLPZMSV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-L7UXKP2I.js → chunk-NU2UEROZ.js} +1257 -1029
- package/dist/cli-bundle/chunks/chunk-NU2UEROZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-HBAEFWX3.js → chunk-NUHHPVVS.js} +65 -335
- package/dist/cli-bundle/chunks/chunk-NUHHPVVS.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-JPJDP4VU.js → chunk-NWMZWYYB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MWMHZOZZ.js → chunk-OGXLACHC.js} +10 -14
- package/dist/cli-bundle/chunks/{chunk-MWMHZOZZ.js.map → chunk-OGXLACHC.js.map} +1 -1
- package/dist/cli-bundle/chunks/chunk-OKQ22KTH.js +379 -0
- package/dist/cli-bundle/chunks/chunk-OKQ22KTH.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KKX4Z2SE.js → chunk-OTUHB4HS.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-ZLWRPBOW.js → chunk-QCWF6IYD.js} +510 -364
- package/dist/cli-bundle/chunks/chunk-QCWF6IYD.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-PRVTGX64.js → chunk-RGEMWD6Q.js} +11 -23
- package/dist/cli-bundle/chunks/chunk-RGEMWD6Q.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-RH5ZBYFD.js +809 -0
- package/dist/cli-bundle/chunks/chunk-RH5ZBYFD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ALQKV6U7.js → chunk-RLDHZHQS.js} +12 -16
- package/dist/cli-bundle/chunks/{chunk-ALQKV6U7.js.map → chunk-RLDHZHQS.js.map} +1 -1
- package/dist/cli-bundle/chunks/{schema-C6QA367T.js → chunk-RMMQ74TG.js} +144 -67
- package/dist/cli-bundle/chunks/chunk-RMMQ74TG.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-EYPINTFR.js → chunk-RVUALSJF.js} +1516 -753
- package/dist/cli-bundle/chunks/chunk-RVUALSJF.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-SDR5J34Q.js +2468 -0
- package/dist/cli-bundle/chunks/chunk-SDR5J34Q.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-WB5BYQMF.js → chunk-SLMUGTK3.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-SUREE24M.js → chunk-TP5Q5ZD3.js} +12 -24
- package/dist/cli-bundle/chunks/chunk-TP5Q5ZD3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-UACWNBL2.js → chunk-UYUYDGIB.js} +7 -9
- package/dist/cli-bundle/chunks/{chunk-UACWNBL2.js.map → chunk-UYUYDGIB.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-V4UYNSEM.js → chunk-UZIWVBE6.js} +6 -8
- package/dist/cli-bundle/chunks/{chunk-V4UYNSEM.js.map → chunk-UZIWVBE6.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-EWRSXOIZ.js → chunk-V3NOKJF2.js} +11 -13
- package/dist/cli-bundle/chunks/{chunk-EWRSXOIZ.js.map → chunk-V3NOKJF2.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-XXKV4UWE.js → chunk-VARHOHYV.js} +571 -507
- package/dist/cli-bundle/chunks/chunk-VARHOHYV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-AEACLRVH.js → chunk-VICZWYGZ.js} +18 -11
- package/dist/cli-bundle/chunks/chunk-VICZWYGZ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +84 -0
- package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-VZDBVEZR.js +382 -0
- package/dist/cli-bundle/chunks/chunk-VZDBVEZR.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GDUMGZK3.js → chunk-W4ULYO7Z.js} +11 -13
- package/dist/cli-bundle/chunks/{chunk-GDUMGZK3.js.map → chunk-W4ULYO7Z.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-I6QMJ2XT.js → chunk-WYDHYJPO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ALKFCIIB.js → chunk-YITK2PJ6.js} +9 -11
- package/dist/cli-bundle/chunks/{chunk-ALKFCIIB.js.map → chunk-YITK2PJ6.js.map} +1 -1
- package/dist/cli-bundle/chunks/chunk-YJIEJRZB.js +84 -0
- package/dist/cli-bundle/chunks/chunk-YJIEJRZB.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-LNEDHJNQ.js → chunk-ZETXE4SE.js} +66 -329
- package/dist/cli-bundle/chunks/chunk-ZETXE4SE.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KIEAK7YE.js → chunk-ZRP4VG5U.js} +2 -2
- package/dist/cli-bundle/chunks/{claim-FZZZCAY6.js → claim-EMQLYPRW.js} +10 -12
- package/dist/cli-bundle/chunks/{claim-FZZZCAY6.js.map → claim-EMQLYPRW.js.map} +1 -1
- package/dist/cli-bundle/chunks/{claim-XK5QBZE3.js → claim-T3GCKV7C.js} +8 -10
- package/dist/cli-bundle/chunks/{claim-XK5QBZE3.js.map → claim-T3GCKV7C.js.map} +1 -1
- package/dist/cli-bundle/chunks/close-E6ZZGCJY.js +14 -0
- package/dist/cli-bundle/chunks/{close-QHMVWM7M.js → close-TQYAAFJP.js} +7 -8
- package/dist/cli-bundle/chunks/{close-many-OIXJE2JZ.js → close-many-BG5QQIDQ.js} +16 -18
- package/dist/cli-bundle/chunks/{close-many-OIXJE2JZ.js.map → close-many-BG5QQIDQ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{close-many-SUU5BS2C.js → close-many-LDRVEQY2.js} +18 -20
- package/dist/cli-bundle/chunks/{close-many-SUU5BS2C.js.map → close-many-LDRVEQY2.js.map} +1 -1
- package/dist/cli-bundle/chunks/{comments-5YM62D75.js → comments-QCKR2YY2.js} +11 -13
- package/dist/cli-bundle/chunks/{comments-5YM62D75.js.map → comments-QCKR2YY2.js.map} +1 -1
- package/dist/cli-bundle/chunks/{comments-RH3IBIRH.js → comments-YUXJRZPQ.js} +9 -11
- package/dist/cli-bundle/chunks/{comments-RH3IBIRH.js.map → comments-YUXJRZPQ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{config-NCNNWF6R.js → config-DMSU64QO.js} +18 -387
- package/dist/cli-bundle/chunks/config-DMSU64QO.js.map +7 -0
- package/dist/cli-bundle/chunks/{config-SW3U7XP2.js → config-QH2DICD6.js} +18 -380
- package/dist/cli-bundle/chunks/config-QH2DICD6.js.map +1 -0
- package/dist/cli-bundle/chunks/context-B6275WPX.js +46 -0
- package/dist/cli-bundle/chunks/context-OCZ3FJ4Z.js +42 -0
- package/dist/cli-bundle/chunks/{contracts-SY6PDFIK.js → contracts-HN7ABKLP.js} +72 -15
- package/dist/cli-bundle/chunks/contracts-HN7ABKLP.js.map +7 -0
- package/dist/cli-bundle/chunks/{contracts-JXFGBOYT.js → contracts-W4FZVVD6.js} +72 -15
- package/dist/cli-bundle/chunks/contracts-W4FZVVD6.js.map +1 -0
- package/dist/cli-bundle/chunks/{copy-N3GE6FYS.js → copy-BTJOSKKT.js} +7 -11
- package/dist/cli-bundle/chunks/{copy-N3GE6FYS.js.map → copy-BTJOSKKT.js.map} +1 -1
- package/dist/cli-bundle/chunks/{copy-IEDBJOOX.js → copy-DEM4DATS.js} +9 -13
- package/dist/cli-bundle/chunks/{copy-IEDBJOOX.js.map → copy-DEM4DATS.js.map} +1 -1
- package/dist/cli-bundle/chunks/create-OH3BDGBB.js +28 -0
- package/dist/cli-bundle/chunks/{create-O4VONGPG.js → create-RLRJMRTM.js} +12 -14
- package/dist/cli-bundle/chunks/{delete-LPEIF7RU.js → delete-BHK7VB2Z.js} +5 -7
- package/dist/cli-bundle/chunks/{delete-LPEIF7RU.js.map → delete-BHK7VB2Z.js.map} +1 -1
- package/dist/cli-bundle/chunks/{delete-724EQ6OS.js → delete-LSVHAB4Y.js} +7 -9
- package/dist/cli-bundle/chunks/{delete-724EQ6OS.js.map → delete-LSVHAB4Y.js.map} +1 -1
- package/dist/cli-bundle/chunks/{deps-RSBU4SIU.js → deps-4UDFJRUA.js} +8 -11
- package/dist/cli-bundle/chunks/{deps-RSBU4SIU.js.map → deps-4UDFJRUA.js.map} +1 -1
- package/dist/cli-bundle/chunks/{deps-T3Y6Y7RT.js → deps-XHYXWEPT.js} +6 -9
- package/dist/cli-bundle/chunks/{deps-T3Y6Y7RT.js.map → deps-XHYXWEPT.js.map} +1 -1
- package/dist/cli-bundle/chunks/{docs-IFS7HZPP.js → docs-26S44RXU.js} +8 -9
- package/dist/cli-bundle/chunks/{docs-IFS7HZPP.js.map → docs-26S44RXU.js.map} +1 -1
- package/dist/cli-bundle/chunks/{docs-75ZLCO3G.js → docs-GYZNVS26.js} +10 -11
- package/dist/cli-bundle/chunks/{docs-75ZLCO3G.js.map → docs-GYZNVS26.js.map} +1 -1
- package/dist/cli-bundle/chunks/{eval-L2KD7W3M.js → eval-PGRVIJQU.js} +12 -14
- package/dist/cli-bundle/chunks/{eval-L2KD7W3M.js.map → eval-PGRVIJQU.js.map} +1 -1
- package/dist/cli-bundle/chunks/{eval-QGR7JCQO.js → eval-UYF3ZPVO.js} +10 -12
- package/dist/cli-bundle/chunks/{eval-QGR7JCQO.js.map → eval-UYF3ZPVO.js.map} +1 -1
- package/dist/cli-bundle/chunks/{extension-YQF4CPIR.js → extension-CPSLJQVE.js} +12 -7
- package/dist/cli-bundle/chunks/{extension-3JYWJ5K2.js → extension-CXJ6RELI.js} +12 -7
- package/dist/cli-bundle/chunks/{files-EPEJMJHQ.js → files-MBNICQFM.js} +9 -11
- package/dist/cli-bundle/chunks/{files-EPEJMJHQ.js.map → files-MBNICQFM.js.map} +1 -1
- package/dist/cli-bundle/chunks/{files-5BQWDRDT.js → files-NQHEXUZD.js} +11 -13
- package/dist/cli-bundle/chunks/{files-5BQWDRDT.js.map → files-NQHEXUZD.js.map} +1 -1
- package/dist/cli-bundle/chunks/{focus-RWGKD76E.js → focus-DWYIG7GU.js} +10 -14
- package/dist/cli-bundle/chunks/{focus-RWGKD76E.js.map → focus-DWYIG7GU.js.map} +1 -1
- package/dist/cli-bundle/chunks/{focus-DQVJAPOE.js → focus-XZW5423D.js} +8 -12
- package/dist/cli-bundle/chunks/{focus-DQVJAPOE.js.map → focus-XZW5423D.js.map} +1 -1
- package/dist/cli-bundle/chunks/{gc-BEJMQT64.js → gc-7GQYOS2G.js} +3 -3
- package/dist/cli-bundle/chunks/{gc-JEFQDJPA.js → gc-LPVMKJQJ.js} +3 -3
- package/dist/cli-bundle/chunks/{get-LQG6PEVG.js → get-A7MAOHCU.js} +10 -13
- package/dist/cli-bundle/chunks/{get-LQG6PEVG.js.map → get-A7MAOHCU.js.map} +1 -1
- package/dist/cli-bundle/chunks/{get-WVN75H42.js → get-DSDEKJ3L.js} +12 -15
- package/dist/cli-bundle/chunks/{get-WVN75H42.js.map → get-DSDEKJ3L.js.map} +1 -1
- package/dist/cli-bundle/chunks/{health-JJJOY7DJ.js → health-3IPFLKXB.js} +17 -17
- package/dist/cli-bundle/chunks/{health-P67NZ6TT.js → health-GZXGBZ36.js} +17 -17
- package/dist/cli-bundle/chunks/{history-RUKPKNY7.js → history-NERDJNUB.js} +8 -10
- package/dist/cli-bundle/chunks/history-WSZHY3PN.js +18 -0
- package/dist/cli-bundle/chunks/{history-compact-NQ7VPRVT.js → history-compact-2WRZ2WK4.js} +11 -14
- package/dist/cli-bundle/chunks/{history-compact-NQ7VPRVT.js.map → history-compact-2WRZ2WK4.js.map} +1 -1
- package/dist/cli-bundle/chunks/{history-compact-ZAOWR7GD.js → history-compact-HR7BB4LR.js} +13 -16
- package/dist/cli-bundle/chunks/{history-compact-ZAOWR7GD.js.map → history-compact-HR7BB4LR.js.map} +1 -1
- package/dist/cli-bundle/chunks/history-redact-MP6CH7U5.js +19 -0
- package/dist/cli-bundle/chunks/{history-redact-YY4XYVEP.js → history-redact-O3NBCNWC.js} +9 -11
- package/dist/cli-bundle/chunks/{history-repair-EHL4ODQY.js → history-repair-LCMOS45X.js} +11 -14
- package/dist/cli-bundle/chunks/{history-repair-EHL4ODQY.js.map → history-repair-LCMOS45X.js.map} +1 -1
- package/dist/cli-bundle/chunks/{history-repair-YSQH6SY6.js → history-repair-XA3LC4GA.js} +13 -16
- package/dist/cli-bundle/chunks/{history-repair-YSQH6SY6.js.map → history-repair-XA3LC4GA.js.map} +1 -1
- package/dist/cli-bundle/chunks/{init-HBFGYS66.js → init-64XDLQJB.js} +12 -11
- package/dist/cli-bundle/chunks/init-PAX32BJA.js +22 -0
- package/dist/cli-bundle/chunks/{learnings-KFQO7GEZ.js → learnings-JR6MA5TI.js} +9 -11
- package/dist/cli-bundle/chunks/{learnings-KFQO7GEZ.js.map → learnings-JR6MA5TI.js.map} +1 -1
- package/dist/cli-bundle/chunks/{learnings-J555ZFPD.js → learnings-LPKCSJX7.js} +11 -13
- package/dist/cli-bundle/chunks/{learnings-J555ZFPD.js.map → learnings-LPKCSJX7.js.map} +1 -1
- package/dist/cli-bundle/chunks/{list-C7R33MD5.js → list-DNBJVO3E.js} +10 -10
- package/dist/cli-bundle/chunks/{list-DSN6UNFB.js → list-G5Y65VF6.js} +10 -10
- package/dist/cli-bundle/chunks/next-BCERKDUR.js +277 -0
- package/dist/cli-bundle/chunks/next-BCERKDUR.js.map +7 -0
- package/dist/cli-bundle/chunks/next-FYTQF6HG.js +274 -0
- package/dist/cli-bundle/chunks/next-FYTQF6HG.js.map +1 -0
- package/dist/cli-bundle/chunks/{notes-V4VNIQL4.js → notes-2BMU3VVQ.js} +9 -11
- package/dist/cli-bundle/chunks/{notes-V4VNIQL4.js.map → notes-2BMU3VVQ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{notes-VYJFN2A3.js → notes-6KTGO2OJ.js} +11 -13
- package/dist/cli-bundle/chunks/{notes-VYJFN2A3.js.map → notes-6KTGO2OJ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{plan-RBHQ5PO7.js → plan-4WXEQCTN.js} +15 -18
- package/dist/cli-bundle/chunks/{plan-RBHQ5PO7.js.map → plan-4WXEQCTN.js.map} +1 -1
- package/dist/cli-bundle/chunks/{plan-DHRSVSHR.js → plan-RKZHQVXR.js} +17 -20
- package/dist/cli-bundle/chunks/{plan-DHRSVSHR.js.map → plan-RKZHQVXR.js.map} +1 -1
- package/dist/cli-bundle/chunks/profile-4OMM32CD.js +1235 -0
- package/dist/cli-bundle/chunks/profile-4OMM32CD.js.map +7 -0
- package/dist/cli-bundle/chunks/profile-QLER5ENE.js +1197 -0
- package/dist/cli-bundle/chunks/profile-QLER5ENE.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-OM3E2KMY.js → register-list-query-7LV46VAU.js} +45 -21
- package/dist/cli-bundle/chunks/register-list-query-7LV46VAU.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-CCMHGZTF.js → register-list-query-SNG5PGA4.js} +44 -20
- package/dist/cli-bundle/chunks/register-list-query-SNG5PGA4.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-N3CDEGZU.js → register-mutation-ENNDUAZG.js} +106 -40
- package/dist/cli-bundle/chunks/register-mutation-ENNDUAZG.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-UXTTWL6N.js → register-mutation-KK7PHYYU.js} +105 -39
- package/dist/cli-bundle/chunks/register-mutation-KK7PHYYU.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-UDIFMQKD.js → register-operations-C6OWLDSH.js} +32 -34
- package/dist/cli-bundle/chunks/{register-operations-UDIFMQKD.js.map → register-operations-C6OWLDSH.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-operations-R2FLOCRI.js → register-operations-HZ6XERQG.js} +30 -32
- package/dist/cli-bundle/chunks/{register-operations-R2FLOCRI.js.map → register-operations-HZ6XERQG.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-setup-G5LTSFYK.js → register-setup-P67EMBDJ.js} +68 -25
- package/dist/cli-bundle/chunks/register-setup-P67EMBDJ.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-TWHKICM2.js → register-setup-ZKJ53RS7.js} +67 -24
- package/dist/cli-bundle/chunks/register-setup-ZKJ53RS7.js.map +7 -0
- package/dist/cli-bundle/chunks/{restore-LL2WLEDG.js → restore-4MHZFJ2E.js} +9 -11
- package/dist/cli-bundle/chunks/restore-YALDGTQR.js +17 -0
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-M4H2ZI64.js → scheduling-shortcuts-LB6DOLRL.js} +14 -16
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-M4H2ZI64.js.map → scheduling-shortcuts-LB6DOLRL.js.map} +1 -1
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-255GI3BU.js → scheduling-shortcuts-UTOYKLXQ.js} +12 -14
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-255GI3BU.js.map → scheduling-shortcuts-UTOYKLXQ.js.map} +1 -1
- package/dist/cli-bundle/chunks/schema-73HR2OJW.js +75 -0
- package/dist/cli-bundle/chunks/schema-U6LJKSIR.js +71 -0
- package/dist/cli-bundle/chunks/{search-2EI6EAXH.js → search-AXPXKZER.js} +10 -12
- package/dist/cli-bundle/chunks/{search-QBFBLQRO.js → search-KILGT37L.js} +10 -12
- package/dist/cli-bundle/chunks/{stats-TKC6CAKB.js → stats-PSYVVTNZ.js} +21 -13
- package/dist/cli-bundle/chunks/stats-PSYVVTNZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{stats-TCW2SZQG.js → stats-W5KNVJWQ.js} +20 -12
- package/dist/cli-bundle/chunks/stats-W5KNVJWQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{telemetry-BT2VSWU2.js → telemetry-BZUF6H7G.js} +4 -4
- package/dist/cli-bundle/chunks/{telemetry-LQ6FRTUT.js → telemetry-GAHHQTOS.js} +4 -4
- package/dist/cli-bundle/chunks/test-ACD52Z3S.js +35 -0
- package/dist/cli-bundle/chunks/test-ACD52Z3S.js.map +7 -0
- package/dist/cli-bundle/chunks/{test-NV2DRPUS.js → test-PWDIZ255.js} +15 -16
- package/dist/cli-bundle/chunks/test-PWDIZ255.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-all-DZ76VTPQ.js → test-all-L2MDDUCA.js} +20 -22
- package/dist/cli-bundle/chunks/{test-all-DZ76VTPQ.js.map → test-all-L2MDDUCA.js.map} +1 -1
- package/dist/cli-bundle/chunks/{test-all-REW67LXT.js → test-all-RBZ6DLU2.js} +18 -20
- package/dist/cli-bundle/chunks/{test-all-REW67LXT.js.map → test-all-RBZ6DLU2.js.map} +1 -1
- package/dist/cli-bundle/chunks/{test-runs-PX73DMMI.js → test-runs-PLRAZEFW.js} +5 -6
- package/dist/cli-bundle/chunks/test-runs-PLRAZEFW.js.map +7 -0
- package/dist/cli-bundle/chunks/{test-runs-FQ5WNQLP.js → test-runs-UXIXPDKU.js} +6 -7
- package/dist/cli-bundle/chunks/test-runs-UXIXPDKU.js.map +1 -0
- package/dist/cli-bundle/chunks/update-AMRSOIWP.js +24 -0
- package/dist/cli-bundle/chunks/update-AMRSOIWP.js.map +7 -0
- package/dist/cli-bundle/chunks/update-KFX2SIAC.js +28 -0
- package/dist/cli-bundle/chunks/update-KFX2SIAC.js.map +1 -0
- package/dist/cli-bundle/chunks/{update-many-Q5ZEI64S.js → update-many-RNSBX2TA.js} +35 -36
- package/dist/cli-bundle/chunks/{update-many-Q5ZEI64S.js.map → update-many-RNSBX2TA.js.map} +1 -1
- package/dist/cli-bundle/chunks/{update-many-2ILP6E4Y.js → update-many-Z5GJS5LC.js} +33 -34
- package/dist/cli-bundle/chunks/{update-many-2ILP6E4Y.js.map → update-many-Z5GJS5LC.js.map} +1 -1
- package/dist/cli-bundle/chunks/{upgrade-FOZKQTQF.js → upgrade-BRL6KCOJ.js} +13 -8
- package/dist/cli-bundle/chunks/{upgrade-FOZKQTQF.js.map → upgrade-BRL6KCOJ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{upgrade-DHL74PQH.js → upgrade-HAK6JG2O.js} +11 -6
- package/dist/cli-bundle/chunks/{upgrade-DHL74PQH.js.map → upgrade-HAK6JG2O.js.map} +1 -1
- package/dist/cli-bundle/chunks/{validate-HYZNIB6W.js → validate-MTUVL5VC.js} +38 -28
- package/dist/cli-bundle/chunks/validate-MTUVL5VC.js.map +7 -0
- package/dist/cli-bundle/chunks/{validate-54SYJ7QW.js → validate-X5W76YJL.js} +39 -29
- package/dist/cli-bundle/chunks/validate-X5W76YJL.js.map +1 -0
- package/dist/cli-bundle/main.js +95 -724
- package/dist/cli-bundle/main.js.map +4 -4
- package/dist/core/config/positional-value.d.ts +2 -0
- package/dist/core/config/positional-value.js +2 -2
- package/dist/core/config/positional-value.js.map +1 -1
- package/dist/core/extensions/activation-summary-markdown.d.ts +71 -0
- package/dist/core/extensions/activation-summary-markdown.js +151 -0
- package/dist/core/extensions/activation-summary-markdown.js.map +1 -0
- package/dist/core/extensions/activation-summary.d.ts +2 -0
- package/dist/core/extensions/activation-summary.js +3 -2
- package/dist/core/extensions/activation-summary.js.map +1 -1
- package/dist/core/extensions/capability-usage.d.ts +1 -1
- package/dist/core/extensions/capability-usage.js +4 -3
- package/dist/core/extensions/capability-usage.js.map +1 -1
- package/dist/core/extensions/extension-policy.d.ts +18 -3
- package/dist/core/extensions/extension-policy.js +116 -106
- package/dist/core/extensions/extension-policy.js.map +1 -1
- package/dist/core/extensions/extension-registries.js +3 -2
- package/dist/core/extensions/extension-registries.js.map +1 -1
- package/dist/core/extensions/extension-types.d.ts +21 -1
- package/dist/core/extensions/extension-types.js +3 -2
- package/dist/core/extensions/extension-types.js.map +1 -1
- package/dist/core/extensions/loader.js +439 -232
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/fs/fs-utils.js +27 -2
- package/dist/core/fs/fs-utils.js.map +1 -1
- package/dist/core/item/actionability.d.ts +57 -0
- package/dist/core/item/actionability.js +178 -0
- package/dist/core/item/actionability.js.map +1 -0
- package/dist/core/item/item-format.js +523 -410
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/type-registry.js +18 -45
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/profile/profile-describe.d.ts +64 -0
- package/dist/core/profile/profile-describe.js +83 -0
- package/dist/core/profile/profile-describe.js.map +1 -0
- package/dist/core/profile/profile-lint.d.ts +53 -0
- package/dist/core/profile/profile-lint.js +422 -0
- package/dist/core/profile/profile-lint.js.map +1 -0
- package/dist/core/profile/profile-plan.d.ts +145 -0
- package/dist/core/profile/profile-plan.js +0 -0
- package/dist/core/profile/profile-plan.js.map +1 -0
- package/dist/core/profile/profile-presets.d.ts +218 -0
- package/dist/core/profile/profile-presets.js +325 -0
- package/dist/core/profile/profile-presets.js.map +1 -0
- package/dist/core/schema/fields-file.js +25 -25
- package/dist/core/schema/fields-file.js.map +1 -1
- package/dist/core/schema/item-types-file.js +3 -3
- package/dist/core/schema/item-types-file.js.map +1 -1
- package/dist/core/schema/runtime-schema.js +4 -4
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/schema/status-defs-file.js +3 -3
- package/dist/core/schema/status-defs-file.js.map +1 -1
- package/dist/core/shared/serialization.js +83 -62
- package/dist/core/shared/serialization.js.map +1 -1
- package/dist/core/store/item-store.d.ts +1 -0
- package/dist/core/store/item-store.js +16 -8
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/paths.js +4 -32
- package/dist/core/store/paths.js.map +1 -1
- package/dist/core/store/settings.js +14 -14
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/observability.js +50 -54
- package/dist/core/telemetry/observability.js.map +1 -1
- package/dist/core/telemetry/runtime.js +11 -2
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/core/test/background-runs.js +3 -2
- package/dist/core/test/background-runs.js.map +1 -1
- package/dist/core/validate/linked-artifact-reference.d.ts +24 -0
- package/dist/core/validate/linked-artifact-reference.js +41 -0
- package/dist/core/validate/linked-artifact-reference.js.map +1 -0
- package/dist/mcp/server.js +540 -420
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +33 -2
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-types.d.ts +1 -0
- package/dist/sdk/cli-contracts/commander-types.js +15 -2
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +3 -3
- package/dist/sdk/cli-contracts/enum-contracts.js +6 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +149 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1514 -0
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -0
- package/dist/sdk/cli-contracts/string-lists.d.ts +14 -0
- package/dist/sdk/cli-contracts/string-lists.js +20 -0
- package/dist/sdk/cli-contracts/string-lists.js.map +1 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +51 -109
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +17 -0
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +54 -5
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +74 -0
- package/dist/sdk/cli-contracts/tool-schema.js +871 -0
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -0
- package/dist/sdk/cli-contracts.d.ts +13 -193
- package/dist/sdk/cli-contracts.js +5 -2277
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/compose.d.ts +11 -5
- package/dist/sdk/compose.js +240 -124
- package/dist/sdk/compose.js.map +1 -1
- package/dist/sdk/define.d.ts +14 -0
- package/dist/sdk/define.js +17 -2
- package/dist/sdk/define.js.map +1 -1
- package/dist/sdk/index.d.ts +14 -3
- package/dist/sdk/index.js +14 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/testing.d.ts +82 -2
- package/dist/sdk/testing.js +74 -3
- package/dist/sdk/testing.js.map +1 -1
- package/docs/AGENT_GUIDE.md +2 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/COMMANDS.md +37 -0
- package/docs/EXTENSIONS.md +12 -13
- package/docs/RELEASING.md +8 -4
- package/docs/SDK.md +184 -17
- package/docs/TESTING.md +12 -0
- package/docs/examples/policy-restricted-extension/README.md +6 -0
- package/docs/examples/policy-restricted-extension/index.ts +40 -0
- package/docs/examples/policy-restricted-extension/manifest.json +2 -2
- package/docs/examples/starter-extension/README.md +14 -2
- package/docs/examples/starter-extension/{index.js → index.ts} +51 -6
- package/docs/examples/starter-extension/manifest.json +2 -2
- package/package.json +20 -7
- package/packages/pm-beads/extensions/beads/index.ts +3 -3
- package/packages/pm-beads/extensions/beads/manifest.json +2 -2
- package/packages/pm-beads/extensions/beads/runtime-loader.ts +19 -7
- package/packages/pm-beads/extensions/beads/runtime.ts +155 -37
- package/packages/pm-calendar/extensions/calendar/index.ts +3 -3
- package/packages/pm-calendar/extensions/calendar/manifest.json +2 -2
- package/packages/pm-calendar/extensions/calendar/runtime.ts +2 -2
- package/packages/pm-command-kit/extensions/command-kit/index.ts +1 -1
- package/packages/pm-command-kit/extensions/command-kit/manifest.json +2 -2
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +2 -2
- package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +2 -2
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +2 -2
- package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +2 -2
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +1 -1
- package/packages/pm-kanban/README.md +97 -0
- package/packages/pm-kanban/extensions/kanban/index.ts +191 -0
- package/packages/pm-kanban/extensions/kanban/manifest.json +19 -0
- package/packages/pm-kanban/package.json +57 -0
- package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +1 -1
- package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +2 -2
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +2 -2
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +2 -2
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +1 -1
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -2
- package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +2 -2
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +1 -1
- package/packages/pm-templates/extensions/templates/index.ts +2 -2
- package/packages/pm-templates/extensions/templates/manifest.json +2 -2
- package/packages/pm-templates/extensions/templates/runtime.ts +1 -1
- package/packages/pm-todos/extensions/todos/index.ts +3 -3
- package/packages/pm-todos/extensions/todos/manifest.json +2 -2
- package/packages/pm-todos/extensions/todos/runtime-loader.ts +19 -7
- package/packages/pm-todos/extensions/todos/runtime.ts +177 -43
- package/plugins/pm-claude/scripts/pm-mcp-server.mjs +2 -2
- package/plugins/pm-codex/scripts/pm-mcp-server.mjs +2 -2
- package/scripts/bundle-cli.mjs +1 -1
- package/dist/cli-bundle/chunks/activity-54TXGJ2T.js +0 -18
- package/dist/cli-bundle/chunks/aggregate-63NWNIBR.js.map +0 -1
- package/dist/cli-bundle/chunks/aggregate-YHCYX2EV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6EL7SW5C.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6W3Y65PL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-AEACLRVH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-B74BP6IS.js +0 -78
- package/dist/cli-bundle/chunks/chunk-B74BP6IS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-BFFO3AIB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-C4C3EJCJ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-EYPINTFR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-FBLT6WGK.js +0 -75
- package/dist/cli-bundle/chunks/chunk-FBLT6WGK.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GQYJEEFX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-HBAEFWX3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HC2S36NB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IAP5KYBQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-INPHFO33.js +0 -764
- package/dist/cli-bundle/chunks/chunk-INPHFO33.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-IOT6WRL5.js +0 -86
- package/dist/cli-bundle/chunks/chunk-IOT6WRL5.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-ISEKN64V.js +0 -35
- package/dist/cli-bundle/chunks/chunk-ISEKN64V.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-J3NMWFIN.js +0 -115
- package/dist/cli-bundle/chunks/chunk-J3NMWFIN.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-J7I4C5ZB.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-JKL6HRMV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-KJZOSF7J.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-L7UXKP2I.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-LNEDHJNQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-M6TUBOGW.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-MEXZ5XUM.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-N5B6WZC5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-NJ73ALW2.js +0 -761
- package/dist/cli-bundle/chunks/chunk-NJ73ALW2.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-NVXGVEFD.js +0 -83
- package/dist/cli-bundle/chunks/chunk-NVXGVEFD.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OF7V47P3.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OHDQNKJB.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-PEL2NLQE.js +0 -118
- package/dist/cli-bundle/chunks/chunk-PEL2NLQE.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-PRVTGX64.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RAWA3Y7O.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SMXSDY7J.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SUREE24M.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-TKPP4GOO.js +0 -654
- package/dist/cli-bundle/chunks/chunk-TKPP4GOO.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-VSAABFGQ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js +0 -32
- package/dist/cli-bundle/chunks/chunk-W2VMLL5S.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XVYKWZNL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-XXKV4UWE.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-ZLWRPBOW.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ZV7IQ23N.js +0 -657
- package/dist/cli-bundle/chunks/chunk-ZV7IQ23N.js.map +0 -7
- package/dist/cli-bundle/chunks/close-JEBZXONN.js +0 -15
- package/dist/cli-bundle/chunks/config-NCNNWF6R.js.map +0 -7
- package/dist/cli-bundle/chunks/config-SW3U7XP2.js.map +0 -1
- package/dist/cli-bundle/chunks/context-55VEOYI3.js.map +0 -1
- package/dist/cli-bundle/chunks/context-5LB7UGKE.js.map +0 -7
- package/dist/cli-bundle/chunks/contracts-JXFGBOYT.js.map +0 -1
- package/dist/cli-bundle/chunks/contracts-SY6PDFIK.js.map +0 -7
- package/dist/cli-bundle/chunks/create-CLSCHGJJ.js +0 -30
- package/dist/cli-bundle/chunks/history-ALTM2RRP.js +0 -20
- package/dist/cli-bundle/chunks/history-redact-5YGLWUDH.js +0 -21
- package/dist/cli-bundle/chunks/init-C4CRHW22.js +0 -21
- package/dist/cli-bundle/chunks/register-list-query-CCMHGZTF.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-OM3E2KMY.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-N3CDEGZU.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-UXTTWL6N.js.map +0 -7
- package/dist/cli-bundle/chunks/register-setup-G5LTSFYK.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-TWHKICM2.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-LQHXBAY5.js +0 -19
- package/dist/cli-bundle/chunks/schema-C6QA367T.js.map +0 -7
- package/dist/cli-bundle/chunks/schema-QO5I4FBL.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-TCW2SZQG.js.map +0 -7
- package/dist/cli-bundle/chunks/stats-TKC6CAKB.js.map +0 -1
- package/dist/cli-bundle/chunks/test-WA6RZGM2.js +0 -36
- package/dist/cli-bundle/chunks/test-runs-FQ5WNQLP.js.map +0 -1
- package/dist/cli-bundle/chunks/test-runs-PX73DMMI.js.map +0 -7
- package/dist/cli-bundle/chunks/update-BSKMQOYH.js +0 -28
- package/dist/cli-bundle/chunks/update-FIGYNQ2I.js +0 -24
- package/dist/cli-bundle/chunks/validate-54SYJ7QW.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-HYZNIB6W.js.map +0 -7
- package/docs/examples/policy-restricted-extension/index.js +0 -21
- package/packages/pm-beads/extensions/beads/index.js +0 -64
- package/packages/pm-beads/extensions/beads/runtime-loader.js +0 -86
- package/packages/pm-beads/extensions/beads/runtime.js +0 -482
- package/packages/pm-calendar/extensions/calendar/index.js +0 -150
- package/packages/pm-calendar/extensions/calendar/runtime.js +0 -126
- package/packages/pm-command-kit/extensions/command-kit/index.js +0 -181
- package/packages/pm-governance-audit/extensions/governance-audit/index.js +0 -177
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +0 -153
- package/packages/pm-guide-shell/extensions/guide-shell/index.js +0 -98
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +0 -294
- package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +0 -18
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.js +0 -124
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +0 -110
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +0 -258
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +0 -361
- package/packages/pm-templates/extensions/templates/index.js +0 -132
- package/packages/pm-templates/extensions/templates/runtime.js +0 -35
- package/packages/pm-todos/extensions/todos/index.js +0 -81
- package/packages/pm-todos/extensions/todos/runtime-loader.js +0 -86
- package/packages/pm-todos/extensions/todos/runtime.js +0 -545
- /package/dist/cli-bundle/chunks/{activity-54TXGJ2T.js.map → activity-AW6XVFH6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-N7RVTLBQ.js.map → activity-DBLQVIP6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-F32L4HR6.js.map → chunk-27BXPBAY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5BBEWX6C.js.map → chunk-3VGN2UWE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FMWW2JDU.js.map → chunk-AXIDKKAT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TIM4OD74.js.map → chunk-BDTISOSD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CZIFFMZI.js.map → chunk-DDPTYJIM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AYPQUFCX.js.map → chunk-EJUDVUYZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EOGBMLCE.js.map → chunk-EVMTBV6V.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CG3KP6I5.js.map → chunk-G7I7DEZA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-F4BNR2IN.js.map → chunk-HYTGA6GI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2WCYE3IF.js.map → chunk-HZZEHPRG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YV2OSAMS.js.map → chunk-IJYK2T43.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QOUOMPHO.js.map → chunk-JPECA746.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OQ2E64FH.js.map → chunk-KNPEF7QG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3BKH2CL3.js.map → chunk-L5OEFZQG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5S4ZGDB2.js.map → chunk-N74UMG5H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IXAZI443.js.map → chunk-NFDPYAIP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-SKC4UTRP.js.map → chunk-NKZAN7BD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JPJDP4VU.js.map → chunk-NWMZWYYB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KKX4Z2SE.js.map → chunk-OTUHB4HS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WB5BYQMF.js.map → chunk-SLMUGTK3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-I6QMJ2XT.js.map → chunk-WYDHYJPO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KIEAK7YE.js.map → chunk-ZRP4VG5U.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-JEBZXONN.js.map → close-E6ZZGCJY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-QHMVWM7M.js.map → close-TQYAAFJP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-O4VONGPG.js.map → context-B6275WPX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-CLSCHGJJ.js.map → context-OCZ3FJ4Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-YQF4CPIR.js.map → create-OH3BDGBB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-3JYWJ5K2.js.map → create-RLRJMRTM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-ALTM2RRP.js.map → extension-CPSLJQVE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-RUKPKNY7.js.map → extension-CXJ6RELI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-BEJMQT64.js.map → gc-7GQYOS2G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-JEFQDJPA.js.map → gc-LPVMKJQJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{health-JJJOY7DJ.js.map → health-3IPFLKXB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{health-P67NZ6TT.js.map → health-GZXGBZ36.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-YY4XYVEP.js.map → history-NERDJNUB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-5YGLWUDH.js.map → history-WSZHY3PN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-C4CRHW22.js.map → history-redact-MP6CH7U5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-HBFGYS66.js.map → history-redact-O3NBCNWC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-C7R33MD5.js.map → init-64XDLQJB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-DSN6UNFB.js.map → init-PAX32BJA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-LL2WLEDG.js.map → list-DNBJVO3E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-LQHXBAY5.js.map → list-G5Y65VF6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-2EI6EAXH.js.map → restore-4MHZFJ2E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-QBFBLQRO.js.map → restore-YALDGTQR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-NV2DRPUS.js.map → schema-73HR2OJW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-WA6RZGM2.js.map → schema-U6LJKSIR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-BSKMQOYH.js.map → search-AXPXKZER.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-FIGYNQ2I.js.map → search-KILGT37L.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-BT2VSWU2.js.map → telemetry-BZUF6H7G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-LQ6FRTUT.js.map → telemetry-GAHHQTOS.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../cli/bootstrap-args.ts", "../../../../../../../../cli/commands/extension/shared.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @module cli/bootstrap-args\n *\n * Provides CLI runtime support for Bootstrap Args.\n */\nimport { resolveSubcommandFlagContractsForCommand, type CliFlagContract } from \"../sdk/cli-contracts.js\";\nimport { levenshteinDistanceWithinLimit } from \"../core/shared/levenshtein.js\";\n\nfunction parseBootstrapPathToken(\n token: string,\n next: string | undefined,\n): { consumed: number; pathValue?: string; preferred: boolean } | null {\n if (token === \"--path\" || token === \"--pm-path\") {\n if (typeof next === \"string\" && next.length > 0) {\n return {\n consumed: 2,\n pathValue: next,\n preferred: token === \"--pm-path\",\n };\n }\n return {\n consumed: 1,\n preferred: token === \"--pm-path\",\n };\n }\n\n const inlinePrefix = token.startsWith(\"--path=\")\n ? \"--path=\"\n : token.startsWith(\"--pm-path=\")\n ? \"--pm-path=\"\n : undefined;\n if (!inlinePrefix) {\n return null;\n }\n\n const value = token.slice(inlinePrefix.length);\n if (value.length > 0) {\n return {\n consumed: 1,\n pathValue: value,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n }\n return {\n consumed: 1,\n preferred: inlinePrefix === \"--pm-path=\",\n };\n}\n\n/**\n * Documents the bootstrap global options payload exchanged by command, SDK, and package integrations.\n */\nexport interface BootstrapGlobalOptions {\n path?: string;\n noExtensions: boolean;\n noPager: boolean;\n json: boolean;\n quiet: boolean;\n}\n\n/**\n * Implements parse bootstrap global options for the public runtime surface of this module.\n */\nexport function parseBootstrapGlobalOptions(argv: string[]): BootstrapGlobalOptions {\n let legacyPathValue: string | undefined;\n let pmPathValue: string | undefined;\n let noExtensions = false;\n let noPager = false;\n let json = false;\n let quiet = false;\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (token === \"--no-extensions\") {\n noExtensions = true;\n index += 1;\n continue;\n }\n if (token === \"--no-pager\") {\n noPager = true;\n index += 1;\n continue;\n }\n if (token === \"--json\") {\n json = true;\n index += 1;\n continue;\n }\n if (token === \"--quiet\") {\n quiet = true;\n index += 1;\n continue;\n }\n const parsedPath = parseBootstrapPathToken(token, argv[index + 1]);\n if (parsedPath) {\n if (parsedPath.pathValue !== undefined) {\n if (parsedPath.preferred) {\n pmPathValue = parsedPath.pathValue;\n } else {\n legacyPathValue = parsedPath.pathValue;\n }\n }\n index += parsedPath.consumed;\n continue;\n }\n index += 1;\n }\n return {\n path: pmPathValue ?? legacyPathValue,\n noExtensions,\n noPager,\n json,\n quiet,\n };\n}\n\n/**\n * Implements strip global bootstrap tokens for the public runtime surface of this module.\n */\nexport function stripGlobalBootstrapTokens(argv: string[]): string[] {\n const remaining: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n break;\n }\n if (\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n index += 1;\n continue;\n }\n if (token === \"--path\" || token === \"--pm-path\") {\n index += 2;\n continue;\n }\n if (token.startsWith(\"--path=\") || token.startsWith(\"--pm-path=\")) {\n index += 1;\n continue;\n }\n remaining.push(token);\n index += 1;\n }\n return remaining;\n}\n\n/**\n * Documents the bootstrap help request payload exchanged by command, SDK, and package integrations.\n */\nexport interface BootstrapHelpRequest {\n requested: boolean;\n commandPathTokens: string[];\n}\n\n/**\n * Implements parse bootstrap help request for the public runtime surface of this module.\n */\nexport function parseBootstrapHelpRequest(argv: string[]): BootstrapHelpRequest {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n if (first === \"help\") {\n const commandPathTokens: string[] = [];\n for (let index = 1; index < stripped.length; index += 1) {\n const token = stripped[index];\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n }\n\n const helpFlagIndex = stripped.findIndex((token) => token === \"--help\" || token === \"-h\");\n if (helpFlagIndex < 0) {\n return {\n requested: false,\n commandPathTokens: [],\n };\n }\n\n const commandPathTokens: string[] = [];\n for (const token of stripped) {\n if (token.startsWith(\"-\")) {\n break;\n }\n commandPathTokens.push(token.trim().toLowerCase());\n }\n return {\n requested: true,\n commandPathTokens,\n };\n}\n\n/**\n * Index of the command token in argv — the first non-flag token, skipping the\n * value-consuming/global bootstrap flags. Returns undefined when there is none\n * (bare invocation, only global flags, or a leading `--`). Single source of truth\n * for command-position scanning shared by {@link parseBootstrapCommandName} and the\n * command-alias rewrite so their precedence rules can never drift apart.\n */\nfunction findCommandTokenIndex(argv: string[]): number | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--\") {\n return undefined;\n }\n if (token === \"--path\" || token === \"--pm-path\") {\n index += 1;\n continue;\n }\n if (\n token.startsWith(\"--path=\") ||\n token.startsWith(\"--pm-path=\") ||\n token === \"--json\" ||\n token === \"--quiet\" ||\n token === \"--no-extensions\" ||\n token === \"--no-pager\" ||\n token === \"--profile\" ||\n token === \"--id-only\" ||\n token === \"--explain\"\n ) {\n continue;\n }\n if (token.startsWith(\"-\")) {\n continue;\n }\n return index;\n }\n return undefined;\n}\n\n/**\n * Implements parse bootstrap command name for the public runtime surface of this module.\n */\nexport function parseBootstrapCommandName(argv: string[]): string | undefined {\n const index = findCommandTokenIndex(argv);\n return index === undefined ? undefined : argv[index].trim().toLowerCase();\n}\n\nfunction shouldDisablePagerForInvocation(argv: string[], bootstrapGlobal: BootstrapGlobalOptions): boolean {\n if (bootstrapGlobal.noPager) {\n return true;\n }\n if (process.stdout.isTTY === true) {\n return false;\n }\n const helpRequest = parseBootstrapHelpRequest(argv);\n return helpRequest.requested;\n}\n\n/**\n * Implements apply bootstrap pager policy for the public runtime surface of this module.\n */\nexport function applyBootstrapPagerPolicy(argv: string[]): void {\n const bootstrapGlobal = parseBootstrapGlobalOptions(argv);\n if (!shouldDisablePagerForInvocation(argv, bootstrapGlobal)) {\n return;\n }\n process.env.PAGER = \"cat\";\n process.env.MANPAGER = \"cat\";\n process.env.GIT_PAGER = \"cat\";\n if (typeof process.env.LESS !== \"string\" || process.env.LESS.trim().length === 0) {\n process.env.LESS = \"FRX\";\n }\n}\n\ntype ExtensionSubcommandAction =\n | \"init\"\n | \"install\"\n | \"uninstall\"\n | \"explore\"\n | \"manage\"\n | \"doctor\"\n | \"adopt\"\n | \"adopt-all\"\n | \"activate\"\n | \"deactivate\";\n\nconst EXTENSION_ACTION_SYNTAX_TOKENS = new Set<ExtensionSubcommandAction>([\n \"install\",\n \"uninstall\",\n \"explore\",\n \"manage\",\n \"doctor\",\n \"adopt\",\n \"adopt-all\",\n \"activate\",\n \"deactivate\",\n]);\n\n/**\n * Implements normalize legacy extension action syntax for the public runtime surface of this module.\n */\nexport function normalizeLegacyExtensionActionSyntax(argv: string[]): string[] {\n const extensionIndex = argv.findIndex((token) => token === \"extension\");\n if (extensionIndex < 0) {\n return [...argv];\n }\n const actionToken = argv[extensionIndex + 1];\n if (!actionToken || actionToken.startsWith(\"-\")) {\n return [...argv];\n }\n if (!EXTENSION_ACTION_SYNTAX_TOKENS.has(actionToken as ExtensionSubcommandAction)) {\n return [...argv];\n }\n if (argv.includes(\"--help\") || argv.includes(\"-h\")) {\n return [...argv];\n }\n const forcedActionFlag = `--${actionToken}`;\n if (argv.includes(forcedActionFlag)) {\n return [...argv];\n }\n return [...argv.slice(0, extensionIndex + 1), forcedActionFlag, ...argv.slice(extensionIndex + 2)];\n}\n\ntype BootstrapNormalizationReason =\n | \"legacy_extension_action\"\n | \"command_alias\"\n | \"flag_alias\"\n | \"flag_typo\"\n | \"bare_key_value\"\n | \"list_merge\";\ntype BootstrapNormalizationConfidence = \"high\" | \"medium\";\n\n/**\n * Executable command aliases: a leading command token here is rewritten to its\n * canonical command BEFORE commander parses, so the alias actually runs instead of\n * merely being suggested. These are the highest-frequency aliases real agents type\n * (telemetry: `pm show <id>` alone is the single most common unknown-command) and\n * each target takes the same positional/flags as the alias (with `--comment`/\n * `--note`/`--learning` flag-aliased to `--add` on the target command). Keeping this\n * in one place means the alias is consistent across registration, commander dispatch,\n * telemetry, and error handling — all of which read the normalized argv.\n */\nexport const EXECUTABLE_COMMAND_ALIASES: Readonly<Record<string, string>> = {\n show: \"get\",\n view: \"get\",\n comment: \"comments\",\n note: \"notes\",\n learning: \"learnings\",\n};\n\n/**\n * Rewrite a leading command-alias token (e.g. `show` -> `get`) in place. Only the\n * command position is considered — the same token appearing later as an argument\n * (`pm get show`) is left untouched — and only when it is not preceded by `--` or a\n * value-consuming global flag, mirroring {@link parseBootstrapCommandName}.\n */\nfunction rewriteCommandAlias(argv: string[], trace: BootstrapNormalizationEvent[]): string[] {\n const index = findCommandTokenIndex(argv);\n if (index === undefined) {\n return argv;\n }\n const token = argv[index];\n const canonical = EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];\n if (!canonical) {\n return argv;\n }\n const rewritten = [...argv];\n rewritten[index] = canonical;\n trace.push({ from: token, to: [canonical], reason: \"command_alias\", confidence: \"high\" });\n return rewritten;\n}\n\n/**\n * Documents the bootstrap normalization event payload exchanged by command, SDK, and package integrations.\n */\nexport interface BootstrapNormalizationEvent {\n from: string;\n to: string[];\n reason: BootstrapNormalizationReason;\n confidence: BootstrapNormalizationConfidence;\n}\n\n/**\n * Documents the bootstrap invocation normalization result payload exchanged by command, SDK, and package integrations.\n */\nexport interface BootstrapInvocationNormalizationResult {\n argv: string[];\n commandName: string | undefined;\n trace: BootstrapNormalizationEvent[];\n}\n\ninterface FlagLookup {\n canonicalByNormalized: Map<string, string | null>;\n canonicalByCompact: Map<string, string | null>;\n canonicalComparables: Array<{ canonicalFlag: string; comparable: string }>;\n listCanonicalFlags: Set<string>;\n}\n\nfunction normalizeFlagKeyToken(raw: string): string {\n const withoutPrefix = raw.replace(/^--?/, \"\");\n return withoutPrefix\n .replace(/_/g, \"-\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .toLowerCase();\n}\n\nfunction toComparableFlagKey(raw: string): string {\n return normalizeFlagKeyToken(raw).replace(/-/g, \"\");\n}\n\nfunction markUnambiguousFlag(\n map: Map<string, string | null>,\n key: string,\n canonicalFlag: string,\n): void {\n const existing = map.get(key);\n if (existing === undefined) {\n map.set(key, canonicalFlag);\n return;\n }\n if (existing !== canonicalFlag) {\n map.set(key, null);\n }\n}\n\nfunction collectLongFlagCandidates(contract: CliFlagContract): string[] {\n const candidates: string[] = [];\n const pushLongFlag = (value: string | undefined): void => {\n if (typeof value !== \"string\") {\n return;\n }\n if (!value.startsWith(\"--\")) {\n return;\n }\n candidates.push(value);\n };\n pushLongFlag(contract.flag);\n for (const alias of contract.aliases ?? []) {\n pushLongFlag(alias);\n }\n return candidates;\n}\n\nfunction buildFlagLookup(\n commandName: string | undefined,\n contractsOverride?: CliFlagContract[],\n): FlagLookup {\n const contracts = contractsOverride ?? resolveSubcommandFlagContractsForCommand(commandName);\n const canonicalByNormalized = new Map<string, string | null>();\n const canonicalByCompact = new Map<string, string | null>();\n const canonicalComparablesMap = new Map<string, string>();\n const listCanonicalFlags = new Set<string>();\n for (const contract of contracts) {\n const longCandidates = collectLongFlagCandidates(contract);\n if (longCandidates.length === 0) {\n continue;\n }\n const canonicalFlag = `--${normalizeFlagKeyToken(longCandidates[0])}`;\n for (const candidate of longCandidates) {\n markUnambiguousFlag(canonicalByNormalized, normalizeFlagKeyToken(candidate), canonicalFlag);\n markUnambiguousFlag(canonicalByCompact, toComparableFlagKey(candidate), canonicalFlag);\n }\n const comparable = toComparableFlagKey(canonicalFlag);\n if (!canonicalComparablesMap.has(canonicalFlag)) {\n canonicalComparablesMap.set(canonicalFlag, comparable);\n }\n if (contract.list === true) {\n listCanonicalFlags.add(canonicalFlag);\n }\n }\n return {\n canonicalByNormalized,\n canonicalByCompact,\n canonicalComparables: [...canonicalComparablesMap.entries()].map(([canonicalFlag, comparable]) => ({\n canonicalFlag,\n comparable,\n })),\n listCanonicalFlags,\n };\n}\n\nfunction resolveCanonicalFlag(\n rawKey: string,\n lookup: FlagLookup,\n): { flag: string; reason: \"flag_alias\" | \"flag_typo\"; confidence: BootstrapNormalizationConfidence } | null {\n const normalizedKey = normalizeFlagKeyToken(rawKey);\n const direct = lookup.canonicalByNormalized.get(normalizedKey);\n if (typeof direct === \"string\") {\n return {\n flag: direct,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const comparableKey = normalizedKey.replace(/-/g, \"\");\n const compactMatch = lookup.canonicalByCompact.get(comparableKey);\n if (typeof compactMatch === \"string\") {\n return {\n flag: compactMatch,\n reason: \"flag_alias\",\n confidence: \"high\",\n };\n }\n const maxDistance = comparableKey.length >= 8 ? 2 : 1;\n let bestDistance = Number.POSITIVE_INFINITY;\n let bestFlag: string | undefined;\n let tied = false;\n for (const candidate of lookup.canonicalComparables) {\n const distance = levenshteinDistanceWithinLimit(comparableKey, candidate.comparable, maxDistance);\n if (distance === null) {\n continue;\n }\n if (distance < bestDistance) {\n bestDistance = distance;\n bestFlag = candidate.canonicalFlag;\n tied = false;\n continue;\n }\n if (distance === bestDistance && bestFlag !== candidate.canonicalFlag) {\n tied = true;\n }\n }\n if (!bestFlag || tied || !Number.isFinite(bestDistance) || bestDistance <= 0) {\n return null;\n }\n return {\n flag: bestFlag,\n reason: \"flag_typo\",\n confidence: bestDistance >= 2 ? \"medium\" : \"high\",\n };\n}\n\n/**\n * Implements list alias plural keys for the public runtime surface of this module.\n */\nexport function listAliasPluralKeys(normalizedKey: string): string[] {\n const candidates = [`${normalizedKey}s`];\n if (normalizedKey.endsWith(\"y\") && normalizedKey.length > 1) {\n candidates.push(`${normalizedKey.slice(0, -1)}ies`);\n }\n return candidates;\n}\n\nfunction parseBareKeyValueToken(token: string): { key: string; value: string } | null {\n if (token.includes(\"://\")) {\n return null;\n }\n const match = token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);\n if (!match) {\n return null;\n }\n const key = match[1];\n const value = match[3];\n if (value.length === 0) {\n return null;\n }\n return {\n key,\n value,\n };\n}\n\nfunction normalizeLongOptionToken(\n token: string,\n lookup: FlagLookup,\n): { tokens: string[]; event?: BootstrapNormalizationEvent } {\n if (!token.startsWith(\"--\")) {\n return { tokens: [token] };\n }\n const equalsIndex = token.indexOf(\"=\");\n const key = equalsIndex >= 0 ? token.slice(0, equalsIndex) : token;\n const inlineValue = equalsIndex >= 0 ? token.slice(equalsIndex + 1) : undefined;\n const resolution = resolveCanonicalFlag(key, lookup);\n if (!resolution) {\n return { tokens: [token] };\n }\n const normalizedToken = inlineValue === undefined ? resolution.flag : `${resolution.flag}=${inlineValue}`;\n if (normalizedToken === token) {\n return { tokens: [token] };\n }\n return {\n tokens: [normalizedToken],\n event: {\n from: token,\n to: [normalizedToken],\n reason: resolution.reason,\n confidence: resolution.confidence,\n },\n };\n}\n\n// Global option flags whose value may legitimately begin with \"--\" (commander\n// accepts such values). Their value token must not be reinterpreted as a list\n// flag during coalescing. `--pm-path <dir>` and its legacy `--path <dir>`\n// alias are the documented cases; other globals\n// (--json/--quiet/--no-extensions/--no-pager/--profile) are boolean.\nconst GLOBAL_VALUE_CONSUMING_FLAGS = new Set<string>([\"--pm-path\", \"--path\"]);\n\nfunction splitCanonicalListToken(token: string): { flag: string; inlineValue?: string } | null {\n if (!token.startsWith(\"--\")) {\n return null;\n }\n const equalsIndex = token.indexOf(\"=\");\n if (equalsIndex < 0) {\n return { flag: token };\n }\n return {\n flag: token.slice(0, equalsIndex),\n inlineValue: token.slice(equalsIndex + 1),\n };\n}\n\ninterface ListFlagSlot {\n outputIndex: number;\n originalTokens: string[];\n values: string[];\n occurrences: number;\n}\n\ninterface ListFlagOccurrence {\n originalTokens: string[];\n value: string | undefined;\n consumed: number;\n}\n\ninterface ValuedListFlagOccurrence {\n originalTokens: string[];\n value: string;\n}\n\nfunction copyValueConsumingFlag(argv: string[], index: number, result: (string | null)[]): number {\n result.push(argv[index]);\n const next = argv[index + 1];\n if (typeof next === \"string\" && next !== \"--\") {\n result.push(next);\n return index + 2;\n }\n return index + 1;\n}\n\nfunction readListFlagOccurrence(\n argv: string[],\n index: number,\n parsed: { flag: string; inlineValue?: string },\n multiValueListFlags: Set<string>,\n): ListFlagOccurrence {\n if (parsed.inlineValue !== undefined) {\n return {\n originalTokens: [argv[index]],\n value: parsed.inlineValue,\n consumed: 1,\n };\n }\n\n const values: string[] = [];\n let valueIndex = index + 1;\n while (\n valueIndex < argv.length &&\n argv[valueIndex] !== \"--\" &&\n !argv[valueIndex].startsWith(\"-\") &&\n (values.length === 0 || multiValueListFlags.has(parsed.flag))\n ) {\n values.push(argv[valueIndex]);\n valueIndex += 1;\n }\n\n const consumed = values.length === 0 ? 1 : 1 + values.length;\n return {\n originalTokens: argv.slice(index, index + consumed),\n value: values.length === 0 ? undefined : values.join(\",\"),\n consumed,\n };\n}\n\nfunction recordListFlagOccurrence(\n slots: Map<string, ListFlagSlot>,\n result: (string | null)[],\n flag: string,\n occurrence: ValuedListFlagOccurrence,\n): void {\n const existing = slots.get(flag);\n if (existing) {\n existing.values.push(occurrence.value);\n existing.occurrences += 1;\n return;\n }\n\n slots.set(flag, {\n outputIndex: result.length,\n originalTokens: occurrence.originalTokens,\n values: [occurrence.value],\n occurrences: 1,\n });\n // Reserve the anchor position; finalized after the walk so we know the full\n // merged value or can restore the original token form for single uses.\n result.push(null);\n}\n\nfunction buildListFlagCoalescingSplices(\n slots: Map<string, ListFlagSlot>,\n multiValueListFlags: Set<string>,\n): {\n events: BootstrapNormalizationEvent[];\n splices: Array<{ outputIndex: number; tokens: string[] }>;\n} {\n const events: BootstrapNormalizationEvent[] = [];\n const splices: Array<{ outputIndex: number; tokens: string[] }> = [];\n for (const [flag, slot] of slots) {\n const shouldMerge = slot.occurrences >= 2 || (multiValueListFlags.has(flag) && slot.originalTokens.length > 2);\n if (!shouldMerge) {\n splices.push({ outputIndex: slot.outputIndex, tokens: slot.originalTokens });\n continue;\n }\n const mergedToken = `${flag}=${slot.values.join(\",\")}`;\n splices.push({ outputIndex: slot.outputIndex, tokens: [mergedToken] });\n events.push({\n from: `${flag} (x${slot.occurrences})`,\n to: [mergedToken],\n reason: \"list_merge\",\n confidence: \"high\",\n });\n }\n return { events, splices };\n}\n\nfunction applyListFlagSplices(result: (string | null)[], splices: Array<{ outputIndex: number; tokens: string[] }>): void {\n splices.sort((a, b) => b.outputIndex - a.outputIndex);\n for (const splice of splices) {\n result.splice(splice.outputIndex, 1, ...splice.tokens);\n }\n}\n\n/**\n * Coalesce repeated occurrences of comma-separated list flags into a single\n * `--flag=v1,v2,v3` token anchored at the FIRST occurrence. Without this,\n * Commander treats these flags as scalars and silently keeps only the last\n * value (data loss). Both `--flag value` and `--flag=value` forms are merged;\n * a value-less occurrence is preserved untouched, and a `--` terminator stops\n * coalescing (remainder is passed through verbatim).\n *\n * `valueConsumingFlags` lists option flags (e.g. global `--path`) whose value\n * may itself begin with `--`. Their value token is emitted verbatim so a\n * list-flag-looking value (`--path --tags`) is never reinterpreted as a flag\n * nor allowed to swallow the following command/positional token.\n */\nexport function coalesceRepeatedListFlags(\n argv: string[],\n listFlags: Set<string>,\n valueConsumingFlags: Set<string> = new Set(),\n multiValueListFlags: Set<string> = new Set(),\n): { argv: string[]; events: BootstrapNormalizationEvent[] } {\n if (listFlags.size === 0) {\n return { argv: [...argv], events: [] };\n }\n\n const result: (string | null)[] = [];\n const slots = new Map<string, ListFlagSlot>();\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n break;\n }\n // A value-consuming option in space form owns the next token as its value,\n // even when that value begins with \"--\". Emit both verbatim so the value is\n // never misread as a list-flag occurrence.\n if (valueConsumingFlags.has(token)) {\n index = copyValueConsumingFlag(argv, index, result);\n continue;\n }\n const parsed = splitCanonicalListToken(token);\n if (!parsed || !listFlags.has(parsed.flag)) {\n result.push(token);\n index += 1;\n continue;\n }\n\n const occurrence = readListFlagOccurrence(argv, index, parsed, multiValueListFlags);\n if (occurrence.value === undefined) {\n // Value-less occurrence: leave untouched, do not coalesce.\n result.push(token);\n index += occurrence.consumed;\n continue;\n }\n\n recordListFlagOccurrence(slots, result, parsed.flag, {\n originalTokens: occurrence.originalTokens,\n value: occurrence.value,\n });\n index += occurrence.consumed;\n }\n\n // Apply anchor splices from the end so earlier indices stay valid when a\n // single-occurrence anchor expands back into two tokens.\n const { events, splices } = buildListFlagCoalescingSplices(slots, multiValueListFlags);\n applyListFlagSplices(result, splices);\n\n return { argv: result as string[], events };\n}\n\n/**\n * Linked-test entry keys accepted in the two-token form `pm test <id> --add command\n * \"npm test -- parser\"` (GH-191). Only entry-identity keys are merged: `command`/`cmd`\n * name the shell command and `path` names the test file, so a single key=value entry is\n * meaningful for them. Other structured keys (scope, env_set, assertions, ...) cannot\n * form a valid standalone entry and are left for the normal parser to reject. `--remove`\n * matches existing entries by `command=`/`path=` only, so `cmd` is excluded there.\n * Key names mirror STRUCTURED_LINKED_TEST_KEYS in src/cli/commands/linked-test-entry.ts.\n */\nconst LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [\"--add\", new Set([\"command\", \"cmd\", \"path\"])],\n [\"--remove\", new Set([\"command\", \"path\"])],\n]);\n\n/**\n * Sandbox-safe linked-test commands legitimately start with env assignments\n * (`PM_PATH=... PM_GLOBAL_PATH=... vitest run -- parser`), which look like bare\n * key=value settings tokens. When the two preceding tokens are a linked-test\n * flag plus a bare two-token key (`--add command <value>`), the value must be\n * left intact for mergeLinkedTestTwoTokenEntries instead of being rewritten\n * into a canonical flag (e.g. PM_PATH= -> --pm-path), which would silently\n * corrupt the command into `--add command --pm-path ...`.\n */\nfunction isLinkedTestTwoTokenValuePosition(commandName: string | undefined, emittedTokens: readonly string[]): boolean {\n if (commandName !== \"test\" || emittedTokens.length < 2) {\n return false;\n }\n const key = emittedTokens[emittedTokens.length - 1];\n const flag = emittedTokens[emittedTokens.length - 2];\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);\n return keys !== undefined && keys.has(key);\n}\n\n/**\n * Accept the two-token linked-test form `pm test <id> --add command \"npm test -- parser\"`\n * by merging the bare key token and its single quoted value into the documented\n * `--add command=...` shape. Without this merge Commander binds the bare key as the\n * option value and treats the quoted command as an excess positional, failing with\n * \"too many arguments\" (GH-191). The merge only fires when EXACTLY ONE non-flag token\n * follows the bare key, i.e. the value was quoted into one shell token — an unquoted\n * multi-token value stays ambiguous (it may swallow the item id), still fails fast, and\n * is routed to targeted quoting guidance by the commander error classifier instead.\n */\nexport function mergeLinkedTestTwoTokenEntries(\n argv: string[],\n commandName: string | undefined,\n trace: BootstrapNormalizationEvent[],\n): string[] {\n if (commandName !== \"test\") {\n return argv;\n }\n const result: string[] = [];\n let index = 0;\n while (index < argv.length) {\n const token = argv[index];\n if (token === \"--\") {\n result.push(...argv.slice(index));\n return result;\n }\n const keys = LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);\n const key = keys ? argv[index + 1] : undefined;\n if (!keys || typeof key !== \"string\" || !keys.has(key)) {\n result.push(token);\n index += 1;\n continue;\n }\n let runEnd = index + 2;\n while (runEnd < argv.length && !argv[runEnd].startsWith(\"-\")) {\n runEnd += 1;\n }\n if (runEnd - (index + 2) !== 1) {\n result.push(token);\n index += 1;\n continue;\n }\n const value = argv[index + 2];\n const mergedValue = `${key}=${value}`;\n result.push(token, mergedValue);\n trace.push({\n from: `${token} ${key} ${value}`,\n to: [token, mergedValue],\n reason: \"bare_key_value\",\n confidence: \"high\",\n });\n index += 3;\n }\n return result;\n}\n\n/**\n * Implements normalize bootstrap invocation for the public runtime surface of this module.\n */\nexport function normalizeBootstrapInvocation(argv: string[]): BootstrapInvocationNormalizationResult {\n const trace: BootstrapNormalizationEvent[] = [];\n const legacyNormalized = normalizeLegacyExtensionActionSyntax(argv);\n if (legacyNormalized.length !== argv.length || legacyNormalized.some((token, index) => token !== argv[index])) {\n trace.push({\n from: argv.join(\" \"),\n to: [...legacyNormalized],\n reason: \"legacy_extension_action\",\n confidence: \"high\",\n });\n }\n const aliasNormalized = rewriteCommandAlias(legacyNormalized, trace);\n const commandName = parseBootstrapCommandName(aliasNormalized);\n const commandPathName = parseBootstrapCommandPathName(aliasNormalized);\n const lookup = buildFlagLookup(commandPathName ?? commandName);\n const normalizedArgv: string[] = [];\n for (let index = 0; index < aliasNormalized.length; index += 1) {\n const token = aliasNormalized[index];\n if (token === \"--\") {\n normalizedArgv.push(...aliasNormalized.slice(index));\n break;\n }\n const previous = normalizedArgv[normalizedArgv.length - 1];\n if (token.startsWith(\"--\")) {\n const normalizedToken = normalizeLongOptionToken(token, lookup);\n normalizedArgv.push(...normalizedToken.tokens);\n if (normalizedToken.event) {\n trace.push(normalizedToken.event);\n }\n continue;\n }\n const bareKeyValue = parseBareKeyValueToken(token);\n if (\n bareKeyValue &&\n !(typeof previous === \"string\" && previous.startsWith(\"-\")) &&\n !isLinkedTestTwoTokenValuePosition(commandName, normalizedArgv)\n ) {\n const resolution = resolveCanonicalFlag(bareKeyValue.key, lookup);\n if (resolution) {\n const replacement = [resolution.flag, bareKeyValue.value];\n normalizedArgv.push(...replacement);\n trace.push({\n from: token,\n to: replacement,\n reason: \"bare_key_value\",\n confidence: resolution.confidence,\n });\n continue;\n }\n }\n normalizedArgv.push(token);\n }\n const linkedTestNormalized = mergeLinkedTestTwoTokenEntries(normalizedArgv, commandName, trace);\n const coalesced = coalesceRepeatedListFlags(\n linkedTestNormalized,\n lookup.listCanonicalFlags,\n GLOBAL_VALUE_CONSUMING_FLAGS,\n commandName === \"create\" ? new Set([\"--tags\"]) : new Set(),\n );\n for (const event of coalesced.events) {\n trace.push(event);\n }\n return {\n argv: coalesced.argv,\n commandName,\n trace,\n };\n}\n\nfunction parseBootstrapCommandPathName(argv: string[]): string | undefined {\n const stripped = stripGlobalBootstrapTokens(argv);\n const first = stripped[0]?.trim().toLowerCase();\n const second = stripped[1]?.trim().toLowerCase();\n if (\n (first === \"extension\" || first === \"package\" || first === \"packages\") &&\n typeof second === \"string\" &&\n second.length > 0 &&\n !second.startsWith(\"-\")\n ) {\n return `${first} ${second}`;\n }\n return first;\n}\n\n/**\n * Implements parse bootstrap type value for the public runtime surface of this module.\n */\nexport function parseBootstrapTypeValue(argv: string[]): string | undefined {\n for (let index = 0; index < argv.length; index += 1) {\n const token = argv[index];\n if (token === \"--type\") {\n const candidate = argv[index + 1];\n if (typeof candidate === \"string\" && candidate.trim().length > 0) {\n return candidate.trim();\n }\n continue;\n }\n if (token.startsWith(\"--type=\")) {\n const candidate = token.slice(\"--type=\".length).trim();\n if (candidate.length > 0) {\n return candidate;\n }\n }\n }\n return undefined;\n}\n\nexport const _testOnly = {\n buildFlagLookup,\n collectLongFlagCandidates,\n markUnambiguousFlag,\n normalizeLongOptionToken,\n resolveCanonicalFlag,\n};\n", "/**\n * @module cli/commands/extension/shared\n *\n * Implements extension package-management support for Shared.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists } from \"../../../core/fs/fs-utils.js\";\nimport { isPathWithinDirectory } from \"../../../core/fs/path-utils.js\";\nimport { EXIT_CODE } from \"../../../core/shared/constants.js\";\nimport { PmCliError } from \"../../../core/shared/errors.js\";\nimport type { ExtensionManifest } from \"../../../core/extensions/loader.js\";\n\nexport const DEFAULT_EXTENSION_PRIORITY = 100;\n\n/**\n * Documents the validated extension directory payload exchanged by command, SDK, and package integrations.\n */\nexport interface ValidatedExtensionDirectory {\n directory: string;\n manifest_path: string;\n entry_path: string;\n manifest: ExtensionManifest;\n}\n\n/**\n * Implements normalize string list for the public runtime surface of this module.\n */\nexport function normalizeStringList(values: readonly string[]): string[] {\n return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))].sort((left, right) =>\n left.localeCompare(right),\n );\n}\n\n/**\n * Implements normalize extension name for match for the public runtime surface of this module.\n */\nexport function normalizeExtensionNameForMatch(value: string): string {\n return value.trim().toLowerCase();\n}\n\n/**\n * Implements normalize managed directory name for the public runtime surface of this module.\n */\nexport function normalizeManagedDirectoryName(name: string): string {\n const normalized = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n if (normalized.length === 0) {\n throw new PmCliError(\"Extension manifest name must resolve to a non-empty directory name.\", EXIT_CODE.USAGE);\n }\n if (normalized === \".\" || normalized === \"..\") {\n // Manifest-controlled input must resolve to a dedicated child directory, never\n // the extensions root itself or its parent (path-traversal guard).\n throw new PmCliError(\"Extension manifest name must not resolve to \\\".\\\" or \\\"..\\\".\", EXIT_CODE.USAGE);\n }\n return normalized;\n}\n\n/**\n * Implements parse extension manifest for the public runtime surface of this module.\n */\nexport function parseExtensionManifest(raw: unknown): ExtensionManifest | null {\n if (typeof raw !== \"object\" || raw === null) {\n return null;\n }\n const candidate = raw as Record<string, unknown>;\n if (typeof candidate.name !== \"string\" || candidate.name.trim().length === 0) {\n return null;\n }\n if (typeof candidate.version !== \"string\" || candidate.version.trim().length === 0) {\n return null;\n }\n if (typeof candidate.entry !== \"string\" || candidate.entry.trim().length === 0) {\n return null;\n }\n\n let priority = DEFAULT_EXTENSION_PRIORITY;\n if (candidate.priority !== undefined && candidate.priority !== null) {\n if (typeof candidate.priority !== \"number\" || !Number.isInteger(candidate.priority)) {\n return null;\n }\n priority = candidate.priority;\n }\n\n let capabilities: string[] = [];\n if (candidate.capabilities !== undefined && candidate.capabilities !== null) {\n if (!Array.isArray(candidate.capabilities) || candidate.capabilities.some((value) => typeof value !== \"string\")) {\n return null;\n }\n capabilities = normalizeStringList(candidate.capabilities.map((value) => String(value).toLowerCase()));\n }\n\n return {\n name: candidate.name.trim(),\n version: candidate.version.trim(),\n entry: candidate.entry.trim(),\n priority,\n capabilities,\n };\n}\n\n/**\n * Implements check whether canonical path within directory for the public runtime surface of this module.\n */\nexport async function isCanonicalPathWithinDirectory(directory: string, targetPath: string): Promise<boolean> {\n const [resolvedDirectory, resolvedTargetPath] = await Promise.all([fs.realpath(directory), fs.realpath(targetPath)]);\n return isPathWithinDirectory(resolvedDirectory, resolvedTargetPath);\n}\n\n/**\n * Implements validate extension directory for the public runtime surface of this module.\n */\nexport async function validateExtensionDirectory(directory: string): Promise<ValidatedExtensionDirectory> {\n const manifestPath = path.join(directory, \"manifest.json\");\n if (!(await pathExists(manifestPath))) {\n throw new PmCliError(`Extension manifest is missing at \"${manifestPath}\".`, EXIT_CODE.USAGE);\n }\n\n let parsedManifest: unknown;\n try {\n parsedManifest = JSON.parse(await fs.readFile(manifestPath, \"utf8\")) as unknown;\n } catch (error: unknown) {\n throw new PmCliError(\n `Failed to parse extension manifest at \"${manifestPath}\": ${formatManifestReadError(error)}`,\n EXIT_CODE.USAGE,\n );\n }\n\n const manifest = parseExtensionManifest(parsedManifest);\n if (!manifest) {\n throw new PmCliError(`Extension manifest at \"${manifestPath}\" is invalid.`, EXIT_CODE.USAGE);\n }\n\n const entryPath = path.resolve(directory, manifest.entry);\n if (!isPathWithinDirectory(directory, entryPath)) {\n throw new PmCliError(\n `Extension entry \"${manifest.entry}\" resolves outside extension directory \"${directory}\".`,\n EXIT_CODE.USAGE,\n );\n }\n if (!(await pathExists(entryPath))) {\n throw new PmCliError(`Extension entry file is missing at \"${entryPath}\".`, EXIT_CODE.USAGE);\n }\n if (!(await isCanonicalPathWithinDirectory(directory, entryPath))) {\n throw new PmCliError(\n `Extension entry \"${manifest.entry}\" resolves outside extension directory after symlink resolution.`,\n EXIT_CODE.USAGE,\n );\n }\n\n return {\n directory,\n manifest_path: manifestPath,\n entry_path: entryPath,\n manifest,\n };\n}\n\nfunction formatManifestReadError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport const _testOnly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ChE,QAAM,eAAe,KAAK,KAAK,WAAW,eAAe;AACzD,MAAI,CAAE,MAAM,WAAW,YAAY,GAAI;AACrC,UAAM,IAAI,WAAW,qCAAqC,YAAY,MAAM,UAAU,KAAK;EAC7F;AAEA,MAAI;AACJ,MAAI;AACF,qBAAiB,KAAK,MAAM,MAAM,GAAG,SAAS,cAAc,MAAM,CAAC;EACrE,SAAS,OAAgB;AACvB,UAAM,IAAI,WACR,0CAA0C,YAAY,MAAM,wBAAwB,KAAK,CAAC,IAC1F,UAAU,KAAK;EAEnB;AAEA,QAAM,WAAW,uBAAuB,cAAc;AACtD,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,WAAW,0BAA0B,YAAY,iBAAiB,UAAU,KAAK;EAC7F;AAEA,QAAM,YAAY,KAAK,QAAQ,WAAW,SAAS,KAAK;AACxD,MAAI,CAAC,sBAAsB,WAAW,SAAS,GAAG;AAChD,UAAM,IAAI,WACR,oBAAoB,SAAS,KAAK,2CAA2C,SAAS,MACtF,UAAU,KAAK;EAEnB;AACA,MAAI,CAAE,MAAM,WAAW,SAAS,GAAI;AAClC,UAAM,IAAI,WAAW,uCAAuC,SAAS,MAAM,UAAU,KAAK;EAC5F;AACA,MAAI,CAAE,MAAM,+BAA+B,WAAW,SAAS,GAAI;AACjE,UAAM,IAAI,WACR,oBAAoB,SAAS,KAAK,oEAClC,UAAU,KAAK;EAEnB;AAEA,SAAO;IACL;IACA,eAAe;IACf,YAAY;IACZ;;AAEJ;AAEA,SAAS,wBAAwB,OAAc;AAC7C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
|
|
6
|
+
"names": ["commandPathTokens"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0ae90423-f9b0-564b-9911-07266dbae788")}catch(e){}}();
|
|
3
3
|
import {
|
|
4
4
|
resolveAuthor
|
|
5
5
|
} from "./chunk-T5RRNDA7.js";
|
|
6
6
|
import {
|
|
7
7
|
readHistoryEntries
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OGXLACHC.js";
|
|
9
9
|
import {
|
|
10
10
|
EMPTY_REPLAY_DOCUMENT,
|
|
11
11
|
historyEntriesToRaw,
|
|
@@ -13,27 +13,22 @@ import {
|
|
|
13
13
|
replayToItemDocument,
|
|
14
14
|
tryApplyReplayPatch,
|
|
15
15
|
verifyHistoryChain
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SLMUGTK3.js";
|
|
17
17
|
import {
|
|
18
18
|
acquireLock,
|
|
19
19
|
createHistoryEntry,
|
|
20
20
|
locateItem,
|
|
21
|
-
readLocatedItem
|
|
22
|
-
} from "./chunk-KJZOSF7J.js";
|
|
23
|
-
import {
|
|
24
21
|
normalizeItemId,
|
|
25
|
-
normalizeRawItemId
|
|
26
|
-
|
|
22
|
+
normalizeRawItemId,
|
|
23
|
+
readLocatedItem
|
|
24
|
+
} from "./chunk-JSU5P7VS.js";
|
|
27
25
|
import {
|
|
28
26
|
canonicalDocument,
|
|
29
27
|
serializeItemDocument
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import {
|
|
32
|
-
resolveItemTypeRegistry
|
|
33
|
-
} from "./chunk-TKPP4GOO.js";
|
|
28
|
+
} from "./chunk-QCWF6IYD.js";
|
|
34
29
|
import {
|
|
35
30
|
nowIso
|
|
36
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-AXIDKKAT.js";
|
|
37
32
|
import {
|
|
38
33
|
EXIT_CODE,
|
|
39
34
|
PmCliError,
|
|
@@ -45,10 +40,11 @@ import {
|
|
|
45
40
|
readFileIfExists,
|
|
46
41
|
readSettings,
|
|
47
42
|
resolveGovernanceKnobs,
|
|
43
|
+
resolveItemTypeRegistry,
|
|
48
44
|
resolvePmRoot,
|
|
49
45
|
runActiveOnWriteHooks,
|
|
50
46
|
writeFileAtomic
|
|
51
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-7R4QEMZZ.js";
|
|
52
48
|
|
|
53
49
|
// dist/cli/commands/history-redact.js
|
|
54
50
|
import fs from "node:fs/promises";
|
|
@@ -579,6 +575,6 @@ export {
|
|
|
579
575
|
runHistoryRedact,
|
|
580
576
|
_testOnly
|
|
581
577
|
};
|
|
582
|
-
//# sourceMappingURL=chunk-
|
|
578
|
+
//# sourceMappingURL=chunk-RLDHZHQS.js.map
|
|
583
579
|
|
|
584
|
-
//# debugId=
|
|
580
|
+
//# debugId=0ae90423-f9b0-564b-9911-07266dbae788
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../cli/commands/history-redact.ts","../../../../../../../../core/history/history-rewrite.ts"],"sourcesContent":["/**\n * @module cli/commands/history-redact\n *\n * Implements the pm history redact command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { createHistoryEntry } from \"../../core/history/history.js\";\nimport { executeHistoryRewrite } from \"../../core/history/history-rewrite.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n historyEntriesToRaw,\n replayHash,\n replayToItemDocument,\n tryApplyReplayPatch,\n verifyHistoryChain,\n type ReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport { canonicalDocument, serializeItemDocument } from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\n\n/**\n * Documents the history redact command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRedactCommandOptions {\n literal?: string[] | string;\n regex?: string[] | string;\n replacement?: string;\n dryRun?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\ninterface RegexRule {\n kind: \"regex\";\n source: string;\n flags: string;\n label: string;\n}\n\ninterface LiteralRule {\n kind: \"literal\";\n value: string;\n label: string;\n}\n\ntype RedactionRule = RegexRule | LiteralRule;\n\ninterface RedactionRewriteResult {\n entries: HistoryEntry[];\n finalDocument: ReplayDocument;\n entriesChanged: number;\n replacements: number;\n}\n\ninterface HistoryIntegritySnapshot {\n hashMismatchesBefore: number;\n hashMismatchesAfter: number;\n finalDocument: ReplayDocument;\n}\n\n/**\n * Documents the history subject payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistorySubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n}\n\n/**\n * Documents the history redact result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRedactResult {\n id: string;\n dry_run: boolean;\n changed: boolean;\n patterns: {\n literals: string[];\n regex: string[];\n replacement: string;\n };\n history: {\n path: string;\n entries_scanned: number;\n entries_changed: number;\n replacements: number;\n hash_mismatches_before: number;\n hash_mismatches_after: number;\n preexisting_hash_mismatches: number;\n audit_entry_added: boolean;\n verify_ok: boolean;\n verify_errors: string[];\n };\n item: {\n existed_before: boolean;\n exists_after: boolean;\n path_before: string | null;\n path_after: string | null;\n changed: boolean;\n };\n warnings: string[];\n generated_at: string;\n}\n\nfunction normalizeStringArrayInput(value: string[] | string | undefined): string[] {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === \"string\") {\n return [value];\n }\n return [];\n}\n\nfunction normalizeRegexFlags(flags: string): string {\n const unique: string[] = [];\n for (const token of flags) {\n if (!unique.includes(token)) {\n unique.push(token);\n }\n }\n if (!unique.includes(\"g\")) {\n unique.push(\"g\");\n }\n return unique.join(\"\");\n}\n\nfunction parseRegexRule(spec: string): RegexRule {\n const trimmed = spec.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(\"history-redact --regex requires a non-empty pattern.\", EXIT_CODE.USAGE);\n }\n\n let source = trimmed;\n let flags = \"g\";\n if (trimmed.startsWith(\"/\") && trimmed.length > 1) {\n /* c8 ignore start -- bare-slash regex literals are rejected earlier in argument validation. */\n const slashIndex = trimmed.lastIndexOf(\"/\");\n if (slashIndex > 0) {\n source = trimmed.slice(1, slashIndex);\n flags = normalizeRegexFlags(trimmed.slice(slashIndex + 1));\n }\n /* c8 ignore stop */\n }\n if (source.length === 0) {\n throw new PmCliError(\"history-redact --regex cannot use an empty pattern.\", EXIT_CODE.USAGE);\n }\n try {\n new RegExp(source, flags);\n } catch (error) {\n /* c8 ignore start -- RegExp constructor failures are normalized in higher-level parser tests. */\n throw new PmCliError(\n `Invalid --regex value \"${spec}\": ${error instanceof Error ? error.message : String(error)}`,\n EXIT_CODE.USAGE,\n );\n /* c8 ignore stop */\n }\n\n return {\n kind: \"regex\",\n source,\n flags,\n label: `/${source}/${flags}`,\n };\n}\n\nfunction buildRedactionRules(\n literalInput: string[] | string | undefined,\n regexInput: string[] | string | undefined,\n): RedactionRule[] {\n const literalRules = [...new Set(normalizeStringArrayInput(literalInput).map((entry) => entry.trim()))]\n .filter((entry) => entry.length > 0)\n .map<LiteralRule>((entry) => ({\n kind: \"literal\",\n value: entry,\n label: entry,\n }));\n const regexRules = [...new Set(normalizeStringArrayInput(regexInput).map((entry) => entry.trim()))]\n .filter((entry) => entry.length > 0)\n .map(parseRegexRule);\n\n const rules = [...literalRules, ...regexRules];\n if (rules.length === 0) {\n throw new PmCliError(\n \"history-redact requires at least one matcher via --literal or --regex.\",\n EXIT_CODE.USAGE,\n {\n code: \"missing_required_argument\",\n required: \"Provide --literal <value> and/or --regex <pattern>.\",\n examples: [\n 'pm history-redact pm-a1b2 --literal \"[redacted_path_prefix]/private\"',\n 'pm history-redact pm-a1b2 --regex \"/192\\\\\\\\.168\\\\\\\\.[0-9.]+/g\" --replacement \"[scrubbed_ip]\"',\n ],\n },\n );\n }\n return rules;\n}\n\nfunction applyLiteralRule(value: string, literal: string, replacement: string): { value: string; replacements: number } {\n if (literal.length === 0) {\n return { value, replacements: 0 };\n }\n let cursor = 0;\n let replacements = 0;\n while (cursor <= value.length) {\n const index = value.indexOf(literal, cursor);\n if (index === -1) {\n break;\n }\n replacements += 1;\n cursor = index + Math.max(1, literal.length);\n }\n if (replacements === 0) {\n return { value, replacements: 0 };\n }\n return {\n value: value.split(literal).join(replacement),\n replacements,\n };\n}\n\nfunction applyRegexRule(value: string, rule: RegexRule, replacement: string): { value: string; replacements: number } {\n const regex = new RegExp(rule.source, rule.flags);\n const matches = [...value.matchAll(regex)];\n if (matches.length === 0) {\n return { value, replacements: 0 };\n }\n return {\n value: value.replace(regex, replacement),\n replacements: matches.length,\n };\n}\n\nfunction redactStringValue(value: string, rules: RedactionRule[], replacement: string): { value: string; replacements: number } {\n let next = value;\n let replacements = 0;\n for (const rule of rules) {\n const result =\n rule.kind === \"literal\"\n ? applyLiteralRule(next, rule.value, replacement)\n : applyRegexRule(next, rule, replacement);\n next = result.value;\n replacements += result.replacements;\n }\n return {\n value: next,\n replacements,\n };\n}\n\nfunction redactUnknownValue(value: unknown, rules: RedactionRule[], replacement: string): { value: unknown; replacements: number } {\n if (typeof value === \"string\") {\n return redactStringValue(value, rules, replacement);\n }\n if (Array.isArray(value)) {\n let replacements = 0;\n const nextValues = value.map((entry) => {\n const redacted = redactUnknownValue(entry, rules, replacement);\n replacements += redacted.replacements;\n return redacted.value;\n });\n return {\n value: nextValues,\n replacements,\n };\n }\n if (typeof value === \"object\" && value !== null) {\n let replacements = 0;\n const nextRecord: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const redacted = redactUnknownValue(entry, rules, replacement);\n replacements += redacted.replacements;\n nextRecord[key] = redacted.value;\n }\n return {\n value: nextRecord,\n replacements,\n };\n }\n return {\n value,\n replacements: 0,\n };\n}\n\nfunction applyHistoryPatch(current: ReplayDocument, patch: HistoryPatchOp[], entryNumber: number, op: string): ReplayDocument {\n const result = tryApplyReplayPatch(current, patch);\n /* c8 ignore start -- invalid patch replay paths are covered by replay helper tests. */\n if (!result.ok) {\n throw new PmCliError(\n `history-redact failed to apply patch at entry ${entryNumber} (op=${op}): ${\n result.error instanceof Error ? result.error.message : String(result.error)\n }`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n /* c8 ignore stop */\n return result.document;\n}\n\nfunction inspectHistoryIntegrity(entries: HistoryEntry[]): HistoryIntegritySnapshot {\n let replay = structuredClone(EMPTY_REPLAY_DOCUMENT);\n let hashMismatchesBefore = 0;\n let hashMismatchesAfter = 0;\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n if (replayHash(replay) !== entry.before_hash) {\n hashMismatchesBefore += 1;\n }\n replay = applyHistoryPatch(replay, entry.patch, index + 1, entry.op);\n /* c8 ignore start -- after-hash mismatch branch is exercised in dedicated history integrity tests. */\n if (replayHash(replay) !== entry.after_hash) {\n hashMismatchesAfter += 1;\n }\n /* c8 ignore stop */\n }\n return {\n hashMismatchesBefore,\n hashMismatchesAfter,\n finalDocument: replay,\n };\n}\n\nfunction redactHistoryEntry(entry: HistoryEntry, rules: RedactionRule[], replacement: string): {\n entry: HistoryEntry;\n replacements: number;\n changed: boolean;\n} {\n let replacements = 0;\n let changed = false;\n let nextMessage = entry.message;\n\n if (typeof entry.message === \"string\") {\n const redactedMessage = redactStringValue(entry.message, rules, replacement);\n nextMessage = redactedMessage.value;\n replacements += redactedMessage.replacements;\n if (redactedMessage.replacements > 0) {\n changed = true;\n }\n }\n\n const nextPatch = entry.patch.map((operation) => {\n /* c8 ignore start -- patch operations without `value` are covered in lower-level patch adapters. */\n if (!Object.prototype.hasOwnProperty.call(operation, \"value\")) {\n return operation;\n }\n /* c8 ignore stop */\n const redactedValue = redactUnknownValue(operation.value, rules, replacement);\n replacements += redactedValue.replacements;\n if (redactedValue.replacements > 0) {\n changed = true;\n return {\n ...operation,\n value: redactedValue.value,\n };\n }\n return operation;\n });\n\n return {\n entry: {\n ...entry,\n message: nextMessage,\n patch: nextPatch,\n },\n replacements,\n changed,\n };\n}\n\nfunction rewriteHistoryEntries(entries: HistoryEntry[], rules: RedactionRule[], replacement: string): RedactionRewriteResult {\n let replay = structuredClone(EMPTY_REPLAY_DOCUMENT);\n let entriesChanged = 0;\n let replacements = 0;\n const rewrittenEntries: HistoryEntry[] = [];\n\n for (let index = 0; index < entries.length; index += 1) {\n const redacted = redactHistoryEntry(entries[index], rules, replacement);\n replacements += redacted.replacements;\n if (redacted.changed) {\n entriesChanged += 1;\n }\n const beforeHash = replayHash(replay);\n replay = applyHistoryPatch(replay, redacted.entry.patch, index + 1, redacted.entry.op);\n const afterHash = replayHash(replay);\n rewrittenEntries.push({\n ...redacted.entry,\n before_hash: beforeHash,\n after_hash: afterHash,\n });\n }\n\n return {\n entries: rewrittenEntries,\n finalDocument: replay,\n entriesChanged,\n replacements,\n };\n}\n\nfunction hasItemMetadata(replay: ReplayDocument): boolean {\n return Object.keys(replay.metadata).length > 0;\n}\n\n/**\n * Implements resolve history subject for the public runtime surface of this module.\n */\nexport async function resolveHistorySubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<HistorySubject> {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);\n if (located) {\n return {\n id: located.id,\n historyPath: getHistoryPath(pmRoot, located.id),\n located,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n };\n }\n }\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\n/**\n * Implements run history redact for the public runtime surface of this module.\n */\nexport async function runHistoryRedact(\n id: string,\n options: HistoryRedactCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRedactResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const replacement = typeof options.replacement === \"string\" && options.replacement.length > 0 ? options.replacement : \"[redacted]\";\n const rules = buildRedactionRules(options.literal, options.regex);\n const subject = await resolveHistorySubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n\n if (!(await pathExists(subject.historyPath))) {\n throw new PmCliError(`No history stream exists for ${subject.id}.`, EXIT_CODE.NOT_FOUND);\n }\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const historyEntries = await readHistoryEntries(subject.historyPath, subject.id);\n if (historyEntries.length === 0) {\n throw new PmCliError(`No history entries exist for ${subject.id}; nothing to redact.`, EXIT_CODE.USAGE);\n }\n\n const integritySnapshot = inspectHistoryIntegrity(historyEntries);\n const rewritten = rewriteHistoryEntries(historyEntries, rules, replacement);\n const preexistingHashMismatches = integritySnapshot.hashMismatchesBefore + integritySnapshot.hashMismatchesAfter;\n const dryRun = Boolean(options.dryRun);\n const changed = rewritten.replacements > 0;\n const warnings: string[] = [];\n if (preexistingHashMismatches > 0) {\n warnings.push(`history_redact_preexisting_hash_mismatches:${preexistingHashMismatches}`);\n }\n if (!changed) {\n warnings.push(\"history_redact_no_matches\");\n }\n\n let currentItemRaw: string | null = null;\n /* c8 ignore next -- located subject null-path branch is covered in restore/history-repair integration suites. */\n let currentItemPath: string | null = subject.located?.itemPath ?? null;\n let currentItemDocument: ItemDocument | null = null;\n if (subject.located) {\n const loaded = await readLocatedItem(subject.located, { schema: settings.schema });\n currentItemRaw = loaded.raw;\n currentItemDocument = loaded.document;\n }\n\n let nextItemPath: string | null = null;\n let nextItemRaw: string | null = null;\n let nextItemDocument: ItemDocument | null = null;\n /* c8 ignore next -- delete-state replay branches are covered by history rewrite integration tests. */\n if (hasItemMetadata(rewritten.finalDocument)) {\n const canonical = canonicalDocument(replayToItemDocument(rewritten.finalDocument), { schema: settings.schema });\n if (canonical.metadata.id !== subject.id) {\n throw new PmCliError(\n `history-redact would change item id from ${subject.id} to ${canonical.metadata.id}; narrow your patterns.`,\n EXIT_CODE.USAGE,\n );\n }\n nextItemDocument = canonical;\n nextItemPath = getItemPath(pmRoot, canonical.metadata.type, subject.id, \"toon\", typeRegistry.type_to_folder);\n nextItemRaw = serializeItemDocument(canonical, {\n format: \"toon\",\n schema: settings.schema,\n });\n }\n\n const itemChanged =\n /* c8 ignore next -- null-coalescing item-path comparison branch is exercised in broader command integration coverage. */\n (currentItemPath ?? null) !== (nextItemPath ?? null) ||\n /* c8 ignore next -- null-coalescing item-content comparison branch is exercised in broader command integration coverage. */\n (currentItemRaw ?? null) !== (nextItemRaw ?? null);\n\n const author = resolveAuthor(options.author, settings.author_default);\n const redactionMessage =\n /* c8 ignore next -- custom-message branch is validated by command wrapper tests. */\n typeof options.message === \"string\" && options.message.trim().length > 0\n ? options.message\n : `history-redact replaced ${rewritten.replacements} match(es) across ${rewritten.entriesChanged} entr${\n rewritten.entriesChanged === 1 ? \"y\" : \"ies\"\n }.`;\n\n const rewrittenEntries = [...rewritten.entries];\n let auditEntryAdded = false;\n if (!dryRun && changed) {\n /* c8 ignore next -- fallback replay-to-item conversion runs only when rewritten final metadata is absent. */\n const finalDocument = nextItemDocument ?? replayToItemDocument(rewritten.finalDocument);\n rewrittenEntries.push(\n createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"history_redact\",\n before: finalDocument,\n after: finalDocument,\n message: redactionMessage,\n }),\n );\n auditEntryAdded = true;\n }\n const historyVerify = verifyHistoryChain(rewrittenEntries);\n /* c8 ignore start -- invalid rewritten chains are covered by history verification unit tests. */\n if (!historyVerify.ok) {\n throw new PmCliError(\n `history-redact produced an invalid rewritten chain (${historyVerify.errors.join(\", \")}).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n /* c8 ignore stop */\n\n if (!dryRun && changed) {\n warnings.push(\n ...(await executeHistoryRewrite({\n pmRoot,\n subject,\n settings,\n typeRegistry,\n historyRawBeforeLock,\n currentItemRawBeforeLock: currentItemRaw,\n operation: \"history-redact\",\n author,\n force: options.force,\n itemDocument: currentItemDocument,\n applyRewrite: async ({ historyRawUnderLock }) => {\n const affectedItemPaths = new Set<string>();\n if (currentItemPath) {\n affectedItemPaths.add(currentItemPath);\n }\n if (nextItemPath) {\n affectedItemPaths.add(nextItemPath);\n }\n const itemSnapshots = new Map<string, string>();\n if (currentItemPath && currentItemRaw !== null) {\n itemSnapshots.set(currentItemPath, currentItemRaw);\n }\n\n try {\n /* c8 ignore next -- item-write diff branch requires path and content divergence under lock races. */\n if (nextItemPath && nextItemRaw !== null && nextItemRaw !== currentItemRaw) {\n await writeFileAtomic(nextItemPath, nextItemRaw);\n }\n if (currentItemPath && (!nextItemPath || nextItemPath !== currentItemPath)) {\n await fs.rm(currentItemPath, { force: true });\n }\n await writeFileAtomic(subject.historyPath, historyEntriesToRaw(rewrittenEntries));\n } catch (error) {\n /* c8 ignore start -- no-history-under-lock rollback path is exercised in lock-race integration tests. */\n if (historyRawUnderLock === null) {\n await fs.rm(subject.historyPath, { force: true });\n } else {\n await writeFileAtomic(subject.historyPath, historyRawUnderLock);\n }\n /* c8 ignore stop */\n for (const itemPath of affectedItemPaths) {\n const snapshot = itemSnapshots.get(itemPath);\n /* c8 ignore start -- missing snapshot rollback occurs only for create/delete race permutations. */\n if (snapshot === undefined) {\n await fs.rm(itemPath, { force: true });\n } else {\n await writeFileAtomic(itemPath, snapshot);\n }\n /* c8 ignore stop */\n }\n throw error;\n }\n },\n applyPostRewrite: async () => {\n const hookWarnings: string[] = [];\n const itemHookPath = nextItemPath ?? currentItemPath;\n if (itemHookPath) {\n hookWarnings.push(\n ...(await runActiveOnWriteHooks({\n path: itemHookPath,\n scope: \"project\",\n op: \"history_redact\",\n })),\n );\n }\n hookWarnings.push(\n ...(await runActiveOnWriteHooks({\n path: subject.historyPath,\n scope: \"project\",\n op: \"history_redact:history\",\n })),\n );\n return hookWarnings;\n },\n })),\n );\n }\n\n return {\n id: subject.id,\n dry_run: dryRun,\n changed,\n patterns: {\n literals: rules.filter((rule): rule is LiteralRule => rule.kind === \"literal\").map((rule) => rule.value),\n regex: rules.filter((rule): rule is RegexRule => rule.kind === \"regex\").map((rule) => `/${rule.source}/${rule.flags}`),\n replacement,\n },\n history: {\n path: subject.historyPath,\n entries_scanned: historyEntries.length,\n entries_changed: rewritten.entriesChanged,\n replacements: rewritten.replacements,\n hash_mismatches_before: integritySnapshot.hashMismatchesBefore,\n hash_mismatches_after: integritySnapshot.hashMismatchesAfter,\n preexisting_hash_mismatches: preexistingHashMismatches,\n audit_entry_added: auditEntryAdded,\n verify_ok: historyVerify.ok,\n verify_errors: historyVerify.errors,\n },\n item: {\n existed_before: currentItemPath !== null,\n exists_after: nextItemPath !== null,\n path_before: currentItemPath,\n path_after: nextItemPath,\n changed: itemChanged,\n },\n /* c8 ignore next -- warning dedupe ordering is covered indirectly by command-level smoke tests. */\n warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n\nexport const _testOnly = {\n applyLiteralRule,\n applyRegexRule,\n buildRedactionRules,\n hasItemMetadata,\n normalizeRegexFlags,\n normalizeStringArrayInput,\n parseRegexRule,\n redactStringValue,\n redactUnknownValue,\n};\n","/**\n * @module core/history/history-rewrite\n *\n * Implements append-only history and replay behavior for History Rewrite.\n */\nimport { readFileIfExists } from \"../fs/fs-utils.js\";\nimport type { ItemTypeRegistry } from \"../item/type-registry.js\";\nimport { acquireLock } from \"../lock/lock.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { locateItem, readLocatedItem } from \"../store/item-store.js\";\nimport { resolveGovernanceKnobs } from \"../store/settings.js\";\nimport type { ItemDocument, PmSettings } from \"../../types/index.js\";\n\ntype LoadedItem = Awaited<ReturnType<typeof readLocatedItem>>;\n\n/**\n * Documents the history rewrite subject payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRewriteSubject {\n id: string;\n historyPath: string;\n}\n\n/**\n * Documents the history rewrite ownership params payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRewriteOwnershipParams {\n itemDocument: ItemDocument | null;\n subjectId: string;\n author: string;\n force: boolean | undefined;\n settings: PmSettings;\n}\n\n/**\n * Apply ownership_enforcement governance to a history-rewriting operation.\n * Returns the warning(s) the caller should append (empty when no conflict or strict-throws).\n * Throws PmCliError(CONFLICT) in strict mode when the assignee conflicts and --force is not set.\n */\nexport function checkHistoryRewriteOwnership(params: HistoryRewriteOwnershipParams): string[] {\n if (!params.itemDocument) return [];\n const assigned = params.itemDocument.metadata?.assignee?.trim();\n if (!assigned || assigned === params.author || params.force) return [];\n\n const governance = resolveGovernanceKnobs(params.settings);\n if (governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${params.subjectId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (governance.ownership_enforcement === \"warn\") {\n return [`ownership_warning:assignee_conflict:${params.subjectId}:${assigned}`];\n }\n return [];\n}\n\n/**\n * Documents the verify history rewrite drift params payload exchanged by command, SDK, and package integrations.\n */\nexport interface VerifyHistoryRewriteDriftParams {\n pmRoot: string;\n subject: HistoryRewriteSubject;\n settings: PmSettings;\n typeRegistry: ItemTypeRegistry;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n /** Short operation name used in the conflict message (e.g. \"history-redact\"). */\n operation: string;\n}\n\n/**\n * Documents the verified history rewrite state payload exchanged by command, SDK, and package integrations.\n */\nexport interface VerifiedHistoryRewriteState {\n historyRawUnderLock: string | null;\n locatedUnderLock: Awaited<ReturnType<typeof locateItem>>;\n loadedItemUnderLock: LoadedItem | null;\n}\n\n/**\n * Re-read the history stream and the located item document under the acquired lock and\n * compare both with the pre-lock raw snapshots. Throws PmCliError(CONFLICT) if either\n * diverged while waiting for the lock so the caller surfaces an actionable retry.\n */\nexport async function verifyHistoryRewriteNoDrift(\n params: VerifyHistoryRewriteDriftParams,\n): Promise<VerifiedHistoryRewriteState> {\n const historyRawUnderLock = await readFileIfExists(params.subject.historyPath);\n if (historyRawUnderLock !== params.historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${params.subject.id} changed while waiting for lock; retry ${params.operation}.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n params.pmRoot,\n params.subject.id,\n params.settings.id_prefix,\n params.settings.item_format,\n params.typeRegistry.type_to_folder,\n );\n const loadedItemUnderLock = locatedUnderLock\n ? await readLocatedItem(locatedUnderLock, { schema: params.settings.schema })\n : null;\n if ((loadedItemUnderLock?.raw ?? null) !== (params.currentItemRawBeforeLock ?? null)) {\n throw new PmCliError(\n `Item ${params.subject.id} changed while waiting for lock; retry ${params.operation}.`,\n EXIT_CODE.CONFLICT,\n );\n }\n return { historyRawUnderLock, locatedUnderLock, loadedItemUnderLock };\n}\n\n/**\n * Documents the execute history rewrite params payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExecuteHistoryRewriteParams {\n pmRoot: string;\n subject: HistoryRewriteSubject;\n settings: PmSettings;\n typeRegistry: ItemTypeRegistry;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n /** Short operation name used in conflict guidance (e.g. \"history-redact\"). */\n operation: string;\n author: string;\n force: boolean | undefined;\n itemDocument: ItemDocument | null;\n applyRewrite: (verified: VerifiedHistoryRewriteState) => Promise<void>;\n applyPostRewrite?: (verified: VerifiedHistoryRewriteState) => Promise<string[]>;\n}\n\n/**\n * Shared lock/verify/ownership orchestration for history-rewrite commands.\n * Callers provide the operation-specific write/rollback logic and optional\n * post-write hook execution while this helper enforces the common governance +\n * lock sequencing contract.\n */\nexport async function executeHistoryRewrite(params: ExecuteHistoryRewriteParams): Promise<string[]> {\n const warnings = [...checkHistoryRewriteOwnership({\n itemDocument: params.itemDocument,\n subjectId: params.subject.id,\n author: params.author,\n force: params.force,\n settings: params.settings,\n })];\n const releaseLock = await acquireLock(\n params.pmRoot,\n params.subject.id,\n params.settings.locks.ttl_seconds,\n params.author,\n Boolean(params.force),\n params.settings.governance.force_required_for_stale_lock,\n );\n try {\n const verified = await verifyHistoryRewriteNoDrift({\n pmRoot: params.pmRoot,\n subject: params.subject,\n settings: params.settings,\n typeRegistry: params.typeRegistry,\n historyRawBeforeLock: params.historyRawBeforeLock,\n currentItemRawBeforeLock: params.currentItemRawBeforeLock,\n operation: params.operation,\n });\n await params.applyRewrite(verified);\n if (params.applyPostRewrite) {\n warnings.push(...(await params.applyPostRewrite(verified)));\n }\n return warnings;\n } finally {\n await releaseLock();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,QAAQ;;;ACmCT,SAAU,6BAA6B,QAAqC;AAChF,MA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C1C,uBAAuB,kBAAkB;MACzC,6BAA6B;MAC7B,mBAAmB;MACnB,WAAW,cAAc;MACzB,eAAe,cAAc;;IAE/B,MAAM;MACJ,gBAAgB,oBAAoB;MACpC,cAAc,iBAAiB;MAC/B,aAAa;MACb,YAAY;MACZ,SAAS;;;IAGX,UAAU,CAAC,GAAG,IAAI,IAAI,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC;IAChF,cAAc,OAAM;;AAExB;AAEO,IAAM,YAAY;EACvB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","debugId":"148a8af9-cf71-5fc9-b14d-c307d87acbe2"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../cli/commands/history-redact.ts","../../../../../../../../core/history/history-rewrite.ts"],"sourcesContent":["/**\n * @module cli/commands/history-redact\n *\n * Implements the pm history redact command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { createHistoryEntry } from \"../../core/history/history.js\";\nimport { executeHistoryRewrite } from \"../../core/history/history-rewrite.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n historyEntriesToRaw,\n replayHash,\n replayToItemDocument,\n tryApplyReplayPatch,\n verifyHistoryChain,\n type ReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport { canonicalDocument, serializeItemDocument } from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\n\n/**\n * Documents the history redact command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRedactCommandOptions {\n literal?: string[] | string;\n regex?: string[] | string;\n replacement?: string;\n dryRun?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\ninterface RegexRule {\n kind: \"regex\";\n source: string;\n flags: string;\n label: string;\n}\n\ninterface LiteralRule {\n kind: \"literal\";\n value: string;\n label: string;\n}\n\ntype RedactionRule = RegexRule | LiteralRule;\n\ninterface RedactionRewriteResult {\n entries: HistoryEntry[];\n finalDocument: ReplayDocument;\n entriesChanged: number;\n replacements: number;\n}\n\ninterface HistoryIntegritySnapshot {\n hashMismatchesBefore: number;\n hashMismatchesAfter: number;\n finalDocument: ReplayDocument;\n}\n\n/**\n * Documents the history subject payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistorySubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n}\n\n/**\n * Documents the history redact result payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRedactResult {\n id: string;\n dry_run: boolean;\n changed: boolean;\n patterns: {\n literals: string[];\n regex: string[];\n replacement: string;\n };\n history: {\n path: string;\n entries_scanned: number;\n entries_changed: number;\n replacements: number;\n hash_mismatches_before: number;\n hash_mismatches_after: number;\n preexisting_hash_mismatches: number;\n audit_entry_added: boolean;\n verify_ok: boolean;\n verify_errors: string[];\n };\n item: {\n existed_before: boolean;\n exists_after: boolean;\n path_before: string | null;\n path_after: string | null;\n changed: boolean;\n };\n warnings: string[];\n generated_at: string;\n}\n\nfunction normalizeStringArrayInput(value: string[] | string | undefined): string[] {\n if (Array.isArray(value)) {\n return value;\n }\n if (typeof value === \"string\") {\n return [value];\n }\n return [];\n}\n\nfunction normalizeRegexFlags(flags: string): string {\n const unique: string[] = [];\n for (const token of flags) {\n if (!unique.includes(token)) {\n unique.push(token);\n }\n }\n if (!unique.includes(\"g\")) {\n unique.push(\"g\");\n }\n return unique.join(\"\");\n}\n\nfunction parseRegexRule(spec: string): RegexRule {\n const trimmed = spec.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(\"history-redact --regex requires a non-empty pattern.\", EXIT_CODE.USAGE);\n }\n\n let source = trimmed;\n let flags = \"g\";\n if (trimmed.startsWith(\"/\") && trimmed.length > 1) {\n /* c8 ignore start -- bare-slash regex literals are rejected earlier in argument validation. */\n const slashIndex = trimmed.lastIndexOf(\"/\");\n if (slashIndex > 0) {\n source = trimmed.slice(1, slashIndex);\n flags = normalizeRegexFlags(trimmed.slice(slashIndex + 1));\n }\n /* c8 ignore stop */\n }\n if (source.length === 0) {\n throw new PmCliError(\"history-redact --regex cannot use an empty pattern.\", EXIT_CODE.USAGE);\n }\n try {\n new RegExp(source, flags);\n } catch (error) {\n /* c8 ignore start -- RegExp constructor failures are normalized in higher-level parser tests. */\n throw new PmCliError(\n `Invalid --regex value \"${spec}\": ${error instanceof Error ? error.message : String(error)}`,\n EXIT_CODE.USAGE,\n );\n /* c8 ignore stop */\n }\n\n return {\n kind: \"regex\",\n source,\n flags,\n label: `/${source}/${flags}`,\n };\n}\n\nfunction buildRedactionRules(\n literalInput: string[] | string | undefined,\n regexInput: string[] | string | undefined,\n): RedactionRule[] {\n const literalRules = [...new Set(normalizeStringArrayInput(literalInput).map((entry) => entry.trim()))]\n .filter((entry) => entry.length > 0)\n .map<LiteralRule>((entry) => ({\n kind: \"literal\",\n value: entry,\n label: entry,\n }));\n const regexRules = [...new Set(normalizeStringArrayInput(regexInput).map((entry) => entry.trim()))]\n .filter((entry) => entry.length > 0)\n .map(parseRegexRule);\n\n const rules = [...literalRules, ...regexRules];\n if (rules.length === 0) {\n throw new PmCliError(\n \"history-redact requires at least one matcher via --literal or --regex.\",\n EXIT_CODE.USAGE,\n {\n code: \"missing_required_argument\",\n required: \"Provide --literal <value> and/or --regex <pattern>.\",\n examples: [\n 'pm history-redact pm-a1b2 --literal \"[redacted_path_prefix]/private\"',\n 'pm history-redact pm-a1b2 --regex \"/192\\\\\\\\.168\\\\\\\\.[0-9.]+/g\" --replacement \"[scrubbed_ip]\"',\n ],\n },\n );\n }\n return rules;\n}\n\nfunction applyLiteralRule(value: string, literal: string, replacement: string): { value: string; replacements: number } {\n if (literal.length === 0) {\n return { value, replacements: 0 };\n }\n let cursor = 0;\n let replacements = 0;\n while (cursor <= value.length) {\n const index = value.indexOf(literal, cursor);\n if (index === -1) {\n break;\n }\n replacements += 1;\n cursor = index + Math.max(1, literal.length);\n }\n if (replacements === 0) {\n return { value, replacements: 0 };\n }\n return {\n value: value.split(literal).join(replacement),\n replacements,\n };\n}\n\nfunction applyRegexRule(value: string, rule: RegexRule, replacement: string): { value: string; replacements: number } {\n const regex = new RegExp(rule.source, rule.flags);\n const matches = [...value.matchAll(regex)];\n if (matches.length === 0) {\n return { value, replacements: 0 };\n }\n return {\n value: value.replace(regex, replacement),\n replacements: matches.length,\n };\n}\n\nfunction redactStringValue(value: string, rules: RedactionRule[], replacement: string): { value: string; replacements: number } {\n let next = value;\n let replacements = 0;\n for (const rule of rules) {\n const result =\n rule.kind === \"literal\"\n ? applyLiteralRule(next, rule.value, replacement)\n : applyRegexRule(next, rule, replacement);\n next = result.value;\n replacements += result.replacements;\n }\n return {\n value: next,\n replacements,\n };\n}\n\nfunction redactUnknownValue(value: unknown, rules: RedactionRule[], replacement: string): { value: unknown; replacements: number } {\n if (typeof value === \"string\") {\n return redactStringValue(value, rules, replacement);\n }\n if (Array.isArray(value)) {\n let replacements = 0;\n const nextValues = value.map((entry) => {\n const redacted = redactUnknownValue(entry, rules, replacement);\n replacements += redacted.replacements;\n return redacted.value;\n });\n return {\n value: nextValues,\n replacements,\n };\n }\n if (typeof value === \"object\" && value !== null) {\n let replacements = 0;\n const nextRecord: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const redacted = redactUnknownValue(entry, rules, replacement);\n replacements += redacted.replacements;\n nextRecord[key] = redacted.value;\n }\n return {\n value: nextRecord,\n replacements,\n };\n }\n return {\n value,\n replacements: 0,\n };\n}\n\nfunction applyHistoryPatch(current: ReplayDocument, patch: HistoryPatchOp[], entryNumber: number, op: string): ReplayDocument {\n const result = tryApplyReplayPatch(current, patch);\n /* c8 ignore start -- invalid patch replay paths are covered by replay helper tests. */\n if (!result.ok) {\n throw new PmCliError(\n `history-redact failed to apply patch at entry ${entryNumber} (op=${op}): ${\n result.error instanceof Error ? result.error.message : String(result.error)\n }`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n /* c8 ignore stop */\n return result.document;\n}\n\nfunction inspectHistoryIntegrity(entries: HistoryEntry[]): HistoryIntegritySnapshot {\n let replay = structuredClone(EMPTY_REPLAY_DOCUMENT);\n let hashMismatchesBefore = 0;\n let hashMismatchesAfter = 0;\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n if (replayHash(replay) !== entry.before_hash) {\n hashMismatchesBefore += 1;\n }\n replay = applyHistoryPatch(replay, entry.patch, index + 1, entry.op);\n /* c8 ignore start -- after-hash mismatch branch is exercised in dedicated history integrity tests. */\n if (replayHash(replay) !== entry.after_hash) {\n hashMismatchesAfter += 1;\n }\n /* c8 ignore stop */\n }\n return {\n hashMismatchesBefore,\n hashMismatchesAfter,\n finalDocument: replay,\n };\n}\n\nfunction redactHistoryEntry(entry: HistoryEntry, rules: RedactionRule[], replacement: string): {\n entry: HistoryEntry;\n replacements: number;\n changed: boolean;\n} {\n let replacements = 0;\n let changed = false;\n let nextMessage = entry.message;\n\n if (typeof entry.message === \"string\") {\n const redactedMessage = redactStringValue(entry.message, rules, replacement);\n nextMessage = redactedMessage.value;\n replacements += redactedMessage.replacements;\n if (redactedMessage.replacements > 0) {\n changed = true;\n }\n }\n\n const nextPatch = entry.patch.map((operation) => {\n /* c8 ignore start -- patch operations without `value` are covered in lower-level patch adapters. */\n if (!Object.prototype.hasOwnProperty.call(operation, \"value\")) {\n return operation;\n }\n /* c8 ignore stop */\n const redactedValue = redactUnknownValue(operation.value, rules, replacement);\n replacements += redactedValue.replacements;\n if (redactedValue.replacements > 0) {\n changed = true;\n return {\n ...operation,\n value: redactedValue.value,\n };\n }\n return operation;\n });\n\n return {\n entry: {\n ...entry,\n message: nextMessage,\n patch: nextPatch,\n },\n replacements,\n changed,\n };\n}\n\nfunction rewriteHistoryEntries(entries: HistoryEntry[], rules: RedactionRule[], replacement: string): RedactionRewriteResult {\n let replay = structuredClone(EMPTY_REPLAY_DOCUMENT);\n let entriesChanged = 0;\n let replacements = 0;\n const rewrittenEntries: HistoryEntry[] = [];\n\n for (let index = 0; index < entries.length; index += 1) {\n const redacted = redactHistoryEntry(entries[index], rules, replacement);\n replacements += redacted.replacements;\n if (redacted.changed) {\n entriesChanged += 1;\n }\n const beforeHash = replayHash(replay);\n replay = applyHistoryPatch(replay, redacted.entry.patch, index + 1, redacted.entry.op);\n const afterHash = replayHash(replay);\n rewrittenEntries.push({\n ...redacted.entry,\n before_hash: beforeHash,\n after_hash: afterHash,\n });\n }\n\n return {\n entries: rewrittenEntries,\n finalDocument: replay,\n entriesChanged,\n replacements,\n };\n}\n\nfunction hasItemMetadata(replay: ReplayDocument): boolean {\n return Object.keys(replay.metadata).length > 0;\n}\n\n/**\n * Implements resolve history subject for the public runtime surface of this module.\n */\nexport async function resolveHistorySubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<HistorySubject> {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);\n if (located) {\n return {\n id: located.id,\n historyPath: getHistoryPath(pmRoot, located.id),\n located,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n };\n }\n }\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\n/**\n * Implements run history redact for the public runtime surface of this module.\n */\nexport async function runHistoryRedact(\n id: string,\n options: HistoryRedactCommandOptions,\n global: GlobalOptions,\n): Promise<HistoryRedactResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const replacement = typeof options.replacement === \"string\" && options.replacement.length > 0 ? options.replacement : \"[redacted]\";\n const rules = buildRedactionRules(options.literal, options.regex);\n const subject = await resolveHistorySubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n\n if (!(await pathExists(subject.historyPath))) {\n throw new PmCliError(`No history stream exists for ${subject.id}.`, EXIT_CODE.NOT_FOUND);\n }\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const historyEntries = await readHistoryEntries(subject.historyPath, subject.id);\n if (historyEntries.length === 0) {\n throw new PmCliError(`No history entries exist for ${subject.id}; nothing to redact.`, EXIT_CODE.USAGE);\n }\n\n const integritySnapshot = inspectHistoryIntegrity(historyEntries);\n const rewritten = rewriteHistoryEntries(historyEntries, rules, replacement);\n const preexistingHashMismatches = integritySnapshot.hashMismatchesBefore + integritySnapshot.hashMismatchesAfter;\n const dryRun = Boolean(options.dryRun);\n const changed = rewritten.replacements > 0;\n const warnings: string[] = [];\n if (preexistingHashMismatches > 0) {\n warnings.push(`history_redact_preexisting_hash_mismatches:${preexistingHashMismatches}`);\n }\n if (!changed) {\n warnings.push(\"history_redact_no_matches\");\n }\n\n let currentItemRaw: string | null = null;\n /* c8 ignore next -- located subject null-path branch is covered in restore/history-repair integration suites. */\n let currentItemPath: string | null = subject.located?.itemPath ?? null;\n let currentItemDocument: ItemDocument | null = null;\n if (subject.located) {\n const loaded = await readLocatedItem(subject.located, { schema: settings.schema });\n currentItemRaw = loaded.raw;\n currentItemDocument = loaded.document;\n }\n\n let nextItemPath: string | null = null;\n let nextItemRaw: string | null = null;\n let nextItemDocument: ItemDocument | null = null;\n /* c8 ignore next -- delete-state replay branches are covered by history rewrite integration tests. */\n if (hasItemMetadata(rewritten.finalDocument)) {\n const canonical = canonicalDocument(replayToItemDocument(rewritten.finalDocument), { schema: settings.schema });\n if (canonical.metadata.id !== subject.id) {\n throw new PmCliError(\n `history-redact would change item id from ${subject.id} to ${canonical.metadata.id}; narrow your patterns.`,\n EXIT_CODE.USAGE,\n );\n }\n nextItemDocument = canonical;\n nextItemPath = getItemPath(pmRoot, canonical.metadata.type, subject.id, \"toon\", typeRegistry.type_to_folder);\n nextItemRaw = serializeItemDocument(canonical, {\n format: \"toon\",\n schema: settings.schema,\n });\n }\n\n const itemChanged =\n /* c8 ignore next -- null-coalescing item-path comparison branch is exercised in broader command integration coverage. */\n (currentItemPath ?? null) !== (nextItemPath ?? null) ||\n /* c8 ignore next -- null-coalescing item-content comparison branch is exercised in broader command integration coverage. */\n (currentItemRaw ?? null) !== (nextItemRaw ?? null);\n\n const author = resolveAuthor(options.author, settings.author_default);\n const redactionMessage =\n /* c8 ignore next -- custom-message branch is validated by command wrapper tests. */\n typeof options.message === \"string\" && options.message.trim().length > 0\n ? options.message\n : `history-redact replaced ${rewritten.replacements} match(es) across ${rewritten.entriesChanged} entr${\n rewritten.entriesChanged === 1 ? \"y\" : \"ies\"\n }.`;\n\n const rewrittenEntries = [...rewritten.entries];\n let auditEntryAdded = false;\n if (!dryRun && changed) {\n /* c8 ignore next -- fallback replay-to-item conversion runs only when rewritten final metadata is absent. */\n const finalDocument = nextItemDocument ?? replayToItemDocument(rewritten.finalDocument);\n rewrittenEntries.push(\n createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"history_redact\",\n before: finalDocument,\n after: finalDocument,\n message: redactionMessage,\n }),\n );\n auditEntryAdded = true;\n }\n const historyVerify = verifyHistoryChain(rewrittenEntries);\n /* c8 ignore start -- invalid rewritten chains are covered by history verification unit tests. */\n if (!historyVerify.ok) {\n throw new PmCliError(\n `history-redact produced an invalid rewritten chain (${historyVerify.errors.join(\", \")}).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n /* c8 ignore stop */\n\n if (!dryRun && changed) {\n warnings.push(\n ...(await executeHistoryRewrite({\n pmRoot,\n subject,\n settings,\n typeRegistry,\n historyRawBeforeLock,\n currentItemRawBeforeLock: currentItemRaw,\n operation: \"history-redact\",\n author,\n force: options.force,\n itemDocument: currentItemDocument,\n applyRewrite: async ({ historyRawUnderLock }) => {\n const affectedItemPaths = new Set<string>();\n if (currentItemPath) {\n affectedItemPaths.add(currentItemPath);\n }\n if (nextItemPath) {\n affectedItemPaths.add(nextItemPath);\n }\n const itemSnapshots = new Map<string, string>();\n if (currentItemPath && currentItemRaw !== null) {\n itemSnapshots.set(currentItemPath, currentItemRaw);\n }\n\n try {\n /* c8 ignore next -- item-write diff branch requires path and content divergence under lock races. */\n if (nextItemPath && nextItemRaw !== null && nextItemRaw !== currentItemRaw) {\n await writeFileAtomic(nextItemPath, nextItemRaw);\n }\n if (currentItemPath && (!nextItemPath || nextItemPath !== currentItemPath)) {\n await fs.rm(currentItemPath, { force: true });\n }\n await writeFileAtomic(subject.historyPath, historyEntriesToRaw(rewrittenEntries));\n } catch (error) {\n /* c8 ignore start -- no-history-under-lock rollback path is exercised in lock-race integration tests. */\n if (historyRawUnderLock === null) {\n await fs.rm(subject.historyPath, { force: true });\n } else {\n await writeFileAtomic(subject.historyPath, historyRawUnderLock);\n }\n /* c8 ignore stop */\n for (const itemPath of affectedItemPaths) {\n const snapshot = itemSnapshots.get(itemPath);\n /* c8 ignore start -- missing snapshot rollback occurs only for create/delete race permutations. */\n if (snapshot === undefined) {\n await fs.rm(itemPath, { force: true });\n } else {\n await writeFileAtomic(itemPath, snapshot);\n }\n /* c8 ignore stop */\n }\n throw error;\n }\n },\n applyPostRewrite: async () => {\n const hookWarnings: string[] = [];\n const itemHookPath = nextItemPath ?? currentItemPath;\n if (itemHookPath) {\n hookWarnings.push(\n ...(await runActiveOnWriteHooks({\n path: itemHookPath,\n scope: \"project\",\n op: \"history_redact\",\n })),\n );\n }\n hookWarnings.push(\n ...(await runActiveOnWriteHooks({\n path: subject.historyPath,\n scope: \"project\",\n op: \"history_redact:history\",\n })),\n );\n return hookWarnings;\n },\n })),\n );\n }\n\n return {\n id: subject.id,\n dry_run: dryRun,\n changed,\n patterns: {\n literals: rules.filter((rule): rule is LiteralRule => rule.kind === \"literal\").map((rule) => rule.value),\n regex: rules.filter((rule): rule is RegexRule => rule.kind === \"regex\").map((rule) => `/${rule.source}/${rule.flags}`),\n replacement,\n },\n history: {\n path: subject.historyPath,\n entries_scanned: historyEntries.length,\n entries_changed: rewritten.entriesChanged,\n replacements: rewritten.replacements,\n hash_mismatches_before: integritySnapshot.hashMismatchesBefore,\n hash_mismatches_after: integritySnapshot.hashMismatchesAfter,\n preexisting_hash_mismatches: preexistingHashMismatches,\n audit_entry_added: auditEntryAdded,\n verify_ok: historyVerify.ok,\n verify_errors: historyVerify.errors,\n },\n item: {\n existed_before: currentItemPath !== null,\n exists_after: nextItemPath !== null,\n path_before: currentItemPath,\n path_after: nextItemPath,\n changed: itemChanged,\n },\n /* c8 ignore next -- warning dedupe ordering is covered indirectly by command-level smoke tests. */\n warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n\nexport const _testOnly = {\n applyLiteralRule,\n applyRegexRule,\n buildRedactionRules,\n hasItemMetadata,\n normalizeRegexFlags,\n normalizeStringArrayInput,\n parseRegexRule,\n redactStringValue,\n redactUnknownValue,\n};\n","/**\n * @module core/history/history-rewrite\n *\n * Implements append-only history and replay behavior for History Rewrite.\n */\nimport { readFileIfExists } from \"../fs/fs-utils.js\";\nimport type { ItemTypeRegistry } from \"../item/type-registry.js\";\nimport { acquireLock } from \"../lock/lock.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { locateItem, readLocatedItem } from \"../store/item-store.js\";\nimport { resolveGovernanceKnobs } from \"../store/settings.js\";\nimport type { ItemDocument, PmSettings } from \"../../types/index.js\";\n\ntype LoadedItem = Awaited<ReturnType<typeof readLocatedItem>>;\n\n/**\n * Documents the history rewrite subject payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRewriteSubject {\n id: string;\n historyPath: string;\n}\n\n/**\n * Documents the history rewrite ownership params payload exchanged by command, SDK, and package integrations.\n */\nexport interface HistoryRewriteOwnershipParams {\n itemDocument: ItemDocument | null;\n subjectId: string;\n author: string;\n force: boolean | undefined;\n settings: PmSettings;\n}\n\n/**\n * Apply ownership_enforcement governance to a history-rewriting operation.\n * Returns the warning(s) the caller should append (empty when no conflict or strict-throws).\n * Throws PmCliError(CONFLICT) in strict mode when the assignee conflicts and --force is not set.\n */\nexport function checkHistoryRewriteOwnership(params: HistoryRewriteOwnershipParams): string[] {\n if (!params.itemDocument) return [];\n const assigned = params.itemDocument.metadata?.assignee?.trim();\n if (!assigned || assigned === params.author || params.force) return [];\n\n const governance = resolveGovernanceKnobs(params.settings);\n if (governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${params.subjectId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (governance.ownership_enforcement === \"warn\") {\n return [`ownership_warning:assignee_conflict:${params.subjectId}:${assigned}`];\n }\n return [];\n}\n\n/**\n * Documents the verify history rewrite drift params payload exchanged by command, SDK, and package integrations.\n */\nexport interface VerifyHistoryRewriteDriftParams {\n pmRoot: string;\n subject: HistoryRewriteSubject;\n settings: PmSettings;\n typeRegistry: ItemTypeRegistry;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n /** Short operation name used in the conflict message (e.g. \"history-redact\"). */\n operation: string;\n}\n\n/**\n * Documents the verified history rewrite state payload exchanged by command, SDK, and package integrations.\n */\nexport interface VerifiedHistoryRewriteState {\n historyRawUnderLock: string | null;\n locatedUnderLock: Awaited<ReturnType<typeof locateItem>>;\n loadedItemUnderLock: LoadedItem | null;\n}\n\n/**\n * Re-read the history stream and the located item document under the acquired lock and\n * compare both with the pre-lock raw snapshots. Throws PmCliError(CONFLICT) if either\n * diverged while waiting for the lock so the caller surfaces an actionable retry.\n */\nexport async function verifyHistoryRewriteNoDrift(\n params: VerifyHistoryRewriteDriftParams,\n): Promise<VerifiedHistoryRewriteState> {\n const historyRawUnderLock = await readFileIfExists(params.subject.historyPath);\n if (historyRawUnderLock !== params.historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${params.subject.id} changed while waiting for lock; retry ${params.operation}.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n params.pmRoot,\n params.subject.id,\n params.settings.id_prefix,\n params.settings.item_format,\n params.typeRegistry.type_to_folder,\n );\n const loadedItemUnderLock = locatedUnderLock\n ? await readLocatedItem(locatedUnderLock, { schema: params.settings.schema })\n : null;\n if ((loadedItemUnderLock?.raw ?? null) !== (params.currentItemRawBeforeLock ?? null)) {\n throw new PmCliError(\n `Item ${params.subject.id} changed while waiting for lock; retry ${params.operation}.`,\n EXIT_CODE.CONFLICT,\n );\n }\n return { historyRawUnderLock, locatedUnderLock, loadedItemUnderLock };\n}\n\n/**\n * Documents the execute history rewrite params payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExecuteHistoryRewriteParams {\n pmRoot: string;\n subject: HistoryRewriteSubject;\n settings: PmSettings;\n typeRegistry: ItemTypeRegistry;\n historyRawBeforeLock: string | null;\n currentItemRawBeforeLock: string | null;\n /** Short operation name used in conflict guidance (e.g. \"history-redact\"). */\n operation: string;\n author: string;\n force: boolean | undefined;\n itemDocument: ItemDocument | null;\n applyRewrite: (verified: VerifiedHistoryRewriteState) => Promise<void>;\n applyPostRewrite?: (verified: VerifiedHistoryRewriteState) => Promise<string[]>;\n}\n\n/**\n * Shared lock/verify/ownership orchestration for history-rewrite commands.\n * Callers provide the operation-specific write/rollback logic and optional\n * post-write hook execution while this helper enforces the common governance +\n * lock sequencing contract.\n */\nexport async function executeHistoryRewrite(params: ExecuteHistoryRewriteParams): Promise<string[]> {\n const warnings = [...checkHistoryRewriteOwnership({\n itemDocument: params.itemDocument,\n subjectId: params.subject.id,\n author: params.author,\n force: params.force,\n settings: params.settings,\n })];\n const releaseLock = await acquireLock(\n params.pmRoot,\n params.subject.id,\n params.settings.locks.ttl_seconds,\n params.author,\n Boolean(params.force),\n params.settings.governance.force_required_for_stale_lock,\n );\n try {\n const verified = await verifyHistoryRewriteNoDrift({\n pmRoot: params.pmRoot,\n subject: params.subject,\n settings: params.settings,\n typeRegistry: params.typeRegistry,\n historyRawBeforeLock: params.historyRawBeforeLock,\n currentItemRawBeforeLock: params.currentItemRawBeforeLock,\n operation: params.operation,\n });\n await params.applyRewrite(verified);\n if (params.applyPostRewrite) {\n warnings.push(...(await params.applyPostRewrite(verified)));\n }\n return warnings;\n } finally {\n await releaseLock();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,QAAQ;;;ACmCT,SAAU,6BAA6B,QAAqC;AAChF,MAAI,CAAC,OAAO;AAAc,WAAO,CAAA;AACjC,QAAM,WAAW,OAAO,aAAa,UAAU,UAAU,KAAI;AAC7D,MAAI,CAAC,YAAY,aAAa,OAAO,UAAU,OAAO;AAAO,WAAO,CAAA;AAEpE,QAAM,aAAa,uBAAuB,OAAO,QAAQ;AACzD,MAAI,WAAW,0BAA0B,UAAU;AACjD,UAAM,IAAI,WACR,QA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