@unbrained/pm-cli 2026.6.10 → 2026.6.12
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/dist/cli/bootstrap-args.d.ts +11 -0
- package/dist/cli/bootstrap-args.js +88 -4
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/commands/completion.js +20 -8
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/contracts.d.ts +2 -0
- package/dist/cli/commands/contracts.js +9 -2
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.js +6 -3
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/docs.d.ts +2 -0
- package/dist/cli/commands/docs.js +2 -2
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/files.d.ts +2 -0
- package/dist/cli/commands/files.js +2 -2
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/health.d.ts +1 -1
- package/dist/cli/commands/health.js +77 -2
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-repair.d.ts +36 -0
- package/dist/cli/commands/history-repair.js +68 -3
- package/dist/cli/commands/history-repair.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/index.js +3 -3
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/linked-artifacts.d.ts +18 -0
- package/dist/cli/commands/linked-artifacts.js +26 -3
- package/dist/cli/commands/linked-artifacts.js.map +1 -1
- package/dist/cli/commands/plan.d.ts +6 -0
- package/dist/cli/commands/plan.js +93 -32
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +20 -0
- package/dist/cli/commands/validate.js +292 -28
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.d.ts +8 -0
- package/dist/cli/error-guidance.js +102 -2
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/help-content.js +7 -3
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/register-mutation.js +47 -16
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +10 -2
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +16 -16
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli-bundle/chunks/{activity-W6TS5F2L.js → activity-XADJOG6G.js} +11 -11
- package/dist/cli-bundle/chunks/activity-XZIUPGZH.js +16 -0
- package/dist/cli-bundle/chunks/{aggregate-UK2WJ4Z3.js → aggregate-6OTS3AOO.js} +10 -10
- package/dist/cli-bundle/chunks/{aggregate-NNJLKGEK.js → aggregate-OD36DJU5.js} +10 -10
- package/dist/cli-bundle/chunks/{append-DHGTLUZW.js → append-JYWO4P7W.js} +8 -8
- package/dist/cli-bundle/chunks/{append-7BS36Z2L.js → append-KG55G7S3.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-GF5XIBUH.js → chunk-35P4GT6E.js} +111 -10
- package/dist/cli-bundle/chunks/chunk-35P4GT6E.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-A6XVYNQJ.js → chunk-37CYVF73.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-XRE4CTNP.js → chunk-3KLPFWZ4.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-WSWOQP3Z.js → chunk-4HFU4UO2.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UNH3KSHG.js → chunk-4JCSYR6F.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-73PSHEMT.js → chunk-4YFAGDRH.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-7GYMMDDW.js → chunk-5SCT2JCT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q6PSD5DZ.js → chunk-73ZPG2I3.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-XH6RA5A5.js → chunk-7AMK6DOW.js} +15 -15
- package/dist/cli-bundle/chunks/{chunk-XH6RA5A5.js.map → chunk-7AMK6DOW.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-CTW7QAHM.js → chunk-7IYFN5R7.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-OSGWBWLK.js → chunk-7UGSRQCL.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-WNMRICXH.js → chunk-A6LXQFO7.js} +4 -3
- package/dist/cli-bundle/chunks/chunk-A6LXQFO7.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-UDWUDUJI.js → chunk-ATEES5SX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2MKBPWMK.js → chunk-AVGHVVF7.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-ZH7C7ZVX.js → chunk-AX4GEVQC.js} +14 -14
- package/dist/cli-bundle/chunks/{chunk-ZH7C7ZVX.js.map → chunk-AX4GEVQC.js.map} +2 -2
- package/dist/cli-bundle/chunks/chunk-C6SAP27O.js +187 -0
- package/dist/cli-bundle/chunks/chunk-C6SAP27O.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-344GDQTH.js → chunk-CCX4RSYZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6KQS23TX.js → chunk-CW6E4NAT.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-K45NAJV2.js → chunk-DY6C42S6.js} +9 -9
- package/dist/cli-bundle/chunks/chunk-EKS6O2IR.js +217 -0
- package/dist/cli-bundle/chunks/chunk-EKS6O2IR.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ANVZCNL5.js → chunk-ESANVZF4.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-6OSG3EMX.js → chunk-EWFY7SLA.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-DMDEC4QP.js → chunk-F75JSIOZ.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-TALBUVWF.js → chunk-FDH2X65L.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OQGJSCZZ.js → chunk-FY4SPXSC.js} +3 -2
- package/dist/cli-bundle/chunks/chunk-FY4SPXSC.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-TZLGCTA5.js → chunk-GKIZW7SM.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UMWF6ZAS.js → chunk-GWZSYR6X.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KHBRV5JU.js → chunk-HGLC63AU.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-CMEHZD6G.js → chunk-HHHJ2GI3.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-MF6KSSMF.js → chunk-HI7STVF2.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-IEQ3N7WP.js → chunk-I2IJY2NL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O64EYNHF.js → chunk-I53JBTJW.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-K7SXBA75.js → chunk-I7NYDZDV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WBU257Z4.js → chunk-IGVJRZ6H.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-7TW64BS5.js → chunk-IUKD4W6Z.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DTRIVUTN.js → chunk-KBPQHXWG.js} +21 -8
- package/dist/cli-bundle/chunks/chunk-KBPQHXWG.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-OVNSQHDG.js → chunk-KWAXVAXX.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-WWEFBBVF.js → chunk-L5EPZQIC.js} +12 -12
- package/dist/cli-bundle/chunks/chunk-NAWVUHXH.js +220 -0
- package/dist/cli-bundle/chunks/chunk-NAWVUHXH.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-6ADVKPVV.js → chunk-OASDW5UI.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-EIS32UA4.js → chunk-OLKBSY4N.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X3IPJU2O.js → chunk-P5BJOMBB.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-LYL32FT6.js → chunk-P5U5EOMA.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-EAQLLID6.js → chunk-PNYAAB4S.js} +21 -188
- package/dist/cli-bundle/chunks/chunk-PNYAAB4S.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-TV6FZGVK.js → chunk-QJMGRZO2.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KMMUDSSB.js → chunk-QKW5D45B.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-4H2NDEGJ.js → chunk-QNJSITCX.js} +7 -7
- package/dist/cli-bundle/chunks/chunk-R2OUQVBK.js +190 -0
- package/dist/cli-bundle/chunks/chunk-R2OUQVBK.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-XSCGU4WT.js → chunk-R4VWYWRN.js} +19 -193
- package/dist/cli-bundle/chunks/chunk-R4VWYWRN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VSS3CSTF.js → chunk-RXAP6JL5.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-3VTWCBXL.js → chunk-S26FESD4.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-DEYNERFX.js → chunk-S2ZLDYGS.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-QGIWURY3.js → chunk-SO55HRA5.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-F2PVV7IX.js → chunk-SXKNJPQ7.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-5OMABP7I.js → chunk-TK5VZFHY.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-UY26RIBR.js → chunk-TNAP7EJX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QJ2OIEOC.js → chunk-UIG4TW2H.js} +111 -10
- package/dist/cli-bundle/chunks/chunk-UIG4TW2H.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-SNASEDXB.js → chunk-UUWGCWBU.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-6N46IM44.js → chunk-VAOUX6TK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X5YC5DZM.js → chunk-VFUZV5EB.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-I2FM2SMO.js → chunk-VPEAS7PS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7DUVDW7C.js → chunk-VSRZRLG3.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GP6SHEAI.js → chunk-WPDMBIX6.js} +20 -7
- package/dist/cli-bundle/chunks/chunk-WPDMBIX6.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PYULT32I.js → chunk-WUNFKP7M.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LUJQJR7G.js → chunk-XJDGS74Y.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-TXWMLDMG.js → chunk-XMBI6TNW.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-4CYHWHZU.js → chunk-XTKJSVWH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-T6QLB34N.js → chunk-XUC4C4PT.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KRZQGRVL.js → chunk-XWMF3POR.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-OROMGSBP.js → chunk-Y3YKK7CY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D6JZBUZ6.js → chunk-YW6Q3RYZ.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-GRHPU6EM.js → chunk-ZLMIWZUG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5HH6QRH5.js → chunk-ZMW77VWV.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-BE5G7HEL.js → chunk-ZYNJNPYD.js} +4 -4
- package/dist/cli-bundle/chunks/{claim-3TY5LE54.js → claim-2RDYMCTP.js} +10 -10
- package/dist/cli-bundle/chunks/{claim-LM4YY6QQ.js → claim-MJ7DZFC3.js} +10 -10
- package/dist/cli-bundle/chunks/close-4FMAPEMY.js +13 -0
- package/dist/cli-bundle/chunks/{close-CSD4LEMT.js → close-XLEKIQSW.js} +8 -8
- package/dist/cli-bundle/chunks/{close-many-B5SHDX6W.js → close-many-AOD4HSAZ.js} +15 -15
- package/dist/cli-bundle/chunks/{close-many-WRXB5KVY.js → close-many-XKAQY5CQ.js} +15 -15
- package/dist/cli-bundle/chunks/{comments-BDDEK3VW.js → comments-B4RWWDJT.js} +10 -10
- package/dist/cli-bundle/chunks/{comments-A5ALOYTG.js → comments-RN5TG4ZN.js} +10 -10
- package/dist/cli-bundle/chunks/{config-W2NHDNQT.js → config-3JXJ3XZ7.js} +8 -8
- package/dist/cli-bundle/chunks/{config-YUYBMJOW.js → config-FZ4UDC4B.js} +8 -8
- package/dist/cli-bundle/chunks/{context-LRJ74NSU.js → context-L36PIN35.js} +13 -13
- package/dist/cli-bundle/chunks/{context-R2QLOJCK.js → context-QBPO3BFM.js} +13 -13
- package/dist/cli-bundle/chunks/{contracts-HJHR4NCD.js → contracts-2G66IGIA.js} +309 -6
- package/dist/cli-bundle/chunks/contracts-2G66IGIA.js.map +1 -0
- package/dist/cli-bundle/chunks/{contracts-47X7RYUF.js → contracts-PJCHYSO5.js} +315 -5
- package/dist/cli-bundle/chunks/contracts-PJCHYSO5.js.map +7 -0
- package/dist/cli-bundle/chunks/{copy-P4UVYZ7M.js → copy-ALU5WMHA.js} +7 -7
- package/dist/cli-bundle/chunks/{copy-B7HFOWFB.js → copy-FWIVTLBO.js} +7 -7
- package/dist/cli-bundle/chunks/{create-5ERJF64D.js → create-5433DP3G.js} +13 -13
- package/dist/cli-bundle/chunks/create-VWLWS34Z.js +27 -0
- package/dist/cli-bundle/chunks/{delete-LX3LGBCH.js → delete-IYTIYAJS.js} +7 -7
- package/dist/cli-bundle/chunks/{delete-S3WVK6LP.js → delete-Y2SGJBGY.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-YSM4LZQD.js → deps-6TSPOSGU.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-GWSNH7OZ.js → deps-CZ4PTVXU.js} +7 -7
- package/dist/cli-bundle/chunks/{docs-TG6JMVMY.js → docs-I3BAF5WH.js} +11 -11
- package/dist/cli-bundle/chunks/docs-I3BAF5WH.js.map +1 -0
- package/dist/cli-bundle/chunks/{docs-7RYFBHQD.js → docs-MXLGZUIT.js} +10 -10
- package/dist/cli-bundle/chunks/docs-MXLGZUIT.js.map +7 -0
- package/dist/cli-bundle/chunks/{extension-R3LUKMX7.js → extension-Q34OEWO5.js} +5 -5
- package/dist/cli-bundle/chunks/{extension-VNMRKIHI.js → extension-WH2FOIOZ.js} +5 -5
- package/dist/cli-bundle/chunks/{files-KAKU57OT.js → files-FYP3MDPX.js} +10 -10
- package/dist/cli-bundle/chunks/files-FYP3MDPX.js.map +7 -0
- package/dist/cli-bundle/chunks/{files-QB3EYPMO.js → files-GUXUM2MB.js} +11 -11
- package/dist/cli-bundle/chunks/files-GUXUM2MB.js.map +1 -0
- package/dist/cli-bundle/chunks/{gc-KNUPLPSW.js → gc-FENB2ESG.js} +14 -176
- package/dist/cli-bundle/chunks/gc-FENB2ESG.js.map +1 -0
- package/dist/cli-bundle/chunks/{gc-B747VM4M.js → gc-KGQG66SA.js} +12 -181
- package/dist/cli-bundle/chunks/gc-KGQG66SA.js.map +7 -0
- package/dist/cli-bundle/chunks/{get-GMGLIQ5I.js → get-PCHS7RA6.js} +11 -11
- package/dist/cli-bundle/chunks/{get-SBL6NHYQ.js → get-QARTE6BL.js} +11 -11
- package/dist/cli-bundle/chunks/{health-WWZJ5KJS.js → health-7MTXAVR2.js} +82 -15
- package/dist/cli-bundle/chunks/health-7MTXAVR2.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-IG43Z4KL.js → health-E4D7KGHD.js} +83 -16
- package/dist/cli-bundle/chunks/health-E4D7KGHD.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-XCWRXBXC.js → history-7WUAEWHW.js} +10 -10
- package/dist/cli-bundle/chunks/history-L2FQFRTU.js +20 -0
- package/dist/cli-bundle/chunks/{history-compact-KICKUCR7.js → history-compact-3EJ3L2O7.js} +11 -11
- package/dist/cli-bundle/chunks/{history-compact-IDH7E7VN.js → history-compact-LW27IPFK.js} +11 -11
- package/dist/cli-bundle/chunks/{history-redact-JJWH3QWK.js → history-redact-G72A4EJ4.js} +11 -11
- package/dist/cli-bundle/chunks/history-redact-QWQCX5DZ.js +19 -0
- package/dist/cli-bundle/chunks/{history-repair-N5HXKJOI.js → history-repair-OSQOKJ3E.js} +71 -13
- package/dist/cli-bundle/chunks/history-repair-OSQOKJ3E.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-repair-7HWBZKXN.js → history-repair-SBK7P34V.js} +72 -14
- package/dist/cli-bundle/chunks/history-repair-SBK7P34V.js.map +1 -0
- package/dist/cli-bundle/chunks/init-4BKRHGWW.js +17 -0
- package/dist/cli-bundle/chunks/{init-OQA3TWIS.js → init-S5WEGUJY.js} +9 -9
- package/dist/cli-bundle/chunks/{learnings-L7VQUSVI.js → learnings-HQXSSKZ5.js} +10 -10
- package/dist/cli-bundle/chunks/{learnings-Z4GAIZQ5.js → learnings-XK3P4ZDR.js} +10 -10
- package/dist/cli-bundle/chunks/{list-W5ROBC5U.js → list-6CL3XFT6.js} +10 -10
- package/dist/cli-bundle/chunks/list-BYNN4ZEO.js +19 -0
- package/dist/cli-bundle/chunks/{notes-JJDOEDFK.js → notes-5T6P7C5V.js} +10 -10
- package/dist/cli-bundle/chunks/{notes-SDCK7BEN.js → notes-U5FZCSBT.js} +10 -10
- package/dist/cli-bundle/chunks/{plan-H5HYHMBB.js → plan-2YTQYWGM.js} +63 -23
- package/dist/cli-bundle/chunks/plan-2YTQYWGM.js.map +1 -0
- package/dist/cli-bundle/chunks/{plan-W2B5RYR3.js → plan-7IVSICR6.js} +62 -22
- package/dist/cli-bundle/chunks/plan-7IVSICR6.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-QGRFMDWA.js → register-list-query-4UPMHONX.js} +18 -18
- package/dist/cli-bundle/chunks/{register-list-query-V4S23735.js → register-list-query-7VOW2C3W.js} +18 -18
- package/dist/cli-bundle/chunks/{register-mutation-ZPZNJXSA.js → register-mutation-FARSGYRD.js} +64 -47
- package/dist/cli-bundle/chunks/{register-mutation-ZPZNJXSA.js.map → register-mutation-FARSGYRD.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-I57PLUHA.js → register-mutation-LJDNVREU.js} +65 -48
- package/dist/cli-bundle/chunks/{register-mutation-I57PLUHA.js.map → register-mutation-LJDNVREU.js.map} +1 -1
- package/dist/cli-bundle/chunks/{register-operations-KAMLXAF5.js → register-operations-FFTYAL42.js} +38 -34
- package/dist/cli-bundle/chunks/register-operations-FFTYAL42.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-YEN4YEZ2.js → register-operations-HCJKDUA6.js} +37 -33
- package/dist/cli-bundle/chunks/{register-operations-YEN4YEZ2.js.map → register-operations-HCJKDUA6.js.map} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-BZ3TNE3G.js → register-setup-6AVIUOCC.js} +31 -31
- package/dist/cli-bundle/chunks/register-setup-6AVIUOCC.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-WLFL3OUF.js → register-setup-KVNLO5OJ.js} +30 -30
- package/dist/cli-bundle/chunks/register-setup-KVNLO5OJ.js.map +7 -0
- package/dist/cli-bundle/chunks/restore-CHIOQAQL.js +17 -0
- package/dist/cli-bundle/chunks/{restore-RGFSPG4K.js → restore-M6AFHMV4.js} +11 -11
- package/dist/cli-bundle/chunks/{schema-CCDU3RLC.js → schema-76HDZJCC.js} +8 -8
- package/dist/cli-bundle/chunks/{schema-KZASL323.js → schema-AINZ2IMM.js} +8 -8
- package/dist/cli-bundle/chunks/{search-7KSOLI2E.js → search-JMLFQEPJ.js} +10 -10
- package/dist/cli-bundle/chunks/{search-DTL7CO22.js → search-NL3TSCYB.js} +10 -10
- package/dist/cli-bundle/chunks/{stats-QNV7B2CE.js → stats-BKXCBIGT.js} +7 -7
- package/dist/cli-bundle/chunks/{stats-IOXQMGI6.js → stats-UBD56TGK.js} +7 -7
- package/dist/cli-bundle/chunks/{telemetry-NHR5RFXT.js → telemetry-N454RHG5.js} +4 -4
- package/dist/cli-bundle/chunks/{telemetry-IV5C6JOM.js → telemetry-ZJXK3H7X.js} +4 -4
- package/dist/cli-bundle/chunks/{test-PIL2CEEB.js → test-BQAKIXAT.js} +14 -14
- package/dist/cli-bundle/chunks/test-O74JFUH5.js +32 -0
- package/dist/cli-bundle/chunks/{test-all-MFN4MYCV.js → test-all-7LV3I6S5.js} +14 -14
- package/dist/cli-bundle/chunks/{test-all-GRLYHBNP.js → test-all-TDYCCBA4.js} +14 -14
- package/dist/cli-bundle/chunks/{test-runs-7WCSC3TY.js → test-runs-E64M6XS3.js} +5 -5
- package/dist/cli-bundle/chunks/{test-runs-7LRFWWCA.js → test-runs-LXZLULCI.js} +5 -5
- package/dist/cli-bundle/chunks/update-36JM7YZT.js +21 -0
- package/dist/cli-bundle/chunks/update-I246PCLO.js +25 -0
- package/dist/cli-bundle/chunks/{update-many-UYMTVF42.js → update-many-F4IKDWZB.js} +22 -22
- package/dist/cli-bundle/chunks/{update-many-LOTAYUTN.js → update-many-NTWZ5YT3.js} +22 -22
- package/dist/cli-bundle/chunks/{upgrade-ZZSC7CLV.js → upgrade-37F7JKES.js} +5 -5
- package/dist/cli-bundle/chunks/{upgrade-LT2MLLPS.js → upgrade-L32JA4TZ.js} +5 -5
- package/dist/cli-bundle/chunks/{validate-IQIQSKUX.js → validate-46KCRHL7.js} +462 -50
- package/dist/cli-bundle/chunks/validate-46KCRHL7.js.map +1 -0
- package/dist/cli-bundle/chunks/{validate-3XRORNMP.js → validate-CRFMPTYD.js} +482 -49
- package/dist/cli-bundle/chunks/validate-CRFMPTYD.js.map +7 -0
- package/dist/cli-bundle/main.js +180 -25
- package/dist/cli-bundle/main.js.map +2 -2
- package/dist/core/diagnostics/remediation.js +19 -6
- package/dist/core/diagnostics/remediation.js.map +1 -1
- package/dist/core/lock/lock-gc.d.ts +31 -0
- package/dist/core/lock/lock-gc.js +120 -62
- package/dist/core/lock/lock-gc.js.map +1 -1
- package/dist/core/output/query-summary.d.ts +31 -0
- package/dist/core/output/query-summary.js +62 -0
- package/dist/core/output/query-summary.js.map +1 -0
- package/dist/core/shared/constants.js +3 -2
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/telemetry/consent.js +18 -3
- package/dist/core/telemetry/consent.js.map +1 -1
- package/dist/core/validate/fix-planning.d.ts +130 -0
- package/dist/core/validate/fix-planning.js +202 -0
- package/dist/core/validate/fix-planning.js.map +1 -0
- package/dist/core/validate/missing-by-type.d.ts +21 -0
- package/dist/core/validate/missing-by-type.js +39 -0
- package/dist/core/validate/missing-by-type.js.map +1 -0
- package/dist/core/validate/stale-file-classification.d.ts +41 -0
- package/dist/core/validate/stale-file-classification.js +73 -0
- package/dist/core/validate/stale-file-classification.js.map +1 -0
- package/dist/mcp/server.js +74 -266
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.d.ts +27 -0
- package/dist/mcp/tool-definitions.js +330 -0
- package/dist/mcp/tool-definitions.js.map +1 -0
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +38 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +6 -1
- package/dist/sdk/cli-contracts.js +74 -7
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/docs/AGENT_GUIDE.md +7 -2
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/COMMANDS.md +25 -2
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +7 -3
- package/plugins/pm-claude/commands/pm-init.md +1 -1
- package/plugins/pm-codex/README.md +2 -2
- package/dist/cli-bundle/chunks/activity-5QLX6DHN.js +0 -16
- package/dist/cli-bundle/chunks/chunk-DTRIVUTN.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-EAQLLID6.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GF5XIBUH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-GP6SHEAI.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-OQGJSCZZ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-QJ2OIEOC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-WNMRICXH.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XSCGU4WT.js.map +0 -7
- package/dist/cli-bundle/chunks/close-SIQCDOBR.js +0 -13
- package/dist/cli-bundle/chunks/contracts-47X7RYUF.js.map +0 -7
- package/dist/cli-bundle/chunks/contracts-HJHR4NCD.js.map +0 -1
- package/dist/cli-bundle/chunks/create-TXNRPS4K.js +0 -27
- package/dist/cli-bundle/chunks/docs-7RYFBHQD.js.map +0 -7
- package/dist/cli-bundle/chunks/docs-TG6JMVMY.js.map +0 -1
- package/dist/cli-bundle/chunks/files-KAKU57OT.js.map +0 -7
- package/dist/cli-bundle/chunks/files-QB3EYPMO.js.map +0 -1
- package/dist/cli-bundle/chunks/gc-B747VM4M.js.map +0 -7
- package/dist/cli-bundle/chunks/gc-KNUPLPSW.js.map +0 -1
- package/dist/cli-bundle/chunks/health-IG43Z4KL.js.map +0 -1
- package/dist/cli-bundle/chunks/health-WWZJ5KJS.js.map +0 -7
- package/dist/cli-bundle/chunks/history-6UKSZTRT.js +0 -20
- package/dist/cli-bundle/chunks/history-redact-HKYBTK6X.js +0 -19
- package/dist/cli-bundle/chunks/history-repair-7HWBZKXN.js.map +0 -1
- package/dist/cli-bundle/chunks/history-repair-N5HXKJOI.js.map +0 -7
- package/dist/cli-bundle/chunks/init-27JLDUO2.js +0 -17
- package/dist/cli-bundle/chunks/list-6U3CJVXS.js +0 -19
- package/dist/cli-bundle/chunks/plan-H5HYHMBB.js.map +0 -1
- package/dist/cli-bundle/chunks/plan-W2B5RYR3.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-KAMLXAF5.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-BZ3TNE3G.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-WLFL3OUF.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-GNI2W5CN.js +0 -17
- package/dist/cli-bundle/chunks/test-4Z37CXW4.js +0 -32
- package/dist/cli-bundle/chunks/update-I4G34LKJ.js +0 -21
- package/dist/cli-bundle/chunks/update-VI5DBZ3G.js +0 -25
- package/dist/cli-bundle/chunks/validate-3XRORNMP.js.map +0 -7
- package/dist/cli-bundle/chunks/validate-IQIQSKUX.js.map +0 -1
- /package/dist/cli-bundle/chunks/{activity-W6TS5F2L.js.map → activity-XADJOG6G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-5QLX6DHN.js.map → activity-XZIUPGZH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{aggregate-UK2WJ4Z3.js.map → aggregate-6OTS3AOO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{aggregate-NNJLKGEK.js.map → aggregate-OD36DJU5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-DHGTLUZW.js.map → append-JYWO4P7W.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-7BS36Z2L.js.map → append-KG55G7S3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-A6XVYNQJ.js.map → chunk-37CYVF73.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XRE4CTNP.js.map → chunk-3KLPFWZ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WSWOQP3Z.js.map → chunk-4HFU4UO2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UNH3KSHG.js.map → chunk-4JCSYR6F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-73PSHEMT.js.map → chunk-4YFAGDRH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7GYMMDDW.js.map → chunk-5SCT2JCT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q6PSD5DZ.js.map → chunk-73ZPG2I3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CTW7QAHM.js.map → chunk-7IYFN5R7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OSGWBWLK.js.map → chunk-7UGSRQCL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UDWUDUJI.js.map → chunk-ATEES5SX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2MKBPWMK.js.map → chunk-AVGHVVF7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-344GDQTH.js.map → chunk-CCX4RSYZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6KQS23TX.js.map → chunk-CW6E4NAT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K45NAJV2.js.map → chunk-DY6C42S6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ANVZCNL5.js.map → chunk-ESANVZF4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6OSG3EMX.js.map → chunk-EWFY7SLA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DMDEC4QP.js.map → chunk-F75JSIOZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TALBUVWF.js.map → chunk-FDH2X65L.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TZLGCTA5.js.map → chunk-GKIZW7SM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UMWF6ZAS.js.map → chunk-GWZSYR6X.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KHBRV5JU.js.map → chunk-HGLC63AU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CMEHZD6G.js.map → chunk-HHHJ2GI3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MF6KSSMF.js.map → chunk-HI7STVF2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IEQ3N7WP.js.map → chunk-I2IJY2NL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-O64EYNHF.js.map → chunk-I53JBTJW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K7SXBA75.js.map → chunk-I7NYDZDV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WBU257Z4.js.map → chunk-IGVJRZ6H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7TW64BS5.js.map → chunk-IUKD4W6Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OVNSQHDG.js.map → chunk-KWAXVAXX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WWEFBBVF.js.map → chunk-L5EPZQIC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6ADVKPVV.js.map → chunk-OASDW5UI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EIS32UA4.js.map → chunk-OLKBSY4N.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-X3IPJU2O.js.map → chunk-P5BJOMBB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LYL32FT6.js.map → chunk-P5U5EOMA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TV6FZGVK.js.map → chunk-QJMGRZO2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KMMUDSSB.js.map → chunk-QKW5D45B.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4H2NDEGJ.js.map → chunk-QNJSITCX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VSS3CSTF.js.map → chunk-RXAP6JL5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3VTWCBXL.js.map → chunk-S26FESD4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DEYNERFX.js.map → chunk-S2ZLDYGS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QGIWURY3.js.map → chunk-SO55HRA5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-F2PVV7IX.js.map → chunk-SXKNJPQ7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5OMABP7I.js.map → chunk-TK5VZFHY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UY26RIBR.js.map → chunk-TNAP7EJX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-SNASEDXB.js.map → chunk-UUWGCWBU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6N46IM44.js.map → chunk-VAOUX6TK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-X5YC5DZM.js.map → chunk-VFUZV5EB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-I2FM2SMO.js.map → chunk-VPEAS7PS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7DUVDW7C.js.map → chunk-VSRZRLG3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-PYULT32I.js.map → chunk-WUNFKP7M.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LUJQJR7G.js.map → chunk-XJDGS74Y.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TXWMLDMG.js.map → chunk-XMBI6TNW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4CYHWHZU.js.map → chunk-XTKJSVWH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T6QLB34N.js.map → chunk-XUC4C4PT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KRZQGRVL.js.map → chunk-XWMF3POR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OROMGSBP.js.map → chunk-Y3YKK7CY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-D6JZBUZ6.js.map → chunk-YW6Q3RYZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GRHPU6EM.js.map → chunk-ZLMIWZUG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5HH6QRH5.js.map → chunk-ZMW77VWV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BE5G7HEL.js.map → chunk-ZYNJNPYD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-3TY5LE54.js.map → claim-2RDYMCTP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-LM4YY6QQ.js.map → claim-MJ7DZFC3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-SIQCDOBR.js.map → close-4FMAPEMY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-CSD4LEMT.js.map → close-XLEKIQSW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-B5SHDX6W.js.map → close-many-AOD4HSAZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-many-WRXB5KVY.js.map → close-many-XKAQY5CQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-BDDEK3VW.js.map → comments-B4RWWDJT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-A5ALOYTG.js.map → comments-RN5TG4ZN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{config-W2NHDNQT.js.map → config-3JXJ3XZ7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{config-YUYBMJOW.js.map → config-FZ4UDC4B.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-LRJ74NSU.js.map → context-L36PIN35.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-R2QLOJCK.js.map → context-QBPO3BFM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-P4UVYZ7M.js.map → copy-ALU5WMHA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-B7HFOWFB.js.map → copy-FWIVTLBO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-5ERJF64D.js.map → create-5433DP3G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-TXNRPS4K.js.map → create-VWLWS34Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-LX3LGBCH.js.map → delete-IYTIYAJS.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-S3WVK6LP.js.map → delete-Y2SGJBGY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-YSM4LZQD.js.map → deps-6TSPOSGU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-GWSNH7OZ.js.map → deps-CZ4PTVXU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-R3LUKMX7.js.map → extension-Q34OEWO5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-VNMRKIHI.js.map → extension-WH2FOIOZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{get-GMGLIQ5I.js.map → get-PCHS7RA6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{get-SBL6NHYQ.js.map → get-QARTE6BL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-XCWRXBXC.js.map → history-7WUAEWHW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-6UKSZTRT.js.map → history-L2FQFRTU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-KICKUCR7.js.map → history-compact-3EJ3L2O7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-compact-IDH7E7VN.js.map → history-compact-LW27IPFK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-JJWH3QWK.js.map → history-redact-G72A4EJ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-HKYBTK6X.js.map → history-redact-QWQCX5DZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-27JLDUO2.js.map → init-4BKRHGWW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-OQA3TWIS.js.map → init-S5WEGUJY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-L7VQUSVI.js.map → learnings-HQXSSKZ5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-Z4GAIZQ5.js.map → learnings-XK3P4ZDR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-W5ROBC5U.js.map → list-6CL3XFT6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-6U3CJVXS.js.map → list-BYNN4ZEO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-JJDOEDFK.js.map → notes-5T6P7C5V.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-SDCK7BEN.js.map → notes-U5FZCSBT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-list-query-QGRFMDWA.js.map → register-list-query-4UPMHONX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-list-query-V4S23735.js.map → register-list-query-7VOW2C3W.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-GNI2W5CN.js.map → restore-CHIOQAQL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-RGFSPG4K.js.map → restore-M6AFHMV4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-CCDU3RLC.js.map → schema-76HDZJCC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-KZASL323.js.map → schema-AINZ2IMM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-7KSOLI2E.js.map → search-JMLFQEPJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-DTL7CO22.js.map → search-NL3TSCYB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{stats-QNV7B2CE.js.map → stats-BKXCBIGT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{stats-IOXQMGI6.js.map → stats-UBD56TGK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-NHR5RFXT.js.map → telemetry-N454RHG5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-IV5C6JOM.js.map → telemetry-ZJXK3H7X.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-PIL2CEEB.js.map → test-BQAKIXAT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-4Z37CXW4.js.map → test-O74JFUH5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-all-MFN4MYCV.js.map → test-all-7LV3I6S5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-all-GRLYHBNP.js.map → test-all-TDYCCBA4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-7WCSC3TY.js.map → test-runs-E64M6XS3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-7LRFWWCA.js.map → test-runs-LXZLULCI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-I4G34LKJ.js.map → update-36JM7YZT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-VI5DBZ3G.js.map → update-I246PCLO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-UYMTVF42.js.map → update-many-F4IKDWZB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-LOTAYUTN.js.map → update-many-NTWZ5YT3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{upgrade-ZZSC7CLV.js.map → upgrade-37F7JKES.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{upgrade-LT2MLLPS.js.map → upgrade-L32JA4TZ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["import type {\n BuiltinItemType,\n GovernancePreset,\n GovernanceSettings,\n ItemFrontMatter,\n PmSettings,\n RuntimeStatusDefinition,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\nimport { createDefaultExtensionGovernancePolicy } from \"../extensions/extension-types.js\";\n\n/**\n * Canonical default lifecycle status model and workflow role mapping.\n *\n * Single source of truth: `SETTINGS_DEFAULTS.schema` references these, and\n * `src/core/schema/runtime-schema.ts` re-exports them as\n * `DEFAULT_RUNTIME_STATUS_DEFINITIONS` / `DEFAULT_RUNTIME_WORKFLOW`.\n */\nexport const DEFAULT_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> = Object.freeze([\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n]);\n\nexport const DEFAULT_WORKFLOW_DEFINITION: RuntimeWorkflowDefinition = Object.freeze({\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n});\n\nexport const PM_DIRNAME = \".agents/pm\";\nexport const SETTINGS_FILENAME = \"settings.json\";\n\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\nexport const PM_REQUIRED_SUBDIRS = [...PM_CORE_REQUIRED_SUBDIRS, ...PM_OPTIONAL_TYPE_SUBDIRS] as const;\n\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\nexport const FRONT_MATTER_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"duplicate_of\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<BuiltinGovernancePreset, Omit<GovernanceSettings, \"preset\">> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\"no active blocker because work is closed\", \"work is closed\"],\n resolution: [\"closed with implementation evidence\", \"closed with verification evidence\", \"work completed and recorded\", \"work is closed\"],\n actual_result: [\"closed and recorded\", \"work completed\", \"work completed and recorded\"],\n} as const;\n\nfunction cloneOptionalArray<T>(values: readonly T[] | undefined): T[] | undefined {\n return values ? [...values] : undefined;\n}\n\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: DEFAULT_STATUS_DEFINITIONS.map((definition) => ({\n ...definition,\n aliases: cloneOptionalArray(definition.aliases),\n roles: cloneOptionalArray(definition.roles),\n })),\n fields: [],\n workflow: { ...DEFAULT_WORKFLOW_DEFINITION },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: createDefaultExtensionGovernancePolicy(),\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n mutation_refresh_policy: \"semantic_configured\",\n query_expansion: {\n enabled: false,\n provider: \"\",\n },\n rerank: {\n enabled: false,\n model: \"\",\n top_k: 20,\n },\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n recently_created: true,\n unparented: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n collection_name: \"pm_items\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\nexport type TelemetryErrorCategory = \"usage\" | \"validation\" | \"conflict\" | \"runtime\" | \"unknown\";\n\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<Record<string, TelemetryErrorCategory>> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\nexport function resolveTelemetryErrorCategory(errorCode: string | undefined): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (normalized.startsWith(\"unknown_\") || normalized.startsWith(\"missing_required_\")) {\n return \"usage\";\n }\n if (normalized.startsWith(\"invalid_\") || normalized.endsWith(\"_not_found\") || normalized.includes(\"validation\")) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"runtime\";\n }\n return \"unknown\";\n}\n"],"names":[],"mappings":";;AASA,OAAO,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA2C,MAAM,CAAC,MAAM,CAAC;IAC9F;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,CAAC,OAAO,CAAC;KACjB;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,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U,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,gCAAgC,CAAC,UAAU,CAAC,CAAC;IAC9D,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACpF,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAChH,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"e3d8f708-ea81-58a5-920a-ee9f27c436ab"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["core/shared/constants.ts"],"sourceRoot":"/","sourcesContent":["import type {\n BuiltinItemType,\n GovernancePreset,\n GovernanceSettings,\n ItemFrontMatter,\n PmSettings,\n RuntimeStatusDefinition,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\nimport { createDefaultExtensionGovernancePolicy } from \"../extensions/extension-types.js\";\n\n/**\n * Canonical default lifecycle status model and workflow role mapping.\n *\n * Single source of truth: `SETTINGS_DEFAULTS.schema` references these, and\n * `src/core/schema/runtime-schema.ts` re-exports them as\n * `DEFAULT_RUNTIME_STATUS_DEFINITIONS` / `DEFAULT_RUNTIME_WORKFLOW`.\n */\nexport const DEFAULT_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> = Object.freeze([\n {\n id: \"draft\",\n roles: [\"draft\"],\n },\n {\n id: \"open\",\n roles: [\"active\", \"default_open\"],\n },\n {\n id: \"in_progress\",\n aliases: [\"in-progress\"],\n roles: [\"active\"],\n },\n {\n id: \"blocked\",\n roles: [\"blocked\"],\n },\n {\n id: \"closed\",\n roles: [\"terminal\", \"terminal_done\", \"default_close\"],\n },\n {\n id: \"canceled\",\n aliases: [\"cancelled\"],\n roles: [\"terminal\", \"terminal_canceled\", \"default_cancel\"],\n },\n]);\n\nexport const DEFAULT_WORKFLOW_DEFINITION: RuntimeWorkflowDefinition = Object.freeze({\n draft_status: \"draft\",\n open_status: \"open\",\n in_progress_status: \"in_progress\",\n blocked_status: \"blocked\",\n close_status: \"closed\",\n canceled_status: \"canceled\",\n});\n\nexport const PM_DIRNAME = \".agents/pm\";\nexport const SETTINGS_FILENAME = \"settings.json\";\n\nexport const PM_CORE_REQUIRED_SUBDIRS = [\n \"\",\n \"epics\",\n \"features\",\n \"tasks\",\n \"chores\",\n \"issues\",\n \"schema\",\n \"history\",\n \"search\",\n \"extensions\",\n \"locks\",\n] as const;\n\nexport const PM_OPTIONAL_TYPE_SUBDIRS = [\n \"decisions\",\n \"events\",\n \"reminders\",\n \"milestones\",\n \"meetings\",\n \"plans\",\n] as const;\n\nexport const PM_REQUIRED_SUBDIRS = [...PM_CORE_REQUIRED_SUBDIRS, ...PM_OPTIONAL_TYPE_SUBDIRS] as const;\n\nexport const TYPE_TO_FOLDER: Record<BuiltinItemType, string> = {\n Epic: \"epics\",\n Feature: \"features\",\n Task: \"tasks\",\n Chore: \"chores\",\n Issue: \"issues\",\n Decision: \"decisions\",\n Event: \"events\",\n Reminder: \"reminders\",\n Milestone: \"milestones\",\n Meeting: \"meetings\",\n Plan: \"plans\",\n};\n\nexport const FRONT_MATTER_KEY_ORDER: ReadonlyArray<string> = [\n \"id\",\n \"title\",\n \"description\",\n \"type\",\n \"source_type\",\n \"type_options\",\n \"status\",\n \"priority\",\n \"tags\",\n \"created_at\",\n \"updated_at\",\n \"deadline\",\n \"reminders\",\n \"events\",\n \"closed_at\",\n \"assignee\",\n \"source_owner\",\n \"author\",\n \"estimated_minutes\",\n \"acceptance_criteria\",\n \"design\",\n \"external_ref\",\n \"definition_of_ready\",\n \"order\",\n \"goal\",\n \"objective\",\n \"value\",\n \"impact\",\n \"outcome\",\n \"why_now\",\n \"parent\",\n \"reviewer\",\n \"risk\",\n \"confidence\",\n \"sprint\",\n \"release\",\n \"blocked_by\",\n \"blocked_reason\",\n \"unblock_note\",\n \"reporter\",\n \"severity\",\n \"environment\",\n \"repro_steps\",\n \"resolution\",\n \"expected_result\",\n \"actual_result\",\n \"affected_version\",\n \"fixed_version\",\n \"component\",\n \"regression\",\n \"customer_impact\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"close_reason\",\n \"duplicate_of\",\n \"plan_mode\",\n \"plan_scope\",\n \"plan_harness\",\n \"plan_resume_context\",\n \"plan_validation\",\n \"plan_decisions\",\n \"plan_discoveries\",\n \"plan_steps\",\n];\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\n\nexport const GOVERNANCE_PRESET_DEFAULTS: Record<BuiltinGovernancePreset, Omit<GovernanceSettings, \"preset\">> = {\n minimal: {\n ownership_enforcement: \"none\",\n create_mode_default: \"progressive\",\n close_validation_default: \"off\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: false,\n },\n default: {\n ownership_enforcement: \"warn\",\n create_mode_default: \"progressive\",\n close_validation_default: \"warn\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"core\",\n force_required_for_stale_lock: true,\n },\n strict: {\n ownership_enforcement: \"strict\",\n create_mode_default: \"strict\",\n close_validation_default: \"strict\",\n require_close_reason: true,\n parent_reference: \"strict_error\",\n metadata_profile: \"strict\",\n force_required_for_stale_lock: true,\n },\n};\n\nexport const DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS = [\n \"no active blocker\",\n \"ready for planned execution sequencing\",\n \"work completed\",\n \"work is closed\",\n] as const;\n\nexport const DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS = {\n blocked_reason: [\"no active blocker because work is closed\", \"work is closed\"],\n resolution: [\"closed with implementation evidence\", \"closed with verification evidence\", \"work completed and recorded\", \"work is closed\"],\n actual_result: [\"closed and recorded\", \"work completed\", \"work completed and recorded\"],\n} as const;\n\nfunction cloneOptionalArray<T>(values: readonly T[] | undefined): T[] | undefined {\n return values ? [...values] : undefined;\n}\n\nexport const SETTINGS_DEFAULTS: PmSettings = {\n version: 1,\n id_prefix: \"pm-\",\n author_default: \"\",\n item_format: \"toon\",\n locks: {\n ttl_seconds: 1800,\n },\n output: {\n default_format: \"toon\",\n },\n history: {\n missing_stream: \"auto_create\",\n },\n validation: {\n sprint_release_format: \"warn\",\n parent_reference: \"warn\",\n metadata_profile: \"core\",\n metadata_required_fields: [],\n lifecycle_stale_blocker_reason_patterns: [...DEFAULT_VALIDATE_STALE_BLOCKER_REASON_PATTERNS],\n lifecycle_closure_like_blocked_reason_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.blocked_reason,\n ],\n lifecycle_closure_like_resolution_patterns: [...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.resolution],\n lifecycle_closure_like_actual_result_patterns: [\n ...DEFAULT_VALIDATE_CLOSURE_LIKE_METADATA_FIELD_PATTERNS.actual_result,\n ],\n },\n governance: {\n preset: \"minimal\",\n ...GOVERNANCE_PRESET_DEFAULTS.minimal,\n },\n workflow: {\n definition_of_done: [],\n },\n testing: {\n record_results_to_items: false,\n },\n telemetry: {\n enabled: true,\n first_run_prompt_completed: false,\n capture_level: \"redacted\",\n endpoint: \"https://pm-cli.unbrained.dev/v1/events\",\n installation_id: \"\",\n retention_days: 365,\n },\n agent_guidance: {\n prompt_completed: false,\n declined: false,\n declined_at: \"\",\n template_version: 1,\n last_checked_files: [],\n },\n item_types: {\n definitions: [],\n },\n schema: {\n version: 1,\n files: {\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n },\n statuses: DEFAULT_STATUS_DEFINITIONS.map((definition) => ({\n ...definition,\n aliases: cloneOptionalArray(definition.aliases),\n roles: cloneOptionalArray(definition.roles),\n })),\n fields: [],\n workflow: { ...DEFAULT_WORKFLOW_DEFINITION },\n unknown_field_policy: \"allow\",\n },\n extensions: {\n enabled: [],\n disabled: [],\n policy: createDefaultExtensionGovernancePolicy(),\n },\n search: {\n score_threshold: 0,\n hybrid_semantic_weight: 0.7,\n max_results: 50,\n embedding_model: \"\",\n embedding_batch_size: 32,\n embedding_timeout_ms: 30_000,\n scanner_max_batch_retries: 3,\n provider: \"\",\n mutation_refresh_policy: \"semantic_configured\",\n query_expansion: {\n enabled: false,\n provider: \"\",\n },\n rerank: {\n enabled: false,\n model: \"\",\n top_k: 20,\n },\n },\n providers: {\n openai: {\n base_url: \"\",\n api_key: \"\",\n model: \"\",\n },\n ollama: {\n base_url: \"\",\n model: \"\",\n },\n },\n context: {\n default_depth: \"brief\",\n activity_limit: 10,\n stale_threshold_days: 7,\n sections: {\n hierarchy: true,\n activity: true,\n progress: true,\n recently_created: true,\n unparented: true,\n blockers: true,\n files: true,\n workload: true,\n staleness: true,\n tests: true,\n },\n },\n vector_store: {\n adapter: \"\",\n collection_name: \"pm_items\",\n qdrant: {\n url: \"\",\n api_key: \"\",\n },\n lancedb: {\n path: \"\",\n },\n },\n};\n\nexport const EMPTY_CANONICAL_DOCUMENT = {\n metadata: {},\n body: \"\",\n};\n\nexport const EXIT_CODE = {\n SUCCESS: 0,\n GENERIC_FAILURE: 1,\n USAGE: 2,\n NOT_FOUND: 3,\n CONFLICT: 4,\n DEPENDENCY_FAILED: 5,\n} as const;\n\nexport type TelemetryErrorCategory = \"usage\" | \"validation\" | \"conflict\" | \"runtime\" | \"unknown\";\n\nexport const TELEMETRY_ERROR_CATEGORY_BY_CODE: Readonly<Record<string, TelemetryErrorCategory>> = Object.freeze({\n unknown_command: \"usage\",\n unknown_option: \"usage\",\n missing_required_option: \"usage\",\n missing_required_argument: \"usage\",\n invalid_command_usage: \"usage\",\n linked_test_value_not_quoted: \"usage\",\n invalid_argument_value: \"validation\",\n health_findings: \"validation\",\n validation_findings: \"validation\",\n close_through_update: \"validation\",\n no_update_fields: \"validation\",\n unsupported_update_option: \"validation\",\n tracker_not_initialized: \"validation\",\n item_not_found: \"validation\",\n ownership_conflict: \"conflict\",\n lock_conflict: \"conflict\",\n terminal_state_conflict: \"conflict\",\n dependency_failed: \"runtime\",\n command_failed: \"runtime\",\n unknown_error: \"runtime\",\n});\n\nexport function resolveTelemetryErrorCategory(errorCode: string | undefined): TelemetryErrorCategory {\n const normalized = (errorCode ?? \"\").trim().toLowerCase();\n if (normalized.length === 0) {\n return \"unknown\";\n }\n const explicit = TELEMETRY_ERROR_CATEGORY_BY_CODE[normalized];\n if (typeof explicit === \"string\") {\n return explicit;\n }\n if (normalized.includes(\"conflict\") || normalized.includes(\"locked\")) {\n return \"conflict\";\n }\n if (normalized.startsWith(\"unknown_\") || normalized.startsWith(\"missing_required_\")) {\n return \"usage\";\n }\n if (normalized.startsWith(\"invalid_\") || normalized.endsWith(\"_not_found\") || normalized.includes(\"validation\")) {\n return \"validation\";\n }\n if (normalized.endsWith(\"_error\") || normalized.endsWith(\"_failed\")) {\n return \"run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B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","debugId":"aaaabb17-ee0f-5c5d-8111-3406542035c3"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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]="7804d4bf-ff46-50af-9af5-533f83c3d445")}catch(e){}}();
|
|
3
3
|
import readline from "node:readline/promises";
|
|
4
4
|
import { stdin as input, stdout as output } from "node:process";
|
|
5
5
|
import { resolveGlobalPmRoot } from "../store/paths.js";
|
|
@@ -13,6 +13,21 @@ function parseBooleanLike(value) {
|
|
|
13
13
|
}
|
|
14
14
|
return TELEMETRY_PROMPT_DISABLE_VALUES.has(value.trim().toLowerCase());
|
|
15
15
|
}
|
|
16
|
+
// pm-0hx2: the CI guard must fire when CI is SET to a truthy value (CI=true,
|
|
17
|
+
// CI=1, ...). An unset or empty CI behaves as "not CI", and the conventional
|
|
18
|
+
// falsy spellings ("0", "false", "no", "off") explicitly opt back out of the
|
|
19
|
+
// guard. This is intentionally NOT parseBooleanLike, which matches only the
|
|
20
|
+
// disable set and would invert the check.
|
|
21
|
+
function isTruthyEnvValue(value) {
|
|
22
|
+
if (typeof value !== "string") {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const normalized = value.trim().toLowerCase();
|
|
26
|
+
if (normalized.length === 0) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return !TELEMETRY_PROMPT_DISABLE_VALUES.has(normalized);
|
|
30
|
+
}
|
|
16
31
|
function shouldSkipTelemetryPrompt(commandPath, globalOptions) {
|
|
17
32
|
if (globalOptions.json === true || globalOptions.quiet === true) {
|
|
18
33
|
return true;
|
|
@@ -23,7 +38,7 @@ function shouldSkipTelemetryPrompt(commandPath, globalOptions) {
|
|
|
23
38
|
if (parseBooleanLike(process.env[TELEMETRY_PROMPT_DISABLE_ENV])) {
|
|
24
39
|
return true;
|
|
25
40
|
}
|
|
26
|
-
if (
|
|
41
|
+
if (isTruthyEnvValue(process.env.CI)) {
|
|
27
42
|
return true;
|
|
28
43
|
}
|
|
29
44
|
const normalizedCommandPath = commandPath.trim().toLowerCase();
|
|
@@ -79,4 +94,4 @@ export async function maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions
|
|
|
79
94
|
}
|
|
80
95
|
}
|
|
81
96
|
//# sourceMappingURL=consent.js.map
|
|
82
|
-
//# debugId=
|
|
97
|
+
//# debugId=7804d4bf-ff46-50af-9af5-533f83c3d445
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.js","sources":["core/telemetry/consent.ts"],"sourceRoot":"/","sourcesContent":["import readline from \"node:readline/promises\";\nimport { stdin as input, stdout as output } from \"node:process\";\nimport type { GlobalOptions } from \"../shared/command-types.js\";\nimport { resolveGlobalPmRoot } from \"../store/paths.js\";\nimport { readSettings, writeSettings } from \"../store/settings.js\";\n\nconst TELEMETRY_PROMPT_DISABLE_ENV = \"PM_TELEMETRY_PROMPT\";\nconst TELEMETRY_PROMPT_DISABLE_VALUES = new Set([\"0\", \"false\", \"no\", \"off\"]);\nconst TELEMETRY_PROMPT_SKIPPED_COMMANDS = new Set([\"init\", \"completion\", \"completion-statuses\", \"completion-tags\", \"completion-types\"]);\n\nfunction parseBooleanLike(value: string | undefined): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n return TELEMETRY_PROMPT_DISABLE_VALUES.has(value.trim().toLowerCase());\n}\n\nfunction shouldSkipTelemetryPrompt(commandPath: string, globalOptions: GlobalOptions): boolean {\n if (globalOptions.json === true || globalOptions.quiet === true) {\n return true;\n }\n if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {\n return true;\n }\n if (parseBooleanLike(process.env[TELEMETRY_PROMPT_DISABLE_ENV])) {\n return true;\n }\n if (
|
|
1
|
+
{"version":3,"file":"consent.js","sources":["core/telemetry/consent.ts"],"sourceRoot":"/","sourcesContent":["import readline from \"node:readline/promises\";\nimport { stdin as input, stdout as output } from \"node:process\";\nimport type { GlobalOptions } from \"../shared/command-types.js\";\nimport { resolveGlobalPmRoot } from \"../store/paths.js\";\nimport { readSettings, writeSettings } from \"../store/settings.js\";\n\nconst TELEMETRY_PROMPT_DISABLE_ENV = \"PM_TELEMETRY_PROMPT\";\nconst TELEMETRY_PROMPT_DISABLE_VALUES = new Set([\"0\", \"false\", \"no\", \"off\"]);\nconst TELEMETRY_PROMPT_SKIPPED_COMMANDS = new Set([\"init\", \"completion\", \"completion-statuses\", \"completion-tags\", \"completion-types\"]);\n\nfunction parseBooleanLike(value: string | undefined): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n return TELEMETRY_PROMPT_DISABLE_VALUES.has(value.trim().toLowerCase());\n}\n\n// pm-0hx2: the CI guard must fire when CI is SET to a truthy value (CI=true,\n// CI=1, ...). An unset or empty CI behaves as \"not CI\", and the conventional\n// falsy spellings (\"0\", \"false\", \"no\", \"off\") explicitly opt back out of the\n// guard. This is intentionally NOT parseBooleanLike, which matches only the\n// disable set and would invert the check.\nfunction isTruthyEnvValue(value: string | undefined): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n const normalized = value.trim().toLowerCase();\n if (normalized.length === 0) {\n return false;\n }\n return !TELEMETRY_PROMPT_DISABLE_VALUES.has(normalized);\n}\n\nfunction shouldSkipTelemetryPrompt(commandPath: string, globalOptions: GlobalOptions): boolean {\n if (globalOptions.json === true || globalOptions.quiet === true) {\n return true;\n }\n if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {\n return true;\n }\n if (parseBooleanLike(process.env[TELEMETRY_PROMPT_DISABLE_ENV])) {\n return true;\n }\n if (isTruthyEnvValue(process.env.CI)) {\n return true;\n }\n const normalizedCommandPath = commandPath.trim().toLowerCase();\n if (normalizedCommandPath.length === 0) {\n return true;\n }\n return TELEMETRY_PROMPT_SKIPPED_COMMANDS.has(normalizedCommandPath);\n}\n\nfunction parseTelemetryPromptAnswer(answer: string): boolean {\n const normalized = answer.trim().toLowerCase();\n if (normalized === \"n\" || normalized === \"no\") {\n return false;\n }\n return true;\n}\n\nasync function promptTelemetryConsent(currentDefault: boolean): Promise<boolean> {\n const defaultLabel = currentDefault ? \"Y/n\" : \"y/N\";\n const prompt =\n `pm telemetry helps improve reliability and usage diagnostics.\\n` +\n `It is enabled by default and can be changed anytime via:\\n` +\n `pm config global set telemetry-tracking --policy disabled\\n` +\n `Enable telemetry now? [${defaultLabel}] `;\n const rl = readline.createInterface({ input, output });\n try {\n const answer = await rl.question(prompt);\n if (answer.trim().length === 0) {\n return currentDefault;\n }\n return parseTelemetryPromptAnswer(answer);\n } finally {\n rl.close();\n }\n}\n\nexport async function maybeRunFirstUseTelemetryPrompt(commandPath: string, globalOptions: GlobalOptions): Promise<void> {\n if (shouldSkipTelemetryPrompt(commandPath, globalOptions)) {\n return;\n }\n try {\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const settings = await readSettings(globalPmRoot);\n if (settings.telemetry.first_run_prompt_completed) {\n return;\n }\n const enabled = await promptTelemetryConsent(settings.telemetry.enabled);\n settings.telemetry.enabled = enabled;\n settings.telemetry.first_run_prompt_completed = true;\n await writeSettings(globalPmRoot, settings, \"telemetry:first_run_prompt\");\n output.write(\n `Telemetry ${enabled ? \"enabled\" : \"disabled\"} for this CLI install. ` +\n `Update any time with pm config global set telemetry-tracking --policy ${enabled ? \"disabled\" : \"enabled\"}.\\n`,\n );\n } catch {\n // Prompt and persistence failures should never block command execution.\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO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":"7804d4bf-ff46-50af-9af5-533f83c3d445"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix planning for `pm validate --auto-fix` / `--prune-missing` (pm-c3sz,
|
|
3
|
+
* pm-8jss, pm-0v2m).
|
|
4
|
+
*
|
|
5
|
+
* Pure module: planners turn check findings into declarative
|
|
6
|
+
* {@link ValidateFixRecord}s; the validate command decides whether to apply
|
|
7
|
+
* them (apply mode), preview them (`--dry-run`), or withhold gated fixes
|
|
8
|
+
* (lifecycle structural changes require an explicit `--fix-scope lifecycle`).
|
|
9
|
+
*
|
|
10
|
+
* Safety invariants:
|
|
11
|
+
* - Every planned fix is deterministic and non-destructive: it only sets a
|
|
12
|
+
* derivable field value or removes a stale LINK (never a real file).
|
|
13
|
+
* - No fix ever closes, deletes, or cancels an item.
|
|
14
|
+
* - Lifecycle fixes (reparent / unset parent) are structural, so they are
|
|
15
|
+
* planned with `gate: "lifecycle"` and only applied when that scope was
|
|
16
|
+
* explicitly granted.
|
|
17
|
+
*/
|
|
18
|
+
export type ValidateFixCheck = "metadata" | "resolution" | "lifecycle" | "files";
|
|
19
|
+
export type ValidateFixKind = "set_resolution" | "set_close_reason" | "reparent" | "unset_parent" | "prune_file_link" | "prune_doc_link";
|
|
20
|
+
export type ValidateFixScope = "metadata" | "resolution" | "lifecycle";
|
|
21
|
+
/** Scopes auto-applied without an explicit `--fix-scope` (safe field backfills). */
|
|
22
|
+
export declare const DEFAULT_GRANTED_FIX_SCOPES: readonly ValidateFixScope[];
|
|
23
|
+
/** Scopes accepted by `--fix-scope` (lifecycle is the opt-in structural scope). */
|
|
24
|
+
export declare const SUPPORTED_FIX_SCOPES: readonly ValidateFixScope[];
|
|
25
|
+
export interface ValidateFixRecord {
|
|
26
|
+
/** Item the fix targets. */
|
|
27
|
+
item_id: string;
|
|
28
|
+
/** Validate check the finding came from. */
|
|
29
|
+
check: ValidateFixCheck;
|
|
30
|
+
/** Front-matter field (or link list) the fix changes. */
|
|
31
|
+
field: string;
|
|
32
|
+
/** Declarative fix kind the applier dispatches on. */
|
|
33
|
+
kind: ValidateFixKind;
|
|
34
|
+
/** Equivalent standalone `pm` command for the fix. */
|
|
35
|
+
command: string;
|
|
36
|
+
/** New value for set-field fixes. */
|
|
37
|
+
value?: string;
|
|
38
|
+
/** Stale link path for prune fixes. */
|
|
39
|
+
path?: string;
|
|
40
|
+
/** Target parent id for reparent fixes. */
|
|
41
|
+
parent_id?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Fix scope the `--fix-scope` allowlist must grant for the fix to be
|
|
44
|
+
* applied. Every `--auto-fix` record carries one (the granted default is
|
|
45
|
+
* metadata+resolution; lifecycle must be named explicitly). Absent only on
|
|
46
|
+
* `--prune-missing` records, which are governed by their own flag.
|
|
47
|
+
*/
|
|
48
|
+
gate?: ValidateFixScope;
|
|
49
|
+
}
|
|
50
|
+
/** Default resolution backfilled onto closed items with no derivable source text. */
|
|
51
|
+
export declare const DEFAULT_RESOLUTION_BACKFILL_VALUE = "completed";
|
|
52
|
+
export interface ResolutionBackfillRow {
|
|
53
|
+
id: string;
|
|
54
|
+
/** Resolution-check missing field keys for this closed item. */
|
|
55
|
+
missing_fields: readonly string[];
|
|
56
|
+
/** The item's close_reason, when present (preferred derivation source). */
|
|
57
|
+
close_reason?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Plan resolution backfills for closed items flagged by the resolution check.
|
|
61
|
+
* Only the `resolution` field is mechanical enough to auto-fix: it derives
|
|
62
|
+
* from the item's own `close_reason` when present and falls back to the
|
|
63
|
+
* `"completed"` default. `expected_result` / `actual_result` stay hint-only —
|
|
64
|
+
* no deterministic source text exists for them.
|
|
65
|
+
*/
|
|
66
|
+
export declare function planResolutionBackfillFixes(rows: readonly ResolutionBackfillRow[]): ValidateFixRecord[];
|
|
67
|
+
export interface CloseReasonBackfillRow {
|
|
68
|
+
id: string;
|
|
69
|
+
/** The item's resolution, when present (the only derivation source). */
|
|
70
|
+
resolution?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Plan close_reason backfills for closed items flagged by the metadata check.
|
|
74
|
+
* Only derivable when the item already carries a resolution; items missing
|
|
75
|
+
* both stay hint-only (any synthesized reason would be fabricated, not
|
|
76
|
+
* derived).
|
|
77
|
+
*/
|
|
78
|
+
export declare function planCloseReasonBackfillFixes(rows: readonly CloseReasonBackfillRow[]): ValidateFixRecord[];
|
|
79
|
+
export interface TerminalParentFixRow {
|
|
80
|
+
id: string;
|
|
81
|
+
parent_id: string;
|
|
82
|
+
/** The terminal parent's own parent, when one exists. */
|
|
83
|
+
grandparent_id?: string;
|
|
84
|
+
/** True when the grandparent exists and is NOT terminal (safe reparent target). */
|
|
85
|
+
grandparent_active?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Plan lifecycle fixes for active items whose parent is terminal (pm-8jss /
|
|
89
|
+
* GH-168). When the terminal parent has an active grandparent, the child is
|
|
90
|
+
* reparented one level up (it stays inside the same hierarchy); otherwise the
|
|
91
|
+
* parent link is cleared so the item surfaces as unparented active work.
|
|
92
|
+
* Either way the item itself is never closed or mutated beyond `parent` —
|
|
93
|
+
* and every fix carries `gate: "lifecycle"` so it is only applied under an
|
|
94
|
+
* explicit `--fix-scope lifecycle`.
|
|
95
|
+
*/
|
|
96
|
+
export declare function planTerminalParentFixes(rows: readonly TerminalParentFixRow[]): ValidateFixRecord[];
|
|
97
|
+
export interface StaleLinkPruneRow {
|
|
98
|
+
item_id: string;
|
|
99
|
+
path: string;
|
|
100
|
+
link_kind: "files" | "docs";
|
|
101
|
+
classification: "moved" | "deleted";
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Plan link prunes for `--prune-missing` (pm-0v2m / GH-184). Only links whose
|
|
105
|
+
* stale path classified as `deleted` are pruned; `moved` links keep their
|
|
106
|
+
* relink candidates in the files-check details instead of being dropped, so
|
|
107
|
+
* recoverable link information is never destroyed. Link removal only — real
|
|
108
|
+
* files are never touched.
|
|
109
|
+
*/
|
|
110
|
+
export declare function planStaleLinkPruneFixes(rows: readonly StaleLinkPruneRow[]): ValidateFixRecord[];
|
|
111
|
+
/**
|
|
112
|
+
* Resolve the granted `--fix-scope` set (repeatable and/or comma-separated).
|
|
113
|
+
* With no explicit scopes the safe field-backfill scopes (metadata,
|
|
114
|
+
* resolution) are granted; lifecycle must always be named explicitly. Unknown
|
|
115
|
+
* values fail fast with the supported list.
|
|
116
|
+
*/
|
|
117
|
+
export declare function resolveGrantedFixScopes(rawScopes: readonly string[] | undefined): Set<ValidateFixScope>;
|
|
118
|
+
/**
|
|
119
|
+
* Split a fix plan into the records that may be applied under the granted
|
|
120
|
+
* scopes and the gated records that were withheld. `--fix-scope` is an exact
|
|
121
|
+
* allowlist: every `--auto-fix` record requires its gate scope in `granted`.
|
|
122
|
+
* Ungated records (`--prune-missing` link prunes, governed by their own flag)
|
|
123
|
+
* are always applicable.
|
|
124
|
+
*/
|
|
125
|
+
export declare function partitionFixesByGrant(fixes: readonly ValidateFixRecord[], granted: ReadonlySet<ValidateFixScope>): {
|
|
126
|
+
applicable: ValidateFixRecord[];
|
|
127
|
+
gated: ValidateFixRecord[];
|
|
128
|
+
};
|
|
129
|
+
/** Compact serialization of a fix for planned/applied output rows. */
|
|
130
|
+
export declare function toFixOutputRow(fix: ValidateFixRecord): Record<string, unknown>;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix planning for `pm validate --auto-fix` / `--prune-missing` (pm-c3sz,
|
|
3
|
+
* pm-8jss, pm-0v2m).
|
|
4
|
+
*
|
|
5
|
+
* Pure module: planners turn check findings into declarative
|
|
6
|
+
* {@link ValidateFixRecord}s; the validate command decides whether to apply
|
|
7
|
+
* them (apply mode), preview them (`--dry-run`), or withhold gated fixes
|
|
8
|
+
* (lifecycle structural changes require an explicit `--fix-scope lifecycle`).
|
|
9
|
+
*
|
|
10
|
+
* Safety invariants:
|
|
11
|
+
* - Every planned fix is deterministic and non-destructive: it only sets a
|
|
12
|
+
* derivable field value or removes a stale LINK (never a real file).
|
|
13
|
+
* - No fix ever closes, deletes, or cancels an item.
|
|
14
|
+
* - Lifecycle fixes (reparent / unset parent) are structural, so they are
|
|
15
|
+
* planned with `gate: "lifecycle"` and only applied when that scope was
|
|
16
|
+
* explicitly granted.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
!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]="7163fbbf-1a9c-52e0-a1d5-6034abefc50f")}catch(e){}}();
|
|
20
|
+
import { EXIT_CODE } from "../shared/constants.js";
|
|
21
|
+
import { PmCliError } from "../shared/errors.js";
|
|
22
|
+
/** Scopes auto-applied without an explicit `--fix-scope` (safe field backfills). */
|
|
23
|
+
export const DEFAULT_GRANTED_FIX_SCOPES = ["metadata", "resolution"];
|
|
24
|
+
/** Scopes accepted by `--fix-scope` (lifecycle is the opt-in structural scope). */
|
|
25
|
+
export const SUPPORTED_FIX_SCOPES = ["metadata", "resolution", "lifecycle"];
|
|
26
|
+
/** Default resolution backfilled onto closed items with no derivable source text. */
|
|
27
|
+
export const DEFAULT_RESOLUTION_BACKFILL_VALUE = "completed";
|
|
28
|
+
function quoteForCommand(value) {
|
|
29
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
30
|
+
}
|
|
31
|
+
function toMeaningfulValue(value) {
|
|
32
|
+
const trimmed = value?.trim();
|
|
33
|
+
return trimmed !== undefined && trimmed.length > 0 ? trimmed : undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Plan resolution backfills for closed items flagged by the resolution check.
|
|
37
|
+
* Only the `resolution` field is mechanical enough to auto-fix: it derives
|
|
38
|
+
* from the item's own `close_reason` when present and falls back to the
|
|
39
|
+
* `"completed"` default. `expected_result` / `actual_result` stay hint-only —
|
|
40
|
+
* no deterministic source text exists for them.
|
|
41
|
+
*/
|
|
42
|
+
export function planResolutionBackfillFixes(rows) {
|
|
43
|
+
const fixes = [];
|
|
44
|
+
for (const row of rows) {
|
|
45
|
+
if (!row.missing_fields.includes("resolution")) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const value = toMeaningfulValue(row.close_reason) ?? DEFAULT_RESOLUTION_BACKFILL_VALUE;
|
|
49
|
+
fixes.push({
|
|
50
|
+
item_id: row.id,
|
|
51
|
+
check: "resolution",
|
|
52
|
+
field: "resolution",
|
|
53
|
+
kind: "set_resolution",
|
|
54
|
+
value,
|
|
55
|
+
command: `pm update ${row.id} --resolution ${quoteForCommand(value)}`,
|
|
56
|
+
gate: "resolution",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return fixes;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Plan close_reason backfills for closed items flagged by the metadata check.
|
|
63
|
+
* Only derivable when the item already carries a resolution; items missing
|
|
64
|
+
* both stay hint-only (any synthesized reason would be fabricated, not
|
|
65
|
+
* derived).
|
|
66
|
+
*/
|
|
67
|
+
export function planCloseReasonBackfillFixes(rows) {
|
|
68
|
+
const fixes = [];
|
|
69
|
+
for (const row of rows) {
|
|
70
|
+
const value = toMeaningfulValue(row.resolution);
|
|
71
|
+
if (value === undefined) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
fixes.push({
|
|
75
|
+
item_id: row.id,
|
|
76
|
+
check: "metadata",
|
|
77
|
+
field: "close_reason",
|
|
78
|
+
kind: "set_close_reason",
|
|
79
|
+
value,
|
|
80
|
+
command: `pm update ${row.id} --close-reason ${quoteForCommand(value)}`,
|
|
81
|
+
gate: "metadata",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return fixes;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Plan lifecycle fixes for active items whose parent is terminal (pm-8jss /
|
|
88
|
+
* GH-168). When the terminal parent has an active grandparent, the child is
|
|
89
|
+
* reparented one level up (it stays inside the same hierarchy); otherwise the
|
|
90
|
+
* parent link is cleared so the item surfaces as unparented active work.
|
|
91
|
+
* Either way the item itself is never closed or mutated beyond `parent` —
|
|
92
|
+
* and every fix carries `gate: "lifecycle"` so it is only applied under an
|
|
93
|
+
* explicit `--fix-scope lifecycle`.
|
|
94
|
+
*/
|
|
95
|
+
export function planTerminalParentFixes(rows) {
|
|
96
|
+
return rows.map((row) => {
|
|
97
|
+
if (row.grandparent_id !== undefined && row.grandparent_active === true) {
|
|
98
|
+
return {
|
|
99
|
+
item_id: row.id,
|
|
100
|
+
check: "lifecycle",
|
|
101
|
+
field: "parent",
|
|
102
|
+
kind: "reparent",
|
|
103
|
+
parent_id: row.grandparent_id,
|
|
104
|
+
command: `pm update ${row.id} --parent ${row.grandparent_id}`,
|
|
105
|
+
gate: "lifecycle",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
item_id: row.id,
|
|
110
|
+
check: "lifecycle",
|
|
111
|
+
field: "parent",
|
|
112
|
+
kind: "unset_parent",
|
|
113
|
+
command: `pm update ${row.id} --unset parent`,
|
|
114
|
+
gate: "lifecycle",
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Plan link prunes for `--prune-missing` (pm-0v2m / GH-184). Only links whose
|
|
120
|
+
* stale path classified as `deleted` are pruned; `moved` links keep their
|
|
121
|
+
* relink candidates in the files-check details instead of being dropped, so
|
|
122
|
+
* recoverable link information is never destroyed. Link removal only — real
|
|
123
|
+
* files are never touched.
|
|
124
|
+
*/
|
|
125
|
+
export function planStaleLinkPruneFixes(rows) {
|
|
126
|
+
const fixes = [];
|
|
127
|
+
for (const row of rows) {
|
|
128
|
+
if (row.classification !== "deleted") {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const noun = row.link_kind === "files" ? "files" : "docs";
|
|
132
|
+
fixes.push({
|
|
133
|
+
item_id: row.item_id,
|
|
134
|
+
check: "files",
|
|
135
|
+
field: row.link_kind,
|
|
136
|
+
kind: row.link_kind === "files" ? "prune_file_link" : "prune_doc_link",
|
|
137
|
+
path: row.path,
|
|
138
|
+
command: `pm ${noun} ${row.item_id} --remove ${quoteForCommand(row.path)}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return fixes;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Resolve the granted `--fix-scope` set (repeatable and/or comma-separated).
|
|
145
|
+
* With no explicit scopes the safe field-backfill scopes (metadata,
|
|
146
|
+
* resolution) are granted; lifecycle must always be named explicitly. Unknown
|
|
147
|
+
* values fail fast with the supported list.
|
|
148
|
+
*/
|
|
149
|
+
export function resolveGrantedFixScopes(rawScopes) {
|
|
150
|
+
const tokens = (rawScopes ?? [])
|
|
151
|
+
.flatMap((raw) => raw.split(","))
|
|
152
|
+
.map((raw) => raw.trim())
|
|
153
|
+
.filter((raw) => raw.length > 0);
|
|
154
|
+
if (tokens.length === 0) {
|
|
155
|
+
if (rawScopes !== undefined && rawScopes.length > 0) {
|
|
156
|
+
throw new PmCliError(`--fix-scope values must not be empty. Supported values: ${SUPPORTED_FIX_SCOPES.join(", ")}.`, EXIT_CODE.USAGE);
|
|
157
|
+
}
|
|
158
|
+
return new Set(DEFAULT_GRANTED_FIX_SCOPES);
|
|
159
|
+
}
|
|
160
|
+
const granted = new Set();
|
|
161
|
+
for (const raw of tokens) {
|
|
162
|
+
const normalized = raw.toLowerCase().replaceAll("-", "_");
|
|
163
|
+
if (SUPPORTED_FIX_SCOPES.includes(normalized)) {
|
|
164
|
+
granted.add(normalized);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
throw new PmCliError(`Unknown --fix-scope value "${raw}". Supported values: ${SUPPORTED_FIX_SCOPES.join(", ")}.`, EXIT_CODE.USAGE);
|
|
168
|
+
}
|
|
169
|
+
return granted;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Split a fix plan into the records that may be applied under the granted
|
|
173
|
+
* scopes and the gated records that were withheld. `--fix-scope` is an exact
|
|
174
|
+
* allowlist: every `--auto-fix` record requires its gate scope in `granted`.
|
|
175
|
+
* Ungated records (`--prune-missing` link prunes, governed by their own flag)
|
|
176
|
+
* are always applicable.
|
|
177
|
+
*/
|
|
178
|
+
export function partitionFixesByGrant(fixes, granted) {
|
|
179
|
+
const applicable = [];
|
|
180
|
+
const gated = [];
|
|
181
|
+
for (const fix of fixes) {
|
|
182
|
+
if (fix.gate !== undefined && !granted.has(fix.gate)) {
|
|
183
|
+
gated.push(fix);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
applicable.push(fix);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return { applicable, gated };
|
|
190
|
+
}
|
|
191
|
+
/** Compact serialization of a fix for planned/applied output rows. */
|
|
192
|
+
export function toFixOutputRow(fix) {
|
|
193
|
+
return {
|
|
194
|
+
item_id: fix.item_id,
|
|
195
|
+
check: fix.check,
|
|
196
|
+
field: fix.field,
|
|
197
|
+
command: fix.command,
|
|
198
|
+
...(fix.gate !== undefined ? { gate: fix.gate } : {}),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=fix-planning.js.map
|
|
202
|
+
//# debugId=7163fbbf-1a9c-52e0-a1d5-6034abefc50f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-planning.js","sources":["core/validate/fix-planning.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Fix planning for `pm validate --auto-fix` / `--prune-missing` (pm-c3sz,\n * pm-8jss, pm-0v2m).\n *\n * Pure module: planners turn check findings into declarative\n * {@link ValidateFixRecord}s; the validate command decides whether to apply\n * them (apply mode), preview them (`--dry-run`), or withhold gated fixes\n * (lifecycle structural changes require an explicit `--fix-scope lifecycle`).\n *\n * Safety invariants:\n * - Every planned fix is deterministic and non-destructive: it only sets a\n * derivable field value or removes a stale LINK (never a real file).\n * - No fix ever closes, deletes, or cancels an item.\n * - Lifecycle fixes (reparent / unset parent) are structural, so they are\n * planned with `gate: \"lifecycle\"` and only applied when that scope was\n * explicitly granted.\n */\n\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\n\nexport type ValidateFixCheck = \"metadata\" | \"resolution\" | \"lifecycle\" | \"files\";\n\nexport type ValidateFixKind =\n | \"set_resolution\"\n | \"set_close_reason\"\n | \"reparent\"\n | \"unset_parent\"\n | \"prune_file_link\"\n | \"prune_doc_link\";\n\nexport type ValidateFixScope = \"metadata\" | \"resolution\" | \"lifecycle\";\n\n/** Scopes auto-applied without an explicit `--fix-scope` (safe field backfills). */\nexport const DEFAULT_GRANTED_FIX_SCOPES: readonly ValidateFixScope[] = [\"metadata\", \"resolution\"];\n\n/** Scopes accepted by `--fix-scope` (lifecycle is the opt-in structural scope). */\nexport const SUPPORTED_FIX_SCOPES: readonly ValidateFixScope[] = [\"metadata\", \"resolution\", \"lifecycle\"];\n\nexport interface ValidateFixRecord {\n /** Item the fix targets. */\n item_id: string;\n /** Validate check the finding came from. */\n check: ValidateFixCheck;\n /** Front-matter field (or link list) the fix changes. */\n field: string;\n /** Declarative fix kind the applier dispatches on. */\n kind: ValidateFixKind;\n /** Equivalent standalone `pm` command for the fix. */\n command: string;\n /** New value for set-field fixes. */\n value?: string;\n /** Stale link path for prune fixes. */\n path?: string;\n /** Target parent id for reparent fixes. */\n parent_id?: string;\n /**\n * Fix scope the `--fix-scope` allowlist must grant for the fix to be\n * applied. Every `--auto-fix` record carries one (the granted default is\n * metadata+resolution; lifecycle must be named explicitly). Absent only on\n * `--prune-missing` records, which are governed by their own flag.\n */\n gate?: ValidateFixScope;\n}\n\n/** Default resolution backfilled onto closed items with no derivable source text. */\nexport const DEFAULT_RESOLUTION_BACKFILL_VALUE = \"completed\";\n\nfunction quoteForCommand(value: string): string {\n return `\"${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll('\"', '\\\\\"')}\"`;\n}\n\nfunction toMeaningfulValue(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n return trimmed !== undefined && trimmed.length > 0 ? trimmed : undefined;\n}\n\nexport interface ResolutionBackfillRow {\n id: string;\n /** Resolution-check missing field keys for this closed item. */\n missing_fields: readonly string[];\n /** The item's close_reason, when present (preferred derivation source). */\n close_reason?: string;\n}\n\n/**\n * Plan resolution backfills for closed items flagged by the resolution check.\n * Only the `resolution` field is mechanical enough to auto-fix: it derives\n * from the item's own `close_reason` when present and falls back to the\n * `\"completed\"` default. `expected_result` / `actual_result` stay hint-only —\n * no deterministic source text exists for them.\n */\nexport function planResolutionBackfillFixes(rows: readonly ResolutionBackfillRow[]): ValidateFixRecord[] {\n const fixes: ValidateFixRecord[] = [];\n for (const row of rows) {\n if (!row.missing_fields.includes(\"resolution\")) {\n continue;\n }\n const value = toMeaningfulValue(row.close_reason) ?? DEFAULT_RESOLUTION_BACKFILL_VALUE;\n fixes.push({\n item_id: row.id,\n check: \"resolution\",\n field: \"resolution\",\n kind: \"set_resolution\",\n value,\n command: `pm update ${row.id} --resolution ${quoteForCommand(value)}`,\n gate: \"resolution\",\n });\n }\n return fixes;\n}\n\nexport interface CloseReasonBackfillRow {\n id: string;\n /** The item's resolution, when present (the only derivation source). */\n resolution?: string;\n}\n\n/**\n * Plan close_reason backfills for closed items flagged by the metadata check.\n * Only derivable when the item already carries a resolution; items missing\n * both stay hint-only (any synthesized reason would be fabricated, not\n * derived).\n */\nexport function planCloseReasonBackfillFixes(rows: readonly CloseReasonBackfillRow[]): ValidateFixRecord[] {\n const fixes: ValidateFixRecord[] = [];\n for (const row of rows) {\n const value = toMeaningfulValue(row.resolution);\n if (value === undefined) {\n continue;\n }\n fixes.push({\n item_id: row.id,\n check: \"metadata\",\n field: \"close_reason\",\n kind: \"set_close_reason\",\n value,\n command: `pm update ${row.id} --close-reason ${quoteForCommand(value)}`,\n gate: \"metadata\",\n });\n }\n return fixes;\n}\n\nexport interface TerminalParentFixRow {\n id: string;\n parent_id: string;\n /** The terminal parent's own parent, when one exists. */\n grandparent_id?: string;\n /** True when the grandparent exists and is NOT terminal (safe reparent target). */\n grandparent_active?: boolean;\n}\n\n/**\n * Plan lifecycle fixes for active items whose parent is terminal (pm-8jss /\n * GH-168). When the terminal parent has an active grandparent, the child is\n * reparented one level up (it stays inside the same hierarchy); otherwise the\n * parent link is cleared so the item surfaces as unparented active work.\n * Either way the item itself is never closed or mutated beyond `parent` —\n * and every fix carries `gate: \"lifecycle\"` so it is only applied under an\n * explicit `--fix-scope lifecycle`.\n */\nexport function planTerminalParentFixes(rows: readonly TerminalParentFixRow[]): ValidateFixRecord[] {\n return rows.map((row) => {\n if (row.grandparent_id !== undefined && row.grandparent_active === true) {\n return {\n item_id: row.id,\n check: \"lifecycle\" as const,\n field: \"parent\",\n kind: \"reparent\" as const,\n parent_id: row.grandparent_id,\n command: `pm update ${row.id} --parent ${row.grandparent_id}`,\n gate: \"lifecycle\" as const,\n };\n }\n return {\n item_id: row.id,\n check: \"lifecycle\" as const,\n field: \"parent\",\n kind: \"unset_parent\" as const,\n command: `pm update ${row.id} --unset parent`,\n gate: \"lifecycle\" as const,\n };\n });\n}\n\nexport interface StaleLinkPruneRow {\n item_id: string;\n path: string;\n link_kind: \"files\" | \"docs\";\n classification: \"moved\" | \"deleted\";\n}\n\n/**\n * Plan link prunes for `--prune-missing` (pm-0v2m / GH-184). Only links whose\n * stale path classified as `deleted` are pruned; `moved` links keep their\n * relink candidates in the files-check details instead of being dropped, so\n * recoverable link information is never destroyed. Link removal only — real\n * files are never touched.\n */\nexport function planStaleLinkPruneFixes(rows: readonly StaleLinkPruneRow[]): ValidateFixRecord[] {\n const fixes: ValidateFixRecord[] = [];\n for (const row of rows) {\n if (row.classification !== \"deleted\") {\n continue;\n }\n const noun = row.link_kind === \"files\" ? \"files\" : \"docs\";\n fixes.push({\n item_id: row.item_id,\n check: \"files\",\n field: row.link_kind,\n kind: row.link_kind === \"files\" ? \"prune_file_link\" : \"prune_doc_link\",\n path: row.path,\n command: `pm ${noun} ${row.item_id} --remove ${quoteForCommand(row.path)}`,\n });\n }\n return fixes;\n}\n\n/**\n * Resolve the granted `--fix-scope` set (repeatable and/or comma-separated).\n * With no explicit scopes the safe field-backfill scopes (metadata,\n * resolution) are granted; lifecycle must always be named explicitly. Unknown\n * values fail fast with the supported list.\n */\nexport function resolveGrantedFixScopes(rawScopes: readonly string[] | undefined): Set<ValidateFixScope> {\n const tokens = (rawScopes ?? [])\n .flatMap((raw) => raw.split(\",\"))\n .map((raw) => raw.trim())\n .filter((raw) => raw.length > 0);\n if (tokens.length === 0) {\n if (rawScopes !== undefined && rawScopes.length > 0) {\n throw new PmCliError(\n `--fix-scope values must not be empty. Supported values: ${SUPPORTED_FIX_SCOPES.join(\", \")}.`,\n EXIT_CODE.USAGE,\n );\n }\n return new Set(DEFAULT_GRANTED_FIX_SCOPES);\n }\n const granted = new Set<ValidateFixScope>();\n for (const raw of tokens) {\n const normalized = raw.toLowerCase().replaceAll(\"-\", \"_\");\n if ((SUPPORTED_FIX_SCOPES as readonly string[]).includes(normalized)) {\n granted.add(normalized as ValidateFixScope);\n continue;\n }\n throw new PmCliError(\n `Unknown --fix-scope value \"${raw}\". Supported values: ${SUPPORTED_FIX_SCOPES.join(\", \")}.`,\n EXIT_CODE.USAGE,\n );\n }\n return granted;\n}\n\n/**\n * Split a fix plan into the records that may be applied under the granted\n * scopes and the gated records that were withheld. `--fix-scope` is an exact\n * allowlist: every `--auto-fix` record requires its gate scope in `granted`.\n * Ungated records (`--prune-missing` link prunes, governed by their own flag)\n * are always applicable.\n */\nexport function partitionFixesByGrant(\n fixes: readonly ValidateFixRecord[],\n granted: ReadonlySet<ValidateFixScope>,\n): { applicable: ValidateFixRecord[]; gated: ValidateFixRecord[] } {\n const applicable: ValidateFixRecord[] = [];\n const gated: ValidateFixRecord[] = [];\n for (const fix of fixes) {\n if (fix.gate !== undefined && !granted.has(fix.gate)) {\n gated.push(fix);\n } else {\n applicable.push(fix);\n }\n }\n return { applicable, gated };\n}\n\n/** Compact serialization of a fix for planned/applied output rows. */\nexport function toFixOutputRow(fix: ValidateFixRecord): Record<string, unknown> {\n return {\n item_id: fix.item_id,\n check: fix.check,\n field: fix.field,\n command: fix.command,\n ...(fix.gate !== undefined ? { gate: fix.gate } : {}),\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAcjD,oFAAoF;AACpF,MAAM,CAAC,MAAM,0BAA0B,GAAgC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAElG,mFAAmF;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAgC,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AA4BzG,qFAAqF;AACrF,MAAM,CAAC,MAAM,iCAAiC,GAAG,WAAW,CAAC;AAE7D,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AACtE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB;IAClD,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAUD;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAsC;IAChF,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,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AAI,CAAC,GAAG,EAC3F,SAAS,CAAC,KAAK,CAChB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAmC,EACnC,OAAsC;IAEtC,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAC,GAAsB;IACnD,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC","debugId":"7163fbbf-1a9c-52e0-a1d5-6034abefc50f"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-item-type grouping of missing-required-field counts for
|
|
3
|
+
* `pm validate --check-metadata` (pm-pmyq / GH-172).
|
|
4
|
+
*
|
|
5
|
+
* Pure module: callers stream `(item_type, field)` pairs — one per missing
|
|
6
|
+
* required field occurrence — and receive a compact, deterministically sorted
|
|
7
|
+
* `missing_by_type` map of counts (never row dumps), e.g.
|
|
8
|
+
* `{ Task: { close_reason: 3, reviewer: 1 } }`.
|
|
9
|
+
*/
|
|
10
|
+
export interface MissingFieldOccurrence {
|
|
11
|
+
/** Item type name as stored in front matter (e.g. "Task"). */
|
|
12
|
+
item_type: string;
|
|
13
|
+
/** Required metadata field that is missing on the item. */
|
|
14
|
+
field: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Aggregate missing-field occurrences into `{ type: { field: count } }` with
|
|
18
|
+
* both levels sorted lexicographically for stable, diff-friendly output.
|
|
19
|
+
* Zero counts never appear (only observed occurrences are aggregated).
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildMissingByTypeCounts(occurrences: Iterable<MissingFieldOccurrence>): Record<string, Record<string, number>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-item-type grouping of missing-required-field counts for
|
|
3
|
+
* `pm validate --check-metadata` (pm-pmyq / GH-172).
|
|
4
|
+
*
|
|
5
|
+
* Pure module: callers stream `(item_type, field)` pairs — one per missing
|
|
6
|
+
* required field occurrence — and receive a compact, deterministically sorted
|
|
7
|
+
* `missing_by_type` map of counts (never row dumps), e.g.
|
|
8
|
+
* `{ Task: { close_reason: 3, reviewer: 1 } }`.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Aggregate missing-field occurrences into `{ type: { field: count } }` with
|
|
12
|
+
* both levels sorted lexicographically for stable, diff-friendly output.
|
|
13
|
+
* Zero counts never appear (only observed occurrences are aggregated).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
!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]="16988d98-5a10-5e0a-952c-0a6289ab5935")}catch(e){}}();
|
|
17
|
+
export function buildMissingByTypeCounts(occurrences) {
|
|
18
|
+
const countsByType = new Map();
|
|
19
|
+
for (const occurrence of occurrences) {
|
|
20
|
+
let fieldCounts = countsByType.get(occurrence.item_type);
|
|
21
|
+
if (!fieldCounts) {
|
|
22
|
+
fieldCounts = new Map();
|
|
23
|
+
countsByType.set(occurrence.item_type, fieldCounts);
|
|
24
|
+
}
|
|
25
|
+
fieldCounts.set(occurrence.field, (fieldCounts.get(occurrence.field) ?? 0) + 1);
|
|
26
|
+
}
|
|
27
|
+
const result = {};
|
|
28
|
+
for (const type of [...countsByType.keys()].sort((left, right) => left.localeCompare(right))) {
|
|
29
|
+
const fieldCounts = countsByType.get(type);
|
|
30
|
+
const fields = {};
|
|
31
|
+
for (const field of [...fieldCounts.keys()].sort((left, right) => left.localeCompare(right))) {
|
|
32
|
+
fields[field] = fieldCounts.get(field);
|
|
33
|
+
}
|
|
34
|
+
result[type] = fields;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=missing-by-type.js.map
|
|
39
|
+
//# debugId=16988d98-5a10-5e0a-952c-0a6289ab5935
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-by-type.js","sources":["core/validate/missing-by-type.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Per-item-type grouping of missing-required-field counts for\n * `pm validate --check-metadata` (pm-pmyq / GH-172).\n *\n * Pure module: callers stream `(item_type, field)` pairs — one per missing\n * required field occurrence — and receive a compact, deterministically sorted\n * `missing_by_type` map of counts (never row dumps), e.g.\n * `{ Task: { close_reason: 3, reviewer: 1 } }`.\n */\n\nexport interface MissingFieldOccurrence {\n /** Item type name as stored in front matter (e.g. \"Task\"). */\n item_type: string;\n /** Required metadata field that is missing on the item. */\n field: string;\n}\n\n/**\n * Aggregate missing-field occurrences into `{ type: { field: count } }` with\n * both levels sorted lexicographically for stable, diff-friendly output.\n * Zero counts never appear (only observed occurrences are aggregated).\n */\nexport function buildMissingByTypeCounts(\n occurrences: Iterable<MissingFieldOccurrence>,\n): Record<string, Record<string, number>> {\n const countsByType = new Map<string, Map<string, number>>();\n for (const occurrence of occurrences) {\n let fieldCounts = countsByType.get(occurrence.item_type);\n if (!fieldCounts) {\n fieldCounts = new Map<string, number>();\n countsByType.set(occurrence.item_type, fieldCounts);\n }\n fieldCounts.set(occurrence.field, (fieldCounts.get(occurrence.field) ?? 0) + 1);\n }\n\n const result: Record<string, Record<string, number>> = {};\n for (const type of [...countsByType.keys()].sort((left, right) => left.localeCompare(right))) {\n const fieldCounts = countsByType.get(type)!;\n const fields: Record<string, number> = {};\n for (const field of [...fieldCounts.keys()].sort((left, right) => left.localeCompare(right))) {\n fields[field] = fieldCounts.get(field)!;\n }\n result[type] = fields;\n }\n return result;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH;;;;GAIG;;;AACH,MAAM,UAAU,wBAAwB,CACtC,WAA6C;IAE7C,MAAM,YAAY,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC5D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;YACxC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,MAAM,GAA2C,EAAE,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,I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