@unbrained/pm-cli 2026.7.17 → 2026.7.18

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 (264) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +13 -0
  3. package/dist/cli/commands/close.d.ts +1 -1
  4. package/dist/cli/commands/close.js +3 -3
  5. package/dist/cli/commands/close.js.map +1 -1
  6. package/dist/cli/commands/completion.js +47 -5
  7. package/dist/cli/commands/completion.js.map +1 -1
  8. package/dist/cli/commands/context.d.ts +2 -2
  9. package/dist/cli/commands/context.js +42 -28
  10. package/dist/cli/commands/context.js.map +1 -1
  11. package/dist/cli/commands/contracts.js +5 -3
  12. package/dist/cli/commands/contracts.js.map +1 -1
  13. package/dist/cli/commands/graph.d.ts +7 -0
  14. package/dist/cli/commands/graph.js +11 -0
  15. package/dist/cli/commands/graph.js.map +1 -0
  16. package/dist/cli/commands/index.d.ts +1 -0
  17. package/dist/cli/commands/index.js +3 -2
  18. package/dist/cli/commands/index.js.map +1 -1
  19. package/dist/cli/commands/next.d.ts +1 -1
  20. package/dist/cli/commands/next.js +3 -3
  21. package/dist/cli/commands/next.js.map +1 -1
  22. package/dist/cli/main.js +3 -2
  23. package/dist/cli/main.js.map +1 -1
  24. package/dist/cli/register-list-query.js +49 -7
  25. package/dist/cli/register-list-query.js.map +1 -1
  26. package/dist/cli/register-mutation.js +7 -3
  27. package/dist/cli/register-mutation.js.map +1 -1
  28. package/dist/cli-bundle/bundle-manifest.json +157 -149
  29. package/dist/cli-bundle/chunks/{chunk-N7I2DGLP.js → chunk-35FHWD4C.js} +4 -4
  30. package/dist/cli-bundle/chunks/{chunk-37V5MXAU.js.map → chunk-35FHWD4C.js.map} +1 -7
  31. package/dist/cli-bundle/chunks/{chunk-MSGETE6I.js → chunk-3CUQZNQ6.js} +67 -509
  32. package/dist/cli-bundle/chunks/chunk-3CUQZNQ6.js.map +7 -0
  33. package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js +800 -0
  34. package/dist/cli-bundle/chunks/chunk-3QDR6ZLU.js.map +7 -0
  35. package/dist/cli-bundle/chunks/{chunk-QNUAZYGW.js → chunk-43UMFKCK.js} +3 -3
  36. package/dist/cli-bundle/chunks/{chunk-HF63SBLC.js → chunk-6VHUGVNP.js} +39 -16
  37. package/dist/cli-bundle/chunks/chunk-6VHUGVNP.js.map +1 -0
  38. package/dist/cli-bundle/chunks/{chunk-B6SH2YNN.js → chunk-7R6UIHYY.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-NCAFUBJX.js → chunk-7UCY6DR5.js} +183 -12
  40. package/dist/cli-bundle/chunks/chunk-7UCY6DR5.js.map +1 -0
  41. package/dist/cli-bundle/chunks/{chunk-23TCGBRK.js → chunk-ADXDCAKP.js} +2 -2
  42. package/dist/cli-bundle/chunks/{chunk-7LTCLTRG.js → chunk-AXRT7K5V.js} +16 -3
  43. package/dist/cli-bundle/chunks/chunk-AXRT7K5V.js.map +7 -0
  44. package/dist/cli-bundle/chunks/{chunk-P56LKFQX.js → chunk-BDA35QG5.js} +34 -4
  45. package/dist/cli-bundle/chunks/chunk-BDA35QG5.js.map +7 -0
  46. package/dist/cli-bundle/chunks/{chunk-2MPMKJF2.js → chunk-DHNG452T.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-AFSV5HBB.js → chunk-E4FXM2XB.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-QKVVV6QO.js → chunk-EWIT5WIC.js} +3 -3
  49. package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js +783 -0
  50. package/dist/cli-bundle/chunks/chunk-EX7OQT3Y.js.map +1 -0
  51. package/dist/cli-bundle/chunks/{chunk-LLODAQMP.js → chunk-F3VC3GOV.js} +41 -18
  52. package/dist/cli-bundle/chunks/chunk-F3VC3GOV.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{chunk-S46R2M3W.js → chunk-GKPCTQYG.js} +1709 -5
  54. package/dist/cli-bundle/chunks/chunk-GKPCTQYG.js.map +7 -0
  55. package/dist/cli-bundle/chunks/{chunk-HXVHBERL.js → chunk-HPAYDSR2.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-XNPMDSQQ.js → chunk-HYTOJW2Q.js} +2 -2
  57. package/dist/cli-bundle/chunks/{chunk-V3VBXQQV.js → chunk-I3INI567.js} +516 -429
  58. package/dist/cli-bundle/chunks/chunk-I3INI567.js.map +7 -0
  59. package/dist/cli-bundle/chunks/{chunk-V7MP6YTN.js → chunk-IL5SPRMH.js} +2 -2
  60. package/dist/cli-bundle/chunks/{chunk-YQCWK2MB.js → chunk-L5BTTDU5.js} +68 -503
  61. package/dist/cli-bundle/chunks/chunk-L5BTTDU5.js.map +1 -0
  62. package/dist/cli-bundle/chunks/{chunk-SIJV365F.js → chunk-NCVT6XEL.js} +17 -4
  63. package/dist/cli-bundle/chunks/chunk-NCVT6XEL.js.map +1 -0
  64. package/dist/cli-bundle/chunks/{chunk-DCC2AQBD.js → chunk-OGVTB5VO.js} +32 -31
  65. package/dist/cli-bundle/chunks/chunk-OGVTB5VO.js.map +7 -0
  66. package/dist/cli-bundle/chunks/{chunk-6XAZB6SE.js → chunk-QPGQNLPI.js} +1660 -7
  67. package/dist/cli-bundle/chunks/chunk-QPGQNLPI.js.map +1 -0
  68. package/dist/cli-bundle/chunks/{chunk-KOEZCHRF.js → chunk-QRZNCRNA.js} +2 -2
  69. package/dist/cli-bundle/chunks/{chunk-G6KM4YKY.js → chunk-RXPQ5Q23.js} +3 -3
  70. package/dist/cli-bundle/chunks/{chunk-7CTQ7WW5.js → chunk-SIPOACV5.js} +514 -427
  71. package/dist/cli-bundle/chunks/chunk-SIPOACV5.js.map +1 -0
  72. package/dist/cli-bundle/chunks/{chunk-XYJK6GIQ.js → chunk-TGBTLGPX.js} +2 -2
  73. package/dist/cli-bundle/chunks/{chunk-37V5MXAU.js → chunk-TLWJP5BF.js} +3 -3
  74. package/dist/cli-bundle/chunks/chunk-TLWJP5BF.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-3D4YVTNG.js → chunk-TZAE66GQ.js} +2 -2
  76. package/dist/cli-bundle/chunks/{chunk-S6FF7VW6.js → chunk-WQXRZMFN.js} +187 -16
  77. package/dist/cli-bundle/chunks/chunk-WQXRZMFN.js.map +7 -0
  78. package/dist/cli-bundle/chunks/{chunk-SPFZV2GR.js → chunk-XPUTSGJU.js} +32 -31
  79. package/dist/cli-bundle/chunks/chunk-XPUTSGJU.js.map +1 -0
  80. package/dist/cli-bundle/chunks/{chunk-CFSUNEL7.js → chunk-XWBD6DSR.js} +3 -3
  81. package/dist/cli-bundle/chunks/{chunk-MNV226E4.js → chunk-XWYQ2LT4.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-I7GY4X6Y.js → chunk-YFE7JHX3.js} +26 -5
  83. package/dist/cli-bundle/chunks/chunk-YFE7JHX3.js.map +1 -0
  84. package/dist/cli-bundle/chunks/{chunk-FZGM3PNA.js → chunk-YIIIAKCE.js} +2 -2
  85. package/dist/cli-bundle/chunks/{close-BEP7MHF3.js → close-GPD7DTJV.js} +3 -3
  86. package/dist/cli-bundle/chunks/{close-Y6QFUJQN.js → close-X3CF6FQP.js} +3 -3
  87. package/dist/cli-bundle/chunks/{close-many-JJFW7KTT.js → close-many-J7A5EHOQ.js} +5 -5
  88. package/dist/cli-bundle/chunks/{close-many-QJ6FKJUE.js → close-many-NQLYGPYW.js} +5 -5
  89. package/dist/cli-bundle/chunks/{deps-EVTOQMKW.js → deps-MQ4ZIGZB.js} +13 -4
  90. package/dist/cli-bundle/chunks/{deps-5NC4IZH7.js → deps-NIIKXLPB.js} +13 -4
  91. package/dist/cli-bundle/chunks/{profile-U2B6Y7GE.js → profile-AVCIIZID.js} +3 -3
  92. package/dist/cli-bundle/chunks/{profile-AGUKS52S.js → profile-LFYO3HHX.js} +3 -3
  93. package/dist/cli-bundle/chunks/{register-list-query-A5KRJ5J2.js → register-list-query-MZUF2EEC.js} +41 -13
  94. package/dist/cli-bundle/chunks/register-list-query-MZUF2EEC.js.map +1 -0
  95. package/dist/cli-bundle/chunks/{register-list-query-NEYP3TXO.js → register-list-query-UKMF55FT.js} +40 -12
  96. package/dist/cli-bundle/chunks/register-list-query-UKMF55FT.js.map +7 -0
  97. package/dist/cli-bundle/chunks/{register-mutation-6LOPBAHC.js → register-mutation-2PBW2GEX.js} +15 -13
  98. package/dist/cli-bundle/chunks/register-mutation-2PBW2GEX.js.map +1 -0
  99. package/dist/cli-bundle/chunks/{register-mutation-GCZOALNJ.js → register-mutation-T6RVNJC4.js} +14 -12
  100. package/dist/cli-bundle/chunks/{register-mutation-GCZOALNJ.js.map → register-mutation-T6RVNJC4.js.map} +2 -2
  101. package/dist/cli-bundle/chunks/{register-operations-6ZZIF27A.js → register-operations-KHZYR6MG.js} +11 -11
  102. package/dist/cli-bundle/chunks/{register-operations-REDIAEGI.js → register-operations-WPQ2LWZJ.js} +11 -11
  103. package/dist/cli-bundle/chunks/{register-setup-J3JS2ZVT.js → register-setup-PGDNOXDQ.js} +5 -5
  104. package/dist/cli-bundle/chunks/{register-setup-BHPMN5SK.js → register-setup-TDN7WAO6.js} +5 -5
  105. package/dist/cli-bundle/chunks/{update-SA6AG23P.js → update-SQYZA3ZW.js} +4 -4
  106. package/dist/cli-bundle/chunks/{update-PQQHLYCC.js → update-XZJYS5X7.js} +4 -4
  107. package/dist/cli-bundle/chunks/{update-many-RQVTFJPD.js → update-many-R24B3GBK.js} +6 -6
  108. package/dist/cli-bundle/chunks/{update-many-TV3L3KBX.js → update-many-WQ3R3J6N.js} +6 -6
  109. package/dist/cli-bundle/main.js +25 -9
  110. package/dist/cli-bundle/main.js.map +2 -2
  111. package/dist/cli-bundle/sdk-runtime.js +19 -16
  112. package/dist/cli-bundle/sdk.js +95 -305
  113. package/dist/cli-bundle/sdk.js.map +4 -4
  114. package/dist/core/item/actionability.d.ts +12 -0
  115. package/dist/core/item/actionability.js +39 -4
  116. package/dist/core/item/actionability.js.map +1 -1
  117. package/dist/core/sentry/instrument.d.ts +11 -0
  118. package/dist/core/sentry/instrument.js +21 -2
  119. package/dist/core/sentry/instrument.js.map +1 -1
  120. package/dist/mcp/server.d.ts +16 -18
  121. package/dist/mcp/server.js +84 -31
  122. package/dist/mcp/server.js.map +1 -1
  123. package/dist/mcp/tool-definitions.js +17 -4
  124. package/dist/mcp/tool-definitions.js.map +1 -1
  125. package/dist/sdk/actionability.d.ts +10 -0
  126. package/dist/sdk/actionability.js +14 -0
  127. package/dist/sdk/actionability.js.map +1 -0
  128. package/dist/sdk/cli-contracts/enum-contracts.d.ts +6 -2
  129. package/dist/sdk/cli-contracts/enum-contracts.js +19 -2
  130. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  131. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  132. package/dist/sdk/cli-contracts/flag-contracts.js +21 -2
  133. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  134. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +2 -0
  135. package/dist/sdk/cli-contracts/tool-option-contracts.js +16 -2
  136. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  137. package/dist/sdk/cli-contracts/tool-parameter-tables.js +80 -3
  138. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  139. package/dist/sdk/cli-contracts/tool-schema.d.ts +20 -0
  140. package/dist/sdk/cli-contracts/tool-schema.js +97 -9
  141. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  142. package/dist/sdk/cli-contracts.d.ts +2 -2
  143. package/dist/sdk/cli-contracts.js +4 -4
  144. package/dist/sdk/cli-contracts.js.map +1 -1
  145. package/dist/sdk/dependencies.d.ts +42 -53
  146. package/dist/sdk/dependencies.js +177 -125
  147. package/dist/sdk/dependencies.js.map +1 -1
  148. package/dist/sdk/governance/validate.js +3 -3
  149. package/dist/sdk/governance/validate.js.map +1 -1
  150. package/dist/sdk/graph/analytics.d.ts +124 -0
  151. package/dist/sdk/graph/analytics.js +464 -0
  152. package/dist/sdk/graph/analytics.js.map +1 -0
  153. package/dist/sdk/graph/assembly.d.ts +97 -0
  154. package/dist/sdk/graph/assembly.js +146 -0
  155. package/dist/sdk/graph/assembly.js.map +1 -0
  156. package/dist/sdk/graph/cache.d.ts +66 -0
  157. package/dist/sdk/graph/cache.js +148 -0
  158. package/dist/sdk/graph/cache.js.map +1 -0
  159. package/dist/sdk/graph/governance.d.ts +108 -0
  160. package/dist/sdk/graph/governance.js +360 -0
  161. package/dist/sdk/graph/governance.js.map +1 -0
  162. package/dist/sdk/graph/index.d.ts +16 -0
  163. package/dist/sdk/graph/index.js +20 -0
  164. package/dist/sdk/graph/index.js.map +1 -0
  165. package/dist/sdk/graph/remediation.d.ts +52 -0
  166. package/dist/sdk/graph/remediation.js +148 -0
  167. package/dist/sdk/graph/remediation.js.map +1 -0
  168. package/dist/sdk/graph/run.d.ts +295 -0
  169. package/dist/sdk/graph/run.js +468 -0
  170. package/dist/sdk/graph/run.js.map +1 -0
  171. package/dist/sdk/graph/traversal.d.ts +77 -0
  172. package/dist/sdk/graph/traversal.js +262 -0
  173. package/dist/sdk/graph/traversal.js.map +1 -0
  174. package/dist/sdk/index.d.ts +4 -2
  175. package/dist/sdk/index.js +6 -4
  176. package/dist/sdk/index.js.map +1 -1
  177. package/dist/sdk/query/list.d.ts +8 -0
  178. package/dist/sdk/query/list.js +19 -3
  179. package/dist/sdk/query/list.js.map +1 -1
  180. package/dist/sdk/relationship-context.d.ts +42 -0
  181. package/dist/sdk/relationship-context.js +99 -20
  182. package/dist/sdk/relationship-context.js.map +1 -1
  183. package/dist/sdk/relationships.d.ts +13 -0
  184. package/dist/sdk/relationships.js +30 -2
  185. package/dist/sdk/relationships.js.map +1 -1
  186. package/dist/sdk/runtime-input.d.ts +41 -0
  187. package/dist/sdk/runtime-input.js +422 -2
  188. package/dist/sdk/runtime-input.js.map +1 -1
  189. package/dist/sdk/runtime.d.ts +12 -23
  190. package/dist/sdk/runtime.js +19 -371
  191. package/dist/sdk/runtime.js.map +1 -1
  192. package/dist/sdk/test/linked-command-detection.js +12 -3
  193. package/dist/sdk/test/linked-command-detection.js.map +1 -1
  194. package/docs/AGENT_GUIDE.md +1 -0
  195. package/docs/COMMANDS.md +19 -1
  196. package/docs/RELATIONSHIP_GRAPH.md +99 -3
  197. package/docs/SDK.md +17 -3
  198. package/marketplace.json +2 -2
  199. package/package.json +1 -1
  200. package/packages/pm-beads/package.json +1 -1
  201. package/packages/pm-calendar/package.json +1 -1
  202. package/packages/pm-command-kit/package.json +1 -1
  203. package/packages/pm-governance-audit/package.json +1 -1
  204. package/packages/pm-guide-shell/package.json +1 -1
  205. package/packages/pm-kanban/package.json +1 -1
  206. package/packages/pm-lifecycle-hooks/package.json +1 -1
  207. package/packages/pm-linked-test-adapters/package.json +1 -1
  208. package/packages/pm-search-advanced/package.json +1 -1
  209. package/packages/pm-templates/package.json +1 -1
  210. package/packages/pm-todos/package.json +1 -1
  211. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  212. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  213. package/dist/cli-bundle/chunks/chunk-6XAZB6SE.js.map +0 -1
  214. package/dist/cli-bundle/chunks/chunk-7CTQ7WW5.js.map +0 -1
  215. package/dist/cli-bundle/chunks/chunk-7LTCLTRG.js.map +0 -7
  216. package/dist/cli-bundle/chunks/chunk-DCC2AQBD.js.map +0 -7
  217. package/dist/cli-bundle/chunks/chunk-HF63SBLC.js.map +0 -1
  218. package/dist/cli-bundle/chunks/chunk-I7GY4X6Y.js.map +0 -1
  219. package/dist/cli-bundle/chunks/chunk-LLODAQMP.js.map +0 -7
  220. package/dist/cli-bundle/chunks/chunk-MSGETE6I.js.map +0 -7
  221. package/dist/cli-bundle/chunks/chunk-N7I2DGLP.js.map +0 -1
  222. package/dist/cli-bundle/chunks/chunk-NCAFUBJX.js.map +0 -1
  223. package/dist/cli-bundle/chunks/chunk-P56LKFQX.js.map +0 -7
  224. package/dist/cli-bundle/chunks/chunk-S46R2M3W.js.map +0 -7
  225. package/dist/cli-bundle/chunks/chunk-S6FF7VW6.js.map +0 -7
  226. package/dist/cli-bundle/chunks/chunk-SIJV365F.js.map +0 -1
  227. package/dist/cli-bundle/chunks/chunk-SPFZV2GR.js.map +0 -1
  228. package/dist/cli-bundle/chunks/chunk-V3VBXQQV.js.map +0 -7
  229. package/dist/cli-bundle/chunks/chunk-YQCWK2MB.js.map +0 -1
  230. package/dist/cli-bundle/chunks/register-list-query-A5KRJ5J2.js.map +0 -1
  231. package/dist/cli-bundle/chunks/register-list-query-NEYP3TXO.js.map +0 -7
  232. package/dist/cli-bundle/chunks/register-mutation-6LOPBAHC.js.map +0 -1
  233. /package/dist/cli-bundle/chunks/{chunk-QNUAZYGW.js.map → chunk-43UMFKCK.js.map} +0 -0
  234. /package/dist/cli-bundle/chunks/{chunk-B6SH2YNN.js.map → chunk-7R6UIHYY.js.map} +0 -0
  235. /package/dist/cli-bundle/chunks/{chunk-23TCGBRK.js.map → chunk-ADXDCAKP.js.map} +0 -0
  236. /package/dist/cli-bundle/chunks/{chunk-2MPMKJF2.js.map → chunk-DHNG452T.js.map} +0 -0
  237. /package/dist/cli-bundle/chunks/{chunk-AFSV5HBB.js.map → chunk-E4FXM2XB.js.map} +0 -0
  238. /package/dist/cli-bundle/chunks/{chunk-QKVVV6QO.js.map → chunk-EWIT5WIC.js.map} +0 -0
  239. /package/dist/cli-bundle/chunks/{chunk-HXVHBERL.js.map → chunk-HPAYDSR2.js.map} +0 -0
  240. /package/dist/cli-bundle/chunks/{chunk-XNPMDSQQ.js.map → chunk-HYTOJW2Q.js.map} +0 -0
  241. /package/dist/cli-bundle/chunks/{chunk-V7MP6YTN.js.map → chunk-IL5SPRMH.js.map} +0 -0
  242. /package/dist/cli-bundle/chunks/{chunk-KOEZCHRF.js.map → chunk-QRZNCRNA.js.map} +0 -0
  243. /package/dist/cli-bundle/chunks/{chunk-G6KM4YKY.js.map → chunk-RXPQ5Q23.js.map} +0 -0
  244. /package/dist/cli-bundle/chunks/{chunk-XYJK6GIQ.js.map → chunk-TGBTLGPX.js.map} +0 -0
  245. /package/dist/cli-bundle/chunks/{chunk-3D4YVTNG.js.map → chunk-TZAE66GQ.js.map} +0 -0
  246. /package/dist/cli-bundle/chunks/{chunk-CFSUNEL7.js.map → chunk-XWBD6DSR.js.map} +0 -0
  247. /package/dist/cli-bundle/chunks/{chunk-MNV226E4.js.map → chunk-XWYQ2LT4.js.map} +0 -0
  248. /package/dist/cli-bundle/chunks/{chunk-FZGM3PNA.js.map → chunk-YIIIAKCE.js.map} +0 -0
  249. /package/dist/cli-bundle/chunks/{close-BEP7MHF3.js.map → close-GPD7DTJV.js.map} +0 -0
  250. /package/dist/cli-bundle/chunks/{close-Y6QFUJQN.js.map → close-X3CF6FQP.js.map} +0 -0
  251. /package/dist/cli-bundle/chunks/{close-many-JJFW7KTT.js.map → close-many-J7A5EHOQ.js.map} +0 -0
  252. /package/dist/cli-bundle/chunks/{close-many-QJ6FKJUE.js.map → close-many-NQLYGPYW.js.map} +0 -0
  253. /package/dist/cli-bundle/chunks/{deps-EVTOQMKW.js.map → deps-MQ4ZIGZB.js.map} +0 -0
  254. /package/dist/cli-bundle/chunks/{deps-5NC4IZH7.js.map → deps-NIIKXLPB.js.map} +0 -0
  255. /package/dist/cli-bundle/chunks/{profile-U2B6Y7GE.js.map → profile-AVCIIZID.js.map} +0 -0
  256. /package/dist/cli-bundle/chunks/{profile-AGUKS52S.js.map → profile-LFYO3HHX.js.map} +0 -0
  257. /package/dist/cli-bundle/chunks/{register-operations-6ZZIF27A.js.map → register-operations-KHZYR6MG.js.map} +0 -0
  258. /package/dist/cli-bundle/chunks/{register-operations-REDIAEGI.js.map → register-operations-WPQ2LWZJ.js.map} +0 -0
  259. /package/dist/cli-bundle/chunks/{register-setup-J3JS2ZVT.js.map → register-setup-PGDNOXDQ.js.map} +0 -0
  260. /package/dist/cli-bundle/chunks/{register-setup-BHPMN5SK.js.map → register-setup-TDN7WAO6.js.map} +0 -0
  261. /package/dist/cli-bundle/chunks/{update-SA6AG23P.js.map → update-SQYZA3ZW.js.map} +0 -0
  262. /package/dist/cli-bundle/chunks/{update-PQQHLYCC.js.map → update-XZJYS5X7.js.map} +0 -0
  263. /package/dist/cli-bundle/chunks/{update-many-RQVTFJPD.js.map → update-many-R24B3GBK.js.map} +0 -0
  264. /package/dist/cli-bundle/chunks/{update-many-TV3L3KBX.js.map → update-many-WQ3R3J6N.js.map} +0 -0
