@namzu/cli 51.1.0 → 51.2.0

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.
Files changed (360) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-YH3ORAMX.js → acp-HCVLUS7I.js} +106 -71
  4. package/dist/chunks/acp-HCVLUS7I.js.map +6 -0
  5. package/dist/chunks/{activity-command-6SLWX5O6.js → activity-command-I3OMRZ2T.js} +12 -12
  6. package/dist/chunks/{add-5DU7SP37.js → add-A65AU46H.js} +23 -23
  7. package/dist/chunks/{agent-IN76G7FR.js → agent-3A66KRCM.js} +39 -37
  8. package/dist/chunks/agent-session-LJZO5VIZ.js +71 -0
  9. package/dist/chunks/{archive-X5OO3HYU.js → archive-IWWDLSAO.js} +10 -10
  10. package/dist/chunks/{bin-main-MJURSFNJ.js → bin-main-CRX2U7A6.js} +8 -8
  11. package/dist/chunks/{binding-6EX5H32J.js → binding-4AMPOED7.js} +3 -3
  12. package/dist/chunks/{browser-UUSAOFML.js → browser-SAS7YPVD.js} +6 -6
  13. package/dist/chunks/{chat-J2DRST74.js → chat-ANHTX7D5.js} +15 -15
  14. package/dist/chunks/{chunk-BNIO5NNW.js → chunk-2HB47MDS.js} +57 -39
  15. package/dist/chunks/chunk-2HB47MDS.js.map +6 -0
  16. package/dist/chunks/{chunk-4MDH3G7P.js → chunk-3D52GNVJ.js} +4 -4
  17. package/dist/chunks/{chunk-DQGDG63U.js → chunk-3MJ3YKNV.js} +5 -5
  18. package/dist/chunks/chunk-3YM3IWPW.js +221 -0
  19. package/dist/chunks/chunk-3YM3IWPW.js.map +6 -0
  20. package/dist/chunks/{chunk-QN4WGK62.js → chunk-45Z4OPC6.js} +3 -3
  21. package/dist/chunks/{chunk-4GQ5ACCZ.js → chunk-52YXYXRG.js} +2 -2
  22. package/dist/chunks/{chunk-ASITCNWM.js → chunk-56ZS6OTK.js} +4 -4
  23. package/dist/chunks/{chunk-M3O7WEJF.js → chunk-57QGQNRI.js} +2 -2
  24. package/dist/chunks/{chunk-PYRMWOCP.js → chunk-5TPQGNYN.js} +4 -4
  25. package/dist/chunks/{chunk-N7COW4QY.js → chunk-5U42MB6F.js} +10 -10
  26. package/dist/chunks/{chunk-HSSTV5SF.js → chunk-5YMIK3VP.js} +3 -3
  27. package/dist/chunks/{chunk-YWKZQABS.js → chunk-6CKU4TCF.js} +2 -2
  28. package/dist/chunks/{chunk-KBLICB2N.js → chunk-6I4V7I5M.js} +2 -2
  29. package/dist/chunks/{chunk-VIJFICIC.js → chunk-6MI4Q5QQ.js} +4 -4
  30. package/dist/chunks/{chunk-76HAMOHW.js → chunk-6S4L4SAU.js} +6 -6
  31. package/dist/chunks/{chunk-CB7VORLS.js → chunk-AGC67H4M.js} +4 -4
  32. package/dist/chunks/{chunk-BZC5JPMB.js → chunk-ALXE3SUZ.js} +3 -3
  33. package/dist/chunks/{chunk-6J6AEQA4.js → chunk-ANVIYMV6.js} +3 -3
  34. package/dist/chunks/chunk-BBTPD3DU.js +19 -0
  35. package/dist/chunks/chunk-BBTPD3DU.js.map +6 -0
  36. package/dist/chunks/{chunk-S4HDKI6L.js → chunk-BC3IZXTY.js} +2 -2
  37. package/dist/chunks/{chunk-K4BMTUBH.js → chunk-BN32BPU6.js} +2 -2
  38. package/dist/chunks/chunk-BUP54TBX.js +214 -0
  39. package/dist/chunks/chunk-BUP54TBX.js.map +6 -0
  40. package/dist/chunks/{chunk-YUDCUW4N.js → chunk-CYCUJOAD.js} +3 -3
  41. package/dist/chunks/{chunk-ZJQYNG27.js → chunk-DLVHJFXI.js} +2 -2
  42. package/dist/chunks/{chunk-MJW6FQAW.js → chunk-DNOI4BL2.js} +2 -2
  43. package/dist/chunks/{chunk-FI5EMDFZ.js → chunk-DOPHHI6C.js} +3 -3
  44. package/dist/chunks/{chunk-NEKCM2HR.js → chunk-E5OETSRN.js} +6 -6
  45. package/dist/chunks/{chunk-HFLX3ZLT.js → chunk-E7IXVEOQ.js} +3 -3
  46. package/dist/chunks/{chunk-ZKOEUHCF.js → chunk-FKQOGEKL.js} +3 -3
  47. package/dist/chunks/{chunk-LNIM2TS3.js → chunk-FLPT7I7I.js} +4 -4
  48. package/dist/chunks/{chunk-DE4WWSBB.js → chunk-FMAUDMYL.js} +12 -12
  49. package/dist/chunks/{chunk-H32MIHLE.js → chunk-FSS72QJP.js} +2 -2
  50. package/dist/chunks/chunk-G4N43E6M.js +62 -0
  51. package/dist/chunks/chunk-G4N43E6M.js.map +6 -0
  52. package/dist/chunks/{chunk-VPIFXAL6.js → chunk-H56PLZHW.js} +2 -2
  53. package/dist/chunks/{chunk-2XXEIH7D.js → chunk-HHLWXGOG.js} +2 -2
  54. package/dist/chunks/{chunk-EK74R563.js → chunk-HQ4WFN7B.js} +732 -544
  55. package/dist/chunks/chunk-HQ4WFN7B.js.map +6 -0
  56. package/dist/chunks/{chunk-BGT2BABA.js → chunk-HXPRWMLH.js} +4 -4
  57. package/dist/chunks/{chunk-MPLS4I5N.js → chunk-ILPXZDTW.js} +116 -79
  58. package/dist/chunks/chunk-ILPXZDTW.js.map +6 -0
  59. package/dist/chunks/{chunk-UHYZ64ET.js → chunk-IPTWZUSV.js} +2 -2
  60. package/dist/chunks/{chunk-4DYB42HG.js → chunk-ITY5SBAS.js} +2 -2
  61. package/dist/chunks/{chunk-J4QN36GJ.js → chunk-JUN4VUC6.js} +64 -224
  62. package/dist/chunks/chunk-JUN4VUC6.js.map +6 -0
  63. package/dist/chunks/{chunk-ZYRABJ7J.js → chunk-K52DES57.js} +2 -2
  64. package/dist/chunks/chunk-KD6WL3W7.js +10 -0
  65. package/dist/chunks/chunk-KD6WL3W7.js.map +6 -0
  66. package/dist/chunks/{chunk-3KNUUOMF.js → chunk-KJ7Q3BC3.js} +2 -2
  67. package/dist/chunks/{chunk-AROJAFON.js → chunk-KJVRHBMX.js} +3 -3
  68. package/dist/chunks/{chunk-VDQQE3Q6.js → chunk-KZHMLRKY.js} +4 -4
  69. package/dist/chunks/{chunk-MFRWOJCD.js → chunk-LAXSPXNP.js} +4 -3
  70. package/dist/chunks/{chunk-MFRWOJCD.js.map → chunk-LAXSPXNP.js.map} +1 -1
  71. package/dist/chunks/{chunk-5HS5WIS3.js → chunk-LGH2T6KL.js} +2 -2
  72. package/dist/chunks/{chunk-2OGJPIGN.js → chunk-LQJ3TB5E.js} +14 -14
  73. package/dist/chunks/{chunk-TF6ZSM2M.js → chunk-LYPEV765.js} +2 -2
  74. package/dist/chunks/chunk-LYUY2FK2.js +141 -0
  75. package/dist/chunks/chunk-LYUY2FK2.js.map +6 -0
  76. package/dist/chunks/{chunk-YU65OZTC.js → chunk-M44I7P3H.js} +2 -2
  77. package/dist/chunks/{chunk-HAHNDC7N.js → chunk-NAWIOVUH.js} +3 -3
  78. package/dist/chunks/{chunk-WWC6L5WC.js → chunk-NGE7TNCY.js} +2 -2
  79. package/dist/chunks/{chunk-CSWUOY5K.js → chunk-NXJQTDVT.js} +17 -17
  80. package/dist/chunks/{chunk-QZDNCVK4.js → chunk-NY3I4WL7.js} +185 -363
  81. package/dist/chunks/chunk-NY3I4WL7.js.map +6 -0
  82. package/dist/chunks/{chunk-O6QJXKWZ.js → chunk-OEKCCZ7I.js} +5 -5
  83. package/dist/chunks/{chunk-3VKSD45U.js → chunk-OL5SKFPM.js} +4 -4
  84. package/dist/chunks/{chunk-MPUHBR73.js → chunk-OMP25UWR.js} +2 -2
  85. package/dist/chunks/{chunk-GTRG5VXA.js → chunk-P53E77KS.js} +3 -3
  86. package/dist/chunks/{chunk-P6CNFKJC.js → chunk-PI6KC5CD.js} +5 -5
  87. package/dist/chunks/{chunk-RZXNXGRE.js → chunk-Q5DW33F4.js} +2 -2
  88. package/dist/chunks/{chunk-RQKE2URW.js → chunk-QS65X7D6.js} +3 -3
  89. package/dist/chunks/{chunk-BIWDWFAK.js → chunk-QZ4V25KD.js} +3 -3
  90. package/dist/chunks/{chunk-JBQATPG3.js → chunk-RCLTSI6G.js} +2 -2
  91. package/dist/chunks/{chunk-ZRM2NW77.js → chunk-RDWVNVZS.js} +5 -5
  92. package/dist/chunks/{chunk-J267C5O6.js → chunk-SMX5YHRV.js} +2 -2
  93. package/dist/chunks/{chunk-YOCPU3WT.js → chunk-SQWFNFEX.js} +3 -3
  94. package/dist/chunks/{chunk-PR3HSIXG.js → chunk-SR75L2R5.js} +4 -4
  95. package/dist/chunks/{chunk-G2DGASUC.js → chunk-T5X3GYBF.js} +2 -2
  96. package/dist/chunks/{chunk-GN4BLP6C.js → chunk-TJSGSC2W.js} +9 -9
  97. package/dist/chunks/{chunk-B4M4IEOE.js → chunk-TTXZK3BR.js} +3 -3
  98. package/dist/chunks/{chunk-F2I6X667.js → chunk-U7AQ4OQJ.js} +4 -3
  99. package/dist/chunks/{chunk-VONTYDZ3.js → chunk-UPSI724V.js} +3 -3
  100. package/dist/chunks/{chunk-SRBCU3IJ.js → chunk-V23HHK5D.js} +2 -2
  101. package/dist/chunks/{chunk-R77WPUUF.js → chunk-VQHVH7X2.js} +3 -3
  102. package/dist/chunks/{chunk-FJZL4BJN.js → chunk-WJ4YRFPQ.js} +2 -2
  103. package/dist/chunks/{chunk-64CDTVEM.js → chunk-WJXVNXJZ.js} +12 -12
  104. package/dist/chunks/{chunk-DXFPBLQV.js → chunk-WOX4KI7C.js} +3 -3
  105. package/dist/chunks/{chunk-3MUNYBIF.js → chunk-X3L6N5RM.js} +11 -11
  106. package/dist/chunks/{chunk-JE2S7MW2.js → chunk-XFMGW2C5.js} +2 -2
  107. package/dist/chunks/{chunk-W5IR3SD3.js → chunk-XPCRLKFO.js} +6 -6
  108. package/dist/chunks/{chunk-XCDXSRY7.js → chunk-XYT53O3Z.js} +2 -2
  109. package/dist/chunks/{chunk-LJ4DIGHQ.js → chunk-YSV633T5.js} +9 -9
  110. package/dist/chunks/{chunk-LRLMZTZ3.js → chunk-ZXFEHB7N.js} +2 -2
  111. package/dist/chunks/{cli-runtime-YUFSSYYG.js → cli-runtime-5UE6P2QW.js} +19 -16
  112. package/dist/chunks/cli-runtime-5UE6P2QW.js.map +6 -0
  113. package/dist/chunks/{commands-J7XAMJC5.js → commands-IOHIM2PX.js} +5 -5
  114. package/dist/chunks/cost-MYSYQTT3.js +755 -0
  115. package/dist/chunks/cost-MYSYQTT3.js.map +6 -0
  116. package/dist/chunks/{crash-report-3GPFLNQX.js → crash-report-WLLGI2U4.js} +6 -6
  117. package/dist/chunks/day-CU5J7UAK.js +22 -0
  118. package/dist/chunks/{dist-2EQ3MAWA.js → dist-33QU2MGT.js} +2 -2
  119. package/dist/chunks/{dist-IS662MSA.js → dist-6G55RC27.js} +2 -2
  120. package/dist/chunks/{dist-5LXAFF2H.js → dist-CFPNJCLJ.js} +2 -2
  121. package/dist/chunks/{dist-CO47MPO4.js → dist-E2PF4PGO.js} +2 -2
  122. package/dist/chunks/{dist-4TO2X6U4.js → dist-FZYKXUR4.js} +2 -2
  123. package/dist/chunks/{dist-UXUFCGIX.js → dist-IXAUMLZH.js} +2 -2
  124. package/dist/chunks/{dist-EGCYKNFG.js → dist-MBVPANQB.js} +24 -2
  125. package/dist/chunks/{dist-F36KOHDP.js → dist-PKKDBDSA.js} +2 -2
  126. package/dist/chunks/{doctor-YC6Z7P3P.js → doctor-BXRPVVKL.js} +18 -18
  127. package/dist/chunks/{drain-5BQHD3KW.js → drain-EWKGL77B.js} +9 -9
  128. package/dist/chunks/{entry-ZJWR3CSL.js → entry-XPXHELKT.js} +6 -6
  129. package/dist/chunks/{eval-JHNFGVGA.js → eval-OLNNJGUO.js} +2 -2
  130. package/dist/chunks/{exec-YADZELFF.js → exec-XNMHHHTZ.js} +46 -42
  131. package/dist/chunks/exec-XNMHHHTZ.js.map +6 -0
  132. package/dist/chunks/{home-EBXWUU6C.js → home-T4ZVXIEX.js} +3 -3
  133. package/dist/chunks/{host-JU76NQJY.js → host-LQ6V4NJS.js} +10 -10
  134. package/dist/chunks/{host-queries-6TO7AIZE.js → host-queries-LEPTBKZK.js} +15 -15
  135. package/dist/chunks/{learn-YGTIACD6.js → learn-WOZKPYR4.js} +11 -11
  136. package/dist/chunks/{learn-builtin-FND7NEEV.js → learn-builtin-BVJFZF4R.js} +14 -14
  137. package/dist/chunks/{lifecycle-VBNEAO74.js → lifecycle-KKIDSRJV.js} +32 -32
  138. package/dist/chunks/{list-GQEKL3MC.js → list-ZWIXNGJV.js} +15 -15
  139. package/dist/chunks/{live-N3PPNKW6.js → live-4GQNVGPU.js} +17 -17
  140. package/dist/chunks/{login-KEFAKXJZ.js → login-MBXPJW6F.js} +13 -13
  141. package/dist/chunks/{logs-JZEIQMOQ.js → logs-7GVMBYAQ.js} +5 -5
  142. package/dist/chunks/{mcp-7CBDNNY3.js → mcp-45UUEZMF.js} +23 -23
  143. package/dist/chunks/{message-command-JAKH5U6B.js → message-command-YVAI3SLS.js} +47 -45
  144. package/dist/chunks/message-command-YVAI3SLS.js.map +6 -0
  145. package/dist/chunks/{open-Q63ZNCNO.js → open-UG6VAHDW.js} +8 -8
  146. package/dist/chunks/{operator-tools-SEK3DCMJ.js → operator-tools-M4SMIAYS.js} +13 -13
  147. package/dist/chunks/{output-schema-ROCYTWMQ.js → output-schema-MZ6X4WQ2.js} +3 -3
  148. package/dist/chunks/{pal-XOMURPYQ.js → pal-R4RSZP2U.js} +16 -16
  149. package/dist/chunks/{peers-GY5QNN5F.js → peers-6TIMGPGR.js} +7 -7
  150. package/dist/chunks/{peers-JILQNRCW.js → peers-T5SXNFYU.js} +6 -6
  151. package/dist/chunks/plugin-SAQJPDKX.js +1043 -0
  152. package/dist/chunks/plugin-SAQJPDKX.js.map +6 -0
  153. package/dist/chunks/{providers-NMMTLTEC.js → providers-CPHEQZCV.js} +11 -11
  154. package/dist/chunks/{pty-KR5RNX54.js → pty-YAFV4ZA6.js} +3 -3
  155. package/dist/chunks/render-QFCCPEEL.js +14 -0
  156. package/dist/chunks/resume-GZGHY4UR.js +23 -0
  157. package/dist/chunks/{resume-command-WOG47T6A.js → resume-command-WJH7SKYB.js} +5 -5
  158. package/dist/chunks/{schedule-V3OHZVHK.js → schedule-I7ZNWSN3.js} +8 -8
  159. package/dist/chunks/{service-XPJSCHPW.js → service-ZRXXXJW7.js} +36 -36
  160. package/dist/chunks/{skills-PGO6KGCD.js → skills-RIJBOCKN.js} +8 -8
  161. package/dist/chunks/{start-check-CLSVKYRW.js → start-check-5DQL76YU.js} +2 -2
  162. package/dist/chunks/{startup-failure-WN5PCOIE.js → startup-failure-7KMOAOXE.js} +2 -2
  163. package/dist/chunks/{state-W72YF7CF.js → state-QNSG3QWY.js} +2 -2
  164. package/dist/chunks/{store-4RNQ47OD.js → store-7NXFZTW7.js} +6 -6
  165. package/dist/chunks/{store-SQINHTJO.js → store-IDSNTJRG.js} +10 -10
  166. package/dist/chunks/{store-7SESBCUG.js → store-NE2I4H7E.js} +3 -3
  167. package/dist/chunks/store-NE2I4H7E.js.map +6 -0
  168. package/dist/chunks/{store-J4CYKAFS.js → store-TY2ZO2EP.js} +4 -4
  169. package/dist/chunks/store-TY2ZO2EP.js.map +6 -0
  170. package/dist/chunks/{tui-HYKE4V4J.js → tui-DLUH6HQ4.js} +78 -74
  171. package/dist/chunks/tui-DLUH6HQ4.js.map +6 -0
  172. package/dist/chunks/{upgrade-HE5NIE2M.js → upgrade-UZTPAIDF.js} +7 -7
  173. package/dist/chunks/{watch-C5YQJNHV.js → watch-AAZHSSIE.js} +71 -67
  174. package/dist/chunks/watch-AAZHSSIE.js.map +6 -0
  175. package/dist/chunks/{workspaces-CPOLSOKE.js → workspaces-KLYC5537.js} +16 -16
  176. package/dist/chunks/{worktree-TUBWOHUQ.js → worktree-4PKAJ7LT.js} +12 -12
  177. package/dist/cli.d.ts.map +1 -1
  178. package/dist/commands/acp.d.ts +20 -1
  179. package/dist/commands/acp.d.ts.map +1 -1
  180. package/dist/commands/cost.d.ts +26 -0
  181. package/dist/commands/cost.d.ts.map +1 -0
  182. package/dist/commands/desktop-host.d.ts.map +1 -1
  183. package/dist/commands/manifest.d.ts +2 -0
  184. package/dist/commands/manifest.d.ts.map +1 -1
  185. package/dist/commands/plugin.d.ts +18 -0
  186. package/dist/commands/plugin.d.ts.map +1 -0
  187. package/dist/desktop-contract.d.ts +21 -0
  188. package/dist/desktop-contract.d.ts.map +1 -0
  189. package/dist/index.d.ts +1 -0
  190. package/dist/index.d.ts.map +1 -1
  191. package/dist/index.js +31 -27
  192. package/dist/integrations/auto-update/install-kind.d.ts.map +1 -1
  193. package/dist/integrations/plugins/check-hint.d.ts +5 -0
  194. package/dist/integrations/plugins/check-hint.d.ts.map +1 -0
  195. package/dist/integrations/plugins/files.d.ts +17 -0
  196. package/dist/integrations/plugins/files.d.ts.map +1 -1
  197. package/dist/integrations/plugins/validate.d.ts +75 -0
  198. package/dist/integrations/plugins/validate.d.ts.map +1 -0
  199. package/dist/integrations/spend/day.d.ts +26 -0
  200. package/dist/integrations/spend/day.d.ts.map +1 -0
  201. package/dist/integrations/spend/fold.d.ts +136 -0
  202. package/dist/integrations/spend/fold.d.ts.map +1 -0
  203. package/dist/integrations/spend/ledger.d.ts +74 -0
  204. package/dist/integrations/spend/ledger.d.ts.map +1 -0
  205. package/dist/integrations/spend/render.d.ts +6 -0
  206. package/dist/integrations/spend/render.d.ts.map +1 -0
  207. package/dist/integrations/spend/report.d.ts +110 -0
  208. package/dist/integrations/spend/report.d.ts.map +1 -0
  209. package/dist/integrations/telemetry/otlp-export.d.ts +3 -0
  210. package/dist/integrations/telemetry/otlp-export.d.ts.map +1 -1
  211. package/dist/tui/App.d.ts.map +1 -1
  212. package/dist/tui/agent.d.ts.map +1 -1
  213. package/dist/tui/slashCommands.d.ts +5 -0
  214. package/dist/tui/slashCommands.d.ts.map +1 -1
  215. package/dist/user-commands/store.d.ts +14 -0
  216. package/dist/user-commands/store.d.ts.map +1 -1
  217. package/package.json +3 -3
  218. package/dist/chunks/acp-YH3ORAMX.js.map +0 -6
  219. package/dist/chunks/agent-session-5T4QOI6T.js +0 -69
  220. package/dist/chunks/chunk-BNIO5NNW.js.map +0 -6
  221. package/dist/chunks/chunk-EK74R563.js.map +0 -6
  222. package/dist/chunks/chunk-J4QN36GJ.js.map +0 -6
  223. package/dist/chunks/chunk-MPLS4I5N.js.map +0 -6
  224. package/dist/chunks/chunk-QZDNCVK4.js.map +0 -6
  225. package/dist/chunks/cli-runtime-YUFSSYYG.js.map +0 -6
  226. package/dist/chunks/exec-YADZELFF.js.map +0 -6
  227. package/dist/chunks/message-command-JAKH5U6B.js.map +0 -6
  228. package/dist/chunks/resume-A3XPV4Z5.js +0 -23
  229. package/dist/chunks/tui-HYKE4V4J.js.map +0 -6
  230. package/dist/chunks/watch-C5YQJNHV.js.map +0 -6
  231. /package/dist/chunks/{activity-command-6SLWX5O6.js.map → activity-command-I3OMRZ2T.js.map} +0 -0
  232. /package/dist/chunks/{add-5DU7SP37.js.map → add-A65AU46H.js.map} +0 -0
  233. /package/dist/chunks/{agent-IN76G7FR.js.map → agent-3A66KRCM.js.map} +0 -0
  234. /package/dist/chunks/{agent-session-5T4QOI6T.js.map → agent-session-LJZO5VIZ.js.map} +0 -0
  235. /package/dist/chunks/{archive-X5OO3HYU.js.map → archive-IWWDLSAO.js.map} +0 -0
  236. /package/dist/chunks/{bin-main-MJURSFNJ.js.map → bin-main-CRX2U7A6.js.map} +0 -0
  237. /package/dist/chunks/{binding-6EX5H32J.js.map → binding-4AMPOED7.js.map} +0 -0
  238. /package/dist/chunks/{browser-UUSAOFML.js.map → browser-SAS7YPVD.js.map} +0 -0
  239. /package/dist/chunks/{chat-J2DRST74.js.map → chat-ANHTX7D5.js.map} +0 -0
  240. /package/dist/chunks/{chunk-4MDH3G7P.js.map → chunk-3D52GNVJ.js.map} +0 -0
  241. /package/dist/chunks/{chunk-DQGDG63U.js.map → chunk-3MJ3YKNV.js.map} +0 -0
  242. /package/dist/chunks/{chunk-QN4WGK62.js.map → chunk-45Z4OPC6.js.map} +0 -0
  243. /package/dist/chunks/{chunk-4GQ5ACCZ.js.map → chunk-52YXYXRG.js.map} +0 -0
  244. /package/dist/chunks/{chunk-ASITCNWM.js.map → chunk-56ZS6OTK.js.map} +0 -0
  245. /package/dist/chunks/{chunk-M3O7WEJF.js.map → chunk-57QGQNRI.js.map} +0 -0
  246. /package/dist/chunks/{chunk-PYRMWOCP.js.map → chunk-5TPQGNYN.js.map} +0 -0
  247. /package/dist/chunks/{chunk-N7COW4QY.js.map → chunk-5U42MB6F.js.map} +0 -0
  248. /package/dist/chunks/{chunk-HSSTV5SF.js.map → chunk-5YMIK3VP.js.map} +0 -0
  249. /package/dist/chunks/{chunk-YWKZQABS.js.map → chunk-6CKU4TCF.js.map} +0 -0
  250. /package/dist/chunks/{chunk-KBLICB2N.js.map → chunk-6I4V7I5M.js.map} +0 -0
  251. /package/dist/chunks/{chunk-VIJFICIC.js.map → chunk-6MI4Q5QQ.js.map} +0 -0
  252. /package/dist/chunks/{chunk-76HAMOHW.js.map → chunk-6S4L4SAU.js.map} +0 -0
  253. /package/dist/chunks/{chunk-CB7VORLS.js.map → chunk-AGC67H4M.js.map} +0 -0
  254. /package/dist/chunks/{chunk-BZC5JPMB.js.map → chunk-ALXE3SUZ.js.map} +0 -0
  255. /package/dist/chunks/{chunk-6J6AEQA4.js.map → chunk-ANVIYMV6.js.map} +0 -0
  256. /package/dist/chunks/{chunk-S4HDKI6L.js.map → chunk-BC3IZXTY.js.map} +0 -0
  257. /package/dist/chunks/{chunk-K4BMTUBH.js.map → chunk-BN32BPU6.js.map} +0 -0
  258. /package/dist/chunks/{chunk-YUDCUW4N.js.map → chunk-CYCUJOAD.js.map} +0 -0
  259. /package/dist/chunks/{chunk-ZJQYNG27.js.map → chunk-DLVHJFXI.js.map} +0 -0
  260. /package/dist/chunks/{chunk-MJW6FQAW.js.map → chunk-DNOI4BL2.js.map} +0 -0
  261. /package/dist/chunks/{chunk-FI5EMDFZ.js.map → chunk-DOPHHI6C.js.map} +0 -0
  262. /package/dist/chunks/{chunk-NEKCM2HR.js.map → chunk-E5OETSRN.js.map} +0 -0
  263. /package/dist/chunks/{chunk-HFLX3ZLT.js.map → chunk-E7IXVEOQ.js.map} +0 -0
  264. /package/dist/chunks/{chunk-ZKOEUHCF.js.map → chunk-FKQOGEKL.js.map} +0 -0
  265. /package/dist/chunks/{chunk-LNIM2TS3.js.map → chunk-FLPT7I7I.js.map} +0 -0
  266. /package/dist/chunks/{chunk-DE4WWSBB.js.map → chunk-FMAUDMYL.js.map} +0 -0
  267. /package/dist/chunks/{chunk-H32MIHLE.js.map → chunk-FSS72QJP.js.map} +0 -0
  268. /package/dist/chunks/{chunk-VPIFXAL6.js.map → chunk-H56PLZHW.js.map} +0 -0
  269. /package/dist/chunks/{chunk-2XXEIH7D.js.map → chunk-HHLWXGOG.js.map} +0 -0
  270. /package/dist/chunks/{chunk-BGT2BABA.js.map → chunk-HXPRWMLH.js.map} +0 -0
  271. /package/dist/chunks/{chunk-UHYZ64ET.js.map → chunk-IPTWZUSV.js.map} +0 -0
  272. /package/dist/chunks/{chunk-4DYB42HG.js.map → chunk-ITY5SBAS.js.map} +0 -0
  273. /package/dist/chunks/{chunk-ZYRABJ7J.js.map → chunk-K52DES57.js.map} +0 -0
  274. /package/dist/chunks/{chunk-3KNUUOMF.js.map → chunk-KJ7Q3BC3.js.map} +0 -0
  275. /package/dist/chunks/{chunk-AROJAFON.js.map → chunk-KJVRHBMX.js.map} +0 -0
  276. /package/dist/chunks/{chunk-VDQQE3Q6.js.map → chunk-KZHMLRKY.js.map} +0 -0
  277. /package/dist/chunks/{chunk-5HS5WIS3.js.map → chunk-LGH2T6KL.js.map} +0 -0
  278. /package/dist/chunks/{chunk-2OGJPIGN.js.map → chunk-LQJ3TB5E.js.map} +0 -0
  279. /package/dist/chunks/{chunk-TF6ZSM2M.js.map → chunk-LYPEV765.js.map} +0 -0
  280. /package/dist/chunks/{chunk-YU65OZTC.js.map → chunk-M44I7P3H.js.map} +0 -0
  281. /package/dist/chunks/{chunk-HAHNDC7N.js.map → chunk-NAWIOVUH.js.map} +0 -0
  282. /package/dist/chunks/{chunk-WWC6L5WC.js.map → chunk-NGE7TNCY.js.map} +0 -0
  283. /package/dist/chunks/{chunk-CSWUOY5K.js.map → chunk-NXJQTDVT.js.map} +0 -0
  284. /package/dist/chunks/{chunk-O6QJXKWZ.js.map → chunk-OEKCCZ7I.js.map} +0 -0
  285. /package/dist/chunks/{chunk-3VKSD45U.js.map → chunk-OL5SKFPM.js.map} +0 -0
  286. /package/dist/chunks/{chunk-MPUHBR73.js.map → chunk-OMP25UWR.js.map} +0 -0
  287. /package/dist/chunks/{chunk-GTRG5VXA.js.map → chunk-P53E77KS.js.map} +0 -0
  288. /package/dist/chunks/{chunk-P6CNFKJC.js.map → chunk-PI6KC5CD.js.map} +0 -0
  289. /package/dist/chunks/{chunk-RZXNXGRE.js.map → chunk-Q5DW33F4.js.map} +0 -0
  290. /package/dist/chunks/{chunk-RQKE2URW.js.map → chunk-QS65X7D6.js.map} +0 -0
  291. /package/dist/chunks/{chunk-BIWDWFAK.js.map → chunk-QZ4V25KD.js.map} +0 -0
  292. /package/dist/chunks/{chunk-JBQATPG3.js.map → chunk-RCLTSI6G.js.map} +0 -0
  293. /package/dist/chunks/{chunk-ZRM2NW77.js.map → chunk-RDWVNVZS.js.map} +0 -0
  294. /package/dist/chunks/{chunk-J267C5O6.js.map → chunk-SMX5YHRV.js.map} +0 -0
  295. /package/dist/chunks/{chunk-YOCPU3WT.js.map → chunk-SQWFNFEX.js.map} +0 -0
  296. /package/dist/chunks/{chunk-PR3HSIXG.js.map → chunk-SR75L2R5.js.map} +0 -0
  297. /package/dist/chunks/{chunk-G2DGASUC.js.map → chunk-T5X3GYBF.js.map} +0 -0
  298. /package/dist/chunks/{chunk-GN4BLP6C.js.map → chunk-TJSGSC2W.js.map} +0 -0
  299. /package/dist/chunks/{chunk-B4M4IEOE.js.map → chunk-TTXZK3BR.js.map} +0 -0
  300. /package/dist/chunks/{chunk-F2I6X667.js.map → chunk-U7AQ4OQJ.js.map} +0 -0
  301. /package/dist/chunks/{chunk-VONTYDZ3.js.map → chunk-UPSI724V.js.map} +0 -0
  302. /package/dist/chunks/{chunk-SRBCU3IJ.js.map → chunk-V23HHK5D.js.map} +0 -0
  303. /package/dist/chunks/{chunk-R77WPUUF.js.map → chunk-VQHVH7X2.js.map} +0 -0
  304. /package/dist/chunks/{chunk-FJZL4BJN.js.map → chunk-WJ4YRFPQ.js.map} +0 -0
  305. /package/dist/chunks/{chunk-64CDTVEM.js.map → chunk-WJXVNXJZ.js.map} +0 -0
  306. /package/dist/chunks/{chunk-DXFPBLQV.js.map → chunk-WOX4KI7C.js.map} +0 -0
  307. /package/dist/chunks/{chunk-3MUNYBIF.js.map → chunk-X3L6N5RM.js.map} +0 -0
  308. /package/dist/chunks/{chunk-JE2S7MW2.js.map → chunk-XFMGW2C5.js.map} +0 -0
  309. /package/dist/chunks/{chunk-W5IR3SD3.js.map → chunk-XPCRLKFO.js.map} +0 -0
  310. /package/dist/chunks/{chunk-XCDXSRY7.js.map → chunk-XYT53O3Z.js.map} +0 -0
  311. /package/dist/chunks/{chunk-LJ4DIGHQ.js.map → chunk-YSV633T5.js.map} +0 -0
  312. /package/dist/chunks/{chunk-LRLMZTZ3.js.map → chunk-ZXFEHB7N.js.map} +0 -0
  313. /package/dist/chunks/{commands-J7XAMJC5.js.map → commands-IOHIM2PX.js.map} +0 -0
  314. /package/dist/chunks/{crash-report-3GPFLNQX.js.map → crash-report-WLLGI2U4.js.map} +0 -0
  315. /package/dist/chunks/{dist-EGCYKNFG.js.map → day-CU5J7UAK.js.map} +0 -0
  316. /package/dist/chunks/{dist-2EQ3MAWA.js.map → dist-33QU2MGT.js.map} +0 -0
  317. /package/dist/chunks/{dist-IS662MSA.js.map → dist-6G55RC27.js.map} +0 -0
  318. /package/dist/chunks/{dist-5LXAFF2H.js.map → dist-CFPNJCLJ.js.map} +0 -0
  319. /package/dist/chunks/{dist-CO47MPO4.js.map → dist-E2PF4PGO.js.map} +0 -0
  320. /package/dist/chunks/{dist-4TO2X6U4.js.map → dist-FZYKXUR4.js.map} +0 -0
  321. /package/dist/chunks/{dist-UXUFCGIX.js.map → dist-IXAUMLZH.js.map} +0 -0
  322. /package/dist/chunks/{doctor-YC6Z7P3P.js.map → dist-MBVPANQB.js.map} +0 -0
  323. /package/dist/chunks/{dist-F36KOHDP.js.map → dist-PKKDBDSA.js.map} +0 -0
  324. /package/dist/chunks/{home-EBXWUU6C.js.map → doctor-BXRPVVKL.js.map} +0 -0
  325. /package/dist/chunks/{drain-5BQHD3KW.js.map → drain-EWKGL77B.js.map} +0 -0
  326. /package/dist/chunks/{entry-ZJWR3CSL.js.map → entry-XPXHELKT.js.map} +0 -0
  327. /package/dist/chunks/{eval-JHNFGVGA.js.map → eval-OLNNJGUO.js.map} +0 -0
  328. /package/dist/chunks/{host-JU76NQJY.js.map → home-T4ZVXIEX.js.map} +0 -0
  329. /package/dist/chunks/{lifecycle-VBNEAO74.js.map → host-LQ6V4NJS.js.map} +0 -0
  330. /package/dist/chunks/{host-queries-6TO7AIZE.js.map → host-queries-LEPTBKZK.js.map} +0 -0
  331. /package/dist/chunks/{learn-YGTIACD6.js.map → learn-WOZKPYR4.js.map} +0 -0
  332. /package/dist/chunks/{learn-builtin-FND7NEEV.js.map → learn-builtin-BVJFZF4R.js.map} +0 -0
  333. /package/dist/chunks/{live-N3PPNKW6.js.map → lifecycle-KKIDSRJV.js.map} +0 -0
  334. /package/dist/chunks/{list-GQEKL3MC.js.map → list-ZWIXNGJV.js.map} +0 -0
  335. /package/dist/chunks/{login-KEFAKXJZ.js.map → live-4GQNVGPU.js.map} +0 -0
  336. /package/dist/chunks/{open-Q63ZNCNO.js.map → login-MBXPJW6F.js.map} +0 -0
  337. /package/dist/chunks/{logs-JZEIQMOQ.js.map → logs-7GVMBYAQ.js.map} +0 -0
  338. /package/dist/chunks/{mcp-7CBDNNY3.js.map → mcp-45UUEZMF.js.map} +0 -0
  339. /package/dist/chunks/{output-schema-ROCYTWMQ.js.map → open-UG6VAHDW.js.map} +0 -0
  340. /package/dist/chunks/{operator-tools-SEK3DCMJ.js.map → operator-tools-M4SMIAYS.js.map} +0 -0
  341. /package/dist/chunks/{peers-JILQNRCW.js.map → output-schema-MZ6X4WQ2.js.map} +0 -0
  342. /package/dist/chunks/{pal-XOMURPYQ.js.map → pal-R4RSZP2U.js.map} +0 -0
  343. /package/dist/chunks/{peers-GY5QNN5F.js.map → peers-6TIMGPGR.js.map} +0 -0
  344. /package/dist/chunks/{providers-NMMTLTEC.js.map → peers-T5SXNFYU.js.map} +0 -0
  345. /package/dist/chunks/{pty-KR5RNX54.js.map → providers-CPHEQZCV.js.map} +0 -0
  346. /package/dist/chunks/{resume-A3XPV4Z5.js.map → pty-YAFV4ZA6.js.map} +0 -0
  347. /package/dist/chunks/{resume-command-WOG47T6A.js.map → render-QFCCPEEL.js.map} +0 -0
  348. /package/dist/chunks/{start-check-CLSVKYRW.js.map → resume-GZGHY4UR.js.map} +0 -0
  349. /package/dist/chunks/{store-4RNQ47OD.js.map → resume-command-WJH7SKYB.js.map} +0 -0
  350. /package/dist/chunks/{schedule-V3OHZVHK.js.map → schedule-I7ZNWSN3.js.map} +0 -0
  351. /package/dist/chunks/{service-XPJSCHPW.js.map → service-ZRXXXJW7.js.map} +0 -0
  352. /package/dist/chunks/{skills-PGO6KGCD.js.map → skills-RIJBOCKN.js.map} +0 -0
  353. /package/dist/chunks/{store-7SESBCUG.js.map → start-check-5DQL76YU.js.map} +0 -0
  354. /package/dist/chunks/{startup-failure-WN5PCOIE.js.map → startup-failure-7KMOAOXE.js.map} +0 -0
  355. /package/dist/chunks/{state-W72YF7CF.js.map → state-QNSG3QWY.js.map} +0 -0
  356. /package/dist/chunks/{store-J4CYKAFS.js.map → store-7NXFZTW7.js.map} +0 -0
  357. /package/dist/chunks/{store-SQINHTJO.js.map → store-IDSNTJRG.js.map} +0 -0
  358. /package/dist/chunks/{upgrade-HE5NIE2M.js.map → upgrade-UZTPAIDF.js.map} +0 -0
  359. /package/dist/chunks/{workspaces-CPOLSOKE.js.map → workspaces-KLYC5537.js.map} +0 -0
  360. /package/dist/chunks/{worktree-TUBWOHUQ.js.map → worktree-4PKAJ7LT.js.map} +0 -0
