@unbrained/pm-cli 2026.6.13 → 2026.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -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 +269 -8
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/config.d.ts +51 -1
- package/dist/cli/commands/config.js +50 -12
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/context.d.ts +79 -1
- package/dist/cli/commands/context.js +151 -25
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.d.ts +80 -1
- package/dist/cli/commands/contracts.js +54 -4
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.d.ts +49 -0
- package/dist/cli/commands/create.js +105 -7
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/dedupe-audit.d.ts +33 -0
- package/dist/cli/commands/dedupe-audit.js +18 -14
- package/dist/cli/commands/dedupe-audit.js.map +1 -1
- package/dist/cli/commands/deps.js +7 -4
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/event-validation-messages.js +3 -3
- package/dist/cli/commands/event-validation-messages.js.map +1 -1
- package/dist/cli/commands/extension/bundled-catalog.d.ts +7 -0
- package/dist/cli/commands/extension/bundled-catalog.js +19 -15
- package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.d.ts +41 -1
- package/dist/cli/commands/extension/install-sources.js +26 -8
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/extension/shared.d.ts +5 -0
- package/dist/cli/commands/extension/shared.js +9 -3
- package/dist/cli/commands/extension/shared.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +133 -1
- package/dist/cli/commands/extension.js +127 -9
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/files.d.ts +30 -1
- package/dist/cli/commands/files.js +21 -2
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/focus.d.ts +11 -0
- package/dist/cli/commands/focus.js +86 -0
- package/dist/cli/commands/focus.js.map +1 -0
- package/dist/cli/commands/get.d.ts +9 -2
- package/dist/cli/commands/get.js +34 -6
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/guide.d.ts +5 -0
- package/dist/cli/commands/guide.js +6 -3
- package/dist/cli/commands/guide.js.map +1 -1
- package/dist/cli/commands/health.d.ts +109 -0
- package/dist/cli/commands/health.js +87 -35
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-compact.js +27 -36
- package/dist/cli/commands/history-compact.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +46 -0
- package/dist/cli/commands/history-redact.js +99 -67
- package/dist/cli/commands/history-redact.js.map +1 -1
- package/dist/cli/commands/history-repair.js +34 -37
- package/dist/cli/commands/history-repair.js.map +1 -1
- package/dist/cli/commands/history.js +6 -2
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +3 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init-agent-guidance.d.ts +54 -0
- package/dist/cli/commands/init-agent-guidance.js +31 -4
- package/dist/cli/commands/init-agent-guidance.js.map +1 -1
- package/dist/cli/commands/init.d.ts +36 -1
- package/dist/cli/commands/init.js +38 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learnings.js +4 -3
- package/dist/cli/commands/learnings.js.map +1 -1
- package/dist/cli/commands/linked-test-parsers.d.ts +5 -0
- package/dist/cli/commands/linked-test-parsers.js +5 -2
- package/dist/cli/commands/linked-test-parsers.js.map +1 -1
- package/dist/cli/commands/list-filter-shared.d.ts +8 -0
- package/dist/cli/commands/list-filter-shared.js +70 -0
- package/dist/cli/commands/list-filter-shared.js.map +1 -0
- package/dist/cli/commands/list.d.ts +116 -0
- package/dist/cli/commands/list.js +194 -6
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/normalize.js +16 -2
- package/dist/cli/commands/normalize.js.map +1 -1
- package/dist/cli/commands/notes.js +4 -3
- package/dist/cli/commands/notes.js.map +1 -1
- package/dist/cli/commands/plan.js +3 -2
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/reindex.d.ts +83 -0
- package/dist/cli/commands/reindex.js +45 -10
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/restore.d.ts +40 -1
- package/dist/cli/commands/restore.js +27 -2
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +18 -0
- package/dist/cli/commands/schema.js +30 -3
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/search.d.ts +289 -1
- package/dist/cli/commands/search.js +367 -60
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/stats.d.ts +38 -0
- package/dist/cli/commands/stats.js +38 -10
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/telemetry.js +5 -3
- package/dist/cli/commands/telemetry.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +18 -0
- package/dist/cli/commands/templates.js +9 -2
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/commands/test-all.d.ts +5 -0
- package/dist/cli/commands/test-all.js +9 -3
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/commands/test.d.ts +70 -1
- package/dist/cli/commands/test.js +84 -3
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update-many.d.ts +34 -1
- package/dist/cli/commands/update-many.js +60 -31
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.d.ts +71 -0
- package/dist/cli/commands/update.js +74 -8
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/upgrade.d.ts +28 -1
- package/dist/cli/commands/upgrade.js +17 -4
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +114 -0
- package/dist/cli/commands/validate.js +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 +30 -6
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.d.ts +19 -1
- package/dist/cli/help-json-payload.js +16 -7
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.d.ts +223 -0
- package/dist/cli/main.js +203 -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 +210 -40
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.d.ts +8 -0
- package/dist/cli/register-operations.js +33 -11
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +9 -6
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +4 -0
- package/dist/cli/registration-helpers.js +124 -38
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/chunks/activity-5P2KQCTH.js +18 -0
- package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js → activity-MJGTX4LO.js} +13 -11
- package/dist/cli-bundle/chunks/{aggregate-XEBW22UQ.js → aggregate-MH3GROKB.js} +54 -25
- package/dist/cli-bundle/chunks/aggregate-MH3GROKB.js.map +7 -0
- package/dist/cli-bundle/chunks/{aggregate-IRHJWEKG.js → aggregate-OUGCDFNC.js} +55 -26
- package/dist/cli-bundle/chunks/aggregate-OUGCDFNC.js.map +1 -0
- package/dist/cli-bundle/chunks/{append-N2AWXKZC.js → append-2Q4BPUBW.js} +10 -10
- package/dist/cli-bundle/chunks/{append-N2AWXKZC.js.map → append-2Q4BPUBW.js.map} +2 -2
- package/dist/cli-bundle/chunks/{append-NL67JNJU.js → append-VCRUG2W6.js} +11 -11
- package/dist/cli-bundle/chunks/append-VCRUG2W6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js → chunk-2IUJBMKS.js} +10 -9
- package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js.map → chunk-2IUJBMKS.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js → chunk-2JEGCDYT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js → chunk-3WAULYOY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-AGG32LKL.js → chunk-3XOXWOGA.js} +359 -19
- package/dist/cli-bundle/chunks/chunk-3XOXWOGA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XXLMJDUB.js → chunk-4KBK4BA3.js} +13 -15
- package/dist/cli-bundle/chunks/chunk-4KBK4BA3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-UCVJP4JL.js → chunk-4VLB4JH2.js} +51 -8
- package/dist/cli-bundle/chunks/chunk-4VLB4JH2.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-BVL5KGVA.js → chunk-656HPQPO.js} +27 -12
- package/dist/cli-bundle/chunks/chunk-656HPQPO.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-LYNQ3NGI.js → chunk-667XI4UJ.js} +309 -20
- package/dist/cli-bundle/chunks/chunk-667XI4UJ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-W6KNFAMZ.js → chunk-6BV7ENQL.js} +9 -8
- package/dist/cli-bundle/chunks/chunk-6BV7ENQL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js +35 -0
- package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-7SM7VA5I.js → chunk-6NQXMGYU.js} +19 -8
- package/dist/cli-bundle/chunks/chunk-6NQXMGYU.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-AAUYXSFF.js → chunk-764O7EUA.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-764O7EUA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js → chunk-7AGIXLNK.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-7EILPFMA.js +404 -0
- package/dist/cli-bundle/chunks/chunk-7EILPFMA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-L6YQONLM.js → chunk-7K2MXFMX.js} +11 -13
- package/dist/cli-bundle/chunks/chunk-7K2MXFMX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-HZOX5BYD.js → chunk-7L5VOUYP.js} +6 -17
- package/dist/cli-bundle/chunks/chunk-7L5VOUYP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-7ZGKNHUL.js +61 -0
- package/dist/cli-bundle/chunks/chunk-7ZGKNHUL.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-TOX7YQ7X.js → chunk-A576QZDL.js} +223 -50
- package/dist/cli-bundle/chunks/chunk-A576QZDL.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-RFR2YQGO.js → chunk-AERT7KT3.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-ASM4DVRW.js +58 -0
- package/dist/cli-bundle/chunks/chunk-ASM4DVRW.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-SQDKAEKG.js → chunk-B5Q7XC4K.js} +117 -37
- package/dist/cli-bundle/chunks/chunk-B5Q7XC4K.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RHYBR6G7.js → chunk-BJWTFOZM.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-BJWTFOZM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4ZKKZMLH.js → chunk-CBMETQ2U.js} +104 -30
- package/dist/cli-bundle/chunks/chunk-CBMETQ2U.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js → chunk-E6J2PEK6.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js → chunk-F2GC6L3N.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-3VULHQNS.js → chunk-F7WSO5UX.js} +7 -18
- package/dist/cli-bundle/chunks/chunk-F7WSO5UX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js → chunk-FTAZLAR7.js} +8 -5
- package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js.map → chunk-FTAZLAR7.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-AUDDXKNX.js → chunk-FXNT5LPX.js} +77 -9
- package/dist/cli-bundle/chunks/chunk-FXNT5LPX.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-IZHCCG4S.js → chunk-G2YVUY7I.js} +14 -9
- package/dist/cli-bundle/chunks/chunk-G2YVUY7I.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5HSAHRYA.js → chunk-G3CEIXTV.js} +68 -19
- package/dist/cli-bundle/chunks/chunk-G3CEIXTV.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-QQG4HEX7.js → chunk-GAVE4MYM.js} +37 -63
- package/dist/cli-bundle/chunks/chunk-GAVE4MYM.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js → chunk-GQ4JKNMV.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js.map → chunk-GQ4JKNMV.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-MACCNKSZ.js → chunk-GYMG7AG6.js} +36 -62
- package/dist/cli-bundle/chunks/chunk-GYMG7AG6.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-7CRFV6JR.js → chunk-H6EH6ENJ.js} +362 -22
- package/dist/cli-bundle/chunks/chunk-H6EH6ENJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-2J2AH4V5.js → chunk-HDIDUME4.js} +45 -13
- package/dist/cli-bundle/chunks/chunk-HDIDUME4.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2ANTZBYF.js → chunk-HPELHUTG.js} +122 -45
- package/dist/cli-bundle/chunks/chunk-HPELHUTG.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-VNC2HBL4.js → chunk-II7OGE3V.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-II7OGE3V.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js → chunk-ILHLIA47.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js.map → chunk-ILHLIA47.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-4TPFXE2R.js → chunk-IMQG4VR3.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-IMQG4VR3.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-MGAQ6KZG.js → chunk-IQVB3YDD.js} +82 -21
- package/dist/cli-bundle/chunks/chunk-IQVB3YDD.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-WLH7X4RN.js → chunk-KQ3LAMDO.js} +45 -13
- package/dist/cli-bundle/chunks/chunk-KQ3LAMDO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-S2CDTRJ6.js → chunk-KTVETP66.js} +379 -271
- package/dist/cli-bundle/chunks/chunk-KTVETP66.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-36BCSMKP.js → chunk-KZYVTOG5.js} +26 -11
- package/dist/cli-bundle/chunks/chunk-KZYVTOG5.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js → chunk-L6FJPOT4.js} +11 -10
- package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js.map → chunk-L6FJPOT4.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-LFW5NQUP.js → chunk-LV5FFQ7M.js} +405 -290
- package/dist/cli-bundle/chunks/chunk-LV5FFQ7M.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PNYAAB4S.js → chunk-LWGMDLQ6.js} +8 -3
- package/dist/cli-bundle/chunks/chunk-LWGMDLQ6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js → chunk-M23HXJL3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js → chunk-MJZUZ2QE.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js → chunk-NCIBNERT.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js.map → chunk-NCIBNERT.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-6TBR5AZ2.js → chunk-NIQHNDBZ.js} +76 -8
- package/dist/cli-bundle/chunks/chunk-NIQHNDBZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js → chunk-O46LTCXQ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-GFBEXDCQ.js → chunk-OCTQJP42.js} +19 -8
- package/dist/cli-bundle/chunks/{chunk-GFBEXDCQ.js.map → chunk-OCTQJP42.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HLEGAQXT.js → chunk-OLTYNVJR.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-IXVSSHGV.js → chunk-OY3P2I6B.js} +13 -8
- package/dist/cli-bundle/chunks/chunk-OY3P2I6B.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-KHGTYCJ6.js → chunk-PZD7WPUC.js} +69 -20
- package/dist/cli-bundle/chunks/chunk-PZD7WPUC.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-4FHLNNW7.js → chunk-Q5RLUCP3.js} +74 -14
- package/dist/cli-bundle/chunks/chunk-Q5RLUCP3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-SOHXUA2Q.js → chunk-RKKIH2ZQ.js} +116 -36
- package/dist/cli-bundle/chunks/chunk-RKKIH2ZQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js → chunk-SPYPC5CB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js.map → chunk-SPYPC5CB.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-SGMGMCIF.js → chunk-SY4GKIWT.js} +82 -21
- package/dist/cli-bundle/chunks/chunk-SY4GKIWT.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js → chunk-SY4PZWIZ.js} +7 -4
- package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js.map → chunk-SY4PZWIZ.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HWHONML5.js → chunk-T5VU7ROQ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-JWXTOYBI.js → chunk-TIRZIQRP.js} +121 -44
- package/dist/cli-bundle/chunks/chunk-TIRZIQRP.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PEH7SZD2.js → chunk-TUB3DZAZ.js} +105 -31
- package/dist/cli-bundle/chunks/chunk-TUB3DZAZ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-UAR2VNCK.js +394 -0
- package/dist/cli-bundle/chunks/chunk-UAR2VNCK.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js → chunk-UBMCSJXX.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js → chunk-UUKORJSN.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-R4VWYWRN.js → chunk-W3HFLORZ.js} +7 -2
- package/dist/cli-bundle/chunks/chunk-W3HFLORZ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js → chunk-WZCQVABQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js +32 -0
- package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-M3SI2REU.js → chunk-XLNNCKTN.js} +322 -19
- package/dist/cli-bundle/chunks/chunk-XLNNCKTN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-4JHJ7YG2.js → chunk-XNOY7TCB.js} +118 -74
- package/dist/cli-bundle/chunks/chunk-XNOY7TCB.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js → chunk-YGRPBFMA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JW7D6437.js → chunk-YXTLI4XP.js} +20 -9
- package/dist/cli-bundle/chunks/chunk-YXTLI4XP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-TSXWFN3L.js → chunk-Z3MUNQRV.js} +52 -9
- package/dist/cli-bundle/chunks/chunk-Z3MUNQRV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js → chunk-ZJRDVYZI.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-32XSW44C.js → chunk-ZONXMSVB.js} +10 -9
- package/dist/cli-bundle/chunks/chunk-ZONXMSVB.js.map +1 -0
- package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js → claim-4APLUXJW.js} +10 -10
- package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js → claim-NEO7AGWH.js} +10 -10
- package/dist/cli-bundle/chunks/{close-SPUFW5QR.js → close-3QABBNGU.js} +8 -8
- package/dist/cli-bundle/chunks/close-ILMZR3D7.js +13 -0
- package/dist/cli-bundle/chunks/{close-many-GKAJX54X.js → close-many-MIZLTYGL.js} +32 -20
- package/dist/cli-bundle/chunks/close-many-MIZLTYGL.js.map +1 -0
- package/dist/cli-bundle/chunks/{close-many-GL6NRUU5.js → close-many-Q7Y5AHQI.js} +31 -19
- package/dist/cli-bundle/chunks/close-many-Q7Y5AHQI.js.map +7 -0
- package/dist/cli-bundle/chunks/{comments-5FPT6L7N.js → comments-DAIQPOMU.js} +55 -31
- package/dist/cli-bundle/chunks/comments-DAIQPOMU.js.map +1 -0
- package/dist/cli-bundle/chunks/{comments-TOLOYWNI.js → comments-IWFSVM4P.js} +54 -30
- package/dist/cli-bundle/chunks/comments-IWFSVM4P.js.map +7 -0
- package/dist/cli-bundle/chunks/{config-4MN45TIH.js → config-IOJELD6O.js} +45 -19
- package/dist/cli-bundle/chunks/config-IOJELD6O.js.map +1 -0
- package/dist/cli-bundle/chunks/{config-7N6D7YJE.js → config-PXTMAYV3.js} +44 -18
- package/dist/cli-bundle/chunks/config-PXTMAYV3.js.map +7 -0
- package/dist/cli-bundle/chunks/{context-AQSLE7DZ.js → context-QHJSCJW4.js} +128 -39
- package/dist/cli-bundle/chunks/context-QHJSCJW4.js.map +1 -0
- package/dist/cli-bundle/chunks/{context-U3PUJMVN.js → context-XZS2VFKU.js} +127 -38
- package/dist/cli-bundle/chunks/context-XZS2VFKU.js.map +7 -0
- package/dist/cli-bundle/chunks/{contracts-ITSJXO3O.js → contracts-B7U4OJTV.js} +54 -10
- package/dist/cli-bundle/chunks/contracts-B7U4OJTV.js.map +1 -0
- package/dist/cli-bundle/chunks/{contracts-H7KCQXLY.js → contracts-NSBVLXQ3.js} +54 -10
- package/dist/cli-bundle/chunks/contracts-NSBVLXQ3.js.map +7 -0
- package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js → copy-Q64T5FD4.js} +7 -7
- package/dist/cli-bundle/chunks/{copy-C4W522JM.js → copy-SG34LCMU.js} +7 -7
- package/dist/cli-bundle/chunks/create-F5HZX2S4.js +30 -0
- package/dist/cli-bundle/chunks/{create-4EQNELMY.js → create-IPAX2SNL.js} +16 -13
- package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js → delete-TLXR7LJ2.js} +7 -7
- package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js → delete-VH3L7DZ6.js} +7 -7
- package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js → deps-J3HBBLDB.js} +9 -10
- package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js.map → deps-J3HBBLDB.js.map} +2 -2
- package/dist/cli-bundle/chunks/{deps-HV2C2L46.js → deps-XV6JJ6IN.js} +10 -11
- package/dist/cli-bundle/chunks/deps-XV6JJ6IN.js.map +1 -0
- package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js → docs-GWDEB7JH.js} +9 -9
- package/dist/cli-bundle/chunks/{docs-RJQPLROO.js → docs-RCLNSKID.js} +9 -9
- package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js → extension-5RN65LHT.js} +7 -5
- package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js → extension-7KO2NX2A.js} +7 -5
- package/dist/cli-bundle/chunks/{files-OIFN3DQX.js → files-3TCQHUHA.js} +25 -11
- package/dist/cli-bundle/chunks/files-3TCQHUHA.js.map +1 -0
- package/dist/cli-bundle/chunks/{files-LIFDKNCN.js → files-5FDUPSEA.js} +24 -10
- package/dist/cli-bundle/chunks/files-5FDUPSEA.js.map +7 -0
- package/dist/cli-bundle/chunks/focus-7AQMNRSU.js +109 -0
- package/dist/cli-bundle/chunks/focus-7AQMNRSU.js.map +7 -0
- package/dist/cli-bundle/chunks/focus-HQXBYPKM.js +106 -0
- package/dist/cli-bundle/chunks/focus-HQXBYPKM.js.map +1 -0
- package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js → gc-2FGKYRJ4.js} +3 -3
- package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js → gc-5B6ABL3Z.js} +3 -3
- package/dist/cli-bundle/chunks/{get-SAB7CRBG.js → get-FUMVOJQD.js} +43 -16
- package/dist/cli-bundle/chunks/get-FUMVOJQD.js.map +1 -0
- package/dist/cli-bundle/chunks/{get-K7UULTQF.js → get-H5BZTW4A.js} +42 -15
- package/dist/cli-bundle/chunks/get-H5BZTW4A.js.map +7 -0
- package/dist/cli-bundle/chunks/{health-NUVZYIEV.js → health-JSVOR6B4.js} +75 -49
- package/dist/cli-bundle/chunks/health-JSVOR6B4.js.map +1 -0
- package/dist/cli-bundle/chunks/{health-VJWH3ZFK.js → health-LE2ZQGSM.js} +74 -48
- package/dist/cli-bundle/chunks/health-LE2ZQGSM.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-GYFD2DJW.js → history-QO4JVJJP.js} +10 -10
- package/dist/cli-bundle/chunks/history-SSXGGTVZ.js +20 -0
- package/dist/cli-bundle/chunks/{history-compact-WQZQ6KXM.js → history-compact-ID74DOUI.js} +37 -46
- package/dist/cli-bundle/chunks/history-compact-ID74DOUI.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-compact-SLL6ESXH.js → history-compact-SDFRPZ4V.js} +38 -47
- package/dist/cli-bundle/chunks/history-compact-SDFRPZ4V.js.map +1 -0
- package/dist/cli-bundle/chunks/history-redact-VBH44Y7F.js +21 -0
- package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js → history-redact-Z4P5MM3G.js} +13 -11
- package/dist/cli-bundle/chunks/{history-repair-UCYS55ZX.js → history-repair-ANHEYWKF.js} +43 -48
- package/dist/cli-bundle/chunks/history-repair-ANHEYWKF.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-repair-BJCGM6Q3.js → history-repair-CKE7GLZR.js} +44 -49
- package/dist/cli-bundle/chunks/history-repair-CKE7GLZR.js.map +1 -0
- package/dist/cli-bundle/chunks/init-7FBQO77A.js +19 -0
- package/dist/cli-bundle/chunks/{init-MXV57LKL.js → init-K6MSMB37.js} +11 -9
- package/dist/cli-bundle/chunks/{learnings-QKJOKEAO.js → learnings-VIS3NOQV.js} +13 -12
- package/dist/cli-bundle/chunks/learnings-VIS3NOQV.js.map +7 -0
- package/dist/cli-bundle/chunks/{learnings-L6KTZGOT.js → learnings-YYNB64GN.js} +14 -13
- package/dist/cli-bundle/chunks/learnings-YYNB64GN.js.map +1 -0
- package/dist/cli-bundle/chunks/list-7UE44A2R.js +29 -0
- package/dist/cli-bundle/chunks/list-UHMA3N2K.js +33 -0
- package/dist/cli-bundle/chunks/{notes-3NLK7WTZ.js → notes-2HRMV67I.js} +14 -13
- package/dist/cli-bundle/chunks/notes-2HRMV67I.js.map +1 -0
- package/dist/cli-bundle/chunks/{notes-HMCB7TK6.js → notes-IN3UMA7W.js} +13 -12
- package/dist/cli-bundle/chunks/notes-IN3UMA7W.js.map +7 -0
- package/dist/cli-bundle/chunks/{plan-DWBYI5C6.js → plan-I3SVH7FV.js} +16 -15
- package/dist/cli-bundle/chunks/plan-I3SVH7FV.js.map +1 -0
- package/dist/cli-bundle/chunks/{plan-NANUWH4T.js → plan-PAWCCAPW.js} +15 -14
- package/dist/cli-bundle/chunks/plan-PAWCCAPW.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-PWQ5F2VI.js → register-list-query-N7Z7RTDM.js} +31 -22
- package/dist/cli-bundle/chunks/register-list-query-N7Z7RTDM.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-SMMMLSWW.js → register-list-query-OTIK4DVA.js} +32 -23
- package/dist/cli-bundle/chunks/register-list-query-OTIK4DVA.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-mutation-QKFPTIZG.js → register-mutation-UFZK6Q57.js} +216 -66
- package/dist/cli-bundle/chunks/register-mutation-UFZK6Q57.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-ZYJQ4DVP.js → register-mutation-XFORLS6D.js} +210 -67
- package/dist/cli-bundle/chunks/register-mutation-XFORLS6D.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-2FMZ6WEF.js → register-operations-6ZCLKRBG.js} +53 -39
- package/dist/cli-bundle/chunks/register-operations-6ZCLKRBG.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-BAFQURZG.js → register-operations-ITE7JTH3.js} +54 -40
- package/dist/cli-bundle/chunks/register-operations-ITE7JTH3.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-QN2XV7UL.js → register-setup-7RKGE4BQ.js} +18 -21
- package/dist/cli-bundle/chunks/register-setup-7RKGE4BQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-setup-DQEIKBIP.js → register-setup-7UKEFKT6.js} +17 -20
- package/dist/cli-bundle/chunks/register-setup-7UKEFKT6.js.map +7 -0
- package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js → restore-NNVPBBVJ.js} +13 -11
- package/dist/cli-bundle/chunks/restore-XXXLQ2XC.js +19 -0
- package/dist/cli-bundle/chunks/{schema-RNVJ55V2.js → schema-3HCLXCFX.js} +27 -9
- package/dist/cli-bundle/chunks/schema-3HCLXCFX.js.map +7 -0
- package/dist/cli-bundle/chunks/{schema-ZZ7ZDM2X.js → schema-3YKCQ3VO.js} +28 -10
- package/dist/cli-bundle/chunks/schema-3YKCQ3VO.js.map +1 -0
- package/dist/cli-bundle/chunks/{search-BJ457C2A.js → search-NQ42NC6A.js} +328 -71
- package/dist/cli-bundle/chunks/search-NQ42NC6A.js.map +7 -0
- package/dist/cli-bundle/chunks/{search-FQDZXX7P.js → search-V7PZ2ICH.js} +328 -71
- package/dist/cli-bundle/chunks/search-V7PZ2ICH.js.map +1 -0
- package/dist/cli-bundle/chunks/{stats-DUQWCVOS.js → stats-7KD4PJC5.js} +41 -16
- package/dist/cli-bundle/chunks/stats-7KD4PJC5.js.map +7 -0
- package/dist/cli-bundle/chunks/{stats-CUG3ZHOI.js → stats-GRHO6RFB.js} +42 -17
- package/dist/cli-bundle/chunks/stats-GRHO6RFB.js.map +1 -0
- package/dist/cli-bundle/chunks/{telemetry-33MRGX4Z.js → telemetry-H5GLXNG5.js} +6 -6
- package/dist/cli-bundle/chunks/telemetry-H5GLXNG5.js.map +7 -0
- package/dist/cli-bundle/chunks/{telemetry-RK2VX75A.js → telemetry-TRRYZXWT.js} +7 -7
- package/dist/cli-bundle/chunks/telemetry-TRRYZXWT.js.map +1 -0
- package/dist/cli-bundle/chunks/test-6CZNIIGA.js +34 -0
- package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js → test-7GVQ3VMN.js} +16 -14
- package/dist/cli-bundle/chunks/{test-all-ANYQ33O2.js → test-all-3LF2OZD2.js} +23 -16
- package/dist/cli-bundle/chunks/test-all-3LF2OZD2.js.map +7 -0
- package/dist/cli-bundle/chunks/{test-all-ARSMX33Q.js → test-all-ODVADHV6.js} +24 -17
- package/dist/cli-bundle/chunks/test-all-ODVADHV6.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-runs-5URSD34O.js → test-runs-LYT6ZTNQ.js} +62 -65
- package/dist/cli-bundle/chunks/test-runs-LYT6ZTNQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{test-runs-XNACGSNQ.js → test-runs-RVP6VWN7.js} +61 -64
- package/dist/cli-bundle/chunks/test-runs-RVP6VWN7.js.map +7 -0
- package/dist/cli-bundle/chunks/update-MPGM6SBE.js +28 -0
- package/dist/cli-bundle/chunks/update-UN75XW3C.js +24 -0
- package/dist/cli-bundle/chunks/{update-many-6B7PJ33I.js → update-many-FCU6RKTO.js} +80 -34
- package/dist/cli-bundle/chunks/update-many-FCU6RKTO.js.map +1 -0
- package/dist/cli-bundle/chunks/{update-many-724JCVDE.js → update-many-XSEQJ24X.js} +79 -33
- package/dist/cli-bundle/chunks/update-many-XSEQJ24X.js.map +7 -0
- package/dist/cli-bundle/chunks/{upgrade-ALBEZAI7.js → upgrade-A6TL3INC.js} +22 -8
- package/dist/cli-bundle/chunks/upgrade-A6TL3INC.js.map +7 -0
- package/dist/cli-bundle/chunks/{upgrade-QHRGDBSA.js → upgrade-FOB5LHO5.js} +23 -9
- package/dist/cli-bundle/chunks/upgrade-FOB5LHO5.js.map +1 -0
- package/dist/cli-bundle/chunks/{validate-IQRYFXIV.js → validate-7BLDG3AT.js} +221 -30
- package/dist/cli-bundle/chunks/validate-7BLDG3AT.js.map +1 -0
- package/dist/cli-bundle/chunks/{validate-UY6DRCG5.js → validate-EHL3MI2V.js} +235 -30
- package/dist/cli-bundle/chunks/validate-EHL3MI2V.js.map +7 -0
- package/dist/cli-bundle/main.js +270 -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/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 +9 -0
- package/dist/core/item/parse.js +10 -16
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/item/type-registry.d.ts +1 -0
- package/dist/core/item/type-registry.js +8 -10
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/lock/lock.d.ts +26 -0
- package/dist/core/lock/lock.js +10 -2
- package/dist/core/lock/lock.js.map +1 -1
- package/dist/core/output/output.d.ts +7 -0
- package/dist/core/output/output.js +6 -2
- package/dist/core/output/output.js.map +1 -1
- package/dist/core/schema/item-types-file.d.ts +25 -2
- package/dist/core/schema/item-types-file.js +78 -6
- package/dist/core/schema/item-types-file.js.map +1 -1
- package/dist/core/schema/runtime-schema.d.ts +7 -0
- package/dist/core/schema/runtime-schema.js +23 -16
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/search/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/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 +50 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-definitions.js +17 -4
- package/dist/mcp/tool-definitions.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +13 -2
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
- package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +110 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +83 -8
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +28 -0
- package/dist/sdk/cli-contracts.js +164 -11
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/types.d.ts +17 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +15 -3
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/COMMANDS.md +136 -7
- package/docs/CONFIGURATION.md +52 -0
- package/docs/TESTING.md +6 -4
- package/package.json +6 -4
- package/packages/pm-calendar/extensions/calendar/runtime.js +6 -0
- package/packages/pm-calendar/extensions/calendar/runtime.ts +12 -0
- package/packages/pm-todos/extensions/todos/runtime.ts +5 -0
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +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-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-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-5P2KQCTH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js.map → activity-MJGTX4LO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js.map → chunk-2JEGCDYT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js.map → chunk-3WAULYOY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js.map → chunk-7AGIXLNK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RFR2YQGO.js.map → chunk-AERT7KT3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js.map → chunk-E6J2PEK6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js.map → chunk-F2GC6L3N.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js.map → chunk-M23HXJL3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js.map → chunk-MJZUZ2QE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js.map → chunk-O46LTCXQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HLEGAQXT.js.map → chunk-OLTYNVJR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HWHONML5.js.map → chunk-T5VU7ROQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js.map → chunk-UBMCSJXX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js.map → chunk-UUKORJSN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js.map → chunk-WZCQVABQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js.map → chunk-YGRPBFMA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js.map → chunk-ZJRDVYZI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js.map → claim-4APLUXJW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js.map → claim-NEO7AGWH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-SPUFW5QR.js.map → close-3QABBNGU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-WOG5WTMZ.js.map → close-ILMZR3D7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js.map → copy-Q64T5FD4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-C4W522JM.js.map → copy-SG34LCMU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-NW3K7LVG.js.map → create-F5HZX2S4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-4EQNELMY.js.map → create-IPAX2SNL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js.map → delete-TLXR7LJ2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js.map → delete-VH3L7DZ6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js.map → docs-GWDEB7JH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-RJQPLROO.js.map → docs-RCLNSKID.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js.map → extension-5RN65LHT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js.map → extension-7KO2NX2A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js.map → gc-2FGKYRJ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js.map → gc-5B6ABL3Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-GYFD2DJW.js.map → history-QO4JVJJP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-IUVN4NTN.js.map → history-SSXGGTVZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-75KIIJUJ.js.map → history-redact-VBH44Y7F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js.map → history-redact-Z4P5MM3G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-JJFYRUKG.js.map → init-7FBQO77A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-MXV57LKL.js.map → init-K6MSMB37.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-VOQDQHA4.js.map → list-7UE44A2R.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-GGVPXEV6.js.map → list-UHMA3N2K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js.map → restore-NNVPBBVJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-DRBNXJJH.js.map → restore-XXXLQ2XC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-SDMYEQHH.js.map → test-6CZNIIGA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js.map → test-7GVQ3VMN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-U235A7WP.js.map → update-MPGM6SBE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-PD46VOXI.js.map → update-UN75XW3C.js.map} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeItemId,
|
|
3
3
|
normalizeRawItemId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WZCQVABQ.js";
|
|
5
5
|
import {
|
|
6
6
|
canonicalDocument,
|
|
7
7
|
parseItemDocument,
|
|
8
8
|
serializeItemDocument
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GYMG7AG6.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveItemTypeRegistry
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6BV7ENQL.js";
|
|
13
13
|
import {
|
|
14
14
|
nowIso
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OY3P2I6B.js";
|
|
16
16
|
import {
|
|
17
17
|
EMPTY_CANONICAL_DOCUMENT,
|
|
18
18
|
EXIT_CODE,
|
|
@@ -42,13 +42,13 @@ import {
|
|
|
42
42
|
stableStringify,
|
|
43
43
|
toErrorMessage,
|
|
44
44
|
writeFileAtomic
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-LV5FFQ7M.js";
|
|
46
46
|
|
|
47
47
|
// dist/core/extensions/item-fields.js
|
|
48
48
|
!(function() {
|
|
49
49
|
try {
|
|
50
50
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
51
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
51
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "a347b372-2690-5b65-a35c-7d2cfa3790d1");
|
|
52
52
|
} catch (e2) {
|
|
53
53
|
}
|
|
54
54
|
})();
|
|
@@ -81,9 +81,6 @@ function parseFieldAssignment(raw) {
|
|
|
81
81
|
}
|
|
82
82
|
const key = trimmed.slice(0, separatorIndex).trim();
|
|
83
83
|
const value = trimmed.slice(separatorIndex + 1);
|
|
84
|
-
if (key.length === 0) {
|
|
85
|
-
throw new PmCliError("--field entries require a non-empty field name", EXIT_CODE.USAGE);
|
|
86
|
-
}
|
|
87
84
|
return { key, value };
|
|
88
85
|
}
|
|
89
86
|
function parseJsonFieldValue(raw, fieldName, expectedType) {
|
|
@@ -253,7 +250,7 @@ import jsonPatch from "fast-json-patch";
|
|
|
253
250
|
!(function() {
|
|
254
251
|
try {
|
|
255
252
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
256
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
253
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b165ab2e-26f4-5ccd-83f4-39b5cf86c2cf");
|
|
257
254
|
} catch (e2) {
|
|
258
255
|
}
|
|
259
256
|
})();
|
|
@@ -462,7 +459,7 @@ import path2 from "node:path";
|
|
|
462
459
|
!(function() {
|
|
463
460
|
try {
|
|
464
461
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
465
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
462
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "1a8d523b-e42a-54c0-98b8-2cf802a795ef");
|
|
466
463
|
} catch (e2) {
|
|
467
464
|
}
|
|
468
465
|
})();
|
|
@@ -930,7 +927,7 @@ import path4 from "node:path";
|
|
|
930
927
|
!(function() {
|
|
931
928
|
try {
|
|
932
929
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
933
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
930
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "d6538d11-5ec9-5c34-88ab-d477e36eaf06");
|
|
934
931
|
} catch (e2) {
|
|
935
932
|
}
|
|
936
933
|
})();
|
|
@@ -1011,7 +1008,8 @@ async function listAllFrontMatterWithBody(pmRoot, preferredFormat, typeToFolder
|
|
|
1011
1008
|
const candidates = await listAllDocumentCandidatesCached(pmRoot, preferredFormat, typeToFolder, warnings, schema, { includeBody: true });
|
|
1012
1009
|
return candidates.map((candidate) => ({
|
|
1013
1010
|
...candidate.metadata,
|
|
1014
|
-
|
|
1011
|
+
// includeBody:true guarantees candidate bodies are materialized.
|
|
1012
|
+
body: candidate.body
|
|
1015
1013
|
}));
|
|
1016
1014
|
}
|
|
1017
1015
|
async function listKnownItemIds(pmRoot, typeToFolder) {
|
|
@@ -1051,7 +1049,7 @@ async function buildItemNotFoundError(pmRoot, badId, idPrefix, typeToFolder) {
|
|
|
1051
1049
|
return new PmCliError(`Item ${badId} not found`, EXIT_CODE.NOT_FOUND, { nextSteps });
|
|
1052
1050
|
}
|
|
1053
1051
|
function bypassesAssigneeConflict(op, bypassAssigneeConflict) {
|
|
1054
|
-
return op === "claim" || bypassAssigneeConflict === true && (op === "comment_add" || op === "note_add" || op === "learning_add" || op === "release" || op === "update" || op === "update_audit");
|
|
1052
|
+
return op === "claim" || bypassAssigneeConflict === true && (op === "comment_add" || op === "comment_edit" || op === "comment_delete" || op === "note_add" || op === "learning_add" || op === "release" || op === "update" || op === "update_audit");
|
|
1055
1053
|
}
|
|
1056
1054
|
async function prepareLockedItem(params) {
|
|
1057
1055
|
const typeToFolder = params.typeToFolder ?? resolveItemTypeRegistry(params.settings, getActiveExtensionRegistrations()).type_to_folder;
|
|
@@ -1363,4 +1361,4 @@ export {
|
|
|
1363
1361
|
mutateItem,
|
|
1364
1362
|
deleteItem
|
|
1365
1363
|
};
|
|
1366
|
-
//# sourceMappingURL=chunk-
|
|
1364
|
+
//# sourceMappingURL=chunk-4KBK4BA3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../core/extensions/item-fields.ts", "../../../../../../../../core/item/item-record.ts", "../../../../../../../../core/history/history.ts", "../../../../../../../../core/history/history-stream-policy.ts", "../../../../../../../../core/lock/lock.ts", "../../../../../../../../core/store/front-matter-cache.ts", "../../../../../../../../core/store/item-store.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionRegistrationRegistry } from \"./loader.js\";\nimport { normalizeItemFieldType, type KnownItemFieldType } from \"./item-field-types.js\";\nimport { EXIT_CODE, FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\n\nconst RESERVED_ITEM_FIELD_NAMES = new Set(FRONT_MATTER_KEY_ORDER);\n\nfunction normalizeFieldName(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeFieldType(value: unknown): KnownItemFieldType | null {\n if (typeof value !== \"string\") {\n return null;\n }\n return normalizeItemFieldType(value);\n}\n\nfunction cloneFieldValue<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return value;\n }\n}\n\nfunction parseFieldAssignment(raw: string): { key: string; value: string } {\n const trimmed = raw.trim();\n const separatorIndex = trimmed.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(`--field entries must use name=value syntax, received: ${raw}`, EXIT_CODE.USAGE);\n }\n // `separatorIndex > 0` guarantees a non-`=` first character on the already\n // trimmed string, so the trimmed key is always non-empty here.\n const key = trimmed.slice(0, separatorIndex).trim();\n const value = trimmed.slice(separatorIndex + 1);\n return { key, value };\n}\n\nfunction parseJsonFieldValue(raw: string, fieldName: string, expectedType: \"array\" | \"object\"): unknown {\n try {\n const parsed = JSON.parse(raw);\n if (expectedType === \"array\" && Array.isArray(parsed)) {\n return parsed;\n }\n if (expectedType === \"object\" && typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Fall through to the typed usage error below.\n }\n throw new PmCliError(`--field ${fieldName}=... must be valid JSON ${expectedType}`, EXIT_CODE.USAGE);\n}\n\nfunction coerceRegisteredFieldValue(fieldName: string, fieldType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\", raw: string): unknown {\n if (fieldType === \"string\") {\n return raw;\n }\n if (fieldType === \"number\") {\n const trimmed = raw.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n const parsed = Number(trimmed);\n if (!Number.isFinite(parsed)) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n return parsed;\n }\n if (fieldType === \"boolean\") {\n const normalized = raw.trim().toLowerCase();\n if (normalized === \"true\" || normalized === \"1\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"false\" || normalized === \"0\" || normalized === \"no\") {\n return false;\n }\n throw new PmCliError(`--field ${fieldName}=... must be one of true|false|1|0|yes|no`, EXIT_CODE.USAGE);\n }\n return parseJsonFieldValue(raw, fieldName, fieldType);\n}\n\nfunction collectRegisteredFieldDefinitions(\n registrations: ExtensionRegistrationRegistry | null,\n): Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }> {\n const definitions = new Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }>();\n if (!registrations) {\n return definitions;\n }\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n const fieldType = normalizeFieldType(definition.type);\n if (!fieldName || !fieldType) {\n continue;\n }\n const existing = definitions.get(fieldName);\n if (existing && existing.type !== fieldType) {\n throw new PmCliError(\n `Extension item field \"${fieldName}\" is declared with conflicting types: ${existing.type}, ${fieldType}`,\n EXIT_CODE.USAGE,\n {\n code: \"extension_item_field_type_conflict\",\n nextSteps: [\"Make every active extension declaration for this field use the same type.\"],\n },\n );\n }\n definitions.set(fieldName, { name: fieldName, type: fieldType });\n }\n }\n return definitions;\n}\n\nfunction assertNotReservedItemFieldName(fieldName: string): void {\n if (!RESERVED_ITEM_FIELD_NAMES.has(fieldName)) {\n return;\n }\n throw new PmCliError(`Extension item field \"${fieldName}\" collides with reserved item metadata`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_reserved\",\n nextSteps: [\"Rename the extension item field, preferably with an extension-specific prefix.\"],\n });\n}\n\nexport function collectRegisteredItemFieldNames(registrations: ExtensionRegistrationRegistry | null): string[] {\n return [...collectRegisteredFieldDefinitions(registrations).keys()].sort((left, right) => left.localeCompare(right));\n}\n\nexport function parseRegisteredItemFieldAssignments(\n rawFields: string[] | undefined,\n registrations: ExtensionRegistrationRegistry | null,\n): Record<string, unknown> {\n if (!rawFields || rawFields.length === 0) {\n return {};\n }\n const definitions = collectRegisteredFieldDefinitions(registrations);\n const values: Record<string, unknown> = {};\n for (const raw of rawFields) {\n const { key, value } = parseFieldAssignment(raw);\n const definition = definitions.get(key);\n if (!definition) {\n const known = [...definitions.keys()].sort((left, right) => left.localeCompare(right));\n throw new PmCliError(`--field ${key} is not declared by an active extension item-field registration`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_unknown\",\n recovery: { provided_fields: known },\n nextSteps: known.length > 0\n ? [`Use one of the declared fields: ${known.join(\", \")}`]\n : [\"Activate an extension that calls registerItemFields before setting extension fields.\"],\n });\n }\n assertNotReservedItemFieldName(definition.name);\n values[definition.name] = coerceRegisteredFieldValue(definition.name, definition.type, value);\n }\n return values;\n}\n\nfunction isValidFieldType(value: unknown, expectedType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\"): boolean {\n if (expectedType === \"string\") {\n return typeof value === \"string\";\n }\n if (expectedType === \"number\") {\n return typeof value === \"number\" && Number.isFinite(value);\n }\n if (expectedType === \"boolean\") {\n return typeof value === \"boolean\";\n }\n if (expectedType === \"array\") {\n return Array.isArray(value);\n }\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isAllowedFieldValue(value: unknown, allowed: unknown[] | undefined): boolean {\n if (!allowed || allowed.length === 0) {\n return true;\n }\n return allowed.some((candidate) => Object.is(candidate, value));\n}\n\nexport function applyRegisteredItemFieldDefaultsAndValidation(\n frontMatter: Record<string, unknown>,\n registrations: ExtensionRegistrationRegistry | null,\n options: { skipDefaultFields?: ReadonlySet<string> } = {},\n): void {\n if (!registrations) {\n return;\n }\n collectRegisteredFieldDefinitions(registrations);\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n if (!fieldName) {\n continue;\n }\n assertNotReservedItemFieldName(fieldName);\n if (\n !(fieldName in frontMatter) &&\n !options.skipDefaultFields?.has(fieldName) &&\n Object.prototype.hasOwnProperty.call(definition, \"default\")\n ) {\n frontMatter[fieldName] = cloneFieldValue(definition.default);\n }\n\n const currentValue = frontMatter[fieldName];\n if (currentValue === undefined) {\n continue;\n }\n const expectedType = normalizeFieldType(definition.type);\n if (expectedType && !isValidFieldType(currentValue, expectedType)) {\n throw new TypeError(`Item field \"${fieldName}\" must be of type ${expectedType}`);\n }\n\n const allowedValues = Array.isArray(definition.values) ? definition.values : undefined;\n if (!isAllowedFieldValue(currentValue, allowedValues)) {\n throw new TypeError(`Item field \"${fieldName}\" must match one of the configured allowed values`);\n }\n }\n }\n}\n", "import type { ItemMetadata } from \"../../types/index.js\";\n\n/**\n * Bridge a typed item record into the generic `Record<string, unknown>` shape\n * consumed by formatters, field projections, history canonicalization, and\n * JSON output paths.\n *\n * `ItemMetadata` carries an index signature, but the structural mismatch on its\n * concretely-typed fields means TypeScript still requires a double cast to widen\n * it. Centralizing that `as unknown as Record<string, unknown>` widening here\n * gives the type bridge a single, named, documented home instead of scattering\n * the cast across command and core modules.\n *\n * This is a compile-time-only widening: the returned value is the very same\n * object reference, with no runtime transformation. (It is intentionally\n * distinct from the runtime `asRecord*` guards in `core/shared/primitives.ts`,\n * which validate `typeof` at runtime.) `ItemFrontMatter` is an alias of\n * `ItemMetadata`, so front-matter values are accepted as-is.\n */\nexport function toItemRecord(item: ItemMetadata): Record<string, unknown> {\n return item as unknown as Record<string, unknown>;\n}\n", "import jsonPatch from \"fast-json-patch\";\nimport { FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { runActiveServiceOverride } from \"../extensions/index.js\";\nimport { appendLineAtomic } from \"../fs/fs-utils.js\";\nimport { canonicalDocument } from \"../item/item-format.js\";\nimport { toItemRecord } from \"../item/item-record.js\";\nimport { orderObject, sha256Hex, stableStringify } from \"../shared/serialization.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument } from \"../../types/index.js\";\n\nconst EMPTY_LEGACY_HASH_DOCUMENT = {\n front_matter: {},\n body: \"\",\n};\n\nfunction decodeJsonPointer(path: string): string[] {\n if (!path || path === \"/\") {\n return [];\n }\n if (!path.startsWith(\"/\")) {\n return [];\n }\n return path\n .slice(1)\n .split(\"/\")\n .map((segment) => segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n}\n\nfunction isDefinedPointerPath(document: unknown, path: string): boolean {\n const segments = decodeJsonPointer(path);\n if (segments.length === 0) {\n return true;\n }\n let cursor: unknown = document;\n for (const segment of segments) {\n if (Array.isArray(cursor)) {\n if (segment === \"-\" || !/^(0|[1-9]\\d*)$/.test(segment)) {\n return false;\n }\n const index = Number(segment);\n if (!Number.isInteger(index) || index < 0 || index >= cursor.length) {\n return false;\n }\n const next = cursor[index];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n continue;\n }\n if (typeof cursor !== \"object\" || cursor === null) {\n return false;\n }\n if (!Object.prototype.hasOwnProperty.call(cursor, segment)) {\n return false;\n }\n const next = (cursor as Record<string, unknown>)[segment];\n if (next === undefined) {\n return false;\n }\n cursor = next;\n }\n return true;\n}\n\nfunction normalizeHistoryPatchOps(\n beforeDocument: { metadata: Record<string, unknown>; body: string },\n patch: HistoryPatchOp[],\n): HistoryPatchOp[] {\n const normalized: HistoryPatchOp[] = [];\n let replayCursor: unknown = structuredClone(beforeDocument);\n for (const operation of patch) {\n const normalizedOperation =\n operation.op === \"replace\" && !isDefinedPointerPath(replayCursor, operation.path)\n ? ({ ...operation, op: \"add\" } as HistoryPatchOp)\n : operation;\n normalized.push(normalizedOperation);\n replayCursor = jsonPatch.applyPatch(\n replayCursor,\n [normalizedOperation as jsonPatch.Operation],\n true,\n true,\n ).newDocument as unknown;\n }\n return normalized;\n}\n\nfunction canonicalHashDocument(document: ItemDocument): { front_matter: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n front_matter: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedFrontMatter = orderObject(toItemRecord(canonical.metadata), FRONT_MATTER_KEY_ORDER);\n return {\n front_matter: orderedFrontMatter,\n body: canonical.body,\n };\n}\n\nfunction canonicalPatchDocument(document: ItemDocument): { metadata: Record<string, unknown>; body: string } {\n const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;\n if (!hasMetadata) {\n return {\n metadata: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n const orderedMetadata = orderObject(toItemRecord(canonical.metadata), FRONT_MATTER_KEY_ORDER);\n return {\n metadata: orderedMetadata,\n body: canonical.body,\n };\n}\n\nexport function hashDocument(document: ItemDocument): string {\n return sha256Hex(stableStringify(canonicalHashDocument(document)));\n}\n\nexport function hashEmptyDocument(): string {\n return sha256Hex(stableStringify(EMPTY_LEGACY_HASH_DOCUMENT));\n}\n\nexport function createHistoryEntry(params: {\n nowIso: string;\n author: string;\n op: string;\n before: ItemDocument;\n after: ItemDocument;\n message?: string;\n}): HistoryEntry {\n const beforeHashCanonical = canonicalHashDocument(params.before);\n const afterHashCanonical = canonicalHashDocument(params.after);\n const beforePatchCanonical = canonicalPatchDocument(params.before);\n const afterPatchCanonical = canonicalPatchDocument(params.after);\n const rawPatch = jsonPatch.compare(beforePatchCanonical, afterPatchCanonical) as HistoryPatchOp[];\n const patch = normalizeHistoryPatchOps(beforePatchCanonical, rawPatch);\n\n return {\n ts: params.nowIso,\n author: params.author,\n op: params.op,\n patch,\n before_hash: sha256Hex(stableStringify(beforeHashCanonical)),\n after_hash: sha256Hex(stableStringify(afterHashCanonical)),\n message: params.message === undefined ? undefined : params.message,\n };\n}\n\nexport async function appendHistoryEntry(historyPath: string, entry: HistoryEntry): Promise<void> {\n const override = await runActiveServiceOverride(\"history_append\", {\n history_path: historyPath,\n entry,\n });\n if (override.handled) {\n if (override.result === false) {\n return;\n }\n if (typeof override.result === \"string\") {\n await appendLineAtomic(historyPath, override.result);\n return;\n }\n if (typeof override.result === \"object\" && override.result !== null) {\n const record = override.result as {\n history_path?: unknown;\n entry?: unknown;\n line?: unknown;\n skip?: unknown;\n };\n if (record.skip === true) {\n return;\n }\n const nextHistoryPath = typeof record.history_path === \"string\" ? record.history_path : historyPath;\n if (typeof record.line === \"string\") {\n await appendLineAtomic(nextHistoryPath, record.line);\n return;\n }\n const nextEntry = (record.entry ?? entry) as HistoryEntry;\n await appendLineAtomic(nextHistoryPath, JSON.stringify(nextEntry));\n return;\n }\n }\n await appendLineAtomic(historyPath, JSON.stringify(entry));\n}\n\nexport const _testOnly = {\n decodeJsonPointer,\n isDefinedPointerPath,\n};\n", "import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runActiveOnWriteHooks } from \"../extensions/index.js\";\nimport { ensureDir, pathExists } from \"../fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { getHistoryPath } from \"../store/paths.js\";\nimport type { PmSettings } from \"../../types/index.js\";\n\ninterface HistoryStreamPolicyParams {\n pmRoot: string;\n settings: PmSettings;\n itemId: string;\n commandLabel: string;\n}\n\ninterface HistoryStreamPolicyManyParams {\n pmRoot: string;\n settings: PmSettings;\n itemIds: string[];\n commandLabel: string;\n}\n\nexport interface HistoryStreamPolicyResult {\n auto_created_ids: string[];\n warnings: string[];\n}\n\nfunction toSortedUniqueItemIds(itemIds: string[]): string[] {\n return [...new Set(itemIds.filter((value) => value.trim().length > 0))].sort((left, right) => left.localeCompare(right));\n}\n\nfunction strictMissingStreamError(itemId: string, commandLabel: string): PmCliError {\n return new PmCliError(\n `Missing history stream for ${itemId}. ${commandLabel} requires history streams when settings.history.missing_stream is strict_error.`,\n EXIT_CODE.NOT_FOUND,\n );\n}\n\nasync function createStream(historyPath: string, commandLabel: string): Promise<string[]> {\n await ensureDir(path.dirname(historyPath));\n const handle = await fs.open(historyPath, \"a\");\n await handle.close();\n return runActiveOnWriteHooks({\n path: historyPath,\n scope: \"project\",\n op: `${commandLabel}:history:auto_create`,\n });\n}\n\nexport async function enforceHistoryStreamPolicyForItem(params: HistoryStreamPolicyParams): Promise<HistoryStreamPolicyResult> {\n return enforceHistoryStreamPolicyForItems({\n pmRoot: params.pmRoot,\n settings: params.settings,\n itemIds: [params.itemId],\n commandLabel: params.commandLabel,\n });\n}\n\nexport async function enforceHistoryStreamPolicyForItems(\n params: HistoryStreamPolicyManyParams,\n): Promise<HistoryStreamPolicyResult> {\n const ids = toSortedUniqueItemIds(params.itemIds);\n const autoCreated: string[] = [];\n const warnings: string[] = [];\n\n for (const itemId of ids) {\n const historyPath = getHistoryPath(params.pmRoot, itemId);\n if (await pathExists(historyPath)) {\n continue;\n }\n if (params.settings.history.missing_stream === \"strict_error\") {\n throw strictMissingStreamError(itemId, params.commandLabel);\n }\n warnings.push(...(await createStream(historyPath, params.commandLabel)));\n warnings.push(`history_stream_auto_created:${itemId}`);\n autoCreated.push(itemId);\n }\n\n return {\n auto_created_ids: autoCreated,\n warnings,\n };\n}\n", "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, forceRequiredForStaleLock);\n }\n }\n\n throw new PmCliError(`Failed to acquire lock for ${id}`, EXIT_CODE.CONFLICT);\n}\n", "import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport { getActiveExtensionRegistrations, hasActiveOnReadHooks, runActiveOnReadHooks } from \"../extensions/index.js\";\nimport { collectRegisteredItemFieldNames } from \"../extensions/item-fields.js\";\nimport { parseItemDocument } from \"../item/item-format.js\";\nimport { writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { ITEM_FILE_EXTENSIONS, getItemFormatFromPath } from \"./paths.js\";\nimport type { ItemDocument, ItemFormat, ItemMetadata, ItemType, RuntimeSchemaSettings } from \"../../types/index.js\";\n\nconst CACHE_VERSION = 6;\nconst CACHE_FILENAME = \"metadata-cache.json\";\nconst BODY_CACHE_FILENAME = \"metadata-cache-bodies.json\";\nconst COLLECTIONS_CACHE_FILENAME = \"metadata-cache-collections.json\";\n\n/**\n * Heavy \"collection\" front-matter fields. These arrays dominate the on-disk cache\n * (e.g. a single item's comment thread can be hundreds of KB) yet the hot list path\n * (`pm list`, stats, deps, activity, calendar, close) never reads them. They are\n * stored in a separate collections cache that is parsed only when a caller opts in\n * (`includeCollections`), keeping the always-loaded light cache an order of magnitude\n * smaller and its JSON.parse correspondingly cheaper.\n */\nexport const HEAVY_METADATA_KEYS = [\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n] as const;\n\nfunction resolveActiveExtensionFieldNames(): readonly string[] {\n return collectRegisteredItemFieldNames(getActiveExtensionRegistrations());\n}\n\ninterface StatSignature {\n mtime_ms: number;\n ctime_ms: number;\n size: number;\n}\n\ninterface CachedEntry extends StatSignature {\n metadata: ItemMetadata;\n body_length: number;\n}\n\ninterface CachedBody extends StatSignature {\n body: string;\n}\n\ninterface CachedCollections extends StatSignature {\n collections: Record<string, unknown>;\n}\n\ninterface CacheEnvelope {\n version: number;\n context_fingerprint: string;\n entries: Record<string, CachedEntry>;\n}\n\ninterface BodyCacheEnvelope {\n version: number;\n context_fingerprint: string;\n bodies: Record<string, CachedBody>;\n}\n\ninterface CollectionsCacheEnvelope {\n version: number;\n context_fingerprint: string;\n collections: Record<string, CachedCollections>;\n}\n\n/**\n * Split parsed front-matter into the light scalar/small fields (everything except the\n * heavy collection arrays) and the heavy collection fields. Only keys that are actually\n * present are moved, so an item without comments stays without comments in both tiers.\n */\nfunction splitHeavyMetadata(metadata: ItemMetadata): {\n light: ItemMetadata;\n heavy: Record<string, unknown>;\n} {\n const light = { ...metadata } as Record<string, unknown>;\n const heavy: Record<string, unknown> = {};\n for (const key of HEAVY_METADATA_KEYS) {\n if (key in light) {\n heavy[key] = light[key];\n delete light[key];\n }\n }\n return { light: light as ItemMetadata, heavy };\n}\n\n/**\n * Recombine light metadata with cached heavy collection fields. Key order differs from\n * the on-disk document, but every downstream hash/serialization canonicalizes and\n * sorts keys (`stableStringify`), so the merged record is byte-identical once hashed.\n */\nfunction mergeHeavyMetadata(light: ItemMetadata, heavy: Record<string, unknown> | undefined): ItemMetadata {\n if (!heavy || Object.keys(heavy).length === 0) {\n return light;\n }\n return { ...light, ...heavy } as ItemMetadata;\n}\n\nexport interface CachedDocumentCandidate {\n metadata: ItemMetadata;\n body?: string;\n item_format: ItemFormat;\n item_path: string;\n}\n\nfunction computeContextFingerprint(\n preferredFormat: ItemFormat | undefined,\n typeToFolder: Record<string, string>,\n schema: RuntimeSchemaSettings | undefined,\n extensionFieldNames: readonly string[],\n): string {\n const hash = createHash(\"sha256\");\n hash.update(`format:${preferredFormat ?? \"default\"}`);\n const sortedTypes = Object.entries(typeToFolder)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([type, folder]) => `${type}=${folder}`)\n .join(\",\");\n hash.update(`|types:${sortedTypes}`);\n if (schema) {\n hash.update(`|schema:${JSON.stringify(schema)}`);\n }\n if (extensionFieldNames.length > 0) {\n hash.update(`|extension_fields:${extensionFieldNames.join(\",\")}`);\n }\n return hash.digest(\"hex\").slice(0, 16);\n}\n\nfunction getCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", CACHE_FILENAME);\n}\n\nfunction getBodyCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", BODY_CACHE_FILENAME);\n}\n\nfunction getCollectionsCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", COLLECTIONS_CACHE_FILENAME);\n}\n\nasync function loadCache(pmRoot: string): Promise<CacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as CacheEnvelope;\n if (parsed.version !== CACHE_VERSION || typeof parsed.entries !== \"object\" || parsed.entries === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nasync function loadBodyCache(pmRoot: string): Promise<BodyCacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getBodyCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as BodyCacheEnvelope;\n if (parsed.version !== CACHE_VERSION || typeof parsed.bodies !== \"object\" || parsed.bodies === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nasync function loadCollectionsCache(pmRoot: string): Promise<CollectionsCacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getCollectionsCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as CollectionsCacheEnvelope;\n if (parsed.version !== CACHE_VERSION || typeof parsed.collections !== \"object\" || parsed.collections === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nasync function persistCache(\n cachePath: string,\n envelope: CacheEnvelope | BodyCacheEnvelope | CollectionsCacheEnvelope,\n): Promise<void> {\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n await writeFileAtomic(cachePath, JSON.stringify(envelope));\n}\n\nfunction appendWarning(warnings: string[] | undefined, warning: string): void {\n if (warnings && !warnings.includes(warning)) {\n warnings.push(warning);\n }\n}\n\nfunction statMatches(signature: StatSignature, mtimeMs: number, ctimeMs: number, size: number): boolean {\n return signature.mtime_ms === mtimeMs && signature.ctime_ms === ctimeMs && signature.size === size;\n}\n\nexport interface ListCacheOptions {\n /**\n * When false, item bodies are neither loaded from nor written to the separate\n * body cache. Metadata-only callers (`pm list`, stats, deps, activity, …) skip\n * the large body cache entirely; only body consumers (search/reindex) pay for it.\n */\n includeBody?: boolean;\n /**\n * When false, heavy collection fields (comments/notes/learnings/files/tests/\n * test_runs/docs) are neither loaded from nor written to the separate collections\n * cache, and are absent from the returned metadata. Light-only callers (`pm list`\n * compact, stats, deps, activity, calendar, close) skip the large collections cache\n * entirely. Defaults to true so any caller that does read those fields stays correct.\n */\n includeCollections?: boolean;\n}\n\n/**\n * List all item documents using a persistent on-disk metadata cache.\n *\n * Metadata and bodies are stored in two separate cache files so the hot path\n * (`pm list` and friends, which discard bodies) never loads or rewrites the much\n * larger body payload. Each file is rewritten only when its contents actually\n * change, and per-file onRead hooks are dispatched only when an extension\n * registers one. Only files whose mtime/ctime/size changed since the last run are\n * re-parsed.\n */\nexport async function listAllDocumentCandidatesCached(\n pmRoot: string,\n preferredFormat: ItemFormat | undefined,\n typeToFolder: Record<string, string>,\n warnings: string[] | undefined,\n schema: RuntimeSchemaSettings | undefined,\n options: ListCacheOptions = {},\n): Promise<CachedDocumentCandidate[]> {\n const includeBody = options.includeBody !== false;\n const includeCollections = options.includeCollections !== false;\n const extensionFieldNames = resolveActiveExtensionFieldNames();\n const contextFingerprint = computeContextFingerprint(preferredFormat, typeToFolder, schema, extensionFieldNames);\n\n const existingCache = await loadCache(pmRoot);\n const previousEntries: Record<string, CachedEntry> =\n existingCache && existingCache.context_fingerprint === contextFingerprint ? existingCache.entries : {};\n\n const existingBodyCache = includeBody ? await loadBodyCache(pmRoot) : null;\n const previousBodies: Record<string, CachedBody> =\n existingBodyCache && existingBodyCache.context_fingerprint === contextFingerprint ? existingBodyCache.bodies : {};\n\n const existingCollectionsCache = includeCollections ? await loadCollectionsCache(pmRoot) : null;\n const previousCollections: Record<string, CachedCollections> =\n existingCollectionsCache && existingCollectionsCache.context_fingerprint === contextFingerprint\n ? existingCollectionsCache.collections\n : {};\n\n const entries = Object.entries(typeToFolder) as Array<[ItemType, string]>;\n const dirResults = await Promise.all(\n entries.map(async ([, folder]) => {\n const dirPath = path.join(pmRoot, folder);\n try {\n const files = await fs.readdir(dirPath);\n return { folder, dirPath, files };\n } catch (error: unknown) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code !== \"ENOENT\") {\n appendWarning(warnings, `item_list_directory_read_failed:${folder}`);\n }\n return { folder, dirPath, files: [] as string[] };\n }\n }),\n );\n\n const dispatchReadHooks = hasActiveOnReadHooks();\n const newEntries: Record<string, CachedEntry> = {};\n const newBodies: Record<string, CachedBody> = {};\n const newCollections: Record<string, CachedCollections> = {};\n const documentsById = new Map<string, { candidate: CachedDocumentCandidate; itemFormat: ItemFormat }>();\n let metadataMiss = false;\n let bodyMiss = false;\n let collectionsMiss = false;\n\n const parseTasks: Array<Promise<void>> = [];\n\n for (const { folder, dirPath, files } of dirResults) {\n for (const file of files) {\n if (!ITEM_FILE_EXTENSIONS.some((ext) => file.toLowerCase().endsWith(ext))) {\n continue;\n }\n const filePath = path.join(dirPath, file);\n const relativePath = path.relative(pmRoot, filePath);\n\n parseTasks.push(\n (async () => {\n try {\n const stat = await fs.stat(filePath);\n const mtimeMs = stat.mtimeMs;\n const ctimeMs = stat.ctimeMs;\n const { size } = stat;\n const itemFormat = getItemFormatFromPath(filePath) as ItemFormat;\n\n // Preserve onRead hook semantics even when served from cache, but only\n // when an extension actually observes reads. Surface hook warnings so\n // read-hook failures are not silently hidden.\n if (dispatchReadHooks) {\n for (const warning of await runActiveOnReadHooks({ path: filePath, scope: \"project\" })) {\n appendWarning(warnings, warning);\n }\n }\n\n const cachedEntry = previousEntries[relativePath];\n const metadataCached = cachedEntry !== undefined && statMatches(cachedEntry, mtimeMs, ctimeMs, size);\n const cachedBody = previousBodies[relativePath];\n const bodyCached = cachedBody !== undefined && statMatches(cachedBody, mtimeMs, ctimeMs, size);\n const cachedCollections = previousCollections[relativePath];\n const collectionsCached =\n cachedCollections !== undefined && statMatches(cachedCollections, mtimeMs, ctimeMs, size);\n\n const needRead =\n !metadataCached || (includeBody && !bodyCached) || (includeCollections && !collectionsCached);\n let lightMetadata: ItemMetadata;\n let heavyMetadata: Record<string, unknown> | undefined;\n let bodyLength: number;\n let body: string | undefined;\n\n if (needRead) {\n const raw = await fs.readFile(filePath, \"utf8\");\n const parsed = parseItemDocument(raw, {\n format: itemFormat,\n schema,\n extensionFieldNames,\n onWarning: (w) => appendWarning(warnings, w),\n });\n const split = splitHeavyMetadata(parsed.metadata);\n lightMetadata = metadataCached ? cachedEntry.metadata : split.light;\n bodyLength = metadataCached ? cachedEntry.body_length : parsed.body.length;\n body = includeBody ? parsed.body : undefined;\n if (includeCollections) {\n heavyMetadata = collectionsCached ? cachedCollections.collections : split.heavy;\n }\n if (!metadataCached) {\n metadataMiss = true;\n }\n if (includeBody && !bodyCached) {\n bodyMiss = true;\n }\n if (includeCollections && !collectionsCached) {\n collectionsMiss = true;\n }\n } else {\n lightMetadata = cachedEntry.metadata;\n bodyLength = cachedEntry.body_length;\n body = includeBody ? cachedBody.body : undefined;\n heavyMetadata = includeCollections && cachedCollections ? cachedCollections.collections : undefined;\n }\n\n newEntries[relativePath] = {\n mtime_ms: mtimeMs,\n ctime_ms: ctimeMs,\n size,\n metadata: lightMetadata,\n body_length: bodyLength,\n };\n if (includeBody && body !== undefined) {\n newBodies[relativePath] = { mtime_ms: mtimeMs, ctime_ms: ctimeMs, size, body };\n }\n if (includeCollections && heavyMetadata !== undefined) {\n newCollections[relativePath] = { mtime_ms: mtimeMs, ctime_ms: ctimeMs, size, collections: heavyMetadata };\n }\n\n const metadata = includeCollections ? mergeHeavyMetadata(lightMetadata, heavyMetadata) : lightMetadata;\n const existing = documentsById.get(metadata.id);\n const candidate: CachedDocumentCandidate = {\n metadata,\n body,\n item_format: itemFormat,\n item_path: filePath,\n };\n if (!existing) {\n documentsById.set(metadata.id, { candidate, itemFormat });\n } else {\n const shouldReplace = preferredFormat\n ? itemFormat === preferredFormat && existing.itemFormat !== preferredFormat\n : itemFormat === \"toon\" && existing.itemFormat !== \"toon\";\n if (shouldReplace) {\n documentsById.set(metadata.id, { candidate, itemFormat });\n }\n }\n } catch {\n appendWarning(warnings, `item_list_item_read_failed:${folder}/${file}`);\n }\n })(),\n );\n }\n }\n\n await Promise.all(parseTasks);\n\n // Rewrite a cache file only when its contents changed: any re-parsed (missing or\n // stale) entry, or a different set of keys (additions/deletions).\n const metadataDirty = metadataMiss || Object.keys(previousEntries).length !== Object.keys(newEntries).length;\n if (metadataDirty || existingCache === null || existingCache.context_fingerprint !== contextFingerprint) {\n await persistCache(getCachePath(pmRoot), {\n version: CACHE_VERSION,\n context_fingerprint: contextFingerprint,\n entries: newEntries,\n }).catch(() => {});\n }\n\n if (includeBody) {\n const bodyDirty = bodyMiss || Object.keys(previousBodies).length !== Object.keys(newBodies).length;\n if (bodyDirty || existingBodyCache === null || existingBodyCache.context_fingerprint !== contextFingerprint) {\n await persistCache(getBodyCachePath(pmRoot), {\n version: CACHE_VERSION,\n context_fingerprint: contextFingerprint,\n bodies: newBodies,\n }).catch(() => {});\n }\n }\n\n if (includeCollections) {\n const collectionsDirty =\n collectionsMiss || Object.keys(previousCollections).length !== Object.keys(newCollections).length;\n if (\n collectionsDirty ||\n existingCollectionsCache === null ||\n existingCollectionsCache.context_fingerprint !== contextFingerprint\n ) {\n await persistCache(getCollectionsCachePath(pmRoot), {\n version: CACHE_VERSION,\n context_fingerprint: contextFingerprint,\n collections: newCollections,\n }).catch(() => {});\n }\n }\n\n return [...documentsById.values()]\n .sort((left, right) => left.candidate.metadata.id.localeCompare(right.candidate.metadata.id))\n .map((entry) => entry.candidate);\n}\n\nexport async function listAllDocumentsCached(\n pmRoot: string,\n preferredFormat: ItemFormat | undefined,\n typeToFolder: Record<string, string>,\n warnings: string[] | undefined,\n schema: RuntimeSchemaSettings | undefined,\n): Promise<ItemDocument[]> {\n const candidates = await listAllDocumentCandidatesCached(pmRoot, preferredFormat, typeToFolder, warnings, schema, {\n includeBody: false,\n });\n return candidates.map((candidate) => ({\n metadata: candidate.metadata,\n body: candidate.body ?? \"\",\n }));\n}\n\n/**\n * Light variant of {@link listAllDocumentsCached}: returns metadata WITHOUT the heavy\n * collection fields (comments/notes/learnings/files/tests/test_runs/docs), skipping the\n * large collections cache entirely. Only safe for callers that read just the light\n * scalar/small fields (id/title/status/type/priority/parent/tags/dates/dependencies/…).\n */\nexport async function listAllDocumentsCachedLight(\n pmRoot: string,\n preferredFormat: ItemFormat | undefined,\n typeToFolder: Record<string, string>,\n warnings: string[] | undefined,\n schema: RuntimeSchemaSettings | undefined,\n): Promise<ItemDocument[]> {\n const candidates = await listAllDocumentCandidatesCached(pmRoot, preferredFormat, typeToFolder, warnings, schema, {\n includeBody: false,\n includeCollections: false,\n });\n return candidates.map((candidate) => ({\n metadata: candidate.metadata,\n body: candidate.body ?? \"\",\n }));\n}\n", "import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n getActiveExtensionRegistrations,\n projectAfterCommandItemSnapshot,\n recordAfterCommandAffectedItem,\n runActiveOnReadHooks,\n runActiveOnWriteHooks,\n runActiveServiceOverride,\n} from \"../extensions/index.js\";\nimport { collectRegisteredItemFieldNames } from \"../extensions/item-fields.js\";\nimport { EMPTY_CANONICAL_DOCUMENT, EXIT_CODE, TYPE_TO_FOLDER } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\nimport { levenshteinDistanceWithinLimit } from \"../shared/levenshtein.js\";\nimport { appendHistoryEntry, createHistoryEntry } from \"../history/history.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../history/history-stream-policy.js\";\nimport { canonicalDocument, parseItemDocument, serializeItemDocument } from \"../item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../item/type-registry.js\";\nimport { acquireLock } from \"../lock/lock.js\";\nimport { writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../item/id.js\";\nimport { listAllDocumentCandidatesCached, listAllDocumentsCached, listAllDocumentsCachedLight } from \"./front-matter-cache.js\";\nimport { getHistoryPath, getItemFormatFromPath, getItemPath, ITEM_FILE_EXTENSIONS } from \"./paths.js\";\nimport { resolveGovernanceKnobs } from \"./settings.js\";\nimport { nowIso } from \"../shared/time.js\";\nimport type { ItemDocument, ItemFormat, ItemFrontMatter, ItemType, PmSettings, RuntimeSchemaSettings } from \"../../types/index.js\";\n\nexport interface LocatedItem {\n id: string;\n type: ItemType;\n itemPath: string;\n item_format: ItemFormat;\n}\n\nasync function fileExists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\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\nfunction appendWarning(warnings: string[] | undefined, warning: string): void {\n if (!warnings) {\n return;\n }\n if (!warnings.includes(warning)) {\n warnings.push(warning);\n }\n}\n\nfunction resolveActiveExtensionFieldNames(explicit: readonly string[] | undefined): readonly string[] {\n return explicit ?? collectRegisteredItemFieldNames(getActiveExtensionRegistrations());\n}\n\nfunction resolveItemFormatSearchOrder(preferredFormat?: ItemFormat): ItemFormat[] {\n if (preferredFormat === \"toon\") {\n return [\"toon\", \"json_markdown\"];\n }\n if (preferredFormat === \"json_markdown\") {\n return [\"json_markdown\", \"toon\"];\n }\n return [\"toon\", \"json_markdown\"];\n}\n\nexport async function locateItem(\n pmRoot: string,\n rawId: string,\n idPrefix = \"pm-\",\n preferredFormat?: ItemFormat,\n typeToFolder: Record<string, string> = TYPE_TO_FOLDER,\n): Promise<LocatedItem | null> {\n const normalizedId = normalizeItemId(rawId, idPrefix);\n const rawNormalizedId = normalizeRawItemId(rawId);\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n const entries = Object.entries(typeToFolder) as Array<[ItemType, string]>;\n const searchOrder = resolveItemFormatSearchOrder(preferredFormat);\n for (const candidateId of candidateIds) {\n for (const [type] of entries) {\n for (const itemFormat of searchOrder) {\n const itemPath = getItemPath(pmRoot, type, candidateId, itemFormat, typeToFolder);\n if (await fileExists(itemPath)) {\n return {\n id: candidateId,\n type,\n itemPath,\n item_format: itemFormat,\n };\n }\n }\n }\n }\n return null;\n}\n\nexport async function readLocatedItem(\n item: LocatedItem,\n options: { schema?: RuntimeSchemaSettings; extensionFieldNames?: readonly string[]; warnings?: string[] } = {},\n): Promise<{ raw: string; document: ItemDocument }> {\n const raw = await fs.readFile(item.itemPath, \"utf8\");\n await runActiveOnReadHooks({\n path: item.itemPath,\n scope: \"project\",\n });\n const document = parseItemDocument(raw, {\n format: item.item_format,\n schema: options.schema,\n extensionFieldNames: resolveActiveExtensionFieldNames(options.extensionFieldNames),\n onWarning: (warning) => appendWarning(options.warnings, warning),\n });\n return { raw, document };\n}\n\nexport async function listAllFrontMatter(\n pmRoot: string,\n preferredFormat?: ItemFormat,\n typeToFolder: Record<string, string> = TYPE_TO_FOLDER,\n warnings?: string[],\n schema?: RuntimeSchemaSettings,\n): Promise<ItemFrontMatter[]> {\n const documents = await listAllDocumentsCached(pmRoot, preferredFormat, typeToFolder, warnings, schema);\n return documents.map((document) => document.metadata);\n}\n\n/**\n * Light variant of {@link listAllFrontMatter}: returns front-matter WITHOUT the heavy\n * collection fields (comments/notes/learnings/files/tests/test_runs/docs). Skips the\n * large collections cache so the hot list path stays cheap. Only use for callers that\n * read just the light scalar/small fields — see {@link listAllDocumentsCachedLight}.\n */\nexport async function listAllFrontMatterLight(\n pmRoot: string,\n preferredFormat?: ItemFormat,\n typeToFolder: Record<string, string> = TYPE_TO_FOLDER,\n warnings?: string[],\n schema?: RuntimeSchemaSettings,\n): Promise<ItemFrontMatter[]> {\n const documents = await listAllDocumentsCachedLight(pmRoot, preferredFormat, typeToFolder, warnings, schema);\n return documents.map((document) => document.metadata);\n}\n\nexport async function listAllFrontMatterWithBody(\n pmRoot: string,\n preferredFormat?: ItemFormat,\n typeToFolder: Record<string, string> = TYPE_TO_FOLDER,\n warnings?: string[],\n schema?: RuntimeSchemaSettings,\n): Promise<Array<ItemFrontMatter & { body: string }>> {\n const candidates = await listAllDocumentCandidatesCached(\n pmRoot,\n preferredFormat,\n typeToFolder,\n warnings,\n schema,\n { includeBody: true },\n );\n return candidates.map((candidate) => ({\n ...candidate.metadata,\n // includeBody:true guarantees candidate bodies are materialized.\n body: candidate.body!,\n }));\n}\n\nasync function listKnownItemIds(\n pmRoot: string,\n typeToFolder: Record<string, string>,\n): Promise<string[]> {\n const folders = new Set(Object.values(typeToFolder));\n const allIds: string[] = [];\n await Promise.all(\n [...folders].map(async (folder) => {\n try {\n const entries = await fs.readdir(path.join(pmRoot, folder));\n for (const entry of entries) {\n for (const ext of ITEM_FILE_EXTENSIONS) {\n if (entry.toLowerCase().endsWith(ext)) {\n allIds.push(entry.slice(0, -ext.length));\n break;\n }\n }\n }\n } catch {\n // ignore missing folders\n }\n }),\n );\n return allIds;\n}\n\nasync function buildDidYouMeanSuggestions(\n pmRoot: string,\n badId: string,\n idPrefix: string,\n typeToFolder: Record<string, string>,\n): Promise<string[]> {\n const normalized = normalizeItemId(badId, idPrefix);\n const ids = await listKnownItemIds(pmRoot, typeToFolder);\n if (ids.length === 0) return [];\n const limit = Math.max(3, Math.floor(normalized.length / 2));\n const scored = ids\n .map((id) => ({ id, distance: levenshteinDistanceWithinLimit(id, normalized, limit) }))\n .filter((entry): entry is { id: string; distance: number } => entry.distance !== null)\n .sort((left, right) => left.distance - right.distance)\n .slice(0, 3)\n .map((entry) => entry.id);\n return scored;\n}\n\nexport async function buildItemNotFoundError(\n pmRoot: string,\n badId: string,\n idPrefix: string,\n typeToFolder: Record<string, string>,\n): Promise<PmCliError> {\n const suggestions = await buildDidYouMeanSuggestions(pmRoot, badId, idPrefix, typeToFolder);\n const nextSteps: string[] = [\"Confirm the active --path/PM_PATH scope, then retry with a valid id.\"];\n if (suggestions.length > 0) {\n nextSteps.unshift(`Did you mean one of: ${suggestions.join(\", \")}?`);\n }\n return new PmCliError(`Item ${badId} not found`, EXIT_CODE.NOT_FOUND, { nextSteps });\n}\n\nfunction bypassesAssigneeConflict(\n op: string,\n bypassAssigneeConflict?: boolean,\n): boolean {\n return (\n op === \"claim\" ||\n (bypassAssigneeConflict === true &&\n (op === \"comment_add\" ||\n op === \"comment_edit\" ||\n op === \"comment_delete\" ||\n op === \"note_add\" ||\n op === \"learning_add\" ||\n op === \"release\" ||\n op === \"update\" ||\n op === \"update_audit\"))\n );\n}\n\nasync function prepareLockedItem(params: {\n pmRoot: string;\n settings: PmSettings;\n id: string;\n op: string;\n author: string;\n force?: boolean;\n bypassAssigneeConflict?: boolean;\n extensionFieldNames?: readonly string[];\n typeToFolder?: Record<string, string>;\n}): Promise<{\n typeToFolder: Record<string, string>;\n located: LocatedItem;\n originalRaw: string;\n document: ItemDocument;\n warnings: string[];\n releaseLock: () => Promise<void>;\n}> {\n const typeToFolder =\n params.typeToFolder ??\n resolveItemTypeRegistry(params.settings, getActiveExtensionRegistrations())\n .type_to_folder;\n const located = await locateItem(\n params.pmRoot,\n params.id,\n params.settings.id_prefix,\n params.settings.item_format,\n typeToFolder,\n );\n if (!located) {\n throw await buildItemNotFoundError(\n params.pmRoot,\n params.id,\n params.settings.id_prefix,\n typeToFolder,\n );\n }\n\n const releaseLock = await acquireLock(\n params.pmRoot,\n located.id,\n params.settings.locks.ttl_seconds,\n params.author,\n Boolean(params.force),\n params.settings.governance.force_required_for_stale_lock,\n );\n\n try {\n const warnings: string[] = [];\n const { raw: originalRaw, document } = await readLocatedItem(located, {\n schema: params.settings.schema,\n extensionFieldNames: params.extensionFieldNames,\n warnings,\n });\n\n const assigned = document.metadata.assignee?.trim();\n const governance = resolveGovernanceKnobs(params.settings);\n const hasOwnershipConflict =\n assigned &&\n assigned !== params.author &&\n !params.force &&\n !bypassesAssigneeConflict(params.op, params.bypassAssigneeConflict);\n if (hasOwnershipConflict) {\n if (governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${located.id} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (governance.ownership_enforcement === \"warn\") {\n warnings.push(\n `ownership_warning:assignee_conflict:${located.id}:${assigned}`,\n );\n }\n }\n\n return {\n typeToFolder,\n located,\n originalRaw,\n document,\n warnings,\n releaseLock,\n };\n } catch (error: unknown) {\n await releaseLock();\n throw error;\n }\n}\n\nexport async function mutateItem(params: {\n pmRoot: string;\n settings: PmSettings;\n id: string;\n op: string;\n author: string;\n message?: string;\n force?: boolean;\n bypassAssigneeConflict?: boolean;\n extensionFieldNames?: readonly string[];\n typeToFolder?: Record<string, string>;\n mutate: (document: ItemDocument) => {\n changedFields: string[];\n warnings?: string[];\n };\n}): Promise<{\n item: ItemFrontMatter;\n body: string;\n changedFields: string[];\n warnings: string[];\n}> {\n const prepared = await prepareLockedItem({\n pmRoot: params.pmRoot,\n settings: params.settings,\n id: params.id,\n op: params.op,\n author: params.author,\n force: params.force,\n bypassAssigneeConflict: params.bypassAssigneeConflict,\n extensionFieldNames: params.extensionFieldNames,\n typeToFolder: params.typeToFolder,\n });\n const {\n typeToFolder,\n located,\n originalRaw,\n document,\n warnings: parseWarnings,\n releaseLock,\n } = prepared;\n\n try {\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot: params.pmRoot,\n settings: params.settings,\n itemId: located.id,\n commandLabel: params.op,\n });\n\n const beforeDocument = canonicalDocument(document, {\n schema: params.settings.schema,\n extensionFieldNames: params.extensionFieldNames,\n });\n const mutableDocument = canonicalDocument(structuredClone(document), {\n schema: params.settings.schema,\n extensionFieldNames: params.extensionFieldNames,\n });\n const mutation = params.mutate(mutableDocument);\n mutableDocument.metadata.updated_at = nowIso();\n const afterDocument = canonicalDocument(mutableDocument, {\n schema: params.settings.schema,\n extensionFieldNames: params.extensionFieldNames,\n });\n const targetItemFormat: ItemFormat = \"toon\";\n const serializedAfter = serializeItemDocument(afterDocument, {\n format: targetItemFormat,\n schema: params.settings.schema,\n extensionFieldNames: params.extensionFieldNames,\n });\n const targetItemPath = getItemPath(\n params.pmRoot,\n afterDocument.metadata.type,\n located.id,\n targetItemFormat,\n typeToFolder,\n );\n const historyPath = getHistoryPath(params.pmRoot, located.id);\n const serviceWriteOverride = await runActiveServiceOverride(\"item_store_write\", {\n op: params.op,\n pm_root: params.pmRoot,\n item_id: located.id,\n source_item_path: located.itemPath,\n target_item_path: targetItemPath,\n history_path: historyPath,\n item_format: targetItemFormat,\n before: beforeDocument,\n after: afterDocument,\n contents: serializedAfter,\n });\n let effectiveTargetItemPath = targetItemPath;\n let effectiveSerializedAfter = serializedAfter;\n let skipItemWrite = false;\n if (\n serviceWriteOverride.handled &&\n typeof serviceWriteOverride.result === \"object\" &&\n serviceWriteOverride.result !== null\n ) {\n const overrideRecord = serviceWriteOverride.result as {\n target_item_path?: unknown;\n contents?: unknown;\n skip_write?: unknown;\n };\n if (typeof overrideRecord.target_item_path === \"string\" && overrideRecord.target_item_path.trim().length > 0) {\n effectiveTargetItemPath = overrideRecord.target_item_path;\n }\n if (typeof overrideRecord.contents === \"string\") {\n effectiveSerializedAfter = overrideRecord.contents;\n }\n if (overrideRecord.skip_write === true) {\n skipItemWrite = true;\n }\n }\n\n if (!skipItemWrite) {\n await writeFileAtomic(effectiveTargetItemPath, effectiveSerializedAfter);\n }\n if (!skipItemWrite && effectiveTargetItemPath !== located.itemPath) {\n await fs.rm(located.itemPath);\n }\n const entry = createHistoryEntry({\n nowIso: afterDocument.metadata.updated_at,\n author: params.author,\n op: params.op,\n before: beforeDocument,\n after: afterDocument,\n message: params.message,\n });\n\n try {\n await appendHistoryEntry(historyPath, entry);\n } catch (error: unknown) {\n if (!skipItemWrite && effectiveTargetItemPath !== located.itemPath) {\n await writeFileAtomic(located.itemPath, originalRaw);\n await fs.rm(effectiveTargetItemPath, { force: true });\n } else if (!skipItemWrite) {\n await writeFileAtomic(located.itemPath, originalRaw);\n }\n throw error;\n }\n const hookWarnings = [\n ...(await runActiveOnWriteHooks({\n path: effectiveTargetItemPath,\n scope: \"project\",\n op: params.op,\n item_id: afterDocument.metadata.id,\n item_type: afterDocument.metadata.type,\n before: beforeDocument,\n after: afterDocument,\n changed_fields: mutation.changedFields,\n })),\n ...(await runActiveOnWriteHooks({\n path: historyPath,\n scope: \"project\",\n op: `${params.op}:history`,\n item_id: afterDocument.metadata.id,\n item_type: afterDocument.metadata.type,\n before: beforeDocument,\n after: afterDocument,\n changed_fields: mutation.changedFields,\n })),\n ];\n\n recordAfterCommandAffectedItem({\n id: afterDocument.metadata.id,\n op: params.op,\n item_type: afterDocument.metadata.type,\n previous_status: beforeDocument.metadata.status,\n status: afterDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(beforeDocument.metadata, mutation.changedFields),\n current: projectAfterCommandItemSnapshot(afterDocument.metadata, mutation.changedFields),\n changed_fields: mutation.changedFields,\n });\n\n return {\n item: afterDocument.metadata,\n body: afterDocument.body,\n changedFields: mutation.changedFields,\n warnings: [\n ...parseWarnings,\n ...(mutation.warnings ?? []),\n ...historyPolicy.warnings,\n ...serviceWriteOverride.warnings,\n ...hookWarnings,\n ],\n };\n } finally {\n await releaseLock();\n }\n}\n\nexport const itemStoreTestOnly = {\n appendWarning,\n bypassesAssigneeConflict,\n buildDidYouMeanSuggestions,\n isErrno,\n};\n\nexport async function deleteItem(params: {\n pmRoot: string;\n settings: PmSettings;\n id: string;\n author: string;\n message?: string;\n force?: boolean;\n dryRun?: boolean;\n}): Promise<{ item: ItemFrontMatter; changedFields: string[]; warnings: string[]; targetPath?: string }> {\n const prepared = await prepareLockedItem({\n pmRoot: params.pmRoot,\n settings: params.settings,\n id: params.id,\n op: \"delete\",\n author: params.author,\n force: params.force,\n });\n const { located, originalRaw, document, warnings: parseWarnings, releaseLock } = prepared;\n\n try {\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot: params.pmRoot,\n settings: params.settings,\n itemId: located.id,\n commandLabel: \"delete\",\n });\n\n const beforeDocument = canonicalDocument(document, { schema: params.settings.schema });\n const deletionTimestamp = nowIso();\n const tombstoneDocument = EMPTY_CANONICAL_DOCUMENT as unknown as ItemDocument;\n const historyEntry = createHistoryEntry({\n nowIso: deletionTimestamp,\n author: params.author,\n op: \"delete\",\n before: beforeDocument,\n after: tombstoneDocument,\n message: params.message,\n });\n const historyPath = getHistoryPath(params.pmRoot, located.id);\n const serviceDeleteOverride = await runActiveServiceOverride(\"item_store_delete\", {\n op: \"delete\",\n pm_root: params.pmRoot,\n item_id: located.id,\n item_path: located.itemPath,\n history_path: historyPath,\n before: beforeDocument,\n });\n let effectiveItemPath = located.itemPath;\n let skipDelete = false;\n if (\n serviceDeleteOverride.handled &&\n typeof serviceDeleteOverride.result === \"object\" &&\n serviceDeleteOverride.result !== null\n ) {\n const overrideRecord = serviceDeleteOverride.result as {\n item_path?: unknown;\n skip_delete?: unknown;\n };\n if (typeof overrideRecord.item_path === \"string\" && overrideRecord.item_path.trim().length > 0) {\n effectiveItemPath = overrideRecord.item_path;\n }\n if (overrideRecord.skip_delete === true) {\n skipDelete = true;\n }\n }\n\n if (params.dryRun === true) {\n return {\n item: beforeDocument.metadata,\n changedFields: [\"deleted\"],\n targetPath: effectiveItemPath,\n warnings: [...parseWarnings, ...historyPolicy.warnings, ...serviceDeleteOverride.warnings],\n };\n }\n\n if (!skipDelete) {\n await fs.rm(effectiveItemPath);\n }\n try {\n await appendHistoryEntry(historyPath, historyEntry);\n } catch (error: unknown) {\n if (!skipDelete) {\n await writeFileAtomic(effectiveItemPath, originalRaw);\n }\n throw error;\n }\n\n const hookWarnings = [\n ...(await runActiveOnWriteHooks({\n path: effectiveItemPath,\n scope: \"project\",\n op: \"delete\",\n item_id: beforeDocument.metadata.id,\n item_type: beforeDocument.metadata.type,\n before: beforeDocument,\n after: tombstoneDocument,\n changed_fields: [\"deleted\"],\n })),\n ...(await runActiveOnWriteHooks({\n path: historyPath,\n scope: \"project\",\n op: \"delete:history\",\n item_id: beforeDocument.metadata.id,\n item_type: beforeDocument.metadata.type,\n before: beforeDocument,\n after: tombstoneDocument,\n changed_fields: [\"deleted\"],\n })),\n ];\n\n recordAfterCommandAffectedItem({\n id: beforeDocument.metadata.id,\n op: \"delete\",\n item_type: beforeDocument.metadata.type,\n previous_status: beforeDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(beforeDocument.metadata, Object.keys(beforeDocument.metadata)),\n changed_fields: [\"deleted\"],\n });\n\n return {\n item: beforeDocument.metadata,\n changedFields: [\"deleted\"],\n warnings: [...parseWarnings, ...historyPolicy.warnings, ...serviceDeleteOverride.warnings, ...hookWarnings],\n };\n } finally {\n await releaseLock();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,4BAA4B,IAAI,IAAI,sBAAsB;AAEhE,SAAS,mBAAmB,OAAc;AACxC,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;EACT;AACA,QAAM,aAAa,MAAM,KAAI;AAC7B,SAAO,WAAW,SAAS,IAAI,aAAa;AAC9C;AAEA,SAAS,mBAAmB,OAAc;AACxC,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;EACT;AACA,SAAO,uBAAuB,KAAK;AACrC;AAEA,SAAS,gBAAmB,OAAQ;AAClC,MAAI;AACF,WAAO,gBAAgB,KAAK;EAC9B,QAAQ;AACN,WAAO;EACT;AACF;AAEA,SAAS,qBAAqB,KAAW;AACvC,QAAM,UAAU,IAAI,KAAI;AACxB,QAAM,iBAAiB,QAAQ,QAAQ,GAAG;AAC1C,MAAI,kBAAkB,GAAG;AACvB,UAAM,IAAI,WAAW,yDAAyD,GAAG,IAAI,UAAU,KAAK;EACtG;AAGA,QAAM,MAAM,QAAQ,MAAM,GAAG,cAAc,EAAE,KAAI;AACjD,QAAM,QAAQ,QAAQ,MAAM,iBAAiB,CAAC;AAC9C,SAAO,EAAE,KAAK,MAAK;AACrB;AAEA,SAAS,oBAAoB,KAAa,WAAmB,cAAgC;AAC3F,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,GAAG;AA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AM;QACN,OAAO;QACP,IAAI;QACJ,SAAS,eAAe,SAAS;QACjC,WAAW,eAAe,SAAS;QACnC,QAAQ;QACR,OAAO;QACP,gBAAgB,CAAC,SAAS;OAC3B;MACD,GAAI,MAAM,sBAAsB;QAC9B,MAAM;QACN,OAAO;QACP,IAAI;QACJ,SAAS,eAAe,SAAS;QACjC,WAAW,eAAe,SAAS;QACnC,QAAQ;QACR,OAAO;QACP,gBAAgB,CAAC,SAAS;OAC3B;;AAGH,mCAA+B;MAC7B,IAAI,eAAe,SAAS;MAC5B,IAAI;MACJ,WAAW,eAAe,SAAS;MACnC,iBAAiB,eAAe,SAAS;MACzC,UAAU,gCAAgC,eAAe,UAAU,OAAO,KAAK,eAAe,QAAQ,CAAC;MACvG,gBAAgB,CAAC,SAAS;KAC3B;AAED,WAAO;MACL,MAAM,eAAe;MACrB,eAAe,CAAC,SAAS;MACzB,UAAU,CAAC,GAAG,eAAe,GAAG,cAAc,UAAU,GAAG,sBAAsB,UAAU,GAAG,YAAY;;EAE9G;AACE,UAAM,YAAW;EACnB;AACF;",
|
|
6
|
+
"names": ["path", "next", "fs", "path", "fs", "path", "fs", "path", "path", "fs", "fs", "path", "fs", "appendWarning", "resolveActiveExtensionFieldNames", "fs", "path", "fs"]
|
|
7
|
+
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toDefaultFolder
|
|
3
|
+
} from "./chunk-6BV7ENQL.js";
|
|
1
4
|
import {
|
|
2
5
|
BUILTIN_ITEM_TYPE_VALUES
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LV5FFQ7M.js";
|
|
4
7
|
|
|
5
8
|
// dist/core/schema/item-types-file.js
|
|
6
9
|
!(function() {
|
|
7
10
|
try {
|
|
8
11
|
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
9
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
12
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "995e9919-c166-505a-8821-d8a859a60ae8");
|
|
10
13
|
} catch (e2) {
|
|
11
14
|
}
|
|
12
15
|
})();
|
|
13
16
|
var BUILTIN_NAME_LOOKUP = new Map(BUILTIN_ITEM_TYPE_VALUES.map((name) => [name.toLowerCase(), name]));
|
|
17
|
+
var TYPE_NAME_TOKEN_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
18
|
+
function assertValidTypeToken(value, label) {
|
|
19
|
+
if (!TYPE_NAME_TOKEN_PATTERN.test(value)) {
|
|
20
|
+
throw new Error(`${label} "${value}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
14
23
|
function matchBuiltinTypeName(name) {
|
|
15
24
|
return BUILTIN_NAME_LOOKUP.get(name.trim().toLowerCase());
|
|
16
25
|
}
|
|
@@ -39,6 +48,7 @@ function normalizeAddTypeInput(raw) {
|
|
|
39
48
|
if (name.length === 0) {
|
|
40
49
|
throw new Error("Type name must not be empty.");
|
|
41
50
|
}
|
|
51
|
+
assertValidTypeToken(name, "Type name");
|
|
42
52
|
const builtinMatch = matchBuiltinTypeName(name);
|
|
43
53
|
if (builtinMatch) {
|
|
44
54
|
throw new Error(`Cannot redefine built-in item type "${builtinMatch}". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(", ")}.`);
|
|
@@ -48,6 +58,7 @@ function normalizeAddTypeInput(raw) {
|
|
|
48
58
|
const folder = raw.folder?.trim();
|
|
49
59
|
const aliases = dedupeAliases(raw.aliases ?? []);
|
|
50
60
|
for (const alias of aliases) {
|
|
61
|
+
assertValidTypeToken(alias, "Alias");
|
|
51
62
|
const aliasBuiltin = matchBuiltinTypeName(alias);
|
|
52
63
|
if (aliasBuiltin) {
|
|
53
64
|
throw new Error(`Alias "${alias}" collides with built-in item type "${aliasBuiltin}". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(", ")}.`);
|
|
@@ -90,6 +101,35 @@ function assertAliasesAvailable(input, existing) {
|
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
}
|
|
104
|
+
function resolveDefinitionFolder(name, folder) {
|
|
105
|
+
if (typeof folder === "string" && folder.trim().length > 0) {
|
|
106
|
+
return folder.trim().toLowerCase();
|
|
107
|
+
}
|
|
108
|
+
return toDefaultFolder(name).toLowerCase();
|
|
109
|
+
}
|
|
110
|
+
function assertTypeFolderAvailable(input, existing, reservedFolders) {
|
|
111
|
+
const selfLower = input.name.toLowerCase();
|
|
112
|
+
const inputFolder = resolveDefinitionFolder(input.name, input.folder);
|
|
113
|
+
const fail = (ownerName) => {
|
|
114
|
+
throw new Error(`Item type "${input.name}" would store items in folder "${inputFolder}", which already belongs to existing item type "${ownerName}". Pass a distinct --folder to keep their storage separate.`);
|
|
115
|
+
};
|
|
116
|
+
for (const definition of existing.definitions) {
|
|
117
|
+
if (typeof definition.name !== "string") {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const definitionName = definition.name.trim();
|
|
121
|
+
if (definitionName.length === 0 || definitionName.toLowerCase() === selfLower) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (resolveDefinitionFolder(definitionName, definition.folder) === inputFolder) {
|
|
125
|
+
fail(definitionName);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const reservedOwner = reservedFolders?.get(inputFolder);
|
|
129
|
+
if (reservedOwner !== void 0 && reservedOwner.toLowerCase() !== selfLower) {
|
|
130
|
+
fail(reservedOwner);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
93
133
|
function parseItemTypesFile(raw) {
|
|
94
134
|
if (raw === null || raw === void 0 || raw.trim().length === 0) {
|
|
95
135
|
return { definitions: [] };
|
|
@@ -168,7 +208,8 @@ function upsertItemType(file, input) {
|
|
|
168
208
|
return {
|
|
169
209
|
file: { definitions },
|
|
170
210
|
definition: next,
|
|
171
|
-
replaced: existingIndex >= 0
|
|
211
|
+
replaced: existingIndex >= 0,
|
|
212
|
+
...existing && typeof existing.name === "string" ? { previousName: existing.name } : {}
|
|
172
213
|
};
|
|
173
214
|
}
|
|
174
215
|
function removeItemType(file, name) {
|
|
@@ -199,18 +240,20 @@ function serializeItemTypesFile(file) {
|
|
|
199
240
|
return `${JSON.stringify({ definitions: file.definitions }, null, 2)}
|
|
200
241
|
`;
|
|
201
242
|
}
|
|
202
|
-
function buildInvalidTypeHint(name) {
|
|
243
|
+
function buildInvalidTypeHint(name, typesFilePath) {
|
|
203
244
|
const safeName = name.trim().length > 0 ? name.trim() : name;
|
|
204
|
-
|
|
245
|
+
const target = typesFilePath?.trim() || ".agents/pm/schema/types.json";
|
|
246
|
+
return `To register a custom type, run: pm schema add-type "${escapeForDoubleQuotes(safeName)}" (writes ${target}).`;
|
|
205
247
|
}
|
|
206
|
-
function buildInvalidTypeError(name, allowedTypes) {
|
|
207
|
-
return `Invalid type value "${name}". Allowed: ${allowedTypes.join(", ")}. ${buildInvalidTypeHint(name)}`;
|
|
248
|
+
function buildInvalidTypeError(name, allowedTypes, typesFilePath) {
|
|
249
|
+
return `Invalid type value "${name}". Allowed: ${allowedTypes.join(", ")}. ${buildInvalidTypeHint(name, typesFilePath)}`;
|
|
208
250
|
}
|
|
209
251
|
|
|
210
252
|
export {
|
|
211
253
|
escapeForDoubleQuotes,
|
|
212
254
|
normalizeAddTypeInput,
|
|
213
255
|
assertAliasesAvailable,
|
|
256
|
+
assertTypeFolderAvailable,
|
|
214
257
|
parseItemTypesFile,
|
|
215
258
|
upsertItemType,
|
|
216
259
|
removeItemType,
|
|
@@ -218,4 +261,4 @@ export {
|
|
|
218
261
|
buildInvalidTypeHint,
|
|
219
262
|
buildInvalidTypeError
|
|
220
263
|
};
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
264
|
+
//# sourceMappingURL=chunk-4VLB4JH2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../core/schema/item-types-file.ts"],
|
|
4
|
+
"sourcesContent": ["import { BUILTIN_ITEM_TYPE_VALUES } from \"../../types/index.js\";\nimport type { ItemTypeDefinition } from \"../../types/index.js\";\nimport { toDefaultFolder } from \"../item/type-registry.js\";\n\nexport type { ItemTypeDefinition } from \"../../types/index.js\";\n\n/**\n * Pure logic for the `pm schema add-type` command and the create/update\n * invalid-type discoverability hint. The CLI command file (schema.ts) handles\n * IO/governance; everything testable and side-effect-free lives here so it can\n * be coverage-gated to 100%.\n */\n\nconst BUILTIN_NAME_LOOKUP = new Map<string, string>(\n BUILTIN_ITEM_TYPE_VALUES.map((name) => [name.toLowerCase(), name]),\n);\n\n/**\n * The shape persisted at `.agents/pm/schema/types.json`.\n */\nexport interface ItemTypesFile {\n definitions: ItemTypeDefinition[];\n}\n\nexport interface NormalizedAddTypeInput {\n name: string;\n description?: string;\n defaultStatus?: string;\n folder?: string;\n aliases: string[];\n}\n\nexport interface RawAddTypeInput {\n name: string | undefined;\n description?: string;\n defaultStatus?: string;\n folder?: string;\n aliases?: string[];\n}\n\nexport interface UpsertItemTypeResult {\n file: ItemTypesFile;\n /** The definition as stored after the upsert (existing fields preserved). */\n definition: ItemTypeDefinition;\n /** True when an existing definition with the same (case-insensitive) name was replaced. */\n replaced: boolean;\n /**\n * The canonical name of the replaced definition (only present when `replaced`).\n * Lets the caller detect a silent recase (e.g. \"Spike\" -> \"spike\") and warn.\n */\n previousName?: string;\n}\n\n/**\n * Custom item type names (and aliases) must be a single letter-led identifier\n * token: letters, digits, hyphen, or underscore — no whitespace or other\n * punctuation. This keeps names copy-pasteable as shell arguments and folder\n * slugs deterministic, matching the single-token PascalCase shape of every\n * built-in type. Folder/slug overlap between two distinct valid tokens (e.g.\n * \"Spike\"/\"Spikes\", \"code-review\"/\"code_review\") is rejected separately by\n * assertTypeFolderAvailable.\n */\nconst TYPE_NAME_TOKEN_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/;\n\nfunction assertValidTypeToken(value: string, label: string): void {\n if (!TYPE_NAME_TOKEN_PATTERN.test(value)) {\n throw new Error(\n `${label} \"${value}\" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. \"Spike\" or \"code-review\").`,\n );\n }\n}\n\nexport interface RemoveItemTypeResult {\n file: ItemTypesFile;\n /** True when a matching definition existed and was dropped from the file. */\n removed: boolean;\n /** The removed definition, when one matched (case-insensitively) the requested name. */\n definition?: ItemTypeDefinition;\n}\n\n/**\n * Returns the canonical built-in name when `name` collides (case-insensitively)\n * with a reserved built-in item type, otherwise undefined.\n */\nexport function matchBuiltinTypeName(name: string): string | undefined {\n return BUILTIN_NAME_LOOKUP.get(name.trim().toLowerCase());\n}\n\n/**\n * Coerces a persisted `aliases` value into a string array, tolerating malformed\n * data (a non-array, or an array containing non-string entries) without throwing\n * or exploding a stray string into character aliases.\n */\nfunction coerceAliasArray(value: unknown): string[] {\n return Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === \"string\") : [];\n}\n\n/**\n * Escapes a value for safe interpolation inside a double-quoted shell string so\n * suggested copy-pasteable commands stay well-formed for names containing\n * `\"`, `` ` ``, `$`, or `\\`.\n */\nexport function escapeForDoubleQuotes(value: string): string {\n return value.replace(/[\\\\\"`$]/g, (char) => `\\\\${char}`);\n}\n\nfunction dedupeAliases(values: Iterable<string>): string[] {\n const seen = new Map<string, string>();\n for (const value of values) {\n const trimmed = value.trim();\n if (trimmed.length === 0) {\n continue;\n }\n const key = trimmed.toLowerCase();\n if (!seen.has(key)) {\n seen.set(key, trimmed);\n }\n }\n return [...seen.values()].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Validates and normalizes raw add-type CLI input. Throws a plain Error with a\n * stable message when the name is missing/empty or collides with a built-in;\n * the CLI layer maps these to PmCliError exit codes.\n */\nexport function normalizeAddTypeInput(raw: RawAddTypeInput): NormalizedAddTypeInput {\n const name = (raw.name ?? \"\").trim();\n if (name.length === 0) {\n throw new Error(\"Type name must not be empty.\");\n }\n assertValidTypeToken(name, \"Type name\");\n const builtinMatch = matchBuiltinTypeName(name);\n if (builtinMatch) {\n throw new Error(\n `Cannot redefine built-in item type \"${builtinMatch}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n const description = raw.description?.trim();\n const defaultStatus = raw.defaultStatus?.trim();\n const folder = raw.folder?.trim();\n const aliases = dedupeAliases(raw.aliases ?? []);\n for (const alias of aliases) {\n assertValidTypeToken(alias, \"Alias\");\n const aliasBuiltin = matchBuiltinTypeName(alias);\n if (aliasBuiltin) {\n throw new Error(\n `Alias \"${alias}\" collides with built-in item type \"${aliasBuiltin}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n }\n return {\n name,\n description: description && description.length > 0 ? description : undefined,\n defaultStatus: defaultStatus && defaultStatus.length > 0 ? defaultStatus : undefined,\n folder: folder && folder.length > 0 ? folder : undefined,\n aliases,\n };\n}\n\n/**\n * Throws when the requested name or any alias collides (case-insensitively)\n * with the canonical name or an alias of a DIFFERENT existing definition.\n * Such collisions would make `pm create`/`pm update --type` resolve\n * ambiguously (the runtime registry keys a single lowercase alias map), so\n * they are rejected. Tokens belonging to the same-named definition being\n * upserted are ignored, keeping re-runs idempotent.\n */\nexport function assertAliasesAvailable(input: NormalizedAddTypeInput, existing: ItemTypesFile): void {\n const selfLower = input.name.toLowerCase();\n const taken = new Map<string, string>();\n for (const definition of existing.definitions) {\n if (typeof definition.name !== \"string\") {\n continue;\n }\n const definitionName = definition.name.trim();\n if (definitionName.length === 0 || definitionName.toLowerCase() === selfLower) {\n continue;\n }\n taken.set(definitionName.toLowerCase(), definitionName);\n for (const alias of coerceAliasArray(definition.aliases)) {\n if (alias.trim().length > 0) {\n taken.set(alias.trim().toLowerCase(), definitionName);\n }\n }\n }\n const nameOwner = taken.get(selfLower);\n if (nameOwner) {\n throw new Error(`Type name \"${input.name}\" collides with an alias of existing item type \"${nameOwner}\".`);\n }\n for (const alias of input.aliases) {\n const owner = taken.get(alias.toLowerCase());\n if (owner) {\n throw new Error(`Alias \"${alias}\" already maps to existing item type \"${owner}\".`);\n }\n }\n}\n\n/**\n * Resolves the storage folder a definition would use: an explicit non-empty\n * `folder` wins, otherwise the deterministic slug derived from the name (the\n * same derivation the runtime registry applies, single-sourced from\n * type-registry.toDefaultFolder).\n */\nfunction resolveDefinitionFolder(name: string, folder: unknown): string {\n if (typeof folder === \"string\" && folder.trim().length > 0) {\n return folder.trim().toLowerCase();\n }\n return toDefaultFolder(name).toLowerCase();\n}\n\n/**\n * Throws when the requested type's storage folder would collide with a\n * DIFFERENT existing definition's folder. Two distinct type names can slug to\n * one folder (\"Spike\"/\"Spikes\", \"code-review\"/\"code_review\"), which would make\n * their item files share a directory and silently corrupt the taxonomy. The\n * same-named definition being upserted is ignored (folder reuse on re-run is\n * expected). Resolving the collision is a matter of passing a distinct\n * `--folder`, so the error says so.\n *\n * `reservedFolders` carries the folders already owned by built-in and extension\n * types (folder-slug → owner name); a custom type whose slug matches one of\n * those (e.g. \"Tasks\" → \"tasks\", owned by the built-in Task) is just as\n * corrupting as a custom-vs-custom collision, so both are checked.\n */\nexport function assertTypeFolderAvailable(\n input: NormalizedAddTypeInput,\n existing: ItemTypesFile,\n reservedFolders?: ReadonlyMap<string, string>,\n): void {\n const selfLower = input.name.toLowerCase();\n const inputFolder = resolveDefinitionFolder(input.name, input.folder);\n const fail = (ownerName: string): never => {\n throw new Error(\n `Item type \"${input.name}\" would store items in folder \"${inputFolder}\", which already belongs to existing item type \"${ownerName}\". Pass a distinct --folder to keep their storage separate.`,\n );\n };\n for (const definition of existing.definitions) {\n if (typeof definition.name !== \"string\") {\n continue;\n }\n const definitionName = definition.name.trim();\n if (definitionName.length === 0 || definitionName.toLowerCase() === selfLower) {\n continue;\n }\n if (resolveDefinitionFolder(definitionName, definition.folder) === inputFolder) {\n fail(definitionName);\n }\n }\n const reservedOwner = reservedFolders?.get(inputFolder);\n if (reservedOwner !== undefined && reservedOwner.toLowerCase() !== selfLower) {\n fail(reservedOwner);\n }\n}\n\n/**\n * Coerces an arbitrary parsed value from types.json into an ItemTypesFile.\n * Accepts the canonical `{ definitions: [...] }` shape, a bare array of\n * definitions, or a nested `{ item_types: { definitions: [...] } }` form, and\n * tolerates a missing/invalid file by returning an empty definitions list.\n */\nexport function parseItemTypesFile(raw: string | null | undefined): ItemTypesFile {\n if (raw === null || raw === undefined || raw.trim().length === 0) {\n return { definitions: [] };\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new Error(\"schema/types.json contains invalid JSON.\");\n }\n return { definitions: extractDefinitions(parsed) };\n}\n\nfunction extractDefinitions(parsed: unknown): ItemTypeDefinition[] {\n const candidate = selectDefinitionsArray(parsed);\n if (!candidate) {\n return [];\n }\n const definitions: ItemTypeDefinition[] = [];\n for (const entry of candidate) {\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) {\n continue;\n }\n const record = entry as Record<string, unknown>;\n if (typeof record.name !== \"string\" || record.name.trim().length === 0) {\n continue;\n }\n definitions.push(record as unknown as ItemTypeDefinition);\n }\n return definitions;\n}\n\nfunction selectDefinitionsArray(parsed: unknown): unknown[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.definitions)) {\n return record.definitions;\n }\n if (typeof record.item_types === \"object\" && record.item_types !== null) {\n const nested = record.item_types as Record<string, unknown>;\n if (Array.isArray(nested.definitions)) {\n return nested.definitions;\n }\n }\n return undefined;\n}\n\n/**\n * Idempotent UPSERT of a custom item type into the parsed file. Matching is\n * case-insensitive by name. When a definition already exists, fields supplied\n * in `input` override the previous values; aliases are merged (deduped); other\n * fields not addressed by add-type flags are preserved untouched.\n */\nexport function upsertItemType(file: ItemTypesFile, input: NormalizedAddTypeInput): UpsertItemTypeResult {\n const lowerName = input.name.toLowerCase();\n const definitions = file.definitions.slice();\n const existingIndex = definitions.findIndex(\n (definition) => typeof definition.name === \"string\" && definition.name.trim().toLowerCase() === lowerName,\n );\n const existing = existingIndex >= 0 ? definitions[existingIndex] : undefined;\n\n const mergedAliases = dedupeAliases([...coerceAliasArray(existing?.aliases), ...input.aliases]);\n\n const next: ItemTypeDefinition = {\n ...(existing ?? {}),\n name: input.name,\n };\n if (input.folder !== undefined) {\n next.folder = input.folder;\n }\n if (mergedAliases.length > 0) {\n next.aliases = mergedAliases;\n } else if (next.aliases !== undefined) {\n delete next.aliases;\n }\n applyAttribute(next, \"description\", input.description);\n applyAttribute(next, \"default_status\", input.defaultStatus);\n\n if (existingIndex >= 0) {\n definitions[existingIndex] = next;\n } else {\n definitions.push(next);\n }\n definitions.sort((left, right) => left.name.localeCompare(right.name));\n\n return {\n file: { definitions },\n definition: next,\n replaced: existingIndex >= 0,\n ...(existing && typeof existing.name === \"string\" ? { previousName: existing.name } : {}),\n };\n}\n\n/**\n * Removes a custom item type definition from the parsed file by name\n * (case-insensitive). Throws a plain Error when `name` is empty or collides\n * with a reserved built-in type (built-ins are not stored in the file and must\n * never be deletable). Returns `removed: false` when no matching custom\n * definition exists so the CLI layer can treat the call as an idempotent no-op.\n */\nexport function removeItemType(file: ItemTypesFile, name: string | undefined): RemoveItemTypeResult {\n const trimmed = (name ?? \"\").trim();\n if (trimmed.length === 0) {\n throw new Error(\"Type name must not be empty.\");\n }\n const builtinMatch = matchBuiltinTypeName(trimmed);\n if (builtinMatch) {\n throw new Error(\n `Cannot remove built-in item type \"${builtinMatch}\". Built-in types are reserved: ${BUILTIN_ITEM_TYPE_VALUES.join(\", \")}.`,\n );\n }\n const lowerName = trimmed.toLowerCase();\n const definitions = file.definitions.slice();\n const existingIndex = definitions.findIndex(\n (definition) => typeof definition.name === \"string\" && definition.name.trim().toLowerCase() === lowerName,\n );\n if (existingIndex < 0) {\n return { file: { definitions }, removed: false };\n }\n const [definition] = definitions.splice(existingIndex, 1);\n return { file: { definitions }, removed: true, definition };\n}\n\nfunction applyAttribute(definition: ItemTypeDefinition, key: string, value: string | undefined): void {\n const record = definition as unknown as Record<string, unknown>;\n if (value !== undefined) {\n record[key] = value;\n }\n}\n\n/**\n * Serializes the item types file with a trailing newline (matches the rest of\n * the schema scaffold files written by pm).\n */\nexport function serializeItemTypesFile(file: ItemTypesFile): string {\n return `${JSON.stringify({ definitions: file.definitions }, null, 2)}\\n`;\n}\n\n/**\n * Appends a discoverable hint to the \"Invalid type\" error so agents learn that\n * custom types exist and how to register one. Quotes are chosen so the printed\n * line is copy-pasteable as a shell command.\n */\nexport function buildInvalidTypeHint(name: string, typesFilePath?: string): string {\n const safeName = name.trim().length > 0 ? name.trim() : name;\n const target = typesFilePath?.trim() || \".agents/pm/schema/types.json\";\n return `To register a custom type, run: pm schema add-type \"${escapeForDoubleQuotes(safeName)}\" (writes ${target}).`;\n}\n\n/**\n * Builds the full invalid-type error message used by create/update: the\n * existing \"Invalid type ... Allowed: ...\" line plus the discoverable hint.\n * `typesFilePath` should be the resolved schema/types.json path for the active\n * tracker (see {@link resolveItemTypesFilePath}) so the hint reflects a custom\n * `--pm-path` instead of the hardcoded `.agents/pm` default.\n */\nexport function buildInvalidTypeError(name: string, allowedTypes: readonly string[], typesFilePath?: string): string {\n return `Invalid type value \"${name}\". Allowed: ${allowedTypes.join(\", \")}. ${buildInvalidTypeHint(name, typesFilePath)}`;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAaA,IAAM,sBAAsB,IAAI,IAC9B,yBAAyB,IAAI,CAAC,SAAS,CAAC,KAAK,YAAW,GAAI,IAAI,CAAC,CAAC;AAgDpE,IAAM,0BAA0B;AAEhC,SAAS,qBAAqB,OAAe,OAAa;AACxD,MAAI,CAA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B,MAAc,eAAsB;AACvE,QAAM,WAAW,KAAK,KAAI,EAAG,SAAS,IAAI,KAAK,KAAI,IAAK;AACxD,QAAM,SAAS,eAAe,KAAI,KAAM;AACxC,SAAO,uDAAuD,sBAAsB,QAAQ,CAAC,aAAa,MAAM;AAClH;AASM,SAAU,sBAAsB,MAAc,cAAiC,eAAsB;AACzG,SAAO,uBAAuB,IAAI,eAAe,aAAa,KAAK,IAAI,CAAC,KAAK,qBAAqB,MAAM,aAAa,CAAC;AACxH;",
|
|
6
|
+
"names": ["definition"]
|
|
7
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b983245f-0499-5725-9073-d2ebb98d9533")}catch(e){}}();
|
|
3
3
|
import {
|
|
4
4
|
resolveAuthor
|
|
5
5
|
} from "./chunk-J27KIHTG.js";
|
|
6
6
|
import {
|
|
7
7
|
readHistoryEntries
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L6FJPOT4.js";
|
|
9
9
|
import {
|
|
10
10
|
EMPTY_REPLAY_DOCUMENT,
|
|
11
11
|
normalizeReplayPatchOps,
|
|
12
12
|
replayHash,
|
|
13
13
|
toReplayDocument
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UUKORJSN.js";
|
|
15
15
|
import {
|
|
16
16
|
acquireLock,
|
|
17
17
|
appendHistoryEntry,
|
|
@@ -19,21 +19,21 @@ import {
|
|
|
19
19
|
enforceHistoryStreamPolicyForItem,
|
|
20
20
|
locateItem,
|
|
21
21
|
readLocatedItem
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7K2MXFMX.js";
|
|
23
23
|
import {
|
|
24
24
|
normalizeItemId,
|
|
25
25
|
normalizeRawItemId
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-2JEGCDYT.js";
|
|
27
27
|
import {
|
|
28
28
|
canonicalDocument,
|
|
29
29
|
serializeItemDocument
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GAVE4MYM.js";
|
|
31
31
|
import {
|
|
32
32
|
resolveItemTypeRegistry
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZONXMSVB.js";
|
|
34
34
|
import {
|
|
35
35
|
nowIso
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-G2YVUY7I.js";
|
|
37
37
|
import {
|
|
38
38
|
EXIT_CODE,
|
|
39
39
|
PmCliError,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
resolvePmRoot,
|
|
50
50
|
runActiveOnWriteHooks,
|
|
51
51
|
writeFileAtomic
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-KTVETP66.js";
|
|
53
53
|
|
|
54
54
|
// dist/cli/commands/restore.js
|
|
55
55
|
import jsonPatch from "fast-json-patch";
|
|
@@ -144,9 +144,13 @@ function applyHistoryPatch(current, patch, entryNumber, entryOp) {
|
|
|
144
144
|
const failureContext = extractPatchFailureContext(patch, error);
|
|
145
145
|
const contextTokens = [
|
|
146
146
|
`history_op=${entryOp}`,
|
|
147
|
+
/* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
|
|
147
148
|
failureContext.patchIndex !== void 0 ? `patch_index=${failureContext.patchIndex}` : null,
|
|
149
|
+
/* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
|
|
148
150
|
failureContext.op ? `op=${failureContext.op}` : null,
|
|
151
|
+
/* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
|
|
149
152
|
failureContext.path ? `path=${failureContext.path}` : null,
|
|
153
|
+
/* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
|
|
150
154
|
failureContext.from ? `from=${failureContext.from}` : null
|
|
151
155
|
].filter((token) => token !== null);
|
|
152
156
|
const reasonSuffix = failureContext.reason ? ` ${failureContext.reason}` : "";
|
|
@@ -371,10 +375,21 @@ async function runRestore(id, target, options, global) {
|
|
|
371
375
|
await releaseLock();
|
|
372
376
|
}
|
|
373
377
|
}
|
|
378
|
+
var _testOnlyRestoreCommand = {
|
|
379
|
+
applyHistoryPatch,
|
|
380
|
+
changedFields,
|
|
381
|
+
ensureMaterializedRestoreTarget,
|
|
382
|
+
ensureReplayTarget,
|
|
383
|
+
extractPatchFailureContext,
|
|
384
|
+
replayCurrentDocument,
|
|
385
|
+
replayToTarget,
|
|
386
|
+
resolveRestoreSubject
|
|
387
|
+
};
|
|
374
388
|
|
|
375
389
|
export {
|
|
376
|
-
runRestore
|
|
390
|
+
runRestore,
|
|
391
|
+
_testOnlyRestoreCommand
|
|
377
392
|
};
|
|
378
|
-
//# sourceMappingURL=chunk-
|
|
393
|
+
//# sourceMappingURL=chunk-656HPQPO.js.map
|
|
379
394
|
|
|
380
|
-
//# debugId=
|
|
395
|
+
//# debugId=b983245f-0499-5725-9073-d2ebb98d9533
|