@unbrained/pm-cli 2026.6.13 → 2026.6.17
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 +102 -0
- package/README.md +1 -1
- 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 +362 -15
- 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 +51 -0
- package/dist/cli/commands/create.js +137 -18
- 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 +4 -1
- package/dist/cli/commands/index.js +6 -3
- 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 +38 -2
- package/dist/cli/commands/init.js +50 -64
- 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/lifecycle-transitions.d.ts +23 -0
- package/dist/cli/commands/lifecycle-transitions.js +41 -0
- package/dist/cli/commands/lifecycle-transitions.js.map +1 -0
- package/dist/cli/commands/linked-artifacts.d.ts +5 -0
- package/dist/cli/commands/linked-artifacts.js +18 -4
- package/dist/cli/commands/linked-artifacts.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/recurrence-parsers.d.ts +9 -0
- package/dist/cli/commands/recurrence-parsers.js +19 -2
- package/dist/cli/commands/recurrence-parsers.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/repeatable-metadata-parsers.js +28 -4
- package/dist/cli/commands/repeatable-metadata-parsers.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/scheduling-shortcuts.d.ts +43 -0
- package/dist/cli/commands/scheduling-shortcuts.js +87 -0
- package/dist/cli/commands/scheduling-shortcuts.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +152 -2
- package/dist/cli/commands/schema.js +510 -4
- 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 +91 -11
- 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 +153 -8
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.d.ts +30 -0
- package/dist/cli/error-guidance.js +41 -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 +54 -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 +242 -0
- package/dist/cli/main.js +241 -45
- 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 +376 -100
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.d.ts +8 -0
- package/dist/cli/register-operations.js +134 -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-PZYSZA26.js +18 -0
- package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js → activity-SFM4THAU.js} +13 -11
- package/dist/cli-bundle/chunks/{aggregate-IRHJWEKG.js → aggregate-Y5ADDKBM.js} +55 -26
- package/dist/cli-bundle/chunks/aggregate-Y5ADDKBM.js.map +1 -0
- package/dist/cli-bundle/chunks/{aggregate-XEBW22UQ.js → aggregate-YTAUQLRW.js} +54 -25
- package/dist/cli-bundle/chunks/aggregate-YTAUQLRW.js.map +7 -0
- package/dist/cli-bundle/chunks/{append-NL67JNJU.js → append-4M7OVV7M.js} +11 -11
- package/dist/cli-bundle/chunks/append-4M7OVV7M.js.map +1 -0
- package/dist/cli-bundle/chunks/{append-N2AWXKZC.js → append-HSPK4L4V.js} +10 -10
- package/dist/cli-bundle/chunks/{append-N2AWXKZC.js.map → append-HSPK4L4V.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js → chunk-26BM6YLO.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js → chunk-2C6FU3D3.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js.map → chunk-2C6FU3D3.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-SQDKAEKG.js → chunk-2OPYLXDO.js} +117 -37
- package/dist/cli-bundle/chunks/chunk-2OPYLXDO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-4ZKKZMLH.js → chunk-2S46FKLB.js} +104 -30
- package/dist/cli-bundle/chunks/chunk-2S46FKLB.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js → chunk-2TMKMTEI.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js → chunk-2VH7DFSJ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RHYBR6G7.js → chunk-3ENF4NO4.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-3ENF4NO4.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-3GR2HTYY.js +404 -0
- package/dist/cli-bundle/chunks/chunk-3GR2HTYY.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-AAUYXSFF.js → chunk-3R3FYCBV.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-3R3FYCBV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5HSAHRYA.js → chunk-3UKJX3RP.js} +82 -21
- package/dist/cli-bundle/chunks/chunk-3UKJX3RP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-4RTLBTYS.js +83 -0
- package/dist/cli-bundle/chunks/chunk-4RTLBTYS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-UCVJP4JL.js → chunk-5FDYWOJT.js} +52 -8
- package/dist/cli-bundle/chunks/chunk-5FDYWOJT.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js → chunk-5XGWFUW2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LYNQ3NGI.js → chunk-6BD77FGL.js} +309 -20
- package/dist/cli-bundle/chunks/chunk-6BD77FGL.js.map +1 -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-36BCSMKP.js → chunk-6HF6CIY2.js} +26 -11
- package/dist/cli-bundle/chunks/chunk-6HF6CIY2.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-M3SI2REU.js → chunk-6PBPD4MN.js} +322 -19
- package/dist/cli-bundle/chunks/chunk-6PBPD4MN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-TSXWFN3L.js → chunk-6VFUEGOA.js} +53 -9
- package/dist/cli-bundle/chunks/chunk-6VFUEGOA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2J2AH4V5.js → chunk-AAOXSPAE.js} +56 -72
- package/dist/cli-bundle/chunks/chunk-AAOXSPAE.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js → chunk-AJCQ5GT6.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-ALTGYHN3.js +61 -0
- package/dist/cli-bundle/chunks/chunk-ALTGYHN3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-KHGTYCJ6.js → chunk-AOJQL33L.js} +83 -22
- package/dist/cli-bundle/chunks/chunk-AOJQL33L.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js → chunk-AXLDUGXA.js} +7 -4
- package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js.map → chunk-AXLDUGXA.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js → chunk-BITCVGHT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js → chunk-CGQTFWYI.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-LFW5NQUP.js → chunk-CHM2VFVL.js} +407 -290
- package/dist/cli-bundle/chunks/chunk-CHM2VFVL.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js → chunk-COVLE33A.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-SGMGMCIF.js → chunk-DDNBWH4W.js} +157 -25
- package/dist/cli-bundle/chunks/chunk-DDNBWH4W.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js → chunk-F5MSD5HE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6TBR5AZ2.js → chunk-FAXB6F6R.js} +76 -8
- package/dist/cli-bundle/chunks/chunk-FAXB6F6R.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-L6YQONLM.js → chunk-FPDK5BZQ.js} +18 -19
- package/dist/cli-bundle/chunks/chunk-FPDK5BZQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-AGG32LKL.js → chunk-FPY2TOFI.js} +480 -24
- package/dist/cli-bundle/chunks/chunk-FPY2TOFI.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JWXTOYBI.js → chunk-G2MOUCTU.js} +121 -44
- package/dist/cli-bundle/chunks/chunk-G2MOUCTU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-3VULHQNS.js → chunk-G57RHEGP.js} +36 -18
- package/dist/cli-bundle/chunks/chunk-G57RHEGP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-QQG4HEX7.js → chunk-IROHIK2T.js} +37 -63
- package/dist/cli-bundle/chunks/chunk-IROHIK2T.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js → chunk-JZHL4E3Q.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-XXLMJDUB.js → chunk-KA22USXD.js} +21 -22
- package/dist/cli-bundle/chunks/chunk-KA22USXD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-WLH7X4RN.js → chunk-KBC4O7SY.js} +56 -72
- package/dist/cli-bundle/chunks/chunk-KBC4O7SY.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js → chunk-KCAGIH6K.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-BVL5KGVA.js → chunk-KO3VM5GS.js} +27 -12
- package/dist/cli-bundle/chunks/chunk-KO3VM5GS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IXVSSHGV.js → chunk-LNH5Q32E.js} +13 -8
- package/dist/cli-bundle/chunks/chunk-LNH5Q32E.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js → chunk-LORM3M2I.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js.map → chunk-LORM3M2I.js.map} +1 -1
- 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-GFBEXDCQ.js → chunk-M4AVU7VC.js} +19 -8
- package/dist/cli-bundle/chunks/{chunk-GFBEXDCQ.js.map → chunk-M4AVU7VC.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js → chunk-MIBX6ZRN.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-AUDDXKNX.js → chunk-MMF2E3FM.js} +77 -9
- package/dist/cli-bundle/chunks/chunk-MMF2E3FM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RFR2YQGO.js → chunk-MORZOR7W.js} +21 -8
- package/dist/cli-bundle/chunks/chunk-MORZOR7W.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4TPFXE2R.js → chunk-MUTUZ2HD.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-MUTUZ2HD.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-HZOX5BYD.js → chunk-OGXEBTX3.js} +35 -17
- package/dist/cli-bundle/chunks/chunk-OGXEBTX3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js → chunk-OOIH6J5T.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js.map → chunk-OOIH6J5T.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-VNC2HBL4.js → chunk-OSBJPPX3.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-OSBJPPX3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2ANTZBYF.js → chunk-PJS3WDO2.js} +122 -45
- package/dist/cli-bundle/chunks/chunk-PJS3WDO2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-7SM7VA5I.js → chunk-QGPE2H6Z.js} +19 -8
- package/dist/cli-bundle/chunks/chunk-QGPE2H6Z.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-QVTFFLR2.js +58 -0
- package/dist/cli-bundle/chunks/chunk-QVTFFLR2.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js → chunk-QW2F6ARZ.js} +8 -5
- package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js.map → chunk-QW2F6ARZ.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-TOX7YQ7X.js → chunk-QXC3LWB7.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-QXC3LWB7.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-W6KNFAMZ.js → chunk-QXMXRPX5.js} +9 -8
- package/dist/cli-bundle/chunks/chunk-QXMXRPX5.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js → chunk-R4AKUPKI.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js.map → chunk-R4AKUPKI.js.map} +1 -1
- package/dist/cli-bundle/chunks/chunk-RASR23HV.js +394 -0
- package/dist/cli-bundle/chunks/chunk-RASR23HV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JW7D6437.js → chunk-SCDCNGCV.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-SCDCNGCV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js → chunk-SCS5PVAA.js} +10 -9
- package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js.map → chunk-SCS5PVAA.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-S2CDTRJ6.js → chunk-SJCMTOEU.js} +381 -271
- package/dist/cli-bundle/chunks/chunk-SJCMTOEU.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js → chunk-SO2ES46D.js} +11 -10
- package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js.map → chunk-SO2ES46D.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-MACCNKSZ.js → chunk-TBV33CB4.js} +36 -62
- package/dist/cli-bundle/chunks/chunk-TBV33CB4.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-TEFEXQWI.js +86 -0
- package/dist/cli-bundle/chunks/chunk-TEFEXQWI.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-HLEGAQXT.js → chunk-TWBDDVIF.js} +20 -7
- package/dist/cli-bundle/chunks/chunk-TWBDDVIF.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-4JHJ7YG2.js → chunk-UGUJ2UOR.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-UGUJ2UOR.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js → chunk-UN6P3IJ4.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-32XSW44C.js → chunk-V2GYOMEX.js} +10 -9
- package/dist/cli-bundle/chunks/chunk-V2GYOMEX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-HWHONML5.js → chunk-VF3KQGNY.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-SOHXUA2Q.js → chunk-VHG6LUKR.js} +116 -36
- package/dist/cli-bundle/chunks/chunk-VHG6LUKR.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-7CRFV6JR.js → chunk-VXHMQDXA.js} +483 -27
- package/dist/cli-bundle/chunks/chunk-VXHMQDXA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-IZHCCG4S.js → chunk-VXRFAE7W.js} +14 -9
- package/dist/cli-bundle/chunks/chunk-VXRFAE7W.js.map +1 -0
- 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-4FHLNNW7.js → chunk-WQRL4COW.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-WQRL4COW.js.map +7 -0
- 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-MGAQ6KZG.js → chunk-XESAPVZ4.js} +166 -27
- package/dist/cli-bundle/chunks/chunk-XESAPVZ4.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PEH7SZD2.js → chunk-YLAW3FZN.js} +105 -31
- package/dist/cli-bundle/chunks/chunk-YLAW3FZN.js.map +7 -0
- package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js → claim-WGAWJCPY.js} +10 -10
- package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js → claim-ZI6P4LMU.js} +10 -10
- package/dist/cli-bundle/chunks/close-I7PRQ5G7.js +13 -0
- package/dist/cli-bundle/chunks/{close-SPUFW5QR.js → close-JMVVSIQE.js} +8 -8
- package/dist/cli-bundle/chunks/{close-many-GKAJX54X.js → close-many-IKPJXVOZ.js} +32 -20
- package/dist/cli-bundle/chunks/close-many-IKPJXVOZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{close-many-GL6NRUU5.js → close-many-TXABDCSJ.js} +31 -19
- package/dist/cli-bundle/chunks/close-many-TXABDCSJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{comments-5FPT6L7N.js → comments-RLWR2S7W.js} +55 -31
- package/dist/cli-bundle/chunks/comments-RLWR2S7W.js.map +1 -0
- package/dist/cli-bundle/chunks/{comments-TOLOYWNI.js → comments-YAMXKHUX.js} +54 -30
- package/dist/cli-bundle/chunks/comments-YAMXKHUX.js.map +7 -0
- package/dist/cli-bundle/chunks/{config-7N6D7YJE.js → config-7ICYC2WU.js} +83 -19
- package/dist/cli-bundle/chunks/config-7ICYC2WU.js.map +7 -0
- package/dist/cli-bundle/chunks/{config-4MN45TIH.js → config-NGWN3EXC.js} +83 -19
- package/dist/cli-bundle/chunks/config-NGWN3EXC.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-AQSLE7DZ.js → context-K6QAHN5H.js} +128 -39
- package/dist/cli-bundle/chunks/context-K6QAHN5H.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-U3PUJMVN.js → context-VGXOOAH2.js} +127 -38
- package/dist/cli-bundle/chunks/context-VGXOOAH2.js.map +7 -0
- package/dist/cli-bundle/chunks/{contracts-ITSJXO3O.js → contracts-KJGY2AQA.js} +99 -15
- package/dist/cli-bundle/chunks/contracts-KJGY2AQA.js.map +1 -0
- package/dist/cli-bundle/chunks/{contracts-H7KCQXLY.js → contracts-KMA6OJY7.js} +99 -15
- package/dist/cli-bundle/chunks/contracts-KMA6OJY7.js.map +7 -0
- package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js → copy-Q2PPU4AY.js} +7 -7
- package/dist/cli-bundle/chunks/{copy-C4W522JM.js → copy-SC6UF3PI.js} +7 -7
- package/dist/cli-bundle/chunks/{create-4EQNELMY.js → create-76FE7JVF.js} +16 -13
- package/dist/cli-bundle/chunks/create-RTRFW6RE.js +30 -0
- package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js → delete-T6DJSUJI.js} +7 -7
- package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js → delete-XFUX533E.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js → deps-5GWMMS6D.js} +9 -10
- package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js.map → deps-5GWMMS6D.js.map} +2 -2
- package/dist/cli-bundle/chunks/{deps-HV2C2L46.js → deps-MCCU633S.js} +10 -11
- package/dist/cli-bundle/chunks/deps-MCCU633S.js.map +1 -0
- package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js → docs-HE3HCQ4S.js} +9 -9
- package/dist/cli-bundle/chunks/{docs-RJQPLROO.js → docs-SXMOABHR.js} +9 -9
- package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js → extension-E23K4QRR.js} +7 -5
- package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js → extension-PMD3XMLN.js} +7 -5
- package/dist/cli-bundle/chunks/{files-OIFN3DQX.js → files-2RSWGPEU.js} +25 -11
- package/dist/cli-bundle/chunks/files-2RSWGPEU.js.map +1 -0
- package/dist/cli-bundle/chunks/{files-LIFDKNCN.js → files-ZWFJFWBK.js} +24 -10
- package/dist/cli-bundle/chunks/files-ZWFJFWBK.js.map +7 -0
- package/dist/cli-bundle/chunks/focus-KTTB3P3F.js +106 -0
- package/dist/cli-bundle/chunks/focus-KTTB3P3F.js.map +1 -0
- package/dist/cli-bundle/chunks/focus-ZMDP4FEL.js +109 -0
- package/dist/cli-bundle/chunks/focus-ZMDP4FEL.js.map +7 -0
- package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js → gc-BXIAKLAH.js} +3 -3
- package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js → gc-C7K6JNUO.js} +3 -3
- package/dist/cli-bundle/chunks/{get-SAB7CRBG.js → get-AZQLC4NO.js} +43 -16
- package/dist/cli-bundle/chunks/get-AZQLC4NO.js.map +1 -0
- package/dist/cli-bundle/chunks/{get-K7UULTQF.js → get-I65HTAWO.js} +42 -15
- package/dist/cli-bundle/chunks/get-I65HTAWO.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-NUVZYIEV.js → health-3MFFPQVZ.js} +75 -49
- package/dist/cli-bundle/chunks/health-3MFFPQVZ.js.map +1 -0
- package/dist/cli-bundle/chunks/{health-VJWH3ZFK.js → health-MYZEOCLI.js} +74 -48
- package/dist/cli-bundle/chunks/health-MYZEOCLI.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-GYFD2DJW.js → history-73Z6OBFZ.js} +10 -10
- package/dist/cli-bundle/chunks/history-BIPHVUMF.js +20 -0
- package/dist/cli-bundle/chunks/{history-compact-WQZQ6KXM.js → history-compact-24VQ63A3.js} +37 -46
- package/dist/cli-bundle/chunks/history-compact-24VQ63A3.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-compact-SLL6ESXH.js → history-compact-UIAR2OI4.js} +38 -47
- package/dist/cli-bundle/chunks/history-compact-UIAR2OI4.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js → history-redact-7YCXEWJD.js} +13 -11
- package/dist/cli-bundle/chunks/history-redact-WZZ6GZ2Z.js +21 -0
- package/dist/cli-bundle/chunks/{history-repair-BJCGM6Q3.js → history-repair-4NOFFG2W.js} +44 -49
- package/dist/cli-bundle/chunks/history-repair-4NOFFG2W.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-repair-UCYS55ZX.js → history-repair-GQN2X4TR.js} +43 -48
- package/dist/cli-bundle/chunks/history-repair-GQN2X4TR.js.map +7 -0
- package/dist/cli-bundle/chunks/init-K34V4PZR.js +20 -0
- package/dist/cli-bundle/chunks/{init-MXV57LKL.js → init-TDEDNVMM.js} +12 -9
- package/dist/cli-bundle/chunks/{learnings-QKJOKEAO.js → learnings-TV2CTGJ3.js} +13 -12
- package/dist/cli-bundle/chunks/learnings-TV2CTGJ3.js.map +7 -0
- package/dist/cli-bundle/chunks/{learnings-L6KTZGOT.js → learnings-U67FTXPB.js} +14 -13
- package/dist/cli-bundle/chunks/learnings-U67FTXPB.js.map +1 -0
- package/dist/cli-bundle/chunks/list-MSHYOCFU.js +33 -0
- package/dist/cli-bundle/chunks/list-VV57WGUD.js +29 -0
- package/dist/cli-bundle/chunks/{notes-HMCB7TK6.js → notes-EUANWWKD.js} +13 -12
- package/dist/cli-bundle/chunks/notes-EUANWWKD.js.map +7 -0
- package/dist/cli-bundle/chunks/{notes-3NLK7WTZ.js → notes-GYVNDAL4.js} +14 -13
- package/dist/cli-bundle/chunks/notes-GYVNDAL4.js.map +1 -0
- package/dist/cli-bundle/chunks/{plan-NANUWH4T.js → plan-4LF4AV63.js} +15 -14
- package/dist/cli-bundle/chunks/plan-4LF4AV63.js.map +7 -0
- package/dist/cli-bundle/chunks/{plan-DWBYI5C6.js → plan-W27O6DBS.js} +16 -15
- package/dist/cli-bundle/chunks/plan-W27O6DBS.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-SMMMLSWW.js → register-list-query-BXLEHJ7L.js} +32 -23
- package/dist/cli-bundle/chunks/register-list-query-BXLEHJ7L.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-PWQ5F2VI.js → register-list-query-C2MS3BVQ.js} +31 -22
- package/dist/cli-bundle/chunks/register-list-query-C2MS3BVQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-QKFPTIZG.js → register-mutation-6UCOEQ6L.js} +361 -106
- package/dist/cli-bundle/chunks/register-mutation-6UCOEQ6L.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-ZYJQ4DVP.js → register-mutation-HE73PREP.js} +355 -107
- package/dist/cli-bundle/chunks/register-mutation-HE73PREP.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-2FMZ6WEF.js → register-operations-L6C32FDA.js} +111 -39
- package/dist/cli-bundle/chunks/register-operations-L6C32FDA.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-BAFQURZG.js → register-operations-QQEHEX4P.js} +112 -40
- package/dist/cli-bundle/chunks/register-operations-QQEHEX4P.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-QN2XV7UL.js → register-setup-A7N4PNT3.js} +18 -21
- package/dist/cli-bundle/chunks/register-setup-A7N4PNT3.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-DQEIKBIP.js → register-setup-WHG3NBP6.js} +17 -20
- package/dist/cli-bundle/chunks/register-setup-WHG3NBP6.js.map +7 -0
- package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js → restore-TSWSULYY.js} +13 -11
- package/dist/cli-bundle/chunks/restore-XQXICL3V.js +19 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-NC46K6BD.js +91 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-NC46K6BD.js.map +7 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-UGDPQALY.js +88 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-UGDPQALY.js.map +1 -0
- package/dist/cli-bundle/chunks/{schema-ZZ7ZDM2X.js → schema-7U7JUYGK.js} +797 -10
- package/dist/cli-bundle/chunks/schema-7U7JUYGK.js.map +1 -0
- package/dist/cli-bundle/chunks/{schema-RNVJ55V2.js → schema-TSBYSEMW.js} +810 -9
- package/dist/cli-bundle/chunks/schema-TSBYSEMW.js.map +7 -0
- package/dist/cli-bundle/chunks/{search-BJ457C2A.js → search-OXLSQKHP.js} +328 -71
- package/dist/cli-bundle/chunks/search-OXLSQKHP.js.map +7 -0
- package/dist/cli-bundle/chunks/{search-FQDZXX7P.js → search-T3TOFLOQ.js} +328 -71
- package/dist/cli-bundle/chunks/search-T3TOFLOQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{stats-DUQWCVOS.js → stats-5CLG22YZ.js} +41 -16
- package/dist/cli-bundle/chunks/stats-5CLG22YZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{stats-CUG3ZHOI.js → stats-XEMUXS42.js} +42 -17
- package/dist/cli-bundle/chunks/stats-XEMUXS42.js.map +1 -0
- package/dist/cli-bundle/chunks/{telemetry-RK2VX75A.js → telemetry-23OPBBZT.js} +7 -7
- package/dist/cli-bundle/chunks/telemetry-23OPBBZT.js.map +1 -0
- package/dist/cli-bundle/chunks/{telemetry-33MRGX4Z.js → telemetry-I3D7XZ55.js} +6 -6
- package/dist/cli-bundle/chunks/telemetry-I3D7XZ55.js.map +7 -0
- package/dist/cli-bundle/chunks/test-AROS3LIV.js +35 -0
- package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js → test-CECIMKOA.js} +17 -14
- package/dist/cli-bundle/chunks/{test-all-ARSMX33Q.js → test-all-4DEQPIXH.js} +25 -17
- package/dist/cli-bundle/chunks/test-all-4DEQPIXH.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-all-ANYQ33O2.js → test-all-6RO6X3SM.js} +24 -16
- package/dist/cli-bundle/chunks/test-all-6RO6X3SM.js.map +7 -0
- package/dist/cli-bundle/chunks/{test-runs-5URSD34O.js → test-runs-AAXVFWKH.js} +62 -65
- package/dist/cli-bundle/chunks/test-runs-AAXVFWKH.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-runs-XNACGSNQ.js → test-runs-LYBQSYRC.js} +61 -64
- package/dist/cli-bundle/chunks/test-runs-LYBQSYRC.js.map +7 -0
- package/dist/cli-bundle/chunks/update-MIWEJC76.js +24 -0
- package/dist/cli-bundle/chunks/update-P7I5YSRB.js +28 -0
- package/dist/cli-bundle/chunks/{update-many-724JCVDE.js → update-many-5B4HLVBK.js} +79 -33
- package/dist/cli-bundle/chunks/update-many-5B4HLVBK.js.map +7 -0
- package/dist/cli-bundle/chunks/{update-many-6B7PJ33I.js → update-many-G2QOVZSB.js} +80 -34
- package/dist/cli-bundle/chunks/update-many-G2QOVZSB.js.map +1 -0
- package/dist/cli-bundle/chunks/{upgrade-QHRGDBSA.js → upgrade-GFIDL62L.js} +23 -9
- package/dist/cli-bundle/chunks/upgrade-GFIDL62L.js.map +1 -0
- package/dist/cli-bundle/chunks/{upgrade-ALBEZAI7.js → upgrade-QUQYL7D3.js} +22 -8
- package/dist/cli-bundle/chunks/upgrade-QUQYL7D3.js.map +7 -0
- package/dist/cli-bundle/chunks/{validate-UY6DRCG5.js → validate-ADDZBMM3.js} +236 -30
- package/dist/cli-bundle/chunks/validate-ADDZBMM3.js.map +7 -0
- package/dist/cli-bundle/chunks/{validate-IQRYFXIV.js → validate-MAS3H6ZP.js} +222 -30
- package/dist/cli-bundle/chunks/validate-MAS3H6ZP.js.map +1 -0
- package/dist/cli-bundle/main.js +312 -139
- 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/config/nested-settings.js +40 -2
- package/dist/core/config/nested-settings.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-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 +41 -0
- package/dist/core/item/parse.js +69 -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/fields-file.d.ts +94 -0
- package/dist/core/schema/fields-file.js +317 -0
- package/dist/core/schema/fields-file.js.map +1 -0
- 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/schema/type-inference.d.ts +34 -0
- package/dist/core/schema/type-inference.js +97 -0
- package/dist/core/schema/type-inference.js.map +1 -0
- package/dist/core/schema/type-presets.d.ts +30 -0
- package/dist/core/schema/type-presets.js +96 -0
- package/dist/core/schema/type-presets.js.map +1 -0
- 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/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/front-matter-cache.d.ts +13 -0
- package/dist/core/store/front-matter-cache.js +21 -11
- package/dist/core/store/front-matter-cache.js.map +1 -1
- package/dist/core/store/item-store.d.ts +11 -0
- package/dist/core/store/item-store.js +12 -3
- 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 +61 -0
- package/dist/mcp/server.js +98 -8
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +64 -10
- 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 +7 -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 +127 -11
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +31 -0
- package/dist/sdk/cli-contracts.js +238 -12
- 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 +171 -10
- package/docs/CONFIGURATION.md +135 -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 +3 -3
- 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-XIOTGZMU.js +0 -16
- package/dist/cli-bundle/chunks/aggregate-IRHJWEKG.js.map +0 -1
- package/dist/cli-bundle/chunks/aggregate-XEBW22UQ.js.map +0 -7
- package/dist/cli-bundle/chunks/append-NL67JNJU.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-2ANTZBYF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-2J2AH4V5.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-32XSW44C.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-36BCSMKP.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-3VULHQNS.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-4FHLNNW7.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4JHJ7YG2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-4TPFXE2R.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-4ZKKZMLH.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-5HSAHRYA.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6TBR5AZ2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-7CRFV6JR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-7SM7VA5I.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-AAUYXSFF.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-AGG32LKL.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-AUDDXKNX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-BVL5KGVA.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-C24PWDFG.js +0 -138
- package/dist/cli-bundle/chunks/chunk-C24PWDFG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HLEGAQXT.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HZOX5BYD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-IXVSSHGV.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-IZHCCG4S.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JW7D6437.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JWXTOYBI.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-KHGTYCJ6.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-L6YQONLM.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-LFW5NQUP.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-LYNQ3NGI.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-M3SI2REU.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MACCNKSZ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-MGAQ6KZG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-PEH7SZD2.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-PNYAAB4S.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-QQG4HEX7.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-R4VWYWRN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RFR2YQGO.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-RHYBR6G7.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-S2CDTRJ6.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SGMGMCIF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SOHXUA2Q.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SQDKAEKG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-TOX7YQ7X.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-TSXWFN3L.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UCVJP4JL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-V4KP3TCN.js +0 -128
- package/dist/cli-bundle/chunks/chunk-V4KP3TCN.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-VNC2HBL4.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-W6KNFAMZ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-WLH7X4RN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-XXLMJDUB.js.map +0 -7
- package/dist/cli-bundle/chunks/close-WOG5WTMZ.js +0 -13
- package/dist/cli-bundle/chunks/close-many-GKAJX54X.js.map +0 -1
- package/dist/cli-bundle/chunks/close-many-GL6NRUU5.js.map +0 -7
- package/dist/cli-bundle/chunks/comments-5FPT6L7N.js.map +0 -1
- package/dist/cli-bundle/chunks/comments-TOLOYWNI.js.map +0 -7
- package/dist/cli-bundle/chunks/config-4MN45TIH.js.map +0 -1
- package/dist/cli-bundle/chunks/config-7N6D7YJE.js.map +0 -7
- package/dist/cli-bundle/chunks/context-AQSLE7DZ.js.map +0 -1
- package/dist/cli-bundle/chunks/context-U3PUJMVN.js.map +0 -7
- package/dist/cli-bundle/chunks/contracts-H7KCQXLY.js.map +0 -7
- package/dist/cli-bundle/chunks/contracts-ITSJXO3O.js.map +0 -1
- package/dist/cli-bundle/chunks/create-NW3K7LVG.js +0 -27
- package/dist/cli-bundle/chunks/deps-HV2C2L46.js.map +0 -1
- package/dist/cli-bundle/chunks/files-LIFDKNCN.js.map +0 -7
- package/dist/cli-bundle/chunks/files-OIFN3DQX.js.map +0 -1
- package/dist/cli-bundle/chunks/get-K7UULTQF.js.map +0 -7
- package/dist/cli-bundle/chunks/get-SAB7CRBG.js.map +0 -1
- package/dist/cli-bundle/chunks/health-NUVZYIEV.js.map +0 -1
- package/dist/cli-bundle/chunks/health-VJWH3ZFK.js.map +0 -7
- package/dist/cli-bundle/chunks/history-IUVN4NTN.js +0 -20
- package/dist/cli-bundle/chunks/history-compact-SLL6ESXH.js.map +0 -1
- package/dist/cli-bundle/chunks/history-compact-WQZQ6KXM.js.map +0 -7
- package/dist/cli-bundle/chunks/history-redact-75KIIJUJ.js +0 -19
- package/dist/cli-bundle/chunks/history-repair-BJCGM6Q3.js.map +0 -1
- package/dist/cli-bundle/chunks/history-repair-UCYS55ZX.js.map +0 -7
- package/dist/cli-bundle/chunks/init-JJFYRUKG.js +0 -17
- package/dist/cli-bundle/chunks/learnings-L6KTZGOT.js.map +0 -1
- package/dist/cli-bundle/chunks/learnings-QKJOKEAO.js.map +0 -7
- package/dist/cli-bundle/chunks/list-GGVPXEV6.js +0 -23
- package/dist/cli-bundle/chunks/list-VOQDQHA4.js +0 -19
- package/dist/cli-bundle/chunks/notes-3NLK7WTZ.js.map +0 -1
- package/dist/cli-bundle/chunks/notes-HMCB7TK6.js.map +0 -7
- package/dist/cli-bundle/chunks/plan-DWBYI5C6.js.map +0 -1
- package/dist/cli-bundle/chunks/plan-NANUWH4T.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-PWQ5F2VI.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-SMMMLSWW.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-QKFPTIZG.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-ZYJQ4DVP.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-2FMZ6WEF.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-BAFQURZG.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-DQEIKBIP.js.map +0 -7
- package/dist/cli-bundle/chunks/register-setup-QN2XV7UL.js.map +0 -1
- package/dist/cli-bundle/chunks/restore-DRBNXJJH.js +0 -17
- package/dist/cli-bundle/chunks/schema-RNVJ55V2.js.map +0 -7
- package/dist/cli-bundle/chunks/schema-ZZ7ZDM2X.js.map +0 -1
- package/dist/cli-bundle/chunks/search-BJ457C2A.js.map +0 -7
- package/dist/cli-bundle/chunks/search-FQDZXX7P.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-CUG3ZHOI.js.map +0 -1
- package/dist/cli-bundle/chunks/stats-DUQWCVOS.js.map +0 -7
- package/dist/cli-bundle/chunks/telemetry-33MRGX4Z.js.map +0 -7
- package/dist/cli-bundle/chunks/telemetry-RK2VX75A.js.map +0 -1
- package/dist/cli-bundle/chunks/test-SDMYEQHH.js +0 -32
- package/dist/cli-bundle/chunks/test-all-ANYQ33O2.js.map +0 -7
- package/dist/cli-bundle/chunks/test-all-ARSMX33Q.js.map +0 -1
- package/dist/cli-bundle/chunks/test-runs-5URSD34O.js.map +0 -1
- package/dist/cli-bundle/chunks/test-runs-XNACGSNQ.js.map +0 -7
- package/dist/cli-bundle/chunks/update-PD46VOXI.js +0 -21
- package/dist/cli-bundle/chunks/update-U235A7WP.js +0 -25
- package/dist/cli-bundle/chunks/update-many-6B7PJ33I.js.map +0 -1
- package/dist/cli-bundle/chunks/update-many-724JCVDE.js.map +0 -7
- package/dist/cli-bundle/chunks/upgrade-ALBEZAI7.js.map +0 -7
- package/dist/cli-bundle/chunks/upgrade-QHRGDBSA.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-IQRYFXIV.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-UY6DRCG5.js.map +0 -7
- /package/dist/cli-bundle/chunks/{activity-XIOTGZMU.js.map → activity-PZYSZA26.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js.map → activity-SFM4THAU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js.map → chunk-26BM6YLO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js.map → chunk-2TMKMTEI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js.map → chunk-2VH7DFSJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js.map → chunk-5XGWFUW2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js.map → chunk-AJCQ5GT6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js.map → chunk-BITCVGHT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js.map → chunk-CGQTFWYI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js.map → chunk-COVLE33A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js.map → chunk-F5MSD5HE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js.map → chunk-JZHL4E3Q.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js.map → chunk-KCAGIH6K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js.map → chunk-MIBX6ZRN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js.map → chunk-UN6P3IJ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HWHONML5.js.map → chunk-VF3KQGNY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js.map → claim-WGAWJCPY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js.map → claim-ZI6P4LMU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-WOG5WTMZ.js.map → close-I7PRQ5G7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-SPUFW5QR.js.map → close-JMVVSIQE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js.map → copy-Q2PPU4AY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-C4W522JM.js.map → copy-SC6UF3PI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-4EQNELMY.js.map → create-76FE7JVF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-NW3K7LVG.js.map → create-RTRFW6RE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js.map → delete-T6DJSUJI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js.map → delete-XFUX533E.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js.map → docs-HE3HCQ4S.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-RJQPLROO.js.map → docs-SXMOABHR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js.map → extension-E23K4QRR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js.map → extension-PMD3XMLN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js.map → gc-BXIAKLAH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js.map → gc-C7K6JNUO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-GYFD2DJW.js.map → history-73Z6OBFZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-IUVN4NTN.js.map → history-BIPHVUMF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js.map → history-redact-7YCXEWJD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-75KIIJUJ.js.map → history-redact-WZZ6GZ2Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-JJFYRUKG.js.map → init-K34V4PZR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-MXV57LKL.js.map → init-TDEDNVMM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-GGVPXEV6.js.map → list-MSHYOCFU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-VOQDQHA4.js.map → list-VV57WGUD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js.map → restore-TSWSULYY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-DRBNXJJH.js.map → restore-XQXICL3V.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-SDMYEQHH.js.map → test-AROS3LIV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js.map → test-CECIMKOA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-PD46VOXI.js.map → update-MIWEJC76.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-U235A7WP.js.map → update-P7I5YSRB.js.map} +0 -0
package/dist/core/lock/lock.js
CHANGED
|
@@ -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]="1a8d523b-e42a-54c0-98b8-2cf802a795ef")}catch(e){}}();
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { runActiveOnReadHooks, runActiveOnWriteHooks, runActiveServiceOverride } from "../extensions/index.js";
|
|
@@ -134,6 +134,14 @@ async function handleExistingLock(lockPath, id, ttlSeconds, force, forceRequired
|
|
|
134
134
|
}
|
|
135
135
|
await unlinkLockWithHook(lockPath, "lock:stale_remove");
|
|
136
136
|
}
|
|
137
|
+
export const _testOnly = {
|
|
138
|
+
parseLockInfo,
|
|
139
|
+
readLockInfo,
|
|
140
|
+
isErrno,
|
|
141
|
+
buildLockPayload,
|
|
142
|
+
isStaleLock,
|
|
143
|
+
lockOwnerSuffix,
|
|
144
|
+
};
|
|
137
145
|
export async function acquireLock(pmRoot, id, ttlSeconds, owner, force = false, forceRequiredForStaleLock = true) {
|
|
138
146
|
const lockOverride = await runActiveServiceOverride("lock_acquire", {
|
|
139
147
|
pm_root: pmRoot,
|
|
@@ -186,4 +194,4 @@ export async function acquireLock(pmRoot, id, ttlSeconds, owner, force = false,
|
|
|
186
194
|
throw new PmCliError(`Failed to acquire lock for ${id}`, EXIT_CODE.CONFLICT);
|
|
187
195
|
}
|
|
188
196
|
//# sourceMappingURL=lock.js.map
|
|
189
|
-
//# debugId=
|
|
197
|
+
//# debugId=1a8d523b-e42a-54c0-98b8-2cf802a795ef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.js","sources":["core/lock/lock.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runActiveOnReadHooks, runActiveOnWriteHooks, runActiveServiceOverride } from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { getLockPath } from \"../store/paths.js\";\nimport { nowIso } from \"../shared/time.js\";\n\ninterface LockInfo {\n id: string;\n pid: number;\n owner: string;\n created_at: string;\n ttl_seconds: number;\n}\n\ntype LockWriteOp = \"lock:create\" | \"lock:release\" | \"lock:stale_remove\";\n\ninterface LockReadResult {\n info: LockInfo | null;\n warnings: string[];\n}\n\nfunction parseLockInfo(raw: string): LockReadResult {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n return {\n info: null,\n warnings: [\"lock_info_invalid_json\"],\n };\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return {\n info: null,\n warnings: [\"lock_info_invalid_shape\"],\n };\n }\n const candidate = parsed as Record<string, unknown>;\n const id = candidate.id;\n const pid = candidate.pid;\n const owner = candidate.owner;\n const createdAt = candidate.created_at;\n const ttlSeconds = candidate.ttl_seconds;\n if (\n typeof id !== \"string\" ||\n typeof pid !== \"number\" ||\n !Number.isFinite(pid) ||\n typeof owner !== \"string\" ||\n typeof createdAt !== \"string\" ||\n typeof ttlSeconds !== \"number\" ||\n !Number.isFinite(ttlSeconds)\n ) {\n return {\n info: null,\n warnings: [\"lock_info_invalid_shape\"],\n };\n }\n return {\n info: {\n id,\n pid,\n owner,\n created_at: createdAt,\n ttl_seconds: ttlSeconds,\n },\n warnings: [],\n };\n}\n\nasync function readLockInfo(lockPath: string): Promise<LockReadResult> {\n try {\n const raw = await fs.readFile(lockPath, \"utf8\");\n await runActiveOnReadHooks({\n path: lockPath,\n scope: \"project\",\n });\n return parseLockInfo(raw);\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return {\n info: null,\n warnings: [],\n };\n }\n return {\n info: null,\n warnings: [\"lock_info_read_failed\"],\n };\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n\nasync function emitLockWriteHook(lockPath: string, op: LockWriteOp): Promise<void> {\n await runActiveOnWriteHooks({\n path: lockPath,\n scope: \"project\",\n op,\n });\n}\n\nfunction buildLockPayload(id: string, owner: string, ttlSeconds: number): LockInfo {\n return {\n id,\n pid: process.pid,\n owner,\n created_at: nowIso(),\n ttl_seconds: ttlSeconds,\n };\n}\n\nasync function createLockFile(lockPath: string, id: string, owner: string, ttlSeconds: number): Promise<void> {\n await fs.mkdir(path.dirname(lockPath), { recursive: true });\n const handle = await fs.open(lockPath, \"wx\");\n try {\n await handle.writeFile(`${JSON.stringify(buildLockPayload(id, owner, ttlSeconds), null, 2)}\\n`, \"utf8\");\n } finally {\n await handle.close();\n }\n await emitLockWriteHook(lockPath, \"lock:create\");\n}\n\nasync function unlinkLockWithHook(lockPath: string, op: \"lock:release\" | \"lock:stale_remove\"): Promise<void> {\n try {\n await fs.unlink(lockPath);\n await emitLockWriteHook(lockPath, op);\n } catch {\n // Lock cleanup is best-effort.\n }\n}\n\nfunction isStaleLock(info: LockInfo | null, ttlSeconds: number): boolean {\n const createdAtMs = info?.created_at ? Date.parse(info.created_at) : Number.NaN;\n const ageMs = Number.isFinite(createdAtMs) ? Date.now() - createdAtMs : Number.POSITIVE_INFINITY;\n return ageMs > ttlSeconds * 1000;\n}\n\nfunction lockOwnerSuffix(info: LockInfo | null): string {\n return info?.owner ? ` (owner ${info.owner})` : \"\";\n}\n\nasync function handleExistingLock(\n lockPath: string,\n id: string,\n ttlSeconds: number,\n force: boolean,\n forceRequiredForStaleLock: boolean,\n): Promise<void> {\n const lockInfo = await readLockInfo(lockPath);\n if (!isStaleLock(lockInfo.info, ttlSeconds)) {\n throw new PmCliError(`Item ${id} is locked${lockOwnerSuffix(lockInfo.info)}`, EXIT_CODE.CONFLICT);\n }\n\n if (!force && forceRequiredForStaleLock) {\n const warningSuffix = lockInfo.warnings.length > 0 ? ` (${lockInfo.warnings.join(\",\")})` : \"\";\n throw new PmCliError(\n `Item ${id} lock is stale${warningSuffix}; rerun with --force when supported for this command`,\n EXIT_CODE.CONFLICT,\n );\n }\n\n await unlinkLockWithHook(lockPath, \"lock:stale_remove\");\n}\n\n\nexport async function acquireLock(\n pmRoot: string,\n id: string,\n ttlSeconds: number,\n owner: string,\n force = false,\n forceRequiredForStaleLock = true,\n): Promise<() => Promise<void>> {\n const lockOverride = await runActiveServiceOverride(\"lock_acquire\", {\n pm_root: pmRoot,\n id,\n ttl_seconds: ttlSeconds,\n owner,\n force,\n force_required_for_stale_lock: forceRequiredForStaleLock,\n });\n if (lockOverride.handled) {\n const releaseFromFunction = typeof lockOverride.result === \"function\" ? lockOverride.result : null;\n const releaseFromObject =\n typeof lockOverride.result === \"object\" &&\n lockOverride.result !== null &&\n \"release\" in lockOverride.result &&\n typeof (lockOverride.result as { release?: unknown }).release === \"function\"\n ? ((lockOverride.result as { release: () => Promise<void> | void }).release as () => Promise<void> | void)\n : null;\n const release = releaseFromFunction ?? releaseFromObject;\n if (release) {\n return async () => {\n await Promise.resolve(release());\n await runActiveServiceOverride(\"lock_release\", {\n pm_root: pmRoot,\n id,\n owner,\n });\n };\n }\n }\n\n const lockPath = getLockPath(pmRoot, id);\n\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n await createLockFile(lockPath, id, owner, ttlSeconds);\n return async () => {\n await unlinkLockWithHook(lockPath, \"lock:release\");\n await runActiveServiceOverride(\"lock_release\", {\n pm_root: pmRoot,\n id,\n owner,\n });\n };\n } catch (error: unknown) {\n if (!isErrno(error, \"EEXIST\")) {\n throw new PmCliError(`Failed to acquire lock for ${id}: ${toErrorMessage(error)}`, EXIT_CODE.GENERIC_FAILURE);\n }\n await handleExistingLock(lockPath, id, ttlSeconds, force, forceRequiredForStaleLock);\n }\n }\n\n throw new PmCliError(`Failed to acquire lock for ${id}`, EXIT_CODE.CONFLICT);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAiB3C,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,CAAC,wBAAwB,CAAC;SACrC,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,OAAO;YACL,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,CAAC,yBAAyB,CAAC;SACtC,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAiC,CAAC;IACpD,MAAM,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;IAC1B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IAC9B,MAAM,SAAS,GAAG,SAAS,CA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AE;oBAC7C,OAAO,EAAE,MAAM;oBACf,EAAE;oBACF,KAAK;iBACN,CAAC,CAAC;YACL,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEzC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC;YACH,MAAM,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;YACtD,OAAO,KAAK,IAAI,EAAE;gBAChB,MAAM,kBAAkB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBACnD,MAAM,wBAAwB,CAAC,cAAc,EAAE;oBAC7C,OAAO,EAAE,MAAM;oBACf,EAAE;oBACF,KAAK;iBACN,CAAC,CAAC;YACL,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,UAAU,CAAC,8BAA8B,EAAE,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;YAChH,CAAC;YACD,MAAM,kBAAkB,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED,MAAM,IAAI,UAAU,CAAC,8BAA8B,EAAE,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC","debugId":"5747034b-5b93-59ff-8764-7594ff8c0617"}
|
|
1
|
+
{"version":3,"file":"lock.js","sources":["core/lock/lock.ts"],"sourceRoot":"/","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runActiveOnReadHooks, runActiveOnWriteHooks, runActiveServiceOverride } from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { getLockPath } from \"../store/paths.js\";\nimport { nowIso } from \"../shared/time.js\";\n\ninterface LockInfo {\n id: string;\n pid: number;\n owner: string;\n created_at: string;\n ttl_seconds: number;\n}\n\ntype LockWriteOp = \"lock:create\" | \"lock:release\" | \"lock:stale_remove\";\n\ninterface LockReadResult {\n info: LockInfo | null;\n warnings: string[];\n}\n\nfunction parseLockInfo(raw: string): LockReadResult {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n return {\n info: null,\n warnings: [\"lock_info_invalid_json\"],\n };\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return {\n info: null,\n warnings: [\"lock_info_invalid_shape\"],\n };\n }\n const candidate = parsed as Record<string, unknown>;\n const id = candidate.id;\n const pid = candidate.pid;\n const owner = candidate.owner;\n const createdAt = candidate.created_at;\n const ttlSeconds = candidate.ttl_seconds;\n if (\n typeof id !== \"string\" ||\n typeof pid !== \"number\" ||\n !Number.isFinite(pid) ||\n typeof owner !== \"string\" ||\n typeof createdAt !== \"string\" ||\n typeof ttlSeconds !== \"number\" ||\n !Number.isFinite(ttlSeconds)\n ) {\n return {\n info: null,\n warnings: [\"lock_info_invalid_shape\"],\n };\n }\n return {\n info: {\n id,\n pid,\n owner,\n created_at: createdAt,\n ttl_seconds: ttlSeconds,\n },\n warnings: [],\n };\n}\n\nasync function readLockInfo(lockPath: string): Promise<LockReadResult> {\n try {\n const raw = await fs.readFile(lockPath, \"utf8\");\n await runActiveOnReadHooks({\n path: lockPath,\n scope: \"project\",\n });\n return parseLockInfo(raw);\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return {\n info: null,\n warnings: [],\n };\n }\n return {\n info: null,\n warnings: [\"lock_info_read_failed\"],\n };\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n\nasync function emitLockWriteHook(lockPath: string, op: LockWriteOp): Promise<void> {\n await runActiveOnWriteHooks({\n path: lockPath,\n scope: \"project\",\n op,\n });\n}\n\nfunction buildLockPayload(id: string, owner: string, ttlSeconds: number): LockInfo {\n return {\n id,\n pid: process.pid,\n owner,\n created_at: nowIso(),\n ttl_seconds: ttlSeconds,\n };\n}\n\nasync function createLockFile(lockPath: string, id: string, owner: string, ttlSeconds: number): Promise<void> {\n await fs.mkdir(path.dirname(lockPath), { recursive: true });\n const handle = await fs.open(lockPath, \"wx\");\n try {\n await handle.writeFile(`${JSON.stringify(buildLockPayload(id, owner, ttlSeconds), null, 2)}\\n`, \"utf8\");\n } finally {\n await handle.close();\n }\n await emitLockWriteHook(lockPath, \"lock:create\");\n}\n\nasync function unlinkLockWithHook(lockPath: string, op: \"lock:release\" | \"lock:stale_remove\"): Promise<void> {\n try {\n await fs.unlink(lockPath);\n await emitLockWriteHook(lockPath, op);\n } catch {\n // Lock cleanup is best-effort.\n }\n}\n\nfunction isStaleLock(info: LockInfo | null, ttlSeconds: number): boolean {\n const createdAtMs = info?.created_at ? Date.parse(info.created_at) : Number.NaN;\n const ageMs = Number.isFinite(createdAtMs) ? Date.now() - createdAtMs : Number.POSITIVE_INFINITY;\n return ageMs > ttlSeconds * 1000;\n}\n\nfunction lockOwnerSuffix(info: LockInfo | null): string {\n return info?.owner ? ` (owner ${info.owner})` : \"\";\n}\n\nasync function handleExistingLock(\n lockPath: string,\n id: string,\n ttlSeconds: number,\n force: boolean,\n forceRequiredForStaleLock: boolean,\n): Promise<void> {\n const lockInfo = await readLockInfo(lockPath);\n if (!isStaleLock(lockInfo.info, ttlSeconds)) {\n throw new PmCliError(`Item ${id} is locked${lockOwnerSuffix(lockInfo.info)}`, EXIT_CODE.CONFLICT);\n }\n\n if (!force && forceRequiredForStaleLock) {\n const warningSuffix = lockInfo.warnings.length > 0 ? ` (${lockInfo.warnings.join(\",\")})` : \"\";\n throw new PmCliError(\n `Item ${id} lock is stale${warningSuffix}; rerun with --force when supported for this command`,\n EXIT_CODE.CONFLICT,\n );\n }\n\n await unlinkLockWithHook(lockPath, \"lock:stale_remove\");\n}\n\nexport const _testOnly = {\n parseLockInfo,\n readLockInfo,\n isErrno,\n buildLockPayload,\n isStaleLock,\n lockOwnerSuffix,\n};\n\n\nexport async function acquireLock(\n pmRoot: string,\n id: string,\n ttlSeconds: number,\n owner: string,\n force = false,\n forceRequiredForStaleLock = true,\n): Promise<() => Promise<void>> {\n const lockOverride = await runActiveServiceOverride(\"lock_acquire\", {\n pm_root: pmRoot,\n id,\n ttl_seconds: ttlSeconds,\n owner,\n force,\n force_required_for_stale_lock: forceRequiredForStaleLock,\n });\n if (lockOverride.handled) {\n const releaseFromFunction = typeof lockOverride.result === \"function\" ? lockOverride.result : null;\n const releaseFromObject =\n typeof lockOverride.result === \"object\" &&\n lockOverride.result !== null &&\n \"release\" in lockOverride.result &&\n typeof (lockOverride.result as { release?: unknown }).release === \"function\"\n ? ((lockOverride.result as { release: () => Promise<void> | void }).release as () => Promise<void> | void)\n : null;\n const release = releaseFromFunction ?? releaseFromObject;\n if (release) {\n return async () => {\n await Promise.resolve(release());\n await runActiveServiceOverride(\"lock_release\", {\n pm_root: pmRoot,\n id,\n owner,\n });\n };\n }\n }\n\n const lockPath = getLockPath(pmRoot, id);\n\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n await createLockFile(lockPath, id, owner, ttlSeconds);\n return async () => {\n await unlinkLockWithHook(lockPath, \"lock:release\");\n await runActiveServiceOverride(\"lock_release\", {\n pm_root: pmRoot,\n id,\n owner,\n });\n };\n } catch (error: unknown) {\n if (!isErrno(error, \"EEXIST\")) {\n throw new PmCliError(`Failed to acquire lock for ${id}: ${toErrorMessage(error)}`, EXIT_CODE.GENERIC_FAILURE);\n }\n await handleExistingLock(lockPath, id, ttlSeconds, force, forceRequiredForStaleL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eStdout(text: string): boolean;
|
|
15
15
|
export declare function writeStderr(text: string): boolean;
|
|
16
|
+
declare function compactToonValue(value: unknown): unknown | undefined;
|
|
17
|
+
declare function renderToonValue(value: unknown, depth: number): string;
|
|
16
18
|
export declare function formatOutput(result: unknown, options: OutputOptions): string;
|
|
17
19
|
export declare function printResult(result: unknown, options: OutputOptions): void;
|
|
18
20
|
export declare function printError(message: string): void;
|
|
21
|
+
export declare const outputTestOnly: {
|
|
22
|
+
compactToonValue: typeof compactToonValue;
|
|
23
|
+
renderToonValue: typeof renderToonValue;
|
|
24
|
+
};
|
|
25
|
+
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]="e5956170-7139-58b6-9ebd-aa59d7392925")}catch(e){}}();
|
|
3
3
|
import { runActiveCommandOverride, runActiveRendererOverride, runActiveServiceOverrideSync, setActiveCommandResult, } from "../extensions/index.js";
|
|
4
4
|
import { EXIT_CODE } from "../shared/constants.js";
|
|
5
5
|
import { projectMutationResult } from "./mutation-projection.js";
|
|
@@ -252,5 +252,9 @@ export function printError(message) {
|
|
|
252
252
|
const rendered = override.handled && typeof override.result === "string" ? override.result : message;
|
|
253
253
|
writeStderr(rendered.endsWith("\n") ? rendered : `${rendered}\n`);
|
|
254
254
|
}
|
|
255
|
+
export const outputTestOnly = {
|
|
256
|
+
compactToonValue,
|
|
257
|
+
renderToonValue,
|
|
258
|
+
};
|
|
255
259
|
//# sourceMappingURL=output.js.map
|
|
256
|
-
//# debugId=
|
|
260
|
+
//# debugId=e5956170-7139-58b6-9ebd-aa59d7392925
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sources":["core/output/output.ts"],"sourceRoot":"/","sourcesContent":["import {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\nexport interface OutputOptions {\n json?: boolean;\n quiet?: boolean;\n /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n /** When true, single-item mutation results print only id and status. */\n idOnly?: boolean;\n defaultOutputFormat?: \"toon\" | \"json\";\n command?: string;\n commandArgs?: string[];\n commandOptions?: Record<string, unknown>;\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nconst NATIVE_OUTPUT_MARKER = \"__pm_native_output\";\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction shouldUseNativeOutput(result: unknown): boolean {\n return isPlainObject(result) && result[NATIVE_OUTPUT_MARKER] === true;\n}\n\nfunction stripNativeOutputMarker<T>(result: T): T {\n if (!isPlainObject(result) || result[NATIVE_OUTPUT_MARKER] !== true) {\n return result;\n }\n const { [NATIVE_OUTPUT_MARKER]: _marker, ...rest } = result;\n return rest as T;\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && (error as NodeLikeError).code === \"EPIPE\";\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (typeof value.view !== \"string\" || !Array.isArray(value.events) || !Array.isArray(value.days)) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText = typeof event.reminder_text === \"string\" && event.reminder_text.length > 0 ? ` ${event.reminder_text}` : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const nativeOutput = shouldUseNativeOutput(commandOverride.result);\n const effectiveResult = stripNativeOutputMarker(commandOverride.result);\n setActiveCommandResult(effectiveResult);\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = nativeOutput ? { handled: false, result: effectiveResult } : runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\") ? serviceOverride.result : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled ? serviceOverride.result : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = nativeOutput ? { rendered: null } : runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\") ? rendererOverride.rendered : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.idOnly\n ? projectMutationResult(result, { idOnly: true })\n : options.noChangedFields\n ? projectMutationResult(result, { changedFields: \"compact\" })\n : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered = override.handled && typeof override.result === \"string\" ? override.result : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAoBjE,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAGzC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAe;IAC5C,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAAI,MAAS;IAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,oBAAoB,CAAC,KAAK,IAAI,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,EAAE,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAC5D,OAAO,IAAS,CAAC;AACn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AC,MAAe,EAAE,OAAsB;IACjE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM;QAC9B,CAAC,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjD,CAAC,CAAC,OAAO,CAAC,eAAe;YACvB,CAAC,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;YAC7D,CAAC,CAAC,MAAM,CAAC;IACb,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,WAAW,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,QAAQ,GAAG,4BAA4B,CAAC,cAAc,EAAE;QAC5D,OAAO;KACR,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACrG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC;AACpE,CAAC","debugId":"e5eeb823-9fe2-5c10-93b8-1d2ab95a411c"}
|
|
1
|
+
{"version":3,"file":"output.js","sources":["core/output/output.ts"],"sourceRoot":"/","sourcesContent":["import {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\nexport interface OutputOptions {\n json?: boolean;\n quiet?: boolean;\n /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n /** When true, single-item mutation results print only id and status. */\n idOnly?: boolean;\n defaultOutputFormat?: \"toon\" | \"json\";\n command?: string;\n commandArgs?: string[];\n commandOptions?: Record<string, unknown>;\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nconst NATIVE_OUTPUT_MARKER = \"__pm_native_output\";\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction shouldUseNativeOutput(result: unknown): boolean {\n return isPlainObject(result) && result[NATIVE_OUTPUT_MARKER] === true;\n}\n\nfunction stripNativeOutputMarker<T>(result: T): T {\n if (!isPlainObject(result) || result[NATIVE_OUTPUT_MARKER] !== true) {\n return result;\n }\n const { [NATIVE_OUTPUT_MARKER]: _marker, ...rest } = result;\n return rest as T;\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && (error as NodeLikeError).code === \"EPIPE\";\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (typeof value.view !== \"string\" || !Array.isArray(value.events) || !Array.isArray(value.days)) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText = typeof event.reminder_text === \"string\" && event.reminder_text.length > 0 ? ` ${event.reminder_text}` : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const nativeOutput = shouldUseNativeOutput(commandOverride.result);\n const effectiveResult = stripNativeOutputMarker(commandOverride.result);\n setActiveCommandResult(effectiveResult);\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = nativeOutput ? { handled: false, result: effectiveResult } : runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\") ? serviceOverride.result : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled ? serviceOverride.result : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = nativeOutput ? { rendered: null } : runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\") ? rendererOverride.rendered : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.idOnly\n ? projectMutationResult(result, { idOnly: true })\n : options.noChangedFields\n ? projectMutationResult(result, { changedFields: \"compact\" })\n : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered = override.handled && typeof override.result === \"string\" ? override.result : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n\nexport const outputTestOnly = {\n compactToonValue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EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,WAAW,CAAC,QAAQ,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,QAAQ,GAAG,4BAA4B,CAAC,cAAc,EAAE;QAC5D,OAAO;KACR,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACrG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB;IAChB,eAAe;CAChB,CAAC","debugId":"e5956170-7139-58b6-9ebd-aa59d7392925"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { RuntimeFieldCommand, RuntimeFieldDefinition, RuntimeFieldType } from "../../types/index.js";
|
|
2
|
+
export type { RuntimeFieldCommand, RuntimeFieldDefinition, RuntimeFieldType } from "../../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Built-in front-matter field names a custom field key must never shadow. A
|
|
5
|
+
* custom key that collides with one of these would let `pm create --<key>` write
|
|
6
|
+
* over reserved metadata, so add-field rejects them up front (symmetric with the
|
|
7
|
+
* built-in-type guard in item-types-file.ts).
|
|
8
|
+
*/
|
|
9
|
+
export declare const BUILTIN_FIELD_KEYS: ReadonlySet<string>;
|
|
10
|
+
/**
|
|
11
|
+
* The shape persisted at `.agents/pm/schema/fields.json`.
|
|
12
|
+
*/
|
|
13
|
+
export interface FieldsFile {
|
|
14
|
+
fields: RuntimeFieldDefinition[];
|
|
15
|
+
}
|
|
16
|
+
export interface RawAddFieldInput {
|
|
17
|
+
key: string | undefined;
|
|
18
|
+
type?: string;
|
|
19
|
+
commands?: string[];
|
|
20
|
+
description?: string;
|
|
21
|
+
cliFlag?: string;
|
|
22
|
+
aliases?: string[];
|
|
23
|
+
required?: boolean;
|
|
24
|
+
requiredOnCreate?: boolean;
|
|
25
|
+
allowUnset?: boolean;
|
|
26
|
+
requiredTypes?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface NormalizedAddFieldInput {
|
|
29
|
+
key: string;
|
|
30
|
+
type: RuntimeFieldType;
|
|
31
|
+
commands: RuntimeFieldCommand[];
|
|
32
|
+
description?: string;
|
|
33
|
+
cliFlag?: string;
|
|
34
|
+
cliAliases: string[];
|
|
35
|
+
required: boolean;
|
|
36
|
+
requiredOnCreate: boolean;
|
|
37
|
+
allowUnset: boolean;
|
|
38
|
+
requiredTypes: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface UpsertFieldResult {
|
|
41
|
+
file: FieldsFile;
|
|
42
|
+
/** The definition as stored after the upsert. */
|
|
43
|
+
definition: RuntimeFieldDefinition;
|
|
44
|
+
/** True when an existing definition with the same (normalized) key was replaced. */
|
|
45
|
+
replaced: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface RemoveFieldResult {
|
|
48
|
+
file: FieldsFile;
|
|
49
|
+
/** True when a matching definition existed and was dropped from the file. */
|
|
50
|
+
removed: boolean;
|
|
51
|
+
/** The removed definition, when one matched the requested key. */
|
|
52
|
+
definition?: RuntimeFieldDefinition;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Normalizes a field key using the same rule as runtime-schema.ts: lowercase and
|
|
56
|
+
* collapse any run of whitespace/hyphens into a single underscore.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normalizeFieldKey(value: unknown): string;
|
|
59
|
+
/**
|
|
60
|
+
* Validates and normalizes raw add-field CLI input. Throws a plain Error with a
|
|
61
|
+
* stable message when the key is missing/empty, collides with a built-in field,
|
|
62
|
+
* or carries an invalid type/command; the CLI layer maps these to PmCliError
|
|
63
|
+
* exit codes. A `string_array` type implies a repeatable field downstream
|
|
64
|
+
* (runtime-schema.ts derives `repeatable`), so no separate repeatable flag is
|
|
65
|
+
* exposed.
|
|
66
|
+
*/
|
|
67
|
+
export declare function normalizeAddFieldInput(raw: RawAddFieldInput): NormalizedAddFieldInput;
|
|
68
|
+
/**
|
|
69
|
+
* Coerces an arbitrary parsed value from fields.json into a FieldsFile. Accepts
|
|
70
|
+
* the canonical `{ fields: [...] }` shape, a bare array, or a `{ definitions: [...] }`
|
|
71
|
+
* form, and tolerates a missing/invalid file by returning an empty fields list.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseFieldsFile(raw: string | null | undefined): FieldsFile;
|
|
74
|
+
/**
|
|
75
|
+
* Serializes the fields file with a trailing newline (matches the rest of the
|
|
76
|
+
* schema scaffold files written by pm).
|
|
77
|
+
*/
|
|
78
|
+
export declare function serializeFieldsFile(file: FieldsFile): string;
|
|
79
|
+
/**
|
|
80
|
+
* Idempotent UPSERT of a custom field into the parsed file. Matching is by
|
|
81
|
+
* normalized key. When a definition already exists, the supplied input fully
|
|
82
|
+
* replaces its add-field-managed attributes (type/commands/description/flags/
|
|
83
|
+
* required flags) while preserving any unrelated keys the file may carry; any
|
|
84
|
+
* `metadata_key` already stored is preserved so existing item data keeps mapping
|
|
85
|
+
* to the same front-matter column.
|
|
86
|
+
*/
|
|
87
|
+
export declare function upsertField(file: FieldsFile, input: NormalizedAddFieldInput): UpsertFieldResult;
|
|
88
|
+
/**
|
|
89
|
+
* Removes a custom field definition from the parsed file by key (normalized).
|
|
90
|
+
* Throws a plain Error when `key` is empty. Returns `removed: false` when no
|
|
91
|
+
* matching definition exists so the CLI layer can treat the call as an
|
|
92
|
+
* idempotent no-op.
|
|
93
|
+
*/
|
|
94
|
+
export declare function removeField(file: FieldsFile, key: string | undefined): RemoveFieldResult;
|
|
@@ -0,0 +1,317 @@
|
|
|
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]="01bca6b9-49d3-5785-9d18-8399a0aac293")}catch(e){}}();
|
|
3
|
+
import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, } from "../../types/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Pure logic for the `pm schema add-field` / `pm schema remove-field` commands
|
|
6
|
+
* and the `list-fields` / `show-field` inspectors. The CLI command file
|
|
7
|
+
* (schema.ts) owns IO/governance; everything testable and side-effect-free lives
|
|
8
|
+
* here so it can be coverage-gated to 100%.
|
|
9
|
+
*
|
|
10
|
+
* Custom fields persist at `.agents/pm/schema/fields.json` under the shape
|
|
11
|
+
* `{ fields: RuntimeFieldDefinition[] }`. The runtime merge layer
|
|
12
|
+
* (loadRuntimeSchemaFromOptionalFiles) reads that file and dynamically registers
|
|
13
|
+
* a CLI flag per field on create/update/list/search/context, so this module only
|
|
14
|
+
* has to manage the persisted entries; it never duplicates the registration.
|
|
15
|
+
*/
|
|
16
|
+
const RUNTIME_FIELD_TYPE_SET = new Set(RUNTIME_FIELD_TYPE_VALUES);
|
|
17
|
+
const RUNTIME_FIELD_COMMAND_SET = new Set(RUNTIME_FIELD_COMMAND_VALUES);
|
|
18
|
+
/**
|
|
19
|
+
* Built-in front-matter field names a custom field key must never shadow. A
|
|
20
|
+
* custom key that collides with one of these would let `pm create --<key>` write
|
|
21
|
+
* over reserved metadata, so add-field rejects them up front (symmetric with the
|
|
22
|
+
* built-in-type guard in item-types-file.ts).
|
|
23
|
+
*/
|
|
24
|
+
export const BUILTIN_FIELD_KEYS = new Set([
|
|
25
|
+
"id",
|
|
26
|
+
"title",
|
|
27
|
+
"type",
|
|
28
|
+
"status",
|
|
29
|
+
"priority",
|
|
30
|
+
"tags",
|
|
31
|
+
"assignee",
|
|
32
|
+
"parent",
|
|
33
|
+
"description",
|
|
34
|
+
"body",
|
|
35
|
+
"created_at",
|
|
36
|
+
"updated_at",
|
|
37
|
+
"closed_at",
|
|
38
|
+
"author",
|
|
39
|
+
"deadline",
|
|
40
|
+
"estimate",
|
|
41
|
+
"sprint",
|
|
42
|
+
"release",
|
|
43
|
+
"risk",
|
|
44
|
+
"confidence",
|
|
45
|
+
"reviewer",
|
|
46
|
+
"resolution",
|
|
47
|
+
"expected",
|
|
48
|
+
"actual",
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* The default commands a field is wired onto when `--commands` is omitted,
|
|
52
|
+
* matching the runtime default in runtime-schema.ts (normalizeRuntimeFieldDefinition).
|
|
53
|
+
*/
|
|
54
|
+
const DEFAULT_FIELD_COMMANDS = ["create", "update"];
|
|
55
|
+
/**
|
|
56
|
+
* Normalizes a field key using the same rule as runtime-schema.ts: lowercase and
|
|
57
|
+
* collapse any run of whitespace/hyphens into a single underscore.
|
|
58
|
+
*/
|
|
59
|
+
export function normalizeFieldKey(value) {
|
|
60
|
+
return typeof value === "string" ? value.trim().toLowerCase().replaceAll(/[\s-]+/g, "_") : "";
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Normalizes a CLI flag token: strip a leading `--`, lowercase, and collapse
|
|
64
|
+
* whitespace/underscore runs to a single hyphen (matches normalizeCliToken in
|
|
65
|
+
* runtime-schema.ts).
|
|
66
|
+
*/
|
|
67
|
+
function normalizeCliToken(value) {
|
|
68
|
+
if (typeof value !== "string") {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
const collapsed = value.trim().toLowerCase().replaceAll(/[\s_]+/g, "-");
|
|
72
|
+
return collapsed.startsWith("--") ? collapsed.slice(2) : collapsed;
|
|
73
|
+
}
|
|
74
|
+
function keyToDefaultCliFlag(key) {
|
|
75
|
+
return key.replaceAll("_", "-");
|
|
76
|
+
}
|
|
77
|
+
function dedupeCliTokens(values, exclude) {
|
|
78
|
+
const seen = new Set();
|
|
79
|
+
for (const value of values) {
|
|
80
|
+
const token = normalizeCliToken(value);
|
|
81
|
+
if (token.length > 0 && token !== exclude) {
|
|
82
|
+
seen.add(token);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return [...seen].sort((left, right) => left.localeCompare(right));
|
|
86
|
+
}
|
|
87
|
+
function dedupeStringList(values) {
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
for (const value of values ?? []) {
|
|
90
|
+
const trimmed = value.trim();
|
|
91
|
+
if (trimmed.length > 0) {
|
|
92
|
+
seen.add(trimmed);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return [...seen].sort((left, right) => left.localeCompare(right));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Validates and normalizes raw add-field CLI input. Throws a plain Error with a
|
|
99
|
+
* stable message when the key is missing/empty, collides with a built-in field,
|
|
100
|
+
* or carries an invalid type/command; the CLI layer maps these to PmCliError
|
|
101
|
+
* exit codes. A `string_array` type implies a repeatable field downstream
|
|
102
|
+
* (runtime-schema.ts derives `repeatable`), so no separate repeatable flag is
|
|
103
|
+
* exposed.
|
|
104
|
+
*/
|
|
105
|
+
export function normalizeAddFieldInput(raw) {
|
|
106
|
+
const key = normalizeFieldKey(raw.key);
|
|
107
|
+
if (key.length === 0) {
|
|
108
|
+
throw new Error("Field key must not be empty.");
|
|
109
|
+
}
|
|
110
|
+
if (BUILTIN_FIELD_KEYS.has(key)) {
|
|
111
|
+
throw new Error(`Cannot define custom field "${key}": it shadows a built-in field. Built-in fields are reserved.`);
|
|
112
|
+
}
|
|
113
|
+
const typeCandidate = typeof raw.type === "string" && raw.type.trim().length > 0 ? raw.type.trim().toLowerCase() : "string";
|
|
114
|
+
if (!RUNTIME_FIELD_TYPE_SET.has(typeCandidate)) {
|
|
115
|
+
throw new Error(`Invalid field type "${raw.type}". Allowed: ${RUNTIME_FIELD_TYPE_VALUES.join(", ")}.`);
|
|
116
|
+
}
|
|
117
|
+
const type = typeCandidate;
|
|
118
|
+
let commands;
|
|
119
|
+
if (raw.commands === undefined) {
|
|
120
|
+
commands = [...DEFAULT_FIELD_COMMANDS];
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
const normalized = [];
|
|
125
|
+
for (const rawCommand of raw.commands) {
|
|
126
|
+
const command = rawCommand.trim().toLowerCase();
|
|
127
|
+
if (command.length === 0) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (!RUNTIME_FIELD_COMMAND_SET.has(command)) {
|
|
131
|
+
throw new Error(`Invalid field command "${rawCommand}". Allowed: ${RUNTIME_FIELD_COMMAND_VALUES.join(", ")}.`);
|
|
132
|
+
}
|
|
133
|
+
if (!seen.has(command)) {
|
|
134
|
+
seen.add(command);
|
|
135
|
+
normalized.push(command);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
commands = normalized.length > 0 ? normalized : [...DEFAULT_FIELD_COMMANDS];
|
|
139
|
+
}
|
|
140
|
+
const cliFlagToken = normalizeCliToken(raw.cliFlag);
|
|
141
|
+
const cliFlag = cliFlagToken.length > 0 && cliFlagToken !== keyToDefaultCliFlag(key) ? cliFlagToken : undefined;
|
|
142
|
+
const effectiveFlag = cliFlag ?? keyToDefaultCliFlag(key);
|
|
143
|
+
const cliAliases = dedupeCliTokens(raw.aliases ?? [], effectiveFlag);
|
|
144
|
+
const description = raw.description?.trim();
|
|
145
|
+
return {
|
|
146
|
+
key,
|
|
147
|
+
type,
|
|
148
|
+
commands,
|
|
149
|
+
description: description && description.length > 0 ? description : undefined,
|
|
150
|
+
cliFlag,
|
|
151
|
+
cliAliases,
|
|
152
|
+
required: raw.required === true,
|
|
153
|
+
requiredOnCreate: raw.requiredOnCreate === true,
|
|
154
|
+
// allow_unset defaults to true (omitted) and is only persisted when an
|
|
155
|
+
// operator explicitly disables it with --no-allow-unset (allowUnset === false).
|
|
156
|
+
allowUnset: raw.allowUnset !== false,
|
|
157
|
+
requiredTypes: dedupeStringList(raw.requiredTypes),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function selectFieldsArray(parsed) {
|
|
161
|
+
if (Array.isArray(parsed)) {
|
|
162
|
+
return parsed;
|
|
163
|
+
}
|
|
164
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
const record = parsed;
|
|
168
|
+
if (Array.isArray(record.fields)) {
|
|
169
|
+
return record.fields;
|
|
170
|
+
}
|
|
171
|
+
if (Array.isArray(record.definitions)) {
|
|
172
|
+
return record.definitions;
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
function extractFieldDefinitions(parsed) {
|
|
177
|
+
const candidate = selectFieldsArray(parsed);
|
|
178
|
+
if (!candidate) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
const definitions = [];
|
|
182
|
+
for (const entry of candidate) {
|
|
183
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const record = entry;
|
|
187
|
+
if (typeof record.key !== "string" || record.key.trim().length === 0) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
definitions.push(record);
|
|
191
|
+
}
|
|
192
|
+
return definitions;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Coerces an arbitrary parsed value from fields.json into a FieldsFile. Accepts
|
|
196
|
+
* the canonical `{ fields: [...] }` shape, a bare array, or a `{ definitions: [...] }`
|
|
197
|
+
* form, and tolerates a missing/invalid file by returning an empty fields list.
|
|
198
|
+
*/
|
|
199
|
+
export function parseFieldsFile(raw) {
|
|
200
|
+
if (raw === null || raw === undefined || raw.trim().length === 0) {
|
|
201
|
+
return { fields: [] };
|
|
202
|
+
}
|
|
203
|
+
let parsed;
|
|
204
|
+
try {
|
|
205
|
+
parsed = JSON.parse(raw);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
throw new Error("schema/fields.json contains invalid JSON.");
|
|
209
|
+
}
|
|
210
|
+
return { fields: extractFieldDefinitions(parsed) };
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Serializes the fields file with a trailing newline (matches the rest of the
|
|
214
|
+
* schema scaffold files written by pm).
|
|
215
|
+
*/
|
|
216
|
+
export function serializeFieldsFile(file) {
|
|
217
|
+
return `${JSON.stringify({ fields: file.fields }, null, 2)}\n`;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Idempotent UPSERT of a custom field into the parsed file. Matching is by
|
|
221
|
+
* normalized key. When a definition already exists, the supplied input fully
|
|
222
|
+
* replaces its add-field-managed attributes (type/commands/description/flags/
|
|
223
|
+
* required flags) while preserving any unrelated keys the file may carry; any
|
|
224
|
+
* `metadata_key` already stored is preserved so existing item data keeps mapping
|
|
225
|
+
* to the same front-matter column.
|
|
226
|
+
*/
|
|
227
|
+
export function upsertField(file, input) {
|
|
228
|
+
// Match by normalized key. A hand-authored file may carry more than one entry
|
|
229
|
+
// for the same key, so drop ALL matches and re-insert a single merged result
|
|
230
|
+
// (collapsing duplicates) rather than only rewriting the first occurrence. The
|
|
231
|
+
// first existing match seeds preserved attributes (e.g. metadata_key).
|
|
232
|
+
const existing = file.fields.find((definition) => normalizeFieldKey(definition.key) === input.key);
|
|
233
|
+
const replaced = existing !== undefined;
|
|
234
|
+
const fields = file.fields.filter((definition) => normalizeFieldKey(definition.key) !== input.key);
|
|
235
|
+
const next = {
|
|
236
|
+
...(existing ?? {}),
|
|
237
|
+
key: input.key,
|
|
238
|
+
type: input.type,
|
|
239
|
+
commands: [...input.commands],
|
|
240
|
+
};
|
|
241
|
+
applyOptionalString(next, "description", input.description);
|
|
242
|
+
applyOptionalString(next, "cli_flag", input.cliFlag);
|
|
243
|
+
if (input.cliAliases.length > 0) {
|
|
244
|
+
next.cli_aliases = [...input.cliAliases];
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
delete next.cli_aliases;
|
|
248
|
+
}
|
|
249
|
+
applyBooleanFlag(next, "required", input.required);
|
|
250
|
+
applyBooleanFlag(next, "required_on_create", input.requiredOnCreate);
|
|
251
|
+
// allow_unset defaults true; only persist the explicit false override.
|
|
252
|
+
if (input.allowUnset === false) {
|
|
253
|
+
next.allow_unset = false;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
delete next.allow_unset;
|
|
257
|
+
}
|
|
258
|
+
if (input.requiredTypes.length > 0) {
|
|
259
|
+
next.required_types = [...input.requiredTypes];
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
delete next.required_types;
|
|
263
|
+
}
|
|
264
|
+
fields.push(next);
|
|
265
|
+
fields.sort((left, right) => normalizeFieldKey(left.key).localeCompare(normalizeFieldKey(right.key)));
|
|
266
|
+
return {
|
|
267
|
+
file: { fields },
|
|
268
|
+
definition: next,
|
|
269
|
+
replaced,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Removes a custom field definition from the parsed file by key (normalized).
|
|
274
|
+
* Throws a plain Error when `key` is empty. Returns `removed: false` when no
|
|
275
|
+
* matching definition exists so the CLI layer can treat the call as an
|
|
276
|
+
* idempotent no-op.
|
|
277
|
+
*/
|
|
278
|
+
export function removeField(file, key) {
|
|
279
|
+
const normalizedKey = normalizeFieldKey(key);
|
|
280
|
+
if (normalizedKey.length === 0) {
|
|
281
|
+
throw new Error("Field key must not be empty.");
|
|
282
|
+
}
|
|
283
|
+
// Remove ALL matches (a hand-authored file may carry duplicate entries for the
|
|
284
|
+
// same normalized key) so no stale duplicate survives the removal.
|
|
285
|
+
const removed = [];
|
|
286
|
+
const fields = file.fields.filter((definition) => {
|
|
287
|
+
if (normalizeFieldKey(definition.key) === normalizedKey) {
|
|
288
|
+
removed.push(definition);
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
});
|
|
293
|
+
if (removed.length === 0) {
|
|
294
|
+
return { file: { fields }, removed: false };
|
|
295
|
+
}
|
|
296
|
+
return { file: { fields }, removed: true, definition: removed[0] };
|
|
297
|
+
}
|
|
298
|
+
function applyOptionalString(definition, key, value) {
|
|
299
|
+
const record = definition;
|
|
300
|
+
if (value !== undefined && value.length > 0) {
|
|
301
|
+
record[key] = value;
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
delete record[key];
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function applyBooleanFlag(definition, key, value) {
|
|
308
|
+
const record = definition;
|
|
309
|
+
if (value) {
|
|
310
|
+
record[key] = true;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
delete record[key];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=fields-file.js.map
|
|
317
|
+
//# debugId=01bca6b9-49d3-5785-9d18-8399a0aac293
|