@@ -0,0 +1,1043 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ COMMAND_FILE_KEYS,
5
+ parseCommandText
6
+ } from "./chunk-BUP54TBX.js";
7
+ import {
8
+ resolvePluginFileDir
9
+ } from "./chunk-3YM3IWPW.js";
10
+ import {
11
+ SKILL_MANIFEST_MAX_CHARS
12
+ } from "./chunk-U7AQ4OQJ.js";
13
+ import "./chunk-BBTPD3DU.js";
14
+ import {
15
+ terminalDisplayText
16
+ } from "./chunk-I4GTRFPK.js";
17
+ import "./chunk-NAWIOVUH.js";
18
+ import {
19
+ createFormatter
20
+ } from "./chunk-KONYGNG6.js";
21
+ import {
22
+ PERMISSION_MODE_NAMES
23
+ } from "./chunk-WMEZTDLT.js";
24
+ import "./chunk-U5UV2YRE.js";
25
+ import {
26
+ EXIT_FAIL,
27
+ EXIT_NOINPUT,
28
+ EXIT_OK,
29
+ EXIT_USAGE
30
+ } from "./chunk-FTMONTUX.js";
31
+ import "./chunk-M44I7P3H.js";
32
+ import "./chunk-LGH2T6KL.js";
33
+ import "./chunk-NGE7TNCY.js";
34
+ import {
35
+ AGENT_FILE_KEYS,
36
+ PluginManifestSchema,
37
+ RENAMED_PLUGIN_HOOK_EVENTS,
38
+ SKILL_FRONTMATTER_KEYS,
39
+ assertEnableable,
40
+ assertPluginHookEvent,
41
+ parseAgentMarkdown,
42
+ parsePluginManifestText,
43
+ parseSkillMarkdown,
44
+ resolveWithinReal,
45
+ skillModelDescription
46
+ } from "./chunk-HQ4WFN7B.js";
47
+ import {
48
+ __name
49
+ } from "./chunk-76FLAFCG.js";
50
+
51
+ // src/commands/plugin.ts
52
+ import { resolve } from "node:path";
53
+
54
+ // src/integrations/plugins/validate.ts
55
+ import { constants } from "node:fs";
56
+ import { lstat, open, readdir, realpath, stat } from "node:fs/promises";
57
+ import { isAbsolute, join, relative, sep } from "node:path";
58
+ var PLUGIN_VALIDATION_REPORT_VERSION = 1;
59
+ var MAX_CHECKED_FILE_BYTES = 4 * 1024 * 1024;
60
+ var MAX_CHECKED_FILES_PER_FOLDER = 500;
61
+ var MANIFEST_FILE = "plugin.json";
62
+ async function readInside(root, rel) {
63
+ let abs;
64
+ try {
65
+ abs = await resolveWithinReal(root, rel);
66
+ } catch (error) {
67
+ return { ok: false, kind: "outside", detail: message(error) };
68
+ }
69
+ let handle;
70
+ try {
71
+ const before = await stat(abs);
72
+ if (!before.isFile()) return { ok: false, kind: "not-file" };
73
+ handle = await open(abs, constants.O_RDONLY | constants.O_NONBLOCK);
74
+ const info = await handle.stat();
75
+ if (!info.isFile()) return { ok: false, kind: "not-file" };
76
+ if (info.size > MAX_CHECKED_FILE_BYTES) {
77
+ return { ok: false, kind: "too-large", detail: `${info.size} bytes` };
78
+ }
79
+ const buffer = Buffer.alloc(info.size);
80
+ let filled = 0;
81
+ while (filled < info.size) {
82
+ const { bytesRead } = await handle.read(buffer, filled, info.size - filled, filled);
83
+ if (bytesRead === 0) break;
84
+ filled += bytesRead;
85
+ }
86
+ const bytes = buffer.subarray(0, filled);
87
+ if (bytes.includes(0)) return { ok: false, kind: "binary" };
88
+ return { ok: true, text: bytes.toString("utf8"), abs };
89
+ } catch (error) {
90
+ const code = error.code;
91
+ if (code === "ENOENT" || code === "ENOTDIR") return { ok: false, kind: "missing" };
92
+ return { ok: false, kind: "unreadable", detail: message(error) };
93
+ } finally {
94
+ await handle?.close().catch(() => void 0);
95
+ }
96
+ }
97
+ __name(readInside, "readInside");
98
+ function message(error) {
99
+ return error instanceof Error ? error.message : String(error);
100
+ }
101
+ __name(message, "message");
102
+ function posix(path) {
103
+ return path.split(sep).join("/");
104
+ }
105
+ __name(posix, "posix");
106
+ function jsonLines(text) {
107
+ const lines = /* @__PURE__ */ new Map();
108
+ let i = 0;
109
+ let line = 1;
110
+ const skip = /* @__PURE__ */ __name(() => {
111
+ while (i < text.length) {
112
+ const c = text[i];
113
+ if (c === "\n") line++;
114
+ else if (c !== " " && c !== " " && c !== "\r" && c !== "\uFEFF") return;
115
+ i++;
116
+ }
117
+ }, "skip");
118
+ const string = /* @__PURE__ */ __name(() => {
119
+ const start = i;
120
+ i++;
121
+ while (i < text.length && text[i] !== '"') i += text[i] === "\\" ? 2 : 1;
122
+ i++;
123
+ return JSON.parse(text.slice(start, i));
124
+ }, "string");
125
+ const value = /* @__PURE__ */ __name((path) => {
126
+ skip();
127
+ const c = text[i];
128
+ if (c === "{") {
129
+ i++;
130
+ skip();
131
+ while (text[i] !== "}") {
132
+ skip();
133
+ const keyLine = line;
134
+ const key = string();
135
+ const child = path === "" ? key : `${path}/${key}`;
136
+ lines.set(child, keyLine);
137
+ skip();
138
+ i++;
139
+ value(child);
140
+ skip();
141
+ if (text[i] === ",") i++;
142
+ skip();
143
+ }
144
+ i++;
145
+ } else if (c === "[") {
146
+ i++;
147
+ skip();
148
+ let index = 0;
149
+ while (text[i] !== "]") {
150
+ skip();
151
+ const child = path === "" ? String(index) : `${path}/${index}`;
152
+ lines.set(child, line);
153
+ value(child);
154
+ index++;
155
+ skip();
156
+ if (text[i] === ",") i++;
157
+ skip();
158
+ }
159
+ i++;
160
+ } else if (c === '"') {
161
+ string();
162
+ } else {
163
+ while (i < text.length && !/[,\]}\s]/.test(text[i])) i++;
164
+ }
165
+ }, "value");
166
+ try {
167
+ value("");
168
+ } catch {
169
+ }
170
+ return lines;
171
+ }
172
+ __name(jsonLines, "jsonLines");
173
+ function frontmatterKeys(text) {
174
+ const lines = text.replace(/^/, "").split(/\r\n|\n|\r/);
175
+ let start = lines.findIndex((l) => l.trim() !== "");
176
+ if (start === -1 || lines[start]?.trim() !== "---") return [];
177
+ start++;
178
+ const keys = [];
179
+ for (let n = start; n < lines.length; n++) {
180
+ const l = lines[n];
181
+ if (/^---[ \t]*$/.test(l)) break;
182
+ const match = /^([A-Za-z0-9_-]+)\s*:/.exec(l);
183
+ if (match) keys.push({ key: match[1], line: n + 1 });
184
+ }
185
+ return keys;
186
+ }
187
+ __name(frontmatterKeys, "frontmatterKeys");
188
+ function lineForReason(text, reason) {
189
+ const keys = frontmatterKeys(text);
190
+ const named = keys.filter(
191
+ ({ key }) => new RegExp(`(^|[^A-Za-z0-9_-])${escapeRegExp(key)}([^A-Za-z0-9_-]|$)`).test(reason)
192
+ ).sort((a, b) => b.key.length - a.key.length)[0];
193
+ if (named) return named.line;
194
+ const lines = text.replace(/^/, "").split(/\r\n|\n|\r/);
195
+ const fence = lines.findIndex((l) => l.trim() === "---");
196
+ return fence === -1 ? 1 : fence + 1;
197
+ }
198
+ __name(lineForReason, "lineForReason");
199
+ function escapeRegExp(text) {
200
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
201
+ }
202
+ __name(escapeRegExp, "escapeRegExp");
203
+ function plainReason(reason, ...paths) {
204
+ let out = reason;
205
+ for (const p of paths) out = out.split(p).join("");
206
+ return out.replace(/\s+/g, " ").trim();
207
+ }
208
+ __name(plainReason, "plainReason");
209
+ var Collector = class {
210
+ static {
211
+ __name(this, "Collector");
212
+ }
213
+ problems = [];
214
+ /** Name and version read from a manifest that is otherwise refused, when they are plain text. */
215
+ identity = {};
216
+ parts = [];
217
+ part(kind, name, file) {
218
+ const id = kind === "manifest" ? "manifest" : `${kind}:${name}`;
219
+ if (!this.parts.some((p) => p.id === id)) {
220
+ this.parts.push({ kind, name, ...file !== void 0 ? { file } : {}, id });
221
+ }
222
+ return id;
223
+ }
224
+ add(problem) {
225
+ const { line, ...rest } = problem;
226
+ this.problems.push({ ...rest, ...line !== void 0 ? { line } : {} });
227
+ }
228
+ finish(folder, plugin) {
229
+ const parts = this.parts.map(({ id, kind, name, file }) => {
230
+ const own = this.problems.filter((p) => p.part === id);
231
+ return {
232
+ kind,
233
+ name,
234
+ ...file !== void 0 ? { file } : {},
235
+ status: own.some((p) => p.level === "error") ? "error" : own.length > 0 ? "warning" : "ok"
236
+ };
237
+ });
238
+ const errors = this.problems.filter((p) => p.level === "error").length;
239
+ const warnings = this.problems.length - errors;
240
+ return {
241
+ version: PLUGIN_VALIDATION_REPORT_VERSION,
242
+ folder,
243
+ status: errors > 0 ? "errors" : warnings > 0 ? "warnings" : "clean",
244
+ plugin,
245
+ parts,
246
+ problems: this.problems,
247
+ summary: { errors, warnings }
248
+ };
249
+ }
250
+ };
251
+ function unreadableReport(folder, readError) {
252
+ return {
253
+ version: PLUGIN_VALIDATION_REPORT_VERSION,
254
+ folder,
255
+ status: "unreadable",
256
+ readError,
257
+ plugin: {},
258
+ parts: [],
259
+ problems: [],
260
+ summary: { errors: 0, warnings: 0 }
261
+ };
262
+ }
263
+ __name(unreadableReport, "unreadableReport");
264
+ var REFUSED = "The loader refuses the whole plugin; nothing in it is loaded.";
265
+ var FILE_NOTE = "This file is read, never run.";
266
+ async function validatePluginFolder(folder) {
267
+ let root;
268
+ try {
269
+ root = await realpath(folder);
270
+ if (!(await stat(root)).isDirectory()) {
271
+ return unreadableReport(folder, "it is not a folder.");
272
+ }
273
+ await readdir(root);
274
+ } catch (error) {
275
+ const code = error.code;
276
+ return unreadableReport(
277
+ folder,
278
+ code === "ENOENT" ? "it does not exist." : `it could not be opened: ${message(error)}`
279
+ );
280
+ }
281
+ const c = new Collector();
282
+ const manifest = await checkManifest(root, c);
283
+ if (manifest) await checkParts(root, manifest, c);
284
+ return c.finish(root, manifest ? { name: manifest.name, version: manifest.version } : c.identity);
285
+ }
286
+ __name(validatePluginFolder, "validatePluginFolder");
287
+ async function checkManifest(root, c) {
288
+ const part = c.part("manifest", MANIFEST_FILE, MANIFEST_FILE);
289
+ const problem = /* @__PURE__ */ __name((code, text, consequence = REFUSED, line, level = "error") => c.add({ level, part, file: MANIFEST_FILE, line, code, message: text, consequence }), "problem");
290
+ let entry;
291
+ try {
292
+ entry = await lstat(join(root, MANIFEST_FILE));
293
+ } catch {
294
+ problem(
295
+ "manifest-missing",
296
+ `There is no ${MANIFEST_FILE} in this folder.`,
297
+ "The folder is not a plugin; discovery skips it and --plugin-dir refuses it."
298
+ );
299
+ return void 0;
300
+ }
301
+ if (entry.isSymbolicLink() || !entry.isFile()) {
302
+ problem(
303
+ "manifest-not-regular",
304
+ `${MANIFEST_FILE} must be a regular file, not a link or a folder.`
305
+ );
306
+ return void 0;
307
+ }
308
+ const read = await readInside(root, MANIFEST_FILE);
309
+ if (!read.ok) {
310
+ const reason = read.kind === "too-large" ? `${MANIFEST_FILE} is ${read.detail ?? "very large"}, over the ${MAX_CHECKED_FILE_BYTES} bytes this check reads.` : read.kind === "binary" ? `${MANIFEST_FILE} is not a text file.` : `${MANIFEST_FILE} could not be read${read.detail ? `: ${read.detail}` : "."}`;
311
+ if (read.kind === "too-large") {
312
+ problem(
313
+ "manifest-too-large",
314
+ `${reason} It was not read, so nothing else in this plugin was checked.`,
315
+ "The loader reads a manifest of any size; whether it accepts this one is not known here.",
316
+ void 0,
317
+ "warning"
318
+ );
319
+ return void 0;
320
+ }
321
+ problem(`manifest-${read.kind === "binary" ? "binary" : "unreadable"}`, reason);
322
+ return void 0;
323
+ }
324
+ let parsed;
325
+ try {
326
+ parsed = parsePluginManifestText(read.text);
327
+ } catch (error) {
328
+ const lines2 = jsonLines(read.text);
329
+ try {
330
+ const loose = JSON.parse(read.text);
331
+ c.identity = {
332
+ ...typeof loose.name === "string" ? { name: loose.name } : {},
333
+ ...typeof loose.version === "string" ? { version: loose.version } : {}
334
+ };
335
+ } catch {
336
+ }
337
+ const issues = error.issues;
338
+ if (Array.isArray(issues)) {
339
+ for (const issue of issues) {
340
+ const where = issue.path.map(
341
+ (step, at) => typeof step === "number" ? `[${step}]` : at === 0 ? step : `.${step}`
342
+ ).join("");
343
+ const keys = issue.code === "unrecognized_keys" && issue.keys ? issue.keys : void 0;
344
+ const text = keys ? `${where ? `"${where}" has` : "The manifest has"} ${keys.length === 1 ? "a field" : "fields"} the loader does not accept: ${keys.map((k) => `"${k}"`).join(", ")}.` : `${where ? `"${where}": ` : ""}${issue.message}.`;
345
+ const path = [...issue.path, ...keys?.[0] ? [keys[0]] : []].join("/");
346
+ problem(
347
+ "manifest-schema",
348
+ text,
349
+ REFUSED,
350
+ lines2.get(path) ?? lines2.get(issue.path.join("/"))
351
+ );
352
+ }
353
+ } else {
354
+ const text = message(error);
355
+ const at = /line (\d+)/.exec(text);
356
+ const position = /position (\d+)/.exec(text);
357
+ const line = at ? Number(at[1]) : position ? read.text.slice(0, Number(position[1])).split("\n").length : void 0;
358
+ problem("manifest-json", `${MANIFEST_FILE} is not valid JSON: ${text}.`, REFUSED, line);
359
+ }
360
+ return void 0;
361
+ }
362
+ try {
363
+ assertEnableable(parsed, { skillsSupported: true });
364
+ } catch (error) {
365
+ problem("manifest-incompatible", plainReason(message(error)));
366
+ }
367
+ const lines = jsonLines(read.text);
368
+ let raw;
369
+ try {
370
+ raw = JSON.parse(read.text);
371
+ } catch {
372
+ raw = void 0;
373
+ }
374
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
375
+ const known = new Set(Object.keys(PluginManifestSchema.shape));
376
+ for (const key of Object.keys(raw)) {
377
+ if (known.has(key)) continue;
378
+ problem(
379
+ "manifest-unknown-key",
380
+ `"${key}" is not a field Namzu reads in a manifest, so it is ignored. If it is a misspelling, the part it was meant to declare is missing.`,
381
+ "The loader drops the field without a word.",
382
+ lines.get(key),
383
+ "warning"
384
+ );
385
+ }
386
+ }
387
+ if (!/^\d+\.\d+\.\d+([-+].*)?$/.test(parsed.version)) {
388
+ problem(
389
+ "manifest-version-format",
390
+ `"version" is "${parsed.version}", which is not a semantic version such as 1.0.0.`,
391
+ "The loader accepts any text; tools that compare versions will not.",
392
+ lines.get("version"),
393
+ "warning"
394
+ );
395
+ }
396
+ const contributes = (parsed.tools?.length ?? 0) + (parsed.skills?.length ?? 0) + (parsed.hooks?.length ?? 0) + (parsed.mcpServers?.length ?? 0) + (parsed.commands?.length ?? 0) + (parsed.agents?.length ?? 0) + (parsed.instructions ? 1 : 0);
397
+ if (contributes === 0) {
398
+ problem(
399
+ "manifest-empty",
400
+ "The plugin declares no tools, skills, hooks, MCP servers, commands, agents or instructions, so it adds nothing.",
401
+ "It loads and does nothing.",
402
+ void 0,
403
+ "warning"
404
+ );
405
+ }
406
+ return parsed;
407
+ }
408
+ __name(checkManifest, "checkManifest");
409
+ async function checkParts(root, manifest, c) {
410
+ const pluginName = manifest.name;
411
+ for (const [kind, list] of [
412
+ ["tool", manifest.tools],
413
+ ["hook", manifest.hooks]
414
+ ]) {
415
+ const seen = /* @__PURE__ */ new Set();
416
+ for (const [index, rel] of (list ?? []).entries()) {
417
+ const part = c.part(kind, rel, rel);
418
+ const key = `${kind === "tool" ? "tools" : "hooks"}/${index}`;
419
+ if (seen.has(rel)) {
420
+ c.add({
421
+ level: "warning",
422
+ part,
423
+ file: MANIFEST_FILE,
424
+ code: "part-duplicate",
425
+ message: `"${rel}" is listed twice in "${kind === "tool" ? "tools" : "hooks"}".`,
426
+ consequence: "The module is imported once, but its tools or hooks are registered twice."
427
+ });
428
+ }
429
+ seen.add(rel);
430
+ await checkModule(root, kind, rel, part, key, c);
431
+ }
432
+ }
433
+ const skillNames = /* @__PURE__ */ new Set();
434
+ for (const rel of manifest.skills ?? []) {
435
+ const part = c.part("skill", rel, rel);
436
+ await checkSkill(root, rel, part, skillNames, c);
437
+ }
438
+ checkMcpServers(root, manifest, c);
439
+ const commandNames = /* @__PURE__ */ new Map();
440
+ for (const rel of manifest.commands ?? []) {
441
+ await checkFolder(root, rel, "commands", pluginName, c, async (file, text, abs) => {
442
+ const base = file.slice(0, -".md".length);
443
+ const name = `${pluginName}__${base}`;
444
+ const rel2 = posix(relative(root, abs));
445
+ const part = c.part("command", name, rel2);
446
+ const prior = commandNames.get(name);
447
+ if (prior !== void 0) {
448
+ c.add({
449
+ level: "warning",
450
+ part,
451
+ file: rel2,
452
+ code: "command-duplicate",
453
+ message: `/${name} is also written by ${prior}.`,
454
+ consequence: "The file read last replaces the other."
455
+ });
456
+ }
457
+ commandNames.set(name, rel2);
458
+ if (/\s/.test(base)) {
459
+ c.add({
460
+ level: "warning",
461
+ part,
462
+ file: rel2,
463
+ code: "command-name",
464
+ message: `The file name "${file}" has a space, so "/${name}" cannot be typed as one word.`,
465
+ consequence: "The command is listed but cannot be run by name."
466
+ });
467
+ }
468
+ const command = parseCommandText(text, abs, name, "plugin");
469
+ if (command.problem) {
470
+ c.add({
471
+ level: "error",
472
+ part,
473
+ file: rel2,
474
+ line: lineForReason(text, command.problem),
475
+ code: "command-invalid",
476
+ message: `The command file ${plainReason(command.problem, abs)}.`,
477
+ consequence: "The command is listed with this reason and cannot be used."
478
+ });
479
+ return;
480
+ }
481
+ if (command.template.trim() === "") {
482
+ c.add({
483
+ level: "warning",
484
+ part,
485
+ file: rel2,
486
+ code: "command-empty",
487
+ message: "The file has no prompt text after its frontmatter.",
488
+ consequence: "The command sends an empty prompt."
489
+ });
490
+ }
491
+ unknownKeys(text, COMMAND_FILE_KEYS, part, rel2, "command-unknown-key", c, "a command file");
492
+ });
493
+ }
494
+ const agentNames = /* @__PURE__ */ new Map();
495
+ for (const rel of manifest.agents ?? []) {
496
+ await checkFolder(root, rel, "agents", pluginName, c, async (file, text, abs) => {
497
+ const rel2 = posix(relative(root, abs));
498
+ const fallback = `${pluginName}__${file.slice(0, -".md".length)}`;
499
+ const found = parseAgentMarkdown(
500
+ text,
501
+ abs,
502
+ "plugin",
503
+ void 0,
504
+ /* @__PURE__ */ new Set([...PERMISSION_MODE_NAMES, "inherit"])
505
+ );
506
+ const part = c.part(
507
+ "agent",
508
+ "reason" in found ? fallback : `${pluginName}__${found.name}`,
509
+ rel2
510
+ );
511
+ if ("reason" in found) {
512
+ c.add({
513
+ level: "error",
514
+ part,
515
+ file: rel2,
516
+ line: lineForReason(text, found.reason),
517
+ code: "agent-invalid",
518
+ message: `The agent file ${plainReason(found.reason, abs)}.`,
519
+ consequence: "The file is skipped and named in the log; the other agents load."
520
+ });
521
+ return;
522
+ }
523
+ const full = `${pluginName}__${found.name}`;
524
+ const prior = agentNames.get(full);
525
+ if (prior !== void 0) {
526
+ c.add({
527
+ level: "warning",
528
+ part,
529
+ file: rel2,
530
+ code: "agent-duplicate",
531
+ message: `The agent "${full}" is also defined by ${prior}.`,
532
+ consequence: "The file read last replaces the other."
533
+ });
534
+ }
535
+ agentNames.set(full, rel2);
536
+ unknownKeys(text, AGENT_FILE_KEYS, part, rel2, "agent-unknown-key", c, "an agent file");
537
+ });
538
+ }
539
+ }
540
+ __name(checkParts, "checkParts");
541
+ function unknownKeys(text, known, part, file, code, c, what) {
542
+ for (const { key, line } of frontmatterKeys(text)) {
543
+ if (known.includes(key)) continue;
544
+ c.add({
545
+ level: "warning",
546
+ part,
547
+ file,
548
+ line,
549
+ code,
550
+ message: `"${key}" is not a key ${what} reads, so it is ignored. If it is a misspelling, what it was meant to set is not set.`,
551
+ consequence: "The loader drops the key without a word."
552
+ });
553
+ }
554
+ }
555
+ __name(unknownKeys, "unknownKeys");
556
+ function readProblem(read, what, rel) {
557
+ switch (read.kind) {
558
+ case "outside":
559
+ return {
560
+ code: "path-outside",
561
+ text: `${what} "${rel}" leaves the plugin folder, so it is not followed.`
562
+ };
563
+ case "missing":
564
+ return { code: "path-missing", text: `${what} "${rel}" does not exist.` };
565
+ case "not-file":
566
+ return { code: "path-not-file", text: `${what} "${rel}" is not a regular file.` };
567
+ case "too-large":
568
+ return {
569
+ code: "file-too-large",
570
+ text: `${what} "${rel}" is ${read.detail ?? "very large"}, over the ${MAX_CHECKED_FILE_BYTES} bytes this check reads, so it was not read.`
571
+ };
572
+ case "binary":
573
+ return { code: "file-binary", text: `${what} "${rel}" is not a text file.` };
574
+ default:
575
+ return {
576
+ code: "file-unreadable",
577
+ text: `${what} "${rel}" could not be read${read.detail ? `: ${read.detail}` : "."}`
578
+ };
579
+ }
580
+ }
581
+ __name(readProblem, "readProblem");
582
+ var MARKDOWN_LOOKALIKE = /\.(md|markdown|mdown|mkd|mdx)$/i;
583
+ var MODULE_EXTENSIONS = [".js", ".mjs", ".cjs"];
584
+ async function checkModule(root, kind, rel, part, _key, c) {
585
+ const what = kind === "tool" ? "The tool module" : "The hook module";
586
+ const read = await readInside(root, rel);
587
+ if (!read.ok) {
588
+ const { code, text } = readProblem(read, what, rel);
589
+ const scanOnly = read.kind === "too-large";
590
+ c.add({
591
+ level: scanOnly ? "warning" : "error",
592
+ part,
593
+ file: MANIFEST_FILE,
594
+ code,
595
+ message: text,
596
+ consequence: scanOnly ? "The module is not scanned; whether it loads is decided when it is imported." : REFUSED
597
+ });
598
+ return;
599
+ }
600
+ const file = posix(relative(root, read.abs));
601
+ if (!MODULE_EXTENSIONS.some((ext) => read.abs.endsWith(ext))) {
602
+ c.add({
603
+ level: "warning",
604
+ part,
605
+ file,
606
+ code: "module-extension",
607
+ message: `${what} "${rel}" does not end in .js, .mjs or .cjs. Namzu imports it with Node, which loads only those with certainty.`,
608
+ consequence: "The import may fail, and then the loader refuses the whole plugin."
609
+ });
610
+ }
611
+ const exportName = kind === "tool" ? "tools" : "hooks";
612
+ if (!new RegExp(`\\b${exportName}\\b`).test(read.text)) {
613
+ c.add({
614
+ level: "warning",
615
+ part,
616
+ file,
617
+ code: "module-export",
618
+ message: `The text of ${what.toLowerCase()} "${rel}" never mentions "${exportName}". The loader needs the module to export a "${exportName}" array. ${FILE_NOTE}`,
619
+ consequence: REFUSED
620
+ });
621
+ }
622
+ if (kind === "hook") {
623
+ const seen = /* @__PURE__ */ new Set();
624
+ for (const match of withoutComments(read.text).matchAll(
625
+ /\bevent\s*:\s*(['"`])([A-Za-z0-9_]+)\1/g
626
+ )) {
627
+ const event = match[2];
628
+ if (seen.has(event)) continue;
629
+ seen.add(event);
630
+ try {
631
+ assertPluginHookEvent(event);
632
+ } catch (error) {
633
+ const renamed = RENAMED_PLUGIN_HOOK_EVENTS[event];
634
+ c.add({
635
+ level: "warning",
636
+ part,
637
+ file,
638
+ line: read.text.slice(0, match.index).split("\n").length,
639
+ code: "hook-event-unknown",
640
+ message: renamed ? `The hook event "${event}" was renamed to "${renamed}", so a hook written under the old name cannot be registered.` : `"${event}" is not a hook event Namzu has, so a hook written for it cannot be registered.`,
641
+ consequence: `Found by reading the text, not by running it. If the module really registers it, the loader refuses the whole plugin (${plainReason(message(error))}).`
642
+ });
643
+ }
644
+ }
645
+ }
646
+ }
647
+ __name(checkModule, "checkModule");
648
+ function withoutComments(text) {
649
+ return text.replace(/\/\*[\s\S]*?\*\//g, (block) => block.replace(/[^\n]/g, " ")).replace(/(^|[^:'"`\\])\/\/[^\n]*/gm, (_m, lead) => lead);
650
+ }
651
+ __name(withoutComments, "withoutComments");
652
+ async function checkSkill(root, rel, part, names, c) {
653
+ let dir;
654
+ try {
655
+ dir = await resolveWithinReal(root, rel);
656
+ } catch {
657
+ c.add({
658
+ level: "error",
659
+ part,
660
+ file: MANIFEST_FILE,
661
+ code: "path-outside",
662
+ message: `The skill folder "${rel}" leaves the plugin folder, so it is not followed.`,
663
+ consequence: REFUSED
664
+ });
665
+ return;
666
+ }
667
+ let isDir = false;
668
+ try {
669
+ isDir = (await stat(dir)).isDirectory();
670
+ } catch {
671
+ isDir = false;
672
+ }
673
+ if (!isDir) {
674
+ c.add({
675
+ level: "error",
676
+ part,
677
+ file: MANIFEST_FILE,
678
+ code: "path-missing",
679
+ message: `The skill folder "${rel}" does not exist or is not a folder.`,
680
+ consequence: REFUSED
681
+ });
682
+ return;
683
+ }
684
+ const skillFile = posix(join(relative(root, dir), "SKILL.md"));
685
+ const read = await readInside(root, skillFile);
686
+ if (!read.ok) {
687
+ if (read.kind === "outside") {
688
+ c.add({
689
+ level: "warning",
690
+ part,
691
+ file: skillFile,
692
+ code: "path-outside",
693
+ message: `SKILL.md in "${rel}" is a link to a file outside the plugin folder, so it is not followed and was not checked.`,
694
+ consequence: "The loader reads it through the link, so what it holds is up to whatever is there."
695
+ });
696
+ return;
697
+ }
698
+ const { code, text } = readProblem(read, "The skill file", skillFile);
699
+ c.add({
700
+ // Too large to read here, but the loader reads any size: not read is not refused.
701
+ level: read.kind === "too-large" ? "warning" : "error",
702
+ part,
703
+ file: skillFile,
704
+ code: read.kind === "missing" ? "path-missing" : code,
705
+ message: read.kind === "missing" ? `"${rel}" has no SKILL.md.` : text,
706
+ consequence: read.kind === "too-large" ? "The loader reads it whatever its size." : REFUSED
707
+ });
708
+ return;
709
+ }
710
+ let skill;
711
+ try {
712
+ skill = parseSkillMarkdown(read.text, dir);
713
+ } catch (error) {
714
+ const reason = message(error);
715
+ c.add({
716
+ level: "error",
717
+ part,
718
+ file: skillFile,
719
+ line: lineForReason(read.text, reason),
720
+ code: "skill-invalid",
721
+ message: `The skill file ${plainReason(reason, `SKILL.md at "${dir}": `, `SKILL.md at "${dir}"`)}.`,
722
+ consequence: REFUSED
723
+ });
724
+ return;
725
+ }
726
+ const full = skill.metadata.name;
727
+ if (names.has(full)) {
728
+ c.add({
729
+ level: "error",
730
+ part,
731
+ file: skillFile,
732
+ code: "skill-duplicate",
733
+ message: `Two declared skills are named "${full}".`,
734
+ consequence: REFUSED
735
+ });
736
+ }
737
+ names.add(full);
738
+ const model = skillModelDescription(skill.metadata).length;
739
+ const entry = model + full.length + dir.length + 90;
740
+ if (entry > SKILL_MANIFEST_MAX_CHARS / 4) {
741
+ c.add({
742
+ level: "warning",
743
+ part,
744
+ file: skillFile,
745
+ code: "skill-description-large",
746
+ message: `The description and when_to_use of "${full}" take ${model} characters; with its name and place they use about ${entry} of the ${SKILL_MANIFEST_MAX_CHARS} the list of skills may use.`,
747
+ consequence: "Skills after it can be left out of the list the model sees (they stay loadable by name)."
748
+ });
749
+ }
750
+ if (skill.body.trim() === "") {
751
+ c.add({
752
+ level: "warning",
753
+ part,
754
+ file: skillFile,
755
+ code: "skill-body-empty",
756
+ message: `"${full}" has no instructions after its frontmatter.`,
757
+ consequence: "It loads and gives the model nothing to follow."
758
+ });
759
+ }
760
+ unknownKeys(read.text, SKILL_FRONTMATTER_KEYS, part, skillFile, "skill-unknown-key", c, "a skill");
761
+ }
762
+ __name(checkSkill, "checkSkill");
763
+ function leavesFolder(root, value) {
764
+ if (value.startsWith("~")) return true;
765
+ if (isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value)) {
766
+ const rel = relative(root, value);
767
+ return rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel);
768
+ }
769
+ return value.split(/[\\/]/).includes("..");
770
+ }
771
+ __name(leavesFolder, "leavesFolder");
772
+ function checkMcpServers(root, manifest, c) {
773
+ const names = /* @__PURE__ */ new Set();
774
+ for (const server of manifest.mcpServers ?? []) {
775
+ const part = c.part("mcp-server", server.name, MANIFEST_FILE);
776
+ if (names.has(server.name)) {
777
+ c.add({
778
+ level: "warning",
779
+ part,
780
+ file: MANIFEST_FILE,
781
+ code: "mcp-duplicate-server",
782
+ message: `Two MCP servers are named "${server.name}".`,
783
+ consequence: "Both start, and their tool names collide."
784
+ });
785
+ }
786
+ names.add(server.name);
787
+ if (server.command.includes("/") || server.command.includes("\\")) {
788
+ if (leavesFolder(root, server.command)) {
789
+ c.add({
790
+ level: "warning",
791
+ part,
792
+ file: MANIFEST_FILE,
793
+ code: "mcp-command-outside",
794
+ message: `The command "${server.command}" of "${server.name}" points outside the plugin folder. It was not run and not looked at.`,
795
+ consequence: "It starts whatever is there on the machine that loads the plugin."
796
+ });
797
+ }
798
+ }
799
+ for (const arg of server.args ?? []) {
800
+ if (/^(\/|[a-zA-Z]:[\\/]|\.\.?[\\/]|~)/.test(arg) && leavesFolder(root, arg)) {
801
+ c.add({
802
+ level: "warning",
803
+ part,
804
+ file: MANIFEST_FILE,
805
+ code: "mcp-arg-outside",
806
+ message: `The argument "${arg}" of "${server.name}" points outside the plugin folder.`,
807
+ consequence: "The server is started with it as written."
808
+ });
809
+ }
810
+ }
811
+ }
812
+ }
813
+ __name(checkMcpServers, "checkMcpServers");
814
+ async function checkFolder(root, rel, field, pluginName, c, each) {
815
+ const resolved = resolvePluginFileDir(root, rel);
816
+ const part = c.part(field === "commands" ? "command" : "agent", `${field}:${rel}`, rel);
817
+ const dropPlaceholder = /* @__PURE__ */ __name(() => {
818
+ const at = c.parts.findIndex((p) => p.id === part);
819
+ if (at !== -1 && !c.problems.some((p) => p.part === part)) c.parts.splice(at, 1);
820
+ }, "dropPlaceholder");
821
+ if (resolved.kind !== "inside") {
822
+ c.add({
823
+ level: "error",
824
+ part,
825
+ file: MANIFEST_FILE,
826
+ code: resolved.kind === "outside" ? "path-outside" : "path-missing",
827
+ message: resolved.kind === "outside" ? `The ${field} folder "${rel}" leads outside the plugin folder, so it is not followed.` : `The ${field} folder "${rel}" was not found.`,
828
+ consequence: `The folder is skipped and named in the log; the plugin's other parts load.`
829
+ });
830
+ return;
831
+ }
832
+ let entries;
833
+ let passedOver = [];
834
+ try {
835
+ const all = await readdir(resolved.dir, { withFileTypes: true });
836
+ entries = all.filter((e) => e.name.endsWith(".md"));
837
+ passedOver = all.filter(
838
+ (e) => !e.isDirectory() && !e.name.endsWith(".md") && MARKDOWN_LOOKALIKE.test(e.name)
839
+ );
840
+ } catch (error) {
841
+ c.add({
842
+ level: "error",
843
+ part,
844
+ file: MANIFEST_FILE,
845
+ code: "file-unreadable",
846
+ message: `The ${field} folder "${rel}" could not be read: ${message(error)}`,
847
+ consequence: "The folder is skipped."
848
+ });
849
+ return;
850
+ }
851
+ entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
852
+ passedOver.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
853
+ for (const entry of passedOver.slice(0, MAX_CHECKED_FILES_PER_FOLDER)) {
854
+ const rel2 = posix(relative(root, join(resolved.dir, entry.name)));
855
+ c.add({
856
+ level: "warning",
857
+ part,
858
+ file: rel2,
859
+ code: "file-ignored",
860
+ message: `"${entry.name}" looks like a markdown file, but only names ending in lowercase ".md" are read, so it is not.`,
861
+ consequence: `The loader passes it over without a word; rename it to end in ".md" to use it as ${field === "commands" ? "a command" : "an agent"}.`
862
+ });
863
+ }
864
+ if (entries.length > MAX_CHECKED_FILES_PER_FOLDER) {
865
+ c.add({
866
+ level: "warning",
867
+ part,
868
+ file: rel,
869
+ code: "entries-truncated",
870
+ message: `The folder "${rel}" holds ${entries.length} markdown files; only the first ${MAX_CHECKED_FILES_PER_FOLDER} were checked.`,
871
+ consequence: "The loader reads them all."
872
+ });
873
+ entries = entries.slice(0, MAX_CHECKED_FILES_PER_FOLDER);
874
+ }
875
+ for (const entry of entries) {
876
+ const file = entry.name;
877
+ const abs = join(resolved.dir, file);
878
+ const rel2 = posix(relative(root, abs));
879
+ if (!entry.isFile()) {
880
+ c.add({
881
+ level: "warning",
882
+ part,
883
+ file: rel2,
884
+ code: "file-ignored",
885
+ message: `"${file}" is a link or a folder, not a regular file, so it is not read.`,
886
+ consequence: "The loader passes it over without a word."
887
+ });
888
+ continue;
889
+ }
890
+ const read = await readInside(root, rel2);
891
+ if (!read.ok) {
892
+ const { code, text } = readProblem(
893
+ read,
894
+ field === "commands" ? "The command file" : "The agent file",
895
+ rel2
896
+ );
897
+ c.add({
898
+ level: read.kind === "too-large" && field === "commands" ? "warning" : "error",
899
+ part: c.part(
900
+ field === "commands" ? "command" : "agent",
901
+ `${pluginName}__${file.slice(0, -".md".length)}`,
902
+ rel2
903
+ ),
904
+ file: rel2,
905
+ code,
906
+ message: text,
907
+ consequence: field === "commands" ? "The command cannot be used." : "The file is skipped and named in the log."
908
+ });
909
+ continue;
910
+ }
911
+ await each(file, read.text, read.abs);
912
+ }
913
+ dropPlaceholder();
914
+ }
915
+ __name(checkFolder, "checkFolder");
916
+
917
+ // src/commands/plugin.ts
918
+ var PLUGIN_VALIDATE_EXIT = {
919
+ clean: EXIT_OK,
920
+ errors: EXIT_FAIL,
921
+ warnings: 10,
922
+ unreadable: EXIT_NOINPUT,
923
+ usage: EXIT_USAGE
924
+ };
925
+ var HELP = [
926
+ "Usage: namzu plugin validate [--json] [--] [path]",
927
+ "",
928
+ "Check a plugin folder (default: the current folder) and every part it carries,",
929
+ "without running anything from it: no hook, MCP server, command or script is",
930
+ "started, no module is imported and nothing is fetched. Files are read inside",
931
+ "the folder only; a reference that leaves it is reported and not followed.",
932
+ "",
933
+ "Each problem names the file, the line when it is known, what is wrong and what",
934
+ "the loader would do about it. An error is something that makes the loader",
935
+ "refuse the plugin or skip a part; a warning loads but is very likely not what",
936
+ "you meant.",
937
+ "",
938
+ "Options:",
939
+ " --json Print one JSON report (version 1) on standard output and nothing else",
940
+ " -- End of options, for a folder whose name starts with a dash",
941
+ "",
942
+ "Exit status:",
943
+ " 0 no problems",
944
+ " 10 warnings only",
945
+ " 1 at least one error",
946
+ " 66 the folder could not be read",
947
+ " 64 the command line is wrong"
948
+ ].join("\n");
949
+ function parseArgs(rawArgs) {
950
+ const [sub, ...rest] = rawArgs;
951
+ if (sub !== "validate") {
952
+ return {
953
+ path: ".",
954
+ json: false,
955
+ error: sub === void 0 ? "plugin needs a subcommand: validate. Run `namzu plugin --help`." : `unknown plugin subcommand: ${sub}. The one there is: validate.`
956
+ };
957
+ }
958
+ let json = false;
959
+ const paths = [];
960
+ let literal = false;
961
+ for (const arg of rest) {
962
+ if (literal) paths.push(arg);
963
+ else if (arg === "--") literal = true;
964
+ else if (arg === "--json") json = true;
965
+ else if (arg.startsWith("-") && arg !== "-") {
966
+ return { path: ".", json, error: `unknown plugin validate option: ${arg}` };
967
+ } else paths.push(arg);
968
+ }
969
+ if (paths.length > 1) {
970
+ return { path: ".", json, error: "plugin validate takes one folder at a time." };
971
+ }
972
+ return { path: paths[0] ?? ".", json };
973
+ }
974
+ __name(parseArgs, "parseArgs");
975
+ function exitStatusFor(report) {
976
+ switch (report.status) {
977
+ case "clean":
978
+ return PLUGIN_VALIDATE_EXIT.clean;
979
+ case "warnings":
980
+ return PLUGIN_VALIDATE_EXIT.warnings;
981
+ case "errors":
982
+ return PLUGIN_VALIDATE_EXIT.errors;
983
+ default:
984
+ return PLUGIN_VALIDATE_EXIT.unreadable;
985
+ }
986
+ }
987
+ __name(exitStatusFor, "exitStatusFor");
988
+ function oneLine(value) {
989
+ return terminalDisplayText(value).replace(/[\t\n\r]+/g, " ");
990
+ }
991
+ __name(oneLine, "oneLine");
992
+ function renderPluginReport(report) {
993
+ if (report.status === "unreadable") {
994
+ return `Could not read ${oneLine(report.folder)}: ${oneLine(report.readError ?? "unknown reason")}`;
995
+ }
996
+ const who = report.plugin.name ? `${oneLine(report.plugin.name)} ${oneLine(report.plugin.version ?? "")}`.trim() : "plugin";
997
+ const lines = [`Checked ${who} in ${oneLine(report.folder)}`];
998
+ for (const problem of report.problems) {
999
+ const where = problem.file ? `${oneLine(problem.file)}${problem.line !== void 0 ? `:${problem.line}` : ""}` : "";
1000
+ lines.push(
1001
+ `${problem.level === "error" ? "error " : "warning"} ${where ? `${where} ` : ""}${oneLine(problem.message)}`
1002
+ );
1003
+ lines.push(` ${oneLine(problem.consequence)}`);
1004
+ }
1005
+ const parts = `${report.parts.length} ${report.parts.length === 1 ? "part" : "parts"}`;
1006
+ const { errors, warnings } = report.summary;
1007
+ lines.push(
1008
+ errors === 0 && warnings === 0 ? `No problems in ${parts}.` : `${parts} checked: ${errors} ${errors === 1 ? "error" : "errors"}, ${warnings} ${warnings === 1 ? "warning" : "warnings"}.`
1009
+ );
1010
+ return lines.join("\n");
1011
+ }
1012
+ __name(renderPluginReport, "renderPluginReport");
1013
+ var pluginCommand = {
1014
+ name: "plugin",
1015
+ description: "Check a plugin folder without running anything from it",
1016
+ passThrough: true,
1017
+ help: HELP,
1018
+ handler: /* @__PURE__ */ __name(async ({ ctx, rawArgs }) => {
1019
+ const args = parseArgs(rawArgs);
1020
+ if (args.error) {
1021
+ ctx.formatter.error({ message: args.error });
1022
+ return PLUGIN_VALIDATE_EXIT.usage;
1023
+ }
1024
+ const report = await validatePluginFolder(resolve(args.path));
1025
+ if (args.json || ctx.formatter.name === "json") {
1026
+ createFormatter("json", { quiet: true }).print(report);
1027
+ } else if (ctx.formatter.name === "yaml") {
1028
+ ctx.formatter.print(report);
1029
+ } else if (report.status === "unreadable") {
1030
+ ctx.formatter.error({ message: renderPluginReport(report) });
1031
+ } else {
1032
+ ctx.formatter.print({ text: renderPluginReport(report) });
1033
+ }
1034
+ return exitStatusFor(report);
1035
+ }, "handler")
1036
+ };
1037
+ export {
1038
+ PLUGIN_VALIDATE_EXIT,
1039
+ exitStatusFor,
1040
+ pluginCommand,
1041
+ renderPluginReport
1042
+ };
1043
+ //# sourceMappingURL=plugin-SAQJPDKX.js.map