@@ -0,0 +1,783 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bc45de9b-3efd-5b0c-b660-483700eabaa9")}catch(e){}}();
3
+ import {
4
+ assembleWorkspaceRelationshipGraph,
5
+ collectDanglingDependencyReferences,
6
+ createRelationshipKindRegistry
7
+ } from "./chunk-L5BTTDU5.js";
8
+ import {
9
+ createQueryFingerprint,
10
+ encodeQueryCursor,
11
+ resolveQueryCursorStart
12
+ } from "./chunk-2IPNL3DR.js";
13
+ import {
14
+ getActiveExtensionRegistrations,
15
+ isTerminalStatus,
16
+ listAllItemMetadataLight,
17
+ locateItem,
18
+ readLocatedItem,
19
+ readSettings
20
+ } from "./chunk-P22HGFFI.js";
21
+ import {
22
+ EXIT_CODE,
23
+ PmCliError,
24
+ getSettingsPath,
25
+ pathExists,
26
+ resolveItemTypeRegistry,
27
+ resolvePmRoot,
28
+ resolveRuntimeStatusRegistry
29
+ } from "./chunk-KX62NMZC.js";
30
+
31
+ // dist/sdk/graph/cache.js
32
+ import { createHash } from "node:crypto";
33
+ var DEFAULT_MAX_RESULTS_PER_WORKSPACE = 64;
34
+ var DEFAULT_MAX_WORKSPACES = 8;
35
+ function fingerprintLine(item, isTerminal) {
36
+ const dependencies = (item.dependencies ?? []).map((rawDependency) => {
37
+ if (typeof rawDependency !== "object" || rawDependency === null)
38
+ return "";
39
+ const dependency = rawDependency;
40
+ return `${typeof dependency.kind === "string" ? dependency.kind : "related"}:${typeof dependency.id === "string" ? dependency.id : ""}`;
41
+ }).sort().join(",");
42
+ return [
43
+ item.id,
44
+ item.title,
45
+ item.status,
46
+ isTerminal(item.status) ? "1" : "0",
47
+ item.parent ?? "",
48
+ item.blocked_by ?? "",
49
+ dependencies
50
+ ].join("\0");
51
+ }
52
+ function computeWorkspaceGraphFingerprint(items, isTerminal = (status) => status === "closed" || status === "canceled") {
53
+ const lines = items.filter((item) => typeof item?.id === "string" && item.id.trim().length > 0).map((item) => fingerprintLine(item, isTerminal)).sort();
54
+ return createHash("sha256").update(lines.join("")).digest("hex");
55
+ }
56
+ function requirePositiveCacheBound(name, value, fallback) {
57
+ const bound = value ?? fallback;
58
+ if (!Number.isInteger(bound) || bound < 1)
59
+ throw new TypeError(`Invalid ${name} bound: ${String(value)}`);
60
+ return bound;
61
+ }
62
+ var WorkspaceGraphCache = class {
63
+ #entries = /* @__PURE__ */ new Map();
64
+ #maxResultsPerWorkspace;
65
+ #maxWorkspaces;
66
+ /** Create a cache, optionally bounding workspaces and memoized results. */
67
+ constructor(options = {}) {
68
+ this.#maxResultsPerWorkspace = requirePositiveCacheBound("maxResultsPerWorkspace", options.maxResultsPerWorkspace, DEFAULT_MAX_RESULTS_PER_WORKSPACE);
69
+ this.#maxWorkspaces = requirePositiveCacheBound("maxWorkspaces", options.maxWorkspaces, DEFAULT_MAX_WORKSPACES);
70
+ }
71
+ /**
72
+ * Resolve the cached assembly for one workspace key and fingerprint,
73
+ * building and storing it on miss. The returned lookup exposes snapshot-
74
+ * scoped memoization for query results derived from the same assembly.
75
+ */
76
+ lookup(key, fingerprint, build) {
77
+ let entry = this.#entries.get(key);
78
+ let assemblyReused = true;
79
+ if (entry === void 0 || entry.fingerprint !== fingerprint) {
80
+ entry = { fingerprint, assembly: build(), results: /* @__PURE__ */ new Map() };
81
+ assemblyReused = false;
82
+ if (!this.#entries.has(key) && this.#entries.size >= this.#maxWorkspaces) {
83
+ this.#entries.delete(this.#entries.keys().next().value);
84
+ }
85
+ }
86
+ this.#entries.delete(key);
87
+ this.#entries.set(key, entry);
88
+ const resolved = entry;
89
+ const maxResults = this.#maxResultsPerWorkspace;
90
+ return {
91
+ assembly: resolved.assembly,
92
+ assemblyReused,
93
+ fingerprint,
94
+ memoize(queryKey, compute) {
95
+ const cached = resolved.results.get(queryKey);
96
+ if (cached !== void 0 || resolved.results.has(queryKey)) {
97
+ resolved.results.delete(queryKey);
98
+ resolved.results.set(queryKey, cached);
99
+ return { value: structuredClone(cached), reused: true };
100
+ }
101
+ const value = compute();
102
+ if (resolved.results.size >= maxResults) {
103
+ resolved.results.delete(resolved.results.keys().next().value);
104
+ }
105
+ resolved.results.set(queryKey, structuredClone(value));
106
+ return { value, reused: false };
107
+ }
108
+ };
109
+ }
110
+ /** Drop every cached workspace entry and memoized result. */
111
+ clear() {
112
+ this.#entries.clear();
113
+ }
114
+ };
115
+ var sharedCache = new WorkspaceGraphCache();
116
+ function workspaceGraphCache() {
117
+ return sharedCache;
118
+ }
119
+ function resetWorkspaceGraphCache() {
120
+ sharedCache.clear();
121
+ }
122
+
123
+ // dist/sdk/relationship-context.js
124
+ var RELATIONSHIP_CONTEXT_ROLE_PRIORITY = [
125
+ "prerequisite",
126
+ "dependent",
127
+ "ancestor",
128
+ "descendant",
129
+ "provenance",
130
+ "related"
131
+ ];
132
+ var tokenEncoder = new TextEncoder();
133
+ function positiveInteger(value, fallback, field) {
134
+ const resolved = value ?? fallback;
135
+ if (!Number.isInteger(resolved) || resolved < 1)
136
+ throw new TypeError(`Relationship context ${field} must be positive`);
137
+ return resolved;
138
+ }
139
+ function estimateTokens(value) {
140
+ return Math.max(1, Math.ceil(tokenEncoder.encode(JSON.stringify(value)).byteLength / 4));
141
+ }
142
+ function explainDirectEdge(edge, node, registry) {
143
+ const definition = registry.resolve(edge.kind);
144
+ if (definition?.ordering) {
145
+ const sourceFirst = (definition.precedence ?? "source_before_target") === "source_before_target";
146
+ const before = sourceFirst ? edge.source : edge.target;
147
+ return node === before ? "prerequisite" : "dependent";
148
+ }
149
+ if (definition?.hierarchy) {
150
+ const sourceIsParent = (definition.hierarchyDirection ?? "source_parent") === "source_parent";
151
+ const parent = sourceIsParent ? edge.source : edge.target;
152
+ return node === parent ? "ancestor" : "descendant";
153
+ }
154
+ if (edge.kind === "discovered_from" || edge.kind === "incident_from")
155
+ return "provenance";
156
+ return "related";
157
+ }
158
+ function directReasons(rootEdges, root, node, registry) {
159
+ const reasons = rootEdges.filter((edge) => edge.source === root && edge.target === node || edge.target === root && edge.source === node).map((edge) => explainDirectEdge(edge, node, registry));
160
+ return [...new Set(reasons)].sort();
161
+ }
162
+ function primaryRole(roles) {
163
+ return RELATIONSHIP_CONTEXT_ROLE_PRIORITY.find((role) => roles.includes(role));
164
+ }
165
+ function discoverNodes(graph, root, registry, options) {
166
+ const direction = options.direction ?? "both";
167
+ const maxDepth = options.maxDepth ?? 3;
168
+ if (!Number.isInteger(maxDepth) || maxDepth < 0)
169
+ throw new TypeError("Relationship context maxDepth must be non-negative");
170
+ const seen = /* @__PURE__ */ new Set([root]);
171
+ const queue = [
172
+ { id: root, distance: 0 }
173
+ ];
174
+ const rows = [];
175
+ let inspectedEdges = 0;
176
+ let depthTruncated = false;
177
+ for (let index = 0; index < queue.length; index += 1) {
178
+ options.signal?.throwIfAborted();
179
+ const current = queue[index];
180
+ if (current.distance >= maxDepth && depthTruncated)
181
+ continue;
182
+ const adjacent = graph.neighborEdges(current.id, {
183
+ direction,
184
+ kinds: options.kinds,
185
+ signal: options.signal
186
+ });
187
+ inspectedEdges += adjacent.meta.inspectedEdges;
188
+ if (current.distance >= maxDepth) {
189
+ if (adjacent.value.some((row) => !seen.has(row.id)))
190
+ depthTruncated = true;
191
+ continue;
192
+ }
193
+ for (const { id, edge } of adjacent.value) {
194
+ if (seen.has(id))
195
+ continue;
196
+ seen.add(id);
197
+ const row = {
198
+ id,
199
+ distance: current.distance + 1,
200
+ via: current.id,
201
+ role: explainDirectEdge(edge, id, registry)
202
+ };
203
+ rows.push(row);
204
+ queue.push(row);
205
+ }
206
+ }
207
+ rows.sort((left, right) => left.distance - right.distance || left.id.localeCompare(right.id));
208
+ return {
209
+ rows,
210
+ visitedNodes: queue.length,
211
+ inspectedEdges,
212
+ depthTruncated
213
+ };
214
+ }
215
+ function summarizeDirectEdges(graph, root, registry, options) {
216
+ const directEdges = {
217
+ prerequisite: 0,
218
+ dependent: 0,
219
+ ancestor: 0,
220
+ descendant: 0,
221
+ provenance: 0,
222
+ related: 0
223
+ };
224
+ const rows = graph.neighborEdges(root, {
225
+ direction: options.direction ?? "both",
226
+ kinds: options.kinds,
227
+ signal: options.signal
228
+ }).value;
229
+ for (const { id, edge } of rows)
230
+ directEdges[explainDirectEdge(edge, id, registry)] += 1;
231
+ return {
232
+ directEdges,
233
+ directTotal: rows.length,
234
+ rootEdges: rows.map(({ edge }) => edge)
235
+ };
236
+ }
237
+ function selectContextNodes(params) {
238
+ const nodes = [];
239
+ let usedTokens = params.initialTokens;
240
+ for (const candidate of params.candidates) {
241
+ if (nodes.length >= params.nodeLimit)
242
+ break;
243
+ const direct = candidate.distance === 1 ? directReasons(params.rootEdges, params.rootId, candidate.id, params.registry) : [];
244
+ const node = {
245
+ ...params.details.get(candidate.id) ?? { id: candidate.id },
246
+ distance: candidate.distance,
247
+ role: direct.length > 0 ? primaryRole(direct) : candidate.role,
248
+ via: candidate.via,
249
+ reasons: direct.length > 0 ? direct : [
250
+ `${candidate.role} via ${candidate.via} (depth ${candidate.distance})`
251
+ ]
252
+ };
253
+ const cost = estimateTokens(node);
254
+ if (usedTokens + cost > params.tokenBudget)
255
+ break;
256
+ nodes.push(node);
257
+ usedTokens += cost;
258
+ }
259
+ if (params.candidates.length > 0 && nodes.length === 0)
260
+ throw new TypeError("Relationship context tokenBudget cannot fit one node");
261
+ return { nodes, usedTokens };
262
+ }
263
+ function selectContextEdges(params) {
264
+ const kinds = params.options.kinds ? new Set(params.options.kinds.map((kind) => params.registry.require(kind).kind)) : void 0;
265
+ const candidates = params.graph.edges().filter((edge) => {
266
+ if (!params.included.has(edge.source) || !params.included.has(edge.target))
267
+ return false;
268
+ if (kinds === void 0 || kinds.has(edge.kind))
269
+ return true;
270
+ const inverse = params.registry.resolve(edge.kind)?.inverse;
271
+ return inverse !== void 0 && kinds.has(inverse);
272
+ });
273
+ const edges = [];
274
+ let usedTokens = params.initialTokens;
275
+ for (const edge of candidates) {
276
+ if (edges.length >= params.edgeLimit)
277
+ break;
278
+ const cost = estimateTokens(edge);
279
+ if (usedTokens + cost > params.tokenBudget)
280
+ break;
281
+ edges.push(edge);
282
+ usedTokens += cost;
283
+ }
284
+ return { edges, usedTokens, candidateCount: candidates.length };
285
+ }
286
+ function buildRelationshipContext(graph, rootId, details, options = {}) {
287
+ if (!graph.nodes().includes(rootId))
288
+ throw new TypeError(`Relationship node not found: ${rootId}`);
289
+ const nodeLimit = positiveInteger(options.nodeLimit, 20, "nodeLimit");
290
+ const edgeLimit = positiveInteger(options.edgeLimit, 40, "edgeLimit");
291
+ const tokenBudget = positiveInteger(options.tokenBudget, 1200, "tokenBudget");
292
+ const registry = options.registry ?? createRelationshipKindRegistry();
293
+ const byId = new Map(details.map((detail) => [detail.id, detail]));
294
+ const rootDetails = byId.get(rootId) ?? {
295
+ id: rootId
296
+ };
297
+ const { evidence: rootEvidence = [], ...root } = rootDetails;
298
+ const evidence = [...rootEvidence];
299
+ const discovery = discoverNodes(graph, rootId, registry, options);
300
+ const { rootEdges, ...directSummary } = summarizeDirectEdges(graph, rootId, registry, options);
301
+ const fingerprint = createQueryFingerprint("relationship-context", {
302
+ rootId,
303
+ direction: options.direction ?? "both",
304
+ kinds: [...options.kinds ?? []].sort(),
305
+ maxDepth: options.maxDepth ?? 3
306
+ });
307
+ const pageStart = resolveQueryCursorStart(discovery.rows, options.cursor, fingerprint, ({ id }) => id);
308
+ const candidates = discovery.rows.slice(pageStart);
309
+ const initialTokens = estimateTokens(root) + estimateTokens(evidence);
310
+ if (initialTokens > tokenBudget)
311
+ throw new TypeError("Relationship context tokenBudget cannot fit root and evidence");
312
+ const nodeSelection = selectContextNodes({
313
+ candidates,
314
+ details: byId,
315
+ rootEdges,
316
+ rootId,
317
+ registry,
318
+ nodeLimit,
319
+ tokenBudget,
320
+ initialTokens
321
+ });
322
+ const { nodes } = nodeSelection;
323
+ const included = /* @__PURE__ */ new Set([rootId, ...nodes.map(({ id }) => id)]);
324
+ const edgeSelection = selectContextEdges({
325
+ graph,
326
+ included,
327
+ options,
328
+ registry,
329
+ edgeLimit,
330
+ tokenBudget,
331
+ initialTokens: nodeSelection.usedTokens
332
+ });
333
+ const { edges, usedTokens } = edgeSelection;
334
+ const consumed = pageStart + nodes.length;
335
+ const hasMoreNodes = consumed < discovery.rows.length;
336
+ const lastNode = nodes.at(-1);
337
+ const omittedEdges = edgeSelection.candidateCount - edges.length;
338
+ const truncated = discovery.depthTruncated || hasMoreNodes || omittedEdges > 0;
339
+ const summary = {
340
+ rootId,
341
+ ...root.status === void 0 ? {} : { rootStatus: root.status },
342
+ ...directSummary,
343
+ discoveredNodes: discovery.rows.length,
344
+ returnedNodes: nodes.length,
345
+ returnedEdges: edges.length,
346
+ omittedNodes: discovery.rows.length - consumed,
347
+ omittedEdges,
348
+ evidenceCount: evidence.length,
349
+ hasMore: hasMoreNodes
350
+ };
351
+ return {
352
+ root,
353
+ summary,
354
+ nodes,
355
+ edges,
356
+ evidence,
357
+ meta: {
358
+ exact: true,
359
+ truncated,
360
+ completeness: truncated ? "truncated" : "complete",
361
+ nodeLimit,
362
+ edgeLimit,
363
+ tokenBudget,
364
+ usedTokens,
365
+ visitedNodes: discovery.visitedNodes,
366
+ inspectedEdges: discovery.inspectedEdges,
367
+ omittedNodes: discovery.rows.length - consumed,
368
+ omittedEdges,
369
+ ...hasMoreNodes && lastNode ? {
370
+ nextCursor: encodeQueryCursor(fingerprint, lastNode.id, consumed - 1)
371
+ } : {}
372
+ }
373
+ };
374
+ }
375
+
376
+ // dist/sdk/dependencies.js
377
+ var DEPS_FORMAT_VALUES = ["tree", "graph", "context"];
378
+ var DEPS_COLLAPSE_VALUES = ["none", "repeated"];
379
+ var DEPS_DIRECTION_VALUES = ["outgoing", "incoming", "both"];
380
+ function parseFormat(raw) {
381
+ const candidate = raw?.trim().toLowerCase() ?? "tree";
382
+ if (DEPS_FORMAT_VALUES.includes(candidate)) {
383
+ return candidate;
384
+ }
385
+ throw new PmCliError(`Invalid --format value "${raw}". Use "tree", "graph", or "context".`, EXIT_CODE.USAGE);
386
+ }
387
+ function parsePositiveInteger(raw, flag) {
388
+ if (raw === void 0)
389
+ return void 0;
390
+ const value = typeof raw === "number" ? raw : Number(raw.trim());
391
+ if (!Number.isInteger(value) || value < 1)
392
+ throw new PmCliError(`Invalid --${flag} value "${raw}". Use a positive integer.`, EXIT_CODE.USAGE);
393
+ return value;
394
+ }
395
+ function parseMaxDepth(raw) {
396
+ if (raw === void 0) {
397
+ return void 0;
398
+ }
399
+ const normalized = typeof raw === "number" ? raw : Number(raw.trim());
400
+ if (!Number.isInteger(normalized) || normalized < 0) {
401
+ throw new PmCliError(`Invalid --max-depth value "${raw}". Use a non-negative integer.`, EXIT_CODE.USAGE);
402
+ }
403
+ return normalized;
404
+ }
405
+ function parseCollapse(raw) {
406
+ const candidate = raw?.trim().toLowerCase() ?? "none";
407
+ if (DEPS_COLLAPSE_VALUES.includes(candidate)) {
408
+ return candidate;
409
+ }
410
+ throw new PmCliError(`Invalid --collapse value "${raw}". Use "none" or "repeated".`, EXIT_CODE.USAGE);
411
+ }
412
+ function parseDirection(raw) {
413
+ const candidate = raw?.trim().toLowerCase() ?? "both";
414
+ if (DEPS_DIRECTION_VALUES.includes(candidate)) {
415
+ return candidate;
416
+ }
417
+ throw new PmCliError(`Invalid --direction value "${raw}". Use "outgoing", "incoming", or "both".`, EXIT_CODE.USAGE);
418
+ }
419
+ function parseKinds(raw) {
420
+ if (raw === void 0)
421
+ return void 0;
422
+ const registry = createRelationshipKindRegistry();
423
+ const values = (Array.isArray(raw) ? raw : [raw]).flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
424
+ if (values.length === 0)
425
+ return void 0;
426
+ const kinds = /* @__PURE__ */ new Set();
427
+ for (const value of values) {
428
+ const definition = registry.resolve(value);
429
+ if (!definition) {
430
+ const known = registry.list().map((entry) => entry.kind).join(", ");
431
+ throw new PmCliError(`Invalid --kind value "${value}". Registered kinds: ${known}.`, EXIT_CODE.USAGE);
432
+ }
433
+ kinds.add(definition.kind);
434
+ }
435
+ return [...kinds].sort();
436
+ }
437
+ function normalizeDependencies(dependencies) {
438
+ if (!dependencies || dependencies.length === 0) {
439
+ return [];
440
+ }
441
+ const sorted = dependencies.map(({ id, kind }) => ({
442
+ id: id.trim(),
443
+ kind: kind.trim().toLowerCase()
444
+ })).sort((left, right) => {
445
+ const byKind = left.kind.localeCompare(right.kind);
446
+ if (byKind !== 0)
447
+ return byKind;
448
+ return left.id.localeCompare(right.id);
449
+ });
450
+ const deduped = /* @__PURE__ */ new Map();
451
+ for (const dependency of sorted) {
452
+ const key = `${dependency.kind.toLowerCase()}::${dependency.id.toLowerCase()}`;
453
+ if (!deduped.has(key)) {
454
+ deduped.set(key, { id: dependency.id, kind: dependency.kind });
455
+ }
456
+ }
457
+ return [...deduped.values()];
458
+ }
459
+ function toIndexedItem(item) {
460
+ return {
461
+ id: item.id,
462
+ title: item.title,
463
+ type: item.type,
464
+ status: item.status,
465
+ dependencies: normalizeDependencies(item.dependencies)
466
+ };
467
+ }
468
+ function toTreeNode(id, index, lineage, maxDepth, collapse, expanded, depth = 0, via) {
469
+ const lookupId = id.trim().toLowerCase();
470
+ const item = index.get(lookupId);
471
+ const baseNode = {
472
+ id: item?.id ?? id,
473
+ title: item?.title,
474
+ type: item?.type,
475
+ status: item?.status,
476
+ via,
477
+ missing: !item,
478
+ cycle: lineage.has(lookupId),
479
+ dependencies: []
480
+ };
481
+ if (!item || baseNode.cycle) {
482
+ return baseNode;
483
+ }
484
+ if (maxDepth !== void 0 && depth >= maxDepth) {
485
+ if (item.dependencies.length > 0) {
486
+ baseNode.truncated = true;
487
+ }
488
+ return baseNode;
489
+ }
490
+ if (collapse === "repeated" && expanded.has(lookupId)) {
491
+ baseNode.collapsed = true;
492
+ return baseNode;
493
+ }
494
+ if (collapse === "repeated") {
495
+ expanded.add(lookupId);
496
+ }
497
+ const nextLineage = new Set(lineage);
498
+ nextLineage.add(lookupId);
499
+ baseNode.dependencies = item.dependencies.map((dependency) => toTreeNode(dependency.id, index, nextLineage, maxDepth, collapse, expanded, depth + 1, dependency.kind));
500
+ return baseNode;
501
+ }
502
+ function mergeGraphNode(existing, candidate) {
503
+ if (!existing) {
504
+ return candidate;
505
+ }
506
+ if (existing.missing && !candidate.missing)
507
+ return candidate;
508
+ return {
509
+ ...existing,
510
+ title: existing.title ?? candidate.title,
511
+ type: existing.type ?? candidate.type,
512
+ status: existing.status ?? candidate.status
513
+ };
514
+ }
515
+ function toGraph(root) {
516
+ const nodesById = /* @__PURE__ */ new Map();
517
+ const edgesByKey = /* @__PURE__ */ new Map();
518
+ const visit = (node) => {
519
+ nodesById.set(node.id, mergeGraphNode(nodesById.get(node.id), {
520
+ id: node.id,
521
+ title: node.title,
522
+ type: node.type,
523
+ status: node.status,
524
+ missing: node.missing
525
+ }));
526
+ for (const child of node.dependencies) {
527
+ nodesById.set(child.id, mergeGraphNode(nodesById.get(child.id), {
528
+ id: child.id,
529
+ title: child.title,
530
+ type: child.type,
531
+ status: child.status,
532
+ missing: child.missing
533
+ }));
534
+ const relationKind = child.via ?? "related";
535
+ const edgeKey = `${node.id}::${child.id}::${relationKind}`;
536
+ if (!edgesByKey.has(edgeKey)) {
537
+ edgesByKey.set(edgeKey, {
538
+ from: node.id,
539
+ to: child.id,
540
+ kind: relationKind
541
+ });
542
+ }
543
+ if (!child.cycle) {
544
+ visit(child);
545
+ }
546
+ }
547
+ };
548
+ visit(root);
549
+ const nodes = [...nodesById.values()].sort((left, right) => left.id.localeCompare(right.id));
550
+ const edges = [...edgesByKey.values()].sort((left, right) => {
551
+ const byFrom = left.from.localeCompare(right.from);
552
+ if (byFrom !== 0)
553
+ return byFrom;
554
+ const byTo = left.to.localeCompare(right.to);
555
+ if (byTo !== 0)
556
+ return byTo;
557
+ return left.kind.localeCompare(right.kind);
558
+ });
559
+ const missingIds = nodes.filter((node) => node.missing).map((node) => node.id);
560
+ return {
561
+ root_id: root.id,
562
+ nodes,
563
+ edges,
564
+ missing_ids: missingIds
565
+ };
566
+ }
567
+ function countDependencyGraph(rootId, index, maxDepth) {
568
+ const nodeIds = /* @__PURE__ */ new Set();
569
+ const edgeKeys = /* @__PURE__ */ new Set();
570
+ const missingIds = /* @__PURE__ */ new Set();
571
+ const expanded = /* @__PURE__ */ new Set();
572
+ const pending = [{ id: rootId, depth: 0 }];
573
+ let pendingIndex = 0;
574
+ while (pendingIndex < pending.length) {
575
+ const current = pending[pendingIndex++];
576
+ const lookupId = current.id.trim().toLowerCase();
577
+ nodeIds.add(lookupId);
578
+ const item = index.get(lookupId);
579
+ if (!item) {
580
+ missingIds.add(lookupId);
581
+ continue;
582
+ }
583
+ if (maxDepth !== void 0 && current.depth >= maxDepth) {
584
+ continue;
585
+ }
586
+ if (expanded.has(lookupId)) {
587
+ continue;
588
+ }
589
+ expanded.add(lookupId);
590
+ for (const dependency of item.dependencies) {
591
+ edgeKeys.add(`${lookupId}::${dependency.id.trim().toLowerCase()}::${dependency.kind}`);
592
+ pending.push({ id: dependency.id, depth: current.depth + 1 });
593
+ }
594
+ }
595
+ return {
596
+ node_count: nodeIds.size,
597
+ edge_count: edgeKeys.size,
598
+ missing_count: missingIds.size
599
+ };
600
+ }
601
+ function parseDepsContextOptions(options) {
602
+ const maxDepth = parseMaxDepth(options.maxDepth);
603
+ const nodeLimit = parsePositiveInteger(options.nodeLimit, "node-limit");
604
+ const edgeLimit = parsePositiveInteger(options.edgeLimit, "edge-limit");
605
+ const tokenBudget = parsePositiveInteger(options.tokenBudget, "token-budget");
606
+ const kinds = parseKinds(options.kind);
607
+ return {
608
+ direction: parseDirection(options.direction),
609
+ ...kinds === void 0 ? {} : { kinds },
610
+ ...maxDepth === void 0 ? {} : { maxDepth },
611
+ ...nodeLimit === void 0 ? {} : { nodeLimit },
612
+ ...edgeLimit === void 0 ? {} : { edgeLimit },
613
+ ...tokenBudget === void 0 ? {} : { tokenBudget },
614
+ ...options.cursor?.trim() ? { cursor: options.cursor.trim() } : {}
615
+ };
616
+ }
617
+ function buildContextFromAssembly(assembly, rootId, options, rootEvidence) {
618
+ return buildRelationshipContext(assembly.graph, rootId, assembly.details.map((detail) => detail.id === rootId && rootEvidence.length > 0 ? { ...detail, evidence: rootEvidence } : detail), options);
619
+ }
620
+ function buildDepsRelationshipContext(rootId, items, options, rootEvidence = []) {
621
+ return buildContextFromAssembly(assembleWorkspaceRelationshipGraph(items), rootId, parseDepsContextOptions(options), rootEvidence);
622
+ }
623
+ function appendEvidencePointers(evidence, label, values, limit) {
624
+ for (const value of values.slice(0, limit)) {
625
+ const trimmed = value?.trim();
626
+ if (trimmed)
627
+ evidence.push(`${label}:${trimmed}`);
628
+ }
629
+ }
630
+ async function collectRootEvidence(pmRoot, id, settings, typeToFolder) {
631
+ const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);
632
+ if (!located)
633
+ return [];
634
+ const { document } = await readLocatedItem(located, {
635
+ schema: settings.schema
636
+ });
637
+ const metadata = document.metadata;
638
+ const files = metadata.files ?? [];
639
+ const tests = metadata.tests ?? [];
640
+ const docs = metadata.docs ?? [];
641
+ const counts = [
642
+ ["files", files.length],
643
+ ["tests", tests.length],
644
+ ["docs", docs.length],
645
+ ["comments", (metadata.comments ?? []).length],
646
+ ["notes", (metadata.notes ?? []).length],
647
+ ["learnings", (metadata.learnings ?? []).length]
648
+ ];
649
+ if (counts.every(([, count]) => count === 0))
650
+ return [];
651
+ const evidence = [
652
+ `linked:${counts.map(([key, count]) => `${key}=${count}`).join(",")}`
653
+ ];
654
+ appendEvidencePointers(evidence, "file", files.map((file) => file.path), 3);
655
+ appendEvidencePointers(evidence, "test", tests.map((test) => test.command ?? test.path), 2);
656
+ appendEvidencePointers(evidence, "doc", docs.map((doc) => doc.path), 2);
657
+ return evidence;
658
+ }
659
+ function buildContextDepsResult(params) {
660
+ const { assembly, canonicalId, options, rootEvidence, summaryOnly } = params;
661
+ const contextOptions = parseDepsContextOptions(options);
662
+ const context = buildContextFromAssembly(assembly, canonicalId, contextOptions, rootEvidence);
663
+ const reachable = assembly.graph.closure(canonicalId, {
664
+ direction: contextOptions.direction,
665
+ ...contextOptions.kinds === void 0 ? {} : { kinds: contextOptions.kinds },
666
+ maxDepth: contextOptions.maxDepth ?? 3
667
+ });
668
+ const missingReachable = reachable.value.filter((nodeId) => assembly.missingIdSet.has(nodeId.toLowerCase()));
669
+ const missingReachableSet = new Set(missingReachable.map((nodeId) => nodeId.toLowerCase()));
670
+ const relationshipRegistry = createRelationshipKindRegistry();
671
+ const filteredKinds = contextOptions.kinds ? new Set(contextOptions.kinds.map((kind) => relationshipRegistry.require(kind).kind)) : void 0;
672
+ const packetIds = /* @__PURE__ */ new Set([canonicalId, ...reachable.value]);
673
+ const missingReferences = [
674
+ ...assembly.dangling.active,
675
+ ...assembly.dangling.legacy_terminal
676
+ ].filter((row) => {
677
+ if (row.no_active_blocker_sentinel || !missingReachableSet.has(row.target_id.trim().toLowerCase()) || !packetIds.has(row.holder_id))
678
+ return false;
679
+ if (filteredKinds === void 0)
680
+ return true;
681
+ const definition = relationshipRegistry.resolve(row.kind);
682
+ return definition !== void 0 && (filteredKinds.has(definition.kind) || definition.inverse !== void 0 && filteredKinds.has(definition.inverse));
683
+ });
684
+ const referenceLimit = contextOptions.edgeLimit ?? 40;
685
+ return {
686
+ id: canonicalId,
687
+ format: "context",
688
+ node_count: context.nodes.length + 1,
689
+ edge_count: context.edges.length,
690
+ missing_count: missingReachable.length,
691
+ missing_scope: "traversal",
692
+ missing_reference_count: missingReferences.length,
693
+ ...summaryOnly ? {} : {
694
+ missing_references: missingReferences.slice(0, referenceLimit),
695
+ context
696
+ }
697
+ };
698
+ }
699
+ async function runDeps(id, options, global) {
700
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
701
+ if (!await pathExists(getSettingsPath(pmRoot))) {
702
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
703
+ }
704
+ const format = parseFormat(options.format);
705
+ const maxDepth = parseMaxDepth(options.maxDepth);
706
+ const collapse = parseCollapse(options.collapse);
707
+ const summaryOnly = options.summary === true;
708
+ const settings = await readSettings(pmRoot);
709
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
710
+ const items = await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, void 0, settings.schema);
711
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
712
+ const index = new Map(items.map((item) => [item.id.trim().toLowerCase(), toIndexedItem(item)]));
713
+ const dangling = collectDanglingDependencyReferences(items, (status) => isTerminalStatus(status, statusRegistry));
714
+ for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {
715
+ const holder = index.get(reference.holder_id.trim().toLowerCase());
716
+ const referenceKind = reference.kind.trim().toLowerCase();
717
+ if (holder && !holder.dependencies.some((dependency) => dependency.id.trim().toLowerCase() === reference.target_id.trim().toLowerCase() && dependency.kind === referenceKind)) {
718
+ holder.dependencies.push({ id: reference.target_id, kind: referenceKind });
719
+ }
720
+ }
721
+ if (!index.has(id.trim().toLowerCase())) {
722
+ throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);
723
+ }
724
+ if (format === "context") {
725
+ const canonicalId = index.get(id.trim().toLowerCase()).id;
726
+ const rootEvidence = summaryOnly ? [] : await collectRootEvidence(pmRoot, canonicalId, settings, typeRegistry.type_to_folder);
727
+ const isTerminal = (status) => isTerminalStatus(status, statusRegistry);
728
+ const lookup = workspaceGraphCache().lookup(pmRoot, computeWorkspaceGraphFingerprint(items, isTerminal), () => assembleWorkspaceRelationshipGraph(items, isTerminal));
729
+ return buildContextDepsResult({
730
+ assembly: lookup.assembly,
731
+ canonicalId,
732
+ options,
733
+ rootEvidence,
734
+ summaryOnly
735
+ });
736
+ }
737
+ if (summaryOnly) {
738
+ return {
739
+ id,
740
+ format,
741
+ ...countDependencyGraph(id, index, maxDepth)
742
+ };
743
+ }
744
+ const tree = toTreeNode(id, index, /* @__PURE__ */ new Set(), maxDepth, collapse, /* @__PURE__ */ new Set());
745
+ const graph = toGraph(tree);
746
+ const baseResult = {
747
+ id,
748
+ format,
749
+ node_count: graph.nodes.length,
750
+ edge_count: graph.edges.length,
751
+ missing_count: graph.missing_ids.length
752
+ };
753
+ if (format === "tree") {
754
+ return {
755
+ ...baseResult,
756
+ tree
757
+ };
758
+ }
759
+ return {
760
+ ...baseResult,
761
+ graph
762
+ };
763
+ }
764
+
765
+ export {
766
+ computeWorkspaceGraphFingerprint,
767
+ WorkspaceGraphCache,
768
+ workspaceGraphCache,
769
+ resetWorkspaceGraphCache,
770
+ buildRelationshipContext,
771
+ DEPS_FORMAT_VALUES,
772
+ DEPS_COLLAPSE_VALUES,
773
+ DEPS_DIRECTION_VALUES,
774
+ parsePositiveInteger,
775
+ parseMaxDepth,
776
+ parseDirection,
777
+ parseKinds,
778
+ buildDepsRelationshipContext,
779
+ runDeps
780
+ };
781
+ //# sourceMappingURL=chunk-EX7OQT3Y.js.map
782
+
783
+ //# debugId=bc45de9b-3efd-5b0c-b660-483700eabaa9