@unbrained/pm-cli 2026.6.12 → 2026.6.16
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/CHANGELOG.md +103 -0
- package/README.md +2 -2
- package/dist/cli/bootstrap-args.d.ts +29 -0
- package/dist/cli/bootstrap-args.js +11 -4
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/commander-usage.d.ts +12 -0
- package/dist/cli/commander-usage.js +18 -7
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/activity.d.ts +19 -0
- package/dist/cli/commands/activity.js +12 -2
- package/dist/cli/commands/activity.js.map +1 -1
- package/dist/cli/commands/aggregate.d.ts +58 -0
- package/dist/cli/commands/aggregate.js +48 -15
- package/dist/cli/commands/aggregate.js.map +1 -1
- package/dist/cli/commands/annotation-command.d.ts +6 -1
- package/dist/cli/commands/annotation-command.js +72 -2
- package/dist/cli/commands/annotation-command.js.map +1 -1
- package/dist/cli/commands/append.js +4 -3
- package/dist/cli/commands/append.js.map +1 -1
- package/dist/cli/commands/close-many.d.ts +20 -0
- package/dist/cli/commands/close-many.js +14 -23
- package/dist/cli/commands/close-many.js.map +1 -1
- package/dist/cli/commands/close.js +37 -4
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/comments-audit.js +3 -2
- package/dist/cli/commands/comments-audit.js.map +1 -1
- package/dist/cli/commands/comments.d.ts +2 -0
- package/dist/cli/commands/comments.js +49 -23
- package/dist/cli/commands/comments.js.map +1 -1
- package/dist/cli/commands/completion.js +269 -8
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.d.ts +51 -1
- package/dist/cli/commands/config.js +50 -12
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/context.d.ts +79 -1
- package/dist/cli/commands/context.js +151 -25
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.d.ts +80 -1
- package/dist/cli/commands/contracts.js +54 -4
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.d.ts +49 -0
- package/dist/cli/commands/create.js +112 -7
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/dedupe-audit.d.ts +33 -0
- package/dist/cli/commands/dedupe-audit.js +18 -14
- package/dist/cli/commands/dedupe-audit.js.map +1 -1
- package/dist/cli/commands/deps.js +7 -4
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/event-validation-messages.js +3 -3
- package/dist/cli/commands/event-validation-messages.js.map +1 -1
- package/dist/cli/commands/extension/bundled-catalog.d.ts +7 -0
- package/dist/cli/commands/extension/bundled-catalog.js +19 -15
- package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.d.ts +41 -1
- package/dist/cli/commands/extension/install-sources.js +26 -8
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/extension/shared.d.ts +5 -0
- package/dist/cli/commands/extension/shared.js +9 -3
- package/dist/cli/commands/extension/shared.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +133 -1
- package/dist/cli/commands/extension.js +127 -9
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/files.d.ts +30 -1
- package/dist/cli/commands/files.js +21 -2
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/focus.d.ts +11 -0
- package/dist/cli/commands/focus.js +86 -0
- package/dist/cli/commands/focus.js.map +1 -0
- package/dist/cli/commands/get.d.ts +9 -2
- package/dist/cli/commands/get.js +34 -6
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/guide.d.ts +5 -0
- package/dist/cli/commands/guide.js +6 -3
- package/dist/cli/commands/guide.js.map +1 -1
- package/dist/cli/commands/health.d.ts +109 -0
- package/dist/cli/commands/health.js +87 -35
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-compact.js +27 -36
- package/dist/cli/commands/history-compact.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +46 -0
- package/dist/cli/commands/history-redact.js +99 -67
- package/dist/cli/commands/history-redact.js.map +1 -1
- package/dist/cli/commands/history-repair.js +34 -37
- package/dist/cli/commands/history-repair.js.map +1 -1
- package/dist/cli/commands/history.js +6 -2
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +3 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init-agent-guidance.d.ts +54 -0
- package/dist/cli/commands/init-agent-guidance.js +31 -4
- package/dist/cli/commands/init-agent-guidance.js.map +1 -1
- package/dist/cli/commands/init.d.ts +36 -1
- package/dist/cli/commands/init.js +38 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learnings.js +4 -3
- package/dist/cli/commands/learnings.js.map +1 -1
- package/dist/cli/commands/linked-test-parsers.d.ts +5 -0
- package/dist/cli/commands/linked-test-parsers.js +5 -2
- package/dist/cli/commands/linked-test-parsers.js.map +1 -1
- package/dist/cli/commands/list-filter-shared.d.ts +8 -0
- package/dist/cli/commands/list-filter-shared.js +70 -0
- package/dist/cli/commands/list-filter-shared.js.map +1 -0
- package/dist/cli/commands/list.d.ts +116 -0
- package/dist/cli/commands/list.js +194 -6
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/normalize.js +16 -2
- package/dist/cli/commands/normalize.js.map +1 -1
- package/dist/cli/commands/notes.js +4 -3
- package/dist/cli/commands/notes.js.map +1 -1
- package/dist/cli/commands/plan.js +3 -2
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/reindex.d.ts +83 -0
- package/dist/cli/commands/reindex.js +45 -10
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/restore.d.ts +40 -1
- package/dist/cli/commands/restore.js +27 -2
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +18 -0
- package/dist/cli/commands/schema.js +30 -3
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/search.d.ts +289 -1
- package/dist/cli/commands/search.js +367 -60
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/stats.d.ts +38 -0
- package/dist/cli/commands/stats.js +38 -10
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/telemetry.js +5 -3
- package/dist/cli/commands/telemetry.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +18 -0
- package/dist/cli/commands/templates.js +9 -2
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/commands/test-all.d.ts +5 -0
- package/dist/cli/commands/test-all.js +9 -3
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/commands/test.d.ts +70 -1
- package/dist/cli/commands/test.js +84 -3
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update-many.d.ts +34 -1
- package/dist/cli/commands/update-many.js +60 -31
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.d.ts +71 -0
- package/dist/cli/commands/update.js +74 -8
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/upgrade.d.ts +28 -1
- package/dist/cli/commands/upgrade.js +17 -4
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +114 -0
- package/dist/cli/commands/validate.js +154 -9
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.d.ts +30 -0
- package/dist/cli/error-guidance.js +68 -6
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-options.js +9 -7
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/help-content.d.ts +8 -0
- package/dist/cli/help-content.js +30 -6
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.d.ts +19 -1
- package/dist/cli/help-json-payload.js +16 -7
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.d.ts +223 -0
- package/dist/cli/main.js +214 -46
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +62 -5
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.d.ts +16 -0
- package/dist/cli/register-mutation.js +210 -40
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.d.ts +8 -0
- package/dist/cli/register-operations.js +33 -11
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +9 -6
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +4 -0
- package/dist/cli/registration-helpers.js +124 -38
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/chunks/activity-5P2KQCTH.js +18 -0
- package/dist/cli-bundle/chunks/{activity-XADJOG6G.js → activity-MJGTX4LO.js} +13 -11
- package/dist/cli-bundle/chunks/{aggregate-OD36DJU5.js → aggregate-MH3GROKB.js} +54 -25
- package/dist/cli-bundle/chunks/aggregate-MH3GROKB.js.map +7 -0
- package/dist/cli-bundle/chunks/{aggregate-6OTS3AOO.js → aggregate-OUGCDFNC.js} +55 -26
- package/dist/cli-bundle/chunks/aggregate-OUGCDFNC.js.map +1 -0
- package/dist/cli-bundle/chunks/{append-JYWO4P7W.js → append-2Q4BPUBW.js} +10 -10
- package/dist/cli-bundle/chunks/{append-JYWO4P7W.js.map → append-2Q4BPUBW.js.map} +2 -2
- package/dist/cli-bundle/chunks/{append-KG55G7S3.js → append-VCRUG2W6.js} +11 -11
- package/dist/cli-bundle/chunks/append-VCRUG2W6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IGVJRZ6H.js → chunk-2IUJBMKS.js} +10 -9
- package/dist/cli-bundle/chunks/{chunk-IGVJRZ6H.js.map → chunk-2IUJBMKS.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ATEES5SX.js → chunk-2JEGCDYT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XUC4C4PT.js → chunk-3WAULYOY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UIG4TW2H.js → chunk-3XOXWOGA.js} +359 -19
- package/dist/cli-bundle/chunks/chunk-3XOXWOGA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-3KLPFWZ4.js → chunk-4KBK4BA3.js} +16 -34
- package/dist/cli-bundle/chunks/chunk-4KBK4BA3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-OLKBSY4N.js → chunk-4VLB4JH2.js} +51 -8
- package/dist/cli-bundle/chunks/chunk-4VLB4JH2.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ZMW77VWV.js → chunk-656HPQPO.js} +27 -12
- package/dist/cli-bundle/chunks/chunk-656HPQPO.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CW6E4NAT.js → chunk-667XI4UJ.js} +309 -20
- package/dist/cli-bundle/chunks/chunk-667XI4UJ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5SCT2JCT.js → chunk-6BV7ENQL.js} +9 -8
- package/dist/cli-bundle/chunks/chunk-6BV7ENQL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js +35 -0
- package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VFUZV5EB.js → chunk-6NQXMGYU.js} +19 -8
- package/dist/cli-bundle/chunks/chunk-6NQXMGYU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GKIZW7SM.js → chunk-764O7EUA.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-764O7EUA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-QJMGRZO2.js → chunk-7AGIXLNK.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-7EILPFMA.js +404 -0
- package/dist/cli-bundle/chunks/chunk-7EILPFMA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HI7STVF2.js → chunk-7K2MXFMX.js} +14 -32
- package/dist/cli-bundle/chunks/chunk-7K2MXFMX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-TNAP7EJX.js → chunk-7L5VOUYP.js} +6 -17
- package/dist/cli-bundle/chunks/chunk-7L5VOUYP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-7ZGKNHUL.js +61 -0
- package/dist/cli-bundle/chunks/chunk-7ZGKNHUL.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-7IYFN5R7.js → chunk-A576QZDL.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-A576QZDL.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KBPQHXWG.js → chunk-AERT7KT3.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-ASM4DVRW.js +58 -0
- package/dist/cli-bundle/chunks/chunk-ASM4DVRW.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KWAXVAXX.js → chunk-B5Q7XC4K.js} +117 -37
- package/dist/cli-bundle/chunks/chunk-B5Q7XC4K.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-EWFY7SLA.js → chunk-BJWTFOZM.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-BJWTFOZM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XJDGS74Y.js → chunk-CBMETQ2U.js} +105 -31
- package/dist/cli-bundle/chunks/chunk-CBMETQ2U.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ESANVZF4.js → chunk-E6J2PEK6.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-VSRZRLG3.js → chunk-F2GC6L3N.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-I7NYDZDV.js → chunk-F7WSO5UX.js} +7 -18
- package/dist/cli-bundle/chunks/chunk-F7WSO5UX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-VAOUX6TK.js → chunk-FTAZLAR7.js} +8 -5
- package/dist/cli-bundle/chunks/{chunk-VAOUX6TK.js.map → chunk-FTAZLAR7.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-OASDW5UI.js → chunk-FXNT5LPX.js} +77 -9
- package/dist/cli-bundle/chunks/chunk-FXNT5LPX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-WUNFKP7M.js → chunk-G2YVUY7I.js} +14 -9
- package/dist/cli-bundle/chunks/chunk-G2YVUY7I.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-L5EPZQIC.js → chunk-G3CEIXTV.js} +68 -19
- package/dist/cli-bundle/chunks/chunk-G3CEIXTV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UUWGCWBU.js → chunk-GAVE4MYM.js} +37 -63
- package/dist/cli-bundle/chunks/chunk-GAVE4MYM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-SXKNJPQ7.js → chunk-GQ4JKNMV.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-SXKNJPQ7.js.map → chunk-GQ4JKNMV.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-73ZPG2I3.js → chunk-GYMG7AG6.js} +36 -62
- package/dist/cli-bundle/chunks/chunk-GYMG7AG6.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-35P4GT6E.js → chunk-H6EH6ENJ.js} +362 -22
- package/dist/cli-bundle/chunks/chunk-H6EH6ENJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-F75JSIOZ.js → chunk-HDIDUME4.js} +45 -13
- package/dist/cli-bundle/chunks/chunk-HDIDUME4.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XWMF3POR.js → chunk-HPELHUTG.js} +122 -45
- package/dist/cli-bundle/chunks/chunk-HPELHUTG.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-QKW5D45B.js → chunk-II7OGE3V.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-II7OGE3V.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4HFU4UO2.js → chunk-ILHLIA47.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-4HFU4UO2.js.map → chunk-ILHLIA47.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-P5BJOMBB.js → chunk-IMQG4VR3.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-IMQG4VR3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-AX4GEVQC.js → chunk-IQVB3YDD.js} +88 -22
- package/dist/cli-bundle/chunks/chunk-IQVB3YDD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-I53JBTJW.js → chunk-KQ3LAMDO.js} +45 -13
- package/dist/cli-bundle/chunks/chunk-KQ3LAMDO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-A6LXQFO7.js → chunk-KTVETP66.js} +334 -253
- package/dist/cli-bundle/chunks/chunk-KTVETP66.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-DY6C42S6.js → chunk-KZYVTOG5.js} +26 -11
- package/dist/cli-bundle/chunks/chunk-KZYVTOG5.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HGLC63AU.js → chunk-L6FJPOT4.js} +11 -10
- package/dist/cli-bundle/chunks/{chunk-HGLC63AU.js.map → chunk-L6FJPOT4.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-FY4SPXSC.js → chunk-LV5FFQ7M.js} +354 -266
- package/dist/cli-bundle/chunks/chunk-LV5FFQ7M.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PNYAAB4S.js → chunk-LWGMDLQ6.js} +8 -3
- package/dist/cli-bundle/chunks/chunk-LWGMDLQ6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XTKJSVWH.js → chunk-M23HXJL3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-S26FESD4.js → chunk-MJZUZ2QE.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-I2IJY2NL.js → chunk-NCIBNERT.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-I2IJY2NL.js.map → chunk-NCIBNERT.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-TK5VZFHY.js → chunk-NIQHNDBZ.js} +76 -8
- package/dist/cli-bundle/chunks/chunk-NIQHNDBZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-C6SAP27O.js → chunk-O46LTCXQ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-YW6Q3RYZ.js → chunk-OCTQJP42.js} +19 -8
- package/dist/cli-bundle/chunks/{chunk-YW6Q3RYZ.js.map → chunk-OCTQJP42.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WPDMBIX6.js → chunk-OLTYNVJR.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-IUKD4W6Z.js → chunk-OY3P2I6B.js} +13 -8
- package/dist/cli-bundle/chunks/chunk-OY3P2I6B.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SO55HRA5.js → chunk-PZD7WPUC.js} +69 -20
- package/dist/cli-bundle/chunks/chunk-PZD7WPUC.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-HHHJ2GI3.js → chunk-Q5RLUCP3.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-Q5RLUCP3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-S2ZLDYGS.js → chunk-RKKIH2ZQ.js} +116 -36
- package/dist/cli-bundle/chunks/chunk-RKKIH2ZQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GWZSYR6X.js → chunk-SPYPC5CB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GWZSYR6X.js.map → chunk-SPYPC5CB.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-7AMK6DOW.js → chunk-SY4GKIWT.js} +88 -22
- package/dist/cli-bundle/chunks/chunk-SY4GKIWT.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-ZLMIWZUG.js → chunk-SY4PZWIZ.js} +7 -4
- package/dist/cli-bundle/chunks/{chunk-ZLMIWZUG.js.map → chunk-SY4PZWIZ.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-R2OUQVBK.js → chunk-T5VU7ROQ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-37CYVF73.js → chunk-TIRZIQRP.js} +121 -44
- package/dist/cli-bundle/chunks/chunk-TIRZIQRP.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-7UGSRQCL.js → chunk-TUB3DZAZ.js} +107 -33
- package/dist/cli-bundle/chunks/chunk-TUB3DZAZ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-UAR2VNCK.js +394 -0
- package/dist/cli-bundle/chunks/chunk-UAR2VNCK.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-P5U5EOMA.js → chunk-UBMCSJXX.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-ZYNJNPYD.js → chunk-UUKORJSN.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-R4VWYWRN.js → chunk-W3HFLORZ.js} +7 -2
- package/dist/cli-bundle/chunks/chunk-W3HFLORZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VPEAS7PS.js → chunk-WZCQVABQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js +32 -0
- package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4YFAGDRH.js → chunk-XLNNCKTN.js} +322 -19
- package/dist/cli-bundle/chunks/chunk-XLNNCKTN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RXAP6JL5.js → chunk-XNOY7TCB.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-XNOY7TCB.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-Y3YKK7CY.js → chunk-YGRPBFMA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QNJSITCX.js → chunk-YXTLI4XP.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-YXTLI4XP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-FDH2X65L.js → chunk-Z3MUNQRV.js} +52 -9
- package/dist/cli-bundle/chunks/chunk-Z3MUNQRV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XMBI6TNW.js → chunk-ZJRDVYZI.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-CCX4RSYZ.js → chunk-ZONXMSVB.js} +10 -9
- package/dist/cli-bundle/chunks/chunk-ZONXMSVB.js.map +1 -0
- package/dist/cli-bundle/chunks/{claim-2RDYMCTP.js → claim-4APLUXJW.js} +10 -10
- package/dist/cli-bundle/chunks/{claim-MJ7DZFC3.js → claim-NEO7AGWH.js} +10 -10
- package/dist/cli-bundle/chunks/{close-XLEKIQSW.js → close-3QABBNGU.js} +8 -8
- package/dist/cli-bundle/chunks/close-ILMZR3D7.js +13 -0
- package/dist/cli-bundle/chunks/{close-many-AOD4HSAZ.js → close-many-MIZLTYGL.js} +32 -20
- package/dist/cli-bundle/chunks/close-many-MIZLTYGL.js.map +1 -0
- package/dist/cli-bundle/chunks/{close-many-XKAQY5CQ.js → close-many-Q7Y5AHQI.js} +31 -19
- package/dist/cli-bundle/chunks/close-many-Q7Y5AHQI.js.map +7 -0
- package/dist/cli-bundle/chunks/{comments-RN5TG4ZN.js → comments-DAIQPOMU.js} +55 -31
- package/dist/cli-bundle/chunks/comments-DAIQPOMU.js.map +1 -0
- package/dist/cli-bundle/chunks/{comments-B4RWWDJT.js → comments-IWFSVM4P.js} +54 -30
- package/dist/cli-bundle/chunks/comments-IWFSVM4P.js.map +7 -0
- package/dist/cli-bundle/chunks/{config-3JXJ3XZ7.js → config-IOJELD6O.js} +45 -19
- package/dist/cli-bundle/chunks/config-IOJELD6O.js.map +1 -0
- package/dist/cli-bundle/chunks/{config-FZ4UDC4B.js → config-PXTMAYV3.js} +44 -18
- package/dist/cli-bundle/chunks/config-PXTMAYV3.js.map +7 -0
- package/dist/cli-bundle/chunks/{context-QBPO3BFM.js → context-QHJSCJW4.js} +128 -39
- package/dist/cli-bundle/chunks/context-QHJSCJW4.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-L36PIN35.js → context-XZS2VFKU.js} +127 -38
- package/dist/cli-bundle/chunks/context-XZS2VFKU.js.map +7 -0
- package/dist/cli-bundle/chunks/{contracts-2G66IGIA.js → contracts-B7U4OJTV.js} +54 -10
- package/dist/cli-bundle/chunks/contracts-B7U4OJTV.js.map +1 -0
- package/dist/cli-bundle/chunks/{contracts-PJCHYSO5.js → contracts-NSBVLXQ3.js} +54 -10
- package/dist/cli-bundle/chunks/contracts-NSBVLXQ3.js.map +7 -0
- package/dist/cli-bundle/chunks/{copy-FWIVTLBO.js → copy-Q64T5FD4.js} +7 -7
- package/dist/cli-bundle/chunks/{copy-ALU5WMHA.js → copy-SG34LCMU.js} +7 -7
- package/dist/cli-bundle/chunks/create-F5HZX2S4.js +30 -0
- package/dist/cli-bundle/chunks/{create-5433DP3G.js → create-IPAX2SNL.js} +16 -13
- package/dist/cli-bundle/chunks/{delete-Y2SGJBGY.js → delete-TLXR7LJ2.js} +7 -7
- package/dist/cli-bundle/chunks/{delete-IYTIYAJS.js → delete-VH3L7DZ6.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-CZ4PTVXU.js → deps-J3HBBLDB.js} +9 -10
- package/dist/cli-bundle/chunks/{deps-CZ4PTVXU.js.map → deps-J3HBBLDB.js.map} +2 -2
- package/dist/cli-bundle/chunks/{deps-6TSPOSGU.js → deps-XV6JJ6IN.js} +10 -11
- package/dist/cli-bundle/chunks/deps-XV6JJ6IN.js.map +1 -0
- package/dist/cli-bundle/chunks/{docs-MXLGZUIT.js → docs-GWDEB7JH.js} +9 -9
- package/dist/cli-bundle/chunks/{docs-I3BAF5WH.js → docs-RCLNSKID.js} +9 -9
- package/dist/cli-bundle/chunks/{extension-Q34OEWO5.js → extension-5RN65LHT.js} +7 -5
- package/dist/cli-bundle/chunks/{extension-WH2FOIOZ.js → extension-7KO2NX2A.js} +7 -5
- package/dist/cli-bundle/chunks/{files-GUXUM2MB.js → files-3TCQHUHA.js} +25 -11
- package/dist/cli-bundle/chunks/files-3TCQHUHA.js.map +1 -0
- package/dist/cli-bundle/chunks/{files-FYP3MDPX.js → files-5FDUPSEA.js} +24 -10
- package/dist/cli-bundle/chunks/files-5FDUPSEA.js.map +7 -0
- package/dist/cli-bundle/chunks/focus-7AQMNRSU.js +109 -0
- package/dist/cli-bundle/chunks/focus-7AQMNRSU.js.map +7 -0
- package/dist/cli-bundle/chunks/focus-HQXBYPKM.js +106 -0
- package/dist/cli-bundle/chunks/focus-HQXBYPKM.js.map +1 -0
- package/dist/cli-bundle/chunks/{gc-KGQG66SA.js → gc-2FGKYRJ4.js} +3 -3
- package/dist/cli-bundle/chunks/{gc-FENB2ESG.js → gc-5B6ABL3Z.js} +3 -3
- package/dist/cli-bundle/chunks/{get-PCHS7RA6.js → get-FUMVOJQD.js} +43 -16
- package/dist/cli-bundle/chunks/get-FUMVOJQD.js.map +1 -0
- package/dist/cli-bundle/chunks/{get-QARTE6BL.js → get-H5BZTW4A.js} +42 -15
- package/dist/cli-bundle/chunks/get-H5BZTW4A.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-E4D7KGHD.js → health-JSVOR6B4.js} +75 -49
- package/dist/cli-bundle/chunks/health-JSVOR6B4.js.map +1 -0
- package/dist/cli-bundle/chunks/{health-7MTXAVR2.js → health-LE2ZQGSM.js} +74 -48
- package/dist/cli-bundle/chunks/health-LE2ZQGSM.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-7WUAEWHW.js → history-QO4JVJJP.js} +10 -10
- package/dist/cli-bundle/chunks/history-SSXGGTVZ.js +20 -0
- package/dist/cli-bundle/chunks/{history-compact-LW27IPFK.js → history-compact-ID74DOUI.js} +37 -46
- package/dist/cli-bundle/chunks/history-compact-ID74DOUI.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-compact-3EJ3L2O7.js → history-compact-SDFRPZ4V.js} +38 -47
- package/dist/cli-bundle/chunks/history-compact-SDFRPZ4V.js.map +1 -0
- package/dist/cli-bundle/chunks/history-redact-VBH44Y7F.js +21 -0
- package/dist/cli-bundle/chunks/{history-redact-G72A4EJ4.js → history-redact-Z4P5MM3G.js} +13 -11
- package/dist/cli-bundle/chunks/{history-repair-OSQOKJ3E.js → history-repair-ANHEYWKF.js} +43 -48
- package/dist/cli-bundle/chunks/history-repair-ANHEYWKF.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-repair-SBK7P34V.js → history-repair-CKE7GLZR.js} +44 -49
- package/dist/cli-bundle/chunks/history-repair-CKE7GLZR.js.map +1 -0
- package/dist/cli-bundle/chunks/init-7FBQO77A.js +19 -0
- package/dist/cli-bundle/chunks/{init-S5WEGUJY.js → init-K6MSMB37.js} +11 -9
- package/dist/cli-bundle/chunks/{learnings-XK3P4ZDR.js → learnings-VIS3NOQV.js} +13 -12
- package/dist/cli-bundle/chunks/learnings-VIS3NOQV.js.map +7 -0
- package/dist/cli-bundle/chunks/{learnings-HQXSSKZ5.js → learnings-YYNB64GN.js} +14 -13
- package/dist/cli-bundle/chunks/learnings-YYNB64GN.js.map +1 -0
- package/dist/cli-bundle/chunks/list-7UE44A2R.js +29 -0
- package/dist/cli-bundle/chunks/list-UHMA3N2K.js +33 -0
- package/dist/cli-bundle/chunks/{notes-5T6P7C5V.js → notes-2HRMV67I.js} +14 -13
- package/dist/cli-bundle/chunks/notes-2HRMV67I.js.map +1 -0
- package/dist/cli-bundle/chunks/{notes-U5FZCSBT.js → notes-IN3UMA7W.js} +13 -12
- package/dist/cli-bundle/chunks/notes-IN3UMA7W.js.map +7 -0
- package/dist/cli-bundle/chunks/{plan-2YTQYWGM.js → plan-I3SVH7FV.js} +16 -15
- package/dist/cli-bundle/chunks/plan-I3SVH7FV.js.map +1 -0
- package/dist/cli-bundle/chunks/{plan-7IVSICR6.js → plan-PAWCCAPW.js} +15 -14
- package/dist/cli-bundle/chunks/plan-PAWCCAPW.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-4UPMHONX.js → register-list-query-N7Z7RTDM.js} +31 -22
- package/dist/cli-bundle/chunks/register-list-query-N7Z7RTDM.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-7VOW2C3W.js → register-list-query-OTIK4DVA.js} +32 -23
- package/dist/cli-bundle/chunks/register-list-query-OTIK4DVA.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-FARSGYRD.js → register-mutation-UFZK6Q57.js} +216 -66
- package/dist/cli-bundle/chunks/register-mutation-UFZK6Q57.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-LJDNVREU.js → register-mutation-XFORLS6D.js} +210 -67
- package/dist/cli-bundle/chunks/register-mutation-XFORLS6D.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-HCJKDUA6.js → register-operations-6ZCLKRBG.js} +53 -39
- package/dist/cli-bundle/chunks/register-operations-6ZCLKRBG.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-FFTYAL42.js → register-operations-ITE7JTH3.js} +54 -40
- package/dist/cli-bundle/chunks/register-operations-ITE7JTH3.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-6AVIUOCC.js → register-setup-7RKGE4BQ.js} +18 -21
- package/dist/cli-bundle/chunks/register-setup-7RKGE4BQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-KVNLO5OJ.js → register-setup-7UKEFKT6.js} +17 -20
- package/dist/cli-bundle/chunks/register-setup-7UKEFKT6.js.map +7 -0
- package/dist/cli-bundle/chunks/{restore-M6AFHMV4.js → restore-NNVPBBVJ.js} +13 -11
- package/dist/cli-bundle/chunks/restore-XXXLQ2XC.js +19 -0
- package/dist/cli-bundle/chunks/{schema-AINZ2IMM.js → schema-3HCLXCFX.js} +27 -9
- package/dist/cli-bundle/chunks/schema-3HCLXCFX.js.map +7 -0
- package/dist/cli-bundle/chunks/{schema-76HDZJCC.js → schema-3YKCQ3VO.js} +28 -10
- package/dist/cli-bundle/chunks/schema-3YKCQ3VO.js.map +1 -0
- package/dist/cli-bundle/chunks/{search-JMLFQEPJ.js → search-NQ42NC6A.js} +328 -71
- package/dist/cli-bundle/chunks/search-NQ42NC6A.js.map +7 -0
- package/dist/cli-bundle/chunks/{search-NL3TSCYB.js → search-V7PZ2ICH.js} +328 -71
- package/dist/cli-bundle/chunks/search-V7PZ2ICH.js.map +1 -0
- package/dist/cli-bundle/chunks/{stats-BKXCBIGT.js → stats-7KD4PJC5.js} +41 -16
- package/dist/cli-bundle/chunks/stats-7KD4PJC5.js.map +7 -0
- package/dist/cli-bundle/chunks/{stats-UBD56TGK.js → stats-GRHO6RFB.js} +42 -17
- package/dist/cli-bundle/chunks/stats-GRHO6RFB.js.map +1 -0
- package/dist/cli-bundle/chunks/{telemetry-ZJXK3H7X.js → telemetry-H5GLXNG5.js} +6 -6
- package/dist/cli-bundle/chunks/telemetry-H5GLXNG5.js.map +7 -0
- package/dist/cli-bundle/chunks/{telemetry-N454RHG5.js → telemetry-TRRYZXWT.js} +7 -7
- package/dist/cli-bundle/chunks/telemetry-TRRYZXWT.js.map +1 -0
- package/dist/cli-bundle/chunks/test-6CZNIIGA.js +34 -0
- package/dist/cli-bundle/chunks/{test-BQAKIXAT.js → test-7GVQ3VMN.js} +16 -14
- package/dist/cli-bundle/chunks/{test-all-7LV3I6S5.js → test-all-3LF2OZD2.js} +23 -16
- package/dist/cli-bundle/chunks/test-all-3LF2OZD2.js.map +7 -0
- package/dist/cli-bundle/chunks/{test-all-TDYCCBA4.js → test-all-ODVADHV6.js} +24 -17
- package/dist/cli-bundle/chunks/test-all-ODVADHV6.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-runs-E64M6XS3.js → test-runs-LYT6ZTNQ.js} +62 -65
- package/dist/cli-bundle/chunks/test-runs-LYT6ZTNQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-runs-LXZLULCI.js → test-runs-RVP6VWN7.js} +61 -64
- package/dist/cli-bundle/chunks/test-runs-RVP6VWN7.js.map +7 -0
- package/dist/cli-bundle/chunks/update-MPGM6SBE.js +28 -0
- package/dist/cli-bundle/chunks/update-UN75XW3C.js +24 -0
- package/dist/cli-bundle/chunks/{update-many-F4IKDWZB.js → update-many-FCU6RKTO.js} +80 -34
- package/dist/cli-bundle/chunks/update-many-FCU6RKTO.js.map +1 -0
- package/dist/cli-bundle/chunks/{update-many-NTWZ5YT3.js → update-many-XSEQJ24X.js} +79 -33
- package/dist/cli-bundle/chunks/update-many-XSEQJ24X.js.map +7 -0
- package/dist/cli-bundle/chunks/{upgrade-37F7JKES.js → upgrade-A6TL3INC.js} +22 -8
- package/dist/cli-bundle/chunks/upgrade-A6TL3INC.js.map +7 -0
- package/dist/cli-bundle/chunks/{upgrade-L32JA4TZ.js → upgrade-FOB5LHO5.js} +23 -9
- package/dist/cli-bundle/chunks/upgrade-FOB5LHO5.js.map +1 -0
- package/dist/cli-bundle/chunks/{validate-46KCRHL7.js → validate-7BLDG3AT.js} +222 -31
- package/dist/cli-bundle/chunks/validate-7BLDG3AT.js.map +1 -0
- package/dist/cli-bundle/chunks/{validate-CRFMPTYD.js → validate-EHL3MI2V.js} +236 -31
- package/dist/cli-bundle/chunks/validate-EHL3MI2V.js.map +7 -0
- package/dist/cli-bundle/main.js +305 -140
- package/dist/cli-bundle/main.js.map +3 -3
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +21 -8
- package/dist/cli.js.map +1 -1
- package/dist/core/diagnostics/remediation.js +7 -2
- package/dist/core/diagnostics/remediation.js.map +1 -1
- package/dist/core/extensions/extension-capability-aliases.js +7 -33
- package/dist/core/extensions/extension-capability-aliases.js.map +1 -1
- package/dist/core/extensions/extension-policy.js +14 -15
- package/dist/core/extensions/extension-policy.js.map +1 -1
- package/dist/core/extensions/item-fields.js +4 -5
- package/dist/core/extensions/item-fields.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +75 -1
- package/dist/core/extensions/loader.js +56 -32
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/governance/content-fields.d.ts +84 -0
- package/dist/core/governance/content-fields.js +182 -0
- package/dist/core/governance/content-fields.js.map +1 -0
- package/dist/core/governance/issue-codes.d.ts +51 -0
- package/dist/core/governance/issue-codes.js +95 -0
- package/dist/core/governance/issue-codes.js.map +1 -0
- package/dist/core/governance/metadata-coverage.d.ts +168 -0
- package/dist/core/governance/metadata-coverage.js +362 -0
- package/dist/core/governance/metadata-coverage.js.map +1 -0
- package/dist/core/history/history-rewrite.d.ts +22 -0
- package/dist/core/history/history-rewrite.js +38 -2
- package/dist/core/history/history-rewrite.js.map +1 -1
- package/dist/core/history/history.d.ts +7 -0
- package/dist/core/history/history.js +6 -2
- package/dist/core/history/history.js.map +1 -1
- package/dist/core/io/body-file.d.ts +14 -0
- package/dist/core/io/body-file.js +47 -0
- package/dist/core/io/body-file.js.map +1 -0
- package/dist/core/item/item-format.d.ts +46 -1
- package/dist/core/item/item-format.js +51 -60
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/parse.d.ts +9 -0
- package/dist/core/item/parse.js +10 -16
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/item/type-registry.d.ts +1 -0
- package/dist/core/item/type-registry.js +8 -10
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/lock/lock.d.ts +26 -0
- package/dist/core/lock/lock.js +10 -2
- package/dist/core/lock/lock.js.map +1 -1
- package/dist/core/output/output.d.ts +7 -0
- package/dist/core/output/output.js +6 -2
- package/dist/core/output/output.js.map +1 -1
- package/dist/core/schema/item-types-file.d.ts +25 -2
- package/dist/core/schema/item-types-file.js +78 -6
- package/dist/core/schema/item-types-file.js.map +1 -1
- package/dist/core/schema/runtime-schema.d.ts +7 -0
- package/dist/core/schema/runtime-schema.js +23 -16
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/search/background-refresh.js +3 -3
- package/dist/core/search/background-refresh.js.map +1 -1
- package/dist/core/search/cache.d.ts +19 -1
- package/dist/core/search/cache.js +11 -3
- package/dist/core/search/cache.js.map +1 -1
- package/dist/core/search/corpus.d.ts +36 -2
- package/dist/core/search/corpus.js +120 -24
- package/dist/core/search/corpus.js.map +1 -1
- package/dist/core/search/providers.d.ts +19 -0
- package/dist/core/search/providers.js +19 -2
- package/dist/core/search/providers.js.map +1 -1
- package/dist/core/sentry/instrument.d.ts +1 -0
- package/dist/core/sentry/instrument.js +6 -2
- package/dist/core/sentry/instrument.js.map +1 -1
- package/dist/core/session/session-state.d.ts +16 -0
- package/dist/core/session/session-state.js +48 -0
- package/dist/core/session/session-state.js.map +1 -0
- package/dist/core/shared/constants.d.ts +8 -0
- package/dist/core/shared/constants.js +11 -2
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/shared/errors.d.ts +3 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/errors.js.map +1 -1
- package/dist/core/shared/text-normalization.js +4 -3
- package/dist/core/shared/text-normalization.js.map +1 -1
- package/dist/core/shared/time.d.ts +13 -0
- package/dist/core/shared/time.js +19 -7
- package/dist/core/shared/time.js.map +1 -1
- package/dist/core/store/item-store.d.ts +11 -0
- package/dist/core/store/item-store.js +16 -23
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +2 -0
- package/dist/core/store/settings-validator.js +25 -2
- package/dist/core/store/settings-validator.js.map +1 -1
- package/dist/core/store/settings.d.ts +60 -1
- package/dist/core/store/settings.js +100 -46
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/observability.js +10 -8
- package/dist/core/telemetry/observability.js.map +1 -1
- package/dist/core/telemetry/runtime.d.ts +272 -1
- package/dist/core/telemetry/runtime.js +358 -37
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/core/test/background-runs.d.ts +35 -0
- package/dist/core/test/background-runs.js +72 -61
- package/dist/core/test/background-runs.js.map +1 -1
- package/dist/core/test/run-selectors.js +5 -4
- package/dist/core/test/run-selectors.js.map +1 -1
- package/dist/core/validate/estimate-defaults.d.ts +39 -0
- package/dist/core/validate/estimate-defaults.js +117 -0
- package/dist/core/validate/estimate-defaults.js.map +1 -0
- package/dist/core/validate/fix-planning.d.ts +21 -3
- package/dist/core/validate/fix-planning.js +31 -4
- package/dist/core/validate/fix-planning.js.map +1 -1
- package/dist/core/validate/missing-link-owners.d.ts +64 -0
- package/dist/core/validate/missing-link-owners.js +98 -0
- package/dist/core/validate/missing-link-owners.js.map +1 -0
- package/dist/mcp/server.d.ts +62 -0
- package/dist/mcp/server.js +71 -8
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +17 -4
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +13 -2
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +110 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +83 -8
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +28 -0
- package/dist/sdk/cli-contracts.js +164 -11
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/types.d.ts +17 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +15 -3
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/COMMANDS.md +136 -7
- package/docs/CONFIGURATION.md +52 -0
- package/docs/TESTING.md +6 -4
- package/package.json +6 -4
- package/packages/pm-calendar/extensions/calendar/runtime.js +6 -0
- package/packages/pm-calendar/extensions/calendar/runtime.ts +12 -0
- package/packages/pm-todos/extensions/todos/runtime.ts +5 -0
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +6 -14
- package/plugins/pm-claude/commands/pm-init.md +1 -1
- package/plugins/pm-codex/README.md +1 -1
- package/scripts/bundle-cli.mjs +46 -37
- package/scripts/finalize-build.mjs +20 -9
- package/scripts/prepare-build-cache.mjs +27 -16
- package/dist/cli-bundle/chunks/activity-XZIUPGZH.js +0 -16
- package/dist/cli-bundle/chunks/aggregate-6OTS3AOO.js.map +0 -1
- package/dist/cli-bundle/chunks/aggregate-OD36DJU5.js.map +0 -7
- package/dist/cli-bundle/chunks/append-KG55G7S3.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-35P4GT6E.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-37CYVF73.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-3KLPFWZ4.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4JCSYR6F.js +0 -138
- package/dist/cli-bundle/chunks/chunk-4JCSYR6F.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4YFAGDRH.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-5SCT2JCT.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-73ZPG2I3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-7AMK6DOW.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7IYFN5R7.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7UGSRQCL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-A6LXQFO7.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-AVGHVVF7.js +0 -128
- package/dist/cli-bundle/chunks/chunk-AVGHVVF7.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-AX4GEVQC.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-CCX4RSYZ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-CW6E4NAT.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-DY6C42S6.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-EWFY7SLA.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-F75JSIOZ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-FDH2X65L.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-FY4SPXSC.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-GKIZW7SM.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HHHJ2GI3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HI7STVF2.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-I53JBTJW.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-I7NYDZDV.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-IUKD4W6Z.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-KWAXVAXX.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-L5EPZQIC.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-OASDW5UI.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OLKBSY4N.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-P5BJOMBB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-PNYAAB4S.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-QKW5D45B.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-QNJSITCX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-R4VWYWRN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RXAP6JL5.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-S2ZLDYGS.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SO55HRA5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-TK5VZFHY.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-TNAP7EJX.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-UIG4TW2H.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UUWGCWBU.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-VFUZV5EB.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-WUNFKP7M.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XJDGS74Y.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XWMF3POR.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-ZMW77VWV.js.map +0 -1
- package/dist/cli-bundle/chunks/close-4FMAPEMY.js +0 -13
- package/dist/cli-bundle/chunks/close-many-AOD4HSAZ.js.map +0 -1
- package/dist/cli-bundle/chunks/close-many-XKAQY5CQ.js.map +0 -7
- package/dist/cli-bundle/chunks/comments-B4RWWDJT.js.map +0 -7
- package/dist/cli-bundle/chunks/comments-RN5TG4ZN.js.map +0 -1
- package/dist/cli-bundle/chunks/config-3JXJ3XZ7.js.map +0 -1
- package/dist/cli-bundle/chunks/config-FZ4UDC4B.js.map +0 -7
- package/dist/cli-bundle/chunks/context-L36PIN35.js.map +0 -7
- package/dist/cli-bundle/chunks/context-QBPO3BFM.js.map +0 -1
- package/dist/cli-bundle/chunks/contracts-2G66IGIA.js.map +0 -1
- package/dist/cli-bundle/chunks/contracts-PJCHYSO5.js.map +0 -7
- package/dist/cli-bundle/chunks/create-VWLWS34Z.js +0 -27
- package/dist/cli-bundle/chunks/deps-6TSPOSGU.js.map +0 -1
- package/dist/cli-bundle/chunks/files-FYP3MDPX.js.map +0 -7
- package/dist/cli-bundle/chunks/files-GUXUM2MB.js.map +0 -1
- package/dist/cli-bundle/chunks/get-PCHS7RA6.js.map +0 -1
- package/dist/cli-bundle/chunks/get-QARTE6BL.js.map +0 -7
- package/dist/cli-bundle/chunks/health-7MTXAVR2.js.map +0 -7
- package/dist/cli-bundle/chunks/health-E4D7KGHD.js.map +0 -1
- package/dist/cli-bundle/chunks/history-L2FQFRTU.js +0 -20
- package/dist/cli-bundle/chunks/history-compact-3EJ3L2O7.js.map +0 -1
- package/dist/cli-bundle/chunks/history-compact-LW27IPFK.js.map +0 -7
- package/dist/cli-bundle/chunks/history-redact-QWQCX5DZ.js +0 -19
- package/dist/cli-bundle/chunks/history-repair-OSQOKJ3E.js.map +0 -7
- package/dist/cli-bundle/chunks/history-repair-SBK7P34V.js.map +0 -1
- package/dist/cli-bundle/chunks/init-4BKRHGWW.js +0 -17
- package/dist/cli-bundle/chunks/learnings-HQXSSKZ5.js.map +0 -1
- package/dist/cli-bundle/chunks/learnings-XK3P4ZDR.js.map +0 -7
- package/dist/cli-bundle/chunks/list-6CL3XFT6.js +0 -23
- package/dist/cli-bundle/chunks/list-BYNN4ZEO.js +0 -19
- package/dist/cli-bundle/chunks/notes-5T6P7C5V.js.map +0 -1
- package/dist/cli-bundle/chunks/notes-U5FZCSBT.js.map +0 -7
- package/dist/cli-bundle/chunks/plan-2YTQYWGM.js.map +0 -1
- package/dist/cli-bundle/chunks/plan-7IVSICR6.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-4UPMHONX.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-7VOW2C3W.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-FARSGYRD.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-LJDNVREU.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-FFTYAL42.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-HCJKDUA6.js.map +0 -7
- package/dist/cli-bundle/chunks/register-setup-6AVIUOCC.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-KVNLO5OJ.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-CHIOQAQL.js +0 -17
- package/dist/cli-bundle/chunks/schema-76HDZJCC.js.map +0 -1
- package/dist/cli-bundle/chunks/schema-AINZ2IMM.js.map +0 -7
- package/dist/cli-bundle/chunks/search-JMLFQEPJ.js.map +0 -7
- package/dist/cli-bundle/chunks/search-NL3TSCYB.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-BKXCBIGT.js.map +0 -7
- package/dist/cli-bundle/chunks/stats-UBD56TGK.js.map +0 -1
- package/dist/cli-bundle/chunks/telemetry-N454RHG5.js.map +0 -1
- package/dist/cli-bundle/chunks/telemetry-ZJXK3H7X.js.map +0 -7
- package/dist/cli-bundle/chunks/test-O74JFUH5.js +0 -32
- package/dist/cli-bundle/chunks/test-all-7LV3I6S5.js.map +0 -7
- package/dist/cli-bundle/chunks/test-all-TDYCCBA4.js.map +0 -1
- package/dist/cli-bundle/chunks/test-runs-E64M6XS3.js.map +0 -1
- package/dist/cli-bundle/chunks/test-runs-LXZLULCI.js.map +0 -7
- package/dist/cli-bundle/chunks/update-36JM7YZT.js +0 -21
- package/dist/cli-bundle/chunks/update-I246PCLO.js +0 -25
- package/dist/cli-bundle/chunks/update-many-F4IKDWZB.js.map +0 -1
- package/dist/cli-bundle/chunks/update-many-NTWZ5YT3.js.map +0 -7
- package/dist/cli-bundle/chunks/upgrade-37F7JKES.js.map +0 -7
- package/dist/cli-bundle/chunks/upgrade-L32JA4TZ.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-46KCRHL7.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-CRFMPTYD.js.map +0 -7
- /package/dist/cli-bundle/chunks/{activity-XZIUPGZH.js.map → activity-5P2KQCTH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-XADJOG6G.js.map → activity-MJGTX4LO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ATEES5SX.js.map → chunk-2JEGCDYT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XUC4C4PT.js.map → chunk-3WAULYOY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QJMGRZO2.js.map → chunk-7AGIXLNK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KBPQHXWG.js.map → chunk-AERT7KT3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ESANVZF4.js.map → chunk-E6J2PEK6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VSRZRLG3.js.map → chunk-F2GC6L3N.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XTKJSVWH.js.map → chunk-M23HXJL3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-S26FESD4.js.map → chunk-MJZUZ2QE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-C6SAP27O.js.map → chunk-O46LTCXQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WPDMBIX6.js.map → chunk-OLTYNVJR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-R2OUQVBK.js.map → chunk-T5VU7ROQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-P5U5EOMA.js.map → chunk-UBMCSJXX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZYNJNPYD.js.map → chunk-UUKORJSN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VPEAS7PS.js.map → chunk-WZCQVABQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Y3YKK7CY.js.map → chunk-YGRPBFMA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XMBI6TNW.js.map → chunk-ZJRDVYZI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-2RDYMCTP.js.map → claim-4APLUXJW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-MJ7DZFC3.js.map → claim-NEO7AGWH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-XLEKIQSW.js.map → close-3QABBNGU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-4FMAPEMY.js.map → close-ILMZR3D7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-FWIVTLBO.js.map → copy-Q64T5FD4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-ALU5WMHA.js.map → copy-SG34LCMU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-VWLWS34Z.js.map → create-F5HZX2S4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-5433DP3G.js.map → create-IPAX2SNL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-Y2SGJBGY.js.map → delete-TLXR7LJ2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-IYTIYAJS.js.map → delete-VH3L7DZ6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-MXLGZUIT.js.map → docs-GWDEB7JH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-I3BAF5WH.js.map → docs-RCLNSKID.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-Q34OEWO5.js.map → extension-5RN65LHT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-WH2FOIOZ.js.map → extension-7KO2NX2A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-KGQG66SA.js.map → gc-2FGKYRJ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-FENB2ESG.js.map → gc-5B6ABL3Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-7WUAEWHW.js.map → history-QO4JVJJP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-L2FQFRTU.js.map → history-SSXGGTVZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-QWQCX5DZ.js.map → history-redact-VBH44Y7F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-G72A4EJ4.js.map → history-redact-Z4P5MM3G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-4BKRHGWW.js.map → init-7FBQO77A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-S5WEGUJY.js.map → init-K6MSMB37.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-BYNN4ZEO.js.map → list-7UE44A2R.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-6CL3XFT6.js.map → list-UHMA3N2K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-M6AFHMV4.js.map → restore-NNVPBBVJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-CHIOQAQL.js.map → restore-XXXLQ2XC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-O74JFUH5.js.map → test-6CZNIIGA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-BQAKIXAT.js.map → test-7GVQ3VMN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-I246PCLO.js.map → update-MPGM6SBE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-36JM7YZT.js.map → update-UN75XW3C.js.map} +0 -0
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import { type ContentFieldUtilizationReport } from "../../core/governance/content-fields.js";
|
|
2
|
+
import { type GroupedBreakdown, type MetadataCoverageReport } from "../../core/governance/metadata-coverage.js";
|
|
1
3
|
import { type HistoryStorageStats } from "../../core/history/history-storage-stats.js";
|
|
2
4
|
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
3
5
|
import type { ItemStatus, ItemType } from "../../types/index.js";
|
|
4
6
|
export interface StatsCommandOptions {
|
|
5
7
|
/** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */
|
|
6
8
|
storage?: boolean;
|
|
9
|
+
/** Include metadata coverage percentages (AC, estimates, resolution, tags, parent) overall and by type. */
|
|
10
|
+
metadataCoverage?: boolean;
|
|
11
|
+
/** Include a lifecycle-bucketed breakdown grouped by assignee. */
|
|
12
|
+
byAssignee?: boolean;
|
|
13
|
+
/** Include a lifecycle-bucketed breakdown grouped by tag (optionally filtered by --tag-prefix). */
|
|
14
|
+
byTag?: boolean;
|
|
15
|
+
/** Include a lifecycle-bucketed breakdown grouped by priority. */
|
|
16
|
+
byPriority?: boolean;
|
|
17
|
+
/** With --by-tag: only consider tags starting with this prefix (e.g. "domain:"). */
|
|
18
|
+
tagPrefix?: string;
|
|
19
|
+
/** Include a content-field utilization breakdown (notes/learnings/files/docs/tests/comments/deps/body usage rates). */
|
|
20
|
+
fieldUtilization?: boolean;
|
|
7
21
|
}
|
|
8
22
|
export interface StatsResult {
|
|
9
23
|
totals: {
|
|
@@ -13,8 +27,32 @@ export interface StatsResult {
|
|
|
13
27
|
};
|
|
14
28
|
by_type: Record<ItemType, number>;
|
|
15
29
|
by_status: Record<ItemStatus, number>;
|
|
30
|
+
/** Present only with --metadata-coverage: per-field coverage overall and by type. */
|
|
31
|
+
metadata_coverage?: MetadataCoverageReport;
|
|
32
|
+
/** Present only with --by-assignee/--by-tag/--by-priority: lifecycle-bucketed group breakdowns. */
|
|
33
|
+
breakdowns?: {
|
|
34
|
+
assignee?: GroupedBreakdown;
|
|
35
|
+
tag?: GroupedBreakdown;
|
|
36
|
+
priority?: GroupedBreakdown;
|
|
37
|
+
};
|
|
16
38
|
/** Present only with --storage: aggregate history-stream metrics for compaction/planning. */
|
|
17
39
|
storage?: HistoryStorageStats;
|
|
40
|
+
/** Present only with --field-utilization: content-field utilization rates across all items. */
|
|
41
|
+
field_utilization?: ContentFieldUtilizationReport;
|
|
18
42
|
generated_at: string;
|
|
19
43
|
}
|
|
44
|
+
declare function zeroByType(itemTypes: string[]): Record<ItemType, number>;
|
|
45
|
+
declare function zeroByStatus(statuses: string[]): Record<ItemStatus, number>;
|
|
46
|
+
declare function countNonEmptyLines(raw: string): number;
|
|
47
|
+
declare function readHistoryStreamContents(pmRoot: string): Promise<Array<{
|
|
48
|
+
id: string;
|
|
49
|
+
raw: string;
|
|
50
|
+
}>>;
|
|
51
|
+
export declare const _testOnly: {
|
|
52
|
+
zeroByType: typeof zeroByType;
|
|
53
|
+
zeroByStatus: typeof zeroByStatus;
|
|
54
|
+
countNonEmptyLines: typeof countNonEmptyLines;
|
|
55
|
+
readHistoryStreamContents: typeof readHistoryStreamContents;
|
|
56
|
+
};
|
|
20
57
|
export declare function runStats(global: GlobalOptions, options?: StatsCommandOptions): Promise<StatsResult>;
|
|
58
|
+
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
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]="bcac44f4-a3b7-5ff0-a2e2-d71aba588f7c")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { getActiveExtensionRegistrations, runActiveOnReadHooks } from "../../core/extensions/index.js";
|
|
6
|
+
import { computeContentFieldUtilization, } from "../../core/governance/content-fields.js";
|
|
7
|
+
import { computeMetadataCoverage, groupItemsByDimension, lifecycleClassifierFromStatusRegistry, } from "../../core/governance/metadata-coverage.js";
|
|
6
8
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
7
9
|
import { enforceHistoryStreamPolicyForItems } from "../../core/history/history-stream-policy.js";
|
|
8
10
|
import { computeHistoryStorageStats } from "../../core/history/history-storage-stats.js";
|
|
@@ -11,7 +13,7 @@ import { resolveRuntimeStatusRegistry } from "../../core/schema/runtime-schema.j
|
|
|
11
13
|
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
12
14
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
13
15
|
import { nowIso } from "../../core/shared/time.js";
|
|
14
|
-
import { listAllFrontMatterLight } from "../../core/store/item-store.js";
|
|
16
|
+
import { listAllFrontMatterLight, listAllFrontMatterWithBody } from "../../core/store/item-store.js";
|
|
15
17
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
16
18
|
import { readSettings } from "../../core/store/settings.js";
|
|
17
19
|
function zeroByType(itemTypes) {
|
|
@@ -59,6 +61,12 @@ async function readHistoryStreamContents(pmRoot) {
|
|
|
59
61
|
}
|
|
60
62
|
return streams;
|
|
61
63
|
}
|
|
64
|
+
export const _testOnly = {
|
|
65
|
+
zeroByType,
|
|
66
|
+
zeroByStatus,
|
|
67
|
+
countNonEmptyLines,
|
|
68
|
+
readHistoryStreamContents,
|
|
69
|
+
};
|
|
62
70
|
export async function runStats(global, options = {}) {
|
|
63
71
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
64
72
|
if (!(await pathExists(getSettingsPath(pmRoot)))) {
|
|
@@ -67,7 +75,12 @@ export async function runStats(global, options = {}) {
|
|
|
67
75
|
const settings = await readSettings(pmRoot);
|
|
68
76
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
69
77
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
70
|
-
|
|
78
|
+
// Field utilization needs the heavy collections (notes/learnings/files/docs/
|
|
79
|
+
// tests/comments/deps) AND the body, which the light reader drops — so when it
|
|
80
|
+
// is requested we read the WithBody rows and use them for every section.
|
|
81
|
+
const items = options.fieldUtilization
|
|
82
|
+
? await listAllFrontMatterWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)
|
|
83
|
+
: await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema);
|
|
71
84
|
await enforceHistoryStreamPolicyForItems({
|
|
72
85
|
pmRoot,
|
|
73
86
|
settings,
|
|
@@ -76,14 +89,12 @@ export async function runStats(global, options = {}) {
|
|
|
76
89
|
});
|
|
77
90
|
const byType = zeroByType(typeRegistry.types);
|
|
78
91
|
const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));
|
|
92
|
+
// zeroByType/zeroByStatus pre-seed a bucket for every registry type/status, and
|
|
93
|
+
// the light front-matter reader drops any item whose type/status falls outside
|
|
94
|
+
// the active registry (parse rejects them) — so every item's bucket is already
|
|
95
|
+
// present here and no on-the-fly initialization is reachable.
|
|
79
96
|
for (const item of items) {
|
|
80
|
-
if (byType[item.type] === undefined) {
|
|
81
|
-
byType[item.type] = 0;
|
|
82
|
-
}
|
|
83
97
|
byType[item.type] += 1;
|
|
84
|
-
if (byStatus[item.status] === undefined) {
|
|
85
|
-
byStatus[item.status] = 0;
|
|
86
|
-
}
|
|
87
98
|
byStatus[item.status] += 1;
|
|
88
99
|
}
|
|
89
100
|
const streams = await readHistoryStreamContents(pmRoot);
|
|
@@ -92,6 +103,20 @@ export async function runStats(global, options = {}) {
|
|
|
92
103
|
historyEntries += countNonEmptyLines(stream.raw);
|
|
93
104
|
}
|
|
94
105
|
const storage = options.storage ? computeHistoryStorageStats(streams) : undefined;
|
|
106
|
+
const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);
|
|
107
|
+
const metadataCoverage = options.metadataCoverage ? computeMetadataCoverage(items, classifier) : undefined;
|
|
108
|
+
const breakdowns = {};
|
|
109
|
+
if (options.byAssignee) {
|
|
110
|
+
breakdowns.assignee = groupItemsByDimension(items, "assignee", classifier);
|
|
111
|
+
}
|
|
112
|
+
if (options.byTag) {
|
|
113
|
+
breakdowns.tag = groupItemsByDimension(items, "tag", classifier, { tagPrefix: options.tagPrefix });
|
|
114
|
+
}
|
|
115
|
+
if (options.byPriority) {
|
|
116
|
+
breakdowns.priority = groupItemsByDimension(items, "priority", classifier);
|
|
117
|
+
}
|
|
118
|
+
const hasBreakdowns = Object.keys(breakdowns).length > 0;
|
|
119
|
+
const fieldUtilization = options.fieldUtilization ? computeContentFieldUtilization(items) : undefined;
|
|
95
120
|
return {
|
|
96
121
|
totals: {
|
|
97
122
|
items: items.length,
|
|
@@ -100,9 +125,12 @@ export async function runStats(global, options = {}) {
|
|
|
100
125
|
},
|
|
101
126
|
by_type: byType,
|
|
102
127
|
by_status: byStatus,
|
|
128
|
+
...(metadataCoverage ? { metadata_coverage: metadataCoverage } : {}),
|
|
129
|
+
...(hasBreakdowns ? { breakdowns } : {}),
|
|
103
130
|
...(storage ? { storage } : {}),
|
|
131
|
+
...(fieldUtilization ? { field_utilization: fieldUtilization } : {}),
|
|
104
132
|
generated_at: nowIso(),
|
|
105
133
|
};
|
|
106
134
|
}
|
|
107
135
|
//# sourceMappingURL=stats.js.map
|
|
108
|
-
//# debugId=
|
|
136
|
+
//# debugId=bcac44f4-a3b7-5ff0-a2e2-d71aba588f7c
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sources":["cli/commands/stats.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../../core/history/history-stream-policy.js\";\nimport { computeHistoryStorageStats, type HistoryStorageStats } from \"../../core/history/history-storage-stats.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { listAllFrontMatterLight } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../../types/index.js\";\n\nexport interface StatsCommandOptions {\n /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */\n storage?: boolean;\n}\n\nexport interface StatsResult {\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n by_type: Record<ItemType, number>;\n by_status: Record<ItemStatus, number>;\n /** Present only with --storage: aggregate history-stream metrics for compaction/planning. */\n storage?: HistoryStorageStats;\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw\n .split(/\\r?\\n/u)\n .filter((line) => line.trim().length > 0)\n .length;\n}\n\nasync function readHistoryStreamContents(pmRoot: string): Promise<Array<{ id: string; raw: string }>> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return [];\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n const streams: Array<{ id: string; raw: string }> = [];\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await fs.readFile(historyPath, \"utf8\");\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n streams.push({ id: file.slice(0, -\".jsonl\".length), raw });\n }\n\n return streams;\n}\n\nexport async function runStats(global: GlobalOptions, options: StatsCommandOptions = {}): Promise<StatsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema);\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));\n for (const item of items) {\n if (byType[item.type] === undefined) {\n byType[item.type] = 0;\n }\n byType[item.type] += 1;\n if (byStatus[item.status] === undefined) {\n byStatus[item.status] = 0;\n }\n byStatus[item.status] += 1;\n }\n\n const streams = await readHistoryStreamContents(pmRoot);\n let historyEntries = 0;\n for (const stream of streams) {\n historyEntries += countNonEmptyLines(stream.raw);\n }\n const storage = options.storage ? computeHistoryStorageStats(streams) : undefined;\n\n return {\n totals: {\n items: items.length,\n history_streams: streams.length,\n history_entries: historyEntries,\n },\n by_type: byType,\n by_status: byStatus,\n ...(storage ? { storage } : {}),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAA4B,MAAM,6CAA6C,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAqB5D,SAAS,UAAU,CAAC,SAAmB;IACrC,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACf,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA8B,CAC/B,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,QAAkB;IACtC,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACf,OAAO,GAAG,CAAC;IACb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AAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"02809425-3f94-5445-91ea-bdc968f9f64b"}
|
|
1
|
+
{"version":3,"file":"stats.js","sources":["cli/commands/stats.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations, runActiveOnReadHooks } from \"../../core/extensions/index.js\";\nimport {\n computeContentFieldUtilization,\n type ContentFieldUtilizationReport,\n} from \"../../core/governance/content-fields.js\";\nimport {\n computeMetadataCoverage,\n groupItemsByDimension,\n lifecycleClassifierFromStatusRegistry,\n type GroupedBreakdown,\n type MetadataCoverageReport,\n} from \"../../core/governance/metadata-coverage.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../../core/history/history-stream-policy.js\";\nimport { computeHistoryStorageStats, type HistoryStorageStats } from \"../../core/history/history-storage-stats.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { listAllFrontMatterLight, listAllFrontMatterWithBody } from \"../../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../../types/index.js\";\n\nexport interface StatsCommandOptions {\n /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */\n storage?: boolean;\n /** Include metadata coverage percentages (AC, estimates, resolution, tags, parent) overall and by type. */\n metadataCoverage?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by assignee. */\n byAssignee?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by tag (optionally filtered by --tag-prefix). */\n byTag?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by priority. */\n byPriority?: boolean;\n /** With --by-tag: only consider tags starting with this prefix (e.g. \"domain:\"). */\n tagPrefix?: string;\n /** Include a content-field utilization breakdown (notes/learnings/files/docs/tests/comments/deps/body usage rates). */\n fieldUtilization?: boolean;\n}\n\nexport interface StatsResult {\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n by_type: Record<ItemType, number>;\n by_status: Record<ItemStatus, number>;\n /** Present only with --metadata-coverage: per-field coverage overall and by type. */\n metadata_coverage?: MetadataCoverageReport;\n /** Present only with --by-assignee/--by-tag/--by-priority: lifecycle-bucketed group breakdowns. */\n breakdowns?: {\n assignee?: GroupedBreakdown;\n tag?: GroupedBreakdown;\n priority?: GroupedBreakdown;\n };\n /** Present only with --storage: aggregate history-stream metrics for compaction/planning. */\n storage?: HistoryStorageStats;\n /** Present only with --field-utilization: content-field utilization rates across all items. */\n field_utilization?: ContentFieldUtilizationReport;\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw\n .split(/\\r?\\n/u)\n .filter((line) => line.trim().length > 0)\n .length;\n}\n\nasync function readHistoryStreamContents(pmRoot: string): Promise<Array<{ id: string; raw: string }>> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return [];\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n const streams: Array<{ id: string; raw: string }> = [];\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await fs.readFile(historyPath, \"utf8\");\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n streams.push({ id: file.slice(0, -\".jsonl\".length), raw });\n }\n\n return streams;\n}\n\nexport const _testOnly = {\n zeroByType,\n zeroByStatus,\n countNonEmptyLines,\n readHistoryStreamContents,\n};\n\nexport async function runStats(global: GlobalOptions, options: StatsCommandOptions = {}): Promise<StatsResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n // Field utilization needs the heavy collections (notes/learnings/files/docs/\n // tests/comments/deps) AND the body, which the light reader drops — so when it\n // is requested we read the WithBody rows and use them for every section.\n const items = options.fieldUtilization\n ? await listAllFrontMatterWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)\n : await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema);\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));\n // zeroByType/zeroByStatus pre-seed a bucket for every registry type/status, and\n // the light front-matter reader drops any item whose type/status falls outside\n // the active registry (parse rejects them) — so every item's bucket is already\n // present here and no on-the-fly initialization is reachable.\n for (const item of items) {\n byType[item.type] += 1;\n byStatus[item.status] += 1;\n }\n\n const streams = await readHistoryStreamContents(pmRoot);\n let historyEntries = 0;\n for (const stream of streams) {\n historyEntries += countNonEmptyLines(stream.raw);\n }\n const storage = options.storage ? computeHistoryStorageStats(streams) : undefined;\n\n const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);\n const metadataCoverage = options.metadataCoverage ? computeMetadataCoverage(items, classifier) : undefined;\n const breakdowns: NonNullable<StatsResult[\"breakdowns\"]> = {};\n if (options.byAssignee) {\n breakdowns.assignee = groupItemsByDimension(items, \"assignee\", classifier);\n }\n if (options.byTag) {\n breakdowns.tag = groupItemsByDimension(items, \"tag\", classifier, { tagPrefix: options.tagPrefix });\n }\n if (options.byPriority) {\n breakdowns.priority = groupItemsByDimension(items, \"priority\", classifier);\n }\n const hasBreakdowns = Object.keys(breakdowns).length > 0;\n const fieldUtilization = options.fieldUtilization ? computeContentFieldUtilization(items) : undefined;\n\n return {\n totals: {\n items: items.length,\n history_streams: streams.length,\n history_entries: historyEntries,\n },\n by_type: byType,\n by_status: byStatus,\n ...(metadataCoverage ? { metadata_coverage: metadataCoverage } : {}),\n ...(hasBreakdowns ? { breakdowns } : {}),\n ...(storage ? { storage } : {}),\n ...(fieldUtilization ? { field_utilization: fieldUtilization } : {}),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACvG,OAAO,EACL,8BAA8B,GAE/B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qCAAqC,GAGtC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAA4B,MAAM,6CAA6C,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,4BAA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AE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7E,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEtG,OAAO;QACL,MAAM,EAAE;YACN,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,eAAe,EAAE,OAAO,CAAC,MAAM;YAC/B,eAAe,EAAE,cAAc;SAChC;QACD,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,QAAQ;QACnB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"bcac44f4-a3b7-5ff0-a2e2-d71aba588f7c"}
|
|
@@ -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]="d357d083-b2e2-5574-a1a3-513eb9bd5b1d")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { pathExists, readFileIfExists } from "../../core/fs/fs-utils.js";
|
|
@@ -19,7 +19,9 @@ function normalizeTelemetrySubcommand(value) {
|
|
|
19
19
|
if (TELEMETRY_SUBCOMMANDS.includes(normalized)) {
|
|
20
20
|
return normalized;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
// `value` is always a defined string here: an undefined subcommand normalizes
|
|
23
|
+
// to "status" above (a valid value) and never reaches this throw.
|
|
24
|
+
throw new PmCliError(`Unknown pm telemetry subcommand "${value}". Allowed: ${TELEMETRY_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, {
|
|
23
25
|
code: "unknown_subcommand",
|
|
24
26
|
examples: [
|
|
25
27
|
"pm telemetry status",
|
|
@@ -250,4 +252,4 @@ export async function runTelemetry(options, _global) {
|
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
254
|
//# sourceMappingURL=telemetry.js.map
|
|
253
|
-
//# debugId=
|
|
255
|
+
//# debugId=d357d083-b2e2-5574-a1a3-513eb9bd5b1d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sources":["cli/commands/telemetry.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { resolveGlobalPmRoot } from \"../../core/store/paths.js\";\nimport { readSettings, writeSettings } from \"../../core/store/settings.js\";\nimport { flushTelemetryQueueNow } from \"../../core/telemetry/runtime.js\";\n\nconst TELEMETRY_QUEUE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"events.jsonl\");\nconst TELEMETRY_STATE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"state.json\");\nconst TELEMETRY_RUNTIME_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\");\nconst DEFAULT_STATS_LIMIT = 20;\n\nexport const TELEMETRY_SUBCOMMANDS = [\"status\", \"flush\", \"stats\", \"clear\"] as const;\nexport type TelemetrySubcommand = (typeof TELEMETRY_SUBCOMMANDS)[number];\n\ninterface TelemetryRuntimeStateRecord {\n endpoint?: string;\n queue_entries?: number;\n last_attempted_flush_at?: string;\n last_successful_flush_at?: string;\n last_failed_flush_at?: string;\n last_failed_flush_error?: string;\n}\n\ninterface QueuedTelemetryEventRecord {\n attempts: number;\n client_schema_version?: number;\n event: {\n event_id?: string;\n event_type?: string;\n schema_version?: number;\n command?: string;\n };\n}\n\ninterface ParsedTelemetryQueue {\n rows_total: number;\n valid_entries: number;\n invalid_rows: number;\n entries: QueuedTelemetryEventRecord[];\n}\n\ninterface TelemetryStatusSummary {\n enabled: boolean;\n endpoint: string;\n queue_path: string;\n state_path: string;\n queue_rows_total: number;\n queue_entries: number;\n queue_invalid_rows: number;\n queue_size_bytes: number;\n last_attempted_flush_at: string | null;\n last_successful_flush_at: string | null;\n last_failed_flush_at: string | null;\n last_failed_flush_error: string | null;\n}\n\nexport interface TelemetryCommandOptions {\n subcommand?: string;\n limit?: string | number;\n}\n\ninterface TelemetryStatsBucket {\n command: string;\n count: number;\n event_type_counts: Record<string, number>;\n max_attempts: number;\n event_schema_versions: number[];\n client_schema_versions: number[];\n}\n\nfunction normalizeTelemetrySubcommand(value: string | undefined): TelemetrySubcommand {\n const normalized = (value ?? \"status\").trim().toLowerCase();\n if ((TELEMETRY_SUBCOMMANDS as readonly string[]).includes(normalized)) {\n return normalized as TelemetrySubcommand;\n }\n throw new PmCliError(\n `Unknown pm telemetry subcommand \"${value ?? \"\"}\". Allowed: ${TELEMETRY_SUBCOMMANDS.join(\", \")}`,\n EXIT_CODE.USAGE,\n {\n code: \"unknown_subcommand\",\n examples: [\n \"pm telemetry status\",\n \"pm telemetry flush\",\n \"pm telemetry stats --limit 10\",\n \"pm telemetry clear\",\n ],\n },\n );\n}\n\nfunction parseTelemetryStatsLimit(raw: string | number | undefined): number {\n if (raw === undefined) {\n return DEFAULT_STATS_LIMIT;\n }\n if (typeof raw === \"number\") {\n if (!Number.isFinite(raw) || !Number.isInteger(raw) || raw <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return raw;\n }\n const trimmed = raw.trim();\n if (trimmed.length === 0 || !/^\\d+$/.test(trimmed)) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n const parsed = Number.parseInt(trimmed, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return parsed;\n}\n\nfunction parseTelemetryQueue(raw: string | null): ParsedTelemetryQueue {\n if (raw === null || raw.trim().length === 0) {\n return {\n rows_total: 0,\n valid_entries: 0,\n invalid_rows: 0,\n entries: [],\n };\n }\n const entries: QueuedTelemetryEventRecord[] = [];\n let rowsTotal = 0;\n let invalidRows = 0;\n for (const line of raw.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n rowsTotal += 1;\n try {\n const parsed = JSON.parse(trimmed) as QueuedTelemetryEventRecord;\n if (\n typeof parsed === \"object\" &&\n parsed !== null &&\n typeof parsed.attempts === \"number\" &&\n typeof parsed.event === \"object\" &&\n parsed.event !== null\n ) {\n entries.push(parsed);\n } else {\n invalidRows += 1;\n }\n } catch {\n invalidRows += 1;\n }\n }\n return {\n rows_total: rowsTotal,\n valid_entries: entries.length,\n invalid_rows: invalidRows,\n entries,\n };\n}\n\nasync function readTelemetryRuntimeState(statePath: string): Promise<TelemetryRuntimeStateRecord> {\n const stateRaw = await readFileIfExists(statePath);\n if (stateRaw === null || stateRaw.trim().length === 0) {\n return {};\n }\n try {\n const parsed = JSON.parse(stateRaw) as TelemetryRuntimeStateRecord;\n if (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Ignore malformed state files; status command is observational.\n }\n return {};\n}\n\nasync function buildTelemetryStatusSummary(globalPmRoot: string): Promise<TelemetryStatusSummary> {\n const settings = await readSettings(globalPmRoot);\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const runtimeState = await readTelemetryRuntimeState(statePath);\n return {\n enabled: settings.telemetry.enabled,\n endpoint: settings.telemetry.endpoint,\n queue_path: queuePath,\n state_path: statePath,\n queue_rows_total: queue.rows_total,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_size_bytes: queueRaw === null ? 0 : Buffer.byteLength(queueRaw, \"utf8\"),\n last_attempted_flush_at: runtimeState.last_attempted_flush_at ?? null,\n last_successful_flush_at: runtimeState.last_successful_flush_at ?? null,\n last_failed_flush_at: runtimeState.last_failed_flush_at ?? null,\n last_failed_flush_error: runtimeState.last_failed_flush_error ?? null,\n };\n}\n\nfunction buildTelemetryStatsBuckets(entries: QueuedTelemetryEventRecord[]): TelemetryStatsBucket[] {\n const grouped = new Map<\n string,\n {\n count: number;\n max_attempts: number;\n event_type_counts: Record<string, number>;\n event_schema_versions: Set<number>;\n client_schema_versions: Set<number>;\n }\n >();\n for (const entry of entries) {\n const command = typeof entry.event.command === \"string\" && entry.event.command.trim().length > 0\n ? entry.event.command\n : \"<unknown>\";\n const eventType = typeof entry.event.event_type === \"string\" && entry.event.event_type.trim().length > 0\n ? entry.event.event_type\n : \"unknown\";\n const eventSchemaVersion = typeof entry.event.schema_version === \"number\" && Number.isFinite(entry.event.schema_version)\n ? Math.trunc(entry.event.schema_version)\n : undefined;\n const clientSchemaVersion =\n typeof entry.client_schema_version === \"number\" && Number.isFinite(entry.client_schema_version)\n ? Math.trunc(entry.client_schema_version)\n : undefined;\n const current = grouped.get(command) ?? {\n count: 0,\n max_attempts: 0,\n event_type_counts: {},\n event_schema_versions: new Set<number>(),\n client_schema_versions: new Set<number>(),\n };\n current.count += 1;\n current.max_attempts = Math.max(current.max_attempts, Math.max(0, Math.trunc(entry.attempts)));\n current.event_type_counts[eventType] = (current.event_type_counts[eventType] ?? 0) + 1;\n if (eventSchemaVersion !== undefined) {\n current.event_schema_versions.add(eventSchemaVersion);\n }\n if (clientSchemaVersion !== undefined) {\n current.client_schema_versions.add(clientSchemaVersion);\n }\n grouped.set(command, current);\n }\n return [...grouped.entries()]\n .map(([command, value]) => ({\n command,\n count: value.count,\n event_type_counts: Object.fromEntries(\n Object.entries(value.event_type_counts).sort((left, right) => left[0].localeCompare(right[0])),\n ),\n max_attempts: value.max_attempts,\n event_schema_versions: [...value.event_schema_versions].sort((left, right) => left - right),\n client_schema_versions: [...value.client_schema_versions].sort((left, right) => left - right),\n }))\n .sort((left, right) => right.count - left.count || left.command.localeCompare(right.command));\n}\n\nexport async function runTelemetry(options: TelemetryCommandOptions, _global: GlobalOptions): Promise<Record<string, unknown>> {\n void _global;\n const subcommand = normalizeTelemetrySubcommand(options.subcommand);\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n if (subcommand === \"status\") {\n return {\n action: \"telemetry\",\n subcommand,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"flush\") {\n const before = await buildTelemetryStatusSummary(globalPmRoot);\n await flushTelemetryQueueNow(globalPmRoot);\n const after = await buildTelemetryStatusSummary(globalPmRoot);\n return {\n action: \"telemetry\",\n subcommand,\n queue_entries_before: before.queue_entries,\n queue_entries_after: after.queue_entries,\n queue_drained: after.queue_entries < before.queue_entries,\n status: after,\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"stats\") {\n const limit = parseTelemetryStatsLimit(options.limit);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const buckets = buildTelemetryStatsBuckets(queue.entries);\n const selected = buckets.slice(0, limit);\n return {\n action: \"telemetry\",\n subcommand,\n limit,\n total_commands: buckets.length,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_rows_total: queue.rows_total,\n truncated: buckets.length > selected.length,\n stats: selected,\n generated_at: nowIso(),\n };\n }\n\n const settings = await readSettings(globalPmRoot);\n const previousEnabled = settings.telemetry.enabled;\n const previousInstallationId = settings.telemetry.installation_id;\n const previousFirstRunPromptCompleted = settings.telemetry.first_run_prompt_completed;\n settings.telemetry.enabled = false;\n settings.telemetry.first_run_prompt_completed = true;\n settings.telemetry.installation_id = \"\";\n const settingsChanged =\n previousEnabled !== settings.telemetry.enabled ||\n previousInstallationId !== settings.telemetry.installation_id ||\n previousFirstRunPromptCompleted !== settings.telemetry.first_run_prompt_completed;\n if (settingsChanged) {\n await writeSettings(globalPmRoot, settings, \"telemetry:clear\");\n }\n\n const telemetryRuntimePath = path.join(globalPmRoot, TELEMETRY_RUNTIME_RELATIVE_PATH);\n const existed = await pathExists(telemetryRuntimePath);\n await fs.rm(telemetryRuntimePath, { recursive: true, force: true });\n const queueExistsAfter = await pathExists(queuePath);\n const stateExistsAfter = await pathExists(statePath);\n return {\n action: \"telemetry\",\n subcommand,\n settings_changed: settingsChanged,\n runtime_dir_removed: existed && !(await pathExists(telemetryRuntimePath)),\n queue_exists_after: queueExistsAfter,\n state_exists_after: stateExistsAfter,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n}\n"],"names":[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gBAAgB,EAAE,eAAe;QACjC,mBAAmB,EAAE,OAAO,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACzE,kBAAkB,EAAE,gBAAgB;QACpC,kBAAkB,EAAE,gBAAgB;QACpC,MAAM,EAAE,MAAM,2BAA2B,CAAC,YAAY,CAAC;QACvD,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"4d50d256-348c-5406-a377-ea98099b9ec6"}
|
|
1
|
+
{"version":3,"file":"telemetry.js","sources":["cli/commands/telemetry.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { resolveGlobalPmRoot } from \"../../core/store/paths.js\";\nimport { readSettings, writeSettings } from \"../../core/store/settings.js\";\nimport { flushTelemetryQueueNow } from \"../../core/telemetry/runtime.js\";\n\nconst TELEMETRY_QUEUE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"events.jsonl\");\nconst TELEMETRY_STATE_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\", \"state.json\");\nconst TELEMETRY_RUNTIME_RELATIVE_PATH = path.join(\"runtime\", \"telemetry\");\nconst DEFAULT_STATS_LIMIT = 20;\n\nexport const TELEMETRY_SUBCOMMANDS = [\"status\", \"flush\", \"stats\", \"clear\"] as const;\nexport type TelemetrySubcommand = (typeof TELEMETRY_SUBCOMMANDS)[number];\n\ninterface TelemetryRuntimeStateRecord {\n endpoint?: string;\n queue_entries?: number;\n last_attempted_flush_at?: string;\n last_successful_flush_at?: string;\n last_failed_flush_at?: string;\n last_failed_flush_error?: string;\n}\n\ninterface QueuedTelemetryEventRecord {\n attempts: number;\n client_schema_version?: number;\n event: {\n event_id?: string;\n event_type?: string;\n schema_version?: number;\n command?: string;\n };\n}\n\ninterface ParsedTelemetryQueue {\n rows_total: number;\n valid_entries: number;\n invalid_rows: number;\n entries: QueuedTelemetryEventRecord[];\n}\n\ninterface TelemetryStatusSummary {\n enabled: boolean;\n endpoint: string;\n queue_path: string;\n state_path: string;\n queue_rows_total: number;\n queue_entries: number;\n queue_invalid_rows: number;\n queue_size_bytes: number;\n last_attempted_flush_at: string | null;\n last_successful_flush_at: string | null;\n last_failed_flush_at: string | null;\n last_failed_flush_error: string | null;\n}\n\nexport interface TelemetryCommandOptions {\n subcommand?: string;\n limit?: string | number;\n}\n\ninterface TelemetryStatsBucket {\n command: string;\n count: number;\n event_type_counts: Record<string, number>;\n max_attempts: number;\n event_schema_versions: number[];\n client_schema_versions: number[];\n}\n\nfunction normalizeTelemetrySubcommand(value: string | undefined): TelemetrySubcommand {\n const normalized = (value ?? \"status\").trim().toLowerCase();\n if ((TELEMETRY_SUBCOMMANDS as readonly string[]).includes(normalized)) {\n return normalized as TelemetrySubcommand;\n }\n // `value` is always a defined string here: an undefined subcommand normalizes\n // to \"status\" above (a valid value) and never reaches this throw.\n throw new PmCliError(\n `Unknown pm telemetry subcommand \"${value}\". Allowed: ${TELEMETRY_SUBCOMMANDS.join(\", \")}`,\n EXIT_CODE.USAGE,\n {\n code: \"unknown_subcommand\",\n examples: [\n \"pm telemetry status\",\n \"pm telemetry flush\",\n \"pm telemetry stats --limit 10\",\n \"pm telemetry clear\",\n ],\n },\n );\n}\n\nfunction parseTelemetryStatsLimit(raw: string | number | undefined): number {\n if (raw === undefined) {\n return DEFAULT_STATS_LIMIT;\n }\n if (typeof raw === \"number\") {\n if (!Number.isFinite(raw) || !Number.isInteger(raw) || raw <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return raw;\n }\n const trimmed = raw.trim();\n if (trimmed.length === 0 || !/^\\d+$/.test(trimmed)) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n const parsed = Number.parseInt(trimmed, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) {\n throw new PmCliError(\"--limit must be a positive integer\", EXIT_CODE.USAGE);\n }\n return parsed;\n}\n\nfunction parseTelemetryQueue(raw: string | null): ParsedTelemetryQueue {\n if (raw === null || raw.trim().length === 0) {\n return {\n rows_total: 0,\n valid_entries: 0,\n invalid_rows: 0,\n entries: [],\n };\n }\n const entries: QueuedTelemetryEventRecord[] = [];\n let rowsTotal = 0;\n let invalidRows = 0;\n for (const line of raw.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n rowsTotal += 1;\n try {\n const parsed = JSON.parse(trimmed) as QueuedTelemetryEventRecord;\n if (\n typeof parsed === \"object\" &&\n parsed !== null &&\n typeof parsed.attempts === \"number\" &&\n typeof parsed.event === \"object\" &&\n parsed.event !== null\n ) {\n entries.push(parsed);\n } else {\n invalidRows += 1;\n }\n } catch {\n invalidRows += 1;\n }\n }\n return {\n rows_total: rowsTotal,\n valid_entries: entries.length,\n invalid_rows: invalidRows,\n entries,\n };\n}\n\nasync function readTelemetryRuntimeState(statePath: string): Promise<TelemetryRuntimeStateRecord> {\n const stateRaw = await readFileIfExists(statePath);\n if (stateRaw === null || stateRaw.trim().length === 0) {\n return {};\n }\n try {\n const parsed = JSON.parse(stateRaw) as TelemetryRuntimeStateRecord;\n if (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Ignore malformed state files; status command is observational.\n }\n return {};\n}\n\nasync function buildTelemetryStatusSummary(globalPmRoot: string): Promise<TelemetryStatusSummary> {\n const settings = await readSettings(globalPmRoot);\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const runtimeState = await readTelemetryRuntimeState(statePath);\n return {\n enabled: settings.telemetry.enabled,\n endpoint: settings.telemetry.endpoint,\n queue_path: queuePath,\n state_path: statePath,\n queue_rows_total: queue.rows_total,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_size_bytes: queueRaw === null ? 0 : Buffer.byteLength(queueRaw, \"utf8\"),\n last_attempted_flush_at: runtimeState.last_attempted_flush_at ?? null,\n last_successful_flush_at: runtimeState.last_successful_flush_at ?? null,\n last_failed_flush_at: runtimeState.last_failed_flush_at ?? null,\n last_failed_flush_error: runtimeState.last_failed_flush_error ?? null,\n };\n}\n\nfunction buildTelemetryStatsBuckets(entries: QueuedTelemetryEventRecord[]): TelemetryStatsBucket[] {\n const grouped = new Map<\n string,\n {\n count: number;\n max_attempts: number;\n event_type_counts: Record<string, number>;\n event_schema_versions: Set<number>;\n client_schema_versions: Set<number>;\n }\n >();\n for (const entry of entries) {\n const command = typeof entry.event.command === \"string\" && entry.event.command.trim().length > 0\n ? entry.event.command\n : \"<unknown>\";\n const eventType = typeof entry.event.event_type === \"string\" && entry.event.event_type.trim().length > 0\n ? entry.event.event_type\n : \"unknown\";\n const eventSchemaVersion = typeof entry.event.schema_version === \"number\" && Number.isFinite(entry.event.schema_version)\n ? Math.trunc(entry.event.schema_version)\n : undefined;\n const clientSchemaVersion =\n typeof entry.client_schema_version === \"number\" && Number.isFinite(entry.client_schema_version)\n ? Math.trunc(entry.client_schema_version)\n : undefined;\n const current = grouped.get(command) ?? {\n count: 0,\n max_attempts: 0,\n event_type_counts: {},\n event_schema_versions: new Set<number>(),\n client_schema_versions: new Set<number>(),\n };\n current.count += 1;\n current.max_attempts = Math.max(current.max_attempts, Math.max(0, Math.trunc(entry.attempts)));\n current.event_type_counts[eventType] = (current.event_type_counts[eventType] ?? 0) + 1;\n if (eventSchemaVersion !== undefined) {\n current.event_schema_versions.add(eventSchemaVersion);\n }\n if (clientSchemaVersion !== undefined) {\n current.client_schema_versions.add(clientSchemaVersion);\n }\n grouped.set(command, current);\n }\n return [...grouped.entries()]\n .map(([command, value]) => ({\n command,\n count: value.count,\n event_type_counts: Object.fromEntries(\n Object.entries(value.event_type_counts).sort((left, right) => left[0].localeCompare(right[0])),\n ),\n max_attempts: value.max_attempts,\n event_schema_versions: [...value.event_schema_versions].sort((left, right) => left - right),\n client_schema_versions: [...value.client_schema_versions].sort((left, right) => left - right),\n }))\n .sort((left, right) => right.count - left.count || left.command.localeCompare(right.command));\n}\n\nexport async function runTelemetry(options: TelemetryCommandOptions, _global: GlobalOptions): Promise<Record<string, unknown>> {\n void _global;\n const subcommand = normalizeTelemetrySubcommand(options.subcommand);\n const globalPmRoot = resolveGlobalPmRoot(process.cwd());\n const queuePath = path.join(globalPmRoot, TELEMETRY_QUEUE_RELATIVE_PATH);\n const statePath = path.join(globalPmRoot, TELEMETRY_STATE_RELATIVE_PATH);\n if (subcommand === \"status\") {\n return {\n action: \"telemetry\",\n subcommand,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"flush\") {\n const before = await buildTelemetryStatusSummary(globalPmRoot);\n await flushTelemetryQueueNow(globalPmRoot);\n const after = await buildTelemetryStatusSummary(globalPmRoot);\n return {\n action: \"telemetry\",\n subcommand,\n queue_entries_before: before.queue_entries,\n queue_entries_after: after.queue_entries,\n queue_drained: after.queue_entries < before.queue_entries,\n status: after,\n generated_at: nowIso(),\n };\n }\n\n if (subcommand === \"stats\") {\n const limit = parseTelemetryStatsLimit(options.limit);\n const queueRaw = await readFileIfExists(queuePath);\n const queue = parseTelemetryQueue(queueRaw);\n const buckets = buildTelemetryStatsBuckets(queue.entries);\n const selected = buckets.slice(0, limit);\n return {\n action: \"telemetry\",\n subcommand,\n limit,\n total_commands: buckets.length,\n queue_entries: queue.valid_entries,\n queue_invalid_rows: queue.invalid_rows,\n queue_rows_total: queue.rows_total,\n truncated: buckets.length > selected.length,\n stats: selected,\n generated_at: nowIso(),\n };\n }\n\n const settings = await readSettings(globalPmRoot);\n const previousEnabled = settings.telemetry.enabled;\n const previousInstallationId = settings.telemetry.installation_id;\n const previousFirstRunPromptCompleted = settings.telemetry.first_run_prompt_completed;\n settings.telemetry.enabled = false;\n settings.telemetry.first_run_prompt_completed = true;\n settings.telemetry.installation_id = \"\";\n const settingsChanged =\n previousEnabled !== settings.telemetry.enabled ||\n previousInstallationId !== settings.telemetry.installation_id ||\n previousFirstRunPromptCompleted !== settings.telemetry.first_run_prompt_completed;\n if (settingsChanged) {\n await writeSettings(globalPmRoot, settings, \"telemetry:clear\");\n }\n\n const telemetryRuntimePath = path.join(globalPmRoot, TELEMETRY_RUNTIME_RELATIVE_PATH);\n const existed = await pathExists(telemetryRuntimePath);\n await fs.rm(telemetryRuntimePath, { recursive: true, force: true });\n const queueExistsAfter = await pathExists(queuePath);\n const stateExistsAfter = await pathExists(statePath);\n return {\n action: \"telemetry\",\n subcommand,\n settings_changed: settingsChanged,\n runtime_dir_removed: existed && !(await pathExists(telemetryRuntimePath)),\n queue_exists_after: queueExistsAfter,\n state_exists_after: stateExistsAfter,\n status: await buildTelemetryStatusSummary(globalPmRoot),\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE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,CAAC,SAAS,CAAC,eAAe,GAAG,EAAE,CAAC;IACxC,MAAM,eAAe,GACnB,eAAe,KAAK,QAAQ,CAAC,SAAS,CAAC,OAAO;QAC9C,sBAAsB,KAAK,QAAQ,CAAC,SAAS,CAAC,eAAe;QAC7D,+BAA+B,KAAK,QAAQ,CAAC,SAAS,CAAC,0BAA0B,CAAC;IACpF,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,+BAA+B,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvD,MAAM,EAAE,CAAC,EAAE,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,UAAU;QACV,gBAAgB,EAAE,eAAe;QACjC,mBAAmB,EAAE,OAAO,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACzE,kBAAkB,EAAE,gBAAgB;QACpC,kBAAkB,EAAE,gBAAgB;QACpC,MAAM,EAAE,MAAM,2BAA2B,CAAC,YAAY,CAAC;QACvD,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"d357d083-b2e2-5574-a1a3-513eb9bd5b1d"}
|
|
@@ -2,6 +2,19 @@ import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
|
2
2
|
type TemplateOptionValue = string | string[];
|
|
3
3
|
export type CreateTemplateOptions = Record<string, TemplateOptionValue>;
|
|
4
4
|
export type TemplateSource = "builtin" | "user";
|
|
5
|
+
interface StoredCreateTemplateDocument {
|
|
6
|
+
name: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
options: CreateTemplateOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare const _testOnly: {
|
|
12
|
+
normalizeTemplateName: typeof normalizeTemplateName;
|
|
13
|
+
extractTemplateOptions: typeof extractTemplateOptions;
|
|
14
|
+
parseStoredTemplateDocument: typeof parseStoredTemplateDocument;
|
|
15
|
+
builtinTemplateDocument: typeof builtinTemplateDocument;
|
|
16
|
+
readStoredTemplateDocument: typeof readStoredTemplateDocument;
|
|
17
|
+
};
|
|
5
18
|
export interface TemplatesSaveResult {
|
|
6
19
|
name: string;
|
|
7
20
|
created_at: string;
|
|
@@ -23,6 +36,11 @@ export interface TemplatesShowResult {
|
|
|
23
36
|
path: string;
|
|
24
37
|
options: CreateTemplateOptions;
|
|
25
38
|
}
|
|
39
|
+
declare function normalizeTemplateName(rawName: string): string;
|
|
40
|
+
declare function extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions;
|
|
41
|
+
declare function parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument;
|
|
42
|
+
declare function builtinTemplateDocument(normalizedName: string): StoredCreateTemplateDocument | null;
|
|
43
|
+
declare function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument>;
|
|
26
44
|
export declare function loadCreateTemplateOptions(pmRoot: string, rawTemplateName: string): Promise<CreateTemplateOptions>;
|
|
27
45
|
export declare function runTemplatesSave(rawTemplateName: string, options: Record<string, unknown>, global: GlobalOptions): Promise<TemplatesSaveResult>;
|
|
28
46
|
export declare function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult>;
|
|
@@ -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]="fca82a46-ab76-52b6-b3db-a0a664561755")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { pathExists, readFileIfExists, writeFileAtomic } from "../../core/fs/fs-utils.js";
|
|
@@ -48,6 +48,13 @@ const BUILTIN_TEMPLATES = {
|
|
|
48
48
|
body: "## What\n\n## Why\n",
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
|
+
export const _testOnly = {
|
|
52
|
+
normalizeTemplateName,
|
|
53
|
+
extractTemplateOptions,
|
|
54
|
+
parseStoredTemplateDocument,
|
|
55
|
+
builtinTemplateDocument,
|
|
56
|
+
readStoredTemplateDocument,
|
|
57
|
+
};
|
|
51
58
|
function normalizeTemplateName(rawName) {
|
|
52
59
|
const name = rawName.trim();
|
|
53
60
|
if (!TEMPLATE_NAME_PATTERN.test(name)) {
|
|
@@ -251,4 +258,4 @@ export async function runTemplatesShow(rawTemplateName, global) {
|
|
|
251
258
|
};
|
|
252
259
|
}
|
|
253
260
|
//# sourceMappingURL=templates.js.map
|
|
254
|
-
//# debugId=
|
|
261
|
+
//# debugId=fca82a46-ab76-52b6-b3db-a0a664561755
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sources":["cli/commands/templates.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport {\n CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,\n} from \"../../sdk/cli-contracts.js\";\n\nconst TEMPLATE_DIRECTORY_NAME = \"templates\";\nconst TEMPLATE_FILE_EXTENSION = \".json\";\nconst TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\nconst TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);\nconst TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set<string>(TEMPLATE_OPTION_REPEATABLE_KEYS);\n\ntype TemplateOptionValue = string | string[];\nexport type CreateTemplateOptions = Record<string, TemplateOptionValue>;\nexport type TemplateSource = \"builtin\" | \"user\";\n\nconst BUILTIN_TEMPLATE_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst BUILTIN_TEMPLATES: Readonly<Record<string, CreateTemplateOptions>> = {\n bug: {\n type: \"Issue\",\n priority: \"1\",\n tags: \"bug\",\n acceptanceCriteria: \"Bug no longer reproduces with the steps below and a regression test guards it.\",\n expectedResult: \"Describe the correct behavior.\",\n actualResult: \"Describe the observed (buggy) behavior.\",\n body: \"## Repro steps\\n1. \\n2. \\n3. \\n\\n## Expected\\n\\n## Actual\\n\",\n },\n feature: {\n type: \"Feature\",\n priority: \"2\",\n tags: \"feature\",\n acceptanceCriteria: \"Feature is shipped behind agreed scope with tests and docs updated.\",\n whyNow: \"Explain why this is worth doing now (impact / urgency).\",\n body: \"## Goal\\n\\n## Why now\\n\\n## Out of scope\\n\",\n },\n spike: {\n type: \"Task\",\n priority: \"2\",\n tags: \"spike\",\n estimatedMinutes: \"120\",\n acceptanceCriteria: \"Timeboxed investigation complete; findings and a recommendation are recorded.\",\n body: \"## Question to answer\\n\\n## Timebox\\n2h\\n\\n## Findings\\n\\n## Recommendation\\n\",\n },\n chore: {\n type: \"Chore\",\n priority: \"3\",\n tags: \"chore\",\n acceptanceCriteria: \"Maintenance task done with no behavior change and green checks.\",\n body: \"## What\\n\\n## Why\\n\",\n },\n};\n\ninterface StoredCreateTemplateDocument {\n name: string;\n created_at: string;\n updated_at: string;\n options: CreateTemplateOptions;\n}\n\nexport interface TemplatesSaveResult {\n name: string;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nexport interface TemplatesListResult {\n templates: string[];\n count: number;\n builtin_templates: string[];\n user_templates: string[];\n}\n\nexport interface TemplatesShowResult {\n name: string;\n source: TemplateSource;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nfunction normalizeTemplateName(rawName: string): string {\n const name = rawName.trim();\n if (!TEMPLATE_NAME_PATTERN.test(name)) {\n throw new PmCliError(\n `Invalid template name \"${rawName}\". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,\n EXIT_CODE.USAGE,\n );\n }\n return name;\n}\n\nfunction templatesDirectory(pmRoot: string): string {\n return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);\n}\n\nfunction templatePath(pmRoot: string, normalizedName: string): string {\n return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);\n}\n\nasync function ensureTrackerInitialized(pmRoot: string): Promise<void> {\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\nfunction sortTemplateOptions(options: CreateTemplateOptions): CreateTemplateOptions {\n return Object.fromEntries(\n Object.entries(options).sort(([left], [right]) => left.localeCompare(right)),\n ) as CreateTemplateOptions;\n}\n\nfunction extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions {\n const next: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(rawOptions)) {\n if (value === undefined) {\n continue;\n }\n if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {\n if (typeof value === \"string\") {\n next[key] = [value];\n continue;\n }\n if (!Array.isArray(value)) {\n continue;\n }\n const values = value.filter((entry): entry is string => typeof entry === \"string\");\n if (values.length > 0) {\n next[key] = values;\n }\n continue;\n }\n if (typeof value === \"string\") {\n next[key] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n next[key] = [...value];\n }\n }\n return sortTemplateOptions(next);\n}\n\nfunction parseStoredTemplateOptions(rawOptions: unknown, templateName: string): CreateTemplateOptions {\n if (typeof rawOptions !== \"object\" || rawOptions === null || Array.isArray(rawOptions)) {\n throw new PmCliError(`Template \"${templateName}\" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const optionsRecord = rawOptions as Record<string, unknown>;\n const normalized: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(optionsRecord)) {\n const normalizedKey = key.trim();\n if (normalizedKey.length === 0) {\n throw new PmCliError(\n `Template \"${templateName}\" contains an empty option key.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (typeof value === \"string\") {\n normalized[normalizedKey] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n normalized[normalizedKey] = [...value];\n continue;\n }\n throw new PmCliError(\n `Template \"${templateName}\" contains invalid value for option \"${normalizedKey}\".`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return sortTemplateOptions(normalized);\n}\n\nfunction parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(`Template \"${normalizedName}\" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new PmCliError(`Template \"${normalizedName}\" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n const options = parseStoredTemplateOptions(record.options, normalizedName);\n const now = nowIso();\n return {\n name: typeof record.name === \"string\" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,\n created_at: typeof record.created_at === \"string\" ? record.created_at : now,\n updated_at: typeof record.updated_at === \"string\" ? record.updated_at : now,\n options,\n };\n}\n\nfunction builtinTemplateDocument(normalizedName: string): StoredCreateTemplateDocument | null {\n const options = BUILTIN_TEMPLATES[normalizedName];\n if (!options) {\n return null;\n }\n return {\n name: normalizedName,\n created_at: BUILTIN_TEMPLATE_TIMESTAMP,\n updated_at: BUILTIN_TEMPLATE_TIMESTAMP,\n options: sortTemplateOptions({ ...options }),\n };\n}\n\ninterface ResolvedTemplateDocument {\n document: StoredCreateTemplateDocument;\n source: TemplateSource;\n}\n\nasync function resolveTemplateDocument(pmRoot: string, normalizedName: string): Promise<ResolvedTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw !== null) {\n return { document: parseStoredTemplateDocument(raw, normalizedName), source: \"user\" };\n }\n const builtin = builtinTemplateDocument(normalizedName);\n if (builtin) {\n return { document: builtin, source: \"builtin\" };\n }\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n}\n\nasync function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw === null) {\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n }\n return parseStoredTemplateDocument(raw, normalizedName);\n}\n\nexport async function loadCreateTemplateOptions(pmRoot: string, rawTemplateName: string): Promise<CreateTemplateOptions> {\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document } = await resolveTemplateDocument(pmRoot, normalizedName);\n return document.options;\n}\n\nexport async function runTemplatesSave(\n rawTemplateName: string,\n options: Record<string, unknown>,\n global: GlobalOptions,\n): Promise<TemplatesSaveResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const nextOptions = extractTemplateOptions(options);\n if (Object.keys(nextOptions).length === 0) {\n throw new PmCliError(\"templates save requires at least one create option flag\", EXIT_CODE.USAGE);\n }\n\n const now = nowIso();\n const storedPath = templatePath(pmRoot, normalizedName);\n let createdAt = now;\n if (await pathExists(storedPath)) {\n const existing = await readStoredTemplateDocument(pmRoot, normalizedName);\n createdAt = existing.created_at;\n }\n\n const document: StoredCreateTemplateDocument = {\n name: normalizedName,\n created_at: createdAt,\n updated_at: now,\n options: nextOptions,\n };\n await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });\n await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\\n`);\n return {\n name: document.name,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: storedPath,\n options: document.options,\n };\n}\n\nasync function readUserTemplateNames(pmRoot: string): Promise<string[]> {\n const dirPath = templatesDirectory(pmRoot);\n if (!(await pathExists(dirPath))) {\n return [];\n }\n const entries = await fs.readdir(dirPath);\n return entries\n .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))\n .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))\n .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry));\n}\n\nexport async function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const userTemplates = await readUserTemplateNames(pmRoot);\n const userTemplateSet = new Set<string>(userTemplates);\n const builtinTemplates = Object.keys(BUILTIN_TEMPLATES).filter((name) => !userTemplateSet.has(name));\n const sortedUser = [...userTemplates].sort((left, right) => left.localeCompare(right));\n const sortedBuiltin = [...builtinTemplates].sort((left, right) => left.localeCompare(right));\n const templates = [...new Set([...sortedUser, ...sortedBuiltin])].sort((left, right) => left.localeCompare(right));\n return {\n templates,\n count: templates.length,\n builtin_templates: sortedBuiltin,\n user_templates: sortedUser,\n };\n}\n\nexport async function runTemplatesShow(rawTemplateName: string, global: GlobalOptions): Promise<TemplatesShowResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document, source } = await resolveTemplateDocument(pmRoot, normalizedName);\n return {\n name: document.name,\n source,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: source === \"builtin\" ? `builtin:${normalizedName}` : templatePath(pmRoot, normalizedName),\n options: document.options,\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EACL,4CAA4C,GAC7C,MAAM,4BAA4B,CAAC;AAEpC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAC5C,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAElE,MAAM,+BAA+B,GAAG,4CAA4C,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAClH,MAAM,kCAAkC,GAAG,IAAI,GAAG,CAAS,+BAA+B,CAAC,CAAC;AAM5F,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAC9D,MAAM,iBAAiB,GAAoD;IACzE,GAAG,EAAE;QACH,IAAI,EAAE,OA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AK,EAAE,SAAS,CAAC,MAAM;QACvB,iBAAiB,EAAE,aAAa;QAChC,cAAc,EAAE,UAAU;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,eAAuB,EAAE,MAAqB;IACnF,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC9D,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnF,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM;QACN,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,cAAc,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC;QAC/F,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC","debugId":"b9b40f68-29ac-5ae0-96d4-b4aab2822e8a"}
|
|
1
|
+
{"version":3,"file":"templates.js","sources":["cli/commands/templates.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport {\n CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,\n} from \"../../sdk/cli-contracts.js\";\n\nconst TEMPLATE_DIRECTORY_NAME = \"templates\";\nconst TEMPLATE_FILE_EXTENSION = \".json\";\nconst TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\nconst TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);\nconst TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set<string>(TEMPLATE_OPTION_REPEATABLE_KEYS);\n\ntype TemplateOptionValue = string | string[];\nexport type CreateTemplateOptions = Record<string, TemplateOptionValue>;\nexport type TemplateSource = \"builtin\" | \"user\";\n\nconst BUILTIN_TEMPLATE_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst BUILTIN_TEMPLATES: Readonly<Record<string, CreateTemplateOptions>> = {\n bug: {\n type: \"Issue\",\n priority: \"1\",\n tags: \"bug\",\n acceptanceCriteria: \"Bug no longer reproduces with the steps below and a regression test guards it.\",\n expectedResult: \"Describe the correct behavior.\",\n actualResult: \"Describe the observed (buggy) behavior.\",\n body: \"## Repro steps\\n1. \\n2. \\n3. \\n\\n## Expected\\n\\n## Actual\\n\",\n },\n feature: {\n type: \"Feature\",\n priority: \"2\",\n tags: \"feature\",\n acceptanceCriteria: \"Feature is shipped behind agreed scope with tests and docs updated.\",\n whyNow: \"Explain why this is worth doing now (impact / urgency).\",\n body: \"## Goal\\n\\n## Why now\\n\\n## Out of scope\\n\",\n },\n spike: {\n type: \"Task\",\n priority: \"2\",\n tags: \"spike\",\n estimatedMinutes: \"120\",\n acceptanceCriteria: \"Timeboxed investigation complete; findings and a recommendation are recorded.\",\n body: \"## Question to answer\\n\\n## Timebox\\n2h\\n\\n## Findings\\n\\n## Recommendation\\n\",\n },\n chore: {\n type: \"Chore\",\n priority: \"3\",\n tags: \"chore\",\n acceptanceCriteria: \"Maintenance task done with no behavior change and green checks.\",\n body: \"## What\\n\\n## Why\\n\",\n },\n};\n\ninterface StoredCreateTemplateDocument {\n name: string;\n created_at: string;\n updated_at: string;\n options: CreateTemplateOptions;\n}\n\nexport const _testOnly = {\n normalizeTemplateName,\n extractTemplateOptions,\n parseStoredTemplateDocument,\n builtinTemplateDocument,\n readStoredTemplateDocument,\n};\n\nexport interface TemplatesSaveResult {\n name: string;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nexport interface TemplatesListResult {\n templates: string[];\n count: number;\n builtin_templates: string[];\n user_templates: string[];\n}\n\nexport interface TemplatesShowResult {\n name: string;\n source: TemplateSource;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nfunction normalizeTemplateName(rawName: string): string {\n const name = rawName.trim();\n if (!TEMPLATE_NAME_PATTERN.test(name)) {\n throw new PmCliError(\n `Invalid template name \"${rawName}\". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,\n EXIT_CODE.USAGE,\n );\n }\n return name;\n}\n\nfunction templatesDirectory(pmRoot: string): string {\n return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);\n}\n\nfunction templatePath(pmRoot: string, normalizedName: string): string {\n return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);\n}\n\nasync function ensureTrackerInitialized(pmRoot: string): Promise<void> {\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\nfunction sortTemplateOptions(options: CreateTemplateOptions): CreateTemplateOptions {\n return Object.fromEntries(\n Object.entries(options).sort(([left], [right]) => left.localeCompare(right)),\n ) as CreateTemplateOptions;\n}\n\nfunction extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions {\n const next: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(rawOptions)) {\n if (value === undefined) {\n continue;\n }\n if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {\n if (typeof value === \"string\") {\n next[key] = [value];\n continue;\n }\n if (!Array.isArray(value)) {\n continue;\n }\n const values = value.filter((entry): entry is string => typeof entry === \"string\");\n if (values.length > 0) {\n next[key] = values;\n }\n continue;\n }\n if (typeof value === \"string\") {\n next[key] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n next[key] = [...value];\n }\n }\n return sortTemplateOptions(next);\n}\n\nfunction parseStoredTemplateOptions(rawOptions: unknown, templateName: string): CreateTemplateOptions {\n if (typeof rawOptions !== \"object\" || rawOptions === null || Array.isArray(rawOptions)) {\n throw new PmCliError(`Template \"${templateName}\" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const optionsRecord = rawOptions as Record<string, unknown>;\n const normalized: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(optionsRecord)) {\n const normalizedKey = key.trim();\n if (normalizedKey.length === 0) {\n throw new PmCliError(\n `Template \"${templateName}\" contains an empty option key.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (typeof value === \"string\") {\n normalized[normalizedKey] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n normalized[normalizedKey] = [...value];\n continue;\n }\n throw new PmCliError(\n `Template \"${templateName}\" contains invalid value for option \"${normalizedKey}\".`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return sortTemplateOptions(normalized);\n}\n\nfunction parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(`Template \"${normalizedName}\" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new PmCliError(`Template \"${normalizedName}\" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n const options = parseStoredTemplateOptions(record.options, normalizedName);\n const now = nowIso();\n return {\n name: typeof record.name === \"string\" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,\n created_at: typeof record.created_at === \"string\" ? record.created_at : now,\n updated_at: typeof record.updated_at === \"string\" ? record.updated_at : now,\n options,\n };\n}\n\nfunction builtinTemplateDocument(normalizedName: string): StoredCreateTemplateDocument | null {\n const options = BUILTIN_TEMPLATES[normalizedName];\n if (!options) {\n return null;\n }\n return {\n name: normalizedName,\n created_at: BUILTIN_TEMPLATE_TIMESTAMP,\n updated_at: BUILTIN_TEMPLATE_TIMESTAMP,\n options: sortTemplateOptions({ ...options }),\n };\n}\n\ninterface ResolvedTemplateDocument {\n document: StoredCreateTemplateDocument;\n source: TemplateSource;\n}\n\nasync function resolveTemplateDocument(pmRoot: string, normalizedName: string): Promise<ResolvedTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw !== null) {\n return { document: parseStoredTemplateDocument(raw, normalizedName), source: \"user\" };\n }\n const builtin = builtinTemplateDocument(normalizedName);\n if (builtin) {\n return { document: builtin, source: \"builtin\" };\n }\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n}\n\nasync function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw === null) {\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n }\n return parseStoredTemplateDocument(raw, normalizedName);\n}\n\nexport async function loadCreateTemplateOptions(pmRoot: string, rawTemplateName: string): Promise<CreateTemplateOptions> {\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document } = await resolveTemplateDocument(pmRoot, normalizedName);\n return document.options;\n}\n\nexport async function runTemplatesSave(\n rawTemplateName: string,\n options: Record<string, unknown>,\n global: GlobalOptions,\n): Promise<TemplatesSaveResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const nextOptions = extractTemplateOptions(options);\n if (Object.keys(nextOptions).length === 0) {\n throw new PmCliError(\"templates save requires at least one create option flag\", EXIT_CODE.USAGE);\n }\n\n const now = nowIso();\n const storedPath = templatePath(pmRoot, normalizedName);\n let createdAt = now;\n if (await pathExists(storedPath)) {\n const existing = await readStoredTemplateDocument(pmRoot, normalizedName);\n createdAt = existing.created_at;\n }\n\n const document: StoredCreateTemplateDocument = {\n name: normalizedName,\n created_at: createdAt,\n updated_at: now,\n options: nextOptions,\n };\n await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });\n await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\\n`);\n return {\n name: document.name,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: storedPath,\n options: document.options,\n };\n}\n\nasync function readUserTemplateNames(pmRoot: string): Promise<string[]> {\n const dirPath = templatesDirectory(pmRoot);\n if (!(await pathExists(dirPath))) {\n return [];\n }\n const entries = await fs.readdir(dirPath);\n return entries\n .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))\n .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))\n .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry));\n}\n\nexport async function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const userTemplates = await readUserTemplateNames(pmRoot);\n const userTemplateSet = new Set<string>(userTemplates);\n const builtinTemplates = Object.keys(BUILTIN_TEMPLATES).filter((name) => !userTemplateSet.has(name));\n const sortedUser = [...userTemplates].sort((left, right) => left.localeCompare(right));\n const sortedBuiltin = [...builtinTemplates].sort((left, right) => left.localeCompare(right));\n const templates = [...new Set([...sortedUser, ...sortedBuiltin])].sort((left, right) => left.localeCompare(right));\n return {\n templates,\n count: templates.length,\n builtin_templates: sortedBuiltin,\n user_templates: sortedUser,\n };\n}\n\nexport async function runTemplatesShow(rawTemplateName: string, global: GlobalOptions): Promise<TemplatesShowResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document, source } = await resolveTemplateDocument(pmRoot, normalizedName);\n return {\n name: document.name,\n source,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: source === \"builtin\" ? `builtin:${normalizedName}` : templatePath(pmRoot, normalizedName),\n options: document.options,\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EACL,4CAA4C,GAC7C,MAAM,4BAA4B,CAAC;AAEpC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAC5C,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAElE,MAAM,+BAA+B,GAAG,4CAA4C,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAClH,MAAM,kCAAkC,GAAG,IAAI,GAAG,CAAS,+BAA+B,CAAC,CAAC;AAM5F,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAC9D,MAAM,iBAAiB,GAAoD;IACzE,GAAG,EAAE;QACH,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,GAAG;QACb,IAAI,EAAE,KAAK;QACX,kBA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a,CAAC,KAAK,CAAC,CAAC,CAAC;IACnH,OAAO;QACL,SAAS;QACT,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,iBAAiB,EAAE,aAAa;QAChC,cAAc,EAAE,UAAU;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,eAAuB,EAAE,MAAqB;IACnF,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAC9D,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnF,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM;QACN,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,cAAc,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC;QAC/F,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC","debugId":"fca82a46-ab76-52b6-b3db-a0a664561755"}
|
|
@@ -47,4 +47,9 @@ export interface TestAllResult {
|
|
|
47
47
|
warnings?: string[];
|
|
48
48
|
results: TestAllItemResult[];
|
|
49
49
|
}
|
|
50
|
+
declare function formatTrackingError(error: unknown): string;
|
|
50
51
|
export declare function runTestAll(options: TestAllCommandOptions, global: GlobalOptions): Promise<TestAllResult>;
|
|
52
|
+
export declare const _testOnlyTestAll: {
|
|
53
|
+
formatTrackingError: typeof formatTrackingError;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -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]="50fd20e8-3b50-588b-971e-865664146a4c")}catch(e){}}();
|
|
3
3
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
4
4
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
5
5
|
import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
@@ -42,6 +42,9 @@ function parseNonNegativeInteger(raw, flag) {
|
|
|
42
42
|
}
|
|
43
43
|
return parsed;
|
|
44
44
|
}
|
|
45
|
+
function formatTrackingError(error) {
|
|
46
|
+
return error instanceof Error ? error.message : String(error);
|
|
47
|
+
}
|
|
45
48
|
function resolveTrackedRunId() {
|
|
46
49
|
const fromEnv = process.env.PM_BACKGROUND_TEST_RUN_ID?.trim();
|
|
47
50
|
if (fromEnv && fromEnv.length > 0) {
|
|
@@ -260,7 +263,7 @@ export async function runTestAll(options, global) {
|
|
|
260
263
|
});
|
|
261
264
|
}
|
|
262
265
|
catch (error) {
|
|
263
|
-
trackingWarnings.push(`test_result_tracking_failed:${item.id}:${
|
|
266
|
+
trackingWarnings.push(`test_result_tracking_failed:${item.id}:${formatTrackingError(error)}`);
|
|
264
267
|
}
|
|
265
268
|
}
|
|
266
269
|
results.push({
|
|
@@ -302,5 +305,8 @@ export async function runTestAll(options, global) {
|
|
|
302
305
|
results,
|
|
303
306
|
};
|
|
304
307
|
}
|
|
308
|
+
export const _testOnlyTestAll = {
|
|
309
|
+
formatTrackingError,
|
|
310
|
+
};
|
|
305
311
|
//# sourceMappingURL=test-all.js.map
|
|
306
|
-
//# debugId=
|
|
312
|
+
//# debugId=50fd20e8-3b50-588b-971e-865664146a4c
|