@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
|
@@ -1,14 +1,17 @@
|
|
|
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]="e455daa2-7c3a-5a87-ad9a-570e05956efd")}catch(e){}}();
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
isRemoteLinkedArtifactReference
|
|
5
|
+
} from "./chunk-IBMFIKVS.js";
|
|
6
6
|
import {
|
|
7
7
|
assertNoUnknownCsvKeys,
|
|
8
8
|
createStdinTokenResolver,
|
|
9
9
|
looksLikeGenericKeyValueEntry,
|
|
10
10
|
parseCsvKv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZRP4VG5U.js";
|
|
12
|
+
import {
|
|
13
|
+
resolveAuthor
|
|
14
|
+
} from "./chunk-T5RRNDA7.js";
|
|
12
15
|
import {
|
|
13
16
|
splitCommaList
|
|
14
17
|
} from "./chunk-P4SESZGT.js";
|
|
@@ -17,10 +20,7 @@ import {
|
|
|
17
20
|
locateItem,
|
|
18
21
|
mutateItem,
|
|
19
22
|
readLocatedItem
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
resolveItemTypeRegistry
|
|
23
|
-
} from "./chunk-TKPP4GOO.js";
|
|
23
|
+
} from "./chunk-JSU5P7VS.js";
|
|
24
24
|
import {
|
|
25
25
|
EXIT_CODE,
|
|
26
26
|
PmCliError,
|
|
@@ -29,8 +29,9 @@ import {
|
|
|
29
29
|
getSettingsPath,
|
|
30
30
|
pathExists,
|
|
31
31
|
readSettings,
|
|
32
|
+
resolveItemTypeRegistry,
|
|
32
33
|
resolvePmRoot
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7R4QEMZZ.js";
|
|
34
35
|
|
|
35
36
|
// dist/cli/commands/linked-artifacts.js
|
|
36
37
|
import fs from "node:fs/promises";
|
|
@@ -217,7 +218,12 @@ async function validateLinkedPaths(paths) {
|
|
|
217
218
|
const existingFiles = [];
|
|
218
219
|
const missingPaths = [];
|
|
219
220
|
const nonFilePaths = [];
|
|
221
|
+
const remoteReferences = [];
|
|
220
222
|
for (const relativePath of uniquePaths) {
|
|
223
|
+
if (isRemoteLinkedArtifactReference(relativePath)) {
|
|
224
|
+
remoteReferences.push(relativePath.trim());
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
221
227
|
const resolvedPath = path.isAbsolute(relativePath) ? relativePath : path.resolve(process.cwd(), relativePath);
|
|
222
228
|
try {
|
|
223
229
|
const stats = await fs.stat(resolvedPath);
|
|
@@ -238,7 +244,8 @@ async function validateLinkedPaths(paths) {
|
|
|
238
244
|
checked: uniquePaths.length,
|
|
239
245
|
existing_files: existingFiles,
|
|
240
246
|
missing_paths: missingPaths,
|
|
241
|
-
non_file_paths: nonFilePaths
|
|
247
|
+
non_file_paths: nonFilePaths,
|
|
248
|
+
remote_references: remoteReferences
|
|
242
249
|
};
|
|
243
250
|
}
|
|
244
251
|
function buildLinkedPathAudit(paths, allItems) {
|
|
@@ -384,6 +391,6 @@ export {
|
|
|
384
391
|
runLinkedArtifacts,
|
|
385
392
|
renameArtifactsResultKey
|
|
386
393
|
};
|
|
387
|
-
//# sourceMappingURL=chunk-
|
|
394
|
+
//# sourceMappingURL=chunk-A7FPBAQS.js.map
|
|
388
395
|
|
|
389
|
-
//# debugId=
|
|
396
|
+
//# debugId=e455daa2-7c3a-5a87-ad9a-570e05956efd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../cli/commands/linked-artifacts.ts"],"sourcesContent":["/**\n * @module cli/commands/linked-artifacts\n *\n * Implements the pm linked artifacts command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport fg from \"fast-glob\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport {\n assertNoUnknownCsvKeys,\n createStdinTokenResolver,\n looksLikeGenericKeyValueEntry,\n parseCsvKv,\n} from \"../../core/item/parse.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { isRemoteLinkedArtifactReference } from \"../../core/validate/linked-artifact-reference.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 { splitCommaList } from \"../../core/shared/split-comma-list.js\";\nimport { listAllFrontMatter, locateItem, mutateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { SCOPE_VALUES } from \"../../types/index.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { LinkScope } from \"../../types/index.js\";\n\n/**\n * Restricts linked artifact values accepted by command, SDK, and storage contracts.\n */\nexport type LinkedArtifact = {\n path: string;\n scope: LinkScope;\n note?: string;\n};\n\n/** Allowed CSV/markdown keys for each structured linked-artifact option (GH-258). */\nexport const LINKED_ARTIFACT_ADD_KEYS = [\"path\", \"scope\", \"note\"] as const;\nexport const LINKED_ARTIFACT_ADD_GLOB_KEYS = [\"pattern\", \"glob\", \"path\", \"scope\", \"note\"] as const;\nexport const LINKED_ARTIFACT_REMOVE_KEYS = [\"path\"] as const;\nexport const LINKED_ARTIFACT_MIGRATE_KEYS = [\"from\", \"to\"] as const;\n/**\n * Keys that are valid on --add but meaningless on --remove (GH-277). Rejected\n * with audit-trail guidance (--message) rather than the generic unknown-key\n * error so agents are not left believing a removal note was recorded.\n */\nconst LINKED_ARTIFACT_REMOVE_UNSUPPORTED_KEYS: ReadonlySet<string> = new Set([\"note\", \"scope\"]);\n\n/**\n * Documents the linked artifact command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface LinkedArtifactCommandOptions {\n add?: string[];\n addGlob?: string[];\n remove?: string[];\n migrate?: string[];\n /**\n * GH-170 (pm-pfnx): standalone note applied to every link added by --add /\n * --add-glob in the same invocation. A per-entry embedded note (the\n * `path=...,note=...` pair syntax) takes precedence over this flag.\n * Requires at least one --add/--add-glob; rejected otherwise.\n */\n note?: string;\n list?: boolean;\n appendStable?: boolean;\n validatePaths?: boolean;\n audit?: boolean;\n author?: string;\n message?: string;\n force?: boolean;\n}\n\n/**\n * Documents the path migration payload exchanged by command, SDK, and package integrations.\n */\nexport interface PathMigration {\n from: string;\n to: string;\n}\n\n/**\n * Documents the add glob entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface AddGlobEntry {\n pattern: string;\n scope: LinkScope;\n note?: string;\n}\n\n/**\n * Documents the linked path validation payload exchanged by command, SDK, and package integrations.\n */\nexport interface LinkedPathValidation {\n checked: number;\n existing_files: string[];\n missing_paths: string[];\n non_file_paths: string[];\n /**\n * Remote references (https:// URLs and other `scheme://` paths) recorded as\n * links — most often a PR/issue/design-doc URL added via `pm docs --add`.\n * These are not local files, so they bypass the existence probe and are\n * reported here rather than counted as missing.\n */\n remote_references: string[];\n}\n\n/**\n * Documents the linked path audit entry payload exchanged by command, SDK, and package integrations.\n */\nexport interface LinkedPathAuditEntry {\n path: string;\n linked_by_count: number;\n linked_item_ids: string[];\n}\n\n/**\n * Documents the linked artifact result payload exchanged by command, SDK, and package integrations.\n */\nexport interface LinkedArtifactResult {\n id: string;\n changed: boolean;\n count: number;\n migrations_applied?: number;\n validation?: LinkedPathValidation;\n audit?: LinkedPathAuditEntry[];\n artifacts: LinkedArtifact[];\n}\n\n/**\n * Configuration that adapts the shared linked-artifact command core to a\n * specific resource kind (files or docs) while preserving every behavioral\n * detail of the original twin implementations.\n */\nexport interface LinkedArtifactKindConfig {\n /** Metadata key under which the artifacts are stored (e.g. \"files\" | \"docs\"). */\n metadataKey: \"files\" | \"docs\";\n /** Mutation op recorded in history (e.g. \"files_add\" | \"docs_add\"). */\n op: \"files_add\" | \"docs_add\";\n /** Noun used in the \"bare <noun> path\" --add usage error (e.g. \"file\" | \"doc\"). */\n bareNoun: \"file\" | \"doc\";\n /**\n * Whether this kind honors the append-stable option. files supports it;\n * docs always sorts and must never expose append-stable behavior.\n */\n supportsAppendStable: boolean;\n}\n\n/**\n * Implements ensure scope for the public runtime surface of this module.\n */\nexport function ensureScope(raw: string | undefined): LinkScope {\n const value = (raw ?? \"project\") as LinkScope;\n if (!SCOPE_VALUES.includes(value)) {\n throw new PmCliError(\n `Invalid scope \"${raw}\". Valid scopes: ${SCOPE_VALUES.join(\", \")} (default: project).`,\n EXIT_CODE.USAGE,\n );\n }\n return value;\n}\n\n/**\n * Implements looks like structured path entry for the public runtime surface of this module.\n */\nexport function looksLikeStructuredPathEntry(raw: string): boolean {\n if (raw.startsWith(\"```\") || raw.includes(\"\\n\")) {\n return true;\n }\n if (/^(?:[-*+]\\s+)?(?:path|scope|note)\\s*[:=]/i.test(raw)) {\n return true;\n }\n // A first-key typo (e.g. `lable=main,path=…`) must still be parsed so the\n // unknown key is rejected rather than swallowed as a bare path (GH-258).\n return looksLikeGenericKeyValueEntry(raw);\n}\n\nfunction expandBareCommaSeparatedAddEntries(raw: string[]): string[] {\n return raw.flatMap((entry) => {\n const trimmed = entry.trim();\n if (trimmed.length === 0 || looksLikeStructuredPathEntry(trimmed) || !trimmed.includes(\",\")) {\n return [entry];\n }\n return splitCommaList(trimmed);\n });\n}\n\n/**\n * Implements parse add entries for the public runtime surface of this module.\n */\nexport function parseAddEntries(raw: string[] | undefined, bareNoun: \"file\" | \"doc\"): LinkedArtifact[] {\n if (!raw) return [];\n return expandBareCommaSeparatedAddEntries(raw).map((entry) => {\n const trimmed = entry.trim();\n const kv = looksLikeStructuredPathEntry(trimmed) ? parseCsvKv(entry, \"--add\") : { path: trimmed };\n assertNoUnknownCsvKeys(kv, \"--add\", LINKED_ARTIFACT_ADD_KEYS);\n if (!kv.path) {\n throw new PmCliError(`--add requires path=<value> or a bare ${bareNoun} path`, EXIT_CODE.USAGE);\n }\n return {\n path: kv.path,\n scope: ensureScope(kv.scope),\n note: kv.note?.trim() || undefined,\n };\n });\n}\n\n/**\n * Implements parse add glob entries for the public runtime surface of this module.\n */\nexport function parseAddGlobEntries(raw: string[] | undefined): AddGlobEntry[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) {\n throw new PmCliError(\"--add-glob requires a glob pattern value\", EXIT_CODE.USAGE);\n }\n if (trimmed.includes(\"=\") || /^(?:[-*+]\\s+)?(?:pattern|glob|path)\\s*[:=]/i.test(trimmed) || trimmed.startsWith(\"```\")) {\n const kv = parseCsvKv(trimmed, \"--add-glob\");\n assertNoUnknownCsvKeys(kv, \"--add-glob\", LINKED_ARTIFACT_ADD_GLOB_KEYS);\n const pattern = kv.pattern?.trim() || kv.glob?.trim() || kv.path?.trim();\n if (!pattern) {\n throw new PmCliError(\"--add-glob key/value form requires pattern=<glob>\", EXIT_CODE.USAGE);\n }\n return {\n pattern,\n scope: ensureScope(kv.scope),\n note: kv.note?.trim() || undefined,\n };\n }\n return {\n pattern: trimmed,\n scope: \"project\",\n };\n });\n}\n\n/**\n * Implements parse remove entries for the public runtime surface of this module.\n */\nexport function parseRemoveEntries(raw: string[] | undefined): string[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) {\n throw new PmCliError(\"--remove requires a path value\", EXIT_CODE.USAGE);\n }\n if (trimmed.includes(\"=\") || /^(?:[-*+]\\s+)?path\\s*[:=]/i.test(trimmed) || trimmed.startsWith(\"```\")) {\n const kv = parseCsvKv(trimmed, \"--remove\");\n // GH-277: --remove identifies an existing link by path only; it does not\n // attach per-link metadata. Reject the --add-only keys with guidance toward\n // the audit-trail path (--message) rather than the generic \"unrecognized\n // key\" error, which left agents believing they had recorded a removal note.\n const unsupportedRemoveKeys = Object.keys(kv).filter((key) =>\n LINKED_ARTIFACT_REMOVE_UNSUPPORTED_KEYS.has(key.toLowerCase()),\n );\n if (unsupportedRemoveKeys.length > 0) {\n throw new PmCliError(\n `--remove identifies a linked artifact by path only and does not accept ${unsupportedRemoveKeys\n .map((key) => `\"${key}\"`)\n .join(\", \")}. Pass just the path (path=<value>, path:<value>, or a bare path); record removal context with --message \"<why removed>\".`,\n EXIT_CODE.USAGE,\n );\n }\n assertNoUnknownCsvKeys(kv, \"--remove\", LINKED_ARTIFACT_REMOVE_KEYS);\n if (!kv.path) {\n throw new PmCliError(\"--remove key/value form requires path=<value>\", EXIT_CODE.USAGE);\n }\n return kv.path;\n }\n return trimmed;\n });\n}\n\n/**\n * Implements parse migrate entries for the public runtime surface of this module.\n */\nexport function parseMigrateEntries(raw: string[] | undefined): PathMigration[] {\n if (!raw) return [];\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--migrate\");\n assertNoUnknownCsvKeys(kv, \"--migrate\", LINKED_ARTIFACT_MIGRATE_KEYS);\n const from = kv.from?.trim();\n const to = kv.to?.trim();\n if (!from || !to) {\n throw new PmCliError(\"--migrate requires from=<value> and to=<value>\", EXIT_CODE.USAGE);\n }\n return { from, to };\n });\n}\n\n/**\n * Implements apply path migrations for the public runtime surface of this module.\n */\nexport function applyPathMigrations(artifactPath: string, migrations: PathMigration[]): string {\n let next = artifactPath;\n for (const migration of migrations) {\n if (next.startsWith(migration.from)) {\n next = `${migration.to}${next.slice(migration.from.length)}`;\n }\n }\n return next;\n}\n\n/**\n * Implements normalize linked path for the public runtime surface of this module.\n */\nexport function normalizeLinkedPath(value: string): string {\n return value.split(path.sep).join(\"/\");\n}\n\n/**\n * Implements expand add glob entries for the public runtime surface of this module.\n */\nexport async function expandAddGlobEntries(entries: AddGlobEntry[]): Promise<LinkedArtifact[]> {\n const expanded: LinkedArtifact[] = [];\n for (const entry of entries) {\n const absolutePattern = path.isAbsolute(entry.pattern);\n const matches = await fg(entry.pattern, {\n cwd: process.cwd(),\n absolute: absolutePattern,\n onlyFiles: true,\n dot: true,\n unique: true,\n followSymbolicLinks: true,\n });\n const sortedMatches = [...new Set(matches.map((match) => normalizeLinkedPath(path.normalize(match))))].sort((left, right) =>\n left.localeCompare(right),\n );\n for (const matchedPath of sortedMatches) {\n expanded.push({\n path: matchedPath,\n scope: entry.scope,\n note: entry.note,\n });\n }\n }\n return expanded;\n}\n\n/**\n * GH-170 (pm-pfnx): apply a standalone --note to the links added in this\n * invocation. Semantics (documented on pm-pfnx): the note is attached to EVERY\n * entry added via --add/--add-glob so a single flag annotates the whole batch\n * predictably; a per-entry embedded `note=` wins over the standalone flag; and\n * --note without any --add/--add-glob flag is a usage error because there is\n * nothing to annotate (it never retro-edits existing links). `hasAddFlags`\n * reflects flag presence, not match count, so a glob that legitimately matches\n * zero files is not an error.\n */\nexport function applyStandaloneNote(\n adds: LinkedArtifact[],\n note: string | undefined,\n hasAddFlags: boolean,\n): LinkedArtifact[] {\n if (note === undefined) {\n return adds;\n }\n if (!hasAddFlags) {\n throw new PmCliError(\n \"--note requires --add or --add-glob in the same invocation (the note annotates the links being added)\",\n EXIT_CODE.USAGE,\n );\n }\n const trimmed = note.trim();\n if (trimmed.length === 0) {\n return adds;\n }\n return adds.map((entry) => (entry.note === undefined ? { ...entry, note: trimmed } : entry));\n}\n\n/**\n * Implements artifact key for the public runtime surface of this module.\n */\nexport function artifactKey(value: Pick<LinkedArtifact, \"path\" | \"scope\">): string {\n return `${value.path}::${value.scope}`;\n}\n\n/**\n * Implements sort linked artifacts for the public runtime surface of this module.\n */\nexport function sortLinkedArtifacts(artifacts: LinkedArtifact[]): LinkedArtifact[] {\n return [...artifacts].sort((left, right) => {\n const byPath = left.path.localeCompare(right.path);\n if (byPath !== 0) return byPath;\n return left.scope.localeCompare(right.scope);\n });\n}\n\n/**\n * Implements dedupe linked artifacts for the public runtime surface of this module.\n */\nexport function dedupeLinkedArtifacts(artifacts: LinkedArtifact[]): LinkedArtifact[] {\n return [...new Map(artifacts.map((entry) => [artifactKey(entry), entry])).values()].map((entry) => ({\n ...entry,\n note: entry.note?.trim() || undefined,\n }));\n}\n\n/**\n * Implements validate linked paths for the public runtime surface of this module.\n */\nexport async function validateLinkedPaths(paths: string[]): Promise<LinkedPathValidation> {\n const uniquePaths = [...new Set(paths)].sort((left, right) => left.localeCompare(right));\n const existingFiles: string[] = [];\n const missingPaths: string[] = [];\n const nonFilePaths: string[] = [];\n const remoteReferences: string[] = [];\n for (const relativePath of uniquePaths) {\n // Remote references (https:// PR/issue/design-doc URLs) are not local\n // files; report them separately (trimmed, to match buildFilesCheck's\n // output shape) instead of probing a meaningless path.\n if (isRemoteLinkedArtifactReference(relativePath)) {\n remoteReferences.push(relativePath.trim());\n continue;\n }\n const resolvedPath = path.isAbsolute(relativePath) ? relativePath : path.resolve(process.cwd(), relativePath);\n try {\n const stats = await fs.stat(resolvedPath);\n if (stats.isFile()) {\n existingFiles.push(relativePath);\n } else {\n nonFilePaths.push(relativePath);\n }\n } catch (error: unknown) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === \"ENOENT\") {\n missingPaths.push(relativePath);\n continue;\n }\n nonFilePaths.push(relativePath);\n }\n }\n return {\n checked: uniquePaths.length,\n existing_files: existingFiles,\n missing_paths: missingPaths,\n non_file_paths: nonFilePaths,\n remote_references: remoteReferences,\n };\n}\n\n/**\n * Implements build linked path audit for the public runtime surface of this module.\n */\nexport function buildLinkedPathAudit(\n paths: string[],\n allItems: Array<{ id: string; artifacts?: LinkedArtifact[] }>,\n): LinkedPathAuditEntry[] {\n const index = new Map<string, Set<string>>();\n for (const item of allItems) {\n for (const linkedArtifact of item.artifacts ?? []) {\n const seen = index.get(linkedArtifact.path) ?? new Set<string>();\n seen.add(item.id);\n index.set(linkedArtifact.path, seen);\n }\n }\n return [...new Set(paths)]\n .sort((left, right) => left.localeCompare(right))\n .map((linkedPath) => {\n const linkedIds = [...(index.get(linkedPath) ?? new Set<string>())].sort((left, right) => left.localeCompare(right));\n return {\n path: linkedPath,\n linked_by_count: linkedIds.length,\n linked_item_ids: linkedIds,\n };\n });\n}\n\n/**\n * Shared linked-artifact list/mutate command core used by runFiles and runDocs.\n * The kind config selects metadata key, op, bare-path noun, and whether\n * append-stable ordering is honored, preserving each twin's exact semantics.\n */\nexport async function runLinkedArtifacts(\n id: string,\n options: LinkedArtifactCommandOptions,\n global: GlobalOptions,\n config: LinkedArtifactKindConfig,\n): Promise<LinkedArtifactResult> {\n const { metadataKey } = config;\n const stdinResolver = createStdinTokenResolver();\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 const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const resolvedAdds = await stdinResolver.resolveList(options.add, \"--add\");\n const resolvedAddGlobs = await stdinResolver.resolveList(options.addGlob, \"--add-glob\");\n const resolvedRemoves = await stdinResolver.resolveList(options.remove, \"--remove\");\n const resolvedMigrations = await stdinResolver.resolveList(options.migrate, \"--migrate\");\n const parsedAdds = parseAddEntries(resolvedAdds, config.bareNoun);\n const addGlobs = parseAddGlobEntries(resolvedAddGlobs);\n const expandedGlobAdds = await expandAddGlobEntries(addGlobs);\n const adds = applyStandaloneNote(\n [...parsedAdds, ...expandedGlobAdds],\n options.note,\n parsedAdds.length > 0 || addGlobs.length > 0,\n );\n const removes = parseRemoveEntries(resolvedRemoves);\n const migrations = parseMigrateEntries(resolvedMigrations);\n const shouldMutate = adds.length > 0 || removes.length > 0 || migrations.length > 0;\n\n const collectAuditItems = async (): Promise<Array<{ id: string; artifacts?: LinkedArtifact[] }>> =>\n (await listAllFrontMatter(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)).map((entry) => ({\n id: entry.id,\n artifacts: (entry as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined,\n }));\n\n if (!shouldMutate) {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);\n if (!located) {\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n }\n const loaded = await readLocatedItem(located, { schema: settings.schema });\n const artifacts = ((loaded.document.metadata as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined) ?? [];\n return {\n id: located.id,\n artifacts,\n changed: false,\n count: artifacts.length,\n validation: options.validatePaths ? await validateLinkedPaths(artifacts.map((entry) => entry.path)) : undefined,\n audit: options.audit ? buildLinkedPathAudit(artifacts.map((entry) => entry.path), await collectAuditItems()) : undefined,\n };\n }\n\n const author = resolveAuthor(options.author, settings.author_default);\n const result = await mutateItem({\n pmRoot,\n settings,\n id,\n op: config.op,\n author,\n message: options.message,\n force: options.force,\n mutate(document) {\n const metadata = document.metadata as Record<string, unknown>;\n const next = [...((metadata[metadataKey] as LinkedArtifact[] | undefined) ?? [])];\n let migrationCount = 0;\n if (migrations.length > 0) {\n for (let index = 0; index < next.length; index += 1) {\n const migratedPath = applyPathMigrations(next[index].path, migrations);\n if (migratedPath !== next[index].path) {\n next[index] = { ...next[index], path: migratedPath };\n migrationCount += 1;\n }\n }\n }\n const migratedAdds = adds.map((entry) => {\n const migratedPath = applyPathMigrations(entry.path, migrations);\n if (migratedPath !== entry.path) {\n migrationCount += 1;\n }\n return {\n ...entry,\n path: migratedPath,\n };\n });\n const migratedRemoves = removes.map((entry) => applyPathMigrations(entry, migrations));\n for (const add of migratedAdds) {\n const exists = next.some((entry) => entry.path === add.path && entry.scope === add.scope);\n if (!exists) {\n next.push(add);\n }\n }\n if (migratedRemoves.length > 0) {\n for (let i = next.length - 1; i >= 0; i -= 1) {\n if (migratedRemoves.includes(next[i].path)) {\n next.splice(i, 1);\n }\n }\n }\n const deduped = dedupeLinkedArtifacts(next);\n const normalized = config.supportsAppendStable && options.appendStable ? deduped : sortLinkedArtifacts(deduped);\n if (normalized.length > 0) {\n metadata[metadataKey] = normalized;\n } else {\n delete metadata[metadataKey];\n }\n return { changedFields: [metadataKey], warnings: migrationCount > 0 ? [`path_migrations_applied:${migrationCount}`] : [] };\n },\n });\n\n const artifacts = ((result.item as Record<string, unknown>)[metadataKey] as LinkedArtifact[] | undefined) ?? [];\n const migrationWarning = result.warnings.find((warning) => warning.startsWith(\"path_migrations_applied:\"));\n const migrationCount = migrationWarning ? Number(migrationWarning.slice(\"path_migrations_applied:\".length)) : 0;\n const allItems = options.audit ? await collectAuditItems() : [];\n return {\n id: result.item.id,\n artifacts,\n changed: true,\n count: artifacts.length,\n migrations_applied: migrationCount > 0 ? migrationCount : undefined,\n validation: options.validatePaths ? await validateLinkedPaths(artifacts.map((entry) => entry.path)) : undefined,\n audit: options.audit ? buildLinkedPathAudit(artifacts.map((entry) => entry.path), allItems) : undefined,\n };\n}\n\n/**\n * Re-key the generic `artifacts` field to the resource-specific name (files/docs)\n * while preserving the original key order and presence so kind-specific result\n * shapes (and their deterministic JSON key ordering) stay byte-identical.\n */\nexport function renameArtifactsResultKey(result: LinkedArtifactResult, key: \"files\" | \"docs\"): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(result)) {\n out[field === \"artifacts\" ? key : field] = value;\n }\n return out;\n}\n"],"names":["artifacts","migrationCount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAgCR,IAAM,2BAA2B,CAAC,QAAQ,SAAS,MAAM;AACzD,IAAM,gCAAgC,CAA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AU;IACjB,oBAAoB,iBAAiB,IAAI,iBAAiB;IAC1D,YAAY,QAAQ,gBAAgB,MAAM,oBAAoB,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,IAAI;IACtG,OAAO,QAAQ,QAAQ,qBAAqB,UAAU,IAAI,CAAC,UAAU,MAAM,IAAI,GAAG,QAAQ,IAAI;;AAElG;AAOM,SAAU,yBAAyB,QAA8B,KAAqB;AAC1F,QAAM,MAA+B,CAAA;AACrC,aAAW,CAAC,OAAO,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACnD,QAAI,UAAU,cAAc,MAAM,KAAK,IAAI;EAC7C;AACA,SAAO;AACT","debugId":"e455daa2-7c3a-5a87-ad9a-570e05956efd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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]="4aa0a029-8d29-53c9-b3cb-9c468d83de89")}catch(e){}}();
|
|
3
3
|
import {
|
|
4
4
|
nowIso
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AXIDKKAT.js";
|
|
6
6
|
import {
|
|
7
7
|
EXIT_CODE,
|
|
8
8
|
appendLineAtomic,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
resolveTelemetryErrorCategory,
|
|
14
14
|
writeFileAtomic,
|
|
15
15
|
writeSettings
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-7R4QEMZZ.js";
|
|
17
17
|
|
|
18
18
|
// dist/core/telemetry/observability.js
|
|
19
19
|
var SETUP_ROOT_COMMANDS = /* @__PURE__ */ new Set(["init", "config", "completion", "completion-statuses", "completion-tags", "completion-types"]);
|
|
@@ -67,6 +67,45 @@ function normalizeErrorCode(errorCode2) {
|
|
|
67
67
|
const normalized = errorCode2?.trim().toLowerCase();
|
|
68
68
|
return normalized && normalized.length > 0 ? normalized : void 0;
|
|
69
69
|
}
|
|
70
|
+
var TELEMETRY_ERROR_MESSAGE_CLASSIFIERS = [
|
|
71
|
+
{ code: "unknown_command", matches: (message) => message.includes("unknown command") },
|
|
72
|
+
{ code: "unknown_option", matches: (message) => message.includes("unknown option") },
|
|
73
|
+
{
|
|
74
|
+
code: "missing_required_option",
|
|
75
|
+
matches: (message) => message.includes("missing required options") || message.includes("missing required option")
|
|
76
|
+
},
|
|
77
|
+
{ code: "missing_required_argument", matches: (message) => message.includes("missing required argument") },
|
|
78
|
+
{ code: "no_update_fields", matches: (message) => message.includes("no update flags provided") },
|
|
79
|
+
{
|
|
80
|
+
code: "ownership_conflict",
|
|
81
|
+
matches: (message) => message.includes("is assigned to") && message.includes("use --force")
|
|
82
|
+
},
|
|
83
|
+
{ code: "lock_conflict", matches: (message) => message.includes("is locked") },
|
|
84
|
+
{
|
|
85
|
+
code: "terminal_state_conflict",
|
|
86
|
+
matches: (message) => message.includes("already terminal") && message.includes("use --force")
|
|
87
|
+
},
|
|
88
|
+
{ code: "tracker_not_initialized", matches: (message) => message.includes("tracker is not initialized") },
|
|
89
|
+
{ code: "item_not_found", matches: (message) => message.includes(" not found") },
|
|
90
|
+
{
|
|
91
|
+
code: "close_through_update",
|
|
92
|
+
matches: (message) => message.includes('use "pm close <id> <text>" to close an item') || message.includes("invalid --status value") && message.includes('"closed"')
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
code: "invalid_argument_value",
|
|
96
|
+
matches: (message) => message.startsWith("invalid ") || message.includes(" must be ") || message.includes(" requires ")
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
code: "invalid_command_usage",
|
|
100
|
+
matches: (message) => message.includes("either as positional") && message.includes("not both")
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
var TELEMETRY_EXIT_CODE_FALLBACKS = /* @__PURE__ */ new Map([
|
|
104
|
+
[EXIT_CODE.USAGE, "invalid_command_usage"],
|
|
105
|
+
[EXIT_CODE.NOT_FOUND, "item_not_found"],
|
|
106
|
+
[EXIT_CODE.CONFLICT, "lock_conflict"],
|
|
107
|
+
[EXIT_CODE.DEPENDENCY_FAILED, "dependency_failed"]
|
|
108
|
+
]);
|
|
70
109
|
function deriveTelemetryCommandTaxonomy(commandPath) {
|
|
71
110
|
const normalizedPath = normalizeCommandPath(commandPath);
|
|
72
111
|
const tokens = normalizedPath.length > 0 ? normalizedPath.split(" ") : ["<unknown>"];
|
|
@@ -103,57 +142,14 @@ function inferTelemetryErrorCode(params) {
|
|
|
103
142
|
return explicit;
|
|
104
143
|
}
|
|
105
144
|
const message = (params.errorMessage ?? "").trim().toLowerCase();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return "unknown_option";
|
|
111
|
-
}
|
|
112
|
-
if (message.includes("missing required options") || message.includes("missing required option")) {
|
|
113
|
-
return "missing_required_option";
|
|
114
|
-
}
|
|
115
|
-
if (message.includes("missing required argument")) {
|
|
116
|
-
return "missing_required_argument";
|
|
117
|
-
}
|
|
118
|
-
if (message.includes("no update flags provided")) {
|
|
119
|
-
return "no_update_fields";
|
|
120
|
-
}
|
|
121
|
-
if (message.includes("is assigned to") && message.includes("use --force")) {
|
|
122
|
-
return "ownership_conflict";
|
|
123
|
-
}
|
|
124
|
-
if (message.includes("is locked")) {
|
|
125
|
-
return "lock_conflict";
|
|
126
|
-
}
|
|
127
|
-
if (message.includes("already terminal") && message.includes("use --force")) {
|
|
128
|
-
return "terminal_state_conflict";
|
|
129
|
-
}
|
|
130
|
-
if (message.includes("tracker is not initialized")) {
|
|
131
|
-
return "tracker_not_initialized";
|
|
132
|
-
}
|
|
133
|
-
if (message.includes(" not found")) {
|
|
134
|
-
return "item_not_found";
|
|
135
|
-
}
|
|
136
|
-
if (message.includes('use "pm close <id> <text>" to close an item') || message.includes("invalid --status value") && message.includes('"closed"')) {
|
|
137
|
-
return "close_through_update";
|
|
138
|
-
}
|
|
139
|
-
if (message.startsWith("invalid ") || message.includes(" must be ") || message.includes(" requires ")) {
|
|
140
|
-
return "invalid_argument_value";
|
|
141
|
-
}
|
|
142
|
-
if (message.includes("either as positional") && message.includes("not both")) {
|
|
143
|
-
return "invalid_command_usage";
|
|
145
|
+
for (const classifier of TELEMETRY_ERROR_MESSAGE_CLASSIFIERS) {
|
|
146
|
+
if (classifier.matches(message)) {
|
|
147
|
+
return classifier.code;
|
|
148
|
+
}
|
|
144
149
|
}
|
|
145
150
|
const exitCode = Number.isFinite(params.exitCode) ? Math.max(0, Math.trunc(params.exitCode)) : void 0;
|
|
146
|
-
if (exitCode
|
|
147
|
-
return "
|
|
148
|
-
}
|
|
149
|
-
if (exitCode === EXIT_CODE.NOT_FOUND) {
|
|
150
|
-
return "item_not_found";
|
|
151
|
-
}
|
|
152
|
-
if (exitCode === EXIT_CODE.CONFLICT) {
|
|
153
|
-
return "lock_conflict";
|
|
154
|
-
}
|
|
155
|
-
if (exitCode === EXIT_CODE.DEPENDENCY_FAILED) {
|
|
156
|
-
return "dependency_failed";
|
|
151
|
+
if (exitCode !== void 0) {
|
|
152
|
+
return TELEMETRY_EXIT_CODE_FALLBACKS.get(exitCode) ?? "command_failed";
|
|
157
153
|
}
|
|
158
154
|
return "command_failed";
|
|
159
155
|
}
|
|
@@ -1531,6 +1527,9 @@ function scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays) {
|
|
|
1531
1527
|
[PM_TELEMETRY_FLUSH_CHILD_ENV]: "1"
|
|
1532
1528
|
}
|
|
1533
1529
|
});
|
|
1530
|
+
child.on("error", () => {
|
|
1531
|
+
releaseTelemetryFlushSpawnGate(globalPmRoot);
|
|
1532
|
+
});
|
|
1534
1533
|
child.unref();
|
|
1535
1534
|
} catch {
|
|
1536
1535
|
releaseTelemetryFlushSpawnGate(globalPmRoot);
|
|
@@ -1759,6 +1758,6 @@ export {
|
|
|
1759
1758
|
finishTelemetryCommand,
|
|
1760
1759
|
emitTelemetryErrorEvent
|
|
1761
1760
|
};
|
|
1762
|
-
//# sourceMappingURL=chunk-
|
|
1761
|
+
//# sourceMappingURL=chunk-AVEE5EHK.js.map
|
|
1763
1762
|
|
|
1764
|
-
//# debugId=
|
|
1763
|
+
//# debugId=4aa0a029-8d29-53c9-b3cb-9c468d83de89
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../core/telemetry/observability.ts","../../../../../../../../core/telemetry/runtime.ts"],"sourcesContent":["/**\n * @module core/telemetry/observability\n *\n * Captures consent-aware telemetry and observability events for Observability.\n */\nimport { EXIT_CODE, type TelemetryErrorCategory } from \"../shared/constants.js\";\n\n/**\n * Restricts telemetry resolution stage values accepted by command, SDK, and storage contracts.\n */\nexport type TelemetryResolutionStage = \"parse\" | \"preflight\" | \"execute\" | \"unknown\";\n\n/**\n * Restricts telemetry command resolution values accepted by command, SDK, and storage contracts.\n */\nexport type TelemetryCommandResolution =\n | \"success\"\n | \"nonexistent_command\"\n | \"invalid_option\"\n | \"missing_required_option\"\n | \"missing_required_argument\"\n | \"invalid_usage\"\n | \"validation_failed\"\n | \"health_findings\"\n | \"validation_findings\"\n | \"conflict\"\n | \"runtime_failed\"\n | \"unknown_failed\";\n\n/**\n * Documents the telemetry command taxonomy payload exchanged by command, SDK, and package integrations.\n */\nexport interface TelemetryCommandTaxonomy {\n command_path: string;\n command_root: string;\n command_leaf: string;\n command_depth: number;\n command_family: \"setup\" | \"query\" | \"mutation\" | \"testing\" | \"extension\" | \"diagnostics\" | \"other\";\n}\n\ninterface InferTelemetryErrorCodeParams {\n ok: boolean;\n errorCode?: string;\n errorMessage?: string;\n exitCode?: number;\n}\n\ninterface TelemetryErrorMessageClassifier {\n code: string;\n matches: (message: string) => boolean;\n}\n\nconst SETUP_ROOT_COMMANDS = new Set([\"init\", \"config\", \"completion\", \"completion-statuses\", \"completion-tags\", \"completion-types\"]);\nconst QUERY_ROOT_COMMANDS = new Set([\n \"list\",\n \"list-all\",\n \"list-open\",\n \"list-in-progress\",\n \"list-blocked\",\n \"list-closed\",\n \"list-canceled\",\n \"list-draft\",\n \"search\",\n \"get\",\n \"context\",\n \"calendar\",\n \"history\",\n \"activity\",\n \"aggregate\",\n \"deps\",\n \"contracts\",\n \"stats\",\n \"dedupe-audit\",\n]);\nconst MUTATION_ROOT_COMMANDS = new Set([\n \"create\",\n \"update\",\n \"update-many\",\n \"close-many\",\n \"append\",\n \"close\",\n \"delete\",\n \"restore\",\n \"claim\",\n \"release\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"docs\",\n \"start-task\",\n \"pause-task\",\n \"close-task\",\n]);\nconst TESTING_ROOT_COMMANDS = new Set([\"test\", \"test-all\", \"test-runs\", \"test-verify\", \"trace-test\", \"test-ping\"]);\nconst DIAGNOSTICS_ROOT_COMMANDS = new Set([\"health\", \"validate\", \"normalize\", \"reindex\", \"gc\", \"telemetry\", \"extension-doctor\"]);\n\nfunction normalizeCommandPath(commandPath: string): string {\n return commandPath\n .trim()\n .replaceAll(/\\s+/g, \" \")\n .toLowerCase();\n}\n\nfunction normalizeErrorCode(errorCode: string | undefined): string | undefined {\n const normalized = errorCode?.trim().toLowerCase();\n return normalized && normalized.length > 0 ? normalized : undefined;\n}\n\nconst TELEMETRY_ERROR_MESSAGE_CLASSIFIERS: readonly TelemetryErrorMessageClassifier[] = [\n { code: \"unknown_command\", matches: (message) => message.includes(\"unknown command\") },\n { code: \"unknown_option\", matches: (message) => message.includes(\"unknown option\") },\n {\n code: \"missing_required_option\",\n matches: (message) => message.includes(\"missing required options\") || message.includes(\"missing required option\"),\n },\n { code: \"missing_required_argument\", matches: (message) => message.includes(\"missing required argument\") },\n { code: \"no_update_fields\", matches: (message) => message.includes(\"no update flags provided\") },\n {\n code: \"ownership_conflict\",\n matches: (message) => message.includes(\"is assigned to\") && message.includes(\"use --force\"),\n },\n { code: \"lock_conflict\", matches: (message) => message.includes(\"is locked\") },\n {\n code: \"terminal_state_conflict\",\n matches: (message) => message.includes(\"already terminal\") && message.includes(\"use --force\"),\n },\n { code: \"tracker_not_initialized\", matches: (message) => message.includes(\"tracker is not initialized\") },\n { code: \"item_not_found\", matches: (message) => message.includes(\" not found\") },\n {\n code: \"close_through_update\",\n matches: (message) =>\n message.includes(\"use \\\"pm close <id> <text>\\\" to close an item\") ||\n (message.includes(\"invalid --status value\") && message.includes(\"\\\"closed\\\"\")),\n },\n {\n code: \"invalid_argument_value\",\n matches: (message) => message.startsWith(\"invalid \") || message.includes(\" must be \") || message.includes(\" requires \"),\n },\n {\n code: \"invalid_command_usage\",\n matches: (message) => message.includes(\"either as positional\") && message.includes(\"not both\"),\n },\n];\n\nconst TELEMETRY_EXIT_CODE_FALLBACKS: ReadonlyMap<number, string> = new Map([\n [EXIT_CODE.USAGE, \"invalid_command_usage\"],\n [EXIT_CODE.NOT_FOUND, \"item_not_found\"],\n [EXIT_CODE.CONFLICT, \"lock_conflict\"],\n [EXIT_CODE.DEPENDENCY_FAILED, \"dependency_failed\"],\n]);\n\n/**\n * Implements derive telemetry command taxonomy for the public runtime surface of this module.\n */\nexport function deriveTelemetryCommandTaxonomy(commandPath: string): TelemetryCommandTaxonomy {\n const normalizedPath = normalizeCommandPath(commandPath);\n // tokens always has at least one element (the fallback [\"<unknown>\"]), so the\n // first/last lookups are never undefined.\n const tokens = normalizedPath.length > 0 ? normalizedPath.split(\" \") : [\"<unknown>\"];\n const root = tokens[0] as string;\n const leaf = tokens[tokens.length - 1] as string;\n\n let family: TelemetryCommandTaxonomy[\"command_family\"] = \"other\";\n if (SETUP_ROOT_COMMANDS.has(root)) {\n family = \"setup\";\n } else if (QUERY_ROOT_COMMANDS.has(root)) {\n family = \"query\";\n } else if (MUTATION_ROOT_COMMANDS.has(root)) {\n family = \"mutation\";\n } else if (TESTING_ROOT_COMMANDS.has(root)) {\n family = \"testing\";\n } else if (root === \"extension\") {\n family = \"extension\";\n } else if (DIAGNOSTICS_ROOT_COMMANDS.has(root)) {\n family = \"diagnostics\";\n }\n\n return {\n command_path: normalizedPath.length > 0 ? normalizedPath : \"<unknown>\",\n command_root: root,\n command_leaf: leaf,\n command_depth: tokens.length,\n command_family: family,\n };\n}\n\n/**\n * Implements infer telemetry error code for the public runtime surface of this module.\n */\nexport function inferTelemetryErrorCode(params: InferTelemetryErrorCodeParams): string | undefined {\n if (params.ok) {\n return undefined;\n }\n\n const explicit = normalizeErrorCode(params.errorCode);\n if (explicit) {\n return explicit;\n }\n\n const message = (params.errorMessage ?? \"\").trim().toLowerCase();\n // NOTE: A \"strict create mode requires concrete values for --\" message is always\n // classified as invalid_argument_value by the ordered ` requires ` classifier,\n // so a dedicated branch would be unreachable and is intentionally omitted.\n for (const classifier of TELEMETRY_ERROR_MESSAGE_CLASSIFIERS) {\n if (classifier.matches(message)) {\n return classifier.code;\n }\n }\n\n const exitCode = Number.isFinite(params.exitCode) ? Math.max(0, Math.trunc(params.exitCode as number)) : undefined;\n if (exitCode !== undefined) {\n return TELEMETRY_EXIT_CODE_FALLBACKS.get(exitCode) ?? \"command_failed\";\n }\n return \"command_failed\";\n}\n\n/**\n * Implements derive telemetry command resolution for the public runtime surface of this module.\n */\nexport function deriveTelemetryCommandResolution(params: {\n ok: boolean;\n errorCode?: string;\n errorCategory?: TelemetryErrorCategory;\n}): TelemetryCommandResolution {\n if (params.ok) {\n return \"success\";\n }\n\n const normalizedCode = normalizeErrorCode(params.errorCode);\n if (normalizedCode === \"unknown_command\") {\n return \"nonexistent_command\";\n }\n if (normalizedCode === \"unknown_option\") {\n return \"invalid_option\";\n }\n if (normalizedCode === \"missing_required_option\") {\n return \"missing_required_option\";\n }\n if (normalizedCode === \"missing_required_argument\") {\n return \"missing_required_argument\";\n }\n if (normalizedCode === \"health_findings\") {\n return \"health_findings\";\n }\n if (normalizedCode === \"validation_findings\") {\n return \"validation_findings\";\n }\n\n if (params.errorCategory === \"usage\") {\n return \"invalid_usage\";\n }\n if (params.errorCategory === \"validation\") {\n return \"validation_failed\";\n }\n if (params.errorCategory === \"conflict\") {\n return \"conflict\";\n }\n if (params.errorCategory === \"runtime\") {\n return \"runtime_failed\";\n }\n return \"unknown_failed\";\n}\n","/**\n * @module core/telemetry/runtime\n *\n * Captures consent-aware telemetry and observability events for Runtime.\n */\nimport crypto from \"node:crypto\";\nimport { spawn } from \"node:child_process\";\nimport { mkdirSync, rmSync, statSync } from \"node:fs\";\nimport { mkdir, readdir, rm, stat } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport type { GlobalOptions } from \"../shared/command-types.js\";\nimport { resolvePmPackageRootFromModule } from \"../packages/root.js\";\nimport { appendLineAtomic, readFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { resolveTelemetryErrorCategory, type TelemetryErrorCategory } from \"../shared/constants.js\";\nimport { nowIso } from \"../shared/time.js\";\nimport { resolveGlobalPmRoot } from \"../store/paths.js\";\nimport { readSettings, writeSettings } from \"../store/settings.js\";\nimport {\n deriveTelemetryCommandResolution,\n deriveTelemetryCommandTaxonomy,\n inferTelemetryErrorCode,\n type TelemetryCommandResolution,\n type TelemetryCommandTaxonomy,\n type TelemetryResolutionStage,\n} from \"./observability.js\";\n\nconst TELEMETRY_QUEUE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"events.jsonl\");\nconst TELEMETRY_STATE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"state.json\");\nconst TELEMETRY_OTEL_SPANS_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"otel-spans.jsonl\");\n// Kept small so a worst-case batch against a blackholed collector\n// (TELEMETRY_OTEL_SPANS_FLUSH_BATCH_SIZE * TELEMETRY_HTTP_TIMEOUT_MS plus the\n// preceding event flush) stays well under TELEMETRY_FLUSH_LOCK_STALE_MS (60s).\n// Otherwise a later command could treat the still-held flush lock as stale and\n// start a second concurrent worker.\nconst TELEMETRY_OTEL_SPANS_FLUSH_BATCH_SIZE = 8;\nconst TELEMETRY_OTEL_SPANS_MAX_PENDING = 500;\nexport const TELEMETRY_SCHEMA_VERSION = 1;\nconst TELEMETRY_CLIENT_SCHEMA_VERSION = 1;\nconst TELEMETRY_FLUSH_BATCH_SIZE = 100;\nconst TELEMETRY_MAX_RETRY_DELAY_MS = 3_600_000;\nconst TELEMETRY_RETRY_BASE_DELAY_MS = 30_000;\nconst TELEMETRY_HTTP_TIMEOUT_MS = 5_000;\nconst MILLISECONDS_PER_DAY = 86_400_000;\nconst TELEMETRY_MAX_EVENT_BYTES = 65_536;\nconst TELEMETRY_SANITIZE_MAX_DEPTH = 6;\nconst TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS = 20;\nexport const TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS = 15;\nconst TELEMETRY_RESULT_PREVIEW_MAX_BYTES = 8_192;\nconst TELEMETRY_QUEUE_REWRITE_RETRY_DELAYS_MS = [25, 50, 100, 200] as const;\nconst TELEMETRY_QUEUE_TMP_ORPHAN_MAX_AGE_MS = 60 * 60 * 1000;\nconst TELEMETRY_FLUSH_LOCK_STALE_MS = 60_000;\nconst TELEMETRY_FLUSH_SPAWN_LOCK_STALE_MS = 60_000;\nconst OTEL_TRACES_ENDPOINT_ENV = \"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT\";\nconst OTEL_BASE_ENDPOINT_ENV = \"OTEL_EXPORTER_OTLP_ENDPOINT\";\nconst OTEL_SERVICE_NAME_ENV = \"OTEL_SERVICE_NAME\";\nconst PM_TELEMETRY_DISABLED_ENV = \"PM_TELEMETRY_DISABLED\";\nconst PM_NO_TELEMETRY_ENV = \"PM_NO_TELEMETRY\";\nconst PM_TELEMETRY_DISABLED_VALUES = new Set([\"1\", \"true\", \"yes\", \"on\"]);\nconst PM_TELEMETRY_OTEL_DISABLED_ENV = \"PM_TELEMETRY_OTEL_DISABLED\";\nconst PM_TELEMETRY_OTEL_DISABLED_VALUES = new Set([\"1\", \"true\", \"yes\", \"on\"]);\nconst PM_TELEMETRY_INLINE_FLUSH_ENV = \"PM_TELEMETRY_INLINE_FLUSH\";\nconst PM_TELEMETRY_FLUSH_CHILD_ENV = \"PM_TELEMETRY_FLUSH_CHILD\";\nconst PM_TELEMETRY_SOURCE_CONTEXT_ENV = \"PM_TELEMETRY_SOURCE_CONTEXT\";\nconst PM_AUTHOR_ENV = \"PM_AUTHOR\";\nexport const PM_TELEMETRY_SOURCE_CONTEXT_VALUES = [\"user\", \"automation\", \"test\", \"dogfood\", \"audit_smoke\"] as const;\n\nlet _lastFlushPromise: Promise<void> = Promise.resolve();\nlet _queueMutationPromise: Promise<unknown> = Promise.resolve();\n\n/** Wait for the most recent background flush to settle. Test-only helper. */\nexport async function waitForPendingFlush(): Promise<void> {\n await _lastFlushPromise;\n await _queueMutationPromise;\n}\nconst PM_TELEMETRY_SOURCE_CONTEXT_SET = new Set<string>(PM_TELEMETRY_SOURCE_CONTEXT_VALUES);\nconst BOOLEAN_TRUE_VALUES = new Set([\"1\", \"true\", \"yes\", \"on\"]);\nconst PROCESS_SESSION_ID = crypto.randomUUID();\n\nconst SENSITIVE_KEYWORDS = [\n \"token\",\n \"secret\",\n \"password\",\n \"passwd\",\n \"api_key\",\n \"apikey\",\n \"authorization\",\n \"cookie\",\n \"session\",\n \"credentials\",\n \"bearer\",\n] as const;\nconst SENSITIVE_INLINE_KEY_PATTERN =\n \"(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer)\";\nconst INLINE_SENSITIVE_ASSIGNMENT_PATTERN = new RegExp(\n `\\\\b(${SENSITIVE_INLINE_KEY_PATTERN})\\\\s*([:=])\\\\s*([^\\\\s,;]+)`,\n \"giu\",\n);\nconst INLINE_SENSITIVE_FLAG_PATTERN = new RegExp(\n `(--${SENSITIVE_INLINE_KEY_PATTERN})(=|\\\\s+)([^\\\\s,;]+)`,\n \"giu\",\n);\nconst ABSOLUTE_PATH_TOKEN_PATTERN = /(^|[\\s\"'`(=])\\/(?:[^\\s\"'`),;]+)/g;\nconst BEARER_TOKEN_PATTERN = /bearer\\s+[a-z0-9._=-]+/giu;\nconst PRIVATE_IP_PATTERN =\n /\\b(?:10\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)|172\\.(?:1[6-9]|2\\d|3[01])\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)|192\\.168\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))\\b/g;\n\ninterface TelemetryEvent {\n schema_version: number;\n event_id: string;\n event_type: \"command_start\" | \"command_finish\" | \"command_error\";\n occurred_at: string;\n installation_id: string;\n session_id: string;\n command: string;\n payload: Record<string, unknown>;\n}\n\ninterface QueuedTelemetryEvent {\n client_schema_version?: number;\n event: TelemetryEvent;\n attempts: number;\n last_attempt_at?: string;\n next_attempt_after?: string;\n}\n\ninterface TelemetryRuntimeState {\n last_attempted_flush_at?: string;\n last_successful_flush_at?: string;\n last_failed_flush_at?: string;\n last_failed_flush_error?: string;\n endpoint?: string;\n queue_entries?: number;\n pending_otel_spans?: number;\n last_otel_attempt_at?: string;\n last_otel_success_at?: string;\n last_otel_failure_at?: string;\n last_otel_failure_error?: string;\n}\n\n/**\n * A built OpenTelemetry span request awaiting export. Persisted to a small,\n * bounded queue so the OTLP trace POST happens in the detached, unref'd flush\n * worker instead of inline in the foreground command. This keeps the CLI process\n * from staying alive while a connecting socket to an unreachable traces endpoint\n * drains its 5s timeout (the GH-209 root cause). `payload` is the fully built\n * OTLP resourceSpans body; `endpoint` is the per-span traces endpoint.\n */\ninterface PendingOtelSpan {\n /**\n * Stable id used to reconcile the queue after the network flush: the worker\n * re-reads the file and removes/updates only the spans it processed, by id, so\n * spans appended by a concurrent foreground process during the flush are never\n * overwritten. Mirrors the event-queue's event_id-based reconciliation.\n */\n id: string;\n endpoint: string;\n payload: unknown;\n enqueued_at: string;\n attempts: number;\n next_attempt_after?: string;\n}\n\ntype TelemetryCaptureLevel = \"minimal\" | \"redacted\" | \"max\";\ntype TelemetrySourceContext = (typeof PM_TELEMETRY_SOURCE_CONTEXT_VALUES)[number];\ntype TelemetrySourceContextSource = \"inferred\" | \"env_override\";\n\ninterface ResolvedTelemetrySourceContext {\n source_context: TelemetrySourceContext;\n source_context_source: TelemetrySourceContextSource;\n}\n\n/**\n * Documents the active telemetry command payload exchanged by command, SDK, and package integrations.\n */\nexport interface ActiveTelemetryCommand {\n started_at: string;\n started_at_ms: number;\n command: string;\n command_taxonomy: TelemetryCommandTaxonomy;\n pm_version: string;\n source_context: TelemetrySourceContext;\n source_context_source: TelemetrySourceContextSource;\n installation_id: string;\n pm_root_hash: string;\n cwd_hash: string;\n endpoint: string;\n retention_days: number;\n global_pm_root: string;\n capture_level: TelemetryCaptureLevel;\n otel_traces_endpoint?: string;\n otel_trace_id?: string;\n otel_span_id?: string;\n}\n\n/**\n * Documents the telemetry command context payload exchanged by command, SDK, and package integrations.\n */\nexport interface TelemetryCommandContext {\n command: string;\n pm_version: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Documents the telemetry command outcome payload exchanged by command, SDK, and package integrations.\n */\nexport interface TelemetryCommandOutcome {\n ok: boolean;\n error?: string;\n result?: unknown;\n exit_code?: number;\n error_code?: string;\n error_category?: TelemetryErrorCategory;\n command_resolution?: TelemetryCommandResolution;\n resolution_stage?: TelemetryResolutionStage;\n}\n\n/**\n * Documents the telemetry error event context payload exchanged by command, SDK, and package integrations.\n */\nexport interface TelemetryErrorEventContext {\n command: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_version: string;\n pm_root: string;\n error_code: string;\n error_message: string;\n exit_code: number;\n error_category?: TelemetryErrorCategory;\n command_resolution?: TelemetryCommandResolution;\n resolution_stage?: TelemetryResolutionStage;\n}\n\n\nfunction queuePath(globalPmRoot: string): string {\n return path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n}\n\nfunction otelSpansQueuePath(globalPmRoot: string): string {\n return path.join(globalPmRoot, TELEMETRY_OTEL_SPANS_RELATIVE_PATH);\n}\n\nfunction telemetryRuntimeDirectory(globalPmRoot: string): string {\n return path.dirname(queuePath(globalPmRoot));\n}\n\nfunction runtimeStatePath(globalPmRoot: string): string {\n return path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n}\n\nfunction flushLockPath(globalPmRoot: string): string {\n return path.join(globalPmRoot, \"runtime\", \"telemetry\", \"flush.lock\");\n}\n\nfunction flushSpawnLockPath(globalPmRoot: string): string {\n return path.join(globalPmRoot, \"runtime\", \"telemetry\", \"flush.spawn.lock\");\n}\n\nfunction telemetryFlushRunnerPath(): string {\n return path.join(resolvePmPackageRootFromModule(import.meta.url, [\"../../..\"]), \"dist\", \"cli\", \"telemetry-flush.js\");\n}\n\nfunction shouldFlushInline(): boolean {\n if (parseBooleanTrueLike(process.env[PM_TELEMETRY_INLINE_FLUSH_ENV])) {\n return true;\n }\n if (parseBooleanTrueLike(process.env[PM_TELEMETRY_FLUSH_CHILD_ENV])) {\n return true;\n }\n const nodeEnv = (process.env.NODE_ENV ?? \"\").trim().toLowerCase();\n return typeof process.env.VITEST === \"string\" || typeof process.env.VITEST_WORKER_ID === \"string\" || nodeEnv === \"test\";\n}\n\nasync function readRuntimeState(globalPmRoot: string): Promise<TelemetryRuntimeState> {\n const raw = await readFileIfExists(runtimeStatePath(globalPmRoot));\n if (!raw || raw.trim().length === 0) {\n return {};\n }\n try {\n const parsed = JSON.parse(raw) as TelemetryRuntimeState;\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return {};\n }\n return parsed;\n } catch {\n return {};\n }\n}\n\nasync function writeRuntimeState(globalPmRoot: string, patch: TelemetryRuntimeState): Promise<void> {\n try {\n const current = await readRuntimeState(globalPmRoot);\n const next: TelemetryRuntimeState = {\n ...current,\n ...patch,\n };\n const normalized = Object.fromEntries(\n Object.entries(next)\n .filter(([, value]) => value !== undefined)\n .sort((left, right) => left[0].localeCompare(right[0])),\n );\n await writeFileAtomic(runtimeStatePath(globalPmRoot), `${JSON.stringify(normalized, null, 2)}\\n`);\n } catch {\n // Runtime state persistence is best effort and must not block command execution.\n }\n}\n\nfunction isSensitiveKey(key: string): boolean {\n const normalized = key.trim().toLowerCase().replaceAll(\"-\", \"_\").replaceAll(/[^a-z0-9_]+/g, \"_\");\n const tokens = normalized.split(\"_\").filter((token) => token.length > 0);\n return SENSITIVE_KEYWORDS.some(\n (keyword) => normalized === keyword || normalized.endsWith(`_${keyword}`) || tokens.includes(keyword),\n );\n}\n\nfunction redactInlineSensitiveAssignments(input: string): string {\n const withoutAssignments = input.replaceAll(\n INLINE_SENSITIVE_ASSIGNMENT_PATTERN,\n (_match: string, key: string, delimiter: string): string => `${key}${delimiter}[redacted]`,\n );\n return withoutAssignments.replaceAll(\n INLINE_SENSITIVE_FLAG_PATTERN,\n (_match: string, flag: string, delimiter: string): string => `${flag}${delimiter}[redacted]`,\n );\n}\n\nfunction redactAbsolutePathTokens(input: string): string {\n return input.replaceAll(\n ABSOLUTE_PATH_TOKEN_PATTERN,\n (_match: string, prefix: string): string => `${prefix}[redacted_path]`,\n );\n}\n\nfunction isAsciiLetterOrDigitCode(code: number): boolean {\n const isUpper = code >= 65 && code <= 90;\n const isLower = code >= 97 && code <= 122;\n const isDigit = code >= 48 && code <= 57;\n return isUpper || isLower || isDigit;\n}\n\nfunction isEmailLocalCharacter(character: string | undefined): boolean {\n if (!character) {\n return false;\n }\n const code = character.charCodeAt(0);\n if (isAsciiLetterOrDigitCode(code)) {\n return true;\n }\n return character === \".\" || character === \"_\" || character === \"%\" || character === \"+\" || character === \"-\";\n}\n\nfunction isEmailDomainCharacter(character: string | undefined): boolean {\n if (!character) {\n return false;\n }\n const code = character.charCodeAt(0);\n if (isAsciiLetterOrDigitCode(code)) {\n return true;\n }\n return character === \".\" || character === \"-\";\n}\n\nfunction looksLikeEmailToken(token: string): boolean {\n const atIndex = token.indexOf(\"@\");\n if (atIndex <= 0 || atIndex !== token.lastIndexOf(\"@\") || atIndex === token.length - 1) {\n return false;\n }\n const localPart = token.slice(0, atIndex);\n const domainPart = token.slice(atIndex + 1);\n const lastDot = domainPart.lastIndexOf(\".\");\n if (lastDot <= 0 || lastDot === domainPart.length - 1) {\n return false;\n }\n if (domainPart.length - (lastDot + 1) < 2) {\n return false;\n }\n for (const character of localPart) {\n if (!isEmailLocalCharacter(character)) {\n return false;\n }\n }\n for (const character of domainPart) {\n if (!isEmailDomainCharacter(character)) {\n return false;\n }\n }\n return true;\n}\n\nfunction redactEmailTokens(input: string): string {\n let redacted = \"\";\n let cursor = 0;\n while (cursor < input.length) {\n const atIndex = input.indexOf(\"@\", cursor);\n if (atIndex < 0) {\n redacted += input.slice(cursor);\n break;\n }\n let start = atIndex - 1;\n while (start >= cursor && isEmailLocalCharacter(input[start])) {\n start -= 1;\n }\n start += 1;\n let end = atIndex + 1;\n while (end < input.length && isEmailDomainCharacter(input[end])) {\n end += 1;\n }\n const candidate = input.slice(start, end);\n if (looksLikeEmailToken(candidate)) {\n redacted += input.slice(cursor, start);\n redacted += \"[redacted_email]\";\n cursor = end;\n continue;\n }\n redacted += input.slice(cursor, atIndex + 1);\n cursor = atIndex + 1;\n }\n return redacted;\n}\n\nfunction sanitizeCommonSensitiveTokens(input: string): string {\n const withoutEmails = redactEmailTokens(input);\n const withoutBearer = withoutEmails.replaceAll(BEARER_TOKEN_PATTERN, \"bearer [redacted_token]\");\n return withoutBearer.replaceAll(PRIVATE_IP_PATTERN, \"[redacted_ip]\");\n}\n\nfunction sanitizeStringRedacted(input: string): string {\n const withoutCommonSensitiveTokens = sanitizeCommonSensitiveTokens(input);\n const withoutInlineSecrets = redactInlineSensitiveAssignments(withoutCommonSensitiveTokens);\n const withoutAbsolutePaths = redactAbsolutePathTokens(withoutInlineSecrets);\n const trimmed = withoutAbsolutePaths.trim();\n if (trimmed.startsWith(\"/\") && trimmed.length > 1) {\n return \"[redacted_path]\";\n }\n if (withoutAbsolutePaths.length > 512) {\n return `${withoutAbsolutePaths.slice(0, 509)}...`;\n }\n return withoutAbsolutePaths;\n}\n\nfunction sanitizeStringMax(input: string): string {\n const withoutCommonSensitiveTokens = sanitizeCommonSensitiveTokens(input);\n const withoutInlineSecrets = redactInlineSensitiveAssignments(withoutCommonSensitiveTokens);\n const withoutAbsolutePaths = redactAbsolutePathTokens(withoutInlineSecrets);\n const trimmed = withoutAbsolutePaths.trim();\n if (trimmed.startsWith(\"/\") && trimmed.length > 1) {\n return \"[redacted_path]\";\n }\n if (withoutAbsolutePaths.length > 2048) {\n return `${withoutAbsolutePaths.slice(0, 2045)}...`;\n }\n return withoutAbsolutePaths;\n}\n\nfunction sanitizeString(input: string, captureLevel: Exclude<TelemetryCaptureLevel, \"minimal\"> = \"redacted\"): string {\n if (captureLevel === \"max\") {\n return sanitizeStringMax(input);\n }\n return sanitizeStringRedacted(input);\n}\n\nfunction sanitizeValue(\n value: unknown,\n keyHint?: string,\n captureLevel: Exclude<TelemetryCaptureLevel, \"minimal\"> = \"redacted\",\n depth = 0,\n): unknown {\n if (keyHint && isSensitiveKey(keyHint)) {\n return \"[redacted]\";\n }\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value === \"string\") {\n return sanitizeString(value, captureLevel);\n }\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return value;\n }\n if (depth >= TELEMETRY_SANITIZE_MAX_DEPTH) {\n return \"[depth_truncated]\";\n }\n if (Array.isArray(value)) {\n return value.slice(0, TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS).map((entry) => sanitizeValue(entry, undefined, captureLevel, depth + 1));\n }\n if (typeof value === \"object\") {\n const record = value as Record<string, unknown>;\n const sanitized: Record<string, unknown> = {};\n for (const [key, nested] of Object.entries(record)) {\n sanitized[key] = sanitizeValue(nested, key, captureLevel, depth + 1);\n }\n return sanitized;\n }\n return String(value);\n}\n\nfunction sanitizeCommandArgs(\n args: string[],\n captureLevel: Exclude<TelemetryCaptureLevel, \"minimal\"> = \"redacted\",\n): string[] {\n const sanitized: string[] = [];\n let nextIsSensitiveValue = false;\n for (const rawArg of args) {\n const arg = sanitizeString(rawArg, captureLevel);\n if (nextIsSensitiveValue) {\n sanitized.push(\"[redacted]\");\n nextIsSensitiveValue = false;\n continue;\n }\n if (arg.startsWith(\"--\")) {\n const withoutPrefix = arg.slice(2);\n const delimiterIndex = withoutPrefix.indexOf(\"=\");\n if (delimiterIndex >= 0) {\n const key = withoutPrefix.slice(0, delimiterIndex);\n const value = withoutPrefix.slice(delimiterIndex + 1);\n if (isSensitiveKey(key)) {\n sanitized.push(`--${key}=[redacted]`);\n } else {\n sanitized.push(`--${key}=${sanitizeString(value, captureLevel)}`);\n }\n continue;\n }\n if (isSensitiveKey(withoutPrefix)) {\n sanitized.push(`--${withoutPrefix}`);\n nextIsSensitiveValue = true;\n continue;\n }\n }\n sanitized.push(arg);\n }\n return sanitized;\n}\n\nfunction normalizeCaptureLevel(value: string | undefined): TelemetryCaptureLevel {\n const normalized = value?.trim().toLowerCase();\n if (normalized === \"minimal\" || normalized === \"redacted\" || normalized === \"max\") {\n return normalized;\n }\n return \"redacted\";\n}\n\nfunction parseBooleanTrueLike(value: string | undefined): boolean {\n return BOOLEAN_TRUE_VALUES.has((value ?? \"\").trim().toLowerCase());\n}\n\nfunction normalizePmVersion(value: string | undefined): string {\n const trimmed = typeof value === \"string\" ? value.trim() : \"\";\n return trimmed.length > 0 ? trimmed : \"0.0.0\";\n}\n\nfunction normalizeTelemetryErrorCode(value: string | undefined): string | undefined {\n const normalized = value?.trim();\n return normalized && normalized.length > 0 ? normalized : undefined;\n}\n\nfunction normalizeTelemetryExitCode(exitCode: number | undefined, ok: boolean): number {\n if (Number.isFinite(exitCode)) {\n return Math.max(0, Math.trunc(exitCode as number));\n }\n return ok ? 0 : 1;\n}\n\nfunction normalizeTelemetryErrorCategory(params: {\n ok: boolean;\n errorCode?: string;\n errorCategory?: TelemetryErrorCategory;\n}): TelemetryErrorCategory | undefined {\n if (params.ok) {\n return undefined;\n }\n if (typeof params.errorCategory === \"string\" && params.errorCategory.trim().length > 0) {\n return params.errorCategory;\n }\n if (typeof params.errorCode === \"string\" && params.errorCode.trim().length > 0) {\n return resolveTelemetryErrorCategory(params.errorCode);\n }\n return \"unknown\";\n}\n\nfunction resolveTelemetrySourceContext(globalOptions: GlobalOptions): ResolvedTelemetrySourceContext {\n const override = (process.env[PM_TELEMETRY_SOURCE_CONTEXT_ENV] ?? \"\").trim().toLowerCase();\n if (PM_TELEMETRY_SOURCE_CONTEXT_SET.has(override)) {\n return {\n source_context: override as TelemetrySourceContext,\n source_context_source: \"env_override\",\n };\n }\n const nodeEnv = (process.env.NODE_ENV ?? \"\").trim().toLowerCase();\n if (typeof process.env.VITEST === \"string\" || typeof process.env.VITEST_WORKER_ID === \"string\" || nodeEnv === \"test\") {\n return {\n source_context: \"test\",\n source_context_source: \"inferred\",\n };\n }\n const nonTty = process.stdin.isTTY !== true || process.stdout.isTTY !== true;\n const ci = parseBooleanTrueLike(process.env.CI);\n const scriptLikeMode = globalOptions.json === true || globalOptions.quiet === true;\n if (nonTty || ci || scriptLikeMode) {\n return {\n source_context: \"automation\",\n source_context_source: \"inferred\",\n };\n }\n return {\n source_context: \"user\",\n source_context_source: \"inferred\",\n };\n}\n\nfunction hashWithInstallationId(installationId: string, value: string): string {\n return crypto.createHash(\"sha256\").update(`${installationId}:${value}`).digest(\"hex\");\n}\n\n/**\n * Builds the agent-identity dimension for a telemetry payload from `PM_AUTHOR`.\n *\n * The raw `PM_AUTHOR` value (e.g. `claude-code-agent`) is never emitted. At\n * non-minimal capture levels a stable `author_context_hash` is attached — the\n * same installation-id-keyed one-way hash used for `pm_root_hash`/`cwd_hash`, so\n * agent-driven invocations can be segmented in Sentry/dashboards while the same\n * author hashes differently across installations. Because the field is a one-way\n * hash, it intentionally bypasses the {@link SENSITIVE_KEYWORDS} redaction path.\n * At minimal capture only a `has_author_context` boolean is surfaced.\n */\nfunction buildAuthorContextPayloadFields(\n captureLevel: TelemetryCaptureLevel,\n installationId: string,\n): Record<string, unknown> {\n const author = (process.env[PM_AUTHOR_ENV] ?? \"\").trim();\n if (captureLevel === \"minimal\") {\n return { has_author_context: author.length > 0 };\n }\n return author.length > 0\n ? { author_context_hash: hashWithInstallationId(installationId, author) }\n : {};\n}\n\nfunction normalizeForHash(value: unknown, depth = 0): unknown {\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n return value;\n }\n if (depth >= TELEMETRY_SANITIZE_MAX_DEPTH) {\n return \"[depth_truncated]\";\n }\n if (Array.isArray(value)) {\n return value.slice(0, TELEMETRY_SANITIZE_MAX_ARRAY_ITEMS).map((entry) => normalizeForHash(entry, depth + 1));\n }\n if (typeof value === \"object\") {\n const record = value as Record<string, unknown>;\n const normalized: Record<string, unknown> = {};\n const sortedKeys = Object.keys(record).sort((left, right) => left.localeCompare(right));\n for (const key of sortedKeys) {\n normalized[key] = normalizeForHash(record[key], depth + 1);\n }\n return normalized;\n }\n return String(value);\n}\n\nfunction hashTelemetryValue(installationId: string, value: unknown): string {\n return hashWithInstallationId(installationId, JSON.stringify(normalizeForHash(value)));\n}\n\nfunction hashCommandArgs(installationId: string, args: string[]): { hashes: string[]; digest: string } {\n return {\n hashes: args.map((arg) => hashWithInstallationId(installationId, arg)),\n digest: hashWithInstallationId(installationId, args.join(\"\\u0000\")),\n };\n}\n\nfunction hashTelemetryErrorFingerprint(\n installationId: string,\n command: string,\n errorCode: string | undefined,\n errorMessage: string | undefined,\n): string {\n const normalizedMessage = sanitizeString(typeof errorMessage === \"string\" ? errorMessage : \"\", \"redacted\");\n const normalizedCode = typeof errorCode === \"string\" && errorCode.length > 0 ? errorCode : \"unknown_error\";\n const fingerprintSource = `${command}\\u0000${normalizedCode}\\u0000${normalizedMessage}`;\n return hashWithInstallationId(installationId, fingerprintSource);\n}\n\nfunction telemetryDisabledByEnvironment(): boolean {\n return (\n PM_TELEMETRY_DISABLED_VALUES.has((process.env[PM_TELEMETRY_DISABLED_ENV] ?? \"\").trim().toLowerCase()) ||\n PM_TELEMETRY_DISABLED_VALUES.has((process.env[PM_NO_TELEMETRY_ENV] ?? \"\").trim().toLowerCase())\n );\n}\n\nfunction resolveOtelTracesEndpoint(): string | null {\n if (PM_TELEMETRY_OTEL_DISABLED_VALUES.has((process.env[PM_TELEMETRY_OTEL_DISABLED_ENV] ?? \"\").trim().toLowerCase())) {\n return null;\n }\n\n const directEndpoint = (process.env[OTEL_TRACES_ENDPOINT_ENV] ?? \"\").trim();\n if (directEndpoint.length > 0) {\n try {\n return new URL(directEndpoint).toString();\n } catch {\n return null;\n }\n }\n\n const baseEndpoint = (process.env[OTEL_BASE_ENDPOINT_ENV] ?? \"\").trim();\n if (baseEndpoint.length === 0) {\n return null;\n }\n\n try {\n const url = new URL(baseEndpoint);\n const normalizedPath = url.pathname.replace(/\\/+$/, \"\");\n if (!normalizedPath.endsWith(\"/v1/traces\")) {\n url.pathname = `${normalizedPath.length === 0 ? \"\" : normalizedPath}/v1/traces`;\n }\n return url.toString();\n } catch {\n return null;\n }\n}\n\nfunction isoToUnixNano(iso: string): string {\n const parsedMs = Date.parse(iso);\n const epochMs = Number.isNaN(parsedMs) ? Date.now() : parsedMs;\n return `${BigInt(epochMs) * 1_000_000n}`;\n}\n\nfunction otlpStringAttribute(key: string, value: string): { key: string; value: { stringValue: string } } {\n return {\n key,\n value: { stringValue: value },\n };\n}\n\nfunction otlpBoolAttribute(key: string, value: boolean): { key: string; value: { boolValue: boolean } } {\n return {\n key,\n value: { boolValue: value },\n };\n}\n\nfunction otlpIntAttribute(key: string, value: number): { key: string; value: { intValue: string } } {\n return {\n key,\n value: { intValue: String(Math.max(0, Math.trunc(value))) },\n };\n}\n\n/**\n * Build the OTLP trace-export request for a finished command without performing\n * any network I/O. Returns `null` when OTLP export is not configured (no traces\n * endpoint / trace ids). The actual POST is deferred to the detached flush worker\n * via {@link enqueuePendingOtelSpan} so the foreground command never blocks on a\n * connecting socket (GH-209).\n */\nfunction buildOtelSpanRequest(\n activeCommand: ActiveTelemetryCommand,\n outcome: { ok: boolean; error?: string; exit_code?: number; error_code?: string; error_category?: TelemetryErrorCategory },\n finishedAtIso: string,\n durationMs: number,\n): { endpoint: string; payload: unknown } | null {\n if (\n typeof activeCommand.otel_traces_endpoint !== \"string\" ||\n activeCommand.otel_traces_endpoint.trim().length === 0 ||\n typeof activeCommand.otel_trace_id !== \"string\" ||\n activeCommand.otel_trace_id.length === 0 ||\n typeof activeCommand.otel_span_id !== \"string\" ||\n activeCommand.otel_span_id.length === 0\n ) {\n return null;\n }\n\n const serviceNameCandidate = sanitizeString((process.env[OTEL_SERVICE_NAME_ENV] ?? \"\").trim());\n const serviceName = serviceNameCandidate.length > 0 ? serviceNameCandidate : \"pm-cli\";\n const normalizedExitCode = normalizeTelemetryExitCode(outcome.exit_code, outcome.ok);\n const normalizedErrorCode = normalizeTelemetryErrorCode(outcome.error_code);\n const normalizedErrorCategory = normalizeTelemetryErrorCategory({\n ok: outcome.ok,\n errorCode: normalizedErrorCode,\n errorCategory: outcome.error_category,\n });\n const attributes: Array<\n | ReturnType<typeof otlpStringAttribute>\n | ReturnType<typeof otlpBoolAttribute>\n | ReturnType<typeof otlpIntAttribute>\n > = [\n otlpStringAttribute(\"pm.command\", sanitizeString(activeCommand.command)),\n otlpStringAttribute(\"pm.version\", activeCommand.pm_version),\n otlpStringAttribute(\"pm.source_context\", activeCommand.source_context),\n otlpStringAttribute(\"pm.source_context_source\", activeCommand.source_context_source),\n otlpStringAttribute(\"pm.installation_id\", activeCommand.installation_id),\n otlpStringAttribute(\"pm.session_id\", PROCESS_SESSION_ID),\n otlpStringAttribute(\"pm.pm_root_hash\", activeCommand.pm_root_hash),\n otlpStringAttribute(\"pm.cwd_hash\", activeCommand.cwd_hash),\n otlpBoolAttribute(\"pm.ok\", outcome.ok),\n otlpIntAttribute(\"pm.exit_code\", normalizedExitCode),\n otlpIntAttribute(\"pm.duration_ms\", durationMs),\n ];\n if (typeof normalizedErrorCode === \"string\") {\n attributes.push(otlpStringAttribute(\"pm.error_code\", normalizedErrorCode));\n }\n if (typeof normalizedErrorCategory === \"string\") {\n attributes.push(otlpStringAttribute(\"pm.error_category\", normalizedErrorCategory));\n }\n if (typeof outcome.error === \"string\" && outcome.error.trim().length > 0) {\n attributes.push(otlpStringAttribute(\"pm.error\", sanitizeString(outcome.error)));\n }\n\n const payload = {\n resourceSpans: [\n {\n resource: {\n attributes: [otlpStringAttribute(\"service.name\", serviceName)],\n },\n scopeSpans: [\n {\n scope: {\n name: \"pm-cli.telemetry\",\n version: \"1\",\n },\n spans: [\n {\n traceId: activeCommand.otel_trace_id,\n spanId: activeCommand.otel_span_id,\n name: `pm.command.${sanitizeString(activeCommand.command)}`,\n kind: 1,\n startTimeUnixNano: isoToUnixNano(activeCommand.started_at),\n endTimeUnixNano: isoToUnixNano(finishedAtIso),\n attributes,\n status: {\n code: outcome.ok ? 1 : 2,\n message: outcome.ok\n ? \"\"\n : sanitizeString(typeof outcome.error === \"string\" ? outcome.error : \"command_failed\"),\n },\n },\n ],\n },\n ],\n },\n ],\n };\n\n return { endpoint: activeCommand.otel_traces_endpoint, payload };\n}\n\nfunction summarizeResult(\n result: unknown,\n captureLevel: Exclude<TelemetryCaptureLevel, \"minimal\"> = \"redacted\",\n): Record<string, unknown> {\n if (result === null || result === undefined) {\n return { type: \"nullish\" };\n }\n if (typeof result === \"string\") {\n return { type: \"string\", value: sanitizeString(result, captureLevel) };\n }\n if (typeof result === \"number\" || typeof result === \"boolean\") {\n return { type: typeof result, value: result };\n }\n if (Array.isArray(result)) {\n return {\n type: \"array\",\n length: result.length,\n sample: result.slice(0, 5).map((entry) => sanitizeValue(entry, undefined, captureLevel)),\n };\n }\n if (typeof result === \"object\") {\n const record = result as Record<string, unknown>;\n const keys = Object.keys(record).sort((left, right) => left.localeCompare(right));\n const sanitized: Record<string, unknown> = {};\n let previewBytes = 0;\n for (const key of keys.slice(0, 25)) {\n const sanitizedValue = sanitizeValue(record[key], key, captureLevel);\n const entrySize = JSON.stringify(sanitizedValue).length;\n if (previewBytes + entrySize > TELEMETRY_RESULT_PREVIEW_MAX_BYTES) {\n sanitized[key] = \"[preview_truncated]\";\n break;\n }\n previewBytes += entrySize;\n sanitized[key] = sanitizedValue;\n }\n return {\n type: \"object\",\n key_count: keys.length,\n keys_preview: keys.slice(0, 50),\n preview: sanitized,\n };\n }\n return { type: typeof result, value: String(result) };\n}\n\nfunction buildCommandStartPayload(params: {\n captureLevel: TelemetryCaptureLevel;\n context: TelemetryCommandContext;\n pmVersion: string;\n sourceContext: ResolvedTelemetrySourceContext;\n pmRootHash: string;\n cwdHash: string;\n installationId: string;\n}): Record<string, unknown> {\n const { captureLevel, context, pmVersion, sourceContext, pmRootHash, cwdHash, installationId } = params;\n const commandTaxonomy = deriveTelemetryCommandTaxonomy(context.command);\n const hashedArgs = hashCommandArgs(installationId, context.args);\n const commandInvocationDigest = hashWithInstallationId(installationId, `${context.command}\\u0000${context.args.join(\"\\u0000\")}`);\n const commandOptionsDigest = hashTelemetryValue(installationId, context.options);\n const globalOptionsDigest = hashTelemetryValue(installationId, context.global);\n const authorContextFields = buildAuthorContextPayloadFields(captureLevel, installationId);\n if (captureLevel === \"minimal\") {\n return {\n capture_level: captureLevel,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n command_args_digest: hashedArgs.digest,\n command_invocation_digest: commandInvocationDigest,\n command_options_digest: commandOptionsDigest,\n global_options_digest: globalOptionsDigest,\n ...authorContextFields,\n };\n }\n return {\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n ...authorContextFields,\n command_args: sanitizeCommandArgs(context.args, captureLevel),\n command_args_hashes: hashedArgs.hashes,\n command_args_digest: hashedArgs.digest,\n command_invocation_digest: commandInvocationDigest,\n command_options: sanitizeValue(context.options, undefined, captureLevel) as Record<string, unknown>,\n command_options_digest: commandOptionsDigest,\n global_options: sanitizeValue(context.global, undefined, captureLevel) as Record<string, unknown>,\n global_options_digest: globalOptionsDigest,\n pm_root_hash: pmRootHash,\n cwd_hash: cwdHash,\n capture_level: captureLevel,\n runtime: {\n node: process.version,\n platform: process.platform,\n arch: process.arch,\n hostname_hash: hashWithInstallationId(installationId, os.hostname()),\n stdin_tty: process.stdin.isTTY === true,\n stdout_tty: process.stdout.isTTY === true,\n },\n };\n}\n\nfunction buildCommandFinishPayload(params: {\n captureLevel: TelemetryCaptureLevel;\n pmVersion: string;\n sourceContext: ResolvedTelemetrySourceContext;\n outcome: TelemetryCommandOutcome;\n durationMs: number;\n startedAt: string;\n command: string;\n installationId: string;\n commandTaxonomy: TelemetryCommandTaxonomy;\n exitCode: number;\n errorCode?: string;\n errorCategory?: TelemetryErrorCategory;\n commandResolution: TelemetryCommandResolution;\n resolutionStage: TelemetryResolutionStage;\n}): Record<string, unknown> {\n const {\n captureLevel,\n pmVersion,\n sourceContext,\n outcome,\n durationMs,\n startedAt,\n command,\n installationId,\n commandTaxonomy,\n exitCode,\n errorCode,\n errorCategory,\n commandResolution,\n resolutionStage,\n } = params;\n const errorFingerprint =\n outcome.ok === false\n ? hashTelemetryErrorFingerprint(installationId, command, errorCode, outcome.error)\n : undefined;\n const authorContextFields = buildAuthorContextPayloadFields(captureLevel, installationId);\n if (captureLevel === \"minimal\") {\n return {\n capture_level: captureLevel,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n command_resolution: commandResolution,\n resolution_stage: resolutionStage,\n ok: outcome.ok,\n exit_code: exitCode,\n error_code: errorCode,\n error_category: errorCategory,\n error: outcome.error ? sanitizeString(outcome.error, \"redacted\") : undefined,\n error_fingerprint: errorFingerprint,\n duration_ms: durationMs,\n ...authorContextFields,\n };\n }\n return {\n capture_level: captureLevel,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n command_resolution: commandResolution,\n resolution_stage: resolutionStage,\n ...authorContextFields,\n ok: outcome.ok,\n exit_code: exitCode,\n error_code: errorCode,\n error_category: errorCategory,\n error: outcome.error ? sanitizeString(outcome.error, captureLevel) : undefined,\n error_fingerprint: errorFingerprint,\n duration_ms: durationMs,\n started_at: startedAt,\n result_summary: summarizeResult(outcome.result, captureLevel),\n };\n}\n\nfunction buildCommandErrorPayload(params: {\n captureLevel: TelemetryCaptureLevel;\n pmVersion: string;\n sourceContext: ResolvedTelemetrySourceContext;\n command: string;\n commandTaxonomy: TelemetryCommandTaxonomy;\n commandResolution: TelemetryCommandResolution;\n resolutionStage: TelemetryResolutionStage;\n args: string[];\n options: Record<string, unknown>;\n pmRootHash: string;\n cwdHash: string;\n installationId: string;\n errorCode: string;\n errorMessage: string;\n errorCategory: TelemetryErrorCategory;\n exitCode: number;\n}): Record<string, unknown> {\n const {\n captureLevel,\n pmVersion,\n sourceContext,\n command,\n commandTaxonomy,\n commandResolution,\n resolutionStage,\n args,\n options,\n pmRootHash,\n cwdHash,\n installationId,\n errorCode,\n errorMessage,\n errorCategory,\n exitCode,\n } = params;\n const attemptedArgHashes = hashCommandArgs(installationId, args);\n const attemptedCommandDigest = hashWithInstallationId(installationId, command);\n const attemptedOptionsDigest = hashTelemetryValue(installationId, options);\n const errorFingerprint = hashTelemetryErrorFingerprint(installationId, command, errorCode, errorMessage);\n if (captureLevel === \"minimal\") {\n return {\n capture_level: captureLevel,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n command_resolution: commandResolution,\n resolution_stage: resolutionStage,\n attempted_command_digest: attemptedCommandDigest,\n attempted_args_digest: attemptedArgHashes.digest,\n attempted_options_digest: attemptedOptionsDigest,\n error_code: errorCode,\n error_category: errorCategory,\n exit_code: exitCode,\n error: sanitizeString(errorMessage, \"redacted\"),\n error_fingerprint: errorFingerprint,\n };\n }\n\n return {\n capture_level: captureLevel,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n command_taxonomy: commandTaxonomy,\n command_resolution: commandResolution,\n resolution_stage: resolutionStage,\n attempted_command: sanitizeString(command, captureLevel),\n attempted_command_digest: attemptedCommandDigest,\n attempted_args: sanitizeCommandArgs(args, captureLevel),\n attempted_args_hashes: attemptedArgHashes.hashes,\n attempted_args_digest: attemptedArgHashes.digest,\n attempted_options: sanitizeValue(options, undefined, captureLevel) as Record<string, unknown>,\n attempted_options_digest: attemptedOptionsDigest,\n error_code: errorCode,\n error_category: errorCategory,\n exit_code: exitCode,\n error: sanitizeString(errorMessage, captureLevel),\n error_fingerprint: errorFingerprint,\n pm_root_hash: pmRootHash,\n cwd_hash: cwdHash,\n runtime: {\n node: process.version,\n platform: process.platform,\n arch: process.arch,\n hostname_hash: hashWithInstallationId(installationId, os.hostname()),\n stdin_tty: process.stdin.isTTY === true,\n stdout_tty: process.stdout.isTTY === true,\n },\n };\n}\n\nasync function ensureInstallationId(\n globalPmRoot: string,\n): Promise<{ installationId: string; endpoint: string; retentionDays: number }> {\n const settings = await readSettings(globalPmRoot);\n let changed = false;\n if (settings.telemetry.installation_id.trim().length === 0) {\n settings.telemetry.installation_id = crypto.randomUUID();\n changed = true;\n }\n if (changed) {\n await writeSettings(globalPmRoot, settings, \"telemetry:install_id\");\n }\n return {\n installationId: settings.telemetry.installation_id,\n endpoint: settings.telemetry.endpoint,\n retentionDays: Math.max(1, Math.trunc(settings.telemetry.retention_days)),\n };\n}\n\nasync function enqueueTelemetryEvent(globalPmRoot: string, event: TelemetryEvent): Promise<void> {\n const queued: QueuedTelemetryEvent = {\n client_schema_version: TELEMETRY_CLIENT_SCHEMA_VERSION,\n event,\n attempts: 0,\n };\n let serialized = JSON.stringify(queued);\n if (serialized.length > TELEMETRY_MAX_EVENT_BYTES) {\n const trimmed = { ...event, payload: { ...event.payload, result_summary: { truncated: true, reason: \"payload_size_exceeded\", original_bytes: serialized.length } } };\n const trimmedQueued: QueuedTelemetryEvent = {\n client_schema_version: TELEMETRY_CLIENT_SCHEMA_VERSION,\n event: trimmed,\n attempts: 0,\n };\n serialized = JSON.stringify(trimmedQueued);\n }\n await withQueueMutation(async () => {\n await appendLineAtomic(queuePath(globalPmRoot), serialized);\n });\n}\n\nfunction parseQueueLines(raw: string): QueuedTelemetryEvent[] {\n const entries: QueuedTelemetryEvent[] = [];\n for (const line of raw.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n try {\n const parsed = JSON.parse(trimmed) as QueuedTelemetryEvent;\n if (\n parsed &&\n typeof parsed === \"object\" &&\n parsed.event &&\n typeof parsed.event === \"object\" &&\n typeof parsed.attempts === \"number\" &&\n (\n parsed.client_schema_version === undefined ||\n (typeof parsed.client_schema_version === \"number\" && Number.isFinite(parsed.client_schema_version))\n )\n ) {\n entries.push(parsed);\n }\n } catch {\n // Drop malformed lines to preserve queue forward progress.\n }\n }\n return entries;\n}\n\nfunction nextRetryIso(attempts: number): string {\n const delay = Math.min(TELEMETRY_RETRY_BASE_DELAY_MS * 2 ** Math.max(attempts - 1, 0), TELEMETRY_MAX_RETRY_DELAY_MS);\n return new Date(Date.now() + delay).toISOString();\n}\n\nfunction isDueForRetryAt(nextAttemptAfter: string | undefined): boolean {\n if (typeof nextAttemptAfter !== \"string\" || nextAttemptAfter.trim().length === 0) {\n return true;\n }\n const dueAtMs = Date.parse(nextAttemptAfter);\n if (Number.isNaN(dueAtMs)) {\n return true;\n }\n return dueAtMs <= Date.now();\n}\n\nfunction isDueForRetry(entry: QueuedTelemetryEvent): boolean {\n return isDueForRetryAt(entry.next_attempt_after);\n}\n\nfunction retentionCutoffMs(retentionDays: number): number {\n const normalizedDays = Number.isFinite(retentionDays) ? Math.max(1, Math.trunc(retentionDays)) : 1;\n return Date.now() - normalizedDays * MILLISECONDS_PER_DAY;\n}\n\nfunction isExpiredQueueEntry(entry: QueuedTelemetryEvent, cutoffMs: number): boolean {\n const occurredAt = entry.event?.occurred_at;\n if (typeof occurredAt !== \"string\" || occurredAt.trim().length === 0) {\n return false;\n }\n const occurredAtMs = Date.parse(occurredAt);\n if (Number.isNaN(occurredAtMs)) {\n return false;\n }\n return occurredAtMs < cutoffMs;\n}\n\nfunction pruneExpiredQueueEntries(\n entries: QueuedTelemetryEvent[],\n retentionDays: number,\n): { entries: QueuedTelemetryEvent[]; prunedCount: number } {\n const cutoffMs = retentionCutoffMs(retentionDays);\n const retained: QueuedTelemetryEvent[] = [];\n let prunedCount = 0;\n for (const entry of entries) {\n const serializedSize = JSON.stringify(entry).length;\n const oversized = serializedSize > TELEMETRY_MAX_EVENT_BYTES;\n if (oversized || isExpiredQueueEntry(entry, cutoffMs) || entry.attempts >= TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS) {\n prunedCount += 1;\n continue;\n }\n retained.push(entry);\n }\n return { entries: retained, prunedCount };\n}\n\nasync function rewriteQueue(globalPmRoot: string, entries: QueuedTelemetryEvent[]): Promise<void> {\n const serialized = entries.map((entry) => JSON.stringify(entry)).join(\"\\n\");\n const contents = serialized.length > 0 ? `${serialized}\\n` : \"\";\n for (let attempt = 0; ; attempt += 1) {\n try {\n await writeFileAtomic(queuePath(globalPmRoot), contents);\n return;\n } catch (error: unknown) {\n const retryDelay = TELEMETRY_QUEUE_REWRITE_RETRY_DELAYS_MS[attempt];\n if (retryDelay === undefined || !isRetryableQueueRewriteError(error)) {\n throw error;\n }\n await sleep(retryDelay);\n }\n }\n}\n\nfunction isRetryableQueueRewriteError(error: unknown): boolean {\n if (typeof error !== \"object\" || error === null || !(\"code\" in error)) {\n return false;\n }\n const code = (error as { code?: unknown }).code;\n return code === \"EACCES\" || code === \"EBUSY\" || code === \"EPERM\";\n}\n\nfunction sleep(milliseconds: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, milliseconds);\n });\n}\n\n/**\n * Append a built OTLP span request to the bounded pending-spans queue. The\n * detached flush worker drains and POSTs these so the foreground command never\n * performs OTLP network I/O (GH-209). Best effort: a write failure never blocks\n * the command, and the span is simply not exported.\n */\nasync function enqueuePendingOtelSpan(globalPmRoot: string, request: { endpoint: string; payload: unknown }): Promise<void> {\n const pending: PendingOtelSpan = {\n id: crypto.randomUUID(),\n endpoint: request.endpoint,\n payload: request.payload,\n enqueued_at: nowIso(),\n attempts: 0,\n };\n const serialized = JSON.stringify(pending);\n // Drop oversized spans rather than poison the queue; they would never flush.\n if (serialized.length > TELEMETRY_MAX_EVENT_BYTES) {\n return;\n }\n await withQueueMutation(async () => {\n await appendLineAtomic(otelSpansQueuePath(globalPmRoot), serialized);\n });\n}\n\n/**\n * Derive a stable id for a legacy id-less pending span from its identity fields.\n * Deterministic so the same on-disk line yields the same id across reads, which\n * is what lets reconciliation remove/update it after a flush.\n */\nfunction backfillPendingOtelSpanId(entry: { endpoint: string; enqueued_at: string; payload: unknown }): string {\n const material = JSON.stringify([entry.endpoint, entry.enqueued_at, entry.payload]);\n return crypto.createHash(\"sha256\").update(material).digest(\"hex\").slice(0, 32);\n}\n\nfunction parsePendingOtelSpanLines(raw: string): PendingOtelSpan[] {\n const entries: PendingOtelSpan[] = [];\n for (const line of raw.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n try {\n const parsed = JSON.parse(trimmed) as PendingOtelSpan;\n if (\n parsed &&\n typeof parsed === \"object\" &&\n typeof parsed.endpoint === \"string\" &&\n parsed.endpoint.trim().length > 0 &&\n \"payload\" in parsed &&\n typeof parsed.attempts === \"number\" &&\n Number.isFinite(parsed.attempts)\n ) {\n // Backfill an id for legacy entries written before id tracking existed.\n // It MUST be deterministic from the entry's content so the post-flush\n // re-read derives the same id and reconciliation can address the entry;\n // a random id would differ between reads and strand the span.\n if (typeof parsed.id !== \"string\" || parsed.id.length === 0) {\n parsed.id = backfillPendingOtelSpanId(parsed);\n }\n entries.push(parsed);\n }\n } catch {\n // Drop malformed lines to preserve forward progress.\n }\n }\n return entries;\n}\n\nfunction isExpiredPendingOtelSpan(entry: PendingOtelSpan, cutoffMs: number): boolean {\n if (typeof entry.enqueued_at !== \"string\" || entry.enqueued_at.trim().length === 0) {\n return false;\n }\n const enqueuedAtMs = Date.parse(entry.enqueued_at);\n if (Number.isNaN(enqueuedAtMs)) {\n return false;\n }\n return enqueuedAtMs < cutoffMs;\n}\n\nfunction prunePendingOtelSpans(\n entries: PendingOtelSpan[],\n retentionDays: number,\n): { entries: PendingOtelSpan[]; prunedCount: number } {\n const cutoffMs = retentionCutoffMs(retentionDays);\n const retained: PendingOtelSpan[] = [];\n let prunedCount = 0;\n for (const entry of entries) {\n const oversized = JSON.stringify(entry).length > TELEMETRY_MAX_EVENT_BYTES;\n if (oversized || isExpiredPendingOtelSpan(entry, cutoffMs) || entry.attempts >= TELEMETRY_MAX_QUEUE_ENTRY_ATTEMPTS) {\n prunedCount += 1;\n continue;\n }\n retained.push(entry);\n }\n if (retained.length > TELEMETRY_OTEL_SPANS_MAX_PENDING) {\n const overflow = retained.length - TELEMETRY_OTEL_SPANS_MAX_PENDING;\n prunedCount += overflow;\n // Keep the most recently enqueued spans; oldest beyond the cap are dropped.\n return { entries: retained.slice(overflow), prunedCount };\n }\n return { entries: retained, prunedCount };\n}\n\nasync function rewritePendingOtelSpans(globalPmRoot: string, entries: PendingOtelSpan[]): Promise<void> {\n const serialized = entries.map((entry) => JSON.stringify(entry)).join(\"\\n\");\n const contents = serialized.length > 0 ? `${serialized}\\n` : \"\";\n for (let attempt = 0; ; attempt += 1) {\n try {\n await writeFileAtomic(otelSpansQueuePath(globalPmRoot), contents);\n return;\n } catch (error: unknown) {\n const retryDelay = TELEMETRY_QUEUE_REWRITE_RETRY_DELAYS_MS[attempt];\n if (retryDelay === undefined || !isRetryableQueueRewriteError(error)) {\n throw error;\n }\n await sleep(retryDelay);\n }\n }\n}\n\n/**\n * Drain the pending OTLP span queue and POST due spans to their traces endpoint.\n * Runs only inside the flush worker (detached child) or the inline test path, so\n * the foreground command never makes OTLP network calls. Failures increment\n * per-span attempts with backoff and are retried by a later flush; runtime state\n * records OTLP export diagnostics for `pm health` (GH-205).\n */\n/**\n * Re-read the spans queue under the mutation serializer and rewrite it with the\n * processed spans removed/updated by id, preserving any spans a concurrent\n * foreground process appended during the (network) flush window. `succeededIds`\n * are dropped; `failedUpdates` patch attempts/next_attempt_after by id; all other\n * (incl. newly-appended) entries are retained, then pruned. Returns the count of\n * spans left in the queue. Mirrors removeFlushedEntriesFromCurrentQueue.\n */\nasync function reconcilePendingOtelSpansAfterFlush(\n globalPmRoot: string,\n retentionDays: number,\n succeededIds: ReadonlySet<string>,\n failedUpdates: ReadonlyMap<string, { attempts: number; next_attempt_after: string }>,\n): Promise<number> {\n return withQueueMutation(async () => {\n const raw = await readFileIfExists(otelSpansQueuePath(globalPmRoot));\n const current = raw === null ? [] : parsePendingOtelSpanLines(raw);\n const reconciled: PendingOtelSpan[] = [];\n for (const entry of current) {\n if (succeededIds.has(entry.id)) {\n continue;\n }\n const failure = failedUpdates.get(entry.id);\n reconciled.push(failure ? { ...entry, attempts: failure.attempts, next_attempt_after: failure.next_attempt_after } : entry);\n }\n const { entries: retained } = prunePendingOtelSpans(reconciled, retentionDays);\n await rewritePendingOtelSpans(globalPmRoot, retained);\n return retained.length;\n });\n}\n\nasync function flushPendingOtelSpans(globalPmRoot: string, retentionDays: number): Promise<void> {\n const raw = await readFileIfExists(otelSpansQueuePath(globalPmRoot));\n if (raw === null || raw.trim().length === 0) {\n await writeRuntimeState(globalPmRoot, { pending_otel_spans: 0 });\n return;\n }\n const entries = parsePendingOtelSpanLines(raw);\n const { entries: retained, prunedCount } = prunePendingOtelSpans(entries, retentionDays);\n const due = retained.filter((entry) => isDueForRetryAt(entry.next_attempt_after)).slice(\n 0,\n TELEMETRY_OTEL_SPANS_FLUSH_BATCH_SIZE,\n );\n if (due.length === 0) {\n // Nothing to POST. Still reconcile so pruning persists, but only if pruning\n // actually changed the on-disk set (avoids a redundant rewrite each command).\n const remaining = prunedCount > 0 ? await reconcilePendingOtelSpansAfterFlush(globalPmRoot, retentionDays, new Set(), new Map()) : retained.length;\n await writeRuntimeState(globalPmRoot, { pending_otel_spans: remaining });\n return;\n }\n\n const attemptTime = nowIso();\n const succeededIds = new Set<string>();\n const failedUpdates = new Map<string, { attempts: number; next_attempt_after: string }>();\n let succeededCount = 0;\n let lastError: string | undefined;\n // Export the batch concurrently so a slow/blackholed collector caps the worker\n // at one TELEMETRY_HTTP_TIMEOUT_MS rather than batch-size x timeout — keeping it\n // well within the flush-lock TTL. The Set/Map/counter mutations are synchronous\n // and safe under Node's single-threaded event loop.\n await Promise.all(\n due.map(async (span) => {\n try {\n const response = await fetch(span.endpoint, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(span.payload),\n signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS),\n });\n if (!response.ok) {\n throw new Error(`local_otel_export_http_${response.status}`);\n }\n succeededIds.add(span.id);\n succeededCount += 1;\n } catch (error: unknown) {\n lastError = error instanceof Error ? sanitizeString(error.message, \"redacted\") : \"local_otel_export_failed\";\n const nextAttempts = span.attempts + 1;\n failedUpdates.set(span.id, { attempts: nextAttempts, next_attempt_after: nextRetryIso(nextAttempts) });\n }\n }),\n );\n\n const remaining = await reconcilePendingOtelSpansAfterFlush(globalPmRoot, retentionDays, succeededIds, failedUpdates);\n const statePatch: TelemetryRuntimeState = {\n pending_otel_spans: remaining,\n last_otel_attempt_at: attemptTime,\n };\n if (succeededCount > 0) {\n statePatch.last_otel_success_at = attemptTime;\n }\n if (lastError !== undefined) {\n statePatch.last_otel_failure_at = attemptTime;\n statePatch.last_otel_failure_error = lastError;\n } else if (remaining === 0) {\n // Only clear the failure diagnostic once the queue is fully drained. A\n // clean batch while other (not-yet-due) spans still wait could be hiding\n // earlier failures; keep the last known failure until nothing is pending.\n statePatch.last_otel_failure_at = undefined;\n statePatch.last_otel_failure_error = undefined;\n }\n await writeRuntimeState(globalPmRoot, statePatch);\n}\n\n/**\n * Flush both telemetry artifacts under the same worker invocation: the event\n * ingest queue and the pending OTLP span queue. Used by the detached flush\n * worker and the inline (test) path so OTLP export always happens off the\n * foreground command's critical path.\n */\nasync function flushTelemetryArtifacts(globalPmRoot: string, endpoint: string, retentionDays: number): Promise<void> {\n // Isolate the two artifacts: a failure flushing the event queue (e.g. a corrupt\n // queue file) must not strand the OTLP span flush in the same pass, and vice\n // versa. Both are best effort and retried on the next dispatch.\n try {\n await flushQueue(globalPmRoot, endpoint, retentionDays);\n } catch {\n // Best effort; event-queue flush is retried on the next dispatch.\n }\n try {\n await flushPendingOtelSpans(globalPmRoot, retentionDays);\n } catch {\n // Best effort; span flush is retried on the next dispatch.\n }\n}\n\nasync function cleanupTelemetryQueueTempOrphans(\n globalPmRoot: string,\n maxAgeMs = TELEMETRY_QUEUE_TMP_ORPHAN_MAX_AGE_MS,\n): Promise<void> {\n try {\n const dirPath = telemetryRuntimeDirectory(globalPmRoot);\n const entries = await readdir(dirPath, { withFileTypes: true });\n const cutoffMs = Date.now() - Math.max(0, maxAgeMs);\n await Promise.all(\n entries\n .filter((entry) => entry.isFile() && /^\\.events\\.jsonl\\.\\d+\\.\\d+\\.[a-f0-9]+\\.tmp$/.test(entry.name))\n .map(async (entry) => {\n const candidate = path.join(dirPath, entry.name);\n const candidateStats = await stat(candidate);\n if (candidateStats.mtimeMs < cutoffMs) {\n await rm(candidate, { force: true });\n }\n }),\n );\n } catch {\n // Telemetry cleanup is best-effort and must not affect command execution.\n }\n}\n\nasync function withQueueMutation<T>(operation: () => Promise<T>): Promise<T> {\n const run = _queueMutationPromise.catch(\n /* c8 ignore next */\n () => {},\n ).then(operation);\n _queueMutationPromise = run.catch(\n /* c8 ignore next */\n () => {},\n );\n return run;\n}\n\nasync function readCurrentQueueEntries(globalPmRoot: string): Promise<QueuedTelemetryEvent[]> {\n const raw = await readFileIfExists(queuePath(globalPmRoot));\n if (raw === null || raw.trim().length === 0) {\n return [];\n }\n return parseQueueLines(raw);\n}\n\nasync function removeFlushedEntriesFromCurrentQueue(\n globalPmRoot: string,\n flushedIds: ReadonlySet<string>,\n retentionDays: number,\n): Promise<QueuedTelemetryEvent[]> {\n return withQueueMutation(async () => {\n const currentEntries = await readCurrentQueueEntries(globalPmRoot);\n const { entries: retainedEntries } = pruneExpiredQueueEntries(currentEntries, retentionDays);\n const remaining = retainedEntries.filter((entry) => !flushedIds.has(entry.event.event_id));\n await rewriteQueue(globalPmRoot, remaining);\n return remaining;\n });\n}\n\nasync function markFailedEntriesInCurrentQueue(\n globalPmRoot: string,\n failedIds: ReadonlySet<string>,\n attemptTime: string,\n retentionDays: number,\n): Promise<QueuedTelemetryEvent[]> {\n return withQueueMutation(async () => {\n const currentEntries = await readCurrentQueueEntries(globalPmRoot);\n const { entries: retainedEntries } = pruneExpiredQueueEntries(currentEntries, retentionDays);\n const retried = retainedEntries.map((entry) => {\n if (!failedIds.has(entry.event.event_id)) {\n return entry;\n }\n const attempts = entry.attempts + 1;\n return {\n ...entry,\n attempts,\n last_attempt_at: attemptTime,\n next_attempt_after: nextRetryIso(attempts),\n };\n });\n await rewriteQueue(globalPmRoot, retried);\n return retried;\n });\n}\n\nasync function flushQueue(globalPmRoot: string, endpoint: string, retentionDays: number): Promise<void> {\n await cleanupTelemetryQueueTempOrphans(globalPmRoot);\n const normalizedEndpoint = endpoint.trim();\n if (normalizedEndpoint.length === 0) {\n return;\n }\n const raw = await readFileIfExists(queuePath(globalPmRoot));\n if (raw === null || raw.trim().length === 0) {\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: 0,\n });\n return;\n }\n const queueEntries = parseQueueLines(raw);\n if (queueEntries.length === 0) {\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: 0,\n });\n return;\n }\n const { entries: retainedEntries, prunedCount } = pruneExpiredQueueEntries(queueEntries, retentionDays);\n if (retainedEntries.length === 0) {\n await rewriteQueue(globalPmRoot, []);\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: 0,\n });\n return;\n }\n const dueEntries = retainedEntries.filter((entry) => isDueForRetry(entry)).slice(0, TELEMETRY_FLUSH_BATCH_SIZE);\n if (dueEntries.length === 0) {\n if (prunedCount > 0) {\n await rewriteQueue(globalPmRoot, retainedEntries);\n }\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: retainedEntries.length,\n });\n return;\n }\n const dueIds = new Set(dueEntries.map((entry) => entry.event.event_id));\n const attemptTime = nowIso();\n const requestHeaders: Record<string, string> = {\n \"content-type\": \"application/json\",\n };\n const ingestKey = process.env.PM_TELEMETRY_INGEST_KEY?.trim();\n if (ingestKey) {\n requestHeaders[\"x-pm-telemetry-key\"] = ingestKey;\n }\n\n try {\n const response = await fetch(normalizedEndpoint, {\n method: \"POST\",\n headers: requestHeaders,\n body: JSON.stringify({\n schema_version: TELEMETRY_SCHEMA_VERSION,\n events: dueEntries.map((entry) => entry.event),\n }),\n signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS),\n });\n if (!response.ok) {\n throw new Error(`telemetry_flush_http_${response.status}`);\n }\n } catch (error: unknown) {\n const retried = await markFailedEntriesInCurrentQueue(globalPmRoot, dueIds, attemptTime, retentionDays);\n const errorMessage = (() => {\n if (error instanceof Error) {\n return sanitizeString(error.message, \"redacted\");\n }\n return \"telemetry_flush_failed\";\n })();\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: retried.length,\n last_attempted_flush_at: attemptTime,\n last_failed_flush_at: attemptTime,\n last_failed_flush_error: errorMessage,\n });\n return;\n }\n\n try {\n const remaining = await removeFlushedEntriesFromCurrentQueue(globalPmRoot, dueIds, retentionDays);\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: remaining.length,\n last_attempted_flush_at: attemptTime,\n last_successful_flush_at: attemptTime,\n last_failed_flush_at: undefined,\n last_failed_flush_error: undefined,\n });\n /* c8 ignore start */\n } catch (error: unknown) {\n const errorMessage = (() => {\n if (error instanceof Error) {\n return sanitizeString(error.message, \"redacted\");\n }\n return \"telemetry_flush_failed\";\n })();\n const currentEntries = await readCurrentQueueEntries(globalPmRoot).catch(() => retainedEntries);\n await writeRuntimeState(globalPmRoot, {\n endpoint: normalizedEndpoint,\n queue_entries: currentEntries.length,\n last_attempted_flush_at: attemptTime,\n last_failed_flush_at: attemptTime,\n last_failed_flush_error: errorMessage,\n });\n }\n /* c8 ignore stop */\n}\n\nasync function acquireTelemetryFlushLock(globalPmRoot: string): Promise<boolean> {\n const lockPath = flushLockPath(globalPmRoot);\n await mkdir(path.dirname(lockPath), { recursive: true });\n try {\n await mkdir(lockPath);\n return true;\n } catch (error: unknown) {\n if (typeof error !== \"object\" || error === null || !(\"code\" in error) || (error as { code?: unknown }).code !== \"EEXIST\") {\n throw error;\n }\n }\n\n try {\n const lockStats = await stat(lockPath);\n if (Date.now() - lockStats.mtimeMs < TELEMETRY_FLUSH_LOCK_STALE_MS) {\n return false;\n }\n await rm(lockPath, { recursive: true, force: true });\n await mkdir(lockPath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isFreshDirectoryLock(lockPath: string, staleMs: number): boolean {\n try {\n return Date.now() - statSync(lockPath).mtimeMs < staleMs;\n } catch {\n return false;\n }\n}\n\nfunction removeDirectoryLockBestEffort(lockPath: string): void {\n try {\n rmSync(lockPath, { recursive: true, force: true });\n } catch {\n // Flush scheduling is best effort and must never fail user commands.\n }\n}\n\nfunction errorCode(error: unknown): string | undefined {\n if (typeof error !== \"object\" || error === null || !(\"code\" in error)) {\n return undefined;\n }\n const code = (error as { code?: unknown }).code;\n return typeof code === \"string\" ? code : undefined;\n}\n\nfunction createDirectoryLock(lockPath: string): boolean {\n try {\n mkdirSync(lockPath);\n return true;\n } catch (error: unknown) {\n const code = errorCode(error);\n if (code === \"EEXIST\") {\n return false;\n }\n if (code !== \"ENOENT\") {\n return false;\n }\n }\n\n /* c8 ignore start */\n try {\n mkdirSync(path.dirname(lockPath), { recursive: true });\n mkdirSync(lockPath);\n return true;\n } catch {\n return false;\n }\n /* c8 ignore stop */\n}\n\nfunction acquireTelemetryFlushSpawnGate(globalPmRoot: string): boolean {\n if (isFreshDirectoryLock(flushLockPath(globalPmRoot), TELEMETRY_FLUSH_LOCK_STALE_MS)) {\n return false;\n }\n\n const lockPath = flushSpawnLockPath(globalPmRoot);\n try {\n if (Date.now() - statSync(lockPath).mtimeMs < TELEMETRY_FLUSH_SPAWN_LOCK_STALE_MS) {\n return false;\n }\n removeDirectoryLockBestEffort(lockPath);\n } catch (error: unknown) {\n if (errorCode(error) !== \"ENOENT\") {\n return false;\n }\n }\n\n return createDirectoryLock(lockPath);\n}\n\nfunction releaseTelemetryFlushSpawnGate(globalPmRoot: string): void {\n removeDirectoryLockBestEffort(flushSpawnLockPath(globalPmRoot));\n}\n\nexport const _testOnly = {\n acquireTelemetryFlushSpawnGate,\n acquireTelemetryFlushLock,\n buildAuthorContextPayloadFields,\n buildCommandErrorPayload,\n buildCommandFinishPayload,\n buildCommandStartPayload,\n buildOtelSpanRequest,\n createDirectoryLock,\n enqueuePendingOtelSpan,\n enqueueTelemetryEvent,\n errorCode,\n flushPendingOtelSpans,\n flushQueue,\n flushQueueWithProcessLock,\n flushTelemetryArtifacts,\n hashTelemetryErrorFingerprint,\n hashTelemetryValue,\n isEmailDomainCharacter,\n isEmailLocalCharacter,\n isExpiredPendingOtelSpan,\n isExpiredQueueEntry,\n isFreshDirectoryLock,\n isDueForRetry,\n isDueForRetryAt,\n isRetryableQueueRewriteError,\n looksLikeEmailToken,\n otelSpansQueuePath,\n parseBooleanTrueLike,\n parsePendingOtelSpanLines,\n prunePendingOtelSpans,\n reconcilePendingOtelSpansAfterFlush,\n retentionCutoffMs,\n resolveOtelTracesEndpoint,\n rewritePendingOtelSpans,\n normalizeForHash,\n normalizeCaptureLevel,\n normalizePmVersion,\n normalizeTelemetryErrorCategory,\n normalizeTelemetryErrorCode,\n normalizeTelemetryExitCode,\n parseQueueLines,\n pruneExpiredQueueEntries,\n readRuntimeState,\n readCurrentQueueEntries,\n releaseTelemetryFlushSpawnGate,\n removeFlushedEntriesFromCurrentQueue,\n removeDirectoryLockBestEffort,\n resolveTelemetrySourceContext,\n rewriteQueue,\n sanitizeCommandArgs,\n sanitizeStringMax,\n sanitizeStringRedacted,\n sanitizeValue,\n scheduleTelemetryFlush,\n shouldFlushInline,\n sleep,\n summarizeResult,\n telemetryFlushRunnerPath,\n withQueueMutation,\n flushLockPath,\n flushSpawnLockPath,\n runtimeStatePath,\n writeRuntimeState,\n};\n\nasync function flushQueueWithProcessLock(globalPmRoot: string, endpoint: string, retentionDays: number): Promise<void> {\n const acquired = await acquireTelemetryFlushLock(globalPmRoot);\n releaseTelemetryFlushSpawnGate(globalPmRoot);\n if (!acquired) {\n return;\n }\n try {\n await flushTelemetryArtifacts(globalPmRoot, endpoint, retentionDays);\n } finally {\n try {\n await rm(flushLockPath(globalPmRoot), { recursive: true, force: true });\n } catch {\n // Best effort lock cleanup; stale locks are recovered by TTL checks.\n }\n }\n}\n\nfunction scheduleTelemetryFlush(globalPmRoot: string, endpoint: string, retentionDays: number): void {\n if (shouldFlushInline()) {\n const previousFlush = _lastFlushPromise;\n const nextFlush = flushTelemetryArtifacts(globalPmRoot, endpoint, retentionDays);\n _lastFlushPromise = Promise.allSettled([previousFlush, nextFlush]).then(() => {});\n return;\n }\n\n try {\n const acquiredSpawnGate = acquireTelemetryFlushSpawnGate(globalPmRoot);\n if (!acquiredSpawnGate) {\n return;\n }\n const child = spawn(process.execPath, [telemetryFlushRunnerPath()], {\n detached: true,\n stdio: \"ignore\",\n // Detached workers inherit cwd by default. On Windows that can keep a\n // disposable project directory locked after the foreground command exits.\n cwd: os.tmpdir(),\n env: {\n ...process.env,\n PM_GLOBAL_PATH: globalPmRoot,\n [PM_TELEMETRY_FLUSH_CHILD_ENV]: \"1\",\n },\n });\n // A detached spawn can fail asynchronously — the runtime cannot launch the\n // executable (locked-down Windows runners, missing flush runner, EACCES).\n // Node re-throws an 'error' event with no listener as an uncaught exception,\n // which would crash the foreground CLI and, under the test runner, the\n // vitest worker during teardown (GH-348). Flush is strictly best effort, so\n // swallow the failure and release the spawn gate to permit a later retry.\n child.on(\"error\", () => {\n releaseTelemetryFlushSpawnGate(globalPmRoot);\n });\n child.unref();\n } catch {\n releaseTelemetryFlushSpawnGate(globalPmRoot);\n // Flush scheduling is best effort and must not keep the CLI alive.\n }\n}\n\n/**\n * Implements flush telemetry queue now for the public runtime surface of this module.\n */\nexport async function flushTelemetryQueueNow(globalPmRoot = resolveGlobalPmRoot(process.cwd())): Promise<void> {\n if (telemetryDisabledByEnvironment()) {\n return;\n }\n try {\n const settings = await readSettings(globalPmRoot);\n if (!settings.telemetry.enabled) {\n return;\n }\n const { endpoint, retentionDays } = await ensureInstallationId(globalPmRoot);\n await flushQueueWithProcessLock(globalPmRoot, endpoint, retentionDays);\n } catch {\n // Telemetry workers are best effort and must never fail user commands.\n }\n}\n\n/**\n * Implements start telemetry command for the public runtime surface of this module.\n */\nexport async function startTelemetryCommand(context: TelemetryCommandContext): Promise<ActiveTelemetryCommand | null> {\n if (telemetryDisabledByEnvironment()) {\n return null;\n }\n if (\n context.command === \"telemetry\" &&\n context.args.some((token) => token.trim().toLowerCase() === \"clear\")\n ) {\n return null;\n }\n try {\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const settings = await readSettings(globalPmRoot);\n if (!settings.telemetry.enabled) {\n return null;\n }\n const captureLevel = normalizeCaptureLevel(settings.telemetry.capture_level);\n const { installationId, endpoint, retentionDays } = await ensureInstallationId(globalPmRoot);\n const pmVersion = normalizePmVersion(context.pm_version);\n const sourceContext = resolveTelemetrySourceContext(context.global);\n const pmRootHash = hashWithInstallationId(installationId, context.pm_root);\n const cwdHash = hashWithInstallationId(installationId, process.cwd());\n const otelTracesEndpoint = resolveOtelTracesEndpoint();\n const occurredAt = nowIso();\n const event: TelemetryEvent = {\n schema_version: TELEMETRY_SCHEMA_VERSION,\n event_id: crypto.randomUUID(),\n event_type: \"command_start\",\n occurred_at: occurredAt,\n installation_id: installationId,\n session_id: PROCESS_SESSION_ID,\n command: context.command,\n payload: buildCommandStartPayload({\n captureLevel,\n context,\n pmVersion,\n sourceContext,\n pmRootHash,\n cwdHash,\n installationId,\n }),\n };\n await enqueueTelemetryEvent(globalPmRoot, event);\n scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays);\n const commandTaxonomy = deriveTelemetryCommandTaxonomy(context.command);\n return {\n started_at: occurredAt,\n started_at_ms: Date.now(),\n command: context.command,\n command_taxonomy: commandTaxonomy,\n pm_version: pmVersion,\n source_context: sourceContext.source_context,\n source_context_source: sourceContext.source_context_source,\n installation_id: installationId,\n pm_root_hash: pmRootHash,\n cwd_hash: cwdHash,\n endpoint,\n retention_days: retentionDays,\n global_pm_root: globalPmRoot,\n capture_level: captureLevel,\n otel_traces_endpoint: otelTracesEndpoint ?? undefined,\n otel_trace_id: otelTracesEndpoint ? crypto.randomBytes(16).toString(\"hex\") : undefined,\n otel_span_id: otelTracesEndpoint ? crypto.randomBytes(8).toString(\"hex\") : undefined,\n };\n } catch {\n // Telemetry must never block command execution.\n return null;\n }\n}\n\n/**\n * Implements finish telemetry command for the public runtime surface of this module.\n */\nexport async function finishTelemetryCommand(\n activeCommand: ActiveTelemetryCommand | null,\n outcome: TelemetryCommandOutcome,\n): Promise<void> {\n if (!activeCommand) {\n return;\n }\n try {\n const finishedAt = nowIso();\n const durationMs = Math.max(0, Date.now() - activeCommand.started_at_ms);\n const normalizedErrorCode = normalizeTelemetryErrorCode(\n inferTelemetryErrorCode({\n ok: outcome.ok,\n errorCode: outcome.error_code,\n errorMessage: outcome.error,\n exitCode: outcome.exit_code,\n }),\n );\n const normalizedErrorCategory = normalizeTelemetryErrorCategory({\n ok: outcome.ok,\n errorCode: normalizedErrorCode,\n errorCategory: outcome.error_category,\n });\n const normalizedExitCode = normalizeTelemetryExitCode(outcome.exit_code, outcome.ok);\n const commandResolution =\n outcome.command_resolution ??\n deriveTelemetryCommandResolution({\n ok: outcome.ok,\n errorCode: normalizedErrorCode,\n errorCategory: normalizedErrorCategory,\n });\n const resolutionStage = outcome.resolution_stage ?? \"execute\";\n const event: TelemetryEvent = {\n schema_version: TELEMETRY_SCHEMA_VERSION,\n event_id: crypto.randomUUID(),\n event_type: \"command_finish\",\n occurred_at: finishedAt,\n installation_id: activeCommand.installation_id,\n session_id: PROCESS_SESSION_ID,\n command: activeCommand.command,\n payload: buildCommandFinishPayload({\n captureLevel: activeCommand.capture_level,\n pmVersion: activeCommand.pm_version,\n sourceContext: {\n source_context: activeCommand.source_context,\n source_context_source: activeCommand.source_context_source,\n },\n outcome,\n durationMs,\n startedAt: activeCommand.started_at,\n command: activeCommand.command,\n installationId: activeCommand.installation_id,\n commandTaxonomy: activeCommand.command_taxonomy,\n exitCode: normalizedExitCode,\n errorCode: normalizedErrorCode,\n errorCategory: normalizedErrorCategory,\n commandResolution,\n resolutionStage,\n }),\n };\n await enqueueTelemetryEvent(activeCommand.global_pm_root, event);\n const otelRequest = buildOtelSpanRequest(\n activeCommand,\n {\n ...outcome,\n exit_code: normalizedExitCode,\n error_code: normalizedErrorCode,\n error_category: normalizedErrorCategory,\n },\n finishedAt,\n durationMs,\n );\n if (otelRequest) {\n // Persist the span for the detached worker; never POST inline so the\n // foreground command exits promptly even if the traces endpoint is\n // unreachable (GH-209).\n await enqueuePendingOtelSpan(activeCommand.global_pm_root, otelRequest);\n }\n scheduleTelemetryFlush(activeCommand.global_pm_root, activeCommand.endpoint, activeCommand.retention_days);\n } catch {\n // Telemetry must never block command execution.\n }\n}\n\n/**\n * Implements emit telemetry error event for the public runtime surface of this module.\n */\nexport async function emitTelemetryErrorEvent(context: TelemetryErrorEventContext): Promise<void> {\n if (telemetryDisabledByEnvironment()) {\n return;\n }\n try {\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const settings = await readSettings(globalPmRoot);\n if (!settings.telemetry.enabled) {\n return;\n }\n const captureLevel = normalizeCaptureLevel(settings.telemetry.capture_level);\n const { installationId, endpoint, retentionDays } = await ensureInstallationId(globalPmRoot);\n const pmVersion = normalizePmVersion(context.pm_version);\n const sourceContext = resolveTelemetrySourceContext(context.global);\n const pmRootHash = hashWithInstallationId(installationId, context.pm_root);\n const cwdHash = hashWithInstallationId(installationId, process.cwd());\n const occurredAt = nowIso();\n const normalizedErrorCode =\n normalizeTelemetryErrorCode(\n inferTelemetryErrorCode({\n ok: false,\n errorCode: context.error_code,\n errorMessage: context.error_message,\n exitCode: context.exit_code,\n }),\n ) as string;\n const normalizedErrorCategory =\n context.error_category ?? resolveTelemetryErrorCategory(normalizedErrorCode);\n const normalizedExitCode = normalizeTelemetryExitCode(context.exit_code, false);\n const normalizedCommand = context.command.trim().length > 0 ? context.command : \"<unknown>\";\n const commandTaxonomy = deriveTelemetryCommandTaxonomy(normalizedCommand);\n const commandResolution =\n context.command_resolution ??\n deriveTelemetryCommandResolution({\n ok: false,\n errorCode: normalizedErrorCode,\n errorCategory: normalizedErrorCategory,\n });\n const resolutionStage = context.resolution_stage ?? \"unknown\";\n\n const event: TelemetryEvent = {\n schema_version: TELEMETRY_SCHEMA_VERSION,\n event_id: crypto.randomUUID(),\n event_type: \"command_error\",\n occurred_at: occurredAt,\n installation_id: installationId,\n session_id: PROCESS_SESSION_ID,\n command: sanitizeString(normalizedCommand, \"redacted\"),\n payload: buildCommandErrorPayload({\n captureLevel,\n pmVersion,\n sourceContext,\n command: normalizedCommand,\n commandTaxonomy,\n commandResolution,\n resolutionStage,\n args: context.args,\n options: context.options,\n pmRootHash,\n cwdHash,\n installationId,\n errorCode: normalizedErrorCode,\n errorCategory: normalizedErrorCategory,\n exitCode: normalizedExitCode,\n errorMessage: context.error_message,\n }),\n };\n await enqueueTelemetryEvent(globalPmRoot, event);\n scheduleTelemetryFlush(globalPmRoot, endpoint, retentionDays);\n } catch {\n // Telemetry must never block command execution.\n }\n}\n"],"names":["errorCode","errorCode","remaining"],"mappings":";;;;;;;;;;;;;;;;;;AAoDA,IAAM,sBAAsB,oBAAI,IAAI,CAAC,QAAQ,UAAU,cAAc,uBAAuB,mBAAmB,kBAAkB,CAAC;AAClI,IAAM,sBAAsB,oBAAI,IAAI;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD,IAAM,yBAAyB,oBAAI,IAAI;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AACD,IAAM,wBAAwB,oBAAI,IAAI,CAAC,QAAQ,YAAY,aAAa,eAAe,cAAc,WAAW,CAAC;AACjH,IAAM,4BAA4B,oBAAI,IAAI,CAAC,UAAU,YAAY,aAAa,WAAW,MAAM,aAAa,kBAAkB,CAAC;AAE/H,SAAS,qBAAqB,aAAmB;AAC/C,SAAO,YACJ,KAAI,EACJ,WAAW,QAAQ,GAAG,EACtB,YAAW;AAChB;AAEA,SAAS,mBAAmBA,YAA6B;AACvD,QAAM,aAAaA,YAAW,KAAI,EAAG,YAAW;AAChD,SAAO,cAAc,WAAW,SAAS,IAAI,aAAa;AAC5D;AAEA,IAAM,sCAAkF;EACtF,EAAE,MAAM,mBAAmB,SAAS,CAAC,YAAY,QAAQ,SAAS,iBAA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