@unbrained/pm-cli 2026.7.2 → 2026.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -3
- package/CHANGELOG.md +29 -0
- package/CONTRIBUTING.md +38 -9
- package/README.md +1 -5
- package/dist/cli/commander-usage.js +54 -41
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/activity.js +79 -57
- package/dist/cli/commands/activity.js.map +1 -1
- package/dist/cli/commands/calendar.js +3 -3
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/close-many.js +106 -65
- package/dist/cli/commands/close-many.js.map +1 -1
- package/dist/cli/commands/completion.js +231 -345
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/create.d.ts +2 -59
- package/dist/cli/commands/create.js +38 -39
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/extension/doctor.js +56 -67
- package/dist/cli/commands/extension/doctor.js.map +1 -1
- package/dist/cli/commands/extension/scaffold.js +54 -133
- package/dist/cli/commands/extension/scaffold.js.map +1 -1
- package/dist/cli/commands/extension/shared.js +21 -15
- package/dist/cli/commands/extension/shared.js.map +1 -1
- package/dist/cli/commands/files.js +3 -3
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/health.js +101 -112
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-compact.js +9 -18
- package/dist/cli/commands/history-compact.js.map +1 -1
- package/dist/cli/commands/history-repair.js +9 -19
- package/dist/cli/commands/history-repair.js.map +1 -1
- package/dist/cli/commands/init-agent-guidance.js +160 -111
- package/dist/cli/commands/init-agent-guidance.js.map +1 -1
- package/dist/cli/commands/init.js +3 -3
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/item-filter-options.d.ts +2 -0
- package/dist/cli/commands/item-filter-options.js +2 -2
- package/dist/cli/commands/item-filter-options.js.map +1 -1
- package/dist/cli/commands/mutation-command-options.d.ts +78 -0
- package/dist/cli/commands/mutation-command-options.js +10 -0
- package/dist/cli/commands/mutation-command-options.js.map +1 -0
- package/dist/cli/commands/next.js +13 -10
- package/dist/cli/commands/next.js.map +1 -1
- package/dist/cli/commands/profile.js +23 -15
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/reindex.js +3 -3
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/shared-unset-fields.d.ts +19 -0
- package/dist/cli/commands/shared-unset-fields.js +31 -2
- package/dist/cli/commands/shared-unset-fields.js.map +1 -1
- package/dist/cli/commands/update.d.ts +2 -59
- package/dist/cli/commands/update.js +26 -97
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +2 -0
- package/dist/cli/commands/validate.js +16 -4
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.js +9 -6
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-help.js +27 -19
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/help-json-payload.js +57 -49
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.js +48 -32
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +215 -213
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +368 -368
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +303 -299
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +4 -0
- package/dist/cli/registration-helpers.js +51 -56
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli-bundle/chunks/activity-IDS5GSYG.js +16 -0
- package/dist/cli-bundle/chunks/{activity-CUC4JY3U.js → activity-OENQCYZD.js} +9 -9
- package/dist/cli-bundle/chunks/{aggregate-SW5PNGCS.js → aggregate-EC4LWS3U.js} +8 -8
- package/dist/cli-bundle/chunks/{aggregate-DKUTRY6R.js → aggregate-RCB3QJJE.js} +8 -8
- package/dist/cli-bundle/chunks/{append-H32VOR2Y.js → append-ADBOI3A6.js} +8 -8
- package/dist/cli-bundle/chunks/{append-UBM632FK.js → append-XLEKVVWB.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-Q6NXOHS6.js → chunk-2LRMWMZ6.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-2227673O.js → chunk-2ONH3WG6.js} +32 -13
- package/dist/cli-bundle/chunks/{chunk-2227673O.js.map → chunk-2ONH3WG6.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-MNBPX5JS.js → chunk-2VK677OA.js} +72 -49
- package/dist/cli-bundle/chunks/chunk-2VK677OA.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-KLXF7NCC.js → chunk-3C5T3ZEO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JMK5GCK2.js → chunk-3MLQZI3H.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BTX5MIQF.js → chunk-4EVY7CQN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q6K2OACU.js → chunk-4IW7STMB.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-6YCYF2AI.js → chunk-4KPQQ42D.js} +166 -110
- package/dist/cli-bundle/chunks/chunk-4KPQQ42D.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-BVZZN2LH.js → chunk-4OXNQHKQ.js} +23 -17
- package/dist/cli-bundle/chunks/{chunk-BVZZN2LH.js.map → chunk-4OXNQHKQ.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UWKEJMZU.js → chunk-4PJYRA3V.js} +31 -12
- package/dist/cli-bundle/chunks/{chunk-UWKEJMZU.js.map → chunk-4PJYRA3V.js.map} +3 -3
- package/dist/cli-bundle/chunks/{chunk-EMPGXBUF.js → chunk-4SHME4VR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6ITZLD4T.js → chunk-5FYY76HR.js} +28 -99
- package/dist/cli-bundle/chunks/chunk-5FYY76HR.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-OTUJZKGI.js → chunk-6QY2NA2M.js} +24 -18
- package/dist/cli-bundle/chunks/{chunk-OTUJZKGI.js.map → chunk-6QY2NA2M.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-2KWL5NPW.js → chunk-6YB7HG2J.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-36UGKF4O.js → chunk-724VLYDJ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XCHUVHKU.js → chunk-75VMARGO.js} +11 -11
- package/dist/cli-bundle/chunks/chunk-75VMARGO.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-XWGEMNBR.js → chunk-7745CXNI.js} +119 -195
- package/dist/cli-bundle/chunks/chunk-7745CXNI.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-YPKFV2JR.js → chunk-7G5SUU6F.js} +76 -54
- package/dist/cli-bundle/chunks/chunk-7G5SUU6F.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-Y4NRKBFW.js → chunk-7ITQSEBL.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-W47SML5B.js → chunk-A222YWOQ.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-3LCUASYG.js → chunk-A2W3XKAD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KN3URLKS.js → chunk-AOP2EMK3.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-RM37OPYK.js → chunk-AZMPKLIA.js} +72 -49
- package/dist/cli-bundle/chunks/chunk-AZMPKLIA.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-7NSPKJUS.js → chunk-BDDYM4LH.js} +262 -252
- package/dist/cli-bundle/chunks/chunk-BDDYM4LH.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-JXAUVO6X.js → chunk-CN4OAA2G.js} +55 -20
- package/dist/cli-bundle/chunks/chunk-CN4OAA2G.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-IEEJQCZ4.js → chunk-CQFZRLXQ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-4NUOWFBT.js → chunk-CQISNF3Z.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-S62UANU7.js → chunk-D2LDM35X.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GRRG3MCT.js → chunk-DEIDJQZK.js} +57 -136
- package/dist/cli-bundle/chunks/chunk-DEIDJQZK.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-IG5JYZGU.js → chunk-DJ5S2LDY.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-A6VOGKBA.js → chunk-EB4BBEZD.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-QH3FSKRJ.js → chunk-EH23N5FX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HQTPRV4D.js → chunk-FDNJMYZB.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-K2VYLVX4.js → chunk-FMWQRMHS.js} +33 -6
- package/dist/cli-bundle/chunks/chunk-FMWQRMHS.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-N2JSWVWG.js → chunk-HL742IBM.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-3AZUFQK6.js → chunk-J4KNRDI3.js} +59 -70
- package/dist/cli-bundle/chunks/{chunk-3AZUFQK6.js.map → chunk-J4KNRDI3.js.map} +1 -1
- package/dist/cli-bundle/chunks/{chunk-66Z3X7ZG.js → chunk-JYLFF7GJ.js} +166 -110
- package/dist/cli-bundle/chunks/chunk-JYLFF7GJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-GFMSLORL.js → chunk-JZJJEJBR.js} +75 -53
- package/dist/cli-bundle/chunks/chunk-JZJJEJBR.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-7TH5NMVB.js → chunk-KKHIQOTN.js} +25 -19
- package/dist/cli-bundle/chunks/chunk-KKHIQOTN.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-5GVTFFTC.js → chunk-LLQLLAKU.js} +118 -194
- package/dist/cli-bundle/chunks/chunk-LLQLLAKU.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-KIYCOJ63.js → chunk-M34MVAOP.js} +58 -137
- package/dist/cli-bundle/chunks/chunk-M34MVAOP.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CZPVDLD2.js → chunk-M6PR5BC6.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-XEWQKDYZ.js → chunk-MTB4PRA3.js} +10 -10
- package/dist/cli-bundle/chunks/chunk-MTB4PRA3.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-MRD4T5LF.js → chunk-MZ4NH46V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AIAIXG7I.js → chunk-MZG6I2Q2.js} +39 -5
- package/dist/cli-bundle/chunks/chunk-MZG6I2Q2.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-ZNHEYCDD.js → chunk-N2LOJUBB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WJAMWAHZ.js → chunk-NGDK3KEZ.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-SYNKD3ZG.js → chunk-NHDR3UCW.js} +46 -60
- package/dist/cli-bundle/chunks/chunk-NHDR3UCW.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-2CHRYUXL.js → chunk-NHKXOMZ5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7MYWF4ZX.js → chunk-OTSP6UEX.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-UGLU6Q2I.js → chunk-PUVPC5DL.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-LTRAF2D7.js → chunk-PV5JS7MP.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KCO2EAN5.js → chunk-Q2266G4S.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-SYVUU7EK.js → chunk-Q3XVLRCJ.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-AJEBCRIY.js → chunk-QFXFKYNQ.js} +47 -61
- package/dist/cli-bundle/chunks/chunk-QFXFKYNQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-6ZMBJRDJ.js → chunk-R7EMP4JG.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-SPM2XLWI.js → chunk-SBNT6SLO.js} +22 -7
- package/dist/cli-bundle/chunks/chunk-SBNT6SLO.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-I66WE2HE.js → chunk-SL2ANJSV.js} +260 -250
- package/dist/cli-bundle/chunks/chunk-SL2ANJSV.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-U2BEEM2X.js → chunk-T5RTYLZJ.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UTSH5GWX.js → chunk-TGYDJEJH.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-H4GRLYJS.js → chunk-TO4KCIOT.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-EUKTMRN3.js → chunk-TUV7SIWZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N3QCJS4M.js → chunk-UGDONITK.js} +58 -69
- package/dist/cli-bundle/chunks/{chunk-N3QCJS4M.js.map → chunk-UGDONITK.js.map} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NRZS637N.js → chunk-UYLA5ROU.js} +56 -21
- package/dist/cli-bundle/chunks/chunk-UYLA5ROU.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-55XRYWEG.js → chunk-V655JQ5J.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-3Q2HBMTI.js → chunk-W5X3AHJN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XTHQWXVC.js → chunk-WBWRQS32.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-UT73HUPC.js → chunk-WOOB7PV7.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-5PGBHRY3.js → chunk-WSDIALO4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LRKMWUUV.js → chunk-WTXDLBSZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FFOQHGNH.js → chunk-XBIYI23P.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-7W4H4K26.js → chunk-XFO2NJY6.js} +29 -100
- package/dist/cli-bundle/chunks/chunk-XFO2NJY6.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-TPOFWBMY.js → chunk-XQCWTSLO.js} +26 -20
- package/dist/cli-bundle/chunks/chunk-XQCWTSLO.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-2ASNV4DH.js → chunk-Y2VSCQ77.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-ZNT7KEWE.js → chunk-YZR7UMZ6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YLZZ6T54.js → chunk-YZWXMDNH.js} +23 -8
- package/dist/cli-bundle/chunks/chunk-YZWXMDNH.js.map +1 -0
- package/dist/cli-bundle/chunks/{chunk-CYBDUHNO.js → chunk-ZIEGTQCY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-TTHCEV5Q.js → chunk-ZZWMJVW2.js} +4 -4
- package/dist/cli-bundle/chunks/{claim-Z7MEQCBT.js → claim-D6L33A5Y.js} +8 -8
- package/dist/cli-bundle/chunks/{claim-SENTPZBN.js → claim-YAFUTPVK.js} +8 -8
- package/dist/cli-bundle/chunks/close-KLDLHAOP.js +14 -0
- package/dist/cli-bundle/chunks/{close-424MX4CU.js → close-TGYXG7TV.js} +7 -7
- package/dist/cli-bundle/chunks/{close-many-SWY34BII.js → close-many-4QSWKCRU.js} +119 -76
- package/dist/cli-bundle/chunks/close-many-4QSWKCRU.js.map +7 -0
- package/dist/cli-bundle/chunks/{close-many-2IV4J2TR.js → close-many-SNA6LNZH.js} +120 -77
- package/dist/cli-bundle/chunks/close-many-SNA6LNZH.js.map +1 -0
- package/dist/cli-bundle/chunks/{comments-4FGNTSNV.js → comments-QC6ARR5X.js} +9 -9
- package/dist/cli-bundle/chunks/{comments-7YS5MY5X.js → comments-ZHVYGUVC.js} +9 -9
- package/dist/cli-bundle/chunks/{config-G74GISC4.js → config-O6W2EU2G.js} +7 -7
- package/dist/cli-bundle/chunks/{config-BZJKK7FZ.js → config-XQRFJXJP.js} +7 -7
- package/dist/cli-bundle/chunks/{context-LHVKJSPJ.js → context-IHE3IXN5.js} +12 -12
- package/dist/cli-bundle/chunks/{context-ZQY54JNS.js → context-WSYWBEUL.js} +12 -12
- package/dist/cli-bundle/chunks/{contracts-FIZLMP7O.js → contracts-CVBINC7C.js} +3 -3
- package/dist/cli-bundle/chunks/{contracts-CP2EZJC7.js → contracts-NLCDIZAT.js} +3 -3
- package/dist/cli-bundle/chunks/{copy-TLW7JTQT.js → copy-7MUQC44A.js} +5 -5
- package/dist/cli-bundle/chunks/{copy-GYNQQPW2.js → copy-ANWXDJVC.js} +5 -5
- package/dist/cli-bundle/chunks/create-AJ6HUR5W.js +28 -0
- package/dist/cli-bundle/chunks/{create-VSKYSOCD.js → create-JIA2IFCO.js} +12 -12
- package/dist/cli-bundle/chunks/{delete-ANTOTI2I.js → delete-5OLYWQIC.js} +5 -5
- package/dist/cli-bundle/chunks/{delete-4W5JYCEG.js → delete-INHKCIRN.js} +5 -5
- package/dist/cli-bundle/chunks/{deps-HPPE6MJN.js → deps-CCSWGZW7.js} +5 -5
- package/dist/cli-bundle/chunks/{deps-ZQZN54EZ.js → deps-IYEID3QX.js} +5 -5
- package/dist/cli-bundle/chunks/{docs-XJNYBJGE.js → docs-3XZK22WF.js} +7 -7
- package/dist/cli-bundle/chunks/{docs-RPOVFMP3.js → docs-PKO7OEIM.js} +7 -7
- package/dist/cli-bundle/chunks/{eval-RFBI5FGS.js → eval-5XYP6NMY.js} +10 -10
- package/dist/cli-bundle/chunks/{eval-DM6JBZTS.js → eval-O4WGQYDI.js} +10 -10
- package/dist/cli-bundle/chunks/{extension-TTSEFQTS.js → extension-PVGRRZZG.js} +11 -11
- package/dist/cli-bundle/chunks/{extension-B3YY4WY5.js → extension-T7JNTAAA.js} +11 -11
- package/dist/cli-bundle/chunks/{files-5D65CHGE.js → files-7IU56S6R.js} +10 -10
- package/dist/cli-bundle/chunks/files-7IU56S6R.js.map +1 -0
- package/dist/cli-bundle/chunks/{files-GPIG77EN.js → files-W7HH5EOD.js} +9 -9
- package/dist/cli-bundle/chunks/{files-GPIG77EN.js.map → files-W7HH5EOD.js.map} +1 -1
- package/dist/cli-bundle/chunks/{focus-ZHN7WIGX.js → focus-6FA5KYRY.js} +6 -6
- package/dist/cli-bundle/chunks/{focus-C3PEJV2C.js → focus-CQ63JFDG.js} +6 -6
- package/dist/cli-bundle/chunks/{gc-D4JQ6OWN.js → gc-3BG67KTO.js} +3 -3
- package/dist/cli-bundle/chunks/{gc-VZIXDL32.js → gc-PEZYGNVB.js} +3 -3
- package/dist/cli-bundle/chunks/{get-GIBRUUOP.js → get-J6CSJ4SX.js} +10 -10
- package/dist/cli-bundle/chunks/{get-IOVAN6RU.js → get-KJTKGNEQ.js} +10 -10
- package/dist/cli-bundle/chunks/{health-L2U3AFKV.js → health-32UQICEL.js} +115 -123
- package/dist/cli-bundle/chunks/health-32UQICEL.js.map +1 -0
- package/dist/cli-bundle/chunks/{health-MM7AWXYF.js → health-ZUZG5ULV.js} +114 -122
- package/dist/cli-bundle/chunks/health-ZUZG5ULV.js.map +7 -0
- package/dist/cli-bundle/chunks/history-IOH6FKG7.js +18 -0
- package/dist/cli-bundle/chunks/{history-IL7XCEX2.js → history-W6QVR6FA.js} +8 -8
- package/dist/cli-bundle/chunks/{history-compact-HALOTOU7.js → history-compact-F355EGL4.js} +20 -27
- package/dist/cli-bundle/chunks/history-compact-F355EGL4.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-compact-MV25P7DM.js → history-compact-JQ6ZGYSJ.js} +19 -26
- package/dist/cli-bundle/chunks/history-compact-JQ6ZGYSJ.js.map +7 -0
- package/dist/cli-bundle/chunks/{history-redact-VYCWQFK7.js → history-redact-TUWOUYX5.js} +9 -9
- package/dist/cli-bundle/chunks/history-redact-VVDOARNO.js +19 -0
- package/dist/cli-bundle/chunks/{history-repair-44MODPQF.js → history-repair-MPCAIKYE.js} +20 -28
- package/dist/cli-bundle/chunks/history-repair-MPCAIKYE.js.map +1 -0
- package/dist/cli-bundle/chunks/{history-repair-CPNAOCNF.js → history-repair-ZKS3LKPV.js} +19 -27
- package/dist/cli-bundle/chunks/history-repair-ZKS3LKPV.js.map +7 -0
- package/dist/cli-bundle/chunks/init-CZLEEE6Q.js +22 -0
- package/dist/cli-bundle/chunks/{init-F27NHENZ.js → init-MAA6UMNQ.js} +12 -12
- package/dist/cli-bundle/chunks/{learnings-XSFSUUWK.js → learnings-EYC3OKS2.js} +9 -9
- package/dist/cli-bundle/chunks/{learnings-HJVDQIGY.js → learnings-HKJJUVTA.js} +9 -9
- package/dist/cli-bundle/chunks/{list-VMPWTURB.js → list-HFD5737R.js} +8 -8
- package/dist/cli-bundle/chunks/{list-HPMEKCAA.js → list-KN3TL5Y5.js} +8 -8
- package/dist/cli-bundle/chunks/{next-ETXF2ZCN.js → next-DQUMFAHG.js} +25 -22
- package/dist/cli-bundle/chunks/{next-ETXF2ZCN.js.map → next-DQUMFAHG.js.map} +2 -2
- package/dist/cli-bundle/chunks/{next-QM6YJIIS.js → next-JUEYC5HE.js} +26 -23
- package/dist/cli-bundle/chunks/next-JUEYC5HE.js.map +1 -0
- package/dist/cli-bundle/chunks/{notes-WDDBPC4D.js → notes-XATYT43P.js} +9 -9
- package/dist/cli-bundle/chunks/{notes-GDZIKGR6.js → notes-ZG6RLZXB.js} +9 -9
- package/dist/cli-bundle/chunks/{plan-BGDR73Z6.js → plan-5NWQL2DH.js} +12 -12
- package/dist/cli-bundle/chunks/{plan-C5IMM335.js → plan-DVVLX7LK.js} +12 -12
- package/dist/cli-bundle/chunks/{profile-CCOKZ2IQ.js → profile-54DZ4CLB.js} +27 -19
- package/dist/cli-bundle/chunks/profile-54DZ4CLB.js.map +1 -0
- package/dist/cli-bundle/chunks/{profile-HUCENIEQ.js → profile-PLIQVEOY.js} +26 -18
- package/dist/cli-bundle/chunks/profile-PLIQVEOY.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-ROSNIL52.js → register-list-query-PNRAHNIQ.js} +181 -172
- package/dist/cli-bundle/chunks/register-list-query-PNRAHNIQ.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-list-query-XN4ZRHSV.js → register-list-query-WRS6ACUW.js} +180 -171
- package/dist/cli-bundle/chunks/register-list-query-WRS6ACUW.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-KRLAHEL2.js → register-mutation-ET6E4VLE.js} +367 -361
- package/dist/cli-bundle/chunks/register-mutation-ET6E4VLE.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-CFSB2MS3.js → register-mutation-K2MNRWGI.js} +368 -362
- package/dist/cli-bundle/chunks/register-mutation-K2MNRWGI.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-MBN4KGUM.js → register-operations-6DQRUTIX.js} +310 -305
- package/dist/cli-bundle/chunks/register-operations-6DQRUTIX.js.map +1 -0
- package/dist/cli-bundle/chunks/{register-operations-4PASGJDB.js → register-operations-73UDWMVB.js} +309 -304
- package/dist/cli-bundle/chunks/register-operations-73UDWMVB.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-setup-ZCGKHDKL.js → register-setup-FXZJ2CEJ.js} +15 -15
- package/dist/cli-bundle/chunks/{register-setup-VIAWYFP5.js → register-setup-LYYCMQFV.js} +15 -15
- package/dist/cli-bundle/chunks/restore-L27TMMCF.js +17 -0
- package/dist/cli-bundle/chunks/{restore-4CBWUMCX.js → restore-R6YJHQK3.js} +9 -9
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-6VFKNKCM.js → scheduling-shortcuts-LE4S7OI7.js} +12 -12
- package/dist/cli-bundle/chunks/{scheduling-shortcuts-ERHCVTEM.js → scheduling-shortcuts-OGODPUBL.js} +12 -12
- package/dist/cli-bundle/chunks/{schema-UE5KKAUX.js → schema-ICCD3HOP.js} +7 -7
- package/dist/cli-bundle/chunks/{schema-TDGK6N3I.js → schema-RHH23PQX.js} +7 -7
- package/dist/cli-bundle/chunks/{search-FP7MEU4S.js → search-HDDKOPFE.js} +10 -10
- package/dist/cli-bundle/chunks/{search-K4CFLQ5S.js → search-Z2VGP2Q5.js} +10 -10
- package/dist/cli-bundle/chunks/{stats-NJJCALEZ.js → stats-DHMRXHOB.js} +6 -6
- package/dist/cli-bundle/chunks/{stats-XT6QRKQY.js → stats-ETFP37MB.js} +6 -6
- package/dist/cli-bundle/chunks/{telemetry-HVXFZA2U.js → telemetry-NUZNKDCP.js} +4 -4
- package/dist/cli-bundle/chunks/{telemetry-5SQ5UDXC.js → telemetry-ZRBM22QD.js} +4 -4
- package/dist/cli-bundle/chunks/{test-UFSJ5YIO.js → test-H36PM746.js} +15 -15
- package/dist/cli-bundle/chunks/{test-YCDAUBWF.js → test-XNKTIP4Y.js} +15 -15
- package/dist/cli-bundle/chunks/{test-all-2BWKY3GQ.js → test-all-APCBSXQI.js} +17 -17
- package/dist/cli-bundle/chunks/{test-all-PM7UYN42.js → test-all-KIK3OYBY.js} +17 -17
- package/dist/cli-bundle/chunks/{test-runs-H4TGWGRN.js → test-runs-5SLLV3XU.js} +4 -4
- package/dist/cli-bundle/chunks/{test-runs-FK5E75AA.js → test-runs-L3WKLO67.js} +4 -4
- package/dist/cli-bundle/chunks/update-RQKI3AMW.js +24 -0
- package/dist/cli-bundle/chunks/{update-Y5WQVT5O.js → update-ZM7NJWHY.js} +15 -15
- package/dist/cli-bundle/chunks/{update-many-JTKKSA7Y.js → update-many-GFCQG6ZQ.js} +28 -28
- package/dist/cli-bundle/chunks/{update-many-6YAYYRLE.js → update-many-XGTJ7QIU.js} +28 -28
- package/dist/cli-bundle/chunks/{upgrade-DTAHZ236.js → upgrade-KJ3JGELR.js} +11 -11
- package/dist/cli-bundle/chunks/{upgrade-JUDU7YL4.js → upgrade-RBRQ7PQU.js} +11 -11
- package/dist/cli-bundle/chunks/{validate-732RWS5W.js → validate-EW6TGC7R.js} +31 -21
- package/dist/cli-bundle/chunks/validate-EW6TGC7R.js.map +7 -0
- package/dist/cli-bundle/chunks/{validate-W7H5TEDC.js → validate-T6PR5WAL.js} +32 -22
- package/dist/cli-bundle/chunks/validate-T6PR5WAL.js.map +1 -0
- package/dist/cli-bundle/main.js +180 -122
- package/dist/cli-bundle/main.js.map +3 -3
- package/dist/core/extensions/extension-types.d.ts +1 -2
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/extension-types.js.map +1 -1
- package/dist/core/history/history-rewrite.d.ts +10 -0
- package/dist/core/history/history-rewrite.js +27 -3
- package/dist/core/history/history-rewrite.js.map +1 -1
- package/dist/core/item/type-registry.d.ts +1 -0
- package/dist/core/item/type-registry.js +180 -194
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/schema/runtime-schema.js +65 -54
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/schema/status-defs-file.js +26 -3
- package/dist/core/schema/status-defs-file.js.map +1 -1
- package/dist/core/search/corpus.js +25 -19
- package/dist/core/search/corpus.js.map +1 -1
- package/dist/core/shared/memo.d.ts +12 -0
- package/dist/core/shared/memo.js +25 -0
- package/dist/core/shared/memo.js.map +1 -0
- package/dist/core/shared/serialization.js +24 -14
- package/dist/core/shared/serialization.js.map +1 -1
- package/dist/core/shared/time.js +26 -4
- package/dist/core/shared/time.js.map +1 -1
- package/dist/core/store/front-matter-cache.d.ts +5 -0
- package/dist/core/store/front-matter-cache.js +79 -20
- package/dist/core/store/front-matter-cache.js.map +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +73 -99
- package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +55 -94
- package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
- package/dist/sdk/compose.js +51 -42
- package/dist/sdk/compose.js.map +1 -1
- package/dist/sdk/package-import-adapters.d.ts +90 -2
- package/dist/sdk/package-import-adapters.js +274 -2
- package/dist/sdk/package-import-adapters.js.map +1 -1
- package/dist/sdk/runtime.d.ts +1 -1
- package/dist/sdk/runtime.js +3 -3
- package/dist/sdk/runtime.js.map +1 -1
- package/docs/AGENT_GUIDE.md +2 -2
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/COMMANDS.md +8 -4
- package/docs/CONFIGURATION.md +1 -1
- package/docs/EXTENSIONS.md +12 -12
- package/docs/ONBOARDING.md +4 -2
- package/docs/README.md +2 -0
- package/docs/examples/starter-extension/README.md +11 -10
- package/marketplace.json +3 -3
- package/package.json +4 -3
- package/packages/pm-beads/extensions/beads/runtime-loader.ts +27 -40
- package/packages/pm-beads/extensions/beads/runtime.ts +106 -223
- package/packages/pm-calendar/extensions/calendar/runtime.ts +21 -18
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +9 -11
- package/packages/pm-todos/extensions/todos/runtime-loader.ts +48 -76
- package/packages/pm-todos/extensions/todos/runtime.ts +61 -257
- package/plugins/pm-claude/.claude-plugin/plugin.json +2 -2
- package/plugins/pm-claude/README.md +6 -3
- package/plugins/pm-claude/commands/pm-init.md +1 -1
- package/plugins/pm-claude/scripts/pm-mcp-server.mjs +73 -31
- package/plugins/pm-codex/scripts/pm-mcp-server.mjs +80 -34
- package/scripts/install.ps1 +7 -7
- package/dist/cli-bundle/chunks/activity-WEIEMM73.js +0 -16
- package/dist/cli-bundle/chunks/chunk-5GVTFFTC.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-66Z3X7ZG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6ITZLD4T.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-6YCYF2AI.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-7NSPKJUS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-7TH5NMVB.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-7W4H4K26.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-AIAIXG7I.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-AJEBCRIY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-GFMSLORL.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-GRRG3MCT.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-I66WE2HE.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JXAUVO6X.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-K2VYLVX4.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-KIYCOJ63.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-MNBPX5JS.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-NRZS637N.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-RM37OPYK.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-SPM2XLWI.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SYNKD3ZG.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-TPOFWBMY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XCHUVHKU.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-XEWQKDYZ.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-XWGEMNBR.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-YLZZ6T54.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-YPKFV2JR.js.map +0 -1
- package/dist/cli-bundle/chunks/close-YCWQQPDS.js +0 -14
- package/dist/cli-bundle/chunks/close-many-2IV4J2TR.js.map +0 -1
- package/dist/cli-bundle/chunks/close-many-SWY34BII.js.map +0 -7
- package/dist/cli-bundle/chunks/create-XTMAPS7I.js +0 -28
- package/dist/cli-bundle/chunks/files-5D65CHGE.js.map +0 -1
- package/dist/cli-bundle/chunks/health-L2U3AFKV.js.map +0 -1
- package/dist/cli-bundle/chunks/health-MM7AWXYF.js.map +0 -7
- package/dist/cli-bundle/chunks/history-DD7L7BNL.js +0 -18
- package/dist/cli-bundle/chunks/history-compact-HALOTOU7.js.map +0 -1
- package/dist/cli-bundle/chunks/history-compact-MV25P7DM.js.map +0 -7
- package/dist/cli-bundle/chunks/history-redact-IX4YEWMY.js +0 -19
- package/dist/cli-bundle/chunks/history-repair-44MODPQF.js.map +0 -1
- package/dist/cli-bundle/chunks/history-repair-CPNAOCNF.js.map +0 -7
- package/dist/cli-bundle/chunks/init-HHVQQP6C.js +0 -22
- package/dist/cli-bundle/chunks/next-QM6YJIIS.js.map +0 -1
- package/dist/cli-bundle/chunks/profile-CCOKZ2IQ.js.map +0 -1
- package/dist/cli-bundle/chunks/profile-HUCENIEQ.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-ROSNIL52.js.map +0 -1
- package/dist/cli-bundle/chunks/register-list-query-XN4ZRHSV.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-CFSB2MS3.js.map +0 -1
- package/dist/cli-bundle/chunks/register-mutation-KRLAHEL2.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-4PASGJDB.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-MBN4KGUM.js.map +0 -1
- package/dist/cli-bundle/chunks/restore-5UEAGG3W.js +0 -17
- package/dist/cli-bundle/chunks/update-MTCFES6X.js +0 -24
- package/dist/cli-bundle/chunks/validate-732RWS5W.js.map +0 -7
- package/dist/cli-bundle/chunks/validate-W7H5TEDC.js.map +0 -1
- /package/dist/cli-bundle/chunks/{activity-WEIEMM73.js.map → activity-IDS5GSYG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-CUC4JY3U.js.map → activity-OENQCYZD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{aggregate-SW5PNGCS.js.map → aggregate-EC4LWS3U.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{aggregate-DKUTRY6R.js.map → aggregate-RCB3QJJE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-H32VOR2Y.js.map → append-ADBOI3A6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{append-UBM632FK.js.map → append-XLEKVVWB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q6NXOHS6.js.map → chunk-2LRMWMZ6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KLXF7NCC.js.map → chunk-3C5T3ZEO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JMK5GCK2.js.map → chunk-3MLQZI3H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BTX5MIQF.js.map → chunk-4EVY7CQN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Q6K2OACU.js.map → chunk-4IW7STMB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EMPGXBUF.js.map → chunk-4SHME4VR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2KWL5NPW.js.map → chunk-6YB7HG2J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-36UGKF4O.js.map → chunk-724VLYDJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Y4NRKBFW.js.map → chunk-7ITQSEBL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-W47SML5B.js.map → chunk-A222YWOQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3LCUASYG.js.map → chunk-A2W3XKAD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KN3URLKS.js.map → chunk-AOP2EMK3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IEEJQCZ4.js.map → chunk-CQFZRLXQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4NUOWFBT.js.map → chunk-CQISNF3Z.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-S62UANU7.js.map → chunk-D2LDM35X.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IG5JYZGU.js.map → chunk-DJ5S2LDY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-A6VOGKBA.js.map → chunk-EB4BBEZD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QH3FSKRJ.js.map → chunk-EH23N5FX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HQTPRV4D.js.map → chunk-FDNJMYZB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-N2JSWVWG.js.map → chunk-HL742IBM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CZPVDLD2.js.map → chunk-M6PR5BC6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MRD4T5LF.js.map → chunk-MZ4NH46V.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZNHEYCDD.js.map → chunk-N2LOJUBB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WJAMWAHZ.js.map → chunk-NGDK3KEZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2CHRYUXL.js.map → chunk-NHKXOMZ5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7MYWF4ZX.js.map → chunk-OTSP6UEX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UGLU6Q2I.js.map → chunk-PUVPC5DL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LTRAF2D7.js.map → chunk-PV5JS7MP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KCO2EAN5.js.map → chunk-Q2266G4S.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-SYVUU7EK.js.map → chunk-Q3XVLRCJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-6ZMBJRDJ.js.map → chunk-R7EMP4JG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-U2BEEM2X.js.map → chunk-T5RTYLZJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UTSH5GWX.js.map → chunk-TGYDJEJH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-H4GRLYJS.js.map → chunk-TO4KCIOT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EUKTMRN3.js.map → chunk-TUV7SIWZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-55XRYWEG.js.map → chunk-V655JQ5J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3Q2HBMTI.js.map → chunk-W5X3AHJN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-XTHQWXVC.js.map → chunk-WBWRQS32.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-UT73HUPC.js.map → chunk-WOOB7PV7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5PGBHRY3.js.map → chunk-WSDIALO4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LRKMWUUV.js.map → chunk-WTXDLBSZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FFOQHGNH.js.map → chunk-XBIYI23P.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-2ASNV4DH.js.map → chunk-Y2VSCQ77.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZNT7KEWE.js.map → chunk-YZR7UMZ6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-CYBDUHNO.js.map → chunk-ZIEGTQCY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TTHCEV5Q.js.map → chunk-ZZWMJVW2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-Z7MEQCBT.js.map → claim-D6L33A5Y.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{claim-SENTPZBN.js.map → claim-YAFUTPVK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-YCWQQPDS.js.map → close-KLDLHAOP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-424MX4CU.js.map → close-TGYXG7TV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-4FGNTSNV.js.map → comments-QC6ARR5X.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{comments-7YS5MY5X.js.map → comments-ZHVYGUVC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{config-G74GISC4.js.map → config-O6W2EU2G.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{config-BZJKK7FZ.js.map → config-XQRFJXJP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-LHVKJSPJ.js.map → context-IHE3IXN5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-ZQY54JNS.js.map → context-WSYWBEUL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{contracts-FIZLMP7O.js.map → contracts-CVBINC7C.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{contracts-CP2EZJC7.js.map → contracts-NLCDIZAT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-TLW7JTQT.js.map → copy-7MUQC44A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{copy-GYNQQPW2.js.map → copy-ANWXDJVC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-XTMAPS7I.js.map → create-AJ6HUR5W.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-VSKYSOCD.js.map → create-JIA2IFCO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-ANTOTI2I.js.map → delete-5OLYWQIC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{delete-4W5JYCEG.js.map → delete-INHKCIRN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-HPPE6MJN.js.map → deps-CCSWGZW7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{deps-ZQZN54EZ.js.map → deps-IYEID3QX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-XJNYBJGE.js.map → docs-3XZK22WF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{docs-RPOVFMP3.js.map → docs-PKO7OEIM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{eval-RFBI5FGS.js.map → eval-5XYP6NMY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{eval-DM6JBZTS.js.map → eval-O4WGQYDI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-TTSEFQTS.js.map → extension-PVGRRZZG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-B3YY4WY5.js.map → extension-T7JNTAAA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-ZHN7WIGX.js.map → focus-6FA5KYRY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{focus-C3PEJV2C.js.map → focus-CQ63JFDG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-D4JQ6OWN.js.map → gc-3BG67KTO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{gc-VZIXDL32.js.map → gc-PEZYGNVB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{get-GIBRUUOP.js.map → get-J6CSJ4SX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{get-IOVAN6RU.js.map → get-KJTKGNEQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-DD7L7BNL.js.map → history-IOH6FKG7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-IL7XCEX2.js.map → history-W6QVR6FA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-VYCWQFK7.js.map → history-redact-TUWOUYX5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-IX4YEWMY.js.map → history-redact-VVDOARNO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-HHVQQP6C.js.map → init-CZLEEE6Q.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-F27NHENZ.js.map → init-MAA6UMNQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-XSFSUUWK.js.map → learnings-EYC3OKS2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{learnings-HJVDQIGY.js.map → learnings-HKJJUVTA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-VMPWTURB.js.map → list-HFD5737R.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-HPMEKCAA.js.map → list-KN3TL5Y5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-WDDBPC4D.js.map → notes-XATYT43P.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{notes-GDZIKGR6.js.map → notes-ZG6RLZXB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-BGDR73Z6.js.map → plan-5NWQL2DH.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{plan-C5IMM335.js.map → plan-DVVLX7LK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-setup-ZCGKHDKL.js.map → register-setup-FXZJ2CEJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-setup-VIAWYFP5.js.map → register-setup-LYYCMQFV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-5UEAGG3W.js.map → restore-L27TMMCF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-4CBWUMCX.js.map → restore-R6YJHQK3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{scheduling-shortcuts-6VFKNKCM.js.map → scheduling-shortcuts-LE4S7OI7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{scheduling-shortcuts-ERHCVTEM.js.map → scheduling-shortcuts-OGODPUBL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-UE5KKAUX.js.map → schema-ICCD3HOP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-TDGK6N3I.js.map → schema-RHH23PQX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-FP7MEU4S.js.map → search-HDDKOPFE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-K4CFLQ5S.js.map → search-Z2VGP2Q5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{stats-NJJCALEZ.js.map → stats-DHMRXHOB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{stats-XT6QRKQY.js.map → stats-ETFP37MB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-HVXFZA2U.js.map → telemetry-NUZNKDCP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{telemetry-5SQ5UDXC.js.map → telemetry-ZRBM22QD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-UFSJ5YIO.js.map → test-H36PM746.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-YCDAUBWF.js.map → test-XNKTIP4Y.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-all-2BWKY3GQ.js.map → test-all-APCBSXQI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-all-PM7UYN42.js.map → test-all-KIK3OYBY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-H4TGWGRN.js.map → test-runs-5SLLV3XU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-FK5E75AA.js.map → test-runs-L3WKLO67.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-MTCFES6X.js.map → update-RQKI3AMW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-Y5WQVT5O.js.map → update-ZM7NJWHY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-JTKKSA7Y.js.map → update-many-GFCQG6ZQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-many-6YAYYRLE.js.map → update-many-XGTJ7QIU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{upgrade-DTAHZ236.js.map → upgrade-KJ3JGELR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{upgrade-JUDU7YL4.js.map → upgrade-RBRQ7PQU.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../cli/commands/profile.ts", "../../../../../../../../core/profile/profile-presets.ts", "../../../../../../../../core/profile/profile-describe.ts", "../../../../../../../../core/profile/profile-lint.ts", "../../../../../../../../core/profile/profile-plan.ts", "../../../../../../../../cli/commands/templates.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @module cli/commands/profile\n *\n * Implements the `pm profile` command surface: listing the built-in project\n * archetypes, showing a profile's full composition, and applying a profile to an\n * initialized tracker. Apply stages item types, custom statuses, custom fields,\n * per-type workflows, config knobs, and create templates idempotently, and\n * surfaces advisory package recommendations. The pure diff lives in\n * {@link module:core/profile/profile-plan}; this module is the I/O orchestration\n * and human formatting around it.\n */\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { acquireLock } from \"../../core/lock/lock.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings, resolveGovernanceKnobs, writeSettings } from \"../../core/store/settings.js\";\nimport {\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,\n filePathForSchemaSection,\n normalizeRuntimeSchemaSettings,\n} from \"../../core/schema/runtime-schema.js\";\nimport { normalizeAddTypeInput, serializeItemTypesFile } from \"../../core/schema/item-types-file.js\";\nimport { serializeStatusDefsFile } from \"../../core/schema/status-defs-file.js\";\nimport { serializeFieldsFile } from \"../../core/schema/fields-file.js\";\nimport {\n resolveNestedSettingDescriptor,\n writeNestedSettingValue,\n} from \"../../core/config/nested-settings.js\";\nimport { getActiveExtensionRegistrations, runActiveOnWriteHooks } from \"../../core/extensions/index.js\";\nimport {\n resolveProfileCatalog,\n resolveProfileEntry,\n type ExtensionProfileContribution,\n type ProfileSourceKind,\n type ProfileTemplateOptions,\n type ProjectProfileDefinition,\n type ResolveProfileEntryResult,\n} from \"../../core/profile/profile-presets.js\";\nimport {\n describeProfileComposition,\n describeProjectProfile,\n type ProjectProfileComposition,\n} from \"../../core/profile/profile-describe.js\";\nimport {\n lintProjectProfile,\n type ProjectProfileLintFinding,\n} from \"../../core/profile/profile-lint.js\";\nimport {\n planProfileApplication,\n type ProfileApplicationPlan,\n type ProfileChangeStatus,\n type ProfileCurrentState,\n} from \"../../core/profile/profile-plan.js\";\nimport { ensureTypeFolderScaffold } from \"./schema.js\";\nimport { runTemplatesSave } from \"./templates.js\";\n\n/** Ordered `pm profile` subcommands. */\nexport const PROFILE_SUBCOMMANDS = [\"list\", \"show\", \"apply\", \"lint\"] as const;\n/**\n * Restricts profile subcommand values accepted by command, SDK, and storage contracts.\n */\nexport type ProfileSubcommand = (typeof PROFILE_SUBCOMMANDS)[number];\n\nconst PROFILE_TYPES_LOCK_ID = \"schema-types\";\nconst PROFILE_STATUSES_LOCK_ID = \"schema-statuses\";\nconst PROFILE_FIELDS_LOCK_ID = \"schema-fields\";\n\n/**\n * Per-dimension counts summarizing how much a profile stages. Aliases the shared\n * {@link ProjectProfileComposition} so the CLI result shape and the core describe\n * primitive never drift.\n */\nexport type ProfileComposition = ProjectProfileComposition;\n\n/** A single profile entry in the `pm profile list` payload. */\nexport interface ProfileListEntry {\n /** Profile name. */\n name: string;\n /** Display title. */\n title: string;\n /** One-line archetype summary. */\n summary: string;\n /** Whether the profile is core-baked or contributed by an active extension. */\n source: ProfileSourceKind;\n /** Owning package/extension name for an extension profile; omitted for builtins. */\n package?: string;\n /** Per-dimension counts. */\n composition: ProfileComposition;\n}\n\n/** Result of `pm profile list`. */\nexport interface ProfileListResult {\n /** Discriminant for the profile result union. */\n action: \"list\";\n /** Built-in profiles in canonical order followed by active extension profiles. */\n profiles: ProfileListEntry[];\n /** Non-fatal merge warnings (built-in shadowing attempts, duplicate names). */\n warnings: string[];\n /** ISO timestamp the result was produced. */\n generated_at: string;\n}\n\n/** Result of `pm profile show <name>`. */\nexport interface ProfileShowResult {\n /** Discriminant for the profile result union. */\n action: \"show\";\n /** Profile name. */\n name: string;\n /** Display title. */\n title: string;\n /** One-line archetype summary. */\n summary: string;\n /** Whether the profile is core-baked or contributed by an active extension. */\n source: ProfileSourceKind;\n /** Owning package/extension name for an extension profile; omitted for builtins. */\n package?: string;\n /** Per-dimension counts. */\n composition: ProfileComposition;\n /** Item type names the profile registers. */\n types: string[];\n /** Custom status ids. */\n statuses: string[];\n /** Custom field keys. */\n fields: string[];\n /** Item types governed by a staged workflow. */\n workflows: string[];\n /** Config knobs as `key=value` pairs. */\n config: string[];\n /** Template names the profile stages. */\n templates: string[];\n /** Recommended package specs with rationale. */\n packages: Array<{ spec: string; reason: string }>;\n /** Non-fatal merge warnings (built-in shadowing attempts, duplicate names). */\n warnings: string[];\n /** ISO timestamp the result was produced. */\n generated_at: string;\n}\n\n/** Per-dimension change summary in an apply result. */\nexport interface ProfileApplyDimension {\n /** Entry keys that were newly created. */\n added: string[];\n /** Entry keys whose stored value was overwritten. */\n updated: string[];\n /** Entry keys already current (no write). */\n unchanged: string[];\n}\n\n/** Result of `pm profile apply <name>`. */\nexport interface ProfileApplyResult {\n /** Discriminant for the profile result union. */\n action: \"apply\";\n /** Applied profile name. */\n name: string;\n /** Display title. */\n title: string;\n /** True when changes were persisted; false for `--dry-run` or a no-op. */\n applied: boolean;\n /** True when `--dry-run` previewed without writing. */\n dry_run: boolean;\n /** True when at least one dimension stages an add/update. */\n changed: boolean;\n /** Item-type change summary. */\n types: ProfileApplyDimension;\n /** Status change summary. */\n statuses: ProfileApplyDimension;\n /** Field change summary. */\n fields: ProfileApplyDimension;\n /** Workflow change summary. */\n workflows: ProfileApplyDimension;\n /** Config-knob change summary. */\n config: ProfileApplyDimension;\n /** Template change summary. */\n templates: ProfileApplyDimension;\n /** Advisory package recommendations with install status. */\n packages: Array<{ spec: string; reason: string; status: \"installed\" | \"recommended\" }>;\n /** Deduped on-write hook + advisory warnings. */\n warnings: string[];\n /** ISO timestamp the result was produced. */\n generated_at: string;\n}\n\n/** Result of `pm profile lint [name]`. */\nexport interface ProfileLintResult {\n /** Discriminant for the profile result union. */\n action: \"lint\";\n /** Linted profile name. */\n name: string;\n /** Display title. */\n title: string;\n /** Whether the profile is core-baked or contributed by an active extension. */\n source: ProfileSourceKind;\n /** Owning package/extension name for an extension profile; omitted for builtins. */\n package?: string;\n /** True when the profile produced no error-severity findings. */\n ok: boolean;\n /** Count of error-severity findings. */\n error_count: number;\n /** Count of warning-severity findings. */\n warning_count: number;\n /** Every graded consistency finding in dimension order. */\n findings: ProjectProfileLintFinding[];\n /** Non-fatal catalog merge warnings (built-in shadowing attempts, duplicate names). */\n warnings: string[];\n /** ISO timestamp the result was produced. */\n generated_at: string;\n}\n\n/** Discriminated union of every `pm profile` result shape. */\nexport type ProfileResult = ProfileListResult | ProfileShowResult | ProfileApplyResult | ProfileLintResult;\n\n/* c8 ignore start -- profile command I/O orchestration and formatting is covered by profile integration workflows; the idempotent diff is unit-tested in core/profile/profile-plan. */\n\n/**\n * Collects the profiles contributed by active extensions, mapping the live\n * registration registry onto the resolver's contribution shape. Returns an empty\n * list when extensions are disabled or none registered a profile.\n */\nfunction collectExtensionProfileContributions(): ExtensionProfileContribution[] {\n const registrations = getActiveExtensionRegistrations();\n if (registrations === null) {\n return [];\n }\n return registrations.profiles.map((entry) => ({ name: entry.name, profile: entry.profile }));\n}\n\n/**\n * Lists every available profile — the built-in archetypes followed by profiles\n * contributed by active extensions — with per-dimension composition counts and\n * the source each came from. Surfaces any non-fatal merge collisions as warnings.\n */\nexport function runProfileList(): ProfileListResult {\n const { profiles, warnings } = resolveProfileCatalog(collectExtensionProfileContributions());\n return {\n action: \"list\",\n profiles: profiles.map((resolved) => ({\n name: resolved.definition.name,\n title: resolved.definition.title,\n summary: resolved.definition.summary,\n source: resolved.source,\n ...(resolved.package !== undefined ? { package: resolved.package } : {}),\n composition: describeProfileComposition(resolved.definition),\n })),\n warnings,\n generated_at: nowIso(),\n };\n}\n\n/**\n * Shows the full composition of a single profile, resolved across built-in and\n * extension-contributed archetypes. Throws a USAGE error for a missing or unknown\n * profile name.\n */\nexport function runProfileShow(name: string | undefined): ProfileShowResult {\n let entry: ResolveProfileEntryResult;\n try {\n entry = resolveProfileEntry(name, collectExtensionProfileContributions());\n } catch (error) {\n throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);\n }\n const { resolved } = entry;\n return {\n action: \"show\",\n ...describeProjectProfile(resolved.definition),\n source: resolved.source,\n ...(resolved.package !== undefined ? { package: resolved.package } : {}),\n warnings: entry.warnings,\n generated_at: nowIso(),\n };\n}\n\n/**\n * Lints a single profile, resolved across built-in and extension-contributed\n * archetypes, returning every graded consistency finding plus any catalog merge\n * warnings. Throws a USAGE error for a missing or unknown profile name. This is\n * the read-only author-time validation surface; it never writes to the tracker.\n */\nexport function runProfileLint(name: string | undefined): ProfileLintResult {\n let entry: ResolveProfileEntryResult;\n try {\n entry = resolveProfileEntry(name, collectExtensionProfileContributions());\n } catch (error) {\n throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);\n }\n const { resolved } = entry;\n const report = lintProjectProfile(resolved.definition);\n return {\n action: \"lint\",\n name: resolved.definition.name,\n title: resolved.definition.title,\n source: resolved.source,\n ...(resolved.package !== undefined ? { package: resolved.package } : {}),\n ok: report.ok,\n error_count: report.errorCount,\n warning_count: report.warningCount,\n findings: report.findings,\n warnings: entry.warnings,\n generated_at: nowIso(),\n };\n}\n\n/** Options accepted by {@link runProfileApply}. */\nexport interface ProfileApplyCommandOptions {\n /** Preview the diff without writing any files. */\n dryRun?: boolean;\n /** Mutation author override. */\n author?: string;\n /** Force ownership/lock override. */\n force?: boolean;\n}\n\nfunction templateFilePath(pmRoot: string, name: string): string {\n return path.join(pmRoot, \"templates\", `${name}.json`);\n}\n\nasync function readStoredTemplateOptions(pmRoot: string, name: string): Promise<ProfileTemplateOptions | undefined> {\n const raw = await readFileIfExists(templateFilePath(pmRoot, name));\n if (raw === null) {\n return undefined;\n }\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n const options = (parsed as { options?: unknown }).options;\n if (options !== null && typeof options === \"object\" && !Array.isArray(options)) {\n return options as ProfileTemplateOptions;\n }\n }\n } catch {\n // A malformed template file is treated as absent so apply re-stages it.\n }\n return undefined;\n}\n\nasync function loadProfileCurrentState(\n pmRoot: string,\n schema: ReturnType<typeof normalizeRuntimeSchemaSettings>,\n settings: Awaited<ReturnType<typeof readSettings>>,\n profile: ProjectProfileDefinition,\n): Promise<ProfileCurrentState> {\n const templates = new Map<string, ProfileTemplateOptions>();\n for (const template of profile.templates) {\n const stored = await readStoredTemplateOptions(pmRoot, template.name);\n if (stored !== undefined) {\n templates.set(template.name, stored);\n }\n }\n return {\n typesRaw: await readFileIfExists(filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types)),\n statusesRaw: await readFileIfExists(\n filePathForSchemaSection(pmRoot, schema.files.statuses, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses),\n ),\n fieldsRaw: await readFileIfExists(\n filePathForSchemaSection(pmRoot, schema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields),\n ),\n workflows: settings.schema.type_workflows ?? [],\n settings,\n templates,\n // Package recommendations are advisory: apply never installs and never\n // inspects install state, so every recommendation surfaces as \"recommended\".\n // The planner still supports an install-state set for SDK consumers that want\n // richer reporting.\n installedPackages: new Set<string>(),\n };\n}\n\nfunction dimensionFrom(changes: ReadonlyArray<{ key: string; status: ProfileChangeStatus }>): ProfileApplyDimension {\n const added: string[] = [];\n const updated: string[] = [];\n const unchanged: string[] = [];\n for (const change of changes) {\n (change.status === \"add\" ? added : change.status === \"update\" ? updated : unchanged).push(change.key);\n }\n return { added, updated, unchanged };\n}\n\nfunction buildApplyResult(\n profile: ProjectProfileDefinition,\n plan: ProfileApplicationPlan,\n applied: boolean,\n dryRun: boolean,\n warnings: string[],\n): ProfileApplyResult {\n return {\n action: \"apply\",\n name: profile.name,\n title: profile.title,\n applied,\n dry_run: dryRun,\n changed: plan.changed,\n types: dimensionFrom(plan.types.changes),\n statuses: dimensionFrom(plan.statuses.changes),\n fields: dimensionFrom(plan.fields.changes),\n workflows: dimensionFrom(plan.workflows.changes.map((change) => ({ key: change.type, status: change.status }))),\n config: dimensionFrom(plan.config.changes),\n templates: dimensionFrom(plan.templates.changes.map((change) => ({ key: change.name, status: change.status }))),\n packages: plan.packages,\n warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),\n generated_at: nowIso(),\n };\n}\n\nasync function assertProfileTrackerInitialized(pmRoot: string): Promise<void> {\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\nfunction resolveProfileForCommand(name: string | undefined): { profile: ProjectProfileDefinition; warnings: string[] } {\n try {\n const entry = resolveProfileEntry(name, collectExtensionProfileContributions());\n return {\n profile: entry.resolved.definition,\n warnings: entry.warnings,\n };\n } catch (error) {\n throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);\n }\n}\n\n/**\n * Applies a profile to the initialized tracker, or previews the idempotent diff\n * when `dryRun` is set. Schema files are written under their respective locks;\n * config and workflows are persisted to settings; templates are staged via the\n * shared template writer. Re-applying an already-applied profile performs zero\n * writes. Throws a USAGE error for an unknown profile or an invalid config knob,\n * and a NOT_FOUND error when the tracker is not initialized.\n */\nexport async function runProfileApply(\n name: string | undefined,\n options: ProfileApplyCommandOptions,\n global: GlobalOptions,\n): Promise<ProfileApplyResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await assertProfileTrackerInitialized(pmRoot);\n\n // Catalog-level merge warnings (e.g. an extension profile shadowed by a\n // built-in) seed the result so `apply` surfaces them the same way `list`\n // does, rather than silently swallowing them.\n const resolvedProfile = resolveProfileForCommand(name);\n const profile = resolvedProfile.profile;\n const mergeWarnings = resolvedProfile.warnings;\n\n const dryRun = options.dryRun === true;\n const settings = await readSettings(pmRoot);\n const schema = normalizeRuntimeSchemaSettings(settings.schema);\n\n if (dryRun) {\n const state = await loadProfileCurrentState(pmRoot, schema, settings, profile);\n const plan = planProfile(profile, state);\n return buildApplyResult(profile, plan, false, true, [...mergeWarnings]);\n }\n\n const author = resolveAuthor(options.author, settings.author_default);\n const governance = resolveGovernanceKnobs(settings);\n const force = Boolean(options.force);\n const warnings: string[] = [...mergeWarnings];\n\n // Acquire all three schema locks inside the try so a later acquisition that\n // throws (held/stale lock without --force) still releases the earlier ones in\n // finally rather than stranding them until TTL expiry.\n const releasers: Array<() => Promise<void>> = [];\n const acquire = async (lockId: string): Promise<void> => {\n releasers.push(\n await acquireLock(pmRoot, lockId, settings.locks.ttl_seconds, author, force, governance.force_required_for_stale_lock),\n );\n };\n let plan: ProfileApplicationPlan;\n try {\n await acquire(PROFILE_TYPES_LOCK_ID);\n await acquire(PROFILE_STATUSES_LOCK_ID);\n await acquire(PROFILE_FIELDS_LOCK_ID);\n const state = await loadProfileCurrentState(pmRoot, schema, settings, profile);\n plan = planProfile(profile, state);\n\n if (plan.types.changed) {\n const typesPath = filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);\n await writeFileAtomic(typesPath, serializeItemTypesFile(plan.types.file));\n const stagedNames = new Set(profile.types.map((type) => normalizeAddTypeInput(type).name));\n const stagedDefinitions = plan.types.file.definitions.filter((definition) => stagedNames.has(definition.name));\n await ensureTypeFolderScaffold(pmRoot, stagedDefinitions, warnings, \"profile:apply-type-folder\");\n warnings.push(...(await runActiveOnWriteHooks({ path: typesPath, scope: \"project\", op: \"profile:apply-types\" })));\n }\n if (plan.statuses.changed) {\n const statusesPath = filePathForSchemaSection(pmRoot, schema.files.statuses, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses);\n await writeFileAtomic(statusesPath, serializeStatusDefsFile(plan.statuses.file));\n warnings.push(...(await runActiveOnWriteHooks({ path: statusesPath, scope: \"project\", op: \"profile:apply-statuses\" })));\n }\n if (plan.fields.changed) {\n const fieldsPath = filePathForSchemaSection(pmRoot, schema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields);\n await writeFileAtomic(fieldsPath, serializeFieldsFile(plan.fields.file));\n warnings.push(...(await runActiveOnWriteHooks({ path: fieldsPath, scope: \"project\", op: \"profile:apply-fields\" })));\n }\n if (plan.config.changed || plan.workflows.changed) {\n for (const change of plan.config.changes) {\n if (change.status === \"unchanged\") {\n continue;\n }\n const descriptor = resolveNestedSettingDescriptor(change.key);\n if (descriptor !== undefined) {\n writeNestedSettingValue(settings as unknown as Record<string, unknown>, descriptor, change.value);\n }\n }\n settings.schema.type_workflows = plan.workflows.result;\n await writeSettings(pmRoot, settings, \"profile:apply-config\");\n }\n for (const change of plan.templates.changes) {\n if (change.status === \"unchanged\") {\n continue;\n }\n await runTemplatesSave(change.name, { ...change.options }, global);\n }\n } finally {\n // Release in reverse acquisition order; only locks actually acquired are\n // present. Each release is best-effort so one rejecting release never strands\n // the remaining locks (a failed release falls back to TTL expiry).\n for (const release of releasers.reverse()) {\n try {\n await release();\n } catch {\n // Ignore: a failed lock release is non-fatal and self-heals at TTL.\n }\n }\n }\n\n return buildApplyResult(profile, plan, plan.changed, false, warnings);\n}\n\n// planProfileApplication can throw a plain Error for an invalid config knob; map\n// it to a USAGE exit code consistently across the dry-run and apply paths.\nfunction planProfile(profile: ProjectProfileDefinition, state: ProfileCurrentState): ProfileApplicationPlan {\n try {\n return planProfileApplication(profile, state);\n } catch (error) {\n throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);\n }\n}\n\nfunction formatDimensionLine(label: string, dimension: ProfileApplyDimension): string | undefined {\n const segments: string[] = [];\n if (dimension.added.length > 0) {\n segments.push(`+${dimension.added.join(\", \")}`);\n }\n if (dimension.updated.length > 0) {\n segments.push(`~${dimension.updated.join(\", \")}`);\n }\n if (segments.length === 0) {\n return undefined;\n }\n return ` ${label}: ${segments.join(\" \")}`;\n}\n\n/**\n * Renders the `pm profile list` result as human-readable text.\n */\nexport function formatProfileListHuman(result: ProfileListResult): string {\n const lines = [\"Project profiles:\"];\n for (const profile of result.profiles) {\n const origin = profile.source === \"extension\" ? ` [${profile.package ?? \"extension\"}]` : \"\";\n lines.push(` ${profile.name} — ${profile.title}: ${profile.summary}${origin}`);\n }\n for (const warning of result.warnings) {\n lines.push(` warning: ${warning}`);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Renders the `pm profile show` result as human-readable text.\n */\nexport function formatProfileShowHuman(result: ProfileShowResult): string {\n const origin = result.source === \"extension\" ? ` [${result.package ?? \"extension\"}]` : \"\";\n const lines = [`${result.name} — ${result.title}${origin}`, result.summary, \"\"];\n lines.push(`types: ${result.types.join(\", \") || \"(none)\"}`);\n lines.push(`statuses: ${result.statuses.join(\", \") || \"(none)\"}`);\n lines.push(`fields: ${result.fields.join(\", \") || \"(none)\"}`);\n lines.push(`workflows: ${result.workflows.join(\", \") || \"(none)\"}`);\n lines.push(`config: ${result.config.join(\", \") || \"(none)\"}`);\n lines.push(`templates: ${result.templates.join(\", \") || \"(none)\"}`);\n lines.push(`packages: ${result.packages.map((pkg) => pkg.spec).join(\", \") || \"(none)\"}`);\n for (const warning of result.warnings) {\n lines.push(`warning: ${warning}`);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Renders the `pm profile lint` result as human-readable text: a one-line verdict\n * followed by each finding prefixed with its severity, code, and dimension.\n */\nexport function formatProfileLintHuman(result: ProfileLintResult): string {\n const origin = result.source === \"extension\" ? ` [${result.package ?? \"extension\"}]` : \"\";\n // Catalog merge warnings are rendered below alongside lint-finding warnings, so\n // fold them into the headline count to avoid an \"ok (0 warnings)\" verdict that\n // is immediately followed by `warning:` lines.\n const totalWarningCount = result.warning_count + result.warnings.length;\n const verdict = result.ok\n ? `Profile ${result.name}${origin}: ok (${totalWarningCount} warning${totalWarningCount === 1 ? \"\" : \"s\"})`\n : `Profile ${result.name}${origin}: ${result.error_count} error${result.error_count === 1 ? \"\" : \"s\"}, ${totalWarningCount} warning${totalWarningCount === 1 ? \"\" : \"s\"}`;\n const lines = [verdict];\n for (const finding of result.findings) {\n const target = finding.target !== undefined ? ` (${finding.target})` : \"\";\n lines.push(` ${finding.severity} [${finding.code}] ${finding.dimension}${target}: ${finding.message}`);\n }\n for (const warning of result.warnings) {\n lines.push(` warning: ${warning}`);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Renders the `pm profile apply` result as human-readable text, including the\n * staged diff and any package recommendations.\n */\nexport function formatProfileApplyHuman(result: ProfileApplyResult): string {\n const mode = result.dry_run ? \"dry-run\" : result.applied ? \"applied\" : \"no changes\";\n const lines = [`Profile ${result.name} (${mode})`];\n if (!result.changed) {\n lines.push(\" already up to date\");\n } else {\n for (const [label, dimension] of [\n [\"types\", result.types],\n [\"statuses\", result.statuses],\n [\"fields\", result.fields],\n [\"workflows\", result.workflows],\n [\"config\", result.config],\n [\"templates\", result.templates],\n ] as const) {\n const line = formatDimensionLine(label, dimension);\n if (line !== undefined) {\n lines.push(line);\n }\n }\n }\n const recommended = result.packages.filter((pkg) => pkg.status === \"recommended\");\n if (recommended.length > 0) {\n lines.push(` recommended packages: ${recommended.map((pkg) => pkg.spec).join(\", \")}`);\n }\n for (const warning of result.warnings) {\n lines.push(` warning: ${warning}`);\n }\n return lines.join(\"\\n\");\n}\n\n/* c8 ignore stop */\n", "/**\n * @module core/profile/profile-presets\n *\n * Defines the project-profile model and the first-party archetype presets that\n * compose the existing schema, config, template, and package primitives into a\n * single declarative bundle. A profile is a higher-level customization unit than\n * a {@link TYPE_PRESET_DEFINITIONS type preset}: where a type preset only stages\n * item types, a profile stages item types, custom statuses, custom fields,\n * per-type workflows, configuration knobs, create templates, and recommended\n * packages so a fresh tracker can be tailored to an archetype (agile delivery,\n * operations, or research) in one idempotent `pm profile apply` invocation.\n *\n * The raw type definitions are shared verbatim with {@link TYPE_PRESET_DEFINITIONS}\n * so `pm profile apply agile` registers byte-identical item types to\n * `pm init --type-preset agile` and `pm schema apply-preset agile`. Everything in\n * this module is pure data plus name normalization; the planning and apply logic\n * lives in {@link module:core/profile/profile-plan} and `cli/commands/profile`.\n */\nimport type { RawAddTypeInput } from \"../schema/item-types-file.js\";\nimport type { RawAddStatusInput } from \"../schema/status-defs-file.js\";\nimport type { RawAddFieldInput } from \"../schema/fields-file.js\";\nimport type { TypeWorkflowDefinition } from \"../../types.js\";\nimport { TYPE_PRESET_DEFINITIONS } from \"../schema/type-presets.js\";\n\n/**\n * Repeatable create-flag values used to stage a profile template. Mirrors the\n * stored-template option shape (`Record<flag, string | string[]>`) accepted by\n * `pm templates save` without importing the CLI module into core.\n */\nexport type ProfileTemplateOptions = Readonly<Record<string, string | readonly string[]>>;\n\n/**\n * A single nested-settings knob a profile stages during apply. The `key` is a\n * {@link module:core/config/nested-settings} descriptor key (snake_case) and the\n * `value` is the raw string the descriptor parser coerces into a typed leaf, so\n * profile config reuses exactly the same validation as `pm config set`.\n */\nexport interface ProfileConfigEntry {\n /** Nested-settings descriptor key, e.g. `search_provider`. */\n key: string;\n /** Raw value parsed by the descriptor (e.g. `\"bm25\"`, `\"20\"`). */\n value: string;\n /** Short human-facing rationale surfaced in profile descriptions. */\n summary: string;\n}\n\n/**\n * A named create template a profile stages into `<pmRoot>/templates/<name>.json`\n * so operators can immediately `pm create --template <name>`.\n */\nexport interface ProfileTemplateEntry {\n /** Template name (matches the `pm templates` naming rules). */\n name: string;\n /** Create-flag option payload stored for the template. */\n options: ProfileTemplateOptions;\n}\n\n/**\n * A package the profile recommends but never auto-installs. Apply surfaces these\n * as advisory `pm package install` hints, keeping profile application offline and\n * side-effect-free with respect to the package registry.\n */\nexport interface ProfilePackageRecommendation {\n /** Catalog alias or install spec, e.g. `templates` or `npm:@unbrained/pm-templates`. */\n spec: string;\n /** Why this archetype benefits from the package. */\n reason: string;\n}\n\n/**\n * The complete declarative definition of a project profile. Every dimension is\n * optional-by-emptiness: an empty array simply stages nothing for that surface.\n */\nexport interface ProjectProfileDefinition {\n /** Stable lowercase profile identifier, e.g. `agile`. */\n name: string;\n /** Human-facing display title. */\n title: string;\n /** One-line description of the archetype the profile tailors the tracker for. */\n summary: string;\n /** Item types to upsert (shared with the matching type preset). */\n types: readonly RawAddTypeInput[];\n /** Custom statuses to upsert. */\n statuses: readonly RawAddStatusInput[];\n /** Custom fields to upsert. */\n fields: readonly RawAddFieldInput[];\n /** Per-type workflow transition allow-lists to stage into settings. */\n workflows: readonly TypeWorkflowDefinition[];\n /** Nested-settings knobs to stage. */\n config: readonly ProfileConfigEntry[];\n /** Create templates to stage. */\n templates: readonly ProfileTemplateEntry[];\n /** Advisory package recommendations (never auto-installed). */\n packages: readonly ProfilePackageRecommendation[];\n}\n\n/**\n * The shape an extension passes to `api.registerProfile(profile)`.\n *\n * Only `name` and `title` are required; every other dimension is optional and\n * defaults to an empty array (and `summary` to an empty string) during\n * registration, matching the \"optional-by-emptiness\" model of\n * {@link ProjectProfileDefinition}. The loader normalizes a registration input\n * into a full {@link ProjectProfileDefinition} before storing it, so a sparse\n * `{ name, title }` archetype is a first-class, fully-typed call — no casts —\n * while a complete definition (a built-in or `defineProjectProfile`-typed value)\n * also satisfies it.\n */\nexport type ProjectProfileRegistrationInput = Pick<ProjectProfileDefinition, \"name\" | \"title\"> &\n Partial<Omit<ProjectProfileDefinition, \"name\" | \"title\">>;\n\n/**\n * Ordered list of first-party profile names. Drives CLI help, completion,\n * contracts, and the `pm profile list` ordering.\n */\nexport const PROFILE_NAMES = [\"agile\", \"ops\", \"research\"] as const;\n/**\n * Restricts profile name values accepted by command, SDK, and storage contracts.\n */\nexport type ProfileName = (typeof PROFILE_NAMES)[number];\n\n/**\n * First-party archetype profiles. Each composes its matching\n * {@link TYPE_PRESET_DEFINITIONS} entry (so item types stay identical to the\n * standalone type preset) with archetype-appropriate statuses, fields, a primary\n * workflow, offline-friendly search config, a starter template, and package\n * recommendations.\n */\nexport const BUILTIN_PROFILES: Record<ProfileName, ProjectProfileDefinition> = {\n agile: {\n name: \"agile\",\n title: \"Agile delivery\",\n summary: \"Story/Spike delivery with a review stage, story points, and acceptance ownership.\",\n types: TYPE_PRESET_DEFINITIONS.agile,\n statuses: [\n {\n id: \"review\",\n roles: [\"active\"],\n aliases: [\"in-review\"],\n description: \"Work is implementation-complete and awaiting peer review.\",\n },\n ],\n fields: [\n {\n key: \"story_points\",\n type: \"number\",\n commands: [\"create\", \"update\", \"list\"],\n description: \"Relative estimation size for a story or spike.\",\n aliases: [\"points\"],\n },\n {\n key: \"acceptance_owner\",\n type: \"string\",\n commands: [\"create\", \"update\", \"list\"],\n description: \"Stakeholder accountable for accepting the delivered story.\",\n aliases: [\"acceptor\"],\n },\n ],\n workflows: [\n {\n type: \"Story\",\n allowed_transitions: [\n [\"open\", \"in_progress\"],\n [\"in_progress\", \"review\"],\n [\"review\", \"in_progress\"],\n [\"review\", \"closed\"],\n [\"in_progress\", \"blocked\"],\n [\"blocked\", \"in_progress\"],\n ],\n },\n ],\n config: [\n { key: \"search_provider\", value: \"bm25\", summary: \"Offline BM25 lexical search works without an embedding service.\" },\n { key: \"search_max_results\", value: \"20\", summary: \"Sprint-sized result cap for quick triage.\" },\n ],\n templates: [\n {\n name: \"story\",\n options: {\n type: \"Story\",\n priority: \"2\",\n tags: \"story\",\n acceptanceCriteria: \"Story delivers the stated user outcome with tests and docs updated.\",\n body: \"## As a\\n\\n## I want\\n\\n## So that\\n\\n## Acceptance\\n- [ ] \\n\",\n },\n },\n ],\n packages: [\n { spec: \"templates\", reason: \"Reusable create templates for recurring story shapes.\" },\n { spec: \"calendar\", reason: \"Sprint and iteration scheduling views.\" },\n { spec: \"search-advanced\", reason: \"Richer retrieval as the backlog grows.\" },\n ],\n },\n ops: {\n name: \"ops\",\n title: \"Operations\",\n summary: \"Incident/Runbook response with mitigation and monitoring stages, severity, and service fields.\",\n types: TYPE_PRESET_DEFINITIONS.ops,\n statuses: [\n {\n id: \"mitigating\",\n roles: [\"active\"],\n aliases: [\"mitigation\"],\n description: \"Active mitigation is underway to restore service.\",\n },\n {\n id: \"monitoring\",\n roles: [\"active\"],\n aliases: [\"observing\"],\n description: \"Mitigation applied; monitoring for recurrence before closure.\",\n },\n ],\n fields: [\n {\n key: \"severity\",\n type: \"string\",\n commands: [\"create\", \"update\", \"list\"],\n description: \"Incident severity classification (e.g. sev1, sev2, sev3).\",\n aliases: [\"sev\"],\n },\n {\n key: \"service\",\n type: \"string\",\n commands: [\"create\", \"update\", \"list\"],\n description: \"Primary affected service or component.\",\n },\n ],\n workflows: [\n {\n type: \"Incident\",\n allowed_transitions: [\n [\"open\", \"mitigating\"],\n [\"mitigating\", \"monitoring\"],\n [\"monitoring\", \"mitigating\"],\n [\"monitoring\", \"closed\"],\n [\"mitigating\", \"blocked\"],\n [\"blocked\", \"mitigating\"],\n ],\n },\n ],\n config: [\n { key: \"search_provider\", value: \"bm25\", summary: \"Offline BM25 lexical search for fast incident lookup.\" },\n { key: \"search_max_results\", value: \"25\", summary: \"Wider result cap to surface related incidents and runbooks.\" },\n ],\n templates: [\n {\n name: \"incident\",\n options: {\n type: \"Incident\",\n priority: \"1\",\n tags: \"incident\",\n acceptanceCriteria: \"Service restored, root cause documented, and follow-ups filed.\",\n body: \"## Impact\\n\\n## Timeline\\n\\n## Root cause\\n\\n## Mitigation\\n\\n## Follow-ups\\n\",\n },\n },\n ],\n packages: [\n { spec: \"lifecycle-hooks\", reason: \"Automate transitions and notifications on incident state changes.\" },\n { spec: \"governance-audit\", reason: \"Audit incident metadata completeness and closure quality.\" },\n { spec: \"calendar\", reason: \"On-call and follow-up scheduling.\" },\n ],\n },\n research: {\n name: \"research\",\n title: \"Research\",\n summary: \"Experiment/Hypothesis investigation with an analysis stage, hypothesis, and method fields.\",\n types: TYPE_PRESET_DEFINITIONS.research,\n statuses: [\n {\n id: \"analyzing\",\n roles: [\"active\"],\n aliases: [\"analysis\"],\n description: \"Data collected; analysis and synthesis in progress.\",\n },\n ],\n fields: [\n {\n key: \"hypothesis\",\n type: \"string\",\n commands: [\"create\", \"update\"],\n description: \"The testable claim the experiment evaluates.\",\n },\n {\n key: \"method\",\n type: \"string\",\n commands: [\"create\", \"update\", \"list\"],\n description: \"Experimental method or protocol used to evaluate the hypothesis.\",\n aliases: [\"protocol\"],\n },\n ],\n workflows: [\n {\n type: \"Experiment\",\n allowed_transitions: [\n [\"open\", \"in_progress\"],\n [\"in_progress\", \"analyzing\"],\n [\"analyzing\", \"in_progress\"],\n [\"analyzing\", \"closed\"],\n [\"in_progress\", \"blocked\"],\n [\"blocked\", \"in_progress\"],\n ],\n },\n ],\n config: [\n { key: \"search_provider\", value: \"bm25\", summary: \"Offline BM25 lexical search across the research corpus.\" },\n { key: \"search_max_results\", value: \"50\", summary: \"Broader recall cap for literature and prior-experiment discovery.\" },\n ],\n templates: [\n {\n name: \"experiment\",\n options: {\n type: \"Experiment\",\n priority: \"2\",\n tags: \"experiment\",\n acceptanceCriteria: \"Hypothesis is supported, rejected, or refined with recorded evidence.\",\n body: \"## Hypothesis\\n\\n## Method\\n\\n## Results\\n\\n## Conclusion\\n\",\n },\n },\n ],\n packages: [\n { spec: \"search-advanced\", reason: \"Semantic retrieval over experiments and findings.\" },\n { spec: \"templates\", reason: \"Consistent experiment and hypothesis scaffolds.\" },\n { spec: \"beads\", reason: \"Import structured prior work into the tracker.\" },\n ],\n },\n};\n\n/**\n * Validates and normalizes a raw profile-name value. Returns `undefined` when the\n * value is omitted. Throws a plain Error with a stable message for an empty or\n * unknown name; CLI layers map it to a USAGE exit code. Accepts hyphen/underscore\n * and casing variations for ergonomics, mirroring {@link normalizeTypePresetName}.\n */\nexport function normalizeProfileName(rawValue: string | undefined): ProfileName | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = normalizeProfileLookupKey(rawValue);\n if (normalized.length === 0) {\n throw new Error(\"Profile name must not be empty.\");\n }\n // Validate against PROFILE_NAMES so adding a profile never drifts from the\n // accepted set (single source of truth shared with BUILTIN_PROFILES).\n if ((PROFILE_NAMES as readonly string[]).includes(normalized)) {\n return normalized as ProfileName;\n }\n throw new Error(`Invalid profile \"${rawValue}\". Allowed: ${PROFILE_NAMES.join(\", \")}.`);\n}\n\n/**\n * Resolves a built-in profile definition by validated name. Throws (via\n * {@link normalizeProfileName}) when the name is missing or unknown.\n */\nexport function resolveProfile(rawValue: string | undefined): ProjectProfileDefinition {\n const name = normalizeProfileName(rawValue);\n if (name === undefined) {\n throw new Error(`Profile name is required. Allowed: ${PROFILE_NAMES.join(\", \")}.`);\n }\n return BUILTIN_PROFILES[name];\n}\n\n/**\n * Returns all built-in profile definitions in {@link PROFILE_NAMES} order. Used by\n * `pm profile list` and SDK consumers enumerating available archetypes.\n */\nexport function listProfiles(): ProjectProfileDefinition[] {\n return PROFILE_NAMES.map((name) => BUILTIN_PROFILES[name]);\n}\n\n/**\n * Whether a resolved profile is core-baked or contributed by an active extension.\n */\nexport type ProfileSourceKind = \"builtin\" | \"extension\";\n\n/**\n * A profile definition paired with where it came from, returned by the merged\n * `pm profile` resolution so callers can label a profile's origin.\n */\nexport interface ResolvedProfile {\n /** The profile definition. */\n definition: ProjectProfileDefinition;\n /** Whether the profile is core-baked or contributed by an active extension. */\n source: ProfileSourceKind;\n /** For an extension profile, the owning package/extension name; absent for builtins. */\n package?: string;\n}\n\n/**\n * A profile contributed by an active extension, fed into the merge resolver.\n *\n * This intentionally mirrors the loader's `RegisteredExtensionProjectProfile`\n * without importing `core/extensions` — `extension-types` depends on this module\n * for {@link ProjectProfileDefinition}, so importing back would form a cycle. The\n * CLI maps the active registration registry onto this shape.\n */\nexport interface ExtensionProfileContribution {\n /** Owning extension/package name, surfaced as the resolved profile's source. */\n name: string;\n /** The profile definition the extension registered. */\n profile: ProjectProfileDefinition;\n}\n\n/**\n * Result of {@link resolveProfileCatalog}: the merged profile list plus any\n * non-fatal collisions encountered while merging.\n */\nexport interface ResolveProfileCatalogResult {\n /** Builtins first (in {@link PROFILE_NAMES} order), then accepted extension profiles in contribution order. */\n profiles: ResolvedProfile[];\n /** Non-fatal merge warnings (built-in shadowing attempts, duplicate names). */\n warnings: string[];\n}\n\n/**\n * Result of {@link resolveProfileEntry}: the single resolved profile plus the\n * same non-fatal merge `warnings` {@link resolveProfileCatalog} produced, so\n * `pm profile show`/`apply` surface a shadowed or duplicate extension profile\n * just like `pm profile list` does rather than swallowing it.\n */\nexport interface ResolveProfileEntryResult {\n /** The resolved profile and its source. */\n resolved: ResolvedProfile;\n /** Non-fatal merge warnings from building the catalog the entry was resolved against. */\n warnings: string[];\n}\n\n/**\n * Canonical lookup key for a profile name: trimmed, lowercased, with hyphens\n * folded to underscores. Shared by both sides of every catalog match (and by\n * {@link normalizeProfileName}) so a user can type `my-flow`, `My-Flow`, or\n * `my_flow ` interchangeably. Interior spaces are preserved — only the\n * hyphen/underscore distinction and surrounding whitespace/casing are folded.\n */\nexport function normalizeProfileLookupKey(rawValue: string): string {\n return rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n}\n\nfunction formatAvailableProfileNames(profiles: readonly ResolvedProfile[]): string {\n return profiles.map((entry) => entry.definition.name).join(\", \");\n}\n\n/**\n * Merges the core-baked {@link BUILTIN_PROFILES} with profiles contributed by\n * active extensions into one resolvable catalog.\n *\n * Built-in names are reserved: an extension profile whose normalized name\n * collides with a built-in archetype is dropped with a warning, so a package can\n * never silently shadow a core profile. Two extension profiles that normalize to\n * the same key keep the first contribution and warn on each later duplicate.\n * Builtins always sort first, preserving the established `pm profile list`\n * ordering. Names are non-blank by construction — the loader's\n * `registerProfile` validation rejects an empty `name` before it can reach the\n * registry that feeds this resolver.\n */\nexport function resolveProfileCatalog(\n contributions: readonly ExtensionProfileContribution[] = [],\n): ResolveProfileCatalogResult {\n const profiles: ResolvedProfile[] = PROFILE_NAMES.map((name) => ({\n definition: BUILTIN_PROFILES[name],\n source: \"builtin\" as const,\n }));\n const builtinKeys = new Set<string>(PROFILE_NAMES.map((name) => normalizeProfileLookupKey(name)));\n const seen = new Set<string>(builtinKeys);\n const warnings: string[] = [];\n for (const contribution of contributions) {\n const key = normalizeProfileLookupKey(contribution.profile.name);\n if (builtinKeys.has(key)) {\n warnings.push(\n `Extension \"${contribution.name}\" profile \"${contribution.profile.name}\" uses a name reserved by a built-in archetype and was ignored.`,\n );\n continue;\n }\n if (seen.has(key)) {\n warnings.push(\n `Profile \"${contribution.profile.name}\" from extension \"${contribution.name}\" duplicates an already-registered profile and was ignored.`,\n );\n continue;\n }\n seen.add(key);\n profiles.push({ definition: contribution.profile, source: \"extension\", package: contribution.name });\n }\n return { profiles, warnings };\n}\n\n/**\n * Resolves a single profile by name from the merged catalog (builtins +\n * extension contributions), returning it alongside the catalog's merge warnings.\n * Throws a plain Error with a stable, name-listing message when the value is\n * missing or unknown, so CLI layers map it to a USAGE exit code — the\n * extension-aware counterpart to {@link resolveProfile}.\n */\nexport function resolveProfileEntry(\n rawValue: string | undefined,\n contributions: readonly ExtensionProfileContribution[] = [],\n): ResolveProfileEntryResult {\n const { profiles, warnings } = resolveProfileCatalog(contributions);\n // Treat any non-string name as missing — undefined, null, or a non-string\n // primitive slipping in from an untyped JS caller or parsed payload — so the\n // `.trim()` below never throws.\n if (typeof rawValue !== \"string\" || rawValue.trim().length === 0) {\n throw new Error(`Profile name is required. Allowed: ${formatAvailableProfileNames(profiles)}.`);\n }\n const key = normalizeProfileLookupKey(rawValue);\n const match = profiles.find((entry) => normalizeProfileLookupKey(entry.definition.name) === key);\n if (match === undefined) {\n throw new Error(`Invalid profile \"${rawValue}\". Allowed: ${formatAvailableProfileNames(profiles)}.`);\n }\n return { resolved: match, warnings };\n}\n", "/**\n * @module core/profile/profile-describe\n *\n * Author-time *describe* primitive for a {@link ProjectProfileDefinition}: the\n * project-profile analogue of the extension surface's `describeExtensionBlueprint`.\n * It distills a profile into a deterministic, side-effect-free summary — the\n * per-dimension counts plus the resolved entry identifiers — so the CLI\n * `pm profile show`/`list` formatters and SDK consumers share one source of truth\n * for \"what does this profile stage?\" rather than each recomputing it inline.\n *\n * Identifier derivation deliberately mirrors what {@link module:core/profile/profile-plan}\n * upserts: item type names, status ids, and field keys all flow through the same\n * `normalizeAddTypeInput` / `normalizeAddStatusInput` / `normalizeAddFieldInput`\n * canonicalization the planner uses, so describe reports the exact ids/keys\n * `pm profile apply` stages (not the author's raw casing/spelling). Workflows,\n * config, templates, and packages surface their authored identity verbatim.\n *\n * Describe is intentionally lenient: it feeds read-only `pm profile show`/`list`,\n * so a semantically-invalid entry from an untrusted extension-contributed profile\n * (a built-in-named or empty type/status/field the normalizer rejects) falls back\n * to its raw identifier rather than throwing — surfacing the actual defect is the\n * job of {@link module:core/profile/profile-lint lintProjectProfile}, not describe.\n */\nimport { normalizeAddFieldInput } from \"../schema/fields-file.js\";\nimport { normalizeAddStatusInput } from \"../schema/status-defs-file.js\";\nimport { normalizeAddTypeInput } from \"../schema/item-types-file.js\";\nimport type { ProjectProfileDefinition } from \"./profile-presets.js\";\n\n/** Per-dimension counts summarizing how much a profile stages. */\nexport interface ProjectProfileComposition {\n /** Number of item types the profile registers. */\n types: number;\n /** Number of custom statuses. */\n statuses: number;\n /** Number of custom fields. */\n fields: number;\n /** Number of per-type workflows. */\n workflows: number;\n /** Number of config knobs. */\n config: number;\n /** Number of create templates. */\n templates: number;\n /** Number of recommended packages. */\n packages: number;\n}\n\n/** A package recommendation distilled to its spec and rationale. */\nexport interface ProjectProfilePackageSummary {\n /** Catalog alias or install spec. */\n spec: string;\n /** Why the archetype benefits from the package. */\n reason: string;\n}\n\n/** Deterministic summary of a profile's composition produced by {@link describeProjectProfile}. */\nexport interface ProjectProfileDescription {\n /** Profile name. */\n name: string;\n /** Display title. */\n title: string;\n /** One-line archetype summary. */\n summary: string;\n /** Per-dimension counts. */\n composition: ProjectProfileComposition;\n /** Canonical item type names the profile registers. */\n types: string[];\n /** Custom status ids. */\n statuses: string[];\n /** Custom field keys. */\n fields: string[];\n /** Item types governed by a staged workflow. */\n workflows: string[];\n /** Config knobs as `key=value` pairs. */\n config: string[];\n /** Template names the profile stages. */\n templates: string[];\n /** Recommended package specs with rationale. */\n packages: ProjectProfilePackageSummary[];\n}\n\n/**\n * Computes the per-dimension counts for a profile.\n */\nexport function describeProfileComposition(profile: ProjectProfileDefinition): ProjectProfileComposition {\n return {\n types: profile.types.length,\n statuses: profile.statuses.length,\n fields: profile.fields.length,\n workflows: profile.workflows.length,\n config: profile.config.length,\n templates: profile.templates.length,\n packages: profile.packages.length,\n };\n}\n\n/**\n * Distills a profile definition into a deterministic composition summary. Pure\n * and tracker-independent; the resolved identifiers match exactly what\n * `pm profile apply` stages for each dimension.\n *\n * @param profile The profile definition to describe.\n * @returns The profile's metadata, per-dimension counts, and resolved entry\n * identifiers.\n */\nexport function describeProjectProfile(profile: ProjectProfileDefinition): ProjectProfileDescription {\n return {\n name: profile.name,\n title: profile.title,\n summary: profile.summary,\n composition: describeProfileComposition(profile),\n types: profile.types.map((type) =>\n lenientIdentifier(() => normalizeAddTypeInput(type).name, () => String(type.name ?? \"\")),\n ),\n statuses: profile.statuses.map((status) =>\n lenientIdentifier(() => normalizeAddStatusInput(status).id, () => String(status.id ?? \"\")),\n ),\n fields: profile.fields.map((field) =>\n lenientIdentifier(() => normalizeAddFieldInput(field).key, () => String(field.key ?? \"\")),\n ),\n workflows: profile.workflows.map((workflow) => workflow.type),\n config: profile.config.map((entry) => `${entry.key}=${entry.value}`),\n templates: profile.templates.map((template) => template.name),\n packages: profile.packages.map((recommendation) => ({ spec: recommendation.spec, reason: recommendation.reason })),\n };\n}\n\n/**\n * Resolves a dimension entry's identifier through the planner's canonicalizing\n * normalizer so describe reports exactly what `pm profile apply` stages, falling\n * back to the entry's raw identifier when the normalizer rejects a semantically\n * invalid value (a built-in-named or empty type/status/field) — surfacing the\n * defect is the job of {@link module:core/profile/profile-lint}, not describe.\n */\nfunction lenientIdentifier(normalize: () => string, raw: () => string): string {\n try {\n return normalize();\n } catch {\n return raw();\n }\n}\n", "/**\n * @module core/profile/profile-lint\n *\n * Author-time, tracker-independent consistency linting for a\n * {@link ProjectProfileDefinition}. This is the project-profile analogue of the\n * extension surface's `lintExtensionBlueprint`: where `defineProjectProfile`\n * (and `api.registerProfile`) only assert structural shape, and\n * {@link module:core/profile/profile-plan planProfileApplication} only validates\n * config knobs fail-fast against a live tracker at apply time, this linter\n * inspects a profile definition in isolation and reports *every* problem at once\n * across all eight dimensions.\n *\n * Findings are graded:\n * - `error` — a condition that makes `pm profile apply` throw or silently lose\n * data (an invalid type/status/field the upsert normalizer rejects, a\n * duplicate key whose later entry overwrites the earlier one, an unknown or\n * invalid config knob the planner rejects, an empty profile name resolution\n * requires, or a malformed workflow transition pair the workflow resolver\n * silently drops).\n * - `warning` — authored content that is structurally valid but very likely a\n * bug (a workflow governing a type the profile never declares, a transition\n * referencing a status token no profile/built-in status defines — a dead,\n * unreachable rule — a template whose `type` references an undeclared type, a\n * profile name resolution would fold, or an empty title/summary/package spec).\n *\n * Cross-reference checks are warnings rather than errors because the referenced\n * type or status MAY already exist in the target tracker independently of the\n * profile (profiles layer onto whatever schema is present), so erroring would\n * produce false positives against valid layered setups.\n *\n * Everything here is pure and side-effect-free so it is fully coverage-gated; the\n * CLI `pm profile lint` command and the SDK `assertProjectProfile` helper are\n * thin wrappers around {@link lintProjectProfile}.\n */\nimport { BUILTIN_ITEM_TYPE_VALUES } from \"../../types/index.js\";\nimport { parseNestedSettingValue, resolveNestedSettingDescriptor } from \"../config/nested-settings.js\";\nimport { normalizeAddFieldInput } from \"../schema/fields-file.js\";\nimport { normalizeAddStatusInput } from \"../schema/status-defs-file.js\";\nimport { normalizeAddTypeInput } from \"../schema/item-types-file.js\";\nimport { normalizeStatusToken } from \"../schema/type-workflows.js\";\nimport { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from \"../schema/runtime-schema.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { normalizeProfileLookupKey, type ProjectProfileDefinition } from \"./profile-presets.js\";\n\n/** Severity grade of a profile lint finding. */\nexport type ProfileLintSeverity = \"error\" | \"warning\";\n\n/** Profile dimension a lint finding is attributed to. */\nexport const PROFILE_LINT_DIMENSIONS = [\n \"profile\",\n \"types\",\n \"statuses\",\n \"fields\",\n \"workflows\",\n \"config\",\n \"templates\",\n \"packages\",\n] as const;\n/**\n * Restricts profile lint dimension values accepted by command, SDK, and storage contracts.\n */\nexport type ProfileLintDimension = (typeof PROFILE_LINT_DIMENSIONS)[number];\n\n/** Stable machine-readable codes every {@link ProjectProfileLintFinding} carries. */\nexport const PROFILE_LINT_CODES = [\n \"profile_name_empty\",\n \"profile_name_not_normalized\",\n \"profile_title_empty\",\n \"profile_summary_empty\",\n \"type_invalid\",\n \"type_duplicate\",\n \"status_invalid\",\n \"status_duplicate\",\n \"field_invalid\",\n \"field_duplicate\",\n \"workflow_type_empty\",\n \"workflow_type_unknown\",\n \"workflow_duplicate_type\",\n \"workflow_transition_malformed\",\n \"workflow_status_unknown\",\n \"config_key_unknown\",\n \"config_value_invalid\",\n \"config_duplicate\",\n \"template_type_unknown\",\n \"package_spec_empty\",\n] as const;\n/**\n * Restricts profile lint code values accepted by command, SDK, and storage contracts.\n */\nexport type ProfileLintCode = (typeof PROFILE_LINT_CODES)[number];\n\n/** A single graded consistency finding produced by {@link lintProjectProfile}. */\nexport interface ProjectProfileLintFinding {\n /** Whether the finding blocks a clean apply (`error`) or merely flags risk (`warning`). */\n severity: ProfileLintSeverity;\n /** Stable machine-readable classification. */\n code: ProfileLintCode;\n /** Profile dimension the finding belongs to. */\n dimension: ProfileLintDimension;\n /** Identifier of the offending entry within the dimension, when applicable. */\n target?: string;\n /** Human-facing description of the problem. */\n message: string;\n}\n\n/** Result of linting a single {@link ProjectProfileDefinition}. */\nexport interface ProjectProfileLintReport {\n /** The profile name as authored (preserved verbatim, even when blank). */\n profile: string;\n /** True when no `error`-severity findings were produced. */\n ok: boolean;\n /** All findings in deterministic dimension order. */\n findings: ProjectProfileLintFinding[];\n /** Count of `error`-severity findings. */\n errorCount: number;\n /** Count of `warning`-severity findings. */\n warningCount: number;\n}\n\n/**\n * Built-in status tokens (canonical ids and their aliases, normalized) every\n * tracker recognizes regardless of profile. A workflow transition referencing one\n * of these is always resolvable, so it never triggers a `workflow_status_unknown`\n * warning. Computed once from the canonical defaults so it never drifts.\n */\nconst BUILTIN_STATUS_TOKENS: ReadonlySet<string> = new Set(\n DEFAULT_RUNTIME_STATUS_DEFINITIONS.flatMap((definition) => [\n normalizeStatusToken(definition.id),\n ...(definition.aliases ?? []).map((alias) => normalizeStatusToken(alias)),\n ]).filter((token) => token.length > 0),\n);\n\n/** Built-in item type names, lower-cased for case-insensitive workflow/template matching. */\nconst BUILTIN_TYPE_KEYS: ReadonlySet<string> = new Set(BUILTIN_ITEM_TYPE_VALUES.map((name) => name.toLowerCase()));\n\n/** Lint the profile-level identity fields (name, title, summary). */\nfunction lintProfileIdentity(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): void {\n if (profile.name.trim().length === 0) {\n findings.push({\n severity: \"error\",\n code: \"profile_name_empty\",\n dimension: \"profile\",\n message: \"Profile name must not be empty; profile resolution requires a non-blank name.\",\n });\n } else if (profile.name !== normalizeProfileLookupKey(profile.name)) {\n findings.push({\n severity: \"warning\",\n code: \"profile_name_not_normalized\",\n dimension: \"profile\",\n target: profile.name,\n message: `Profile name \"${profile.name}\" is not in canonical form; resolution folds it to \"${normalizeProfileLookupKey(profile.name)}\" (lowercase, hyphens as underscores).`,\n });\n }\n if (profile.title.trim().length === 0) {\n findings.push({\n severity: \"warning\",\n code: \"profile_title_empty\",\n dimension: \"profile\",\n message: \"Profile title is empty; list and show surfaces will render a blank title.\",\n });\n }\n if (profile.summary.trim().length === 0) {\n findings.push({\n severity: \"warning\",\n code: \"profile_summary_empty\",\n dimension: \"profile\",\n message: \"Profile summary is empty; list and show surfaces will render a blank archetype description.\",\n });\n }\n}\n\n/**\n * Lint the item types, returning the set of declared type keys (lower-cased)\n * collected from entries that normalize cleanly so workflow and template checks\n * can resolve cross-references against them.\n */\nfunction lintTypes(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): Set<string> {\n const declared = new Set<string>();\n const seen = new Set<string>();\n for (const [index, type] of profile.types.entries()) {\n let name: string;\n try {\n name = normalizeAddTypeInput(type).name;\n } catch (error) {\n findings.push({\n severity: \"error\",\n code: \"type_invalid\",\n dimension: \"types\",\n target: typeof type.name === \"string\" ? type.name : `#${index}`,\n message: toErrorMessage(error),\n });\n continue;\n }\n const key = name.toLowerCase();\n if (seen.has(key)) {\n findings.push({\n severity: \"error\",\n code: \"type_duplicate\",\n dimension: \"types\",\n target: name,\n message: `Item type \"${name}\" is declared more than once; the later definition silently overwrites the earlier upsert.`,\n });\n continue;\n }\n seen.add(key);\n declared.add(key);\n }\n return declared;\n}\n\n/**\n * Lint the custom statuses, returning the set of declared status tokens (ids and\n * aliases, normalized) collected from entries that normalize cleanly so workflow\n * transition checks can resolve cross-references against them.\n */\nfunction lintStatuses(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): Set<string> {\n const declared = new Set<string>();\n const seen = new Set<string>();\n for (const [index, status] of profile.statuses.entries()) {\n let normalized: ReturnType<typeof normalizeAddStatusInput>;\n try {\n normalized = normalizeAddStatusInput(status);\n } catch (error) {\n findings.push({\n severity: \"error\",\n code: \"status_invalid\",\n dimension: \"statuses\",\n target: typeof status.id === \"string\" ? status.id : `#${index}`,\n message: toErrorMessage(error),\n });\n continue;\n }\n if (seen.has(normalized.id)) {\n findings.push({\n severity: \"error\",\n code: \"status_duplicate\",\n dimension: \"statuses\",\n target: normalized.id,\n message: `Status \"${normalized.id}\" is declared more than once; the later definition silently overwrites the earlier upsert.`,\n });\n continue;\n }\n seen.add(normalized.id);\n declared.add(normalized.id);\n for (const alias of normalized.aliases ?? []) {\n declared.add(normalizeStatusToken(alias));\n }\n }\n return declared;\n}\n\n/** Lint the custom fields for invalid and duplicate keys. */\nfunction lintFields(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): void {\n const seen = new Set<string>();\n for (const [index, field] of profile.fields.entries()) {\n let key: string;\n try {\n key = normalizeAddFieldInput(field).key;\n } catch (error) {\n findings.push({\n severity: \"error\",\n code: \"field_invalid\",\n dimension: \"fields\",\n target: typeof field.key === \"string\" ? field.key : `#${index}`,\n message: toErrorMessage(error),\n });\n continue;\n }\n if (seen.has(key)) {\n findings.push({\n severity: \"error\",\n code: \"field_duplicate\",\n dimension: \"fields\",\n target: key,\n message: `Field \"${key}\" is declared more than once; the later definition silently overwrites the earlier upsert.`,\n });\n continue;\n }\n seen.add(key);\n }\n}\n\n/**\n * Lint the per-type workflows: flag workflows that govern an undeclared type,\n * duplicate workflows for the same type, malformed transition pairs, and\n * transitions referencing a status token no built-in or profile status defines.\n */\nfunction lintWorkflows(\n profile: ProjectProfileDefinition,\n declaredTypes: ReadonlySet<string>,\n declaredStatuses: ReadonlySet<string>,\n findings: ProjectProfileLintFinding[],\n): void {\n const seenTypes = new Set<string>();\n for (const [index, workflow] of profile.workflows.entries()) {\n const typeKey = workflow.type.trim().toLowerCase();\n if (typeKey.length === 0) {\n findings.push({\n severity: \"error\",\n code: \"workflow_type_empty\",\n dimension: \"workflows\",\n target: `#${index}`,\n message: \"Workflow has an empty type; the workflow resolver drops entries without a type.\",\n });\n continue;\n }\n const duplicate = seenTypes.has(typeKey);\n seenTypes.add(typeKey);\n if (duplicate) {\n // The unknown-type check already fired for the first occurrence, so only\n // report the duplication here to avoid a redundant second finding.\n findings.push({\n severity: \"warning\",\n code: \"workflow_duplicate_type\",\n dimension: \"workflows\",\n target: workflow.type,\n message: `Workflow type \"${workflow.type}\" is declared more than once; the later transition set wins.`,\n });\n } else if (!BUILTIN_TYPE_KEYS.has(typeKey) && !declaredTypes.has(typeKey)) {\n findings.push({\n severity: \"warning\",\n code: \"workflow_type_unknown\",\n dimension: \"workflows\",\n target: workflow.type,\n message: `Workflow governs type \"${workflow.type}\" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`,\n });\n }\n // Each unknown status is reported once per workflow (not globally) so a later\n // workflow referencing the same unresolved token is still surfaced in its own\n // context.\n const reportedUnknownStatuses = new Set<string>();\n for (const pair of workflow.allowed_transitions) {\n const from = normalizeStatusToken(pair[0]);\n const to = normalizeStatusToken(pair[1]);\n if (from.length === 0 || to.length === 0) {\n findings.push({\n severity: \"error\",\n code: \"workflow_transition_malformed\",\n dimension: \"workflows\",\n target: workflow.type,\n message: `Workflow \"${workflow.type}\" has a transition with an empty status; the workflow resolver silently drops it.`,\n });\n continue;\n }\n for (const token of [from, to]) {\n if (BUILTIN_STATUS_TOKENS.has(token) || declaredStatuses.has(token) || reportedUnknownStatuses.has(token)) {\n continue;\n }\n reportedUnknownStatuses.add(token);\n findings.push({\n severity: \"warning\",\n code: \"workflow_status_unknown\",\n dimension: \"workflows\",\n target: token,\n message: `Workflow \"${workflow.type}\" references status \"${token}\" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`,\n });\n }\n }\n }\n}\n\n/**\n * Lint the config knobs: resolve each descriptor, flag duplicates that would\n * silently overwrite an earlier knob, and parse each value.\n */\nfunction lintConfig(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): void {\n const seen = new Set<string>();\n for (const entry of profile.config) {\n const descriptor = resolveNestedSettingDescriptor(entry.key);\n if (descriptor === undefined) {\n findings.push({\n severity: \"error\",\n code: \"config_key_unknown\",\n dimension: \"config\",\n target: entry.key,\n message: `Config knob \"${entry.key}\" is not a recognized setting; apply rejects it with a usage error.`,\n });\n continue;\n }\n // Dedupe on the resolved descriptor key so two entries that differ only by\n // alias/casing (e.g. `search-provider` and `search_provider`) are caught.\n if (seen.has(descriptor.key)) {\n findings.push({\n severity: \"error\",\n code: \"config_duplicate\",\n dimension: \"config\",\n target: descriptor.key,\n message: `Config knob \"${descriptor.key}\" is set more than once; the later value silently overwrites the earlier one.`,\n });\n } else {\n seen.add(descriptor.key);\n }\n const parsed = parseNestedSettingValue(descriptor, entry.value);\n if (!parsed.ok) {\n findings.push({\n severity: \"error\",\n code: \"config_value_invalid\",\n dimension: \"config\",\n target: entry.key,\n message: parsed.error.message,\n });\n }\n }\n}\n\n/** Lint the create templates: flag a `type` option referencing an undeclared type. */\nfunction lintTemplates(\n profile: ProjectProfileDefinition,\n declaredTypes: ReadonlySet<string>,\n findings: ProjectProfileLintFinding[],\n): void {\n for (const template of profile.templates) {\n const typeOption = template.options.type;\n if (typeof typeOption !== \"string\" || typeOption.trim().length === 0) {\n continue;\n }\n const typeKey = typeOption.trim().toLowerCase();\n if (!BUILTIN_TYPE_KEYS.has(typeKey) && !declaredTypes.has(typeKey)) {\n findings.push({\n severity: \"warning\",\n code: \"template_type_unknown\",\n dimension: \"templates\",\n target: template.name,\n message: `Template \"${template.name}\" creates type \"${typeOption}\" which is neither a built-in type nor declared by this profile.`,\n });\n }\n }\n}\n\n/** Lint the advisory package recommendations for an empty spec. */\nfunction lintPackages(profile: ProjectProfileDefinition, findings: ProjectProfileLintFinding[]): void {\n for (const [index, recommendation] of profile.packages.entries()) {\n if (recommendation.spec.trim().length === 0) {\n findings.push({\n severity: \"warning\",\n code: \"package_spec_empty\",\n dimension: \"packages\",\n target: `#${index}`,\n message: \"Package recommendation has an empty spec; it cannot be surfaced as an install hint.\",\n });\n }\n }\n}\n\n/**\n * Lints a project profile definition for internal consistency, returning every\n * graded finding across all dimensions. Pure and tracker-independent: it never\n * reads disk or settings, so authors can call it on a `defineProjectProfile`\n * value, the CLI can call it on a resolved built-in or extension-contributed\n * profile, and tests can gate against it.\n *\n * @param profile The profile definition to lint.\n * @returns A report whose `ok` flag is true exactly when no `error` findings\n * were produced.\n */\nexport function lintProjectProfile(profile: ProjectProfileDefinition): ProjectProfileLintReport {\n const findings: ProjectProfileLintFinding[] = [];\n lintProfileIdentity(profile, findings);\n const declaredTypes = lintTypes(profile, findings);\n const declaredStatuses = lintStatuses(profile, findings);\n lintFields(profile, findings);\n lintWorkflows(profile, declaredTypes, declaredStatuses, findings);\n lintConfig(profile, findings);\n lintTemplates(profile, declaredTypes, findings);\n lintPackages(profile, findings);\n const errorCount = findings.filter((finding) => finding.severity === \"error\").length;\n const warningCount = findings.length - errorCount;\n return {\n profile: profile.name,\n ok: errorCount === 0,\n findings,\n errorCount,\n warningCount,\n };\n}\n", "/**\n * @module core/profile/profile-plan\n *\n * Pure planning for `pm profile apply`. Given a {@link ProjectProfileDefinition}\n * and a snapshot of the current tracker state, computes an idempotent diff across\n * every profile dimension (item types, statuses, fields, per-type workflows,\n * config knobs, templates, and package recommendations) without touching disk.\n *\n * Idempotency is structural: each schema component is upserted onto a clone and\n * the canonical serialization is compared before/after, so re-running `apply`\n * against an already-applied profile reports every entry as `unchanged` and the\n * command performs zero writes. The resulting files/settings the planner returns\n * are exactly what the apply step persists, guaranteeing the dry-run preview and\n * the real mutation never diverge.\n */\nimport {\n normalizeAddTypeInput,\n parseItemTypesFile,\n serializeItemTypesFile,\n upsertItemType,\n type ItemTypesFile,\n} from \"../schema/item-types-file.js\";\nimport {\n normalizeAddStatusInput,\n parseStatusDefsFile,\n serializeStatusDefsFile,\n upsertStatusDef,\n type StatusDefsFile,\n} from \"../schema/status-defs-file.js\";\nimport {\n normalizeAddFieldInput,\n parseFieldsFile,\n serializeFieldsFile,\n upsertField,\n type FieldsFile,\n} from \"../schema/fields-file.js\";\nimport {\n parseNestedSettingValue,\n readNestedSettingValue,\n resolveNestedSettingDescriptor,\n} from \"../config/nested-settings.js\";\nimport type { TypeWorkflowDefinition } from \"../../types.js\";\nimport type {\n ProfileTemplateOptions,\n ProjectProfileDefinition,\n} from \"./profile-presets.js\";\n\n/** Per-entry change classification used across every profile dimension. */\nexport type ProfileChangeStatus = \"add\" | \"update\" | \"unchanged\";\n\n/** A single staged change keyed by its component identifier. */\nexport interface ProfileComponentChange {\n /** Component identity (type name, status id, field key, etc.). */\n key: string;\n /** Whether the entry is new, an overwrite, or already current. */\n status: ProfileChangeStatus;\n}\n\n/** Plan for a file-backed schema component (types/statuses/fields). */\nexport interface ProfileSchemaPlan<TFile> {\n /** Serialized file content to persist when `changed`. */\n file: TFile;\n /** Per-entry classifications in profile order. */\n changes: ProfileComponentChange[];\n /** True when at least one entry is add/update. */\n changed: boolean;\n}\n\n/** A staged per-type workflow change plus the merged result list. */\nexport interface ProfileWorkflowChange {\n /** Item type the workflow governs. */\n type: string;\n /** Whether the workflow is new, changed, or already current. */\n status: ProfileChangeStatus;\n}\n\n/** Plan for the `schema.type_workflows` settings subtree. */\nexport interface ProfileWorkflowPlan {\n /** Per-workflow classifications in profile order. */\n changes: ProfileWorkflowChange[];\n /** Full merged workflow list to persist when `changed`. */\n result: TypeWorkflowDefinition[];\n /** True when at least one workflow is add/update. */\n changed: boolean;\n}\n\n/** A staged config knob plus the resolved settings path and typed value. */\nexport interface ProfileConfigChange {\n /** Descriptor key (snake_case). */\n key: string;\n /** Dotted PmSettings path the value writes to. */\n path: string;\n /** Typed leaf value to persist. */\n value: string | number | boolean;\n /** Whether the leaf is new, changed, or already current. */\n status: ProfileChangeStatus;\n}\n\n/** Plan for the nested-settings knobs a profile stages. */\nexport interface ProfileConfigPlan {\n /** Per-knob classifications in profile order. */\n changes: ProfileConfigChange[];\n /** True when at least one knob is add/update. */\n changed: boolean;\n}\n\n/** A staged create-template change. */\nexport interface ProfileTemplateChange {\n /** Template name. */\n name: string;\n /** Option payload to persist for the template. */\n options: ProfileTemplateOptions;\n /** Whether the template is new, changed, or already current. */\n status: ProfileChangeStatus;\n}\n\n/** Plan for the create templates a profile stages. */\nexport interface ProfileTemplatePlan {\n /** Per-template classifications in profile order. */\n changes: ProfileTemplateChange[];\n /** True when at least one template is add/update. */\n changed: boolean;\n}\n\n/** Advisory package recommendation with install status. */\nexport interface ProfilePackagePlan {\n /** Catalog alias or install spec. */\n spec: string;\n /** Why the archetype benefits from the package. */\n reason: string;\n /** `installed` when already present, otherwise `recommended`. */\n status: \"installed\" | \"recommended\";\n}\n\n/** Current tracker state the planner diffs the profile against. */\nexport interface ProfileCurrentState {\n /** Raw `schema/types.json` content (or null when absent). */\n typesRaw: string | null;\n /** Raw status-defs file content (or null when absent). */\n statusesRaw: string | null;\n /** Raw fields file content (or null when absent). */\n fieldsRaw: string | null;\n /** Current `schema.type_workflows` entries. */\n workflows: readonly TypeWorkflowDefinition[];\n /** Settings object used to read current config leaf values. */\n settings: unknown;\n /** Existing stored template options keyed by template name. */\n templates: ReadonlyMap<string, ProfileTemplateOptions>;\n /** Install specs/aliases already present in the project. */\n installedPackages: ReadonlySet<string>;\n}\n\n/** Complete idempotent plan for applying a profile. */\nexport interface ProfileApplicationPlan {\n /** Identifying metadata for the planned profile. */\n profile: { name: string; title: string; summary: string };\n /** Item-type plan. */\n types: ProfileSchemaPlan<ItemTypesFile>;\n /** Status plan. */\n statuses: ProfileSchemaPlan<StatusDefsFile>;\n /** Field plan. */\n fields: ProfileSchemaPlan<FieldsFile>;\n /** Per-type workflow plan. */\n workflows: ProfileWorkflowPlan;\n /** Config-knob plan. */\n config: ProfileConfigPlan;\n /** Template plan. */\n templates: ProfileTemplatePlan;\n /** Advisory package recommendations. */\n packages: ProfilePackagePlan[];\n /** True when any dimension stages an add/update. */\n changed: boolean;\n}\n\n/**\n * Plans a file-backed schema component by upserting each normalized input onto a\n * working clone and comparing canonical serializations to classify add/update/\n * unchanged. Shared by the type, status, and field planners.\n */\nfunction planSchemaComponent<TInput, TFile>(\n initialFile: TFile,\n inputs: readonly TInput[],\n keyOf: (input: TInput) => string,\n serialize: (file: TFile) => string,\n upsert: (file: TFile, input: TInput) => { file: TFile; replaced: boolean },\n): ProfileSchemaPlan<TFile> {\n let file = initialFile;\n const changes: ProfileComponentChange[] = [];\n for (const input of inputs) {\n const before = serialize(file);\n const result = upsert(file, input);\n const after = serialize(result.file);\n file = result.file;\n const status: ProfileChangeStatus = before === after ? \"unchanged\" : result.replaced ? \"update\" : \"add\";\n changes.push({ key: keyOf(input), status });\n }\n return { file, changes, changed: changes.some((change) => change.status !== \"unchanged\") };\n}\n\n/**\n * Canonicalizes an allowed-transition list to an order-independent string. The\n * transitions are a set of `[from, to]` pairs, so a stored list that merely\n * reorders the same pairs must not register as a spurious `update`.\n */\nfunction canonicalTransitions(transitions: readonly [string, string][]): string {\n return JSON.stringify(transitions.map((pair) => pair.join(\"\u0000\")).sort());\n}\n\n/**\n * Plans the per-type workflow merge. A workflow whose transition set matches the\n * current entry (order-independent) is `unchanged`; a new type is `add`; a\n * changed transition set is `update`. The merged result preserves untouched\n * entries.\n */\nfunction planWorkflows(\n current: readonly TypeWorkflowDefinition[],\n desired: readonly TypeWorkflowDefinition[],\n): ProfileWorkflowPlan {\n const result = current.map((entry) => ({ ...entry }));\n const changes: ProfileWorkflowChange[] = [];\n for (const workflow of desired) {\n const index = result.findIndex((entry) => entry.type === workflow.type);\n const next: TypeWorkflowDefinition = { type: workflow.type, allowed_transitions: workflow.allowed_transitions };\n if (index < 0) {\n result.push(next);\n changes.push({ type: workflow.type, status: \"add\" });\n } else if (canonicalTransitions(result[index].allowed_transitions) === canonicalTransitions(workflow.allowed_transitions)) {\n changes.push({ type: workflow.type, status: \"unchanged\" });\n } else {\n result[index] = next;\n changes.push({ type: workflow.type, status: \"update\" });\n }\n }\n return { changes, result, changed: changes.some((change) => change.status !== \"unchanged\") };\n}\n\n/**\n * Plans config knobs by resolving each descriptor, coercing the value, and\n * comparing it against the current settings leaf. Throws a plain Error for an\n * unknown key or invalid value so the CLI can map it to a USAGE exit code.\n */\nfunction planConfig(profile: ProjectProfileDefinition, settings: unknown): ProfileConfigPlan {\n const changes: ProfileConfigChange[] = [];\n for (const entry of profile.config) {\n const descriptor = resolveNestedSettingDescriptor(entry.key);\n if (descriptor === undefined) {\n throw new Error(`Profile \"${profile.name}\" references unknown config key \"${entry.key}\".`);\n }\n const parsed = parseNestedSettingValue(descriptor, entry.value);\n if (!parsed.ok) {\n throw new Error(`Profile \"${profile.name}\" config ${entry.key}: ${parsed.error.message}`);\n }\n // readNestedSettingValue returns `null` (never `undefined`) when the leaf is\n // absent, so a null current is an unambiguous \"add\".\n const current = readNestedSettingValue(settings, descriptor);\n const status: ProfileChangeStatus =\n current === null ? \"add\" : current === parsed.parsed.value ? \"unchanged\" : \"update\";\n changes.push({ key: descriptor.key, path: descriptor.path, value: parsed.parsed.value, status });\n }\n return { changes, changed: changes.some((change) => change.status !== \"unchanged\") };\n}\n\n/**\n * Canonicalizes a template option payload to a key-order-independent string so a\n * profile's authored option order never produces a spurious `update` against the\n * key-sorted form `pm templates save` persists.\n */\nfunction canonicalTemplateOptions(options: ProfileTemplateOptions): string {\n const sorted = Object.entries(options).sort(([left], [right]) => left.localeCompare(right));\n return JSON.stringify(sorted);\n}\n\n/**\n * Plans create templates by comparing each profile template's option payload\n * against the stored template (if any). Equality is canonical so option key\n * ordering never produces a spurious `update`.\n */\nfunction planTemplates(\n profile: ProjectProfileDefinition,\n existing: ReadonlyMap<string, ProfileTemplateOptions>,\n): ProfileTemplatePlan {\n const changes: ProfileTemplateChange[] = [];\n for (const template of profile.templates) {\n const current = existing.get(template.name);\n let status: ProfileChangeStatus;\n if (current === undefined) {\n status = \"add\";\n } else if (canonicalTemplateOptions(current) === canonicalTemplateOptions(template.options)) {\n status = \"unchanged\";\n } else {\n status = \"update\";\n }\n changes.push({ name: template.name, options: template.options, status });\n }\n return { changes, changed: changes.some((change) => change.status !== \"unchanged\") };\n}\n\n/**\n * Computes the complete idempotent application plan for a profile against the\n * supplied tracker snapshot. The returned files/settings are exactly what the\n * apply step persists; nothing here touches disk.\n */\nexport function planProfileApplication(\n profile: ProjectProfileDefinition,\n current: ProfileCurrentState,\n): ProfileApplicationPlan {\n const types = planSchemaComponent(\n parseItemTypesFile(current.typesRaw),\n profile.types,\n (input) => normalizeAddTypeInput(input).name,\n serializeItemTypesFile,\n (file, input) => upsertItemType(file, normalizeAddTypeInput(input)),\n );\n const statuses = planSchemaComponent(\n parseStatusDefsFile(current.statusesRaw),\n profile.statuses,\n (input) => normalizeAddStatusInput(input).id,\n serializeStatusDefsFile,\n (file, input) => upsertStatusDef(file, normalizeAddStatusInput(input)),\n );\n const fields = planSchemaComponent(\n parseFieldsFile(current.fieldsRaw),\n profile.fields,\n (input) => normalizeAddFieldInput(input).key,\n serializeFieldsFile,\n (file, input) => upsertField(file, normalizeAddFieldInput(input)),\n );\n const workflows = planWorkflows(current.workflows, profile.workflows);\n const config = planConfig(profile, current.settings);\n const templates = planTemplates(profile, current.templates);\n const packages = profile.packages.map((recommendation) => ({\n spec: recommendation.spec,\n reason: recommendation.reason,\n status: current.installedPackages.has(recommendation.spec) ? (\"installed\" as const) : (\"recommended\" as const),\n }));\n const changed = types.changed || statuses.changed || fields.changed || workflows.changed || config.changed || templates.changed;\n return {\n profile: { name: profile.name, title: profile.title, summary: profile.summary },\n types,\n statuses,\n fields,\n workflows,\n config,\n templates,\n packages,\n changed,\n };\n}\n", "/**\n * @module cli/commands/templates\n *\n * Implements the pm templates command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport {\n CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,\n} from \"../../sdk/cli-contracts.js\";\n\nconst TEMPLATE_DIRECTORY_NAME = \"templates\";\nconst TEMPLATE_FILE_EXTENSION = \".json\";\nconst TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\nconst TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);\nconst TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set<string>(TEMPLATE_OPTION_REPEATABLE_KEYS);\n\ntype TemplateOptionValue = string | string[];\n/**\n * Restricts create template options values accepted by command, SDK, and storage contracts.\n */\nexport type CreateTemplateOptions = Record<string, TemplateOptionValue>;\n/**\n * Restricts template source values accepted by command, SDK, and storage contracts.\n */\nexport type TemplateSource = \"builtin\" | \"user\";\n\nconst BUILTIN_TEMPLATE_TIMESTAMP = \"1970-01-01T00:00:00.000Z\";\nconst BUILTIN_TEMPLATES: Readonly<Record<string, CreateTemplateOptions>> = {\n bug: {\n type: \"Issue\",\n priority: \"1\",\n tags: \"bug\",\n acceptanceCriteria: \"Bug no longer reproduces with the steps below and a regression test guards it.\",\n expectedResult: \"Describe the correct behavior.\",\n actualResult: \"Describe the observed (buggy) behavior.\",\n body: \"## Repro steps\\n1. \\n2. \\n3. \\n\\n## Expected\\n\\n## Actual\\n\",\n },\n feature: {\n type: \"Feature\",\n priority: \"2\",\n tags: \"feature\",\n acceptanceCriteria: \"Feature is shipped behind agreed scope with tests and docs updated.\",\n whyNow: \"Explain why this is worth doing now (impact / urgency).\",\n body: \"## Goal\\n\\n## Why now\\n\\n## Out of scope\\n\",\n },\n spike: {\n type: \"Task\",\n priority: \"2\",\n tags: \"spike\",\n estimatedMinutes: \"120\",\n acceptanceCriteria: \"Timeboxed investigation complete; findings and a recommendation are recorded.\",\n body: \"## Question to answer\\n\\n## Timebox\\n2h\\n\\n## Findings\\n\\n## Recommendation\\n\",\n },\n chore: {\n type: \"Chore\",\n priority: \"3\",\n tags: \"chore\",\n acceptanceCriteria: \"Maintenance task done with no behavior change and green checks.\",\n body: \"## What\\n\\n## Why\\n\",\n },\n};\n\ninterface StoredCreateTemplateDocument {\n name: string;\n created_at: string;\n updated_at: string;\n options: CreateTemplateOptions;\n}\n\nexport const _testOnly = {\n normalizeTemplateName,\n extractTemplateOptions,\n parseStoredTemplateDocument,\n builtinTemplateDocument,\n readStoredTemplateDocument,\n};\n\n/**\n * Documents the templates save result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesSaveResult {\n name: string;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\n/**\n * Documents the templates list result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesListResult {\n templates: string[];\n count: number;\n builtin_templates: string[];\n user_templates: string[];\n}\n\n/**\n * Documents the templates show result payload exchanged by command, SDK, and package integrations.\n */\nexport interface TemplatesShowResult {\n name: string;\n source: TemplateSource;\n created_at: string;\n updated_at: string;\n path: string;\n options: CreateTemplateOptions;\n}\n\nfunction normalizeTemplateName(rawName: string): string {\n const name = rawName.trim();\n if (!TEMPLATE_NAME_PATTERN.test(name)) {\n throw new PmCliError(\n `Invalid template name \"${rawName}\". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,\n EXIT_CODE.USAGE,\n );\n }\n return name;\n}\n\nfunction templatesDirectory(pmRoot: string): string {\n return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);\n}\n\nfunction templatePath(pmRoot: string, normalizedName: string): string {\n return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);\n}\n\nasync function ensureTrackerInitialized(pmRoot: string): Promise<void> {\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n}\n\nfunction sortTemplateOptions(options: CreateTemplateOptions): CreateTemplateOptions {\n return Object.fromEntries(\n Object.entries(options).sort(([left], [right]) => left.localeCompare(right)),\n ) as CreateTemplateOptions;\n}\n\nfunction extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions {\n const next: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(rawOptions)) {\n if (value === undefined) {\n continue;\n }\n if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {\n if (typeof value === \"string\") {\n next[key] = [value];\n continue;\n }\n if (!Array.isArray(value)) {\n continue;\n }\n const values = value.filter((entry): entry is string => typeof entry === \"string\");\n if (values.length > 0) {\n next[key] = values;\n }\n continue;\n }\n if (typeof value === \"string\") {\n next[key] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n next[key] = [...value];\n }\n }\n return sortTemplateOptions(next);\n}\n\nfunction parseStoredTemplateOptions(rawOptions: unknown, templateName: string): CreateTemplateOptions {\n if (typeof rawOptions !== \"object\" || rawOptions === null || Array.isArray(rawOptions)) {\n throw new PmCliError(`Template \"${templateName}\" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const optionsRecord = rawOptions as Record<string, unknown>;\n const normalized: CreateTemplateOptions = {};\n for (const [key, value] of Object.entries(optionsRecord)) {\n const normalizedKey = key.trim();\n if (normalizedKey.length === 0) {\n throw new PmCliError(\n `Template \"${templateName}\" contains an empty option key.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (typeof value === \"string\") {\n normalized[normalizedKey] = value;\n continue;\n }\n if (Array.isArray(value) && value.every((entry) => typeof entry === \"string\")) {\n normalized[normalizedKey] = [...value];\n continue;\n }\n throw new PmCliError(\n `Template \"${templateName}\" contains invalid value for option \"${normalizedKey}\".`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return sortTemplateOptions(normalized);\n}\n\nfunction parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(`Template \"${normalizedName}\" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new PmCliError(`Template \"${normalizedName}\" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);\n }\n const record = parsed as Record<string, unknown>;\n const options = parseStoredTemplateOptions(record.options, normalizedName);\n const now = nowIso();\n return {\n name: typeof record.name === \"string\" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,\n created_at: typeof record.created_at === \"string\" ? record.created_at : now,\n updated_at: typeof record.updated_at === \"string\" ? record.updated_at : now,\n options,\n };\n}\n\nfunction builtinTemplateDocument(normalizedName: string): StoredCreateTemplateDocument | null {\n const options = BUILTIN_TEMPLATES[normalizedName];\n if (!options) {\n return null;\n }\n return {\n name: normalizedName,\n created_at: BUILTIN_TEMPLATE_TIMESTAMP,\n updated_at: BUILTIN_TEMPLATE_TIMESTAMP,\n options: sortTemplateOptions({ ...options }),\n };\n}\n\ninterface ResolvedTemplateDocument {\n document: StoredCreateTemplateDocument;\n source: TemplateSource;\n}\n\nasync function resolveTemplateDocument(pmRoot: string, normalizedName: string): Promise<ResolvedTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw !== null) {\n return { document: parseStoredTemplateDocument(raw, normalizedName), source: \"user\" };\n }\n const builtin = builtinTemplateDocument(normalizedName);\n if (builtin) {\n return { document: builtin, source: \"builtin\" };\n }\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n}\n\nasync function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument> {\n const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));\n if (raw === null) {\n throw new PmCliError(`Template \"${normalizedName}\" not found`, EXIT_CODE.NOT_FOUND);\n }\n return parseStoredTemplateDocument(raw, normalizedName);\n}\n\n/**\n * Implements load create template options for the public runtime surface of this module.\n */\nexport async function loadCreateTemplateOptions(pmRoot: string, rawTemplateName: string): Promise<CreateTemplateOptions> {\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document } = await resolveTemplateDocument(pmRoot, normalizedName);\n return document.options;\n}\n\n/**\n * Implements run templates save for the public runtime surface of this module.\n */\nexport async function runTemplatesSave(\n rawTemplateName: string,\n options: Record<string, unknown>,\n global: GlobalOptions,\n): Promise<TemplatesSaveResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const nextOptions = extractTemplateOptions(options);\n if (Object.keys(nextOptions).length === 0) {\n throw new PmCliError(\"templates save requires at least one create option flag\", EXIT_CODE.USAGE);\n }\n\n const now = nowIso();\n const storedPath = templatePath(pmRoot, normalizedName);\n let createdAt = now;\n if (await pathExists(storedPath)) {\n const existing = await readStoredTemplateDocument(pmRoot, normalizedName);\n createdAt = existing.created_at;\n }\n\n const document: StoredCreateTemplateDocument = {\n name: normalizedName,\n created_at: createdAt,\n updated_at: now,\n options: nextOptions,\n };\n await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });\n await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\\n`);\n return {\n name: document.name,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: storedPath,\n options: document.options,\n };\n}\n\nasync function readUserTemplateNames(pmRoot: string): Promise<string[]> {\n const dirPath = templatesDirectory(pmRoot);\n if (!(await pathExists(dirPath))) {\n return [];\n }\n const entries = await fs.readdir(dirPath);\n return entries\n .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))\n .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))\n .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry));\n}\n\n/**\n * Implements run templates list for the public runtime surface of this module.\n */\nexport async function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const userTemplates = await readUserTemplateNames(pmRoot);\n const userTemplateSet = new Set<string>(userTemplates);\n const builtinTemplates = Object.keys(BUILTIN_TEMPLATES).filter((name) => !userTemplateSet.has(name));\n const sortedUser = [...userTemplates].sort((left, right) => left.localeCompare(right));\n const sortedBuiltin = [...builtinTemplates].sort((left, right) => left.localeCompare(right));\n const templates = [...new Set([...sortedUser, ...sortedBuiltin])].sort((left, right) => left.localeCompare(right));\n return {\n templates,\n count: templates.length,\n builtin_templates: sortedBuiltin,\n user_templates: sortedUser,\n };\n}\n\n/**\n * Implements run templates show for the public runtime surface of this module.\n */\nexport async function runTemplatesShow(rawTemplateName: string, global: GlobalOptions): Promise<TemplatesShowResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n await ensureTrackerInitialized(pmRoot);\n const normalizedName = normalizeTemplateName(rawTemplateName);\n const { document, source } = await resolveTemplateDocument(pmRoot, normalizedName);\n return {\n name: document.name,\n source,\n created_at: document.created_at,\n updated_at: document.updated_at,\n path: source === \"builtin\" ? `builtin:${normalizedName}` : templatePath(pmRoot, normalizedName),\n options: document.options,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,OAAOA,WAAU;;;;;;;;;;ACwGV,IAAM,gBAAgB,CAAC,SAAS,OAAO,UAAU;AAajD,IAAM,mBAAkE;EAC7E,OAAO;IACL,MAAM;IACN,OAAO;IACP,SAAS;IACT,OAAO,wBAAwB;IAC/B,UAAU;MACR;QACE,IAAI;QACJ,OAAO,CAAC,QAAQ;QAChB,SAAS,CAAC,WAAW;QACrB,aAAa;;;IAGjB,QAAQ;MACN;QACE,KAAK;QACL,MAAM;QACN,UAAU,CAAC,UAAU,UAAU,MAAM;QACrC,aAAa;QACb,SAAS,CAAC,QAAQ;;MAEpB;QACE,KAAK;QACL,MAAM;QACN,UAAU,CAAC,UAAU,UAAU,MAAM;QACrC,aAAa;QACb,SAAS,CAAC,UAAU;;;IAGxB,WAAW;MACT;QACE,MAAM;QACN,qBAAqB;UACnB,CAAC,QAAQ,aAAa;UACtB,CAAC,eAAe,QAAQ;UACxB,CAAC,UAAU,aAAa;UACxB,CAAC,UAAU,QAAQ;UACnB,CAAC,eAAe,SAAS;UACzB,CAAC,WAAW,aAAa;;;;IAI/B,QAAQ;MACN,EAAE,KAAK,mBAAmB,OAAO,QAAQ,SAAS,kEAAiE;MACnH,EAAE,KAAK,sBAAsB,OAAO,MAAM,SAAS,4CAA2C;;IAEhG,WAAW;MACT;QACE,MAAM;QACN,SAAS;UACP,MAAM;UACN,UAAU;UACV,MAAM;UACN,oBAAoB;UACpB,MAAM;;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